@kodelyth/codex 2026.5.42 → 2026.6.1
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/package.json +16 -1
- package/doctor-contract-api.test.ts +0 -44
- package/doctor-contract-api.ts +0 -68
- package/harness.ts +0 -72
- package/index.test.ts +0 -230
- package/index.ts +0 -66
- package/media-understanding-provider.test.ts +0 -486
- package/media-understanding-provider.ts +0 -521
- package/prompt-overlay-runtime-contract.test.ts +0 -48
- package/prompt-overlay.ts +0 -21
- package/provider-catalog.ts +0 -83
- package/provider-discovery.ts +0 -45
- package/provider.test.ts +0 -384
- package/provider.ts +0 -243
- package/src/app-server/app-inventory-cache.test.ts +0 -176
- package/src/app-server/app-inventory-cache.ts +0 -324
- package/src/app-server/approval-bridge.test.ts +0 -1471
- package/src/app-server/approval-bridge.ts +0 -1211
- package/src/app-server/auth-bridge.test.ts +0 -1449
- package/src/app-server/auth-bridge.ts +0 -614
- package/src/app-server/auth-profile-runtime-contract.test.ts +0 -239
- package/src/app-server/capabilities.ts +0 -27
- package/src/app-server/client-factory.ts +0 -24
- package/src/app-server/client.test.ts +0 -563
- package/src/app-server/client.ts +0 -715
- package/src/app-server/compact.test.ts +0 -710
- package/src/app-server/compact.ts +0 -500
- package/src/app-server/computer-use.test.ts +0 -788
- package/src/app-server/computer-use.ts +0 -683
- package/src/app-server/config.test.ts +0 -879
- package/src/app-server/config.ts +0 -1038
- package/src/app-server/context-engine-projection.test.ts +0 -252
- package/src/app-server/context-engine-projection.ts +0 -403
- package/src/app-server/delivery-no-reply-runtime-contract.test.ts +0 -80
- package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
- package/src/app-server/dynamic-tool-profile.ts +0 -69
- package/src/app-server/dynamic-tools.test.ts +0 -1302
- package/src/app-server/dynamic-tools.ts +0 -623
- package/src/app-server/elicitation-bridge.test.ts +0 -1056
- package/src/app-server/elicitation-bridge.ts +0 -783
- package/src/app-server/event-projector.test.ts +0 -2668
- package/src/app-server/event-projector.ts +0 -2057
- package/src/app-server/image-payload-sanitizer.test.ts +0 -49
- package/src/app-server/image-payload-sanitizer.ts +0 -167
- package/src/app-server/klaw-owned-tool-runtime-contract.test.ts +0 -456
- package/src/app-server/local-runtime-attribution.ts +0 -39
- package/src/app-server/managed-binary.test.ts +0 -139
- package/src/app-server/managed-binary.ts +0 -193
- package/src/app-server/models.test.ts +0 -246
- package/src/app-server/models.ts +0 -172
- package/src/app-server/native-hook-relay.test.ts +0 -271
- package/src/app-server/native-hook-relay.ts +0 -150
- package/src/app-server/native-subagent-task-mirror.test.ts +0 -573
- package/src/app-server/native-subagent-task-mirror.ts +0 -497
- package/src/app-server/outcome-fallback-runtime-contract.test.ts +0 -404
- package/src/app-server/plugin-activation.test.ts +0 -336
- package/src/app-server/plugin-activation.ts +0 -283
- package/src/app-server/plugin-app-cache-key.ts +0 -74
- package/src/app-server/plugin-approval-roundtrip.ts +0 -122
- package/src/app-server/plugin-inventory.test.ts +0 -355
- package/src/app-server/plugin-inventory.ts +0 -357
- package/src/app-server/plugin-thread-config.test.ts +0 -865
- package/src/app-server/plugin-thread-config.ts +0 -455
- package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +0 -33
- package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +0 -199
- package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +0 -102
- package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +0 -227
- package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +0 -2630
- package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +0 -2630
- package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +0 -1659
- package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +0 -1655
- package/src/app-server/protocol-validators.test.ts +0 -75
- package/src/app-server/protocol-validators.ts +0 -203
- package/src/app-server/protocol.ts +0 -520
- package/src/app-server/rate-limit-cache.ts +0 -48
- package/src/app-server/rate-limits.test.ts +0 -202
- package/src/app-server/rate-limits.ts +0 -583
- package/src/app-server/request.ts +0 -73
- package/src/app-server/run-attempt.context-engine.test.ts +0 -1004
- package/src/app-server/run-attempt.test.ts +0 -9477
- package/src/app-server/run-attempt.ts +0 -4683
- package/src/app-server/run-attempt.vision-tools.test.ts +0 -35
- package/src/app-server/schema-normalization-runtime-contract.test.ts +0 -206
- package/src/app-server/session-binding.test.ts +0 -303
- package/src/app-server/session-binding.ts +0 -398
- package/src/app-server/session-history.ts +0 -44
- package/src/app-server/shared-client.test.ts +0 -589
- package/src/app-server/shared-client.ts +0 -289
- package/src/app-server/side-question.test.ts +0 -1175
- package/src/app-server/side-question.ts +0 -1007
- package/src/app-server/test-support.ts +0 -48
- package/src/app-server/thread-lifecycle.test.ts +0 -447
- package/src/app-server/thread-lifecycle.ts +0 -939
- package/src/app-server/thread-lifecycle.user-mcp-servers.test.ts +0 -442
- package/src/app-server/timeout.ts +0 -9
- package/src/app-server/tool-progress-normalization.ts +0 -77
- package/src/app-server/trajectory.test.ts +0 -205
- package/src/app-server/trajectory.ts +0 -365
- package/src/app-server/transcript-mirror.test.ts +0 -524
- package/src/app-server/transcript-mirror.ts +0 -208
- package/src/app-server/transcript-repair-runtime-contract.test.ts +0 -44
- package/src/app-server/transport-stdio.test.ts +0 -171
- package/src/app-server/transport-stdio.ts +0 -107
- package/src/app-server/transport-websocket.test.ts +0 -69
- package/src/app-server/transport-websocket.ts +0 -90
- package/src/app-server/transport.ts +0 -117
- package/src/app-server/user-input-bridge.test.ts +0 -249
- package/src/app-server/user-input-bridge.ts +0 -316
- package/src/app-server/version.ts +0 -4
- package/src/app-server/vision-tools.ts +0 -12
- package/src/command-account.ts +0 -544
- package/src/command-formatters.ts +0 -425
- package/src/command-handlers.ts +0 -2004
- package/src/command-rpc.test.ts +0 -16
- package/src/command-rpc.ts +0 -142
- package/src/commands.test.ts +0 -3312
- package/src/commands.ts +0 -65
- package/src/conversation-binding-data.ts +0 -124
- package/src/conversation-binding.test.ts +0 -599
- package/src/conversation-binding.ts +0 -561
- package/src/conversation-control.test.ts +0 -126
- package/src/conversation-control.ts +0 -303
- package/src/conversation-turn-collector.test.ts +0 -191
- package/src/conversation-turn-collector.ts +0 -186
- package/src/conversation-turn-input.test.ts +0 -141
- package/src/conversation-turn-input.ts +0 -106
- package/src/manifest.test.ts +0 -20
- package/src/migration/apply.ts +0 -501
- package/src/migration/helpers.ts +0 -55
- package/src/migration/plan.ts +0 -461
- package/src/migration/provider.test.ts +0 -1741
- package/src/migration/provider.ts +0 -41
- package/src/migration/source.ts +0 -643
- package/src/migration/targets.ts +0 -25
- package/src/node-cli-sessions.test.ts +0 -180
- package/src/node-cli-sessions.ts +0 -711
- package/test-api.ts +0 -82
- package/tsconfig.json +0 -16
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
}
|