@bolt-foundry/gambit 1.0.0-rc.1 → 1.0.0-rc.2

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/CHANGELOG.md CHANGED
@@ -1,14 +1,43 @@
1
1
  +++
2
2
  [release]
3
- since = "b6ed5a3a8d6a9b272ce520d885d3953d27c2c0d4"
3
+ since = "00872eb8b2190de2ba0904c0ac4f4cdbc611718b"
4
4
  +++
5
5
 
6
6
  # Changelog
7
7
 
8
- ## Unreleased
8
+ ## Unreleased (v1.0.0)
9
9
 
10
10
  - TBD
11
11
 
12
+ ## v1.0.0-rc.2
13
+
14
+ - fix(gambit): preserve structured text spacing
15
+ - fix(gambit): pass codex runtime tools
16
+ - feat(gambit): make provider execution responses-only
17
+ - feat(gambit): expose structured responses runtime
18
+ - fix(gambit): preserve responses continuation context
19
+ - chore(gambit): remove dead chat provider adapters
20
+ - test(gambit): remove legacy chat suites
21
+ - chore(browser): move runtime out of Gambit
22
+ - feat(gambit): add live browser pointer refs
23
+ - feat(workloop): bridge runtime Codex refresh to host services
24
+ - feat(gambit): add browser introspection live commands
25
+ - fix(gambit): fall back without host service token
26
+ - fix(workloop): preserve Codex auth refresh failures
27
+ - fix(gambit): preserve whitespace in streamed assistant deltas
28
+ - fix(workloop): disable Codex websockets in chief runtime
29
+ - feat(gambit): add local deck chat repro server
30
+ - feat(gambit): stream and control chat turns
31
+ - feat(gambit): improve chat event observability
32
+ - docs(gambit): use canonical graders frontmatter
33
+ - fix(gambit): reject sandboxed chat runs
34
+ - docs(gambit): reposition around scenarios and graders
35
+ - docs(gambit): record agent file naming feedback
36
+ - chore(gambit): record full precommit verification
37
+ - fix(gambit): hydrate chat transcript from persisted state
38
+ - chore(gambit): use generic runtime env names
39
+ - docs(workloop): align Gambit brand hierarchy
40
+
12
41
  ## v1.0.0-rc.1
13
42
 
14
43
  - BREAKING: make Gambit runtime execution Responses-only.
package/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # <img src="./gambit_1color_bg.png" alt="Gambit logo" height="50" />
2
2
 
3
- Gambit is an open-source, developer-first framework that helps you build\
4
- reliable LLM workflows by composing small, typed “decks”\
5
- with clear inputs/outputs and guardrails. Run decks locally, stream traces, and\
6
- debug with a built-in UI.
3
+ Agent frameworks help you build agents. Gambit helps you create the evidence
4
+ that they work.
5
+
6
+ Gambit is the synthetic scenario and evaluation layer for agent systems: create
7
+ realistic scenarios, validate their quality, run agents against them, grade the
8
+ behavior, capture trace evidence, and turn failures into regression suites.
9
+
10
+ Native Gambit agents are still the fastest path to the fully integrated loop:
11
+ typed inputs and outputs, local runs, scenarios, graders, traces, permission
12
+ evidence, and the simulator's Build/Test/Grade/Verify workflow.
7
13
 
