@kodelyth/codex 2026.5.42 → 2026.6.2

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.
Files changed (138) hide show
  1. package/package.json +17 -2
  2. package/doctor-contract-api.test.ts +0 -44
  3. package/doctor-contract-api.ts +0 -68
  4. package/harness.ts +0 -72
  5. package/index.test.ts +0 -230
  6. package/index.ts +0 -66
  7. package/media-understanding-provider.test.ts +0 -486
  8. package/media-understanding-provider.ts +0 -521
  9. package/prompt-overlay-runtime-contract.test.ts +0 -48
  10. package/prompt-overlay.ts +0 -21
  11. package/provider-catalog.ts +0 -83
  12. package/provider-discovery.ts +0 -45
  13. package/provider.test.ts +0 -384
  14. package/provider.ts +0 -243
  15. package/src/app-server/app-inventory-cache.test.ts +0 -176
  16. package/src/app-server/app-inventory-cache.ts +0 -324
  17. package/src/app-server/approval-bridge.test.ts +0 -1471
  18. package/src/app-server/approval-bridge.ts +0 -1211
  19. package/src/app-server/auth-bridge.test.ts +0 -1449
  20. package/src/app-server/auth-bridge.ts +0 -614
  21. package/src/app-server/auth-profile-runtime-contract.test.ts +0 -239
  22. package/src/app-server/capabilities.ts +0 -27
  23. package/src/app-server/client-factory.ts +0 -24
  24. package/src/app-server/client.test.ts +0 -563
  25. package/src/app-server/client.ts +0 -715
  26. package/src/app-server/compact.test.ts +0 -710
  27. package/src/app-server/compact.ts +0 -500
  28. package/src/app-server/computer-use.test.ts +0 -788
  29. package/src/app-server/computer-use.ts +0 -683
  30. package/src/app-server/config.test.ts +0 -879
  31. package/src/app-server/config.ts +0 -1038
  32. package/src/app-server/context-engine-projection.test.ts +0 -252
  33. package/src/app-server/context-engine-projection.ts +0 -403
  34. package/src/app-server/delivery-no-reply-runtime-contract.test.ts +0 -80
  35. package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
  36. package/src/app-server/dynamic-tool-profile.ts +0 -69
  37. package/src/app-server/dynamic-tools.test.ts +0 -1302
  38. package/src/app-server/dynamic-tools.ts +0 -623
  39. package/src/app-server/elicitation-bridge.test.ts +0 -1056
  40. package/src/app-server/elicitation-bridge.ts +0 -783
  41. package/src/app-server/event-projector.test.ts +0 -2668
  42. package/src/app-server/event-projector.ts +0 -2057
  43. package/src/app-server/image-payload-sanitizer.test.ts +0 -49
  44. package/src/app-server/image-payload-sanitizer.ts +0 -167
  45. package/src/app-server/klaw-owned-tool-runtime-contract.test.ts +0 -456
  46. package/src/app-server/local-runtime-attribution.ts +0 -39
  47. package/src/app-server/managed-binary.test.ts +0 -139
  48. package/src/app-server/managed-binary.ts +0 -193
  49. package/src/app-server/models.test.ts +0 -246
  50. package/src/app-server/models.ts +0 -172
  51. package/src/app-server/native-hook-relay.test.ts +0 -271
  52. package/src/app-server/native-hook-relay.ts +0 -150
  53. package/src/app-server/native-subagent-task-mirror.test.ts +0 -573
  54. package/src/app-server/native-subagent-task-mirror.ts +0 -497
  55. package/src/app-server/outcome-fallback-runtime-contract.test.ts +0 -404
  56. package/src/app-server/plugin-activation.test.ts +0 -336
  57. package/src/app-server/plugin-activation.ts +0 -283
  58. package/src/app-server/plugin-app-cache-key.ts +0 -74
  59. package/src/app-server/plugin-approval-roundtrip.ts +0 -122
  60. package/src/app-server/plugin-inventory.test.ts +0 -355
  61. package/src/app-server/plugin-inventory.ts +0 -357
  62. package/src/app-server/plugin-thread-config.test.ts +0 -865
  63. package/src/app-server/plugin-thread-config.ts +0 -455
  64. package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +0 -33
  65. package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +0 -199
  66. package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +0 -102
  67. package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +0 -227
  68. package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +0 -2630
  69. package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +0 -2630
  70. package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +0 -1659
  71. package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +0 -1655
  72. package/src/app-server/protocol-validators.test.ts +0 -75
  73. package/src/app-server/protocol-validators.ts +0 -203
  74. package/src/app-server/protocol.ts +0 -520
  75. package/src/app-server/rate-limit-cache.ts +0 -48
  76. package/src/app-server/rate-limits.test.ts +0 -202
  77. package/src/app-server/rate-limits.ts +0 -583
  78. package/src/app-server/request.ts +0 -73
  79. package/src/app-server/run-attempt.context-engine.test.ts +0 -1004
  80. package/src/app-server/run-attempt.test.ts +0 -9477
  81. package/src/app-server/run-attempt.ts +0 -4683
  82. package/src/app-server/run-attempt.vision-tools.test.ts +0 -35
  83. package/src/app-server/schema-normalization-runtime-contract.test.ts +0 -206
  84. package/src/app-server/session-binding.test.ts +0 -303
  85. package/src/app-server/session-binding.ts +0 -398
  86. package/src/app-server/session-history.ts +0 -44
  87. package/src/app-server/shared-client.test.ts +0 -589
  88. package/src/app-server/shared-client.ts +0 -289
  89. package/src/app-server/side-question.test.ts +0 -1175
  90. package/src/app-server/side-question.ts +0 -1007
  91. package/src/app-server/test-support.ts +0 -48
  92. package/src/app-server/thread-lifecycle.test.ts +0 -447
  93. package/src/app-server/thread-lifecycle.ts +0 -939
  94. package/src/app-server/thread-lifecycle.user-mcp-servers.test.ts +0 -442
  95. package/src/app-server/timeout.ts +0 -9
  96. package/src/app-server/tool-progress-normalization.ts +0 -77
  97. package/src/app-server/trajectory.test.ts +0 -205
  98. package/src/app-server/trajectory.ts +0 -365
  99. package/src/app-server/transcript-mirror.test.ts +0 -524
  100. package/src/app-server/transcript-mirror.ts +0 -208
  101. package/src/app-server/transcript-repair-runtime-contract.test.ts +0 -44
  102. package/src/app-server/transport-stdio.test.ts +0 -171
  103. package/src/app-server/transport-stdio.ts +0 -107
  104. package/src/app-server/transport-websocket.test.ts +0 -69
  105. package/src/app-server/transport-websocket.ts +0 -90
  106. package/src/app-server/transport.ts +0 -117
  107. package/src/app-server/user-input-bridge.test.ts +0 -249
  108. package/src/app-server/user-input-bridge.ts +0 -316
  109. package/src/app-server/version.ts +0 -4
  110. package/src/app-server/vision-tools.ts +0 -12
  111. package/src/command-account.ts +0 -544
  112. package/src/command-formatters.ts +0 -425
  113. package/src/command-handlers.ts +0 -2004
  114. package/src/command-rpc.test.ts +0 -16
  115. package/src/command-rpc.ts +0 -142
  116. package/src/commands.test.ts +0 -3312
  117. package/src/commands.ts +0 -65
  118. package/src/conversation-binding-data.ts +0 -124
  119. package/src/conversation-binding.test.ts +0 -599
  120. package/src/conversation-binding.ts +0 -561
  121. package/src/conversation-control.test.ts +0 -126
  122. package/src/conversation-control.ts +0 -303
  123. package/src/conversation-turn-collector.test.ts +0 -191
  124. package/src/conversation-turn-collector.ts +0 -186
  125. package/src/conversation-turn-input.test.ts +0 -141
  126. package/src/conversation-turn-input.ts +0 -106
  127. package/src/manifest.test.ts +0 -20
  128. package/src/migration/apply.ts +0 -501
  129. package/src/migration/helpers.ts +0 -55
  130. package/src/migration/plan.ts +0 -461
  131. package/src/migration/provider.test.ts +0 -1741
  132. package/src/migration/provider.ts +0 -41
  133. package/src/migration/source.ts +0 -643
  134. package/src/migration/targets.ts +0 -25
  135. package/src/node-cli-sessions.test.ts +0 -180
  136. package/src/node-cli-sessions.ts +0 -711
  137. package/test-api.ts +0 -82
  138. package/tsconfig.json +0 -16
