@oh-my-pi/pi-coding-agent 16.0.4 → 16.0.6
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 +94 -0
- package/dist/cli.js +2027 -1396
- package/dist/types/advisor/advise-tool.d.ts +31 -19
- package/dist/types/autoresearch/tools/init-experiment.d.ts +13 -17
- package/dist/types/autoresearch/tools/log-experiment.d.ts +17 -19
- package/dist/types/autoresearch/tools/run-experiment.d.ts +3 -4
- package/dist/types/autoresearch/tools/update-notes.d.ts +4 -5
- package/dist/types/cli/args.d.ts +1 -0
- package/dist/types/cli/bench-cli.d.ts +6 -0
- package/dist/types/cli/ttsr-cli.d.ts +39 -0
- package/dist/types/commands/launch.d.ts +3 -0
- package/dist/types/commands/ttsr.d.ts +57 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +4 -5
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +4 -5
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +5 -6
- package/dist/types/commit/agentic/tools/git-overview.d.ts +4 -5
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +23 -24
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +11 -32
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +3 -4
- package/dist/types/commit/agentic/tools/schemas.d.ts +6 -27
- package/dist/types/commit/agentic/tools/split-commit.d.ts +28 -49
- package/dist/types/commit/changelog/generate.d.ts +12 -13
- package/dist/types/commit/shared-llm.d.ts +10 -37
- package/dist/types/config/config-file.d.ts +4 -4
- package/dist/types/config/keybindings.d.ts +5 -0
- package/dist/types/config/models-config-schema.d.ts +625 -990
- package/dist/types/config/models-config.d.ts +229 -217
- package/dist/types/config/settings-schema.d.ts +144 -25
- package/dist/types/edit/hashline/params.d.ts +7 -11
- package/dist/types/edit/index.d.ts +2 -1
- package/dist/types/edit/modes/apply-patch.d.ts +4 -5
- package/dist/types/edit/modes/patch.d.ts +15 -24
- package/dist/types/edit/modes/replace.d.ts +16 -17
- package/dist/types/eval/js/index.d.ts +1 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +6 -3
- package/dist/types/extensibility/custom-tools/types.d.ts +8 -5
- package/dist/types/extensibility/extensions/runner.d.ts +5 -2
- package/dist/types/extensibility/extensions/types.d.ts +14 -10
- package/dist/types/extensibility/hooks/types.d.ts +7 -4
- package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +13 -5
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +17 -0
- package/dist/types/extensibility/shared-events.d.ts +22 -1
- package/dist/types/extensibility/typebox.d.ts +80 -58
- package/dist/types/goals/tools/goal-tool.d.ts +11 -24
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lsp/index.d.ts +11 -26
- package/dist/types/lsp/types.d.ts +12 -28
- package/dist/types/main.d.ts +1 -0
- package/dist/types/mcp/client.d.ts +8 -0
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/custom-editor.d.ts +3 -1
- package/dist/types/modes/components/status-line/component.d.ts +1 -1
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +0 -1
- package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
- package/dist/types/modes/controllers/input-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +3 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +1 -1
- package/dist/types/modes/setup-wizard/index.d.ts +1 -0
- package/dist/types/modes/setup-wizard/startup-splash.d.ts +7 -0
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/modes/types.d.ts +3 -0
- package/dist/types/modes/utils/context-usage.d.ts +12 -0
- package/dist/types/sdk.d.ts +8 -1
- package/dist/types/session/agent-session.d.ts +24 -0
- package/dist/types/session/session-persistence.d.ts +4 -0
- package/dist/types/startup-splash.d.ts +12 -0
- package/dist/types/task/types.d.ts +47 -48
- package/dist/types/tools/ask.d.ts +26 -27
- package/dist/types/tools/ast-edit.d.ts +17 -17
- package/dist/types/tools/ast-grep.d.ts +12 -13
- package/dist/types/tools/bash.d.ts +20 -17
- package/dist/types/tools/browser.d.ts +46 -71
- package/dist/types/tools/checkpoint.d.ts +14 -15
- package/dist/types/tools/debug.d.ts +82 -145
- package/dist/types/tools/eval.d.ts +30 -40
- package/dist/types/tools/find.d.ts +17 -18
- package/dist/types/tools/gh.d.ts +49 -78
- package/dist/types/tools/image-gen.d.ts +20 -36
- package/dist/types/tools/inspect-image.d.ts +10 -11
- package/dist/types/tools/irc.d.ts +22 -33
- package/dist/types/tools/job.d.ts +11 -12
- package/dist/types/tools/learn.d.ts +21 -28
- package/dist/types/tools/manage-skill.d.ts +13 -22
- package/dist/types/tools/memory-edit.d.ts +15 -24
- package/dist/types/tools/memory-recall.d.ts +7 -8
- package/dist/types/tools/memory-reflect.d.ts +9 -10
- package/dist/types/tools/memory-retain.d.ts +13 -14
- package/dist/types/tools/read.d.ts +8 -8
- package/dist/types/tools/resolve.d.ts +11 -18
- package/dist/types/tools/review.d.ts +9 -15
- package/dist/types/tools/search-tool-bm25.d.ts +9 -10
- package/dist/types/tools/search.d.ts +16 -17
- package/dist/types/tools/ssh.d.ts +14 -15
- package/dist/types/tools/todo.d.ts +27 -43
- package/dist/types/tools/tts.d.ts +8 -9
- package/dist/types/tools/write.d.ts +9 -10
- package/dist/types/tui/code-cell.d.ts +2 -0
- package/dist/types/tui/index.d.ts +1 -0
- package/dist/types/tui/width-aware-text.d.ts +23 -0
- package/dist/types/utils/image-vision-fallback.d.ts +28 -0
- package/dist/types/utils/markit.d.ts +10 -1
- package/dist/types/web/search/index.d.ts +17 -28
- package/dist/types/web/search/providers/base.d.ts +1 -0
- package/dist/types/web/search/providers/gemini.d.ts +1 -0
- package/dist/types/web/search/providers/perplexity.d.ts +0 -2
- package/dist/types/web/search/types.d.ts +32 -26
- package/package.json +14 -13
- package/scripts/omp +1 -1
- package/src/advisor/__tests__/advisor.test.ts +103 -1
- package/src/advisor/advise-tool.ts +47 -11
- package/src/autoresearch/tools/init-experiment.ts +13 -16
- package/src/autoresearch/tools/log-experiment.ts +15 -18
- package/src/autoresearch/tools/run-experiment.ts +3 -3
- package/src/autoresearch/tools/update-notes.ts +4 -4
- package/src/cli/args.ts +1 -0
- package/src/cli/bench-cli.ts +30 -7
- package/src/cli/flag-tables.ts +8 -0
- package/src/cli/ttsr-cli.ts +995 -0
- package/src/cli-commands.ts +1 -0
- package/src/cli.ts +7 -1
- package/src/collab/host.ts +2 -2
- package/src/commands/launch.ts +3 -0
- package/src/commands/ttsr.ts +125 -0
- package/src/commit/agentic/tools/analyze-file.ts +4 -4
- package/src/commit/agentic/tools/git-file-diff.ts +4 -4
- package/src/commit/agentic/tools/git-hunk.ts +7 -5
- package/src/commit/agentic/tools/git-overview.ts +4 -4
- package/src/commit/agentic/tools/propose-changelog.ts +18 -15
- package/src/commit/agentic/tools/propose-commit.ts +6 -6
- package/src/commit/agentic/tools/recent-commits.ts +3 -3
- package/src/commit/agentic/tools/schemas.ts +8 -20
- package/src/commit/agentic/tools/split-commit.ts +19 -23
- package/src/commit/analysis/summary.ts +7 -5
- package/src/commit/changelog/generate.ts +15 -11
- package/src/commit/shared-llm.ts +17 -24
- package/src/config/config-file.ts +13 -15
- package/src/config/keybindings.ts +6 -0
- package/src/config/models-config-schema.ts +206 -179
- package/src/config/settings-schema.ts +118 -2
- package/src/discovery/builtin-rules/index.ts +2 -0
- package/src/discovery/builtin-rules/ts-import-type.md +2 -2
- package/src/discovery/builtin-rules/ts-no-any.md +11 -2
- package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +55 -0
- package/src/edit/hashline/params.ts +12 -11
- package/src/edit/index.ts +5 -4
- package/src/edit/modes/apply-patch.ts +4 -4
- package/src/edit/modes/patch.ts +15 -18
- package/src/edit/modes/replace.ts +13 -17
- package/src/edit/renderer.ts +0 -1
- package/src/eval/agent-bridge.ts +11 -13
- package/src/eval/completion-bridge.ts +25 -17
- package/src/eval/js/context-manager.ts +17 -2
- package/src/eval/js/index.ts +1 -1
- package/src/eval/py/executor.ts +2 -2
- package/src/eval/py/runner.py +44 -0
- package/src/extensibility/custom-commands/loader.ts +5 -3
- package/src/extensibility/custom-commands/types.ts +6 -3
- package/src/extensibility/custom-tools/loader.ts +4 -2
- package/src/extensibility/custom-tools/types.ts +8 -5
- package/src/extensibility/extensions/loader.ts +4 -2
- package/src/extensibility/extensions/runner.ts +20 -2
- package/src/extensibility/extensions/types.ts +22 -8
- package/src/extensibility/hooks/loader.ts +5 -2
- package/src/extensibility/hooks/types.ts +7 -4
- package/src/extensibility/legacy-pi-ai-shim.ts +42 -5
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +113 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +13 -13
- package/src/extensibility/shared-events.ts +24 -0
- package/src/extensibility/tool-proxy.ts +4 -1
- package/src/extensibility/typebox.ts +778 -251
- package/src/goals/guided-setup.ts +12 -3
- package/src/goals/tools/goal-tool.ts +6 -6
- package/src/index.ts +2 -0
- package/src/internal-urls/docs-index.generated.ts +15 -13
- package/src/lsp/types.ts +13 -27
- package/src/main.ts +29 -21
- package/src/mcp/client.ts +38 -13
- package/src/mcp/render.ts +102 -89
- package/src/modes/components/agent-hub.ts +11 -4
- package/src/modes/components/branch-summary-message.ts +1 -0
- package/src/modes/components/btw-panel.ts +5 -1
- package/src/modes/components/collab-prompt-message.ts +9 -7
- package/src/modes/components/compaction-summary-message.ts +1 -0
- package/src/modes/components/custom-editor.ts +18 -0
- package/src/modes/components/custom-message.ts +1 -0
- package/src/modes/components/footer.ts +6 -5
- package/src/modes/components/hook-message.ts +1 -0
- package/src/modes/components/read-tool-group.ts +9 -3
- package/src/modes/components/skill-message.ts +1 -0
- package/src/modes/components/status-line/component.ts +139 -15
- package/src/modes/components/status-line/context-thresholds.ts +0 -1
- package/src/modes/components/todo-reminder.ts +1 -0
- package/src/modes/components/tool-execution.ts +17 -10
- package/src/modes/components/ttsr-notification.ts +1 -0
- package/src/modes/components/user-message.ts +6 -6
- package/src/modes/controllers/btw-controller.ts +69 -1
- package/src/modes/controllers/event-controller.ts +2 -7
- package/src/modes/controllers/input-controller.ts +29 -0
- package/src/modes/controllers/selector-controller.ts +10 -3
- package/src/modes/interactive-mode.ts +42 -10
- package/src/modes/rpc/rpc-types.ts +1 -1
- package/src/modes/setup-wizard/index.ts +1 -0
- package/src/modes/setup-wizard/scenes/sign-in.ts +77 -5
- package/src/modes/setup-wizard/startup-splash.ts +107 -0
- package/src/modes/theme/theme.ts +133 -143
- package/src/modes/types.ts +3 -0
- package/src/modes/utils/context-usage.ts +37 -20
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/image-attachment-describe-system.md +8 -0
- package/src/prompts/tools/image-attachment-describe.md +10 -0
- package/src/sdk.ts +35 -22
- package/src/session/agent-session.ts +715 -255
- package/src/session/session-history-format.ts +11 -2
- package/src/session/session-loader.ts +19 -32
- package/src/session/session-persistence.ts +27 -11
- package/src/session/snapcompact-inline.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +4 -11
- package/src/ssh/connection-manager.ts +3 -2
- package/src/startup-splash.ts +19 -0
- package/src/task/executor.ts +12 -7
- package/src/task/types.ts +44 -41
- package/src/tool-discovery/tool-index.ts +17 -4
- package/src/tools/ask.ts +14 -14
- package/src/tools/ast-edit.ts +17 -14
- package/src/tools/ast-grep.ts +10 -9
- package/src/tools/bash.ts +15 -10
- package/src/tools/browser/launch.ts +13 -0
- package/src/tools/browser.ts +26 -32
- package/src/tools/checkpoint.ts +7 -7
- package/src/tools/debug.ts +72 -69
- package/src/tools/eval.ts +18 -19
- package/src/tools/find.ts +20 -13
- package/src/tools/gh.ts +29 -49
- package/src/tools/image-gen.ts +94 -57
- package/src/tools/inspect-image.ts +8 -9
- package/src/tools/irc.ts +12 -12
- package/src/tools/job.ts +6 -6
- package/src/tools/learn.ts +11 -14
- package/src/tools/manage-skill.ts +19 -23
- package/src/tools/memory-edit.ts +8 -8
- package/src/tools/memory-recall.ts +4 -4
- package/src/tools/memory-reflect.ts +5 -5
- package/src/tools/memory-retain.ts +9 -11
- package/src/tools/puppeteer/02_stealth_hairline.txt +1 -1
- package/src/tools/puppeteer/04_stealth_iframe.txt +4 -4
- package/src/tools/puppeteer/05_stealth_webgl.txt +1 -1
- package/src/tools/puppeteer/10_stealth_plugins.txt +6 -4
- package/src/tools/puppeteer/12_stealth_codecs.txt +2 -2
- package/src/tools/puppeteer/13_stealth_worker.txt +1 -1
- package/src/tools/read.ts +197 -19
- package/src/tools/report-tool-issue.ts +6 -6
- package/src/tools/resolve.ts +6 -6
- package/src/tools/review.ts +10 -12
- package/src/tools/search-tool-bm25.ts +5 -5
- package/src/tools/search.ts +20 -29
- package/src/tools/ssh.ts +8 -8
- package/src/tools/todo.ts +16 -19
- package/src/tools/tts.ts +16 -15
- package/src/tools/write.ts +5 -5
- package/src/tui/code-cell.ts +44 -3
- package/src/tui/index.ts +1 -0
- package/src/tui/width-aware-text.ts +58 -0
- package/src/utils/image-vision-fallback.ts +197 -0
- package/src/utils/markit.ts +17 -2
- package/src/web/search/index.ts +21 -9
- package/src/web/search/providers/base.ts +1 -0
- package/src/web/search/providers/gemini.ts +56 -18
- package/src/web/search/providers/perplexity.ts +373 -126
- package/src/web/search/types.ts +28 -48
|
@@ -11,13 +11,21 @@
|
|
|
11
11
|
* bare package root. Subpath imports (`@oh-my-pi/pi-ai/oauth`, etc.)
|
|
12
12
|
* continue to resolve directly against the bundled pi-ai package.
|
|
13
13
|
*
|
|
14
|
-
* The `Type` runtime
|
|
15
|
-
* already serves
|
|
16
|
-
* class, keeping the legacy-compat surface internally consistent.
|
|
14
|
+
* The `Type` runtime and legacy `StringEnum()` helper are borrowed from the
|
|
15
|
+
* Zod-backed TypeBox shim that already serves TypeBox imports for the same
|
|
16
|
+
* extension class, keeping the legacy-compat surface internally consistent.
|
|
17
17
|
*
|
|
18
18
|
* Type-level `Static` and `TSchema` continue to come from pi-ai's own
|
|
19
19
|
* `types.ts` via the `export *` below — pi-ai still exports both as types,
|
|
20
|
-
* only the runtime `Type` builder
|
|
20
|
+
* only the runtime `Type` builder and `StringEnum()` helper were removed.
|
|
21
21
|
*/
|
|
22
|
+
import { type TSchema, Type } from "./typebox";
|
|
23
|
+
export interface StringEnumOptions<T extends string> {
|
|
24
|
+
description?: string;
|
|
25
|
+
default?: T;
|
|
26
|
+
examples?: T[];
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
export declare function StringEnum<T extends string>(values: readonly T[], options?: StringEnumOptions<T>): TSchema;
|
|
22
30
|
export * from "@oh-my-pi/pi-ai";
|
|
23
|
-
export { Type }
|
|
31
|
+
export { Type };
|
|
@@ -11,4 +11,21 @@
|
|
|
11
11
|
* entry, while still re-exporting the canonical surface so plugins observe
|
|
12
12
|
* the same module identity as a direct `@oh-my-pi/pi-coding-agent` import.
|
|
13
13
|
*/
|
|
14
|
+
import type { TSchema } from "@oh-my-pi/pi-ai";
|
|
15
|
+
import { Settings } from "../config/settings";
|
|
16
|
+
import type { ToolDefinition } from "./extensions/types";
|
|
17
|
+
import { Type } from "./typebox";
|
|
18
|
+
export interface ParsedFrontmatter<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
19
|
+
frontmatter: T;
|
|
20
|
+
body: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseFrontmatter<T extends Record<string, unknown> = Record<string, unknown>>(content: string): ParsedFrontmatter<T>;
|
|
23
|
+
export declare function stripFrontmatter(content: string): string;
|
|
24
|
+
export declare function defineTool<TParams extends TSchema = TSchema, TDetails = unknown>(tool: ToolDefinition<TParams, TDetails>): ToolDefinition<TParams, TDetails>;
|
|
25
|
+
export declare function createCodingTools(cwd: string): ToolDefinition[];
|
|
26
|
+
export declare const SettingsManager: {
|
|
27
|
+
readonly create: (cwd: string, agentDir?: string) => Promise<Settings>;
|
|
28
|
+
readonly inMemory: () => Settings;
|
|
29
|
+
};
|
|
14
30
|
export * from "../index";
|
|
31
|
+
export { Type };
|
|
@@ -79,6 +79,16 @@ export interface SessionCompactEvent {
|
|
|
79
79
|
export interface SessionShutdownEvent {
|
|
80
80
|
type: "session_shutdown";
|
|
81
81
|
}
|
|
82
|
+
/** Fired when a main-agent turn is about to settle; handlers may request one continuation turn. */
|
|
83
|
+
export interface SessionStopEvent {
|
|
84
|
+
type: "session_stop";
|
|
85
|
+
messages: AgentMessage[];
|
|
86
|
+
turn_id: number;
|
|
87
|
+
last_assistant_message?: AgentMessage;
|
|
88
|
+
session_id: string;
|
|
89
|
+
session_file?: string;
|
|
90
|
+
stop_hook_active: boolean;
|
|
91
|
+
}
|
|
82
92
|
/** Preparation data for tree navigation (used by session_before_tree event) */
|
|
83
93
|
export interface TreePreparation {
|
|
84
94
|
/** Node being switched to */
|
|
@@ -118,7 +128,7 @@ export interface GoalUpdatedEvent {
|
|
|
118
128
|
goal: Goal | null;
|
|
119
129
|
state?: GoalModeState;
|
|
120
130
|
}
|
|
121
|
-
export type SessionEvent = SessionStartEvent | SessionBeforeSwitchEvent | SessionSwitchEvent | SessionBeforeBranchEvent | SessionBranchEvent | SessionBeforeCompactEvent | SessionCompactingEvent | SessionCompactEvent | SessionShutdownEvent | SessionBeforeTreeEvent | SessionTreeEvent | GoalUpdatedEvent;
|
|
131
|
+
export type SessionEvent = SessionStartEvent | SessionBeforeSwitchEvent | SessionSwitchEvent | SessionBeforeBranchEvent | SessionBranchEvent | SessionBeforeCompactEvent | SessionCompactingEvent | SessionCompactEvent | SessionStopEvent | SessionShutdownEvent | SessionBeforeTreeEvent | SessionTreeEvent | GoalUpdatedEvent;
|
|
122
132
|
/**
|
|
123
133
|
* Fired before each LLM call.
|
|
124
134
|
*
|
|
@@ -264,6 +274,17 @@ export interface SessionCompactingResult {
|
|
|
264
274
|
/** Custom data to store in compaction entry */
|
|
265
275
|
preserveData?: Record<string, unknown>;
|
|
266
276
|
}
|
|
277
|
+
/** Return type for `session_stop` handlers */
|
|
278
|
+
export interface SessionStopEventResult {
|
|
279
|
+
/** Continue the main session with additional context before settling */
|
|
280
|
+
continue?: boolean;
|
|
281
|
+
/** OMP-native model-visible context for the continuation */
|
|
282
|
+
additionalContext?: string;
|
|
283
|
+
/** Claude/Codex-compatible block decision; maps to a continuation */
|
|
284
|
+
decision?: "block";
|
|
285
|
+
/** Claude/Codex-compatible model-visible continuation reason */
|
|
286
|
+
reason?: string;
|
|
287
|
+
}
|
|
267
288
|
/** Return type for `session_before_tree` handlers */
|
|
268
289
|
export interface SessionBeforeTreeResult {
|
|
269
290
|
/** If true, cancel the navigation entirely */
|
|
@@ -1,45 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Minimal `@sinclair/typebox` runtime compatibility shim
|
|
2
|
+
* Minimal `@sinclair/typebox` runtime compatibility shim.
|
|
3
3
|
*
|
|
4
4
|
* Historically the coding agent injected the real `@sinclair/typebox` (~5MB
|
|
5
5
|
* dependency) into extensions, hooks, custom tools, and custom commands so
|
|
6
6
|
* they could author parameter schemas as `Type.Object({ name: Type.String() })`.
|
|
7
|
-
* Internally everything already runs through Zod (`wire.ts`, `validation.ts`);
|
|
8
|
-
* the only reason TypeBox remained was extension-author compat.
|
|
9
7
|
*
|
|
10
|
-
* This module
|
|
11
|
-
* return Zod schemas. Output is indistinguishable from hand-written Zod inside
|
|
12
|
-
* the agent pipeline:
|
|
8
|
+
* This module provides the subset those integrations depend on:
|
|
13
9
|
*
|
|
14
|
-
* -
|
|
15
|
-
* - `
|
|
16
|
-
*
|
|
10
|
+
* - TypeBox-style `Type.*` builders.
|
|
11
|
+
* - Runtime validation through `schema.safeParse(input)` and `schema.__validator(input)`.
|
|
12
|
+
* - Enumerable JSON Schema keywords so `{ ...schema }`, `JSON.stringify(schema)`,
|
|
13
|
+
* and `toolWireSchema({ parameters: schema })` all see the same schema.
|
|
17
14
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `@sinclair/typebox` directly in their own package.
|
|
15
|
+
* Internal validator fields and methods are intentionally non-enumerable. The
|
|
16
|
+
* object should look like JSON Schema at every serialization/wire boundary and
|
|
17
|
+
* like a small validator at runtime.
|
|
22
18
|
*/
|
|
23
|
-
|
|
24
|
-
export type
|
|
25
|
-
export type
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export type
|
|
33
|
-
export type
|
|
34
|
-
export type
|
|
35
|
-
export type
|
|
36
|
-
export type
|
|
37
|
-
export type
|
|
38
|
-
export type
|
|
39
|
-
export type
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
export type TSchema = ArkSchema;
|
|
20
|
+
export type Static<T extends ArkSchema> = T["__infer"];
|
|
21
|
+
export type TAny = ArkSchema;
|
|
22
|
+
export type TUnknown = ArkSchema;
|
|
23
|
+
export type TNever = ArkSchema;
|
|
24
|
+
export type TNull = ArkSchema;
|
|
25
|
+
export type TString = ArkSchema;
|
|
26
|
+
export type TNumber = ArkSchema;
|
|
27
|
+
export type TInteger = ArkSchema;
|
|
28
|
+
export type TBoolean = ArkSchema;
|
|
29
|
+
export type TLiteral<_V extends string | number | boolean> = ArkSchema;
|
|
30
|
+
export type TArray<_E extends ArkSchema> = ArkSchema;
|
|
31
|
+
export type TObject<_P extends Record<string, ArkSchema> = Record<string, ArkSchema>> = ArkSchema;
|
|
32
|
+
export type TOptional<_E extends ArkSchema> = ArkSchema;
|
|
33
|
+
export type TUnion<_T extends readonly ArkSchema[] = readonly ArkSchema[]> = ArkSchema;
|
|
34
|
+
export type TEnum<_T extends readonly (string | number)[] = readonly (string | number)[]> = ArkSchema;
|
|
35
|
+
export type TRecord<_K extends ArkSchema, _V extends ArkSchema> = ArkSchema;
|
|
36
|
+
declare const VALIDATION_FAILURE: unique symbol;
|
|
37
|
+
interface ValidationFailure {
|
|
38
|
+
message: string;
|
|
39
|
+
readonly [VALIDATION_FAILURE]: true;
|
|
40
|
+
}
|
|
41
|
+
interface SafeParseSuccess {
|
|
42
|
+
success: true;
|
|
43
|
+
data: unknown;
|
|
44
|
+
}
|
|
45
|
+
interface SafeParseFailure {
|
|
46
|
+
success: false;
|
|
47
|
+
error: ValidationFailure;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* JSON-Schema-shaped object with non-enumerable runtime helpers.
|
|
51
|
+
* Validators return the validated data or a marked `{ message }` failure.
|
|
52
|
+
*/
|
|
53
|
+
interface ArkSchema {
|
|
54
|
+
__validator: (data: unknown) => unknown;
|
|
55
|
+
__metadata?: Record<string, unknown>;
|
|
56
|
+
__optional?: true;
|
|
57
|
+
__properties?: Record<string, ArkSchema>;
|
|
58
|
+
__additionalProperties?: boolean | ArkSchema;
|
|
59
|
+
__infer?: unknown;
|
|
60
|
+
__inner?: ArkSchema;
|
|
61
|
+
safeParse(input: unknown): SafeParseSuccess | SafeParseFailure;
|
|
62
|
+
toJSON(): Record<string, unknown>;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
43
65
|
interface Meta {
|
|
44
66
|
title?: string;
|
|
45
67
|
description?: string;
|
|
@@ -70,32 +92,32 @@ interface ObjectOpts extends Meta {
|
|
|
70
92
|
* TypeBox default: extra keys are preserved. Set `false` to reject unknowns,
|
|
71
93
|
* `true` to allow any, or a schema to validate them.
|
|
72
94
|
*/
|
|
73
|
-
additionalProperties?: boolean |
|
|
95
|
+
additionalProperties?: boolean | ArkSchema;
|
|
74
96
|
}
|
|
75
|
-
declare function tString(opts?: StringOpts):
|
|
76
|
-
declare function tNumber(opts?: NumberOpts):
|
|
77
|
-
declare function tInteger(opts?: NumberOpts):
|
|
78
|
-
declare function tBoolean(opts?: Meta):
|
|
79
|
-
declare function tNull(opts?: Meta):
|
|
80
|
-
declare function tAny(opts?: Meta):
|
|
81
|
-
declare function tUnknown(opts?: Meta):
|
|
82
|
-
declare function tNever(opts?: Meta):
|
|
83
|
-
declare function tLiteral<V extends string | number | boolean>(value: V, opts?: Meta):
|
|
84
|
-
declare function tUnion<T extends readonly
|
|
85
|
-
declare function tIntersect(schemas: readonly
|
|
86
|
-
declare function tEnum<T extends Record<string, string | number> | readonly (string | number)[]>(values: T, opts?: Meta):
|
|
87
|
-
declare function tArray<E extends
|
|
88
|
-
declare function tTuple(items: readonly
|
|
89
|
-
declare function tObject<P extends
|
|
90
|
-
declare function tRecord<V extends
|
|
91
|
-
declare function tOptional<E extends
|
|
92
|
-
declare function tNullable<E extends
|
|
93
|
-
declare function tReadonly<E extends
|
|
94
|
-
declare function tPartial<
|
|
95
|
-
declare function tRequired<
|
|
96
|
-
declare function tPick<P extends
|
|
97
|
-
declare function tOmit<P extends
|
|
98
|
-
declare function tComposite(objects: readonly
|
|
97
|
+
declare function tString(opts?: StringOpts): ArkSchema;
|
|
98
|
+
declare function tNumber(opts?: NumberOpts): ArkSchema;
|
|
99
|
+
declare function tInteger(opts?: NumberOpts): ArkSchema;
|
|
100
|
+
declare function tBoolean(opts?: Meta): ArkSchema;
|
|
101
|
+
declare function tNull(opts?: Meta): ArkSchema;
|
|
102
|
+
declare function tAny(opts?: Meta): ArkSchema;
|
|
103
|
+
declare function tUnknown(opts?: Meta): ArkSchema;
|
|
104
|
+
declare function tNever(opts?: Meta): ArkSchema;
|
|
105
|
+
declare function tLiteral<V extends string | number | boolean>(value: V, opts?: Meta): ArkSchema;
|
|
106
|
+
declare function tUnion<T extends readonly ArkSchema[]>(schemas: T, opts?: Meta): ArkSchema;
|
|
107
|
+
declare function tIntersect(schemas: readonly ArkSchema[], opts?: Meta): ArkSchema;
|
|
108
|
+
declare function tEnum<T extends Record<string, string | number> | readonly (string | number)[]>(values: T, opts?: Meta): ArkSchema;
|
|
109
|
+
declare function tArray<E extends ArkSchema>(item: E, opts?: ArrayOpts): ArkSchema;
|
|
110
|
+
declare function tTuple(items: readonly ArkSchema[], opts?: Meta): ArkSchema;
|
|
111
|
+
declare function tObject<P extends Record<string, ArkSchema>>(properties: P, opts?: ObjectOpts): ArkSchema;
|
|
112
|
+
declare function tRecord<K extends ArkSchema, V extends ArkSchema>(key: K, value: V, opts?: Meta): ArkSchema;
|
|
113
|
+
declare function tOptional<E extends ArkSchema>(schema: E, opts?: Meta): ArkSchema;
|
|
114
|
+
declare function tNullable<E extends ArkSchema>(schema: E, opts?: Meta): ArkSchema;
|
|
115
|
+
declare function tReadonly<E extends ArkSchema>(schema: E): ArkSchema;
|
|
116
|
+
declare function tPartial<_P extends Record<string, ArkSchema>>(obj: ArkSchema): ArkSchema;
|
|
117
|
+
declare function tRequired<_P extends Record<string, ArkSchema>>(obj: ArkSchema): ArkSchema;
|
|
118
|
+
declare function tPick<P extends Record<string, ArkSchema>, K extends keyof P>(obj: ArkSchema, keys: readonly K[]): ArkSchema;
|
|
119
|
+
declare function tOmit<P extends Record<string, ArkSchema>, K extends keyof P>(obj: ArkSchema, keys: readonly K[]): ArkSchema;
|
|
120
|
+
declare function tComposite(objects: readonly ArkSchema[], opts?: Meta): ArkSchema;
|
|
99
121
|
export declare const Type: {
|
|
100
122
|
readonly String: typeof tString;
|
|
101
123
|
readonly Number: typeof tNumber;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
3
|
import type { RenderResultOptions } from "../../extensibility/custom-tools/types";
|
|
5
4
|
import type { Theme } from "../../modes/theme/theme";
|
|
6
5
|
import type { ToolSession } from "../../tools";
|
|
7
6
|
import type { Goal, GoalToolDetails } from "../state";
|
|
8
|
-
declare const goalSchema:
|
|
9
|
-
op:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
resume: "resume";
|
|
15
|
-
}>;
|
|
16
|
-
objective: z.ZodOptional<z.ZodString>;
|
|
17
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
export type GoalToolInput = z.infer<typeof goalSchema>;
|
|
7
|
+
declare const goalSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
8
|
+
op: "complete" | "create" | "drop" | "get" | "resume";
|
|
9
|
+
objective?: string | undefined;
|
|
10
|
+
token_budget?: number | undefined;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export type GoalToolInput = typeof goalSchema.infer;
|
|
20
13
|
export interface GoalToolResponse {
|
|
21
14
|
goal: Goal | null;
|
|
22
15
|
remainingTokens: number | null;
|
|
@@ -30,17 +23,11 @@ export declare class GoalTool implements AgentTool<typeof goalSchema, GoalToolDe
|
|
|
30
23
|
readonly name = "goal";
|
|
31
24
|
readonly label = "Goal";
|
|
32
25
|
readonly description: string;
|
|
33
|
-
readonly parameters:
|
|
34
|
-
op:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
get: "get";
|
|
39
|
-
resume: "resume";
|
|
40
|
-
}>;
|
|
41
|
-
objective: z.ZodOptional<z.ZodString>;
|
|
42
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
43
|
-
}, z.core.$strip>;
|
|
26
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
27
|
+
op: "complete" | "create" | "drop" | "get" | "resume";
|
|
28
|
+
objective?: string | undefined;
|
|
29
|
+
token_budget?: number | undefined;
|
|
30
|
+
}, {}>;
|
|
44
31
|
readonly strict = true;
|
|
45
32
|
readonly intent: "omit";
|
|
46
33
|
constructor(session: ToolSession);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HookEditorComponent, HookInputComponent, HookSelectorComponent } from "./modes/components";
|
|
2
2
|
export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
3
3
|
export { getAgentDir, logger, VERSION } from "@oh-my-pi/pi-utils";
|
|
4
|
+
export * as zod from "zod/v4";
|
|
5
|
+
export { z } from "zod/v4";
|
|
4
6
|
export * from "./config/keybindings";
|
|
5
7
|
export * from "./config/model-registry";
|
|
6
8
|
export type * from "./config/prompt-templates";
|
|
@@ -102,32 +102,17 @@ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetai
|
|
|
102
102
|
readonly loadMode = "discoverable";
|
|
103
103
|
readonly summary = "Query LSP (language server) for diagnostics, hover info, and references";
|
|
104
104
|
readonly description: string;
|
|
105
|
-
readonly parameters: import("
|
|
106
|
-
action:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
rename_file: "rename_file";
|
|
117
|
-
request: "request";
|
|
118
|
-
status: "status";
|
|
119
|
-
symbols: "symbols";
|
|
120
|
-
type_definition: "type_definition";
|
|
121
|
-
}>;
|
|
122
|
-
file: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
|
123
|
-
line: import("zod/v4").ZodOptional<import("zod/v4").ZodNumber>;
|
|
124
|
-
symbol: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
|
125
|
-
query: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
|
126
|
-
new_name: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
|
127
|
-
apply: import("zod/v4").ZodOptional<import("zod/v4").ZodBoolean>;
|
|
128
|
-
timeout: import("zod/v4").ZodOptional<import("zod/v4").ZodNumber>;
|
|
129
|
-
payload: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
|
|
130
|
-
}, import("zod/v4/core").$strip>;
|
|
105
|
+
readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
106
|
+
action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
|
|
107
|
+
file?: string | undefined;
|
|
108
|
+
line?: number | undefined;
|
|
109
|
+
symbol?: string | undefined;
|
|
110
|
+
query?: string | undefined;
|
|
111
|
+
new_name?: string | undefined;
|
|
112
|
+
apply?: boolean | undefined;
|
|
113
|
+
timeout?: number | undefined;
|
|
114
|
+
payload?: string | undefined;
|
|
115
|
+
}, {}>;
|
|
131
116
|
readonly strict = true;
|
|
132
117
|
constructor(session: ToolSession);
|
|
133
118
|
static createIf(session: ToolSession): LspTool | null;
|
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
import type { ptree } from "@oh-my-pi/pi-utils";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
rename_file: "rename_file";
|
|
15
|
-
request: "request";
|
|
16
|
-
status: "status";
|
|
17
|
-
symbols: "symbols";
|
|
18
|
-
type_definition: "type_definition";
|
|
19
|
-
}>;
|
|
20
|
-
file: z.ZodOptional<z.ZodString>;
|
|
21
|
-
line: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
symbol: z.ZodOptional<z.ZodString>;
|
|
23
|
-
query: z.ZodOptional<z.ZodString>;
|
|
24
|
-
new_name: z.ZodOptional<z.ZodString>;
|
|
25
|
-
apply: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
payload: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>;
|
|
29
|
-
export type LspParams = z.infer<typeof lspSchema>;
|
|
2
|
+
export declare const lspSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
action: "capabilities" | "code_actions" | "definition" | "diagnostics" | "hover" | "implementation" | "references" | "reload" | "rename" | "rename_file" | "request" | "status" | "symbols" | "type_definition";
|
|
4
|
+
file?: string | undefined;
|
|
5
|
+
line?: number | undefined;
|
|
6
|
+
symbol?: string | undefined;
|
|
7
|
+
query?: string | undefined;
|
|
8
|
+
new_name?: string | undefined;
|
|
9
|
+
apply?: boolean | undefined;
|
|
10
|
+
timeout?: number | undefined;
|
|
11
|
+
payload?: string | undefined;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export type LspParams = typeof lspSchema.infer;
|
|
30
14
|
export interface LspToolDetails {
|
|
31
15
|
serverName?: string;
|
|
32
16
|
action: string;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { AuthStorage } from "./session/auth-storage";
|
|
|
10
10
|
import { type SessionInfo } from "./session/session-listing";
|
|
11
11
|
import { SessionManager } from "./session/session-manager";
|
|
12
12
|
type RunAcpMode = (createSession: AcpSessionFactory) => Promise<never>;
|
|
13
|
+
export declare function writeStartupNotice(parsedArgs: Pick<Args, "mode">, text: string): void;
|
|
13
14
|
export interface InteractiveModeNotify {
|
|
14
15
|
kind: "warn" | "error" | "info";
|
|
15
16
|
message: string;
|
|
@@ -35,6 +35,14 @@ export declare function listResources(connection: MCPServerConnection, options?:
|
|
|
35
35
|
}): Promise<MCPResource[]>;
|
|
36
36
|
/**
|
|
37
37
|
* List resource templates from a connected server.
|
|
38
|
+
*
|
|
39
|
+
* A server MAY advertise the `resources` capability without implementing the
|
|
40
|
+
* optional `resources/templates/list` method (it is optional in the MCP spec).
|
|
41
|
+
* Such servers reject the request with JSON-RPC -32601 ("Method not found").
|
|
42
|
+
* Treat that as "no templates" and return `[]` rather than throwing — otherwise
|
|
43
|
+
* a caller that loads resources and templates together (see `MCPManager`'s
|
|
44
|
+
* `Promise.all([listResources, listResourceTemplates])`) would discard the
|
|
45
|
+
* server's concrete resources too. Any other error still propagates.
|
|
38
46
|
*/
|
|
39
47
|
export declare function listResourceTemplates(connection: MCPServerConnection, options?: {
|
|
40
48
|
signal?: AbortSignal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor, type KeyId } from "@oh-my-pi/pi-tui";
|
|
2
2
|
import type { AppKeybinding } from "../../config/keybindings";
|
|
3
|
-
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.display.reset" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.clipboard.pasteImage" | "app.clipboard.pasteTextRaw" | "app.clipboard.copyPrompt">;
|
|
3
|
+
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.display.reset" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.retry" | "app.clipboard.pasteImage" | "app.clipboard.pasteTextRaw" | "app.clipboard.copyPrompt">;
|
|
4
4
|
/** Max gap (ms) between two spaces for the later one to count as OS key auto-repeat rather than a
|
|
5
5
|
* deliberate press. OS auto-repeat is fast; a deliberate tap (even a fast one) is slower. */
|
|
6
6
|
export declare const SPACE_REPEAT_MAX_GAP_MS = 120;
|
|
@@ -79,6 +79,8 @@ export declare class CustomEditor extends Editor {
|
|
|
79
79
|
onPasteTextRaw?: () => void;
|
|
80
80
|
/** Called when the configured dequeue shortcut is pressed. */
|
|
81
81
|
onDequeue?: () => void;
|
|
82
|
+
/** Called when the configured retry shortcut is pressed. */
|
|
83
|
+
onRetry?: () => void;
|
|
82
84
|
/** Called when Caps Lock is pressed. */
|
|
83
85
|
onCapsLock?: () => void;
|
|
84
86
|
/** Called when left-arrow is pressed while the editor is empty (cursor necessarily at start). */
|
|
@@ -50,7 +50,7 @@ export declare class StatusLineComponent implements Component {
|
|
|
50
50
|
* for unit tests and the collab host's state broadcast.
|
|
51
51
|
*/
|
|
52
52
|
getCachedContextBreakdown(): {
|
|
53
|
-
usedTokens: number
|
|
53
|
+
usedTokens: number;
|
|
54
54
|
contextWindow: number;
|
|
55
55
|
};
|
|
56
56
|
getTopBorder(width: number): {
|
|
@@ -4,7 +4,6 @@ export declare function getContextUsageLevel(contextPercent: number, contextWind
|
|
|
4
4
|
/**
|
|
5
5
|
* Format context usage as `<percent>%/<window>` (e.g. `5.1%/1M`), matching the
|
|
6
6
|
* status line's context gauge so subagent and footer renderers stay in sync.
|
|
7
|
-
* A `null`/`undefined` percent (unknown, e.g. right after compaction) renders as `?`.
|
|
8
7
|
*/
|
|
9
8
|
export declare function formatContextUsage(contextPercent: number | null | undefined, contextWindow: number): string;
|
|
10
9
|
export declare function getContextUsageThemeColor(level: ContextUsageLevel): ThemeColor;
|
|
@@ -4,6 +4,8 @@ export declare class BtwController {
|
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
constructor(ctx: InteractiveModeContext);
|
|
6
6
|
hasActiveRequest(): boolean;
|
|
7
|
+
canBranch(): boolean;
|
|
8
|
+
handleBranch(): Promise<boolean>;
|
|
7
9
|
handleEscape(): boolean;
|
|
8
10
|
dispose(): void;
|
|
9
11
|
start(question: string): Promise<void>;
|
|
@@ -18,6 +18,7 @@ export declare class InputController {
|
|
|
18
18
|
handleCtrlD(): void;
|
|
19
19
|
handleCtrlZ(): void;
|
|
20
20
|
handleDequeue(): void;
|
|
21
|
+
handleRetry(): Promise<void>;
|
|
21
22
|
/** Send editor text as a follow-up message (queued behind current stream). */
|
|
22
23
|
handleFollowUp(): Promise<void>;
|
|
23
24
|
restoreQueuedMessagesToEditor(options?: {
|
|
@@ -330,6 +330,9 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
330
330
|
handleTanCommand(work: string): Promise<void>;
|
|
331
331
|
hasActiveBtw(): boolean;
|
|
332
332
|
handleBtwEscape(): boolean;
|
|
333
|
+
canBranchBtw(): boolean;
|
|
334
|
+
handleBtwBranchKey(): Promise<boolean>;
|
|
335
|
+
handleBtwBranch(question: string, assistantMessage: AssistantMessage): Promise<void>;
|
|
333
336
|
handleOmfgCommand(complaint: string): Promise<void>;
|
|
334
337
|
hasActiveOmfg(): boolean;
|
|
335
338
|
handleOmfgEscape(): boolean;
|
|
@@ -188,7 +188,7 @@ export interface RpcSessionState {
|
|
|
188
188
|
parameters: unknown;
|
|
189
189
|
examples?: readonly ToolExample[];
|
|
190
190
|
}>;
|
|
191
|
-
/** Current context window usage.
|
|
191
|
+
/** Current context window usage. */
|
|
192
192
|
contextUsage?: ContextUsage;
|
|
193
193
|
}
|
|
194
194
|
export interface RpcAvailableSlashCommand {
|
|
@@ -3,6 +3,7 @@ import { CURRENT_SETUP_VERSION } from "../setup-version";
|
|
|
3
3
|
import type { InteractiveModeContext } from "../types";
|
|
4
4
|
import type { SetupScene } from "./scenes/types";
|
|
5
5
|
export type { SetupScene, SetupSceneController, SetupSceneHost, SetupSceneResult } from "./scenes/types";
|
|
6
|
+
export { runStartupSplash } from "./startup-splash";
|
|
6
7
|
export { CURRENT_SETUP_VERSION };
|
|
7
8
|
export declare const ALL_SCENES: readonly [SetupScene, SetupScene, SetupScene];
|
|
8
9
|
export interface SetupSceneSelectionOptions {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InteractiveModeContext } from "../types";
|
|
2
|
+
export interface RunStartupSplashOptions {
|
|
3
|
+
readonly durationMs?: number;
|
|
4
|
+
readonly tickMs?: number;
|
|
5
|
+
readonly now?: () => number;
|
|
6
|
+
}
|
|
7
|
+
export declare function runStartupSplash(ctx: InteractiveModeContext, options?: RunStartupSplashOptions): Promise<void>;
|
|
@@ -290,7 +290,7 @@ export declare function setColorBlindMode(enabled: boolean): Promise<void>;
|
|
|
290
290
|
* Get the current color blind mode setting.
|
|
291
291
|
*/
|
|
292
292
|
export declare function getColorBlindMode(): boolean;
|
|
293
|
-
export declare function onThemeChange(callback: () => void): void;
|
|
293
|
+
export declare function onThemeChange(callback: () => void): () => void;
|
|
294
294
|
/**
|
|
295
295
|
* Monotonic counter bumped on any theme-affecting change that should invalidate
|
|
296
296
|
* cached renders: theme swaps and reloads (including the invalid-theme dark
|
|
@@ -316,6 +316,9 @@ export interface InteractiveModeContext {
|
|
|
316
316
|
handleTanCommand(work: string): Promise<void>;
|
|
317
317
|
hasActiveBtw(): boolean;
|
|
318
318
|
handleBtwEscape(): boolean;
|
|
319
|
+
handleBtwBranchKey(): Promise<boolean>;
|
|
320
|
+
canBranchBtw(): boolean;
|
|
321
|
+
handleBtwBranch(question: string, assistantMessage: AssistantMessage): Promise<void>;
|
|
319
322
|
handleOmfgCommand(complaint: string): Promise<void>;
|
|
320
323
|
hasActiveOmfg(): boolean;
|
|
321
324
|
handleOmfgEscape(): boolean;
|
|
@@ -37,6 +37,18 @@ export declare function estimateToolSchemaTokens(tools: ReadonlyArray<Pick<Tool,
|
|
|
37
37
|
* messages walked incrementally as new entries append.
|
|
38
38
|
*/
|
|
39
39
|
export declare function computeNonMessageTokens(session: AgentSession): number;
|
|
40
|
+
/**
|
|
41
|
+
* Shared helper for the four non-message token totals used by
|
|
42
|
+
* `computeContextBreakdown` (/context panel). Keep this category split stable:
|
|
43
|
+
* the status-line fast path intentionally uses the equivalent collapsed total
|
|
44
|
+
* in `computeNonMessageTokens`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeNonMessageBreakdown(session: AgentSession): {
|
|
47
|
+
skillsTokens: number;
|
|
48
|
+
toolsTokens: number;
|
|
49
|
+
systemContextTokens: number;
|
|
50
|
+
systemPromptTokens: number;
|
|
51
|
+
};
|
|
40
52
|
/**
|
|
41
53
|
* Compute a breakdown of estimated context usage by category for the active
|
|
42
54
|
* session and model.
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export interface CreateAgentSessionOptions {
|
|
|
55
55
|
providerSessionId?: string;
|
|
56
56
|
/** Optional provider-facing prompt cache key, distinct from request lineage. */
|
|
57
57
|
providerPromptCacheKey?: string;
|
|
58
|
+
/** Absolute wall-clock deadline in Unix epoch milliseconds. */
|
|
59
|
+
deadline?: number;
|
|
58
60
|
/** Custom tools to register (in addition to built-in tools). Accepts both CustomTool and ToolDefinition. */
|
|
59
61
|
customTools?: (CustomTool | ToolDefinition)[];
|
|
60
62
|
/** Inline extensions (merged with discovery). */
|
|
@@ -160,6 +162,11 @@ export interface CreateAgentSessionOptions {
|
|
|
160
162
|
localProtocolOptions?: LocalProtocolOptions;
|
|
161
163
|
/** Settings instance. Default: Settings.init({ cwd, agentDir }) */
|
|
162
164
|
settings?: Settings;
|
|
165
|
+
/**
|
|
166
|
+
* Legacy alias for `settings`. Older Pi extensions pass SettingsManager.create(...)
|
|
167
|
+
* through this field; accept it so their SDK calls keep the configured settings.
|
|
168
|
+
*/
|
|
169
|
+
settingsManager?: Settings | Promise<Settings>;
|
|
163
170
|
/** Whether UI is available (enables interactive tools like ask). Default: false */
|
|
164
171
|
hasUI?: boolean;
|
|
165
172
|
/**
|
|
@@ -193,7 +200,7 @@ export interface CreateAgentSessionResult {
|
|
|
193
200
|
eventBus: EventBus;
|
|
194
201
|
}
|
|
195
202
|
export type DialectFormat = "auto" | "native" | Dialect;
|
|
196
|
-
export declare function resolveDialect(format: DialectFormat, model: Pick<Model, "supportsTools"> | undefined): Dialect | undefined;
|
|
203
|
+
export declare function resolveDialect(format: DialectFormat, model: (Pick<Model, "supportsTools"> & Partial<Pick<Model, "id">>) | undefined): Dialect | undefined;
|
|
197
204
|
export type { PromptTemplate } from "./config/prompt-templates";
|
|
198
205
|
export { Settings, type SkillsSettings } from "./config/settings";
|
|
199
206
|
export type { CustomCommand, CustomCommandFactory } from "./extensibility/custom-commands/types";
|