@withbuddi/buddi 0.1.0-pre.19 → 0.1.0-pre.20
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/README.md +1 -1
- package/node_modules/@buddi/cli/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/cli/dist/commands.js +1 -1
- package/node_modules/@buddi/cli/dist/commands.js.map +1 -1
- package/node_modules/@buddi/cli/dist/main.d.ts.map +1 -1
- package/node_modules/@buddi/cli/dist/main.js +12 -2
- package/node_modules/@buddi/cli/dist/main.js.map +1 -1
- package/node_modules/@buddi/cli/dist/status.d.ts +10 -0
- package/node_modules/@buddi/cli/dist/status.d.ts.map +1 -1
- package/node_modules/@buddi/cli/dist/status.js +4 -0
- package/node_modules/@buddi/cli/dist/status.js.map +1 -1
- package/node_modules/@buddi/core/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/core/dist/agents/catalog.d.ts.map +1 -1
- package/node_modules/@buddi/core/dist/agents/catalog.js +7 -1
- package/node_modules/@buddi/core/dist/agents/catalog.js.map +1 -1
- package/node_modules/@buddi/core/dist/provider-accounts.d.ts +7 -1
- package/node_modules/@buddi/core/dist/provider-accounts.d.ts.map +1 -1
- package/node_modules/@buddi/core/dist/provider-accounts.js +14 -1
- package/node_modules/@buddi/core/dist/provider-accounts.js.map +1 -1
- package/node_modules/@buddi/core/dist/provider.d.ts +6 -0
- package/node_modules/@buddi/core/dist/provider.d.ts.map +1 -1
- package/node_modules/@buddi/core/dist/provider.js.map +1 -1
- package/node_modules/@buddi/core/migrations/046_ollama_device_key.sql +7 -0
- package/node_modules/@buddi/core/migrations/047_reported_context_windows.sql +5 -0
- package/node_modules/@buddi/gateway/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/gateway/dist/codex-accounts.d.ts +24 -11
- package/node_modules/@buddi/gateway/dist/codex-accounts.d.ts.map +1 -1
- package/node_modules/@buddi/gateway/dist/codex-accounts.js +151 -215
- package/node_modules/@buddi/gateway/dist/codex-accounts.js.map +1 -1
- package/node_modules/@buddi/gateway/dist/index.d.ts +1 -0
- package/node_modules/@buddi/gateway/dist/index.d.ts.map +1 -1
- package/node_modules/@buddi/gateway/dist/index.js +1 -0
- package/node_modules/@buddi/gateway/dist/index.js.map +1 -1
- package/node_modules/@buddi/gateway/dist/ollama-accounts.d.ts +87 -0
- package/node_modules/@buddi/gateway/dist/ollama-accounts.d.ts.map +1 -0
- package/node_modules/@buddi/gateway/dist/ollama-accounts.js +179 -0
- package/node_modules/@buddi/gateway/dist/ollama-accounts.js.map +1 -0
- package/node_modules/@buddi/gateway/dist/provider-accounts.d.ts +47 -1
- package/node_modules/@buddi/gateway/dist/provider-accounts.d.ts.map +1 -1
- package/node_modules/@buddi/gateway/dist/provider-accounts.js +182 -25
- package/node_modules/@buddi/gateway/dist/provider-accounts.js.map +1 -1
- package/node_modules/@buddi/gateway/dist/surfaces/context-budget.d.ts.map +1 -1
- package/node_modules/@buddi/gateway/dist/surfaces/context-budget.js +10 -3
- package/node_modules/@buddi/gateway/dist/surfaces/context-budget.js.map +1 -1
- package/node_modules/@buddi/gateway/dist/web/server.d.ts.map +1 -1
- package/node_modules/@buddi/gateway/dist/web/server.js +16 -13
- package/node_modules/@buddi/gateway/dist/web/server.js.map +1 -1
- package/node_modules/@buddi/install/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/runtime/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/runtime/dist/codex-direct.d.ts +55 -0
- package/node_modules/@buddi/runtime/dist/codex-direct.d.ts.map +1 -0
- package/node_modules/@buddi/runtime/dist/codex-direct.js +334 -0
- package/node_modules/@buddi/runtime/dist/codex-direct.js.map +1 -0
- package/node_modules/@buddi/runtime/dist/codex-oauth.d.ts +66 -0
- package/node_modules/@buddi/runtime/dist/codex-oauth.d.ts.map +1 -0
- package/node_modules/@buddi/runtime/dist/codex-oauth.js +210 -0
- package/node_modules/@buddi/runtime/dist/codex-oauth.js.map +1 -0
- package/node_modules/@buddi/runtime/dist/codex-profile.d.ts +19 -0
- package/node_modules/@buddi/runtime/dist/codex-profile.d.ts.map +1 -0
- package/node_modules/@buddi/runtime/dist/codex-profile.js +99 -0
- package/node_modules/@buddi/runtime/dist/codex-profile.js.map +1 -0
- package/node_modules/@buddi/runtime/dist/context-window.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/context-window.js +4 -0
- package/node_modules/@buddi/runtime/dist/context-window.js.map +1 -1
- package/node_modules/@buddi/runtime/dist/delegate.d.ts +24 -0
- package/node_modules/@buddi/runtime/dist/delegate.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/delegate.js +87 -11
- package/node_modules/@buddi/runtime/dist/delegate.js.map +1 -1
- package/node_modules/@buddi/runtime/dist/index.d.ts +4 -4
- package/node_modules/@buddi/runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/index.js +5 -5
- package/node_modules/@buddi/runtime/dist/index.js.map +1 -1
- package/node_modules/@buddi/runtime/dist/loop.d.ts +7 -0
- package/node_modules/@buddi/runtime/dist/loop.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/loop.js +48 -8
- package/node_modules/@buddi/runtime/dist/loop.js.map +1 -1
- package/node_modules/@buddi/runtime/dist/ollama-signing.d.ts +52 -0
- package/node_modules/@buddi/runtime/dist/ollama-signing.d.ts.map +1 -0
- package/node_modules/@buddi/runtime/dist/ollama-signing.js +154 -0
- package/node_modules/@buddi/runtime/dist/ollama-signing.js.map +1 -0
- package/node_modules/@buddi/runtime/dist/openai.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/openai.js +21 -7
- package/node_modules/@buddi/runtime/dist/openai.js.map +1 -1
- package/node_modules/@buddi/runtime/dist/provider-models.d.ts +2 -0
- package/node_modules/@buddi/runtime/dist/provider-models.d.ts.map +1 -1
- package/node_modules/@buddi/runtime/dist/provider-models.js +8 -3
- package/node_modules/@buddi/runtime/dist/provider-models.js.map +1 -1
- package/node_modules/@buddi/tool-artifacts/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/tool-browser/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/tool-email/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/tool-host/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/tool-memory/dist/.tsbuildinfo +1 -1
- package/node_modules/@buddi/tool-web/dist/.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/packages/cli/dist/.tsbuildinfo +1 -1
- package/packages/cli/dist/commands.js +1 -1
- package/packages/cli/dist/commands.js.map +1 -1
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +12 -2
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/status.d.ts +10 -0
- package/packages/cli/dist/status.d.ts.map +1 -1
- package/packages/cli/dist/status.js +4 -0
- package/packages/cli/dist/status.js.map +1 -1
- package/packages/core/dist/.tsbuildinfo +1 -1
- package/packages/core/dist/agents/catalog.d.ts.map +1 -1
- package/packages/core/dist/agents/catalog.js +7 -1
- package/packages/core/dist/agents/catalog.js.map +1 -1
- package/packages/core/dist/provider-accounts.d.ts +7 -1
- package/packages/core/dist/provider-accounts.d.ts.map +1 -1
- package/packages/core/dist/provider-accounts.js +14 -1
- package/packages/core/dist/provider-accounts.js.map +1 -1
- package/packages/core/dist/provider.d.ts +6 -0
- package/packages/core/dist/provider.d.ts.map +1 -1
- package/packages/core/dist/provider.js.map +1 -1
- package/packages/core/migrations/046_ollama_device_key.sql +7 -0
- package/packages/core/migrations/047_reported_context_windows.sql +5 -0
- package/packages/gateway/dist/.tsbuildinfo +1 -1
- package/packages/gateway/dist/codex-accounts.d.ts +24 -11
- package/packages/gateway/dist/codex-accounts.d.ts.map +1 -1
- package/packages/gateway/dist/codex-accounts.js +151 -215
- package/packages/gateway/dist/codex-accounts.js.map +1 -1
- package/packages/gateway/dist/index.d.ts +1 -0
- package/packages/gateway/dist/index.d.ts.map +1 -1
- package/packages/gateway/dist/index.js +1 -0
- package/packages/gateway/dist/index.js.map +1 -1
- package/packages/gateway/dist/ollama-accounts.d.ts +87 -0
- package/packages/gateway/dist/ollama-accounts.d.ts.map +1 -0
- package/packages/gateway/dist/ollama-accounts.js +179 -0
- package/packages/gateway/dist/ollama-accounts.js.map +1 -0
- package/packages/gateway/dist/provider-accounts.d.ts +47 -1
- package/packages/gateway/dist/provider-accounts.d.ts.map +1 -1
- package/packages/gateway/dist/provider-accounts.js +182 -25
- package/packages/gateway/dist/provider-accounts.js.map +1 -1
- package/packages/gateway/dist/surfaces/context-budget.d.ts.map +1 -1
- package/packages/gateway/dist/surfaces/context-budget.js +10 -3
- package/packages/gateway/dist/surfaces/context-budget.js.map +1 -1
- package/packages/gateway/dist/web/server.d.ts.map +1 -1
- package/packages/gateway/dist/web/server.js +16 -13
- package/packages/gateway/dist/web/server.js.map +1 -1
- package/packages/install/dist/.tsbuildinfo +1 -1
- package/packages/runtime/dist/.tsbuildinfo +1 -1
- package/packages/runtime/dist/codex-direct.d.ts +55 -0
- package/packages/runtime/dist/codex-direct.d.ts.map +1 -0
- package/packages/runtime/dist/codex-direct.js +334 -0
- package/packages/runtime/dist/codex-direct.js.map +1 -0
- package/packages/runtime/dist/codex-oauth.d.ts +66 -0
- package/packages/runtime/dist/codex-oauth.d.ts.map +1 -0
- package/packages/runtime/dist/codex-oauth.js +210 -0
- package/packages/runtime/dist/codex-oauth.js.map +1 -0
- package/packages/runtime/dist/codex-profile.d.ts +19 -0
- package/packages/runtime/dist/codex-profile.d.ts.map +1 -0
- package/packages/runtime/dist/codex-profile.js +99 -0
- package/packages/runtime/dist/codex-profile.js.map +1 -0
- package/packages/runtime/dist/context-window.d.ts.map +1 -1
- package/packages/runtime/dist/context-window.js +4 -0
- package/packages/runtime/dist/context-window.js.map +1 -1
- package/packages/runtime/dist/delegate.d.ts +24 -0
- package/packages/runtime/dist/delegate.d.ts.map +1 -1
- package/packages/runtime/dist/delegate.js +87 -11
- package/packages/runtime/dist/delegate.js.map +1 -1
- package/packages/runtime/dist/index.d.ts +4 -4
- package/packages/runtime/dist/index.d.ts.map +1 -1
- package/packages/runtime/dist/index.js +5 -5
- package/packages/runtime/dist/index.js.map +1 -1
- package/packages/runtime/dist/loop.d.ts +7 -0
- package/packages/runtime/dist/loop.d.ts.map +1 -1
- package/packages/runtime/dist/loop.js +48 -8
- package/packages/runtime/dist/loop.js.map +1 -1
- package/packages/runtime/dist/ollama-signing.d.ts +52 -0
- package/packages/runtime/dist/ollama-signing.d.ts.map +1 -0
- package/packages/runtime/dist/ollama-signing.js +154 -0
- package/packages/runtime/dist/ollama-signing.js.map +1 -0
- package/packages/runtime/dist/openai.d.ts.map +1 -1
- package/packages/runtime/dist/openai.js +21 -7
- package/packages/runtime/dist/openai.js.map +1 -1
- package/packages/runtime/dist/provider-models.d.ts +2 -0
- package/packages/runtime/dist/provider-models.d.ts.map +1 -1
- package/packages/runtime/dist/provider-models.js +8 -3
- package/packages/runtime/dist/provider-models.js.map +1 -1
- package/packages/tools/artifacts/dist/.tsbuildinfo +1 -1
- package/packages/tools/browser/dist/.tsbuildinfo +1 -1
- package/packages/tools/email/dist/.tsbuildinfo +1 -1
- package/packages/tools/host/dist/.tsbuildinfo +1 -1
- package/packages/tools/memory/dist/.tsbuildinfo +1 -1
- package/packages/tools/web/dist/.tsbuildinfo +1 -1
- package/packages/web/dist/assets/index-BRc5auXm.js +123 -0
- package/packages/web/dist/assets/{index-B727JQsO.css → index-DwUpotTR.css} +1 -1
- package/packages/web/dist/index.html +2 -2
- package/node_modules/@buddi/runtime/dist/codex-app-server.d.ts +0 -20
- package/node_modules/@buddi/runtime/dist/codex-app-server.d.ts.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-app-server.js +0 -172
- package/node_modules/@buddi/runtime/dist/codex-app-server.js.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-policy.d.ts +0 -6
- package/node_modules/@buddi/runtime/dist/codex-policy.d.ts.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-policy.js +0 -79
- package/node_modules/@buddi/runtime/dist/codex-policy.js.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-rpc.d.ts +0 -34
- package/node_modules/@buddi/runtime/dist/codex-rpc.d.ts.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-rpc.js +0 -152
- package/node_modules/@buddi/runtime/dist/codex-rpc.js.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-session.d.ts +0 -30
- package/node_modules/@buddi/runtime/dist/codex-session.d.ts.map +0 -1
- package/node_modules/@buddi/runtime/dist/codex-session.js +0 -169
- package/node_modules/@buddi/runtime/dist/codex-session.js.map +0 -1
- package/packages/runtime/dist/codex-app-server.d.ts +0 -20
- package/packages/runtime/dist/codex-app-server.d.ts.map +0 -1
- package/packages/runtime/dist/codex-app-server.js +0 -172
- package/packages/runtime/dist/codex-app-server.js.map +0 -1
- package/packages/runtime/dist/codex-policy.d.ts +0 -6
- package/packages/runtime/dist/codex-policy.d.ts.map +0 -1
- package/packages/runtime/dist/codex-policy.js +0 -79
- package/packages/runtime/dist/codex-policy.js.map +0 -1
- package/packages/runtime/dist/codex-rpc.d.ts +0 -34
- package/packages/runtime/dist/codex-rpc.d.ts.map +0 -1
- package/packages/runtime/dist/codex-rpc.js +0 -152
- package/packages/runtime/dist/codex-rpc.js.map +0 -1
- package/packages/runtime/dist/codex-session.d.ts +0 -30
- package/packages/runtime/dist/codex-session.d.ts.map +0 -1
- package/packages/runtime/dist/codex-session.js +0 -169
- package/packages/runtime/dist/codex-session.js.map +0 -1
- package/packages/web/dist/assets/index-OA0xgibo.js +0 -123
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
if (width === 'narrow' || width === 'full') root.setAttribute('data-width', width);
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="./assets/index-
|
|
26
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
25
|
+
<script type="module" crossorigin src="./assets/index-BRc5auXm.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DwUpotTR.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Experimental, dependency-injected App Server adapter. Selected only by the
|
|
3
|
-
* opt-in Codex account service, never by the generic HTTP provider factory.
|
|
4
|
-
*
|
|
5
|
-
* One child/thread per completion. A tool request is returned as a proposal, then
|
|
6
|
-
* the child is closed BEFORE the caller can execute it through Buddi's registry.
|
|
7
|
-
* Resumption reconstructs history; no subprocess waits through owner approval.
|
|
8
|
-
*/
|
|
9
|
-
import type { CompletionRequest, RuntimeProvider } from './anthropic.js';
|
|
10
|
-
import { type CodexRpc } from './codex-rpc.js';
|
|
11
|
-
/** Keep useful classifications, never raw provider text (which can echo secrets). */
|
|
12
|
-
export declare function codexTurnError(value: unknown): Error;
|
|
13
|
-
export declare function codexHistory(req: CompletionRequest, names: Map<string, string>): unknown[];
|
|
14
|
-
export declare function createCodexAppServerAdapter(options: {
|
|
15
|
-
model: string;
|
|
16
|
-
cwd: string;
|
|
17
|
-
connect(): CodexRpc;
|
|
18
|
-
timeoutMs?: number;
|
|
19
|
-
}): RuntimeProvider;
|
|
20
|
-
//# sourceMappingURL=codex-app-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-app-server.d.ts","sourceRoot":"","sources":["../src/codex-app-server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAoC,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG3G,OAAO,EAAmB,KAAK,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAOjF,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAsBpD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,EAAE,CAc1F;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,IAAI,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAgGlB"}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { toolNameMap } from './anthropic.js';
|
|
2
|
-
import { providerCapabilities } from './capabilities.js';
|
|
3
|
-
import { initializeCodex } from './codex-rpc.js';
|
|
4
|
-
import { assertCodexIsolation } from './codex-policy.js';
|
|
5
|
-
function record(value) {
|
|
6
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
7
|
-
}
|
|
8
|
-
/** Keep useful classifications, never raw provider text (which can echo secrets). */
|
|
9
|
-
export function codexTurnError(value) {
|
|
10
|
-
const error = record(value);
|
|
11
|
-
const message = typeof error.message === 'string' ? error.message : '';
|
|
12
|
-
if (/model.{0,200}(?:not supported|unsupported|not available|does not exist)/i.test(message)) {
|
|
13
|
-
return Object.assign(new Error('The selected model is not available for this Codex account. Choose a supported model in agent settings.'), { status: 400, type: 'model_not_supported' });
|
|
14
|
-
}
|
|
15
|
-
const info = error.codexErrorInfo;
|
|
16
|
-
const kind = typeof info === 'string' ? info : Object.keys(record(info))[0];
|
|
17
|
-
const known = {
|
|
18
|
-
contextWindowExceeded: [400, 'context_window_exceeded'], usageLimitExceeded: [429, 'rate_limit_error'],
|
|
19
|
-
unauthorized: [401, 'authentication_error'], badRequest: [400, 'invalid_request_error'],
|
|
20
|
-
internalServerError: [500, 'provider_error'], httpConnectionFailed: [undefined, 'transport_error'],
|
|
21
|
-
responseStreamConnectionFailed: [undefined, 'transport_error'], responseStreamDisconnected: [undefined, 'transport_error'],
|
|
22
|
-
responseTooManyFailedAttempts: [undefined, 'transport_error'], sandboxError: [undefined, 'sandbox_error'],
|
|
23
|
-
};
|
|
24
|
-
const recognized = kind && Object.hasOwn(known, kind) ? known[kind] : undefined;
|
|
25
|
-
if (!recognized)
|
|
26
|
-
return new Error('Codex turn did not complete successfully.');
|
|
27
|
-
const upstream = record(record(info)[kind]).httpStatusCode;
|
|
28
|
-
const status = typeof upstream === 'number' && Number.isInteger(upstream) && upstream >= 400 && upstream <= 599 ? upstream : recognized[0];
|
|
29
|
-
return Object.assign(new Error(`Codex turn failed (${kind}${status ? `; HTTP ${status}` : ''}).`), { ...(status !== undefined ? { status } : {}), type: status !== undefined ? 'http_error' : recognized[1] });
|
|
30
|
-
}
|
|
31
|
-
export function codexHistory(req, names) {
|
|
32
|
-
return req.messages.flatMap((message) => message.content.map((block) => {
|
|
33
|
-
switch (block.type) {
|
|
34
|
-
case 'text': return { type: 'message', role: message.role, content: [{ type: message.role === 'user' ? 'input_text' : 'output_text', text: block.text }] };
|
|
35
|
-
case 'image': return { type: 'message', role: message.role, content: [{ type: 'input_image', image_url: `data:${block.mime};base64,${block.data}` }] };
|
|
36
|
-
case 'tool_use': {
|
|
37
|
-
const name = names.get(block.name);
|
|
38
|
-
if (!name)
|
|
39
|
-
throw new Error('Codex cannot replay a tool that is no longer granted.');
|
|
40
|
-
return { type: 'function_call', call_id: block.id, name, arguments: JSON.stringify(block.input) };
|
|
41
|
-
}
|
|
42
|
-
case 'tool_result': return { type: 'function_call_output', call_id: block.tool_use_id, output: block.is_error ? `[Buddi tool failed]\n${block.content}` : block.content };
|
|
43
|
-
default: throw new Error(`Codex experiment cannot replay ${block.type} content.`);
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
export function createCodexAppServerAdapter(options) {
|
|
48
|
-
return {
|
|
49
|
-
capabilities: { ...providerCapabilities('openai'), parallelToolCalls: false, usageReporting: false },
|
|
50
|
-
async complete(req) {
|
|
51
|
-
req.signal?.throwIfAborted();
|
|
52
|
-
// The native turn API has no exact per-completion max-output-token control.
|
|
53
|
-
// Do not pretend Buddi's testing/cost cap was enforced.
|
|
54
|
-
if (req.maxTokens !== undefined)
|
|
55
|
-
throw new Error('Codex experiment does not support an exact maxTokens cap.');
|
|
56
|
-
if (req.nativeSearch)
|
|
57
|
-
throw new Error('Codex native search is disabled; use a granted Buddi tool.');
|
|
58
|
-
const mapping = toolNameMap(req.tools, 64, ['request_user_input', 'skills']);
|
|
59
|
-
const names = new Map([...mapping].map(([wire, original]) => [original, wire]));
|
|
60
|
-
const history = codexHistory(req, names);
|
|
61
|
-
const rpc = options.connect();
|
|
62
|
-
let threadId;
|
|
63
|
-
let turnId;
|
|
64
|
-
let lastError;
|
|
65
|
-
const content = [];
|
|
66
|
-
const usage = { input: 0, output: 0 };
|
|
67
|
-
let finish;
|
|
68
|
-
let fail;
|
|
69
|
-
let settled = false;
|
|
70
|
-
const done = new Promise((resolve, reject) => {
|
|
71
|
-
finish = (response) => { if (!settled) {
|
|
72
|
-
settled = true;
|
|
73
|
-
resolve(response);
|
|
74
|
-
} };
|
|
75
|
-
fail = (error) => { if (!settled) {
|
|
76
|
-
settled = true;
|
|
77
|
-
reject(error);
|
|
78
|
-
} };
|
|
79
|
-
});
|
|
80
|
-
// A notification can fail while a setup request is pending.
|
|
81
|
-
void done.catch(() => { });
|
|
82
|
-
const abort = () => {
|
|
83
|
-
fail(new Error('Codex completion cancelled.'));
|
|
84
|
-
if (threadId && turnId)
|
|
85
|
-
void rpc.request('turn/interrupt', { threadId, turnId }).catch(() => { });
|
|
86
|
-
void rpc.close().catch(() => { });
|
|
87
|
-
};
|
|
88
|
-
req.signal?.addEventListener('abort', abort, { once: true });
|
|
89
|
-
const timer = setTimeout(() => { fail(new Error('Codex completion timed out.')); void rpc.close().catch(() => { }); }, options.timeoutMs ?? 120_000);
|
|
90
|
-
const offClose = rpc.onClose(fail);
|
|
91
|
-
const offMessage = rpc.onMessage((message) => {
|
|
92
|
-
if (settled)
|
|
93
|
-
return;
|
|
94
|
-
const params = record(message.params);
|
|
95
|
-
if (params.threadId !== threadId)
|
|
96
|
-
return;
|
|
97
|
-
if (turnId && params.turnId && params.turnId !== turnId)
|
|
98
|
-
return;
|
|
99
|
-
if (message.method === 'item/tool/call') {
|
|
100
|
-
const original = [...names].find(([, wire]) => wire === params.tool)?.[0];
|
|
101
|
-
if (!original || params.namespace || typeof params.callId !== 'string' || message.id === undefined) {
|
|
102
|
-
fail(new Error('Codex requested a tool outside this completion’s grant.'));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
content.push({ type: 'tool_use', id: params.callId, name: original, input: params.arguments });
|
|
106
|
-
finish({ content, stopReason: 'tool_use', usage, model: options.model });
|
|
107
|
-
}
|
|
108
|
-
// Do not answer the native tool request. The finally block closes the
|
|
109
|
-
// child after the turn/start acknowledgement, before returning to Buddi.
|
|
110
|
-
}
|
|
111
|
-
else if (message.method === 'item/completed') {
|
|
112
|
-
const item = record(params.item);
|
|
113
|
-
if (item.type === 'agentMessage' && typeof item.text === 'string')
|
|
114
|
-
content.push({ type: 'text', text: item.text });
|
|
115
|
-
}
|
|
116
|
-
else if (message.method === 'item/started') {
|
|
117
|
-
const type = record(params.item).type;
|
|
118
|
-
if (!['agentMessage', 'reasoning', 'userMessage', 'dynamicToolCall'].includes(String(type))) {
|
|
119
|
-
fail(new Error('Codex emitted an unsupported native activity.'));
|
|
120
|
-
void rpc.close().catch(() => { });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else if (message.method === 'thread/tokenUsage/updated') {
|
|
124
|
-
const last = record(record(params.tokenUsage).last);
|
|
125
|
-
if (typeof last.inputTokens === 'number')
|
|
126
|
-
usage.input = last.inputTokens;
|
|
127
|
-
if (typeof last.outputTokens === 'number')
|
|
128
|
-
usage.output = last.outputTokens;
|
|
129
|
-
}
|
|
130
|
-
else if (message.method === 'error') {
|
|
131
|
-
// Retrying error events are not terminal. Keep a sanitized fallback
|
|
132
|
-
// for clients that omit the error from the final turn notification.
|
|
133
|
-
lastError = codexTurnError(params.error);
|
|
134
|
-
}
|
|
135
|
-
else if (message.method === 'turn/completed') {
|
|
136
|
-
const turn = record(params.turn);
|
|
137
|
-
if (turn.status === 'completed')
|
|
138
|
-
finish({ content, stopReason: 'end_turn', usage, model: options.model });
|
|
139
|
-
else
|
|
140
|
-
fail(turn.error ? codexTurnError(turn.error) : lastError ?? codexTurnError(undefined));
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
try {
|
|
144
|
-
if (req.signal?.aborted)
|
|
145
|
-
abort();
|
|
146
|
-
await initializeCodex(rpc);
|
|
147
|
-
await assertCodexIsolation(rpc, options.cwd);
|
|
148
|
-
const started = record(await rpc.request('thread/start', {
|
|
149
|
-
model: options.model, cwd: options.cwd, ephemeral: true, environments: [], selectedCapabilityRoots: [],
|
|
150
|
-
approvalPolicy: 'on-request', sandbox: 'read-only',
|
|
151
|
-
baseInstructions: req.system,
|
|
152
|
-
dynamicTools: req.tools.map((tool) => ({ type: 'function', name: names.get(tool.name), description: tool.description, inputSchema: tool.input_schema })),
|
|
153
|
-
}));
|
|
154
|
-
threadId = record(started.thread).id;
|
|
155
|
-
if (!threadId || started.model !== options.model)
|
|
156
|
-
throw new Error('Codex thread model did not match the requested model.');
|
|
157
|
-
await rpc.request('thread/inject_items', { threadId, items: history });
|
|
158
|
-
const turn = record(await rpc.request('turn/start', { threadId, input: [] }));
|
|
159
|
-
turnId = record(turn.turn).id;
|
|
160
|
-
return await done;
|
|
161
|
-
}
|
|
162
|
-
finally {
|
|
163
|
-
clearTimeout(timer);
|
|
164
|
-
req.signal?.removeEventListener('abort', abort);
|
|
165
|
-
offMessage();
|
|
166
|
-
offClose();
|
|
167
|
-
await rpc.close();
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
//# sourceMappingURL=codex-app-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-app-server.js","sourceRoot":"","sources":["../src/codex-app-server.ts"],"names":[],"mappings":"AASA,OAAO,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,EAAE,KAAK,CAAC,CAAC;gBAChD,UAAU,EAAE,CAAC;gBAAC,QAAQ,EAAE,CAAC;gBAAC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;YAC9C,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CodexRpc } from './codex-rpc.js';
|
|
2
|
-
/** Pinned configuration, coupled with an empty native skill-catalog preflight. */
|
|
3
|
-
export declare const CODEX_EXPERIMENT_CONFIG: Record<string, unknown>;
|
|
4
|
-
export declare function codexConfigArgs(config: Record<string, unknown>): string[];
|
|
5
|
-
export declare function assertCodexIsolation(rpc: CodexRpc, cwd: string): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=codex-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-policy.d.ts","sourceRoot":"","sources":["../src/codex-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA2C3D,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAEzE;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BpF"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/** Pinned configuration, coupled with an empty native skill-catalog preflight. */
|
|
2
|
-
export const CODEX_EXPERIMENT_CONFIG = {
|
|
3
|
-
approval_policy: 'on-request',
|
|
4
|
-
sandbox_mode: 'read-only',
|
|
5
|
-
web_search: 'disabled',
|
|
6
|
-
cli_auth_credentials_store: 'file',
|
|
7
|
-
forced_login_method: 'chatgpt',
|
|
8
|
-
mcp_servers: {},
|
|
9
|
-
notify: [],
|
|
10
|
-
hooks: {},
|
|
11
|
-
project_doc_max_bytes: 0,
|
|
12
|
-
check_for_update_on_startup: false,
|
|
13
|
-
'history.persistence': 'none',
|
|
14
|
-
'analytics.enabled': false,
|
|
15
|
-
'feedback.enabled': false,
|
|
16
|
-
'agents.enabled': false,
|
|
17
|
-
'features.shell_tool': false,
|
|
18
|
-
'features.unified_exec': false,
|
|
19
|
-
'features.shell_snapshot': false,
|
|
20
|
-
'features.view_image': false,
|
|
21
|
-
'tools.view_image': false,
|
|
22
|
-
'features.apps': false,
|
|
23
|
-
'features.plugins': false,
|
|
24
|
-
'features.remote_plugin': false,
|
|
25
|
-
'features.hooks': false,
|
|
26
|
-
'features.browser_use': false,
|
|
27
|
-
'features.browser_use_external': false,
|
|
28
|
-
'features.computer_use': false,
|
|
29
|
-
'features.in_app_browser': false,
|
|
30
|
-
'features.multi_agent': false,
|
|
31
|
-
'features.multi_agent_v2': false,
|
|
32
|
-
'features.memories': false,
|
|
33
|
-
'features.workspace_dependencies': false,
|
|
34
|
-
'features.skill_mcp_dependency_install': false,
|
|
35
|
-
'features.skip_host_skill_discovery': true,
|
|
36
|
-
'features.skill_search': false,
|
|
37
|
-
'features.code_mode': false,
|
|
38
|
-
// Required to dispatch modern models' tool calls to the client. This is the
|
|
39
|
-
// internal dispatcher, not a grant of native shell/code/browser tools.
|
|
40
|
-
'features.code_mode_host': true,
|
|
41
|
-
'features.image_generation': false,
|
|
42
|
-
'features.goals': false,
|
|
43
|
-
'features.sleep_tool': false,
|
|
44
|
-
'features.tool_suggest': false,
|
|
45
|
-
};
|
|
46
|
-
export function codexConfigArgs(config) {
|
|
47
|
-
return Object.entries(config).flatMap(([key, value]) => ['-c', `${key}=${JSON.stringify(value)}`]);
|
|
48
|
-
}
|
|
49
|
-
export async function assertCodexIsolation(rpc, cwd) {
|
|
50
|
-
const read = await rpc.request('config/read', { includeLayers: false });
|
|
51
|
-
const config = read?.config;
|
|
52
|
-
const features = config?.features;
|
|
53
|
-
if (!config || config.sandbox_mode !== 'read-only' || config.web_search !== 'disabled' ||
|
|
54
|
-
!features || Object.entries(CODEX_EXPERIMENT_CONFIG).some(([key, value]) => key.startsWith('features.') && features[key.slice('features.'.length)] !== value) ||
|
|
55
|
-
Object.values((config.mcp_servers ?? {})).some(server => server.enabled !== false)) {
|
|
56
|
-
throw new Error('Codex isolation check failed: effective native tool restrictions do not match.');
|
|
57
|
-
}
|
|
58
|
-
const result = await rpc.request('skills/list', { cwds: [cwd], forceReload: true });
|
|
59
|
-
if (!Array.isArray(result?.data) || result.data.length !== 1 ||
|
|
60
|
-
!Array.isArray(result.data[0]?.skills) || result.data[0].skills.length > 1000 ||
|
|
61
|
-
result.data[0].errors?.length) {
|
|
62
|
-
throw new Error('Codex isolation check failed: native skill catalog must be empty.');
|
|
63
|
-
}
|
|
64
|
-
for (const skill of result.data[0].skills) {
|
|
65
|
-
if (typeof skill.path !== 'string')
|
|
66
|
-
throw new Error('Invalid Codex skill catalog.');
|
|
67
|
-
// This changes ONLY the freshly-created private Codex profile's config,
|
|
68
|
-
// never the discovered skill file or the owner's real Codex settings.
|
|
69
|
-
if (skill.enabled !== false)
|
|
70
|
-
await rpc.request('skills/config/write', { path: skill.path, enabled: false });
|
|
71
|
-
}
|
|
72
|
-
const checked = await rpc.request('skills/list', { cwds: [cwd], forceReload: true });
|
|
73
|
-
if (!Array.isArray(checked?.data) || checked.data.length !== 1 ||
|
|
74
|
-
!Array.isArray(checked.data[0]?.skills) || checked.data[0].errors?.length ||
|
|
75
|
-
checked.data[0].skills.some(skill => skill.enabled !== false)) {
|
|
76
|
-
throw new Error('Codex isolation check failed: native skills remain enabled.');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=codex-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-policy.js","sourceRoot":"","sources":["../src/codex-policy.ts"],"names":[],"mappings":"AAEA,kFAAkF;A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C,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** Experimental Codex App Server NDJSON client. No credentials or raw stderr in errors. */
|
|
2
|
-
import { type ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
3
|
-
export type RpcMessage = {
|
|
4
|
-
id?: string | number;
|
|
5
|
-
method?: string;
|
|
6
|
-
params?: unknown;
|
|
7
|
-
result?: unknown;
|
|
8
|
-
error?: unknown;
|
|
9
|
-
};
|
|
10
|
-
export interface CodexRpc {
|
|
11
|
-
readonly processId?: number;
|
|
12
|
-
request(method: string, params?: unknown): Promise<unknown>;
|
|
13
|
-
notify(method: string, params?: unknown): void;
|
|
14
|
-
onMessage(listener: (message: RpcMessage) => void): () => void;
|
|
15
|
-
onClose(listener: (error: Error) => void): () => void;
|
|
16
|
-
close(): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
export declare function createCodexRpc(child: ChildProcessWithoutNullStreams, timeoutMs?: number): CodexRpc;
|
|
19
|
-
export declare function initializeCodex(rpc: CodexRpc): Promise<void>;
|
|
20
|
-
/** No shell, no inherited provider keys, no user's Codex configuration. */
|
|
21
|
-
export declare function spawnCodexRpc(options: {
|
|
22
|
-
executable: string;
|
|
23
|
-
profileDir: string;
|
|
24
|
-
cwd: string;
|
|
25
|
-
args: readonly string[];
|
|
26
|
-
}): CodexRpc;
|
|
27
|
-
/**
|
|
28
|
-
* The whole environment a native Codex child gets: a short allowlist, so no
|
|
29
|
-
* ambient provider key (OPENAI_API_KEY and the like) and no owner CODEX_HOME
|
|
30
|
-
* reaches it. CODEX_HOME is the native client's documented per-account
|
|
31
|
-
* configuration, not a change to this process or the owner's CLI environment.
|
|
32
|
-
*/
|
|
33
|
-
export declare function codexChildEnv(profileDir: string): Record<string, string>;
|
|
34
|
-
//# sourceMappingURL=codex-rpc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-rpc.d.ts","sourceRoot":"","sources":["../src/codex-rpc.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAS,KAAK,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACxH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC/D,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,8BAA8B,EAAE,SAAS,SAAS,GAAG,QAAQ,CAyFlG;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlE;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB,GAAG,QAAQ,CAIX;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxE"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/** Experimental Codex App Server NDJSON client. No credentials or raw stderr in errors. */
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
|
-
import { StringDecoder } from 'node:string_decoder';
|
|
4
|
-
export function createCodexRpc(child, timeoutMs = 30_000) {
|
|
5
|
-
const pending = new Map();
|
|
6
|
-
const listeners = new Set();
|
|
7
|
-
const closeListeners = new Set();
|
|
8
|
-
const decoder = new StringDecoder('utf8');
|
|
9
|
-
let sequence = 0;
|
|
10
|
-
let buffer = '';
|
|
11
|
-
let closed;
|
|
12
|
-
let resolveStopped;
|
|
13
|
-
const stopped = new Promise((resolve) => { resolveStopped = resolve; });
|
|
14
|
-
child.once('exit', resolveStopped);
|
|
15
|
-
child.once('error', resolveStopped);
|
|
16
|
-
const close = (error) => {
|
|
17
|
-
if (closed)
|
|
18
|
-
return;
|
|
19
|
-
closed = error;
|
|
20
|
-
for (const call of pending.values()) {
|
|
21
|
-
clearTimeout(call.timer);
|
|
22
|
-
call.reject(error);
|
|
23
|
-
}
|
|
24
|
-
pending.clear();
|
|
25
|
-
for (const listener of closeListeners)
|
|
26
|
-
listener(error);
|
|
27
|
-
// Every client owns its child, never a shared/user Codex process.
|
|
28
|
-
child.kill('SIGTERM');
|
|
29
|
-
const timer = setTimeout(() => { if (child.exitCode === null && child.signalCode === null)
|
|
30
|
-
child.kill('SIGKILL'); }, 1_000);
|
|
31
|
-
timer.unref();
|
|
32
|
-
};
|
|
33
|
-
const send = (message) => {
|
|
34
|
-
if (closed)
|
|
35
|
-
throw closed;
|
|
36
|
-
child.stdin.write(JSON.stringify(message) + '\n');
|
|
37
|
-
};
|
|
38
|
-
child.on('error', () => close(new Error('Codex App Server could not start. Check the configured executable.')));
|
|
39
|
-
child.on('exit', () => close(new Error('Codex App Server exited.')));
|
|
40
|
-
child.stdin.on('error', () => close(new Error('Codex App Server input closed.')));
|
|
41
|
-
child.stderr.resume(); // Drain, never copy auth codes, tokens or provider bodies to logs.
|
|
42
|
-
child.stdout.on('data', (chunk) => {
|
|
43
|
-
buffer += decoder.write(chunk);
|
|
44
|
-
if (Buffer.byteLength(buffer) > 16 * 1024 * 1024) {
|
|
45
|
-
close(new Error('Codex protocol frame exceeded the size limit.'));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
let newline;
|
|
49
|
-
while ((newline = buffer.indexOf('\n')) >= 0) {
|
|
50
|
-
const line = buffer.slice(0, newline);
|
|
51
|
-
buffer = buffer.slice(newline + 1);
|
|
52
|
-
if (!line.trim())
|
|
53
|
-
continue;
|
|
54
|
-
let message;
|
|
55
|
-
try {
|
|
56
|
-
const value = JSON.parse(line);
|
|
57
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
58
|
-
throw new Error();
|
|
59
|
-
message = value;
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
close(new Error('Invalid Codex App Server protocol frame.'));
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (!message.method && typeof message.id === 'number') {
|
|
66
|
-
const call = pending.get(message.id);
|
|
67
|
-
if (!call)
|
|
68
|
-
continue;
|
|
69
|
-
pending.delete(message.id);
|
|
70
|
-
clearTimeout(call.timer);
|
|
71
|
-
if (message.error !== undefined)
|
|
72
|
-
call.reject(new Error('Codex App Server rejected the request.'));
|
|
73
|
-
else
|
|
74
|
-
call.resolve(message.result);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// Never grant native command/file/permission requests. Tool requests are
|
|
78
|
-
// proposals only: the adapter closes this child before Buddi executes one.
|
|
79
|
-
if (message.id !== undefined && message.method !== 'item/tool/call') {
|
|
80
|
-
send({ id: message.id, error: { code: -32601, message: 'Only Buddi dynamic tools are supported.' } });
|
|
81
|
-
close(new Error('Codex requested an unsupported native capability.'));
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
for (const listener of listeners)
|
|
85
|
-
listener(message);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
processId: child.pid,
|
|
91
|
-
request(method, params) {
|
|
92
|
-
if (closed)
|
|
93
|
-
return Promise.reject(closed);
|
|
94
|
-
const id = ++sequence;
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
const timer = setTimeout(() => close(new Error('Codex App Server request timed out.')), timeoutMs);
|
|
97
|
-
pending.set(id, { resolve, reject, timer });
|
|
98
|
-
send({ id, method, params });
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
notify(method, params) { send({ method, params }); },
|
|
102
|
-
onMessage(listener) { listeners.add(listener); return () => listeners.delete(listener); },
|
|
103
|
-
onClose(listener) { if (closed)
|
|
104
|
-
listener(closed);
|
|
105
|
-
else
|
|
106
|
-
closeListeners.add(listener); return () => closeListeners.delete(listener); },
|
|
107
|
-
async close() {
|
|
108
|
-
close(new Error('Codex App Server session closed.'));
|
|
109
|
-
if (child.exitCode !== null || child.signalCode !== null)
|
|
110
|
-
return;
|
|
111
|
-
let timer;
|
|
112
|
-
try {
|
|
113
|
-
await Promise.race([stopped, new Promise((_, reject) => {
|
|
114
|
-
timer = setTimeout(() => reject(new Error('Codex child did not stop; tool execution must not proceed.')), 3_000);
|
|
115
|
-
})]);
|
|
116
|
-
}
|
|
117
|
-
finally {
|
|
118
|
-
clearTimeout(timer);
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export async function initializeCodex(rpc) {
|
|
124
|
-
await rpc.request('initialize', {
|
|
125
|
-
clientInfo: { name: 'buddi_codex_experiment', title: 'Buddi experimental adapter', version: '0.1.0' },
|
|
126
|
-
capabilities: { experimentalApi: true },
|
|
127
|
-
});
|
|
128
|
-
rpc.notify('initialized');
|
|
129
|
-
}
|
|
130
|
-
/** No shell, no inherited provider keys, no user's Codex configuration. */
|
|
131
|
-
export function spawnCodexRpc(options) {
|
|
132
|
-
return createCodexRpc(spawn(options.executable, ['app-server', ...options.args], {
|
|
133
|
-
cwd: options.cwd, env: codexChildEnv(options.profileDir), stdio: 'pipe', shell: false,
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* The whole environment a native Codex child gets: a short allowlist, so no
|
|
138
|
-
* ambient provider key (OPENAI_API_KEY and the like) and no owner CODEX_HOME
|
|
139
|
-
* reaches it. CODEX_HOME is the native client's documented per-account
|
|
140
|
-
* configuration, not a change to this process or the owner's CLI environment.
|
|
141
|
-
*/
|
|
142
|
-
export function codexChildEnv(profileDir) {
|
|
143
|
-
const env = {};
|
|
144
|
-
for (const name of ['PATH', 'HOME', 'USERPROFILE', 'SystemRoot', 'WINDIR', 'TMPDIR', 'TEMP', 'TMP', 'LANG']) {
|
|
145
|
-
const value = process.env[name];
|
|
146
|
-
if (value)
|
|
147
|
-
env[name] = value;
|
|
148
|
-
}
|
|
149
|
-
env.CODEX_HOME = profileDir;
|
|
150
|
-
return env;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=codex-rpc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-rpc.js","sourceRoot":"","sources":["../src/codex-rpc.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYpD,MAAM,UAAU,cAAc,CAAC,KAAqC,EAAE,SAAS,GAAG,MAAM;IACtF,MAAM,OAAO,GAAG,IAAI,GAAG,EAA+G,CAAC;IACvI,MA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OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;KACtF,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QAC5G,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,KAAK;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC/B,CAAC;IACD,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type CodexRpc } from './codex-rpc.js';
|
|
2
|
-
export interface CodexSession {
|
|
3
|
-
rpc: CodexRpc;
|
|
4
|
-
cwd: string;
|
|
5
|
-
/** Call only after the child has stopped, so refreshed credentials are stable. */
|
|
6
|
-
credential(): Promise<string | null>;
|
|
7
|
-
dispose(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
/** Shape validation only; never decode, log or expose the tokens. */
|
|
10
|
-
export declare function validateCodexCredential(value: string): string;
|
|
11
|
-
/** Clean only marked, private profiles whose parent AND native child have exited. */
|
|
12
|
-
export declare function cleanupCodexSessions(root?: string): Promise<void>;
|
|
13
|
-
export declare function openCodexSession(credential: string | null, executable?: string): Promise<CodexSession>;
|
|
14
|
-
/**
|
|
15
|
-
* A private profile with this credential staged in it, and no process: for a
|
|
16
|
-
* caller that runs its own native child (`codex exec`) rather than the App
|
|
17
|
-
* Server. Same directory shape, modes and orphan marker as a session, so the
|
|
18
|
-
* same cleanup recognises it; the marker names no child because this module
|
|
19
|
-
* never starts one.
|
|
20
|
-
*/
|
|
21
|
-
export interface StagedCodexProfile {
|
|
22
|
-
home: string;
|
|
23
|
-
workspace: string;
|
|
24
|
-
env: Record<string, string>;
|
|
25
|
-
/** Call only after the caller's child has exited. */
|
|
26
|
-
credential(): Promise<string | null>;
|
|
27
|
-
dispose(): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export declare function stageCodexProfile(credential: string): Promise<StagedCodexProfile>;
|
|
30
|
-
//# sourceMappingURL=codex-session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-session.d.ts","sourceRoot":"","sources":["../src/codex-session.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgC,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,kFAAkF;IAClF,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB7D;AAED,qFAAqF;AACrF,wBAAsB,oBAAoB,CAAC,IAAI,SAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBzE;AAED,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,SAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CA8C7G;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,qDAAqD;IACrD,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkCvF"}
|