run402-mcp 4.49.0 → 4.50.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.
Files changed (35) hide show
  1. package/dist/harness-context.d.ts +107 -0
  2. package/dist/harness-context.d.ts.map +1 -0
  3. package/dist/harness-context.js +246 -0
  4. package/dist/harness-context.js.map +1 -0
  5. package/dist/tools/ack-room-message.d.ts.map +1 -1
  6. package/dist/tools/ack-room-message.js +2 -1
  7. package/dist/tools/ack-room-message.js.map +1 -1
  8. package/dist/tools/claim-room-resource.d.ts.map +1 -1
  9. package/dist/tools/claim-room-resource.js +2 -1
  10. package/dist/tools/claim-room-resource.js.map +1 -1
  11. package/dist/tools/join-room.d.ts.map +1 -1
  12. package/dist/tools/join-room.js +10 -3
  13. package/dist/tools/join-room.js.map +1 -1
  14. package/dist/tools/read-room-messages.d.ts.map +1 -1
  15. package/dist/tools/read-room-messages.js +2 -0
  16. package/dist/tools/read-room-messages.js.map +1 -1
  17. package/dist/tools/rooms-shared.d.ts +15 -4
  18. package/dist/tools/rooms-shared.d.ts.map +1 -1
  19. package/dist/tools/rooms-shared.js +19 -5
  20. package/dist/tools/rooms-shared.js.map +1 -1
  21. package/dist/tools/send-room-message.d.ts.map +1 -1
  22. package/dist/tools/send-room-message.js +7 -4
  23. package/dist/tools/send-room-message.js.map +1 -1
  24. package/package.json +1 -1
  25. package/sdk/dist/namespaces/gitvault.d.ts +104 -1
  26. package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
  27. package/sdk/dist/namespaces/gitvault.js +124 -0
  28. package/sdk/dist/namespaces/gitvault.js.map +1 -1
  29. package/sdk/dist/namespaces/gitvault.types.d.ts +96 -2
  30. package/sdk/dist/namespaces/gitvault.types.d.ts.map +1 -1
  31. package/sdk/dist/namespaces/gitvault.types.js.map +1 -1
  32. package/sdk/dist/node/gitvault-publication.d.ts +54 -14
  33. package/sdk/dist/node/gitvault-publication.d.ts.map +1 -1
  34. package/sdk/dist/node/gitvault-publication.js +119 -36
  35. package/sdk/dist/node/gitvault-publication.js.map +1 -1
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Best-effort session + task identity sourced from the AI harness hosting
3
+ * this MCP server — no network call, every source optional, the chain always
4
+ * terminates. TypeScript port of the CLI's `cli/lib/harness-context.mjs` for
5
+ * the same mechanism (presence-naming-ergonomics, run402-private tasks 2.2 /
6
+ * 3.1-3.2): `cli/` is source, not shipped — `run402-mcp`'s package.json
7
+ * `files` list is `dist` + `core/dist` + `sdk/dist` + `sdk/core-dist` +
8
+ * `schemas`, so the CLI's copy is not importable at runtime here, same
9
+ * reason `rooms-shared.ts` carries its own room-addressing logic instead of
10
+ * importing the CLI's.
11
+ *
12
+ * The env var names and on-disk cache path (`.run402/session-key.json`,
13
+ * relative to the SERVER's cwd — see `rooms-shared.ts`'s own note on why that
14
+ * is the right default and its real limit) are IDENTICAL to the CLI's, on
15
+ * purpose: a harness that sets RUN402_SESSION_KEY, or a checkout that already
16
+ * has a generated key on disk from a prior CLI invocation, gets the same
17
+ * resumable identity through either surface.
18
+ *
19
+ * Session identity is what makes a presence RESUMABLE across a lost server
20
+ * process (an MCP server restart has no memory of what it registered last
21
+ * time — `rooms-shared.ts`'s presence cache is in-memory, process-lifetime
22
+ * only): the gateway resumes a presence bound to the SAME session_key no
23
+ * matter how long its TTL has silently decayed, so a restarted server that
24
+ * can re-derive its OWN key independently of any in-process cache needs no
25
+ * cache at all to pick up where it left off. Two genuinely concurrent server
26
+ * instances must NEVER derive the same key — that would be the #663
27
+ * regression this design exists to avoid (see run402-private's
28
+ * agent-presence.ts, resolvePresence's own comment) — so every source below
29
+ * is either a value the harness itself guarantees is unique per session, or
30
+ * a value generated here and persisted only for THIS checkout.
31
+ */
32
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
33
+ import { homedir } from "node:os";
34
+ import { randomBytes } from "node:crypto";
35
+ export declare const SESSION_KEY_OVERRIDE_ENV = "RUN402_SESSION_KEY";
36
+ export declare const TASK_FROM_TITLE_OPT_OUT_ENV = "RUN402_NO_TASK_FROM_TITLE";
37
+ export interface SessionKeyResolution {
38
+ key: string;
39
+ source: "env_override" | "claude_code_session_id" | "codex_thread_id" | "generated_cached" | "generated";
40
+ }
41
+ export interface TaskLabelResolution {
42
+ task: string | null;
43
+ source: "explicit" | "opted_out" | "claude_code_thread_title" | "codex_thread_title" | "none";
44
+ }
45
+ /**
46
+ * Resolve THIS server process's opaque identity as an ordered chain with no
47
+ * network call: explicit override -> Claude Code's own session id -> Codex's
48
+ * own thread id -> a locally generated key persisted for this checkout. No
49
+ * source is load-bearing — a harness that sets neither env var, or a
50
+ * filesystem that refuses the write, still yields a usable key for this run.
51
+ *
52
+ * NOT memoized here (see {@link getSessionKey} for the server-lifetime
53
+ * memoization) so the function stays a pure, directly-testable resolver —
54
+ * matching the CLI's own `resolveSessionKey` shape exactly.
55
+ */
56
+ export declare function resolveSessionKey(opts?: {
57
+ env?: NodeJS.ProcessEnv;
58
+ cwd?: string;
59
+ existsSyncImpl?: typeof existsSync;
60
+ readFileSyncImpl?: typeof readFileSync;
61
+ writeFileSyncImpl?: typeof writeFileSync;
62
+ mkdirSyncImpl?: typeof mkdirSync;
63
+ randomBytesImpl?: typeof randomBytes;
64
+ }): SessionKeyResolution;
65
+ /**
66
+ * This SERVER PROCESS's session identity, resolved once (lazily, on first
67
+ * use) and reused for its entire lifetime. An MCP server is one continuous
68
+ * session for as long as it runs — unlike the CLI, where "once per process"
69
+ * and "once per invocation" are the same thing, here they are not, and the
70
+ * whole point of a stable session_key is that it stays stable across the
71
+ * many tool calls one server instance serves, not just within one.
72
+ */
73
+ export declare function getSessionKey(): SessionKeyResolution;
74
+ /** Reset the cached session key. Test-only (matches `sdk.ts`'s `_resetSdk`). */
75
+ export declare function _resetSessionKeyForTests(): void;
76
+ /**
77
+ * Best-effort "what is this session working on", sourced from the harness's
78
+ * own thread title when the caller did not pass an explicit `task`. Design
79
+ * D1a (presence-naming-ergonomics): the thread title is the best
80
+ * "what am I working on" string in the system — automatic, human-meaningful,
81
+ * already maintained by the user — and the schema already has the right
82
+ * slot for it (`task` is display-only and already refreshed on every
83
+ * coordination call).
84
+ *
85
+ * Deliberately NOT memoized across calls (unlike {@link getSessionKey}): a
86
+ * long-lived server should reflect a mid-conversation thread rename on the
87
+ * NEXT tool call, not freeze the label at whatever it read on server start.
88
+ *
89
+ * Never throws and never blocks meaningfully on a slow or failing read:
90
+ * every source here is either a fast env-var check or a single best-effort
91
+ * file/DB read, and any failure just leaves the explicit `task` (possibly
92
+ * absent) untouched.
93
+ *
94
+ * A thread title is user-authored prose this publishes into a shared org
95
+ * room the instant it is sent — `RUN402_NO_TASK_FROM_TITLE=1` opts out
96
+ * entirely, matching design task 3.2's "never send a title for a room the
97
+ * session did not deliberately join".
98
+ */
99
+ export declare function resolveTaskLabel(opts?: {
100
+ explicitTask?: string;
101
+ env?: NodeJS.ProcessEnv;
102
+ existsSyncImpl?: typeof existsSync;
103
+ readFileSyncImpl?: typeof readFileSync;
104
+ readdirSyncImpl?: typeof readdirSync;
105
+ homedirImpl?: typeof homedir;
106
+ }): Promise<TaskLabelResolution>;
107
+ //# sourceMappingURL=harness-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-context.d.ts","sourceRoot":"","sources":["../src/harness-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AAOvE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,cAAc,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,WAAW,CAAC;CAC1G;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,MAAM,CAAC;CAC/F;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,UAAU,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,YAAY,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,aAAa,CAAC;IACzC,aAAa,CAAC,EAAE,OAAO,SAAS,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,WAAW,CAAC;CACjC,GAAG,oBAAoB,CAsC5B;AAID;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,oBAAoB,CAGpD;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAmGD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,GAAE;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,UAAU,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,YAAY,CAAC;IACvC,eAAe,CAAC,EAAE,OAAO,WAAW,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAkBpC"}
@@ -0,0 +1,246 @@
1
+ /**
2
+ * Best-effort session + task identity sourced from the AI harness hosting
3
+ * this MCP server — no network call, every source optional, the chain always
4
+ * terminates. TypeScript port of the CLI's `cli/lib/harness-context.mjs` for
5
+ * the same mechanism (presence-naming-ergonomics, run402-private tasks 2.2 /
6
+ * 3.1-3.2): `cli/` is source, not shipped — `run402-mcp`'s package.json
7
+ * `files` list is `dist` + `core/dist` + `sdk/dist` + `sdk/core-dist` +
8
+ * `schemas`, so the CLI's copy is not importable at runtime here, same
9
+ * reason `rooms-shared.ts` carries its own room-addressing logic instead of
10
+ * importing the CLI's.
11
+ *
12
+ * The env var names and on-disk cache path (`.run402/session-key.json`,
13
+ * relative to the SERVER's cwd — see `rooms-shared.ts`'s own note on why that
14
+ * is the right default and its real limit) are IDENTICAL to the CLI's, on
15
+ * purpose: a harness that sets RUN402_SESSION_KEY, or a checkout that already
16
+ * has a generated key on disk from a prior CLI invocation, gets the same
17
+ * resumable identity through either surface.
18
+ *
19
+ * Session identity is what makes a presence RESUMABLE across a lost server
20
+ * process (an MCP server restart has no memory of what it registered last
21
+ * time — `rooms-shared.ts`'s presence cache is in-memory, process-lifetime
22
+ * only): the gateway resumes a presence bound to the SAME session_key no
23
+ * matter how long its TTL has silently decayed, so a restarted server that
24
+ * can re-derive its OWN key independently of any in-process cache needs no
25
+ * cache at all to pick up where it left off. Two genuinely concurrent server
26
+ * instances must NEVER derive the same key — that would be the #663
27
+ * regression this design exists to avoid (see run402-private's
28
+ * agent-presence.ts, resolvePresence's own comment) — so every source below
29
+ * is either a value the harness itself guarantees is unique per session, or
30
+ * a value generated here and persisted only for THIS checkout.
31
+ */
32
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
33
+ import { homedir } from "node:os";
34
+ import { join } from "node:path";
35
+ import { randomBytes } from "node:crypto";
36
+ export const SESSION_KEY_OVERRIDE_ENV = "RUN402_SESSION_KEY";
37
+ export const TASK_FROM_TITLE_OPT_OUT_ENV = "RUN402_NO_TASK_FROM_TITLE";
38
+ const SESSION_KEY_CACHE_RELATIVE_PATH = ".run402/session-key.json";
39
+ const CLAUDE_SESSIONS_DIR_PARTS = ["Library", "Application Support", "Claude", "claude-code-sessions"];
40
+ const CODEX_STATE_DB_PARTS = [".codex", "state_5.sqlite"];
41
+ const MAX_TITLE_SEARCH_DIRS = 2000;
42
+ const TASK_MAX_LENGTH = 500; // mirrors the gateway's own validateMeta cap — never send what it would reject.
43
+ function isTruthyEnvValue(raw) {
44
+ const v = (raw ?? "").trim().toLowerCase();
45
+ return v === "1" || v === "true" || v === "yes";
46
+ }
47
+ /**
48
+ * Resolve THIS server process's opaque identity as an ordered chain with no
49
+ * network call: explicit override -> Claude Code's own session id -> Codex's
50
+ * own thread id -> a locally generated key persisted for this checkout. No
51
+ * source is load-bearing — a harness that sets neither env var, or a
52
+ * filesystem that refuses the write, still yields a usable key for this run.
53
+ *
54
+ * NOT memoized here (see {@link getSessionKey} for the server-lifetime
55
+ * memoization) so the function stays a pure, directly-testable resolver —
56
+ * matching the CLI's own `resolveSessionKey` shape exactly.
57
+ */
58
+ export function resolveSessionKey(opts = {}) {
59
+ const env = opts.env ?? process.env;
60
+ const cwd = opts.cwd ?? process.cwd();
61
+ const existsSyncImpl = opts.existsSyncImpl ?? existsSync;
62
+ const readFileSyncImpl = opts.readFileSyncImpl ?? readFileSync;
63
+ const writeFileSyncImpl = opts.writeFileSyncImpl ?? writeFileSync;
64
+ const mkdirSyncImpl = opts.mkdirSyncImpl ?? mkdirSync;
65
+ const randomBytesImpl = opts.randomBytesImpl ?? randomBytes;
66
+ const override = env[SESSION_KEY_OVERRIDE_ENV]?.trim();
67
+ if (override)
68
+ return { key: override, source: "env_override" };
69
+ const claudeId = env.CLAUDE_CODE_SESSION_ID?.trim();
70
+ if (claudeId)
71
+ return { key: claudeId, source: "claude_code_session_id" };
72
+ const codexId = env.CODEX_THREAD_ID?.trim();
73
+ if (codexId)
74
+ return { key: codexId, source: "codex_thread_id" };
75
+ const keyPath = join(cwd, SESSION_KEY_CACHE_RELATIVE_PATH);
76
+ try {
77
+ if (existsSyncImpl(keyPath)) {
78
+ const parsed = JSON.parse(readFileSyncImpl(keyPath, "utf8"));
79
+ if (typeof parsed?.session_key === "string" && parsed.session_key) {
80
+ return { key: parsed.session_key, source: "generated_cached" };
81
+ }
82
+ }
83
+ }
84
+ catch {
85
+ // Malformed or unreadable cache: fall through to generating a fresh one.
86
+ }
87
+ const generated = randomBytesImpl(16).toString("hex");
88
+ try {
89
+ mkdirSyncImpl(join(cwd, ".run402"), { recursive: true });
90
+ writeFileSyncImpl(keyPath, `${JSON.stringify({ session_key: generated }, null, 2)}\n`);
91
+ }
92
+ catch {
93
+ // Best-effort persistence: an unwritable checkout still gets a usable
94
+ // (if not durable-across-invocations) key for this one run.
95
+ }
96
+ return { key: generated, source: "generated" };
97
+ }
98
+ let sessionKeyMemo;
99
+ /**
100
+ * This SERVER PROCESS's session identity, resolved once (lazily, on first
101
+ * use) and reused for its entire lifetime. An MCP server is one continuous
102
+ * session for as long as it runs — unlike the CLI, where "once per process"
103
+ * and "once per invocation" are the same thing, here they are not, and the
104
+ * whole point of a stable session_key is that it stays stable across the
105
+ * many tool calls one server instance serves, not just within one.
106
+ */
107
+ export function getSessionKey() {
108
+ if (sessionKeyMemo === undefined)
109
+ sessionKeyMemo = resolveSessionKey();
110
+ return sessionKeyMemo;
111
+ }
112
+ /** Reset the cached session key. Test-only (matches `sdk.ts`'s `_resetSdk`). */
113
+ export function _resetSessionKeyForTests() {
114
+ sessionKeyMemo = undefined;
115
+ }
116
+ /**
117
+ * Bounded-depth search for a file named `filename` under `root`. Stops at
118
+ * the first match, or after MAX_TITLE_SEARCH_DIRS directories visited,
119
+ * whichever comes first — this is best-effort enrichment, not a guarantee,
120
+ * and must never become an unbounded walk of the user's home directory.
121
+ */
122
+ function findFileByName(root, filename, opts) {
123
+ const maxDepth = opts.maxDepth ?? 4;
124
+ if (!opts.existsSyncImpl(root))
125
+ return null;
126
+ const stack = [{ dir: root, depth: 0 }];
127
+ let visited = 0;
128
+ while (stack.length && visited < MAX_TITLE_SEARCH_DIRS) {
129
+ const next = stack.pop();
130
+ visited += 1;
131
+ let entries;
132
+ try {
133
+ entries = opts.readdirSyncImpl(next.dir, { withFileTypes: true });
134
+ }
135
+ catch {
136
+ continue;
137
+ }
138
+ for (const entry of entries) {
139
+ if (entry.isFile() && entry.name === filename)
140
+ return join(next.dir, entry.name);
141
+ if (entry.isDirectory() && next.depth < maxDepth) {
142
+ stack.push({ dir: join(next.dir, entry.name), depth: next.depth + 1 });
143
+ }
144
+ }
145
+ }
146
+ return null;
147
+ }
148
+ /**
149
+ * Claude Code's own per-session metadata store — one JSON file named
150
+ * `<CLAUDE_CODE_HOST_SESSION_ID>.json`, holding (among other fields) `title`:
151
+ * the human-meaningful, user-renamable thread title shown in the app. Its
152
+ * exact parent directories are two harness-assigned ids this function does
153
+ * not try to predict; it searches for the leaf filename instead, bounded and
154
+ * best-effort.
155
+ */
156
+ function readClaudeCodeThreadTitle(opts) {
157
+ const hostId = opts.env.CLAUDE_CODE_HOST_SESSION_ID?.trim();
158
+ if (!hostId)
159
+ return null;
160
+ const root = join(opts.homedirImpl(), ...CLAUDE_SESSIONS_DIR_PARTS);
161
+ const found = findFileByName(root, `${hostId}.json`, opts);
162
+ if (!found)
163
+ return null;
164
+ try {
165
+ const parsed = JSON.parse(opts.readFileSyncImpl(found, "utf8"));
166
+ const title = parsed?.title;
167
+ return typeof title === "string" && title.trim() ? title.trim() : null;
168
+ }
169
+ catch {
170
+ return null;
171
+ }
172
+ }
173
+ /**
174
+ * Codex's own local thread store (a SQLite file under its home directory) —
175
+ * `threads.title` for the id `CODEX_THREAD_ID` names. Read via Node's
176
+ * built-in `node:sqlite`; guarded by dynamic import so an older runtime that
177
+ * lacks it — or any other read failure — degrades to "no title" rather than
178
+ * a crash. Opened read-only: this must never create a WAL file or take a
179
+ * write lock on a store Codex itself may be actively writing to.
180
+ */
181
+ async function readCodexThreadTitle(opts) {
182
+ const threadId = opts.env.CODEX_THREAD_ID?.trim();
183
+ if (!threadId)
184
+ return null;
185
+ const dbPath = join(opts.homedirImpl(), ...CODEX_STATE_DB_PARTS);
186
+ if (!opts.existsSyncImpl(dbPath))
187
+ return null;
188
+ try {
189
+ const { DatabaseSync } = await import("node:sqlite");
190
+ const db = new DatabaseSync(dbPath, { readOnly: true });
191
+ try {
192
+ const row = db.prepare("SELECT title FROM threads WHERE id = ?").get(threadId);
193
+ const title = row?.title;
194
+ return typeof title === "string" && title.trim() ? title.trim() : null;
195
+ }
196
+ finally {
197
+ db.close();
198
+ }
199
+ }
200
+ catch {
201
+ return null;
202
+ }
203
+ }
204
+ /**
205
+ * Best-effort "what is this session working on", sourced from the harness's
206
+ * own thread title when the caller did not pass an explicit `task`. Design
207
+ * D1a (presence-naming-ergonomics): the thread title is the best
208
+ * "what am I working on" string in the system — automatic, human-meaningful,
209
+ * already maintained by the user — and the schema already has the right
210
+ * slot for it (`task` is display-only and already refreshed on every
211
+ * coordination call).
212
+ *
213
+ * Deliberately NOT memoized across calls (unlike {@link getSessionKey}): a
214
+ * long-lived server should reflect a mid-conversation thread rename on the
215
+ * NEXT tool call, not freeze the label at whatever it read on server start.
216
+ *
217
+ * Never throws and never blocks meaningfully on a slow or failing read:
218
+ * every source here is either a fast env-var check or a single best-effort
219
+ * file/DB read, and any failure just leaves the explicit `task` (possibly
220
+ * absent) untouched.
221
+ *
222
+ * A thread title is user-authored prose this publishes into a shared org
223
+ * room the instant it is sent — `RUN402_NO_TASK_FROM_TITLE=1` opts out
224
+ * entirely, matching design task 3.2's "never send a title for a room the
225
+ * session did not deliberately join".
226
+ */
227
+ export async function resolveTaskLabel(opts = {}) {
228
+ const env = opts.env ?? process.env;
229
+ const existsSyncImpl = opts.existsSyncImpl ?? existsSync;
230
+ const readFileSyncImpl = opts.readFileSyncImpl ?? readFileSync;
231
+ const readdirSyncImpl = opts.readdirSyncImpl ?? readdirSync;
232
+ const homedirImpl = opts.homedirImpl ?? homedir;
233
+ const trimmed = typeof opts.explicitTask === "string" ? opts.explicitTask.trim() : "";
234
+ if (trimmed)
235
+ return { task: trimmed, source: "explicit" };
236
+ if (isTruthyEnvValue(env[TASK_FROM_TITLE_OPT_OUT_ENV]))
237
+ return { task: null, source: "opted_out" };
238
+ const claude = readClaudeCodeThreadTitle({ env, existsSyncImpl, readFileSyncImpl, readdirSyncImpl, homedirImpl });
239
+ if (claude)
240
+ return { task: claude.slice(0, TASK_MAX_LENGTH), source: "claude_code_thread_title" };
241
+ const codex = await readCodexThreadTitle({ env, existsSyncImpl, homedirImpl });
242
+ if (codex)
243
+ return { task: codex.slice(0, TASK_MAX_LENGTH), source: "codex_thread_title" };
244
+ return { task: null, source: "none" };
245
+ }
246
+ //# sourceMappingURL=harness-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-context.js","sourceRoot":"","sources":["../src/harness-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AACvE,MAAM,+BAA+B,GAAG,0BAA0B,CAAC;AACnE,MAAM,yBAAyB,GAAG,CAAC,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;AACvG,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAC1D,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,gFAAgF;AAY7G,SAAS,gBAAgB,CAAC,GAAuB;IAC/C,MAAM,C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ACpB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgBrB"}
1
+ {"version":3,"file":"ack-room-message.d.ts","sourceRoot":"","sources":["../../src/tools/ack-room-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB;;;;;CAKhC,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,SAAS,CAAC,CAiBrB"}
@@ -16,8 +16,9 @@ export async function handleAckRoomMessage(args) {
16
16
  }
17
17
  const room = addr.room;
18
18
  try {
19
- const result = await withPresenceRetry(room, (presenceId) => getSdk().rooms.ackMessage(room.orgId, room.roomKey, args.message_id, {
19
+ const result = await withPresenceRetry(room, (presenceId, sessionKey) => getSdk().rooms.ackMessage(room.orgId, room.roomKey, args.message_id, {
20
20
  ...(presenceId !== undefined ? { presenceId } : {}),
21
+ sessionKey,
21
22
  }));
22
23
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ack-room-message.js","sourceRoot":"","sources":["../../src/tools/ack-room-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,e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AAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,SAAS,CAAC,CAoBrB"}
1
+ {"version":3,"file":"claim-room-resource.d.ts","sourceRoot":"","sources":["../../src/tools/claim-room-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB;;;;;;;;CAQnC,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,SAAS,CAAC,CAqBrB"}
@@ -19,12 +19,13 @@ export async function handleClaimRoomResource(args) {
19
19
  }
20
20
  const room = addr.room;
21
21
  try {
22
- const created = await withPresenceRetry(room, (presenceId) => getSdk().rooms.createClaim(room.orgId, room.roomKey, {
22
+ const created = await withPresenceRetry(room, (presenceId, sessionKey) => getSdk().rooms.createClaim(room.orgId, room.roomKey, {
23
23
  resource: args.resource,
24
24
  mode: args.mode ?? "exclusive",
25
25
  ...(args.ttl_seconds !== undefined ? { ttlSeconds: args.ttl_seconds } : {}),
26
26
  ...(args.note !== undefined ? { note: args.note } : {}),
27
27
  ...(presenceId !== undefined ? { presenceId } : {}),
28
+ sessionKey,
28
29
  }));
29
30
  return { content: [{ type: "text", text: JSON.stringify(created, null, 2) }] };
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claim-room-resource.js","sourceRoot":"","sources":["../../src/tools/claim-room-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8EAA8E,CAAC;IAC1H,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IACtF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iPAAiP,CAAC;IAC3R,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oKAAoK,CAAC;IACnM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,QA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IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,SAAS,CAAC,CA2BrB"}
1
+ {"version":3,"file":"join-room.d.ts","sourceRoot":"","sources":["../../src/tools/join-room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,SAAS,CAAC,CAiCrB"}
@@ -2,12 +2,13 @@ import { z } from "zod";
2
2
  import { getSdk } from "../sdk.js";
3
3
  import { mapSdkError } from "../errors.js";
4
4
  import { resolveRoomArgs, cachedPresenceId, rememberPresence } from "./rooms-shared.js";
5
+ import { getSessionKey, resolveTaskLabel } from "../harness-context.js";
5
6
  export const joinRoomSchema = {
6
7
  project_id: z.string().optional().describe("Project whose DEFAULT room to join (the room key is the project id — the zero-config rendezvous). Omit when passing org_id + room_key."),
7
8
  org_id: z.string().optional().describe("Org id, together with room_key, to join a NAMED org room (multi-repo products)."),
8
9
  room_key: z.string().optional().describe("Named room slug (with org_id). Rooms auto-vivify on first use — there is no create call. Omit every addressing parameter to use the checkout's own context: RUN402_ROOM, or an `org`/`room` binding in .run402.json, or the wallet profile's selected org (read from the MCP server's working directory)."),
9
- requested_name: z.string().optional().describe("Choose your own presence name. Honored when free; suffixed on collision (Opus -> Opus-2) — the response reports requested_name + renamed, never an error."),
10
- task: z.string().optional().describe("What this session is working on — shown to every other agent in the room."),
10
+ requested_name: z.string().optional().describe("Choose your own presence name. Honored when free; on collision a task-derived name is tried first (Opus + task \"mpp triage\" -> Opus-mpp-triage) before a bare ordinal (Opus -> Opus-2) — the response reports requested_name + renamed + why, never an error. Ignored when this session resumes an existing presence (see the resumed field): an existing presence keeps its existing name."),
11
+ task: z.string().optional().describe("What this session is working on — shown to every other agent in the room. Omit to best-effort auto-source it from your harness's own thread title (RUN402_NO_TASK_FROM_TITLE=1 opts out)."),
11
12
  };
12
13
  export async function handleJoinRoom(args) {
13
14
  const addr = await resolveRoomArgs(args).catch((err) => ({ ok: false, error: mapSdkErrorText(err) }));
@@ -22,9 +23,15 @@ export async function handleJoinRoom(args) {
22
23
  you = { presence_id: existing, reused: true };
23
24
  }
24
25
  else {
26
+ // No in-memory presence yet for this room — the common case on a freshly
27
+ // started server. sessionKey lets the gateway resume the SAME presence
28
+ // this process (or an earlier instance of it) registered before, rather
29
+ // than always registering fresh on every server restart.
30
+ const { task } = await resolveTaskLabel({ explicitTask: args.task });
25
31
  const registration = await sdk.rooms.registerPresence(room.orgId, room.roomKey, {
26
32
  ...(args.requested_name !== undefined ? { requestedName: args.requested_name } : {}),
27
- ...(args.task !== undefined ? { task: args.task } : {}),
33
+ ...(task !== null ? { task } : {}),
34
+ sessionKey: getSessionKey().key,
28
35
  });
29
36
  rememberPresence(room, registration, args.requested_name);
30
37
  you = registration;
@@ -1 +1 @@
1
- {"version":3,"file":"join-room.js","sourceRoot":"","sources":["../../src/tools/join-room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe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room-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,sBAAsB;;;;;;;;;CASlC,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,CAAC,CAyBrB"}
1
+ {"version":3,"file":"read-room-messages.d.ts","sourceRoot":"","sources":["../../src/tools/read-room-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB;;;;;;;;;CASlC,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,CAAC,CA0BrB"}
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { getSdk } from "../sdk.js";
3
3
  import { mapSdkError } from "../errors.js";
4
4
  import { resolveRoomArgs, cachedPresenceId } from "./rooms-shared.js";
5
+ import { getSessionKey } from "../harness-context.js";
5
6
  export const readRoomMessagesSchema = {
6
7
  project_id: z.string().optional().describe("Project whose default room to read. Omit when passing org_id + room_key."),
7
8
  org_id: z.string().optional().describe("Org id (with room_key) for a named org room."),
@@ -31,6 +32,7 @@ export async function handleReadRoomMessages(args) {
31
32
  ...(args.thread_id !== undefined ? { threadId: args.thread_id } : {}),
32
33
  ...(args.unread ? { addressedTo: "me", unread: true } : {}),
33
34
  ...(presenceId !== undefined ? { presenceId } : {}),
35
+ sessionKey: getSessionKey().key,
34
36
  ...(args.limit !== undefined ? { limit: args.limit } : {}),
35
37
  });
36
38
  return { content: [{ type: "text", text: JSON.stringify(page, null, 2) }] };
@@ -1 +1 @@
1
- {"version":3,"file":"read-room-messages.js","sourceRoot":"","sources":["../../src/tools/read-room-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0EAA0E,CAAC;IACtH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,C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resolveRoomArgs(args: RoomAddressArgs, opts?: {
21
21
  export declare function cachedPresenceId(room: ResolvedRoom): string | undefined;
22
22
  export declare function rememberPresence(room: ResolvedRoom, presence: unknown, requestedName?: string): void;
23
23
  export declare function forgetPresence(room: ResolvedRoom): void;
24
- /** Retry-once on PRESENCE_EXPIRED: drop the cached session presence, REGISTER
25
- * a replacement (asking for the same name — it suffixes honestly), and retry
26
- * with it. Registration is explicit because a bare call cannot mean "me". */
27
- export declare function withPresenceRetry<T>(room: ResolvedRoom, call: (presenceId: string | undefined) => Promise<T>): Promise<T>;
24
+ /**
25
+ * Retry-once on PRESENCE_EXPIRED: drop the cached session presence, REGISTER
26
+ * a replacement (asking for the same name it suffixes honestly), and retry
27
+ * with it. Registration is explicit because a bare call cannot mean "me".
28
+ *
29
+ * Every call also carries this SERVER PROCESS's resolved session identity
30
+ * (see `../harness-context.js`) alongside any cached `presence_id` — the
31
+ * gateway tries the session identity first, so a presence whose TTL lapsed
32
+ * BETWEEN tool calls (or across a server restart, which starts with an empty
33
+ * in-memory presence cache) revives under its own name via that path rather
34
+ * than 410ing. The retry below is now reached only when no resolvable
35
+ * session identity exists, or the presence aged past the 90-day retention
36
+ * sweep — not on an ordinary period of the server sitting idle.
37
+ */
38
+ export declare function withPresenceRetry<T>(room: ResolvedRoom, call: (presenceId: string | undefined, sessionKey: string) => Promise<T>): Promise<T>;
28
39
  //# sourceMappingURL=rooms-shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rooms-shared.d.ts","sourceRoot":"","sources":["../../src/tools/rooms-shared.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAA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C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAoEjC,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAO,GACnD,OAAO,CAAC,iBAAiB,CAAC,CAmC5B;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAIvE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAOpG;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACvE,OAAO,CAAC,CAAC,CAAC,CAoBZ"}
@@ -18,6 +18,7 @@ import { getSdk } from "../sdk.js";
18
18
  import { mapSdkError } from "../errors.js";
19
19
  import { findBindingKey } from "../../core/dist/binding-file.js";
20
20
  import { getActiveOrgId } from "../../core/dist/profile-state.js";
21
+ import { getSessionKey } from "../harness-context.js";
21
22
  const ORG_ENV = "RUN402_ORG";
22
23
  const ROOM_ENV = "RUN402_ROOM";
23
24
  const trimmed = (v) => typeof v === "string" && v.trim() ? v.trim() : null;
@@ -139,13 +140,25 @@ export function rememberPresence(room, presence, requestedName) {
139
140
  export function forgetPresence(room) {
140
141
  presenceByRoom.delete(roomKeyOf(room));
141
142
  }
142
- /** Retry-once on PRESENCE_EXPIRED: drop the cached session presence, REGISTER
143
- * a replacement (asking for the same name — it suffixes honestly), and retry
144
- * with it. Registration is explicit because a bare call cannot mean "me". */
143
+ /**
144
+ * Retry-once on PRESENCE_EXPIRED: drop the cached session presence, REGISTER
145
+ * a replacement (asking for the same name it suffixes honestly), and retry
146
+ * with it. Registration is explicit because a bare call cannot mean "me".
147
+ *
148
+ * Every call also carries this SERVER PROCESS's resolved session identity
149
+ * (see `../harness-context.js`) alongside any cached `presence_id` — the
150
+ * gateway tries the session identity first, so a presence whose TTL lapsed
151
+ * BETWEEN tool calls (or across a server restart, which starts with an empty
152
+ * in-memory presence cache) revives under its own name via that path rather
153
+ * than 410ing. The retry below is now reached only when no resolvable
154
+ * session identity exists, or the presence aged past the 90-day retention
155
+ * sweep — not on an ordinary period of the server sitting idle.
156
+ */
145
157
  export async function withPresenceRetry(room, call) {
146
158
  const presenceId = cachedPresenceId(room);
159
+ const sessionKey = getSessionKey().key;
147
160
  try {
148
- return await call(presenceId);
161
+ return await call(presenceId, sessionKey);
149
162
  }
150
163
  catch (err) {
151
164
  const code = err?.body?.code
@@ -155,9 +168,10 @@ export async function withPresenceRetry(room, call) {
155
168
  const requestedName = requestedNameByRoom.get(roomKeyOf(room));
156
169
  const replacement = await getSdk().rooms.registerPresence(room.orgId, room.roomKey, {
157
170
  ...(requestedName ? { requestedName } : {}),
171
+ sessionKey,
158
172
  });
159
173
  rememberPresence(room, replacement, requestedName);
160
- return call(replacement?.presence_id);
174
+ return call(replacement?.presence_id, sessionKey);
161
175
  }
162
176
  throw err;
163
177
  }