@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.
Files changed (138) hide show
  1. package/package.json +16 -1
  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,455 +0,0 @@
1
- import crypto from "node:crypto";
2
- import { embeddedAgentLog } from "klaw/plugin-sdk/agent-harness-runtime";
3
- import {
4
- defaultCodexAppInventoryCache,
5
- serializeCodexAppInventoryError,
6
- type CodexAppInventorySnapshot,
7
- type CodexAppInventoryCache,
8
- type CodexAppInventoryRequest,
9
- } from "./app-inventory-cache.js";
10
- import {
11
- resolveCodexPluginsPolicy,
12
- type ResolvedCodexPluginPolicy,
13
- type ResolvedCodexPluginsPolicy,
14
- } from "./config.js";
15
- import {
16
- ensureCodexPluginActivation,
17
- type CodexPluginActivationResult,
18
- } from "./plugin-activation.js";
19
- import {
20
- readCodexPluginInventory,
21
- type CodexPluginInventory,
22
- type CodexPluginInventoryDiagnostic,
23
- type CodexPluginInventoryRecord,
24
- type CodexPluginOwnedApp,
25
- type CodexPluginRuntimeRequest,
26
- } from "./plugin-inventory.js";
27
- import type { JsonObject, JsonValue } from "./protocol.js";
28
-
29
- export type PluginAppPolicyContextEntry = {
30
- configKey: string;
31
- marketplaceName: ResolvedCodexPluginPolicy["marketplaceName"];
32
- pluginName: string;
33
- allowDestructiveActions: boolean;
34
- mcpServerNames: string[];
35
- };
36
-
37
- export type PluginAppPolicyContext = {
38
- fingerprint: string;
39
- apps: Record<string, PluginAppPolicyContextEntry>;
40
- pluginAppIds: Record<string, string[]>;
41
- };
42
-
43
- export type CodexPluginThreadConfigDiagnostic =
44
- | CodexPluginInventoryDiagnostic
45
- | {
46
- code: "plugin_activation_failed" | "app_not_ready";
47
- plugin?: ResolvedCodexPluginPolicy;
48
- message: string;
49
- };
50
-
51
- export type CodexPluginThreadConfig = {
52
- enabled: boolean;
53
- configPatch?: JsonObject;
54
- fingerprint: string;
55
- inputFingerprint: string;
56
- policyContext: PluginAppPolicyContext;
57
- inventory?: CodexPluginInventory;
58
- diagnostics: CodexPluginThreadConfigDiagnostic[];
59
- };
60
-
61
- export type BuildCodexPluginThreadConfigParams = {
62
- pluginConfig?: unknown;
63
- request: CodexPluginRuntimeRequest;
64
- appCache?: CodexAppInventoryCache;
65
- appCacheKey: string;
66
- nowMs?: number;
67
- };
68
-
69
- const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 1;
70
- const CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION = 1;
71
-
72
- export function shouldBuildCodexPluginThreadConfig(pluginConfig?: unknown): boolean {
73
- return resolveCodexPluginsPolicy(pluginConfig).configured;
74
- }
75
-
76
- export function buildCodexPluginThreadConfigInputFingerprint(params: {
77
- pluginConfig?: unknown;
78
- appCacheKey?: string;
79
- }): string {
80
- const policy = resolveCodexPluginsPolicy(params.pluginConfig);
81
- return fingerprintJson({
82
- version: CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION,
83
- policy: policyFingerprint(policy),
84
- appCacheKey: params.appCacheKey ?? null,
85
- });
86
- }
87
-
88
- export async function buildCodexPluginThreadConfig(
89
- params: BuildCodexPluginThreadConfigParams,
90
- ): Promise<CodexPluginThreadConfig> {
91
- const appCache = params.appCache ?? defaultCodexAppInventoryCache;
92
- let inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
93
- pluginConfig: params.pluginConfig,
94
- appCacheKey: params.appCacheKey,
95
- });
96
- const policy = resolveCodexPluginsPolicy(params.pluginConfig);
97
- if (!policy.enabled) {
98
- return emptyPluginThreadConfig({
99
- enabled: false,
100
- inputFingerprint,
101
- configPatch: buildDisabledAppsConfigPatch(),
102
- });
103
- }
104
-
105
- let inventory = await readCodexPluginInventory({
106
- pluginConfig: params.pluginConfig,
107
- policy,
108
- request: params.request,
109
- appCache,
110
- appCacheKey: params.appCacheKey,
111
- nowMs: params.nowMs,
112
- suppressAppInventoryRefresh: true,
113
- });
114
- if (shouldWaitForInitialAppInventory(params, policy, inventory)) {
115
- await refreshAppInventoryNow(params, appCache, {
116
- forceRefetch: true,
117
- reason: "initial_missing",
118
- });
119
- inventory = await readCodexPluginInventory({
120
- pluginConfig: params.pluginConfig,
121
- policy,
122
- request: params.request,
123
- appCache,
124
- appCacheKey: params.appCacheKey,
125
- nowMs: params.nowMs,
126
- });
127
- inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
128
- pluginConfig: params.pluginConfig,
129
- appCacheKey: params.appCacheKey,
130
- });
131
- }
132
- const activationDiagnostics: CodexPluginThreadConfigDiagnostic[] = [];
133
- const activationResults: CodexPluginActivationResult[] = [];
134
- for (const record of inventory.records) {
135
- if (!record.activationRequired) {
136
- continue;
137
- }
138
- const activation = await ensureCodexPluginActivation({
139
- identity: record.policy,
140
- request: params.request,
141
- appCache,
142
- appCacheKey: params.appCacheKey,
143
- });
144
- activationResults.push(activation);
145
- if (!activation.ok) {
146
- activationDiagnostics.push({
147
- code: "plugin_activation_failed",
148
- plugin: record.policy,
149
- message: activation.diagnostics.map((item) => item.message).join(" ") || activation.reason,
150
- });
151
- }
152
- }
153
- if (activationResults.some((activation) => activation.ok && activation.installAttempted)) {
154
- await refreshAppInventoryNow(params, appCache, {
155
- forceRefetch: true,
156
- reason: "post_install",
157
- });
158
- inventory = await readCodexPluginInventory({
159
- pluginConfig: params.pluginConfig,
160
- policy,
161
- request: params.request,
162
- appCache,
163
- appCacheKey: params.appCacheKey,
164
- nowMs: params.nowMs,
165
- });
166
- inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
167
- pluginConfig: params.pluginConfig,
168
- appCacheKey: params.appCacheKey,
169
- });
170
- }
171
- if (shouldForceRefreshForNotReadyPluginApps(params, policy, inventory)) {
172
- await refreshAppInventoryNow(params, appCache, {
173
- forceRefetch: true,
174
- reason: "not_ready_plugin_apps",
175
- });
176
- inventory = await readCodexPluginInventory({
177
- pluginConfig: params.pluginConfig,
178
- policy,
179
- request: params.request,
180
- appCache,
181
- appCacheKey: params.appCacheKey,
182
- nowMs: params.nowMs,
183
- });
184
- inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
185
- pluginConfig: params.pluginConfig,
186
- appCacheKey: params.appCacheKey,
187
- });
188
- }
189
-
190
- const diagnostics: CodexPluginThreadConfigDiagnostic[] = [
191
- ...inventory.diagnostics,
192
- ...activationDiagnostics,
193
- ];
194
- const apps: JsonObject = {
195
- _default: {
196
- enabled: false,
197
- destructive_enabled: false,
198
- open_world_enabled: false,
199
- },
200
- };
201
- const policyApps: Record<string, PluginAppPolicyContextEntry> = {};
202
- const pluginAppIds: Record<string, string[]> = {};
203
- for (const record of inventory.records) {
204
- if (record.activationRequired) {
205
- const activation = activationResults.find(
206
- (item) => item.identity.configKey === record.policy.configKey,
207
- );
208
- if (!activation?.ok) {
209
- continue;
210
- }
211
- }
212
- if (record.appOwnership !== "proven") {
213
- continue;
214
- }
215
- pluginAppIds[record.policy.configKey] = [...record.ownedAppIds].toSorted();
216
- for (const app of resolveThreadConfigAppsForRecord({ record, inventory })) {
217
- if (!app.accessible || !app.enabled) {
218
- diagnostics.push({
219
- code: "app_not_ready",
220
- plugin: record.policy,
221
- message: `${app.id} is not accessible or enabled for ${record.policy.pluginName}.`,
222
- });
223
- continue;
224
- }
225
- const appConfig: JsonObject = {
226
- enabled: true,
227
- destructive_enabled: record.policy.allowDestructiveActions,
228
- open_world_enabled: true,
229
- default_tools_approval_mode: "auto",
230
- };
231
- apps[app.id] = appConfig;
232
- policyApps[app.id] = {
233
- configKey: record.policy.configKey,
234
- marketplaceName: record.policy.marketplaceName,
235
- pluginName: record.policy.pluginName,
236
- allowDestructiveActions: record.policy.allowDestructiveActions,
237
- mcpServerNames: [...(record.detail?.mcpServers ?? [])].toSorted(),
238
- };
239
- }
240
- }
241
-
242
- const configPatch = { apps };
243
- const policyContext = buildPluginAppPolicyContext(policyApps, pluginAppIds);
244
- return {
245
- enabled: true,
246
- configPatch,
247
- fingerprint: fingerprintJson({
248
- version: CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION,
249
- inputFingerprint,
250
- configPatch,
251
- policyContext,
252
- }),
253
- inputFingerprint,
254
- policyContext,
255
- inventory,
256
- diagnostics,
257
- };
258
- }
259
-
260
- export function mergeCodexThreadConfigs(
261
- ...configs: Array<JsonObject | undefined>
262
- ): JsonObject | undefined {
263
- let merged: JsonObject | undefined;
264
- for (const config of configs) {
265
- if (!config) {
266
- continue;
267
- }
268
- merged = mergeJsonObjects(merged ?? {}, config);
269
- }
270
- return merged && Object.keys(merged).length > 0 ? merged : undefined;
271
- }
272
-
273
- export function isCodexPluginThreadBindingStale(params: {
274
- codexPluginsEnabled: boolean;
275
- bindingFingerprint?: string;
276
- bindingInputFingerprint?: string;
277
- currentInputFingerprint?: string;
278
- hasBindingPolicyContext?: boolean;
279
- }): boolean {
280
- if (!params.codexPluginsEnabled) {
281
- return Boolean(
282
- params.bindingFingerprint || params.bindingInputFingerprint || params.hasBindingPolicyContext,
283
- );
284
- }
285
- if (
286
- !params.bindingFingerprint ||
287
- !params.bindingInputFingerprint ||
288
- !params.hasBindingPolicyContext
289
- ) {
290
- return true;
291
- }
292
- return params.bindingInputFingerprint !== params.currentInputFingerprint;
293
- }
294
-
295
- function emptyPluginThreadConfig(params: {
296
- enabled: boolean;
297
- inputFingerprint: string;
298
- configPatch?: JsonObject;
299
- }): CodexPluginThreadConfig {
300
- const policyContext = buildPluginAppPolicyContext({}, {});
301
- return {
302
- enabled: params.enabled,
303
- fingerprint: fingerprintJson({
304
- version: CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION,
305
- inputFingerprint: params.inputFingerprint,
306
- configPatch: params.configPatch ?? null,
307
- policyContext,
308
- }),
309
- inputFingerprint: params.inputFingerprint,
310
- ...(params.configPatch ? { configPatch: params.configPatch } : {}),
311
- policyContext,
312
- diagnostics: [],
313
- };
314
- }
315
-
316
- function buildDisabledAppsConfigPatch(): JsonObject {
317
- return {
318
- apps: {
319
- _default: {
320
- enabled: false,
321
- destructive_enabled: false,
322
- open_world_enabled: false,
323
- },
324
- },
325
- };
326
- }
327
-
328
- function buildPluginAppPolicyContext(
329
- apps: Record<string, PluginAppPolicyContextEntry>,
330
- pluginAppIds: Record<string, string[]>,
331
- ): PluginAppPolicyContext {
332
- return {
333
- fingerprint: fingerprintJson({ version: 1, apps, pluginAppIds }),
334
- apps,
335
- pluginAppIds,
336
- };
337
- }
338
-
339
- function shouldWaitForInitialAppInventory(
340
- params: BuildCodexPluginThreadConfigParams,
341
- policy: ResolvedCodexPluginsPolicy,
342
- inventory: CodexPluginInventory,
343
- ): boolean {
344
- return Boolean(
345
- params.appCacheKey &&
346
- policy.pluginPolicies.some((plugin) => plugin.enabled) &&
347
- inventory.appInventory?.state === "missing",
348
- );
349
- }
350
-
351
- async function refreshAppInventoryNow(
352
- params: BuildCodexPluginThreadConfigParams,
353
- appCache: CodexAppInventoryCache,
354
- options: { forceRefetch?: boolean; reason?: string } = {},
355
- ): Promise<CodexAppInventorySnapshot | undefined> {
356
- const appCacheKey = params.appCacheKey;
357
- if (!appCacheKey) {
358
- return undefined;
359
- }
360
- const request: CodexAppInventoryRequest = async (method, requestParams) =>
361
- (await params.request(method, requestParams)) as Awaited<ReturnType<CodexAppInventoryRequest>>;
362
- try {
363
- const snapshot = await appCache.refreshNow({
364
- key: appCacheKey,
365
- request,
366
- nowMs: params.nowMs,
367
- forceRefetch: options.forceRefetch,
368
- });
369
- return snapshot;
370
- } catch (error) {
371
- embeddedAgentLog.warn("codex plugin thread config app inventory refresh failed", {
372
- reason: options.reason,
373
- forceRefetch: options.forceRefetch === true,
374
- error: serializeCodexAppInventoryError(error),
375
- });
376
- // Keep building from the diagnostic inventory state; app exposure remains scoped below.
377
- return undefined;
378
- }
379
- }
380
-
381
- function resolveThreadConfigAppsForRecord(params: {
382
- record: CodexPluginInventoryRecord;
383
- inventory: CodexPluginInventory;
384
- }): CodexPluginOwnedApp[] {
385
- if (params.inventory.appInventory?.state === "missing") {
386
- return [];
387
- }
388
- return params.record.apps;
389
- }
390
-
391
- function shouldForceRefreshForNotReadyPluginApps(
392
- params: BuildCodexPluginThreadConfigParams,
393
- policy: ResolvedCodexPluginsPolicy,
394
- inventory: CodexPluginInventory,
395
- ): boolean {
396
- if (!params.appCacheKey || !policy.pluginPolicies.some((plugin) => plugin.enabled)) {
397
- return false;
398
- }
399
- if (inventory.appInventory?.state === "missing") {
400
- return false;
401
- }
402
- return inventory.records.some(
403
- (record) =>
404
- record.appOwnership === "proven" &&
405
- record.ownedAppIds.length > 0 &&
406
- (record.apps.length === 0 || record.apps.some((app) => !app.accessible || !app.enabled)),
407
- );
408
- }
409
-
410
- function policyFingerprint(policy: ResolvedCodexPluginsPolicy): JsonValue {
411
- return {
412
- enabled: policy.enabled,
413
- allowDestructiveActions: policy.allowDestructiveActions,
414
- plugins: policy.pluginPolicies.map((plugin) => ({
415
- configKey: plugin.configKey,
416
- marketplaceName: plugin.marketplaceName,
417
- pluginName: plugin.pluginName,
418
- enabled: plugin.enabled,
419
- allowDestructiveActions: plugin.allowDestructiveActions,
420
- })),
421
- };
422
- }
423
-
424
- function mergeJsonObjects(left: JsonObject, right: JsonObject): JsonObject {
425
- const merged: JsonObject = { ...left };
426
- for (const [key, value] of Object.entries(right)) {
427
- const existing = merged[key];
428
- merged[key] =
429
- isPlainJsonObject(existing) && isPlainJsonObject(value)
430
- ? mergeJsonObjects(existing, value)
431
- : value;
432
- }
433
- return merged;
434
- }
435
-
436
- function isPlainJsonObject(value: JsonValue | undefined): value is JsonObject {
437
- return Boolean(value && typeof value === "object" && !Array.isArray(value));
438
- }
439
-
440
- function fingerprintJson(value: JsonValue): string {
441
- return crypto.createHash("sha256").update(stableStringify(value)).digest("hex");
442
- }
443
-
444
- function stableStringify(value: JsonValue | undefined): string {
445
- if (Array.isArray(value)) {
446
- return `[${value.map((item) => stableStringify(item)).join(",")}]`;
447
- }
448
- if (value && typeof value === "object") {
449
- return `{${Object.entries(value)
450
- .toSorted(([left], [right]) => left.localeCompare(right))
451
- .map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item)}`)
452
- .join(",")}}`;
453
- }
454
- return JSON.stringify(value);
455
- }
@@ -1,33 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "title": "DynamicToolCallParams",
4
- "type": "object",
5
- "required": [
6
- "arguments",
7
- "callId",
8
- "threadId",
9
- "tool",
10
- "turnId"
11
- ],
12
- "properties": {
13
- "arguments": true,
14
- "callId": {
15
- "type": "string"
16
- },
17
- "namespace": {
18
- "type": [
19
- "string",
20
- "null"
21
- ]
22
- },
23
- "threadId": {
24
- "type": "string"
25
- },
26
- "tool": {
27
- "type": "string"
28
- },
29
- "turnId": {
30
- "type": "string"
31
- }
32
- }
33
- }
@@ -1,199 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "title": "ErrorNotification",
4
- "type": "object",
5
- "required": [
6
- "error",
7
- "threadId",
8
- "turnId",
9
- "willRetry"
10
- ],
11
- "properties": {
12
- "error": {
13
- "$ref": "#/definitions/TurnError"
14
- },
15
- "threadId": {
16
- "type": "string"
17
- },
18
- "turnId": {
19
- "type": "string"
20
- },
21
- "willRetry": {
22
- "type": "boolean"
23
- }
24
- },
25
- "definitions": {
26
- "CodexErrorInfo": {
27
- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",
28
- "oneOf": [
29
- {
30
- "type": "string",
31
- "enum": [
32
- "contextWindowExceeded",
33
- "usageLimitExceeded",
34
- "serverOverloaded",
35
- "cyberPolicy",
36
- "internalServerError",
37
- "unauthorized",
38
- "badRequest",
39
- "threadRollbackFailed",
40
- "sandboxError",
41
- "other"
42
- ]
43
- },
44
- {
45
- "type": "object",
46
- "required": [
47
- "httpConnectionFailed"
48
- ],
49
- "properties": {
50
- "httpConnectionFailed": {
51
- "type": "object",
52
- "properties": {
53
- "httpStatusCode": {
54
- "type": [
55
- "integer",
56
- "null"
57
- ],
58
- "format": "uint16",
59
- "minimum": 0
60
- }
61
- }
62
- }
63
- },
64
- "additionalProperties": false,
65
- "title": "HttpConnectionFailedCodexErrorInfo"
66
- },
67
- {
68
- "description": "Failed to connect to the response SSE stream.",
69
- "type": "object",
70
- "required": [
71
- "responseStreamConnectionFailed"
72
- ],
73
- "properties": {
74
- "responseStreamConnectionFailed": {
75
- "type": "object",
76
- "properties": {
77
- "httpStatusCode": {
78
- "type": [
79
- "integer",
80
- "null"
81
- ],
82
- "format": "uint16",
83
- "minimum": 0
84
- }
85
- }
86
- }
87
- },
88
- "additionalProperties": false,
89
- "title": "ResponseStreamConnectionFailedCodexErrorInfo"
90
- },
91
- {
92
- "description": "The response SSE stream disconnected in the middle of a turn before completion.",
93
- "type": "object",
94
- "required": [
95
- "responseStreamDisconnected"
96
- ],
97
- "properties": {
98
- "responseStreamDisconnected": {
99
- "type": "object",
100
- "properties": {
101
- "httpStatusCode": {
102
- "type": [
103
- "integer",
104
- "null"
105
- ],
106
- "format": "uint16",
107
- "minimum": 0
108
- }
109
- }
110
- }
111
- },
112
- "additionalProperties": false,
113
- "title": "ResponseStreamDisconnectedCodexErrorInfo"
114
- },
115
- {
116
- "description": "Reached the retry limit for responses.",
117
- "type": "object",
118
- "required": [
119
- "responseTooManyFailedAttempts"
120
- ],
121
- "properties": {
122
- "responseTooManyFailedAttempts": {
123
- "type": "object",
124
- "properties": {
125
- "httpStatusCode": {
126
- "type": [
127
- "integer",
128
- "null"
129
- ],
130
- "format": "uint16",
131
- "minimum": 0
132
- }
133
- }
134
- }
135
- },
136
- "additionalProperties": false,
137
- "title": "ResponseTooManyFailedAttemptsCodexErrorInfo"
138
- },
139
- {
140
- "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
141
- "type": "object",
142
- "required": [
143
- "activeTurnNotSteerable"
144
- ],
145
- "properties": {
146
- "activeTurnNotSteerable": {
147
- "type": "object",
148
- "required": [
149
- "turnKind"
150
- ],
151
- "properties": {
152
- "turnKind": {
153
- "$ref": "#/definitions/NonSteerableTurnKind"
154
- }
155
- }
156
- }
157
- },
158
- "additionalProperties": false,
159
- "title": "ActiveTurnNotSteerableCodexErrorInfo"
160
- }
161
- ]
162
- },
163
- "NonSteerableTurnKind": {
164
- "type": "string",
165
- "enum": [
166
- "review",
167
- "compact"
168
- ]
169
- },
170
- "TurnError": {
171
- "type": "object",
172
- "required": [
173
- "message"
174
- ],
175
- "properties": {
176
- "additionalDetails": {
177
- "default": null,
178
- "type": [
179
- "string",
180
- "null"
181
- ]
182
- },
183
- "codexErrorInfo": {
184
- "anyOf": [
185
- {
186
- "$ref": "#/definitions/CodexErrorInfo"
187
- },
188
- {
189
- "type": "null"
190
- }
191
- ]
192
- },
193
- "message": {
194
- "type": "string"
195
- }
196
- }
197
- }
198
- }
199
- }