oh-my-knowledge 0.52.3 → 0.54.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/README.md +21 -1
- package/README.zh.md +21 -1
- package/dist/assets/agent-skills/omk/SKILL.md +6 -0
- package/dist/assets/agent-skills/omk/references/commands.md +1 -1
- package/dist/authoring/evolver.js +1 -1
- package/dist/authoring/generator.js +1 -1
- package/dist/cli/commands/eval/index.js +7 -6
- package/dist/cli/commands/install.js +5 -1
- package/dist/cli/lib/generation-failure-hint.js +6 -8
- package/dist/cli/lib/runtime-defaults.d.ts +2 -0
- package/dist/cli/lib/runtime-defaults.js +7 -4
- package/dist/dsh-plugin/cordis.patch.yml +3 -0
- package/dist/dsh-plugin/host-executor.d.ts +93 -0
- package/dist/dsh-plugin/host-executor.js +232 -0
- package/dist/dsh-plugin/index.d.ts +30 -0
- package/dist/dsh-plugin/index.js +275 -0
- package/dist/dsh-plugin/observe.d.ts +47 -0
- package/dist/dsh-plugin/observe.js +359 -0
- package/dist/dsh-plugin/protocol.d.ts +21 -0
- package/dist/dsh-plugin/protocol.js +229 -0
- package/dist/dsh-plugin/trace-adapter.d.ts +48 -0
- package/dist/dsh-plugin/trace-adapter.js +590 -0
- package/dist/eval-core/comparability.js +3 -0
- package/dist/eval-core/evaluation-execution.js +5 -13
- package/dist/eval-core/evaluation-reporting.d.ts +7 -4
- package/dist/eval-core/evaluation-reporting.js +39 -18
- package/dist/eval-core/judge-independence.d.ts +1 -1
- package/dist/eval-core/judge-independence.js +1 -1
- package/dist/eval-core/report-document.js +6 -0
- package/dist/eval-core/resume-compatibility.d.ts +1 -0
- package/dist/eval-core/resume-compatibility.js +5 -4
- package/dist/eval-workflows/batch-evaluation-workflow.js +1 -1
- package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.js +4 -2
- package/dist/eval-workflows/evaluation-pipeline.d.ts +3 -1
- package/dist/eval-workflows/evaluation-pipeline.js +7 -3
- package/dist/eval-workflows/run-evaluation.d.ts +4 -2
- package/dist/eval-workflows/run-evaluation.js +7 -3
- package/dist/executors/{anthropic-api.d.ts → anthropic/api.d.ts} +1 -1
- package/dist/executors/{anthropic-api.js → anthropic/api.js} +4 -2
- package/dist/executors/{claude-cli.d.ts → anthropic/claude/cli.d.ts} +1 -1
- package/dist/executors/{claude-cli.js → anthropic/claude/cli.js} +5 -3
- package/dist/executors/anthropic/claude/protocol.d.ts +87 -0
- package/dist/executors/{claude-protocol.js → anthropic/claude/protocol.js} +6 -6
- package/dist/executors/{claude-sdk.d.ts → anthropic/claude/sdk.d.ts} +2 -2
- package/dist/executors/{claude-sdk.js → anthropic/claude/sdk.js} +8 -5
- package/dist/executors/anthropic/claude/trace.d.ts +9 -0
- package/dist/executors/{claude-sdk-trace.js → anthropic/claude/trace.js} +5 -5
- package/dist/executors/{capabilities.d.ts → core/capabilities.d.ts} +3 -5
- package/dist/executors/{capabilities.js → core/capabilities.js} +4 -11
- package/dist/executors/core/http.d.ts +6 -0
- package/dist/executors/core/http.js +19 -0
- package/dist/executors/core/limits.d.ts +2 -0
- package/dist/executors/core/limits.js +2 -0
- package/dist/executors/core/optional-dependencies.d.ts +7 -0
- package/dist/executors/core/optional-dependencies.js +35 -0
- package/dist/executors/core/registry.d.ts +145 -0
- package/dist/executors/core/registry.js +127 -0
- package/dist/executors/core/runtime-fingerprint.d.ts +13 -0
- package/dist/executors/{runtime-fingerprint.js → core/runtime-fingerprint.js} +119 -59
- package/dist/executors/core/runtime.d.ts +12 -0
- package/dist/executors/core/runtime.js +61 -0
- package/dist/executors/core/subprocess.d.ts +44 -0
- package/dist/executors/{shared.js → core/subprocess.js} +20 -156
- package/dist/executors/index.d.ts +4 -4
- package/dist/executors/index.js +26 -15
- package/dist/executors/{openai-api.d.ts → openai/api.d.ts} +1 -1
- package/dist/executors/{openai-api.js → openai/api.js} +4 -2
- package/dist/executors/{codex-cli.d.ts → openai/codex/cli.d.ts} +3 -3
- package/dist/executors/{codex-cli.js → openai/codex/cli.js} +5 -3
- package/dist/executors/openai/codex/protocol.d.ts +72 -0
- package/dist/executors/{codex-protocol.js → openai/codex/protocol.js} +33 -2
- package/dist/executors/{codex-sdk.d.ts → openai/codex/sdk.d.ts} +18 -4
- package/dist/executors/{codex-sdk.js → openai/codex/sdk.js} +7 -4
- package/dist/executors/{codex-cli-trace.d.ts → openai/codex/trace.d.ts} +2 -2
- package/dist/executors/{codex-cli-trace.js → openai/codex/trace.js} +4 -4
- package/dist/executors/{script.d.ts → script/index.d.ts} +1 -1
- package/dist/executors/{script.js → script/index.js} +6 -4
- package/dist/grading/judge.d.ts +1 -1
- package/dist/grading/judge.js +1 -1
- package/dist/observability/conversation-catalog.js +1 -1
- package/dist/observability/experience.js +4 -0
- package/dist/observability/inbox.d.ts +4 -1
- package/dist/observability/inbox.js +7 -2
- package/dist/observability/trace-ir.d.ts +6 -3
- package/dist/observability/turn-index.js +4 -0
- package/dist/renderer/conversation-renderer.js +20 -6
- package/dist/renderer/html-renderer.js +30 -11
- package/dist/renderer/knowledge-debugger-renderer.js +6 -1
- package/dist/renderer/observation-inbox-renderer.js +2 -2
- package/dist/renderer/trajectory-live.d.ts +1 -0
- package/dist/renderer/trajectory-live.js +5 -2
- package/dist/shared/trace-source-kind.js +1 -0
- package/dist/types/executor.d.ts +13 -2
- package/dist/types/judge.d.ts +2 -2
- package/dist/types/observability.d.ts +1 -1
- package/dist/types/trace.d.ts +1 -1
- package/package.json +25 -5
- package/dist/executors/claude-protocol.d.ts +0 -28
- package/dist/executors/claude-sdk-trace.d.ts +0 -9
- package/dist/executors/codex-protocol.d.ts +0 -24
- package/dist/executors/gemini.d.ts +0 -2
- package/dist/executors/gemini.js +0 -156
- package/dist/executors/runtime-fingerprint.d.ts +0 -6
- package/dist/executors/shared.d.ts +0 -226
- /package/dist/executors/{script-command.d.ts → script/command.d.ts} +0 -0
- /package/dist/executors/{script-command.js → script/command.js} +0 -0
package/dist/executors/gemini.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_TIMEOUT_MS, errorMessage, interruptedExecResult, parseJson, spawnWithSigintPropagation, timeoutExecResult, } from './shared.js';
|
|
2
|
-
import { optionalTokenCount } from '../shared/token-usage.js';
|
|
3
|
-
export async function geminiExecutor({ model, system, prompt, timeoutMs = DEFAULT_TIMEOUT_MS }) {
|
|
4
|
-
const fullPrompt = system ? `${system}\n\n${prompt}` : prompt;
|
|
5
|
-
const start = Date.now();
|
|
6
|
-
try {
|
|
7
|
-
const args = [];
|
|
8
|
-
if (model)
|
|
9
|
-
args.push('--model', model);
|
|
10
|
-
const { child, done } = spawnWithSigintPropagation('gemini', args, {
|
|
11
|
-
env: { ...process.env },
|
|
12
|
-
timeoutMs,
|
|
13
|
-
});
|
|
14
|
-
child.stdin?.on('error', () => undefined);
|
|
15
|
-
child.stdin?.write(fullPrompt);
|
|
16
|
-
child.stdin?.end();
|
|
17
|
-
let output;
|
|
18
|
-
try {
|
|
19
|
-
const r = await done;
|
|
20
|
-
output = r.stdout;
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
const details = err;
|
|
24
|
-
if (details.killedByTimeout)
|
|
25
|
-
return timeoutExecResult(timeoutMs, Date.now() - start);
|
|
26
|
-
if (details.killedBySignal)
|
|
27
|
-
return interruptedExecResult(Date.now() - start);
|
|
28
|
-
const durationMs = Date.now() - start;
|
|
29
|
-
return {
|
|
30
|
-
ok: false,
|
|
31
|
-
error: details.stderr?.trim() || details.message || `gemini exited with code ${details.code ?? '?'}`,
|
|
32
|
-
durationMs,
|
|
33
|
-
durationApiMs: 0,
|
|
34
|
-
inputTokens: 0,
|
|
35
|
-
outputTokens: 0,
|
|
36
|
-
cacheReadTokens: 0,
|
|
37
|
-
cacheCreationTokens: 0,
|
|
38
|
-
tokenUsageReportedByExecutor: false,
|
|
39
|
-
costUSD: 0,
|
|
40
|
-
costReportedByExecutor: false,
|
|
41
|
-
output: details.stdout?.trim() || null,
|
|
42
|
-
stopReason: 'error',
|
|
43
|
-
numTurns: 0,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const durationMs = Date.now() - start;
|
|
47
|
-
let text = output;
|
|
48
|
-
let inputTokens = 0;
|
|
49
|
-
let outputTokens = 0;
|
|
50
|
-
let tokenUsageReported = false;
|
|
51
|
-
try {
|
|
52
|
-
const parsed = parseJson(output);
|
|
53
|
-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
54
|
-
const record = parsed;
|
|
55
|
-
const declaresProtocol = Object.hasOwn(record, 'response')
|
|
56
|
-
|| Object.hasOwn(record, 'stats');
|
|
57
|
-
if (declaresProtocol) {
|
|
58
|
-
const data = parsed;
|
|
59
|
-
if (typeof data.response !== 'string') {
|
|
60
|
-
return invalidGeminiProtocolResult(durationMs, '"response" must be a string');
|
|
61
|
-
}
|
|
62
|
-
text = data.response;
|
|
63
|
-
if (data.stats !== undefined
|
|
64
|
-
&& (!data.stats
|
|
65
|
-
|| typeof data.stats !== 'object'
|
|
66
|
-
|| Array.isArray(data.stats))) {
|
|
67
|
-
return invalidGeminiProtocolResult(durationMs, '"stats" must be an object when present');
|
|
68
|
-
}
|
|
69
|
-
if (data.stats !== undefined) {
|
|
70
|
-
const parsedInput = optionalTokenCount(data.stats.inputTokens);
|
|
71
|
-
const parsedOutput = optionalTokenCount(data.stats.outputTokens);
|
|
72
|
-
if (parsedInput === undefined || parsedOutput === undefined) {
|
|
73
|
-
return invalidGeminiProtocolResult(durationMs, 'invalid token usage');
|
|
74
|
-
}
|
|
75
|
-
inputTokens = parsedInput;
|
|
76
|
-
outputTokens = parsedOutput;
|
|
77
|
-
tokenUsageReported = true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
text = output.trim();
|
|
84
|
-
}
|
|
85
|
-
if (!text.trim()) {
|
|
86
|
-
return {
|
|
87
|
-
ok: false,
|
|
88
|
-
error: 'gemini completed without model output',
|
|
89
|
-
durationMs,
|
|
90
|
-
durationApiMs: 0,
|
|
91
|
-
inputTokens,
|
|
92
|
-
outputTokens,
|
|
93
|
-
cacheReadTokens: 0,
|
|
94
|
-
cacheCreationTokens: 0,
|
|
95
|
-
...(!tokenUsageReported && { tokenUsageReportedByExecutor: false }),
|
|
96
|
-
costUSD: 0,
|
|
97
|
-
costReportedByExecutor: false,
|
|
98
|
-
output: null,
|
|
99
|
-
stopReason: 'error',
|
|
100
|
-
numTurns: 1,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
ok: true,
|
|
105
|
-
durationMs,
|
|
106
|
-
durationApiMs: 0,
|
|
107
|
-
inputTokens,
|
|
108
|
-
outputTokens,
|
|
109
|
-
cacheReadTokens: 0,
|
|
110
|
-
cacheCreationTokens: 0,
|
|
111
|
-
...(!tokenUsageReported && { tokenUsageReportedByExecutor: false }),
|
|
112
|
-
costUSD: 0,
|
|
113
|
-
costReportedByExecutor: false,
|
|
114
|
-
output: text,
|
|
115
|
-
stopReason: 'end',
|
|
116
|
-
numTurns: 1,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
catch (err) {
|
|
120
|
-
const durationMs = Date.now() - start;
|
|
121
|
-
return {
|
|
122
|
-
ok: false,
|
|
123
|
-
error: errorMessage(err),
|
|
124
|
-
durationMs,
|
|
125
|
-
durationApiMs: 0,
|
|
126
|
-
inputTokens: 0,
|
|
127
|
-
outputTokens: 0,
|
|
128
|
-
cacheReadTokens: 0,
|
|
129
|
-
cacheCreationTokens: 0,
|
|
130
|
-
tokenUsageReportedByExecutor: false,
|
|
131
|
-
costUSD: 0,
|
|
132
|
-
costReportedByExecutor: false,
|
|
133
|
-
output: null,
|
|
134
|
-
stopReason: 'error',
|
|
135
|
-
numTurns: 0,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function invalidGeminiProtocolResult(durationMs, message) {
|
|
140
|
-
return {
|
|
141
|
-
ok: false,
|
|
142
|
-
error: `gemini returned malformed protocol JSON: ${message}`,
|
|
143
|
-
durationMs,
|
|
144
|
-
durationApiMs: 0,
|
|
145
|
-
inputTokens: 0,
|
|
146
|
-
outputTokens: 0,
|
|
147
|
-
cacheReadTokens: 0,
|
|
148
|
-
cacheCreationTokens: 0,
|
|
149
|
-
tokenUsageReportedByExecutor: false,
|
|
150
|
-
costUSD: 0,
|
|
151
|
-
costReportedByExecutor: false,
|
|
152
|
-
output: null,
|
|
153
|
-
stopReason: 'error',
|
|
154
|
-
numTurns: 1,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ExecutorRuntimeFingerprint } from '../types/index.js';
|
|
2
|
-
export interface ExecutorRuntimeFingerprintOptions {
|
|
3
|
-
skillDir?: string | null;
|
|
4
|
-
env?: NodeJS.ProcessEnv;
|
|
5
|
-
}
|
|
6
|
-
export declare function getExecutorRuntimeFingerprint(executorName: string, model: string, options?: ExecutorRuntimeFingerprintOptions): ExecutorRuntimeFingerprint;
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { execFile, type ChildProcess } from 'node:child_process';
|
|
2
|
-
import type { ExecResult } from '../types/index.js';
|
|
3
|
-
export declare const execFileAsync: typeof execFile.__promisify__;
|
|
4
|
-
export declare const DEFAULT_MODEL = "sonnet";
|
|
5
|
-
export declare const JUDGE_MODEL = "haiku";
|
|
6
|
-
export declare const DEFAULT_TIMEOUT_MS = 600000;
|
|
7
|
-
export declare const MAX_BUFFER: number;
|
|
8
|
-
export type ExecutorVendor = 'anthropic' | 'openai' | 'google' | 'unknown';
|
|
9
|
-
export declare function executorVendor(executor: string): ExecutorVendor;
|
|
10
|
-
export interface TokenUsage {
|
|
11
|
-
input_tokens?: number;
|
|
12
|
-
output_tokens?: number;
|
|
13
|
-
cache_read_input_tokens?: number;
|
|
14
|
-
cache_creation_input_tokens?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface ClaudeCliResponse {
|
|
17
|
-
is_error?: boolean;
|
|
18
|
-
duration_ms?: number;
|
|
19
|
-
duration_api_ms?: number;
|
|
20
|
-
usage?: TokenUsage;
|
|
21
|
-
total_cost_usd?: number;
|
|
22
|
-
result?: string;
|
|
23
|
-
stop_reason?: string | null;
|
|
24
|
-
num_turns?: number;
|
|
25
|
-
}
|
|
26
|
-
export interface OpenAiUsage {
|
|
27
|
-
prompt_tokens?: number;
|
|
28
|
-
completion_tokens?: number;
|
|
29
|
-
prompt_tokens_details?: {
|
|
30
|
-
cached_tokens?: number;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface OpenAiResponse {
|
|
34
|
-
usage?: OpenAiUsage;
|
|
35
|
-
choices?: Array<{
|
|
36
|
-
message?: {
|
|
37
|
-
content?: string | null;
|
|
38
|
-
refusal?: string | null;
|
|
39
|
-
};
|
|
40
|
-
finish_reason?: string;
|
|
41
|
-
}>;
|
|
42
|
-
error?: {
|
|
43
|
-
message?: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export interface GeminiResponse {
|
|
47
|
-
response?: string;
|
|
48
|
-
stats?: {
|
|
49
|
-
inputTokens?: number;
|
|
50
|
-
outputTokens?: number;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export interface AnthropicResponse {
|
|
54
|
-
usage?: TokenUsage;
|
|
55
|
-
content?: Array<{
|
|
56
|
-
type?: string;
|
|
57
|
-
text?: string;
|
|
58
|
-
}>;
|
|
59
|
-
stop_reason?: string;
|
|
60
|
-
error?: {
|
|
61
|
-
message?: string;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export interface ClaudeSdkQueryOptions {
|
|
65
|
-
model?: string;
|
|
66
|
-
systemPrompt?: string;
|
|
67
|
-
cwd: string;
|
|
68
|
-
permissionMode: 'bypassPermissions';
|
|
69
|
-
allowDangerouslySkipPermissions: true;
|
|
70
|
-
abortController: AbortController;
|
|
71
|
-
env: NodeJS.ProcessEnv;
|
|
72
|
-
}
|
|
73
|
-
export interface ClaudeSdkQueryInput {
|
|
74
|
-
prompt: string;
|
|
75
|
-
options: ClaudeSdkQueryOptions;
|
|
76
|
-
}
|
|
77
|
-
export interface ClaudeSdkBaseMessage {
|
|
78
|
-
type: string;
|
|
79
|
-
message?: {
|
|
80
|
-
role?: string;
|
|
81
|
-
content?: Array<{
|
|
82
|
-
type: string;
|
|
83
|
-
text?: string;
|
|
84
|
-
id?: string;
|
|
85
|
-
name?: string;
|
|
86
|
-
input?: unknown;
|
|
87
|
-
}>;
|
|
88
|
-
};
|
|
89
|
-
tool_use_id?: string;
|
|
90
|
-
content?: string | Array<{
|
|
91
|
-
type: string;
|
|
92
|
-
text?: string;
|
|
93
|
-
}>;
|
|
94
|
-
is_error?: boolean;
|
|
95
|
-
}
|
|
96
|
-
export interface ClaudeSdkResultMessage extends ClaudeSdkBaseMessage {
|
|
97
|
-
type: 'result';
|
|
98
|
-
result?: string;
|
|
99
|
-
usage?: TokenUsage;
|
|
100
|
-
total_cost_usd?: number;
|
|
101
|
-
duration_api_ms?: number;
|
|
102
|
-
duration_ms?: number;
|
|
103
|
-
num_turns?: number;
|
|
104
|
-
stop_reason?: string | null;
|
|
105
|
-
modelUsage?: Record<string, {
|
|
106
|
-
inputTokens?: number;
|
|
107
|
-
outputTokens?: number;
|
|
108
|
-
cacheReadInputTokens?: number;
|
|
109
|
-
cacheCreationInputTokens?: number;
|
|
110
|
-
}>;
|
|
111
|
-
subtype?: string;
|
|
112
|
-
errors?: string[];
|
|
113
|
-
}
|
|
114
|
-
export interface ClaudeSdkModule {
|
|
115
|
-
query: (opts: ClaudeSdkQueryInput) => AsyncIterable<ClaudeSdkBaseMessage>;
|
|
116
|
-
}
|
|
117
|
-
export interface CodexEvent {
|
|
118
|
-
type?: string;
|
|
119
|
-
turn_id?: string;
|
|
120
|
-
usage?: {
|
|
121
|
-
input_tokens?: number;
|
|
122
|
-
cached_input_tokens?: number;
|
|
123
|
-
output_tokens?: number;
|
|
124
|
-
reasoning_output_tokens?: number;
|
|
125
|
-
};
|
|
126
|
-
elapsed_ms?: number;
|
|
127
|
-
stop_reason?: string;
|
|
128
|
-
item?: {
|
|
129
|
-
id?: string;
|
|
130
|
-
type?: string;
|
|
131
|
-
text?: string;
|
|
132
|
-
command?: string;
|
|
133
|
-
aggregated_output?: string;
|
|
134
|
-
exit_code?: number | null;
|
|
135
|
-
status?: string;
|
|
136
|
-
path?: string;
|
|
137
|
-
content?: string;
|
|
138
|
-
query?: string;
|
|
139
|
-
results?: unknown[];
|
|
140
|
-
changes?: Array<{
|
|
141
|
-
path?: string;
|
|
142
|
-
changeKind?: string;
|
|
143
|
-
}>;
|
|
144
|
-
server?: string;
|
|
145
|
-
tool?: string;
|
|
146
|
-
name?: string;
|
|
147
|
-
arguments?: unknown;
|
|
148
|
-
result?: unknown;
|
|
149
|
-
message?: string;
|
|
150
|
-
error?: {
|
|
151
|
-
message?: string;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
error?: {
|
|
155
|
-
message?: string;
|
|
156
|
-
};
|
|
157
|
-
message?: string;
|
|
158
|
-
ts?: number;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Translate Codex's external event shape into omk's internal protocol model.
|
|
162
|
-
* Codex currently calls file-change discriminators `kind`; omk reserves bare
|
|
163
|
-
* `kind` for ArtifactKind, so the raw field is qualified at the boundary.
|
|
164
|
-
*/
|
|
165
|
-
export declare function normalizeCodexProtocolEvent(value: unknown): CodexEvent | null;
|
|
166
|
-
export interface ExecutorErrorLike {
|
|
167
|
-
message?: string;
|
|
168
|
-
name?: string;
|
|
169
|
-
killed?: boolean;
|
|
170
|
-
stdout?: string;
|
|
171
|
-
}
|
|
172
|
-
export declare function asErrorLike(err: unknown): ExecutorErrorLike;
|
|
173
|
-
export declare function errorMessage(err: unknown, fallback?: string): string;
|
|
174
|
-
export declare function parseJson<T>(content: string): T;
|
|
175
|
-
export interface JsonResponseBody<T> {
|
|
176
|
-
data: T | null;
|
|
177
|
-
rawBody: string;
|
|
178
|
-
}
|
|
179
|
-
export declare function readJsonResponse<T>(response: Response): Promise<JsonResponseBody<T>>;
|
|
180
|
-
export declare function responseBodyPreview(rawBody: string, maxLength?: number): string;
|
|
181
|
-
export declare function buildExecEnv(skillDir?: string | null): NodeJS.ProcessEnv;
|
|
182
|
-
export declare function timeoutExecResult(timeoutMs: number, durationMs: number): ExecResult;
|
|
183
|
-
export declare function interruptedExecResult(durationMs: number): ExecResult;
|
|
184
|
-
/**
|
|
185
|
-
* Register an in-process runtime (for example an SDK-owned child) with the
|
|
186
|
-
* same SIGINT coordinator used by spawned executors.
|
|
187
|
-
*/
|
|
188
|
-
export declare function registerSigintSubscriber(subscriber: () => void): () => void;
|
|
189
|
-
export declare function __resetSigintRegistryForTest(): void;
|
|
190
|
-
export interface SpawnHelperResult {
|
|
191
|
-
stdout: string;
|
|
192
|
-
stderr: string;
|
|
193
|
-
code: number | null;
|
|
194
|
-
signal: NodeJS.Signals | null;
|
|
195
|
-
killedByTimeout: boolean;
|
|
196
|
-
killedBySignal: NodeJS.Signals | null;
|
|
197
|
-
}
|
|
198
|
-
export interface SpawnHelperError extends Error {
|
|
199
|
-
stdout?: string;
|
|
200
|
-
stderr?: string;
|
|
201
|
-
code?: number | null;
|
|
202
|
-
signal?: NodeJS.Signals | null;
|
|
203
|
-
killedByTimeout?: boolean;
|
|
204
|
-
killedBySignal?: NodeJS.Signals | null;
|
|
205
|
-
}
|
|
206
|
-
export interface SpawnHelperOptions {
|
|
207
|
-
cwd?: string;
|
|
208
|
-
env?: NodeJS.ProcessEnv;
|
|
209
|
-
/** kill child after this many ms; reject with killedByTimeout=true */
|
|
210
|
-
timeoutMs?: number;
|
|
211
|
-
/** per-stream stdout/stderr byte limit; reject when either stream exceeds it */
|
|
212
|
-
maxBuffer?: number;
|
|
213
|
-
/** external abort signal; abort() 走跟 SIGINT 同一 grace 路径 */
|
|
214
|
-
abortSignal?: AbortSignal;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* spawn child + 注册到全局 SIGINT registry。返回 { child, done } 让 caller 自己
|
|
218
|
-
* 操作 stdin(写入 / 关闭),通过 done 等结果。
|
|
219
|
-
*
|
|
220
|
-
* 适用:claude / codex / gemini / script CLI 子进程。HTTP executor(*-api)用 fetch +
|
|
221
|
-
* AbortSignal.timeout,自带 abort,不走这个。claude-sdk in-process 也不走。
|
|
222
|
-
*/
|
|
223
|
-
export declare function spawnWithSigintPropagation(command: string, args: string[], options?: SpawnHelperOptions): {
|
|
224
|
-
child: ChildProcess;
|
|
225
|
-
done: Promise<SpawnHelperResult>;
|
|
226
|
-
};
|
|
File without changes
|
|
File without changes
|