@agwab/pi-workflow 0.1.0 → 0.1.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.
Files changed (58) hide show
  1. package/README.md +14 -3
  2. package/agents/researcher.md +17 -7
  3. package/dist/artifact-graph-runtime.js +1 -0
  4. package/dist/compiler.js +2 -2
  5. package/dist/dynamic-generated-task-runtime.js +4 -3
  6. package/dist/dynamic-runtime-bundle.js +3 -2
  7. package/dist/extension.js +40 -1
  8. package/dist/subagent-backend.js +82 -27
  9. package/dist/tool-metadata.d.ts +1 -0
  10. package/dist/tool-metadata.js +13 -1
  11. package/dist/workflow-artifact-extension.js +3 -2
  12. package/dist/workflow-artifact-tool.js +84 -4
  13. package/dist/workflow-web-source-extension.d.ts +43 -0
  14. package/dist/workflow-web-source-extension.js +1194 -0
  15. package/dist/workflow-web-source.d.ts +171 -0
  16. package/dist/workflow-web-source.js +897 -0
  17. package/docs/usage.md +32 -45
  18. package/node_modules/@agwab/pi-subagent/package.json +1 -1
  19. package/node_modules/@agwab/pi-subagent/src/api.ts +245 -132
  20. package/node_modules/@agwab/pi-subagent/src/artifacts/result.ts +243 -163
  21. package/node_modules/@agwab/pi-subagent/src/core/constants.ts +117 -90
  22. package/node_modules/@agwab/pi-subagent/src/core/validation.ts +728 -475
  23. package/node_modules/@agwab/pi-subagent/src/orchestrate/run.ts +305 -209
  24. package/node_modules/@agwab/pi-subagent/src/runners/headless-model.ts +750 -439
  25. package/node_modules/@agwab/pi-subagent/src/runners/tmux.ts +422 -268
  26. package/package.json +3 -4
  27. package/skills/workflow-guide/scaffolds/object-tool-fallback/schemas/fetch-control.schema.json +1 -1
  28. package/skills/workflow-guide/scaffolds/object-tool-fallback/spec.json +4 -3
  29. package/src/artifact-graph-runtime.ts +1 -0
  30. package/src/compiler.ts +2 -1
  31. package/src/dynamic-generated-task-runtime.ts +4 -2
  32. package/src/dynamic-runtime-bundle.ts +3 -2
  33. package/src/extension.ts +46 -1
  34. package/src/subagent-backend.ts +121 -37
  35. package/src/tool-metadata.ts +22 -1
  36. package/src/workflow-artifact-extension.ts +3 -2
  37. package/src/workflow-artifact-tool.ts +96 -4
  38. package/src/workflow-web-source-extension.ts +1411 -0
  39. package/src/workflow-web-source.ts +1171 -0
  40. package/workflows/README.md +1 -1
  41. package/workflows/deep-research/helpers/claim-evidence-gate.mjs +474 -40
  42. package/workflows/deep-research/helpers/final-audit-packet.mjs +219 -0
  43. package/workflows/deep-research/helpers/normalize-input-packet.mjs +436 -0
  44. package/workflows/deep-research/helpers/render-executive.mjs +571 -198
  45. package/workflows/deep-research/schemas/deep-research-executive-render-control.schema.json +35 -8
  46. package/workflows/deep-research/schemas/deep-research-normalize-claims-control.schema.json +45 -4
  47. package/workflows/deep-research/schemas/deep-research-verify-claims-control.schema.json +0 -2
  48. package/workflows/deep-research/spec.json +36 -21
  49. package/workflows/deep-review/helpers/render-review-report.mjs +502 -0
  50. package/workflows/deep-review/schemas/deep-review-render-control.schema.json +50 -0
  51. package/workflows/deep-review/spec.json +22 -1
  52. package/docs/release.md +0 -89
  53. package/node_modules/@pondwader/socks5-server/.DS_Store +0 -0
  54. package/node_modules/commander/.DS_Store +0 -0
  55. package/node_modules/jiti/.DS_Store +0 -0
  56. package/node_modules/node-forge/.DS_Store +0 -0
  57. package/node_modules/shell-quote/.DS_Store +0 -0
  58. package/node_modules/zod/.DS_Store +0 -0
@@ -1,28 +1,45 @@
1
1
  export const BACKENDS = ["inline", "headless", "tmux", "auto"] as const;
2
2
  export const RESOLVED_BACKENDS = ["inline", "headless", "tmux"] as const;
3
- export const STATUSES = ["pending", "running", "completed", "failed", "cancelled"] as const;
3
+ export const STATUSES = [
4
+ "pending",
5
+ "running",
6
+ "completed",
7
+ "failed",
8
+ "cancelled",
9
+ ] as const;
4
10
  export const FAILURE_KINDS = [
5
- "validation",
6
- "spawn",
7
- "timeout",
8
- "abort",
9
- "cancelled",
10
- "sandbox",
11
- "rpc",
12
- "model",
13
- "tool",
14
- "exit",
15
- "parse",
16
- "internal",
17
- "stale",
11
+ "validation",
12
+ "spawn",
13
+ "timeout",
14
+ "abort",
15
+ "cancelled",
16
+ "sandbox",
17
+ "rpc",
18
+ "model",
19
+ "tool",
20
+ "exit",
21
+ "parse",
22
+ "internal",
23
+ "stale",
18
24
  ] as const;
