@junghanacs/entwurf 0.21.0 → 0.23.0
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/AGENTS.md +3 -2
- package/BASELINE.md +3 -1
- package/CHANGELOG.md +658 -0
- package/DELIVERY.md +167 -29
- package/README.md +104 -14
- package/VERIFY.md +73 -11
- package/docs/external-mcp-host.md +16 -6
- package/docs/setup-clean-host.md +73 -22
- package/mcp/entwurf-bridge/dist/mcp/entwurf-bridge/src/index.js +54 -31
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/codex-caller-seat.js +174 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/codex-declaration.js +609 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/codex-fresh-preflight.js +289 -57
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-control-rpc.js +40 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-fact-provider.js +6 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-facts.js +7 -1
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-peer-observe.js +67 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-peers-render.js +9 -1
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-self-address.js +24 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-runner.js +3 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-send.js +8 -4
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/fresh-call-composition.js +423 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/fresh-call-dispatch.js +98 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/herdr-fresh-call.js +1018 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/herdr-placement.js +213 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/mux-fresh-call.js +171 -263
- package/mcp/entwurf-bridge/dist/scripts/codex-socket-path.js +30 -0
- package/mcp/entwurf-bridge/dist/scripts/peer-facts.js +109 -0
- package/mcp/entwurf-bridge/src/index.ts +65 -31
- package/mcp/entwurf-bridge/tsconfig.build.json +10 -0
- package/package.json +4 -4
- package/pi-extensions/entwurf-control.ts +91 -52
- package/pi-extensions/lib/codex-caller-seat.ts +204 -0
- package/pi-extensions/lib/codex-declaration.js +612 -0
- package/pi-extensions/lib/codex-fresh-preflight.ts +325 -52
- package/pi-extensions/lib/entwurf-control-rpc.ts +46 -0
- package/pi-extensions/lib/entwurf-fact-provider.ts +13 -2
- package/pi-extensions/lib/entwurf-facts.ts +14 -1
- package/pi-extensions/lib/entwurf-peer-observe.ts +72 -2
- package/pi-extensions/lib/entwurf-peers-render.ts +9 -1
- package/pi-extensions/lib/entwurf-self-address.ts +33 -0
- package/pi-extensions/lib/entwurf-v2-runner.ts +3 -2
- package/pi-extensions/lib/entwurf-v2-send.ts +16 -11
- package/pi-extensions/lib/fresh-call-composition.ts +493 -0
- package/pi-extensions/lib/fresh-call-dispatch.ts +142 -0
- package/pi-extensions/lib/herdr-fresh-call.ts +1378 -0
- package/pi-extensions/lib/herdr-placement.ts +276 -0
- package/pi-extensions/lib/mux-fresh-call.ts +257 -304
- package/run.sh +522 -10
- package/scripts/check-codex-app-server-launch.ts +445 -0
- package/scripts/check-codex-birth-hook.ts +187 -0
- package/scripts/check-entwurf-control-rpc.ts +138 -0
- package/scripts/check-entwurf-fact-provider.ts +4 -2
- package/scripts/check-entwurf-facts.ts +12 -6
- package/scripts/check-entwurf-peers-surface.ts +3 -1
- package/scripts/check-entwurf-self-address.ts +68 -0
- package/scripts/check-entwurf-v2-production.ts +42 -1
- package/scripts/check-entwurf-v2-send.ts +26 -7
- package/scripts/check-fresh-call-dispatch.ts +301 -0
- package/scripts/check-gate-qualification.ts +19 -5
- package/scripts/check-herdr-activation.ts +1293 -0
- package/scripts/check-herdr-fresh-call.ts +1250 -0
- package/scripts/check-herdr-placement.ts +383 -0
- package/scripts/check-herdr-plugin-build.ts +842 -0
- package/scripts/check-herdr-plugin-profile.ts +371 -0
- package/scripts/check-herdr-plugin.ts +523 -0
- package/scripts/check-herdr-runtime-bootstrap.ts +1264 -0
- package/scripts/check-herdr-sandbox.ts +456 -0
- package/scripts/check-herdr-supply.ts +184 -0
- package/scripts/check-mux-launch-tmux.ts +331 -35
- package/scripts/check-mux-launcher-fence.ts +138 -0
- package/scripts/check-peer-facts.ts +331 -0
- package/scripts/check-release-gate-outcomes.ts +12 -0
- package/scripts/check-typing-call-fence.ts +296 -0
- package/scripts/codex-app-server-launch.sh +275 -0
- package/scripts/codex-birth-doctor.sh +159 -16
- package/scripts/codex-birth-install.sh +178 -72
- package/scripts/codex-birth-uninstall.sh +162 -7
- package/scripts/codex-socket-path.ts +33 -0
- package/scripts/codex-terminal-title-config.py +500 -0
- package/scripts/codex_toml_io.py +121 -0
- package/scripts/fixtures/herdr-supply.json +29 -0
- package/scripts/herdr-activation.mjs +536 -0
- package/scripts/herdr-plugin-activate.mjs +270 -0
- package/scripts/herdr-plugin-deactivate.mjs +193 -0
- package/scripts/herdr-runtime.mjs +1203 -0
- package/scripts/install-herdr-ci.sh +96 -0
- package/scripts/lib/codex-fresh-live-protocol.ts +13 -5
- package/scripts/lib/codex-fresh-source-receipts.ts +29 -2
- package/scripts/lib/tree-digest.ts +97 -0
- package/scripts/meta-bridge-install.sh +19 -2
- package/scripts/meta-bridge-state.py +167 -11
- package/scripts/mutants/codex-app-server-launch.json +157 -0
- package/scripts/mutants/codex-caller-seat.json +334 -0
- package/scripts/mutants/codex-native.json +195 -29
- package/scripts/mutants/control-socket-disconnect.json +57 -0
- package/scripts/mutants/fresh-call-dispatch.json +154 -0
- package/scripts/mutants/herdr-activation.json +305 -0
- package/scripts/mutants/herdr-fresh-call.json +448 -0
- package/scripts/mutants/herdr-placement.json +161 -0
- package/scripts/mutants/herdr-plugin-build.json +160 -0
- package/scripts/mutants/herdr-plugin-profile.json +202 -0
- package/scripts/mutants/herdr-plugin.json +133 -0
- package/scripts/mutants/herdr-runtime-bootstrap.json +411 -0
- package/scripts/mutants/herdr-supply.json +133 -0
- package/scripts/mutants/meta-hook-session-switch.json +2 -2
- package/scripts/mutants/mux-fresh-call.json +184 -25
- package/scripts/mutants/mux-launcher-fence.json +13 -0
- package/scripts/mutants/omp-fresh.json +4 -4
- package/scripts/mutants/peer-facts.json +98 -0
- package/scripts/mutants/self-address.json +33 -0
- package/scripts/mutants/typing-call-fence.json +17 -0
- package/scripts/mutants/v2-surface.json +22 -0
- package/scripts/peer-facts.ts +120 -0
- package/scripts/register-pi-package.py +8 -0
- package/scripts/register-pi-provider.py +88 -12
- package/scripts/smoke-codex-birth.sh +281 -12
- package/scripts/smoke-codex-config-state.sh +192 -3
- package/scripts/smoke-codex-fresh-live.ts +277 -37
- package/scripts/smoke-entwurf-chain-live.ts +50 -0
- package/scripts/smoke-herdr-fresh-call-live.ts +1027 -0
- package/scripts/smoke-herdr-plugin-build-live.ts +543 -0
- package/scripts/smoke-setup-verdict.sh +13 -11
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* mux-fresh-call — open ONE visible sibling in the caller's own tmux server (its own session by
|
|
3
3
|
* default, or one named existing session on that server since #105), hand it its first task in
|
|
4
|
-
* the launch argv, and let it name itself back to the caller. Codex is the one measured
|
|
5
|
-
* exception
|
|
4
|
+
* the launch argv, and let it name itself back to the caller. A Codex CALLER is the one measured
|
|
5
|
+
* exception to "the caller's own session": it opens beside its own TUI pane, found by that
|
|
6
|
+
* pane's terminal title (#95 lane B), never by a TUI guess.
|
|
6
7
|
*
|
|
7
8
|
* ── Why this is a third module and not a parameter on the leaf ──
|
|
8
9
|
*
|
|
@@ -39,6 +40,14 @@
|
|
|
39
40
|
* byte-identical to the pre-#73 shape. Anything else is taken LITERALLY — no trim, no
|
|
40
41
|
* realpath, no project-name resolution, no store/peers/record lookup. The caller is the
|
|
41
42
|
* only cwd authority this module knows.
|
|
43
|
+
* - when a CODEX caller omits it, the surface supplies that citizen's own record cwd and it
|
|
44
|
+
* becomes an explicit `-c` (#95 lane C). This is not a second authority: it is the same
|
|
45
|
+
* caller, named more precisely, because a codex caller's PROCESS directory is the
|
|
46
|
+
* operator-owned app-server's rather than its own. Every other caller keeps the inherited
|
|
47
|
+
* directory and an unchanged argv.
|
|
48
|
+
* - the chosen value reaches codex TWICE, and that is one value with two carriers rather than
|
|
49
|
+
* two inputs: tmux `-c` places the pane, and codex `-C` places the THREAD, which a
|
|
50
|
+
* `--remote` attachment would otherwise take from the app-server (see `buildBackendArgs`).
|
|
42
51
|
* - the value is classified by the shared `classify-tmux-cwd.ts` leaf BEFORE any mutation
|
|
43
52
|
* (same four stable reasons as resume; the measured tmux 3.6a facts live on that leaf).
|
|
44
53
|
* This module's hints phrase them as the REQUESTED cwd; resume's say RECORDED.
|
|
@@ -76,21 +85,46 @@
|
|
|
76
85
|
* the session the window is actually in. It still reports no `pane_current_path`, and
|
|
77
86
|
* there is no "session created" field because nothing here creates one.
|
|
78
87
|
*/
|
|
79
|
-
import { randomBytes } from "node:crypto";
|
|
80
88
|
import { classifyTmuxCwd } from "./classify-tmux-cwd.js";
|
|
81
|
-
import {
|
|
89
|
+
import { CODEX_CALLER_SEAT_HINT, resolveCodexCallerSeat, } from "./codex-caller-seat.js";
|
|
90
|
+
import { CODEX_CALLER_PREFLIGHT_HINT, CODEX_LAUNCH_CWD_PREFLIGHT_HINT, CODEX_PREFLIGHT_HINT, codexLaunchCwdFreshPreflight, } from "./codex-fresh-preflight.js";
|
|
82
91
|
import { COPILOT_PREFLIGHT_HINT, copilotFreshPreflight, } from "./copilot-fresh-preflight.js";
|
|
92
|
+
import { buildOmpBootstrapPayload, composeBackendArgs, composeFreshCallPrompt, FRESH_CALL_BACKENDS, FRESH_CALL_CALLBACK_TOOL, isSafeFreshCallModel, MODEL_MAX_CHARS, mintNonce, normalizeFreshCallInputs, OMP_BOOTSTRAP_FLAG, OMP_BOOTSTRAP_VERSION, TASK_MAX_CHARS, } from "./fresh-call-composition.js";
|
|
83
93
|
import { assertLaunchTarget, LaunchPreconditionError, resolveRuntimeOnPath, } from "./mux-launch.js";
|
|
84
94
|
import { APPEND_FORMAT, assertSelector, assertTmuxOk, inspectPlacement, parseWindowFields, requireSameContext, runTmux, } from "./mux-placement.js";
|
|
85
95
|
import { resolveCodexDefaultSocketPath } from "./native-push/codex-ws-client.js";
|
|
86
96
|
import { OMP_PREFLIGHT_HINT, ompFreshPreflight } from "./omp-fresh-preflight.js";
|
|
87
97
|
import { classifyTmuxSessionName, resolveTmuxSessionId } from "./resolve-tmux-session.js";
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
98
|
+
/**
|
|
99
|
+
* THE COMPOSITION MOVED, THE RAIL DID NOT (#116 S2-a). Backend argv, the first-turn framing and
|
|
100
|
+
* the nonce now live in `fresh-call-composition.ts`, which knows nothing about tmux, so the herdr
|
|
101
|
+
* rail can reach them without importing this file and dragging placement behind it. They are
|
|
102
|
+
* re-exported here unchanged: every existing caller, gate and mutant anchor that reads them from
|
|
103
|
+
* this module keeps reading the same names.
|
|
104
|
+
*
|
|
105
|
+
* The two wrappers below are where this rail states what only it can state — the sentence that
|
|
106
|
+
* says a sibling was opened in the operator's tmux session, and the Codex socket path. Both are
|
|
107
|
+
* arguments to the leaf rather than knowledge inside it.
|
|
108
|
+
*/
|
|
109
|
+
export { buildOmpBootstrapPayload, FRESH_CALL_BACKENDS, FRESH_CALL_CALLBACK_TOOL, isSafeFreshCallModel, MODEL_MAX_CHARS, mintNonce, OMP_BOOTSTRAP_FLAG, OMP_BOOTSTRAP_VERSION, TASK_MAX_CHARS, };
|
|
110
|
+
/** What the tmux rail tells a sibling about where it woke up. The resume verb has no equivalent
|
|
111
|
+
* because it composes no first turn at all; a herdr rail will pass its own sentence here. */
|
|
112
|
+
export const TMUX_FRESH_CALL_OPENING_LINE = "You are a fresh visible citizen that entwurf opened in the operator's tmux session.";
|
|
113
|
+
/** Backend argv for THIS rail: the neutral dialect, with the two Codex facts only a rail can
|
|
114
|
+
* state — the socket resolved from the caller's env, and the directory this launch chose.
|
|
115
|
+
*
|
|
116
|
+
* `launchCwd` defaults to THIS process's own directory, which is what tmux gives a window opened
|
|
117
|
+
* with no `-c` (`[측정 ×2]`, module header). The default is that inherited fact rather than a
|
|
118
|
+
* convenience, so a caller that omits it still names the truth to codex. Both facts reach the
|
|
119
|
+
* leaf lazily, because a host with no Codex home must still be able to open pi and claude
|
|
120
|
+
* siblings — see `composeBackendArgs`. */
|
|
121
|
+
export function buildBackendArgs(backend, composition, model, env = process.env, launchCwd = process.cwd()) {
|
|
122
|
+
return composeBackendArgs(backend, composition, model, () => resolveCodexDefaultSocketPath(env), () => launchCwd);
|
|
123
|
+
}
|
|
124
|
+
/** The first turn for THIS rail: the neutral framing under this rail's placement sentence. */
|
|
125
|
+
export function buildFreshCallPrompt(params) {
|
|
126
|
+
return composeFreshCallPrompt({ ...params, openingLine: TMUX_FRESH_CALL_OPENING_LINE });
|
|
127
|
+
}
|
|
94
128
|
/**
|
|
95
129
|
* The fixed runtime each backend resolves on PATH. Same reason `mux-launch` uses PATH rather
|
|
96
130
|
* than a compiled-in location: the official binary is whatever the operator's environment gives
|
|
@@ -121,234 +155,31 @@ export const FRESH_CALL_RUNTIME = {
|
|
|
121
155
|
codex: "codex",
|
|
122
156
|
};
|
|
123
157
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* (
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*/
|
|
144
|
-
export const FRESH_CALL_CALLBACK_TOOL = {
|
|
145
|
-
pi: "entwurf_v2",
|
|
146
|
-
"claude-code": "mcp__entwurf-bridge__entwurf_v2",
|
|
147
|
-
copilot: "entwurf-bridge-entwurf_v2",
|
|
148
|
-
omp: "mcp__entwurf_bridge_entwurf_v",
|
|
149
|
-
codex: "mcp__entwurf_bridge__entwurf_v2",
|
|
150
|
-
};
|
|
151
|
-
/** Mirrors the `entwurf_v2` message bound. This is an INTERFACE cap for symmetry with the
|
|
152
|
-
* delivery surface, not a claim that a task of this size was measured through tmux. An argv
|
|
153
|
-
* that the OS refuses is a launch failure and fails loud — it never reads as a delivered task. */
|
|
154
|
-
export const TASK_MAX_CHARS = 16000;
|
|
155
|
-
export const MODEL_MAX_CHARS = 200;
|
|
156
|
-
const MODEL_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._/:[\]-]*$/;
|
|
157
|
-
/** A model is an explicit launch input, not ambient process state. The grammar admits canonical
|
|
158
|
-
* pi provider/model ids, Claude model ids/aliases, and bracketed context variants, while refusing
|
|
159
|
-
* whitespace and tmux control syntax. It is passed without a shell using each runtime's measured
|
|
160
|
-
* CLI dialect: Pi takes `--model`, value; Claude Code takes `--model=value`. */
|
|
161
|
-
export function isSafeFreshCallModel(model) {
|
|
162
|
-
return model.length > 0 && model.length <= MODEL_MAX_CHARS && MODEL_PATTERN.test(model);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Backend argv AFTER the runtime path. Both orders are MEASURED, and both were measured by
|
|
166
|
-
* getting them wrong first (rail §6-a):
|
|
167
|
-
*
|
|
168
|
-
* pi — prompt BEFORE `--entwurf-control`, then `--model`, value as TWO tokens.
|
|
169
|
-
* Flag-first submitted no message; Pi rejects the equals form for `--model`.
|
|
170
|
-
* claude-code — prompt, then `--allowedTools=` and `--model=` as ONE token each. The space form
|
|
171
|
-
* for allowedTools is variadic and eats the prompt as an option value.
|
|
172
|
-
* copilot — the managed VERB first, then the prompt as the value of `-i/--interactive`,
|
|
173
|
-
* `--model`, value as two tokens, and the policy as the explicit `--yolo`
|
|
174
|
-
* token. Measured from `copilot --help` (1.0.80).
|
|
175
|
-
* omp — NO positional prompt at all. The task rides `--entwurf-bootstrap`, a fixed
|
|
176
|
-
* flag the installed birth extension registers, then `--model`, value as two
|
|
177
|
-
* tokens, then the policy as `--approval-mode`, `yolo`. `-p/--print` remains
|
|
178
|
-
* the flag this argv must never carry — it processes a prompt and EXITS,
|
|
179
|
-
* closing the window on a sibling that has to stay open to be delivered to.
|
|
180
|
-
*
|
|
181
|
-
* Both pi/claude failures looked identical from outside: window open, record and socket minted,
|
|
182
|
-
* no turn.
|
|
183
|
-
*
|
|
184
|
-
* For pi and claude-code the equals form is NOT a permission guarantee — on the measured host
|
|
185
|
-
* the tool was already permitted, so the option's effect was unobservable. What was observed is
|
|
186
|
-
* that it does no harm to the argv. Permission stays a documented host precondition there.
|
|
187
|
-
*
|
|
188
|
-
* Copilot is the backend where the policy IS carried explicitly (step 9 clause 2), and three of
|
|
189
|
-
* its argv facts are load-bearing:
|
|
190
|
-
*
|
|
191
|
-
* - `copilot` is argv[0] of the RUNTIME `entwurf`, i.e. the managed verb — see
|
|
192
|
-
* `FRESH_CALL_RUNTIME`. Everything after it is forwarded byte-identical by
|
|
193
|
-
* `scripts/copilot-launch.sh`.
|
|
194
|
-
* - the prompt rides `--interactive`, never `-p/--prompt`: `-p` runs the prompt and EXITS,
|
|
195
|
-
* which would close the window on a sibling that is supposed to stay open and be delivered
|
|
196
|
-
* to. `--interactive <prompt>` is non-variadic, so the space form is safe here.
|
|
197
|
-
* - the policy token is `--yolo`, STATED HERE rather than left to the launcher: the launcher
|
|
198
|
-
* injects `--yolo` only when the argv names no policy, and step 9 clause 2 requires the
|
|
199
|
-
* fresh composition to state its model and permission policy explicitly, never to rely
|
|
200
|
-
* invisibly on someone else's default.
|
|
201
|
-
*
|
|
202
|
-
* `--yolo` is a GLG operator decision, not a drifted default. The first cut passed a
|
|
203
|
-
* callback-only `--allow-tool=entwurf-bridge(entwurf_v2)` grant, and GLG's 2026-08-25 operator
|
|
204
|
-
* LIVE measured the consequence: the fresh sibling's footer showed no `YOLO`, and every tool
|
|
205
|
-
* its task needed stopped on a confirmation prompt, which made the sibling impractical to work
|
|
206
|
-
* with. GLG then set the policy explicitly: a fresh Copilot sibling carries the same managed
|
|
207
|
-
* `--yolo` profile a human-typed `entwurf copilot` gets. (Copilot 1.0.80 help: `--yolo` = all
|
|
208
|
-
* tools + all paths + all URLs.) The permission GRAMMAR lesson from that first cut — Copilot's
|
|
209
|
-
* `--allow-tool` takes `<mcp-server-name>(tool-name?)`, a different dialect from the
|
|
210
|
-
* model-facing tool name — stays recorded in `docs/adding-a-harness.md` step 9's worked
|
|
211
|
-
* example; it is a measured vendor fact even though this argv no longer uses it.
|
|
212
|
-
*
|
|
213
|
-
* OMP'S POLICY TOKEN IS THE ONE MOST EASILY ARGUED AWAY, SO READ THIS BEFORE DELETING IT.
|
|
214
|
-
* `[측정]` omp 18.0.0's schema default for `tools.approvalMode` IS ALREADY `yolo`
|
|
215
|
-
* (vendor doc `omp://approval-mode.md`; `omp config get tools.approvalMode` → `yolo` on the
|
|
216
|
-
* acceptance host). So dropping `--approval-mode yolo` changes NOTHING observable: the callback
|
|
217
|
-
* still fires, the LIVE smoke still passes, and the argv silently starts depending on a vendor
|
|
218
|
-
* default and on whatever the operator's config happens to say. That is exactly the drift step 9
|
|
219
|
-
* clause 2 forbids — "carry the chosen width as an explicit argv token rather than relying on a
|
|
220
|
-
* launcher's injected default" — and the reason the width is stated here even though the host
|
|
221
|
-
* would have granted it anyway. The width itself (task-wide, not callback-only) is a GLG
|
|
222
|
-
* operator decision of 2026-08-30, taken with the Copilot measurement in hand: a callback-only
|
|
223
|
-
* sibling names itself and then stops at the first tool its TASK needs. omp offers no argv
|
|
224
|
-
* grammar for a narrower grant at all — `tools.approval.<tool>` is a config axis, not a flag —
|
|
225
|
-
* so the honest choice was between `write` and `yolo`, and `yolo` matches what a human-typed
|
|
226
|
-
* `omp` gets on this host. `--approval-mode` takes both the space and equals form (measured);
|
|
227
|
-
* the space form is used for symmetry with `--model`.
|
|
228
|
-
*
|
|
229
|
-
* WHY OMP ALONE CARRIES NO PROMPT, AND WHY THAT IS A MEASUREMENT RATHER THAN A PREFERENCE.
|
|
230
|
-
* `[LIVE 2026-08-30]` the first public fresh call at omp DID pass the full framing as a bare
|
|
231
|
-
* positional. The window opened, the record minted (garden `20260830T181342-452167`), the
|
|
232
|
-
* prompt arrived byte-identical as a user message at `09:13:42.413Z` — and the model answered
|
|
233
|
-
* the literal text `ACK` with ZERO tool calls, because the callback tool did not exist yet.
|
|
234
|
-
* `[source]` the interactive UI defers MCP discovery and only refreshes the tool list once
|
|
235
|
-
* `discoverAndConnect()` settles (`sdk.ts:1847-1855`, `:1881-1905`), while the positional
|
|
236
|
-
* `initialMessage` prompts immediately after `await mode.init()` (`main.ts:540-565`,
|
|
237
|
-
* `595-610`). `[측정]` a `/tmp` observer on the same runtime: `turn_start` at +654ms with the
|
|
238
|
-
* entwurf tools ABSENT, callback tool present only at +1484ms — the turn began ~830ms before
|
|
239
|
-
* the tool it was told to call existed. No argv can close that gap, because the gap is a race
|
|
240
|
-
* inside the host. So the composition hands omp a PAYLOAD instead of a turn, and the
|
|
241
|
-
* in-process birth extension — which can see when the tool becomes callable — owns the first
|
|
242
|
-
* two messages (`pi-extensions/meta-bridge-omp.ts`, "THE TWO-STAGE FRESH BOOTSTRAP").
|
|
243
|
-
*
|
|
244
|
-
* The flag is fixed and one-purpose ON PURPOSE. `[측정 2026-08-30]` a normal discovered
|
|
245
|
-
* extension that registers a flag receives the operator's argv value byte-identical — quotes,
|
|
246
|
-
* `$VAR`, backticks and a semicolon all survived a 137-byte JSON payload — because extensions
|
|
247
|
-
* load before argv classification and the reparse writes the registered map
|
|
248
|
-
* (`main.ts:1799-1810`, `cli/extension-flags.ts:36-43`). An env carrier or a temp file would
|
|
249
|
-
* have needed its own quoting, its own lifetime and its own refusal rules; argv already owns
|
|
250
|
-
* all three. This is deliberately NOT a general `--flag value` passthrough — an arbitrary
|
|
251
|
-
* carrier would hand callers the launch-shaping power this rail exists to refuse.
|
|
252
|
-
*/
|
|
253
|
-
export function buildBackendArgs(backend, composition, model, env = process.env) {
|
|
254
|
-
switch (backend) {
|
|
255
|
-
case "pi":
|
|
256
|
-
return [composition.prompt, "--entwurf-control", "--model", model];
|
|
257
|
-
case "claude-code":
|
|
258
|
-
return [composition.prompt, `--allowedTools=${FRESH_CALL_CALLBACK_TOOL["claude-code"]}`, `--model=${model}`];
|
|
259
|
-
case "copilot":
|
|
260
|
-
return ["copilot", "--interactive", composition.prompt, "--model", model, "--yolo"];
|
|
261
|
-
case "omp":
|
|
262
|
-
return [`--${OMP_BOOTSTRAP_FLAG}`, composition.bootstrapPayload, "--model", model, "--approval-mode", "yolo"];
|
|
263
|
-
case "codex":
|
|
264
|
-
return [
|
|
265
|
-
"--remote",
|
|
266
|
-
`unix://${resolveCodexDefaultSocketPath(env)}`,
|
|
267
|
-
"--model",
|
|
268
|
-
model,
|
|
269
|
-
"--dangerously-bypass-approvals-and-sandbox",
|
|
270
|
-
composition.prompt,
|
|
271
|
-
];
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* The omp bootstrap flag, spelled WITHOUT dashes — the vendor's flag map is keyed by bare
|
|
276
|
-
* name (`extensions/loader.ts:221-228`) and this composition adds the `--` itself.
|
|
277
|
-
*
|
|
278
|
-
* Held equal to the installed extension's own constant by
|
|
279
|
-
* `test/omp-fresh-bootstrap.contract.test.ts`. The two copies exist because the extension
|
|
280
|
-
* ships INSIDE the omp agent dir carrying only its own small closure and cannot import this
|
|
281
|
-
* module; the gate is what keeps the duplication from becoming drift.
|
|
282
|
-
*/
|
|
283
|
-
export const OMP_BOOTSTRAP_FLAG = "entwurf-bootstrap";
|
|
284
|
-
/** Payload grammar version, matched exactly by the decoder. A bump means a stale installed
|
|
285
|
-
* unit, which is the one thing `doctor-omp-bridge` exists to say out loud. */
|
|
286
|
-
export const OMP_BOOTSTRAP_VERSION = 1;
|
|
287
|
-
/**
|
|
288
|
-
* The whole of what a fresh omp sibling is launched with.
|
|
289
|
-
*
|
|
290
|
-
* THREE FIELDS, CLOSED. The decoder refuses an unknown key, so this object is the entire
|
|
291
|
-
* contract: who to call back, the nonce that proves it is this call, and the task that is
|
|
292
|
-
* released only after that callback succeeds. There is no command here, no path, no env name
|
|
293
|
-
* and no model — the model is already an explicit argv token, and a second copy of it inside
|
|
294
|
-
* a payload would be a second place for it to disagree with the launch.
|
|
295
|
-
*/
|
|
296
|
-
export function buildOmpBootstrapPayload(params) {
|
|
297
|
-
return JSON.stringify({
|
|
298
|
-
v: OMP_BOOTSTRAP_VERSION,
|
|
299
|
-
target: params.callerGardenId,
|
|
300
|
-
nonce: params.nonce,
|
|
301
|
-
task: params.task,
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* The first-turn framing. Order is the contract: the callback is the FIRST action and the task
|
|
306
|
-
* follows it, so a sibling that gets stuck in the task has already told the caller who it is.
|
|
307
|
-
*
|
|
308
|
-
* The three prohibitions are not politeness. Each names a detour that was measured to produce a
|
|
309
|
-
* confidently wrong answer or a wasted turn.
|
|
310
|
-
*/
|
|
311
|
-
export function buildFreshCallPrompt(params) {
|
|
312
|
-
const tool = FRESH_CALL_CALLBACK_TOOL[params.backend];
|
|
313
|
-
return [
|
|
314
|
-
"You are a fresh visible citizen that entwurf opened in the operator's tmux session.",
|
|
315
|
-
"",
|
|
316
|
-
`FIRST ACTION, before reading files or anything else: call ${tool} with ` +
|
|
317
|
-
`target=${params.callerGardenId}, intent=fire-and-forget, wants_reply=false, and ` +
|
|
318
|
-
`message set to exactly ${params.nonce} — that string alone, nothing added.`,
|
|
319
|
-
"That call is how the agent that opened you learns your address. Do not skip it, do not",
|
|
320
|
-
"defer it until the task is done, and do not reword the message.",
|
|
321
|
-
"",
|
|
322
|
-
"Do not inspect environment variables, do not call entwurf_self, and do not start an MCP",
|
|
323
|
-
"server yourself. Your own report of your identity is not the address anyone needs.",
|
|
324
|
-
"",
|
|
325
|
-
"After the tool receipt, carry out this task:",
|
|
326
|
-
"",
|
|
327
|
-
params.task,
|
|
328
|
-
].join("\n");
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Codex's explicit home topology (#95): the operator provides this one existing tmux session
|
|
332
|
-
* and seats the operator-owned app-server plus supported Codex TUIs there. This is a placement
|
|
333
|
-
* convention, not an address axis — `threadId` remains the native delivery address.
|
|
158
|
+
* WHICH RULE PICKS THE TARGET SESSION. Three in strict order, and the order is the contract:
|
|
159
|
+
*
|
|
160
|
+
* 1. an explicit `placement` — the expert override, and it wins over everything below.
|
|
161
|
+
* 2. a CODEX CALLER with placement omitted — the sibling opens beside the caller's own TUI
|
|
162
|
+
* pane, found by the title anchor (#95 lane B). This one is NOT a named seat and is
|
|
163
|
+
* therefore not decided here: it resolves to a native `$id` with no name in between, so
|
|
164
|
+
* `freshCall` owns it directly (see the anchor step below) and this function answers
|
|
165
|
+
* `null` so the name grammar and the name→id lookup stay out of a path that has neither.
|
|
166
|
+
* 3. anything else — the caller's own session, with no named seat at all.
|
|
167
|
+
*
|
|
168
|
+
* THE SEAT FOLLOWS THE CALLER, NEVER THE BACKEND BEING OPENED. #95 first shipped a fourth rule —
|
|
169
|
+
* an omitted-placement Codex TARGET selected a fixed existing session named `codex`, where the
|
|
170
|
+
* operator seated the app-server and their TUIs — and #95 D1 retired it (GLG, 2026-09-16). It
|
|
171
|
+
* was a workaround for a mapping that did not exist yet: nothing could find the pane a Codex
|
|
172
|
+
* caller was sitting in, so the operator was asked to keep every Codex in one known room. Rule 2
|
|
173
|
+
* is that mapping, so the room is no longer load-bearing, and keeping it would have meant Codex
|
|
174
|
+
* alone answering "where does a sibling open?" differently from every other backend. The
|
|
175
|
+
* operator-owned app-server keeps its own seat wherever the operator puts it; Entwurf still
|
|
176
|
+
* never creates, moves or supervises it.
|
|
334
177
|
*/
|
|
335
|
-
export
|
|
336
|
-
/** An explicit seat always wins. Only omitted Codex placement gets the fixed home. */
|
|
337
|
-
export function selectFreshCallSeat(backend, placement) {
|
|
178
|
+
export function selectFreshCallSeat(placement) {
|
|
338
179
|
if (placement !== undefined)
|
|
339
180
|
return { tmuxSession: placement.tmuxSession, source: "requested" };
|
|
340
|
-
if (backend === "codex")
|
|
341
|
-
return { tmuxSession: CODEX_HOME_TMUX_SESSION, source: "codex-home" };
|
|
342
181
|
return null;
|
|
343
182
|
}
|
|
344
|
-
/** Correlation tag only. Random, never derived from time, cwd or a peer listing — a nonce that
|
|
345
|
-
* encoded any of those would invite exactly the guessing this rail exists to refuse. */
|
|
346
|
-
export function mintNonce(randomHex = defaultRandomHex) {
|
|
347
|
-
return `mux-fresh-call-${randomHex()}`;
|
|
348
|
-
}
|
|
349
|
-
function defaultRandomHex() {
|
|
350
|
-
return randomBytes(12).toString("hex");
|
|
351
|
-
}
|
|
352
183
|
/**
|
|
353
184
|
* The pi identity carrier, scrubbed at the launch seam for EVERY backend (#87 Bundle C).
|
|
354
185
|
*
|
|
@@ -416,25 +247,48 @@ export function buildFreshCallArgs(targetSessionId, runtimePath, backendArgs, cw
|
|
|
416
247
|
* `callerGardenId` is supplied by the SURFACE that registered this tool, from its own
|
|
417
248
|
* record-backed context. It is not a tool parameter and this module never derives, validates
|
|
418
249
|
* against a store, or guesses it: an empty value is a named refusal, not a lookup.
|
|
250
|
+
*
|
|
251
|
+
* `callerNativeSessionId` is supplied by the same surface under the same rule, and its PRESENCE
|
|
252
|
+
* is the whole signal: it is set exactly when the reconciled sender is a record-backed codex
|
|
253
|
+
* citizen, and it carries that citizen's `nativeSessionId` (the `_meta.threadId` the vendor put
|
|
254
|
+
* on this very request). This module never resolves it, never reads `_meta`, and never asks a
|
|
255
|
+
* store who is calling — it only turns a thread id into a pane, and only for placement.
|
|
256
|
+
*
|
|
257
|
+
* `callerCwd` rides the same surface rule and the same condition: it is that codex citizen's
|
|
258
|
+
* RECORD cwd, and it exists because a codex caller's process directory is NOT its own (the
|
|
259
|
+
* bridge runs as a child of the operator-owned app-server, so the directory that process
|
|
260
|
+
* reports is the app-server's — #95 lane C §2). It is consulted only when the caller requested
|
|
261
|
+
* no cwd, so an
|
|
262
|
+
* explicit request always wins, and this module never looks a cwd up, resolves it, or infers it
|
|
263
|
+
* from a seat, a workspace map or a project name.
|
|
419
264
|
*/
|
|
420
265
|
export function freshCall(params, env = process.env, nonce = mintNonce()) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
266
|
+
// The caller-facing input contract lives in the composition leaf so BOTH rails answer a
|
|
267
|
+
// mistyped model or an oversized task with the same words. Order, trimming and the
|
|
268
|
+
// cwd-omission rule (`undefined` and the exact empty string, and nothing else, mean "no
|
|
269
|
+
// cwd") are unchanged from when they lived here.
|
|
270
|
+
const normalized = normalizeFreshCallInputs(params);
|
|
271
|
+
if (!normalized.ok)
|
|
272
|
+
return { ok: false, reason: normalized.reason };
|
|
273
|
+
const { callerGardenId, model, task, cwd: requestedCwd } = normalized.inputs;
|
|
274
|
+
// The caller's own record directory answers the SAME two-value emptiness rule the leaf
|
|
275
|
+
// applies to a requested cwd, and is consulted ONLY second: an explicit request always wins,
|
|
276
|
+
// and a caller that supplies neither leaves the pane to inherit this process's directory
|
|
277
|
+
// exactly as before — a pi caller's argv is byte-identical, because its process directory IS
|
|
278
|
+
// its own and a `-c` token would change nothing about where that window lands.
|
|
279
|
+
const callerCwd = params.callerCwd === undefined || params.callerCwd === "" ? undefined : params.callerCwd;
|
|
280
|
+
const chosenCwd = requestedCwd !== undefined
|
|
281
|
+
? { value: requestedCwd, source: "requested" }
|
|
282
|
+
: callerCwd !== undefined
|
|
283
|
+
? { value: callerCwd, source: "codex-caller-record" }
|
|
284
|
+
: undefined;
|
|
285
|
+
const cwd = chosenCwd?.value;
|
|
286
|
+
// SEAM (#95 lane C): a caller-record directory is classified by the SAME shared leaf and
|
|
287
|
+
// answers the same four `cwd-*` reasons, whose hint text says REQUESTED. When a codex
|
|
288
|
+
// caller's recorded directory has since been deleted, the repair that hint points at is
|
|
289
|
+
// still the right one — that directory does not exist — but the noun belongs to the caller
|
|
290
|
+
// rather than to the request. Kept shared on purpose: doubling the reason set for a wording
|
|
291
|
+
// difference would double the refusal contract two surfaces and one leaf already agree on.
|
|
438
292
|
if (cwd !== undefined) {
|
|
439
293
|
const badCwd = classifyTmuxCwd(cwd);
|
|
440
294
|
if (badCwd)
|
|
@@ -444,9 +298,10 @@ export function freshCall(params, env = process.env, nonce = mintNonce()) {
|
|
|
444
298
|
// without tmux, so an unresolvable name is answered before anything else runs. Whether that
|
|
445
299
|
// session EXISTS is a tmux question and is asked below, after the caller's own context is
|
|
446
300
|
// proven — a name check that needed a live server would refuse for the wrong reason on a
|
|
447
|
-
// host with no tmux at all.
|
|
448
|
-
//
|
|
449
|
-
|
|
301
|
+
// host with no tmux at all. An explicit seat is an expert override and is reported as such; a
|
|
302
|
+
// CODEX CALLER's own pane is deliberately not a name at all, so it is absent here and
|
|
303
|
+
// resolved after the context proof below — see `selectFreshCallSeat` for the three-rule order.
|
|
304
|
+
const selectedSeat = selectFreshCallSeat(params.placement);
|
|
450
305
|
const seat = selectedSeat?.tmuxSession;
|
|
451
306
|
if (seat !== undefined) {
|
|
452
307
|
const badSeat = classifyTmuxSessionName(seat);
|
|
@@ -488,22 +343,67 @@ export function freshCall(params, env = process.env, nonce = mintNonce()) {
|
|
|
488
343
|
// native id continues; the name does not travel past this line. STILL PRE-MUTATION: an
|
|
489
344
|
// absent seat refuses with no window anywhere.
|
|
490
345
|
let targetSessionId = placement.sessionId;
|
|
346
|
+
let anchoredSeat = false;
|
|
491
347
|
if (seat !== undefined) {
|
|
492
348
|
const resolved = resolveTmuxSessionId(seat, (args) => runTmux(args, env));
|
|
493
349
|
if (!resolved.ok)
|
|
494
350
|
return { ok: false, reason: resolved.reason };
|
|
495
351
|
targetSessionId = resolved.sessionId;
|
|
496
352
|
}
|
|
353
|
+
else if (params.placement === undefined && params.callerNativeSessionId !== undefined) {
|
|
354
|
+
// Rule 2: the caller is a codex citizen and named no seat, so the sibling belongs beside
|
|
355
|
+
// the caller's own TUI. The pane is found by the title anchor and ONLY its `$session`
|
|
356
|
+
// continues — a pane title is forgeable, so it may never become an address, a liveness
|
|
357
|
+
// claim or a delivery input (Hard Rule 16). `params.placement` is re-read here rather
|
|
358
|
+
// than inferred from `seat === undefined`: "an explicit seat always wins" is the one
|
|
359
|
+
// invariant a later edit must not be able to lose by accident.
|
|
360
|
+
// STILL PRE-MUTATION: 0 or 2+ matching panes refuse with no window anywhere and no
|
|
361
|
+
// fallback to any other session.
|
|
362
|
+
const anchor = resolveCodexCallerSeat(params.callerNativeSessionId, (args) => runTmux(args, env));
|
|
363
|
+
if (!anchor.ok)
|
|
364
|
+
return { ok: false, reason: anchor.reason };
|
|
365
|
+
targetSessionId = anchor.seat.sessionId;
|
|
366
|
+
anchoredSeat = true;
|
|
367
|
+
}
|
|
497
368
|
const composition = {
|
|
498
369
|
prompt: buildFreshCallPrompt({
|
|
499
370
|
backend: params.backend,
|
|
500
371
|
task,
|
|
501
|
-
callerGardenId
|
|
372
|
+
callerGardenId,
|
|
502
373
|
nonce,
|
|
503
374
|
}),
|
|
504
|
-
bootstrapPayload: buildOmpBootstrapPayload({ callerGardenId
|
|
375
|
+
bootstrapPayload: buildOmpBootstrapPayload({ callerGardenId, nonce, task }),
|
|
505
376
|
};
|
|
506
|
-
const
|
|
377
|
+
const backendArgs = buildBackendArgs(params.backend, composition, model, env, cwd);
|
|
378
|
+
// THE LAUNCH-DIRECTORY NOTE, AND IT IS A DIAGNOSTIC RATHER THAN A GATE. `[측정 2026-09-16]` a
|
|
379
|
+
// Codex sibling opened into a directory this Codex has no answer for stops on the vendor's
|
|
380
|
+
// folder-consent screen: no first turn, no rollout, no callback. It is tempting to refuse
|
|
381
|
+
// that, and refusing is the wrong product. The consent screen is SELF-REPAIRING when a human
|
|
382
|
+
// is there — one answer and the vendor records the directory, so every later launch runs —
|
|
383
|
+
// and an operator at the keyboard is exactly who a visible-first rail is built for. A refusal
|
|
384
|
+
// would replace that one answer with "no window, go run codex yourself, then call again", and
|
|
385
|
+
// it would have to be right about a decision this process cannot fully see (the vendor merges
|
|
386
|
+
// system, managed and cloud layers around the file this leaf reads). So the launch proceeds
|
|
387
|
+
// and says what it saw.
|
|
388
|
+
//
|
|
389
|
+
// The UNATTENDED case is not answered here and must not be: a gate with nobody at the keyboard
|
|
390
|
+
// needs its precondition named before it spends a model turn, which is its own oracle's job —
|
|
391
|
+
// `smoke-codex-fresh-live` asserts this same leaf up front, so a missing answer reads as a
|
|
392
|
+
// named precondition instead of a callback timeout.
|
|
393
|
+
//
|
|
394
|
+
// The directory asked about is READ BACK off codex's own `-C` token rather than recomputed:
|
|
395
|
+
// one resolution, one authority, and no way for the note to name a directory the thread will
|
|
396
|
+
// not start in (this module is deliberately not allowed to resolve the inherited default a
|
|
397
|
+
// second time — `FRESHCALL-CWD-CALLER-ONLY`).
|
|
398
|
+
if (params.backend === "codex") {
|
|
399
|
+
const at = backendArgs.indexOf("-C");
|
|
400
|
+
const launchCwd = backendArgs[at + 1] ?? "";
|
|
401
|
+
const unanswered = codexLaunchCwdFreshPreflight(env, launchCwd);
|
|
402
|
+
if (unanswered) {
|
|
403
|
+
console.error(`[fresh-call] ${unanswered}: ${launchCwd}\n` + ` ${CODEX_LAUNCH_CWD_PREFLIGHT_HINT[unanswered]}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const run = runTmux(buildFreshCallArgs(targetSessionId, runtimePath, backendArgs, cwd), env);
|
|
507
407
|
assertTmuxOk("new-window", run);
|
|
508
408
|
let fields;
|
|
509
409
|
try {
|
|
@@ -523,9 +423,11 @@ export function freshCall(params, env = process.env, nonce = mintNonce()) {
|
|
|
523
423
|
...fields,
|
|
524
424
|
backend: params.backend,
|
|
525
425
|
model,
|
|
526
|
-
...(
|
|
426
|
+
...(chosenCwd === undefined ? {} : { cwd: chosenCwd.value, cwdSource: chosenCwd.source }),
|
|
527
427
|
...(selectedSeat === null
|
|
528
|
-
?
|
|
428
|
+
? anchoredSeat
|
|
429
|
+
? { tmuxSessionSource: "codex-title-anchor" }
|
|
430
|
+
: {}
|
|
529
431
|
: { tmuxSession: selectedSeat.tmuxSession, tmuxSessionSource: selectedSeat.source }),
|
|
530
432
|
runtimePath,
|
|
531
433
|
nonce,
|
|
@@ -540,6 +442,8 @@ const REJECT_HINT = {
|
|
|
540
442
|
...COPILOT_PREFLIGHT_HINT,
|
|
541
443
|
...OMP_PREFLIGHT_HINT,
|
|
542
444
|
...CODEX_PREFLIGHT_HINT,
|
|
445
|
+
...CODEX_CALLER_PREFLIGHT_HINT,
|
|
446
|
+
...CODEX_CALLER_SEAT_HINT,
|
|
543
447
|
"no-tmux-context": "this agent is not running inside tmux, so there is no session to open a sibling beside",
|
|
544
448
|
"anchor-malformed": "TMUX_PANE is not a native pane id",
|
|
545
449
|
"anchor-unresolved": "tmux resolved no pane for this agent's anchor",
|
|
@@ -550,7 +454,7 @@ const REJECT_HINT = {
|
|
|
550
454
|
"cwd-missing": "the requested cwd does not exist; tmux would not report this, it would open the window in $HOME and look successful",
|
|
551
455
|
"cwd-not-directory": "the requested cwd exists but is not a directory",
|
|
552
456
|
"tmux-session-name-invalid": "the requested tmux session name is outside the shape this rail addresses (start with a letter or digit, then letters, digits, '_' or '-') — some other shapes tmux cannot resolve at all ('#' is expanded when the name is stored; '.' and ':' are its own pane/window separators inside a target; a name like '$0' loses to the session id '$0'), and the rest are declined to keep one narrow grammar, so rename the session or open one whose name fits",
|
|
553
|
-
"tmux-session-missing": "no session with that exact name answers on this agent's tmux server (or that server stopped answering) — nothing was created, so open the session yourself and call again
|
|
457
|
+
"tmux-session-missing": "no session with that exact name answers on this agent's tmux server (or that server stopped answering) — nothing was created, so open the session yourself and call again",
|
|
554
458
|
"model-empty": "model is empty after trimming; fresh calls require an explicit model",
|
|
555
459
|
"model-invalid": `model must be one ${MODEL_MAX_CHARS}-character argv-safe id/alias without whitespace or tmux syntax`,
|
|
556
460
|
"task-empty": "task is empty after trimming",
|
|
@@ -583,11 +487,15 @@ export function renderFreshCall(result) {
|
|
|
583
487
|
text: `[entwurf fresh call →]\n` +
|
|
584
488
|
` backend: ${r.backend} (${r.runtimePath})\n` +
|
|
585
489
|
` model: ${r.model} (requested on the runtime CLI)\n` +
|
|
586
|
-
(r.cwd === undefined
|
|
587
|
-
|
|
490
|
+
(r.cwd === undefined
|
|
491
|
+
? ""
|
|
492
|
+
: r.cwdSource === "codex-caller-record"
|
|
493
|
+
? ` cwd: ${r.cwd} (the Codex caller's own record directory, used because no cwd was requested — not an observation)\n`
|
|
494
|
+
: ` cwd: ${r.cwd} (requested start directory — not an observation)\n`) +
|
|
495
|
+
(r.tmuxSessionSource === undefined
|
|
588
496
|
? ""
|
|
589
|
-
: r.tmuxSessionSource === "codex-
|
|
590
|
-
? ` seat: ${r.
|
|
497
|
+
: r.tmuxSessionSource === "codex-title-anchor"
|
|
498
|
+
? ` seat: ${r.sessionId} (the Codex caller's own pane, found by its thread-id terminal title — an OBSERVED session, not a requested name)\n`
|
|
591
499
|
: ` seat: ${r.tmuxSession} (requested tmux session, resolved to ${r.sessionId})\n`) +
|
|
592
500
|
` window: ${r.windowId} (index ${r.windowIndex}) in session ${r.sessionId}\n` +
|
|
593
501
|
` pane: ${r.paneId} pid ${r.panePid}\n` +
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* codex-socket-path — print the Codex app-server default control-socket path for THIS
|
|
3
|
+
* environment, and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* WHY A LEAF EXISTS FOR ONE LINE. `entwurf codex-app-server` is a bash launcher, and bash
|
|
6
|
+
* cannot import `resolveCodexDefaultSocketPath`. Its first version re-derived the path
|
|
7
|
+
* instead — `${CODEX_HOME:-$HOME/.codex}` plus a POSIX `[:space:]` trim — and a gate compared
|
|
8
|
+
* the two spellings over four ASCII-normal inputs, which they agreed on.
|
|
9
|
+
*
|
|
10
|
+
* They did not agree everywhere. `[측정 2026-09-16]` with `CODEX_HOME=$''` the TS leaf
|
|
11
|
+
* trims (JS `String.prototype.trim` strips U+FEFF) and falls back to `$HOME/.codex`, while the
|
|
12
|
+
* bash trim keeps the byte and yields `<BOM>/app-server-control/app-server-control.sock`. Same
|
|
13
|
+
* for `path.join`'s normalization of a trailing slash or a `..` segment. Every one of those is
|
|
14
|
+
* a managed launch starting a server at an address delivery and preflight never look at — a
|
|
15
|
+
* false success of exactly the kind this repo refuses.
|
|
16
|
+
*
|
|
17
|
+
* So the second spelling is gone rather than widened. There is ONE implementation of this
|
|
18
|
+
* address, this leaf prints it, and the launcher asks. Matching a transcription against its
|
|
19
|
+
* original can only ever test the inputs somebody thought of.
|
|
20
|
+
*
|
|
21
|
+
* Reads `process.env` directly: the resolver's contract is the ambient environment of whoever
|
|
22
|
+
* is about to launch, and an argv seam here would be a way to redirect the address.
|
|
23
|
+
*/
|
|
24
|
+
import { resolveCodexDefaultSocketPath } from "../pi-extensions/lib/native-push/codex-ws-client.js";
|
|
25
|
+
if (process.argv.length > 2) {
|
|
26
|
+
console.error("usage: codex-socket-path (no arguments; the environment is the input)");
|
|
27
|
+
process.exit(2);
|
|
28
|
+
}
|
|
29
|
+
// No trailing newline: the caller substitutes this straight into an address.
|
|
30
|
+
process.stdout.write(resolveCodexDefaultSocketPath(process.env));
|