@oh-my-pi/pi-coding-agent 16.1.12 → 16.1.14
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 +27 -0
- package/dist/cli.js +5650 -2860
- package/dist/types/config/settings-schema.d.ts +44 -14
- package/dist/types/cursor.d.ts +9 -9
- package/dist/types/eval/__tests__/julia-prelude.test.d.ts +1 -0
- package/dist/types/eval/backend-helpers.d.ts +23 -0
- package/dist/types/eval/executor-base.d.ts +118 -0
- package/dist/types/eval/index.d.ts +2 -0
- package/dist/types/eval/jl/executor.d.ts +44 -0
- package/dist/types/eval/jl/index.d.ts +11 -0
- package/dist/types/eval/jl/kernel.d.ts +28 -0
- package/dist/types/eval/jl/prelude.d.ts +1 -0
- package/dist/types/eval/jl/runtime.d.ts +22 -0
- package/dist/types/eval/kernel-base.d.ts +105 -0
- package/dist/types/eval/py/kernel.d.ts +3 -61
- package/dist/types/eval/rb/executor.d.ts +77 -0
- package/dist/types/eval/rb/index.d.ts +11 -0
- package/dist/types/eval/rb/kernel.d.ts +31 -0
- package/dist/types/eval/rb/prelude.d.ts +1 -0
- package/dist/types/eval/rb/runtime.d.ts +23 -0
- package/dist/types/eval/runtime-env.d.ts +24 -0
- package/dist/types/eval/types.d.ts +3 -3
- package/dist/types/extensibility/extensions/runner.d.ts +2 -15
- package/dist/types/extensibility/hooks/loader.d.ts +1 -25
- package/dist/types/extensibility/session-handler-types.d.ts +23 -0
- package/dist/types/jsonrpc/message-framing.d.ts +35 -0
- package/dist/types/mnemopi/embed-client.d.ts +7 -24
- package/dist/types/modes/components/chat-transcript-builder.d.ts +1 -1
- package/dist/types/modes/components/custom-editor.d.ts +11 -0
- package/dist/types/modes/components/selector-helpers.d.ts +53 -0
- package/dist/types/modes/interactive-mode.d.ts +0 -2
- package/dist/types/modes/theme/theme.d.ts +8 -1
- package/dist/types/modes/types.d.ts +0 -2
- package/dist/types/modes/utils/copy-targets.d.ts +1 -1
- package/dist/types/modes/utils/interactive-context-helpers.d.ts +14 -0
- package/dist/types/modes/utils/transcript-render-helpers.d.ts +54 -0
- package/dist/types/sdk.d.ts +1 -1
- package/dist/types/session/agent-session.d.ts +2 -2
- package/dist/types/stt/asr-client.d.ts +3 -29
- package/dist/types/subprocess/worker-client.d.ts +149 -0
- package/dist/types/subprocess/worker-runtime.d.ts +107 -0
- package/dist/types/tiny/title-client.d.ts +14 -34
- package/dist/types/tools/eval-backends.d.ts +6 -3
- package/dist/types/tools/eval-render.d.ts +6 -5
- package/dist/types/tools/eval.d.ts +13 -15
- package/dist/types/tools/index.d.ts +3 -3
- package/dist/types/tts/tts-client.d.ts +3 -28
- package/dist/types/tui/code-cell.d.ts +7 -0
- package/dist/types/utils/file-display-mode.d.ts +1 -1
- package/dist/types/web/parallel.d.ts +6 -0
- package/package.json +12 -12
- package/src/config/settings-schema.ts +50 -18
- package/src/config/settings.ts +5 -0
- package/src/dap/client.ts +13 -107
- package/src/eval/__tests__/julia-prelude.test.ts +77 -0
- package/src/eval/backend-helpers.ts +48 -0
- package/src/eval/executor-base.ts +425 -0
- package/src/eval/index.ts +2 -0
- package/src/eval/jl/executor.ts +540 -0
- package/src/eval/jl/index.ts +54 -0
- package/src/eval/jl/kernel.ts +235 -0
- package/src/eval/jl/prelude.jl +930 -0
- package/src/eval/jl/prelude.ts +3 -0
- package/src/eval/jl/runner.jl +634 -0
- package/src/eval/jl/runtime.ts +118 -0
- package/src/eval/js/index.ts +3 -14
- package/src/eval/kernel-base.ts +569 -0
- package/src/eval/py/executor.ts +43 -252
- package/src/eval/py/index.ts +9 -20
- package/src/eval/py/kernel.ts +29 -544
- package/src/eval/rb/executor.ts +504 -0
- package/src/eval/rb/index.ts +54 -0
- package/src/eval/rb/kernel.ts +230 -0
- package/src/eval/rb/prelude.rb +721 -0
- package/src/eval/rb/prelude.ts +3 -0
- package/src/eval/rb/runner.rb +474 -0
- package/src/eval/rb/runtime.ts +132 -0
- package/src/eval/runtime-env.ts +104 -0
- package/src/eval/types.ts +3 -3
- package/src/extensibility/extensions/runner.ts +4 -11
- package/src/extensibility/hooks/loader.ts +3 -21
- package/src/extensibility/session-handler-types.ts +21 -0
- package/src/internal-urls/docs-index.generated.txt +1 -1
- package/src/jsonrpc/message-framing.ts +142 -0
- package/src/lsp/client.ts +13 -109
- package/src/mnemopi/embed-client.ts +43 -198
- package/src/modes/components/agent-dashboard.ts +17 -40
- package/src/modes/components/chat-transcript-builder.ts +18 -102
- package/src/modes/components/custom-editor.ts +19 -0
- package/src/modes/components/extensions/extension-dashboard.ts +4 -13
- package/src/modes/components/extensions/extension-list.ts +16 -44
- package/src/modes/components/history-search.ts +4 -16
- package/src/modes/components/selector-helpers.ts +129 -0
- package/src/modes/components/settings-selector.ts +7 -5
- package/src/modes/components/tree-selector.ts +13 -18
- package/src/modes/controllers/event-controller.ts +3 -9
- package/src/modes/controllers/input-controller.ts +32 -54
- package/src/modes/interactive-mode.ts +5 -7
- package/src/modes/theme/theme.ts +35 -0
- package/src/modes/types.ts +0 -2
- package/src/modes/utils/copy-targets.ts +3 -2
- package/src/modes/utils/interactive-context-helpers.ts +27 -0
- package/src/modes/utils/transcript-render-helpers.ts +157 -0
- package/src/modes/utils/ui-helpers.ts +21 -126
- package/src/prompts/system/system-prompt.md +10 -10
- package/src/prompts/tools/bash.md +0 -1
- package/src/prompts/tools/eval.md +6 -4
- package/src/prompts/tools/find.md +0 -4
- package/src/prompts/tools/read.md +1 -2
- package/src/prompts/tools/replace.md +1 -1
- package/src/prompts/tools/search.md +0 -1
- package/src/sdk.ts +13 -7
- package/src/session/agent-session.ts +9 -7
- package/src/stt/asr-client.ts +35 -215
- package/src/stt/asr-worker.ts +29 -181
- package/src/subprocess/worker-client.ts +297 -0
- package/src/subprocess/worker-runtime.ts +277 -0
- package/src/task/executor.ts +4 -4
- package/src/tiny/title-client.ts +53 -219
- package/src/tiny/worker.ts +29 -180
- package/src/tools/eval-backends.ts +10 -3
- package/src/tools/eval-render.ts +17 -8
- package/src/tools/eval.ts +187 -22
- package/src/tools/index.ts +51 -28
- package/src/tts/tts-client.ts +38 -206
- package/src/tts/tts-worker.ts +23 -97
- package/src/tui/code-cell.ts +12 -1
- package/src/utils/file-display-mode.ts +2 -3
- package/src/web/parallel.ts +43 -42
- package/src/web/search/providers/parallel.ts +10 -99
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseKernel, type KernelRuntimeEnv, type KernelStartOptions } from "../kernel-base";
|
|
2
|
+
import type { KernelDisplayOutput } from "../py/display";
|
|
3
|
+
import { type RubyRuntime } from "./runtime";
|
|
4
|
+
export type { KernelExecuteResult, KernelRuntimeEnv, KernelShutdownResult } from "../kernel-base";
|
|
5
|
+
export type { KernelDisplayOutput, PythonStatusEvent } from "../py/display";
|
|
6
|
+
export { renderKernelDisplay } from "../py/display";
|
|
7
|
+
export interface KernelExecuteOptions {
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Runtime working directory applied immediately before this request executes. */
|
|
10
|
+
cwd?: string;
|
|
11
|
+
/** Managed runtime environment variables applied immediately before this request executes. */
|
|
12
|
+
env?: KernelRuntimeEnv;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
onChunk?: (text: string) => Promise<void> | void;
|
|
15
|
+
onDisplay?: (output: KernelDisplayOutput) => Promise<void> | void;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
silent?: boolean;
|
|
18
|
+
storeHistory?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface RubyKernelAvailability {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
rubyPath?: string;
|
|
23
|
+
reason?: string;
|
|
24
|
+
/** The probed-working runtime, when one was found. */
|
|
25
|
+
runtime?: RubyRuntime;
|
|
26
|
+
}
|
|
27
|
+
export declare function checkRubyKernelAvailability(cwd: string, interpreter?: string): Promise<RubyKernelAvailability>;
|
|
28
|
+
export declare class RubyKernel extends BaseKernel<KernelExecuteOptions> {
|
|
29
|
+
private constructor();
|
|
30
|
+
static start(options: KernelStartOptions): Promise<RubyKernel>;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RUBY_PRELUDE: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface RubyRuntime {
|
|
2
|
+
/** Path to the ruby executable. */
|
|
3
|
+
rubyPath: string;
|
|
4
|
+
/** Filtered environment variables. */
|
|
5
|
+
env: Record<string, string | undefined>;
|
|
6
|
+
}
|
|
7
|
+
export declare const filterEnv: (env: Record<string, string | undefined>) => Record<string, string | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve an explicitly configured interpreter (`ruby.interpreter`) into a
|
|
10
|
+
* runtime, bypassing discovery. Does not probe the executable — callers must
|
|
11
|
+
* check it actually runs. `~` expands to the home directory and relative paths
|
|
12
|
+
* resolve against `cwd`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveExplicitRubyRuntime(interpreter: string, cwd: string, baseEnv: Record<string, string | undefined>): RubyRuntime;
|
|
15
|
+
/**
|
|
16
|
+
* Enumerate candidate Ruby runtimes in priority order. With an explicit
|
|
17
|
+
* interpreter that is the only candidate; otherwise the first `ruby` on PATH.
|
|
18
|
+
*/
|
|
19
|
+
export declare function enumerateRubyRuntimes(cwd: string, baseEnv: Record<string, string | undefined>, interpreter?: string): RubyRuntime[];
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the highest-priority Ruby runtime. Throws when none exists.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveRubyRuntime(cwd: string, baseEnv: Record<string, string | undefined>, interpreter?: string): RubyRuntime;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const CASE_INSENSITIVE_ENV: boolean;
|
|
2
|
+
export declare const SECRET_KEY_PATTERN: RegExp;
|
|
3
|
+
export interface EnvFilterOptions {
|
|
4
|
+
allowList: string[];
|
|
5
|
+
windowsAllowList: string[];
|
|
6
|
+
denyList: string[];
|
|
7
|
+
allowPrefixes: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates an environment filter function based on the provided allowlists, denylists, and prefixes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createEnvFilter(options: EnvFilterOptions): (env: Record<string, string | undefined>) => Record<string, string | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve an explicitly configured interpreter path, expanding `~` to the home directory.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveExplicitPath(interpreter: string, cwd: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Enumerates candidate runtimes in priority order.
|
|
19
|
+
*/
|
|
20
|
+
export declare function enumerateRuntimes<T>(cwd: string, baseEnv: Record<string, string | undefined>, binaryName: string, createRuntime: (executablePath: string, env: Record<string, string | undefined>) => T, interpreter?: string): T[];
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the highest-priority runtime. Throws when none exists.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveRuntime<T>(cwd: string, baseEnv: Record<string, string | undefined>, binaryName: string, createRuntime: (executablePath: string, env: Record<string, string | undefined>) => T, interpreter?: string): T;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** Runtime backend that an eval cell dispatches to. */
|
|
2
|
-
export type EvalLanguage = "python" | "js";
|
|
2
|
+
export type EvalLanguage = "python" | "js" | "ruby" | "julia";
|
|
3
3
|
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
4
4
|
import type { OutputMeta } from "../tools/output-meta";
|
|
5
|
-
/** Status event emitted by prelude helpers
|
|
5
|
+
/** Status event emitted by eval prelude helpers for TUI rendering. */
|
|
6
6
|
export interface EvalStatusEvent {
|
|
7
7
|
op: string;
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
}
|
|
10
|
-
/** Display output captured during eval execution
|
|
10
|
+
/** Display output captured during eval execution across supported backends. */
|
|
11
11
|
export type EvalDisplayOutput = {
|
|
12
12
|
type: "json";
|
|
13
13
|
data: unknown;
|
|
@@ -8,6 +8,7 @@ import type { ModelRegistry } from "../../config/model-registry";
|
|
|
8
8
|
import type { Settings } from "../../config/settings";
|
|
9
9
|
import type { MemoryRuntimeContext } from "../../memory-backend";
|
|
10
10
|
import type { SessionManager } from "../../session/session-manager";
|
|
11
|
+
import type { BranchHandler, NavigateTreeHandler, NewSessionHandler } from "../session-handler-types";
|
|
11
12
|
import type { AfterProviderResponseEvent, AssistantThinkingRenderer, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, ContextEvent, Extension, ExtensionActions, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFlag, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, InputEvent, InputEventResult, MessageRenderer, RegisteredCommand, RegisteredTool, ResourcesDiscoverEvent, SessionBeforeBranchResult, SessionBeforeCompactResult, SessionBeforeSwitchResult, SessionBeforeTreeResult, SessionCompactingResult, SessionStopEvent, SessionStopEventResult, ToolCallEvent, ToolCallEventResult, ToolResultEvent, ToolResultEventResult, UserBashEvent, UserBashEventResult, UserPythonEvent, UserPythonEventResult } from "./types";
|
|
12
13
|
/** Combined result from all before_agent_start handlers */
|
|
13
14
|
interface BeforeAgentStartCombinedResult {
|
|
@@ -46,20 +47,7 @@ type RunnerEmitResult<TEvent extends RunnerEmitEvent> = TEvent extends {
|
|
|
46
47
|
} ? SessionCompactingResult | undefined : TEvent extends {
|
|
47
48
|
type: "session_stop";
|
|
48
49
|
} ? SessionStopEventResult | undefined : undefined;
|
|
49
|
-
export type
|
|
50
|
-
parentSession?: string;
|
|
51
|
-
setup?: (sessionManager: SessionManager) => Promise<void>;
|
|
52
|
-
}) => Promise<{
|
|
53
|
-
cancelled: boolean;
|
|
54
|
-
}>;
|
|
55
|
-
export type BranchHandler = (entryId: string) => Promise<{
|
|
56
|
-
cancelled: boolean;
|
|
57
|
-
}>;
|
|
58
|
-
export type NavigateTreeHandler = (targetId: string, options?: {
|
|
59
|
-
summarize?: boolean;
|
|
60
|
-
}) => Promise<{
|
|
61
|
-
cancelled: boolean;
|
|
62
|
-
}>;
|
|
50
|
+
export type { BranchHandler, NavigateTreeHandler, NewSessionHandler };
|
|
63
51
|
export type SwitchSessionHandler = (sessionPath: string) => Promise<{
|
|
64
52
|
cancelled: boolean;
|
|
65
53
|
}>;
|
|
@@ -156,4 +144,3 @@ export declare class ExtensionRunner {
|
|
|
156
144
|
emitAfterProviderResponse(response: ProviderResponseMetadata, _model?: Model): Promise<void>;
|
|
157
145
|
emitBeforeAgentStart(prompt: string, images: ImageContent[] | undefined, systemPrompt: string[]): Promise<BeforeAgentStartCombinedResult | undefined>;
|
|
158
146
|
}
|
|
159
|
-
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { HookMessage } from "../../session/messages";
|
|
2
|
-
import type { SessionManager } from "../../session/session-manager";
|
|
3
2
|
import type { HookMessageRenderer, RegisteredCommand } from "./types";
|
|
4
3
|
/**
|
|
5
4
|
* Generic handler function type.
|
|
@@ -16,29 +15,7 @@ export type SendMessageHandler = <T = unknown>(message: Pick<HookMessage<T>, "cu
|
|
|
16
15
|
* Append entry handler type for pi.appendEntry().
|
|
17
16
|
*/
|
|
18
17
|
export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
|
|
19
|
-
|
|
20
|
-
* New session handler type for ctx.newSession() in HookCommandContext.
|
|
21
|
-
*/
|
|
22
|
-
export type NewSessionHandler = (options?: {
|
|
23
|
-
parentSession?: string;
|
|
24
|
-
setup?: (sessionManager: SessionManager) => Promise<void>;
|
|
25
|
-
}) => Promise<{
|
|
26
|
-
cancelled: boolean;
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Branch handler type for ctx.branch() in HookCommandContext.
|
|
30
|
-
*/
|
|
31
|
-
export type BranchHandler = (entryId: string) => Promise<{
|
|
32
|
-
cancelled: boolean;
|
|
33
|
-
}>;
|
|
34
|
-
/**
|
|
35
|
-
* Navigate tree handler type for ctx.navigateTree() in HookCommandContext.
|
|
36
|
-
*/
|
|
37
|
-
export type NavigateTreeHandler = (targetId: string, options?: {
|
|
38
|
-
summarize?: boolean;
|
|
39
|
-
}) => Promise<{
|
|
40
|
-
cancelled: boolean;
|
|
41
|
-
}>;
|
|
18
|
+
export type { BranchHandler, NavigateTreeHandler, NewSessionHandler } from "../session-handler-types";
|
|
42
19
|
/**
|
|
43
20
|
* Registered handlers for a loaded hook.
|
|
44
21
|
*/
|
|
@@ -86,4 +63,3 @@ export declare function loadHooks(paths: string[], cwd: string): Promise<LoadHoo
|
|
|
86
63
|
* Plus any explicitly configured paths from settings.
|
|
87
64
|
*/
|
|
88
65
|
export declare function discoverAndLoadHooks(configuredPaths: string[], cwd: string): Promise<LoadHooksResult>;
|
|
89
|
-
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-lifecycle handler types shared by the extension runner and the hook
|
|
3
|
+
* loader/runner. Both surfaces wire the same new-session / branch / navigate
|
|
4
|
+
* handlers into their command contexts; this is the single source of truth.
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionManager } from "../session/session-manager";
|
|
7
|
+
/** Handler for `ctx.newSession()` — creates (and optionally seeds) a session. */
|
|
8
|
+
export type NewSessionHandler = (options?: {
|
|
9
|
+
parentSession?: string;
|
|
10
|
+
setup?: (sessionManager: SessionManager) => Promise<void>;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
cancelled: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
/** Handler for `ctx.branch()` — branches from a transcript entry. */
|
|
15
|
+
export type BranchHandler = (entryId: string) => Promise<{
|
|
16
|
+
cancelled: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/** Handler for `ctx.navigateTree()` — navigates the session tree. */
|
|
19
|
+
export type NavigateTreeHandler = (targetId: string, options?: {
|
|
20
|
+
summarize?: boolean;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
cancelled: boolean;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Content-Length message framing for the JSON byte streams spoken by the
|
|
3
|
+
* LSP and DAP stdio clients. Both protocols use the same base-protocol framing:
|
|
4
|
+
* each message is a `Content-Length: <n>\r\n\r\n` header block followed by `<n>`
|
|
5
|
+
* bytes of UTF-8 JSON. This module owns the incremental decode so the two
|
|
6
|
+
* clients don't each reimplement chunk accumulation, header scanning, and the
|
|
7
|
+
* mid-message remainder handoff.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Incremental Content-Length frame decoder for a JSON message byte stream.
|
|
11
|
+
*
|
|
12
|
+
* Incoming bytes are buffered as a list of chunks and only joined when a full
|
|
13
|
+
* message is framed — concatenating the accumulator on every read is O(n^2) for
|
|
14
|
+
* messages that span many reads (e.g. a large initial diagnostics burst). Feed
|
|
15
|
+
* raw chunks with {@link push}, pull every complete message with {@link drain},
|
|
16
|
+
* and persist {@link remainder} when the reader stops so a restarted reader
|
|
17
|
+
* resumes mid-message.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MessageFramer {
|
|
20
|
+
#private;
|
|
21
|
+
/** Seed the buffer with any unparsed remainder left by a previous reader. */
|
|
22
|
+
constructor(seed: Buffer);
|
|
23
|
+
/** Append a freshly read chunk to the pending buffer. */
|
|
24
|
+
push(chunk: Buffer): void;
|
|
25
|
+
/**
|
|
26
|
+
* Yield the JSON text of every complete message currently buffered. A header
|
|
27
|
+
* block without a `Content-Length` is non-protocol noise (e.g. a server
|
|
28
|
+
* printing to stdout); `onResync` is invoked with the offending header text
|
|
29
|
+
* and the framer drops past the bogus terminator to recover instead of
|
|
30
|
+
* stalling on the same junk header forever.
|
|
31
|
+
*/
|
|
32
|
+
drain(onResync: (headerText: string) => void): Generator<string>;
|
|
33
|
+
/** The unparsed remainder, to persist when the reader stops. */
|
|
34
|
+
remainder(): Buffer;
|
|
35
|
+
}
|
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SpawnedSubprocess, type WorkerHandle } from "../subprocess/worker-client";
|
|
2
2
|
import type { MnemopiEmbedModelId, MnemopiEmbedWorkerInbound, MnemopiEmbedWorkerOutbound } from "./embed-protocol";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Parent-side handle for the mnemopi embeddings subprocess. The runtime
|
|
5
5
|
* implementation is a Bun child process so `onnxruntime-node`'s NAPI
|
|
6
6
|
* constructor + finalizer never run inside the main agent address space —
|
|
7
7
|
* those destructors segfault Bun on Windows when mnemopi's local embedding
|
|
8
8
|
* provider loads fastembed in the main process (issue #3031; the mnemopi
|
|
9
9
|
* sibling of the tiny-model fix from #1606 / #1607).
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
12
|
-
send(message: MnemopiEmbedWorkerInbound): void;
|
|
13
|
-
onMessage(handler: (message: MnemopiEmbedWorkerOutbound) => void): () => void;
|
|
14
|
-
onError(handler: (error: Error) => void): () => void;
|
|
15
|
-
terminate(): Promise<void>;
|
|
16
|
-
}
|
|
11
|
+
export type MnemopiEmbedWorkerHandle = WorkerHandle<MnemopiEmbedWorkerInbound, MnemopiEmbedWorkerOutbound>;
|
|
17
12
|
/**
|
|
18
13
|
* Hidden subcommand on the main CLI that boots the mnemopi embeddings worker
|
|
19
14
|
* in the spawned subprocess. Kept in sync with the dispatch in `cli.ts`.
|
|
20
15
|
*/
|
|
21
16
|
export declare const MNEMOPI_EMBED_WORKER_ARG = "__omp_worker_mnemopi_embed";
|
|
22
|
-
interface SpawnedSubprocess {
|
|
23
|
-
proc: Subprocess<"ignore", "ignore", "ignore">;
|
|
24
|
-
inbound: Set<(message: MnemopiEmbedWorkerOutbound) => void>;
|
|
25
|
-
errors: Set<(error: Error) => void>;
|
|
26
|
-
/**
|
|
27
|
-
* Flipped to `true` right before the deliberate SIGKILL so `onExit` can
|
|
28
|
-
* distinguish the expected hard-kill from a crash (SIGSEGV from a native
|
|
29
|
-
* fault, OOM SIGKILL, operator `kill -9`). Only the latter surfaces as a
|
|
30
|
-
* worker error so callers don't await forever.
|
|
31
|
-
*/
|
|
32
|
-
intentionalExit: {
|
|
33
|
-
value: boolean;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
17
|
/**
|
|
37
18
|
* Spawn the mnemopi embeddings worker as a subprocess. Exported for tests and
|
|
38
19
|
* the smoke probe; production callers go through {@link spawnMnemopiEmbedWorker}.
|
|
20
|
+
* The child inherits the parent env verbatim — fastembed honours `HF_HUB_*`,
|
|
21
|
+
* `HTTPS_PROXY`, etc., and our `loadFastembed()` reads the same `OMP_*`
|
|
22
|
+
* runtime-install knobs the parent uses.
|
|
39
23
|
*/
|
|
40
|
-
export declare function createMnemopiEmbedSubprocess(): SpawnedSubprocess
|
|
24
|
+
export declare function createMnemopiEmbedSubprocess(): SpawnedSubprocess<MnemopiEmbedWorkerOutbound>;
|
|
41
25
|
/**
|
|
42
26
|
* Per-model wrapper produced by {@link MnemopiEmbedClient.initialize}.
|
|
43
27
|
* `embed()` round-trips one batch of texts through the worker subprocess and
|
|
@@ -67,4 +51,3 @@ export declare function shutdownMnemopiEmbedClient(): Promise<void>;
|
|
|
67
51
|
export declare function smokeTestMnemopiEmbedWorker({ timeoutMs, }?: {
|
|
68
52
|
timeoutMs?: number;
|
|
69
53
|
}): Promise<void>;
|
|
70
|
-
export {};
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* component reuse could.
|
|
13
13
|
*/
|
|
14
14
|
import type { AgentTool } from "@oh-my-pi/pi-agent-core";
|
|
15
|
-
import {
|
|
15
|
+
import type { TUI } from "@oh-my-pi/pi-tui";
|
|
16
16
|
import type { MessageRenderer } from "../../extensibility/extensions/types";
|
|
17
17
|
import type { SessionMessageEntry } from "../../session/session-entries";
|
|
18
18
|
import { TranscriptContainer } from "./transcript-container";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
1
2
|
import { Editor, type KeyId } from "@oh-my-pi/pi-tui";
|
|
2
3
|
import type { AppKeybinding } from "../../config/keybindings";
|
|
3
4
|
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.display.reset" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.retry" | "app.clipboard.pasteImage" | "app.clipboard.pasteTextRaw" | "app.clipboard.copyPrompt">;
|
|
@@ -26,6 +27,16 @@ export declare function extractBracketedImagePastePath(data: string): string | u
|
|
|
26
27
|
export declare class CustomEditor extends Editor {
|
|
27
28
|
#private;
|
|
28
29
|
imageLinks?: readonly (string | undefined)[];
|
|
30
|
+
/** Draft images pasted into the composer, consumed on submit. Co-located with
|
|
31
|
+
* {@link imageLinks} so every piece of draft-image state lives on the editor. */
|
|
32
|
+
pendingImages: ImageContent[];
|
|
33
|
+
/** Per-image source links (file:// targets) parallel to {@link pendingImages};
|
|
34
|
+
* `undefined` entries are images without a backing reference yet. */
|
|
35
|
+
pendingImageLinks: (string | undefined)[];
|
|
36
|
+
/** Clear the composer draft: optionally commit `historyText` to history, then
|
|
37
|
+
* reset the editor text and all pending draft-image state. The shared tail of
|
|
38
|
+
* every "message submitted" path; pass no argument for a plain discard. */
|
|
39
|
+
clearDraft(historyText?: string): void;
|
|
29
40
|
/** Treat image/paste markers as indivisible: a stray backspace deletes the whole token
|
|
30
41
|
* instead of corrupting `[Paste #1, +30 lines]` into plain text. */
|
|
31
42
|
atomicTokenPattern: RegExp;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render `rows` through a {@link ScrollView} with the shared list theme (muted
|
|
3
|
+
* track / accent thumb) and an "auto" scrollbar, positioned at `scrollOffset`.
|
|
4
|
+
* Returns the rendered lines for the caller to append to its output.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderScrollableList(rows: readonly string[], options: {
|
|
7
|
+
width: number;
|
|
8
|
+
totalRows: number;
|
|
9
|
+
scrollOffset: number;
|
|
10
|
+
}): readonly string[];
|
|
11
|
+
/**
|
|
12
|
+
* Center a viewport window of `maxVisible` rows on `selectedIndex` within a
|
|
13
|
+
* list of `total` rows, clamped to valid bounds. Used by the selection-centered
|
|
14
|
+
* list panes (history search, tree selector).
|
|
15
|
+
*/
|
|
16
|
+
export declare function centeredWindow(selectedIndex: number, total: number, maxVisible: number): {
|
|
17
|
+
startIndex: number;
|
|
18
|
+
endIndex: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Width available for row content, reserving the rightmost column for the
|
|
22
|
+
* scrollbar when the list overflows its visible window.
|
|
23
|
+
*/
|
|
24
|
+
export declare function contentRowWidth(width: number, total: number, maxVisible: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* Clamp `selectedIndex` into `[0, total)` and nudge `scrollOffset` so the
|
|
27
|
+
* selection stays within the visible window of `maxVisible` rows. Returns the
|
|
28
|
+
* adjusted pair; on an empty list both reset to 0.
|
|
29
|
+
*/
|
|
30
|
+
export declare function clampSelection(selectedIndex: number, scrollOffset: number, total: number, maxVisible: number): {
|
|
31
|
+
selectedIndex: number;
|
|
32
|
+
scrollOffset: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Classify a key event for search-query text entry. Returns the single
|
|
36
|
+
* printable character to append to the query, or `null` when the key is not a
|
|
37
|
+
* searchable character: non-printable, multi-byte, or a reserved `j`/`k`
|
|
38
|
+
* navigation key.
|
|
39
|
+
*/
|
|
40
|
+
export declare function searchableChar(data: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Handle the shared tab-cycling keys: Tab/Right advance to the next tab,
|
|
43
|
+
* Shift+Tab/Left to the previous. Invokes `switchTab` with the direction and
|
|
44
|
+
* returns true when the key was consumed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleTabSwitchKey(data: string, switchTab: (direction: 1 | -1) => void): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Pad `lines` with blank rows up to `rows` so a full-screen overlay covers the
|
|
49
|
+
* viewport instead of letting the transcript peek through below it. Copies
|
|
50
|
+
* before padding — the source array may be component-owned and must not be
|
|
51
|
+
* mutated.
|
|
52
|
+
*/
|
|
53
|
+
export declare function padLinesToHeight(lines: readonly string[], rows: number): readonly string[];
|
|
@@ -110,8 +110,6 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
110
110
|
todoPhases: TodoPhase[];
|
|
111
111
|
hideThinkingBlock: boolean;
|
|
112
112
|
proseOnlyThinking: boolean;
|
|
113
|
-
pendingImages: ImageContent[];
|
|
114
|
-
pendingImageLinks: (string | undefined)[];
|
|
115
113
|
compactionQueuedMessages: CompactionQueuedMessage[];
|
|
116
114
|
pendingTools: Map<string, ToolExecutionHandle>;
|
|
117
115
|
pendingBashComponents: BashExecutionComponent[];
|
|
@@ -6,7 +6,7 @@ export type SymbolPreset = "unicode" | "nerd" | "ascii";
|
|
|
6
6
|
/**
|
|
7
7
|
* All available symbol keys organized by category.
|
|
8
8
|
*/
|
|
9
|
-
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.ghost" | "icon.agents" | "icon.job" | "icon.cache" | "icon.cacheMiss" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "icon.camera" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.files" | "tab.shell" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.inspectImage" | "tool.goal" | "tool.irc";
|
|
9
|
+
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.ghost" | "icon.agents" | "icon.job" | "icon.cache" | "icon.cacheMiss" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "icon.camera" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.julia" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.files" | "tab.shell" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.inspectImage" | "tool.goal" | "tool.irc";
|
|
10
10
|
export type SpinnerType = "status" | "activity";
|
|
11
11
|
export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "bashMode" | "pythonMode" | "statusLineSep" | "statusLineModel" | "statusLinePath" | "statusLineGitClean" | "statusLineGitDirty" | "statusLineContext" | "statusLineSpend" | "statusLineStaged" | "statusLineDirty" | "statusLineUntracked" | "statusLineOutput" | "statusLineCost" | "statusLineSubagents";
|
|
12
12
|
/** Check if a string is a valid ThemeColor value */
|
|
@@ -241,6 +241,13 @@ export declare class Theme {
|
|
|
241
241
|
* Maps common language names to their corresponding symbol keys.
|
|
242
242
|
*/
|
|
243
243
|
getLangIcon(lang: string | undefined): string;
|
|
244
|
+
/**
|
|
245
|
+
* Language icon tinted with the language's brand color (see
|
|
246
|
+
* {@link LANG_BRAND_COLORS}). Falls back to the muted theme color for
|
|
247
|
+
* languages without a brand entry, and returns the bare (possibly empty)
|
|
248
|
+
* icon when the active symbol preset has none.
|
|
249
|
+
*/
|
|
250
|
+
getLangIconStyled(lang: string | undefined): string;
|
|
244
251
|
}
|
|
245
252
|
export declare function getAvailableThemes(): Promise<string[]>;
|
|
246
253
|
export interface ThemeInfo {
|
|
@@ -141,8 +141,6 @@ export interface InteractiveModeContext {
|
|
|
141
141
|
planModePlanFilePath?: string;
|
|
142
142
|
hideThinkingBlock: boolean;
|
|
143
143
|
proseOnlyThinking: boolean;
|
|
144
|
-
pendingImages: ImageContent[];
|
|
145
|
-
pendingImageLinks: (string | undefined)[];
|
|
146
144
|
compactionQueuedMessages: CompactionQueuedMessage[];
|
|
147
145
|
pendingTools: Map<string, ToolExecutionHandle>;
|
|
148
146
|
pendingBashComponents: BashExecutionComponent[];
|
|
@@ -21,7 +21,7 @@ export type MessageBlock = ({
|
|
|
21
21
|
export interface LastCommand {
|
|
22
22
|
kind: "bash" | "eval";
|
|
23
23
|
code: string;
|
|
24
|
-
/** Highlight language: "bash" for bash, "python"/"javascript"
|
|
24
|
+
/** Highlight language: "bash" for bash, or the resolved eval language ("python"/"javascript"/"ruby"/"julia"). */
|
|
25
25
|
language: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small helpers over {@link InteractiveModeContext} shared between
|
|
3
|
+
* {@link UiHelpers} and the input/event controllers, so the live chat surfaces
|
|
4
|
+
* construct components and reset editor state identically.
|
|
5
|
+
*/
|
|
6
|
+
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
7
|
+
import { AssistantMessageComponent } from "../components/assistant-message";
|
|
8
|
+
import type { InteractiveModeContext } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Construct an {@link AssistantMessageComponent} wired to the live context's
|
|
11
|
+
* thinking/image settings. `message` is omitted for the streaming placeholder
|
|
12
|
+
* component and supplied when rendering a persisted turn.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAssistantMessageComponent(ctx: InteractiveModeContext, message?: AssistantMessage): AssistantMessageComponent;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render helpers shared between the live transcript ({@link UiHelpers}) and the
|
|
3
|
+
* file/remote-backed {@link ChatTranscriptBuilder}. Both surfaces build the same
|
|
4
|
+
* transcript rows from persisted message entries; holding the row construction
|
|
5
|
+
* here keeps the two byte-for-byte identical.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
8
|
+
import { type Component } from "@oh-my-pi/pi-tui";
|
|
9
|
+
import { type FileMentionMessage } from "../../session/messages";
|
|
10
|
+
import { TranscriptBlock } from "../components/transcript-container";
|
|
11
|
+
type CustomOrHookMessage = Extract<AgentMessage, {
|
|
12
|
+
role: "custom" | "hookMessage";
|
|
13
|
+
}>;
|
|
14
|
+
type AssistantAgentMessage = Extract<AgentMessage, {
|
|
15
|
+
role: "assistant";
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Render an `async-result` custom message (a completed background bash/task job,
|
|
19
|
+
* or a batch of them) as a transcript block of one "Background job completed"
|
|
20
|
+
* row per job.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildAsyncResultBlock(message: CustomOrHookMessage): TranscriptBlock;
|
|
23
|
+
/**
|
|
24
|
+
* Render a live IRC traffic custom message (`irc:incoming` / `irc:autoreply` /
|
|
25
|
+
* `irc:relay`) as a transcript card. `getExpanded` supplies the live
|
|
26
|
+
* expanded-state getter for the cached card.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: () => boolean): Component;
|
|
29
|
+
/**
|
|
30
|
+
* Render a `fileMention` message's files as a transcript block of "Read <path>"
|
|
31
|
+
* rows. `indent` sets the left pad: the live chat renders within an outer gutter
|
|
32
|
+
* (0), the transcript viewer renders body rows without one so rows own their pad
|
|
33
|
+
* (1).
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildFileMentionBlock(files: FileMentionMessage["files"], indent: number): TranscriptBlock;
|
|
36
|
+
/**
|
|
37
|
+
* Whether an assistant turn has visible text or thinking content (after
|
|
38
|
+
* canonicalization) — i.e. content that closes the current read-tool run.
|
|
39
|
+
*/
|
|
40
|
+
export declare function assistantHasVisibleContent(message: AssistantAgentMessage): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize raw tool-call arguments to a plain record, collapsing non-object or
|
|
43
|
+
* array values to an empty object.
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizeToolArgs(args: unknown): Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the inline error label, if any, for a turn-ending assistant message.
|
|
48
|
+
* Silent aborts yield no label. `retryAttempt` tunes the abort label wording.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveAssistantErrorMessage(message: AssistantAgentMessage, retryAttempt?: number): {
|
|
51
|
+
hasErrorStop: boolean;
|
|
52
|
+
errorMessage: string | null;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ export interface CreateAgentSessionOptions {
|
|
|
128
128
|
mcpManager?: MCPManager;
|
|
129
129
|
/** Enable LSP integration (tool, formatting, diagnostics, warmup). Default: true */
|
|
130
130
|
enableLsp?: boolean;
|
|
131
|
-
/** Skip
|
|
131
|
+
/** Skip subprocess-kernel availability checks and prelude warmup */
|
|
132
132
|
skipPythonPreflight?: boolean;
|
|
133
133
|
/** Tool names explicitly requested (enables disabled-by-default tools) */
|
|
134
134
|
toolNames?: string[];
|
|
@@ -200,7 +200,7 @@ export interface AgentSessionConfig {
|
|
|
200
200
|
obfuscator?: SecretObfuscator;
|
|
201
201
|
/** Inherited eval executor session id from a parent agent. */
|
|
202
202
|
parentEvalSessionId?: string;
|
|
203
|
-
/** Logical owner for retained
|
|
203
|
+
/** Logical owner for retained eval kernels created by this session. */
|
|
204
204
|
evalKernelOwnerId?: string;
|
|
205
205
|
/**
|
|
206
206
|
* AsyncJobManager that this session installed as the process-global instance.
|
|
@@ -461,7 +461,7 @@ export declare class AgentSession {
|
|
|
461
461
|
get isDisposed(): boolean;
|
|
462
462
|
/**
|
|
463
463
|
* Synchronously mark the session as disposing so new work is rejected
|
|
464
|
-
* immediately:
|
|
464
|
+
* immediately: eval starts throw, queued asides are dropped, and the
|
|
465
465
|
* aside provider is detached. Idempotent; `dispose()` runs it first.
|
|
466
466
|
*
|
|
467
467
|
* Wrappers that await other teardown before delegating to `dispose()` MUST
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SpawnedSubprocess, type WorkerHandle } from "../subprocess/worker-client";
|
|
2
2
|
import type { SttProgressEvent, SttWorkerInbound, SttWorkerOutbound } from "./asr-protocol";
|
|
3
3
|
import type { SttModelKey } from "./models";
|
|
4
|
-
/**
|
|
5
|
-
* Abstraction over the speech-recognition subprocess. Modelled as a worker
|
|
6
|
-
* interface so the parent composes lifecycle, ping/pong, and request/response
|
|
7
|
-
* correlation uniformly; the runtime implementation is a Bun child process so
|
|
8
|
-
* `onnxruntime-node`'s NAPI finalizer never runs inside the main agent address
|
|
9
|
-
* space — that destructor segfaults Bun on shutdown (issue #1606).
|
|
10
|
-
*/
|
|
11
|
-
interface WorkerHandle {
|
|
12
|
-
send(message: SttWorkerInbound): void;
|
|
13
|
-
onMessage(handler: (message: SttWorkerOutbound) => void): () => void;
|
|
14
|
-
onError(handler: (error: Error) => void): () => void;
|
|
15
|
-
terminate(): Promise<void>;
|
|
16
|
-
}
|
|
17
4
|
export interface SttTranscribeOptions {
|
|
18
5
|
language?: string;
|
|
19
6
|
signal?: AbortSignal;
|
|
@@ -44,26 +31,14 @@ export interface SttStreamOptions {
|
|
|
44
31
|
* the spawned subprocess. Kept in sync with the dispatch in `cli.ts`.
|
|
45
32
|
*/
|
|
46
33
|
export declare const STT_WORKER_ARG = "__omp_worker_stt";
|
|
47
|
-
interface SpawnedSubprocess {
|
|
48
|
-
proc: Subprocess<"ignore", "ignore", "ignore">;
|
|
49
|
-
inbound: Set<(message: SttWorkerOutbound) => void>;
|
|
50
|
-
errors: Set<(error: Error) => void>;
|
|
51
|
-
/**
|
|
52
|
-
* Flipped to `true` right before the parent SIGKILLs the child so `onExit`
|
|
53
|
-
* can distinguish the expected hard-kill from a crash/OOM/external signal.
|
|
54
|
-
*/
|
|
55
|
-
intentionalExit: {
|
|
56
|
-
value: boolean;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
34
|
/**
|
|
60
35
|
* Spawn the speech worker as a subprocess. Exported for tests and the smoke
|
|
61
36
|
* probe; production callers go through {@link spawnSttWorker}.
|
|
62
37
|
*/
|
|
63
|
-
export declare function createSttSubprocess(): SpawnedSubprocess
|
|
38
|
+
export declare function createSttSubprocess(): SpawnedSubprocess<SttWorkerOutbound>;
|
|
64
39
|
export declare class SttClient {
|
|
65
40
|
#private;
|
|
66
|
-
constructor(spawnWorker?: () => WorkerHandle);
|
|
41
|
+
constructor(spawnWorker?: () => WorkerHandle<SttWorkerInbound, SttWorkerOutbound>);
|
|
67
42
|
onProgress(listener: (event: SttProgressEvent) => void): () => void;
|
|
68
43
|
/**
|
|
69
44
|
* Transcribe 16 kHz mono audio on the warm worker. Rejects with the worker
|
|
@@ -87,4 +62,3 @@ export declare function shutdownSttClient(): Promise<void>;
|
|
|
87
62
|
export declare function smokeTestSttWorker({ timeoutMs, }?: {
|
|
88
63
|
timeoutMs?: number;
|
|
89
64
|
}): Promise<void>;
|
|
90
|
-
export {};
|