19
25
  export const EXECUTION_MODES = ["single", "parallel"] as const;
20
- export const ASYNC_DEPENDENCIES = ["needed-before-final", "background", "unclassified"] as const;
26
+ export const ASYNC_DEPENDENCIES = [
27
+ "needed-before-final",
28
+ "background",
29
+ "unclassified",
30
+ ] as const;
21
31
  export const AGENT_SCOPES = ["auto", "global", "project"] as const;
22
32
  export const WORKSPACE_MODES = ["shared", "worktree", "auto"] as const;
23
33
  export const WORKTREE_POLICIES = ["auto", "required", "never"] as const;
24
34
  export const ON_COMPLETE_ACTIONS = ["return", "notify", "detach"] as const;
25
- export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const;
35
+ export const THINKING_LEVELS = [
36
+ "off",
37
+ "minimal",
38
+ "low",
39
+ "medium",
40
+ "high",
41
+ "xhigh",
42
+ ] as const;
26
43
 
27
44
  export type Backend = (typeof BACKENDS)[number];
28
45
  export type ResolvedBackend = (typeof RESOLVED_BACKENDS)[number];
@@ -37,125 +54,135 @@ export type OnCompleteAction = (typeof ON_COMPLETE_ACTIONS)[number];
37
54
  export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
38
55
 
39
56
  export interface SandboxOptionsInput {
40
- /**
41
- * Network domains the sandboxed child process may reach (e.g. "api.anthropic.com",
42
- * "*.npmjs.org"). The whole child Pi runs inside the sandbox boundary, so the model
43
- * provider endpoint must be listed here for model-backed runs to work. Omitted or
44
- * empty means no network access (deny-all), matching `sandbox: true`.
45
- */
46
- allowedDomains?: string[];
57
+ /**
58
+ * Network domains the sandboxed child process may reach (e.g. "api.anthropic.com",
59
+ * "*.npmjs.org"). The whole child Pi runs inside the sandbox boundary, so the model
60
+ * provider endpoint must be listed here for model-backed runs to work. Omitted or
61
+ * empty means no network access (deny-all), matching `sandbox: true`.
62
+ */
63
+ allowedDomains?: string[];
47
64
  }
48
65
 
49
66
  export type SandboxInput = true | SandboxOptionsInput;
50
67
 
