@aid-framework/generator-ts-vercel 0.1.39 → 0.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -163
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,164 +1,123 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
The
|
|
4
|
-
[`@aid-framework/runtime`](
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| Declared | Honoured by |
|
|
1
|
+
# `@aid-framework/generator-ts-vercel`
|
|
2
|
+
|
|
3
|
+
The TypeScript / Vercel target for [AID Framework](https://github.com/aid-framework/aid-framework). It compiles an
|
|
4
|
+
IR into a Next.js app whose behaviour lives in [`@aid-framework/runtime`](https://www.npmjs.com/package/@aid-framework/runtime),
|
|
5
|
+
with a `business/` tier the compiler creates once and never touches again.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
app.spec.yaml ──aid gen --target ts-vercel──▶ app/generated/ (compiler)
|
|
9
|
+
app/business/ (you)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install --save-dev @aid-framework/generator-ts-vercel
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Requires Node.js 24 or newer. In practice you pull it in through
|
|
19
|
+
[`@aid-framework/cli`](https://www.npmjs.com/package/@aid-framework/cli).
|
|
20
|
+
|
|
21
|
+
## Use it
|
|
22
|
+
|
|
23
|
+
A spec generates one target at a time, so a project that ships both stacks declares both:
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
project:
|
|
27
|
+
name: support-copilot
|
|
28
|
+
targets:
|
|
29
|
+
- py-fastapi
|
|
30
|
+
- ts-vercel
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx aid gen --target ts-vercel
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
ts-vercel: 20 created, 0 updated, 0 unchanged, 0 kept
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`--target` selects among the targets the spec declares. Naming an undeclared one fails with `target-unsupported`
|
|
42
|
+
and lists what is declared, because generating a stack the spec never asked for would make the spec a lie.
|
|
43
|
+
|
|
44
|
+
## What it emits
|
|
45
|
+
|
|
46
|
+
| Path | Contents |
|
|
49
47
|
| --- | --- |
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
|
|
57
|
-
`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
##
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Next is the **deployment target**, not a dependency of this repository. `next` pulls `caniuse-lite`, which is
|
|
127
|
-
CC-BY-4.0, and [`scripts/check-licenses.mjs`](../../../scripts/check-licenses.mjs) allows only
|
|
128
|
-
0BSD/Apache-2.0/BlueOak/BSD/CC0-1.0/ISC/MIT/MIT-0/MPL-2.0/Python-2.0/PSF-2.0/Unlicense/WTFPL. Adding Next would
|
|
129
|
-
mean weakening the license allowlist, which this layer does not do. The example therefore ships
|
|
130
|
-
`tests/server.ts`, a Node host that speaks the same Fetch-shaped contract as the emitted handler and looks up the
|
|
131
|
-
same `ROUTE` constant, so the end-to-end job can boot generated code and hit a real socket without a Next install.
|
|
132
|
-
|
|
133
|
-
**Determinism** ([`§8.2`](../../../docs/design.md)): output is path-sorted, LF-only, with one trailing newline, no
|
|
134
|
-
timestamps, no absolute paths and no machine names. `checkDeterminism` in the generator SDK is the lint that holds
|
|
135
|
-
this; a test in this package plans the example twice and compares bytes.
|
|
136
|
-
|
|
137
|
-
**Prompt templates** are the one place the two runtimes disagree about syntax: the IR stores `{{ name }}` mustaches
|
|
138
|
-
and the TypeScript runtime parses `str.format`-style `{name}` fields. `src/placeholders.ts` performs that
|
|
139
|
-
conversion once, `validate.ts` refuses a template the runtime cannot interpolate, and the emitter never re-indents
|
|
140
|
-
template content.
|
|
141
|
-
|
|
142
|
-
**Not responsible for:** runtime behaviour — the gateway, prompt registry, tool executor, tracing, retrieval, the
|
|
143
|
-
eval harness and the baseline statistics all live in [`runtimes/typescript/`](../../../runtimes/typescript/).
|
|
144
|
-
|
|
145
|
-
**Status:** implemented for the Phase 1 scope and reachable as `aid gen --target ts-vercel` through the two-entry
|
|
146
|
-
registry in [`packages/cli/src/targets.ts`](../../cli/src/targets.ts). `py-fastapi` remains the default target.
|
|
147
|
-
|
|
148
|
-
**Scope boundary:** the generator rejects what it cannot express rather than emitting something broken
|
|
149
|
-
([`§4`](../../../docs/design.md), capability negotiation) — `cursor-memory`, guardrails, multi-step agent loops,
|
|
150
|
-
streaming bodies, `llm-judge` as a required CI gate, latency and cost budgets, eval metrics selected by field or
|
|
151
|
-
value, non-`http` triggers, retriever `filters` and non-file sources. Each refusal has a plan diagnostic code.
|
|
152
|
-
|
|
153
|
-
**Tests:** `test/golden.test.ts` (the example's committed tree *is* the golden fixture), `test/drift.test.ts`
|
|
154
|
-
(regeneration safety across both tiers), `test/target.test.ts` (manifest, capability discipline, IR-only purity,
|
|
155
|
-
layout), `test/text.test.ts` (the byte-level helpers, including the linear edge trim every emitter shares) and
|
|
156
|
-
[`packages/cli/test/targets.test.ts`](../../cli/test/targets.test.ts) (the registry cross-check). The
|
|
157
|
-
example app is in [`examples/support-copilot-ts/`](../../../examples/support-copilot-ts/), and the end-to-end job
|
|
158
|
-
runs `pnpm e2e:ts` after the Python example's `pnpm e2e` in the same `e2e` job, then the example's own suite
|
|
159
|
-
(`pnpm --filter support-copilot-ts-example test`), which the root `vitest` run does not collect and whose 7 passing
|
|
160
|
-
tests are pinned by `examples/support-copilot-ts/scripts/run-tests.mjs`.
|
|
161
|
-
|
|
162
|
-
Reference: [`docs/design.md` §8](../../../docs/design.md) (generator plugin model),
|
|
163
|
-
[`§9`](../../../docs/design.md) (runtime libraries), [`§6.1`](../../../docs/design.md) (example spec),
|
|
164
|
-
[`§12`](../../../docs/design.md) (testing), [`§14`](../../../docs/design.md) (roadmap).
|
|
48
|
+
| `app/generated/index.ts` | The package's public surface |
|
|
49
|
+
| `app/generated/deps.ts` | Wiring: gateway, registry, executor, pipelines |
|
|
50
|
+
| `app/generated/control.ts` | The composite-step helpers the pipelines use |
|
|
51
|
+
| `app/generated/schemas.ts` | zod schemas derived from the IR's `types` |
|
|
52
|
+
| `app/generated/gateway/models.ts` | `ModelSpec` values and pinned aliases from the IR |
|
|
53
|
+
| `app/generated/observability.ts` | Tracer setup |
|
|
54
|
+
| `app/generated/guardrails.ts` | The guardrail policies the IR declares |
|
|
55
|
+
| `app/generated/contracts/` | The interface each business module must satisfy |
|
|
56
|
+
| `app/generated/pipelines/` | One module per pipeline, as ordinary async code |
|
|
57
|
+
| `app/generated/prompts/` | The registry the IR's prompts resolve into |
|
|
58
|
+
| `app/generated/tools/` | Tool definitions and dispatch |
|
|
59
|
+
| `app/generated/evals/` | The eval dataset and gate thresholds |
|
|
60
|
+
| `app/generated/retrieval/` | Retriever bindings, plus `ingest/` for corpus indexing |
|
|
61
|
+
| `app/generated/routes/` | Request handlers for pipelines with an `http` trigger |
|
|
62
|
+
| `app/business/`, `app/business/prompts/`, `app/business/tools/` | Your seam — created once, then never touched |
|
|
63
|
+
|
|
64
|
+
The exact file set follows the spec: a spec that declares no retrievers emits no `retrieval/` modules.
|
|
65
|
+
|
|
66
|
+
### A note on `app/`
|
|
67
|
+
|
|
68
|
+
The output root is `app/`, which is also Next.js's own directory convention. That collision is deliberate and
|
|
69
|
+
accepted for parity with the other target's layout: the generated tree sits at the project's `app/`, alongside
|
|
70
|
+
whatever Next puts there. If you already have a Next project at that root, generate into a fresh directory rather
|
|
71
|
+
than merging the two.
|
|
72
|
+
|
|
73
|
+
## Capabilities
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
http-trigger, json-schema, tool-calling, otel,
|
|
77
|
+
embeddings, rerank, guardrails, agents, cursor-memory
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
It emits against **zod** for structured output and **`otel-genai`** for tracing.
|
|
81
|
+
|
|
82
|
+
Note the absence of `streaming`: this target does not declare it, so the IR's `deploy/streaming` gate rejects a
|
|
83
|
+
spec that asks for a streaming deployment here rather than emitting an endpoint that cannot stream.
|
|
84
|
+
|
|
85
|
+
## The `business/` seam
|
|
86
|
+
|
|
87
|
+
Everything in `generated/` is replaced on the next `aid gen`. `business/` is created only if missing and is never
|
|
88
|
+
written again — that is where prompts, tool handlers and domain logic belong.
|
|
89
|
+
|
|
90
|
+
`app/generated/contracts/` carries the interfaces the business modules implement, so a missing or misnamed export
|
|
91
|
+
is a type error at build time instead of a runtime surprise.
|
|
92
|
+
|
|
93
|
+
## Determinism
|
|
94
|
+
|
|
95
|
+
Given the same IR, this generator produces byte-identical output — no timestamps, no absolute paths, no host
|
|
96
|
+
names, and import order derived from stable ids rather than from filesystem walk order. That makes `generated/`
|
|
97
|
+
diffable and keeps a regeneration from producing a diff it did not mean.
|
|
98
|
+
|
|
99
|
+
## Programmatic use
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { manifest, plan } from '@aid-framework/generator-ts-vercel';
|
|
103
|
+
import type { Generator } from '@aid-framework/generator-sdk';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The generator satisfies the `Generator` contract from
|
|
107
|
+
[`@aid-framework/generator-sdk`](https://www.npmjs.com/package/@aid-framework/generator-sdk): `plan(ir)` is pure
|
|
108
|
+
and `emit(plan)` returns the file set. Ownership, drift detection and manifest writing are the SDK's, so this
|
|
109
|
+
package contains no regeneration logic of its own.
|
|
110
|
+
|
|
111
|
+
## Related packages
|
|
112
|
+
|
|
113
|
+
- [`@aid-framework/runtime`](https://www.npmjs.com/package/@aid-framework/runtime) — the runtime the emitted code
|
|
114
|
+
imports
|
|
115
|
+
- [`aid-runtime-python`](https://pypi.org/project/aid-runtime-python/) — the Python runtime
|
|
116
|
+
- [`@aid-framework/generator-py-fastapi`](https://www.npmjs.com/package/@aid-framework/generator-py-fastapi) — the
|
|
117
|
+
Python target
|
|
118
|
+
- [`@aid-framework/cli`](https://www.npmjs.com/package/@aid-framework/cli) — `aid`
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
[Apache-2.0](https://github.com/aid-framework/aid-framework/blob/main/LICENSE). Code generated by AID Framework is
|
|
123
|
+
not subject to this license.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aid-framework/generator-ts-vercel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "AID generator for a Next.js App Router (Vercel) TypeScript target.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aid-framework/generator-sdk": "0.1.
|
|
33
|
-
"@aid-framework/ir": "0.1.
|
|
32
|
+
"@aid-framework/generator-sdk": "0.1.48",
|
|
33
|
+
"@aid-framework/ir": "0.1.48"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@aid-framework/spec": "0.1.
|
|
36
|
+
"@aid-framework/spec": "0.1.48",
|
|
37
37
|
"@types/node": "^26.6.5"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|