@oh-my-pi/pi-coding-agent 15.13.3 → 16.0.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/CHANGELOG.md +155 -133
- package/dist/cli.js +621 -530
- package/dist/types/advisor/__tests__/advisor.test.d.ts +1 -0
- package/dist/types/advisor/advise-tool.d.ts +58 -0
- package/dist/types/advisor/index.d.ts +3 -0
- package/dist/types/advisor/runtime.d.ts +52 -0
- package/dist/types/advisor/watchdog.d.ts +5 -0
- package/dist/types/config/model-roles.d.ts +1 -1
- package/dist/types/config/settings-schema.d.ts +66 -5
- package/dist/types/discovery/helpers.d.ts +7 -0
- package/dist/types/eval/__tests__/prelude-agent.test.d.ts +1 -0
- package/dist/types/extensibility/plugins/runtime-config.d.ts +3 -0
- package/dist/types/modes/components/advisor-message.d.ts +9 -0
- package/dist/types/modes/components/assistant-message.d.ts +1 -0
- package/dist/types/modes/controllers/command-controller.d.ts +3 -1
- package/dist/types/modes/interactive-mode.d.ts +3 -1
- package/dist/types/modes/types.d.ts +8 -1
- package/dist/types/sdk.d.ts +3 -3
- package/dist/types/session/agent-session.d.ts +81 -2
- package/dist/types/session/session-history-format.d.ts +4 -0
- package/dist/types/session/session-manager.d.ts +4 -1
- package/dist/types/session/yield-queue.d.ts +2 -0
- package/dist/types/task/index.d.ts +21 -0
- package/dist/types/tools/github-cache.d.ts +5 -4
- package/dist/types/tools/job.d.ts +1 -0
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/report-tool-issue.d.ts +0 -1
- package/dist/types/web/search/index.d.ts +2 -2
- package/dist/types/web/search/provider.d.ts +2 -0
- package/package.json +13 -13
- package/src/advisor/__tests__/advisor.test.ts +586 -0
- package/src/advisor/advise-tool.ts +87 -0
- package/src/advisor/index.ts +3 -0
- package/src/advisor/runtime.ts +248 -0
- package/src/advisor/watchdog.ts +83 -0
- package/src/cli/args.ts +1 -0
- package/src/collab/host.ts +1 -1
- package/src/config/model-roles.ts +13 -1
- package/src/config/settings-schema.ts +65 -6
- package/src/discovery/claude-plugins.ts +3 -42
- package/src/discovery/github.ts +101 -6
- package/src/discovery/helpers.ts +11 -0
- package/src/eval/__tests__/prelude-agent.test.ts +73 -0
- package/src/eval/js/shared/prelude.txt +12 -3
- package/src/eval/py/prelude.py +26 -2
- package/src/extensibility/custom-commands/bundled/review/index.ts +289 -80
- package/src/extensibility/plugins/loader.ts +3 -2
- package/src/extensibility/plugins/manager.ts +4 -3
- package/src/extensibility/plugins/marketplace/fetcher.ts +32 -34
- package/src/extensibility/plugins/runtime-config.ts +9 -0
- package/src/internal-urls/docs-index.generated.ts +10 -9
- package/src/internal-urls/issue-pr-protocol.ts +8 -4
- package/src/main.ts +9 -1
- package/src/modes/acp/acp-agent.ts +3 -3
- package/src/modes/components/advisor-message.ts +99 -0
- package/src/modes/components/agent-hub.ts +7 -0
- package/src/modes/components/assistant-message.ts +86 -0
- package/src/modes/components/settings-defs.ts +7 -0
- package/src/modes/components/status-line/segments.ts +20 -7
- package/src/modes/components/tips.txt +1 -1
- package/src/modes/controllers/command-controller.ts +69 -2
- package/src/modes/controllers/extension-ui-controller.ts +4 -3
- package/src/modes/controllers/input-controller.ts +1 -0
- package/src/modes/controllers/selector-controller.ts +7 -0
- package/src/modes/interactive-mode.ts +59 -2
- package/src/modes/rpc/rpc-mode.ts +3 -3
- package/src/modes/runtime-init.ts +2 -1
- package/src/modes/types.ts +8 -1
- package/src/modes/utils/ui-helpers.ts +9 -0
- package/src/prompts/advisor/advise-tool.md +1 -0
- package/src/prompts/advisor/system.md +31 -0
- package/src/prompts/agents/designer.md +8 -0
- package/src/prompts/review-request.md +1 -1
- package/src/prompts/system/subagent-system-prompt.md +4 -1
- package/src/prompts/tools/eval.md +13 -3
- package/src/prompts/tools/irc.md +1 -1
- package/src/sdk.ts +61 -14
- package/src/session/agent-session.ts +667 -13
- package/src/session/session-dump-format.ts +15 -131
- package/src/session/session-history-format.ts +30 -11
- package/src/session/session-manager.ts +3 -1
- package/src/session/yield-queue.ts +5 -1
- package/src/slash-commands/builtin-registry.ts +105 -4
- package/src/system-prompt.ts +1 -1
- package/src/task/executor.ts +5 -4
- package/src/task/index.ts +70 -9
- package/src/tools/github-cache.ts +32 -7
- package/src/tools/job.ts +14 -1
- package/src/tools/path-utils.ts +33 -2
- package/src/tools/report-tool-issue.ts +2 -7
- package/src/web/scrapers/docs-rs.ts +2 -3
- package/src/web/search/index.ts +2 -2
- package/src/web/search/provider.ts +14 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
declare const adviseSchema: z.ZodObject<{
|
|
4
|
+
note: z.ZodString;
|
|
5
|
+
severity: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
blocker: "blocker";
|
|
7
|
+
concern: "concern";
|
|
8
|
+
nit: "nit";
|
|
9
|
+
}>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type AdviseParams = z.infer<typeof adviseSchema>;
|
|
12
|
+
export type AdvisorSeverity = "nit" | "concern" | "blocker";
|
|
13
|
+
export interface AdviseDetails {
|
|
14
|
+
note: string;
|
|
15
|
+
severity?: AdvisorSeverity;
|
|
16
|
+
}
|
|
17
|
+
/** One queued advice note. */
|
|
18
|
+
export interface AdvisorNote {
|
|
19
|
+
note: string;
|
|
20
|
+
severity?: AdvisorSeverity;
|
|
21
|
+
}
|
|
22
|
+
/** Details payload on the batched `advisor` custom message rendered in the transcript. */
|
|
23
|
+
export interface AdvisorMessageDetails {
|
|
24
|
+
notes: AdvisorNote[];
|
|
25
|
+
}
|
|
26
|
+
/** Render one advisor card body from a batch of notes (prefix + one bullet per note). */
|
|
27
|
+
export declare function formatAdvisorBatchContent(notes: readonly AdvisorNote[]): string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether advice at this severity should interrupt the running agent (delivered
|
|
30
|
+
* via the steering channel, aborting in-flight tools) rather than ride the
|
|
31
|
+
* non-interrupting aside queue that lands at the next step boundary. `concern`
|
|
32
|
+
* and `blocker` interrupt; a plain `nit` queues.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isInterruptingSeverity(severity: AdvisorSeverity | undefined): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Side-effect-free investigation tools handed to the advisor agent so it can
|
|
37
|
+
* inspect the workspace before weighing in. Names match the primary session's
|
|
38
|
+
* tool instances, which the advisor reuses.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ADVISOR_READONLY_TOOL_NAMES: ReadonlySet<string>;
|
|
41
|
+
export declare class AdviseTool implements AgentTool<typeof adviseSchema, AdviseDetails> {
|
|
42
|
+
private readonly onAdvice;
|
|
43
|
+
readonly name = "advise";
|
|
44
|
+
readonly label = "Advise";
|
|
45
|
+
readonly description: string;
|
|
46
|
+
readonly parameters: z.ZodObject<{
|
|
47
|
+
note: z.ZodString;
|
|
48
|
+
severity: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
blocker: "blocker";
|
|
50
|
+
concern: "concern";
|
|
51
|
+
nit: "nit";
|
|
52
|
+
}>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
readonly intent: "omit";
|
|
55
|
+
constructor(onAdvice: (note: string, severity?: AdviseDetails["severity"]) => void);
|
|
56
|
+
execute(_toolCallId: string, args: AdviseParams, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<AdviseDetails>, _context?: AgentToolContext): Promise<AgentToolResult<AdviseDetails>>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
/** Minimal slice of `Agent` the runtime drives — satisfied by pi-agent-core `Agent`. */
|
|
3
|
+
export interface AdvisorAgent {
|
|
4
|
+
prompt(input: string): Promise<void>;
|
|
5
|
+
abort(reason?: unknown): void;
|
|
6
|
+
reset(): void;
|
|
7
|
+
readonly state: {
|
|
8
|
+
messages: AgentMessage[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface AdvisorRuntimeHost {
|
|
12
|
+
/** Live primary transcript (use `agent.state.messages`). */
|
|
13
|
+
snapshotMessages(): AgentMessage[];
|
|
14
|
+
/** Surface one advice note to the primary (enqueues into the session YieldQueue). */
|
|
15
|
+
enqueueAdvice(note: string, severity?: "nit" | "concern" | "blocker"): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-prompt context maintenance for the advisor's own append-only context.
|
|
18
|
+
* Promotes the advisor model to a larger sibling when its context nears the
|
|
19
|
+
* window (mirroring the primary's promote-first policy) and resolves `true`
|
|
20
|
+
* when the advisor should re-prime — reset and replay the current
|
|
21
|
+
* primary-bounded transcript — because promotion did not free enough room.
|
|
22
|
+
* Optional: hosts that omit it get no maintenance (context only shrinks when
|
|
23
|
+
* the primary's next compaction triggers {@link AdvisorRuntime.reset}).
|
|
24
|
+
*/
|
|
25
|
+
maintainContext?(incomingTokens: number): Promise<boolean>;
|
|
26
|
+
}
|
|
27
|
+
export declare class AdvisorRuntime {
|
|
28
|
+
#private;
|
|
29
|
+
private readonly agent;
|
|
30
|
+
private readonly host;
|
|
31
|
+
private readonly retryDelayMs;
|
|
32
|
+
disposed: boolean;
|
|
33
|
+
constructor(agent: AdvisorAgent, host: AdvisorRuntimeHost, retryDelayMs?: number);
|
|
34
|
+
get backlog(): number;
|
|
35
|
+
onTurnEnd(messages?: AgentMessage[]): void;
|
|
36
|
+
waitForCatchup(maxMs: number, threshold: number, signal?: AbortSignal): Promise<void>;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Re-prime the advisor after a history rewrite (compaction, session
|
|
40
|
+
* switch/resume, branch). Clears the advisor's own (non-persisted) context
|
|
41
|
+
* and rewinds the cursor to 0 so the NEXT turn replays the full current —
|
|
42
|
+
* post-compaction — transcript, giving the advisor fresh context instead of
|
|
43
|
+
* leaving it blind to everything before the rewrite.
|
|
44
|
+
*/
|
|
45
|
+
reset(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Seed the cursor to the current transcript length when the advisor is enabled
|
|
48
|
+
* mid-session. Prevents the next turn from replaying the entire history to the
|
|
49
|
+
* advisor (which would be expensive and likely stale).
|
|
50
|
+
*/
|
|
51
|
+
seedTo(count: number): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover and load WATCHDOG.md files walking up from cwd, project .omp folder, and user agent dir.
|
|
3
|
+
* Returns formatted watchdog file blocks ready to be appended to the advisor system prompt.
|
|
4
|
+
*/
|
|
5
|
+
export declare function discoverWatchdogFiles(cwd: string, agentDir?: string): Promise<string[]>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ThemeColor } from "../modes/theme/theme";
|
|
5
5
|
import type { Settings } from "./settings";
|
|
6
|
-
export type ModelRole = "default" | "smol" | "slow" | "vision" | "plan" | "designer" | "commit" | "title" | "task";
|
|
6
|
+
export type ModelRole = "default" | "smol" | "slow" | "vision" | "plan" | "designer" | "commit" | "title" | "task" | "advisor";
|
|
7
7
|
export interface ModelRoleInfo {
|
|
8
8
|
tag?: string;
|
|
9
9
|
name: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SearchProviderId } from "../web/search/types";
|
|
1
2
|
/** Unified settings schema - single source of truth for all settings.
|
|
2
3
|
*
|
|
3
4
|
* Each setting is defined once here with:
|
|
@@ -177,6 +178,37 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
177
178
|
readonly description: "Keep the display from idle-sleeping while a session is open (caffeinate -d)";
|
|
178
179
|
};
|
|
179
180
|
};
|
|
181
|
+
readonly "advisor.enabled": {
|
|
182
|
+
readonly type: "boolean";
|
|
183
|
+
readonly default: false;
|
|
184
|
+
readonly ui: {
|
|
185
|
+
readonly tab: "model";
|
|
186
|
+
readonly group: "Advisor";
|
|
187
|
+
readonly label: "Enable Advisor";
|
|
188
|
+
readonly description: "Pair a second model (assigned to the 'advisor' role) that passively reviews each turn and injects notes.";
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
readonly "advisor.subagents": {
|
|
192
|
+
readonly type: "boolean";
|
|
193
|
+
readonly default: false;
|
|
194
|
+
readonly ui: {
|
|
195
|
+
readonly tab: "model";
|
|
196
|
+
readonly group: "Advisor";
|
|
197
|
+
readonly label: "Advisor for Subagents";
|
|
198
|
+
readonly description: "Also enable the advisor on spawned task/eval subagents.";
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
readonly "advisor.syncBacklog": {
|
|
202
|
+
readonly type: "enum";
|
|
203
|
+
readonly values: readonly ["off", "1", "3", "5"];
|
|
204
|
+
readonly default: "off";
|
|
205
|
+
readonly ui: {
|
|
206
|
+
readonly tab: "model";
|
|
207
|
+
readonly group: "Advisor";
|
|
208
|
+
readonly label: "Advisor Sync Backlog";
|
|
209
|
+
readonly description: "Pause the main agent for up to 30 seconds if the advisor falls behind by this many turns. Off disables catch-up delays.";
|
|
210
|
+
};
|
|
211
|
+
};
|
|
180
212
|
readonly shellPath: {
|
|
181
213
|
readonly type: "string";
|
|
182
214
|
readonly default: undefined;
|
|
@@ -1843,13 +1875,13 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1843
1875
|
};
|
|
1844
1876
|
readonly "tools.format": {
|
|
1845
1877
|
readonly type: "enum";
|
|
1846
|
-
readonly values: readonly ["auto", "native", "glm", "hermes", "kimi", "xml", "anthropic", "deepseek", "harmony", "pi", "qwen3"];
|
|
1878
|
+
readonly values: readonly ["auto", "native", "glm", "hermes", "kimi", "xml", "anthropic", "deepseek", "harmony", "pi", "qwen3", "gemini", "gemma"];
|
|
1847
1879
|
readonly default: "auto";
|
|
1848
1880
|
readonly ui: {
|
|
1849
1881
|
readonly tab: "context";
|
|
1850
1882
|
readonly group: "Experimental";
|
|
1851
|
-
readonly label: "Tool
|
|
1852
|
-
readonly description: "Controls how tools are exposed to the model. Auto uses native tool calls unless the selected model is marked as not supporting
|
|
1883
|
+
readonly label: "Tool Calling Mode";
|
|
1884
|
+
readonly description: "Controls how tools are exposed to the model. Auto uses provider-native tool calls unless the selected model is marked as not supporting them, then falls back to the GLM owned dialect. Native forces provider-native tools; the other values force the named owned dialect. Applies on session start.";
|
|
1853
1885
|
readonly options: readonly [{
|
|
1854
1886
|
readonly value: "auto";
|
|
1855
1887
|
readonly label: "Auto";
|
|
@@ -1889,11 +1921,19 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1889
1921
|
}, {
|
|
1890
1922
|
readonly value: "pi";
|
|
1891
1923
|
readonly label: "Pi";
|
|
1892
|
-
readonly description: "Use Pi
|
|
1924
|
+
readonly description: "Use the Pi owned dialect.";
|
|
1893
1925
|
}, {
|
|
1894
1926
|
readonly value: "qwen3";
|
|
1895
1927
|
readonly label: "Qwen3";
|
|
1896
|
-
readonly description: "Use Qwen3
|
|
1928
|
+
readonly description: "Use the Qwen3 owned dialect.";
|
|
1929
|
+
}, {
|
|
1930
|
+
readonly value: "gemini";
|
|
1931
|
+
readonly label: "Gemini";
|
|
1932
|
+
readonly description: "Use the Gemini owned dialect.";
|
|
1933
|
+
}, {
|
|
1934
|
+
readonly value: "gemma";
|
|
1935
|
+
readonly label: "Gemma";
|
|
1936
|
+
readonly description: "Use the Gemma owned dialect.";
|
|
1897
1937
|
}];
|
|
1898
1938
|
};
|
|
1899
1939
|
};
|
|
@@ -3566,6 +3606,17 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
3566
3606
|
readonly description: "Enable plan mode for read-only exploration and planning before execution";
|
|
3567
3607
|
};
|
|
3568
3608
|
};
|
|
3609
|
+
readonly "plan.defaultOnStartup": {
|
|
3610
|
+
readonly type: "boolean";
|
|
3611
|
+
readonly default: false;
|
|
3612
|
+
readonly ui: {
|
|
3613
|
+
readonly tab: "tasks";
|
|
3614
|
+
readonly group: "Modes";
|
|
3615
|
+
readonly label: "Start in Plan Mode";
|
|
3616
|
+
readonly description: "Automatically enter plan mode at the start of every new session";
|
|
3617
|
+
readonly condition: "planModeEnabled";
|
|
3618
|
+
};
|
|
3619
|
+
};
|
|
3569
3620
|
readonly "goal.enabled": {
|
|
3570
3621
|
readonly type: "boolean";
|
|
3571
3622
|
readonly default: true;
|
|
@@ -4081,6 +4132,16 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
4081
4132
|
}];
|
|
4082
4133
|
};
|
|
4083
4134
|
};
|
|
4135
|
+
readonly "providers.webSearchExclude": {
|
|
4136
|
+
readonly type: "array";
|
|
4137
|
+
readonly default: SearchProviderId[];
|
|
4138
|
+
readonly ui: {
|
|
4139
|
+
readonly tab: "providers";
|
|
4140
|
+
readonly group: "Services";
|
|
4141
|
+
readonly label: "Excluded Web Search Providers";
|
|
4142
|
+
readonly description: "Providers that web_search should never use, even as fallbacks";
|
|
4143
|
+
};
|
|
4144
|
+
};
|
|
4084
4145
|
readonly "providers.image": {
|
|
4085
4146
|
readonly type: "enum";
|
|
4086
4147
|
readonly values: readonly ["auto", "openai", "antigravity", "xai", "gemini", "openrouter"];
|
|
@@ -67,6 +67,13 @@ export declare function getUserPath(ctx: LoadContext, source: SourceId, subpath:
|
|
|
67
67
|
* Get project-level path for a source (cwd only).
|
|
68
68
|
*/
|
|
69
69
|
export declare function getProjectPath(ctx: LoadContext, source: SourceId, subpath: string): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve GitHub Copilot CLI's user-global config root. Copilot stores per-user
|
|
72
|
+
* instructions/prompts/agents/MCP under `~/.copilot`, relocatable via the
|
|
73
|
+
* `COPILOT_HOME` env var (mirrors Copilot CLI's `--config-dir`). Falls back to
|
|
74
|
+
* `<home>/.copilot` when the override is unset.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveCopilotHome(home: string): string;
|
|
70
77
|
/**
|
|
71
78
|
* Create source metadata for an item.
|
|
72
79
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Component } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import type { AdvisorMessageDetails } from "../../advisor";
|
|
3
|
+
import type { Theme } from "../theme/theme";
|
|
4
|
+
/**
|
|
5
|
+
* Display-only transcript card for advisor notes injected into the primary
|
|
6
|
+
* session. Mirrors the IRC card's glyph + quote-border conventions so passive
|
|
7
|
+
* advice reads as a distinct, non-interrupting aside rather than a user turn.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAdvisorMessageCard(details: AdvisorMessageDetails | undefined, getExpanded: () => boolean, uiTheme: Theme): Component;
|
|
@@ -13,6 +13,7 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
13
13
|
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, onImageUpdate?: (() => void) | undefined, thinkingRenderers?: readonly AssistantThinkingRenderer[], imageBudget?: ImageBudget | undefined);
|
|
14
14
|
invalidate(): void;
|
|
15
15
|
setHideThinkingBlock(hide: boolean): void;
|
|
16
|
+
dispose(): void;
|
|
16
17
|
/**
|
|
17
18
|
* Toggle suppression of the inline `Error: …` line while the same error is
|
|
18
19
|
* pinned in the banner above the editor. Re-renders so the change is visible.
|
|
@@ -10,10 +10,12 @@ export declare class CommandController {
|
|
|
10
10
|
constructor(ctx: InteractiveModeContext);
|
|
11
11
|
openInBrowser(urlOrPath: string): void;
|
|
12
12
|
handleExportCommand(text: string): Promise<void>;
|
|
13
|
-
handleDumpCommand(): void;
|
|
13
|
+
handleDumpCommand(isRaw?: boolean): void;
|
|
14
|
+
handleAdvisorDumpCommand(isRaw?: boolean): void;
|
|
14
15
|
handleDebugTranscriptCommand(): Promise<void>;
|
|
15
16
|
handleShareCommand(): Promise<void>;
|
|
16
17
|
handleSessionCommand(): Promise<void>;
|
|
18
|
+
handleAdvisorStatusCommand(): Promise<void>;
|
|
17
19
|
handleJobsCommand(): Promise<void>;
|
|
18
20
|
handleUsageCommand(reports?: UsageReport[] | null): Promise<void>;
|
|
19
21
|
handleChangelogCommand(showFull?: boolean): Promise<void>;
|
|
@@ -268,11 +268,13 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
268
268
|
findLastAssistantMessage(): AssistantMessage | undefined;
|
|
269
269
|
extractAssistantText(message: AssistantMessage): string;
|
|
270
270
|
handleExportCommand(text: string): Promise<void>;
|
|
271
|
-
handleDumpCommand(): void;
|
|
271
|
+
handleDumpCommand(isRaw?: boolean): void;
|
|
272
|
+
handleAdvisorDumpCommand(isRaw?: boolean): void;
|
|
272
273
|
handleDebugTranscriptCommand(): Promise<void>;
|
|
273
274
|
handleShareCommand(): Promise<void>;
|
|
274
275
|
handleTodoCommand(args: string): Promise<void>;
|
|
275
276
|
handleSessionCommand(): Promise<void>;
|
|
277
|
+
handleAdvisorStatusCommand(): Promise<void>;
|
|
276
278
|
handleJobsCommand(): Promise<void>;
|
|
277
279
|
handleUsageCommand(reports?: UsageReport[] | null): Promise<void>;
|
|
278
280
|
handleChangelogCommand(showFull?: boolean): Promise<void>;
|
|
@@ -45,6 +45,11 @@ export type SubmittedUserInput = {
|
|
|
45
45
|
* as a hidden agent-authored `developer` message rather than a visible user
|
|
46
46
|
* turn. Used by the `c`/`.` continue shortcut. */
|
|
47
47
|
synthetic?: boolean;
|
|
48
|
+
/** Marks this submission as a deliberate user resume (set by the `.`/`c`
|
|
49
|
+
* continue shortcut, which is also `synthetic`). Forwarded to
|
|
50
|
+
* `session.prompt({ userInitiated })` so it clears advisor auto-resume
|
|
51
|
+
* suppression even though it is synthetic. */
|
|
52
|
+
userInitiated?: boolean;
|
|
48
53
|
display?: boolean;
|
|
49
54
|
/** Queue intent if the session is (or becomes) busy when this submission is
|
|
50
55
|
* dispatched: "steer" (interrupt the active turn) or "followUp" (process after
|
|
@@ -250,13 +255,15 @@ export interface InteractiveModeContext {
|
|
|
250
255
|
handleShareCommand(): Promise<void>;
|
|
251
256
|
handleTodoCommand(args: string): Promise<void>;
|
|
252
257
|
handleSessionCommand(): Promise<void>;
|
|
258
|
+
handleAdvisorStatusCommand(): Promise<void>;
|
|
253
259
|
handleJobsCommand(): Promise<void>;
|
|
254
260
|
handleUsageCommand(reports?: UsageReport[] | null): Promise<void>;
|
|
255
261
|
handleChangelogCommand(showFull?: boolean): Promise<void>;
|
|
256
262
|
handleHotkeysCommand(): void;
|
|
257
263
|
handleToolsCommand(): void;
|
|
258
264
|
handleContextCommand(): void;
|
|
259
|
-
handleDumpCommand(): void;
|
|
265
|
+
handleDumpCommand(isRaw?: boolean): void;
|
|
266
|
+
handleAdvisorDumpCommand(isRaw?: boolean): void;
|
|
260
267
|
handleDebugTranscriptCommand(): Promise<void>;
|
|
261
268
|
handleClearCommand(): Promise<void>;
|
|
262
269
|
handleFreshCommand(): Promise<void>;
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AgentTelemetryConfig, type ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import { type Model } from "@oh-my-pi/pi-ai";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Dialect } from "@oh-my-pi/pi-ai/dialect";
|
|
4
4
|
import { type Rule } from "./capability/rule";
|
|
5
5
|
import { ModelRegistry } from "./config/model-registry";
|
|
6
6
|
import { type PromptTemplate } from "./config/prompt-templates";
|
|
@@ -184,8 +184,8 @@ export interface CreateAgentSessionResult {
|
|
|
184
184
|
/** Shared event bus for tool/extension communication */
|
|
185
185
|
eventBus: EventBus;
|
|
186
186
|
}
|
|
187
|
-
export type
|
|
188
|
-
export declare function
|
|
187
|
+
export type DialectFormat = "auto" | "native" | Dialect;
|
|
188
|
+
export declare function resolveDialect(format: DialectFormat, model: Pick<Model, "supportsTools"> | undefined): Dialect | undefined;
|
|
189
189
|
export type { PromptTemplate } from "./config/prompt-templates";
|
|
190
190
|
export { Settings, type SkillsSettings } from "./config/settings";
|
|
191
191
|
export type { CustomCommand, CustomCommandFactory } from "./extensibility/custom-commands/types";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Modes use this class and add their own I/O layer on top.
|
|
14
14
|
*/
|
|
15
15
|
import type { InMemorySnapshotStore } from "@oh-my-pi/hashline";
|
|
16
|
-
import {
|
|
16
|
+
import { Agent, type AgentEvent, type AgentMessage, type AgentState, type AgentTool, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
17
17
|
import { type CompactionResult, type ShakeConfig } from "@oh-my-pi/pi-agent-core/compaction";
|
|
18
18
|
import type { AssistantMessage, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ResetCreditAccountStatus, ResetCreditRedeemOutcome, ResetCreditTarget, ServiceTier, SimpleStreamOptions, TextContent, ToolChoice, UsageReport } from "@oh-my-pi/pi-ai";
|
|
19
19
|
import { Effort } from "@oh-my-pi/pi-ai";
|
|
@@ -228,6 +228,15 @@ export interface AgentSessionConfig {
|
|
|
228
228
|
* so that credential sticky selection is consistent with the session's streaming calls.
|
|
229
229
|
*/
|
|
230
230
|
providerSessionId?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Hard-isolated read-only tools (read/search/find) for the advisor agent,
|
|
233
|
+
* pre-built in `createAgentSession` against a distinct `ToolSession` so the
|
|
234
|
+
* advisor's reads never share the primary's snapshot/seen-lines/conflict
|
|
235
|
+
* caches. Undefined when the advisor is disabled.
|
|
236
|
+
*/
|
|
237
|
+
advisorReadOnlyTools?: AgentTool[];
|
|
238
|
+
/** Preloaded watchdog prompt content for the advisor. */
|
|
239
|
+
advisorWatchdogPrompt?: string;
|
|
231
240
|
}
|
|
232
241
|
/** Options for AgentSession.prompt() */
|
|
233
242
|
export interface PromptOptions {
|
|
@@ -241,6 +250,12 @@ export interface PromptOptions {
|
|
|
241
250
|
toolChoice?: ToolChoice;
|
|
242
251
|
/** Send as developer/system message instead of user. Providers that support it use the developer role; others fall back to user. */
|
|
243
252
|
synthetic?: boolean;
|
|
253
|
+
/** Marks this prompt as a deliberate user action (typed message, `.`/`c`
|
|
254
|
+
* continue). Clears advisor auto-resume suppression that a user interrupt set.
|
|
255
|
+
* Defaults to `!synthetic`; manual-continue is synthetic yet user-initiated, so
|
|
256
|
+
* it sets this explicitly. Agent-initiated synthetic prompts (auto-continue,
|
|
257
|
+
* plan re-prime, reminders) leave it unset and keep suppression latched. */
|
|
258
|
+
userInitiated?: boolean;
|
|
244
259
|
/** Explicit billing/initiator attribution for the prompt. Defaults to user prompts as `user` and synthetic prompts as `agent`. */
|
|
245
260
|
attribution?: MessageAttribution;
|
|
246
261
|
/** Skip pre-send compaction checks for this prompt (internal use for maintenance flows). */
|
|
@@ -301,6 +316,27 @@ export interface SessionStats {
|
|
|
301
316
|
premiumRequests: number;
|
|
302
317
|
cost: number;
|
|
303
318
|
}
|
|
319
|
+
/** Advisor statistics for /advisor status command. */
|
|
320
|
+
export interface AdvisorStats {
|
|
321
|
+
configured: boolean;
|
|
322
|
+
active: boolean;
|
|
323
|
+
model?: Model;
|
|
324
|
+
contextWindow: number;
|
|
325
|
+
contextTokens: number;
|
|
326
|
+
tokens: {
|
|
327
|
+
input: number;
|
|
328
|
+
output: number;
|
|
329
|
+
cacheRead: number;
|
|
330
|
+
cacheWrite: number;
|
|
331
|
+
total: number;
|
|
332
|
+
};
|
|
333
|
+
cost: number;
|
|
334
|
+
messages: {
|
|
335
|
+
user: number;
|
|
336
|
+
assistant: number;
|
|
337
|
+
total: number;
|
|
338
|
+
};
|
|
339
|
+
}
|
|
304
340
|
export interface FreshSessionResult {
|
|
305
341
|
previousSessionId: string;
|
|
306
342
|
sessionId: string;
|
|
@@ -1095,7 +1131,50 @@ export declare class AgentSession {
|
|
|
1095
1131
|
* Format the entire session as plain text for clipboard export.
|
|
1096
1132
|
* Includes user messages, assistant text, thinking blocks, tool calls, and tool results.
|
|
1097
1133
|
*/
|
|
1098
|
-
formatSessionAsText(
|
|
1134
|
+
formatSessionAsText(options?: {
|
|
1135
|
+
compact?: boolean;
|
|
1136
|
+
}): string;
|
|
1137
|
+
/**
|
|
1138
|
+
* Enable or disable the advisor for this session. The setting is overridden for the session,
|
|
1139
|
+
* and the runtime is started or stopped to match.
|
|
1140
|
+
*
|
|
1141
|
+
* @returns true when the advisor is actively running after the call.
|
|
1142
|
+
*/
|
|
1143
|
+
setAdvisorEnabled(enabled: boolean): boolean;
|
|
1144
|
+
/**
|
|
1145
|
+
* Toggle the advisor setting and start/stop the runtime accordingly.
|
|
1146
|
+
*
|
|
1147
|
+
* @returns true when the advisor is actively running after the call.
|
|
1148
|
+
*/
|
|
1149
|
+
toggleAdvisorEnabled(): boolean;
|
|
1150
|
+
/**
|
|
1151
|
+
* Whether the advisor setting is enabled for this session.
|
|
1152
|
+
*/
|
|
1153
|
+
isAdvisorEnabled(): boolean;
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether a live advisor agent is attached to this session. True only when
|
|
1156
|
+
* `advisor.enabled` is set AND a model resolved for the `advisor` role AND
|
|
1157
|
+
* the advisor applies to this agent kind — i.e. the actual runtime exists,
|
|
1158
|
+
* not merely the setting. Drives the status-line badge and `/dump advisor`.
|
|
1159
|
+
*/
|
|
1160
|
+
isAdvisorActive(): boolean;
|
|
1161
|
+
/**
|
|
1162
|
+
* Return structured advisor stats for the status command and TUI panel.
|
|
1163
|
+
*/
|
|
1164
|
+
getAdvisorStats(): AdvisorStats;
|
|
1165
|
+
/**
|
|
1166
|
+
* Format a concise advisor status line for ACP/text output.
|
|
1167
|
+
*/
|
|
1168
|
+
formatAdvisorStatus(): string;
|
|
1169
|
+
/**
|
|
1170
|
+
* Format the advisor agent's own transcript (its system prompt, config,
|
|
1171
|
+
* tools, and the markdown deltas it received plus its thinking/advise/read
|
|
1172
|
+
* calls) as plain text — the advisor-side equivalent of
|
|
1173
|
+
* {@link formatSessionAsText}. Returns null when no advisor is active.
|
|
1174
|
+
*/
|
|
1175
|
+
formatAdvisorHistoryAsText(options?: {
|
|
1176
|
+
compact?: boolean;
|
|
1177
|
+
}): string | null;
|
|
1099
1178
|
/**
|
|
1100
1179
|
* Check if extensions have handlers for a specific event type.
|
|
1101
1180
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export interface HistoryFormatOptions {
|
|
2
2
|
/** Optional H1 prepended to the transcript. */
|
|
3
3
|
title?: string;
|
|
4
|
+
/** Render assistant thinking blocks (default: elided). */
|
|
5
|
+
includeThinking?: boolean;
|
|
6
|
+
/** Render tool intent comment before tool call lines. */
|
|
7
|
+
includeToolIntent?: boolean;
|
|
4
8
|
}
|
|
5
9
|
/**
|
|
6
10
|
* Format a session's message array as a concise markdown transcript.
|
|
@@ -250,8 +250,11 @@ export declare class SessionManager {
|
|
|
250
250
|
/**
|
|
251
251
|
* Open a specific session file.
|
|
252
252
|
* @param sessionDir Optional dir for /new or /branch; defaults to the file's parent.
|
|
253
|
+
* @param options.initialCwd Cwd to use when the file is empty or missing.
|
|
253
254
|
*/
|
|
254
|
-
static open(filePath: string, sessionDir?: string, storage?: SessionStorage
|
|
255
|
+
static open(filePath: string, sessionDir?: string, storage?: SessionStorage, options?: {
|
|
256
|
+
initialCwd?: string;
|
|
257
|
+
}): Promise<SessionManager>;
|
|
255
258
|
/** Continue the most recent session, or create a new one if none exists. */
|
|
256
259
|
static continueRecent(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
|
|
257
260
|
/** Create an in-memory session (no file persistence). */
|
|
@@ -4,6 +4,8 @@ export interface YieldDispatcher<P> {
|
|
|
4
4
|
isStale?(entry: P): boolean;
|
|
5
5
|
/** Produce one batched AgentMessage from non-stale entries. Return null to skip. */
|
|
6
6
|
build(survivors: P[]): AgentMessage | null;
|
|
7
|
+
/** If true, entries for this kind are drained only by {@link drainLazy} and never trigger the idle flush. */
|
|
8
|
+
skipIdleFlush?: boolean;
|
|
7
9
|
}
|
|
8
10
|
export interface YieldQueueOptions {
|
|
9
11
|
isStreaming: () => boolean;
|
|
@@ -26,6 +26,27 @@ export declare function formatResultOutputFallback(result: Pick<SingleResult, "o
|
|
|
26
26
|
* the same agent ≥2× all without roles. Returns undefined when no nudge applies.
|
|
27
27
|
*/
|
|
28
28
|
export declare function buildSpecializationAdvisory(agentName: string | undefined, items: TaskItem[], depthCapacity: boolean): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Suggestion — never a rejection — nudging the spawner to coordinate via `irc`
|
|
31
|
+
* when one call creates ≥2 live siblings and it still holds spawn capacity.
|
|
32
|
+
* Returns undefined when there is nothing to coordinate or IRC is unavailable.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildCoordinationAdvisory(items: TaskItem[], depthCapacity: boolean, ircEnabled: boolean): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Compose the non-blocking advisory appended to a `task` result: the
|
|
37
|
+
* specialization nudge, plus — only when the siblings keep running after this
|
|
38
|
+
* call (`willRunAsync`) — the coordination suggestion. Coordination is gated on
|
|
39
|
+
* async because a sync fanout's siblings have already finished, so a
|
|
40
|
+
* "coordinate while they run" hint would misfire. Returns undefined when
|
|
41
|
+
* neither applies.
|
|
42
|
+
*/
|
|
43
|
+
export declare function composeSpawnAdvisory(args: {
|
|
44
|
+
agentName: string | undefined;
|
|
45
|
+
items: TaskItem[];
|
|
46
|
+
depthCapacity: boolean;
|
|
47
|
+
ircEnabled: boolean;
|
|
48
|
+
willRunAsync: boolean;
|
|
49
|
+
}): string | undefined;
|
|
29
50
|
/**
|
|
30
51
|
* Task tool - Delegate tasks to specialized agents.
|
|
31
52
|
*
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
* helpers swallow open/IO failures and degrade to "no cache" so a corrupt or
|
|
9
9
|
* unreadable DB never blocks a `gh` call.
|
|
10
10
|
*
|
|
11
|
-
* TTL:
|
|
12
11
|
* Soft TTL → return cached row directly.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Stateful issue/PR rows past soft TTL but within hard TTL → refresh
|
|
13
|
+
* synchronously, falling back to the cached row if the live fetch fails.
|
|
14
|
+
* Expensive PR diff rows past soft TTL but within hard TTL → return cached
|
|
15
|
+
* row AND schedule a background refresh (errors logged, never thrown).
|
|
15
16
|
* Past hard TTL → treat as miss and fetch fresh.
|
|
16
17
|
*/
|
|
17
18
|
import { Database } from "bun:sqlite";
|
|
@@ -101,7 +102,7 @@ export interface CacheLookupOptions<T> {
|
|
|
101
102
|
settings?: Settings | undefined;
|
|
102
103
|
now?: number;
|
|
103
104
|
}
|
|
104
|
-
export type CacheStatus = "miss" | "fresh" | "stale" | "disabled";
|
|
105
|
+
export type CacheStatus = "miss" | "fresh" | "refreshed" | "stale" | "disabled";
|
|
105
106
|
export interface CacheLookupResult<T> {
|
|
106
107
|
rendered: string;
|
|
107
108
|
sourceUrl: string | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type LocalProtocolOptions } from "../internal-urls";
|
|
2
2
|
export declare function expandTilde(filePath: string, home?: string): string;
|
|
3
3
|
export declare function expandPath(filePath: string): string;
|
|
4
|
+
export declare function normalizeWindowsDriveAliasPath(filePath: string, platform?: NodeJS.Platform): string;
|
|
4
5
|
/**
|
|
5
6
|
* Inclusive line range describing one selector segment (e.g. `50-100`,
|
|
6
7
|
* `301-`, or `50+10`). `endLine` is `undefined` for open-ended ranges.
|
|
@@ -66,7 +66,6 @@ export declare function __resetAutoQaConsentForTests(): void;
|
|
|
66
66
|
* permanently locked into the false branch.
|
|
67
67
|
*/
|
|
68
68
|
export declare function resolveAutoQaConsent(settings: Settings | undefined): Promise<boolean>;
|
|
69
|
-
export declare function getAutoQaDbPath(): string;
|
|
70
69
|
/**
|
|
71
70
|
* Open (or return the cached handle for) the auto-QA SQLite database at
|
|
72
71
|
* `~/.omp/agent/autoqa.db`. Idempotently runs schema creation, the
|
|
@@ -80,6 +80,6 @@ export declare class WebSearchTool implements AgentTool<typeof webSearchSchema,
|
|
|
80
80
|
/** Web search tool as CustomTool (for TUI rendering support) */
|
|
81
81
|
export declare const webSearchCustomTool: CustomTool<typeof webSearchSchema, SearchRenderDetails>;
|
|
82
82
|
export declare function getSearchTools(): CustomTool<any, any>[];
|
|
83
|
-
export { getSearchProvider, setPreferredSearchProvider } from "./provider";
|
|
83
|
+
export { getSearchProvider, setExcludedSearchProviders, setPreferredSearchProvider } from "./provider";
|
|
84
84
|
export type { SearchProviderId as SearchProvider, SearchResponse } from "./types";
|
|
85
|
-
export { isSearchProviderPreference } from "./types";
|
|
85
|
+
export { isSearchProviderId, isSearchProviderPreference } from "./types";
|
|
@@ -13,6 +13,8 @@ export declare function getSearchProviderLabel(id: SearchProviderId): string;
|
|
|
13
13
|
export declare function getSearchProvider(id: SearchProviderId): Promise<SearchProvider>;
|
|
14
14
|
/** Set the preferred web search provider from settings */
|
|
15
15
|
export declare function setPreferredSearchProvider(provider: SearchProviderId | "auto"): void;
|
|
16
|
+
/** Set providers that web search should never use, including fallbacks. */
|
|
17
|
+
export declare function setExcludedSearchProviders(providers: readonly SearchProviderId[]): void;
|
|
16
18
|
/**
|
|
17
19
|
* Determine which providers are configured and currently available.
|
|
18
20
|
* Each candidate is loaded (and its `isAvailable()` called) only as the chain
|