8
14
  [Watch the demo video](https://youtu.be/J_hQ2L_yy60).
9
15
 
@@ -19,8 +25,8 @@ export OPENROUTER_API_KEY=...
19
25
  npx @bolt-foundry/gambit demo
20
26
  ```
21
27
 
22
- Downloads example files (hello decks plus the `examples/` gallery) and sets
23
- environment variables.
28
+ Downloads example files (hello agent definitions plus the `examples/` gallery)
29
+ and sets environment variables.
24
30
 
25
31
  To start onboarding with the simulator, run:
26
32
 
@@ -29,7 +35,7 @@ npx @bolt-foundry/gambit-simulator serve gambit/hello.deck.md
29
35
  open http://localhost:8000/debug
30
36
  ```
31
37
 
32
- Use the Build tab to draft your own workspace decks and scenarios.
38
+ Use the Build tab to draft your own workspace agents and scenarios.
33
39
 
34
40
  Run an example in the terminal (`repl`):
35
41
 
@@ -48,35 +54,102 @@ open http://localhost:8000/debug
48
54
 
49
55
  ---
50
56
 
57
+ ## Why Gambit
58
+
59
+ Agent teams already have many ways to build and orchestrate agents: native
60
+ Gambit, Mastra, LangGraph, OpenAI Agents SDK, CrewAI, Google ADK, LlamaIndex,
61
+ Pydantic AI, and custom stacks. The harder product problem is creating the
62
+ situations those agents need to survive, checking whether those situations are
63
+ good tests, and preserving the evidence when behavior regresses.
64
+
65
+ Gambit focuses on that reliability loop:
66
+
67
+ - **Generate scenarios** for realistic user, tool, workflow, policy, and edge
68
+ case pressure.
69
+ - **Evaluate the scenario data** for realism, coverage, difficulty, grounding,
70
+ duplication, and expected-outcome clarity.
71
+ - **Run agent evals** against native Gambit, Mastra, LangGraph, OpenAI, or
72
+ custom agents.
73
+ - **Grade behavior** from transcripts, artifacts, traces, and typed outputs.
74
+ - **Diagnose failures** with trace evidence and permission evidence.
75
+ - **Regenerate regression suites** from failures so the same behavior does not
76
+ quietly break again.
77
+
78
+ For a native Gambit agent, the same system defines, runs, traces, tests, grades,
79
+ and debugs the agent end to end. For a Mastra, LangGraph, OpenAI, or custom
80
+ agent, Gambit sits on the other side of the framework: the test-data engine,
81
+ grader loop, local reproduction harness, and CI behavior check.
82
+
83
+ ## Common workflows
84
+
85
+ ### Native Gambit path
86
+
87
+ Define the agent in Gambit, run it locally, add scenarios for the behavior that
88
+ must keep working, attach graders, inspect traces in the simulator, and reuse
89
+ the same checks in CI. This is the most direct path when you want Gambit to own
90
+ both the agent definition and the verification loop.
91
+
92
+ ### Bring your own agent
93
+
94
+ Use Mastra to build the TypeScript agent application. Use Gambit to create and
95
+ validate scenario suites around the important Mastra behaviors, then grade the
96
+ transcripts and artifacts those runs produce. A thin wrapper can record run
97
+ inputs, transcript turns, artifacts, state paths, and trace references so Gambit
98
+ can grade them and keep failing cases reproducible.
99
+
100
+ ### Pull request gate
101
+
102
+ Run important scenarios on every pull request, grade the resulting transcripts
103
+ or artifacts, and fail the check when behavior drops below the expected
104
+ standard. Failed checks should keep the trace, state, and reproduction inputs so
105
+ the regression can be debugged locally.
106
+
107
+ ```yaml
108
+ # Proposed workflow shape. This is positioning guidance, not a published
109
+ # bolt-foundry/gambit-action release.
110
+ name: Agent behavior checks
111
+
112
+ on:
113
+ pull_request:
114
+
115
+ jobs:
116
+ gambit:
117
+ runs-on: ubuntu-latest
118
+ steps:
119
+ - uses: actions/checkout@v4
120
+ - run: npx @bolt-foundry/gambit scenario gambit/root.deck.md --test-deck gambit/scenarios/smoke.deck.md --grade gambit/graders/smoke.deck.md --state .gambit/ci-smoke.json --trace .gambit/ci-smoke.jsonl
121
+ ```
122
+
51
123
  ## Status quo
52
124
 
53
- - Most teams wire one long prompt to several tools and hope the model routes\
54
- correctly.
55
- - Context often arrives as a single giant fetch or RAG blob, so costs climb and\
56
- hallucinations slip in.
57
- - Input/outputs are rarely typed, which makes orchestration brittle and hard to\
58
- test offline.
59
- - Debugging leans on provider logs instead of local traces, so reproducing\
60
- failures is slow.
125
+ - Teams have more ways than ever to build agents, but fewer ways to know whether
126
+ their eval data covers the behavior that will matter in production.
127
+ - Synthetic scenarios can look plausible while duplicating each other, missing
128
+ policy edges, or failing to state the expected outcome clearly.
129
+ - Agent failures often disappear into provider logs, so the team cannot replay
130
+ the exact inputs, transcript, tool calls, and artifacts that caused the
131
+ regression.
132
+ - CI usually checks code shape more reliably than agent behavior.
61
133
 
62
134
  ## Our vision
63
135
 
64
- - Treat each step as a small deck with explicit inputs/outputs and guardrails;\
65
- model calls are just one kind of action.
66
- - Mix LLM and compute tasks interchangeably and effortlessly inside the same\
67
- deck tree.
68
- - Feed models only what they need per step; inject references and cards instead\
69
- of dumping every document.
70
- - Keep orchestration logic local and testable; run decks offline with\
71
- predictable traces.
72
- - Ship with built-in observability (streaming, REPL, debug UI) so debugging\
73
- feels like regular software, not guesswork.
136
+ - Generate the situations your agents need to survive: users, tasks, workflows,
137
+ tool pressure, policy edges, and hard failure modes.
138
+ - Grade the scenario data itself before it becomes trusted eval data.
139
+ - Run any target agent against the curated suite and preserve the transcript,
140
+ state, artifacts, trace events, and permission evidence.
141
+ - Diagnose failures by capability gap, tool issue, prompt issue, policy
142
+ ambiguity, retrieval miss, or unsafe action.
143
+ - Feed those failures back into sharper follow-up scenarios and regression
144
+ checks.
74
145
 
75
146
  ---
76
147
 
77
148
  ## Using the CLI
78
149
 
79
- Use the CLI to run decks locally, stream output, and capture traces/state.
150
+ Use the CLI to run agent definitions locally, stream output, and capture
151
+ traces/state. The current CLI and file format still use `deck` as the exact
152
+ implementation term.
80
153
 
81
154
  Run with npx (no install):
82
155
 
@@ -84,7 +157,7 @@ Run with npx (no install):
84
157
  npx @bolt-foundry/gambit <command>
85
158
  ```
86
159
 
87
- Run a deck once:
160
+ Run an agent definition once:
88
161
 
89
162
  ```
90
163
  npx @bolt-foundry/gambit run <deck> --context <json|string> --message <json|string>
@@ -99,7 +172,34 @@ Drop into a REPL (streams by default):
99
172
  npx @bolt-foundry/gambit repl <deck>
100
173
  ```
101
174
 
102
- Run a persona against a root deck (scenario):
175
+ Start a focused browser chat for an agent definition:
176
+
177
+ ```
178
+ npx @bolt-foundry/gambit chat <deck> --state .gambit/chat/workspace.sqlite --trace .gambit/chat/trace.jsonl
179
+ ```
180
+
181
+ Use `chat` when you need a localhost transcript, saved state, trace output, and
182
+ runtime-supplied tools without the full simulator workbench. Use `repl` for a
183
+ terminal loop, `run` for one-shot automation, and `gambit-simulator serve` for
184
+ Build/Test/Grade/Verify workflows.
185
+
186
+ For repeatable repros, pass `--repro-message <text>` to attach the original user
187
+ ask to the session payload without sending it automatically.
188
+
189
+ Supply runtime tools with Markdown/TOML files:
190
+
191
+ ```
192
+ npx @bolt-foundry/gambit chat MANAGER.md --runtime-tools ./workloop-runtime-tools.mock.md
193
+ npx @bolt-foundry/gambit chat support.deck.md --runtime-tools ./taxo-runtime-tools.mock.md
194
+ ```
195
+
196
+ The runtime-tool file uses `[[tools]]` entries with `name`, `description`,
197
+ optional `inputSchema`, and optional `action`. Action bindings run Gambit agent
198
+ definitions with the tool arguments as context, keeping product-specific tools
199
+ outside the portable root agent. See `examples/local-chat/` for Workloop-style
200
+ and Taxo-style mock tool fixtures.
201
+
202
+ Run a scenario persona against a root agent:
103
203
 
104
204
  ```
105
205
  npx @bolt-foundry/gambit scenario <root-deck> --test-deck <persona-deck>
@@ -125,7 +225,7 @@ Tracing and state: 
125
225
 
126
226
  ### Worker sandbox defaults
127
227
 
128
- - Deck-executing CLI surfaces default to worker sandbox execution.
228
+ - CLI commands that execute decks default to worker sandbox execution.
129
229
  - Use `--no-worker-sandbox` (or `--legacy-exec`) to force legacy in-process
130
230
  execution.
131
231
  - `--worker-sandbox` explicitly forces worker execution on.
@@ -204,7 +304,9 @@ header (left of `New chat`).
204
304
 
205
305
  ## Using the Library
206
306
 
207
- Use the library when you want TypeScript decks/cards or custom compute steps.
307
+ Use the library when you want TypeScript agent definitions, reusable instruction
308
+ snippets, or custom compute steps. The exported helper names remain `defineDeck`
309
+ and `defineCard` for compatibility.
208
310
 
209
311
  Import the helpers from JSR:
210
312
 
@@ -216,10 +318,10 @@ import { defineDeck, defineCard } from "jsr:@bolt-foundry/gambit";
216
318
 
217
319
  - `reviews/2026-04-15-AAR-raw-response-items.md`
218
320
 
219
- Define `contextSchema`/`responseSchema` with Zod to validate IO, and implement\
220
- `run`/`execute` for compute decks. To call a child deck from code, use\
221
- `ctx.spawnAndWait({ path, input })`. Emit structured trace events with\
222
- `ctx.log(...)`.
321
+ Define `contextSchema`/`responseSchema` with Zod to validate IO, and implement
322
+ `run`/`execute` for compute agent definitions. To call a child agent definition
323
+ from code, use `ctx.spawnAndWait({ path, input })`. Emit structured trace events
324
+ with `ctx.log(...)`.
223
325
 
224
326
  ### Runtime defaults for programmatic `runDeckResponses`
225
327
 
@@ -288,9 +390,9 @@ Replacement mapping:
288
390
 
289
391
  ---
290
392
 
291
- ## Author your first deck
393
+ ## Author your first native Gambit agent
292
394
 
293
- ### Minimal Markdown deck (model-powered): `hello_world.deck.md`
395
+ ### Minimal Markdown agent definition (model-powered): `hello_world.deck.md`
294
396
 
295
397
  ```
296
398
  +++
@@ -310,7 +412,7 @@ Run it:
310
412
  npx @bolt-foundry/gambit run ./hello_world.deck.md --context '"Gambit"' --stream
311
413
  ```
312
414
 
313
- ### Compute deck in TypeScript (no model call): `echo.deck.ts`
415
+ ### Compute agent definition in TypeScript (no model call): `echo.deck.ts`
314
416
 
315
417
  ```typescript
316
418
  // echo.deck.ts
@@ -333,7 +435,7 @@ Run it:
333
435
  npx @bolt-foundry/gambit run ./echo.deck.ts --context '{"text":"ping"}'
334
436
  ```
335
437
 
336
- ### Deck with a child action (calls a TypeScript tool): `agent_with_time.deck.md`
438
+ ### Agent definition with a child action (calls a TypeScript tool): `agent_with_time.deck.md`
337
439
 
338
440
  ```
339
441
  +++
@@ -374,8 +476,9 @@ npx @bolt-foundry/gambit run ./agent_with_time.deck.md --context '"hello"' --str
374
476
  ### Legacy respond-flow demo (historical compatibility)
375
477
 
376
478
  `packages/gambit/examples/respond_flow/` is kept as a legacy compatibility
377
- example for historical transcript/grader behavior. New decks should return
378
- schema-valid assistant output directly instead of calling `gambit_respond`.
479
+ example for historical transcript/grader behavior. New agent definitions should
480
+ return schema-valid assistant output directly instead of calling
481
+ `gambit_respond`.
379
482
 
380
483
  ```
381
484
  cd packages/gambit
@@ -1,10 +1,9 @@
1
- declare const CODEX_APP_SERVER_DEBUG_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
2
- declare const LEGACY_CODEX_APP_SERVER_DEBUG_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
1
+ declare const CODEX_APP_SERVER_DEBUG_ENV = "GAMBIT_CODEX_APP_SERVER_DEBUG";
3
2
  type DebugValue = null | boolean | number | string | Array<DebugValue> | {
4
3
  [key: string]: DebugValue;
5
4
  };
6
5
  export declare function shouldDebugCodexAppServer(): boolean;
7
6
  export declare function logCodexAppServerDebug(event: string, details?: Record<string, unknown>): void;
8
7
  export declare function summarizeCodexAppServerDebugValue(value: unknown): DebugValue;
9
- export { CODEX_APP_SERVER_DEBUG_ENV, LEGACY_CODEX_APP_SERVER_DEBUG_ENV };
8
+ export { CODEX_APP_SERVER_DEBUG_ENV };
10
9
  //# sourceMappingURL=codex_app_server_debug.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex_app_server_debug.d.ts","sourceRoot":"","sources":["../../src/src/codex_app_server_debug.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,0BAA0B,kDACiB,CAAC;AAClD,QAAA,MAAM,iCAAiC,8DACsB,CAAC;AAe9D,KAAK,UAAU,GACX,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC,UAAU,CAAC,GACjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AA+DlC,wBAAgB,yBAAyB,IAAI,OAAO,CAGnD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAIN;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE5E;AAED,OAAO,EAAE,0BAA0B,EAAE,iCAAiC,EAAE,CAAC"}
1
+ {"version":3,"file":"codex_app_server_debug.d.ts","sourceRoot":"","sources":["../../src/src/codex_app_server_debug.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,0BAA0B,kCAAkC,CAAC;AAenE,KAAK,UAAU,GACX,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC,UAAU,CAAC,GACjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AA+DlC,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAIN;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE5E;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
- const CODEX_APP_SERVER_DEBUG_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
3
- const LEGACY_CODEX_APP_SERVER_DEBUG_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
2
+ const CODEX_APP_SERVER_DEBUG_ENV = "GAMBIT_CODEX_APP_SERVER_DEBUG";
4
3
  const STRUCTURAL_STRING_KEYS = new Set([
5
4
  "error",
6
5
  "method",
@@ -59,8 +58,7 @@ function summarizeDebugValue(value, key, depth = 0) {
59
58
  return summarized;
60
59
  }
61
60
  export function shouldDebugCodexAppServer() {
62
- return parseTruthy(dntShim.Deno.env.get(CODEX_APP_SERVER_DEBUG_ENV)) ||
63
- parseTruthy(dntShim.Deno.env.get(LEGACY_CODEX_APP_SERVER_DEBUG_ENV));
61
+ return parseTruthy(dntShim.Deno.env.get(CODEX_APP_SERVER_DEBUG_ENV));
64
62
  }
65
63
  export function logCodexAppServerDebug(event, details) {
66
64
  if (!shouldDebugCodexAppServer())
@@ -71,4 +69,4 @@ export function logCodexAppServerDebug(event, details) {
71
69
  export function summarizeCodexAppServerDebugValue(value) {
72
70
  return summarizeDebugValue(value);
73
71
  }
74
- export { CODEX_APP_SERVER_DEBUG_ENV, LEGACY_CODEX_APP_SERVER_DEBUG_ENV };
72
+ export { CODEX_APP_SERVER_DEBUG_ENV };
@@ -1,5 +1,4 @@
1
- export declare const CODEX_HOST_AUTH_BUNDLE_ENV = "WORKLOOP_CODEX_AUTH_BUNDLE";
2
- export declare const LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV = "BOLT_FOUNDRY_DESKTOP_CODEX_AUTH_BUNDLE";
1
+ export declare const CODEX_HOST_AUTH_BUNDLE_ENV = "GAMBIT_CODEX_AUTH_BUNDLE";
3
2
  export type CodexChatgptAuthTokens = {
4
3
  accessToken: string;
5
4
  chatgptAccountId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"codex_auth.d.ts","sourceRoot":"","sources":["../../src/src/codex_auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA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,sBAAsB,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAkFF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAChD;IACD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CASA;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,GACV,sBAAsB,CAuBxB;AAED,wBAAgB,uCAAuC,CACrD,GAAG,EAAE,MAAM,GACV,sBAAsB,CAuBxB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,GAC7B,MAAM,CAER;AAED,wBAAgB,0BAA0B,IAAI,sBAAsB,GAAG,IAAI,CAI1E;AAED,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAkDlC"}
@@ -1,8 +1,7 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
2
  const CODEX_AUTH0_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
3
3
  const CODEX_AUTH0_TOKEN_URL = "https://auth.openai.com/oauth/token";
4
- export const CODEX_HOST_AUTH_BUNDLE_ENV = "WORKLOOP_CODEX_AUTH_BUNDLE";
5
- export const LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV = "BOLT_FOUNDRY_DESKTOP_CODEX_AUTH_BUNDLE";
4
+ export const CODEX_HOST_AUTH_BUNDLE_ENV = "GAMBIT_CODEX_AUTH_BUNDLE";
6
5
  function normalizeNonEmptyString(value) {
7
6
  return typeof value === "string" && value.trim().length > 0
8
7
  ? value.trim()
@@ -123,8 +122,7 @@ export function serializeCodexAuthBundle(bundle) {
123
122
  return JSON.stringify(bundle);
124
123
  }
125
124
  export function readCodexAuthBundleFromEnv() {
126
- const raw = dntShim.Deno.env.get(CODEX_HOST_AUTH_BUNDLE_ENV)?.trim() ||
127
- dntShim.Deno.env.get(LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV)?.trim();
125
+ const raw = dntShim.Deno.env.get(CODEX_HOST_AUTH_BUNDLE_ENV)?.trim();
128
126
  if (!raw)
129
127
  return null;
130
128
  return parseCodexAuthBundle(raw);
@@ -57,6 +57,16 @@ export declare function codexConfigArgsForTest(input: {
57
57
  instructions?: string;
58
58
  }): Array<string>;
59
59
  export declare function safeJsonForTest(text: string): Record<string, JSONValue>;
60
+ export declare function appServerRequestResultForTest(input: {
61
+ method: string;
62
+ params: Record<string, unknown>;
63
+ }): Promise<{
64
+ result?: Record<string, JSONValue>;
65
+ error?: {
66
+ code: number;
67
+ message: string;
68
+ };
69
+ }>;
60
70
  export declare function sanitizeCodexSpawnArgsForTest(args: Array<string>): Array<string>;
61
71
  export declare function extractCodexConfigValuesForTest(args: Array<string>, flag: string, prefix?: string): Array<string>;
62
72
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/src/providers/codex.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,SAAS,EACT,YAAY,EACZ,aAAa,EAGb,YAAY,EAGZ,UAAU,EACV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,sBAAsB,EAA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GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,KAAK,CAAC,MAAM,CAAC,CAEhB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAEvE;AAED,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,GAAG,OAAO,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC,CAED;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAClB,KAAK,CAAC,MAAM,CAAC,CAEf;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,KAAK,CAAC,MAAM,CAAC,CAEf"}
@@ -13,14 +13,14 @@ const CODEX_REASONING_SUMMARY_ENV = "GAMBIT_CODEX_REASONING_SUMMARY";
13
13
  const CODEX_VERBOSITY_ENV = "GAMBIT_CODEX_VERBOSITY";
14
14
  const CODEX_BIN_ENV = "GAMBIT_CODEX_BIN";
15
15
  const CODEX_SKIP_SANDBOX_CONFIG_ENV = "GAMBIT_CODEX_SKIP_SANDBOX_CONFIG";
16
+ const CODEX_DISABLE_WEBSOCKETS_ENV = "GAMBIT_CODEX_DISABLE_WEBSOCKETS";
16
17
  const CODEX_DANGEROUS_BYPASS_ENV = "GAMBIT_CODEX_DANGEROUSLY_BYPASS_APPROVALS_AND_SANDBOX";
17
18
  const MCP_DENO_BIN_ENV = "GAMBIT_MCP_DENO_BIN";
18
19
  const MCP_ROOT_DECK_PATH_ENV = "GAMBIT_MCP_ROOT_DECK_PATH";
19
20
  const EXTERNAL_TOOL_BRIDGE_ENV = "GAMBIT_EXTERNAL_TOOL_BRIDGE";
20
21
  const MCP_DEBUG_LOG_PATH_ENV = "GAMBIT_MCP_DEBUG_LOG_PATH";
21
22
  const DENO_DIR_ENV = "DENO_DIR";
22
- const DEBUG_MCP_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_MCP";
23
- const LEGACY_DEBUG_MCP_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_MCP";
23
+ const DEBUG_MCP_ENV = "GAMBIT_MCP_DEBUG";
24
24
  const MCP_SERVER_PATH = (() => {
25
25
  try {
26
26
  const moduleUrl = new URL(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url);
@@ -111,10 +111,8 @@ function shouldEnableMcpBridge() {
111
111
  return normalized === "1" || normalized === "true" || normalized === "yes";
112
112
  }
113
113
  function shouldDebugMcpBridge() {
114
- return [DEBUG_MCP_ENV, LEGACY_DEBUG_MCP_ENV].some((envName) => {
115
- const raw = dntShim.Deno.env.get(envName)?.trim().toLowerCase();
116
- return raw === "1" || raw === "true" || raw === "yes";
117
- });
114
+ const raw = dntShim.Deno.env.get(DEBUG_MCP_ENV)?.trim().toLowerCase();
115
+ return raw === "1" || raw === "true" || raw === "yes";
118
116
  }
119
117
  function isCodexNativeOrGambitBuiltinTool(name) {
120
118
  return new Set([
@@ -133,7 +131,7 @@ function logCodexMcpDebug(event, details) {
133
131
  globalThis.console.error("[gambit-codex-mcp]", event, details ?? {});
134
132
  }
135
133
  function codexMcpDebugLogPath(cwd) {
136
- return path.join(cwd, ".boltfoundry", "runtime", "chief-runtime", "gambit-mcp-debug.log");
134
+ return path.join(cwd, ".workloop", "runtime", "chief-runtime", "gambit-mcp-debug.log");
137
135
  }
138
136
  function mcpServerDenoBin() {
139
137
  return dntShim.Deno.env.get(MCP_DENO_BIN_ENV)?.trim() || "deno";
@@ -171,6 +169,14 @@ function shouldSkipCodexSandboxConfig(params) {
171
169
  const envRaw = dntShim.Deno.env.get(CODEX_SKIP_SANDBOX_CONFIG_ENV);
172
170
  return Boolean(envRaw && parseTruthy(envRaw));
173
171
  }
172
+ function shouldDisableCodexWebsockets() {
173
+ // Newer Codex releases reserve built-in provider IDs, so overriding
174
+ // `model_providers.openai.supports_websockets` now prevents app-server
175
+ // startup. Keep the env var harmless while the old transport workaround ages
176
+ // out.
177
+ dntShim.Deno.env.get(CODEX_DISABLE_WEBSOCKETS_ENV);
178
+ return false;
179
+ }
174
180
  function tomlString(value) {
175
181
  return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
176
182
  }
@@ -258,6 +264,9 @@ function codexAdditionalConfigArgs(params) {
258
264
  function codexConfigArgs(input) {
259
265
  const args = [];
260
266
  args.push(...codexAdditionalConfigArgs(input.params));
267
+ if (shouldDisableCodexWebsockets()) {
268
+ args.push("-c", "model_providers.openai.supports_websockets=false");
269
+ }
261
270
  args.push("-c", `approval_policy=${tomlString("never")}`);
262
271
  const pathEnv = dntShim.Deno.env.get("PATH")?.trim();
263
272
  if (pathEnv) {
@@ -478,14 +487,22 @@ async function appServerRequestResult(input) {
478
487
  }
479
488
  if (input.method === "account/chatgptAuthTokens/refresh") {
480
489
  const bridge = requireCodexHostAuthBridge();
481
- const refreshed = await bridge.refreshAuthTokens({
482
- previousAccountId: typeof input.params.previousAccountId === "string"
483
- ? input.params.previousAccountId
484
- : null,
485
- reason: typeof input.params.reason === "string" && input.params.reason
486
- ? input.params.reason
487
- : "account/chatgptAuthTokens/refresh",
488
- });
490
+ let refreshed;
491
+ try {
492
+ refreshed = await bridge.refreshAuthTokens({
493
+ previousAccountId: typeof input.params.previousAccountId === "string"
494
+ ? input.params.previousAccountId
495
+ : null,
496
+ reason: typeof input.params.reason === "string" && input.params.reason
497
+ ? input.params.reason
498
+ : "account/chatgptAuthTokens/refresh",
499
+ });
500
+ }
501
+ catch (error) {
502
+ return {
503
+ error: appServerHostRequestFailure(error),
504
+ };
505
+ }
489
506
  return {
490
507
  result: {
491
508
  accessToken: refreshed.accessToken,
@@ -502,6 +519,14 @@ async function appServerRequestResult(input) {
502
519
  },
503
520
  };
504
521
  }
522
+ function appServerHostRequestFailure(error) {
523
+ return {
524
+ code: -32000,
525
+ message: error instanceof Error && error.message
526
+ ? error.message
527
+ : String(error),
528
+ };
529
+ }
505
530
  async function bootstrapCodexExternalAuth(input) {
506
531
  if (!codexHostAuthBridge) {
507
532
  return;
@@ -984,7 +1009,15 @@ async function defaultAppServerTurnRunner(input) {
984
1009
  method,
985
1010
  params: safeJsonObjectFromRecord(params),
986
1011
  });
987
- const response = await appServerRequestResult({ method, params });
1012
+ let response;
1013
+ try {
1014
+ response = await appServerRequestResult({ method, params });
1015
+ }
1016
+ catch (error) {
1017
+ response = {
1018
+ error: appServerHostRequestFailure(error),
1019
+ };
1020
+ }
988
1021
  logCodexAppServerDebug("message:host_response", {
989
1022
  method,
990
1023
  requestId,
@@ -2098,6 +2131,9 @@ export function codexConfigArgsForTest(input) {
2098
2131
  export function safeJsonForTest(text) {
2099
2132
  return safeJsonObject(text);
2100
2133
  }
2134
+ export async function appServerRequestResultForTest(input) {
2135
+ return await appServerRequestResult(input);
2136
+ }
2101
2137
  export function sanitizeCodexSpawnArgsForTest(args) {
2102
2138
  return sanitizeCodexSpawnArgsForDebug(args);
2103
2139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolt-foundry/gambit",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "Agent harness framework for building, running, and verifying LLM workflows in Markdown and code.",
5
5
  "homepage": "https://github.com/bolt-foundry/gambit",
6
6
  "repository": {
@@ -1,10 +1,9 @@
1
- declare const CODEX_APP_SERVER_DEBUG_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
2
- declare const LEGACY_CODEX_APP_SERVER_DEBUG_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
1
+ declare const CODEX_APP_SERVER_DEBUG_ENV = "GAMBIT_CODEX_APP_SERVER_DEBUG";
3
2
  type DebugValue = null | boolean | number | string | Array<DebugValue> | {
4
3
  [key: string]: DebugValue;
5
4
  };
6
5
  export declare function shouldDebugCodexAppServer(): boolean;
7
6
  export declare function logCodexAppServerDebug(event: string, details?: Record<string, unknown>): void;
8
7
  export declare function summarizeCodexAppServerDebugValue(value: unknown): DebugValue;
9
- export { CODEX_APP_SERVER_DEBUG_ENV, LEGACY_CODEX_APP_SERVER_DEBUG_ENV };
8
+ export { CODEX_APP_SERVER_DEBUG_ENV };
10
9
  //# sourceMappingURL=codex_app_server_debug.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex_app_server_debug.d.ts","sourceRoot":"","sources":["../../src/src/codex_app_server_debug.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,0BAA0B,kDACiB,CAAC;AAClD,QAAA,MAAM,iCAAiC,8DACsB,CAAC;AAe9D,KAAK,UAAU,GACX,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC,UAAU,CAAC,GACjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AA+DlC,wBAAgB,yBAAyB,IAAI,OAAO,CAGnD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAIN;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE5E;AAED,OAAO,EAAE,0BAA0B,EAAE,iCAAiC,EAAE,CAAC"}
1
+ {"version":3,"file":"codex_app_server_debug.d.ts","sourceRoot":"","sources":["../../src/src/codex_app_server_debug.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,0BAA0B,kCAAkC,CAAC;AAenE,KAAK,UAAU,GACX,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,CAAC,UAAU,CAAC,GACjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AA+DlC,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAIN;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE5E;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -33,15 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.LEGACY_CODEX_APP_SERVER_DEBUG_ENV = exports.CODEX_APP_SERVER_DEBUG_ENV = void 0;
36
+ exports.CODEX_APP_SERVER_DEBUG_ENV = void 0;
37
37
  exports.shouldDebugCodexAppServer = shouldDebugCodexAppServer;
38
38
  exports.logCodexAppServerDebug = logCodexAppServerDebug;
39
39
  exports.summarizeCodexAppServerDebugValue = summarizeCodexAppServerDebugValue;
40
40
  const dntShim = __importStar(require("../_dnt.shims.js"));
41
- const CODEX_APP_SERVER_DEBUG_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
41
+ const CODEX_APP_SERVER_DEBUG_ENV = "GAMBIT_CODEX_APP_SERVER_DEBUG";
42
42
  exports.CODEX_APP_SERVER_DEBUG_ENV = CODEX_APP_SERVER_DEBUG_ENV;
43
- const LEGACY_CODEX_APP_SERVER_DEBUG_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_CODEX_APP_SERVER";
44
- exports.LEGACY_CODEX_APP_SERVER_DEBUG_ENV = LEGACY_CODEX_APP_SERVER_DEBUG_ENV;
45
43
  const STRUCTURAL_STRING_KEYS = new Set([
46
44
  "error",
47
45
  "method",
@@ -100,8 +98,7 @@ function summarizeDebugValue(value, key, depth = 0) {
100
98
  return summarized;
101
99
  }
102
100
  function shouldDebugCodexAppServer() {
103
- return parseTruthy(dntShim.Deno.env.get(CODEX_APP_SERVER_DEBUG_ENV)) ||
104
- parseTruthy(dntShim.Deno.env.get(LEGACY_CODEX_APP_SERVER_DEBUG_ENV));
101
+ return parseTruthy(dntShim.Deno.env.get(CODEX_APP_SERVER_DEBUG_ENV));
105
102
  }
106
103
  function logCodexAppServerDebug(event, details) {
107
104
  if (!shouldDebugCodexAppServer())
@@ -1,5 +1,4 @@
1
- export declare const CODEX_HOST_AUTH_BUNDLE_ENV = "WORKLOOP_CODEX_AUTH_BUNDLE";
2
- export declare const LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV = "BOLT_FOUNDRY_DESKTOP_CODEX_AUTH_BUNDLE";
1
+ export declare const CODEX_HOST_AUTH_BUNDLE_ENV = "GAMBIT_CODEX_AUTH_BUNDLE";
3
2
  export type CodexChatgptAuthTokens = {
4
3
  accessToken: string;
5
4
  chatgptAccountId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"codex_auth.d.ts","sourceRoot":"","sources":["../../src/src/codex_auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,iCAAiC,2CACJ,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MA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AgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAChD;IACD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CASA;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,GACV,sBAAsB,CAuBxB;AAED,wBAAgB,uCAAuC,CACrD,GAAG,EAAE,MAAM,GACV,sBAAsB,CAuBxB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,GAC7B,MAAM,CAER;AAED,wBAAgB,0BAA0B,IAAI,sBAAsB,GAAG,IAAI,CAI1E;AAED,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAkDlC"}
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV = exports.CODEX_HOST_AUTH_BUNDLE_ENV = void 0;
36
+ exports.CODEX_HOST_AUTH_BUNDLE_ENV = void 0;
37
37
  exports.summarizeCodexAuthBundle = summarizeCodexAuthBundle;
38
38
  exports.parseCodexAuthBundle = parseCodexAuthBundle;
39
39
  exports.parseCodexAuthBundleFromRuntimeAuthFile = parseCodexAuthBundleFromRuntimeAuthFile;
@@ -43,8 +43,7 @@ exports.refreshCodexChatgptAuthTokens = refreshCodexChatgptAuthTokens;
43
43
  const dntShim = __importStar(require("../_dnt.shims.js"));
44
44
  const CODEX_AUTH0_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
45
45
  const CODEX_AUTH0_TOKEN_URL = "https://auth.openai.com/oauth/token";
46
- exports.CODEX_HOST_AUTH_BUNDLE_ENV = "WORKLOOP_CODEX_AUTH_BUNDLE";
47
- exports.LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV = "BOLT_FOUNDRY_DESKTOP_CODEX_AUTH_BUNDLE";
46
+ exports.CODEX_HOST_AUTH_BUNDLE_ENV = "GAMBIT_CODEX_AUTH_BUNDLE";
48
47
  function normalizeNonEmptyString(value) {
49
48
  return typeof value === "string" && value.trim().length > 0
50
49
  ? value.trim()
@@ -165,8 +164,7 @@ function serializeCodexAuthBundle(bundle) {
165
164
  return JSON.stringify(bundle);
166
165
  }
167
166
  function readCodexAuthBundleFromEnv() {
168
- const raw = dntShim.Deno.env.get(exports.CODEX_HOST_AUTH_BUNDLE_ENV)?.trim() ||
169
- dntShim.Deno.env.get(exports.LEGACY_CODEX_HOST_AUTH_BUNDLE_ENV)?.trim();
167
+ const raw = dntShim.Deno.env.get(exports.CODEX_HOST_AUTH_BUNDLE_ENV)?.trim();
170
168
  if (!raw)
171
169
  return null;
172
170
  return parseCodexAuthBundle(raw);
@@ -57,6 +57,16 @@ export declare function codexConfigArgsForTest(input: {
57
57
  instructions?: string;
58
58
  }): Array<string>;
59
59
  export declare function safeJsonForTest(text: string): Record<string, JSONValue>;
60
+ export declare function appServerRequestResultForTest(input: {
61
+ method: string;
62
+ params: Record<string, unknown>;
63
+ }): Promise<{
64
+ result?: Record<string, JSONValue>;
65
+ error?: {
66
+ code: number;
67
+ message: string;
68
+ };
69
+ }>;
60
70
  export declare function sanitizeCodexSpawnArgsForTest(args: Array<string>): Array<string>;
61
71
  export declare function extractCodexConfigValuesForTest(args: Array<string>, flag: string, prefix?: string): Array<string>;
62
72
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../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yBAAyB,CAAC,KAAK,EAAE;IAC/C,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAET;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,KAAK,CAAC,MAAM,CAAC,CAEhB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAEvE;AAED,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,GAAG,OAAO,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC,CAED;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAClB,KAAK,CAAC,MAAM,CAAC,CAEf;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,KAAK,CAAC,MAAM,CAAC,CAEf"}
@@ -41,6 +41,7 @@ exports.codexInstructionsForMessagesForTest = codexInstructionsForMessagesForTes
41
41
  exports.promptForCodexTurnForTest = promptForCodexTurnForTest;
42
42
  exports.codexConfigArgsForTest = codexConfigArgsForTest;
43
43
  exports.safeJsonForTest = safeJsonForTest;
44
+ exports.appServerRequestResultForTest = appServerRequestResultForTest;
44
45
  exports.sanitizeCodexSpawnArgsForTest = sanitizeCodexSpawnArgsForTest;
45
46
  exports.extractCodexConfigValuesForTest = extractCodexConfigValuesForTest;
46
47
  const dntShim = __importStar(require("../../_dnt.shims.js"));
@@ -58,14 +59,14 @@ const CODEX_REASONING_SUMMARY_ENV = "GAMBIT_CODEX_REASONING_SUMMARY";
58
59
  const CODEX_VERBOSITY_ENV = "GAMBIT_CODEX_VERBOSITY";
59
60
  const CODEX_BIN_ENV = "GAMBIT_CODEX_BIN";
60
61
  const CODEX_SKIP_SANDBOX_CONFIG_ENV = "GAMBIT_CODEX_SKIP_SANDBOX_CONFIG";
62
+ const CODEX_DISABLE_WEBSOCKETS_ENV = "GAMBIT_CODEX_DISABLE_WEBSOCKETS";
61
63
  const CODEX_DANGEROUS_BYPASS_ENV = "GAMBIT_CODEX_DANGEROUSLY_BYPASS_APPROVALS_AND_SANDBOX";
62
64
  const MCP_DENO_BIN_ENV = "GAMBIT_MCP_DENO_BIN";
63
65
  const MCP_ROOT_DECK_PATH_ENV = "GAMBIT_MCP_ROOT_DECK_PATH";
64
66
  const EXTERNAL_TOOL_BRIDGE_ENV = "GAMBIT_EXTERNAL_TOOL_BRIDGE";
65
67
  const MCP_DEBUG_LOG_PATH_ENV = "GAMBIT_MCP_DEBUG_LOG_PATH";
66
68
  const DENO_DIR_ENV = "DENO_DIR";
67
- const DEBUG_MCP_ENV = "WORKLOOP_CHIEF_RUNTIME_DEBUG_MCP";
68
- const LEGACY_DEBUG_MCP_ENV = "BOLT_FOUNDRY_DESKTOP_CHIEF_RUNTIME_DEBUG_MCP";
69
+ const DEBUG_MCP_ENV = "GAMBIT_MCP_DEBUG";
69
70
  const MCP_SERVER_PATH = (() => {
70
71
  try {
71
72
  const moduleUrl = new URL(globalThis[Symbol.for("import-meta-ponyfill-commonjs")](require, module).url);
@@ -156,10 +157,8 @@ function shouldEnableMcpBridge() {
156
157
  return normalized === "1" || normalized === "true" || normalized === "yes";
157
158
  }
158
159
  function shouldDebugMcpBridge() {
159
- return [DEBUG_MCP_ENV, LEGACY_DEBUG_MCP_ENV].some((envName) => {
160
- const raw = dntShim.Deno.env.get(envName)?.trim().toLowerCase();
161
- return raw === "1" || raw === "true" || raw === "yes";
162
- });
160
+ const raw = dntShim.Deno.env.get(DEBUG_MCP_ENV)?.trim().toLowerCase();
161
+ return raw === "1" || raw === "true" || raw === "yes";
163
162
  }
164
163
  function isCodexNativeOrGambitBuiltinTool(name) {
165
164
  return new Set([
@@ -178,7 +177,7 @@ function logCodexMcpDebug(event, details) {
178
177
  globalThis.console.error("[gambit-codex-mcp]", event, details ?? {});
179
178
  }
180
179
  function codexMcpDebugLogPath(cwd) {
181
- return path.join(cwd, ".boltfoundry", "runtime", "chief-runtime", "gambit-mcp-debug.log");
180
+ return path.join(cwd, ".workloop", "runtime", "chief-runtime", "gambit-mcp-debug.log");
182
181
  }
183
182
  function mcpServerDenoBin() {
184
183
  return dntShim.Deno.env.get(MCP_DENO_BIN_ENV)?.trim() || "deno";
@@ -216,6 +215,14 @@ function shouldSkipCodexSandboxConfig(params) {
216
215
  const envRaw = dntShim.Deno.env.get(CODEX_SKIP_SANDBOX_CONFIG_ENV);
217
216
  return Boolean(envRaw && parseTruthy(envRaw));
218
217
  }
218
+ function shouldDisableCodexWebsockets() {
219
+ // Newer Codex releases reserve built-in provider IDs, so overriding
220
+ // `model_providers.openai.supports_websockets` now prevents app-server
221
+ // startup. Keep the env var harmless while the old transport workaround ages
222
+ // out.
223
+ dntShim.Deno.env.get(CODEX_DISABLE_WEBSOCKETS_ENV);
224
+ return false;
225
+ }
219
226
  function tomlString(value) {
220
227
  return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
221
228
  }
@@ -303,6 +310,9 @@ function codexAdditionalConfigArgs(params) {
303
310
  function codexConfigArgs(input) {
304
311
  const args = [];
305
312
  args.push(...codexAdditionalConfigArgs(input.params));
313
+ if (shouldDisableCodexWebsockets()) {
314
+ args.push("-c", "model_providers.openai.supports_websockets=false");
315
+ }
306
316
  args.push("-c", `approval_policy=${tomlString("never")}`);
307
317
  const pathEnv = dntShim.Deno.env.get("PATH")?.trim();
308
318
  if (pathEnv) {
@@ -523,14 +533,22 @@ async function appServerRequestResult(input) {
523
533
  }
524
534
  if (input.method === "account/chatgptAuthTokens/refresh") {
525
535
  const bridge = requireCodexHostAuthBridge();
526
- const refreshed = await bridge.refreshAuthTokens({
527
- previousAccountId: typeof input.params.previousAccountId === "string"
528
- ? input.params.previousAccountId
529
- : null,
530
- reason: typeof input.params.reason === "string" && input.params.reason
531
- ? input.params.reason
532
- : "account/chatgptAuthTokens/refresh",
533
- });
536
+ let refreshed;
537
+ try {
538
+ refreshed = await bridge.refreshAuthTokens({
539
+ previousAccountId: typeof input.params.previousAccountId === "string"
540
+ ? input.params.previousAccountId
541
+ : null,
542
+ reason: typeof input.params.reason === "string" && input.params.reason
543
+ ? input.params.reason
544
+ : "account/chatgptAuthTokens/refresh",
545
+ });
546
+ }
547
+ catch (error) {
548
+ return {
549
+ error: appServerHostRequestFailure(error),
550
+ };
551
+ }
534
552
  return {
535
553
  result: {
536
554
  accessToken: refreshed.accessToken,
@@ -547,6 +565,14 @@ async function appServerRequestResult(input) {
547
565
  },
548
566
  };
549
567
  }
568
+ function appServerHostRequestFailure(error) {
569
+ return {
570
+ code: -32000,
571
+ message: error instanceof Error && error.message
572
+ ? error.message
573
+ : String(error),
574
+ };
575
+ }
550
576
  async function bootstrapCodexExternalAuth(input) {
551
577
  if (!codexHostAuthBridge) {
552
578
  return;
@@ -1029,7 +1055,15 @@ async function defaultAppServerTurnRunner(input) {
1029
1055
  method,
1030
1056
  params: safeJsonObjectFromRecord(params),
1031
1057
  });
1032
- const response = await appServerRequestResult({ method, params });
1058
+ let response;
1059
+ try {
1060
+ response = await appServerRequestResult({ method, params });
1061
+ }
1062
+ catch (error) {
1063
+ response = {
1064
+ error: appServerHostRequestFailure(error),
1065
+ };
1066
+ }
1033
1067
  (0, codex_app_server_debug_js_1.logCodexAppServerDebug)("message:host_response", {
1034
1068
  method,
1035
1069
  requestId,
@@ -2143,6 +2177,9 @@ function codexConfigArgsForTest(input) {
2143
2177
  function safeJsonForTest(text) {
2144
2178
  return safeJsonObject(text);
2145
2179
  }
2180
+ async function appServerRequestResultForTest(input) {
2181
+ return await appServerRequestResult(input);
2182
+ }
2146
2183
  function sanitizeCodexSpawnArgsForTest(args) {
2147
2184
  return sanitizeCodexSpawnArgsForDebug(args);
2148
2185
  }