You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add counts, HTML preview, and a run-scoped workflow mount (CL-8188) (#10)
Closes the Workbench gap check: GET /artifacts/counts tallies a
host-supplied predicate/segment map over a full tenant walk, GET
/artifacts/:id/preview serves a sandboxed text/html body with the same
locked-down CSP Workbench's artifacts-hub used, and
mountWorkflowArtifacts adds a parallel bearer-token-authenticated mount
(create / recent / get / binary create) for workflow-run callers that
have no browser session. Per-run rate limiting stays host-side.
(read-back — 404s a skill-draft or another tenant's row, same as `mountArtifacts`'
115
+
detail route), and `POST /artifacts/binary` (base64 `contentBase64` body, for a render
116
+
step that needs to persist bytes rather than text). Every route is behind
117
+
`resolveRunScope`; there is no unauthenticated case here the way collection reads have
118
+
one on the tenant-session mount, since a workflow run always presents credentials.
119
+
120
+
**Rate limiting is host-side.**`mountWorkflowArtifacts` mints no per-run quota — a host
121
+
that wants one wraps `resolveRunScope` (returning `null` to reject) or puts its own
122
+
middleware in front of the mounted app. `maxContentChars` (default 64,000) and
123
+
`maxBinaryBytes` (default `MAX_UPLOAD_BYTES`) are the two size ceilings this package
124
+
does own, since they protect the same storage `mountArtifacts` protects.
125
+
88
126
## The options
89
127
90
128
Three options have no sensible default; the rest fail closed and degrade a *feature*,
@@ -98,6 +136,7 @@ never safety.
98
136
|`decorate`| no | No-op — rows carry no decoration. Display-only by contract, so it can never change what is returned or who sees it. Clients resolve display names from `ownerPrincipalId` when they need them. |
99
137
|`onArtifactCreated`| no | No-op. Runs inside the same transaction as artifact creation, once per row — the seam a host uses to provision grants (e.g. a `creator`-origin grant on `artifact:<id>` for `write`/`archive`) for the row it just made. See `examples/reference-host`'s `grantOwnership` for a worked example against a real grant store. |
100
138
|`uploadPolicy`| no |`ARTIFACT_UPLOAD_POLICY` — the standard document/image/spreadsheet allowlist. |
139
+
|`countSegments`| no |`{}` — `GET /api/artifacts/counts` answers just `{ all }`. See [Counts](#counts). |
101
140
102
141
Who the request runs as is **not** an option: the host's auth/tenant middleware puts
103
142
`tenant` and `principal` on the `TenantEnv` context, and this package reads them. No
@@ -120,6 +159,8 @@ happen in major versions.
120
159
|`GET`/`POST /api/artifacts/:id/versions`| Version history (paginated, no content bodies) and revision |
0 commit comments