@kodelyth/codex 2026.5.40 → 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 (41) hide show
  1. package/dist/client-ChMX13_o.js +642 -0
  2. package/dist/client-factory-D3dIsp4Y.js +9 -0
  3. package/dist/command-formatters-BRW7_Nu7.js +519 -0
  4. package/dist/command-handlers-P2IqtXaZ.js +1462 -0
  5. package/dist/compact-baos5flR.js +329 -0
  6. package/dist/computer-use-VfLvTMaa.js +367 -0
  7. package/dist/config-CezENx_E.js +510 -0
  8. package/dist/doctor-contract-api.js +53 -0
  9. package/dist/harness.js +51 -0
  10. package/dist/index.js +1133 -0
  11. package/dist/media-understanding-provider.js +335 -0
  12. package/dist/models-B9DhrIwD.js +110 -0
  13. package/dist/node-cli-sessions-De4_DuFw.js +1216 -0
  14. package/dist/plugin-activation-BlMuJeXz.js +452 -0
  15. package/dist/prompt-overlay.js +12 -0
  16. package/dist/protocol-C9UWI98H.js +9 -0
  17. package/dist/protocol-validators-BGBspNmF.js +5988 -0
  18. package/dist/provider-catalog.js +84 -0
  19. package/dist/provider-discovery.js +33 -0
  20. package/dist/provider.js +150 -0
  21. package/dist/rate-limit-cache-CHuacE27.js +24 -0
  22. package/dist/request-CTQKUxaa.js +89 -0
  23. package/dist/rolldown-runtime-DUslC3ob.js +14 -0
  24. package/dist/run-attempt-DqV2OU1R.js +5366 -0
  25. package/dist/session-binding-3PzU7ZTW.js +222 -0
  26. package/dist/shared-client-Cnyr9dyT.js +631 -0
  27. package/dist/side-question-CP5XlA0U.js +667 -0
  28. package/dist/test-api.js +45 -0
  29. package/dist/thread-lifecycle-DBJetBuV.js +1561 -0
  30. package/dist/vision-tools-Cl_5a93K.js +1379 -0
  31. package/klaw.plugin.json +24 -85
  32. package/package.json +18 -3
  33. package/doctor-contract-api.js +0 -7
  34. package/harness.js +0 -7
  35. package/index.js +0 -7
  36. package/media-understanding-provider.js +0 -7
  37. package/prompt-overlay.js +0 -7
  38. package/provider-catalog.js +0 -7
  39. package/provider-discovery.js +0 -7
  40. package/provider.js +0 -7
  41. package/test-api.js +0 -7
