@oh-my-pi/pi-coding-agent 17.0.1 → 17.0.3
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/CHANGELOG.md +162 -40
- package/dist/cli.js +4559 -4543
- package/dist/types/advisor/config.d.ts +14 -6
- package/dist/types/advisor/runtime.d.ts +20 -11
- package/dist/types/autolearn/controller.d.ts +1 -0
- package/dist/types/config/model-discovery.d.ts +17 -0
- package/dist/types/config/model-resolver.d.ts +6 -2
- package/dist/types/config/settings-schema.d.ts +39 -10
- package/dist/types/config/settings.d.ts +50 -0
- package/dist/types/cursor.d.ts +11 -0
- package/dist/types/discovery/helpers.d.ts +5 -2
- package/dist/types/eval/agent-bridge.d.ts +7 -19
- package/dist/types/exec/bash-executor.d.ts +2 -0
- package/dist/types/extensibility/extensions/managed-timers.d.ts +15 -0
- package/dist/types/extensibility/extensions/runner.d.ts +7 -0
- package/dist/types/extensibility/extensions/types.d.ts +18 -0
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +55 -1
- package/dist/types/extensibility/shared-events.d.ts +6 -0
- package/dist/types/extensibility/utils.d.ts +2 -2
- package/dist/types/lsp/client.d.ts +2 -0
- package/dist/types/lsp/types.d.ts +3 -0
- package/dist/types/mcp/transports/stdio.d.ts +42 -1
- package/dist/types/modes/components/advisor-config.d.ts +8 -1
- package/dist/types/modes/components/agent-hub.d.ts +15 -0
- package/dist/types/modes/components/hook-editor.d.ts +7 -0
- package/dist/types/modes/components/model-hub.d.ts +5 -2
- package/dist/types/modes/components/session-selector.d.ts +2 -0
- package/dist/types/modes/controllers/command-controller.d.ts +8 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +3 -1
- package/dist/types/modes/print-mode.d.ts +1 -1
- package/dist/types/modes/warp-events.d.ts +24 -0
- package/dist/types/modes/warp-events.test.d.ts +1 -0
- package/dist/types/plan-mode/model-transition.d.ts +47 -0
- package/dist/types/plan-mode/model-transition.test.d.ts +1 -0
- package/dist/types/registry/agent-lifecycle.d.ts +26 -1
- package/dist/types/registry/persisted-agents.d.ts +3 -0
- package/dist/types/sdk.d.ts +27 -5
- package/dist/types/session/agent-session.d.ts +34 -10
- package/dist/types/session/session-entries.d.ts +6 -1
- package/dist/types/session/session-history-format.d.ts +10 -0
- package/dist/types/session/session-manager.d.ts +19 -0
- package/dist/types/slash-commands/helpers/active-oauth-account.d.ts +9 -0
- package/dist/types/task/executor.d.ts +26 -1
- package/dist/types/task/index.d.ts +1 -1
- package/dist/types/task/label.d.ts +1 -1
- package/dist/types/task/parallel.d.ts +14 -0
- package/dist/types/task/structured-subagent.d.ts +111 -0
- package/dist/types/task/types.d.ts +51 -0
- package/dist/types/telemetry-export.d.ts +34 -9
- package/dist/types/tools/approval.d.ts +8 -0
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/essential-tools.d.ts +29 -0
- package/dist/types/tools/fetch.d.ts +4 -5
- package/dist/types/tools/hub/messaging.d.ts +5 -1
- package/dist/types/tools/image-gen.d.ts +2 -1
- package/dist/types/tools/index.d.ts +17 -1
- package/dist/types/tools/todo.d.ts +31 -0
- package/dist/types/tools/xdev.d.ts +11 -2
- package/dist/types/tui/tree-list.d.ts +7 -0
- package/dist/types/utils/markit.d.ts +11 -0
- package/dist/types/utils/title-generator.d.ts +2 -1
- package/dist/types/web/search/providers/kimi.d.ts +4 -1
- package/dist/types/web/search/types.d.ts +1 -1
- package/package.json +21 -16
- package/src/advisor/__tests__/advisor.test.ts +1304 -42
- package/src/advisor/__tests__/config.test.ts +58 -2
- package/src/advisor/config.ts +76 -24
- package/src/advisor/runtime.ts +445 -92
- package/src/autolearn/controller.ts +23 -28
- package/src/cli/file-processor.ts +1 -2
- package/src/cli.ts +5 -1
- package/src/config/model-discovery.ts +81 -21
- package/src/config/model-registry.ts +25 -6
- package/src/config/model-resolver.ts +14 -7
- package/src/config/settings-schema.ts +46 -9
- package/src/config/settings.ts +405 -25
- package/src/cursor.ts +20 -3
- package/src/debug/report-bundle.ts +40 -4
- package/src/discovery/helpers.ts +28 -5
- package/src/eval/__tests__/agent-bridge.test.ts +133 -47
- package/src/eval/__tests__/prelude-agent.test.ts +29 -0
- package/src/eval/agent-bridge.ts +104 -477
- package/src/eval/jl/prelude.jl +7 -6
- package/src/eval/js/shared/prelude.txt +5 -4
- package/src/eval/py/prelude.py +11 -39
- package/src/eval/rb/prelude.rb +5 -6
- package/src/exec/bash-executor.ts +14 -5
- package/src/extensibility/custom-tools/loader.ts +3 -3
- package/src/extensibility/custom-tools/wrapper.ts +2 -1
- package/src/extensibility/extensions/loader.ts +3 -3
- package/src/extensibility/extensions/managed-timers.ts +83 -0
- package/src/extensibility/extensions/runner.ts +26 -0
- package/src/extensibility/extensions/types.ts +18 -0
- package/src/extensibility/extensions/wrapper.ts +2 -1
- package/src/extensibility/hooks/loader.ts +3 -3
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +149 -8
- package/src/extensibility/plugins/legacy-pi-compat.ts +225 -22
- package/src/extensibility/plugins/manager.ts +2 -2
- package/src/extensibility/shared-events.ts +6 -0
- package/src/extensibility/utils.ts +91 -25
- package/src/irc/bus.ts +22 -3
- package/src/launch/broker.ts +3 -2
- package/src/launch/client.ts +2 -2
- package/src/launch/presence.ts +2 -2
- package/src/lsp/client.ts +58 -1
- package/src/lsp/index.ts +62 -6
- package/src/lsp/types.ts +3 -0
- package/src/main.ts +11 -8
- package/src/mcp/manager.ts +9 -3
- package/src/mcp/oauth-flow.ts +20 -0
- package/src/mcp/transports/stdio.test.ts +269 -1
- package/src/mcp/transports/stdio.ts +255 -24
- package/src/modes/components/advisor-config.ts +65 -3
- package/src/modes/components/agent-hub.ts +1 -72
- package/src/modes/components/ask-dialog.ts +1 -1
- package/src/modes/components/bash-execution.ts +7 -3
- package/src/modes/components/eval-execution.ts +3 -1
- package/src/modes/components/hook-editor.ts +18 -3
- package/src/modes/components/model-hub.ts +138 -42
- package/src/modes/components/session-selector.ts +4 -0
- package/src/modes/components/status-line/component.test.ts +1 -0
- package/src/modes/components/status-line/segments.ts +21 -6
- package/src/modes/controllers/command-controller.ts +167 -47
- package/src/modes/controllers/event-controller.ts +5 -0
- package/src/modes/controllers/extension-ui-controller.ts +4 -22
- package/src/modes/controllers/input-controller.ts +12 -12
- package/src/modes/controllers/selector-controller.ts +191 -31
- package/src/modes/interactive-mode.ts +169 -62
- package/src/modes/print-mode.ts +3 -3
- package/src/modes/rpc/host-tools.ts +2 -1
- package/src/modes/rpc/rpc-mode.ts +19 -4
- package/src/modes/warp-events.test.ts +794 -0
- package/src/modes/warp-events.ts +232 -0
- package/src/plan-mode/model-transition.test.ts +60 -0
- package/src/plan-mode/model-transition.ts +51 -0
- package/src/prompts/system/system-prompt.md +1 -1
- package/src/prompts/tools/eval.md +5 -2
- package/src/prompts/tools/read.md +1 -1
- package/src/prompts/tools/task.md +12 -8
- package/src/prompts/tools/write.md +1 -1
- package/src/registry/agent-lifecycle.ts +133 -18
- package/src/registry/persisted-agents.ts +74 -0
- package/src/sdk.ts +343 -122
- package/src/session/agent-session.ts +1359 -368
- package/src/session/session-entries.ts +6 -1
- package/src/session/session-history-format.ts +20 -5
- package/src/session/session-manager.ts +57 -0
- package/src/session/streaming-output.ts +41 -1
- package/src/slash-commands/builtin-registry.ts +7 -0
- package/src/slash-commands/helpers/active-oauth-account.ts +16 -0
- package/src/system-prompt.ts +7 -2
- package/src/task/executor.ts +100 -22
- package/src/task/index.ts +258 -429
- package/src/task/label.ts +2 -0
- package/src/task/parallel.ts +43 -0
- package/src/task/persisted-revive.ts +19 -7
- package/src/task/structured-subagent.ts +642 -0
- package/src/task/types.ts +58 -0
- package/src/telemetry-export.ts +453 -97
- package/src/tools/__tests__/eval-description.test.ts +1 -1
- package/src/tools/approval.ts +11 -0
- package/src/tools/bash.ts +71 -38
- package/src/tools/essential-tools.ts +45 -0
- package/src/tools/fetch.ts +28 -105
- package/src/tools/gh.ts +169 -2
- package/src/tools/hub/messaging.ts +16 -3
- package/src/tools/image-gen.ts +69 -7
- package/src/tools/index.ts +50 -15
- package/src/tools/path-utils.ts +1 -0
- package/src/tools/read.ts +62 -29
- package/src/tools/todo.ts +126 -13
- package/src/tools/write.ts +22 -4
- package/src/tools/xdev.ts +14 -3
- package/src/tui/tree-list.ts +39 -0
- package/src/utils/markit.ts +12 -0
- package/src/utils/title-generator.ts +15 -4
- package/src/utils/zip.ts +16 -1
- package/src/web/search/providers/kimi.ts +18 -12
- package/src/web/search/types.ts +6 -1
package/src/task/types.ts
CHANGED
|
@@ -7,6 +7,35 @@ import type { NestedRepoPatch } from "./worktree";
|
|
|
7
7
|
|
|
8
8
|
/** Source of an agent definition */
|
|
9
9
|
export type AgentSource = "bundled" | "user" | "project";
|
|
10
|
+
/**
|
|
11
|
+
* Enforcement policy for a structured subagent output schema.
|
|
12
|
+
*
|
|
13
|
+
* `permissive` preserves legacy retry-budget overrides; `strict` turns every
|
|
14
|
+
* invalid final payload, including an exhausted retry override, into a failed
|
|
15
|
+
* `schema_violation` result.
|
|
16
|
+
*/
|
|
17
|
+
export type StructuredSubagentSchemaMode = "permissive" | "strict";
|
|
18
|
+
|
|
19
|
+
/** Origin of the schema selected for a structured subagent invocation. */
|
|
20
|
+
export type StructuredSubagentSchemaSource = "caller" | "agent" | "session" | "none";
|
|
21
|
+
|
|
22
|
+
/** Final validation state of a structured subagent invocation. */
|
|
23
|
+
export type StructuredSubagentValidationStatus = "valid" | "invalid" | "unavailable";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parsed structured completion and its schema-validation metadata.
|
|
27
|
+
*
|
|
28
|
+
* `data` is present whenever a payload could be assembled or parsed, even when
|
|
29
|
+
* strict validation rejects it. `error` explains unavailable or invalid
|
|
30
|
+
* validation without requiring consumers to parse presentation text.
|
|
31
|
+
*/
|
|
32
|
+
export interface StructuredSubagentOutput {
|
|
33
|
+
source: StructuredSubagentSchemaSource;
|
|
34
|
+
mode: StructuredSubagentSchemaMode;
|
|
35
|
+
status: StructuredSubagentValidationStatus;
|
|
36
|
+
data?: unknown;
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
10
39
|
|
|
11
40
|
const parseNumber = (value: string | undefined, defaultValue: number): number => {
|
|
12
41
|
if (value) {
|
|
@@ -81,12 +110,16 @@ export const taskItemSchema = type({
|
|
|
81
110
|
"name?": "string",
|
|
82
111
|
agent: "string = 'task'",
|
|
83
112
|
task: "string",
|
|
113
|
+
"outputSchema?": "unknown",
|
|
114
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
84
115
|
"+": "delete",
|
|
85
116
|
});
|
|
86
117
|
const taskItemSchemaIsolated = type({
|
|
87
118
|
"name?": "string",
|
|
88
119
|
agent: "string = 'task'",
|
|
89
120
|
task: "string",
|
|
121
|
+
"outputSchema?": "unknown",
|
|
122
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
90
123
|
"isolated?": "boolean",
|
|
91
124
|
"+": "delete",
|
|
92
125
|
});
|
|
@@ -99,6 +132,10 @@ export interface TaskItem {
|
|
|
99
132
|
agent?: string;
|
|
100
133
|
/** The work; required by the schema. */
|
|
101
134
|
task?: string;
|
|
135
|
+
/** Caller-provided output schema; its presence overrides the selected agent's schema. */
|
|
136
|
+
outputSchema?: unknown;
|
|
137
|
+
/** Validation behavior for a caller-provided or inherited output schema. */
|
|
138
|
+
schemaMode?: "permissive" | "strict";
|
|
102
139
|
/** Run this spawn in an isolated worktree (batch form; flat form carries it top-level). */
|
|
103
140
|
isolated?: boolean;
|
|
104
141
|
}
|
|
@@ -107,6 +144,8 @@ export const taskSchema = type({
|
|
|
107
144
|
"name?": "string",
|
|
108
145
|
agent: "string = 'task'",
|
|
109
146
|
task: "string",
|
|
147
|
+
"outputSchema?": "unknown",
|
|
148
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
110
149
|
"isolated?": "boolean",
|
|
111
150
|
"+": "delete",
|
|
112
151
|
});
|
|
@@ -114,6 +153,8 @@ const taskSchemaNoIsolation = type({
|
|
|
114
153
|
"name?": "string",
|
|
115
154
|
agent: "string = 'task'",
|
|
116
155
|
task: "string",
|
|
156
|
+
"outputSchema?": "unknown",
|
|
157
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
117
158
|
"+": "delete",
|
|
118
159
|
});
|
|
119
160
|
const taskSchemaBatch = type({
|
|
@@ -156,6 +197,8 @@ function createTaskSchema(options: {
|
|
|
156
197
|
"name?": "string",
|
|
157
198
|
agent,
|
|
158
199
|
task: "string",
|
|
200
|
+
"outputSchema?": "unknown",
|
|
201
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
159
202
|
"isolated?": "boolean",
|
|
160
203
|
"+": "delete",
|
|
161
204
|
});
|
|
@@ -169,6 +212,8 @@ function createTaskSchema(options: {
|
|
|
169
212
|
"name?": "string",
|
|
170
213
|
agent,
|
|
171
214
|
task: "string",
|
|
215
|
+
"outputSchema?": "unknown",
|
|
216
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
172
217
|
"+": "delete",
|
|
173
218
|
});
|
|
174
219
|
return type.raw({
|
|
@@ -182,6 +227,8 @@ function createTaskSchema(options: {
|
|
|
182
227
|
"name?": "string",
|
|
183
228
|
agent,
|
|
184
229
|
task: "string",
|
|
230
|
+
"outputSchema?": "unknown",
|
|
231
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
185
232
|
"isolated?": "boolean",
|
|
186
233
|
"+": "delete",
|
|
187
234
|
});
|
|
@@ -190,6 +237,8 @@ function createTaskSchema(options: {
|
|
|
190
237
|
"name?": "string",
|
|
191
238
|
agent,
|
|
192
239
|
task: "string",
|
|
240
|
+
"outputSchema?": "unknown",
|
|
241
|
+
"schemaMode?": '"permissive" | "strict"',
|
|
193
242
|
"+": "delete",
|
|
194
243
|
});
|
|
195
244
|
}
|
|
@@ -231,6 +280,10 @@ export interface TaskParams {
|
|
|
231
280
|
agent?: string;
|
|
232
281
|
/** The work (flat form). */
|
|
233
282
|
task?: string;
|
|
283
|
+
/** Caller-provided output schema; its presence overrides the selected agent's schema. */
|
|
284
|
+
outputSchema?: unknown;
|
|
285
|
+
/** Validation behavior for a caller-provided or inherited output schema. */
|
|
286
|
+
schemaMode?: "permissive" | "strict";
|
|
234
287
|
/** Batch form (`task.batch`): one subagent per item. */
|
|
235
288
|
tasks?: TaskItem[];
|
|
236
289
|
/** Batch form: shared background prepended to every assignment; required by the batch schema. */
|
|
@@ -413,6 +466,11 @@ export interface SingleResult {
|
|
|
413
466
|
output: string;
|
|
414
467
|
stderr: string;
|
|
415
468
|
truncated: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* Parsed structured completion and validation metadata, when this invocation
|
|
471
|
+
* selected an output schema or strict schema mode.
|
|
472
|
+
*/
|
|
473
|
+
structuredOutput?: StructuredSubagentOutput;
|
|
416
474
|
durationMs: number;
|
|
417
475
|
/** Cumulative input + output + cacheWrite tokens across all turns. Excludes cacheRead (re-reads cached context every turn, making cumulative sum misleading). */
|
|
418
476
|
tokens: number;
|