@0xmaxma/claude-gateway 2.1.10 → 2.1.11
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/config.template.json +4 -0
- package/dist/agent/runner.d.ts +68 -2
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +338 -108
- package/dist/agent/runner.js.map +1 -1
- package/dist/api/async-guard.d.ts +13 -0
- package/dist/api/async-guard.d.ts.map +1 -0
- package/dist/api/async-guard.js +38 -0
- package/dist/api/async-guard.js.map +1 -0
- package/dist/api/auth.d.ts +5 -0
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +3 -0
- package/dist/api/auth.js.map +1 -1
- package/dist/api/browser-bindings-router.d.ts.map +1 -1
- package/dist/api/browser-bindings-router.js +2 -0
- package/dist/api/browser-bindings-router.js.map +1 -1
- package/dist/api/capabilities.d.ts +47 -2
- package/dist/api/capabilities.d.ts.map +1 -1
- package/dist/api/capabilities.js +51 -8
- package/dist/api/capabilities.js.map +1 -1
- package/dist/api/files-router.d.ts +23 -0
- package/dist/api/files-router.d.ts.map +1 -0
- package/dist/api/files-router.js +102 -0
- package/dist/api/files-router.js.map +1 -0
- package/dist/api/gateway-router.d.ts +4 -2
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +20 -2
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/git-router.d.ts +4 -0
- package/dist/api/git-router.d.ts.map +1 -0
- package/dist/api/git-router.js +51 -0
- package/dist/api/git-router.js.map +1 -0
- package/dist/api/manifest-sources.d.ts.map +1 -1
- package/dist/api/manifest-sources.js +6 -0
- package/dist/api/manifest-sources.js.map +1 -1
- package/dist/api/processes-router.d.ts +28 -0
- package/dist/api/processes-router.d.ts.map +1 -0
- package/dist/api/processes-router.js +179 -0
- package/dist/api/processes-router.js.map +1 -0
- package/dist/api/router.d.ts +41 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +98 -25
- package/dist/api/router.js.map +1 -1
- package/dist/api/voice-router.d.ts.map +1 -1
- package/dist/api/voice-router.js +2 -0
- package/dist/api/voice-router.js.map +1 -1
- package/dist/build-provenance.json +4 -4
- package/dist/cli/redact.d.ts +1 -0
- package/dist/cli/redact.d.ts.map +1 -1
- package/dist/cli/redact.js +12 -0
- package/dist/cli/redact.js.map +1 -1
- package/dist/config/loader.d.ts +5 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +121 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/reload-policy.d.ts.map +1 -1
- package/dist/config/reload-policy.js +1 -0
- package/dist/config/reload-policy.js.map +1 -1
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +1 -0
- package/dist/config/watcher.js.map +1 -1
- package/dist/files/config.d.ts +6 -0
- package/dist/files/config.d.ts.map +1 -0
- package/dist/files/config.js +15 -0
- package/dist/files/config.js.map +1 -0
- package/dist/files/delete.d.ts +27 -0
- package/dist/files/delete.d.ts.map +1 -0
- package/dist/files/delete.js +143 -0
- package/dist/files/delete.js.map +1 -0
- package/dist/files/fs.d.ts +70 -0
- package/dist/files/fs.d.ts.map +1 -0
- package/dist/files/fs.js +319 -0
- package/dist/files/fs.js.map +1 -0
- package/dist/files/holds.d.ts +11 -0
- package/dist/files/holds.d.ts.map +1 -0
- package/dist/files/holds.js +20 -0
- package/dist/files/holds.js.map +1 -0
- package/dist/files/paths.d.ts +26 -0
- package/dist/files/paths.d.ts.map +1 -0
- package/dist/files/paths.js +112 -0
- package/dist/files/paths.js.map +1 -0
- package/dist/files/session-cwd.d.ts +8 -0
- package/dist/files/session-cwd.d.ts.map +1 -0
- package/dist/files/session-cwd.js +139 -0
- package/dist/files/session-cwd.js.map +1 -0
- package/dist/git/read.d.ts +25 -0
- package/dist/git/read.d.ts.map +1 -0
- package/dist/git/read.js +166 -0
- package/dist/git/read.js.map +1 -0
- package/dist/git/runner.d.ts +46 -0
- package/dist/git/runner.d.ts.map +1 -0
- package/dist/git/runner.js +176 -0
- package/dist/git/runner.js.map +1 -0
- package/dist/git/status.d.ts +119 -0
- package/dist/git/status.d.ts.map +1 -0
- package/dist/git/status.js +273 -0
- package/dist/git/status.js.map +1 -0
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/orchestration/agent-tool-schemas.js +1 -1
- package/dist/orchestration/agent-tool-schemas.js.map +1 -1
- package/dist/orchestration/bridge.d.ts.map +1 -1
- package/dist/orchestration/bridge.js +2 -1
- package/dist/orchestration/bridge.js.map +1 -1
- package/dist/orchestration/response-errors.d.ts.map +1 -1
- package/dist/orchestration/response-errors.js +2 -0
- package/dist/orchestration/response-errors.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +10 -1
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +23 -3
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/tasks/driver.d.ts.map +1 -1
- package/dist/orchestration/tasks/driver.js +19 -1
- package/dist/orchestration/tasks/driver.js.map +1 -1
- package/dist/orchestration/tasks/service.d.ts +25 -2
- package/dist/orchestration/tasks/service.d.ts.map +1 -1
- package/dist/orchestration/tasks/service.js +45 -4
- package/dist/orchestration/tasks/service.js.map +1 -1
- package/dist/orchestration/types.d.ts +2 -0
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/orchestration/types.js.map +1 -1
- package/dist/processes/listeners.d.ts +41 -0
- package/dist/processes/listeners.d.ts.map +1 -0
- package/dist/processes/listeners.js +140 -0
- package/dist/processes/listeners.js.map +1 -0
- package/dist/processes/start.d.ts +39 -0
- package/dist/processes/start.d.ts.map +1 -0
- package/dist/processes/start.js +208 -0
- package/dist/processes/start.js.map +1 -0
- package/dist/processes/stop.d.ts +37 -0
- package/dist/processes/stop.d.ts.map +1 -0
- package/dist/processes/stop.js +94 -0
- package/dist/processes/stop.js.map +1 -0
- package/dist/session/cwd.d.ts +65 -0
- package/dist/session/cwd.d.ts.map +1 -0
- package/dist/session/cwd.js +24 -0
- package/dist/session/cwd.js.map +1 -0
- package/dist/session/process.d.ts +17 -0
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +58 -3
- package/dist/session/process.js.map +1 -1
- package/dist/session/runtime-profile.d.ts +2 -0
- package/dist/session/runtime-profile.d.ts.map +1 -1
- package/dist/session/runtime-profile.js +1 -0
- package/dist/session/runtime-profile.js.map +1 -1
- package/dist/session/store.d.ts +13 -1
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +50 -4
- package/dist/session/store.js.map +1 -1
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/paths.d.ts +5 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +15 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/result.d.ts +16 -0
- package/dist/utils/result.d.ts.map +1 -0
- package/dist/utils/result.js +8 -0
- package/dist/utils/result.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The working folder of a session, as core code sees it. The files module implements {@link CwdResolver} and the
|
|
3
|
+
* composition root injects it, so session, runner and orchestration code never import a feature module.
|
|
4
|
+
*/
|
|
5
|
+
import type { Result } from '../utils/result';
|
|
6
|
+
/** A session's working folder after it resolved. */
|
|
7
|
+
export interface SessionCwd {
|
|
8
|
+
/** Absolute path as stored on the session. */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Its real path at resolve time: the spawn cwd. */
|
|
11
|
+
dir: string;
|
|
12
|
+
/** The folder's own `.claude/` settings, hooks and `.mcp.json` may load. */
|
|
13
|
+
trusted: boolean;
|
|
14
|
+
/** `dev:ino`, so a folder deleted and recreated at the same path reads as moved. */
|
|
15
|
+
identity: string;
|
|
16
|
+
/** One sentence naming the folder, for the cached orchestration prompt. */
|
|
17
|
+
location: string;
|
|
18
|
+
}
|
|
19
|
+
export type CwdUnavailableReason = 'disabled' | 'not_found' | 'outside_root' | 'not_a_directory' | 'permission_denied' | 'deleting' | 'internal';
|
|
20
|
+
/** Why an agent cannot work in a folder: its process or its workers would not run there. */
|
|
21
|
+
export type CwdUnsupportedReason = 'container' | 'workspace_mode' | 'codex';
|
|
22
|
+
export type CwdFailure = {
|
|
23
|
+
code: 'unavailable';
|
|
24
|
+
reason: CwdUnavailableReason;
|
|
25
|
+
} | {
|
|
26
|
+
code: 'unsupported_agent';
|
|
27
|
+
reason: CwdUnsupportedReason;
|
|
28
|
+
};
|
|
29
|
+
export type CwdResolution = Result<SessionCwd, CwdUnavailableReason>;
|
|
30
|
+
/**
|
|
31
|
+
* What works in a folder: a live or queued `turn`, a process still `spawn`ing, an unfinished `task`, or an idle
|
|
32
|
+
* `session` process still running there. An idle session is reported but does not make a folder busy.
|
|
33
|
+
*/
|
|
34
|
+
export type WorkReason = 'turn' | 'spawn' | 'task' | 'session';
|
|
35
|
+
/** How a session response reports its folder: `missing` once it is gone, `unavailable` when it no longer resolves. */
|
|
36
|
+
export type CwdState = 'available' | 'missing' | 'unavailable';
|
|
37
|
+
export interface CwdResolver {
|
|
38
|
+
/**
|
|
39
|
+
* A client-supplied cwd, absolute or relative to the files root. `invalid` when it is not a path the files API
|
|
40
|
+
* accepts. The root itself resolves to `outside_root`. The value's `path` is what the session stores.
|
|
41
|
+
*/
|
|
42
|
+
parse(raw: unknown): Promise<Result<SessionCwd, CwdUnavailableReason | 'invalid'>>;
|
|
43
|
+
/** Runs again at every spawn and turn, so a folder that moved, left the root or is held fails closed. */
|
|
44
|
+
resolve(path: string): Promise<CwdResolution>;
|
|
45
|
+
/** The location plus, when git answers in time, branch, change count and remote host. For the system prompt. */
|
|
46
|
+
note(cwd: SessionCwd): Promise<string>;
|
|
47
|
+
}
|
|
48
|
+
/** For a gateway built without the files module, and for tests that never bind a folder. */
|
|
49
|
+
export declare const NO_CWD_RESOLVER: CwdResolver;
|
|
50
|
+
/** What a session record says about its folder. */
|
|
51
|
+
export type StoredCwd = {
|
|
52
|
+
kind: 'none';
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'path';
|
|
55
|
+
path: string;
|
|
56
|
+
};
|
|
57
|
+
/** The cwd stored on a session or task, if present. */
|
|
58
|
+
export declare function storedCwd(meta: {
|
|
59
|
+
cwd?: unknown;
|
|
60
|
+
}): StoredCwd;
|
|
61
|
+
/** The send-time error: a turn, spawn or task that cannot run because its folder failed to resolve. */
|
|
62
|
+
export declare function cwdError(failure: CwdFailure): Error;
|
|
63
|
+
/** The uppercase codes a turn answers with 409 when its folder does not resolve. */
|
|
64
|
+
export declare const CWD_SEND_ERRORS: ReadonlySet<string>;
|
|
65
|
+
//# sourceMappingURL=cwd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd.d.ts","sourceRoot":"","sources":["../../src/session/cwd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,WAAW,GACX,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,UAAU,GACV,UAAU,CAAC;AAEf,4FAA4F;AAC5F,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAE5E,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EA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D_RESOLVER = void 0;
|
|
4
|
+
exports.storedCwd = storedCwd;
|
|
5
|
+
exports.cwdError = cwdError;
|
|
6
|
+
/** For a gateway built without the files module, and for tests that never bind a folder. */
|
|
7
|
+
exports.NO_CWD_RESOLVER = {
|
|
8
|
+
parse: async () => ({ ok: false, error: 'disabled' }),
|
|
9
|
+
resolve: async () => ({ ok: false, error: 'disabled' }),
|
|
10
|
+
note: async (cwd) => cwd.location,
|
|
11
|
+
};
|
|
12
|
+
/** The cwd stored on a session or task, if present. */
|
|
13
|
+
function storedCwd(meta) {
|
|
14
|
+
return typeof meta.cwd === 'string' ? { kind: 'path', path: meta.cwd } : { kind: 'none' };
|
|
15
|
+
}
|
|
16
|
+
/** The send-time error: a turn, spawn or task that cannot run because its folder failed to resolve. */
|
|
17
|
+
function cwdError(failure) {
|
|
18
|
+
const code = 'CWD_UNAVAILABLE';
|
|
19
|
+
const message = `Working folder is unavailable (${failure.reason})`;
|
|
20
|
+
return Object.assign(new Error(message), { code, reason: failure.reason });
|
|
21
|
+
}
|
|
22
|
+
/** The uppercase codes a turn answers with 409 when its folder does not resolve. */
|
|
23
|
+
exports.CWD_SEND_ERRORS = new Set(['CWD_UNAVAILABLE', 'SESSION_ID_IN_USE']);
|
|
24
|
+
//# sourceMappingURL=cwd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd.js","sourceRoot":"","sources":["../../src/session/cwd.ts"],"names":[],"mappings":";;;AAuEA,8BAEC;AAGD,4BAIC;AApBD,4FAA4F;AAC/E,QAAA,eAAe,GAAgB;IAC1C,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACrD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACvD,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ;CAClC,CAAC;AAKF,uDAAuD;AACvD,SAAgB,SAAS,CAAC,IAAuB;IAC/C,OAAO,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5F,CAAC;AAED,uGAAuG;AACvG,SAAgB,QAAQ,CAAC,OAAmB;IAC1C,MAAM,IAAI,GAAG,iBAAiB,CAAC;IAC/B,MAAM,OAAO,GAAG,kCAAkC,OAAO,CAAC,MAAM,GAAG,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,oFAAoF;AACvE,QAAA,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,CAAC"}
|
|
@@ -6,6 +6,8 @@ import { RuntimeProfile } from './runtime-profile';
|
|
|
6
6
|
import { AgentConfig, GatewayConfig } from '../types';
|
|
7
7
|
import { type ChatChannelOrApi } from '../history/types';
|
|
8
8
|
import { SessionStore } from './store';
|
|
9
|
+
import { type CwdFailure, type SessionCwd } from './cwd';
|
|
10
|
+
import type { Result } from '../utils/result';
|
|
9
11
|
export declare const MAX_HISTORY_MESSAGES = 50;
|
|
10
12
|
export declare const INTERRUPTED_NO_REPLY_TEXT = "Session was interrupted before I could respond.";
|
|
11
13
|
/**
|
|
@@ -43,6 +45,15 @@ export declare class SessionProcess extends EventEmitter {
|
|
|
43
45
|
/** Backend used to run the subprocess. Set during start(); 'headless' until then. */
|
|
44
46
|
backend: 'pty-shell' | 'headless';
|
|
45
47
|
modelOverride?: string;
|
|
48
|
+
/** Set by the runner for a folder-bound API session. Resolved again at every spawn,
|
|
49
|
+
* crash restarts included, so a missing, escaped or held folder fails the turn
|
|
50
|
+
* instead of running in the agent workspace. */
|
|
51
|
+
cwdSource?: {
|
|
52
|
+
resolve(): Promise<Result<SessionCwd, CwdFailure>>;
|
|
53
|
+
note(cwd: SessionCwd): Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
private boundCwd?;
|
|
56
|
+
private cwdNote?;
|
|
46
57
|
historyLimit: number;
|
|
47
58
|
/** Oversized-request recovery must still shrink an explicit /clear seed window. */
|
|
48
59
|
historyRecoveryActive: boolean;
|
|
@@ -210,6 +221,10 @@ export declare class SessionProcess extends EventEmitter {
|
|
|
210
221
|
private containerLaunch?;
|
|
211
222
|
/** `.sessions/<id>`, once a spawn without a runtime profile has written its mcp-config.json there. */
|
|
212
223
|
private sessionDirPath?;
|
|
224
|
+
/** True when the bound folder no longer resolves to the directory this process runs in, including one recreated at the same path, or when its trust changed (setting sources are fixed at spawn). */
|
|
225
|
+
cwdMoved(): Promise<boolean>;
|
|
226
|
+
/** The real folder a folder-bound process was spawned in; undefined for one that runs in the agent workspace. */
|
|
227
|
+
get cwdDir(): string | undefined;
|
|
213
228
|
/** The appended system prompt never travels on the command line: Windows caps a
|
|
214
229
|
* whole command line at 32767 characters and Linux caps ONE argument at 128 KiB
|
|
215
230
|
* (MAX_ARG_STRLEN), so a large workspace context or skill catalog would fail
|
|
@@ -237,6 +252,8 @@ export declare class SessionProcess extends EventEmitter {
|
|
|
237
252
|
* it is written fresh each spawn to `.sessions/<id>/` (0700) and passed with
|
|
238
253
|
* --append-system-prompt-file. Undefined when isolate mode is off. */
|
|
239
254
|
private writeChatMemoryFile;
|
|
255
|
+
/** A folder-bound session runs in its folder, so the workspace CLAUDE.md is appended instead of discovered. */
|
|
256
|
+
private cwdPersonaPath;
|
|
240
257
|
/** `.sessions/<id>` (0700) for this session's generated spawn files. Recording
|
|
241
258
|
* it as this spawn's directory keeps a stop() of an earlier spawn from removing
|
|
242
259
|
* it at that spawn's exit. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/session/process.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,EAAsB,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,OAAO,EAA4D,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AAOjI,OAAO,EAAE,WAAW,EAAwB,aAAa,EAAE,MAAM,UAAU,CAAC;AAI5E,OAAO,EAAmC,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/session/process.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,EAAsB,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,OAAO,EAA4D,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AAOjI,OAAO,EAAE,WAAW,EAAwB,aAAa,EAAE,MAAM,UAAU,CAAC;AAI5E,OAAO,EAAmC,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAavC,OAAO,EAAY,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG9C,eAAO,MAAM,oBAAoB,KA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G;IACH,kCAAkC,IAAI,OAAO;IAK7C,SAAS,IAAI,OAAO;IAOpB,OAAO,CAAC,WAAW,CAAC,CAAqB;IACnC,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAEvE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAqF5B"}
|
package/dist/session/process.js
CHANGED
|
@@ -71,6 +71,7 @@ const claude_bin_1 = require("./claude-bin");
|
|
|
71
71
|
const claude_settings_1 = require("../config/claude-settings");
|
|
72
72
|
const tool_labels_1 = require("../utils/tool-labels");
|
|
73
73
|
const resolve_1 = require("../connectors/resolve");
|
|
74
|
+
const cwd_1 = require("./cwd");
|
|
74
75
|
const custom_1 = require("../connectors/custom");
|
|
75
76
|
exports.MAX_HISTORY_MESSAGES = 50;
|
|
76
77
|
/**
|
|
@@ -728,6 +729,17 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
728
729
|
return false;
|
|
729
730
|
return [...this.spawnedConnectors.keys()].some(id => name.startsWith(`mcp__${id}__`) && name.length > id.length + 7);
|
|
730
731
|
}
|
|
732
|
+
/** True when the bound folder no longer resolves to the directory this process runs in, including one recreated at the same path, or when its trust changed (setting sources are fixed at spawn). */
|
|
733
|
+
async cwdMoved() {
|
|
734
|
+
if (!this.cwdSource || !this.boundCwd)
|
|
735
|
+
return false;
|
|
736
|
+
const cwd = await this.cwdSource.resolve();
|
|
737
|
+
return !cwd.ok || cwd.value.dir !== this.boundCwd.dir || cwd.value.identity !== this.boundCwd.identity || cwd.value.trusted !== this.boundCwd.trusted;
|
|
738
|
+
}
|
|
739
|
+
/** The real folder a folder-bound process was spawned in; undefined for one that runs in the agent workspace. */
|
|
740
|
+
get cwdDir() {
|
|
741
|
+
return this.boundCwd?.dir;
|
|
742
|
+
}
|
|
731
743
|
/** The appended system prompt never travels on the command line: Windows caps a
|
|
732
744
|
* whole command line at 32767 characters and Linux caps ONE argument at 128 KiB
|
|
733
745
|
* (MAX_ARG_STRLEN), so a large workspace context or skill catalog would fail
|
|
@@ -792,9 +804,17 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
792
804
|
if (this.runtimeProfile || !this.agentConfig.isolateMemory)
|
|
793
805
|
return undefined;
|
|
794
806
|
const file = path.join(this.ensureSessionDir(), 'chat-memory.md');
|
|
795
|
-
|
|
807
|
+
const persona = this.cwdPersonaPath();
|
|
808
|
+
fs.writeFileSync(file, (persona ? fs.readFileSync(persona, 'utf8') + '\n\n' : '') + this.chatMemory(), { mode: 0o600 });
|
|
796
809
|
return file;
|
|
797
810
|
}
|
|
811
|
+
/** A folder-bound session runs in its folder, so the workspace CLAUDE.md is appended instead of discovered. */
|
|
812
|
+
cwdPersonaPath() {
|
|
813
|
+
if (!this.boundCwd)
|
|
814
|
+
return undefined;
|
|
815
|
+
const persona = path.join(this.agentConfig.workspace, 'CLAUDE.md');
|
|
816
|
+
return fs.existsSync(persona) ? persona : undefined;
|
|
817
|
+
}
|
|
798
818
|
/** `.sessions/<id>` (0700) for this session's generated spawn files. Recording
|
|
799
819
|
* it as this spawn's directory keeps a stop() of an earlier spawn from removing
|
|
800
820
|
* it at that spawn's exit. */
|
|
@@ -1101,6 +1121,18 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
1101
1121
|
// Built-in: gateway sessions always run with permissions skipped.
|
|
1102
1122
|
// (The old claude.dangerouslySkipPermissions config is gone.)
|
|
1103
1123
|
args.push('--dangerously-skip-permissions');
|
|
1124
|
+
if (this.boundCwd) {
|
|
1125
|
+
// Skipped permissions would otherwise run an untrusted repo's hooks and .mcp.json.
|
|
1126
|
+
if (!this.boundCwd.trusted)
|
|
1127
|
+
args.push('--setting-sources', 'user');
|
|
1128
|
+
// The persona CLAUDE.md is only discovered from cwd, which is now the bound folder.
|
|
1129
|
+
// Claude Code keeps only the last --append-system-prompt-file, so in isolate mode it rides in the chat memory file.
|
|
1130
|
+
const persona = this.cwdPersonaPath();
|
|
1131
|
+
if (persona && !this.chatMemoryPath)
|
|
1132
|
+
args.push('--append-system-prompt-file', persona);
|
|
1133
|
+
if (this.cwdNote)
|
|
1134
|
+
args.push('--append-system-prompt', this.cwdNote);
|
|
1135
|
+
}
|
|
1104
1136
|
// Isolated memory mode (#601): Claude Code loads the conversation-neutral
|
|
1105
1137
|
// workspace CLAUDE.md itself; this conversation's own USER.md/MEMORY.md
|
|
1106
1138
|
// ride alongside it (see writeChatMemoryFile).
|
|
@@ -1152,6 +1184,17 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
1152
1184
|
if (epoch !== this.spawnEpoch)
|
|
1153
1185
|
return false;
|
|
1154
1186
|
this.spawnContext = { loadedAtSpawn, archivedCount, messageCountAtSpawn };
|
|
1187
|
+
if (this.cwdSource) {
|
|
1188
|
+
const cwd = await this.cwdSource.resolve();
|
|
1189
|
+
if (epoch !== this.spawnEpoch)
|
|
1190
|
+
return false;
|
|
1191
|
+
if (!cwd.ok)
|
|
1192
|
+
throw (0, cwd_1.cwdError)(cwd.error);
|
|
1193
|
+
this.boundCwd = cwd.value;
|
|
1194
|
+
this.cwdNote = await this.cwdSource.note(cwd.value);
|
|
1195
|
+
if (epoch !== this.spawnEpoch)
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1155
1198
|
// Determine if this is a docker-exec app-agent before computing paths
|
|
1156
1199
|
(0, container_1.assertContainerBinding)(this.agentConfig, this.runtimeProfile);
|
|
1157
1200
|
const isAppAgent = this.isContainerAgent();
|
|
@@ -1349,6 +1392,8 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
1349
1392
|
// so a bare `claude` resolves even if the gateway itself was launched with a
|
|
1350
1393
|
// minimal PATH that predates the native-installer migration.
|
|
1351
1394
|
const hardenedPath = (0, claude_bin_1.pathWithNativeBin)();
|
|
1395
|
+
if (this.boundCwd && !fs.existsSync(this.boundCwd.dir))
|
|
1396
|
+
throw (0, cwd_1.cwdError)({ code: 'unavailable', reason: 'not_found' });
|
|
1352
1397
|
const capacityEnabled = Boolean(this.runtimeProfile || this.gatewayConfig.gateway.processLimits || this.gatewayConfig.agents?.some(agent => agent.orchestration?.enabled));
|
|
1353
1398
|
const releaseCapacity = this.runtimeProfile?.capacityReserved ? () => { } : (0, capacity_1.gatewayCapacity)(this.gatewayConfig).acquire(this.runtimeProfile?.role ?? 'legacy', capacityEnabled);
|
|
1354
1399
|
if (!releaseCapacity)
|
|
@@ -1384,7 +1429,7 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
1384
1429
|
...(ptyHeartbeatPath ? { PTY_SHELL_HEARTBEAT_PATH: ptyHeartbeatPath } : {}),
|
|
1385
1430
|
...(ptyStreamSocketPath ? { PTY_SHELL_STREAM_SOCKET: ptyStreamSocketPath } : {}),
|
|
1386
1431
|
}, this.gatewayConfig.gateway.jev),
|
|
1387
|
-
cwd: this.agentConfig.workspace,
|
|
1432
|
+
cwd: this.boundCwd?.dir ?? this.agentConfig.workspace,
|
|
1388
1433
|
...(this.runtimeProfile?.role === 'worker' && (0, process_supervisor_1.processSupervisorSupported)() && (0, process_supervisor_1.workerSpawnDetached)() ? { detached: true } : {}),
|
|
1389
1434
|
windowsHide: true,
|
|
1390
1435
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
@@ -1839,9 +1884,19 @@ class SessionProcess extends events_1.EventEmitter {
|
|
|
1839
1884
|
// hint. This is the exact failure the binary-resolution work targets.
|
|
1840
1885
|
this.lastStderrLine = err.message;
|
|
1841
1886
|
this.logger.error('session subprocess error', { error: err.message });
|
|
1842
|
-
if (this.runtimeProfile && !proc.pid) {
|
|
1887
|
+
if (!this.runtimeProfile && !proc.pid && this.boundCwd && err.code === 'ENOENT' && !fs.existsSync(this.boundCwd.dir)) {
|
|
1888
|
+
// The folder vanished after the pre-spawn check; no 'exit' follows a failed spawn, so the waiting turn would hang to its timeout.
|
|
1889
|
+
if (this.process === proc) {
|
|
1890
|
+
this.process = null;
|
|
1891
|
+
this._exited = true;
|
|
1892
|
+
}
|
|
1893
|
+
this.emit('startup-error', (0, cwd_1.cwdError)({ code: 'unavailable', reason: 'not_found' }));
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
if (!proc.pid) {
|
|
1843
1897
|
// Failed spawn emits 'error' and 'close', but never 'exit'. Clear the
|
|
1844
1898
|
// nonexistent child before listeners call stop(), or cleanup waits forever.
|
|
1899
|
+
// Legacy sessions need the event too: the waiting turn holds its project until it hears of the failure.
|
|
1845
1900
|
if (this.process === proc) {
|
|
1846
1901
|
this.process = null;
|
|
1847
1902
|
this._exited = true;
|