51
- export function sandboxAllowedDomains(sandbox: SandboxInput | null | undefined): string[] {
52
- if (sandbox === undefined || sandbox === null || sandbox === true) return [];
53
- return sandbox.allowedDomains ?? [];
68
+ export function sandboxAllowedDomains(
69
+ sandbox: SandboxInput | null | undefined,
70
+ ): string[] {
71
+ if (sandbox === undefined || sandbox === null || sandbox === true) return [];
72
+ return sandbox.allowedDomains ?? [];
54
73
  }
55
74
 
56
75
  export interface WorkspaceInput {
57
- mode?: WorkspaceMode;
58
- path?: string;
76
+ mode?: WorkspaceMode;
77
+ path?: string;
59
78
  }
60
79
 
61
80
  export interface SubagentTaskInput {
62
- agent?: string;
63
- task?: string;
64
- roleContext?: string;
65
- agentScope?: AgentScope;
66
- confirmProjectAgents?: boolean;
67
- sandbox?: SandboxInput | null;
68
- visible?: boolean;
69
- cwd?: string;
70
- timeoutMs?: number;
71
- model?: string;
72
- thinking?: ThinkingLevel;
73
- tools?: string[];
74
- systemPrompt?: string;
75
- skills?: string[];
76
- extensions?: string[];
77
- captureToolCalls?: boolean;
81
+ agent?: string;
82
+ task?: string;
83
+ roleContext?: string;
84
+ agentScope?: AgentScope;
85
+ confirmProjectAgents?: boolean;
86
+ sandbox?: SandboxInput | null;
87
+ visible?: boolean;
88
+ cwd?: string;
89
+ timeoutMs?: number;
90
+ model?: string;
91
+ sessionId?: string;
92
+ thinking?: ThinkingLevel;
93
+ tools?: string[];
94
+ systemPrompt?: string;
95
+ skills?: string[];
96
+ extensions?: string[];
97
+ captureToolCalls?: boolean;
78
98
  }
79
99
 
80
100
  export interface ResolveInput {
81
- backend?: Backend;
82
- sandbox?: SandboxInput | null;
83
- visible?: boolean;
84
- agent?: string;
85
- task?: string;
86
- roleContext?: string;
87
- agentScope?: AgentScope;
88
- confirmProjectAgents?: boolean;
89
- mode?: ExecutionMode;
90
- tasks?: SubagentTaskInput[];
91
- concurrency?: number;
92
- asyncDependency?: AsyncDependency;
93
- workspace?: WorkspaceInput | WorkspaceMode;
94
- worktree?: boolean | string;
95
- worktreePolicy?: WorktreePolicy;
96
- cwd?: string;
97
- async?: boolean;
98
- onComplete?: OnCompleteAction;
99
- timeoutMs?: number;
100
- model?: string;
101
- thinking?: ThinkingLevel;
102
- tools?: string[];
103
- systemPrompt?: string;
104
- skills?: string[];
105
- extensions?: string[];
106
- captureToolCalls?: boolean;
107
- runsDir?: string;
108
- correlationId?: string;
109
- /** Pi session id of the parent that launched this run. Injected from ctx, not a model-settable tool arg. */
110
- parentSessionId?: string;
101
+ backend?: Backend;
102
+ sandbox?: SandboxInput | null;
103
+ visible?: boolean;
104
+ agent?: string;
105
+ task?: string;
106
+ roleContext?: string;
107
+ agentScope?: AgentScope;
108
+ confirmProjectAgents?: boolean;
109
+ mode?: ExecutionMode;
110
+ tasks?: SubagentTaskInput[];
111
+ concurrency?: number;
112
+ asyncDependency?: AsyncDependency;
113
+ workspace?: WorkspaceInput | WorkspaceMode;
114
+ worktree?: boolean | string;
115
+ worktreePolicy?: WorktreePolicy;
116
+ cwd?: string;
117
+ async?: boolean;
118
+ onComplete?: OnCompleteAction;
119
+ timeoutMs?: number;
120
+ model?: string;
121
+ thinking?: ThinkingLevel;
122
+ tools?: string[];
123
+ systemPrompt?: string;
124
+ skills?: string[];
125
+ extensions?: string[];
126
+ captureToolCalls?: boolean;
127
+ runsDir?: string;
128
+ correlationId?: string;
129
+ /** Pi session id to attach a child headless run to when explicitly set by code API. */
130
+ sessionId?: string;
131
+ /** Pi session id of the parent that launched this run. Injected from ctx, not a model-settable tool arg. */
132
+ parentSessionId?: string;
111
133
  }
112
134
 
113
135
  export interface ResolveSuccess {
114
- backend: ResolvedBackend;
115
- status: "completed";
136
+ backend: ResolvedBackend;
137
+ status: "completed";
116
138
  }
117
139
 
118
140
  export interface ResolveValidationFailure {
119
- backend?: ResolvedBackend;
120
- status: "failed";
121
- failureKind: "validation";
122
- error: string;
141
+ backend?: ResolvedBackend;
142
+ status: "failed";
143
+ failureKind: "validation";
144
+ error: string;
123
145
  }
124
146
 
125
147
  export type ResolveOutput = ResolveSuccess | ResolveValidationFailure;
126
148
 
127
- function isOneOf<T extends string>(values: readonly T[], value: unknown): value is T {
128
- return typeof value === "string" && (values as readonly string[]).includes(value);
149
+ function isOneOf<T extends string>(
150
+ values: readonly T[],
151
+ value: unknown,
152
+ ): value is T {
153
+ return (
154
+ typeof value === "string" && (values as readonly string[]).includes(value)
155
+ );
129
156
  }
130
157
 
131
158
  export function isBackend(value: unknown): value is Backend {
132
- return isOneOf(BACKENDS, value);
159
+ return isOneOf(BACKENDS, value);
133
160
  }
134
161
 
135
162
  export function isExecutionMode(value: unknown): value is ExecutionMode {
136
- return isOneOf(EXECUTION_MODES, value);
163
+ return isOneOf(EXECUTION_MODES, value);
137
164
  }
138
165
 
139
166
  export function isAsyncDependency(value: unknown): value is AsyncDependency {
140
- return isOneOf(ASYNC_DEPENDENCIES, value);
167
+ return isOneOf(ASYNC_DEPENDENCIES, value);
141
168
  }
142
169
 
143
170
  export function isAgentScope(value: unknown): value is AgentScope {
144
- return isOneOf(AGENT_SCOPES, value);
171
+ return isOneOf(AGENT_SCOPES, value);
145
172
  }
146
173
 
147
174
  export function isWorkspaceMode(value: unknown): value is WorkspaceMode {
148
- return isOneOf(WORKSPACE_MODES, value);
175
+ return isOneOf(WORKSPACE_MODES, value);
149
176
  }
150
177
 
151
178
  export function isWorktreePolicy(value: unknown): value is WorktreePolicy {
152
- return isOneOf(WORKTREE_POLICIES, value);
179
+ return isOneOf(WORKTREE_POLICIES, value);
153
180
  }
154
181
 
155
182
  export function isOnCompleteAction(value: unknown): value is OnCompleteAction {
156
- return isOneOf(ON_COMPLETE_ACTIONS, value);
183
+ return isOneOf(ON_COMPLETE_ACTIONS, value);
157
184
  }
158
185
 
159
186
  export function isThinkingLevel(value: unknown): value is ThinkingLevel {
160
- return isOneOf(THINKING_LEVELS, value);
187
+ return isOneOf(THINKING_LEVELS, value);
161
188
  }