@@ -0,0 +1,222 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
2
+ import { o as normalizeCodexServiceTier } from "./config-CezENx_E.js";
3
+ import { embeddedAgentLog } from "klaw/plugin-sdk/agent-harness-runtime";
4
+ import fs from "node:fs/promises";
5
+ import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "klaw/plugin-sdk/agent-runtime";
6
+ //#region extensions/codex/src/app-server/session-binding.ts
7
+ var session_binding_exports = /* @__PURE__ */ __exportAll({
8
+ clearCodexAppServerBinding: () => clearCodexAppServerBinding,
9
+ isCodexAppServerNativeAuthProfile: () => isCodexAppServerNativeAuthProfile,
10
+ normalizeCodexAppServerBindingModelProvider: () => normalizeCodexAppServerBindingModelProvider,
11
+ readCodexAppServerBinding: () => readCodexAppServerBinding,
12
+ resolveCodexAppServerBindingPath: () => resolveCodexAppServerBindingPath,
13
+ writeCodexAppServerBinding: () => writeCodexAppServerBinding
14
+ });
15
+ const CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER = "openai-codex";
16
+ const PUBLIC_OPENAI_MODEL_PROVIDER = "openai";
17
+ function resolveCodexAppServerBindingPath(sessionFile) {
18
+ return `${sessionFile}.codex-app-server.json`;
19
+ }
20
+ async function readCodexAppServerBinding(sessionFile, lookup = {}) {
21
+ const path = resolveCodexAppServerBindingPath(sessionFile);
22
+ let raw;
23
+ try {
24
+ raw = await fs.readFile(path, "utf8");
25
+ } catch (error) {
26
+ if (isNotFound(error)) return;
27
+ embeddedAgentLog.warn("failed to read codex app-server binding", {
28
+ path,
29
+ error
30
+ });
31
+ return;
32
+ }
33
+ try {
34
+ const parsed = JSON.parse(raw);
35
+ if (parsed.schemaVersion !== 1 || typeof parsed.threadId !== "string") return;
36
+ const authProfileId = typeof parsed.authProfileId === "string" ? parsed.authProfileId : void 0;
37
+ return {
38
+ schemaVersion: 1,
39
+ threadId: parsed.threadId,
40
+ sessionFile,
41
+ cwd: typeof parsed.cwd === "string" ? parsed.cwd : "",
42
+ authProfileId,
43
+ model: typeof parsed.model === "string" ? parsed.model : void 0,
44
+ modelProvider: normalizeCodexAppServerBindingModelProvider({
45
+ ...lookup,
46
+ authProfileId,
47
+ modelProvider: typeof parsed.modelProvider === "string" ? parsed.modelProvider : void 0
48
+ }),
49
+ approvalPolicy: readApprovalPolicy(parsed.approvalPolicy),
50
+ sandbox: readSandboxMode(parsed.sandbox),
51
+ serviceTier: readServiceTier(parsed.serviceTier),
52
+ dynamicToolsFingerprint: typeof parsed.dynamicToolsFingerprint === "string" ? parsed.dynamicToolsFingerprint : void 0,
53
+ userMcpServersFingerprint: typeof parsed.userMcpServersFingerprint === "string" ? parsed.userMcpServersFingerprint : void 0,
54
+ mcpServersFingerprint: typeof parsed.mcpServersFingerprint === "string" ? parsed.mcpServersFingerprint : void 0,
55
+ pluginAppsFingerprint: typeof parsed.pluginAppsFingerprint === "string" ? parsed.pluginAppsFingerprint : void 0,
56
+ pluginAppsInputFingerprint: typeof parsed.pluginAppsInputFingerprint === "string" ? parsed.pluginAppsInputFingerprint : void 0,
57
+ pluginAppPolicyContext: readPluginAppPolicyContext(parsed.pluginAppPolicyContext),
58
+ contextEngine: readContextEngineBinding(parsed.contextEngine),
59
+ createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
60
+ updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : (/* @__PURE__ */ new Date()).toISOString()
61
+ };
62
+ } catch (error) {
63
+ embeddedAgentLog.warn("failed to parse codex app-server binding", {
64
+ path,
65
+ error
66
+ });
67
+ return;
68
+ }
69
+ }
70
+ async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
71
+ const now = (/* @__PURE__ */ new Date()).toISOString();
72
+ const payload = {
73
+ schemaVersion: 1,
74
+ sessionFile,
75
+ threadId: binding.threadId,
76
+ cwd: binding.cwd,
77
+ authProfileId: binding.authProfileId,
78
+ model: binding.model,
79
+ modelProvider: normalizeCodexAppServerBindingModelProvider({
80
+ ...lookup,
81
+ authProfileId: binding.authProfileId,
82
+ modelProvider: binding.modelProvider
83
+ }),
84
+ approvalPolicy: binding.approvalPolicy,
85
+ sandbox: binding.sandbox,
86
+ serviceTier: binding.serviceTier,
87
+ dynamicToolsFingerprint: binding.dynamicToolsFingerprint,
88
+ userMcpServersFingerprint: binding.userMcpServersFingerprint,
89
+ mcpServersFingerprint: binding.mcpServersFingerprint,
90
+ pluginAppsFingerprint: binding.pluginAppsFingerprint,
91
+ pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
92
+ pluginAppPolicyContext: binding.pluginAppPolicyContext,
93
+ contextEngine: binding.contextEngine,
94
+ createdAt: binding.createdAt ?? now,
95
+ updatedAt: now
96
+ };
97
+ await fs.writeFile(resolveCodexAppServerBindingPath(sessionFile), `${JSON.stringify(payload, null, 2)}\n`);
98
+ }
99
+ function readContextEngineBinding(value) {
100
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
101
+ const record = value;
102
+ if (record.schemaVersion !== 1 || typeof record.engineId !== "string" || typeof record.policyFingerprint !== "string") return;
103
+ return {
104
+ schemaVersion: 1,
105
+ engineId: record.engineId,
106
+ policyFingerprint: record.policyFingerprint,
107
+ projection: readContextEngineProjectionBinding(record.projection)
108
+ };
109
+ }
110
+ function readContextEngineProjectionBinding(value) {
111
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
112
+ const record = value;
113
+ if (record.schemaVersion !== 1 || record.mode !== "thread_bootstrap" || typeof record.epoch !== "string" || !record.epoch.trim()) return;
114
+ return {
115
+ schemaVersion: 1,
116
+ mode: "thread_bootstrap",
117
+ epoch: record.epoch,
118
+ fingerprint: typeof record.fingerprint === "string" ? record.fingerprint : void 0
119
+ };
120
+ }
121
+ function readPluginAppPolicyContext(value) {
122
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
123
+ const record = value;
124
+ if (typeof record.fingerprint !== "string") return;
125
+ const apps = record.apps;
126
+ if (!apps || typeof apps !== "object" || Array.isArray(apps)) return;
127
+ const parsedApps = {};
128
+ for (const [appId, rawEntry] of Object.entries(apps)) {
129
+ if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) return;
130
+ const entry = rawEntry;
131
+ if ("appId" in entry || typeof entry.configKey !== "string" || entry.marketplaceName !== "openai-curated" || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || !Array.isArray(entry.mcpServerNames) || entry.mcpServerNames.some((serverName) => typeof serverName !== "string")) return;
132
+ parsedApps[appId] = {
133
+ configKey: entry.configKey,
134
+ marketplaceName: entry.marketplaceName,
135
+ pluginName: entry.pluginName,
136
+ allowDestructiveActions: entry.allowDestructiveActions,
137
+ mcpServerNames: entry.mcpServerNames
138
+ };
139
+ }
140
+ const parsedPluginAppIds = {};
141
+ const rawPluginAppIds = record.pluginAppIds;
142
+ if (rawPluginAppIds && (typeof rawPluginAppIds !== "object" || Array.isArray(rawPluginAppIds))) return;
143
+ if (rawPluginAppIds && typeof rawPluginAppIds === "object") for (const [configKey, appIds] of Object.entries(rawPluginAppIds)) {
144
+ if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
145
+ parsedPluginAppIds[configKey] = appIds;
146
+ }
147
+ return {
148
+ fingerprint: record.fingerprint,
149
+ apps: parsedApps,
150
+ pluginAppIds: parsedPluginAppIds
151
+ };
152
+ }
153
+ async function clearCodexAppServerBinding(sessionFile) {
154
+ try {
155
+ await fs.unlink(resolveCodexAppServerBindingPath(sessionFile));
156
+ } catch (error) {
157
+ if (!isNotFound(error)) embeddedAgentLog.warn("failed to clear codex app-server binding", {
158
+ sessionFile,
159
+ error
160
+ });
161
+ }
162
+ }
163
+ function isNotFound(error) {
164
+ return Boolean(error && typeof error === "object" && "code" in error && error.code === "ENOENT");
165
+ }
166
+ function isCodexAppServerNativeAuthProfile(lookup) {
167
+ const authProfileId = lookup.authProfileId?.trim();
168
+ if (!authProfileId) return false;
169
+ try {
170
+ return isCodexAppServerNativeAuthProvider({
171
+ provider: resolveCodexAppServerAuthProfileCredential({
172
+ ...lookup,
173
+ authProfileId
174
+ })?.provider,
175
+ config: lookup.config
176
+ });
177
+ } catch (error) {
178
+ embeddedAgentLog.debug("failed to resolve codex app-server auth profile provider", {
179
+ authProfileId,
180
+ error
181
+ });
182
+ return false;
183
+ }
184
+ }
185
+ function normalizeCodexAppServerBindingModelProvider(params) {
186
+ const modelProvider = params.modelProvider?.trim();
187
+ if (!modelProvider) return;
188
+ if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === PUBLIC_OPENAI_MODEL_PROVIDER) return;
189
+ return modelProvider;
190
+ }
191
+ function resolveCodexAppServerAuthProfileCredential(lookup) {
192
+ const authProfileId = lookup.authProfileId?.trim();
193
+ if (!authProfileId) return;
194
+ return (lookup.authProfileStore ?? loadCodexAppServerAuthProfileStore({
195
+ agentDir: lookup.agentDir,
196
+ authProfileId,
197
+ config: lookup.config
198
+ })).profiles[authProfileId];
199
+ }
200
+ function loadCodexAppServerAuthProfileStore(params) {
201
+ return ensureAuthProfileStore(params.agentDir?.trim() || resolveDefaultAgentDir(params.config ?? {}), {
202
+ allowKeychainPrompt: false,
203
+ config: params.config,
204
+ externalCliProviderIds: [CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER],
205
+ externalCliProfileIds: [params.authProfileId]
206
+ });
207
+ }
208
+ function isCodexAppServerNativeAuthProvider(params) {
209
+ const provider = params.provider?.trim();
210
+ return Boolean(provider && resolveProviderIdForAuth(provider, { config: params.config }) === CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER);
211
+ }
212
+ function readApprovalPolicy(value) {
213
+ return value === "never" || value === "on-request" || value === "on-failure" || value === "untrusted" ? value : void 0;
214
+ }
215
+ function readSandboxMode(value) {
216
+ return value === "read-only" || value === "workspace-write" || value === "danger-full-access" ? value : void 0;
217
+ }
218
+ function readServiceTier(value) {
219
+ return normalizeCodexServiceTier(value);
220
+ }
221
+ //#endregion
222
+ export { session_binding_exports as a, readCodexAppServerBinding as i, isCodexAppServerNativeAuthProfile as n, writeCodexAppServerBinding as o, normalizeCodexAppServerBindingModelProvider as r, clearCodexAppServerBinding as t };