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
{{ message }}
Repository navigation
Commit d8c761b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@ There are three surfaces a host wires up, in the order a hub typically mounts th
21
21
22
22
Mounted under the hub's tenant prefix, alongside a host's other session-authenticated routes. It reads `principal`/`tenant` off the Hono context (placed there by the host's own auth + tenant middleware) and authorizes mutations through the host's `requireGrant` — built from Interchange's `createRequireGrant` over the host's own `GrantStore` and `ConditionRegistry`.
23
23
24
-
|`opts`| Type | What the host provides |
25
-
| --- | --- | --- |
26
-
|`db`|`ArtifactDb`| Artifacts are stored there. `createArtifactDb` opens a handle for a host with none; a hub that already has one passes it through. |
27
-
|`contentStore`|`ContentStore`| Blob storage for file bytes. `InlineContentStore` (exported by this package) fits a minimal host; bring your own store for object storage. |
28
-
|`requireGrant`|`RequireGrant`| The host's grant middleware factory. This package implements no ownership or membership policy of its own — every mutating single-artifact route is gated through it. |
29
-
|`countSegments`|`ArtifactCountSegments` (optional) | Named predicates over `ArtifactListRow` for `GET /artifacts/counts` (e.g. bucket by `kind`). The taxonomy is entirely host-owned; omitted, the route still answers with the tenant-wide `all` total. |
30
-
|`onArtifactCreated`, `decorate`, `uploadPolicy`| — (optional) | See [ARCHITECTURE.md](./ARCHITECTURE.md) for the grant-provisioning hook, the display-only row decorator, and the upload policy. |
|`db`|`ArtifactDb`| Artifacts are stored there. `createArtifactDb` opens a handle for a host with none; a hub that already has one passes it through.|
27
+
|`contentStore`|`ContentStore`| Blob storage for file bytes. `InlineContentStore` (exported by this package) fits a minimal host; bring your own store for object storage.|
28
+
|`requireGrant`|`RequireGrant`| The host's grant middleware factory. This package implements no ownership or membership policy of its own — every mutating single-artifact route is gated through it.|
29
+
|`countSegments`|`ArtifactCountSegments` (optional) | Named predicates over `ArtifactListRow` for `GET /artifacts/counts` (e.g. bucket by `kind`). The taxonomy is entirely host-owned; omitted, the route still answers with the tenant-wide `all` total. |
30
+
|`onArtifactCreated`, `decorate`, `uploadPolicy`| — (optional) | See [ARCHITECTURE.md](./ARCHITECTURE.md) for the grant-provisioning hook, the display-only row decorator, and the upload policy.|
31
31
32
32
```ts
33
33
importtype { Hono } from"hono";
@@ -57,7 +57,9 @@ export function mountArtifactRoutes(
@@ -66,12 +68,12 @@ export function mountArtifactRoutes(
66
68
67
69
A parallel mount for a workflow run, which has no browser session — only a bearer token and an `x-workflow-run-address` header. Mount it at its own path (`/api/workflow-artifacts` by convention; see the sidecar bundle below) rather than under the tenant prefix. `resolveRunScope` is the host's existing sidecar-token → run lookup; `agentToken` is a second, optional auth path so a deployed agent can present the bearer the hub minted for its own definition instead of the sidecar's token.
68
70
69
-
|`opts`| Type | What the host provides |
70
-
| --- | --- | --- |
71
-
|`db`, `contentStore`|`ArtifactDb`, `ContentStore`| Same as above. |
72
-
|`resolveRunScope`|`WorkflowRunResolver`|`(bearerToken, runAddress) => ResolvedWorkflowRunScope \| null`. Returning `null` answers 401 — this package makes no assumption about how a host issues or verifies its sidecar tokens. |
73
-
|`agentToken`|`AgentTokenAuth` (optional) |`{ verify(ctx), resolveRun(runAddress) }`. `verify` returns `undefined` for "not an agent token" (the sidecar path is tried instead) and refuses a bearer whose tenant doesn't match the resolved run's. |
|`db`, `contentStore`|`ArtifactDb`, `ContentStore`| Same as above.|
74
+
|`resolveRunScope`|`WorkflowRunResolver`|`(bearerToken, runAddress) => ResolvedWorkflowRunScope \| null`. Returning `null` answers 401 — this package makes no assumption about how a host issues or verifies its sidecar tokens.|
75
+
|`agentToken`|`AgentTokenAuth` (optional)|`{ verify(ctx), resolveRun(runAddress) }`. `verify` returns `undefined` for "not an agent token" (the sidecar path is tried instead) and refuses a bearer whose tenant doesn't match the resolved run's. |
76
+
|`uploadPolicy`, `maxBinaryBytes`, `maxContentChars`| — (optional) | Per-run ceilings; see [ARCHITECTURE.md](./ARCHITECTURE.md).|
0 commit comments