@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
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
// Generated by scripts/build-pi-demo.mjs from the public research example.
|
|
2
|
+
export const demoData = {
|
|
3
|
+
"workflow": {
|
|
4
|
+
"v": 2,
|
|
5
|
+
"name": "deep-research",
|
|
6
|
+
"schemas": {
|
|
7
|
+
"Question": {
|
|
8
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"question": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"question"
|
|
18
|
+
],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
},
|
|
21
|
+
"Plan": {
|
|
22
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"questions": {
|
|
26
|
+
"minItems": 1,
|
|
27
|
+
"maxItems": 5,
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": [
|
|
36
|
+
"questions"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"Finding": {
|
|
41
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"question": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
},
|
|
47
|
+
"answer": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"sources": {
|
|
51
|
+
"minItems": 1,
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"id": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
},
|
|
59
|
+
"text": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": [
|
|
64
|
+
"id",
|
|
65
|
+
"text"
|
|
66
|
+
],
|
|
67
|
+
"additionalProperties": false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"question",
|
|
73
|
+
"answer",
|
|
74
|
+
"sources"
|
|
75
|
+
],
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
},
|
|
78
|
+
"Report": {
|
|
79
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"answer": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"findings": {
|
|
86
|
+
"minItems": 1,
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"properties": {
|
|
91
|
+
"question": {
|
|
92
|
+
"type": "string"
|
|
93
|
+
},
|
|
94
|
+
"answer": {
|
|
95
|
+
"type": "string"
|
|
96
|
+
},
|
|
97
|
+
"sources": {
|
|
98
|
+
"minItems": 1,
|
|
99
|
+
"type": "array",
|
|
100
|
+
"items": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"id": {
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
106
|
+
"text": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": [
|
|
111
|
+
"id",
|
|
112
|
+
"text"
|
|
113
|
+
],
|
|
114
|
+
"additionalProperties": false
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"required": [
|
|
119
|
+
"question",
|
|
120
|
+
"answer",
|
|
121
|
+
"sources"
|
|
122
|
+
],
|
|
123
|
+
"additionalProperties": false
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"required": [
|
|
128
|
+
"answer",
|
|
129
|
+
"findings"
|
|
130
|
+
],
|
|
131
|
+
"additionalProperties": false
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"input": {
|
|
135
|
+
"schemaId": "Question"
|
|
136
|
+
},
|
|
137
|
+
"output": {
|
|
138
|
+
"schemaId": "Report",
|
|
139
|
+
"path": "report"
|
|
140
|
+
},
|
|
141
|
+
"root": {
|
|
142
|
+
"node": "chain",
|
|
143
|
+
"steps": [
|
|
144
|
+
{
|
|
145
|
+
"node": "decide",
|
|
146
|
+
"label": "plan",
|
|
147
|
+
"instructions": "Break the research question into up to five distinct, answerable subquestions. Each runs independently: include its subject and relevant context so it makes sense without the original question.",
|
|
148
|
+
"state": {
|
|
149
|
+
"question": "{question}"
|
|
150
|
+
},
|
|
151
|
+
"out": "Plan",
|
|
152
|
+
"as": "plan"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"node": "map",
|
|
156
|
+
"label": "research",
|
|
157
|
+
"itemsPath": "plan.questions",
|
|
158
|
+
"as": "findings",
|
|
159
|
+
"maxConcurrency": 3,
|
|
160
|
+
"resultPath": "finding",
|
|
161
|
+
"body": {
|
|
162
|
+
"node": "workflow",
|
|
163
|
+
"label": "research-question",
|
|
164
|
+
"workflow": {
|
|
165
|
+
"v": 2,
|
|
166
|
+
"name": "research-one-question",
|
|
167
|
+
"schemas": {
|
|
168
|
+
"Question": {
|
|
169
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {
|
|
172
|
+
"question": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"minLength": 1
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": [
|
|
178
|
+
"question"
|
|
179
|
+
],
|
|
180
|
+
"additionalProperties": false
|
|
181
|
+
},
|
|
182
|
+
"Sources": {
|
|
183
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
184
|
+
"type": "object",
|
|
185
|
+
"properties": {
|
|
186
|
+
"sources": {
|
|
187
|
+
"type": "array",
|
|
188
|
+
"items": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"id": {
|
|
192
|
+
"type": "string"
|
|
193
|
+
},
|
|
194
|
+
"text": {
|
|
195
|
+
"type": "string"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"required": [
|
|
199
|
+
"id",
|
|
200
|
+
"text"
|
|
201
|
+
],
|
|
202
|
+
"additionalProperties": false
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"sources"
|
|
208
|
+
],
|
|
209
|
+
"additionalProperties": false
|
|
210
|
+
},
|
|
211
|
+
"Finding": {
|
|
212
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
213
|
+
"type": "object",
|
|
214
|
+
"properties": {
|
|
215
|
+
"question": {
|
|
216
|
+
"type": "string"
|
|
217
|
+
},
|
|
218
|
+
"answer": {
|
|
219
|
+
"type": "string"
|
|
220
|
+
},
|
|
221
|
+
"sources": {
|
|
222
|
+
"minItems": 1,
|
|
223
|
+
"type": "array",
|
|
224
|
+
"items": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"id": {
|
|
228
|
+
"type": "string"
|
|
229
|
+
},
|
|
230
|
+
"text": {
|
|
231
|
+
"type": "string"
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"required": [
|
|
235
|
+
"id",
|
|
236
|
+
"text"
|
|
237
|
+
],
|
|
238
|
+
"additionalProperties": false
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"required": [
|
|
243
|
+
"question",
|
|
244
|
+
"answer",
|
|
245
|
+
"sources"
|
|
246
|
+
],
|
|
247
|
+
"additionalProperties": false
|
|
248
|
+
},
|
|
249
|
+
"EvidenceDecision": {
|
|
250
|
+
"type": "object",
|
|
251
|
+
"additionalProperties": false,
|
|
252
|
+
"required": [
|
|
253
|
+
"answersQuestion"
|
|
254
|
+
],
|
|
255
|
+
"properties": {
|
|
256
|
+
"answersQuestion": {
|
|
257
|
+
"type": "boolean",
|
|
258
|
+
"description": "Does this candidate passage provide concrete information for answering `subquestion`? Evaluate the passage's claims, not keyword overlap. A partial answer, a condition, a limitation, or evidence contradicting the proposed answer counts; the passage need not settle the whole question.",
|
|
259
|
+
"criteria": {
|
|
260
|
+
"true": "Reports a specific fact, observation, rule or limitation bearing on the subquestion. Keep supporting and contrary evidence, including qualified answers; do not require proof that the answer holds in every situation.",
|
|
261
|
+
"false": "Only mentions the topic, promises an unspecified benefit, omits the information needed to bear on the subquestion, or describes a different subject without establishing relevance."
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"input": {
|
|
268
|
+
"schemaId": "Question"
|
|
269
|
+
},
|
|
270
|
+
"output": {
|
|
271
|
+
"schemaId": "Finding",
|
|
272
|
+
"path": "finding"
|
|
273
|
+
},
|
|
274
|
+
"root": {
|
|
275
|
+
"node": "chain",
|
|
276
|
+
"steps": [
|
|
277
|
+
{
|
|
278
|
+
"node": "call",
|
|
279
|
+
"label": "search",
|
|
280
|
+
"via": "tool",
|
|
281
|
+
"tool": "search",
|
|
282
|
+
"args": {
|
|
283
|
+
"question": "{question}"
|
|
284
|
+
},
|
|
285
|
+
"out": "Sources",
|
|
286
|
+
"as": "search",
|
|
287
|
+
"deadline_s": 15
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"node": "sift",
|
|
291
|
+
"label": "screen-evidence",
|
|
292
|
+
"itemsPath": "search.sources",
|
|
293
|
+
"state": {
|
|
294
|
+
"subquestion": "{question}"
|
|
295
|
+
},
|
|
296
|
+
"out": "EvidenceDecision",
|
|
297
|
+
"as": "evidence",
|
|
298
|
+
"keep": {
|
|
299
|
+
"path": "answersQuestion",
|
|
300
|
+
"gte": 0.8
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"node": "escalate",
|
|
305
|
+
"label": "missing-evidence",
|
|
306
|
+
"when": {
|
|
307
|
+
"predicate": "empty",
|
|
308
|
+
"path": "evidence.items"
|
|
309
|
+
},
|
|
310
|
+
"kind": "needs_research",
|
|
311
|
+
"stage": "evidence",
|
|
312
|
+
"summary": "No selected evidence addresses: {question}"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"node": "agent",
|
|
316
|
+
"label": "write-finding",
|
|
317
|
+
"instructions": "Answer this subquestion using only the selected sources. Preserve contrary evidence, conditions and uncertainty. Say what cannot be determined when evidence is partial; do not turn a conditional claim into an unconditional conclusion. Return the question, answer and cited source records.",
|
|
318
|
+
"state": {
|
|
319
|
+
"question": "{question}",
|
|
320
|
+
"sources": "{evidence.items}"
|
|
321
|
+
},
|
|
322
|
+
"out": "Finding",
|
|
323
|
+
"as": "finding"
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"input": {
|
|
329
|
+
"question": "{item}"
|
|
330
|
+
},
|
|
331
|
+
"out": "Finding",
|
|
332
|
+
"as": "finding"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"node": "agent",
|
|
337
|
+
"label": "write-report",
|
|
338
|
+
"instructions": "Answer the original question from these findings. Preserve disagreements, conditions, uncertainty and remaining limitations. Keep unresolved questions explicit; do not present partial findings as conclusive.",
|
|
339
|
+
"state": {
|
|
340
|
+
"question": "{question}",
|
|
341
|
+
"findings": "{findings}"
|
|
342
|
+
},
|
|
343
|
+
"out": "Report",
|
|
344
|
+
"as": "report"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"question": "Should our small team move its documentation from a wiki into the code repository?",
|
|
350
|
+
"sources": [
|
|
351
|
+
{
|
|
352
|
+
"id": "review-guide",
|
|
353
|
+
"text": "In this fictional team, documentation changes in the repository require a pull request and an assigned reviewer."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"id": "advert",
|
|
357
|
+
"text": "Repository documentation will transform your whole business."
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"id": "editor-trial",
|
|
361
|
+
"text": "In the fictional trial, browser editing worked, but two non-developers needed help resolving merge conflicts."
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"id": "design-news",
|
|
365
|
+
"text": "The wiki product has changed its logo."
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"id": "search-trial",
|
|
369
|
+
"text": "The fictional repository search found filenames and exact words, but missed the synonyms people used in the wiki."
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"id": "search-advert",
|
|
373
|
+
"text": "Find anything instantly with our new search experience."
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"subquestions": [
|
|
377
|
+
"What review process would our team use for documentation changes in the code repository?",
|
|
378
|
+
"Can our team’s non-developers edit documentation in the code repository?",
|
|
379
|
+
"How does documentation search in the code repository compare with our wiki?"
|
|
380
|
+
],
|
|
381
|
+
"evidenceIds": [
|
|
382
|
+
"review-guide",
|
|
383
|
+
"editor-trial",
|
|
384
|
+
"search-trial"
|
|
385
|
+
]
|
|
386
|
+
};
|
package/dist/demo.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Workflow, WorkflowDeps } from '@parcha/agentrun-dsl';
|
|
2
|
+
import type { PiToolDefinition } from './types.js';
|
|
3
|
+
export declare const demoWorkflow: Workflow;
|
|
4
|
+
export declare const demoInput: {
|
|
5
|
+
question: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const demoSources: {
|
|
8
|
+
id: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const demoQuestions: string[];
|
|
12
|
+
export declare function demoSearchTool(): PiToolDefinition;
|
|
13
|
+
export declare function scriptedDemoDeps(noEvidence?: boolean): WorkflowDeps;
|
package/dist/demo.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { demoData } from './demo-data.js';
|
|
2
|
+
export const demoWorkflow = demoData.workflow;
|
|
3
|
+
export const demoInput = { question: demoData.question };
|
|
4
|
+
export const demoSources = demoData.sources;
|
|
5
|
+
export const demoQuestions = demoData.subquestions;
|
|
6
|
+
export function demoSearchTool() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'search', label: 'Search example sources',
|
|
9
|
+
description: 'Read the bundled fictional wiki-migration sources. This does not search the internet.',
|
|
10
|
+
parameters: { type: 'object', properties: { question: { type: 'string' } }, required: ['question'], additionalProperties: false },
|
|
11
|
+
async execute(_id, _args, signal) {
|
|
12
|
+
signal?.throwIfAborted();
|
|
13
|
+
return { content: [{ type: 'text', text: JSON.stringify({ sources: demoSources }) }], details: { sources: structuredClone(demoSources) } };
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function scriptedDemoDeps(noEvidence = false) {
|
|
18
|
+
return {
|
|
19
|
+
runEffect: async ({ node, signal }) => {
|
|
20
|
+
signal?.throwIfAborted();
|
|
21
|
+
if (node.tool !== 'search')
|
|
22
|
+
throw new Error('Unknown demo tool');
|
|
23
|
+
return { sources: structuredClone(demoSources) };
|
|
24
|
+
},
|
|
25
|
+
runJudge: async ({ questions, state, signal }) => {
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
const data = state;
|
|
28
|
+
const selected = demoData.evidenceIds[demoQuestions.indexOf(data.subquestion)];
|
|
29
|
+
return { answers: Object.fromEntries(Object.keys(questions).map(id => [id, {
|
|
30
|
+
type: 'noul', noul: !noEvidence && data.items[Number(id.split('.')[0])]?.item.id === selected ? 0.95 : 0.05,
|
|
31
|
+
}])) };
|
|
32
|
+
},
|
|
33
|
+
runNode: async ({ label, user, signal }) => {
|
|
34
|
+
signal?.throwIfAborted();
|
|
35
|
+
const input = JSON.parse(user);
|
|
36
|
+
switch (label.split('/').at(-1)) {
|
|
37
|
+
case 'plan': return { questions: demoQuestions };
|
|
38
|
+
case 'write-finding': return { question: input.question, answer: input.sources.map((s) => s.text).join(' '), sources: input.sources };
|
|
39
|
+
case 'write-report': return { answer: 'Pilot the repository workflow first. Reviews gain an explicit approval step, but editing and search still have gaps.', findings: input.findings };
|
|
40
|
+
default: throw new Error('Unknown scripted demo step');
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type Workflow, type WorkflowDeps, type WorkflowInspection, type Escalation } from '@parcha/agentrun-dsl';
|
|
2
|
+
type Event = Parameters<NonNullable<WorkflowDeps['onEvent']>>[0];
|
|
3
|
+
type Counts = {
|
|
4
|
+
agent: number;
|
|
5
|
+
judge: number;
|
|
6
|
+
tool: number;
|
|
7
|
+
};
|
|
8
|
+
export interface ExtensionServiceLimits {
|
|
9
|
+
/** null disables a host admission/deadline limit; omission retains defaults. */
|
|
10
|
+
deadlineMs: number | null;
|
|
11
|
+
maxAgentCalls: number | null;
|
|
12
|
+
maxJudgeCalls: number | null;
|
|
13
|
+
maxToolCalls: number | null;
|
|
14
|
+
maxConcurrency: number;
|
|
15
|
+
/** Retained sanitized event bytes, not an execution limit. Old events may be omitted. */
|
|
16
|
+
maxTraceBytes: number;
|
|
17
|
+
/** Independent per-event JSON safety limit; exceeding it fails closed. */
|
|
18
|
+
maxEventBytes: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ExtensionServiceOptions {
|
|
21
|
+
allowedTools?: readonly string[];
|
|
22
|
+
rubricSections?: Record<string, string>;
|
|
23
|
+
limits?: Partial<ExtensionServiceLimits>;
|
|
24
|
+
}
|
|
25
|
+
export interface PreparedWorkflow {
|
|
26
|
+
digest: string;
|
|
27
|
+
inspection: WorkflowInspection;
|
|
28
|
+
workflow: Workflow;
|
|
29
|
+
executableAuthorized: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ExtensionRunReport {
|
|
32
|
+
digest: string;
|
|
33
|
+
status: 'complete' | 'escalated' | 'failed' | 'interrupted';
|
|
34
|
+
calls: Counts;
|
|
35
|
+
events: Event[];
|
|
36
|
+
output?: unknown;
|
|
37
|
+
escalation?: Pick<Escalation, 'kind' | 'stage' | 'summary' | 'label' | 'executionPath'>;
|
|
38
|
+
error?: {
|
|
39
|
+
code: string;
|
|
40
|
+
message: string;
|
|
41
|
+
stage?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
reason?: string;
|
|
44
|
+
status?: number;
|
|
45
|
+
problems?: string[];
|
|
46
|
+
stateBytes?: number;
|
|
47
|
+
maxStateBytes?: number;
|
|
48
|
+
};
|
|
49
|
+
uncertainEffects?: {
|
|
50
|
+
idempotencyKey: string;
|
|
51
|
+
executionPath?: string;
|
|
52
|
+
outcome: 'unknown';
|
|
53
|
+
}[];
|
|
54
|
+
traceTruncated?: boolean;
|
|
55
|
+
/** Received counts include validated events only; rejected events have no safe byte size. */
|
|
56
|
+
trace?: {
|
|
57
|
+
policy: 'tail';
|
|
58
|
+
receivedEvents: number;
|
|
59
|
+
receivedBytes: number;
|
|
60
|
+
rejectedEvents: number;
|
|
61
|
+
retainedEvents: number;
|
|
62
|
+
retainedBytes: number;
|
|
63
|
+
droppedEvents: number;
|
|
64
|
+
droppedBytes: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ExtensionRunOptions {
|
|
68
|
+
deps: WorkflowDeps;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
/** Best-effort UI observation; suppressed after cancellation/disposal. */
|
|
71
|
+
onEvent?: (event: Event) => unknown;
|
|
72
|
+
/** Full sanitized valid stream, including cleanup before closure. Nonfatal;
|
|
73
|
+
* host owns persistence failures and any asynchronous queue/drain. */
|
|
74
|
+
onTraceEvent?: (event: Event) => unknown;
|
|
75
|
+
}
|
|
76
|
+
export declare class ExtensionServiceError extends Error {
|
|
77
|
+
readonly code: string;
|
|
78
|
+
constructor(code: string, message: string);
|
|
79
|
+
}
|
|
80
|
+
export declare const extensionStructuralLimits: Readonly<{
|
|
81
|
+
maxNodes: 200;
|
|
82
|
+
maxMapConcurrency: 8;
|
|
83
|
+
maxParallelBranches: 8;
|
|
84
|
+
}>;
|
|
85
|
+
export declare class WorkflowExtensionService {
|
|
86
|
+
private readonly allowedTools;
|
|
87
|
+
private readonly rubricSections;
|
|
88
|
+
private readonly limits;
|
|
89
|
+
private current?;
|
|
90
|
+
private lastReport?;
|
|
91
|
+
private disposed;
|
|
92
|
+
private active?;
|
|
93
|
+
constructor(options?: ExtensionServiceOptions);
|
|
94
|
+
private available;
|
|
95
|
+
private idle;
|
|
96
|
+
private check;
|
|
97
|
+
/** Admission and syntax feedback only: never executes code or authorizes a run. */
|
|
98
|
+
preflight(value: unknown, input?: Record<string, unknown>): WorkflowInspection;
|
|
99
|
+
prepare(value: unknown, options?: {
|
|
100
|
+
allowExecutableCandidates?: boolean;
|
|
101
|
+
}): PreparedWorkflow;
|
|
102
|
+
inspect(): {
|
|
103
|
+
current?: PreparedWorkflow;
|
|
104
|
+
lastReport?: ExtensionRunReport;
|
|
105
|
+
};
|
|
106
|
+
stop(): void;
|
|
107
|
+
dispose(): Promise<void>;
|
|
108
|
+
run(input: Record<string, unknown>, options: ExtensionRunOptions): Promise<ExtensionRunReport>;
|
|
109
|
+
}
|
|
110
|
+
export {};
|