@kodelyth/codex 2026.5.40 → 2026.5.42
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/dist/client-ChMX13_o.js +642 -0
- package/dist/client-factory-D3dIsp4Y.js +9 -0
- package/dist/command-formatters-BRW7_Nu7.js +519 -0
- package/dist/command-handlers-P2IqtXaZ.js +1462 -0
- package/dist/compact-baos5flR.js +329 -0
- package/dist/computer-use-VfLvTMaa.js +367 -0
- package/dist/config-CezENx_E.js +510 -0
- package/dist/doctor-contract-api.js +53 -0
- package/dist/harness.js +51 -0
- package/dist/index.js +1133 -0
- package/dist/media-understanding-provider.js +335 -0
- package/dist/models-B9DhrIwD.js +110 -0
- package/dist/node-cli-sessions-De4_DuFw.js +1216 -0
- package/dist/plugin-activation-BlMuJeXz.js +452 -0
- package/dist/prompt-overlay.js +12 -0
- package/dist/protocol-C9UWI98H.js +9 -0
- package/dist/protocol-validators-BGBspNmF.js +5988 -0
- package/dist/provider-catalog.js +84 -0
- package/dist/provider-discovery.js +33 -0
- package/dist/provider.js +150 -0
- package/dist/rate-limit-cache-CHuacE27.js +24 -0
- package/dist/request-CTQKUxaa.js +89 -0
- package/dist/rolldown-runtime-DUslC3ob.js +14 -0
- package/dist/run-attempt-DqV2OU1R.js +5366 -0
- package/dist/session-binding-3PzU7ZTW.js +222 -0
- package/dist/shared-client-Cnyr9dyT.js +631 -0
- package/dist/side-question-CP5XlA0U.js +667 -0
- package/dist/test-api.js +45 -0
- package/dist/thread-lifecycle-DBJetBuV.js +1561 -0
- package/dist/vision-tools-Cl_5a93K.js +1379 -0
- package/doctor-contract-api.test.ts +44 -0
- package/doctor-contract-api.ts +68 -0
- package/harness.ts +72 -0
- package/index.test.ts +230 -0
- package/index.ts +66 -0
- package/klaw.plugin.json +24 -85
- package/media-understanding-provider.test.ts +486 -0
- package/media-understanding-provider.ts +521 -0
- package/package.json +3 -3
- package/prompt-overlay-runtime-contract.test.ts +48 -0
- package/prompt-overlay.ts +21 -0
- package/provider-catalog.ts +83 -0
- package/provider-discovery.ts +45 -0
- package/provider.test.ts +384 -0
- package/provider.ts +243 -0
- package/src/app-server/app-inventory-cache.test.ts +176 -0
- package/src/app-server/app-inventory-cache.ts +324 -0
- package/src/app-server/approval-bridge.test.ts +1471 -0
- package/src/app-server/approval-bridge.ts +1211 -0
- package/src/app-server/auth-bridge.test.ts +1449 -0
- package/src/app-server/auth-bridge.ts +614 -0
- package/src/app-server/auth-profile-runtime-contract.test.ts +239 -0
- package/src/app-server/capabilities.ts +27 -0
- package/src/app-server/client-factory.ts +24 -0
- package/src/app-server/client.test.ts +563 -0
- package/src/app-server/client.ts +715 -0
- package/src/app-server/compact.test.ts +710 -0
- package/src/app-server/compact.ts +500 -0
- package/src/app-server/computer-use.test.ts +788 -0
- package/src/app-server/computer-use.ts +683 -0
- package/src/app-server/config.test.ts +879 -0
- package/src/app-server/config.ts +1038 -0
- package/src/app-server/context-engine-projection.test.ts +252 -0
- package/src/app-server/context-engine-projection.ts +403 -0
- package/src/app-server/delivery-no-reply-runtime-contract.test.ts +80 -0
- package/src/app-server/dynamic-tool-diagnostics.ts +73 -0
- package/src/app-server/dynamic-tool-profile.ts +69 -0
- package/src/app-server/dynamic-tools.test.ts +1302 -0
- package/src/app-server/dynamic-tools.ts +623 -0
- package/src/app-server/elicitation-bridge.test.ts +1056 -0
- package/src/app-server/elicitation-bridge.ts +783 -0
- package/src/app-server/event-projector.test.ts +2668 -0
- package/src/app-server/event-projector.ts +2057 -0
- package/src/app-server/image-payload-sanitizer.test.ts +49 -0
- package/src/app-server/image-payload-sanitizer.ts +167 -0
- package/src/app-server/klaw-owned-tool-runtime-contract.test.ts +456 -0
- package/src/app-server/local-runtime-attribution.ts +39 -0
- package/src/app-server/managed-binary.test.ts +139 -0
- package/src/app-server/managed-binary.ts +193 -0
- package/src/app-server/models.test.ts +246 -0
- package/src/app-server/models.ts +172 -0
- package/src/app-server/native-hook-relay.test.ts +271 -0
- package/src/app-server/native-hook-relay.ts +150 -0
- package/src/app-server/native-subagent-task-mirror.test.ts +573 -0
- package/src/app-server/native-subagent-task-mirror.ts +497 -0
- package/src/app-server/outcome-fallback-runtime-contract.test.ts +404 -0
- package/src/app-server/plugin-activation.test.ts +336 -0
- package/src/app-server/plugin-activation.ts +283 -0
- package/src/app-server/plugin-app-cache-key.ts +74 -0
- package/src/app-server/plugin-approval-roundtrip.ts +122 -0
- package/src/app-server/plugin-inventory.test.ts +355 -0
- package/src/app-server/plugin-inventory.ts +357 -0
- package/src/app-server/plugin-thread-config.test.ts +865 -0
- package/src/app-server/plugin-thread-config.ts +455 -0
- package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +33 -0
- package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +199 -0
- package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +102 -0
- package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +227 -0
- package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +2630 -0
- package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +2630 -0
- package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +1659 -0
- package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +1655 -0
- package/src/app-server/protocol-validators.test.ts +75 -0
- package/src/app-server/protocol-validators.ts +203 -0
- package/src/app-server/protocol.ts +520 -0
- package/src/app-server/rate-limit-cache.ts +48 -0
- package/src/app-server/rate-limits.test.ts +202 -0
- package/src/app-server/rate-limits.ts +583 -0
- package/src/app-server/request.ts +73 -0
- package/src/app-server/run-attempt.context-engine.test.ts +1004 -0
- package/src/app-server/run-attempt.test.ts +9477 -0
- package/src/app-server/run-attempt.ts +4683 -0
- package/src/app-server/run-attempt.vision-tools.test.ts +35 -0
- package/src/app-server/schema-normalization-runtime-contract.test.ts +206 -0
- package/src/app-server/session-binding.test.ts +303 -0
- package/src/app-server/session-binding.ts +398 -0
- package/src/app-server/session-history.ts +44 -0
- package/src/app-server/shared-client.test.ts +589 -0
- package/src/app-server/shared-client.ts +289 -0
- package/src/app-server/side-question.test.ts +1175 -0
- package/src/app-server/side-question.ts +1007 -0
- package/src/app-server/test-support.ts +48 -0
- package/src/app-server/thread-lifecycle.test.ts +447 -0
- package/src/app-server/thread-lifecycle.ts +939 -0
- package/src/app-server/thread-lifecycle.user-mcp-servers.test.ts +442 -0
- package/src/app-server/timeout.ts +9 -0
- package/src/app-server/tool-progress-normalization.ts +77 -0
- package/src/app-server/trajectory.test.ts +205 -0
- package/src/app-server/trajectory.ts +365 -0
- package/src/app-server/transcript-mirror.test.ts +524 -0
- package/src/app-server/transcript-mirror.ts +208 -0
- package/src/app-server/transcript-repair-runtime-contract.test.ts +44 -0
- package/src/app-server/transport-stdio.test.ts +171 -0
- package/src/app-server/transport-stdio.ts +107 -0
- package/src/app-server/transport-websocket.test.ts +69 -0
- package/src/app-server/transport-websocket.ts +90 -0
- package/src/app-server/transport.ts +117 -0
- package/src/app-server/user-input-bridge.test.ts +249 -0
- package/src/app-server/user-input-bridge.ts +316 -0
- package/src/app-server/version.ts +4 -0
- package/src/app-server/vision-tools.ts +12 -0
- package/src/command-account.ts +544 -0
- package/src/command-formatters.ts +425 -0
- package/src/command-handlers.ts +2004 -0
- package/src/command-rpc.test.ts +16 -0
- package/src/command-rpc.ts +142 -0
- package/src/commands.test.ts +3312 -0
- package/src/commands.ts +65 -0
- package/src/conversation-binding-data.ts +124 -0
- package/src/conversation-binding.test.ts +599 -0
- package/src/conversation-binding.ts +561 -0
- package/src/conversation-control.test.ts +126 -0
- package/src/conversation-control.ts +303 -0
- package/src/conversation-turn-collector.test.ts +191 -0
- package/src/conversation-turn-collector.ts +186 -0
- package/src/conversation-turn-input.test.ts +141 -0
- package/src/conversation-turn-input.ts +106 -0
- package/src/manifest.test.ts +20 -0
- package/src/migration/apply.ts +501 -0
- package/src/migration/helpers.ts +55 -0
- package/src/migration/plan.ts +461 -0
- package/src/migration/provider.test.ts +1741 -0
- package/src/migration/provider.ts +41 -0
- package/src/migration/source.ts +643 -0
- package/src/migration/targets.ts +25 -0
- package/src/node-cli-sessions.test.ts +180 -0
- package/src/node-cli-sessions.ts +711 -0
- package/test-api.ts +82 -0
- package/tsconfig.json +16 -0
- package/doctor-contract-api.js +0 -7
- package/harness.js +0 -7
- package/index.js +0 -7
- package/media-understanding-provider.js +0 -7
- package/prompt-overlay.js +0 -7
- package/provider-catalog.js +0 -7
- package/provider-discovery.js +0 -7
- package/provider.js +0 -7
- package/test-api.js +0 -7
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import type { EmbeddedRunAttemptParams } from "klaw/plugin-sdk/agent-harness";
|
|
6
|
+
import { DELIVERY_NO_REPLY_RUNTIME_CONTRACT } from "klaw/plugin-sdk/agent-runtime-test-contracts";
|
|
7
|
+
import { isSilentReplyPayloadText } from "klaw/plugin-sdk/reply-chunking";
|
|
8
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
9
|
+
import { CodexAppServerEventProjector } from "./event-projector.js";
|
|
10
|
+
import { createCodexTestModel } from "./test-support.js";
|
|
11
|
+
|
|
12
|
+
const THREAD_ID = "thread-delivery-contract";
|
|
13
|
+
const TURN_ID = "turn-delivery-contract";
|
|
14
|
+
const tempDirs = new Set<string>();
|
|
15
|
+
|
|
16
|
+
type ProjectorNotification = Parameters<CodexAppServerEventProjector["handleNotification"]>[0];
|
|
17
|
+
|
|
18
|
+
async function createParams(): Promise<EmbeddedRunAttemptParams> {
|
|
19
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "klaw-codex-delivery-contract-"));
|
|
20
|
+
tempDirs.add(tempDir);
|
|
21
|
+
const sessionFile = path.join(tempDir, "session.jsonl");
|
|
22
|
+
SessionManager.open(sessionFile);
|
|
23
|
+
return {
|
|
24
|
+
prompt: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.prompt,
|
|
25
|
+
sessionId: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.sessionId,
|
|
26
|
+
sessionKey: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.sessionKey,
|
|
27
|
+
sessionFile,
|
|
28
|
+
workspaceDir: tempDir,
|
|
29
|
+
runId: DELIVERY_NO_REPLY_RUNTIME_CONTRACT.runId,
|
|
30
|
+
provider: "codex",
|
|
31
|
+
modelId: "gpt-5.4-codex",
|
|
32
|
+
model: createCodexTestModel("codex"),
|
|
33
|
+
thinkLevel: "medium",
|
|
34
|
+
} as EmbeddedRunAttemptParams;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function forCurrentTurn(
|
|
38
|
+
method: ProjectorNotification["method"],
|
|
39
|
+
params: Record<string, unknown>,
|
|
40
|
+
): ProjectorNotification {
|
|
41
|
+
return {
|
|
42
|
+
method,
|
|
43
|
+
params: { threadId: THREAD_ID, turnId: TURN_ID, ...params },
|
|
44
|
+
} as ProjectorNotification;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
afterEach(async () => {
|
|
48
|
+
for (const tempDir of tempDirs) {
|
|
49
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
tempDirs.clear();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("Delivery/NO_REPLY runtime contract - Codex app-server adapter", () => {
|
|
55
|
+
it.each([
|
|
56
|
+
DELIVERY_NO_REPLY_RUNTIME_CONTRACT.silentText,
|
|
57
|
+
` ${DELIVERY_NO_REPLY_RUNTIME_CONTRACT.silentText} `,
|
|
58
|
+
DELIVERY_NO_REPLY_RUNTIME_CONTRACT.jsonSilentText,
|
|
59
|
+
])("preserves silent terminal text %s for shared delivery suppression", async (text) => {
|
|
60
|
+
const projector = new CodexAppServerEventProjector(await createParams(), THREAD_ID, TURN_ID);
|
|
61
|
+
await projector.handleNotification(
|
|
62
|
+
forCurrentTurn("item/agentMessage/delta", {
|
|
63
|
+
itemId: "msg-1",
|
|
64
|
+
delta: text,
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const result = projector.buildResult({
|
|
69
|
+
didSendViaMessagingTool: false,
|
|
70
|
+
messagingToolSentTexts: [],
|
|
71
|
+
messagingToolSentMediaUrls: [],
|
|
72
|
+
messagingToolSentTargets: [],
|
|
73
|
+
toolMediaUrls: [],
|
|
74
|
+
toolAudioAsVoice: false,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(result.assistantTexts).toEqual([text.trim()]);
|
|
78
|
+
expect(isSilentReplyPayloadText(result.assistantTexts[0])).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { emitTrustedDiagnosticEvent } from "klaw/plugin-sdk/diagnostic-runtime";
|
|
2
|
+
import type { CodexDynamicToolCallParams, CodexDynamicToolCallResponse } from "./protocol.js";
|
|
3
|
+
|
|
4
|
+
type DynamicToolDiagnosticContext = {
|
|
5
|
+
call: CodexDynamicToolCallParams;
|
|
6
|
+
runId?: string | undefined;
|
|
7
|
+
sessionId?: string | undefined;
|
|
8
|
+
sessionKey?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function emitDynamicToolStartedDiagnostic(params: DynamicToolDiagnosticContext): void {
|
|
12
|
+
emitTrustedDiagnosticEvent({
|
|
13
|
+
type: "tool.execution.started",
|
|
14
|
+
runId: params.runId,
|
|
15
|
+
sessionId: params.sessionId,
|
|
16
|
+
sessionKey: params.sessionKey,
|
|
17
|
+
toolName: params.call.tool,
|
|
18
|
+
toolCallId: params.call.callId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function emitDynamicToolErrorDiagnostic(
|
|
23
|
+
params: DynamicToolDiagnosticContext & {
|
|
24
|
+
durationMs: number;
|
|
25
|
+
},
|
|
26
|
+
): void {
|
|
27
|
+
emitTrustedDiagnosticEvent({
|
|
28
|
+
type: "tool.execution.error",
|
|
29
|
+
runId: params.runId,
|
|
30
|
+
sessionId: params.sessionId,
|
|
31
|
+
sessionKey: params.sessionKey,
|
|
32
|
+
toolName: params.call.tool,
|
|
33
|
+
toolCallId: params.call.callId,
|
|
34
|
+
durationMs: params.durationMs,
|
|
35
|
+
errorCategory: "codex_dynamic_tool_error",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function emitDynamicToolTerminalDiagnostic(
|
|
40
|
+
params: DynamicToolDiagnosticContext & {
|
|
41
|
+
response: CodexDynamicToolCallResponse;
|
|
42
|
+
durationMs: number;
|
|
43
|
+
},
|
|
44
|
+
): void {
|
|
45
|
+
const terminalType =
|
|
46
|
+
params.response.diagnosticTerminalType ?? (params.response.success ? "completed" : "error");
|
|
47
|
+
if (terminalType === "completed") {
|
|
48
|
+
emitTrustedDiagnosticEvent({
|
|
49
|
+
type: "tool.execution.completed",
|
|
50
|
+
runId: params.runId,
|
|
51
|
+
sessionId: params.sessionId,
|
|
52
|
+
sessionKey: params.sessionKey,
|
|
53
|
+
toolName: params.call.tool,
|
|
54
|
+
toolCallId: params.call.callId,
|
|
55
|
+
durationMs: params.durationMs,
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (terminalType === "blocked") {
|
|
60
|
+
emitTrustedDiagnosticEvent({
|
|
61
|
+
type: "tool.execution.blocked",
|
|
62
|
+
runId: params.runId,
|
|
63
|
+
sessionId: params.sessionId,
|
|
64
|
+
sessionKey: params.sessionKey,
|
|
65
|
+
toolName: params.call.tool,
|
|
66
|
+
toolCallId: params.call.callId,
|
|
67
|
+
deniedReason: "plugin-before-tool-call",
|
|
68
|
+
reason: "Tool call blocked",
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
emitDynamicToolErrorDiagnostic(params);
|
|
73
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { CodexDynamicToolsLoading, CodexPluginConfig } from "./config.js";
|
|
2
|
+
|
|
3
|
+
export const CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES = [
|
|
4
|
+
"read",
|
|
5
|
+
"write",
|
|
6
|
+
"edit",
|
|
7
|
+
"apply_patch",
|
|
8
|
+
"exec",
|
|
9
|
+
"process",
|
|
10
|
+
"update_plan",
|
|
11
|
+
"tool_call",
|
|
12
|
+
"tool_describe",
|
|
13
|
+
"tool_search",
|
|
14
|
+
"tool_search_code",
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
const DYNAMIC_TOOL_NAME_ALIASES: Record<string, string> = {
|
|
18
|
+
bash: "exec",
|
|
19
|
+
"apply-patch": "apply_patch",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type CodexDynamicToolProfileEnv = {
|
|
23
|
+
KLAW_BUILD_PRIVATE_QA?: string;
|
|
24
|
+
KLAW_QA_FORCE_RUNTIME?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function normalizeCodexDynamicToolName(name: string): string {
|
|
28
|
+
const normalized = name.trim().toLowerCase();
|
|
29
|
+
return DYNAMIC_TOOL_NAME_ALIASES[normalized] ?? normalized;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function isForcedPrivateQaCodexRuntime(
|
|
33
|
+
env: CodexDynamicToolProfileEnv = process.env,
|
|
34
|
+
): boolean {
|
|
35
|
+
return (
|
|
36
|
+
env.KLAW_BUILD_PRIVATE_QA === "1" && env.KLAW_QA_FORCE_RUNTIME?.trim().toLowerCase() === "codex"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resolveCodexDynamicToolsLoading(
|
|
41
|
+
config: Pick<CodexPluginConfig, "codexDynamicToolsLoading">,
|
|
42
|
+
env: CodexDynamicToolProfileEnv = process.env,
|
|
43
|
+
): CodexDynamicToolsLoading {
|
|
44
|
+
return isForcedPrivateQaCodexRuntime(env)
|
|
45
|
+
? "direct"
|
|
46
|
+
: (config.codexDynamicToolsLoading ?? "searchable");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function filterCodexDynamicTools<T extends { name: string }>(
|
|
50
|
+
tools: T[],
|
|
51
|
+
config: Pick<CodexPluginConfig, "codexDynamicToolsExclude">,
|
|
52
|
+
env: CodexDynamicToolProfileEnv = process.env,
|
|
53
|
+
): T[] {
|
|
54
|
+
const excludes = new Set<string>();
|
|
55
|
+
if (!isForcedPrivateQaCodexRuntime(env)) {
|
|
56
|
+
for (const name of CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES) {
|
|
57
|
+
excludes.add(name);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const name of config.codexDynamicToolsExclude ?? []) {
|
|
61
|
+
const trimmed = normalizeCodexDynamicToolName(name);
|
|
62
|
+
if (trimmed) {
|
|
63
|
+
excludes.add(trimmed);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return excludes.size === 0
|
|
67
|
+
? tools
|
|
68
|
+
: tools.filter((tool) => !excludes.has(normalizeCodexDynamicToolName(tool.name)));
|
|
69
|
+
}
|