@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.
Files changed (102) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +178 -0
  3. package/README.md +170 -0
  4. package/dist/ast/types.d.ts +34 -0
  5. package/dist/ast/types.js +1 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.js +122 -0
  8. package/dist/compile.d.ts +14 -0
  9. package/dist/compile.js +219 -0
  10. package/dist/contracts.d.ts +12610 -0
  11. package/dist/contracts.js +401 -0
  12. package/dist/diagnostics/types.d.ts +17 -0
  13. package/dist/diagnostics/types.js +1 -0
  14. package/dist/execute/localRuntime.d.ts +5 -0
  15. package/dist/execute/localRuntime.js +165 -0
  16. package/dist/execute/moduleRuntime.d.ts +25 -0
  17. package/dist/execute/moduleRuntime.js +352 -0
  18. package/dist/execute/types.d.ts +113 -0
  19. package/dist/execute/types.js +1 -0
  20. package/dist/execute-cli.d.ts +2 -0
  21. package/dist/execute-cli.js +112 -0
  22. package/dist/execute.d.ts +6 -0
  23. package/dist/execute.js +46 -0
  24. package/dist/graph/buildExecutionGraph.d.ts +8 -0
  25. package/dist/graph/buildExecutionGraph.js +69 -0
  26. package/dist/graph/types.d.ts +24 -0
  27. package/dist/graph/types.js +1 -0
  28. package/dist/handoff-store-cli.d.ts +2 -0
  29. package/dist/handoff-store-cli.js +139 -0
  30. package/dist/handoff-store.d.ts +103 -0
  31. package/dist/handoff-store.js +78 -0
  32. package/dist/index.d.ts +22 -0
  33. package/dist/index.js +21 -0
  34. package/dist/ir/types.d.ts +92 -0
  35. package/dist/ir/types.js +1 -0
  36. package/dist/parser/parseAst.d.ts +3 -0
  37. package/dist/parser/parseAst.js +207 -0
  38. package/dist/parser/payload.d.ts +6 -0
  39. package/dist/parser/payload.js +211 -0
  40. package/dist/plan/buildExecutionPlan.d.ts +9 -0
  41. package/dist/plan/buildExecutionPlan.js +98 -0
  42. package/dist/plan/types.d.ts +44 -0
  43. package/dist/plan/types.js +1 -0
  44. package/dist/publish-cli.d.ts +2 -0
  45. package/dist/publish-cli.js +249 -0
  46. package/dist/publish.d.ts +148 -0
  47. package/dist/publish.js +190 -0
  48. package/dist/recover-cli.d.ts +2 -0
  49. package/dist/recover-cli.js +258 -0
  50. package/dist/recover.d.ts +489 -0
  51. package/dist/recover.js +290 -0
  52. package/dist/refs/resolveRefs.d.ts +13 -0
  53. package/dist/refs/resolveRefs.js +104 -0
  54. package/dist/registry/loadModuleRegistry.d.ts +28 -0
  55. package/dist/registry/loadModuleRegistry.js +97 -0
  56. package/dist/registry/types.d.ts +20 -0
  57. package/dist/registry/types.js +2 -0
  58. package/dist/resume-cli.d.ts +2 -0
  59. package/dist/resume-cli.js +379 -0
  60. package/dist/resume.d.ts +2076 -0
  61. package/dist/resume.js +452 -0
  62. package/dist/run-cli.d.ts +2 -0
  63. package/dist/run-cli.js +119 -0
  64. package/dist/run.d.ts +9 -0
  65. package/dist/run.js +43 -0
  66. package/dist/runtime-handoff-cli.d.ts +2 -0
  67. package/dist/runtime-handoff-cli.js +179 -0
  68. package/dist/runtime-handoff.d.ts +914 -0
  69. package/dist/runtime-handoff.js +383 -0
  70. package/dist/scanner/scanSource.d.ts +9 -0
  71. package/dist/scanner/scanSource.js +43 -0
  72. package/dist/schema/validateIrSchemas.d.ts +3 -0
  73. package/dist/schema/validateIrSchemas.js +64 -0
  74. package/dist/validate-module-cli.d.ts +2 -0
  75. package/dist/validate-module-cli.js +93 -0
  76. package/dist/validate-registry-cli.d.ts +2 -0
  77. package/dist/validate-registry-cli.js +82 -0
  78. package/dist/validate.d.ts +52 -0
  79. package/dist/validate.js +91 -0
  80. package/fixtures/duplicate-doc.aionis.md +19 -0
  81. package/fixtures/fenced-example.aionis.md +27 -0
  82. package/fixtures/malformed-payload.aionis.md +9 -0
  83. package/fixtures/npm-installed-module-registry.json +17 -0
  84. package/fixtures/standalone-module-registry.json +13 -0
  85. package/fixtures/standalone-runner-plan.json +51 -0
  86. package/fixtures/standalone-runner.aionis.md +29 -0
  87. package/fixtures/unresolved-ref.aionis.md +14 -0
  88. package/fixtures/valid-minimal.aionis.md +24 -0
  89. package/fixtures/valid-workflow.aionis.md +29 -0
  90. package/official-modules/copy-summary/CHANGELOG.md +6 -0
  91. package/official-modules/copy-summary/README.md +43 -0
  92. package/official-modules/copy-summary/index.mjs +41 -0
  93. package/official-modules/copy-summary/package.json +31 -0
  94. package/official-modules/json-transform/CHANGELOG.md +6 -0
  95. package/official-modules/json-transform/README.md +51 -0
  96. package/official-modules/json-transform/index.mjs +53 -0
  97. package/official-modules/json-transform/package.json +31 -0
  98. package/official-modules/research-claims/CHANGELOG.md +6 -0
  99. package/official-modules/research-claims/README.md +47 -0
  100. package/official-modules/research-claims/index.mjs +44 -0
  101. package/official-modules/research-claims/package.json +31 -0
  102. package/package.json +74 -0
