@aionis/manifest 0.1.1
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/CHANGELOG.md +26 -0
- package/LICENSE +178 -0
- package/README.md +170 -0
- package/dist/ast/types.d.ts +34 -0
- package/dist/ast/types.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +122 -0
- package/dist/compile.d.ts +14 -0
- package/dist/compile.js +219 -0
- package/dist/contracts.d.ts +12610 -0
- package/dist/contracts.js +401 -0
- package/dist/diagnostics/types.d.ts +17 -0
- package/dist/diagnostics/types.js +1 -0
- package/dist/execute/localRuntime.d.ts +5 -0
- package/dist/execute/localRuntime.js +165 -0
- package/dist/execute/moduleRuntime.d.ts +25 -0
- package/dist/execute/moduleRuntime.js +352 -0
- package/dist/execute/types.d.ts +113 -0
- package/dist/execute/types.js +1 -0
- package/dist/execute-cli.d.ts +2 -0
- package/dist/execute-cli.js +112 -0
- package/dist/execute.d.ts +6 -0
- package/dist/execute.js +46 -0
- package/dist/graph/buildExecutionGraph.d.ts +8 -0
- package/dist/graph/buildExecutionGraph.js +69 -0
- package/dist/graph/types.d.ts +24 -0
- package/dist/graph/types.js +1 -0
- package/dist/handoff-store-cli.d.ts +2 -0
- package/dist/handoff-store-cli.js +139 -0
- package/dist/handoff-store.d.ts +103 -0
- package/dist/handoff-store.js +78 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +21 -0
- package/dist/ir/types.d.ts +92 -0
- package/dist/ir/types.js +1 -0
- package/dist/parser/parseAst.d.ts +3 -0
- package/dist/parser/parseAst.js +207 -0
- package/dist/parser/payload.d.ts +6 -0
- package/dist/parser/payload.js +211 -0
- package/dist/plan/buildExecutionPlan.d.ts +9 -0
- package/dist/plan/buildExecutionPlan.js +98 -0
- package/dist/plan/types.d.ts +44 -0
- package/dist/plan/types.js +1 -0
- package/dist/publish-cli.d.ts +2 -0
- package/dist/publish-cli.js +249 -0
- package/dist/publish.d.ts +148 -0
- package/dist/publish.js +190 -0
- package/dist/recover-cli.d.ts +2 -0
- package/dist/recover-cli.js +258 -0
- package/dist/recover.d.ts +489 -0
- package/dist/recover.js +290 -0
- package/dist/refs/resolveRefs.d.ts +13 -0
- package/dist/refs/resolveRefs.js +104 -0
- package/dist/registry/loadModuleRegistry.d.ts +28 -0
- package/dist/registry/loadModuleRegistry.js +97 -0
- package/dist/registry/types.d.ts +20 -0
- package/dist/registry/types.js +2 -0
- package/dist/resume-cli.d.ts +2 -0
- package/dist/resume-cli.js +379 -0
- package/dist/resume.d.ts +2076 -0
- package/dist/resume.js +452 -0
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +119 -0
- package/dist/run.d.ts +9 -0
- package/dist/run.js +43 -0
- package/dist/runtime-handoff-cli.d.ts +2 -0
- package/dist/runtime-handoff-cli.js +179 -0
- package/dist/runtime-handoff.d.ts +914 -0
- package/dist/runtime-handoff.js +383 -0
- package/dist/scanner/scanSource.d.ts +9 -0
- package/dist/scanner/scanSource.js +43 -0
- package/dist/schema/validateIrSchemas.d.ts +3 -0
- package/dist/schema/validateIrSchemas.js +64 -0
- package/dist/validate-module-cli.d.ts +2 -0
- package/dist/validate-module-cli.js +93 -0
- package/dist/validate-registry-cli.d.ts +2 -0
- package/dist/validate-registry-cli.js +82 -0
- package/dist/validate.d.ts +52 -0
- package/dist/validate.js +91 -0
- package/fixtures/duplicate-doc.aionis.md +19 -0
- package/fixtures/fenced-example.aionis.md +27 -0
- package/fixtures/malformed-payload.aionis.md +9 -0
- package/fixtures/npm-installed-module-registry.json +17 -0
- package/fixtures/standalone-module-registry.json +13 -0
- package/fixtures/standalone-runner-plan.json +51 -0
- package/fixtures/standalone-runner.aionis.md +29 -0
- package/fixtures/unresolved-ref.aionis.md +14 -0
- package/fixtures/valid-minimal.aionis.md +24 -0
- package/fixtures/valid-workflow.aionis.md +29 -0
- package/official-modules/copy-summary/CHANGELOG.md +6 -0
- package/official-modules/copy-summary/README.md +43 -0
- package/official-modules/copy-summary/index.mjs +41 -0
- package/official-modules/copy-summary/package.json +31 -0
- package/official-modules/json-transform/CHANGELOG.md +6 -0
- package/official-modules/json-transform/README.md +51 -0
- package/official-modules/json-transform/index.mjs +53 -0
- package/official-modules/json-transform/package.json +31 -0
- package/official-modules/research-claims/CHANGELOG.md +6 -0
- package/official-modules/research-claims/README.md +47 -0
- package/official-modules/research-claims/index.mjs +44 -0
- package/official-modules/research-claims/package.json +31 -0
- package/package.json +74 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AIONIS_MANIFEST_MODULE_REGISTRY_VERSION, AIONIS_MANIFEST_NPM_MODULE_REGISTRY_VERSION } from "./registry/types.js";
|
|
3
|
+
import { EXECUTION_PLAN_V1 } from "./plan/types.js";
|
|
4
|
+
export const AIONIS_MANIFEST_COMPILE_RESULT_VERSION = "aionis_manifest_compile_result_v1";
|
|
5
|
+
export const AIONIS_MANIFEST_EXECUTION_RESULT_VERSION = "aionis_manifest_execution_result_v1";
|
|
6
|
+
export const AionisManifestRunInputKindSchema = z.enum(["source", "compile-envelope", "plan"]);
|
|
7
|
+
export const EmitModeSchema = z.enum(["all", "ast", "ir", "graph", "plan", "diagnostics"]);
|
|
8
|
+
export const SourcePosSchema = z.object({
|
|
9
|
+
line: z.number().int().nonnegative(),
|
|
10
|
+
column: z.number().int().nonnegative(),
|
|
11
|
+
offset: z.number().int().nonnegative(),
|
|
12
|
+
});
|
|
13
|
+
export const SourceRangeSchema = z.object({
|
|
14
|
+
start: SourcePosSchema,
|
|
15
|
+
end: SourcePosSchema,
|
|
16
|
+
});
|
|
17
|
+
export const DiagnosticSchema = z.object({
|
|
18
|
+
severity: z.enum(["error", "warning", "info"]),
|
|
19
|
+
code: z.string().min(1),
|
|
20
|
+
message: z.string().min(1),
|
|
21
|
+
loc: SourceRangeSchema,
|
|
22
|
+
hint: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
export const AionisValueSchema = z.lazy(() => z.union([
|
|
25
|
+
z.string(),
|
|
26
|
+
z.number(),
|
|
27
|
+
z.boolean(),
|
|
28
|
+
z.null(),
|
|
29
|
+
z.array(AionisValueSchema),
|
|
30
|
+
z.record(AionisValueSchema),
|
|
31
|
+
]));
|
|
32
|
+
export const HeadingNodeSchema = z.object({
|
|
33
|
+
type: z.literal("HeadingNode"),
|
|
34
|
+
depth: z.number().int().positive(),
|
|
35
|
+
text: z.string(),
|
|
36
|
+
raw: z.string().optional(),
|
|
37
|
+
loc: SourceRangeSchema,
|
|
38
|
+
});
|
|
39
|
+
export const ParagraphNodeSchema = z.object({
|
|
40
|
+
type: z.literal("ParagraphNode"),
|
|
41
|
+
text: z.string(),
|
|
42
|
+
raw: z.string().optional(),
|
|
43
|
+
loc: SourceRangeSchema,
|
|
44
|
+
});
|
|
45
|
+
export const CodeFenceNodeSchema = z.object({
|
|
46
|
+
type: z.literal("CodeFenceNode"),
|
|
47
|
+
fence: z.literal("```"),
|
|
48
|
+
info: z.string().optional(),
|
|
49
|
+
content: z.string(),
|
|
50
|
+
raw: z.string().optional(),
|
|
51
|
+
loc: SourceRangeSchema,
|
|
52
|
+
});
|
|
53
|
+
export const DirectiveNodeSchema = z.object({
|
|
54
|
+
type: z.literal("DirectiveNode"),
|
|
55
|
+
name: z.string().min(1),
|
|
56
|
+
payload: AionisValueSchema.nullable(),
|
|
57
|
+
diagnostics: z.array(DiagnosticSchema).optional(),
|
|
58
|
+
raw: z.string().optional(),
|
|
59
|
+
loc: SourceRangeSchema,
|
|
60
|
+
});
|
|
61
|
+
export const AstNodeSchema = z.lazy(() => z.union([HeadingNodeSchema, ParagraphNodeSchema, CodeFenceNodeSchema, DirectiveNodeSchema]));
|
|
62
|
+
export const DocumentNodeSchema = z.object({
|
|
63
|
+
type: z.literal("DocumentNode"),
|
|
64
|
+
children: z.array(AstNodeSchema),
|
|
65
|
+
diagnostics: z.array(DiagnosticSchema),
|
|
66
|
+
raw: z.string().optional(),
|
|
67
|
+
loc: SourceRangeSchema,
|
|
68
|
+
});
|
|
69
|
+
export const DocMetaIRSchema = z.object({
|
|
70
|
+
id: z.string(),
|
|
71
|
+
version: z.string(),
|
|
72
|
+
kind: z.string().optional(),
|
|
73
|
+
title: z.string().optional(),
|
|
74
|
+
status: z.string().optional(),
|
|
75
|
+
tags: z.array(z.string()).optional(),
|
|
76
|
+
data: z.record(AionisValueSchema),
|
|
77
|
+
loc: SourceRangeSchema.optional(),
|
|
78
|
+
});
|
|
79
|
+
export const ContextIRSchema = z.object({
|
|
80
|
+
objective: z.string().optional(),
|
|
81
|
+
audience: z.array(z.string()).optional(),
|
|
82
|
+
constraints: z.array(z.string()).optional(),
|
|
83
|
+
data: z.record(AionisValueSchema),
|
|
84
|
+
loc: SourceRangeSchema.optional(),
|
|
85
|
+
});
|
|
86
|
+
export const PlanIRSchema = z.object({
|
|
87
|
+
steps: z.array(z.string()).optional(),
|
|
88
|
+
success_criteria: z.array(z.string()).optional(),
|
|
89
|
+
checkpoints: z.array(z.string()).optional(),
|
|
90
|
+
fallbacks: z.array(z.string()).optional(),
|
|
91
|
+
data: z.record(AionisValueSchema),
|
|
92
|
+
loc: SourceRangeSchema.optional(),
|
|
93
|
+
});
|
|
94
|
+
export const ExecuteIRSchema = z.object({
|
|
95
|
+
module: z.string().optional(),
|
|
96
|
+
tool: z.string().optional(),
|
|
97
|
+
agent: z.string().optional(),
|
|
98
|
+
input: z.record(AionisValueSchema).optional(),
|
|
99
|
+
input_ref: z.string().optional(),
|
|
100
|
+
output_ref: z.string().optional(),
|
|
101
|
+
deterministic: z.boolean().optional(),
|
|
102
|
+
depends_on: z.array(z.string()).optional(),
|
|
103
|
+
data: z.record(AionisValueSchema),
|
|
104
|
+
loc: SourceRangeSchema.optional(),
|
|
105
|
+
});
|
|
106
|
+
export const DecisionIRSchema = z.object({
|
|
107
|
+
decision: z.string().optional(),
|
|
108
|
+
rationale: z.string().optional(),
|
|
109
|
+
confidence: z.number().optional(),
|
|
110
|
+
data: z.record(AionisValueSchema),
|
|
111
|
+
loc: SourceRangeSchema.optional(),
|
|
112
|
+
});
|
|
113
|
+
export const EvidenceIRSchema = z.object({
|
|
114
|
+
sources: z.array(AionisValueSchema).optional(),
|
|
115
|
+
confidence: z.number().optional(),
|
|
116
|
+
claims_supported: z.array(z.string()).optional(),
|
|
117
|
+
data: z.record(AionisValueSchema),
|
|
118
|
+
loc: SourceRangeSchema.optional(),
|
|
119
|
+
});
|
|
120
|
+
export const ReplayIRSchema = z.object({
|
|
121
|
+
executable: z.boolean().optional(),
|
|
122
|
+
mode: z.enum(["deterministic", "assisted", "advisory"]).optional(),
|
|
123
|
+
workflow_id: z.string().optional(),
|
|
124
|
+
expected_outputs: z.array(z.string()).optional(),
|
|
125
|
+
data: z.record(AionisValueSchema),
|
|
126
|
+
loc: SourceRangeSchema.optional(),
|
|
127
|
+
});
|
|
128
|
+
export const MemoryIRSchema = z.object({
|
|
129
|
+
topics: z.array(z.string()).optional(),
|
|
130
|
+
entities: z.array(z.string()).optional(),
|
|
131
|
+
writeback: z.boolean().optional(),
|
|
132
|
+
summary_layer: z.string().optional(),
|
|
133
|
+
data: z.record(AionisValueSchema),
|
|
134
|
+
loc: SourceRangeSchema.optional(),
|
|
135
|
+
});
|
|
136
|
+
export const StateIRSchema = z.object({
|
|
137
|
+
phase: z.string().optional(),
|
|
138
|
+
run_id: z.string().optional(),
|
|
139
|
+
owner: z.string().optional(),
|
|
140
|
+
data: z.record(AionisValueSchema),
|
|
141
|
+
loc: SourceRangeSchema.optional(),
|
|
142
|
+
});
|
|
143
|
+
export const AionisManifestIRSchema = z.object({
|
|
144
|
+
doc: DocMetaIRSchema.nullable(),
|
|
145
|
+
context: z.array(ContextIRSchema),
|
|
146
|
+
plans: z.array(PlanIRSchema),
|
|
147
|
+
executions: z.array(ExecuteIRSchema),
|
|
148
|
+
decisions: z.array(DecisionIRSchema),
|
|
149
|
+
evidence: z.array(EvidenceIRSchema),
|
|
150
|
+
replay: z.array(ReplayIRSchema),
|
|
151
|
+
memory: z.array(MemoryIRSchema),
|
|
152
|
+
state: z.array(StateIRSchema),
|
|
153
|
+
diagnostics: z.array(DiagnosticSchema),
|
|
154
|
+
});
|
|
155
|
+
export const ExecutionNodeSchema = z.object({
|
|
156
|
+
id: z.string().min(1),
|
|
157
|
+
type: z.enum([
|
|
158
|
+
"context_node",
|
|
159
|
+
"execute_node",
|
|
160
|
+
"decision_node",
|
|
161
|
+
"evidence_node",
|
|
162
|
+
"output_node",
|
|
163
|
+
"memory_write_node",
|
|
164
|
+
"replay_node",
|
|
165
|
+
]),
|
|
166
|
+
label: z.string().optional(),
|
|
167
|
+
module: z.string().optional(),
|
|
168
|
+
input_ref: z.string().optional(),
|
|
169
|
+
output_ref: z.string().optional(),
|
|
170
|
+
payload: z.record(AionisValueSchema).optional(),
|
|
171
|
+
loc: SourceRangeSchema.optional(),
|
|
172
|
+
});
|
|
173
|
+
export const ExecutionEdgeSchema = z.object({
|
|
174
|
+
from: z.string().min(1),
|
|
175
|
+
to: z.string().min(1),
|
|
176
|
+
type: z.enum([
|
|
177
|
+
"data_dependency",
|
|
178
|
+
"sequence_dependency",
|
|
179
|
+
"evidence_attachment",
|
|
180
|
+
"memory_writeback",
|
|
181
|
+
"replay_anchor",
|
|
182
|
+
]),
|
|
183
|
+
});
|
|
184
|
+
export const ExecutionGraphSchema = z.object({
|
|
185
|
+
graph_id: z.string().min(1),
|
|
186
|
+
doc_id: z.string().min(1),
|
|
187
|
+
nodes: z.array(ExecutionNodeSchema),
|
|
188
|
+
edges: z.array(ExecutionEdgeSchema),
|
|
189
|
+
diagnostics: z.array(DiagnosticSchema).optional(),
|
|
190
|
+
});
|
|
191
|
+
export const ExecutionPlanDocMetaSchema = z.object({
|
|
192
|
+
id: z.string().min(1),
|
|
193
|
+
version: z.string().min(1),
|
|
194
|
+
kind: z.string().optional(),
|
|
195
|
+
title: z.string().optional(),
|
|
196
|
+
status: z.string().optional(),
|
|
197
|
+
tags: z.array(z.string()).optional(),
|
|
198
|
+
});
|
|
199
|
+
export const ExecutionPlanContextSchema = z.object({
|
|
200
|
+
merged: z.record(AionisValueSchema),
|
|
201
|
+
frames: z.array(z.record(AionisValueSchema)),
|
|
202
|
+
});
|
|
203
|
+
export const ExecutionPlanStepSchema = z.object({
|
|
204
|
+
execution_id: z.string().min(1),
|
|
205
|
+
module: z.string().optional(),
|
|
206
|
+
tool: z.string().optional(),
|
|
207
|
+
agent: z.string().optional(),
|
|
208
|
+
input: z.record(AionisValueSchema).optional(),
|
|
209
|
+
input_ref: z.string().optional(),
|
|
210
|
+
output_ref: z.string().optional(),
|
|
211
|
+
depends_on: z.array(z.string()),
|
|
212
|
+
deterministic: z.boolean().optional(),
|
|
213
|
+
loc: SourceRangeSchema.optional(),
|
|
214
|
+
});
|
|
215
|
+
export const ExecutionPlanDeterminismSchema = z.object({
|
|
216
|
+
executable: z.boolean(),
|
|
217
|
+
replay_mode: z.enum(["deterministic", "assisted", "advisory"]).optional(),
|
|
218
|
+
requires_resume_support: z.boolean(),
|
|
219
|
+
});
|
|
220
|
+
export const ExecutionPlanSchema = z.object({
|
|
221
|
+
plan_version: z.literal(EXECUTION_PLAN_V1),
|
|
222
|
+
doc: ExecutionPlanDocMetaSchema.nullable(),
|
|
223
|
+
context: ExecutionPlanContextSchema,
|
|
224
|
+
executions: z.array(ExecutionPlanStepSchema),
|
|
225
|
+
graph: ExecutionGraphSchema.nullable(),
|
|
226
|
+
expected_outputs: z.array(z.string()),
|
|
227
|
+
required_capabilities: z.array(z.string()),
|
|
228
|
+
determinism: ExecutionPlanDeterminismSchema,
|
|
229
|
+
diagnostics: z.array(DiagnosticSchema),
|
|
230
|
+
});
|
|
231
|
+
export const CompileArtifactsSchema = z.object({
|
|
232
|
+
ast: DocumentNodeSchema.nullable(),
|
|
233
|
+
ir: AionisManifestIRSchema.nullable(),
|
|
234
|
+
graph: ExecutionGraphSchema.nullable(),
|
|
235
|
+
plan: ExecutionPlanSchema.nullable(),
|
|
236
|
+
});
|
|
237
|
+
export const CompileSummarySchema = z.object({
|
|
238
|
+
has_errors: z.boolean(),
|
|
239
|
+
error_count: z.number().int().nonnegative(),
|
|
240
|
+
warning_count: z.number().int().nonnegative(),
|
|
241
|
+
info_count: z.number().int().nonnegative(),
|
|
242
|
+
ast_node_count: z.number().int().nonnegative(),
|
|
243
|
+
execution_count: z.number().int().nonnegative(),
|
|
244
|
+
graph_node_count: z.number().int().nonnegative(),
|
|
245
|
+
graph_edge_count: z.number().int().nonnegative(),
|
|
246
|
+
});
|
|
247
|
+
export const AionisManifestCompileEnvelopeSchema = z.object({
|
|
248
|
+
command: z.literal("compile-aionis-manifest"),
|
|
249
|
+
compile_result_version: z.literal(AIONIS_MANIFEST_COMPILE_RESULT_VERSION),
|
|
250
|
+
generated_at: z.string().min(1),
|
|
251
|
+
input_path: z.string().min(1),
|
|
252
|
+
selected_artifact: EmitModeSchema,
|
|
253
|
+
diagnostics: z.array(DiagnosticSchema),
|
|
254
|
+
summary: CompileSummarySchema,
|
|
255
|
+
artifacts: CompileArtifactsSchema,
|
|
256
|
+
});
|
|
257
|
+
export const ExecutionNodeResultSchema = z.object({
|
|
258
|
+
execution_id: z.string().min(1),
|
|
259
|
+
module: z.string().optional(),
|
|
260
|
+
tool: z.string().optional(),
|
|
261
|
+
agent: z.string().optional(),
|
|
262
|
+
status: z.enum(["success", "failed", "skipped"]),
|
|
263
|
+
input_ref: z.string().optional(),
|
|
264
|
+
output_ref: z.string().optional(),
|
|
265
|
+
output: AionisValueSchema.optional(),
|
|
266
|
+
artifacts: z.array(AionisValueSchema).optional(),
|
|
267
|
+
evidence: z.array(AionisValueSchema).optional(),
|
|
268
|
+
error: z.string().optional(),
|
|
269
|
+
});
|
|
270
|
+
export const ExecutionArtifactRecordSchema = z.object({
|
|
271
|
+
execution_id: z.string().min(1),
|
|
272
|
+
module: z.string().optional(),
|
|
273
|
+
value: AionisValueSchema,
|
|
274
|
+
});
|
|
275
|
+
export const ExecutionEvidenceRecordSchema = z.object({
|
|
276
|
+
execution_id: z.string().min(1),
|
|
277
|
+
module: z.string().optional(),
|
|
278
|
+
value: AionisValueSchema,
|
|
279
|
+
});
|
|
280
|
+
export const AionisManifestExecutionResultSchema = z.object({
|
|
281
|
+
execution_result_version: z.literal(AIONIS_MANIFEST_EXECUTION_RESULT_VERSION),
|
|
282
|
+
runtime_id: z.string().min(1),
|
|
283
|
+
executed_at: z.string().min(1),
|
|
284
|
+
plan_version: z.literal(EXECUTION_PLAN_V1),
|
|
285
|
+
doc_id: z.string().nullable(),
|
|
286
|
+
status: z.enum(["success", "failed"]),
|
|
287
|
+
outputs: z.record(AionisValueSchema),
|
|
288
|
+
artifacts: z.array(ExecutionArtifactRecordSchema),
|
|
289
|
+
evidence: z.array(ExecutionEvidenceRecordSchema),
|
|
290
|
+
node_results: z.array(ExecutionNodeResultSchema),
|
|
291
|
+
expected_outputs: z.array(z.string()),
|
|
292
|
+
warnings: z.array(z.string()),
|
|
293
|
+
errors: z.array(z.string()),
|
|
294
|
+
diagnostics: z.array(DiagnosticSchema),
|
|
295
|
+
});
|
|
296
|
+
export const ExecutionRuntimeCapabilitySchema = z.enum([
|
|
297
|
+
"direct_execution",
|
|
298
|
+
"deterministic_replay",
|
|
299
|
+
"state_persistence",
|
|
300
|
+
"memory_publish",
|
|
301
|
+
"handoff_recover",
|
|
302
|
+
"module_registry",
|
|
303
|
+
"evidence_capture",
|
|
304
|
+
]);
|
|
305
|
+
export const ExecutionModuleValueContractSchema = z.lazy(() => z.object({
|
|
306
|
+
kind: z.enum(["any", "string", "number", "boolean", "null", "array", "object"]),
|
|
307
|
+
description: z.string().optional(),
|
|
308
|
+
properties: z.record(ExecutionModuleValueContractSchema).optional(),
|
|
309
|
+
required: z.array(z.string()).optional(),
|
|
310
|
+
items: ExecutionModuleValueContractSchema.optional(),
|
|
311
|
+
additional_properties: z.boolean().optional(),
|
|
312
|
+
}));
|
|
313
|
+
export const ExecutionModuleManifestSchema = z.object({
|
|
314
|
+
module: z.string().min(1),
|
|
315
|
+
version: z.string().min(1),
|
|
316
|
+
title: z.string().optional(),
|
|
317
|
+
description: z.string().optional(),
|
|
318
|
+
deterministic: z.boolean().optional(),
|
|
319
|
+
required_capabilities: z.array(ExecutionRuntimeCapabilitySchema).optional(),
|
|
320
|
+
input_contract: ExecutionModuleValueContractSchema.optional(),
|
|
321
|
+
output_contract: ExecutionModuleValueContractSchema.optional(),
|
|
322
|
+
artifact_contract: ExecutionModuleValueContractSchema.optional(),
|
|
323
|
+
evidence_contract: ExecutionModuleValueContractSchema.optional(),
|
|
324
|
+
});
|
|
325
|
+
export const ModuleRegistryFileEntrySchema = z.object({
|
|
326
|
+
module: z.string().min(1),
|
|
327
|
+
entry: z.string().min(1),
|
|
328
|
+
});
|
|
329
|
+
export const ModuleRegistryFileSchema = z.object({
|
|
330
|
+
version: z.literal(AIONIS_MANIFEST_MODULE_REGISTRY_VERSION),
|
|
331
|
+
modules: z.array(ModuleRegistryFileEntrySchema),
|
|
332
|
+
});
|
|
333
|
+
export const NpmModuleRegistryFileEntrySchema = z.object({
|
|
334
|
+
module: z.string().min(1),
|
|
335
|
+
package: z.string().min(1),
|
|
336
|
+
export: z.string().min(1).optional(),
|
|
337
|
+
});
|
|
338
|
+
export const NpmModuleRegistryFileSchema = z.object({
|
|
339
|
+
version: z.literal(AIONIS_MANIFEST_NPM_MODULE_REGISTRY_VERSION),
|
|
340
|
+
modules: z.array(NpmModuleRegistryFileEntrySchema),
|
|
341
|
+
});
|
|
342
|
+
export const AnyModuleRegistryFileSchema = z.union([ModuleRegistryFileSchema, NpmModuleRegistryFileSchema]);
|
|
343
|
+
function selectArtifacts(result, emit) {
|
|
344
|
+
if (emit === "all") {
|
|
345
|
+
return {
|
|
346
|
+
ast: result.ast,
|
|
347
|
+
ir: result.ir,
|
|
348
|
+
graph: result.graph,
|
|
349
|
+
plan: result.plan,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
ast: emit === "ast" ? result.ast : null,
|
|
354
|
+
ir: emit === "ir" ? result.ir : null,
|
|
355
|
+
graph: emit === "graph" ? result.graph : null,
|
|
356
|
+
plan: emit === "plan" ? result.plan : null,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function summarizeCompileResult(result) {
|
|
360
|
+
const errorCount = result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
361
|
+
const warningCount = result.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length;
|
|
362
|
+
const infoCount = result.diagnostics.filter((diagnostic) => diagnostic.severity === "info").length;
|
|
363
|
+
return {
|
|
364
|
+
has_errors: errorCount > 0,
|
|
365
|
+
error_count: errorCount,
|
|
366
|
+
warning_count: warningCount,
|
|
367
|
+
info_count: infoCount,
|
|
368
|
+
ast_node_count: result.ast.children.length,
|
|
369
|
+
execution_count: result.ir.executions.length,
|
|
370
|
+
graph_node_count: result.graph?.nodes.length ?? 0,
|
|
371
|
+
graph_edge_count: result.graph?.edges.length ?? 0,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
export function buildCompileEnvelope(args) {
|
|
375
|
+
const envelope = {
|
|
376
|
+
command: "compile-aionis-manifest",
|
|
377
|
+
compile_result_version: AIONIS_MANIFEST_COMPILE_RESULT_VERSION,
|
|
378
|
+
generated_at: args.generatedAt ?? new Date().toISOString(),
|
|
379
|
+
input_path: args.inputPath,
|
|
380
|
+
selected_artifact: args.emit,
|
|
381
|
+
diagnostics: args.result.diagnostics,
|
|
382
|
+
summary: summarizeCompileResult(args.result),
|
|
383
|
+
artifacts: selectArtifacts(args.result, args.emit),
|
|
384
|
+
};
|
|
385
|
+
return AionisManifestCompileEnvelopeSchema.parse(envelope);
|
|
386
|
+
}
|
|
387
|
+
export function validateCompileEnvelope(value) {
|
|
388
|
+
return AionisManifestCompileEnvelopeSchema.parse(value);
|
|
389
|
+
}
|
|
390
|
+
export function validateExecutionModuleManifest(value) {
|
|
391
|
+
ExecutionModuleManifestSchema.parse(value);
|
|
392
|
+
return value;
|
|
393
|
+
}
|
|
394
|
+
export function validateModuleRegistryFile(value) {
|
|
395
|
+
ModuleRegistryFileSchema.parse(value);
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
export function validateAnyModuleRegistryFile(value) {
|
|
399
|
+
AnyModuleRegistryFileSchema.parse(value);
|
|
400
|
+
return value;
|
|
401
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SourcePos {
|
|
2
|
+
line: number;
|
|
3
|
+
column: number;
|
|
4
|
+
offset: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SourceRange {
|
|
7
|
+
start: SourcePos;
|
|
8
|
+
end: SourcePos;
|
|
9
|
+
}
|
|
10
|
+
export type DiagnosticSeverity = "error" | "warning" | "info";
|
|
11
|
+
export interface Diagnostic {
|
|
12
|
+
severity: DiagnosticSeverity;
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
loc: SourceRange;
|
|
16
|
+
hint?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ModuleRegistryExecutionRuntime, StaticModuleRegistry } from "./moduleRuntime.js";
|
|
2
|
+
export declare function createLocalDemoModuleRegistry(): StaticModuleRegistry;
|
|
3
|
+
export declare class LocalExecutionRuntime extends ModuleRegistryExecutionRuntime {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { ModuleRegistryExecutionRuntime, StaticModuleRegistry, createExecutionRuntimeCapabilities, } from "./moduleRuntime.js";
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
const LOCAL_DEMO_MODULES = [
|
|
6
|
+
{
|
|
7
|
+
manifest: {
|
|
8
|
+
module: "demo.hello.v1",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
description: "Return a greeting payload from document context.",
|
|
11
|
+
deterministic: true,
|
|
12
|
+
required_capabilities: ["direct_execution"],
|
|
13
|
+
input_contract: {
|
|
14
|
+
kind: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
objective: { kind: "string" },
|
|
17
|
+
},
|
|
18
|
+
additional_properties: true,
|
|
19
|
+
},
|
|
20
|
+
output_contract: {
|
|
21
|
+
kind: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
message: { kind: "string" },
|
|
24
|
+
},
|
|
25
|
+
required: ["message"],
|
|
26
|
+
additional_properties: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
handler: (input) => {
|
|
30
|
+
const objective = isObject(input) && typeof input.objective === "string" ? input.objective : null;
|
|
31
|
+
return {
|
|
32
|
+
message: objective ? `Hello from AionisManifest: ${objective}` : "Hello from AionisManifest.",
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
manifest: {
|
|
38
|
+
module: "research.claims.v1",
|
|
39
|
+
version: "1.0.0",
|
|
40
|
+
description: "Generate short product claims from context fields.",
|
|
41
|
+
deterministic: true,
|
|
42
|
+
required_capabilities: ["direct_execution"],
|
|
43
|
+
input_contract: {
|
|
44
|
+
kind: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
product: { kind: "string" },
|
|
47
|
+
audience: {
|
|
48
|
+
kind: "array",
|
|
49
|
+
items: { kind: "string" },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
additional_properties: true,
|
|
53
|
+
},
|
|
54
|
+
output_contract: {
|
|
55
|
+
kind: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
claims: {
|
|
58
|
+
kind: "array",
|
|
59
|
+
items: { kind: "string" },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: ["claims"],
|
|
63
|
+
additional_properties: false,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
handler: (input) => {
|
|
67
|
+
const product = isObject(input) && typeof input.product === "string" ? input.product : "Aionis";
|
|
68
|
+
const audience = isObject(input) && Array.isArray(input.audience)
|
|
69
|
+
? input.audience.filter((item) => typeof item === "string")
|
|
70
|
+
: [];
|
|
71
|
+
const audienceText = audience.length > 0 ? audience.join(" and ") : "teams";
|
|
72
|
+
return {
|
|
73
|
+
claims: [
|
|
74
|
+
`${product} helps ${audienceText} continue work without rediscovery.`,
|
|
75
|
+
`${product} turns executable documents into continuity-aware workflows.`,
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
manifest: {
|
|
82
|
+
module: "copy.hero.v1",
|
|
83
|
+
version: "1.0.0",
|
|
84
|
+
description: "Map a claims array into a single hero line.",
|
|
85
|
+
deterministic: true,
|
|
86
|
+
required_capabilities: ["direct_execution"],
|
|
87
|
+
input_contract: {
|
|
88
|
+
kind: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
claims: {
|
|
91
|
+
kind: "array",
|
|
92
|
+
items: { kind: "string" },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
additional_properties: true,
|
|
96
|
+
},
|
|
97
|
+
output_contract: {
|
|
98
|
+
kind: "object",
|
|
99
|
+
properties: {
|
|
100
|
+
hero: { kind: "string" },
|
|
101
|
+
},
|
|
102
|
+
required: ["hero"],
|
|
103
|
+
additional_properties: false,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
handler: (input) => {
|
|
107
|
+
const claims = isObject(input) && Array.isArray(input.claims)
|
|
108
|
+
? input.claims.filter((item) => typeof item === "string")
|
|
109
|
+
: [];
|
|
110
|
+
return {
|
|
111
|
+
hero: claims[0] ?? "Portable execution starts with one document.",
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
manifest: {
|
|
117
|
+
module: "copy.summary.v1",
|
|
118
|
+
version: "1.0.0",
|
|
119
|
+
description: "Map a claims array into a summary paragraph.",
|
|
120
|
+
deterministic: true,
|
|
121
|
+
required_capabilities: ["direct_execution"],
|
|
122
|
+
input_contract: {
|
|
123
|
+
kind: "object",
|
|
124
|
+
properties: {
|
|
125
|
+
claims: {
|
|
126
|
+
kind: "array",
|
|
127
|
+
items: { kind: "string" },
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
additional_properties: true,
|
|
131
|
+
},
|
|
132
|
+
output_contract: {
|
|
133
|
+
kind: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
summary: { kind: "string" },
|
|
136
|
+
},
|
|
137
|
+
required: ["summary"],
|
|
138
|
+
additional_properties: false,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
handler: (input) => {
|
|
142
|
+
const claims = isObject(input) && Array.isArray(input.claims)
|
|
143
|
+
? input.claims.filter((item) => typeof item === "string")
|
|
144
|
+
: [];
|
|
145
|
+
return {
|
|
146
|
+
summary: claims.join(" ") || "AionisManifest produced an execution summary.",
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
export function createLocalDemoModuleRegistry() {
|
|
152
|
+
return new StaticModuleRegistry(LOCAL_DEMO_MODULES);
|
|
153
|
+
}
|
|
154
|
+
export class LocalExecutionRuntime extends ModuleRegistryExecutionRuntime {
|
|
155
|
+
constructor() {
|
|
156
|
+
super({
|
|
157
|
+
runtime_id: "local_demo_runtime_v1",
|
|
158
|
+
registry: createLocalDemoModuleRegistry(),
|
|
159
|
+
capabilities: createExecutionRuntimeCapabilities({
|
|
160
|
+
direct_execution: true,
|
|
161
|
+
module_registry: true,
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AionisValue } from "../ir/types.js";
|
|
2
|
+
import type { ExecutionPlanV1, ExecutionPlanStep } from "../plan/types.js";
|
|
3
|
+
import { type ExecutionModuleDefinition, type ExecutionModuleManifest, type ExecutionModuleRegistry, type ExecutionResultV1, type ExecutionRuntime, type ExecutionRuntimeCapabilities } from "./types.js";
|
|
4
|
+
export declare function resolveExecutionInput(plan: ExecutionPlanV1, outputs: Record<string, AionisValue>, step: ExecutionPlanStep): AionisValue;
|
|
5
|
+
export declare function createExecutionRuntimeCapabilities(overrides?: Partial<ExecutionRuntimeCapabilities>): ExecutionRuntimeCapabilities;
|
|
6
|
+
export declare class StaticModuleRegistry implements ExecutionModuleRegistry {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(modules: ExecutionModuleDefinition[]);
|
|
9
|
+
has(moduleName: string): boolean;
|
|
10
|
+
get(moduleName: string): ExecutionModuleDefinition | undefined;
|
|
11
|
+
getManifest(moduleName: string): ExecutionModuleManifest | undefined;
|
|
12
|
+
list(): ExecutionModuleDefinition[];
|
|
13
|
+
listManifests(): ExecutionModuleManifest[];
|
|
14
|
+
}
|
|
15
|
+
export declare class ModuleRegistryExecutionRuntime implements ExecutionRuntime {
|
|
16
|
+
#private;
|
|
17
|
+
readonly runtime_id: string;
|
|
18
|
+
constructor(args: {
|
|
19
|
+
runtime_id: string;
|
|
20
|
+
registry: ExecutionModuleRegistry;
|
|
21
|
+
capabilities?: Partial<ExecutionRuntimeCapabilities>;
|
|
22
|
+
});
|
|
23
|
+
capabilities(): ExecutionRuntimeCapabilities;
|
|
24
|
+
execute(plan: ExecutionPlanV1): Promise<ExecutionResultV1>;
|
|
25
|
+
}
|