@oh-my-pi/pi-coding-agent 15.10.12 → 15.11.0
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 +60 -3
- package/dist/cli.js +841 -803
- package/dist/types/async/index.d.ts +0 -1
- package/dist/types/cli/gallery-fixtures/types.d.ts +5 -0
- package/dist/types/config/keybindings.d.ts +6 -1
- package/dist/types/config/settings-schema.d.ts +56 -33
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/types.d.ts +2 -2
- package/dist/types/extensibility/shared-events.d.ts +2 -2
- package/dist/types/internal-urls/history-protocol.d.ts +14 -0
- package/dist/types/internal-urls/index.d.ts +1 -0
- package/dist/types/internal-urls/types.d.ts +1 -1
- package/dist/types/irc/bus.d.ts +66 -0
- package/dist/types/modes/components/agent-hub.d.ts +30 -0
- package/dist/types/modes/components/compaction-summary-message.d.ts +10 -4
- package/dist/types/modes/components/custom-editor.d.ts +2 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/ttsr-notification.d.ts +5 -1
- package/dist/types/modes/components/welcome.d.ts +3 -9
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +3 -2
- package/dist/types/modes/theme/theme.d.ts +2 -1
- package/dist/types/modes/types.d.ts +3 -2
- package/dist/types/modes/utils/ui-helpers.d.ts +1 -1
- package/dist/types/registry/agent-lifecycle.d.ts +51 -0
- package/dist/types/registry/agent-registry.d.ts +16 -5
- package/dist/types/session/agent-session.d.ts +35 -30
- package/dist/types/session/messages.d.ts +2 -4
- package/dist/types/session/session-history-format.d.ts +12 -0
- package/dist/types/session/session-manager.d.ts +21 -3
- package/dist/types/session/streaming-output.d.ts +23 -0
- package/dist/types/task/executor.d.ts +11 -2
- package/dist/types/task/index.d.ts +11 -4
- package/dist/types/task/output-manager.d.ts +0 -7
- package/dist/types/task/repair-args.d.ts +8 -7
- package/dist/types/task/types.d.ts +55 -51
- package/dist/types/tools/browser/tab-worker.d.ts +3 -1
- package/dist/types/tools/find.d.ts +0 -11
- package/dist/types/tools/grouped-file-output.d.ts +0 -49
- package/dist/types/tools/index.d.ts +1 -3
- package/dist/types/tools/irc.d.ts +76 -38
- package/dist/types/tools/job.d.ts +7 -1
- package/examples/extensions/with-deps/package.json +1 -0
- package/package.json +11 -10
- package/scripts/bundle-dist.ts +28 -19
- package/src/async/index.ts +0 -1
- package/src/cli/gallery-cli.ts +1 -1
- package/src/cli/gallery-fixtures/agentic.ts +230 -115
- package/src/cli/gallery-fixtures/types.ts +5 -0
- package/src/cli.ts +20 -6
- package/src/commit/agentic/tools/analyze-file.ts +38 -19
- package/src/config/keybindings.ts +6 -1
- package/src/config/settings-schema.ts +56 -40
- package/src/config/settings.ts +7 -0
- package/src/eval/__tests__/agent-bridge.test.ts +5 -3
- package/src/eval/agent-bridge.ts +3 -16
- package/src/eval/js/shared/prelude.txt +1 -1
- package/src/eval/py/prelude.py +5 -6
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +38 -13
- package/src/extensibility/custom-tools/types.ts +2 -2
- package/src/extensibility/shared-events.ts +2 -2
- package/src/internal-urls/docs-index.generated.ts +8 -8
- package/src/internal-urls/history-protocol.ts +113 -0
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/router.ts +3 -1
- package/src/internal-urls/types.ts +1 -1
- package/src/irc/bus.ts +292 -0
- package/src/main.ts +8 -60
- package/src/modes/components/{session-observer-overlay.ts → agent-hub.ts} +586 -367
- package/src/modes/components/compaction-summary-message.ts +68 -32
- package/src/modes/components/custom-editor.ts +10 -0
- package/src/modes/components/tool-execution.ts +31 -1
- package/src/modes/components/ttsr-notification.ts +72 -30
- package/src/modes/components/welcome.ts +9 -33
- package/src/modes/controllers/event-controller.ts +65 -0
- package/src/modes/controllers/extension-ui-controller.ts +8 -8
- package/src/modes/controllers/input-controller.ts +18 -2
- package/src/modes/controllers/selector-controller.ts +21 -17
- package/src/modes/interactive-mode.ts +8 -13
- package/src/modes/theme/theme.ts +18 -5
- package/src/modes/types.ts +3 -5
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +51 -49
- package/src/prompts/system/irc-incoming.md +3 -4
- package/src/prompts/system/orchestrate-notice.md +2 -2
- package/src/prompts/system/subagent-system-prompt.md +0 -5
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/system/workflow-notice.md +2 -2
- package/src/prompts/tools/eval.md +3 -3
- package/src/prompts/tools/irc.md +29 -19
- package/src/prompts/tools/read.md +2 -2
- package/src/prompts/tools/task-summary.md +5 -16
- package/src/prompts/tools/task.md +38 -29
- package/src/registry/agent-lifecycle.ts +218 -0
- package/src/registry/agent-registry.ts +16 -5
- package/src/sdk.ts +29 -9
- package/src/session/agent-session.ts +243 -237
- package/src/session/messages.ts +11 -78
- package/src/session/session-history-format.ts +246 -0
- package/src/session/session-manager.ts +59 -5
- package/src/session/streaming-output.ts +60 -0
- package/src/task/executor.ts +855 -466
- package/src/task/index.ts +718 -794
- package/src/task/output-manager.ts +0 -11
- package/src/task/render.ts +133 -63
- package/src/task/repair-args.ts +21 -9
- package/src/task/types.ts +73 -66
- package/src/tools/ask.ts +4 -2
- package/src/tools/bash.ts +15 -5
- package/src/tools/browser/tab-worker.ts +26 -7
- package/src/tools/browser.ts +28 -1
- package/src/tools/find.ts +2 -27
- package/src/tools/grouped-file-output.ts +1 -118
- package/src/tools/index.ts +4 -12
- package/src/tools/irc.ts +596 -171
- package/src/tools/job.ts +41 -7
- package/src/tools/read.ts +57 -1
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resolve.ts +4 -1
- package/dist/types/async/support.d.ts +0 -2
- package/dist/types/modes/components/session-observer-overlay.d.ts +0 -11
- package/dist/types/task/simple-mode.d.ts +0 -8
- package/src/async/support.ts +0 -5
- package/src/task/simple-mode.ts +0 -27
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { THINKING_EFFORTS } from "@oh-my-pi/pi-ai";
|
|
2
|
-
import { TASK_SIMPLE_MODES } from "../task/simple-mode";
|
|
3
2
|
import { AUTO_THINKING, getConfiguredThinkingLevelMetadata, getThinkingLevelMetadata } from "../thinking";
|
|
4
3
|
import {
|
|
5
4
|
TINY_MODEL_DEVICE_DEFAULT,
|
|
@@ -1177,13 +1176,13 @@ export const SETTINGS_SCHEMA = {
|
|
|
1177
1176
|
|
|
1178
1177
|
"compaction.strategy": {
|
|
1179
1178
|
type: "enum",
|
|
1180
|
-
values: ["context-full", "handoff", "shake", "off"] as const,
|
|
1179
|
+
values: ["context-full", "handoff", "shake", "snapcompact", "off"] as const,
|
|
1181
1180
|
default: "context-full",
|
|
1182
1181
|
ui: {
|
|
1183
1182
|
tab: "context",
|
|
1184
1183
|
label: "Compaction Strategy",
|
|
1185
1184
|
description:
|
|
1186
|
-
"Choose in-place context-full maintenance, auto-handoff, surgical shake (drop heavy content), or disable auto maintenance (off)",
|
|
1185
|
+
"Choose in-place context-full maintenance, auto-handoff, surgical shake (drop heavy content), snapcompact (archive history as dense images), or disable auto maintenance (off)",
|
|
1187
1186
|
options: [
|
|
1188
1187
|
{
|
|
1189
1188
|
value: "context-full",
|
|
@@ -1196,6 +1195,11 @@ export const SETTINGS_SCHEMA = {
|
|
|
1196
1195
|
label: "Shake",
|
|
1197
1196
|
description: "Drop heavy content (tool results + large blocks) in place; recover via artifact",
|
|
1198
1197
|
},
|
|
1198
|
+
{
|
|
1199
|
+
value: "snapcompact",
|
|
1200
|
+
label: "Snapcompact",
|
|
1201
|
+
description: "Archive history onto dense bitmap images the model reads back; no LLM call",
|
|
1202
|
+
},
|
|
1199
1203
|
{
|
|
1200
1204
|
value: "off",
|
|
1201
1205
|
label: "Off",
|
|
@@ -1326,6 +1330,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
1326
1330
|
],
|
|
1327
1331
|
},
|
|
1328
1332
|
},
|
|
1333
|
+
|
|
1334
|
+
"compaction.supersedeReads": {
|
|
1335
|
+
type: "boolean",
|
|
1336
|
+
default: true,
|
|
1337
|
+
ui: {
|
|
1338
|
+
tab: "context",
|
|
1339
|
+
label: "Supersede Stale Reads",
|
|
1340
|
+
description: "Prune older read results when the same file is read again (cache-aware, runs every turn)",
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
|
|
1329
1344
|
// Branch summaries
|
|
1330
1345
|
"branchSummary.enabled": {
|
|
1331
1346
|
type: "boolean",
|
|
@@ -2289,24 +2304,13 @@ export const SETTINGS_SCHEMA = {
|
|
|
2289
2304
|
},
|
|
2290
2305
|
},
|
|
2291
2306
|
|
|
2292
|
-
"irc.enabled": {
|
|
2293
|
-
type: "boolean",
|
|
2294
|
-
default: true,
|
|
2295
|
-
ui: {
|
|
2296
|
-
tab: "tools",
|
|
2297
|
-
label: "IRC",
|
|
2298
|
-
description: "Enable agent-to-agent IRC messaging via the irc tool",
|
|
2299
|
-
},
|
|
2300
|
-
},
|
|
2301
|
-
|
|
2302
2307
|
"irc.timeoutMs": {
|
|
2303
2308
|
type: "number",
|
|
2304
2309
|
default: 120_000,
|
|
2305
2310
|
ui: {
|
|
2306
2311
|
tab: "tools",
|
|
2307
2312
|
label: "IRC Timeout",
|
|
2308
|
-
description:
|
|
2309
|
-
"Drop IRC messages whose recipient does not respond within this many milliseconds (0 disables the timeout)",
|
|
2313
|
+
description: "Default timeout for irc wait (and send await:true) in milliseconds; 0 disables the timeout",
|
|
2310
2314
|
options: [
|
|
2311
2315
|
{ value: "0", label: "Disabled" },
|
|
2312
2316
|
{ value: "30000", label: "30 seconds" },
|
|
@@ -2501,7 +2505,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
2501
2505
|
ui: {
|
|
2502
2506
|
tab: "tools",
|
|
2503
2507
|
label: "Async Execution",
|
|
2504
|
-
description: "Enable async bash commands
|
|
2508
|
+
description: "Enable async bash commands",
|
|
2505
2509
|
},
|
|
2506
2510
|
},
|
|
2507
2511
|
|
|
@@ -2747,31 +2751,14 @@ export const SETTINGS_SCHEMA = {
|
|
|
2747
2751
|
},
|
|
2748
2752
|
},
|
|
2749
2753
|
|
|
2750
|
-
"task.
|
|
2751
|
-
type: "
|
|
2752
|
-
|
|
2753
|
-
default: "schema-free",
|
|
2754
|
+
"task.batch": {
|
|
2755
|
+
type: "boolean",
|
|
2756
|
+
default: true,
|
|
2754
2757
|
ui: {
|
|
2755
2758
|
tab: "tasks",
|
|
2756
|
-
label: "Task
|
|
2757
|
-
description:
|
|
2758
|
-
|
|
2759
|
-
{
|
|
2760
|
-
value: "default",
|
|
2761
|
-
label: "Default",
|
|
2762
|
-
description: "Shared context and custom task schema are available",
|
|
2763
|
-
},
|
|
2764
|
-
{
|
|
2765
|
-
value: "schema-free",
|
|
2766
|
-
label: "Schema-free",
|
|
2767
|
-
description: "Shared context stays available, but custom task schema is disabled",
|
|
2768
|
-
},
|
|
2769
|
-
{
|
|
2770
|
-
value: "independent",
|
|
2771
|
-
label: "Independent",
|
|
2772
|
-
description: "No shared context or custom task schema; each task must stand alone",
|
|
2773
|
-
},
|
|
2774
|
-
],
|
|
2759
|
+
label: "Batch Task Calls",
|
|
2760
|
+
description:
|
|
2761
|
+
"Switch the task tool to its batch shape: one call carries { agent, context, tasks[] } — one subagent per item (with per-item isolation) and a required shared context prepended to every assignment. Each spawn still runs as an independent background agent with the normal idle/parked lifecycle. Disable to restore the flat single-spawn schema.",
|
|
2775
2762
|
},
|
|
2776
2763
|
},
|
|
2777
2764
|
|
|
@@ -2841,6 +2828,34 @@ export const SETTINGS_SCHEMA = {
|
|
|
2841
2828
|
},
|
|
2842
2829
|
},
|
|
2843
2830
|
|
|
2831
|
+
"task.agentIdleTtlMs": {
|
|
2832
|
+
type: "number",
|
|
2833
|
+
default: 420_000,
|
|
2834
|
+
ui: {
|
|
2835
|
+
tab: "tasks",
|
|
2836
|
+
label: "Agent Idle TTL",
|
|
2837
|
+
description:
|
|
2838
|
+
"How long an idle subagent stays live in memory before being parked to disk (ms). Parked agents are revived automatically when messaged or resumed. 0 keeps idle agents live until exit.",
|
|
2839
|
+
},
|
|
2840
|
+
},
|
|
2841
|
+
|
|
2842
|
+
"task.softRequestBudget": {
|
|
2843
|
+
type: "number",
|
|
2844
|
+
default: 90,
|
|
2845
|
+
ui: {
|
|
2846
|
+
tab: "tasks",
|
|
2847
|
+
label: "Soft Subagent Request Budget",
|
|
2848
|
+
description:
|
|
2849
|
+
"Soft per-subagent request budget (assistant requests per run). Crossing it injects one steering notice asking the subagent to wrap up; at 1.5x the budget the run is aborted gracefully, salvaging partial output. 0 disables the guard. Bundled explore/quick_task agents use a lower built-in budget.",
|
|
2850
|
+
options: [
|
|
2851
|
+
{ value: "0", label: "Disabled" },
|
|
2852
|
+
{ value: "40", label: "40 requests" },
|
|
2853
|
+
{ value: "90", label: "90 requests", description: "Default" },
|
|
2854
|
+
{ value: "150", label: "150 requests" },
|
|
2855
|
+
],
|
|
2856
|
+
},
|
|
2857
|
+
},
|
|
2858
|
+
|
|
2844
2859
|
"task.disabledAgents": {
|
|
2845
2860
|
type: "array",
|
|
2846
2861
|
default: [] as string[],
|
|
@@ -3353,7 +3368,7 @@ export type TreeFilterMode = SettingValue<"treeFilterMode">;
|
|
|
3353
3368
|
|
|
3354
3369
|
export interface CompactionSettings {
|
|
3355
3370
|
enabled: boolean;
|
|
3356
|
-
strategy: "context-full" | "handoff" | "shake" | "off";
|
|
3371
|
+
strategy: "context-full" | "handoff" | "shake" | "snapcompact" | "off";
|
|
3357
3372
|
thresholdPercent: number;
|
|
3358
3373
|
thresholdTokens: number;
|
|
3359
3374
|
reserveTokens: number;
|
|
@@ -3365,6 +3380,7 @@ export interface CompactionSettings {
|
|
|
3365
3380
|
idleEnabled: boolean;
|
|
3366
3381
|
idleThresholdTokens: number;
|
|
3367
3382
|
idleTimeoutSeconds: number;
|
|
3383
|
+
supersedeReads: boolean;
|
|
3368
3384
|
}
|
|
3369
3385
|
|
|
3370
3386
|
export interface ContextPromotionSettings {
|
package/src/config/settings.ts
CHANGED
|
@@ -745,6 +745,13 @@ export class Settings {
|
|
|
745
745
|
delete isolationObj.enabled;
|
|
746
746
|
}
|
|
747
747
|
|
|
748
|
+
// task.simple: removed — the task tool no longer accepts a per-call
|
|
749
|
+
// schema (workflows drive structured output via eval agent()) and the
|
|
750
|
+
// batch/context shape is gated by task.batch instead.
|
|
751
|
+
if (taskObj && "simple" in taskObj) {
|
|
752
|
+
delete taskObj.simple;
|
|
753
|
+
}
|
|
754
|
+
|
|
748
755
|
// task.isolation.mode: legacy values from before the pi-iso PAL refactor.
|
|
749
756
|
// `worktree` was git worktree → now lives under `rcopy`. `fuse-overlay`
|
|
750
757
|
// and `fuse-projfs` are now the platform-named `overlayfs` / `projfs`
|
|
@@ -99,6 +99,7 @@ function singleResult(options: ExecutorOptions, overrides: Partial<SingleResult>
|
|
|
99
99
|
truncated: false,
|
|
100
100
|
durationMs: 1,
|
|
101
101
|
tokens: 0,
|
|
102
|
+
requests: 0,
|
|
102
103
|
...overrides,
|
|
103
104
|
};
|
|
104
105
|
}
|
|
@@ -178,7 +179,7 @@ describe("runEvalAgent", () => {
|
|
|
178
179
|
expect(runSpy).not.toHaveBeenCalled();
|
|
179
180
|
});
|
|
180
181
|
|
|
181
|
-
it("passes
|
|
182
|
+
it("passes parent execution options and only sets outputSchema when schema is supplied", async () => {
|
|
182
183
|
mockAgents();
|
|
183
184
|
const runSpy = vi.spyOn(taskExecutor, "runSubprocess").mockImplementation(async options => singleResult(options));
|
|
184
185
|
const abortController = new AbortController();
|
|
@@ -186,7 +187,7 @@ describe("runEvalAgent", () => {
|
|
|
186
187
|
const session = makeSession({ depth: 2, activeModel: "p/current", modelString: "p/fallback" });
|
|
187
188
|
|
|
188
189
|
await runEvalAgent(
|
|
189
|
-
{ prompt: " hello ",
|
|
190
|
+
{ prompt: " hello ", label: "My Agent", model: "p/override", schema },
|
|
190
191
|
{ session, signal: abortController.signal },
|
|
191
192
|
);
|
|
192
193
|
await runEvalAgent({ prompt: "plain" }, { session });
|
|
@@ -199,7 +200,6 @@ describe("runEvalAgent", () => {
|
|
|
199
200
|
expect(firstOptions.parentActiveModelPattern).toBe("p/current");
|
|
200
201
|
expect(firstOptions.outputSchema).toBe(schema);
|
|
201
202
|
expect(firstOptions.assignment).toBe("hello");
|
|
202
|
-
expect(firstOptions.context).toBe("context");
|
|
203
203
|
expect(firstOptions.description).toBe("My Agent");
|
|
204
204
|
expect(firstOptions.modelOverride).toEqual(["p/override"]);
|
|
205
205
|
expect(secondOptions.outputSchema).toBeUndefined();
|
|
@@ -542,6 +542,7 @@ describe("agent() through eval runtimes", () => {
|
|
|
542
542
|
recentOutput: [],
|
|
543
543
|
toolCount: 0,
|
|
544
544
|
tokens: 0,
|
|
545
|
+
requests: 0,
|
|
545
546
|
cost: 0,
|
|
546
547
|
durationMs: 0,
|
|
547
548
|
...overrides,
|
|
@@ -674,6 +675,7 @@ describe("agent() through eval runtimes", () => {
|
|
|
674
675
|
recentOutput: [],
|
|
675
676
|
toolCount: i,
|
|
676
677
|
tokens: 0,
|
|
678
|
+
requests: 0,
|
|
677
679
|
cost: 0,
|
|
678
680
|
durationMs: i * 10,
|
|
679
681
|
});
|
package/src/eval/agent-bridge.ts
CHANGED
|
@@ -34,7 +34,6 @@ const agentArgsSchema = z.object({
|
|
|
34
34
|
prompt: z.string().min(1, "prompt must be a non-empty string"),
|
|
35
35
|
agentType: z.string().min(1).optional(),
|
|
36
36
|
model: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional(),
|
|
37
|
-
context: z.string().optional(),
|
|
38
37
|
label: z.string().optional(),
|
|
39
38
|
schema: z.unknown().optional(),
|
|
40
39
|
});
|
|
@@ -43,7 +42,6 @@ interface EvalAgentArgs {
|
|
|
43
42
|
prompt: string;
|
|
44
43
|
agentType?: string;
|
|
45
44
|
model?: string | string[];
|
|
46
|
-
context?: string;
|
|
47
45
|
label?: string;
|
|
48
46
|
schema?: unknown;
|
|
49
47
|
}
|
|
@@ -111,7 +109,7 @@ function assertNotPlanMode(session: ToolSession): void {
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
function renderSubagentPrompt(assignment: string): string {
|
|
114
|
-
return prompt.render(subagentUserPromptTemplate, { assignment: assignment.trim()
|
|
112
|
+
return prompt.render(subagentUserPromptTemplate, { assignment: assignment.trim() });
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
function trimToUndefined(value: string | undefined): string | undefined {
|
|
@@ -135,20 +133,12 @@ function getOutputManager(session: ToolSession): AgentOutputManager {
|
|
|
135
133
|
async function getArtifacts(session: ToolSession): Promise<{
|
|
136
134
|
sessionFile: string | null;
|
|
137
135
|
artifactsDir: string;
|
|
138
|
-
contextFile?: string;
|
|
139
136
|
}> {
|
|
140
137
|
const sessionFile = session.getSessionFile();
|
|
141
138
|
const sessionArtifactsDir = sessionFile ? sessionFile.slice(0, -6) : null;
|
|
142
139
|
const artifactsDir = sessionArtifactsDir ?? path.join(os.tmpdir(), `omp-eval-agent-${Snowflake.next()}`);
|
|
143
140
|
await fs.mkdir(artifactsDir, { recursive: true });
|
|
144
|
-
|
|
145
|
-
const shouldWriteConversationContext = session.settings.get("irc.enabled") !== true;
|
|
146
|
-
const compactContext = shouldWriteConversationContext ? session.getCompactContext?.() : undefined;
|
|
147
|
-
if (!compactContext) return { sessionFile, artifactsDir };
|
|
148
|
-
|
|
149
|
-
const contextFile = path.join(artifactsDir, "context.md");
|
|
150
|
-
await Bun.write(contextFile, compactContext);
|
|
151
|
-
return { sessionFile, artifactsDir, contextFile };
|
|
141
|
+
return { sessionFile, artifactsDir };
|
|
152
142
|
}
|
|
153
143
|
|
|
154
144
|
function emitProgressStatus(emitStatus: ((event: JsStatusEvent) => void) | undefined, progress: AgentProgress): void {
|
|
@@ -246,11 +236,10 @@ export async function runEvalAgent(args: unknown, options: EvalAgentBridgeOption
|
|
|
246
236
|
};
|
|
247
237
|
const parentArtifactManager = options.session.getArtifactManager?.() ?? undefined;
|
|
248
238
|
const mcpManager = options.session.mcpManager ?? MCPManager.instance();
|
|
249
|
-
const { sessionFile, artifactsDir
|
|
239
|
+
const { sessionFile, artifactsDir } = await getArtifacts(options.session);
|
|
250
240
|
const outputManager = getOutputManager(options.session);
|
|
251
241
|
const id = await outputManager.allocate(outputIdBase(parsed.label, agentName));
|
|
252
242
|
const assignment = parsed.prompt.trim();
|
|
253
|
-
const context = trimToUndefined(parsed.context);
|
|
254
243
|
// Suspend eval timeout accounting while the subagent owns control. The
|
|
255
244
|
// timeout clock restarts once the bridge returns to the cell runtime.
|
|
256
245
|
const result = await withBridgeTimeoutPause(options.emitStatus, () =>
|
|
@@ -259,7 +248,6 @@ export async function runEvalAgent(args: unknown, options: EvalAgentBridgeOption
|
|
|
259
248
|
agent: effectiveAgent,
|
|
260
249
|
task: renderSubagentPrompt(assignment),
|
|
261
250
|
assignment,
|
|
262
|
-
context,
|
|
263
251
|
description: trimToUndefined(parsed.label),
|
|
264
252
|
index: 0,
|
|
265
253
|
id,
|
|
@@ -271,7 +259,6 @@ export async function runEvalAgent(args: unknown, options: EvalAgentBridgeOption
|
|
|
271
259
|
sessionFile,
|
|
272
260
|
persistArtifacts: Boolean(sessionFile),
|
|
273
261
|
artifactsDir,
|
|
274
|
-
contextFile,
|
|
275
262
|
// Eval `agent()` subagents are short-lived programmatic helpers (data
|
|
276
263
|
// collection, structured output, parallel() fan-out). LSP server
|
|
277
264
|
// cold-start costs tens of seconds and is pure overhead here, so it is
|
|
@@ -65,7 +65,7 @@ if (!globalThis.__omp_js_prelude_loaded__) {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
const agent = async (prompt, opts, ...rest) => {
|
|
68
|
-
const o = optionsArg("agent", opts, rest, "{ agentType, model,
|
|
68
|
+
const o = optionsArg("agent", opts, rest, "{ agentType, model, label, schema }");
|
|
69
69
|
const res = await globalThis.__omp_call_tool__("__agent__", { prompt, ...o });
|
|
70
70
|
const text = res && typeof res === "object" ? res.text : res;
|
|
71
71
|
return hasOwn(o, "schema") ? JSON.parse(text) : text;
|
package/src/eval/py/prelude.py
CHANGED
|
@@ -519,21 +519,20 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
519
519
|
text = res.get("text") if isinstance(res, dict) else res
|
|
520
520
|
return json.loads(text) if schema is not None else text
|
|
521
521
|
|
|
522
|
-
def agent(prompt, *, agent_type="task", model=None,
|
|
522
|
+
def agent(prompt, *, agent_type="task", model=None, label=None, schema=None):
|
|
523
523
|
"""Run a subagent and return its final output.
|
|
524
524
|
|
|
525
525
|
`agent_type` selects the subagent definition (default "task"). Pass
|
|
526
|
-
`model` to override that agent's model, `
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
`model` to override that agent's model, `label` for the output artifact
|
|
527
|
+
id, and `schema` to request structured JSON output; when `schema` is
|
|
528
|
+
supplied the parsed object is returned. Share background by writing a
|
|
529
|
+
local:// file and referencing it in the prompt.
|
|
529
530
|
"""
|
|
530
531
|
args = {"prompt": prompt}
|
|
531
532
|
if agent_type is not None:
|
|
532
533
|
args["agentType"] = agent_type
|
|
533
534
|
if model is not None:
|
|
534
535
|
args["model"] = model
|
|
535
|
-
if context is not None:
|
|
536
|
-
args["context"] = context
|
|
537
536
|
if label is not None:
|
|
538
537
|
args["label"] = label
|
|
539
538
|
if schema is not None:
|