@parcha/agentrun-pi 0.1.0-beta.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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +209 -0
- package/dist/admission.d.ts +6 -0
- package/dist/admission.js +51 -0
- package/dist/author.d.ts +21 -0
- package/dist/author.js +72 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +68 -0
- package/dist/demo-data.d.ts +361 -0
- package/dist/demo-data.js +386 -0
- package/dist/demo.d.ts +13 -0
- package/dist/demo.js +44 -0
- package/dist/extension-service.d.ts +110 -0
- package/dist/extension-service.js +477 -0
- package/dist/extension.d.ts +41 -0
- package/dist/extension.js +419 -0
- package/dist/host-session.d.ts +5 -0
- package/dist/host-session.js +80 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/presentation.d.ts +4 -0
- package/dist/presentation.js +34 -0
- package/dist/runner.d.ts +12 -0
- package/dist/runner.js +256 -0
- package/dist/skill-bundle.d.ts +5 -0
- package/dist/skill-bundle.js +15 -0
- package/dist/tool-input-error.d.ts +10 -0
- package/dist/tool-input-error.js +40 -0
- package/dist/types.d.ts +119 -0
- package/dist/types.js +1 -0
- package/package.json +73 -0
- package/skills/author/SKILL.md +102 -0
- package/skills/author/examples/evidence-gate.input.json +6 -0
- package/skills/author/examples/evidence-gate.json +125 -0
- package/skills/author/examples/read-file.input.json +1 -0
- package/skills/author/examples/read-file.json +44 -0
- package/skills/author/examples/read-source-decision.input.json +4 -0
- package/skills/author/examples/read-source-decision.json +37 -0
- package/skills/author/examples/release-note.txt +10 -0
- package/skills/author/examples/review-release-notes.input.json +6 -0
- package/skills/author/examples/review-release-notes.json +123 -0
- package/skills/author/references/jev-decisions.md +112 -0
- package/skills/author/references/sdk-authoring.md +16 -0
- package/skills/author/references/workflow-format.md +145 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { runWorkflow, validateWorkflow } from "@parcha/agentrun-dsl";
|
|
6
|
+
import { authorWorkflow } from "./author.js";
|
|
7
|
+
import { createPiRunner } from "./runner.js";
|
|
8
|
+
const help = `Usage:
|
|
9
|
+
agentrun-pi validate workflow.json [--inputs key1,key2]
|
|
10
|
+
agentrun-pi author --config ./pi.config.mjs --out ./candidates "Describe the workflow"
|
|
11
|
+
agentrun-pi run --config ./pi.config.mjs workflow.json input.json
|
|
12
|
+
|
|
13
|
+
Config is trusted JavaScript exporting default PiRunnerOptions, optionally deps (Jev/effect adapters).
|
|
14
|
+
Author saves candidates; it does not execute or activate them.
|
|
15
|
+
Validate may execute code probes. Run executes trusted workflow code and exits 2 on escalation.
|
|
16
|
+
Model and authentication must be configured explicitly. No shell/filesystem tools are enabled by default.`;
|
|
17
|
+
async function main(args) {
|
|
18
|
+
const command = args.shift();
|
|
19
|
+
if (!command || command === "--help" || command === "help") {
|
|
20
|
+
console.log(help);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const flag = (name) => {
|
|
24
|
+
const index = args.indexOf(name);
|
|
25
|
+
if (index < 0)
|
|
26
|
+
return undefined;
|
|
27
|
+
const value = args[index + 1];
|
|
28
|
+
if (!value || value.startsWith("--"))
|
|
29
|
+
throw new Error(`Missing value for ${name}`);
|
|
30
|
+
args.splice(index, 2);
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
const configPath = flag("--config");
|
|
34
|
+
const outputDir = flag("--out") ?? "./candidates";
|
|
35
|
+
const inputKeys = (flag("--inputs") ?? "").split(",").filter(Boolean);
|
|
36
|
+
if (command === "validate") {
|
|
37
|
+
if (args.length !== 1)
|
|
38
|
+
throw new Error(help);
|
|
39
|
+
const candidate = JSON.parse(await readFile(args[0], "utf8"));
|
|
40
|
+
const verdict = validateWorkflow(candidate, { inputKeys: inputKeys.length ? inputKeys : undefined });
|
|
41
|
+
console.log(JSON.stringify(verdict, null, 2));
|
|
42
|
+
if (!verdict.ok)
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (command !== "author" && command !== "run")
|
|
47
|
+
throw new Error(help);
|
|
48
|
+
if (!configPath)
|
|
49
|
+
throw new Error("Supply --config with an explicit model and modelRuntime");
|
|
50
|
+
const config = await import(pathToFileURL(resolve(configPath)).href);
|
|
51
|
+
if (command === "author") {
|
|
52
|
+
if (args.length !== 1)
|
|
53
|
+
throw new Error(help);
|
|
54
|
+
const authored = await authorWorkflow({ request: args[0], outputDir, inputKeys, pi: config.default });
|
|
55
|
+
console.log(JSON.stringify({ path: authored.path, candidates: authored.candidates, checks: authored.checks }, null, 2));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (args.length !== 2)
|
|
59
|
+
throw new Error(help);
|
|
60
|
+
const workflow = JSON.parse(await readFile(args[0], "utf8"));
|
|
61
|
+
const input = JSON.parse(await readFile(args[1], "utf8"));
|
|
62
|
+
const result = await runWorkflow(workflow, input, { ...config.deps, runNode: createPiRunner(config.default) });
|
|
63
|
+
console.log(JSON.stringify(result, null, 2));
|
|
64
|
+
if (result.status === "escalated")
|
|
65
|
+
process.exitCode = 2;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
main(process.argv.slice(2)).catch(error => { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1; });
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
export declare const demoData: {
|
|
2
|
+
workflow: {
|
|
3
|
+
v: number;
|
|
4
|
+
name: string;
|
|
5
|
+
schemas: {
|
|
6
|
+
Question: {
|
|
7
|
+
$schema: string;
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
question: {
|
|
11
|
+
type: string;
|
|
12
|
+
minLength: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
16
|
+
additionalProperties: boolean;
|
|
17
|
+
};
|
|
18
|
+
Plan: {
|
|
19
|
+
$schema: string;
|
|
20
|
+
type: string;
|
|
21
|
+
properties: {
|
|
22
|
+
questions: {
|
|
23
|
+
minItems: number;
|
|
24
|
+
maxItems: number;
|
|
25
|
+
type: string;
|
|
26
|
+
items: {
|
|
27
|
+
type: string;
|
|
28
|
+
minLength: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
required: string[];
|
|
33
|
+
additionalProperties: boolean;
|
|
34
|
+
};
|
|
35
|
+
Finding: {
|
|
36
|
+
$schema: string;
|
|
37
|
+
type: string;
|
|
38
|
+
properties: {
|
|
39
|
+
question: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
answer: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
sources: {
|
|
46
|
+
minItems: number;
|
|
47
|
+
type: string;
|
|
48
|
+
items: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: {
|
|
51
|
+
id: {
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
text: {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
required: string[];
|
|
59
|
+
additionalProperties: boolean;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
required: string[];
|
|
64
|
+
additionalProperties: boolean;
|
|
65
|
+
};
|
|
66
|
+
Report: {
|
|
67
|
+
$schema: string;
|
|
68
|
+
type: string;
|
|
69
|
+
properties: {
|
|
70
|
+
answer: {
|
|
71
|
+
type: string;
|
|
72
|
+
};
|
|
73
|
+
findings: {
|
|
74
|
+
minItems: number;
|
|
75
|
+
type: string;
|
|
76
|
+
items: {
|
|
77
|
+
type: string;
|
|
78
|
+
properties: {
|
|
79
|
+
question: {
|
|
80
|
+
type: string;
|
|
81
|
+
};
|
|
82
|
+
answer: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
sources: {
|
|
86
|
+
minItems: number;
|
|
87
|
+
type: string;
|
|
88
|
+
items: {
|
|
89
|
+
type: string;
|
|
90
|
+
properties: {
|
|
91
|
+
id: {
|
|
92
|
+
type: string;
|
|
93
|
+
};
|
|
94
|
+
text: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
required: string[];
|
|
99
|
+
additionalProperties: boolean;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
required: string[];
|
|
104
|
+
additionalProperties: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
required: string[];
|
|
109
|
+
additionalProperties: boolean;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
input: {
|
|
113
|
+
schemaId: string;
|
|
114
|
+
};
|
|
115
|
+
output: {
|
|
116
|
+
schemaId: string;
|
|
117
|
+
path: string;
|
|
118
|
+
};
|
|
119
|
+
root: {
|
|
120
|
+
node: string;
|
|
121
|
+
steps: ({
|
|
122
|
+
node: string;
|
|
123
|
+
label: string;
|
|
124
|
+
instructions: string;
|
|
125
|
+
state: {
|
|
126
|
+
question: string;
|
|
127
|
+
findings?: undefined;
|
|
128
|
+
};
|
|
129
|
+
out: string;
|
|
130
|
+
as: string;
|
|
131
|
+
itemsPath?: undefined;
|
|
132
|
+
maxConcurrency?: undefined;
|
|
133
|
+
resultPath?: undefined;
|
|
134
|
+
body?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
node: string;
|
|
137
|
+
label: string;
|
|
138
|
+
itemsPath: string;
|
|
139
|
+
as: string;
|
|
140
|
+
maxConcurrency: number;
|
|
141
|
+
resultPath: string;
|
|
142
|
+
body: {
|
|
143
|
+
node: string;
|
|
144
|
+
label: string;
|
|
145
|
+
workflow: {
|
|
146
|
+
v: number;
|
|
147
|
+
name: string;
|
|
148
|
+
schemas: {
|
|
149
|
+
Question: {
|
|
150
|
+
$schema: string;
|
|
151
|
+
type: string;
|
|
152
|
+
properties: {
|
|
153
|
+
question: {
|
|
154
|
+
type: string;
|
|
155
|
+
minLength: number;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
required: string[];
|
|
159
|
+
additionalProperties: boolean;
|
|
160
|
+
};
|
|
161
|
+
Sources: {
|
|
162
|
+
$schema: string;
|
|
163
|
+
type: string;
|
|
164
|
+
properties: {
|
|
165
|
+
sources: {
|
|
166
|
+
type: string;
|
|
167
|
+
items: {
|
|
168
|
+
type: string;
|
|
169
|
+
properties: {
|
|
170
|
+
id: {
|
|
171
|
+
type: string;
|
|
172
|
+
};
|
|
173
|
+
text: {
|
|
174
|
+
type: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
required: string[];
|
|
178
|
+
additionalProperties: boolean;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
required: string[];
|
|
183
|
+
additionalProperties: boolean;
|
|
184
|
+
};
|
|
185
|
+
Finding: {
|
|
186
|
+
$schema: string;
|
|
187
|
+
type: string;
|
|
188
|
+
properties: {
|
|
189
|
+
question: {
|
|
190
|
+
type: string;
|
|
191
|
+
};
|
|
192
|
+
answer: {
|
|
193
|
+
type: string;
|
|
194
|
+
};
|
|
195
|
+
sources: {
|
|
196
|
+
minItems: number;
|
|
197
|
+
type: string;
|
|
198
|
+
items: {
|
|
199
|
+
type: string;
|
|
200
|
+
properties: {
|
|
201
|
+
id: {
|
|
202
|
+
type: string;
|
|
203
|
+
};
|
|
204
|
+
text: {
|
|
205
|
+
type: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
required: string[];
|
|
209
|
+
additionalProperties: boolean;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
required: string[];
|
|
214
|
+
additionalProperties: boolean;
|
|
215
|
+
};
|
|
216
|
+
EvidenceDecision: {
|
|
217
|
+
type: string;
|
|
218
|
+
additionalProperties: boolean;
|
|
219
|
+
required: string[];
|
|
220
|
+
properties: {
|
|
221
|
+
answersQuestion: {
|
|
222
|
+
type: string;
|
|
223
|
+
description: string;
|
|
224
|
+
criteria: {
|
|
225
|
+
true: string;
|
|
226
|
+
false: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
input: {
|
|
233
|
+
schemaId: string;
|
|
234
|
+
};
|
|
235
|
+
output: {
|
|
236
|
+
schemaId: string;
|
|
237
|
+
path: string;
|
|
238
|
+
};
|
|
239
|
+
root: {
|
|
240
|
+
node: string;
|
|
241
|
+
steps: ({
|
|
242
|
+
node: string;
|
|
243
|
+
label: string;
|
|
244
|
+
via: string;
|
|
245
|
+
tool: string;
|
|
246
|
+
args: {
|
|
247
|
+
question: string;
|
|
248
|
+
};
|
|
249
|
+
out: string;
|
|
250
|
+
as: string;
|
|
251
|
+
deadline_s: number;
|
|
252
|
+
itemsPath?: undefined;
|
|
253
|
+
state?: undefined;
|
|
254
|
+
keep?: undefined;
|
|
255
|
+
when?: undefined;
|
|
256
|
+
kind?: undefined;
|
|
257
|
+
stage?: undefined;
|
|
258
|
+
summary?: undefined;
|
|
259
|
+
instructions?: undefined;
|
|
260
|
+
} | {
|
|
261
|
+
node: string;
|
|
262
|
+
label: string;
|
|
263
|
+
itemsPath: string;
|
|
264
|
+
state: {
|
|
265
|
+
subquestion: string;
|
|
266
|
+
question?: undefined;
|
|
267
|
+
sources?: undefined;
|
|
268
|
+
};
|
|
269
|
+
out: string;
|
|
270
|
+
as: string;
|
|
271
|
+
keep: {
|
|
272
|
+
path: string;
|
|
273
|
+
gte: number;
|
|
274
|
+
};
|
|
275
|
+
via?: undefined;
|
|
276
|
+
tool?: undefined;
|
|
277
|
+
args?: undefined;
|
|
278
|
+
deadline_s?: undefined;
|
|
279
|
+
when?: undefined;
|
|
280
|
+
kind?: undefined;
|
|
281
|
+
stage?: undefined;
|
|
282
|
+
summary?: undefined;
|
|
283
|
+
instructions?: undefined;
|
|
284
|
+
} | {
|
|
285
|
+
node: string;
|
|
286
|
+
label: string;
|
|
287
|
+
when: {
|
|
288
|
+
predicate: string;
|
|
289
|
+
path: string;
|
|
290
|
+
};
|
|
291
|
+
kind: string;
|
|
292
|
+
stage: string;
|
|
293
|
+
summary: string;
|
|
294
|
+
via?: undefined;
|
|
295
|
+
tool?: undefined;
|
|
296
|
+
args?: undefined;
|
|
297
|
+
out?: undefined;
|
|
298
|
+
as?: undefined;
|
|
299
|
+
deadline_s?: undefined;
|
|
300
|
+
itemsPath?: undefined;
|
|
301
|
+
state?: undefined;
|
|
302
|
+
keep?: undefined;
|
|
303
|
+
instructions?: undefined;
|
|
304
|
+
} | {
|
|
305
|
+
node: string;
|
|
306
|
+
label: string;
|
|
307
|
+
instructions: string;
|
|
308
|
+
state: {
|
|
309
|
+
question: string;
|
|
310
|
+
sources: string;
|
|
311
|
+
subquestion?: undefined;
|
|
312
|
+
};
|
|
313
|
+
out: string;
|
|
314
|
+
as: string;
|
|
315
|
+
via?: undefined;
|
|
316
|
+
tool?: undefined;
|
|
317
|
+
args?: undefined;
|
|
318
|
+
deadline_s?: undefined;
|
|
319
|
+
itemsPath?: undefined;
|
|
320
|
+
keep?: undefined;
|
|
321
|
+
when?: undefined;
|
|
322
|
+
kind?: undefined;
|
|
323
|
+
stage?: undefined;
|
|
324
|
+
summary?: undefined;
|
|
325
|
+
})[];
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
input: {
|
|
329
|
+
question: string;
|
|
330
|
+
};
|
|
331
|
+
out: string;
|
|
332
|
+
as: string;
|
|
333
|
+
};
|
|
334
|
+
instructions?: undefined;
|
|
335
|
+
state?: undefined;
|
|
336
|
+
out?: undefined;
|
|
337
|
+
} | {
|
|
338
|
+
node: string;
|
|
339
|
+
label: string;
|
|
340
|
+
instructions: string;
|
|
341
|
+
state: {
|
|
342
|
+
question: string;
|
|
343
|
+
findings: string;
|
|
344
|
+
};
|
|
345
|
+
out: string;
|
|
346
|
+
as: string;
|
|
347
|
+
itemsPath?: undefined;
|
|
348
|
+
maxConcurrency?: undefined;
|
|
349
|
+
resultPath?: undefined;
|
|
350
|
+
body?: undefined;
|
|
351
|
+
})[];
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
question: string;
|
|
355
|
+
sources: {
|
|
356
|
+
id: string;
|
|
357
|
+
text: string;
|
|
358
|
+
}[];
|
|
359
|
+
subquestions: string[];
|
|
360
|
+
evidenceIds: string[];
|
|
361
|
+
};
|