@gakr-gakr/codex 0.1.0 → 0.1.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 (115) hide show
  1. package/dist/client-DNN2uyJW.js +642 -0
  2. package/dist/client-factory-Bu9OClHJ.js +9 -0
  3. package/dist/command-formatters-BpPOTePl.js +520 -0
  4. package/dist/command-handlers-BBs7Vws9.js +1533 -0
  5. package/dist/compact-CDboBy7o.js +329 -0
  6. package/dist/computer-use-DCZB46Sw.js +367 -0
  7. package/dist/config-CLMSw0p2.js +510 -0
  8. package/dist/doctor-contract-api.js +53 -0
  9. package/dist/harness.js +51 -0
  10. package/dist/index.js +1171 -0
  11. package/dist/media-understanding-provider.js +335 -0
  12. package/dist/models-jLA2SIvd.js +110 -0
  13. package/dist/node-cli-sessions-BLRDs_US.js +1216 -0
  14. package/dist/plugin-activation-CEy_oYpx.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-9LxQdE0K.js +24 -0
  22. package/dist/request-DbSPeTcV.js +89 -0
  23. package/dist/rolldown-runtime-DUslC3ob.js +14 -0
  24. package/dist/run-attempt-BoEwzQCv.js +5463 -0
  25. package/dist/session-binding-e2GFp9VH.js +222 -0
  26. package/dist/shared-client-D7Vy0glq.js +631 -0
  27. package/dist/side-question-BDLuEzFP.js +668 -0
  28. package/dist/test-api.js +49 -0
  29. package/dist/thread-lifecycle-Clo0EHMk.js +1565 -0
  30. package/dist/vision-tools-Cofrv35p.js +1379 -0
  31. package/package.json +16 -1
  32. package/doctor-contract-api.ts +0 -68
  33. package/harness.ts +0 -72
  34. package/index.ts +0 -124
  35. package/media-understanding-provider.ts +0 -521
  36. package/prompt-overlay.ts +0 -21
  37. package/provider-catalog.ts +0 -83
  38. package/provider-discovery.ts +0 -45
  39. package/provider.ts +0 -243
  40. package/src/app-server/app-inventory-cache.ts +0 -324
  41. package/src/app-server/approval-bridge.ts +0 -1211
  42. package/src/app-server/auth-bridge.ts +0 -614
  43. package/src/app-server/capabilities.ts +0 -27
  44. package/src/app-server/client-factory.ts +0 -24
  45. package/src/app-server/client.ts +0 -715
  46. package/src/app-server/compact.ts +0 -512
  47. package/src/app-server/computer-use.ts +0 -683
  48. package/src/app-server/config.ts +0 -1038
  49. package/src/app-server/context-engine-projection.ts +0 -403
  50. package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
  51. package/src/app-server/dynamic-tool-profile.ts +0 -70
  52. package/src/app-server/dynamic-tools.ts +0 -623
  53. package/src/app-server/elicitation-bridge.ts +0 -783
  54. package/src/app-server/event-projector.ts +0 -2065
  55. package/src/app-server/image-payload-sanitizer.ts +0 -167
  56. package/src/app-server/local-runtime-attribution.ts +0 -39
  57. package/src/app-server/managed-binary.ts +0 -193
  58. package/src/app-server/models.ts +0 -172
  59. package/src/app-server/native-hook-relay.ts +0 -150
  60. package/src/app-server/native-subagent-task-mirror.ts +0 -497
  61. package/src/app-server/plugin-activation.ts +0 -283
  62. package/src/app-server/plugin-app-cache-key.ts +0 -74
  63. package/src/app-server/plugin-approval-roundtrip.ts +0 -122
  64. package/src/app-server/plugin-inventory.ts +0 -357
  65. package/src/app-server/plugin-thread-config.ts +0 -455
  66. package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +0 -33
  67. package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +0 -199
  68. package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +0 -102
  69. package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +0 -227
  70. package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +0 -2630
  71. package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +0 -2630
  72. package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +0 -1659
  73. package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +0 -1655
  74. package/src/app-server/protocol-validators.ts +0 -203
  75. package/src/app-server/protocol.ts +0 -520
  76. package/src/app-server/rate-limit-cache.ts +0 -48
  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.ts +0 -4862
  80. package/src/app-server/session-binding.ts +0 -398
  81. package/src/app-server/session-history.ts +0 -44
  82. package/src/app-server/shared-client.ts +0 -289
  83. package/src/app-server/side-question.ts +0 -1009
  84. package/src/app-server/test-support.ts +0 -48
  85. package/src/app-server/thread-lifecycle.ts +0 -959
  86. package/src/app-server/timeout.ts +0 -9
  87. package/src/app-server/tool-progress-normalization.ts +0 -77
  88. package/src/app-server/trajectory.ts +0 -368
  89. package/src/app-server/transcript-mirror.ts +0 -208
  90. package/src/app-server/transport-stdio.ts +0 -107
  91. package/src/app-server/transport-websocket.ts +0 -90
  92. package/src/app-server/transport.ts +0 -117
  93. package/src/app-server/user-input-bridge.ts +0 -316
  94. package/src/app-server/version.ts +0 -4
  95. package/src/app-server/vision-tools.ts +0 -12
  96. package/src/command-account.ts +0 -544
  97. package/src/command-formatters.ts +0 -426
  98. package/src/command-handlers.ts +0 -2021
  99. package/src/command-plugins-management.ts +0 -137
  100. package/src/command-rpc.ts +0 -142
  101. package/src/commands.ts +0 -65
  102. package/src/conversation-binding-data.ts +0 -124
  103. package/src/conversation-binding.ts +0 -561
  104. package/src/conversation-control.ts +0 -303
  105. package/src/conversation-turn-collector.ts +0 -186
  106. package/src/conversation-turn-input.ts +0 -106
  107. package/src/migration/apply.ts +0 -501
  108. package/src/migration/helpers.ts +0 -55
  109. package/src/migration/plan.ts +0 -461
  110. package/src/migration/provider.ts +0 -41
  111. package/src/migration/source.ts +0 -643
  112. package/src/migration/targets.ts +0 -25
  113. package/src/node-cli-sessions.ts +0 -711
  114. package/test-api.ts +0 -95
  115. package/tsconfig.json +0 -16
@@ -0,0 +1,222 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
2
+ import { o as normalizeCodexServiceTier } from "./config-CLMSw0p2.js";
3
+ import { embeddedAgentLog } from "autobot/plugin-sdk/agent-harness-runtime";
4
+ import fs from "node:fs/promises";
5
+ import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "autobot/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 };