@aaac/runtime 0.1.54 → 0.2.0
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 +6 -11
- package/dist/adapters/adk-sdk.d.ts +3 -3
- package/dist/adapters/adk-sdk.js +6 -8
- package/dist/adapters/adk-sdk.js.map +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +3 -3
- package/dist/adapters/claude-agent-sdk.js +22 -23
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/mock.d.ts +2 -3
- package/dist/adapters/openai-agents-sdk.d.ts +3 -3
- package/dist/adapters/openai-agents-sdk.js +6 -5
- package/dist/adapters/openai-agents-sdk.js.map +1 -1
- package/dist/chunk-2INQL5TG.js +298 -0
- package/dist/chunk-2INQL5TG.js.map +1 -0
- package/dist/chunk-3CLWG72V.js +47 -0
- package/dist/chunk-3CLWG72V.js.map +1 -0
- package/dist/chunk-3DDB34BU.js +237 -0
- package/dist/chunk-3DDB34BU.js.map +1 -0
- package/dist/chunk-ABXDSTUV.js +685 -0
- package/dist/chunk-ABXDSTUV.js.map +1 -0
- package/dist/{chunk-3H3PVPPF.js → chunk-F5R46S7I.js} +151 -204
- package/dist/chunk-F5R46S7I.js.map +1 -0
- package/dist/chunk-FKAI54OM.js +234 -0
- package/dist/chunk-FKAI54OM.js.map +1 -0
- package/dist/chunk-KTVMMG33.js +1111 -0
- package/dist/chunk-KTVMMG33.js.map +1 -0
- package/dist/chunk-MSVIEEGR.js +269 -0
- package/dist/chunk-MSVIEEGR.js.map +1 -0
- package/dist/chunk-VJXGCWSZ.js +36 -0
- package/dist/chunk-VJXGCWSZ.js.map +1 -0
- package/dist/claude-bundles/full.js +311 -309
- package/dist/claude-bundles/lean.js +6 -6
- package/dist/claude-bundles/prompt.js +17 -0
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator/index.js +8 -7
- package/dist/guardrail-hooks-CB23nhZV.d.ts +202 -0
- package/dist/hook-protocol-CFnNudiV.d.ts +96 -0
- package/dist/hooks-lite-CoWWnCRH.d.ts +428 -0
- package/dist/index-BlSepCSZ.d.ts +296 -0
- package/dist/index.d.ts +785 -105
- package/dist/index.js +2235 -659
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +3 -26
- package/dist/lib/claude-native/hooks-lite.js +18 -36
- package/dist/lib/claude-native/hooks-prompt.d.ts +5 -0
- package/dist/lib/claude-native/hooks-prompt.js +33 -0
- package/dist/lib/claude-native/hooks-prompt.js.map +1 -0
- package/dist/lib/claude-native/index.d.ts +56 -214
- package/dist/lib/claude-native/index.js +79 -280
- package/dist/lib/claude-native/index.js.map +1 -1
- package/dist/{navigation-context-D_E1NIUf.d.ts → navigation-context-B-RpUg3_.d.ts} +1 -1
- package/dist/navigation-index-prompt-CbrS5laO.d.ts +43 -0
- package/dist/{task-runner-CLc8iTzy.d.ts → task-runner-GWoI7_71.d.ts} +100 -478
- package/dist/workspace-user-prompt-submit-D11Iu0zO.d.ts +269 -0
- package/package.json +15 -6
- package/dist/chunk-3H3PVPPF.js.map +0 -1
- package/dist/chunk-DBM5XN67.js +0 -354
- package/dist/chunk-DBM5XN67.js.map +0 -1
- package/dist/chunk-KXGUWBGK.js +0 -370
- package/dist/chunk-KXGUWBGK.js.map +0 -1
- package/dist/chunk-LDCQZPDG.js +0 -11
- package/dist/chunk-LDCQZPDG.js.map +0 -1
- package/dist/chunk-N4KNGDYY.js +0 -1963
- package/dist/chunk-N4KNGDYY.js.map +0 -1
- package/dist/chunk-NMX4C6LC.js +0 -332
- package/dist/chunk-NMX4C6LC.js.map +0 -1
- package/dist/chunk-QVH5KKBR.js +0 -374
- package/dist/chunk-QVH5KKBR.js.map +0 -1
- package/dist/context-DKkamYX_.d.ts +0 -31
- package/dist/guardrail-hooks-slK-z0Dz.d.ts +0 -83
- package/dist/index-LqEvaRk-.d.ts +0 -299
- package/dist/workspace-pre-tool-use-C6nidc0q.d.ts +0 -333
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { d as GuardrailAction } from './guardrail-hooks-CB23nhZV.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generator configuration — loads and validates the project manifest
|
|
6
|
+
* (`PROJECT_CONFIG_FILENAME` below).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Project manifest filename — resolved under a project root, and under each
|
|
11
|
+
* workspace member root. Single definition for the whole runtime package.
|
|
12
|
+
*/
|
|
13
|
+
declare const PROJECT_CONFIG_FILENAME = "project.yaml";
|
|
14
|
+
/**
|
|
15
|
+
* The runtime section of the project manifest: the keys `loadProjectConfig`
|
|
16
|
+
* parses and carries onto `ResolvedConfig`.
|
|
17
|
+
*
|
|
18
|
+
* Every key here MUST reach a runtime consumer. A key that parses but changes
|
|
19
|
+
* nothing is a declaration a consumer can set with no effect and no error —
|
|
20
|
+
* `packages/runtime/__tests__/project-manifest-consumers.test.ts` gates that.
|
|
21
|
+
*/
|
|
22
|
+
declare const RuntimeConfigSchema: z.ZodObject<{
|
|
23
|
+
dsl: z.ZodDefault<z.ZodString>;
|
|
24
|
+
bindings: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
25
|
+
active_guardrail_policy: z.ZodOptional<z.ZodString>;
|
|
26
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
27
|
+
recovery: z.ZodDefault<z.ZodObject<{
|
|
28
|
+
max_follow_ups: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
model_mapping: z.ZodDefault<z.ZodObject<{
|
|
32
|
+
fast: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
adapter: z.ZodString;
|
|
34
|
+
model: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
adapter: z.ZodString;
|
|
38
|
+
model: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
thinking: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
adapter: z.ZodString;
|
|
42
|
+
model: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
logging: z.ZodDefault<z.ZodObject<{
|
|
46
|
+
progress_log: z.ZodDefault<z.ZodObject<{
|
|
47
|
+
destination: z.ZodDefault<z.ZodEnum<{
|
|
48
|
+
file: "file";
|
|
49
|
+
both: "both";
|
|
50
|
+
stderr: "stderr";
|
|
51
|
+
none: "none";
|
|
52
|
+
}>>;
|
|
53
|
+
file: z.ZodOptional<z.ZodString>;
|
|
54
|
+
naming: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
single: "single";
|
|
56
|
+
"per-invocation": "per-invocation";
|
|
57
|
+
daily: "daily";
|
|
58
|
+
}>>;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
|
|
63
|
+
/** Progress-log settings as consumed by `executeTask` / `executeWorkflow`. */
|
|
64
|
+
type ProgressLogConfig = RuntimeConfig["logging"]["progress_log"];
|
|
65
|
+
/**
|
|
66
|
+
* The project manifest document — the complete declaration of `project.yaml`,
|
|
67
|
+
* and the only schema that parses its text (`loadProjectConfig`,
|
|
68
|
+
* `loadWorkspaceMembers`).
|
|
69
|
+
*
|
|
70
|
+
* ## Unknown keys are rejected, at every level
|
|
71
|
+
*
|
|
72
|
+
* Every object reachable from here is `.strict()` — this root, the sections
|
|
73
|
+
* `@aaac/contracts` declares (`bindings`, `environments`, `model_mapping`) and
|
|
74
|
+
* the ones declared above (`recovery`, `logging`, `workspace`). A key the
|
|
75
|
+
* manifest does not declare is a typo or a key that was retired, and both must
|
|
76
|
+
* stop the load rather than be dropped on the floor: a declaration that parses
|
|
77
|
+
* and changes nothing is the defect #290, #298 and #307 were spent removing,
|
|
78
|
+
* and stripping is what let it hide.
|
|
79
|
+
*
|
|
80
|
+
* One rule for the whole document, not per level: strictness used to sit on
|
|
81
|
+
* two levels alone, so the same key hard-failed there and was silently ignored
|
|
82
|
+
* everywhere else — leaving consumers no way to tell from the schema whether a
|
|
83
|
+
* key they set had any effect (#306).
|
|
84
|
+
*
|
|
85
|
+
* `packages/runtime/__tests__/config.test.ts` walks this declaration and fails
|
|
86
|
+
* on any object that accepts undeclared keys, so a level added later cannot
|
|
87
|
+
* reopen the gap. The one deliberate exception is a partial VIEW of this
|
|
88
|
+
* document — `InitProjectConfigSchema` / `ModelMappingProjectConfigSchema` in
|
|
89
|
+
* `@aaac/contracts`, which read a subset of the root and so cannot reject the
|
|
90
|
+
* rest; each says so at its declaration.
|
|
91
|
+
*/
|
|
92
|
+
declare const ProjectConfigSchema: z.ZodObject<{
|
|
93
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
94
|
+
agents: z.ZodOptional<z.ZodString>;
|
|
95
|
+
dsl: z.ZodOptional<z.ZodString>;
|
|
96
|
+
bindings: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
guardrail: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
|
+
hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
|
+
observability: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
event_mapping: z.ZodOptional<z.ZodString>;
|
|
101
|
+
recorder: z.ZodOptional<z.ZodString>;
|
|
102
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
db_path: z.ZodOptional<z.ZodString>;
|
|
104
|
+
otel: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
endpoint: z.ZodString;
|
|
106
|
+
}, z.core.$strict>>;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
active_guardrail_policy: z.ZodOptional<z.ZodString>;
|
|
110
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
+
recovery: z.ZodDefault<z.ZodObject<{
|
|
112
|
+
max_follow_ups: z.ZodDefault<z.ZodNumber>;
|
|
113
|
+
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
114
|
+
}, z.core.$strict>>;
|
|
115
|
+
model_mapping: z.ZodDefault<z.ZodObject<{
|
|
116
|
+
fast: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
adapter: z.ZodString;
|
|
118
|
+
model: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strict>>;
|
|
120
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
adapter: z.ZodString;
|
|
122
|
+
model: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
thinking: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
adapter: z.ZodString;
|
|
126
|
+
model: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>>;
|
|
128
|
+
}, z.core.$strict>>;
|
|
129
|
+
logging: z.ZodDefault<z.ZodObject<{
|
|
130
|
+
progress_log: z.ZodDefault<z.ZodObject<{
|
|
131
|
+
destination: z.ZodDefault<z.ZodEnum<{
|
|
132
|
+
file: "file";
|
|
133
|
+
both: "both";
|
|
134
|
+
stderr: "stderr";
|
|
135
|
+
none: "none";
|
|
136
|
+
}>>;
|
|
137
|
+
file: z.ZodOptional<z.ZodString>;
|
|
138
|
+
naming: z.ZodDefault<z.ZodEnum<{
|
|
139
|
+
single: "single";
|
|
140
|
+
"per-invocation": "per-invocation";
|
|
141
|
+
daily: "daily";
|
|
142
|
+
}>>;
|
|
143
|
+
}, z.core.$strict>>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
artifacts: z.ZodOptional<z.ZodString>;
|
|
146
|
+
toolchains: z.ZodOptional<z.ZodString>;
|
|
147
|
+
environments: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
git: z.ZodOptional<z.ZodObject<{
|
|
149
|
+
hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
cursor: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
hooks_json: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strict>>;
|
|
154
|
+
}, z.core.$strict>>;
|
|
155
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
members: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
157
|
+
path: z.ZodString;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
glob: z.ZodString;
|
|
160
|
+
}, z.core.$strict>]>>;
|
|
161
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
resolve_from: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strict>>;
|
|
164
|
+
discovery: z.ZodDefault<z.ZodObject<{
|
|
165
|
+
max_depth: z.ZodDefault<z.ZodNumber>;
|
|
166
|
+
}, z.core.$strict>>;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
170
|
+
/**
|
|
171
|
+
* Read a project.yaml as the document {@link ProjectConfigSchema} declares it —
|
|
172
|
+
* the sole path from manifest text to a `ProjectConfig`, here and outside this
|
|
173
|
+
* package.
|
|
174
|
+
*
|
|
175
|
+
* It is one function rather than a `YAML.parse` each reader hands to the schema
|
|
176
|
+
* because the parse IS the interpretation: a caller that does its own reaches
|
|
177
|
+
* every section by plucking a key off an untyped object, which is how
|
|
178
|
+
* `recovery` and `logging` came to be read outside the declaration that owns
|
|
179
|
+
* them (#312) — silently keeping their old shape when the declaration moved.
|
|
180
|
+
* Three readers here spelled it out separately before, so widening the document
|
|
181
|
+
* meant remembering all three.
|
|
182
|
+
*
|
|
183
|
+
* Synchronous because a manifest is one small file read once, and because the
|
|
184
|
+
* section readers this sits beside (`readProjectModelMapping` in
|
|
185
|
+
* `@aaac/contracts`, `findProjectConfig`) already are: a second, asynchronous
|
|
186
|
+
* spelling for the callers that cannot await is the duplication this removes.
|
|
187
|
+
*
|
|
188
|
+
* A manifest that is missing, unparseable, or that the declaration rejects
|
|
189
|
+
* raises. Degrading would let a run proceed on a configuration nobody declared,
|
|
190
|
+
* which is the divergence the single declaration exists to remove.
|
|
191
|
+
*/
|
|
192
|
+
declare function readProjectManifest(configPath: string): ProjectConfig;
|
|
193
|
+
/**
|
|
194
|
+
* The same reading, for manifest text that did not come from a file — the step
|
|
195
|
+
* {@link readProjectManifest} is built on, so there is still one interpretation
|
|
196
|
+
* and not two.
|
|
197
|
+
*
|
|
198
|
+
* It exists because a manifest is not only ever a file: `check-doc-examples.mjs`
|
|
199
|
+
* holds the examples in `README.md` and `docs/**` to this declaration, and they
|
|
200
|
+
* live inside a fenced block. Without this it would have to reach the schema
|
|
201
|
+
* through its own `YAML.parse` — precisely the second interpretation
|
|
202
|
+
* `check-manifest-readers.mjs` exists to refuse, and the one whose absence let
|
|
203
|
+
* the `bindings` examples keep a shape the schema had dropped (#288, #306,
|
|
204
|
+
* #319). `@aaac/contracts` already draws the same line for the component
|
|
205
|
+
* document, where `parseComponentFile` is `readFile` plus
|
|
206
|
+
* `parseComponentString`.
|
|
207
|
+
*
|
|
208
|
+
* Text that is not YAML, or that the declaration rejects, raises — the caller
|
|
209
|
+
* learns which, and neither is degraded to a default.
|
|
210
|
+
*/
|
|
211
|
+
declare function parseProjectManifest(text: string): ProjectConfig;
|
|
212
|
+
interface ResolvedObservability {
|
|
213
|
+
eventMappingPath?: string;
|
|
214
|
+
recorder?: string;
|
|
215
|
+
/** Whether in-process agent-axis recording is enabled (default true when binding present). */
|
|
216
|
+
enabled?: boolean;
|
|
217
|
+
/** Resolved override for the SQLite DB path (undefined → DEFAULT_DB_PATH). */
|
|
218
|
+
dbPath?: string;
|
|
219
|
+
/**
|
|
220
|
+
* OTel Collector endpoint configuration.
|
|
221
|
+
* When present, OtelEmitter is configured with this endpoint at pipeline creation.
|
|
222
|
+
* Falls back to OTEL_EXPORTER_OTLP_ENDPOINT env var when absent.
|
|
223
|
+
*/
|
|
224
|
+
otel?: {
|
|
225
|
+
endpoint: string;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
interface ResolvedConfig extends RuntimeConfig {
|
|
229
|
+
dslPath: string;
|
|
230
|
+
/**
|
|
231
|
+
* True when the manifest EXPLICITLY declares `agents:` / `dsl:`. When false,
|
|
232
|
+
* `dslPath` is only the `RuntimeConfigSchema` default
|
|
233
|
+
* (`./agent-contracts.yaml`) and must NOT be treated as a project overlay —
|
|
234
|
+
* the bundled `/$embedded/` DSL is used as-is.
|
|
235
|
+
*/
|
|
236
|
+
dslDeclared: boolean;
|
|
237
|
+
/** Resolved guardrail_impl matcher files (machine enforcement). */
|
|
238
|
+
bindingPaths: string[];
|
|
239
|
+
/** Observability event mapping + recorder, if configured. */
|
|
240
|
+
observability?: ResolvedObservability;
|
|
241
|
+
artifactsPath?: string;
|
|
242
|
+
toolchainsPath?: string;
|
|
243
|
+
}
|
|
244
|
+
declare function loadProjectConfig(configPath: string): Promise<ResolvedConfig>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Build the guardrail context from resolved DSL + binding data.
|
|
248
|
+
*
|
|
249
|
+
* (The DSL→TypeScript codegen context builder, `buildContractContext`, was
|
|
250
|
+
* removed alongside the runtime `generate()` codegen path.)
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
interface GuardrailCheckEntry {
|
|
254
|
+
guardrail_id: string;
|
|
255
|
+
description: string;
|
|
256
|
+
severity: string;
|
|
257
|
+
action: GuardrailAction;
|
|
258
|
+
matcher_type: string;
|
|
259
|
+
pattern: string;
|
|
260
|
+
message: string;
|
|
261
|
+
file_glob?: string;
|
|
262
|
+
exclude_glob?: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A finding about the guardrail configuration itself (not about a command).
|
|
266
|
+
*
|
|
267
|
+
* Shaped to `NavigationContext["diagnostics"]` so the SessionStart hook renders
|
|
268
|
+
* it (lib/claude-native/ensure-navigation-index.ts) and `ResolvedComponent`
|
|
269
|
+
* carries it, without a second diagnostic type.
|
|
270
|
+
*/
|
|
271
|
+
interface GuardrailDiagnostic {
|
|
272
|
+
path: string;
|
|
273
|
+
message: string;
|
|
274
|
+
severity: string;
|
|
275
|
+
}
|
|
276
|
+
interface GuardrailContext {
|
|
277
|
+
commandChecks: GuardrailCheckEntry[];
|
|
278
|
+
fileChecks: GuardrailCheckEntry[];
|
|
279
|
+
contentChecks: GuardrailCheckEntry[];
|
|
280
|
+
allChecks: GuardrailCheckEntry[];
|
|
281
|
+
hasGuardrails: boolean;
|
|
282
|
+
/** Findings about the guardrail configuration — see GuardrailDiagnostic. */
|
|
283
|
+
diagnostics: GuardrailDiagnostic[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build guardrail context from DSL guardrails, binding guardrail_impl, and active policy.
|
|
287
|
+
* Mirrors the agent-contracts resolveChecks pattern.
|
|
288
|
+
*
|
|
289
|
+
* A check's `severity`/`action` come from the active policy's rule and from
|
|
290
|
+
* nowhere else. When the policy declares none, the check is registered as
|
|
291
|
+
* `unresolved` — which denies (lib/guardrail-hooks.ts) — and the reason is both
|
|
292
|
+
* reported as a diagnostic and carried in the check's message.
|
|
293
|
+
*/
|
|
294
|
+
declare function buildGuardrailContext(dsl: any, binding: any, policyName?: string): GuardrailContext;
|
|
295
|
+
|
|
296
|
+
export { type GuardrailContext as G, type ProgressLogConfig as P, type ResolvedConfig as R, type GuardrailDiagnostic as a, PROJECT_CONFIG_FILENAME as b, type GuardrailCheckEntry as c, type ProjectConfig as d, ProjectConfigSchema as e, buildGuardrailContext as f, loadProjectConfig as l, parseProjectManifest as p, readProjectManifest as r };
|