@@ -0,0 +1,258 @@
1
+ #!/usr/bin/env node
2
+ import { readFile } from "node:fs/promises";
3
+ import { resolve } from "node:path";
4
+ import process from "node:process";
5
+ import { recoverAionisManifestSource, recoverHandoffStoreRequest, recoverPublishedAionisManifest, recoverRuntimeHandoff, } from "./recover.js";
6
+ class CliUsageError extends Error {
7
+ }
8
+ function printHelp() {
9
+ process.stdout.write([
10
+ "recover-aionis-manifest-handoff",
11
+ "",
12
+ "Usage:",
13
+ " recover-aionis-manifest-handoff <input-file> [--input-kind source|runtime-handoff|handoff-store-request|publish-result]",
14
+ " [--base-url http://127.0.0.1:3001] [--scope <scope>] [--tenant-id <tenant>]",
15
+ " [--actor <actor>] [--memory-lane private|shared] [--title <title>] [--tag <tag>]",
16
+ " [--repo-root <path>] [--file-path <path>] [--symbol <name>]",
17
+ " [--current-stage triage|patch|review|resume] [--active-role orchestrator|triage|patch|review|resume]",
18
+ " [--handoff-kind patch_handoff|review_handoff|task_handoff] [--limit <n>]",
19
+ " [--allow-compile-errors] [--timeout-ms <ms>] [--api-key <key>] [--auth-bearer <token>]",
20
+ " [--admin-token <token>] [--request-id <id>] [--compact]",
21
+ "",
22
+ "Notes:",
23
+ " source/runtime-handoff/handoff-store-request modes publish first, then recover via /v1/handoff/recover.",
24
+ " publish-result mode skips publish and recovers from an existing publish-aionis-manifest-handoff JSON result.",
25
+ "",
26
+ ].join("\n"));
27
+ }
28
+ function parseArgs(argv) {
29
+ let inputPath = null;
30
+ const flags = {
31
+ inputKind: "source",
32
+ baseUrl: process.env.AIONIS_BASE_URL?.trim() || "http://127.0.0.1:3001",
33
+ scope: process.env.AIONIS_SCOPE?.trim() || null,
34
+ tenantId: null,
35
+ actor: null,
36
+ memoryLane: null,
37
+ title: null,
38
+ tags: [],
39
+ repoRoot: null,
40
+ filePath: null,
41
+ symbol: null,
42
+ currentStage: null,
43
+ activeRole: null,
44
+ handoffKind: null,
45
+ limit: null,
46
+ allowCompileErrors: false,
47
+ timeoutMs: Number(process.env.AIONIS_TIMEOUT_MS || 10_000),
48
+ apiKey: process.env.API_KEY?.trim() || process.env.PERF_API_KEY?.trim() || null,
49
+ authBearer: process.env.AUTH_BEARER?.trim() || process.env.PERF_AUTH_BEARER?.trim() || null,
50
+ adminToken: process.env.ADMIN_TOKEN?.trim() || null,
51
+ requestId: null,
52
+ compact: false,
53
+ help: false,
54
+ };
55
+ for (let i = 0; i < argv.length; i += 1) {
56
+ const token = argv[i];
57
+ if (token === "--help" || token === "-h") {
58
+ flags.help = true;
59
+ continue;
60
+ }
61
+ if (token === "--compact") {
62
+ flags.compact = true;
63
+ continue;
64
+ }
65
+ if (token === "--allow-compile-errors") {
66
+ flags.allowCompileErrors = true;
67
+ continue;
68
+ }
69
+ if (token === "--tag") {
70
+ const value = argv[i + 1];
71
+ if (!value)
72
+ throw new CliUsageError("Missing value for --tag.");
73
+ flags.tags.push(value);
74
+ i += 1;
75
+ continue;
76
+ }
77
+ if (token === "--input-kind" ||
78
+ token === "--base-url" ||
79
+ token === "--scope" ||
80
+ token === "--tenant-id" ||
81
+ token === "--actor" ||
82
+ token === "--memory-lane" ||
83
+ token === "--title" ||
84
+ token === "--repo-root" ||
85
+ token === "--file-path" ||
86
+ token === "--symbol" ||
87
+ token === "--current-stage" ||
88
+ token === "--active-role" ||
89
+ token === "--handoff-kind" ||
90
+ token === "--limit" ||
91
+ token === "--timeout-ms" ||
92
+ token === "--api-key" ||
93
+ token === "--auth-bearer" ||
94
+ token === "--admin-token" ||
95
+ token === "--request-id") {
96
+ const value = argv[i + 1];
97
+ if (!value)
98
+ throw new CliUsageError(`Missing value for ${token}.`);
99
+ switch (token) {
100
+ case "--input-kind":
101
+ if (!["source", "runtime-handoff", "handoff-store-request", "publish-result"].includes(value)) {
102
+ throw new CliUsageError(`Unsupported input kind '${value}'.`);
103
+ }
104
+ flags.inputKind = value;
105
+ break;
106
+ case "--base-url":
107
+ flags.baseUrl = value;
108
+ break;
109
+ case "--scope":
110
+ flags.scope = value;
111
+ break;
112
+ case "--tenant-id":
113
+ flags.tenantId = value;
114
+ break;
115
+ case "--actor":
116
+ flags.actor = value;
117
+ break;
118
+ case "--memory-lane":
119
+ if (value !== "private" && value !== "shared") {
120
+ throw new CliUsageError(`Unsupported memory lane '${value}'.`);
121
+ }
122
+ flags.memoryLane = value;
123
+ break;
124
+ case "--title":
125
+ flags.title = value;
126
+ break;
127
+ case "--repo-root":
128
+ flags.repoRoot = value;
129
+ break;
130
+ case "--file-path":
131
+ flags.filePath = value;
132
+ break;
133
+ case "--symbol":
134
+ flags.symbol = value;
135
+ break;
136
+ case "--current-stage":
137
+ if (!["triage", "patch", "review", "resume"].includes(value)) {
138
+ throw new CliUsageError(`Unsupported current stage '${value}'.`);
139
+ }
140
+ flags.currentStage = value;
141
+ break;
142
+ case "--active-role":
143
+ if (!["orchestrator", "triage", "patch", "review", "resume"].includes(value)) {
144
+ throw new CliUsageError(`Unsupported active role '${value}'.`);
145
+ }
146
+ flags.activeRole = value;
147
+ break;
148
+ case "--handoff-kind":
149
+ if (!["patch_handoff", "review_handoff", "task_handoff"].includes(value)) {
150
+ throw new CliUsageError(`Unsupported handoff kind '${value}'.`);
151
+ }
152
+ flags.handoffKind = value;
153
+ break;
154
+ case "--limit": {
155
+ const parsed = Number(value);
156
+ if (!Number.isInteger(parsed) || parsed <= 0) {
157
+ throw new CliUsageError("--limit must be a positive integer.");
158
+ }
159
+ flags.limit = parsed;
160
+ break;
161
+ }
162
+ case "--timeout-ms":
163
+ flags.timeoutMs = Number(value);
164
+ break;
165
+ case "--api-key":
166
+ flags.apiKey = value;
167
+ break;
168
+ case "--auth-bearer":
169
+ flags.authBearer = value;
170
+ break;
171
+ case "--admin-token":
172
+ flags.adminToken = value;
173
+ break;
174
+ case "--request-id":
175
+ flags.requestId = value;
176
+ break;
177
+ default:
178
+ break;
179
+ }
180
+ i += 1;
181
+ continue;
182
+ }
183
+ if (token.startsWith("--")) {
184
+ throw new CliUsageError(`Unknown flag '${token}'.`);
185
+ }
186
+ if (inputPath) {
187
+ throw new CliUsageError("Only one input file may be provided.");
188
+ }
189
+ inputPath = token;
190
+ }
191
+ return { inputPath, flags };
192
+ }
193
+ async function main() {
194
+ const { inputPath, flags } = parseArgs(process.argv.slice(2));
195
+ if (flags.help) {
196
+ printHelp();
197
+ return;
198
+ }
199
+ if (!inputPath)
200
+ throw new CliUsageError("An input file path is required.");
201
+ const resolvedInput = resolve(process.cwd(), inputPath);
202
+ const inputText = await readFile(resolvedInput, "utf8");
203
+ const baseArgs = {
204
+ baseUrl: flags.baseUrl,
205
+ scope: flags.scope ?? undefined,
206
+ tenantId: flags.tenantId ?? undefined,
207
+ actor: flags.actor ?? undefined,
208
+ memoryLane: flags.memoryLane ?? undefined,
209
+ title: flags.title ?? undefined,
210
+ tags: flags.tags,
211
+ repoRoot: flags.repoRoot,
212
+ filePath: flags.filePath,
213
+ symbol: flags.symbol,
214
+ currentStage: flags.currentStage ?? undefined,
215
+ activeRole: flags.activeRole ?? undefined,
216
+ handoffKind: flags.handoffKind ?? undefined,
217
+ limit: flags.limit ?? undefined,
218
+ allowCompileErrors: flags.allowCompileErrors,
219
+ timeoutMs: flags.timeoutMs,
220
+ apiKey: flags.apiKey ?? undefined,
221
+ authBearer: flags.authBearer ?? undefined,
222
+ adminToken: flags.adminToken ?? undefined,
223
+ requestId: flags.requestId ?? undefined,
224
+ };
225
+ const result = flags.inputKind === "source"
226
+ ? await recoverAionisManifestSource({
227
+ ...baseArgs,
228
+ source: inputText,
229
+ inputPath: resolvedInput,
230
+ })
231
+ : flags.inputKind === "runtime-handoff"
232
+ ? await recoverRuntimeHandoff({
233
+ ...baseArgs,
234
+ runtimeHandoff: JSON.parse(inputText),
235
+ })
236
+ : flags.inputKind === "handoff-store-request"
237
+ ? await recoverHandoffStoreRequest({
238
+ ...baseArgs,
239
+ handoffStoreRequest: JSON.parse(inputText),
240
+ })
241
+ : await recoverPublishedAionisManifest({
242
+ ...baseArgs,
243
+ publishResult: JSON.parse(inputText),
244
+ });
245
+ const rendered = flags.compact ? JSON.stringify(result) : `${JSON.stringify(result, null, 2)}\n`;
246
+ process.stdout.write(rendered);
247
+ }
248
+ main().catch((error) => {
249
+ if (error instanceof CliUsageError) {
250
+ process.stderr.write(`${error.message}\n`);
251
+ printHelp();
252
+ process.exitCode = 2;
253
+ return;
254
+ }
255
+ const message = error instanceof Error ? error.message : String(error);
256
+ process.stderr.write(`${message}\n`);
257
+ process.exitCode = 1;
258
+ });