@oh-my-pi/pi-coding-agent 17.0.9 → 17.1.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 +54 -0
- package/README.md +1 -1
- package/dist/cli.js +4659 -4261
- package/dist/types/async/job-manager.d.ts +37 -1
- package/dist/types/cli/args.d.ts +2 -0
- package/dist/types/cli/bench-cli.d.ts +41 -0
- package/dist/types/commands/bench.d.ts +15 -3
- package/dist/types/commands/launch.d.ts +4 -0
- package/dist/types/config/model-registry.d.ts +3 -1
- package/dist/types/config/models-config-schema.d.ts +18 -6
- package/dist/types/config/models-config.d.ts +14 -5
- package/dist/types/config/provider-globals.d.ts +2 -2
- package/dist/types/config/service-tier.d.ts +5 -1
- package/dist/types/config/settings-schema.d.ts +316 -47
- package/dist/types/config/settings.d.ts +7 -0
- package/dist/types/dap/client.d.ts +20 -0
- package/dist/types/exec/bash-executor.d.ts +38 -0
- package/dist/types/exec/direnv.d.ts +33 -0
- package/dist/types/export/html/args.d.ts +15 -0
- package/dist/types/export/html/index.d.ts +11 -26
- package/dist/types/export/html/web-palette.d.ts +55 -116
- package/dist/types/extensibility/extensions/loader.d.ts +3 -0
- package/dist/types/extensibility/extensions/types.d.ts +17 -2
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +13 -0
- package/dist/types/live/controller.d.ts +40 -0
- package/dist/types/live/protocol.d.ts +85 -0
- package/dist/types/live/protocol.test.d.ts +1 -0
- package/dist/types/live/transport.d.ts +48 -0
- package/dist/types/live/visualizer.d.ts +33 -0
- package/dist/types/lsp/client.d.ts +16 -1
- package/dist/types/mcp/config-writer.test.d.ts +1 -0
- package/dist/types/mcp/oauth-discovery.d.ts +2 -0
- package/dist/types/mcp/smithery-auth.d.ts +1 -1
- package/dist/types/mcp/smithery-auth.test.d.ts +1 -0
- package/dist/types/memory-backend/tool-names.d.ts +2 -0
- package/dist/types/modes/components/login-dialog.d.ts +2 -2
- package/dist/types/modes/components/plan-review-overlay.d.ts +26 -0
- package/dist/types/modes/components/settings-defs.d.ts +7 -1
- package/dist/types/modes/components/status-line/component.jj-cache.test.d.ts +1 -0
- package/dist/types/modes/components/tool-execution.d.ts +9 -1
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/event-controller.d.ts +6 -1
- package/dist/types/modes/controllers/live-command-controller.d.ts +14 -0
- package/dist/types/modes/interactive-mode.d.ts +5 -0
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/modes/types.d.ts +3 -1
- package/dist/types/modes/utils/context-usage.d.ts +12 -2
- package/dist/types/plan-mode/plan-files.d.ts +10 -0
- package/dist/types/registry/agent-lifecycle.d.ts +21 -9
- package/dist/types/registry/agent-registry.d.ts +11 -4
- package/dist/types/sdk.d.ts +15 -1
- package/dist/types/secrets/index.d.ts +15 -2
- package/dist/types/secrets/obfuscator.d.ts +113 -15
- package/dist/types/session/acp-permission-gate.d.ts +19 -0
- package/dist/types/session/agent-session-events.d.ts +84 -0
- package/dist/types/session/agent-session-types.d.ts +314 -0
- package/dist/types/session/agent-session.d.ts +118 -755
- package/dist/types/session/async-job-delivery.d.ts +28 -0
- package/dist/types/session/bash-runner.d.ts +75 -0
- package/dist/types/session/blob-store.d.ts +11 -1
- package/dist/types/session/blob-store.test.d.ts +1 -0
- package/dist/types/session/checkpoint-entries.d.ts +28 -0
- package/dist/types/session/eval-runner.d.ts +49 -0
- package/dist/types/session/irc-bridge.d.ts +46 -0
- package/dist/types/session/messages.d.ts +22 -0
- package/dist/types/session/model-controls.d.ts +180 -0
- package/dist/types/session/prewalk.d.ts +46 -0
- package/dist/types/session/queued-messages.d.ts +22 -0
- package/dist/types/session/redis-session-storage.d.ts +1 -0
- package/dist/types/session/retry-fallback-chains.d.ts +74 -0
- package/dist/types/session/role-models.d.ts +15 -0
- package/dist/types/session/session-advisors.d.ts +228 -0
- package/dist/types/session/session-entries.d.ts +8 -0
- package/dist/types/session/session-handoff.d.ts +70 -0
- package/dist/types/session/session-history-format.d.ts +6 -1
- package/dist/types/session/session-maintenance.d.ts +246 -0
- package/dist/types/session/session-manager.d.ts +41 -0
- package/dist/types/session/session-memory.d.ts +56 -0
- package/dist/types/session/session-provider-boundary.d.ts +62 -0
- package/dist/types/session/session-stats.d.ts +48 -0
- package/dist/types/session/session-tools.d.ts +143 -0
- package/dist/types/session/session-workspace.d.ts +32 -0
- package/dist/types/session/stream-guards.d.ts +44 -0
- package/dist/types/session/todo-tracker.d.ts +56 -0
- package/dist/types/session/ttsr-coordinator.d.ts +51 -0
- package/dist/types/session/turn-recovery.d.ts +225 -0
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +4 -1
- package/dist/types/task/output-manager.d.ts +3 -1
- package/dist/types/tools/approval.d.ts +1 -0
- package/dist/types/tools/browser/launch.d.ts +5 -0
- package/dist/types/tools/image-gen.d.ts +4 -4
- package/dist/types/tools/image-providers.d.ts +38 -0
- package/dist/types/tools/index.d.ts +5 -0
- package/dist/types/tools/path-utils.d.ts +8 -0
- package/dist/types/tools/todo.d.ts +10 -4
- package/dist/types/tools/xdev.d.ts +5 -1
- package/dist/types/tts/streaming-player.d.ts +14 -0
- package/dist/types/tts/vocalizer.d.ts +5 -0
- package/dist/types/utils/jj.d.ts +29 -0
- package/dist/types/utils/lang-from-path.d.ts +1 -0
- package/dist/types/utils/title-generator.d.ts +30 -0
- package/dist/types/vibe/runtime.d.ts +36 -8
- package/dist/types/web/search/index.d.ts +1 -1
- package/dist/types/web/search/provider.d.ts +15 -5
- package/dist/types/web/search/types.d.ts +94 -0
- package/package.json +12 -12
- package/scripts/generate-share-viewer.ts +4 -6
- package/src/advisor/__tests__/advisor.test.ts +643 -0
- package/src/advisor/runtime.ts +144 -43
- package/src/async/job-manager.ts +90 -2
- package/src/cli/args.ts +2 -0
- package/src/cli/auth-gateway-cli.ts +18 -3
- package/src/cli/bench-cli.ts +395 -29
- package/src/cli/flag-tables.ts +3 -0
- package/src/cli/gc-cli.ts +2 -2
- package/src/cli/usage-cli.ts +10 -1
- package/src/collab/host.ts +3 -2
- package/src/commands/bench.ts +18 -4
- package/src/commands/launch.ts +4 -0
- package/src/config/model-registry.ts +10 -2
- package/src/config/models-config-schema.ts +15 -4
- package/src/config/provider-globals.ts +9 -9
- package/src/config/service-tier.ts +26 -1
- package/src/config/settings-schema.ts +209 -51
- package/src/config/settings.ts +81 -2
- package/src/dap/client.ts +37 -4
- package/src/edit/index.ts +49 -12
- package/src/eval/py/executor.ts +103 -33
- package/src/exec/bash-executor.ts +89 -6
- package/src/exec/direnv.ts +145 -0
- package/src/export/html/args.ts +20 -0
- package/src/export/html/index.ts +45 -47
- package/src/export/html/template.css +19 -1
- package/src/export/html/template.html +6 -0
- package/src/export/html/template.js +21 -0
- package/src/export/html/tool-views.generated.js +31 -31
- package/src/export/html/web-palette.ts +116 -132
- package/src/export/share.ts +249 -49
- package/src/extensibility/extensions/loader.ts +29 -1
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +33 -2
- package/src/extensibility/plugins/legacy-pi-compat.ts +19 -1
- package/src/hindsight/state.ts +64 -6
- package/src/internal-urls/local-protocol.ts +2 -1
- package/src/internal-urls/memory-protocol.ts +2 -2
- package/src/internal-urls/skill-protocol.ts +2 -2
- package/src/internal-urls/ssh-protocol.ts +2 -1
- package/src/internal-urls/vault-protocol.ts +2 -1
- package/src/live/audio-worklet.txt +59 -0
- package/src/live/browser-runtime.txt +221 -0
- package/src/live/controller.ts +464 -0
- package/src/live/prompts/agent-final-message.md +3 -0
- package/src/live/prompts/live-instructions.md +23 -0
- package/src/live/protocol.test.ts +140 -0
- package/src/live/protocol.ts +233 -0
- package/src/live/transport.ts +490 -0
- package/src/live/visualizer.ts +234 -0
- package/src/lsp/client.ts +29 -9
- package/src/lsp/index.ts +19 -4
- package/src/main.ts +8 -1
- package/src/mcp/config-writer.test.ts +43 -0
- package/src/mcp/config-writer.ts +109 -82
- package/src/mcp/oauth-discovery.ts +10 -2
- package/src/mcp/smithery-auth.test.ts +29 -0
- package/src/mcp/smithery-auth.ts +3 -2
- package/src/memories/index.ts +40 -20
- package/src/memory-backend/tool-names.ts +2 -0
- package/src/mnemopi/backend.ts +24 -7
- package/src/modes/acp/acp-agent.ts +56 -10
- package/src/modes/acp/acp-event-mapper.ts +8 -1
- package/src/modes/components/agent-hub.ts +1 -1
- package/src/modes/components/login-dialog.ts +14 -4
- package/src/modes/components/plan-review-overlay.ts +350 -35
- package/src/modes/components/settings-defs.ts +23 -1
- package/src/modes/components/settings-selector.ts +169 -1
- package/src/modes/components/status-line/component.jj-cache.test.ts +229 -0
- package/src/modes/components/status-line/component.ts +123 -2
- package/src/modes/components/tool-execution.ts +11 -2
- package/src/modes/controllers/command-controller.ts +56 -15
- package/src/modes/controllers/event-controller.ts +111 -16
- package/src/modes/controllers/extension-ui-controller.test.ts +1 -0
- package/src/modes/controllers/extension-ui-controller.ts +20 -4
- package/src/modes/controllers/live-command-controller.ts +178 -0
- package/src/modes/controllers/mcp-command-controller.ts +10 -1
- package/src/modes/controllers/omfg-controller.ts +44 -40
- package/src/modes/controllers/selector-controller.ts +18 -10
- package/src/modes/controllers/session-focus-controller.ts +6 -1
- package/src/modes/interactive-mode.ts +157 -38
- package/src/modes/runtime-init.ts +2 -0
- package/src/modes/setup-wizard/scenes/web-search.ts +17 -9
- package/src/modes/theme/theme.ts +1 -1
- package/src/modes/types.ts +3 -1
- package/src/modes/utils/context-usage.ts +23 -7
- package/src/modes/utils/ui-helpers.ts +10 -5
- package/src/plan-mode/plan-files.ts +40 -0
- package/src/prompts/bench/cache-prefix-chunk.md +1 -0
- package/src/prompts/bench/cache-prefix.md +3 -0
- package/src/prompts/bench/cache-suffix.md +1 -0
- package/src/prompts/system/custom-system-prompt.md +1 -1
- package/src/prompts/system/project-prompt.md +8 -1
- package/src/prompts/system/subagent-async-pending.md +6 -0
- package/src/prompts/system/system-prompt.md +1 -1
- package/src/prompts/system/workflow-notice.md +48 -40
- package/src/prompts/system/xdev-mount-notice.md +4 -0
- package/src/prompts/tools/todo.md +3 -1
- package/src/registry/agent-lifecycle.ts +116 -46
- package/src/registry/agent-registry.ts +35 -8
- package/src/registry/persisted-agents.ts +26 -2
- package/src/sdk.ts +210 -136
- package/src/secrets/index.ts +127 -4
- package/src/secrets/obfuscator.ts +2328 -105
- package/src/session/acp-permission-gate.ts +165 -0
- package/src/session/agent-session-error-log.test.ts +1 -1
- package/src/session/agent-session-events.ts +66 -0
- package/src/session/agent-session-types.ts +334 -0
- package/src/session/agent-session.ts +1892 -12226
- package/src/session/artifacts.ts +6 -5
- package/src/session/async-job-delivery.ts +74 -0
- package/src/session/bash-runner.ts +326 -0
- package/src/session/blob-store.test.ts +56 -0
- package/src/session/blob-store.ts +18 -2
- package/src/session/checkpoint-entries.ts +81 -0
- package/src/session/eval-runner.ts +212 -0
- package/src/session/indexed-session-storage.ts +9 -2
- package/src/session/irc-bridge.ts +203 -0
- package/src/session/messages.ts +263 -1
- package/src/session/model-controls.ts +714 -0
- package/src/session/prewalk.ts +252 -0
- package/src/session/queued-messages.ts +93 -0
- package/src/session/redis-session-storage.ts +51 -11
- package/src/session/retry-fallback-chains.ts +455 -0
- package/src/session/role-models.ts +85 -0
- package/src/session/session-advisors.ts +1679 -0
- package/src/session/session-context.ts +6 -3
- package/src/session/session-entries.ts +8 -0
- package/src/session/session-handoff.ts +308 -0
- package/src/session/session-history-format.ts +20 -9
- package/src/session/session-loader.ts +0 -46
- package/src/session/session-maintenance.ts +2983 -0
- package/src/session/session-manager.ts +390 -30
- package/src/session/session-memory.ts +222 -0
- package/src/session/session-provider-boundary.ts +307 -0
- package/src/session/session-stats.ts +293 -0
- package/src/session/session-tools.ts +943 -0
- package/src/session/session-workspace.ts +53 -0
- package/src/session/stream-guards.ts +417 -0
- package/src/session/todo-tracker.ts +380 -0
- package/src/session/ttsr-coordinator.ts +496 -0
- package/src/session/turn-recovery.ts +1629 -0
- package/src/slash-commands/builtin-registry.ts +92 -11
- package/src/slash-commands/helpers/usage-report.ts +22 -3
- package/src/system-prompt.ts +41 -17
- package/src/task/executor.ts +285 -70
- package/src/task/index.ts +98 -105
- package/src/task/output-manager.ts +25 -3
- package/src/task/persisted-revive.ts +4 -3
- package/src/task/structured-subagent.ts +1 -0
- package/src/tools/approval.ts +55 -10
- package/src/tools/bash-interactive.ts +26 -0
- package/src/tools/bash-skill-urls.ts +28 -2
- package/src/tools/bash.ts +339 -123
- package/src/tools/browser/launch.ts +9 -1
- package/src/tools/browser/tab-supervisor.ts +8 -5
- package/src/tools/browser.ts +94 -47
- package/src/tools/image-gen.ts +20 -28
- package/src/tools/image-providers.ts +50 -0
- package/src/tools/index.ts +9 -0
- package/src/tools/path-utils.ts +49 -2
- package/src/tools/read.ts +156 -88
- package/src/tools/renderers.ts +7 -1
- package/src/tools/todo.ts +101 -11
- package/src/tools/vibe.ts +1 -2
- package/src/tools/write.ts +51 -1
- package/src/tools/xdev.ts +67 -3
- package/src/tts/streaming-player.ts +62 -4
- package/src/tts/vocalizer.ts +18 -1
- package/src/utils/jj.ts +125 -4
- package/src/utils/lang-from-path.ts +7 -0
- package/src/utils/title-generator.ts +137 -1
- package/src/vibe/runtime.ts +852 -72
- package/src/web/search/index.ts +3 -6
- package/src/web/search/provider.ts +31 -16
- package/src/web/search/providers/xai.ts +7 -1
- package/src/web/search/types.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,8 +15,8 @@ export declare class LoginDialogComponent extends Container {
|
|
|
15
15
|
* is offered as an additional local shortcut so narrow local terminals still
|
|
16
16
|
* have a truncation-safe copy target (viewport clipping on a long authorize
|
|
17
17
|
* URL silently drops trailing OAuth query parameters — e.g.
|
|
18
|
-
* `code_challenge_method=S256`).
|
|
19
|
-
*
|
|
18
|
+
* `code_challenge_method=S256`). Every physical URL row carries its own OSC 8
|
|
19
|
+
* link to the full URL, so clicking any wrapped fragment opens the same target.
|
|
20
20
|
*/
|
|
21
21
|
showAuth(url: string, instructions?: string, launchUrl?: string): void;
|
|
22
22
|
/**
|
|
@@ -18,6 +18,28 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { type Component } from "@oh-my-pi/pi-tui";
|
|
20
20
|
import type { HookSelectorSlider } from "./hook-selector.js";
|
|
21
|
+
/** Serializable annotations retained by the plan-review owner between overlays. */
|
|
22
|
+
export interface PlanReviewAnnotationState {
|
|
23
|
+
annotations: Array<{
|
|
24
|
+
section: {
|
|
25
|
+
index: number;
|
|
26
|
+
title: string;
|
|
27
|
+
/** Heading ancestry from the document root, when emitted by this overlay. */
|
|
28
|
+
path?: string[];
|
|
29
|
+
/** Hash of the section source, used to reject ambiguous moved headings. */
|
|
30
|
+
contentHash?: string;
|
|
31
|
+
};
|
|
32
|
+
target: {
|
|
33
|
+
kind: "section";
|
|
34
|
+
} | {
|
|
35
|
+
kind: "line";
|
|
36
|
+
row: number;
|
|
37
|
+
context: string;
|
|
38
|
+
contextTruncated?: boolean;
|
|
39
|
+
};
|
|
40
|
+
note: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
21
43
|
export interface PlanReviewOverlayCallbacks {
|
|
22
44
|
/** Invoked with the chosen option label (never a disabled one). */
|
|
23
45
|
onPick: (label: string) => void;
|
|
@@ -33,6 +55,8 @@ export interface PlanReviewOverlayCallbacks {
|
|
|
33
55
|
onPlanEdited?: (content: string) => void;
|
|
34
56
|
/** Invoked with the Refine feedback markdown whenever annotations change. */
|
|
35
57
|
onFeedbackChange?: (feedback: string) => void;
|
|
58
|
+
/** Invoked with a serializable annotation snapshot whenever annotations change. */
|
|
59
|
+
onAnnotationStateChange?: (state: PlanReviewAnnotationState) => void;
|
|
36
60
|
}
|
|
37
61
|
export interface PlanReviewOverlayOptions {
|
|
38
62
|
/** Prompt rendered above the options (e.g. "Plan mode - next step"). */
|
|
@@ -48,6 +72,8 @@ export interface PlanReviewOverlayOptions {
|
|
|
48
72
|
slider?: HookSelectorSlider;
|
|
49
73
|
/** Display label for the external-editor key, surfaced in the footer help. */
|
|
50
74
|
externalEditorLabel?: string;
|
|
75
|
+
/** Serializable annotations restored into this overlay instance. */
|
|
76
|
+
annotationState?: PlanReviewAnnotationState;
|
|
51
77
|
}
|
|
52
78
|
export declare class PlanReviewOverlay implements Component {
|
|
53
79
|
#private;
|
|
@@ -45,7 +45,13 @@ export interface TextInputSettingDef extends BaseSettingDef {
|
|
|
45
45
|
export interface ProviderLimitsSettingDef extends BaseSettingDef {
|
|
46
46
|
type: "providerLimits";
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
/** Array-of-enum setting edited as a toggle list; `ordered` lists render positions and support reordering. */
|
|
49
|
+
export interface MultiSelectSettingDef extends BaseSettingDef {
|
|
50
|
+
type: "multiselect";
|
|
51
|
+
options: OptionList;
|
|
52
|
+
ordered: boolean;
|
|
53
|
+
}
|
|
54
|
+
export type SettingDef = BooleanSettingDef | EnumSettingDef | SubmenuSettingDef | TextInputSettingDef | ProviderLimitsSettingDef | MultiSelectSettingDef;
|
|
49
55
|
/** Get all setting definitions with UI */
|
|
50
56
|
export declare function getAllSettingDefs(): SettingDef[];
|
|
51
57
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -92,7 +92,15 @@ export declare class ToolExecutionComponent extends Container implements NativeS
|
|
|
92
92
|
* immutable native scrollback before the result replaces them.
|
|
93
93
|
*/
|
|
94
94
|
getNativeScrollbackLiveRegionStart(): number | undefined;
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Keeps in-flight TV-wall frames out of immutable native scrollback: the
|
|
97
|
+
* `vibe_wait` wall and displaceable snapshots (`hub` waiting polls, `todo`
|
|
98
|
+
* lists). Their frames replace each other rather than append, and their
|
|
99
|
+
* rows mutate every spinner tick — an unpinned commit records a per-tick
|
|
100
|
+
* frozen snapshot AND force-seals the block (see TranscriptContainer's
|
|
101
|
+
* committed-snapshot seal), so the next poll stacks a new frame instead of
|
|
102
|
+
* displacing this one.
|
|
103
|
+
*/
|
|
96
104
|
isNativeScrollbackLiveRegionPinned(): boolean;
|
|
97
105
|
/**
|
|
98
106
|
* Whether this block has reached a terminal state for transcript freezing.
|
|
@@ -60,4 +60,4 @@ export declare function renderProviderSection(details: ProviderDetails, uiTheme:
|
|
|
60
60
|
* Example output: `Quota: 7d window · 67% used · resets in 3.2d`
|
|
61
61
|
*/
|
|
62
62
|
export declare function formatCompactQuota(provider: string, reports: UsageReport[], nowMs: number, activeAccount?: OAuthAccountIdentity): string | null;
|
|
63
|
-
export declare function renderUsageReports(reports: UsageReport[], uiTheme: typeof theme, nowMs: number, availableWidth: number, resolveActiveAccount?: (provider: string) => OAuthAccountIdentity | undefined): string;
|
|
63
|
+
export declare function renderUsageReports(reports: UsageReport[], uiTheme: typeof theme, nowMs: number, availableWidth: number, resolveActiveAccount?: (provider: string) => OAuthAccountIdentity | undefined, usageModelSelectors?: readonly string[]): string;
|
|
@@ -24,5 +24,10 @@ export declare class EventController {
|
|
|
24
24
|
* Drops the candidate when it is no longer a displaceable todo.
|
|
25
25
|
*/
|
|
26
26
|
inheritDisplaceableTodo(component: ToolExecutionComponent | null | undefined): void;
|
|
27
|
-
|
|
27
|
+
sendErrorNotification(event: Extract<AgentSessionEvent, {
|
|
28
|
+
type: "agent_end";
|
|
29
|
+
}>): void;
|
|
30
|
+
sendCompletionNotification(event: Extract<AgentSessionEvent, {
|
|
31
|
+
type: "agent_end";
|
|
32
|
+
}>): void;
|
|
28
33
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InteractiveModeContext } from "../types.js";
|
|
2
|
+
/** Owns the editor-replacing visualizer and realtime session lifecycle for `/live`. */
|
|
3
|
+
export declare class LiveCommandController {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(ctx: InteractiveModeContext);
|
|
6
|
+
/** Whether a live session is connected, connecting, or closing. */
|
|
7
|
+
get active(): boolean;
|
|
8
|
+
/** Start live mode, or stop the currently active session. */
|
|
9
|
+
handleCommand(): Promise<void>;
|
|
10
|
+
/** Stop the active live session and restore the editor. */
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
/** Release UI resources during synchronous InteractiveMode teardown. */
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
@@ -27,6 +27,7 @@ import type { EvalExecutionComponent } from "./components/eval-execution.js";
|
|
|
27
27
|
import type { HookEditorComponent } from "./components/hook-editor.js";
|
|
28
28
|
import type { HookInputComponent } from "./components/hook-input.js";
|
|
29
29
|
import type { HookSelectorComponent, HookSelectorSlider } from "./components/hook-selector.js";
|
|
30
|
+
import { type PlanReviewAnnotationState } from "./components/plan-review-overlay.js";
|
|
30
31
|
import { StatusLineComponent } from "./components/status-line/index.js";
|
|
31
32
|
import type { ToolExecutionHandle } from "./components/tool-execution.js";
|
|
32
33
|
import { TranscriptContainer } from "./components/transcript-container.js";
|
|
@@ -247,6 +248,8 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
247
248
|
onExternalEditor?: () => void;
|
|
248
249
|
onPlanEdited?: (content: string) => void;
|
|
249
250
|
onFeedbackChange?: (feedback: string) => void;
|
|
251
|
+
annotationState?: PlanReviewAnnotationState;
|
|
252
|
+
onAnnotationStateChange?: (state: PlanReviewAnnotationState) => void;
|
|
250
253
|
initialIndex?: number;
|
|
251
254
|
}, extra?: {
|
|
252
255
|
slider?: HookSelectorSlider;
|
|
@@ -340,6 +343,8 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
340
343
|
handleRenameCommand(title: string): Promise<void>;
|
|
341
344
|
handleMemoryCommand(text: string): Promise<void>;
|
|
342
345
|
handleSTTToggle(): Promise<void>;
|
|
346
|
+
/** Start or stop the Codex-backed realtime voice surface. */
|
|
347
|
+
handleLiveCommand(): Promise<void>;
|
|
343
348
|
showDebugSelector(): Promise<void>;
|
|
344
349
|
showAgentHub(options?: {
|
|
345
350
|
requireContent?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { Effort } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { EditorTheme, MarkdownTheme, SelectListTheme, SettingsListTheme, SymbolTheme } from "@oh-my-pi/pi-tui";
|
|
4
|
-
export { getLanguageFromPath } from "../../utils/lang-from-path.js";
|
|
4
|
+
export { getLanguageFromPath, isMarkdownPath } from "../../utils/lang-from-path.js";
|
|
5
5
|
export type SymbolPreset = "unicode" | "nerd" | "ascii";
|
|
6
6
|
/**
|
|
7
7
|
* All available symbol keys organized by category.
|
|
@@ -61,7 +61,7 @@ export type SubmittedUserInput = {
|
|
|
61
61
|
cancelled: boolean;
|
|
62
62
|
started: boolean;
|
|
63
63
|
};
|
|
64
|
-
export type TodoStatus = "pending" | "in_progress" | "completed" | "abandoned";
|
|
64
|
+
export type TodoStatus = "pending" | "in_progress" | "completed" | "abandoned" | "blocked";
|
|
65
65
|
export type TodoItem = {
|
|
66
66
|
content: string;
|
|
67
67
|
status: TodoStatus;
|
|
@@ -334,6 +334,8 @@ export interface InteractiveModeContext {
|
|
|
334
334
|
handleRenameCommand(title: string): Promise<void>;
|
|
335
335
|
handleMemoryCommand(text: string): Promise<void>;
|
|
336
336
|
handleSTTToggle(): Promise<void>;
|
|
337
|
+
/** Start or stop the Codex-backed realtime voice session. */
|
|
338
|
+
handleLiveCommand(): Promise<void>;
|
|
337
339
|
executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean): Promise<CompactionOutcome>;
|
|
338
340
|
openInBrowser(urlOrPath: string): void;
|
|
339
341
|
refreshSlashCommandState(cwd?: string): Promise<void>;
|
|
@@ -22,16 +22,26 @@ export interface ContextBreakdown {
|
|
|
22
22
|
/** Estimated snapcompact wire savings; set when requested and a snapcompact.* setting is enabled. */
|
|
23
23
|
snapcompact?: SnapcompactSavingsEstimate;
|
|
24
24
|
}
|
|
25
|
+
/** Stable inputs used to cache non-message token estimates. */
|
|
26
|
+
export interface NonMessageTokenSource {
|
|
27
|
+
readonly systemPrompt?: string[];
|
|
28
|
+
readonly agent?: {
|
|
29
|
+
readonly state?: {
|
|
30
|
+
readonly tools?: ReadonlyArray<Pick<Tool, "name" | "description" | "parameters">>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly skills?: readonly Skill[];
|
|
34
|
+
}
|
|
25
35
|
export declare function estimateSkillsTokens(skills: readonly Skill[]): number;
|
|
26
36
|
export declare function estimateToolSchemaTokens(tools: ReadonlyArray<Pick<Tool, "name" | "description" | "parameters">>): number;
|
|
27
|
-
export declare function computeNonMessageTokens(session:
|
|
37
|
+
export declare function computeNonMessageTokens(session: NonMessageTokenSource): number;
|
|
28
38
|
/**
|
|
29
39
|
* Shared helper for the four non-message token totals used by
|
|
30
40
|
* `computeContextBreakdown` (/context panel). Keep this category split stable:
|
|
31
41
|
* the status-line fast path intentionally uses the equivalent collapsed total
|
|
32
42
|
* in `computeNonMessageTokens`.
|
|
33
43
|
*/
|
|
34
|
-
export declare function computeNonMessageBreakdown(session:
|
|
44
|
+
export declare function computeNonMessageBreakdown(session: NonMessageTokenSource): {
|
|
35
45
|
skillsTokens: number;
|
|
36
46
|
toolsTokens: number;
|
|
37
47
|
systemContextTokens: number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type LocalProtocolOptions } from "../internal-urls/index.js";
|
|
2
|
+
/** Reads a plan from a local URL or cwd-relative filesystem path. */
|
|
3
|
+
export declare function readPlanFile(planFilePath: string, options: {
|
|
4
|
+
localProtocolOptions: LocalProtocolOptions;
|
|
5
|
+
cwd: string;
|
|
6
|
+
}): Promise<string | null>;
|
|
7
|
+
/** Lists session-local plan files from newest to oldest. */
|
|
8
|
+
export declare function listPlanFiles(options: {
|
|
9
|
+
localProtocolOptions: LocalProtocolOptions;
|
|
10
|
+
}): Promise<string[]>;
|
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
* - ensureLive during an in-flight park either cancels the park (session still
|
|
15
15
|
* live) or waits for detach+park and then revives.
|
|
16
16
|
* - Concurrent ensureLive/park operations coalesce per id.
|
|
17
|
+
*
|
|
18
|
+
* Every adoption, park, and revival is bound to the exact {@link AgentRef} it
|
|
19
|
+
* started from, so stale async work (a late finalizer, a cancelled initializer,
|
|
20
|
+
* a superseded revive) can never clobber a newer same-id ref.
|
|
17
21
|
*/
|
|
18
22
|
import type { AgentSession } from "../session/agent-session.js";
|
|
19
|
-
import { type AgentRef, AgentRegistry } from "./agent-registry.js";
|
|
20
|
-
export type AgentReviver = () => Promise<AgentSession>;
|
|
23
|
+
import { type AgentRef, type AgentRefExpectation, AgentRegistry } from "./agent-registry.js";
|
|
24
|
+
export type AgentReviver = (expected: AgentRef) => Promise<AgentSession>;
|
|
21
25
|
/**
|
|
22
26
|
* Builds a reviver for a `parked` ref restored from disk (Agent Hub scan,
|
|
23
27
|
* collab mirror, resumed process) that carries a sessionFile but no in-memory
|
|
@@ -48,10 +52,12 @@ export declare class AgentLifecycleManager {
|
|
|
48
52
|
/**
|
|
49
53
|
* Take ownership of a finished subagent. Caller has already set registry
|
|
50
54
|
* status to "idle". Arms the TTL timer (idleTtlMs <= 0 adopts without one).
|
|
55
|
+
* When `expected` is given, the adoption is refused if the id no longer
|
|
56
|
+
* resolves to that ref (or that ref's session).
|
|
51
57
|
*/
|
|
52
|
-
adopt(id: string, opts: AdoptOptions): void;
|
|
53
|
-
/** True if the id is adopted (parked or live). */
|
|
54
|
-
has(id: string): boolean;
|
|
58
|
+
adopt(id: string, opts: AdoptOptions, expected?: AgentRefExpectation): void;
|
|
59
|
+
/** True if the id is adopted (parked or live) — and, when `expected` is given, still bound to that ref. */
|
|
60
|
+
has(id: string, expected?: AgentRefExpectation): boolean;
|
|
55
61
|
/**
|
|
56
62
|
* True when this manager owns `registry` — i.e. its adopt/park/revive state
|
|
57
63
|
* describes that registry's refs. Lets a caller holding a specific registry
|
|
@@ -62,9 +68,10 @@ export declare class AgentLifecycleManager {
|
|
|
62
68
|
/**
|
|
63
69
|
* True while {@link park} is disposing this agent's session (lets dispose
|
|
64
70
|
* hooks distinguish park from teardown). False once the park is cancelled
|
|
65
|
-
* by ensureLive or after detach+dispose completes.
|
|
71
|
+
* by ensureLive or after detach+dispose completes. When `expected` is
|
|
72
|
+
* given, only a park bound to that ref (or its session) counts.
|
|
66
73
|
*/
|
|
67
|
-
isParking(id: string): boolean;
|
|
74
|
+
isParking(id: string, expected?: AgentRefExpectation): boolean;
|
|
68
75
|
/**
|
|
69
76
|
* Dispose the live session, detach it from the registry, and mark the
|
|
70
77
|
* agent `parked`. No-op unless the id is adopted and live.
|
|
@@ -84,8 +91,13 @@ export declare class AgentLifecycleManager {
|
|
|
84
91
|
* cancelled (session still live) or awaited to completion before revive.
|
|
85
92
|
*/
|
|
86
93
|
ensureLive(id: string): Promise<AgentSession>;
|
|
87
|
-
/**
|
|
88
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Hard removal: dispose if live, unregister from registry, drop timers.
|
|
96
|
+
* When `expected` is given, only a ref matching it is released; a stale
|
|
97
|
+
* release can never take down a newer same-id ref. Returns true when a
|
|
98
|
+
* matching ref was released.
|
|
99
|
+
*/
|
|
100
|
+
release(id: string, expected?: AgentRefExpectation): Promise<boolean>;
|
|
89
101
|
/** Teardown everything (process exit / main session dispose). */
|
|
90
102
|
dispose(): Promise<void>;
|
|
91
103
|
}
|
|
@@ -39,6 +39,7 @@ export interface AgentRef {
|
|
|
39
39
|
/** Short gist of what the agent is currently doing (latest intent or tool), for the work-aware roster. Display-only. */
|
|
40
40
|
activity?: string;
|
|
41
41
|
}
|
|
42
|
+
export type AgentRefExpectation = AgentRef | AgentSession;
|
|
42
43
|
export type RegistryEvent = {
|
|
43
44
|
type: "registered";
|
|
44
45
|
ref: AgentRef;
|
|
@@ -65,7 +66,13 @@ export declare class AgentRegistry {
|
|
|
65
66
|
/** Reset the global registry. Test-only. */
|
|
66
67
|
static resetGlobalForTests(): void;
|
|
67
68
|
register(input: RegisterInput): AgentRef;
|
|
68
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Register a new id only when it is absent, or reuse the exact ref a parked
|
|
71
|
+
* revival was authorized to revive. A missing expected ref is a failed CAS:
|
|
72
|
+
* callers must never claim an id after its prior generation disappeared.
|
|
73
|
+
*/
|
|
74
|
+
registerIfAvailable(input: RegisterInput, expected: AgentRef | null): AgentRef | undefined;
|
|
75
|
+
setStatus(id: string, status: AgentStatus, expected?: AgentRefExpectation): boolean;
|
|
69
76
|
/**
|
|
70
77
|
* Record a short activity gist for the work-aware roster. Display-only and
|
|
71
78
|
* read on demand (`irc list`, peer roster), so it emits no event — keeping
|
|
@@ -81,9 +88,9 @@ export declare class AgentRegistry {
|
|
|
81
88
|
* every caller is safe without sanitizing at its own call site.
|
|
82
89
|
*/
|
|
83
90
|
setActivity(id: string, activity: string): void;
|
|
84
|
-
attachSession(id: string, session: AgentSession, sessionFile?: string | null):
|
|
85
|
-
detachSession(id: string):
|
|
86
|
-
unregister(id: string):
|
|
91
|
+
attachSession(id: string, session: AgentSession, sessionFile?: string | null, expected?: AgentRefExpectation): boolean;
|
|
92
|
+
detachSession(id: string, expected?: AgentRefExpectation): boolean;
|
|
93
|
+
unregister(id: string, expected?: AgentRefExpectation): boolean;
|
|
87
94
|
get(id: string): AgentRef | undefined;
|
|
88
95
|
list(): AgentRef[];
|
|
89
96
|
/**
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { HindsightSessionState } from "./hindsight/state.js";
|
|
|
16
16
|
import { type LocalProtocolOptions } from "./internal-urls/index.js";
|
|
17
17
|
import { MCPManager, type MCPToolsLoadResult } from "./mcp/index.js";
|
|
18
18
|
import type { MnemopiSessionState } from "./mnemopi/state.js";
|
|
19
|
-
import { AgentRegistry } from "./registry/agent-registry.js";
|
|
19
|
+
import { type AgentRef, AgentRegistry } from "./registry/agent-registry.js";
|
|
20
20
|
import { AgentSession, type PlanYolo, type Prewalk } from "./session/agent-session.js";
|
|
21
21
|
import type { AuthStorage } from "./session/auth-storage.js";
|
|
22
22
|
import { SessionManager } from "./session/session-manager.js";
|
|
@@ -29,6 +29,8 @@ import { type WorkspaceTree } from "./workspace-tree.js";
|
|
|
29
29
|
export interface CreateAgentSessionOptions {
|
|
30
30
|
/** Working directory for project-local discovery. Default: getProjectDir() */
|
|
31
31
|
cwd?: string;
|
|
32
|
+
/** Additional workspace directories beyond cwd (multi-root), absolute or cwd-relative. */
|
|
33
|
+
additionalDirectories?: string[];
|
|
32
34
|
/** Global config directory. Default: ~/.omp/agent */
|
|
33
35
|
agentDir?: string;
|
|
34
36
|
/** Spawns to allow. Default: "*" */
|
|
@@ -180,6 +182,13 @@ export interface CreateAgentSessionOptions {
|
|
|
180
182
|
agentDisplayName?: string;
|
|
181
183
|
/** Optional shared agent registry for IRC routing. Default: AgentRegistry.global(). */
|
|
182
184
|
agentRegistry?: AgentRegistry;
|
|
185
|
+
/**
|
|
186
|
+
* Registry generation authorized for this creation. `null` requires the id
|
|
187
|
+
* to be absent; an AgentRef allows a parked revival to reuse only that ref.
|
|
188
|
+
* Undefined preserves legacy unconditional registration for external SDK callers.
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
expectedAgentRef?: AgentRef | null;
|
|
183
192
|
/** Parent task ID prefix for nested artifact naming (e.g., "Extensions") */
|
|
184
193
|
parentTaskPrefix?: string;
|
|
185
194
|
/**
|
|
@@ -205,6 +214,11 @@ export interface CreateAgentSessionOptions {
|
|
|
205
214
|
settingsManager?: Settings | Promise<Settings>;
|
|
206
215
|
/** Whether UI is available (enables interactive tools like ask). Default: false */
|
|
207
216
|
hasUI?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Defer `confirm` reserve-policy fallback until AgentSession prompt-time UI is configured.
|
|
219
|
+
* ACP uses this while capabilities are negotiated without enabling UI-only tools.
|
|
220
|
+
*/
|
|
221
|
+
deferUsageReserveConfirmation?: boolean;
|
|
208
222
|
/**
|
|
209
223
|
* Opt-in OpenTelemetry instrumentation forwarded to the underlying Agent.
|
|
210
224
|
* Passing `{}` enables the loop's GenAI-semantic-convention spans. See
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type SecretEntry } from "./obfuscator.js";
|
|
2
|
+
/**
|
|
3
|
+
* Per-install secret key for the placeholder digest. Persisted under the agent
|
|
4
|
+
* config directory and never sent to a provider, so model-visible placeholders
|
|
5
|
+
* cannot be reversed by dictionary-hashing candidate secrets. Stable across
|
|
6
|
+
* sessions so persisted transcripts deobfuscate consistently. Defaults to
|
|
7
|
+
* `getAgentDir()` — the same directory `createAgentSession()` passes as
|
|
8
|
+
* `agentDir` — so a caller relying on the default reads/writes the identical
|
|
9
|
+
* key file live sessions use, per `~/.omp/agent/secret-placeholder.key` in
|
|
10
|
+
* docs/secrets.md.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSecretPlaceholderKey(keyDir?: string): Promise<string>;
|
|
13
|
+
/** Return an existing placeholder key for redaction without creating a new key file. */
|
|
14
|
+
export declare function getExistingSecretPlaceholderKey(keyDir?: string): Promise<string | undefined>;
|
|
15
|
+
export { deobfuscateSessionContext, deobfuscateToolArguments, obfuscateMessages, obfuscateProviderContext, type SecretEntry, SecretObfuscator, secretEntriesNeedPlaceholderKey, secretEntryNeedsPlaceholderKey, } from "./obfuscator.js";
|
|
3
16
|
/**
|
|
4
17
|
* Load secrets from project-local and global secrets.yml files.
|
|
5
18
|
* Project-local entries override global entries with matching content.
|
|
@@ -7,6 +7,7 @@ export interface SecretEntry {
|
|
|
7
7
|
mode?: "obfuscate" | "replace";
|
|
8
8
|
replacement?: string;
|
|
9
9
|
flags?: string;
|
|
10
|
+
friendlyName?: string;
|
|
10
11
|
}
|
|
11
12
|
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
12
13
|
[key: string]: JsonValue | undefined;
|
|
@@ -14,14 +15,105 @@ export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
|
14
15
|
export type JsonRecord = {
|
|
15
16
|
[key: string]: JsonValue | undefined;
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Whether a default (no custom `replacement`) replace-mode regex can never
|
|
20
|
+
* safely redact a 1-2 char match: `findNonMatchingReplacement`'s bounded
|
|
21
|
+
* search — the same search `#generateRegexReplacement` runs at match time —
|
|
22
|
+
* finds no candidate the regex fails to re-match. This holds independent of
|
|
23
|
+
* any actual per-install key: the search already exhausts every character in
|
|
24
|
+
* `REPLACEMENT_CHARS` (the alphabet `buildKeyedReplacementRun` draws its
|
|
25
|
+
* fallback marker from) plus punctuation and whitespace, so if none of those
|
|
26
|
+
* escape the regex, no key-derived marker drawn from the same alphabet can
|
|
27
|
+
* either — the marker is guaranteed to re-match too, making every such match
|
|
28
|
+
* unresolvable: the fallback could only ever emit the raw matched text
|
|
29
|
+
* unchanged. Probed with a value (`"\0".repeat(length)`) the bounded search
|
|
30
|
+
* never treats as a real candidate, so the result depends only on the
|
|
31
|
+
* regex's own matching behavior, not on this specific probe.
|
|
32
|
+
*/
|
|
33
|
+
export declare function regexHasUnresolvableShortMatchFallback(regex: RegExp): boolean;
|
|
34
|
+
export declare const MIN_OBFUSCATE_SECRET_LEN = 8;
|
|
35
|
+
/** Normalize a friendly name into the model-visible placeholder prefix. */
|
|
36
|
+
export declare function sanitizeSecretFriendlyName(name: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether an entry needs the persisted placeholder key: either because it can
|
|
39
|
+
* produce a reversible (keyed) obfuscate-mode placeholder, or because a default
|
|
40
|
+
* (no custom `replacement`) replace-mode regex can reach
|
|
41
|
+
* `#generateRegexReplacement`'s key-derived idempotent fallback marker (see
|
|
42
|
+
* `#generateReplacement`) when every same-length candidate re-matches a
|
|
43
|
+
* pathological match-everything config (e.g. `[\s\S]{8}`). That fallback depends
|
|
44
|
+
* on the persisted per-install key — not just length — to stay a fixed point
|
|
45
|
+
* across a process restart; without a persisted key, a fresh install falls back
|
|
46
|
+
* to a process-random key (`defaultPlaceholderKey()`), so the fallback marker
|
|
47
|
+
* would churn across restarts even though the algorithm itself is stable. A
|
|
48
|
+
* regex WITH a custom `replacement` never reaches that fallback (it always emits
|
|
49
|
+
* the literal configured string), and a plain replace secret's replacement is
|
|
50
|
+
* pure content-hash (`#generateSecretReplacement`), so neither needs the key.
|
|
51
|
+
* Short plain obfuscate entries are toned down (never placeheld), so they must
|
|
52
|
+
* NOT force key creation: otherwise a `secret-placeholder.key` file is written
|
|
53
|
+
* and persisted for a config that ends up with no active secrets, leaving the
|
|
54
|
+
* key readable via a tool and reusable for later placeholders.
|
|
55
|
+
*/
|
|
56
|
+
export declare function secretEntryNeedsPlaceholderKey(entry: SecretEntry): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether a SET of entries needs the persisted placeholder key. `obfuscate()`
|
|
59
|
+
* applies plain replace-mode mappings before the plain-obfuscate pass, so a plain
|
|
60
|
+
* obfuscate entry only emits a reversible (keyed) placeholder when its content can
|
|
61
|
+
* still appear AFTER the replace phase. When no obfuscate entry can ever produce a
|
|
62
|
+
* placeholder, the persisted key must NOT be required/created — otherwise an
|
|
63
|
+
* effectively replace-only secret set still writes `secret-placeholder.key` and
|
|
64
|
+
* fails startup when the agent config dir is unwritable.
|
|
65
|
+
*
|
|
66
|
+
* The decision models the replace phase as the obfuscator actually runs it:
|
|
67
|
+
* replace mappings are content-keyed (later duplicate wins) and applied in
|
|
68
|
+
* descending content-length order; for a fresh probe (no prior placeholders) that
|
|
69
|
+
* phase is plain sequential substring replacement. A plain obfuscate entry needs
|
|
70
|
+
* the key when its content survives that simulated phase (direct typing) OR when
|
|
71
|
+
* any effective replacement can form the content via tiling — a substring,
|
|
72
|
+
* wholesale superstring, or prefix/suffix border that joins with surrounding
|
|
73
|
+
* passthrough bytes (see `replacementCanFormContent`). This covers direct
|
|
74
|
+
* shadowing (`SECRET -> safe`), reintroduction, duplicate ordering, transitive
|
|
75
|
+
* chains, and context-joined fragments uniformly. Default (omitted) replacements
|
|
76
|
+
* are deterministic, length-preserving, and distinct, so a same-content shadow
|
|
77
|
+
* with no other interacting replacement stays key-free.
|
|
78
|
+
* Replacement outputs are themselves rewritten by every later (shorter-content)
|
|
79
|
+
* replacement before the plain-obfuscate pass sees them, so a fragment that a
|
|
80
|
+
* subsequent replacement erases (`AA -> SEC` then `S -> X` turns every `SEC` into
|
|
81
|
+
* `XEC`) no longer forces the key. Surrounding bytes stay modeled as arbitrary
|
|
82
|
+
* passthrough, so testing the surviving fragment only drops false positives and
|
|
83
|
+
* never under-approximates a real key need.
|
|
84
|
+
*/
|
|
85
|
+
export declare function secretEntriesNeedPlaceholderKey(entries: SecretEntry[]): boolean;
|
|
86
|
+
export declare function stripPendingSecretPlaceholderSuffix(text: string): string;
|
|
17
87
|
export declare class SecretObfuscator {
|
|
18
88
|
#private;
|
|
19
|
-
constructor(entries: SecretEntry[]);
|
|
89
|
+
constructor(entries: SecretEntry[], key?: string);
|
|
20
90
|
hasSecrets(): boolean;
|
|
91
|
+
/** Whether stored-session restoration can resolve keyed or legacy placeholders. */
|
|
92
|
+
hasStoredSecrets(): boolean;
|
|
21
93
|
/** Obfuscate all secrets in text. Bidirectional placeholders for obfuscate mode, one-way for replace. */
|
|
22
|
-
obfuscate(text: string): string;
|
|
23
|
-
/**
|
|
94
|
+
obfuscate(text: string, sharedRegexSecretValues?: ReadonlySet<string>): string;
|
|
95
|
+
/**
|
|
96
|
+
* Deobfuscate keyed placeholders back to original secrets for LIVE paths
|
|
97
|
+
* (provider output, tool-call arguments). Replace-mode is NOT reversed, and
|
|
98
|
+
* legacy index-derived aliases are intentionally ignored so a prompt-injected
|
|
99
|
+
* model cannot synthesize one to recover a secret.
|
|
100
|
+
*/
|
|
24
101
|
deobfuscate(text: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* Deobfuscate stored session content for replay/display. Identical to
|
|
104
|
+
* {@link deobfuscate} but additionally honors legacy index-derived aliases so
|
|
105
|
+
* sessions persisted before keyed placeholders still resume correctly. Use
|
|
106
|
+
* only for trusted on-disk session content, never for live model output.
|
|
107
|
+
*/
|
|
108
|
+
deobfuscateStored(text: string): string;
|
|
109
|
+
/** Deep-walk an object, deobfuscating string values for LIVE paths (keyed placeholders only). */
|
|
110
|
+
deobfuscateObject<T>(obj: T): T;
|
|
111
|
+
/** Deep-walk stored session content, deobfuscating string values incl. legacy aliases. */
|
|
112
|
+
deobfuscateStoredObject<T>(obj: T): T;
|
|
113
|
+
/** Deep-walk an object, obfuscating all string values. */
|
|
114
|
+
obfuscateObject<T>(obj: T): T;
|
|
115
|
+
collectRegexSecretValuesForObfuscation(text: string): Set<string>;
|
|
116
|
+
stripUnsafeFriendlyPlaceholderPrefixes(text: string, sharedRegexSecretValues: ReadonlySet<string>): string;
|
|
25
117
|
}
|
|
26
118
|
/**
|
|
27
119
|
* Restore secret placeholders for local display. Only message kinds the model
|
|
@@ -30,30 +122,36 @@ export declare class SecretObfuscator {
|
|
|
30
122
|
* tool-result messages are persisted with their literal text, so a literal
|
|
31
123
|
* `#ABCD#` the operator typed must survive untouched; those roles are never
|
|
32
124
|
* walked.
|
|
125
|
+
*
|
|
126
|
+
* Legacy index-derived aliases (`#XXXX#`) are unkeyed and trivially guessable,
|
|
127
|
+
* so a prompt-injected model can plant one in any record it influences. Every
|
|
128
|
+
* agent-feeding path (resume, history rewrite, branch switch) therefore restores
|
|
129
|
+
* keyed placeholders ONLY (`allowLegacyAliases` false), leaving legacy tokens
|
|
130
|
+
* inert; display-only transcripts that are never re-obfuscated opt in via
|
|
131
|
+
* `allowLegacyAliases`.
|
|
33
132
|
*/
|
|
34
|
-
export declare function deobfuscateSessionContext(sessionContext: SessionContext, obfuscator: SecretObfuscator | undefined): SessionContext;
|
|
35
|
-
export declare function deobfuscateAgentMessages(obfuscator: SecretObfuscator, messages: AgentMessage[]): AgentMessage[];
|
|
133
|
+
export declare function deobfuscateSessionContext(sessionContext: SessionContext, obfuscator: SecretObfuscator | undefined, allowLegacyAliases?: boolean): SessionContext;
|
|
134
|
+
export declare function deobfuscateAgentMessages(obfuscator: SecretObfuscator, messages: AgentMessage[], allowLegacyAliases?: boolean): AgentMessage[];
|
|
36
135
|
/**
|
|
37
136
|
* Restore placeholders in assistant content: visible text and tool-call
|
|
38
137
|
* arguments/intent/rawBlock. Thinking and signatures are opaque
|
|
39
138
|
* provider-replay/hidden-reasoning data and pass through byte-identical.
|
|
40
139
|
*/
|
|
41
|
-
export declare function deobfuscateAssistantContent(obfuscator: SecretObfuscator, content: AssistantMessage["content"]): AssistantMessage["content"];
|
|
140
|
+
export declare function deobfuscateAssistantContent(obfuscator: SecretObfuscator, content: AssistantMessage["content"], allowLegacyAliases?: boolean): AssistantMessage["content"];
|
|
42
141
|
/**
|
|
43
142
|
* Restore placeholders inside a tool call's arguments. Arguments are arbitrary
|
|
44
143
|
* model-authored JSON, so tool-call arguments are the ONLY place a recursive
|
|
45
144
|
* JSON walk runs.
|
|
46
145
|
*/
|
|
47
|
-
export declare function deobfuscateToolArguments(obfuscator: SecretObfuscator, args: Record<string, unknown
|
|
146
|
+
export declare function deobfuscateToolArguments(obfuscator: SecretObfuscator, args: Record<string, unknown>, allowLegacyAliases?: boolean): Record<string, unknown>;
|
|
48
147
|
/** Redact secrets inside a tool call's arguments (same JSON-walk exception as {@link deobfuscateToolArguments}). */
|
|
49
|
-
export declare function obfuscateToolArguments(obfuscator: SecretObfuscator, args: Record<string, unknown>): Record<string, unknown>;
|
|
50
|
-
/**
|
|
51
|
-
* Redact secrets from outbound messages.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* bytes are never walked.
|
|
148
|
+
export declare function obfuscateToolArguments(obfuscator: SecretObfuscator, args: Record<string, unknown>, sharedRegexSecretValues?: ReadonlySet<string>): Record<string, unknown>;
|
|
149
|
+
/**
|
|
150
|
+
* Redact secrets from outbound messages. User messages, tool results, and
|
|
151
|
+
* user-authored developer messages (e.g. `@file` mentions) are obfuscated.
|
|
152
|
+
* Assistant replay content is re-obfuscated too, because session restoration
|
|
153
|
+
* expands keyed placeholders locally before the next provider request. Inline
|
|
154
|
+
* image bytes are never walked.
|
|
57
155
|
*/
|
|
58
156
|
export declare function obfuscateMessages(obfuscator: SecretObfuscator, messages: Message[]): Message[];
|
|
59
157
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ClientBridgePermissionOption } from "./client-bridge.js";
|
|
2
|
+
/** Tools that require user permission before execution when an ACP client is connected. */
|
|
3
|
+
export declare const PERMISSION_REQUIRED_TOOLS: Record<string, true>;
|
|
4
|
+
/** Permission options presented to the client on each gated tool call. */
|
|
5
|
+
export declare const PERMISSION_OPTIONS: ClientBridgePermissionOption[];
|
|
6
|
+
/** Permission options indexed by their wire identifiers; unknown IDs miss and fail closed. */
|
|
7
|
+
export declare const PERMISSION_OPTIONS_BY_ID: Map<string, ClientBridgePermissionOption>;
|
|
8
|
+
/** Describes the permission prompt required for a destructive tool call. */
|
|
9
|
+
export declare function getPermissionIntent(toolName: string, args: unknown): {
|
|
10
|
+
toolName: string;
|
|
11
|
+
title: string;
|
|
12
|
+
paths?: string[];
|
|
13
|
+
cacheKey: string;
|
|
14
|
+
} | undefined;
|
|
15
|
+
/** Converts tool path arguments into absolute ACP editor locations. */
|
|
16
|
+
export declare function extractPermissionLocations(args: unknown, cwd: string, explicitPaths?: string[]): {
|
|
17
|
+
path: string;
|
|
18
|
+
line?: number;
|
|
19
|
+
}[];
|