@nicknisi/pi-workflows 0.3.1 → 0.3.2
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/dist/index.js +22 -40
- package/index.ts +22 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -261,48 +261,30 @@ export default function workflows(pi) {
|
|
|
261
261
|
name: 'workflow',
|
|
262
262
|
label: 'Workflow',
|
|
263
263
|
description: [
|
|
264
|
-
'Run a JavaScript workflow script that orchestrates subagents
|
|
265
|
-
|
|
266
|
-
'
|
|
267
|
-
'
|
|
268
|
-
|
|
269
|
-
'
|
|
270
|
-
|
|
271
|
-
'',
|
|
272
|
-
'
|
|
273
|
-
'
|
|
274
|
-
|
|
275
|
-
'
|
|
276
|
-
'
|
|
277
|
-
'',
|
|
278
|
-
'
|
|
279
|
-
'
|
|
280
|
-
'
|
|
281
|
-
'
|
|
282
|
-
'
|
|
283
|
-
'
|
|
284
|
-
'',
|
|
285
|
-
'
|
|
286
|
-
'schema (validated; lands in result.data), effort (thinking level), timeoutMs, maxTurns,',
|
|
287
|
-
'agentType (accepted but ignored — no agent-type registry; resolve systemPrompt in the',
|
|
288
|
-
'script). agent() throws `${kind}: ${error}` on failure — wrap with a safeAgent that returns',
|
|
289
|
-
'{ ok, value, error } so a failure inside parallel() does not collapse the wave.',
|
|
290
|
-
'',
|
|
291
|
-
'Runs are visible: every agent() spawn is a child in the subagent fleet (use the `fleet`',
|
|
292
|
-
'tool / `/fleet` from @nicknisi/pi-subagents, or `status`/`stop` here). The script itself',
|
|
293
|
-
'executes in the host process with full Node access — the same trust boundary as the bash',
|
|
294
|
-
'tool. Keep the returned value small: summaries, counts, key findings — never raw file dumps.',
|
|
264
|
+
'Run a JavaScript workflow script that orchestrates subagents, or manage runs. Actions: run,',
|
|
265
|
+
'list (saved workflow files), status (run record by runId), stop, pause, resume (hold active',
|
|
266
|
+
'runs before their next agent step). For run, pass EITHER script (inline JS) OR name (a saved',
|
|
267
|
+
'file stem from ~/.pi/agent/workflows/*.js or .pi/workflows/*.js), plus optional args (any JSON,',
|
|
268
|
+
'exposed as the `args` global). Prefer a saved workflow when one fits.',
|
|
269
|
+
'Script contract: the body is wrapped in an async function, so return the result with a',
|
|
270
|
+
'top-level `return`. Keep it small (summaries, counts, findings; never raw file contents). The',
|
|
271
|
+
'FIRST statement should be `export const meta = { name, description }`. Injected globals:',
|
|
272
|
+
'agent(prompt, opts), parallel(thunks), pipeline(items, ...stages), phase(name) (logging marker',
|
|
273
|
+
'only), log(...args), args, budget ({ total, spent, remaining }), cwd, checkpoint(label?),',
|
|
274
|
+
'ask(question, options?).',
|
|
275
|
+
'agent() opts: model, tools (default read-only [read, grep, find, ls]; pass tools explicitly for',
|
|
276
|
+
'builders), label, systemPrompt, schema (validated; agent() returns parsed data, otherwise text),',
|
|
277
|
+
'effort (thinking level), timeoutMs, maxTurns, worktree (when a patch is produced, agent() returns',
|
|
278
|
+
'{ value, patchPath, runId }). agent() throws `${kind}: ${error}` on failure, so wrap',
|
|
279
|
+
'it in a safeAgent() returning { ok, value, error } inside parallel(), or one failure collapses',
|
|
280
|
+
'the wave. parallel(thunks) takes zero-arg thunks: pass () => agent(...), not agent(...).',
|
|
281
|
+
'checkpoint(label?) gates the run on a human confirm (dismiss or reject throws and stops the',
|
|
282
|
+
'run). ask(question, options?) asks the human mid-run: select when options are given, yes/no',
|
|
283
|
+
'otherwise, undefined when dismissed. Use them before destructive or expensive steps.',
|
|
284
|
+
'Every agent() spawn is a child in the subagent fleet (fleet tool, or status/stop here). The',
|
|
285
|
+
'script runs in the host process with full Node access, the same trust boundary as bash.',
|
|
295
286
|
].join(' '),
|
|
296
287
|
promptSnippet: 'Run a JS workflow script orchestrating subagents',
|
|
297
|
-
promptGuidelines: [
|
|
298
|
-
'The script body is wrapped in an async function — a top-level `return value` is the contract for the result.',
|
|
299
|
-
'Lead with `export const meta = { name, description }` so the run is labeled in the result.',
|
|
300
|
-
'agent() throws on failure; wrap it in a safeAgent() that returns { ok, value, error } so a failure inside parallel() reports which stage died instead of collapsing the wave to null.',
|
|
301
|
-
'parallel(thunks) awaits Promise.all over zero-arg thunks — pass `() => agent(...)`, not `agent(...)`.',
|
|
302
|
-
'Children default to read-only tools (read, grep, find, ls); pass `tools` explicitly for builders.',
|
|
303
|
-
'Use log(...) for progress notes; they come back in the result details. phase(name) is a logging marker only.',
|
|
304
|
-
'Keep the returned value small — summaries, counts, key findings — never raw file contents.',
|
|
305
|
-
],
|
|
306
288
|
parameters: Type.Object({
|
|
307
289
|
action: Type.Union([
|
|
308
290
|
Type.Literal('run'),
|
package/index.ts
CHANGED
|
@@ -337,48 +337,30 @@ export default function workflows(pi: ExtensionAPI): void {
|
|
|
337
337
|
name: 'workflow',
|
|
338
338
|
label: 'Workflow',
|
|
339
339
|
description: [
|
|
340
|
-
'Run a JavaScript workflow script that orchestrates subagents
|
|
341
|
-
|
|
342
|
-
'
|
|
343
|
-
'
|
|
344
|
-
|
|
345
|
-
'
|
|
346
|
-
|
|
347
|
-
'',
|
|
348
|
-
'
|
|
349
|
-
'
|
|
350
|
-
|
|
351
|
-
'
|
|
352
|
-
'
|
|
353
|
-
'',
|
|
354
|
-
'
|
|
355
|
-
'
|
|
356
|
-
'
|
|
357
|
-
'
|
|
358
|
-
'
|
|
359
|
-
'
|
|
360
|
-
'',
|
|
361
|
-
'
|
|
362
|
-
'schema (validated; lands in result.data), effort (thinking level), timeoutMs, maxTurns,',
|
|
363
|
-
'agentType (accepted but ignored — no agent-type registry; resolve systemPrompt in the',
|
|
364
|
-
'script). agent() throws `${kind}: ${error}` on failure — wrap with a safeAgent that returns',
|
|
365
|
-
'{ ok, value, error } so a failure inside parallel() does not collapse the wave.',
|
|
366
|
-
'',
|
|
367
|
-
'Runs are visible: every agent() spawn is a child in the subagent fleet (use the `fleet`',
|
|
368
|
-
'tool / `/fleet` from @nicknisi/pi-subagents, or `status`/`stop` here). The script itself',
|
|
369
|
-
'executes in the host process with full Node access — the same trust boundary as the bash',
|
|
370
|
-
'tool. Keep the returned value small: summaries, counts, key findings — never raw file dumps.',
|
|
340
|
+
'Run a JavaScript workflow script that orchestrates subagents, or manage runs. Actions: run,',
|
|
341
|
+
'list (saved workflow files), status (run record by runId), stop, pause, resume (hold active',
|
|
342
|
+
'runs before their next agent step). For run, pass EITHER script (inline JS) OR name (a saved',
|
|
343
|
+
'file stem from ~/.pi/agent/workflows/*.js or .pi/workflows/*.js), plus optional args (any JSON,',
|
|
344
|
+
'exposed as the `args` global). Prefer a saved workflow when one fits.',
|
|
345
|
+
'Script contract: the body is wrapped in an async function, so return the result with a',
|
|
346
|
+
'top-level `return`. Keep it small (summaries, counts, findings; never raw file contents). The',
|
|
347
|
+
'FIRST statement should be `export const meta = { name, description }`. Injected globals:',
|
|
348
|
+
'agent(prompt, opts), parallel(thunks), pipeline(items, ...stages), phase(name) (logging marker',
|
|
349
|
+
'only), log(...args), args, budget ({ total, spent, remaining }), cwd, checkpoint(label?),',
|
|
350
|
+
'ask(question, options?).',
|
|
351
|
+
'agent() opts: model, tools (default read-only [read, grep, find, ls]; pass tools explicitly for',
|
|
352
|
+
'builders), label, systemPrompt, schema (validated; agent() returns parsed data, otherwise text),',
|
|
353
|
+
'effort (thinking level), timeoutMs, maxTurns, worktree (when a patch is produced, agent() returns',
|
|
354
|
+
'{ value, patchPath, runId }). agent() throws `${kind}: ${error}` on failure, so wrap',
|
|
355
|
+
'it in a safeAgent() returning { ok, value, error } inside parallel(), or one failure collapses',
|
|
356
|
+
'the wave. parallel(thunks) takes zero-arg thunks: pass () => agent(...), not agent(...).',
|
|
357
|
+
'checkpoint(label?) gates the run on a human confirm (dismiss or reject throws and stops the',
|
|
358
|
+
'run). ask(question, options?) asks the human mid-run: select when options are given, yes/no',
|
|
359
|
+
'otherwise, undefined when dismissed. Use them before destructive or expensive steps.',
|
|
360
|
+
'Every agent() spawn is a child in the subagent fleet (fleet tool, or status/stop here). The',
|
|
361
|
+
'script runs in the host process with full Node access, the same trust boundary as bash.',
|
|
371
362
|
].join(' '),
|
|
372
363
|
promptSnippet: 'Run a JS workflow script orchestrating subagents',
|
|
373
|
-
promptGuidelines: [
|
|
374
|
-
'The script body is wrapped in an async function — a top-level `return value` is the contract for the result.',
|
|
375
|
-
'Lead with `export const meta = { name, description }` so the run is labeled in the result.',
|
|
376
|
-
'agent() throws on failure; wrap it in a safeAgent() that returns { ok, value, error } so a failure inside parallel() reports which stage died instead of collapsing the wave to null.',
|
|
377
|
-
'parallel(thunks) awaits Promise.all over zero-arg thunks — pass `() => agent(...)`, not `agent(...)`.',
|
|
378
|
-
'Children default to read-only tools (read, grep, find, ls); pass `tools` explicitly for builders.',
|
|
379
|
-
'Use log(...) for progress notes; they come back in the result details. phase(name) is a logging marker only.',
|
|
380
|
-
'Keep the returned value small — summaries, counts, key findings — never raw file contents.',
|
|
381
|
-
],
|
|
382
364
|
parameters: Type.Object({
|
|
383
365
|
action: Type.Union(
|
|
384
366
|
[
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicknisi/pi-workflows",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Model-facing front door to the first-party workflow engine — run JS workflow scripts over the subagent runtime, replacing the third-party @quintinshaw/pi-dynamic-workflows extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|