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
Discover and validate src/providers modules, then execute their sorted factories per request before runAgentRequest while composing with generated state and notice bindings. Register AB4940-AB4942 and preserve byte-identical generated worker output when no providers are present.
|`AB4818`| error |`src/state.ts` is present but does not default-export one direct `defineState({ ... })` call, or `state` config is not the supported `false` opt-out. |
234
234
|`AB4819`| error | The state definition's `id` or `lifetime` is missing, non-literal, empty, duplicated, or outside the state lifetime vocabulary. |
235
235
|`AB4820`| error | A generated project selects `external` state lifetime; v1 generated mounting supports only `request`, `process`, and `workspace-durable` because external drivers require embedder wiring. |
236
+
|`AB4940`| error | A conventional provider module has no default export or its default export is not a function. Default-export a factory receiving `{ invocation, signal }`. |
237
+
|`AB4941`| error | Two provider filenames derive the same camel-cased provider key. Rename one file so every provider key is unique. |
238
+
|`AB4942`| error | A provider filename derives the reserved `processLifetime` key. Rename the file so its camel-cased key does not collide with the framework-owned provider. |
Copy file name to clipboardExpand all lines: docs/entry-conventions.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ entries carry `provenance.kind: 'conventional'` in the normalized model.
63
63
|`src/scripts/<name>.tsx`| Rendered script: the async default component receives `{ argv, signal }` and renders through the Agent renderer with the CLI output contract (`--json`, `--ndjson`, TTY progress, piped Markdown). Compiles to `scripts/<name>.mjs` plus a `scripts/<name>-flight.mjs` react-server worker. The extension is the explicit, visible contract — plain `.ts` scripts are never wrapped in React behavior, and explicit `scripts` config entries stay plain regardless of extension. | Rename to `.ts`, prefix a path segment with `_`, or claim the file with an explicit `scripts` entry |
64
64
|`src/cli/**/*.{ts,tsx}`| Routed CLI commands compiled into one collision-checked command graph and one generated package executable named after `plugin.name` (superseding the `src/cli.ts` bin convention for the project). Nesting is identity: `src/cli/library/audit.ts` runs as `<bin> library audit`. Plain `.ts` commands execute directly and print one canonical JSON line; `.tsx` commands render through the dispatcher with the four output modes. |`bin: false`, `routes.cli: 'conventional'`, or prefix a path segment with `_`|
65
65
|`src/state.ts`| Project state definition: default-exports `defineState({ ... })`; generated MCP, routed-CLI, and rendered-script request scopes mount `(await agent()).state` and `.notices`. |`state: false`, or rename the file to `_state.ts`|
66
+
|`src/providers/<name>.{ts,tsx}`| Request context provider: default-exports a factory receiving `{ invocation, signal }`; its value is mounted at `(await agent()).providers.<camelCaseName>` for generated MCP and event routes. | Prefix the file with `_`|
66
67
67
68
Route and package entry conventions match `.ts` and `.tsx` files exactly;
68
69
the state convention is specifically `src/state.ts`.
@@ -86,6 +87,23 @@ directory. Routed CLI bins and rendered scripts use
86
87
in generated mounting v1 (`authorized`); recipient/principal matching remains
87
88
enforced by the ledger, while application authorization policy is deferred.
88
89
90
+
### Request context providers (power tier)
91
+
92
+
Each direct child of `src/providers/` derives its key by camel-casing the file
93
+
stem: for example, `src/providers/project-auth.ts` mounts at
94
+
`(await agent()).providers.projectAuth`. Every module default-exports a factory
95
+
with the contract `(context: { invocation, signal }) => value |
96
+
Promise<value>`, where `invocation` is the current route invocation and
97
+
`signal` is its request abort signal.
98
+
99
+
The generated shared Flight worker executes providers once per request,
100
+
sequentially in deterministic key order, before entering `runAgentRequest`.
101
+
The returned values join the request's provider map. A thrown or rejected
102
+
factory fails the request closed; expected degradation should return an honest
103
+
unavailable-shaped value instead of throwing. `processLifetime` is reserved
104
+
for the framework-owned process identity and hit counter, so provider filenames
0 commit comments