@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,149 @@
|
|
|
1
|
+
import type { Subprocess } from "bun";
|
|
2
|
+
/**
|
|
3
|
+
* Shared lifecycle scaffolding for the ONNX inference subprocess clients
|
|
4
|
+
* (mnemopi embeddings, speech-to-text, tiny-model titles/completions, TTS).
|
|
5
|
+
* Each runs `onnxruntime-node` inside a dedicated Bun child process so the NAPI
|
|
6
|
+
* constructor/finalizer never executes in the main agent address space — those
|
|
7
|
+
* destructors segfault Bun on shutdown (issues #1606 / #1607 / #3031).
|
|
8
|
+
*
|
|
9
|
+
* Only the genuinely identical pieces live here: the worker-handle shape, the
|
|
10
|
+
* spawn-command resolution, the parent-env snapshot, the `Bun.spawn` wiring,
|
|
11
|
+
* the inline "worker unavailable" stub, and the ping/pong smoke probe. Each
|
|
12
|
+
* client keeps its own divergent request/response correlation, streaming, and
|
|
13
|
+
* teardown semantics.
|
|
14
|
+
*/
|
|
15
|
+
/** Minimal inbound contract shared by every worker: a correlated `ping`. */
|
|
16
|
+
export type WorkerInboundBase = {
|
|
17
|
+
type: "ping";
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
/** Structured log line forwarded from a worker to the parent logger. */
|
|
21
|
+
export type WorkerLogMessage = {
|
|
22
|
+
type: "log";
|
|
23
|
+
level: "debug" | "warn" | "error";
|
|
24
|
+
msg: string;
|
|
25
|
+
meta?: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
/** Minimal outbound contract shared by every worker: `pong`, `error`, `log`. */
|
|
28
|
+
export type WorkerOutboundBase = {
|
|
29
|
+
type: "pong";
|
|
30
|
+
id: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: "error";
|
|
33
|
+
id: string;
|
|
34
|
+
error: string;
|
|
35
|
+
} | WorkerLogMessage;
|
|
36
|
+
/**
|
|
37
|
+
* Parent-side view of a worker subprocess: send typed inbound messages,
|
|
38
|
+
* subscribe to outbound messages and worker errors, and hard-terminate.
|
|
39
|
+
*/
|
|
40
|
+
export interface WorkerHandle<Inbound, Outbound> {
|
|
41
|
+
send(message: Inbound): void;
|
|
42
|
+
onMessage(handler: (message: Outbound) => void): () => void;
|
|
43
|
+
onError(handler: (error: Error) => void): () => void;
|
|
44
|
+
terminate(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A {@link WorkerHandle} that can also be (un)referenced so a pending request
|
|
48
|
+
* keeps the parent event loop alive while an idle worker never blocks exit.
|
|
49
|
+
*/
|
|
50
|
+
export interface RefCountedWorkerHandle<Inbound, Outbound> extends WorkerHandle<Inbound, Outbound> {
|
|
51
|
+
/** Re-reference the subprocess so a pending request keeps the parent event loop alive. */
|
|
52
|
+
ref(): void;
|
|
53
|
+
/** Drop the reference once the worker is idle so it never blocks process exit. */
|
|
54
|
+
unref(): void;
|
|
55
|
+
}
|
|
56
|
+
/** The raw spawned subprocess plus the parent-side fan-out sets. */
|
|
57
|
+
export interface SpawnedSubprocess<Outbound> {
|
|
58
|
+
proc: Subprocess<"ignore", "ignore", "ignore">;
|
|
59
|
+
inbound: Set<(message: Outbound) => void>;
|
|
60
|
+
errors: Set<(error: Error) => void>;
|
|
61
|
+
/**
|
|
62
|
+
* Flipped to `true` right before the deliberate SIGKILL so `onExit` can
|
|
63
|
+
* distinguish the expected hard-kill from a crash (SIGSEGV from a native
|
|
64
|
+
* fault, OOM SIGKILL, operator `kill -9`). Only the latter surfaces as a
|
|
65
|
+
* worker error so callers don't await forever.
|
|
66
|
+
*/
|
|
67
|
+
intentionalExit: {
|
|
68
|
+
value: boolean;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface WorkerSpawnCommand {
|
|
72
|
+
cmd: string[];
|
|
73
|
+
cwd?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Cold-starting a worker from a compiled binary (decompress + module graph
|
|
77
|
+
* load) is slow on contended CI runners; the probe only proves the worker
|
|
78
|
+
* spawns and ponges, so a generous bound removes flakes without weakening it.
|
|
79
|
+
*/
|
|
80
|
+
export declare const SMOKE_TEST_TIMEOUT_MS = 30000;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve the command used to relaunch the agent CLI into worker mode. In a
|
|
83
|
+
* compiled binary the entry point is the binary itself; otherwise re-enter the
|
|
84
|
+
* declared worker-host entry with a cwd-relative script path (Bun's subprocess
|
|
85
|
+
* IPC is more reliable that way under `bun test`), falling back to this
|
|
86
|
+
* package's own `src/cli.ts` when no host entry is declared (bun test, SDK
|
|
87
|
+
* embedding).
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveWorkerSpawnCmd(workerArg: string): WorkerSpawnCommand;
|
|
90
|
+
/**
|
|
91
|
+
* Snapshot the parent environment for the child. `process.env` carries
|
|
92
|
+
* `undefined` slots that `Bun.spawn` rejects, so filter them out; an optional
|
|
93
|
+
* `overlay` (e.g. the tiny-model device/dtype vars) wins over inherited keys.
|
|
94
|
+
*/
|
|
95
|
+
export declare function workerEnvFromParent(overlay?: Record<string, string>): Record<string, string>;
|
|
96
|
+
/**
|
|
97
|
+
* Spawn an inference worker subprocess and wire its IPC fan-out. The child
|
|
98
|
+
* inherits no stdio (native model runtimes may otherwise print progress or
|
|
99
|
+
* decoded text and corrupt the chat scrollback) and is `unref`'d outside `bun
|
|
100
|
+
* test` so an idle worker never blocks process exit. `exitLabel` prefixes the
|
|
101
|
+
* worker-error message surfaced for an unexpected (non-intentional) exit.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createWorkerSubprocess<Outbound>(options: {
|
|
104
|
+
spawnCommand: WorkerSpawnCommand;
|
|
105
|
+
env: Record<string, string>;
|
|
106
|
+
exitLabel: string;
|
|
107
|
+
}): SpawnedSubprocess<Outbound>;
|
|
108
|
+
/**
|
|
109
|
+
* Wrap a {@link SpawnedSubprocess} as a {@link WorkerHandle}. The `send`
|
|
110
|
+
* strategy is injected so each client keeps its exact IPC-send behaviour (e.g.
|
|
111
|
+
* `safeSend` vs an inline guarded `proc.send`). `terminate()` SIGKILLs: the
|
|
112
|
+
* point of subprocess isolation is that the parent never runs
|
|
113
|
+
* `onnxruntime-node`'s NAPI finalizer (it crashes Bun on Windows), so the OS
|
|
114
|
+
* reclaims the model memory instead. The intentional-exit flag is flipped
|
|
115
|
+
* *before* the kill so `onExit` can tell it apart from a native crash.
|
|
116
|
+
*/
|
|
117
|
+
export declare function createWorkerHandle<Inbound, Outbound>(spawned: SpawnedSubprocess<Outbound>, send: (message: Inbound) => void): WorkerHandle<Inbound, Outbound>;
|
|
118
|
+
/**
|
|
119
|
+
* A stand-in handle used when the worker subprocess cannot be spawned. It
|
|
120
|
+
* ponges `ping` (so the smoke probe and readiness checks still resolve) and
|
|
121
|
+
* answers every other request with the spawn error so callers fail fast
|
|
122
|
+
* instead of awaiting forever.
|
|
123
|
+
*/
|
|
124
|
+
export declare function createUnavailableWorker<Inbound extends {
|
|
125
|
+
type: string;
|
|
126
|
+
id: string;
|
|
127
|
+
}, Outbound extends {
|
|
128
|
+
type: string;
|
|
129
|
+
}>(error: unknown): WorkerHandle<Inbound, Outbound>;
|
|
130
|
+
/**
|
|
131
|
+
* Spawn a worker handle, falling back to {@link createUnavailableWorker} (after
|
|
132
|
+
* a warning) when the subprocess cannot be created so the feature degrades
|
|
133
|
+
* gracefully instead of throwing into callers.
|
|
134
|
+
*/
|
|
135
|
+
export declare function spawnWorkerOrUnavailable<Handle>(spawn: () => Handle, unavailable: (error: unknown) => Handle, warnMessage: string): Handle;
|
|
136
|
+
/** Forward a worker's structured `log` message to the matching logger level. */
|
|
137
|
+
export declare function logWorkerMessage(message: WorkerLogMessage): void;
|
|
138
|
+
/**
|
|
139
|
+
* Drive the ping/pong readiness probe wired into `omp --smoke-test`: send one
|
|
140
|
+
* `ping`, resolve on the first `pong` (ignoring `log` chatter), and reject on
|
|
141
|
+
* any other message, a worker error, or the timeout. Always tears the handle
|
|
142
|
+
* down on the way out. `label` prefixes the failure messages.
|
|
143
|
+
*/
|
|
144
|
+
export declare function smokeTestWorker<Inbound extends {
|
|
145
|
+
type: string;
|
|
146
|
+
id: string;
|
|
147
|
+
}, Outbound extends {
|
|
148
|
+
type: string;
|
|
149
|
+
}>(handle: WorkerHandle<Inbound, Outbound>, label: string, timeoutMs: number): Promise<void>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ProgressInfo } from "@huggingface/transformers";
|
|
2
|
+
/**
|
|
3
|
+
* Child-side scaffolding shared by the ONNX inference worker bodies
|
|
4
|
+
* (`stt/asr-worker`, `tiny/worker`, `tts/tts-worker`). These are the helpers
|
|
5
|
+
* that run inside the spawned subprocess: error serialization, structured log
|
|
6
|
+
* and progress reporting over the worker's typed transport, side-runtime
|
|
7
|
+
* install (sharp stubbing + module-resolver patch), once-per-process runtime
|
|
8
|
+
* memoization, and the Transformers.js runtime loader. The parent/client-side
|
|
9
|
+
* complement lives in `worker-client.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Each worker keeps its own strongly-typed transport / model-key / progress
|
|
12
|
+
* event; the structural {@link WorkerLogTransport} / {@link WorkerProgressTransport}
|
|
13
|
+
* interfaces below are the minimal shapes these helpers need, and every worker's
|
|
14
|
+
* concrete transport satisfies them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TRANSFORMERS_PACKAGE = "@huggingface/transformers";
|
|
17
|
+
export declare function errorText(error: unknown): string;
|
|
18
|
+
export declare function errorMessage(error: unknown): string;
|
|
19
|
+
export type WorkerLogLevel = "debug" | "warn" | "error";
|
|
20
|
+
/** Minimal transport surface a worker exposes for forwarding log lines. */
|
|
21
|
+
export interface WorkerLogTransport {
|
|
22
|
+
send(message: {
|
|
23
|
+
type: "log";
|
|
24
|
+
level: WorkerLogLevel;
|
|
25
|
+
msg: string;
|
|
26
|
+
meta?: Record<string, unknown>;
|
|
27
|
+
}): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function sendLog(transport: WorkerLogTransport, level: WorkerLogLevel, msg: string, meta?: Record<string, unknown>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Generic worker progress event. Each worker's protocol declares an identical
|
|
32
|
+
* shape with its own `modelKey` type; this is the parameterized version the
|
|
33
|
+
* shared helpers emit, structurally assignable to each protocol's event.
|
|
34
|
+
*/
|
|
35
|
+
export interface WorkerProgressEvent<K> {
|
|
36
|
+
modelKey: K;
|
|
37
|
+
status: "initiate" | "download" | "progress" | "progress_total" | "done" | "ready" | "error";
|
|
38
|
+
name?: string;
|
|
39
|
+
file?: string;
|
|
40
|
+
progress?: number;
|
|
41
|
+
loaded?: number;
|
|
42
|
+
total?: number;
|
|
43
|
+
files?: Record<string, {
|
|
44
|
+
loaded: number;
|
|
45
|
+
total: number;
|
|
46
|
+
}>;
|
|
47
|
+
task?: string;
|
|
48
|
+
model?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Minimal transport surface a worker exposes for emitting progress events. */
|
|
51
|
+
export interface WorkerProgressTransport<K> {
|
|
52
|
+
send(message: {
|
|
53
|
+
type: "progress";
|
|
54
|
+
id: string;
|
|
55
|
+
event: WorkerProgressEvent<K>;
|
|
56
|
+
}): void;
|
|
57
|
+
}
|
|
58
|
+
export declare function sendProgress<K>(transport: WorkerProgressTransport<K>, id: string, modelKey: K, info: ProgressInfo): void;
|
|
59
|
+
/**
|
|
60
|
+
* If a model is already warming/warm in `cache`, replay a `ready` progress
|
|
61
|
+
* event for this request once it resolves and return the cached promise so the
|
|
62
|
+
* caller can short-circuit; otherwise return `undefined`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function replayCachedReady<K, M>(cache: Map<K, Promise<M>>, modelKey: K, transport: WorkerProgressTransport<K>, requestId: string, task: string, model: string): Promise<M> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Stub `sharp` (the speech/text pipelines are not image codecs, so the native
|
|
67
|
+
* image dependency is dead weight) and patch the module resolver so a side
|
|
68
|
+
* runtime's bare requires resolve against its own `node_modules`. Returns the
|
|
69
|
+
* runtime's `node_modules` directory.
|
|
70
|
+
*/
|
|
71
|
+
export declare function installSharpStubResolver(runtimeDir: string): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Lazily resolve (and memoize) the transformers version spec. In the `catalog:`
|
|
74
|
+
* case {@link resolveTransformersVersionSpec} `require`s the installed
|
|
75
|
+
* `@huggingface/transformers/package.json`, so it is only ever touched on the
|
|
76
|
+
* compiled-binary runtime-install path — loading a worker (smoke-test ping,
|
|
77
|
+
* online path) never triggers the transformers resolve/install dance.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getTransformersVersionSpec(): string;
|
|
80
|
+
/** The subset of the Transformers.js module surface {@link configureTransformers} touches. */
|
|
81
|
+
interface ConfigurableTransformers {
|
|
82
|
+
env: {
|
|
83
|
+
cacheDir?: string;
|
|
84
|
+
allowLocalModels?: boolean;
|
|
85
|
+
logLevel?: unknown;
|
|
86
|
+
};
|
|
87
|
+
LogLevel: {
|
|
88
|
+
ERROR: unknown;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Memoize an async runtime load so it runs at most once per process, clearing
|
|
93
|
+
* the cache on failure so a later call can retry. Each worker holds one
|
|
94
|
+
* instance per runtime it loads.
|
|
95
|
+
*/
|
|
96
|
+
export declare class MemoizedRuntime<T> {
|
|
97
|
+
#private;
|
|
98
|
+
load(build: () => Promise<T>): Promise<T>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Load the `@huggingface/transformers` runtime into `holder` (memoized): from
|
|
102
|
+
* the ambient install when running from source, or from a version-keyed side
|
|
103
|
+
* runtime (resolved lazily at `runtimeDir()`) when running as a compiled binary.
|
|
104
|
+
* The result is cast to the caller's concrete runtime type `T`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function loadTransformersRuntime<T extends ConfigurableTransformers, K>(holder: MemoizedRuntime<T>, transport: WorkerProgressTransport<K>, requestId: string, modelKey: K, runtimeDir: () => string): Promise<T>;
|
|
107
|
+
export {};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SpawnedSubprocess, type WorkerHandle } from "../subprocess/worker-client";
|
|
2
2
|
import type { TinyTitleProgressEvent, TinyTitleWorkerInbound, TinyTitleWorkerOutbound } from "./title-protocol";
|
|
3
|
-
/**
|
|
4
|
-
* Abstraction over the tiny-model subprocess. Modelled as a worker interface
|
|
5
|
-
* so existing callers (titles, memory completions, downloads) compose the
|
|
6
|
-
* same way; the runtime implementation is a Bun child process so
|
|
7
|
-
* `onnxruntime-node`'s NAPI finalizer never runs inside the main agent
|
|
8
|
-
* address space — that destructor segfaults Bun on Windows during shutdown
|
|
9
|
-
* (issue #1606).
|
|
10
|
-
*/
|
|
11
|
-
interface WorkerHandle {
|
|
12
|
-
send(message: TinyTitleWorkerInbound): void;
|
|
13
|
-
onMessage(handler: (message: TinyTitleWorkerOutbound) => void): () => void;
|
|
14
|
-
onError(handler: (error: Error) => void): () => void;
|
|
15
|
-
terminate(): Promise<void>;
|
|
16
|
-
}
|
|
17
3
|
export interface TinyTitleDownloadOptions {
|
|
18
4
|
signal?: AbortSignal;
|
|
19
5
|
onProgress?: (event: TinyTitleProgressEvent) => void;
|
|
@@ -41,29 +27,24 @@ export declare const TINY_WORKER_ARG = "__omp_worker_tiny_inference";
|
|
|
41
27
|
* @internal
|
|
42
28
|
*/
|
|
43
29
|
export declare function tinyWorkerEnvOverlay(env: Record<string, string | undefined>, deviceSetting: string | undefined, dtypeSetting: string | undefined): Record<string, string>;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
intentionalExit: {
|
|
55
|
-
value: boolean;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
30
|
+
/**
|
|
31
|
+
* Env handed to the tiny-model subprocess — and reused verbatim by the STT and
|
|
32
|
+
* TTS workers, which share the same device/dtype resolution. The
|
|
33
|
+
* `PI_TINY_DEVICE` / `PI_TINY_DTYPE` env vars win; otherwise the persisted
|
|
34
|
+
* `providers.tinyModelDevice` / `providers.tinyModelDtype` settings are mapped
|
|
35
|
+
* onto those vars so the subprocess's env-based resolution picks them up.
|
|
36
|
+
* Resolved once at spawn (pipelines are cached for the lifetime of the
|
|
37
|
+
* subprocess).
|
|
38
|
+
*/
|
|
39
|
+
export declare function tinyWorkerEnv(): Record<string, string>;
|
|
58
40
|
/**
|
|
59
41
|
* Spawn the tiny-model worker as a subprocess. Exported for tests and the
|
|
60
|
-
* smoke probe; production callers go through {@link spawnTinyTitleWorker}
|
|
61
|
-
* which wraps the result in a {@link WorkerHandle}.
|
|
42
|
+
* smoke probe; production callers go through {@link spawnTinyTitleWorker}.
|
|
62
43
|
*/
|
|
63
|
-
export declare function createTinyTitleSubprocess(): SpawnedSubprocess
|
|
44
|
+
export declare function createTinyTitleSubprocess(): SpawnedSubprocess<TinyTitleWorkerOutbound>;
|
|
64
45
|
export declare class TinyTitleClient {
|
|
65
46
|
#private;
|
|
66
|
-
constructor(spawnWorker?: () => WorkerHandle);
|
|
47
|
+
constructor(spawnWorker?: () => WorkerHandle<TinyTitleWorkerInbound, TinyTitleWorkerOutbound>);
|
|
67
48
|
onProgress(listener: (event: TinyTitleProgressEvent) => void): () => void;
|
|
68
49
|
generate(modelKey: string, message: string, signal?: AbortSignal): Promise<string | null>;
|
|
69
50
|
generate(modelKey: string, message: string, options?: TinyTitleGenerateOptions): Promise<string | null>;
|
|
@@ -81,4 +62,3 @@ export declare function shutdownTinyTitleClient(): Promise<void>;
|
|
|
81
62
|
export declare function smokeTestTinyTitleWorker({ timeoutMs, }?: {
|
|
82
63
|
timeoutMs?: number;
|
|
83
64
|
}): Promise<void>;
|
|
84
|
-
export {};
|
|
@@ -2,11 +2,14 @@ import type { ToolSession } from ".";
|
|
|
2
2
|
export interface EvalBackendsAllowance {
|
|
3
3
|
python: boolean;
|
|
4
4
|
js: boolean;
|
|
5
|
+
ruby: boolean;
|
|
6
|
+
julia: boolean;
|
|
5
7
|
}
|
|
6
|
-
/** Read per-backend allowance from settings (
|
|
8
|
+
/** Read per-backend allowance from settings (py/js default on; rb/jl opt-in, default off). */
|
|
7
9
|
export declare function readEvalBackendsAllowance(session: ToolSession): EvalBackendsAllowance;
|
|
8
10
|
/**
|
|
9
|
-
* Materialize the active eval backend allowance: PI_PY / PI_JS
|
|
10
|
-
* override the per-key settings; otherwise settings (
|
|
11
|
+
* Materialize the active eval backend allowance: PI_PY / PI_JS / PI_RB / PI_JL
|
|
12
|
+
* env flags override the per-key settings; otherwise settings win (py/js default
|
|
13
|
+
* on, rb/jl default off).
|
|
11
14
|
*/
|
|
12
15
|
export declare function resolveEvalBackends(session: ToolSession): EvalBackendsAllowance;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* TUI rendering for the eval tool.
|
|
3
3
|
*
|
|
4
4
|
* Split out from `eval.ts` so the renderer can be imported by `renderers.ts`
|
|
5
|
-
* without dragging the eval *runtime* (JS/Python backends ->
|
|
6
|
-
* task executor -> sdk -> extension loader -> root barrel)
|
|
7
|
-
* module graph. That transitive chain re-enters
|
|
8
|
-
* is still initializing, which previously
|
|
9
|
-
* `Cannot access 'evalToolRenderer' before
|
|
5
|
+
* without dragging the eval *runtime* (JS/Python/Ruby/Julia backends ->
|
|
6
|
+
* agent bridge -> task executor -> sdk -> extension loader -> root barrel)
|
|
7
|
+
* into the renderer module graph. That transitive chain re-enters
|
|
8
|
+
* `renderers.ts` while `eval.ts` is still initializing, which previously
|
|
9
|
+
* crashed module load with a TDZ `Cannot access 'evalToolRenderer' before
|
|
10
|
+
* initialization`.
|
|
10
11
|
*/
|
|
11
12
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
12
13
|
import type { EvalStatusEvent, EvalToolDetails } from "../eval/types";
|
|
@@ -3,25 +3,29 @@ import type { ToolExample } from "@oh-my-pi/pi-ai";
|
|
|
3
3
|
import type { EvalToolDetails } from "../eval/types";
|
|
4
4
|
import type { ToolSession } from ".";
|
|
5
5
|
export { EVAL_DEFAULT_PREVIEW_LINES, evalToolRenderer } from "./eval-render";
|
|
6
|
+
/** Language tokens the eval tool accepts, in stable display order. */
|
|
7
|
+
export type EvalLanguageToken = "py" | "js" | "rb" | "jl";
|
|
6
8
|
/**
|
|
7
9
|
* Per-cell input. Each cell runs in order; state persists within a language
|
|
8
|
-
* across cells and across tool calls.
|
|
10
|
+
* across cells and across tool calls. This static schema carries the full
|
|
11
|
+
* language union for typing; {@link buildEvalSchema} narrows the wire copy per
|
|
12
|
+
* session so disabled backends are never advertised to the model.
|
|
9
13
|
*/
|
|
10
14
|
declare const evalCellSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
11
|
-
language: "js" | "py";
|
|
12
|
-
code: string;
|
|
13
15
|
title?: string | undefined;
|
|
14
16
|
timeout?: number | undefined;
|
|
15
17
|
reset?: boolean | undefined;
|
|
18
|
+
language: "jl" | "js" | "py" | "rb";
|
|
19
|
+
code: string;
|
|
16
20
|
}, {}>;
|
|
17
21
|
export type EvalCellInput = typeof evalCellSchema.infer;
|
|
18
22
|
export declare const evalSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
19
23
|
cells: {
|
|
20
|
-
language: "js" | "py";
|
|
21
|
-
code: string;
|
|
22
24
|
title?: string | undefined;
|
|
23
25
|
timeout?: number | undefined;
|
|
24
26
|
reset?: boolean | undefined;
|
|
27
|
+
language: "jl" | "js" | "py" | "rb";
|
|
28
|
+
code: string;
|
|
25
29
|
}[];
|
|
26
30
|
}, {}>;
|
|
27
31
|
export type EvalToolParams = typeof evalSchema.infer;
|
|
@@ -36,6 +40,8 @@ export type EvalProxyExecutor = (params: EvalToolParams, signal?: AbortSignal) =
|
|
|
36
40
|
export interface EvalToolDescriptionOptions {
|
|
37
41
|
py?: boolean;
|
|
38
42
|
js?: boolean;
|
|
43
|
+
rb?: boolean;
|
|
44
|
+
jl?: boolean;
|
|
39
45
|
/**
|
|
40
46
|
* Whether `agent()` is allowed in this session. Driven by the parent's
|
|
41
47
|
* spawn policy (`getSessionSpawns`). Defaults to `true` for backward
|
|
@@ -55,20 +61,12 @@ export declare class EvalTool implements AgentTool<typeof evalSchema> {
|
|
|
55
61
|
readonly name = "eval";
|
|
56
62
|
readonly approval: "exec";
|
|
57
63
|
readonly formatApprovalDetails: (args: unknown) => string[];
|
|
58
|
-
|
|
64
|
+
get summary(): string;
|
|
59
65
|
readonly loadMode = "discoverable";
|
|
60
66
|
readonly label = "Eval";
|
|
61
67
|
get description(): string;
|
|
62
68
|
readonly examples: readonly ToolExample<typeof evalSchema.infer>[];
|
|
63
|
-
|
|
64
|
-
cells: {
|
|
65
|
-
language: "js" | "py";
|
|
66
|
-
code: string;
|
|
67
|
-
title?: string | undefined;
|
|
68
|
-
timeout?: number | undefined;
|
|
69
|
-
reset?: boolean | undefined;
|
|
70
|
-
}[];
|
|
71
|
-
}, {}>;
|
|
69
|
+
get parameters(): typeof evalSchema;
|
|
72
70
|
readonly concurrency = "exclusive";
|
|
73
71
|
readonly strict = true;
|
|
74
72
|
readonly intent: (args: Partial<typeof evalSchema.infer>) => string | undefined;
|
|
@@ -115,7 +115,7 @@ export interface ToolSession {
|
|
|
115
115
|
suppressSpawnAdvisory?: boolean;
|
|
116
116
|
/** Optional fetch implementation injected into the URL read pipeline (tests, proxies). Defaults to global fetch. */
|
|
117
117
|
fetch?: FetchImpl;
|
|
118
|
-
/** Skip
|
|
118
|
+
/** Skip subprocess-kernel availability checks and warmup */
|
|
119
119
|
skipPythonPreflight?: boolean;
|
|
120
120
|
/** Pre-loaded context files (AGENTS.md, etc) */
|
|
121
121
|
contextFiles?: ContextFileEntry[];
|
|
@@ -152,13 +152,13 @@ export interface ToolSession {
|
|
|
152
152
|
requireYieldTool?: boolean;
|
|
153
153
|
/** Task recursion depth (0 = top-level, 1 = first child, etc.) */
|
|
154
154
|
taskDepth?: number;
|
|
155
|
-
/** Get shared eval executor session ID. Subagents inherit this to share JS/Python state. */
|
|
155
|
+
/** Get shared eval executor session ID. Subagents inherit this to share JS/Python/Ruby/Julia state. */
|
|
156
156
|
getEvalSessionId?: () => string | null;
|
|
157
157
|
/** Get session file */
|
|
158
158
|
getSessionFile: () => string | null;
|
|
159
159
|
/** Get eval kernel owner ID for session-scoped retained-kernel cleanup. */
|
|
160
160
|
getEvalKernelOwnerId?: () => string | null;
|
|
161
|
-
/** Reject new eval
|
|
161
|
+
/** Reject new eval work once session disposal has started. */
|
|
162
162
|
assertEvalExecutionAllowed?: () => void;
|
|
163
163
|
/** Track tool-owned eval work so session disposal can await/abort it like direct session eval runs. */
|
|
164
164
|
trackEvalExecution?<T>(execution: Promise<T>, abortController: AbortController): Promise<T>;
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RefCountedWorkerHandle, type SpawnedSubprocess } from "../subprocess/worker-client";
|
|
2
2
|
import type { TtsProgressEvent, TtsWorkerInbound, TtsWorkerOutbound } from "./tts-protocol";
|
|
3
3
|
/** Decoded PCM returned by a local synthesis request. */
|
|
4
4
|
export interface TtsAudio {
|
|
5
5
|
pcm: Float32Array;
|
|
6
6
|
sampleRate: number;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Abstraction over the TTS subprocess. The runtime implementation is a Bun child
|
|
10
|
-
* process so `onnxruntime-node`'s NAPI finalizer never runs inside the main agent
|
|
11
|
-
* address space — that destructor segfaults Bun during shutdown (issue #1606).
|
|
12
|
-
*/
|
|
13
|
-
interface WorkerHandle {
|
|
14
|
-
send(message: TtsWorkerInbound): void;
|
|
15
|
-
onMessage(handler: (message: TtsWorkerOutbound) => void): () => void;
|
|
16
|
-
onError(handler: (error: Error) => void): () => void;
|
|
17
|
-
/** Re-reference the subprocess so a pending request keeps the parent event loop alive. */
|
|
18
|
-
ref(): void;
|
|
19
|
-
/** Drop the reference once the worker is idle so it never blocks process exit. */
|
|
20
|
-
unref(): void;
|
|
21
|
-
terminate(): Promise<void>;
|
|
22
|
-
}
|
|
23
8
|
export interface TtsSynthesizeOptions {
|
|
24
9
|
voice?: string;
|
|
25
10
|
signal?: AbortSignal;
|
|
@@ -55,23 +40,14 @@ export interface TtsStreamHandle {
|
|
|
55
40
|
* subprocess. Kept in sync with the dispatch in `cli.ts` (Main-owned).
|
|
56
41
|
*/
|
|
57
42
|
export declare const TTS_WORKER_ARG = "__omp_worker_tts";
|
|
58
|
-
interface SpawnedSubprocess {
|
|
59
|
-
proc: Subprocess<"ignore", "ignore", "ignore">;
|
|
60
|
-
inbound: Set<(message: TtsWorkerOutbound) => void>;
|
|
61
|
-
errors: Set<(error: Error) => void>;
|
|
62
|
-
/** Flipped to `true` right before the deliberate SIGKILL so `onExit` can tell it apart from a crash. */
|
|
63
|
-
intentionalExit: {
|
|
64
|
-
value: boolean;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
43
|
/**
|
|
68
44
|
* Spawn the TTS worker as a subprocess. Exported for tests and the smoke probe;
|
|
69
45
|
* production callers go through {@link spawnTtsWorker}.
|
|
70
46
|
*/
|
|
71
|
-
export declare function createTtsSubprocess(): SpawnedSubprocess
|
|
47
|
+
export declare function createTtsSubprocess(): SpawnedSubprocess<TtsWorkerOutbound>;
|
|
72
48
|
export declare class TtsClient {
|
|
73
49
|
#private;
|
|
74
|
-
constructor(spawnWorker?: () =>
|
|
50
|
+
constructor(spawnWorker?: () => RefCountedWorkerHandle<TtsWorkerInbound, TtsWorkerOutbound>);
|
|
75
51
|
onProgress(listener: (event: TtsProgressEvent) => void): () => void;
|
|
76
52
|
synthesize(modelKey: string, text: string, options?: TtsSynthesizeOptions): Promise<TtsAudio | null>;
|
|
77
53
|
/**
|
|
@@ -90,4 +66,3 @@ export declare function shutdownTtsClient(): Promise<void>;
|
|
|
90
66
|
export declare function smokeTestTtsWorker({ timeoutMs, }?: {
|
|
91
67
|
timeoutMs?: number;
|
|
92
68
|
}): Promise<void>;
|
|
93
|
-
export {};
|
|
@@ -18,6 +18,13 @@ export interface CodeCellOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
codeTail?: boolean;
|
|
20
20
|
expanded?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Prefix the header with the cell's language icon (resolved through the
|
|
23
|
+
* active symbol preset: nerd-font devicon, unicode emoji, or ascii
|
|
24
|
+
* shorthand). Opt-in so only the eval kernel renderer labels each cell;
|
|
25
|
+
* read/write/browser code cells stay icon-free.
|
|
26
|
+
*/
|
|
27
|
+
showLanguage?: boolean;
|
|
21
28
|
width: number;
|
|
22
29
|
codeStartLine?: number;
|
|
23
30
|
codeLineNumbers?: Array<number | null>;
|
|
@@ -10,7 +10,7 @@ export interface FileDisplayModeSession {
|
|
|
10
10
|
/** Whether the edit tool is available. Hashlines are suppressed without it. */
|
|
11
11
|
hasEditTool?: boolean;
|
|
12
12
|
settings: {
|
|
13
|
-
get(key: "readLineNumbers" | "
|
|
13
|
+
get(key: "readLineNumbers" | "edit.mode"): unknown;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type FetchImpl } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import type { AgentStorage } from "../session/agent-storage";
|
|
3
|
+
export declare const PARALLEL_SEARCH_URL = "https://api.parallel.ai/v1beta/search";
|
|
4
|
+
export declare const PARALLEL_BETA_HEADER = "search-extract-2025-10-10";
|
|
3
5
|
export interface ParallelUsageItem {
|
|
4
6
|
name?: string;
|
|
5
7
|
count?: number;
|
|
@@ -55,6 +57,10 @@ export declare class ParallelApiError extends Error {
|
|
|
55
57
|
readonly statusCode?: number;
|
|
56
58
|
constructor(message: string, statusCode?: number);
|
|
57
59
|
}
|
|
60
|
+
export declare function parseParallelErrorResponse(statusCode: number, responseText: string): ParallelApiError;
|
|
61
|
+
export declare function parseParallelSearchPayload(payload: unknown, options?: {
|
|
62
|
+
parseMetadata?: boolean;
|
|
63
|
+
}): ParallelSearchResult;
|
|
58
64
|
export declare function findParallelApiKey(storage: AgentStorage | null | undefined): string | null;
|
|
59
65
|
export declare function getParallelExtractContent(document: ParallelExtractDocument): string;
|
|
60
66
|
export declare function searchWithParallel(objective: string, queries: string[], options: ParallelSearchOptions, storage: AgentStorage | null | undefined): Promise<ParallelSearchResult>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "16.1.
|
|
4
|
+
"version": "16.1.14",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"@agentclientprotocol/sdk": "0.25.0",
|
|
49
49
|
"@babel/parser": "^7.29.7",
|
|
50
50
|
"@mozilla/readability": "^0.6.0",
|
|
51
|
-
"@oh-my-pi/hashline": "16.1.
|
|
52
|
-
"@oh-my-pi/omp-stats": "16.1.
|
|
53
|
-
"@oh-my-pi/pi-agent-core": "16.1.
|
|
54
|
-
"@oh-my-pi/pi-ai": "16.1.
|
|
55
|
-
"@oh-my-pi/pi-catalog": "16.1.
|
|
56
|
-
"@oh-my-pi/pi-mnemopi": "16.1.
|
|
57
|
-
"@oh-my-pi/pi-natives": "16.1.
|
|
58
|
-
"@oh-my-pi/pi-tui": "16.1.
|
|
59
|
-
"@oh-my-pi/pi-utils": "16.1.
|
|
60
|
-
"@oh-my-pi/pi-wire": "16.1.
|
|
61
|
-
"@oh-my-pi/snapcompact": "16.1.
|
|
51
|
+
"@oh-my-pi/hashline": "16.1.14",
|
|
52
|
+
"@oh-my-pi/omp-stats": "16.1.14",
|
|
53
|
+
"@oh-my-pi/pi-agent-core": "16.1.14",
|
|
54
|
+
"@oh-my-pi/pi-ai": "16.1.14",
|
|
55
|
+
"@oh-my-pi/pi-catalog": "16.1.14",
|
|
56
|
+
"@oh-my-pi/pi-mnemopi": "16.1.14",
|
|
57
|
+
"@oh-my-pi/pi-natives": "16.1.14",
|
|
58
|
+
"@oh-my-pi/pi-tui": "16.1.14",
|
|
59
|
+
"@oh-my-pi/pi-utils": "16.1.14",
|
|
60
|
+
"@oh-my-pi/pi-wire": "16.1.14",
|
|
61
|
+
"@oh-my-pi/snapcompact": "16.1.14",
|
|
62
62
|
"@opentelemetry/api": "^1.9.1",
|
|
63
63
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
64
64
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
|