@bastani/atomic 0.9.80-alpha.1 → 0.9.80
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 +20 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +10 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/core/storage/session/released-history-files.d.ts.map +1 -1
- package/dist/core/storage/session/released-history-files.js +5 -0
- package/dist/core/storage/session/released-history-files.js.map +1 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.80] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
Embedding apps can pick storage adapters by package name, the UI shows less placeholder text, and Atomic no longer briefly locks your folder on Windows after it exits.
|
|
8
|
+
|
|
9
|
+
- **Pick an embedded app's storage adapter by name.** An application that embeds Atomic can select the adapter from its own package by name in settings, flags and environment variables, so the configuration survives reinstalling the app in a different location ([#4678](https://github.com/bastani-inc/atomic/issues/4678), [#4679](https://github.com/bastani-inc/atomic/pull/4679)).
|
|
10
|
+
- **Fewer temporary labels.** Tool and extension message rows no longer show "Loading isolated renderer…" before their first frame, and a running workflow run that was resumed no longer carries a `● resumed` label ([#4681](https://github.com/bastani-inc/atomic/pull/4681), [#4680](https://github.com/bastani-inc/atomic/pull/4680)).
|
|
11
|
+
- **No leftover folder lock on Windows.** Cleaning up released session history no longer holds your working directory open after Atomic exits, so you can delete or rename it right away ([#4655](https://github.com/bastani-inc/atomic/issues/4655), [#4684](https://github.com/bastani-inc/atomic/pull/4684)).
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- A storage `adapter` given as a package name, `<package>` or `<package>/<name>`, now also resolves from the package directories the process was given to load as code, with `--extension <dir>` or the SDK's `additionalExtensionPaths`, before the packages in settings and then the agent directory. An application that embeds Atomic can select the adapter listed in its own package's `storageAdapters` by name in settings, `--storage`, `--storage-file`, `ATOMIC_STORAGE`, `ATOMIC_SESSIONS_STORAGE` and `ATOMIC_WORKFLOWS_JOURNAL`, instead of an absolute module path that breaks when the application is reinstalled elsewhere. Local workflow workers, child workflow processes and the Intercom broker receive the resolved module, so they open the same storage without loading that package ([#4678](https://github.com/bastani-inc/atomic/issues/4678))
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- On Windows, the background check that cleans up released session history no longer starts PowerShell in your working directory, so it can no longer keep that folder locked for a moment after Atomic exits ([#4655](https://github.com/bastani-inc/atomic/issues/4655), [#4684](https://github.com/bastani-inc/atomic/pull/4684))
|
|
20
|
+
|
|
21
|
+
### Removed
|
|
22
|
+
|
|
23
|
+
- Removed the "Loading isolated renderer…" line that appeared in a tool result or extension message row until the interactive engine drew it. The row now draws nothing until its first frame arrives, like other engine-drawn components ([#4681](https://github.com/bastani-inc/atomic/pull/4681)).
|
|
24
|
+
|
|
5
25
|
## [0.9.80-alpha.1] - 2026-11-12
|
|
6
26
|
|
|
7
27
|
Storage adapters by package name for embedding apps, and less placeholder text in the UI.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.80
|
|
3
|
+
"version": "0.9.80",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.80
|
|
3
|
+
"version": "0.9.80",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.80
|
|
3
|
+
"version": "0.9.80",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.80] - 2026-11-12
|
|
10
|
+
|
|
11
|
+
Resumed workflow runs look like every other run.
|
|
12
|
+
|
|
13
|
+
- **No `● resumed` label.** A resumed run that is running shows the same status as any other running run, so the graph, widget and pickers stay uncluttered ([#4680](https://github.com/bastani-inc/atomic/pull/4680)).
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
- Removed the `● resumed` label from a resumed workflow run. A resumed run that is running looks like any other running run in the graph header, the widget, `/workflow status`, the `/workflow connect` picker, and the stage switcher; `↑ blocked`, `❚❚ paused`, and `○ quit` are unchanged ([#4680](https://github.com/bastani-inc/atomic/pull/4680)).
|
|
18
|
+
|
|
9
19
|
## [0.9.80-alpha.1] - 2026-11-12
|
|
10
20
|
|
|
11
21
|
### Removed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"released-history-files.d.ts","sourceRoot":"","sources":["../../../../src/core/storage/session/released-history-files.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAA2B,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAW9F,qHAAqH;AACrH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjE;
|
|
1
|
+
{"version":3,"file":"released-history-files.d.ts","sourceRoot":"","sources":["../../../../src/core/storage/session/released-history-files.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAA2B,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAW9F,qHAAqH;AACrH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjE;AAsKD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB1E;AAKD,oGAAoG;AACpG,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI/D;AAwKD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAwB1E"}
|
|
@@ -121,10 +121,15 @@ async function processStartTime(pid) {
|
|
|
121
121
|
return null;
|
|
122
122
|
return output.stdout.replace(/[^A-Za-z0-9]+/g, "");
|
|
123
123
|
}
|
|
124
|
+
/** Neutral working directory so background OS probes never hold a handle on the caller's cwd (#4655). */
|
|
125
|
+
function probeWorkingDirectory() {
|
|
126
|
+
return process.platform === "win32" ? process.env.SystemRoot || process.env.windir || "C:\\Windows" : "/";
|
|
127
|
+
}
|
|
124
128
|
/** Runs a short command; `ran` is false when it could not be started or did not finish in time. */
|
|
125
129
|
function run(command, args, env) {
|
|
126
130
|
return new Promise((resolve) => {
|
|
127
131
|
execFile(command, args, {
|
|
132
|
+
cwd: probeWorkingDirectory(),
|
|
128
133
|
encoding: "utf8",
|
|
129
134
|
timeout: START_TIME_TIMEOUT_MS,
|
|
130
135
|
windowsHide: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"released-history-files.js","sourceRoot":"","sources":["../../../../src/core/storage/session/released-history-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAA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AI,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,MAAM;YACX,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACjD,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACpD,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO;QACN,KAAK,CAAC,eAAe;YACpB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAChD,IAAI,MAAM,YAAY,iBAAiB;gBAAE,OAAO,MAAM,CAAC;YACvD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC;gBACJ,4GAA4G;gBAC5G,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,iBAAiB,CAC3B,mBAAmB,EACnB,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,EAC/C,EAAE,KAAK,EAAE,CACT,CAAC;YACH,CAAC;YACD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,WAAW;YACjB,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { execFile } from \"node:child_process\";\nimport { createHash, randomBytes } from \"node:crypto\";\nimport { constants, readFileSync, readlinkSync, rmdirSync, rmSync } from \"node:fs\";\nimport { copyFile, mkdir, open, readdir, readFile, rename, rm, rmdir } from \"node:fs/promises\";\nimport { hostname, release } from \"node:os\";\nimport { join } from \"node:path\";\nimport { BroadcastChannel, isMainThread, receiveMessageOnPort } from \"node:worker_threads\";\nimport { getErrnoCode } from \"../../tools/errno.ts\";\nimport {\n\tSESSION_TEMP_DIR_MODE,\n\tSESSION_TEMP_FILE_MODE,\n\tsanitizeTempPathComponent,\n} from \"../../tools/session-temp-dir.ts\";\nimport { powershellCandidates } from \"../../tools/windows-directory-security.ts\";\nimport { SessionSpillError } from \"../errors.js\";\nimport type { SessionHistoryDirectory, SessionHistoryFiles } from \"./memory-session-store.js\";\n\n/** The start time recorded for a process whose start time could not be told. */\nconst UNKNOWN_START = \"unknown\";\n/** A process directory's pid/start owner and optional instance nonce; old nonce-free names remain sweepable. */\nconst PROCESS_DIRECTORY_NAME = /^([1-9][0-9]*)-([A-Za-z0-9]+)(?:-[a-f0-9]{32})?$/;\n/** Generated once for this owner, not per store: even identical pid/start pairs must never share exit cleanup. */\nconst PROCESS_NONCE = randomBytes(16).toString(\"hex\");\n/** How long a lookup of a process's start time may take before it counts as one that cannot tell. */\nconst START_TIME_TIMEOUT_MS = 30_000;\n\n/** Where released sessions' history is kept under an agent directory: a directory per host, then one per process. */\nexport function releasedHistoryDirectory(agentDir: string): string {\n\treturn join(agentDir, \"released-history\");\n}\n\nlet identity: Promise<string | undefined> | undefined;\n\n/** A boot and PID namespace in which a pid/start-time pair identifies the same owner for every reader. */\nfunction namespaceIdentity(): Promise<string | undefined> {\n\tidentity ??= (async () => {\n\t\tif (process.platform === \"linux\") {\n\t\t\ttry {\n\t\t\t\tconst ownNamespace = readlinkSync(\"/proc/self/ns/pid\");\n\t\t\t\t// NSpid lists IDs from the proc mount's namespace down to ours. More than one means a foreign view,\n\t\t\t\t// even if the numeric IDs happen to coincide. Missing/unreadable status is not proof of a matching view.\n\t\t\t\tconst status = readFileSync(\"/proc/self/status\", \"utf8\");\n\t\t\t\tconst procPid = /^NSpid:[ \\t]+([0-9]+)[ \\t]*$/m.exec(status);\n\t\t\t\tif (procPid?.[1] !== String(process.pid)) return undefined;\n\t\t\t\tconst namespace = /^pid:\\[([0-9]+)\\]$/.exec(ownNamespace);\n\t\t\t\tconst boot = readFileSync(\"/proc/sys/kernel/random/boot_id\", \"utf8\").trim();\n\t\t\t\tif (namespace === null || boot.length === 0) return undefined;\n\t\t\t\treturn `linux-${namespace[1]}-${boot}`;\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (process.platform === \"darwin\") {\n\t\t\tconst boot = await run(\"sysctl\", [\"-n\", \"kern.boottime\"]);\n\t\t\tconst seconds = /sec = ([0-9]+), usec = ([0-9]+)/.exec(boot.stdout);\n\t\t\treturn boot.ran && boot.exitCode === 0 && seconds !== null\n\t\t\t\t? `darwin-${release()}-${seconds[1]}-${seconds[2]}`\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (process.platform === \"win32\") {\n\t\t\tfor (const executable of powershellCandidates()) {\n\t\t\t\tconst boot = await run(executable, [\n\t\t\t\t\t\"-NoProfile\",\n\t\t\t\t\t\"-NonInteractive\",\n\t\t\t\t\t\"-Command\",\n\t\t\t\t\t\"(Get-CimInstance Win32_OperatingSystem -ErrorAction Stop).LastBootUpTime.ToFileTimeUtc()\",\n\t\t\t\t]);\n\t\t\t\tif (boot.ran)\n\t\t\t\t\treturn boot.exitCode === 0 && /^[0-9]+$/.test(boot.stdout)\n\t\t\t\t\t\t? `win32-${release()}-${boot.stdout}`\n\t\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t})();\n\treturn identity;\n}\n\nasync function hostDirectory(agentDir: string): Promise<string> {\n\t// An unknown identity is never swept; the process-directory nonce still isolates owners with identical PIDs.\n\tconst key = (await namespaceIdentity()) ?? `${process.platform}-unknown-${process.pid}-${await ownStartTime()}`;\n\tconst host = hostname();\n\t// Hash the complete identity: truncating a long hostname must not drop the namespace or boot from the key.\n\tconst digest = createHash(\"sha256\")\n\t\t.update(JSON.stringify([host, key]))\n\t\t.digest(\"hex\");\n\treturn join(releasedHistoryDirectory(agentDir), `${sanitizeTempPathComponent(host, \"host\")}-${digest}`);\n}\n\n/**\n * When process `pid` started, as a token only ever compared with another reading of it: undefined when no process has\n * that pid, null when this platform, or that process, cannot tell.\n */\nasync function processStartTime(pid: number): Promise<string | null | undefined> {\n\tif (process.platform === \"linux\") {\n\t\tif ((await namespaceIdentity()) === undefined) return null;\n\t\ttry {\n\t\t\t// Clock ticks from boot to the process's start. `/proc` is answered by the kernel, never from a disk.\n\t\t\tconst stat = readFileSync(`/proc/${pid}/stat`, \"utf8\");\n\t\t\tconst start = stat.slice(stat.lastIndexOf(\")\") + 2).split(\" \")[19];\n\t\t\treturn start !== undefined && /^[0-9]+$/.test(start) ? start : null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tfor (const executable of powershellCandidates()) {\n\t\t\tconst output = await run(executable, [\n\t\t\t\t\"-NoProfile\",\n\t\t\t\t\"-NonInteractive\",\n\t\t\t\t\"-Command\",\n\t\t\t\t`(Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToFileTimeUtc()`,\n\t\t\t]);\n\t\t\tif (output.ran) return output.exitCode === 0 && /^[0-9]+$/.test(output.stdout) ? output.stdout : null;\n\t\t}\n\t\treturn null;\n\t}\n\tconst output = await run(\"ps\", [\"-o\", \"lstart=\", \"-p\", String(pid)], { LC_ALL: \"C\", TZ: \"UTC\" });\n\tif (!output.ran) return null;\n\t// An unsuccessful or malformed lookup cannot establish that an owner has been replaced.\n\tif (output.exitCode === 1 && output.stdout.length === 0) return undefined;\n\tif (\n\t\toutput.exitCode !== 0 ||\n\t\t!/^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ \\t]+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[ \\t]+[0-9]{1,2}[ \\t]+[0-9]{2}:[0-9]{2}:[0-9]{2}[ \\t]+[0-9]{4}$/.test(\n\t\t\toutput.stdout,\n\t\t)\n\t)\n\t\treturn null;\n\treturn output.stdout.replace(/[^A-Za-z0-9]+/g, \"\");\n}\n\n/** Runs a short command; `ran` is false when it could not be started or did not finish in time. */\nfunction run(\n\tcommand: string,\n\targs: readonly string[],\n\tenv?: NodeJS.ProcessEnv,\n): Promise<{ readonly ran: boolean; readonly exitCode: number; readonly stdout: string }> {\n\treturn new Promise((resolve) => {\n\t\texecFile(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t\ttimeout: START_TIME_TIMEOUT_MS,\n\t\t\t\twindowsHide: true,\n\t\t\t\t...(env === undefined ? {} : { env: { ...process.env, ...env } }),\n\t\t\t},\n\t\t\t(error, stdout) => {\n\t\t\t\tconst exitCode = (error as { readonly code?: unknown } | null)?.code;\n\t\t\t\tresolve({\n\t\t\t\t\tran: error === null || (typeof exitCode === \"number\" && error.killed !== true),\n\t\t\t\t\texitCode: typeof exitCode === \"number\" ? exitCode : 0,\n\t\t\t\t\tstdout: stdout.trim(),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t});\n}\n\nlet ownStart: Promise<string> | undefined;\n\n/** This process's start time, read once for the process; {@link UNKNOWN_START} when it cannot be told. */\nfunction ownStartTime(): Promise<string> {\n\townStart ??= processStartTime(process.pid).then((start) => start ?? UNKNOWN_START);\n\treturn ownStart;\n}\n\n/** Whether a process has `pid`; only ESRCH proves absence, and permission failures remain unknown. */\nfunction processExists(pid: number): boolean | undefined {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn getErrnoCode(error) === \"ESRCH\" ? false : undefined;\n\t}\n}\n\n/**\n * Whether the process that created the directory named for `pid` and `start` may still run: a process has that pid\n * and started at that time, or has that pid and one of the two start times cannot be told.\n */\nasync function ownerMayRun(pid: number, start: string): Promise<boolean> {\n\tconst exists = processExists(pid);\n\tif (exists === false) return false;\n\tif (exists === undefined) return true;\n\tconst current = pid === process.pid ? await ownStartTime() : await processStartTime(pid);\n\treturn current == null || current === UNKNOWN_START || start === UNKNOWN_START || current === start;\n}\n\n/**\n * Removes the directories that processes on this host left under `agentDir` when they ended without removing them,\n * such as one killed with SIGKILL: those whose pid no process has, or has with another start time. A directory whose\n * process may still run is kept, and so is anything this module does not create. Never rejects: what cannot be removed\n * now is left to the next sweep.\n */\nexport async function sweepReleasedHistory(agentDir: string): Promise<void> {\n\tif ((await namespaceIdentity()) === undefined) return;\n\tconst host = await hostDirectory(agentDir);\n\tlet names: string[];\n\ttry {\n\t\tnames = await readdir(host);\n\t} catch {\n\t\treturn;\n\t}\n\tawait Promise.all(\n\t\tnames.map(async (name) => {\n\t\t\tconst owner = PROCESS_DIRECTORY_NAME.exec(name);\n\t\t\tif (owner === null || (await ownerMayRun(Number(owner[1]), owner[2] as string))) return;\n\t\t\tawait rm(join(host, name), { recursive: true, force: true }).catch(() => undefined);\n\t\t}),\n\t);\n}\n\n/** Agent directories this process has swept, or is sweeping. */\nconst swept = new Set<string>();\n\n/** Sweeps `agentDir` in the background, once for this process; see {@link sweepReleasedHistory}. */\nexport function sweepReleasedHistoryOnce(agentDir: string): void {\n\tif (swept.has(agentDir)) return;\n\tswept.add(agentDir);\n\tvoid sweepReleasedHistory(agentDir);\n}\n\n/** Each agent directory's process directory, once this thread has created it. */\nconst processDirectories = new Map<string, Promise<string | SessionSpillError>>();\n/** Process directories this thread created a store's directory in. */\nconst usedProcessDirectories = new Set<string>();\n/** Store directories this thread created and has not removed. */\nconst openDirectories = new Set<string>();\n\n/** The process directory under `agentDir`, created once; one that could not be created is tried again next time. */\nfunction processDirectory(agentDir: string): Promise<string | SessionSpillError> {\n\tlet directory = processDirectories.get(agentDir);\n\tif (directory === undefined) {\n\t\tconst creating = createProcessDirectory(agentDir).then((created) => {\n\t\t\tif (created instanceof SessionSpillError) processDirectories.delete(agentDir);\n\t\t\treturn created;\n\t\t});\n\t\tprocessDirectories.set(agentDir, creating);\n\t\tdirectory = creating;\n\t}\n\treturn directory;\n}\n\nasync function createProcessDirectory(agentDir: string): Promise<string | SessionSpillError> {\n\tconst path = join(await hostDirectory(agentDir), `${process.pid}-${await ownStartTime()}-${PROCESS_NONCE}`);\n\ttry {\n\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t} catch (cause) {\n\t\treturn new SessionSpillError(\"spill-dir-refused\", { directory: path, errno: getErrnoCode(cause) }, { cause });\n\t}\n\tusedProcessDirectories.add(path);\n\tif (!isMainThread) registry.postMessage({ directory: path });\n\tremoveAtExit();\n\treturn path;\n}\n\nlet exitCleanupInstalled = false;\n\n/** Process-local, including workers whose main thread owns no store. Registration never delays a release. */\nconst registry = new BroadcastChannel(\"atomic-released-history-directories\");\nregistry.unref();\nif (isMainThread) {\n\tregistry.onmessage = ({ data }) => registerWorkerDirectory(data);\n\tremoveAtExit();\n\tregistry.postMessage({ announce: true });\n} else {\n\tregistry.onmessage = ({ data }) => {\n\t\tif (data.announce === true) for (const directory of usedProcessDirectories) registry.postMessage({ directory });\n\t};\n}\n\nfunction registerWorkerDirectory(data: { readonly directory?: string }): void {\n\tif (typeof data.directory !== \"string\") return;\n\tusedProcessDirectories.add(data.directory);\n\tregistry.postMessage({ registered: data.directory });\n}\n\nfunction removeAtExit(): void {\n\tif (exitCleanupInstalled) return;\n\texitCleanupInstalled = true;\n\tprocess.once(\"exit\", removeDirectories);\n}\n\n/**\n * Removes at once what this thread keeps on disk, as it exits. Main removes only the nonce-bearing directories\n * created by itself or registered workers; a worker thread removes its own stores' directories.\n */\nfunction removeDirectories(): void {\n\tif (isMainThread) {\n\t\t// A worker can report readiness on its parent port before this channel's event callback runs.\n\t\t// Node and Bun accept BroadcastChannel here; Bun's declaration still only lists MessagePort.\n\t\tconst port = registry as unknown as Parameters<typeof receiveMessageOnPort>[0];\n\t\tfor (let message = receiveMessageOnPort(port); message !== undefined; message = receiveMessageOnPort(port))\n\t\t\tregisterWorkerDirectory(message.message);\n\t}\n\tfor (const path of isMainThread ? usedProcessDirectories : openDirectories) {\n\t\ttry {\n\t\t\trmSync(path, { recursive: true, force: true });\n\t\t} catch {\n\t\t\t// Nothing can report it while the thread ends; the next sweep removes what is left once the process is gone.\n\t\t}\n\t}\n\topenDirectories.clear();\n\tif (isMainThread) return;\n\tfor (const path of usedProcessDirectories) {\n\t\ttry {\n\t\t\trmdirSync(path);\n\t\t} catch {\n\t\t\t// Another thread's stores are still in it.\n\t\t}\n\t}\n}\n\n/** A store's directory is gone; once this thread has none, its process directory goes too, unless a thread uses it. */\nasync function closed(path: string): Promise<void> {\n\topenDirectories.delete(path);\n\tif (openDirectories.size > 0) return;\n\tfor (const directory of usedProcessDirectories) await rmdir(directory).catch(() => undefined);\n}\n\n/** Writes `data` at `position` of the file at `path`, creating the file when `position` is 0. */\nasync function writeAt(path: string, data: Uint8Array, position: number): Promise<void> {\n\tconst handle = await open(path, position === 0 ? \"w\" : \"r+\", SESSION_TEMP_FILE_MODE);\n\tlet failure: unknown;\n\ttry {\n\t\tfor (let written = 0; written < data.byteLength; ) {\n\t\t\tconst { bytesWritten } = await handle.write(data, written, data.byteLength - written, position + written);\n\t\t\twritten += bytesWritten;\n\t\t}\n\t} catch (error) {\n\t\tfailure = error;\n\t}\n\ttry {\n\t\tawait handle.close();\n\t} catch (closeFailure) {\n\t\tif (failure === undefined) throw closeFailure;\n\t\tif (failure instanceof Error) Object.defineProperty(failure, \"cleanupCause\", { value: closeFailure });\n\t}\n\tif (failure !== undefined) throw failure;\n}\n\n/**\n * Writes the file at `path` whole, a copy of `previous` followed by `data`, into a file of its own that is renamed to\n * `path` once complete: a write cut short, by a failure or by the process being killed, never leaves part of a file\n * under that name.\n */\nasync function writeWhole(\n\tpath: string,\n\tdata: Uint8Array,\n\tprevious: { readonly path: string; readonly bytes: number } | undefined,\n): Promise<void> {\n\tconst staging = `${path}.partial`;\n\ttry {\n\t\t// FICLONE requests reflinks where supported; Node falls back to a plain copy otherwise.\n\t\tif (previous !== undefined) await copyFile(previous.path, staging, constants.COPYFILE_FICLONE);\n\t\tawait writeAt(staging, data, previous?.bytes ?? 0);\n\t\tawait rename(staging, path);\n\t} catch (error) {\n\t\tawait rm(staging, { force: true }).catch(() => undefined);\n\t\tthrow error;\n\t}\n}\n\nfunction historyDirectory(path: string): SessionHistoryDirectory {\n\tconst fileAt = (file: number) => join(path, String(file));\n\treturn {\n\t\tpath,\n\t\tasync write(file, data, previous) {\n\t\t\tconst before = previous === undefined ? undefined : { path: fileAt(previous.file), bytes: previous.bytes };\n\t\t\ttry {\n\t\t\t\tawait writeWhole(fileAt(file), data, before);\n\t\t\t} catch (error) {\n\t\t\t\tif (getErrnoCode(error) !== \"ENOENT\") throw error;\n\t\t\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t\t\t\tawait writeWhole(fileAt(file), data, before);\n\t\t\t}\n\t\t},\n\t\tread: (file) => readFile(fileAt(file)),\n\t\tasync removeFile(file) {\n\t\t\tawait rm(fileAt(file), { force: true });\n\t\t},\n\t\tasync remove() {\n\t\t\tawait rm(path, { recursive: true, force: true });\n\t\t\tawait closed(path);\n\t\t},\n\t};\n}\n\n/**\n * Released sessions' history in `<agentDir>/released-history/<host-identity>/<pid>-<start>-<nonce>/`: host identity includes\n * hostname, platform, boot, and Linux PID namespace. Store directories/files are owner-only (0700/0600) on POSIX;\n * Windows inherits the agent directory's ACL. The last handle closing removes its store directory. Main-thread exit\n * removes registered worker directories too, even after terminate(); worker-only SDK imports cannot install main\n * cleanup. Normal worker exit removes its stores. A matching namespace/boot's next startup sweeps killed owners;\n * uncertain identities and owners are always kept.\n */\nexport function releasedHistoryFiles(agentDir: string): SessionHistoryFiles {\n\tsweepReleasedHistoryOnce(agentDir);\n\treturn {\n\t\tasync createDirectory() {\n\t\t\tconst parent = await processDirectory(agentDir);\n\t\t\tif (parent instanceof SessionSpillError) return parent;\n\t\t\tconst path = join(parent, randomBytes(6).toString(\"hex\"));\n\t\t\ttry {\n\t\t\t\t// Recursive: the process directory goes when this thread's last store closes, and comes back with the next.\n\t\t\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t\t\t} catch (cause) {\n\t\t\t\treturn new SessionSpillError(\n\t\t\t\t\t\"spill-dir-refused\",\n\t\t\t\t\t{ directory: path, errno: getErrnoCode(cause) },\n\t\t\t\t\t{ cause },\n\t\t\t\t);\n\t\t\t}\n\t\t\topenDirectories.add(path);\n\t\t\treturn historyDirectory(path);\n\t\t},\n\t\treport(degradation) {\n\t\t\tprocess.emitWarning(degradation);\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"released-history-files.js","sourceRoot":"","sources":["../../../../src/core/storage/session/released-history-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACN,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,i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,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO;QACN,KAAK,CAAC,eAAe;YACpB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAChD,IAAI,MAAM,YAAY,iBAAiB;gBAAE,OAAO,MAAM,CAAC;YACvD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC;gBACJ,4GAA4G;gBAC5G,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,iBAAiB,CAC3B,mBAAmB,EACnB,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,EAC/C,EAAE,KAAK,EAAE,CACT,CAAC;YACH,CAAC;YACD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,WAAW;YACjB,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { execFile } from \"node:child_process\";\nimport { createHash, randomBytes } from \"node:crypto\";\nimport { constants, readFileSync, readlinkSync, rmdirSync, rmSync } from \"node:fs\";\nimport { copyFile, mkdir, open, readdir, readFile, rename, rm, rmdir } from \"node:fs/promises\";\nimport { hostname, release } from \"node:os\";\nimport { join } from \"node:path\";\nimport { BroadcastChannel, isMainThread, receiveMessageOnPort } from \"node:worker_threads\";\nimport { getErrnoCode } from \"../../tools/errno.ts\";\nimport {\n\tSESSION_TEMP_DIR_MODE,\n\tSESSION_TEMP_FILE_MODE,\n\tsanitizeTempPathComponent,\n} from \"../../tools/session-temp-dir.ts\";\nimport { powershellCandidates } from \"../../tools/windows-directory-security.ts\";\nimport { SessionSpillError } from \"../errors.js\";\nimport type { SessionHistoryDirectory, SessionHistoryFiles } from \"./memory-session-store.js\";\n\n/** The start time recorded for a process whose start time could not be told. */\nconst UNKNOWN_START = \"unknown\";\n/** A process directory's pid/start owner and optional instance nonce; old nonce-free names remain sweepable. */\nconst PROCESS_DIRECTORY_NAME = /^([1-9][0-9]*)-([A-Za-z0-9]+)(?:-[a-f0-9]{32})?$/;\n/** Generated once for this owner, not per store: even identical pid/start pairs must never share exit cleanup. */\nconst PROCESS_NONCE = randomBytes(16).toString(\"hex\");\n/** How long a lookup of a process's start time may take before it counts as one that cannot tell. */\nconst START_TIME_TIMEOUT_MS = 30_000;\n\n/** Where released sessions' history is kept under an agent directory: a directory per host, then one per process. */\nexport function releasedHistoryDirectory(agentDir: string): string {\n\treturn join(agentDir, \"released-history\");\n}\n\nlet identity: Promise<string | undefined> | undefined;\n\n/** A boot and PID namespace in which a pid/start-time pair identifies the same owner for every reader. */\nfunction namespaceIdentity(): Promise<string | undefined> {\n\tidentity ??= (async () => {\n\t\tif (process.platform === \"linux\") {\n\t\t\ttry {\n\t\t\t\tconst ownNamespace = readlinkSync(\"/proc/self/ns/pid\");\n\t\t\t\t// NSpid lists IDs from the proc mount's namespace down to ours. More than one means a foreign view,\n\t\t\t\t// even if the numeric IDs happen to coincide. Missing/unreadable status is not proof of a matching view.\n\t\t\t\tconst status = readFileSync(\"/proc/self/status\", \"utf8\");\n\t\t\t\tconst procPid = /^NSpid:[ \\t]+([0-9]+)[ \\t]*$/m.exec(status);\n\t\t\t\tif (procPid?.[1] !== String(process.pid)) return undefined;\n\t\t\t\tconst namespace = /^pid:\\[([0-9]+)\\]$/.exec(ownNamespace);\n\t\t\t\tconst boot = readFileSync(\"/proc/sys/kernel/random/boot_id\", \"utf8\").trim();\n\t\t\t\tif (namespace === null || boot.length === 0) return undefined;\n\t\t\t\treturn `linux-${namespace[1]}-${boot}`;\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (process.platform === \"darwin\") {\n\t\t\tconst boot = await run(\"sysctl\", [\"-n\", \"kern.boottime\"]);\n\t\t\tconst seconds = /sec = ([0-9]+), usec = ([0-9]+)/.exec(boot.stdout);\n\t\t\treturn boot.ran && boot.exitCode === 0 && seconds !== null\n\t\t\t\t? `darwin-${release()}-${seconds[1]}-${seconds[2]}`\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (process.platform === \"win32\") {\n\t\t\tfor (const executable of powershellCandidates()) {\n\t\t\t\tconst boot = await run(executable, [\n\t\t\t\t\t\"-NoProfile\",\n\t\t\t\t\t\"-NonInteractive\",\n\t\t\t\t\t\"-Command\",\n\t\t\t\t\t\"(Get-CimInstance Win32_OperatingSystem -ErrorAction Stop).LastBootUpTime.ToFileTimeUtc()\",\n\t\t\t\t]);\n\t\t\t\tif (boot.ran)\n\t\t\t\t\treturn boot.exitCode === 0 && /^[0-9]+$/.test(boot.stdout)\n\t\t\t\t\t\t? `win32-${release()}-${boot.stdout}`\n\t\t\t\t\t\t: undefined;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t})();\n\treturn identity;\n}\n\nasync function hostDirectory(agentDir: string): Promise<string> {\n\t// An unknown identity is never swept; the process-directory nonce still isolates owners with identical PIDs.\n\tconst key = (await namespaceIdentity()) ?? `${process.platform}-unknown-${process.pid}-${await ownStartTime()}`;\n\tconst host = hostname();\n\t// Hash the complete identity: truncating a long hostname must not drop the namespace or boot from the key.\n\tconst digest = createHash(\"sha256\")\n\t\t.update(JSON.stringify([host, key]))\n\t\t.digest(\"hex\");\n\treturn join(releasedHistoryDirectory(agentDir), `${sanitizeTempPathComponent(host, \"host\")}-${digest}`);\n}\n\n/**\n * When process `pid` started, as a token only ever compared with another reading of it: undefined when no process has\n * that pid, null when this platform, or that process, cannot tell.\n */\nasync function processStartTime(pid: number): Promise<string | null | undefined> {\n\tif (process.platform === \"linux\") {\n\t\tif ((await namespaceIdentity()) === undefined) return null;\n\t\ttry {\n\t\t\t// Clock ticks from boot to the process's start. `/proc` is answered by the kernel, never from a disk.\n\t\t\tconst stat = readFileSync(`/proc/${pid}/stat`, \"utf8\");\n\t\t\tconst start = stat.slice(stat.lastIndexOf(\")\") + 2).split(\" \")[19];\n\t\t\treturn start !== undefined && /^[0-9]+$/.test(start) ? start : null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\tif (process.platform === \"win32\") {\n\t\tfor (const executable of powershellCandidates()) {\n\t\t\tconst output = await run(executable, [\n\t\t\t\t\"-NoProfile\",\n\t\t\t\t\"-NonInteractive\",\n\t\t\t\t\"-Command\",\n\t\t\t\t`(Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToFileTimeUtc()`,\n\t\t\t]);\n\t\t\tif (output.ran) return output.exitCode === 0 && /^[0-9]+$/.test(output.stdout) ? output.stdout : null;\n\t\t}\n\t\treturn null;\n\t}\n\tconst output = await run(\"ps\", [\"-o\", \"lstart=\", \"-p\", String(pid)], { LC_ALL: \"C\", TZ: \"UTC\" });\n\tif (!output.ran) return null;\n\t// An unsuccessful or malformed lookup cannot establish that an owner has been replaced.\n\tif (output.exitCode === 1 && output.stdout.length === 0) return undefined;\n\tif (\n\t\toutput.exitCode !== 0 ||\n\t\t!/^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ \\t]+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[ \\t]+[0-9]{1,2}[ \\t]+[0-9]{2}:[0-9]{2}:[0-9]{2}[ \\t]+[0-9]{4}$/.test(\n\t\t\toutput.stdout,\n\t\t)\n\t)\n\t\treturn null;\n\treturn output.stdout.replace(/[^A-Za-z0-9]+/g, \"\");\n}\n\n/** Neutral working directory so background OS probes never hold a handle on the caller's cwd (#4655). */\nfunction probeWorkingDirectory(): string {\n\treturn process.platform === \"win32\" ? process.env.SystemRoot || process.env.windir || \"C:\\\\Windows\" : \"/\";\n}\n\n/** Runs a short command; `ran` is false when it could not be started or did not finish in time. */\nfunction run(\n\tcommand: string,\n\targs: readonly string[],\n\tenv?: NodeJS.ProcessEnv,\n): Promise<{ readonly ran: boolean; readonly exitCode: number; readonly stdout: string }> {\n\treturn new Promise((resolve) => {\n\t\texecFile(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\t{\n\t\t\t\tcwd: probeWorkingDirectory(),\n\t\t\t\tencoding: \"utf8\",\n\t\t\t\ttimeout: START_TIME_TIMEOUT_MS,\n\t\t\t\twindowsHide: true,\n\t\t\t\t...(env === undefined ? {} : { env: { ...process.env, ...env } }),\n\t\t\t},\n\t\t\t(error, stdout) => {\n\t\t\t\tconst exitCode = (error as { readonly code?: unknown } | null)?.code;\n\t\t\t\tresolve({\n\t\t\t\t\tran: error === null || (typeof exitCode === \"number\" && error.killed !== true),\n\t\t\t\t\texitCode: typeof exitCode === \"number\" ? exitCode : 0,\n\t\t\t\t\tstdout: stdout.trim(),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t});\n}\n\nlet ownStart: Promise<string> | undefined;\n\n/** This process's start time, read once for the process; {@link UNKNOWN_START} when it cannot be told. */\nfunction ownStartTime(): Promise<string> {\n\townStart ??= processStartTime(process.pid).then((start) => start ?? UNKNOWN_START);\n\treturn ownStart;\n}\n\n/** Whether a process has `pid`; only ESRCH proves absence, and permission failures remain unknown. */\nfunction processExists(pid: number): boolean | undefined {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn getErrnoCode(error) === \"ESRCH\" ? false : undefined;\n\t}\n}\n\n/**\n * Whether the process that created the directory named for `pid` and `start` may still run: a process has that pid\n * and started at that time, or has that pid and one of the two start times cannot be told.\n */\nasync function ownerMayRun(pid: number, start: string): Promise<boolean> {\n\tconst exists = processExists(pid);\n\tif (exists === false) return false;\n\tif (exists === undefined) return true;\n\tconst current = pid === process.pid ? await ownStartTime() : await processStartTime(pid);\n\treturn current == null || current === UNKNOWN_START || start === UNKNOWN_START || current === start;\n}\n\n/**\n * Removes the directories that processes on this host left under `agentDir` when they ended without removing them,\n * such as one killed with SIGKILL: those whose pid no process has, or has with another start time. A directory whose\n * process may still run is kept, and so is anything this module does not create. Never rejects: what cannot be removed\n * now is left to the next sweep.\n */\nexport async function sweepReleasedHistory(agentDir: string): Promise<void> {\n\tif ((await namespaceIdentity()) === undefined) return;\n\tconst host = await hostDirectory(agentDir);\n\tlet names: string[];\n\ttry {\n\t\tnames = await readdir(host);\n\t} catch {\n\t\treturn;\n\t}\n\tawait Promise.all(\n\t\tnames.map(async (name) => {\n\t\t\tconst owner = PROCESS_DIRECTORY_NAME.exec(name);\n\t\t\tif (owner === null || (await ownerMayRun(Number(owner[1]), owner[2] as string))) return;\n\t\t\tawait rm(join(host, name), { recursive: true, force: true }).catch(() => undefined);\n\t\t}),\n\t);\n}\n\n/** Agent directories this process has swept, or is sweeping. */\nconst swept = new Set<string>();\n\n/** Sweeps `agentDir` in the background, once for this process; see {@link sweepReleasedHistory}. */\nexport function sweepReleasedHistoryOnce(agentDir: string): void {\n\tif (swept.has(agentDir)) return;\n\tswept.add(agentDir);\n\tvoid sweepReleasedHistory(agentDir);\n}\n\n/** Each agent directory's process directory, once this thread has created it. */\nconst processDirectories = new Map<string, Promise<string | SessionSpillError>>();\n/** Process directories this thread created a store's directory in. */\nconst usedProcessDirectories = new Set<string>();\n/** Store directories this thread created and has not removed. */\nconst openDirectories = new Set<string>();\n\n/** The process directory under `agentDir`, created once; one that could not be created is tried again next time. */\nfunction processDirectory(agentDir: string): Promise<string | SessionSpillError> {\n\tlet directory = processDirectories.get(agentDir);\n\tif (directory === undefined) {\n\t\tconst creating = createProcessDirectory(agentDir).then((created) => {\n\t\t\tif (created instanceof SessionSpillError) processDirectories.delete(agentDir);\n\t\t\treturn created;\n\t\t});\n\t\tprocessDirectories.set(agentDir, creating);\n\t\tdirectory = creating;\n\t}\n\treturn directory;\n}\n\nasync function createProcessDirectory(agentDir: string): Promise<string | SessionSpillError> {\n\tconst path = join(await hostDirectory(agentDir), `${process.pid}-${await ownStartTime()}-${PROCESS_NONCE}`);\n\ttry {\n\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t} catch (cause) {\n\t\treturn new SessionSpillError(\"spill-dir-refused\", { directory: path, errno: getErrnoCode(cause) }, { cause });\n\t}\n\tusedProcessDirectories.add(path);\n\tif (!isMainThread) registry.postMessage({ directory: path });\n\tremoveAtExit();\n\treturn path;\n}\n\nlet exitCleanupInstalled = false;\n\n/** Process-local, including workers whose main thread owns no store. Registration never delays a release. */\nconst registry = new BroadcastChannel(\"atomic-released-history-directories\");\nregistry.unref();\nif (isMainThread) {\n\tregistry.onmessage = ({ data }) => registerWorkerDirectory(data);\n\tremoveAtExit();\n\tregistry.postMessage({ announce: true });\n} else {\n\tregistry.onmessage = ({ data }) => {\n\t\tif (data.announce === true) for (const directory of usedProcessDirectories) registry.postMessage({ directory });\n\t};\n}\n\nfunction registerWorkerDirectory(data: { readonly directory?: string }): void {\n\tif (typeof data.directory !== \"string\") return;\n\tusedProcessDirectories.add(data.directory);\n\tregistry.postMessage({ registered: data.directory });\n}\n\nfunction removeAtExit(): void {\n\tif (exitCleanupInstalled) return;\n\texitCleanupInstalled = true;\n\tprocess.once(\"exit\", removeDirectories);\n}\n\n/**\n * Removes at once what this thread keeps on disk, as it exits. Main removes only the nonce-bearing directories\n * created by itself or registered workers; a worker thread removes its own stores' directories.\n */\nfunction removeDirectories(): void {\n\tif (isMainThread) {\n\t\t// A worker can report readiness on its parent port before this channel's event callback runs.\n\t\t// Node and Bun accept BroadcastChannel here; Bun's declaration still only lists MessagePort.\n\t\tconst port = registry as unknown as Parameters<typeof receiveMessageOnPort>[0];\n\t\tfor (let message = receiveMessageOnPort(port); message !== undefined; message = receiveMessageOnPort(port))\n\t\t\tregisterWorkerDirectory(message.message);\n\t}\n\tfor (const path of isMainThread ? usedProcessDirectories : openDirectories) {\n\t\ttry {\n\t\t\trmSync(path, { recursive: true, force: true });\n\t\t} catch {\n\t\t\t// Nothing can report it while the thread ends; the next sweep removes what is left once the process is gone.\n\t\t}\n\t}\n\topenDirectories.clear();\n\tif (isMainThread) return;\n\tfor (const path of usedProcessDirectories) {\n\t\ttry {\n\t\t\trmdirSync(path);\n\t\t} catch {\n\t\t\t// Another thread's stores are still in it.\n\t\t}\n\t}\n}\n\n/** A store's directory is gone; once this thread has none, its process directory goes too, unless a thread uses it. */\nasync function closed(path: string): Promise<void> {\n\topenDirectories.delete(path);\n\tif (openDirectories.size > 0) return;\n\tfor (const directory of usedProcessDirectories) await rmdir(directory).catch(() => undefined);\n}\n\n/** Writes `data` at `position` of the file at `path`, creating the file when `position` is 0. */\nasync function writeAt(path: string, data: Uint8Array, position: number): Promise<void> {\n\tconst handle = await open(path, position === 0 ? \"w\" : \"r+\", SESSION_TEMP_FILE_MODE);\n\tlet failure: unknown;\n\ttry {\n\t\tfor (let written = 0; written < data.byteLength; ) {\n\t\t\tconst { bytesWritten } = await handle.write(data, written, data.byteLength - written, position + written);\n\t\t\twritten += bytesWritten;\n\t\t}\n\t} catch (error) {\n\t\tfailure = error;\n\t}\n\ttry {\n\t\tawait handle.close();\n\t} catch (closeFailure) {\n\t\tif (failure === undefined) throw closeFailure;\n\t\tif (failure instanceof Error) Object.defineProperty(failure, \"cleanupCause\", { value: closeFailure });\n\t}\n\tif (failure !== undefined) throw failure;\n}\n\n/**\n * Writes the file at `path` whole, a copy of `previous` followed by `data`, into a file of its own that is renamed to\n * `path` once complete: a write cut short, by a failure or by the process being killed, never leaves part of a file\n * under that name.\n */\nasync function writeWhole(\n\tpath: string,\n\tdata: Uint8Array,\n\tprevious: { readonly path: string; readonly bytes: number } | undefined,\n): Promise<void> {\n\tconst staging = `${path}.partial`;\n\ttry {\n\t\t// FICLONE requests reflinks where supported; Node falls back to a plain copy otherwise.\n\t\tif (previous !== undefined) await copyFile(previous.path, staging, constants.COPYFILE_FICLONE);\n\t\tawait writeAt(staging, data, previous?.bytes ?? 0);\n\t\tawait rename(staging, path);\n\t} catch (error) {\n\t\tawait rm(staging, { force: true }).catch(() => undefined);\n\t\tthrow error;\n\t}\n}\n\nfunction historyDirectory(path: string): SessionHistoryDirectory {\n\tconst fileAt = (file: number) => join(path, String(file));\n\treturn {\n\t\tpath,\n\t\tasync write(file, data, previous) {\n\t\t\tconst before = previous === undefined ? undefined : { path: fileAt(previous.file), bytes: previous.bytes };\n\t\t\ttry {\n\t\t\t\tawait writeWhole(fileAt(file), data, before);\n\t\t\t} catch (error) {\n\t\t\t\tif (getErrnoCode(error) !== \"ENOENT\") throw error;\n\t\t\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t\t\t\tawait writeWhole(fileAt(file), data, before);\n\t\t\t}\n\t\t},\n\t\tread: (file) => readFile(fileAt(file)),\n\t\tasync removeFile(file) {\n\t\t\tawait rm(fileAt(file), { force: true });\n\t\t},\n\t\tasync remove() {\n\t\t\tawait rm(path, { recursive: true, force: true });\n\t\t\tawait closed(path);\n\t\t},\n\t};\n}\n\n/**\n * Released sessions' history in `<agentDir>/released-history/<host-identity>/<pid>-<start>-<nonce>/`: host identity includes\n * hostname, platform, boot, and Linux PID namespace. Store directories/files are owner-only (0700/0600) on POSIX;\n * Windows inherits the agent directory's ACL. The last handle closing removes its store directory. Main-thread exit\n * removes registered worker directories too, even after terminate(); worker-only SDK imports cannot install main\n * cleanup. Normal worker exit removes its stores. A matching namespace/boot's next startup sweeps killed owners;\n * uncertain identities and owners are always kept.\n */\nexport function releasedHistoryFiles(agentDir: string): SessionHistoryFiles {\n\tsweepReleasedHistoryOnce(agentDir);\n\treturn {\n\t\tasync createDirectory() {\n\t\t\tconst parent = await processDirectory(agentDir);\n\t\t\tif (parent instanceof SessionSpillError) return parent;\n\t\t\tconst path = join(parent, randomBytes(6).toString(\"hex\"));\n\t\t\ttry {\n\t\t\t\t// Recursive: the process directory goes when this thread's last store closes, and comes back with the next.\n\t\t\t\tawait mkdir(path, { recursive: true, mode: SESSION_TEMP_DIR_MODE });\n\t\t\t} catch (cause) {\n\t\t\t\treturn new SessionSpillError(\n\t\t\t\t\t\"spill-dir-refused\",\n\t\t\t\t\t{ directory: path, errno: getErrnoCode(cause) },\n\t\t\t\t\t{ cause },\n\t\t\t\t);\n\t\t\t}\n\t\t\topenDirectories.add(path);\n\t\t\treturn historyDirectory(path);\n\t\t},\n\t\treport(degradation) {\n\t\t\tprocess.emitWarning(degradation);\n\t\t},\n\t};\n}\n"]}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.80
|
|
3
|
+
"version": "0.9.80",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bastani/atomic",
|
|
9
|
-
"version": "0.9.80
|
|
9
|
+
"version": "0.9.80",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bastani/atomic-natives": "0.9.80
|
|
13
|
-
"@bastani/pi-ai": "0.9.80
|
|
12
|
+
"@bastani/atomic-natives": "0.9.80",
|
|
13
|
+
"@bastani/pi-ai": "0.9.80",
|
|
14
14
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
15
15
|
"@earendil-works/pi-codemode": "1.5.2",
|
|
16
16
|
"@earendil-works/pi-tui": "1.5.2",
|
|
@@ -427,18 +427,18 @@
|
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
429
|
"node_modules/@bastani/atomic-natives": {
|
|
430
|
-
"version": "0.9.80
|
|
431
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.80
|
|
430
|
+
"version": "0.9.80",
|
|
431
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.80.tgz",
|
|
432
432
|
"license": "MIT",
|
|
433
433
|
"optionalDependencies": {
|
|
434
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.80
|
|
435
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.80
|
|
436
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.80
|
|
437
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.80
|
|
438
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.80
|
|
439
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.80
|
|
440
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.80
|
|
441
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.80
|
|
434
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.80",
|
|
435
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.80",
|
|
436
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.80",
|
|
437
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.80",
|
|
438
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.80",
|
|
439
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.80",
|
|
440
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.80",
|
|
441
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.80"
|
|
442
442
|
},
|
|
443
443
|
"engines": {
|
|
444
444
|
"bun": ">=1.4.2",
|
|
@@ -446,8 +446,8 @@
|
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
"node_modules/@bastani/atomic-natives-darwin-arm64": {
|
|
449
|
-
"version": "0.9.80
|
|
450
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.80
|
|
449
|
+
"version": "0.9.80",
|
|
450
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.80.tgz",
|
|
451
451
|
"license": "MIT",
|
|
452
452
|
"os": [
|
|
453
453
|
"darwin"
|
|
@@ -458,8 +458,8 @@
|
|
|
458
458
|
"optional": true
|
|
459
459
|
},
|
|
460
460
|
"node_modules/@bastani/atomic-natives-darwin-x64": {
|
|
461
|
-
"version": "0.9.80
|
|
462
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.80
|
|
461
|
+
"version": "0.9.80",
|
|
462
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.80.tgz",
|
|
463
463
|
"license": "MIT",
|
|
464
464
|
"os": [
|
|
465
465
|
"darwin"
|
|
@@ -470,8 +470,8 @@
|
|
|
470
470
|
"optional": true
|
|
471
471
|
},
|
|
472
472
|
"node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
|
|
473
|
-
"version": "0.9.80
|
|
474
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.80
|
|
473
|
+
"version": "0.9.80",
|
|
474
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.80.tgz",
|
|
475
475
|
"license": "MIT",
|
|
476
476
|
"os": [
|
|
477
477
|
"linux"
|
|
@@ -485,8 +485,8 @@
|
|
|
485
485
|
"optional": true
|
|
486
486
|
},
|
|
487
487
|
"node_modules/@bastani/atomic-natives-linux-arm64-musl": {
|
|
488
|
-
"version": "0.9.80
|
|
489
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.80
|
|
488
|
+
"version": "0.9.80",
|
|
489
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.80.tgz",
|
|
490
490
|
"license": "MIT",
|
|
491
491
|
"os": [
|
|
492
492
|
"linux"
|
|
@@ -500,8 +500,8 @@
|
|
|
500
500
|
"optional": true
|
|
501
501
|
},
|
|
502
502
|
"node_modules/@bastani/atomic-natives-linux-x64-gnu": {
|
|
503
|
-
"version": "0.9.80
|
|
504
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.80
|
|
503
|
+
"version": "0.9.80",
|
|
504
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.80.tgz",
|
|
505
505
|
"license": "MIT",
|
|
506
506
|
"os": [
|
|
507
507
|
"linux"
|
|
@@ -515,8 +515,8 @@
|
|
|
515
515
|
"optional": true
|
|
516
516
|
},
|
|
517
517
|
"node_modules/@bastani/atomic-natives-linux-x64-musl": {
|
|
518
|
-
"version": "0.9.80
|
|
519
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.80
|
|
518
|
+
"version": "0.9.80",
|
|
519
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.80.tgz",
|
|
520
520
|
"license": "MIT",
|
|
521
521
|
"os": [
|
|
522
522
|
"linux"
|
|
@@ -530,8 +530,8 @@
|
|
|
530
530
|
"optional": true
|
|
531
531
|
},
|
|
532
532
|
"node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
|
|
533
|
-
"version": "0.9.80
|
|
534
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.80
|
|
533
|
+
"version": "0.9.80",
|
|
534
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.80.tgz",
|
|
535
535
|
"license": "MIT",
|
|
536
536
|
"os": [
|
|
537
537
|
"win32"
|
|
@@ -542,8 +542,8 @@
|
|
|
542
542
|
"optional": true
|
|
543
543
|
},
|
|
544
544
|
"node_modules/@bastani/atomic-natives-win32-x64-msvc": {
|
|
545
|
-
"version": "0.9.80
|
|
546
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.80
|
|
545
|
+
"version": "0.9.80",
|
|
546
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.80.tgz",
|
|
547
547
|
"license": "MIT",
|
|
548
548
|
"os": [
|
|
549
549
|
"win32"
|
|
@@ -554,8 +554,8 @@
|
|
|
554
554
|
"optional": true
|
|
555
555
|
},
|
|
556
556
|
"node_modules/@bastani/pi-ai": {
|
|
557
|
-
"version": "0.9.80
|
|
558
|
-
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.80
|
|
557
|
+
"version": "0.9.80",
|
|
558
|
+
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.80.tgz",
|
|
559
559
|
"license": "MIT",
|
|
560
560
|
"dependencies": {
|
|
561
561
|
"@anthropic-ai/sdk": "0.129.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.80
|
|
3
|
+
"version": "0.9.80",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@bastani/atomic-natives": "0.9.80
|
|
93
|
-
"@bastani/pi-ai": "0.9.80
|
|
92
|
+
"@bastani/atomic-natives": "0.9.80",
|
|
93
|
+
"@bastani/pi-ai": "0.9.80",
|
|
94
94
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
95
95
|
"@earendil-works/pi-codemode": "1.5.2",
|
|
96
96
|
"@earendil-works/pi-tui": "1.5.2",
|