@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.
- package/dist/client-DNN2uyJW.js +642 -0
- package/dist/client-factory-Bu9OClHJ.js +9 -0
- package/dist/command-formatters-BpPOTePl.js +520 -0
- package/dist/command-handlers-BBs7Vws9.js +1533 -0
- package/dist/compact-CDboBy7o.js +329 -0
- package/dist/computer-use-DCZB46Sw.js +367 -0
- package/dist/config-CLMSw0p2.js +510 -0
- package/dist/doctor-contract-api.js +53 -0
- package/dist/harness.js +51 -0
- package/dist/index.js +1171 -0
- package/dist/media-understanding-provider.js +335 -0
- package/dist/models-jLA2SIvd.js +110 -0
- package/dist/node-cli-sessions-BLRDs_US.js +1216 -0
- package/dist/plugin-activation-CEy_oYpx.js +452 -0
- package/dist/prompt-overlay.js +12 -0
- package/dist/protocol-C9UWI98H.js +9 -0
- package/dist/protocol-validators-BGBspNmF.js +5988 -0
- package/dist/provider-catalog.js +84 -0
- package/dist/provider-discovery.js +33 -0
- package/dist/provider.js +150 -0
- package/dist/rate-limit-cache-9LxQdE0K.js +24 -0
- package/dist/request-DbSPeTcV.js +89 -0
- package/dist/rolldown-runtime-DUslC3ob.js +14 -0
- package/dist/run-attempt-BoEwzQCv.js +5463 -0
- package/dist/session-binding-e2GFp9VH.js +222 -0
- package/dist/shared-client-D7Vy0glq.js +631 -0
- package/dist/side-question-BDLuEzFP.js +668 -0
- package/dist/test-api.js +49 -0
- package/dist/thread-lifecycle-Clo0EHMk.js +1565 -0
- package/dist/vision-tools-Cofrv35p.js +1379 -0
- package/package.json +16 -1
- package/doctor-contract-api.ts +0 -68
- package/harness.ts +0 -72
- package/index.ts +0 -124
- package/media-understanding-provider.ts +0 -521
- package/prompt-overlay.ts +0 -21
- package/provider-catalog.ts +0 -83
- package/provider-discovery.ts +0 -45
- package/provider.ts +0 -243
- package/src/app-server/app-inventory-cache.ts +0 -324
- package/src/app-server/approval-bridge.ts +0 -1211
- package/src/app-server/auth-bridge.ts +0 -614
- package/src/app-server/capabilities.ts +0 -27
- package/src/app-server/client-factory.ts +0 -24
- package/src/app-server/client.ts +0 -715
- package/src/app-server/compact.ts +0 -512
- package/src/app-server/computer-use.ts +0 -683
- package/src/app-server/config.ts +0 -1038
- package/src/app-server/context-engine-projection.ts +0 -403
- package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
- package/src/app-server/dynamic-tool-profile.ts +0 -70
- package/src/app-server/dynamic-tools.ts +0 -623
- package/src/app-server/elicitation-bridge.ts +0 -783
- package/src/app-server/event-projector.ts +0 -2065
- package/src/app-server/image-payload-sanitizer.ts +0 -167
- package/src/app-server/local-runtime-attribution.ts +0 -39
- package/src/app-server/managed-binary.ts +0 -193
- package/src/app-server/models.ts +0 -172
- package/src/app-server/native-hook-relay.ts +0 -150
- package/src/app-server/native-subagent-task-mirror.ts +0 -497
- 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.ts +0 -357
- 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.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.ts +0 -583
- package/src/app-server/request.ts +0 -73
- package/src/app-server/run-attempt.ts +0 -4862
- package/src/app-server/session-binding.ts +0 -398
- package/src/app-server/session-history.ts +0 -44
- package/src/app-server/shared-client.ts +0 -289
- package/src/app-server/side-question.ts +0 -1009
- package/src/app-server/test-support.ts +0 -48
- package/src/app-server/thread-lifecycle.ts +0 -959
- package/src/app-server/timeout.ts +0 -9
- package/src/app-server/tool-progress-normalization.ts +0 -77
- package/src/app-server/trajectory.ts +0 -368
- package/src/app-server/transcript-mirror.ts +0 -208
- package/src/app-server/transport-stdio.ts +0 -107
- package/src/app-server/transport-websocket.ts +0 -90
- package/src/app-server/transport.ts +0 -117
- 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 -426
- package/src/command-handlers.ts +0 -2021
- package/src/command-plugins-management.ts +0 -137
- package/src/command-rpc.ts +0 -142
- package/src/commands.ts +0 -65
- package/src/conversation-binding-data.ts +0 -124
- package/src/conversation-binding.ts +0 -561
- package/src/conversation-control.ts +0 -303
- package/src/conversation-turn-collector.ts +0 -186
- package/src/conversation-turn-input.ts +0 -106
- 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.ts +0 -41
- package/src/migration/source.ts +0 -643
- package/src/migration/targets.ts +0 -25
- package/src/node-cli-sessions.ts +0 -711
- package/test-api.ts +0 -95
- 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 };
|