@jbkjr/relay 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/LICENSES/Apache-2.0.txt +201 -0
- package/LICENSES/README.md +19 -0
- package/LICENSES/codex-NOTICE.txt +6 -0
- package/README.md +393 -2
- package/SECURITY.md +145 -0
- package/adapters/briefs/claude.md +43 -0
- package/adapters/briefs/codex.md +56 -0
- package/adapters/briefs/models.json +33 -0
- package/adapters/build.mjs +8 -0
- package/adapters/claude/.claude-plugin/marketplace.json +13 -0
- package/adapters/claude/relay/.claude-plugin/plugin.json +5 -0
- package/adapters/claude/relay/agents/codex.md +21 -0
- package/adapters/claude/relay/agents/operator.md +21 -0
- package/adapters/claude/relay/skills/ask/SKILL.md +20 -0
- package/adapters/claude/relay/skills/chat/SKILL.md +13 -0
- package/adapters/claude/relay/skills/delegate/SKILL.md +21 -0
- package/adapters/claude/relay/skills/discuss/SKILL.md +19 -0
- package/adapters/claude/relay/skills/review/SKILL.md +21 -0
- package/adapters/claude/relay/skills/tree/SKILL.md +10 -0
- package/adapters/claude/relay/skills/write-for-codex/SKILL.md +78 -0
- package/adapters/codex/.agents/plugins/marketplace.json +20 -0
- package/adapters/codex/AGENTS.snippet.md +5 -0
- package/adapters/codex/relay/.codex-plugin/plugin.json +6 -0
- package/adapters/codex/relay/skills/relay-ask/SKILL.md +20 -0
- package/adapters/codex/relay/skills/relay-chat/SKILL.md +13 -0
- package/adapters/codex/relay/skills/relay-delegate/SKILL.md +21 -0
- package/adapters/codex/relay/skills/relay-discuss/SKILL.md +19 -0
- package/adapters/codex/relay/skills/relay-review/SKILL.md +21 -0
- package/adapters/codex/relay/skills/relay-tree/SKILL.md +10 -0
- package/adapters/codex/relay/skills/relay-write-for-claude/SKILL.md +66 -0
- package/adapters/generate.mjs +124 -0
- package/bin/relay +59 -0
- package/codex-pin.json +12 -0
- package/dist/backends/acp.js +1424 -0
- package/dist/backends/claude.js +890 -0
- package/dist/backends/cli-version.js +112 -0
- package/dist/backends/codex-app.js +1539 -0
- package/dist/backends/codex-daybreak.js +75 -0
- package/dist/backends/codex-env.js +656 -0
- package/dist/backends/codex-network.js +304 -0
- package/dist/backends/codex-pin.js +345 -0
- package/dist/backends/codex-shell-policy.js +182 -0
- package/dist/backends/codex-stage2.js +998 -0
- package/dist/backends/codex-subagents.js +47 -0
- package/dist/backends/codex.js +641 -0
- package/dist/backends/copilot.js +246 -0
- package/dist/backends/env.js +147 -0
- package/dist/backends/gemini.js +607 -0
- package/dist/backends/grok.js +337 -0
- package/dist/backends/index.js +8 -0
- package/dist/backends/native-temp.js +187 -0
- package/dist/backends/never-admission.js +90 -0
- package/dist/backends/run.js +67 -0
- package/dist/backends/stream.js +230 -0
- package/dist/backends/tool-discovery.js +15 -0
- package/dist/backends/types.js +264 -0
- package/dist/build-info.json +5 -0
- package/dist/cli.js +344 -0
- package/dist/confine/bridge.js +113 -0
- package/dist/confine/broker-core.js +76 -0
- package/dist/confine/broker-http.js +650 -0
- package/dist/confine/broker-names.js +9 -0
- package/dist/confine/broker.js +258 -0
- package/dist/confine/canary.js +380 -0
- package/dist/confine/diagnostics.js +122 -0
- package/dist/confine/gemini-tools-main.js +8 -0
- package/dist/confine/gemini-tools.js +181 -0
- package/dist/confine/hardlinks.js +58 -0
- package/dist/confine/harness-config.js +16 -0
- package/dist/confine/index.js +117 -0
- package/dist/confine/leases.js +217 -0
- package/dist/confine/paths.js +6 -0
- package/dist/confine/peer.js +115 -0
- package/dist/confine/port-policy.js +8 -0
- package/dist/confine/ports.js +365 -0
- package/dist/confine/private-root.js +208 -0
- package/dist/confine/probe-stage2.js +501 -0
- package/dist/confine/probe.js +1109 -0
- package/dist/confine/proxy.js +783 -0
- package/dist/confine/sbcheck.js +208 -0
- package/dist/confine/seatbelt-never.js +41 -0
- package/dist/confine/seatbelt-stage2.js +139 -0
- package/dist/confine/seatbelt.js +1129 -0
- package/dist/confine/sockets.js +36 -0
- package/dist/confine/turn-probe.js +19 -0
- package/dist/confine/turn.js +86 -0
- package/dist/core/adoption.js +124 -0
- package/dist/core/api-keys.js +423 -0
- package/dist/core/approvals.js +740 -0
- package/dist/core/build-identity.js +248 -0
- package/dist/core/caller.js +749 -0
- package/dist/core/calls.js +102 -0
- package/dist/core/claude-settings.js +1045 -0
- package/dist/core/config.js +453 -0
- package/dist/core/context.js +186 -0
- package/dist/core/db.js +753 -0
- package/dist/core/dispatch.js +110 -0
- package/dist/core/env-broker.js +505 -0
- package/dist/core/env-policy.js +182 -0
- package/dist/core/escalation-authority.js +76 -0
- package/dist/core/escalation-contract.js +13 -0
- package/dist/core/escalation-person-path.js +131 -0
- package/dist/core/escalation-policy.js +79 -0
- package/dist/core/escalation-runtime.js +135 -0
- package/dist/core/escalation-state.js +42 -0
- package/dist/core/escalations.js +191 -0
- package/dist/core/events.js +235 -0
- package/dist/core/executables.js +147 -0
- package/dist/core/extensions.js +645 -0
- package/dist/core/families.js +204 -0
- package/dist/core/git.js +657 -0
- package/dist/core/identity.js +113 -0
- package/dist/core/liveness.js +68 -0
- package/dist/core/mediated-network-provider.js +81 -0
- package/dist/core/never-checkpoint.js +76 -0
- package/dist/core/never-coverage.js +97 -0
- package/dist/core/never-network.js +49 -0
- package/dist/core/never-policy.js +302 -0
- package/dist/core/never-proxy-policy.js +109 -0
- package/dist/core/never-schema.js +61 -0
- package/dist/core/never-tools.js +56 -0
- package/dist/core/notices.js +48 -0
- package/dist/core/ops.js +959 -0
- package/dist/core/outcome.js +224 -0
- package/dist/core/params.js +32 -0
- package/dist/core/presence.js +174 -0
- package/dist/core/procs.js +546 -0
- package/dist/core/prompts.js +363 -0
- package/dist/core/protected-config.js +238 -0
- package/dist/core/raw-network.js +192 -0
- package/dist/core/redact.js +152 -0
- package/dist/core/refusal.js +33 -0
- package/dist/core/relay-command.js +310 -0
- package/dist/core/reported.js +3 -0
- package/dist/core/restart-overlay.js +651 -0
- package/dist/core/retention.js +1135 -0
- package/dist/core/secrets.js +329 -0
- package/dist/core/session-token.js +175 -0
- package/dist/core/session.js +744 -0
- package/dist/core/shell.js +2 -0
- package/dist/core/shipped-pin.js +47 -0
- package/dist/core/shown.js +42 -0
- package/dist/core/slots.js +67 -0
- package/dist/core/stage2-executors.js +453 -0
- package/dist/core/stage2-switch.js +5 -0
- package/dist/core/steering.js +149 -0
- package/dist/core/storage.js +358 -0
- package/dist/core/toml.js +175 -0
- package/dist/core/views.js +324 -0
- package/dist/core/wait.js +114 -0
- package/dist/core/wake.js +207 -0
- package/dist/core/watch.js +247 -0
- package/dist/core/worktree.js +213 -0
- package/dist/hosts/claude-desktop.js +274 -0
- package/dist/hosts/claude.js +249 -0
- package/dist/hosts/codex.js +345 -0
- package/dist/hosts/desktop-shared.js +20 -0
- package/dist/hosts/index.js +11 -0
- package/dist/hosts/types.js +4 -0
- package/dist/install/basics.js +18 -0
- package/dist/install/claude-init.js +133 -0
- package/dist/install/common.js +655 -0
- package/dist/install/doctor.js +635 -0
- package/dist/install/qualify-codex.js +205 -0
- package/dist/install.js +524 -0
- package/dist/mcp/elicit.js +209 -0
- package/dist/mcp/gateway.js +218 -0
- package/dist/mcp/host.js +253 -0
- package/dist/mcp/server.js +1124 -0
- package/dist/mcp/stdio.js +37 -0
- package/dist/modes/discussion.js +393 -0
- package/dist/modes/review.js +722 -0
- package/dist/native/relay-sbcheck +0 -0
- package/dist/targets/briefs.js +86 -0
- package/dist/targets/claude.js +94 -0
- package/dist/targets/codex.js +66 -0
- package/dist/targets/copilot.js +93 -0
- package/dist/targets/gemini.js +119 -0
- package/dist/targets/grok.js +126 -0
- package/dist/targets/index.js +192 -0
- package/dist/targets/types.js +18 -0
- package/dist/targets/verified.js +35 -0
- package/dist/worker.js +113 -0
- package/docs/UPGRADING.md +1518 -0
- package/docs/pinned-codex.md +333 -0
- package/experiments/stage2-redteam/lib/oracles.mjs +214 -0
- package/experiments/stage2-redteam/lib/report.mjs +35 -0
- package/npm-shrinkwrap.json +1632 -0
- package/package.json +82 -4
- package/scripts/codex-qualify/codex-pin-store.mjs +353 -0
- package/scripts/codex-qualify/codex-qualifier-process.mjs +265 -0
- package/scripts/codex-qualify/codex-qualifier.example.json +5 -0
- package/scripts/codex-qualify/codex-qualifier.mjs +281 -0
- package/scripts/codex-qualify/codex-shipped-pin.mjs +158 -0
- package/scripts/codex-qualify/codex-stage2-pin.mjs +48 -0
- package/scripts/codex-qualify/codex-stage2.mjs +2381 -0
- package/scripts/codex-qualify/install-codex-qualifier.mjs +98 -0
- package/scripts/codex-qualify/main-module.mjs +14 -0
- package/scripts/codex-qualify/relay-codex-qualifier.plist +37 -0
- package/scripts/codex-qualify/scratch-env.mjs +31 -0
- package/scripts/codex-qualify/session.mjs +96 -0
- package/scripts/codex-qualify/stage2-escalation-cases.mjs +125 -0
- package/test/codex-permissions.test.ts +875 -0
- package/test/fixtures/boundary-probes.mjs +17 -0
- package/test/fixtures/denial-stream-host.mjs +7 -0
- package/test/fixtures/families.json +246 -0
- package/test/fixtures/install-snapshots/claude-desktop-foreign.txt +158 -0
- package/test/fixtures/install-snapshots/claude-desktop-fresh.txt +101 -0
- package/test/fixtures/install-snapshots/claude-desktop-installed.txt +161 -0
- package/test/fixtures/install-snapshots/claude-foreign.txt +133 -0
- package/test/fixtures/install-snapshots/claude-fresh.txt +77 -0
- package/test/fixtures/install-snapshots/claude-installed.txt +133 -0
- package/test/fixtures/install-snapshots/codex-foreign.txt +159 -0
- package/test/fixtures/install-snapshots/codex-fresh.txt +107 -0
- package/test/fixtures/install-snapshots/codex-installed.txt +161 -0
- package/test/fixtures/link-parent.mjs +6 -0
- package/test/fixtures/mediated-command.cjs +72 -0
- package/test/fixtures/native-skill-isolation.json +280 -0
- package/test/fixtures/pinned-codex-app-server.mjs +25 -0
- package/test/fixtures/qualified-ext-adapters.mjs +36 -0
- package/test/fixtures/refusals/README.md +52 -0
- package/test/fixtures/refusals/claude-source-result.json +7 -0
- package/test/fixtures/refusals/openai-app-capacity.json +24 -0
- package/test/fixtures/refusals/openai-app-cyberPolicy.json +24 -0
- package/test/fixtures/refusals/openai-gpt-6-astra-max.json +12 -0
- package/test/fixtures/refusals/openai-gpt-6.1-sol-xhigh.json +12 -0
- package/test/fixtures/refusals/openai-review-capacity.json +24 -0
- package/test/fixtures/relay-0.2.0.sql +57 -0
- package/test/fixtures/relay-0.9.1.gen.mjs +212 -0
- package/test/fixtures/relay-0.9.1.sql +340 -0
- package/test/fixtures/slow-boundary-probes.mjs +37 -0
- package/test/fixtures/stable-surfaces/config.json +1122 -0
- package/test/fixtures/stable-surfaces/escalation.json +128 -0
- package/test/fixtures/stable-surfaces/events.json +37 -0
- package/test/fixtures/stable-surfaces/gemini-native-resume.json +4 -0
- package/test/fixtures/stable-surfaces/inbox.jsonl +2 -0
- package/test/fixtures/stable-surfaces/notice.txt +1 -0
- package/test/fixtures/stable-surfaces/refusal-item.json +28 -0
- package/test/fixtures/stable-surfaces/refusal-review.json +23 -0
- package/test/fixtures/stable-surfaces/registry.json +49 -0
- package/test/fixtures/stable-surfaces/tools-desktop.json +575 -0
- package/test/fixtures/stable-surfaces/tools.json +716 -0
- package/test/fixtures/stable-surfaces/usage.txt +46 -0
- package/test/fixtures/stage2-acp-native.mjs +138 -0
- package/test/fixtures/stage2-app-server.mjs +23 -0
- package/test/fixtures/stage2-catalog.json +91 -0
- package/test/fixtures/stage2-hostile-web.mjs +35 -0
- package/test/fixtures/stage2-native-network.mjs +62 -0
- package/test/fixtures/stage2-worker.ts +87 -0
- package/test/fixtures/status-views/expected.json +7825 -0
- package/test/fixtures/status-views/registries.json +1 -0
- package/test/fixtures/steering.json +209 -0
- package/test/helpers.ts +740 -0
- package/test/host-env.ts +7 -0
- package/test/keychain-decoy.ts +197 -0
- package/test/live-scope.ts +44 -0
- package/test/mediated-network.test.ts +192 -0
- package/test/mediated-proxy.test.ts +264 -0
- package/test/native-temp-alias.ts +10 -0
- package/test/never-policy.test.ts +629 -0
- package/test/never-tools.test.ts +136 -0
- package/test/process-home.ts +18 -0
- package/test/proxy.test.ts +531 -0
- package/test/restart-overlay-live.test.ts +85 -0
- package/test/restart-overlay-profile.test.ts +66 -0
- package/test/restart-overlay.test.ts +416 -0
- package/test/stable-surfaces.test.ts +249 -0
- package/test/stage2-escalation-live.test.ts +544 -0
- package/test/stage2-escalation-qualification.test.ts +170 -0
- package/test/stage2-escalation.test.ts +747 -0
- package/test/stage2-executor.test.ts +849 -0
- package/test/stage2-grant.test.ts +603 -0
- package/test/stage2-native-live.test.ts +647 -0
- package/test/stage2-network-decisions.test.ts +70 -0
- package/test/stage2-probe.test.ts +845 -0
- package/test/stage2-standing-live.test.ts +203 -0
- package/test/stubs/broker-host.mjs +59 -0
- package/test/stubs/broker-peer.mjs +20 -0
- package/test/stubs/confined-harness.mjs +91 -0
- package/test/stubs/ext-broken-server.mjs +2 -0
- package/test/stubs/ext-odd-server.mjs +21 -0
- package/test/stubs/ext-server.mjs +31 -0
- package/test/stubs/fake-host-cli.mjs +218 -0
- package/test/stubs/procargs.mjs +30 -0
- package/test/stubs/stub-acp +4 -0
- package/test/stubs/stub-agent.mjs +322 -0
- package/test/stubs/stub-claude +4 -0
- package/test/stubs/stub-codex +4 -0
- package/test/stubs/targets/acp.mjs +307 -0
- package/test/stubs/targets/claude.mjs +149 -0
- package/test/stubs/targets/codex.mjs +479 -0
- package/test/stubs/targets/gemini.mjs +604 -0
- package/test/temp-root.ts +11 -0
- package/test/wp4-adapters.test.ts +353 -0
- package/test/wp4-interlock.test.ts +136 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
$ relay install codex
|
|
2
|
+
exit status 1
|
|
3
|
+
--- stdout
|
|
4
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
5
|
+
[mcp_servers.relay]
|
|
6
|
+
command = "<ROOT>/bin/relay"
|
|
7
|
+
args = ["mcp", "--host", "codex"]
|
|
8
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
9
|
+
tool_timeout_sec = 11400
|
|
10
|
+
startup_timeout_sec = 30
|
|
11
|
+
default_tools_approval_mode = "approve"
|
|
12
|
+
|
|
13
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
14
|
+
[mcp_servers.relay.tools.approve]
|
|
15
|
+
approval_mode = "prompt"
|
|
16
|
+
|
|
17
|
+
--- stderr
|
|
18
|
+
|
|
19
|
+
relay install codex: [mcp_servers.relay] in <TMP>/home/.codex/config.toml is not relay's (its command is foreign-server), so relay will not replace it. If it should go, run this again with --force: what is there now is saved first.
|
|
20
|
+
|
|
21
|
+
Nothing was changed (this was a dry run, and with --write it would have stopped here too).
|
|
22
|
+
|
|
23
|
+
$ relay install codex --force
|
|
24
|
+
exit status 0
|
|
25
|
+
--- stdout
|
|
26
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
27
|
+
[mcp_servers.relay]
|
|
28
|
+
command = "<ROOT>/bin/relay"
|
|
29
|
+
args = ["mcp", "--host", "codex"]
|
|
30
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
31
|
+
tool_timeout_sec = 11400
|
|
32
|
+
startup_timeout_sec = 30
|
|
33
|
+
default_tools_approval_mode = "approve"
|
|
34
|
+
|
|
35
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
36
|
+
[mcp_servers.relay.tools.approve]
|
|
37
|
+
approval_mode = "prompt"
|
|
38
|
+
|
|
39
|
+
# replace relay's block in <TMP>/home/.codex/config.toml
|
|
40
|
+
$ codex plugin marketplace add <ROOT>/adapters/codex
|
|
41
|
+
$ codex plugin add relay@relay-local
|
|
42
|
+
$ ln -s <ROOT>/bin/relay <TMP>/home/.local/bin/relay
|
|
43
|
+
|
|
44
|
+
Nothing was changed. Re-run with --write to apply.
|
|
45
|
+
# this relay ships no Codex pin: after installing, run relay qualify-codex once
|
|
46
|
+
# with --write, it would also make relay's Codex home, <TMP>/home/.local/share/relay-codex-home, for the one-time codex login there
|
|
47
|
+
--- stderr
|
|
48
|
+
|
|
49
|
+
$ relay uninstall codex
|
|
50
|
+
exit status 0
|
|
51
|
+
--- stdout
|
|
52
|
+
# no installation record for Codex; going by what is installed
|
|
53
|
+
# left alone: [mcp_servers.relay] in <TMP>/home/.codex/config.toml is not relay's (its command is foreign-server). --force removes it.
|
|
54
|
+
|
|
55
|
+
Nothing to do: nothing of relay's was found in Codex.
|
|
56
|
+
|
|
57
|
+
Not removed, because it can hold your work or your logins:
|
|
58
|
+
<TMP>/home/.local/state/relay (not present)
|
|
59
|
+
relay's state: the registry of runs, logs, the prompts sent and the transcripts
|
|
60
|
+
<TMP>/home/.local/share/relay/worktrees (not present)
|
|
61
|
+
the worktrees of write jobs
|
|
62
|
+
<TMP>/home/.local/share/relay/consult (not present)
|
|
63
|
+
the directories questions without a project were asked in
|
|
64
|
+
<TMP>/home/.local/share/relay/harness (not present)
|
|
65
|
+
the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)
|
|
66
|
+
<TMP>/home/.config/relay (not present)
|
|
67
|
+
your relay configuration, its local settings (local.json), the installation record and what install saved
|
|
68
|
+
<TMP>/home/.local/share/relay-codex-home (not present) [holds a login (auth.json)]
|
|
69
|
+
relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions
|
|
70
|
+
<TMP>/home/.local/share/relay-codex-pins (not present)
|
|
71
|
+
relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results
|
|
72
|
+
<TMP>/home/.config/relay-keys (not present) [holds API keys]
|
|
73
|
+
the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete
|
|
74
|
+
<TMP>/home/.relay-t (not present)
|
|
75
|
+
relay's private sockets and per-turn state
|
|
76
|
+
<TMP>/home/.rn (not present)
|
|
77
|
+
the short temp directories relay gives Claude's turns
|
|
78
|
+
<TMP>/home/.rsm/q (not present)
|
|
79
|
+
the Codex qualifier's scratch runs
|
|
80
|
+
in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches
|
|
81
|
+
|
|
82
|
+
To remove them by hand, in this order:
|
|
83
|
+
1. <ROOT>/bin/relay clean
|
|
84
|
+
First, while the state directory is still there. It commits work left in finished jobs' worktrees to
|
|
85
|
+
their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists
|
|
86
|
+
the unmerged branches it kept, so no work is lost.
|
|
87
|
+
2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,
|
|
88
|
+
delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.
|
|
89
|
+
3. Stop the Codex qualifier's LaunchAgent, if you installed it:
|
|
90
|
+
# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and <TMP>/home/Library/Logs/relay-codex-qualifier
|
|
91
|
+
4. Then the rest, after checking each: the ones marked above hold credentials.
|
|
92
|
+
rm -rf <TMP>/home/.local/state/relay
|
|
93
|
+
rm -rf <TMP>/home/.local/share/relay/worktrees
|
|
94
|
+
rm -rf <TMP>/home/.local/share/relay/consult
|
|
95
|
+
rm -rf <TMP>/home/.local/share/relay/harness
|
|
96
|
+
rm -rf <TMP>/home/.config/relay
|
|
97
|
+
rm -rf <TMP>/home/.local/share/relay-codex-home
|
|
98
|
+
chmod -R u+w <TMP>/home/.local/share/relay-codex-pins && rm -rf <TMP>/home/.local/share/relay-codex-pins
|
|
99
|
+
rm -rf <TMP>/home/.config/relay-keys
|
|
100
|
+
rm -rf <TMP>/home/.relay-t
|
|
101
|
+
rm -rf <TMP>/home/.rn
|
|
102
|
+
chmod -R u+w <TMP>/home/.rsm/q && rm -rf <TMP>/home/.rsm/q
|
|
103
|
+
--- stderr
|
|
104
|
+
|
|
105
|
+
$ relay uninstall codex --force
|
|
106
|
+
exit status 0
|
|
107
|
+
--- stdout
|
|
108
|
+
# no installation record for Codex; going by what is installed
|
|
109
|
+
# remove relay's [mcp_servers.relay] tables from <TMP>/home/.codex/config.toml
|
|
110
|
+
|
|
111
|
+
Nothing was changed. Re-run with --write to apply.
|
|
112
|
+
|
|
113
|
+
Not removed, because it can hold your work or your logins:
|
|
114
|
+
<TMP>/home/.local/state/relay (not present)
|
|
115
|
+
relay's state: the registry of runs, logs, the prompts sent and the transcripts
|
|
116
|
+
<TMP>/home/.local/share/relay/worktrees (not present)
|
|
117
|
+
the worktrees of write jobs
|
|
118
|
+
<TMP>/home/.local/share/relay/consult (not present)
|
|
119
|
+
the directories questions without a project were asked in
|
|
120
|
+
<TMP>/home/.local/share/relay/harness (not present)
|
|
121
|
+
the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)
|
|
122
|
+
<TMP>/home/.config/relay (not present)
|
|
123
|
+
your relay configuration, its local settings (local.json), the installation record and what install saved
|
|
124
|
+
<TMP>/home/.local/share/relay-codex-home (not present) [holds a login (auth.json)]
|
|
125
|
+
relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions
|
|
126
|
+
<TMP>/home/.local/share/relay-codex-pins (not present)
|
|
127
|
+
relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results
|
|
128
|
+
<TMP>/home/.config/relay-keys (not present) [holds API keys]
|
|
129
|
+
the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete
|
|
130
|
+
<TMP>/home/.relay-t (not present)
|
|
131
|
+
relay's private sockets and per-turn state
|
|
132
|
+
<TMP>/home/.rn (not present)
|
|
133
|
+
the short temp directories relay gives Claude's turns
|
|
134
|
+
<TMP>/home/.rsm/q (not present)
|
|
135
|
+
the Codex qualifier's scratch runs
|
|
136
|
+
in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches
|
|
137
|
+
|
|
138
|
+
To remove them by hand, in this order:
|
|
139
|
+
1. <ROOT>/bin/relay clean
|
|
140
|
+
First, while the state directory is still there. It commits work left in finished jobs' worktrees to
|
|
141
|
+
their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists
|
|
142
|
+
the unmerged branches it kept, so no work is lost.
|
|
143
|
+
2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,
|
|
144
|
+
delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.
|
|
145
|
+
3. Stop the Codex qualifier's LaunchAgent, if you installed it:
|
|
146
|
+
# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and <TMP>/home/Library/Logs/relay-codex-qualifier
|
|
147
|
+
4. Then the rest, after checking each: the ones marked above hold credentials.
|
|
148
|
+
rm -rf <TMP>/home/.local/state/relay
|
|
149
|
+
rm -rf <TMP>/home/.local/share/relay/worktrees
|
|
150
|
+
rm -rf <TMP>/home/.local/share/relay/consult
|
|
151
|
+
rm -rf <TMP>/home/.local/share/relay/harness
|
|
152
|
+
rm -rf <TMP>/home/.config/relay
|
|
153
|
+
rm -rf <TMP>/home/.local/share/relay-codex-home
|
|
154
|
+
chmod -R u+w <TMP>/home/.local/share/relay-codex-pins && rm -rf <TMP>/home/.local/share/relay-codex-pins
|
|
155
|
+
rm -rf <TMP>/home/.config/relay-keys
|
|
156
|
+
rm -rf <TMP>/home/.relay-t
|
|
157
|
+
rm -rf <TMP>/home/.rn
|
|
158
|
+
chmod -R u+w <TMP>/home/.rsm/q && rm -rf <TMP>/home/.rsm/q
|
|
159
|
+
--- stderr
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
$ relay install codex
|
|
2
|
+
exit status 0
|
|
3
|
+
--- stdout
|
|
4
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
5
|
+
[mcp_servers.relay]
|
|
6
|
+
command = "<ROOT>/bin/relay"
|
|
7
|
+
args = ["mcp", "--host", "codex"]
|
|
8
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
9
|
+
tool_timeout_sec = 11400
|
|
10
|
+
startup_timeout_sec = 30
|
|
11
|
+
default_tools_approval_mode = "approve"
|
|
12
|
+
|
|
13
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
14
|
+
[mcp_servers.relay.tools.approve]
|
|
15
|
+
approval_mode = "prompt"
|
|
16
|
+
|
|
17
|
+
# add the block to <TMP>/home/.codex/config.toml
|
|
18
|
+
$ codex plugin marketplace add <ROOT>/adapters/codex
|
|
19
|
+
$ codex plugin add relay@relay-local
|
|
20
|
+
$ ln -s <ROOT>/bin/relay <TMP>/home/.local/bin/relay
|
|
21
|
+
|
|
22
|
+
Nothing was changed. Re-run with --write to apply.
|
|
23
|
+
# this relay ships no Codex pin: after installing, run relay qualify-codex once
|
|
24
|
+
# with --write, it would also make relay's Codex home, <TMP>/home/.local/share/relay-codex-home, for the one-time codex login there
|
|
25
|
+
--- stderr
|
|
26
|
+
|
|
27
|
+
$ relay install codex --force
|
|
28
|
+
exit status 0
|
|
29
|
+
--- stdout
|
|
30
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
31
|
+
[mcp_servers.relay]
|
|
32
|
+
command = "<ROOT>/bin/relay"
|
|
33
|
+
args = ["mcp", "--host", "codex"]
|
|
34
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
35
|
+
tool_timeout_sec = 11400
|
|
36
|
+
startup_timeout_sec = 30
|
|
37
|
+
default_tools_approval_mode = "approve"
|
|
38
|
+
|
|
39
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
40
|
+
[mcp_servers.relay.tools.approve]
|
|
41
|
+
approval_mode = "prompt"
|
|
42
|
+
|
|
43
|
+
# add the block to <TMP>/home/.codex/config.toml
|
|
44
|
+
$ codex plugin marketplace add <ROOT>/adapters/codex
|
|
45
|
+
$ codex plugin add relay@relay-local
|
|
46
|
+
$ ln -s <ROOT>/bin/relay <TMP>/home/.local/bin/relay
|
|
47
|
+
|
|
48
|
+
Nothing was changed. Re-run with --write to apply.
|
|
49
|
+
# this relay ships no Codex pin: after installing, run relay qualify-codex once
|
|
50
|
+
# with --write, it would also make relay's Codex home, <TMP>/home/.local/share/relay-codex-home, for the one-time codex login there
|
|
51
|
+
--- stderr
|
|
52
|
+
|
|
53
|
+
$ relay uninstall codex
|
|
54
|
+
exit status 0
|
|
55
|
+
--- stdout
|
|
56
|
+
# no installation record for Codex; going by what is installed
|
|
57
|
+
# <TMP>/home/.codex/config.toml has no [mcp_servers.relay]
|
|
58
|
+
|
|
59
|
+
Nothing to do: nothing of relay's was found in Codex.
|
|
60
|
+
|
|
61
|
+
Not removed, because it can hold your work or your logins:
|
|
62
|
+
<TMP>/home/.local/state/relay (not present)
|
|
63
|
+
relay's state: the registry of runs, logs, the prompts sent and the transcripts
|
|
64
|
+
<TMP>/home/.local/share/relay/worktrees (not present)
|
|
65
|
+
the worktrees of write jobs
|
|
66
|
+
<TMP>/home/.local/share/relay/consult (not present)
|
|
67
|
+
the directories questions without a project were asked in
|
|
68
|
+
<TMP>/home/.local/share/relay/harness (not present)
|
|
69
|
+
the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)
|
|
70
|
+
<TMP>/home/.config/relay (not present)
|
|
71
|
+
your relay configuration, its local settings (local.json), the installation record and what install saved
|
|
72
|
+
<TMP>/home/.local/share/relay-codex-home (not present) [holds a login (auth.json)]
|
|
73
|
+
relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions
|
|
74
|
+
<TMP>/home/.local/share/relay-codex-pins (not present)
|
|
75
|
+
relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results
|
|
76
|
+
<TMP>/home/.config/relay-keys (not present) [holds API keys]
|
|
77
|
+
the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete
|
|
78
|
+
<TMP>/home/.relay-t (not present)
|
|
79
|
+
relay's private sockets and per-turn state
|
|
80
|
+
<TMP>/home/.rn (not present)
|
|
81
|
+
the short temp directories relay gives Claude's turns
|
|
82
|
+
<TMP>/home/.rsm/q (not present)
|
|
83
|
+
the Codex qualifier's scratch runs
|
|
84
|
+
in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches
|
|
85
|
+
|
|
86
|
+
To remove them by hand, in this order:
|
|
87
|
+
1. <ROOT>/bin/relay clean
|
|
88
|
+
First, while the state directory is still there. It commits work left in finished jobs' worktrees to
|
|
89
|
+
their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists
|
|
90
|
+
the unmerged branches it kept, so no work is lost.
|
|
91
|
+
2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,
|
|
92
|
+
delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.
|
|
93
|
+
3. Stop the Codex qualifier's LaunchAgent, if you installed it:
|
|
94
|
+
# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and <TMP>/home/Library/Logs/relay-codex-qualifier
|
|
95
|
+
4. Then the rest, after checking each: the ones marked above hold credentials.
|
|
96
|
+
rm -rf <TMP>/home/.local/state/relay
|
|
97
|
+
rm -rf <TMP>/home/.local/share/relay/worktrees
|
|
98
|
+
rm -rf <TMP>/home/.local/share/relay/consult
|
|
99
|
+
rm -rf <TMP>/home/.local/share/relay/harness
|
|
100
|
+
rm -rf <TMP>/home/.config/relay
|
|
101
|
+
rm -rf <TMP>/home/.local/share/relay-codex-home
|
|
102
|
+
chmod -R u+w <TMP>/home/.local/share/relay-codex-pins && rm -rf <TMP>/home/.local/share/relay-codex-pins
|
|
103
|
+
rm -rf <TMP>/home/.config/relay-keys
|
|
104
|
+
rm -rf <TMP>/home/.relay-t
|
|
105
|
+
rm -rf <TMP>/home/.rn
|
|
106
|
+
chmod -R u+w <TMP>/home/.rsm/q && rm -rf <TMP>/home/.rsm/q
|
|
107
|
+
--- stderr
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
$ relay install codex
|
|
2
|
+
exit status 0
|
|
3
|
+
--- stdout
|
|
4
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
5
|
+
[mcp_servers.relay]
|
|
6
|
+
command = "<ROOT>/bin/relay"
|
|
7
|
+
args = ["mcp", "--host", "codex"]
|
|
8
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
9
|
+
tool_timeout_sec = 11400
|
|
10
|
+
startup_timeout_sec = 30
|
|
11
|
+
default_tools_approval_mode = "approve"
|
|
12
|
+
|
|
13
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
14
|
+
[mcp_servers.relay.tools.approve]
|
|
15
|
+
approval_mode = "prompt"
|
|
16
|
+
|
|
17
|
+
# <TMP>/home/.codex/config.toml already has relay's block for this checkout
|
|
18
|
+
|
|
19
|
+
Nothing to do: relay is already installed for Codex from this checkout.
|
|
20
|
+
# this relay ships no Codex pin: after installing, run relay qualify-codex once
|
|
21
|
+
--- stderr
|
|
22
|
+
|
|
23
|
+
$ relay install codex --force
|
|
24
|
+
exit status 0
|
|
25
|
+
--- stdout
|
|
26
|
+
# relay's block in <TMP>/home/.codex/config.toml:
|
|
27
|
+
[mcp_servers.relay]
|
|
28
|
+
command = "<ROOT>/bin/relay"
|
|
29
|
+
args = ["mcp", "--host", "codex"]
|
|
30
|
+
env_vars = ["CODEX_HOME","CODEX_INTERNAL_ORIGINATOR_OVERRIDE"]
|
|
31
|
+
tool_timeout_sec = 11400
|
|
32
|
+
startup_timeout_sec = 30
|
|
33
|
+
default_tools_approval_mode = "approve"
|
|
34
|
+
|
|
35
|
+
# Deciding a launched agent's approval request is the one relay call Codex should confirm with you.
|
|
36
|
+
[mcp_servers.relay.tools.approve]
|
|
37
|
+
approval_mode = "prompt"
|
|
38
|
+
|
|
39
|
+
# <TMP>/home/.codex/config.toml already has relay's block for this checkout
|
|
40
|
+
|
|
41
|
+
Nothing to do: relay is already installed for Codex from this checkout.
|
|
42
|
+
# this relay ships no Codex pin: after installing, run relay qualify-codex once
|
|
43
|
+
--- stderr
|
|
44
|
+
|
|
45
|
+
$ relay uninstall codex
|
|
46
|
+
exit status 0
|
|
47
|
+
--- stdout
|
|
48
|
+
# installed <DATE> from <ROOT>/bin/relay, according to <TMP>/home/.config/relay/install.json
|
|
49
|
+
# remove relay's [mcp_servers.relay] tables from <TMP>/home/.codex/config.toml
|
|
50
|
+
$ codex plugin remove relay@relay-local
|
|
51
|
+
$ codex plugin marketplace remove relay-local
|
|
52
|
+
$ rm <TMP>/home/.local/bin/relay
|
|
53
|
+
|
|
54
|
+
Nothing was changed. Re-run with --write to apply.
|
|
55
|
+
|
|
56
|
+
Not removed, because it can hold your work or your logins:
|
|
57
|
+
<TMP>/home/.local/state/relay (not present)
|
|
58
|
+
relay's state: the registry of runs, logs, the prompts sent and the transcripts
|
|
59
|
+
<TMP>/home/.local/share/relay/worktrees (not present)
|
|
60
|
+
the worktrees of write jobs
|
|
61
|
+
<TMP>/home/.local/share/relay/consult (not present)
|
|
62
|
+
the directories questions without a project were asked in
|
|
63
|
+
<TMP>/home/.local/share/relay/harness (not present)
|
|
64
|
+
the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)
|
|
65
|
+
<TMP>/home/.config/relay
|
|
66
|
+
your relay configuration, its local settings (local.json), the installation record and what install saved
|
|
67
|
+
<TMP>/home/.local/share/relay-codex-home [holds a login (auth.json)]
|
|
68
|
+
relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions
|
|
69
|
+
<TMP>/home/.local/share/relay-codex-pins (not present)
|
|
70
|
+
relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results
|
|
71
|
+
<TMP>/home/.config/relay-keys (not present) [holds API keys]
|
|
72
|
+
the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete
|
|
73
|
+
<TMP>/home/.relay-t (not present)
|
|
74
|
+
relay's private sockets and per-turn state
|
|
75
|
+
<TMP>/home/.rn (not present)
|
|
76
|
+
the short temp directories relay gives Claude's turns
|
|
77
|
+
<TMP>/home/.rsm/q (not present)
|
|
78
|
+
the Codex qualifier's scratch runs
|
|
79
|
+
in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches
|
|
80
|
+
|
|
81
|
+
To remove them by hand, in this order:
|
|
82
|
+
1. <ROOT>/bin/relay clean
|
|
83
|
+
First, while the state directory is still there. It commits work left in finished jobs' worktrees to
|
|
84
|
+
their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists
|
|
85
|
+
the unmerged branches it kept, so no work is lost.
|
|
86
|
+
2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,
|
|
87
|
+
delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.
|
|
88
|
+
3. Stop the Codex qualifier's LaunchAgent, if you installed it:
|
|
89
|
+
# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and <TMP>/home/Library/Logs/relay-codex-qualifier
|
|
90
|
+
4. Then the rest, after checking each: the ones marked above hold credentials.
|
|
91
|
+
rm -rf <TMP>/home/.local/state/relay
|
|
92
|
+
rm -rf <TMP>/home/.local/share/relay/worktrees
|
|
93
|
+
rm -rf <TMP>/home/.local/share/relay/consult
|
|
94
|
+
rm -rf <TMP>/home/.local/share/relay/harness
|
|
95
|
+
rm -rf <TMP>/home/.config/relay
|
|
96
|
+
rm -rf <TMP>/home/.local/share/relay-codex-home
|
|
97
|
+
chmod -R u+w <TMP>/home/.local/share/relay-codex-pins && rm -rf <TMP>/home/.local/share/relay-codex-pins
|
|
98
|
+
rm -rf <TMP>/home/.config/relay-keys
|
|
99
|
+
rm -rf <TMP>/home/.relay-t
|
|
100
|
+
rm -rf <TMP>/home/.rn
|
|
101
|
+
chmod -R u+w <TMP>/home/.rsm/q && rm -rf <TMP>/home/.rsm/q
|
|
102
|
+
--- stderr
|
|
103
|
+
|
|
104
|
+
$ relay uninstall codex --force
|
|
105
|
+
exit status 0
|
|
106
|
+
--- stdout
|
|
107
|
+
# installed <DATE> from <ROOT>/bin/relay, according to <TMP>/home/.config/relay/install.json
|
|
108
|
+
# remove relay's [mcp_servers.relay] tables from <TMP>/home/.codex/config.toml
|
|
109
|
+
$ codex plugin remove relay@relay-local
|
|
110
|
+
$ codex plugin marketplace remove relay-local
|
|
111
|
+
$ rm <TMP>/home/.local/bin/relay
|
|
112
|
+
|
|
113
|
+
Nothing was changed. Re-run with --write to apply.
|
|
114
|
+
|
|
115
|
+
Not removed, because it can hold your work or your logins:
|
|
116
|
+
<TMP>/home/.local/state/relay (not present)
|
|
117
|
+
relay's state: the registry of runs, logs, the prompts sent and the transcripts
|
|
118
|
+
<TMP>/home/.local/share/relay/worktrees (not present)
|
|
119
|
+
the worktrees of write jobs
|
|
120
|
+
<TMP>/home/.local/share/relay/consult (not present)
|
|
121
|
+
the directories questions without a project were asked in
|
|
122
|
+
<TMP>/home/.local/share/relay/harness (not present)
|
|
123
|
+
the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)
|
|
124
|
+
<TMP>/home/.config/relay
|
|
125
|
+
your relay configuration, its local settings (local.json), the installation record and what install saved
|
|
126
|
+
<TMP>/home/.local/share/relay-codex-home [holds a login (auth.json)]
|
|
127
|
+
relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions
|
|
128
|
+
<TMP>/home/.local/share/relay-codex-pins (not present)
|
|
129
|
+
relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results
|
|
130
|
+
<TMP>/home/.config/relay-keys (not present) [holds API keys]
|
|
131
|
+
the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete
|
|
132
|
+
<TMP>/home/.relay-t (not present)
|
|
133
|
+
relay's private sockets and per-turn state
|
|
134
|
+
<TMP>/home/.rn (not present)
|
|
135
|
+
the short temp directories relay gives Claude's turns
|
|
136
|
+
<TMP>/home/.rsm/q (not present)
|
|
137
|
+
the Codex qualifier's scratch runs
|
|
138
|
+
in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches
|
|
139
|
+
|
|
140
|
+
To remove them by hand, in this order:
|
|
141
|
+
1. <ROOT>/bin/relay clean
|
|
142
|
+
First, while the state directory is still there. It commits work left in finished jobs' worktrees to
|
|
143
|
+
their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists
|
|
144
|
+
the unmerged branches it kept, so no work is lost.
|
|
145
|
+
2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,
|
|
146
|
+
delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.
|
|
147
|
+
3. Stop the Codex qualifier's LaunchAgent, if you installed it:
|
|
148
|
+
# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and <TMP>/home/Library/Logs/relay-codex-qualifier
|
|
149
|
+
4. Then the rest, after checking each: the ones marked above hold credentials.
|
|
150
|
+
rm -rf <TMP>/home/.local/state/relay
|
|
151
|
+
rm -rf <TMP>/home/.local/share/relay/worktrees
|
|
152
|
+
rm -rf <TMP>/home/.local/share/relay/consult
|
|
153
|
+
rm -rf <TMP>/home/.local/share/relay/harness
|
|
154
|
+
rm -rf <TMP>/home/.config/relay
|
|
155
|
+
rm -rf <TMP>/home/.local/share/relay-codex-home
|
|
156
|
+
chmod -R u+w <TMP>/home/.local/share/relay-codex-pins && rm -rf <TMP>/home/.local/share/relay-codex-pins
|
|
157
|
+
rm -rf <TMP>/home/.config/relay-keys
|
|
158
|
+
rm -rf <TMP>/home/.relay-t
|
|
159
|
+
rm -rf <TMP>/home/.rn
|
|
160
|
+
chmod -R u+w <TMP>/home/.rsm/q && rm -rf <TMP>/home/.rsm/q
|
|
161
|
+
--- stderr
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Test-only preload (node --import, through NODE_OPTIONS in a test harness's environment): puts the
|
|
2
|
+
// short link to ~/.rn in the test's own scratch directory (STUB_LINK_PARENT) instead of
|
|
3
|
+
// /Users/Shared. Production relay never loads this file.
|
|
4
|
+
import { setNativeTempAliasParentForTests } from "../../dist/confine/private-root.js";
|
|
5
|
+
|
|
6
|
+
if (process.env.STUB_LINK_PARENT) setNativeTempAliasParentForTests(process.env.STUB_LINK_PARENT);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Executed only inside the actual Codex turn, with owned endpoints supplied by the host fixture.
|
|
2
|
+
const net = require('node:net'), dgram = require('node:dgram'), http = require('node:http');
|
|
3
|
+
const fs = require('node:fs'), cp = require('node:child_process');
|
|
4
|
+
const proxy = new URL(process.env.HTTP_PROXY);
|
|
5
|
+
const endpoint = Number(process.argv[2]);
|
|
6
|
+
const mode = process.argv[3];
|
|
7
|
+
const marker = process.argv[4];
|
|
8
|
+
const connect = (authority) => new Promise((ok, fail) => {
|
|
9
|
+
const s = net.connect(Number(proxy.port), proxy.hostname); let data = '';
|
|
10
|
+
s.setTimeout(5000, () => s.destroy(new Error('proxy timed out')));
|
|
11
|
+
s.on('error', fail);
|
|
12
|
+
s.once('connect', () => s.write(`CONNECT ${authority} HTTP/1.1\r\nHost: ${authority}\r\n\r\n`));
|
|
13
|
+
const read = b => { data += b; if (!data.includes('\r\n\r\n')) return; s.off('data', read); s.setTimeout(0); ok({ s, status: Number(data.split(' ')[1]) }); };
|
|
14
|
+
s.on('data', read);
|
|
15
|
+
});
|
|
16
|
+
async function main() {
|
|
17
|
+
if (mode === 'standing') {
|
|
18
|
+
for (const key of ['HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'http_proxy', 'https_proxy', 'all_proxy']) {
|
|
19
|
+
if (process.env[key] !== proxy.href.replace(/\/$/, '')) throw new Error('missing or inconsistent proxy variable: ' + key);
|
|
20
|
+
}
|
|
21
|
+
if (process.env.NO_PROXY !== '' || process.env.no_proxy !== '') throw new Error('proxy bypass variables must be empty');
|
|
22
|
+
for (const host of ['forbidden.test', 'forbidden-alias.test', '9.9.9.9']) {
|
|
23
|
+
const denied = await connect(host + ':80'); denied.s.destroy();
|
|
24
|
+
if (denied.status !== 403) throw new Error('never host allowed: ' + host);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (mode === 'hold') {
|
|
28
|
+
const { s, status } = await connect('owned-upstream.test:80');
|
|
29
|
+
if (status !== 200) throw new Error('hold CONNECT refused');
|
|
30
|
+
s.write('GET /mediated-hold HTTP/1.1\r\nHost: owned-upstream.test\r\n\r\n');
|
|
31
|
+
fs.writeFileSync(marker, String(proxy.port));
|
|
32
|
+
return; // Deliberately live until production executor/provider teardown.
|
|
33
|
+
}
|
|
34
|
+
if (mode === 'public') {
|
|
35
|
+
const { s, status } = await connect('example.com:443');
|
|
36
|
+
if (status !== 200) throw new Error('public CONNECT refused');
|
|
37
|
+
const tls = require('node:tls').connect({ socket: s, servername: 'example.com' });
|
|
38
|
+
tls.setTimeout(15000, () => tls.destroy(new Error('public TLS timed out')));
|
|
39
|
+
await new Promise((ok, fail) => { tls.once('secureConnect', ok); tls.once('error', fail); });
|
|
40
|
+
const response = await new Promise((ok, fail) => {
|
|
41
|
+
let data = ''; tls.on('data', b => data += b); tls.once('error', fail); tls.once('end', () => ok(data));
|
|
42
|
+
tls.write('GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n');
|
|
43
|
+
});
|
|
44
|
+
if (!/^HTTP\/1\.[01] 200/.test(response)) throw new Error('public HTTP failed');
|
|
45
|
+
console.log('MEDIATED_PUBLIC_OK:' + proxy.port); return;
|
|
46
|
+
}
|
|
47
|
+
const direct = await new Promise(ok => {
|
|
48
|
+
const s = net.connect(endpoint, '127.0.0.1');
|
|
49
|
+
s.once('connect', () => { s.destroy(); ok('UNEXPECTED_CONNECT'); });
|
|
50
|
+
s.once('error', e => ok(e.code)); s.setTimeout(2000, () => { s.destroy(); ok('TIMEOUT'); });
|
|
51
|
+
});
|
|
52
|
+
const udp = await new Promise(ok => {
|
|
53
|
+
const s = dgram.createSocket('udp4');
|
|
54
|
+
let finished = false; const finish = code => { if (!finished) { finished = true; try { s.close(); } catch {} ok(code); } };
|
|
55
|
+
s.once('error', e => finish(e.code));
|
|
56
|
+
// A real DNS question to an owned UDP sink, never to a host resolver.
|
|
57
|
+
s.send(Buffer.from('123401000001000000000000076578616d706c6503636f6d0000010001', 'hex'), endpoint, '127.0.0.1', e => finish(e?.code ?? 'UNEXPECTED_SEND'));
|
|
58
|
+
});
|
|
59
|
+
const forbidden = await connect('owned-upstream.test:49444'); forbidden.s.destroy();
|
|
60
|
+
const local = await connect('127.0.0.1:' + endpoint); local.s.destroy();
|
|
61
|
+
const body = await new Promise((ok, fail) => {
|
|
62
|
+
const req = http.get({ host: proxy.hostname, port: proxy.port, path: 'http://owned-upstream.test/mediated-upstream', headers: { Host: 'owned-upstream.test' } }, res => {
|
|
63
|
+
let data = ''; res.on('data', b => data += b); res.on('end', () => ok(data));
|
|
64
|
+
}); req.on('error', fail);
|
|
65
|
+
});
|
|
66
|
+
if (direct !== 'EPERM' || udp !== 'EPERM' || forbidden.status !== 403 || local.status !== 403 || body !== 'MEDIATED_UPSTREAM_OK') throw new Error(JSON.stringify({ direct, udp, forbidden: forbidden.status, local: local.status, body }));
|
|
67
|
+
const child = cp.spawn(process.execPath, [__filename, String(endpoint), 'hold', marker], { stdio: 'ignore' }); child.unref();
|
|
68
|
+
for (let n = 0; !fs.existsSync(marker) && n < 100; n++) await new Promise(r => setTimeout(r, 50));
|
|
69
|
+
if (!fs.existsSync(marker)) throw new Error('live tunnel did not start');
|
|
70
|
+
console.log('MEDIATED_RESULT:' + JSON.stringify({ direct, udp, forbidden: forbidden.status, local: local.status, body, port: Number(proxy.port), held: true }));
|
|
71
|
+
}
|
|
72
|
+
main().catch(e => { console.error(e); process.exitCode = 1; });
|