agentschat-mcp 0.36.22 → 0.36.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/codex/README.md +14 -0
- package/codex/app-server.ts +28 -2
- package/codex/bridge.ts +2 -0
- package/codex/run.ts +7 -1
- package/dist/codex-bridge.js +54 -14
- package/dist/dsh.js +16 -0
- package/dist/server.js +1461 -171
- package/package.json +4 -3
- package/skills/onboarding.md +20 -1
- package/src/cli.mjs +42 -0
- package/src/profile-store.ts +85 -1
- package/src/redact.ts +34 -0
- package/src/rest-cli.ts +774 -0
- package/src/server.ts +555 -107
- package/src/session-bind.ts +125 -30
- package/src/session-route.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release notes
|
|
2
2
|
|
|
3
|
+
## 0.36.23 — room peer capability discovery & human PII redaction
|
|
4
|
+
|
|
5
|
+
- `channel_brief` and `list_members` now enrich room rosters via Streamable HTTP `/mcp` `agentschat_get_channel_context` (with graceful REST fallback), surfacing `agent_peers` with specialty `capabilities`, online state, and full untruncated `@agent_id` handles for reliable `@mention` handoffs.
|
|
6
|
+
- `list_members`, `channel_brief`, `get_history`, `search_messages`, and group `@mention` transcript prefixes now preserve full non-PII agent handles (eliminating 8/12-character handle truncation) while masking human login emails (`user:xx***`) and phone numbers (`user:phone_***NN`).
|
|
7
|
+
|
|
3
8
|
## 0.36.22 — unified `skills/onboarding.md` SSOT across all 11 harnesses (including Muse & dot)
|
|
4
9
|
|
|
5
10
|
- `skills/onboarding.md` is now the single source of truth across all 11 supported harnesses (`Claude Code`, `Codex`, `DeepSeek Harness`, `OpenClaw`, `Hermes`, `Grok Bot`, `Antigravity`, `ZCode`, `Muse`, `dot / Work Cloud`, and `URL wake`), adding `§8 Muse` (`--muse` WebSocket bridge, wake daemon, and 3-minute keep-alive hook) plus an HTTPS `unpkg.com` fallback for cloud hosts without local `npx`.
|
package/codex/README.md
CHANGED
|
@@ -510,3 +510,17 @@ same prompt in the local grant. Project context stays in channel docs and the
|
|
|
510
510
|
existing conversation. A no-change run can return `[[AGENTSCHAT_NO_UPDATE]]` alone:
|
|
511
511
|
only this recognized scheduled skill stores `skipped` and sends no reply. Ordinary
|
|
512
512
|
chat, unknown skills and other loops retain normal reply behavior.
|
|
513
|
+
|
|
514
|
+
### Tool identity and readiness
|
|
515
|
+
|
|
516
|
+
The bridge installs its own process-scoped agentschat MCP entry from the same
|
|
517
|
+
package. It passes only the private profile path, expected agent ID and service
|
|
518
|
+
URLs, never a bearer token in command arguments. This entry overrides inherited
|
|
519
|
+
selectors and refuses identity switching; change the bot registry and restart
|
|
520
|
+
the bot to select a different identity. Tool-only mode avoids a duplicate socket.
|
|
521
|
+
|
|
522
|
+
Full-access startup and --check verify the selected AgentsChat account; the MCP
|
|
523
|
+
child also verifies authentication before becoming available. Read-only mode
|
|
524
|
+
disables tools. Manager status connected means chat transport connected, not
|
|
525
|
+
proof that every MCP tool or downstream model is healthy. --check does not
|
|
526
|
+
generate a model response or establish production message/reply proof.
|
package/codex/app-server.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { createInterface } from "node:readline";
|
|
3
4
|
import type { ThreadHistory } from "./thread-history.ts";
|
|
4
5
|
import type { PermissionMode, ReasoningEffort } from "./config.ts";
|
|
@@ -22,15 +23,40 @@ export class AppServer {
|
|
|
22
23
|
private diagnosticTail = "";
|
|
23
24
|
private disabledMcp: Record<string, { enabled: boolean }> = {};
|
|
24
25
|
// Keep the legacy positional argument for callers; turns have no time limit.
|
|
25
|
-
constructor(private bin = "codex", private args = ["app-server", "--listen", "stdio://"], _legacyTurnTimeoutMs?: number, private permissions: PermissionMode = "full-access", private runtime?: {home: string; legacyHome?: string}, private effort?: ReasoningEffort, private model?: string) {}
|
|
26
|
+
constructor(private bin = "codex", private args = ["app-server", "--listen", "stdio://"], _legacyTurnTimeoutMs?: number, private permissions: PermissionMode = "full-access", private runtime?: {home: string; legacyHome?: string}, private effort?: ReasoningEffort, private model?: string, private toolIdentity?: { profileFile: string; agentId: string; apiUrl: string; wsUrl: string }) {}
|
|
26
27
|
get namespace() { return this.runtime?.home; }
|
|
27
28
|
async start() {
|
|
28
29
|
const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => !/^AGENTS?CHAT_|^RELAY_/.test(k)));
|
|
29
30
|
env.AGENTSCHAT_LOCK_OWNER_PID = String(process.pid);
|
|
30
31
|
env.AGENTSCHAT_TOOL_ONLY = "1";
|
|
32
|
+
if (this.toolIdentity) {
|
|
33
|
+
env.AGENTSCHAT_CODEX_IDENTITY = JSON.stringify(this.toolIdentity);
|
|
34
|
+
env.AGENTSCHAT_EXPECT_AGENT_ID = this.toolIdentity.agentId;
|
|
35
|
+
}
|
|
31
36
|
if (this.runtime) { env.CODEX_HOME = this.runtime.home; env.CODEX_SQLITE_HOME = this.runtime.home; }
|
|
32
37
|
const args = this.runtime && this.args[0] === "app-server"
|
|
33
|
-
? [...this.args, "-c", `sqlite_home=${JSON.stringify(this.runtime.home)}`] : this.args;
|
|
38
|
+
? [...this.args, "-c", `sqlite_home=${JSON.stringify(this.runtime.home)}`] : [...this.args];
|
|
39
|
+
if (this.toolIdentity && this.args[0] === "app-server") {
|
|
40
|
+
// Codex filters child environment variables. Supply an explicit MCP entry
|
|
41
|
+
// instead of depending on parent env inheritance or a global plugin version.
|
|
42
|
+
const entry = {
|
|
43
|
+
command: process.execPath,
|
|
44
|
+
args: [fileURLToPath(new URL("../src/cli.mjs", import.meta.url))],
|
|
45
|
+
enabled: this.permissions !== "read-only",
|
|
46
|
+
env: {
|
|
47
|
+
AGENTSCHAT_CODEX_IDENTITY: JSON.stringify(this.toolIdentity),
|
|
48
|
+
AGENTSCHAT_EXPECT_AGENT_ID: this.toolIdentity.agentId,
|
|
49
|
+
AGENTSCHAT_TOOL_ONLY: "1",
|
|
50
|
+
AGENTSCHAT_LOCK_OWNER_PID: String(process.pid),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// Replace the complete entry, including stale url/bearer/env fields from
|
|
54
|
+
// operator config. JSON objects are not TOML inline tables.
|
|
55
|
+
const encode = (value: unknown): string => value && typeof value === "object" && !Array.isArray(value)
|
|
56
|
+
? `{ ${Object.entries(value).map(([k, v]) => `${JSON.stringify(k)} = ${encode(v)}`).join(", ")} }`
|
|
57
|
+
: JSON.stringify(value);
|
|
58
|
+
args.push("-c", `mcp_servers.agentschat=${encode(entry)}`);
|
|
59
|
+
}
|
|
34
60
|
this.child = spawn(this.bin, args, { env, stdio: "pipe" });
|
|
35
61
|
// Child diagnostics may contain account or MCP credentials; never relay raw stderr.
|
|
36
62
|
this.child.stderr.on("data", (chunk: Buffer) => {
|
package/codex/bridge.ts
CHANGED
|
@@ -82,6 +82,8 @@ export class Bridge {
|
|
|
82
82
|
// Only retain the wire fields used by this bridge; no protocol instructions.
|
|
83
83
|
const tick = raw.meta?.kind === "loop_tick" ? raw.meta : undefined;
|
|
84
84
|
const message: ChatMessage = { id: raw.id, channel_id: raw.channel_id, sender_id: raw.sender_id,
|
|
85
|
+
...(Array.isArray(raw.mentioned_ids) ? { mentioned_ids: raw.mentioned_ids.filter((id: unknown) => typeof id === "string") } : {}),
|
|
86
|
+
...(Array.isArray(raw.mentions) ? { mentions: raw.mentions.filter((id: unknown) => typeof id === "string") } : {}),
|
|
85
87
|
content: tick ? "Authorized scheduled loop" : this.redact(raw.content),
|
|
86
88
|
...(tick ? { meta: { kind: "loop_tick", loop_id: tick.loop_id, interval_ms: tick.interval_ms,
|
|
87
89
|
next_tick_ms: tick.next_tick_ms, prompt: tick.prompt } as LoopTick } : {}) };
|
package/codex/run.ts
CHANGED
|
@@ -70,7 +70,7 @@ async function main() {
|
|
|
70
70
|
}
|
|
71
71
|
console.log(JSON.stringify({ cwd: c.cwd, agent_id: c.agentId, profile: c.profileFile, source: c.source, stateDir: c.stateDir }));
|
|
72
72
|
const runtime = prepareRuntimeHome(c.stateDir, undefined, c.codexHomeMode, c.codexBin);
|
|
73
|
-
codex = new AppServer(c.codexBin, undefined, undefined, c.permissions, runtime, c.effort, c.model);
|
|
73
|
+
codex = new AppServer(c.codexBin, undefined, undefined, c.permissions, runtime, c.effort, c.model, { profileFile: c.profileFile, agentId: c.agentId, apiUrl: c.apiUrl, wsUrl: c.wsUrl });
|
|
74
74
|
if (values.conversations || values["read-conversation"]) {
|
|
75
75
|
const state = JSON.parse(readFileSync(join(c.stateDir, "state.json"), "utf8"));
|
|
76
76
|
const channels = state.channels ?? {};
|
|
@@ -83,6 +83,12 @@ async function main() {
|
|
|
83
83
|
console.log(redactSecrets(JSON.stringify(history).split(c.token).join("[REDACTED]")));
|
|
84
84
|
codex.close(); return;
|
|
85
85
|
}
|
|
86
|
+
if (c.permissions === "full-access") {
|
|
87
|
+
const identityStatus = await getOnboardingStatus(c.apiUrl, c.agentId, c.token);
|
|
88
|
+
if (identityStatus.authentication !== "ok")
|
|
89
|
+
throw new Error("AgentsChat authentication failed or unavailable; tool identity is not ready");
|
|
90
|
+
console.log("AgentsChat selected identity authentication: OK; MCP startup also verifies this identity");
|
|
91
|
+
}
|
|
86
92
|
if (values.check) {
|
|
87
93
|
await codex.start();
|
|
88
94
|
console.log("Official app-server initialization: OK (no chat connection or generation)");
|
package/dist/codex-bridge.js
CHANGED
|
@@ -293,7 +293,7 @@ ${text}`,
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
// codex/run.ts
|
|
296
|
-
import { readFileSync as
|
|
296
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
297
297
|
import { homedir as homedir5 } from "node:os";
|
|
298
298
|
import { join as join10 } from "node:path";
|
|
299
299
|
|
|
@@ -1398,6 +1398,7 @@ import { parseArgs } from "node:util";
|
|
|
1398
1398
|
|
|
1399
1399
|
// codex/app-server.ts
|
|
1400
1400
|
import { spawn } from "node:child_process";
|
|
1401
|
+
import { fileURLToPath } from "node:url";
|
|
1401
1402
|
import { createInterface } from "node:readline";
|
|
1402
1403
|
|
|
1403
1404
|
class ThreadBusyError extends Error {
|
|
@@ -1414,6 +1415,7 @@ class AppServer {
|
|
|
1414
1415
|
runtime;
|
|
1415
1416
|
effort;
|
|
1416
1417
|
model;
|
|
1418
|
+
toolIdentity;
|
|
1417
1419
|
onFatal;
|
|
1418
1420
|
closed = false;
|
|
1419
1421
|
child;
|
|
@@ -1425,13 +1427,14 @@ class AppServer {
|
|
|
1425
1427
|
readonlyFilesystemReported = false;
|
|
1426
1428
|
diagnosticTail = "";
|
|
1427
1429
|
disabledMcp = {};
|
|
1428
|
-
constructor(bin = "codex", args = ["app-server", "--listen", "stdio://"], _legacyTurnTimeoutMs, permissions = "full-access", runtime, effort, model) {
|
|
1430
|
+
constructor(bin = "codex", args = ["app-server", "--listen", "stdio://"], _legacyTurnTimeoutMs, permissions = "full-access", runtime, effort, model, toolIdentity) {
|
|
1429
1431
|
this.bin = bin;
|
|
1430
1432
|
this.args = args;
|
|
1431
1433
|
this.permissions = permissions;
|
|
1432
1434
|
this.runtime = runtime;
|
|
1433
1435
|
this.effort = effort;
|
|
1434
1436
|
this.model = model;
|
|
1437
|
+
this.toolIdentity = toolIdentity;
|
|
1435
1438
|
}
|
|
1436
1439
|
get namespace() {
|
|
1437
1440
|
return this.runtime?.home;
|
|
@@ -1440,11 +1443,30 @@ class AppServer {
|
|
|
1440
1443
|
const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => !/^AGENTS?CHAT_|^RELAY_/.test(k)));
|
|
1441
1444
|
env.AGENTSCHAT_LOCK_OWNER_PID = String(process.pid);
|
|
1442
1445
|
env.AGENTSCHAT_TOOL_ONLY = "1";
|
|
1446
|
+
if (this.toolIdentity) {
|
|
1447
|
+
env.AGENTSCHAT_CODEX_IDENTITY = JSON.stringify(this.toolIdentity);
|
|
1448
|
+
env.AGENTSCHAT_EXPECT_AGENT_ID = this.toolIdentity.agentId;
|
|
1449
|
+
}
|
|
1443
1450
|
if (this.runtime) {
|
|
1444
1451
|
env.CODEX_HOME = this.runtime.home;
|
|
1445
1452
|
env.CODEX_SQLITE_HOME = this.runtime.home;
|
|
1446
1453
|
}
|
|
1447
|
-
const args = this.runtime && this.args[0] === "app-server" ? [...this.args, "-c", `sqlite_home=${JSON.stringify(this.runtime.home)}`] : this.args;
|
|
1454
|
+
const args = this.runtime && this.args[0] === "app-server" ? [...this.args, "-c", `sqlite_home=${JSON.stringify(this.runtime.home)}`] : [...this.args];
|
|
1455
|
+
if (this.toolIdentity && this.args[0] === "app-server") {
|
|
1456
|
+
const entry = {
|
|
1457
|
+
command: process.execPath,
|
|
1458
|
+
args: [fileURLToPath(new URL("../src/cli.mjs", import.meta.url))],
|
|
1459
|
+
enabled: this.permissions !== "read-only",
|
|
1460
|
+
env: {
|
|
1461
|
+
AGENTSCHAT_CODEX_IDENTITY: JSON.stringify(this.toolIdentity),
|
|
1462
|
+
AGENTSCHAT_EXPECT_AGENT_ID: this.toolIdentity.agentId,
|
|
1463
|
+
AGENTSCHAT_TOOL_ONLY: "1",
|
|
1464
|
+
AGENTSCHAT_LOCK_OWNER_PID: String(process.pid)
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
const encode = (value) => value && typeof value === "object" && !Array.isArray(value) ? `{ ${Object.entries(value).map(([k, v]) => `${JSON.stringify(k)} = ${encode(v)}`).join(", ")} }` : JSON.stringify(value);
|
|
1468
|
+
args.push("-c", `mcp_servers.agentschat=${encode(entry)}`);
|
|
1469
|
+
}
|
|
1448
1470
|
this.child = spawn(this.bin, args, { env, stdio: "pipe" });
|
|
1449
1471
|
this.child.stderr.on("data", (chunk) => {
|
|
1450
1472
|
if (this.initialized)
|
|
@@ -1647,7 +1669,7 @@ function isTeamLeadSkillInvocation(prompt) {
|
|
|
1647
1669
|
}
|
|
1648
1670
|
|
|
1649
1671
|
// codex/bridge.ts
|
|
1650
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync6, readFileSync as
|
|
1672
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync6, readFileSync as readFileSync8, renameSync as renameSync4, writeFileSync as writeFileSync4, openSync as openSync2, closeSync as closeSync2, unlinkSync as unlinkSync3 } from "node:fs";
|
|
1651
1673
|
import { join as join8 } from "node:path";
|
|
1652
1674
|
|
|
1653
1675
|
// codex/thread-history.ts
|
|
@@ -1785,12 +1807,12 @@ async function verifyLoopTick(raw, config, owner, list) {
|
|
|
1785
1807
|
|
|
1786
1808
|
// src/session-bind.ts
|
|
1787
1809
|
import { createHash as createHash3 } from "node:crypto";
|
|
1788
|
-
import { closeSync, existsSync as existsSync4, mkdirSync as mkdirSync5, openSync, readFileSync as
|
|
1810
|
+
import { closeSync, existsSync as existsSync4, mkdirSync as mkdirSync5, openSync, readFileSync as readFileSync7, readSync, readdirSync as readdirSync4, statSync as statSync3, unlinkSync as unlinkSync2 } from "node:fs";
|
|
1789
1811
|
import { homedir as homedir4, tmpdir } from "node:os";
|
|
1790
1812
|
import { join as join7 } from "node:path";
|
|
1791
1813
|
|
|
1792
1814
|
// src/profile-store.ts
|
|
1793
|
-
import { existsSync as existsSync3, writeFileSync as writeFileSync3, renameSync as renameSync3, chmodSync, unlinkSync, statSync as statSync2 } from "fs";
|
|
1815
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync3, renameSync as renameSync3, chmodSync, unlinkSync, statSync as statSync2, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
|
|
1794
1816
|
var defaultWarn = (m) => process.stderr.write(m);
|
|
1795
1817
|
function safeWriteProfile(path, data, warn = defaultWarn) {
|
|
1796
1818
|
const tmp = path + ".tmp";
|
|
@@ -1820,6 +1842,16 @@ function safeWriteProfile(path, data, warn = defaultWarn) {
|
|
|
1820
1842
|
`);
|
|
1821
1843
|
}
|
|
1822
1844
|
}
|
|
1845
|
+
var NON_PROFILE_JSON_FILES = new Set([
|
|
1846
|
+
"session-binds.json",
|
|
1847
|
+
"agy-binds.json",
|
|
1848
|
+
"grok-binds.json",
|
|
1849
|
+
"grok-binds-meta.json",
|
|
1850
|
+
"grok-binds.meta.json",
|
|
1851
|
+
"identity-guard.json",
|
|
1852
|
+
"dsh.json",
|
|
1853
|
+
"config.json"
|
|
1854
|
+
]);
|
|
1823
1855
|
|
|
1824
1856
|
// src/session-bind.ts
|
|
1825
1857
|
function isPidAlive(pid) {
|
|
@@ -1853,7 +1885,7 @@ function readAgentLock(lockDir, agentId) {
|
|
|
1853
1885
|
if (!existsSync4(file))
|
|
1854
1886
|
return null;
|
|
1855
1887
|
try {
|
|
1856
|
-
const raw = JSON.parse(
|
|
1888
|
+
const raw = JSON.parse(readFileSync7(file, "utf8"));
|
|
1857
1889
|
if (!raw || typeof raw !== "object" || typeof raw.pid !== "number" || typeof raw.agentId !== "string") {
|
|
1858
1890
|
return null;
|
|
1859
1891
|
}
|
|
@@ -1952,7 +1984,7 @@ class Bridge {
|
|
|
1952
1984
|
this.lock = join8(config.stateDir, "bridge.lock");
|
|
1953
1985
|
if (existsSync5(this.lock)) {
|
|
1954
1986
|
try {
|
|
1955
|
-
const holderPid = Number(
|
|
1987
|
+
const holderPid = Number(readFileSync8(this.lock, "utf8").trim());
|
|
1956
1988
|
if (holderPid > 0 && !isPidAlive(holderPid))
|
|
1957
1989
|
unlinkSync3(this.lock);
|
|
1958
1990
|
} catch {}
|
|
@@ -1971,7 +2003,7 @@ class Bridge {
|
|
|
1971
2003
|
runtime: "codex-bridge"
|
|
1972
2004
|
});
|
|
1973
2005
|
try {
|
|
1974
|
-
this.state = existsSync5(this.file) ? JSON.parse(
|
|
2006
|
+
this.state = existsSync5(this.file) ? JSON.parse(readFileSync8(this.file, "utf8")) : { version: 1, threads: {}, entries: [] };
|
|
1975
2007
|
if (this.state.version !== 1 || !this.state.threads || !Array.isArray(this.state.entries))
|
|
1976
2008
|
throw new Error("Invalid bridge state");
|
|
1977
2009
|
for (const e of this.state.entries) {
|
|
@@ -2007,6 +2039,8 @@ class Bridge {
|
|
|
2007
2039
|
id: raw.id,
|
|
2008
2040
|
channel_id: raw.channel_id,
|
|
2009
2041
|
sender_id: raw.sender_id,
|
|
2042
|
+
...Array.isArray(raw.mentioned_ids) ? { mentioned_ids: raw.mentioned_ids.filter((id) => typeof id === "string") } : {},
|
|
2043
|
+
...Array.isArray(raw.mentions) ? { mentions: raw.mentions.filter((id) => typeof id === "string") } : {},
|
|
2010
2044
|
content: tick ? "Authorized scheduled loop" : this.redact(raw.content),
|
|
2011
2045
|
...tick ? { meta: {
|
|
2012
2046
|
kind: "loop_tick",
|
|
@@ -2250,7 +2284,7 @@ class HeartbeatMonitor {
|
|
|
2250
2284
|
}
|
|
2251
2285
|
|
|
2252
2286
|
// codex/inbox-sync.ts
|
|
2253
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as
|
|
2287
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
2254
2288
|
import { join as join9 } from "node:path";
|
|
2255
2289
|
|
|
2256
2290
|
// src/timestamps.ts
|
|
@@ -2295,7 +2329,7 @@ class InboxSync {
|
|
|
2295
2329
|
this.log = log;
|
|
2296
2330
|
mkdirSync7(stateDir, { recursive: true, mode: 448 });
|
|
2297
2331
|
this.file = join9(stateDir, "inbound-cursors.json");
|
|
2298
|
-
this.state = existsSync6(this.file) ? JSON.parse(
|
|
2332
|
+
this.state = existsSync6(this.file) ? JSON.parse(readFileSync9(this.file, "utf8")) : { version: 1, channels: {} };
|
|
2299
2333
|
if (this.state.version !== 1 || !this.state.channels || typeof this.state.channels !== "object" || Array.isArray(this.state.channels))
|
|
2300
2334
|
throw new Error("Invalid inbound cursors; refusing to discard checkpoint");
|
|
2301
2335
|
for (const value of Object.values(this.state.channels))
|
|
@@ -2638,7 +2672,7 @@ async function main() {
|
|
|
2638
2672
|
}
|
|
2639
2673
|
if (!values["gui-thread"] || !values["gui-message-file"])
|
|
2640
2674
|
throw new Error("GUI submission requires --gui-thread and --gui-message-file");
|
|
2641
|
-
const { prompt, ...receipt } = channel.enqueue(values["gui-thread"],
|
|
2675
|
+
const { prompt, ...receipt } = channel.enqueue(values["gui-thread"], readFileSync10(values["gui-message-file"], "utf8"));
|
|
2642
2676
|
console.log(JSON.stringify(receipt));
|
|
2643
2677
|
return;
|
|
2644
2678
|
}
|
|
@@ -2672,9 +2706,9 @@ async function main() {
|
|
|
2672
2706
|
}
|
|
2673
2707
|
console.log(JSON.stringify({ cwd: c.cwd, agent_id: c.agentId, profile: c.profileFile, source: c.source, stateDir: c.stateDir }));
|
|
2674
2708
|
const runtime = prepareRuntimeHome(c.stateDir, undefined, c.codexHomeMode, c.codexBin);
|
|
2675
|
-
codex = new AppServer(c.codexBin, undefined, undefined, c.permissions, runtime, c.effort, c.model);
|
|
2709
|
+
codex = new AppServer(c.codexBin, undefined, undefined, c.permissions, runtime, c.effort, c.model, { profileFile: c.profileFile, agentId: c.agentId, apiUrl: c.apiUrl, wsUrl: c.wsUrl });
|
|
2676
2710
|
if (values.conversations || values["read-conversation"]) {
|
|
2677
|
-
const state = JSON.parse(
|
|
2711
|
+
const state = JSON.parse(readFileSync10(join10(c.stateDir, "state.json"), "utf8"));
|
|
2678
2712
|
const channels = state.channels ?? {};
|
|
2679
2713
|
if (values.conversations) {
|
|
2680
2714
|
console.log(JSON.stringify(Object.entries(channels).map(([channel2, data]) => ({ channel: channel2, thread: data.thread, isolated: data.namespace === runtime.home }))));
|
|
@@ -2691,6 +2725,12 @@ async function main() {
|
|
|
2691
2725
|
codex.close();
|
|
2692
2726
|
return;
|
|
2693
2727
|
}
|
|
2728
|
+
if (c.permissions === "full-access") {
|
|
2729
|
+
const identityStatus = await getOnboardingStatus(c.apiUrl, c.agentId, c.token);
|
|
2730
|
+
if (identityStatus.authentication !== "ok")
|
|
2731
|
+
throw new Error("AgentsChat authentication failed or unavailable; tool identity is not ready");
|
|
2732
|
+
console.log("AgentsChat selected identity authentication: OK; MCP startup also verifies this identity");
|
|
2733
|
+
}
|
|
2694
2734
|
if (values.check) {
|
|
2695
2735
|
await codex.start();
|
|
2696
2736
|
console.log("Official app-server initialization: OK (no chat connection or generation)");
|
package/dist/dsh.js
CHANGED
|
@@ -456,6 +456,20 @@ import { join as join3 } from "node:path";
|
|
|
456
456
|
// src/session-bind.ts
|
|
457
457
|
import { closeSync, existsSync as existsSync2, mkdirSync, openSync, readFileSync as readFileSync2, readSync, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
458
458
|
import { join as join2 } from "node:path";
|
|
459
|
+
|
|
460
|
+
// src/profile-store.ts
|
|
461
|
+
var NON_PROFILE_JSON_FILES = new Set([
|
|
462
|
+
"session-binds.json",
|
|
463
|
+
"agy-binds.json",
|
|
464
|
+
"grok-binds.json",
|
|
465
|
+
"grok-binds-meta.json",
|
|
466
|
+
"grok-binds.meta.json",
|
|
467
|
+
"identity-guard.json",
|
|
468
|
+
"dsh.json",
|
|
469
|
+
"config.json"
|
|
470
|
+
]);
|
|
471
|
+
|
|
472
|
+
// src/session-bind.ts
|
|
459
473
|
var DEFAULT_SESSION_BINDS_FILENAME = "session-binds.json";
|
|
460
474
|
var LEGACY_AGY_BINDS_FILENAME = "agy-binds.json";
|
|
461
475
|
function parseSessionBinds(raw) {
|
|
@@ -520,6 +534,8 @@ function resolveSessionForAgent(agentId, opts = {}) {
|
|
|
520
534
|
return;
|
|
521
535
|
}
|
|
522
536
|
for (const [sessionId, profileName] of Object.entries(binds).reverse()) {
|
|
537
|
+
if (opts.filter && !opts.filter(sessionId))
|
|
538
|
+
continue;
|
|
523
539
|
const path = profilePathForName(configDir, profileName);
|
|
524
540
|
if (path === undefined)
|
|
525
541
|
continue;
|