@@ -1,141 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { buildCodexConversationTurnInput } from "./conversation-turn-input.js";
3
-
4
- describe("codex conversation turn input", () => {
5
- it("forwards inbound image attachments to Codex app-server", () => {
6
- expect(
7
- buildCodexConversationTurnInput({
8
- prompt: "what is this?",
9
- event: {
10
- content: "what is this?",
11
- channel: "telegram",
12
- isGroup: false,
13
- metadata: {
14
- mediaPaths: ["/tmp/photo.png", "/tmp/readme.txt"],
15
- mediaUrls: ["https://example.test/photo.png"],
16
- mediaTypes: ["image/png", "text/plain"],
17
- },
18
- },
19
- }),
20
- ).toEqual([
21
- { type: "text", text: "what is this?", text_elements: [] },
22
- { type: "localImage", path: "/tmp/photo.png" },
23
- ]);
24
- });
25
-
26
- it("uses remote image urls when no local path is available", () => {
27
- expect(
28
- buildCodexConversationTurnInput({
29
- prompt: "look",
30
- event: {
31
- content: "look",
32
- channel: "webchat",
33
- isGroup: false,
34
- metadata: {
35
- mediaUrl: "https://example.test/photo.webp?sig=1",
36
- },
37
- },
38
- }),
39
- ).toEqual([
40
- { type: "text", text: "look", text_elements: [] },
41
- { type: "image", url: "https://example.test/photo.webp?sig=1" },
42
- ]);
43
- });
44
-
45
- it("keeps protocol-relative image urls remote", () => {
46
- expect(
47
- buildCodexConversationTurnInput({
48
- prompt: "look",
49
- event: {
50
- content: "look",
51
- channel: "webchat",
52
- isGroup: false,
53
- metadata: {
54
- mediaUrl: "//cdn.example.test/photo.webp",
55
- },
56
- },
57
- }),
58
- ).toEqual([
59
- { type: "text", text: "look", text_elements: [] },
60
- { type: "image", url: "//cdn.example.test/photo.webp" },
61
- ]);
62
- });
63
-
64
- it("decodes local file URLs for Codex local image input", () => {
65
- expect(
66
- buildCodexConversationTurnInput({
67
- prompt: "look",
68
- event: {
69
- content: "look",
70
- channel: "webchat",
71
- isGroup: false,
72
- metadata: {
73
- mediaPath: "file:///tmp/Klaw%20QA/photo.png",
74
- mediaType: "image/png",
75
- },
76
- },
77
- }),
78
- ).toEqual([
79
- { type: "text", text: "look", text_elements: [] },
80
- { type: "localImage", path: "/tmp/Klaw QA/photo.png" },
81
- ]);
82
- });
83
-
84
- it("drops malformed local file URLs instead of throwing", () => {
85
- expect(
86
- buildCodexConversationTurnInput({
87
- prompt: "look",
88
- event: {
89
- content: "look",
90
- channel: "webchat",
91
- isGroup: false,
92
- metadata: {
93
- mediaPath: "file:///tmp/%zz/photo.png",
94
- mediaType: "image/png",
95
- },
96
- },
97
- }),
98
- ).toEqual([{ type: "text", text: "look", text_elements: [] }]);
99
- });
100
-
101
- it("treats local media URLs as Codex local image input", () => {
102
- expect(
103
- buildCodexConversationTurnInput({
104
- prompt: "look",
105
- event: {
106
- content: "look",
107
- channel: "webchat",
108
- isGroup: false,
109
- metadata: {
110
- mediaUrls: ["/tmp/staged-photo.png", "file:///tmp/Klaw%20QA/second.jpg"],
111
- mediaTypes: ["image/png", "image/jpeg"],
112
- },
113
- },
114
- }),
115
- ).toEqual([
116
- { type: "text", text: "look", text_elements: [] },
117
- { type: "localImage", path: "/tmp/staged-photo.png" },
118
- { type: "localImage", path: "/tmp/Klaw QA/second.jpg" },
119
- ]);
120
- });
121
-
122
- it("treats Windows media paths as Codex local image input", () => {
123
- expect(
124
- buildCodexConversationTurnInput({
125
- prompt: "look",
126
- event: {
127
- content: "look",
128
- channel: "webchat",
129
- isGroup: false,
130
- metadata: {
131
- mediaUrl: "C:\\Klaw QA\\photo.png",
132
- mediaType: "image/png",
133
- },
134
- },
135
- }),
136
- ).toEqual([
137
- { type: "text", text: "look", text_elements: [] },
138
- { type: "localImage", path: "C:\\Klaw QA\\photo.png" },
139
- ]);
140
- });
141
- });
@@ -1,106 +0,0 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import type { PluginHookInboundClaimEvent } from "klaw/plugin-sdk/plugin-entry";
4
- import type { CodexUserInput } from "./app-server/protocol.js";
5
-
6
- type InboundMedia = {
7
- path?: string;
8
- url?: string;
9
- mimeType?: string;
10
- };
11
-
12
- const IMAGE_EXTENSIONS = new Set([".avif", ".gif", ".jpeg", ".jpg", ".png", ".webp"]);
13
-
14
- export function buildCodexConversationTurnInput(params: {
15
- prompt: string;
16
- event: PluginHookInboundClaimEvent;
17
- }): CodexUserInput[] {
18
- return [
19
- { type: "text", text: params.prompt, text_elements: [] },
20
- ...extractInboundMedia(params.event)
21
- .map(toCodexImageInput)
22
- .filter((item): item is CodexUserInput => item !== undefined),
23
- ];
24
- }
25
-
26
- function extractInboundMedia(event: PluginHookInboundClaimEvent): InboundMedia[] {
27
- const metadata = event.metadata ?? {};
28
- // Klaw channels expose either local staged files or remote URLs. Keep
29
- // them separate so Codex can receive the cheaper localImage input when a file
30
- // is already present, while still supporting remote-only transports.
31
- const paths = readStringArray(metadata.mediaPaths).concat(readStringArray(metadata.mediaPath));
32
- const urls = readStringArray(metadata.mediaUrls).concat(readStringArray(metadata.mediaUrl));
33
- const mimeTypes = readStringArray(metadata.mediaTypes).concat(
34
- readStringArray(metadata.mediaType),
35
- );
36
- const count = Math.max(paths.length, urls.length, mimeTypes.length);
37
- const media: InboundMedia[] = [];
38
- for (let index = 0; index < count; index += 1) {
39
- media.push({
40
- path: paths[index],
41
- url: urls[index],
42
- mimeType: mimeTypes[index] ?? mimeTypes[0],
43
- });
44
- }
45
- return media;
46
- }
47
-
48
- function toCodexImageInput(media: InboundMedia): CodexUserInput | undefined {
49
- if (!isImageMedia(media)) {
50
- return undefined;
51
- }
52
- const localPath = media.path ?? readLocalMediaPath(media.url);
53
- if (localPath) {
54
- const normalized = normalizeFileUrl(localPath);
55
- return normalized ? { type: "localImage", path: normalized } : undefined;
56
- }
57
- return media.url ? { type: "image", url: media.url } : undefined;
58
- }
59
-
60
- function isImageMedia(media: InboundMedia): boolean {
61
- if (media.mimeType?.toLowerCase().startsWith("image/")) {
62
- return true;
63
- }
64
- const candidate = media.path ?? media.url;
65
- if (!candidate) {
66
- return false;
67
- }
68
- return IMAGE_EXTENSIONS.has(path.extname(candidate.split(/[?#]/, 1)[0] ?? "").toLowerCase());
69
- }
70
-
71
- function normalizeFileUrl(value: string): string | undefined {
72
- if (!value.startsWith("file://")) {
73
- return value;
74
- }
75
- try {
76
- return fileURLToPath(value);
77
- } catch {
78
- return undefined;
79
- }
80
- }
81
-
82
- function readLocalMediaPath(value: string | undefined): string | undefined {
83
- if (!value) {
84
- return undefined;
85
- }
86
- if (value.startsWith("file://")) {
87
- return value;
88
- }
89
- if (value.startsWith("//")) {
90
- return undefined;
91
- }
92
- if (path.isAbsolute(value) || path.win32.isAbsolute(value)) {
93
- return value;
94
- }
95
- return /^[a-z][a-z0-9+.-]*:/i.test(value) ? undefined : value;
96
- }
97
-
98
- function readStringArray(value: unknown): string[] {
99
- if (typeof value === "string" && value.trim()) {
100
- return [value.trim()];
101
- }
102
- if (!Array.isArray(value)) {
103
- return [];
104
- }
105
- return value.map((entry) => (typeof entry === "string" ? entry.trim() : "")).filter(Boolean);
106
- }
@@ -1,20 +0,0 @@
1
- import fs from "node:fs";
2
- import { describe, expect, it } from "vitest";
3
- import { MANAGED_CODEX_APP_SERVER_PACKAGE_VERSION } from "./app-server/version.js";
4
-
5
- type CodexPackageManifest = {
6
- dependencies?: Record<string, string>;
7
- };
8
-
9
- describe("codex package manifest", () => {
10
- it("keeps runtime dependencies in the package manifest", () => {
11
- const packageJson = JSON.parse(
12
- fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"),
13
- ) as CodexPackageManifest;
14
-
15
- expect(packageJson.dependencies).toHaveProperty("@earendil-works/pi-coding-agent");
16
- expect(packageJson.dependencies?.["@openai/codex"]).toBe(
17
- MANAGED_CODEX_APP_SERVER_PACKAGE_VERSION,
18
- );
19
- });
20
- });