@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,33 @@
|
|
|
1
|
+
/** Default cap on a single `direnv` invocation. The first export for a devenv
|
|
2
|
+
* `.envrc` can build a shell; callers may raise this via `bash.direnvLoadTimeoutMs`. */
|
|
3
|
+
export declare const DEFAULT_DIRENV_TIMEOUT_MS = 30000;
|
|
4
|
+
/** Walk up from `startDir` to the nearest directory containing an `.envrc`. */
|
|
5
|
+
export declare function findEnvrc(startDir: string): Promise<string | null>;
|
|
6
|
+
export interface DirenvExportDiff {
|
|
7
|
+
/** Variables direnv sets to a concrete value. */
|
|
8
|
+
set: Record<string, string>;
|
|
9
|
+
/** Variables direnv removes (JSON `null`). */
|
|
10
|
+
unset: string[];
|
|
11
|
+
}
|
|
12
|
+
/** Parse `direnv export json` output (`{VAR: value|null}`) into set/unset halves. */
|
|
13
|
+
export declare function parseDirenvExport(jsonText: string): DirenvExportDiff;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the nearest `.envrc` from `cwd` and return its `direnv export` diff
|
|
16
|
+
* (variables to set, and variables direnv removes). Returns `null` when there
|
|
17
|
+
* is no `.envrc`, `direnv` is not installed, the `.envrc` is not on direnv's
|
|
18
|
+
* allow list, or the export fails/times out.
|
|
19
|
+
*
|
|
20
|
+
* direnv's own allow list is honored — an `.envrc` the user has not
|
|
21
|
+
* `direnv allow`ed is NEVER executed or auto-allowed. This keeps OMP's trust
|
|
22
|
+
* boundary identical to the user's own shell: cloning a repo with a poisoned
|
|
23
|
+
* `.envrc` grants it nothing until the user explicitly allows it.
|
|
24
|
+
*
|
|
25
|
+
* Always re-invokes `direnv export json` rather than serving a cached diff:
|
|
26
|
+
* direnv is fast once warm, and its own watch/mtime invalidation is the
|
|
27
|
+
* authoritative freshness signal (a content-hash cache here would go stale when
|
|
28
|
+
* a `watch_file` target changes without the `.envrc` text changing).
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadDirenvEnv(cwd: string, opts?: {
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}): Promise<DirenvExportDiff | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/export` argument parsing, split from `./index.ts` so slash-command
|
|
3
|
+
* registries can parse arguments without eagerly loading the export module's
|
|
4
|
+
* embedded template/tool-view text.
|
|
5
|
+
*/
|
|
6
|
+
/** Dark and light TUI theme names bundled into a dual-theme export. */
|
|
7
|
+
export interface ExportThemeNames {
|
|
8
|
+
dark: string;
|
|
9
|
+
light: string;
|
|
10
|
+
}
|
|
11
|
+
/** Parse `/export [--themes] [path]`; paths containing spaces were never supported. */
|
|
12
|
+
export declare function parseExportArgs(args: string): {
|
|
13
|
+
outputPath?: string;
|
|
14
|
+
useUserThemes: boolean;
|
|
15
|
+
};
|
|
@@ -1,45 +1,30 @@
|
|
|
1
1
|
import type { AgentState } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { SessionEntry, SessionHeader } from "../../session/session-entries.js";
|
|
3
3
|
import { SessionManager } from "../../session/session-manager.js";
|
|
4
|
+
import type { ExportThemeNames } from "./args.js";
|
|
5
|
+
export { type ExportThemeNames, parseExportArgs } from "./args.js";
|
|
4
6
|
/** Compose the standalone export template: minified CSS, tool renderers, and viewer JS inlined. */
|
|
5
7
|
export declare function getTemplate(): string;
|
|
6
8
|
export interface ExportOptions {
|
|
7
9
|
outputPath?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Which color palette the export ships with.
|
|
10
|
-
* - `"web"` (default) — the omp brand identity (collab-web pink/purple),
|
|
11
|
-
* so public HTML exports and the `/s/<id>` share viewer match the live
|
|
12
|
-
* `my.omp.sh` client. See `web-palette.ts`.
|
|
13
|
-
* - `"theme"` — derive from `themeName` (or the active TUI theme), preserving
|
|
14
|
-
* the pre-15.12 behavior where an export mirrored the user's terminal.
|
|
15
|
-
*/
|
|
10
|
+
/** `"web"` bundles the omp web themes; `"theme"` bundles TUI themes. */
|
|
16
11
|
palette?: "web" | "theme";
|
|
17
|
-
/**
|
|
18
|
-
* TUI theme to derive colors from when `palette: "theme"`. Ignored for the
|
|
19
|
-
* default `"web"` palette. Resolves to the active TUI theme when omitted.
|
|
20
|
-
*/
|
|
12
|
+
/** Legacy single TUI theme name. Prefer `themeNames` for dual-theme exports. */
|
|
21
13
|
themeName?: string;
|
|
14
|
+
/** Dark and light TUI themes to bundle when `palette` is `"theme"`. */
|
|
15
|
+
themeNames?: ExportThemeNames;
|
|
22
16
|
/** Embed subagent session transcripts found next to the session file (default true). */
|
|
23
17
|
includeSubSessions?: boolean;
|
|
24
18
|
}
|
|
25
19
|
/**
|
|
26
|
-
* Generate CSS custom properties for
|
|
20
|
+
* Generate CSS custom properties for one export theme.
|
|
27
21
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `"web"` (the default for public artifacts) returns the fixed omp brand
|
|
31
|
-
* palette from `web-palette.ts` — collab-web pink/purple identity, shared
|
|
32
|
-
* with the live `my.omp.sh` client, so exports and the share viewer render
|
|
33
|
-
* identically to it. `"theme"` derives from the TUI theme via
|
|
34
|
-
* `getResolvedThemeColors(themeName)` plus the three
|
|
35
|
-
* `export.{pageBg,cardBg,infoBg}` surface overrides.
|
|
36
|
-
* • `generateThemeVars(themeName)` — legacy single-arg form: derive from the
|
|
37
|
-
* named TUI theme. Kept so existing callers (and the theme-islight test)
|
|
38
|
-
* keep working; equivalent to `generateThemeVars("theme", themeName)`.
|
|
39
|
-
*
|
|
40
|
-
* Exported for the share-viewer build script.
|
|
22
|
+
* The single-argument theme-name form remains available to callers that need
|
|
23
|
+
* one TUI palette. Standalone HTML uses `generateThemeStyles()` below.
|
|
41
24
|
*/
|
|
42
25
|
export declare function generateThemeVars(palette?: "web" | "theme" | (string & {}), themeName?: string): Promise<string>;
|
|
26
|
+
/** Generate dark, light, and auto-following CSS rules for a standalone viewer. */
|
|
27
|
+
export declare function generateThemeStyles(palette: "web" | "theme", themeNames?: ExportThemeNames, legacyThemeName?: string): Promise<string>;
|
|
43
28
|
/** Embedded subagent session transcript, keyed by slash-joined agent path in `SessionData.subSessions`. */
|
|
44
29
|
export interface SubSession {
|
|
45
30
|
/** Bare agent id (session file stem), e.g. "ToolAsk". */
|
|
@@ -1,117 +1,56 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
readonly "--border": "oklch(1 0 0 / 9%)";
|
|
55
|
-
readonly "--borderMuted": "oklch(1 0 0 / 6%)";
|
|
56
|
-
readonly "--borderAccent": "#945ff9";
|
|
57
|
-
readonly "--selectedBg": "#2d2535";
|
|
58
|
-
readonly "--success": "#68ca80";
|
|
59
|
-
readonly "--error": "#f05653";
|
|
60
|
-
readonly "--warning": "#e4b33f";
|
|
61
|
-
readonly "--userMessageBg": "oklch(0.674 0.23 341 / 6%)";
|
|
62
|
-
readonly "--userMessageText": "#e6e3ea";
|
|
63
|
-
readonly "--customMessageBg": "#211b28";
|
|
64
|
-
readonly "--customMessageText": "#a49faa";
|
|
65
|
-
readonly "--customMessageLabel": "#b281d6";
|
|
66
|
-
readonly "--toolPendingBg": "#16111c";
|
|
67
|
-
readonly "--toolSuccessBg": "#09060c";
|
|
68
|
-
readonly "--toolErrorBg": "oklch(0.66 0.19 25 / 14%)";
|
|
69
|
-
readonly "--toolTitle": "#e6e3ea";
|
|
70
|
-
readonly "--toolOutput": "#a49faa";
|
|
71
|
-
readonly "--mdHeading": "#ed4abf";
|
|
72
|
-
readonly "--mdLink": "#5ad8e5";
|
|
73
|
-
readonly "--mdLinkUrl": "#6e6974";
|
|
74
|
-
readonly "--mdCode": "#e6e3ea";
|
|
75
|
-
readonly "--mdCodeBlock": "#e6e3ea";
|
|
76
|
-
readonly "--mdCodeBlockBorder": "oklch(1 0 0 / 9%)";
|
|
77
|
-
readonly "--mdQuote": "#a49faa";
|
|
78
|
-
readonly "--mdQuoteBorder": "oklch(1 0 0 / 13%)";
|
|
79
|
-
readonly "--mdHr": "oklch(1 0 0 / 9%)";
|
|
80
|
-
readonly "--mdListBullet": "#ed4abf";
|
|
81
|
-
readonly "--toolDiffAdded": "#68ca80";
|
|
82
|
-
readonly "--toolDiffRemoved": "#f05653";
|
|
83
|
-
readonly "--toolDiffContext": "#6e6974";
|
|
84
|
-
readonly "--syntaxComment": "#6e6974";
|
|
85
|
-
readonly "--syntaxKeyword": "#945ff9";
|
|
86
|
-
readonly "--syntaxFunction": "#e4b33f";
|
|
87
|
-
readonly "--syntaxVariable": "#5ad8e5";
|
|
88
|
-
readonly "--syntaxString": "#68ca80";
|
|
89
|
-
readonly "--syntaxNumber": "#ed4abf";
|
|
90
|
-
readonly "--syntaxType": "#b281d6";
|
|
91
|
-
readonly "--syntaxOperator": "#e6e3ea";
|
|
92
|
-
readonly "--syntaxPunctuation": "#a49faa";
|
|
93
|
-
readonly "--thinkingOff": "#6e6974";
|
|
94
|
-
readonly "--thinkingMinimal": "#6e6974";
|
|
95
|
-
readonly "--thinkingLow": "#945ff9";
|
|
96
|
-
readonly "--thinkingMedium": "#b281d6";
|
|
97
|
-
readonly "--thinkingHigh": "#ed4abf";
|
|
98
|
-
readonly "--thinkingXhigh": "#e4b33f";
|
|
99
|
-
readonly "--bashMode": "#5ad8e5";
|
|
100
|
-
readonly "--pythonMode": "#e4b33f";
|
|
101
|
-
readonly "--statusLineBg": "#0f0b14";
|
|
102
|
-
readonly "--statusLineSep": "#6e6974";
|
|
103
|
-
readonly "--statusLineModel": "#ed4abf";
|
|
104
|
-
readonly "--statusLinePath": "#5ad8e5";
|
|
105
|
-
readonly "--statusLineGitClean": "#68ca80";
|
|
106
|
-
readonly "--statusLineGitDirty": "#e4b33f";
|
|
107
|
-
readonly "--statusLineContext": "#a49faa";
|
|
108
|
-
readonly "--statusLineSpend": "#5ad8e5";
|
|
109
|
-
readonly "--statusLineStaged": "#68ca80";
|
|
110
|
-
readonly "--statusLineDirty": "#e4b33f";
|
|
111
|
-
readonly "--statusLineUntracked": "#945ff9";
|
|
112
|
-
readonly "--statusLineOutput": "#b281d6";
|
|
113
|
-
readonly "--statusLineCost": "#b281d6";
|
|
114
|
-
readonly "--statusLineSubagents": "#ed4abf";
|
|
1
|
+
/** omp web palette bundled into standalone exports and the share viewer. */
|
|
2
|
+
export type WebExportScheme = "dark" | "light";
|
|
3
|
+
export declare const WEB_EXPORT_PALETTES: {
|
|
4
|
+
readonly dark: {
|
|
5
|
+
readonly "--bg": "#0f0b14";
|
|
6
|
+
readonly "--bg-raised": "#16111c";
|
|
7
|
+
readonly "--bg-inset": "#09060c";
|
|
8
|
+
readonly "--bg-overlay": "#211b28";
|
|
9
|
+
readonly "--fg": "#e6e3ea";
|
|
10
|
+
readonly "--fg-muted": "#a49faa";
|
|
11
|
+
readonly "--fg-faint": "#6e6974";
|
|
12
|
+
readonly "--accent": "#ed4abf";
|
|
13
|
+
readonly "--accent-muted": "oklch(0.674 0.23 341 / 18%)";
|
|
14
|
+
readonly "--ok": "#68ca80";
|
|
15
|
+
readonly "--err": "#f05653";
|
|
16
|
+
readonly "--warn": "#e4b33f";
|
|
17
|
+
readonly "--border": "oklch(1 0 0 / 9%)";
|
|
18
|
+
readonly "--border-strong": "oklch(1 0 0 / 13%)";
|
|
19
|
+
readonly "--ring": "oklch(0.817 0.112 205 / 70%)";
|
|
20
|
+
readonly "--link": "#5ad8e5";
|
|
21
|
+
readonly "--syntaxComment": "#6e6974";
|
|
22
|
+
readonly "--syntaxKeyword": "#945ff9";
|
|
23
|
+
readonly "--syntaxFunction": "#e4b33f";
|
|
24
|
+
readonly "--syntaxVariable": "#5ad8e5";
|
|
25
|
+
readonly "--syntaxString": "#68ca80";
|
|
26
|
+
readonly "--syntaxNumber": "#ed4abf";
|
|
27
|
+
readonly "--syntaxType": "#b281d6";
|
|
28
|
+
};
|
|
29
|
+
readonly light: {
|
|
30
|
+
readonly "--bg": "oklch(0.985 0.004 307)";
|
|
31
|
+
readonly "--bg-raised": "oklch(1 0 0)";
|
|
32
|
+
readonly "--bg-inset": "oklch(0.95 0.006 307)";
|
|
33
|
+
readonly "--bg-overlay": "oklch(0.965 0.006 307)";
|
|
34
|
+
readonly "--fg": "oklch(0.26 0.03 307)";
|
|
35
|
+
readonly "--fg-muted": "oklch(0.46 0.03 307)";
|
|
36
|
+
readonly "--fg-faint": "oklch(0.58 0.025 307)";
|
|
37
|
+
readonly "--accent": "oklch(0.62 0.23 341)";
|
|
38
|
+
readonly "--accent-muted": "oklch(0.62 0.23 341 / 14%)";
|
|
39
|
+
readonly "--ok": "oklch(0.55 0.13 150)";
|
|
40
|
+
readonly "--err": "oklch(0.55 0.19 25)";
|
|
41
|
+
readonly "--warn": "oklch(0.6 0.13 85)";
|
|
42
|
+
readonly "--border": "oklch(0 0 0 / 10%)";
|
|
43
|
+
readonly "--border-strong": "oklch(0 0 0 / 15%)";
|
|
44
|
+
readonly "--ring": "oklch(0.58 0.13 230 / 70%)";
|
|
45
|
+
readonly "--link": "#0f7a88";
|
|
46
|
+
readonly "--syntaxComment": "#77717c";
|
|
47
|
+
readonly "--syntaxKeyword": "#6d35c7";
|
|
48
|
+
readonly "--syntaxFunction": "#8a6000";
|
|
49
|
+
readonly "--syntaxVariable": "#087f8c";
|
|
50
|
+
readonly "--syntaxString": "#247a3d";
|
|
51
|
+
readonly "--syntaxNumber": "#b51f88";
|
|
52
|
+
readonly "--syntaxType": "#7b3fa2";
|
|
53
|
+
};
|
|
115
54
|
};
|
|
116
|
-
/** Serialize
|
|
117
|
-
export declare function webExportThemeVars(): string;
|
|
55
|
+
/** Serialize one web color scheme as CSS custom-property declarations. */
|
|
56
|
+
export declare function webExportThemeVars(scheme: WebExportScheme): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
import type { ServiceTierByFamily } from "@oh-my-pi/pi-ai";
|
|
2
3
|
import { EventBus } from "../../utils/event-bus.js";
|
|
3
4
|
import type { Extension, ExtensionFactory, ExtensionRuntime as IExtensionRuntime, LoadExtensionsResult, ProviderConfig } from "./types.js";
|
|
4
5
|
export declare class ExtensionRuntimeNotInitializedError extends Error {
|
|
@@ -26,6 +27,8 @@ export declare class ExtensionRuntime implements IExtensionRuntime {
|
|
|
26
27
|
setModel(): Promise<boolean>;
|
|
27
28
|
getThinkingLevel(): ThinkingLevel;
|
|
28
29
|
setThinkingLevel(): void;
|
|
30
|
+
getServiceTiers(): ServiceTierByFamily;
|
|
31
|
+
setServiceTier(): void;
|
|
29
32
|
getSessionName(): string | undefined;
|
|
30
33
|
setSessionName(): Promise<void>;
|
|
31
34
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolApproval, ToolLoadMode } from "@oh-my-pi/pi-agent-core";
|
|
11
11
|
import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
|
12
|
-
import type { Api, AssistantMessageEvent, AssistantMessageEventStream, Context, ImageContent, Model, ModelSpec, ProviderResponseMetadata, SimpleStreamOptions, Static, TextContent, TSchema } from "@oh-my-pi/pi-ai";
|
|
12
|
+
import type { Api, AssistantMessageEvent, AssistantMessageEventStream, Context, ImageContent, Model, ModelSpec, ProviderResponseMetadata, ServiceTier, ServiceTierByFamily, ServiceTierFamily, SimpleStreamOptions, Static, TextContent, TSchema } from "@oh-my-pi/pi-ai";
|
|
13
13
|
import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/oauth/types";
|
|
14
14
|
import type { AutocompleteItem, AutocompleteProvider, Component, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
|
|
15
15
|
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
|
@@ -690,6 +690,8 @@ export interface RegisteredCommand {
|
|
|
690
690
|
}
|
|
691
691
|
/** Handler function type for events */
|
|
692
692
|
export type ExtensionHandler<E, R = undefined> = (event: E, ctx: ExtensionContext) => Promise<R | void> | R | void;
|
|
693
|
+
/** Service tiers accepted by each provider family. */
|
|
694
|
+
export type ExtensionServiceTier<Family extends ServiceTierFamily> = Family extends "anthropic" ? "priority" : Family extends "google" ? "flex" | "priority" : ServiceTier;
|
|
693
695
|
/**
|
|
694
696
|
* ExtensionAPI passed to extension factory functions.
|
|
695
697
|
*/
|
|
@@ -806,6 +808,13 @@ export interface ExtensionAPI {
|
|
|
806
808
|
getThinkingLevel(): ThinkingLevel | undefined;
|
|
807
809
|
/** Set thinking level for the current session. */
|
|
808
810
|
setThinkingLevel(level: ThinkingLevel): void;
|
|
811
|
+
/** Get a snapshot of the current session's per-family service tiers. */
|
|
812
|
+
getServiceTiers(): Readonly<ServiceTierByFamily>;
|
|
813
|
+
/**
|
|
814
|
+
* Set one provider family's service tier for subsequent requests, or clear
|
|
815
|
+
* its session override with `undefined`.
|
|
816
|
+
*/
|
|
817
|
+
setServiceTier<Family extends ServiceTierFamily>(family: Family, tier: ExtensionServiceTier<Family> | undefined): void;
|
|
809
818
|
/** Get the current session name. */
|
|
810
819
|
getSessionName(): string | undefined;
|
|
811
820
|
/** Set the session name. Persists to the session file. */
|
|
@@ -957,6 +966,8 @@ export type SetActiveToolsHandler = (toolNames: string[]) => Promise<void>;
|
|
|
957
966
|
export type SetModelHandler = (model: Model) => Promise<boolean>;
|
|
958
967
|
export type GetThinkingLevelHandler = () => ThinkingLevel | undefined;
|
|
959
968
|
export type SetThinkingLevelHandler = (level: ThinkingLevel, persist?: boolean) => void;
|
|
969
|
+
export type GetServiceTiersHandler = () => ServiceTierByFamily;
|
|
970
|
+
export type SetServiceTierHandler = (family: ServiceTierFamily, tier: ServiceTier | undefined) => void;
|
|
960
971
|
/** Shared state created by loader, used during registration and runtime. */
|
|
961
972
|
export interface ExtensionRuntimeState {
|
|
962
973
|
flagValues: Map<string, boolean | string>;
|
|
@@ -980,6 +991,8 @@ export interface ExtensionActions {
|
|
|
980
991
|
setModel: SetModelHandler;
|
|
981
992
|
getThinkingLevel: GetThinkingLevelHandler;
|
|
982
993
|
setThinkingLevel: SetThinkingLevelHandler;
|
|
994
|
+
getServiceTiers?: GetServiceTiersHandler;
|
|
995
|
+
setServiceTier?: SetServiceTierHandler;
|
|
983
996
|
getSessionName: () => string | undefined;
|
|
984
997
|
setSessionName: (name: string) => Promise<void>;
|
|
985
998
|
}
|
|
@@ -1018,8 +1031,10 @@ export interface ExtensionCommandContextActions {
|
|
|
1018
1031
|
}>;
|
|
1019
1032
|
reload: () => Promise<void>;
|
|
1020
1033
|
}
|
|
1021
|
-
/** Full runtime = state + actions. */
|
|
1034
|
+
/** Full runtime = state + actions, including host-compatible service-tier fallbacks. */
|
|
1022
1035
|
export interface ExtensionRuntime extends ExtensionRuntimeState, ExtensionActions {
|
|
1036
|
+
getServiceTiers: GetServiceTiersHandler;
|
|
1037
|
+
setServiceTier: SetServiceTierHandler;
|
|
1023
1038
|
}
|
|
1024
1039
|
/** Loaded extension with all registered items. */
|
|
1025
1040
|
export interface Extension {
|
|
@@ -58,6 +58,19 @@ export declare function __validateLegacyPiPackageRootOverrides(candidates: Recor
|
|
|
58
58
|
export declare function __buildLegacyPiPackageRootOverrides(isCompiled: boolean, bundledModuleKeys?: Iterable<string>): Record<string, string>;
|
|
59
59
|
/** Test seam for compiled-binary legacy extension source rewriting. */
|
|
60
60
|
export declare function __rewriteLegacyExtensionSourceForTests(source: string, importerPath: string, mtimeTag?: string | null, resolvedImportMtimeTag?: string | null): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Register {@link evaluateGraphCommonJs} as the graph-owned CommonJS require
|
|
63
|
+
* bridge on `globalThis`, first-wins.
|
|
64
|
+
*
|
|
65
|
+
* On source-link installs the `@(scope)/pi-coding-agent` root shim is served
|
|
66
|
+
* from `src/`, so an extension import can evaluate a second instance of this
|
|
67
|
+
* module with empty graph state. An unconditional set would let that empty
|
|
68
|
+
* instance clobber the host bundle's populated bridge and break transitive
|
|
69
|
+
* CommonJS resolution (#6449); guarding preserves the first (host-owned)
|
|
70
|
+
* registration. Idempotent: a subsequent call with a value already present is a
|
|
71
|
+
* no-op.
|
|
72
|
+
*/
|
|
73
|
+
export declare function ensureGraphCommonJsRequireRegistered(): void;
|
|
61
74
|
/**
|
|
62
75
|
* Load a legacy Pi extension module from its real on-disk location.
|
|
63
76
|
*
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import type { AgentSession } from "../session/agent-session.js";
|
|
3
|
+
import type { LivePhase, LiveTranscript } from "./visualizer.js";
|
|
4
|
+
/** UI notifications emitted during a live session. */
|
|
5
|
+
export interface LiveSessionCallbacks {
|
|
6
|
+
/** Reports connection and activity phase changes. */
|
|
7
|
+
onPhase(phase: LivePhase): void;
|
|
8
|
+
/** Reports clamped microphone and speaker RMS levels. */
|
|
9
|
+
onLevels(input: number, output: number): void;
|
|
10
|
+
/** Reports the latest available conversational transcript. */
|
|
11
|
+
onTranscript(transcript: LiveTranscript | undefined): void;
|
|
12
|
+
/** Reports one terminal stop, optionally carrying its cause. */
|
|
13
|
+
onTerminal(error?: Error): void;
|
|
14
|
+
}
|
|
15
|
+
/** Dependencies and presentation callbacks for a live session. */
|
|
16
|
+
export interface LiveSessionControllerOptions {
|
|
17
|
+
/** Agent session that performs all delegated coding work. */
|
|
18
|
+
session: AgentSession;
|
|
19
|
+
/** UI callbacks for live session state. */
|
|
20
|
+
callbacks: LiveSessionCallbacks;
|
|
21
|
+
/** Extracts visible assistant text using the caller's normal UI rules. */
|
|
22
|
+
extractAssistantText(message: AssistantMessage): string;
|
|
23
|
+
/** Realtime output voice, defaulting to marin. */
|
|
24
|
+
voice?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Coordinates the realtime conversational surface with normal AgentSession turns. */
|
|
27
|
+
export declare class LiveSessionController {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(options: LiveSessionControllerOptions);
|
|
30
|
+
/** Current realtime call phase. */
|
|
31
|
+
get phase(): LivePhase;
|
|
32
|
+
/** Whether microphone input is currently muted. */
|
|
33
|
+
get muted(): boolean;
|
|
34
|
+
/** Connects the realtime surface and starts microphone streaming. */
|
|
35
|
+
start(): Promise<void>;
|
|
36
|
+
/** Toggles microphone capture while leaving output and the session connected. */
|
|
37
|
+
toggleMute(): void;
|
|
38
|
+
/** Stops recording, closes the live session, and emits one terminal callback. */
|
|
39
|
+
stop(): Promise<void>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Frameless Bidi model used by Codex Desktop live calls. */
|
|
2
|
+
export declare const LIVE_MODEL: "gpt-live-1-boulder-alpha";
|
|
3
|
+
/** Maximum UTF-8 payload size accepted by each context append. */
|
|
4
|
+
export declare const CONTEXT_CHUNK_BYTES = 500;
|
|
5
|
+
/** Semantic stream selected for appended Frameless Bidi context. */
|
|
6
|
+
export type LiveContextChannel = "speakable" | "commentary";
|
|
7
|
+
/** Text content item accepted by Frameless Bidi context appends. */
|
|
8
|
+
export type LiveInputTextContent = {
|
|
9
|
+
type: "input_text";
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
/** Session object posted alongside the SDP when opening a live call. */
|
|
13
|
+
export type LiveSessionPayload = {
|
|
14
|
+
model: typeof LIVE_MODEL;
|
|
15
|
+
instructions: string;
|
|
16
|
+
audio: {
|
|
17
|
+
output: {
|
|
18
|
+
voice: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
delegation: {
|
|
22
|
+
type: "client";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/** Messages sent by the client over the Frameless Bidi data channel. */
|
|
26
|
+
export type LiveClientMessage = {
|
|
27
|
+
type: "delegation.context.append";
|
|
28
|
+
delegation_item_id: string;
|
|
29
|
+
channel?: LiveContextChannel;
|
|
30
|
+
content: LiveInputTextContent[];
|
|
31
|
+
} | {
|
|
32
|
+
type: "session.context.append";
|
|
33
|
+
channel?: LiveContextChannel;
|
|
34
|
+
content: LiveInputTextContent[];
|
|
35
|
+
} | {
|
|
36
|
+
type: "session.close";
|
|
37
|
+
};
|
|
38
|
+
/** Parsed Frameless Bidi server events, including unsupported wire event types. */
|
|
39
|
+
export type LiveServerEvent = {
|
|
40
|
+
type: "session.started" | "session.updated";
|
|
41
|
+
session: {
|
|
42
|
+
id: string;
|
|
43
|
+
instructions?: string;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
type: "output_audio.delta";
|
|
47
|
+
audio: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "input_transcript.added" | "output_transcript.added";
|
|
50
|
+
item: {
|
|
51
|
+
text: string;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: "turn.done";
|
|
55
|
+
turn: {
|
|
56
|
+
role: "user" | "assistant";
|
|
57
|
+
transcript: string;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
type: "delegation.created";
|
|
61
|
+
item: {
|
|
62
|
+
type: "delegation";
|
|
63
|
+
target: "client";
|
|
64
|
+
id: string;
|
|
65
|
+
content: LiveInputTextContent[];
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
type: "error";
|
|
69
|
+
message: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: "unknown";
|
|
72
|
+
wireType: string;
|
|
73
|
+
};
|
|
74
|
+
/** Parse a JSON string or decoded value from the Frameless Bidi data channel. */
|
|
75
|
+
export declare function parseLiveServerEvent(payload: unknown): LiveServerEvent | null;
|
|
76
|
+
/** Build the session object posted in the multipart WebRTC call request. */
|
|
77
|
+
export declare function buildLiveSessionPayload(instructions: string, voice: string): LiveSessionPayload;
|
|
78
|
+
/** Build a context append associated with a server-created delegation. */
|
|
79
|
+
export declare function buildDelegationContextAppend(delegationItemId: string, text: string, channel?: LiveContextChannel): LiveClientMessage;
|
|
80
|
+
/** Build context appended to the live session outside a delegation. */
|
|
81
|
+
export declare function buildSessionContextAppend(text: string, channel?: LiveContextChannel): LiveClientMessage;
|
|
82
|
+
/** Build the message that gracefully closes a live session. */
|
|
83
|
+
export declare function buildSessionClose(): LiveClientMessage;
|
|
84
|
+
/** Split context into character-safe chunks of at most 500 UTF-8 bytes. */
|
|
85
|
+
export declare function chunkLiveContext(text: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AuthStorage } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import { type LiveClientMessage, type LiveServerEvent } from "./protocol.js";
|
|
3
|
+
type BrowserLiveApi = {
|
|
4
|
+
start(workletSource: string): Promise<string>;
|
|
5
|
+
acceptAnswer(sdp: string): Promise<void>;
|
|
6
|
+
waitForOpen(): Promise<void>;
|
|
7
|
+
send(payload: string): void;
|
|
8
|
+
pushAudio(payload: string): void;
|
|
9
|
+
setMuted(muted: boolean): void;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
declare global {
|
|
13
|
+
var ompCodexLive: BrowserLiveApi;
|
|
14
|
+
}
|
|
15
|
+
/** Callbacks emitted by the live WebRTC transport. */
|
|
16
|
+
export interface LiveTransportCallbacks {
|
|
17
|
+
onEvent(event: LiveServerEvent): void;
|
|
18
|
+
onOutputLevel(level: number): void;
|
|
19
|
+
}
|
|
20
|
+
/** Configuration required to establish a Codex live call. */
|
|
21
|
+
export interface LiveTransportOptions {
|
|
22
|
+
authStorage: AuthStorage;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
instructions: string;
|
|
25
|
+
voice: string;
|
|
26
|
+
callbacks: LiveTransportCallbacks;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
/** Extracts the server-assigned `rtc_<uuid>` call ID from a signaling Location header. */
|
|
30
|
+
export declare function parseLiveCallId(location: string | null): string | undefined;
|
|
31
|
+
/** Builds the Frameless Bidi sideband WebSocket URL for an accepted Codex call. */
|
|
32
|
+
export declare function buildLiveSidebandUrl(callId: string): string;
|
|
33
|
+
/** Headless-Chromium WebRTC transport for a Codex Frameless Bidi live session. */
|
|
34
|
+
export declare class CodexLiveTransport {
|
|
35
|
+
#private;
|
|
36
|
+
constructor(options: LiveTransportOptions);
|
|
37
|
+
/** Establish the browser peer, perform Codex signaling, and wait for the data channel. */
|
|
38
|
+
connect(): Promise<void>;
|
|
39
|
+
/** Serialize one Frameless Bidi control message onto the call's sideband WebSocket. */
|
|
40
|
+
send(message: LiveClientMessage): Promise<void>;
|
|
41
|
+
/** Queue 16 kHz mono Float32 PCM for continuous browser-side resampling and playback. */
|
|
42
|
+
pushAudio(samples: Float32Array): void;
|
|
43
|
+
/** Enable or disable the browser audio source and discard queued input when muted. */
|
|
44
|
+
setMuted(muted: boolean): Promise<void>;
|
|
45
|
+
/** Stop audio, WebRTC, the page, and Chromium. Safe to call repeatedly. */
|
|
46
|
+
close(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Component } from "@oh-my-pi/pi-tui";
|
|
2
|
+
/** Distinct states of a realtime call connection. */
|
|
3
|
+
export type LivePhase = "connecting" | "listening" | "working" | "speaking" | "muted" | "error";
|
|
4
|
+
/** A transcribed turn in the realtime call. */
|
|
5
|
+
export interface LiveTranscript {
|
|
6
|
+
role: "user" | "assistant";
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/** Configuration callbacks for user interactions in the visualizer. */
|
|
10
|
+
export interface LiveVisualizerOptions {
|
|
11
|
+
onStop(): void;
|
|
12
|
+
onToggleMute(): void;
|
|
13
|
+
}
|
|
14
|
+
/** A compact, fixed-height terminal component for displaying a realtime call. */
|
|
15
|
+
export declare class LiveVisualizer implements Component {
|
|
16
|
+
#private;
|
|
17
|
+
readonly wantsKeyRelease = false;
|
|
18
|
+
constructor(options: LiveVisualizerOptions);
|
|
19
|
+
/** Updates the current call phase. */
|
|
20
|
+
setPhase(phase: LivePhase): void;
|
|
21
|
+
/** Updates the current input and output volume levels (0..1). */
|
|
22
|
+
setLevels(input: number, output: number): void;
|
|
23
|
+
/** Updates the latest transcript fragment. */
|
|
24
|
+
setTranscript(transcript: LiveTranscript | undefined): void;
|
|
25
|
+
/** Updates the animation frame for spinners and waveforms. */
|
|
26
|
+
setFrame(frame: number): void;
|
|
27
|
+
/** Processes user keypresses. */
|
|
28
|
+
handleInput(data: string): void;
|
|
29
|
+
/** Clears the render cache. */
|
|
30
|
+
invalidate(): void;
|
|
31
|
+
/** Renders the visualizer into a fixed array of rows at the given width. */
|
|
32
|
+
render(width: number): readonly string[];
|
|
33
|
+
}
|
|
@@ -69,10 +69,25 @@ export declare function notifyWorkspaceWatchedFiles(cwd: string, changes: readon
|
|
|
69
69
|
* Increments version, sends didChange and didSave notifications.
|
|
70
70
|
*/
|
|
71
71
|
export declare function refreshFile(client: LspClient, filePath: string, signal?: AbortSignal): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Tear down a specific client instance using the LSP shutdown/exit handshake.
|
|
74
|
+
*
|
|
75
|
+
* Removes the client from the registry by identity first (never evicting a
|
|
76
|
+
* newer client already republished under the same key), then performs a bounded
|
|
77
|
+
* graceful shutdown, force-killing and awaiting confirmed process exit.
|
|
78
|
+
*
|
|
79
|
+
* @returns `true` once the process is confirmed exited, `false` if it outlived
|
|
80
|
+
* the shutdown budget — callers reporting a restart must treat `false` as a
|
|
81
|
+
* failed teardown, not a completed restart.
|
|
82
|
+
*/
|
|
83
|
+
export declare function shutdownClientInstance(client: LspClient): Promise<boolean>;
|
|
72
84
|
/**
|
|
73
85
|
* Shutdown a specific client by key.
|
|
86
|
+
*
|
|
87
|
+
* @returns `true` when the client is gone (already absent or confirmed exited),
|
|
88
|
+
* `false` if a live process outlived the shutdown budget.
|
|
74
89
|
*/
|
|
75
|
-
export declare function shutdownClient(key: string): Promise<
|
|
90
|
+
export declare function shutdownClient(key: string): Promise<boolean>;
|
|
76
91
|
/**
|
|
77
92
|
* Send an LSP request and wait for response.
|
|
78
93
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -55,6 +55,7 @@ export declare function analyzeAuthError(error: Error, serverUrl?: string): Auth
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function fetchResourceMetadataScopes(resourceMetadataUrl: string, opts?: {
|
|
57
57
|
fetch?: FetchImpl;
|
|
58
|
+
signal?: AbortSignal;
|
|
58
59
|
}): Promise<string | undefined>;
|
|
59
60
|
/**
|
|
60
61
|
* Try to discover OAuth endpoints by querying the server's well-known endpoints.
|
|
@@ -64,4 +65,5 @@ export declare function discoverOAuthEndpoints(serverUrl: string, authServerUrl?
|
|
|
64
65
|
fetch?: FetchImpl;
|
|
65
66
|
protectedResource?: string;
|
|
66
67
|
protectedScopes?: string;
|
|
68
|
+
signal?: AbortSignal;
|
|
67
69
|
}): Promise<OAuthEndpoints | null>;
|