@bastani/atomic 0.9.30-alpha.1 → 0.9.30-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.30-alpha.2] - 2026-10-09
6
+
7
+ ### Fixed
8
+
9
+ - Updated the `music-metadata` dependency used for audio file conversion to 11.16.1, resolving the crafted-file denial-of-service advisories [GHSA-f94x-6692-553q](https://github.com/advisories/GHSA-f94x-6692-553q), [GHSA-5gfj-9q3v-qfp3](https://github.com/advisories/GHSA-5gfj-9q3v-qfp3), and [GHSA-8j4c-6x6g-rq3j](https://github.com/advisories/GHSA-8j4c-6x6g-rq3j).
10
+ - Updated the native module's `anyhow` (1.0.104) and `crossbeam-epoch` (0.9.21) crates, resolving [RUSTSEC-2026-0190](https://rustsec.org/advisories/RUSTSEC-2026-0190) and [RUSTSEC-2026-0204](https://rustsec.org/advisories/RUSTSEC-2026-0204).
11
+ - Fixed no project context file loading in a git worktree nested inside its main repo when the worktree's `AGENTS.md` is a symlink to the main repo's copy ([#10681](https://github.com/earendil-works/pi/issues/10681))
12
+
5
13
  ## [0.9.30-alpha.1] - 2026-10-09
6
14
 
7
15
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
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/mcp",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
4
4
  "private": true,
5
5
  "description": "Atomic's pi-compatible MCP integration for server connections, OAuth, tools, resources, and terminal management.",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
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.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
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": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -1 +1 @@
1
- {"version":3,"file":"resource-loader-context-files.d.ts","sourceRoot":"","sources":["../../src/core/resource-loader-context-files.ts"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAerG;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7F;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAIpF;AAqBD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAgB,GAAG,MAAM,EAAE,CAS/G;AAoED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAyC3C"}
1
+ {"version":3,"file":"resource-loader-context-files.d.ts","sourceRoot":"","sources":["../../src/core/resource-loader-context-files.ts"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAerG;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7F;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAIpF;AAqBD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAgB,GAAG,MAAM,EAAE,CAS/G;AAsED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA2C3C"}
@@ -99,9 +99,11 @@ function isDescendantOf(directory, child) {
99
99
  * occupy the same logical repository scope, so loading both applies that context twice. Returns
100
100
  * undefined when nothing is shadowed, leaving normal ancestor inheritance alone.
101
101
  *
102
- * Returned canonicalized (realpath), because `git worktree add` writes the `.git`
103
- * file's `gitdir:` target in realpath form while cwd may still be symlinked
104
- * (macOS `/tmp` -> `/private/tmp`) or short-named (Windows `RUNNER~1`).
102
+ * Returned as the main repo root's real path joined with the selected file name, not
103
+ * the file's own real path: `git worktree add` writes the `.git` file's `gitdir:` target
104
+ * in realpath form while cwd may still be symlinked (macOS `/tmp` -> `/private/tmp`) or
105
+ * short-named (Windows `RUNNER~1`), and a worktree context file that symlinks to the main
106
+ * repo's copy would otherwise resolve to the shadowed path itself.
105
107
  */
106
108
  function findShadowedContextFile(cwd) {
107
109
  const gitPaths = findGitPaths(cwd);
@@ -127,9 +129,9 @@ function findShadowedContextFile(cwd) {
127
129
  // the main checkout's selected candidate even when the filenames differ.
128
130
  if (basename(worktreeContextFile.path) === "AGENTS.override.md") {
129
131
  const mainRepoContextFile = loadContextFileFromDir(mainRepoRoot);
130
- return mainRepoContextFile ? realPath(mainRepoContextFile.path) : undefined;
132
+ return mainRepoContextFile ? join(mainRepoRoot, basename(mainRepoContextFile.path)) : undefined;
131
133
  }
132
- return realPath(join(mainRepoRoot, basename(worktreeContextFile.path)));
134
+ return join(mainRepoRoot, basename(worktreeContextFile.path));
133
135
  }
134
136
  export function loadProjectContextFiles(options) {
135
137
  const resolvedCwd = resolvePath(options.cwd);
@@ -153,9 +155,11 @@ export function loadProjectContextFiles(options) {
153
155
  const contextFile = loadContextFileFromDir(currentDir);
154
156
  // A nested linked worktree's context file and the main repo's selected copy
155
157
  // occupy one logical repository scope; skip the main repo's copy so it is not loaded twice.
158
+ // Compare the directory's real path, not the file's, so a symlinked context file is not
159
+ // mistaken for the main repo's copy it points to.
156
160
  const isShadowed = shadowedContextFile !== undefined &&
157
161
  contextFile !== null &&
158
- samePath(realPath(contextFile.path), shadowedContextFile);
162
+ samePath(join(realPath(currentDir), basename(contextFile.path)), shadowedContextFile);
159
163
  if (contextFile && !isShadowed && !seenPaths.has(contextFile.path)) {
160
164
  ancestorContextFiles.unshift(contextFile);
161
165
  seenPaths.add(contextFile.path);
@@ -1 +1 @@
1
- {"version":3,"file":"resource-loader-context-files.js","sourceRoot":"","sources":["../../src/core/resource-loader-context-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,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,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAED,MAAM,oBAAoB,GAA6C,EAAE,CAAC;IAC1E,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE,CAAC;QACtC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACjE,KAAK,MAAM,UAAU,IAAI,sBAAsB,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9D,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACvD,4EAA4E;QAC5E,4FAA4F;QAC5F,MAAM,UAAU,GACf,mBAAmB,KAAK,SAAS;YACjC,WAAW,KAAK,IAAI;YACpB,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC3D,IAAI,WAAW,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACpE,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACF,CAAC;IAED,YAAY,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAE3C,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["import { existsSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, sep } from \"node:path\";\nimport chalk from \"chalk\";\nimport { getAgentDir, getAgentDirs } from \"../config.js\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport { findGitPaths } from \"./footer-data-provider.ts\";\n\nexport function resolvePromptInput(input: string | undefined, description: string): string | undefined {\n\tif (!input) {\n\t\treturn undefined;\n\t}\n\n\tif (existsSync(input)) {\n\t\ttry {\n\t\t\treturn stripBom(readFileSync(input, \"utf-8\"));\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.yellow(`Warning: Could not read ${description} file ${input}: ${error}`));\n\t\t\treturn input;\n\t\t}\n\t}\n\n\treturn input;\n}\n\n/**\n * Path of a system-prompt input that is a real file, for startup disclosure.\n * `resolvePromptInput` also accepts literal prompt text, which has no path.\n */\nexport function resolveExistingPromptSourcePath(input: string | undefined): string | undefined {\n\treturn input && existsSync(input) ? resolvePath(input) : undefined;\n}\n\nexport function resolveExistingPromptSourcePaths(inputs: readonly string[]): string[] {\n\treturn inputs\n\t\t.map((input) => resolveExistingPromptSourcePath(input))\n\t\t.filter((path): path is string => path !== undefined);\n}\n\nfunction loadContextFileFromDir(dir: string): { path: string; content: string } | null {\n\tconst candidates = [\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"];\n\tfor (const filename of candidates) {\n\t\tconst filePath = join(dir, filename);\n\t\tif (existsSync(filePath)) {\n\t\t\ttry {\n\t\t\t\tif (!statSync(filePath).isFile()) continue;\n\t\t\t\treturn {\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tcontent: stripBom(readFileSync(filePath, \"utf-8\")),\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(chalk.yellow(`Warning: Could not read ${filePath}: ${error}`));\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function getAncestorDirectories(startDir: string, parentOf: (path: string) => string = dirname): string[] {\n\tconst directories: string[] = [];\n\tlet currentDir = startDir;\n\twhile (true) {\n\t\tdirectories.push(currentDir);\n\t\tconst parentDir = parentOf(currentDir);\n\t\tif (parentDir === currentDir) return directories;\n\t\tcurrentDir = parentDir;\n\t}\n}\n/**\n * Canonical spelling of a path, for comparing one Node derived from `cwd`\n * against one git wrote into a `.git` file.\n *\n * `canonicalizePath` uses `realpathSync`, which resolves symlinks but leaves a\n * Windows 8.3 short component alone — and `os.tmpdir()` on a GitHub Windows\n * runner is exactly that (`C:\\Users\\RUNNER~1\\AppData\\Local\\Temp`). Git records\n * the expanded long form in the `gitdir:` target, so the two spellings of one\n * directory never compared equal and the shadowing guard below silently did\n * nothing on Windows. `realpathSync.native` expands the short component; it is\n * the same pairing `subagents/runs/shared/worktree-root.ts` already relies on.\n */\nfunction realPath(path: string): string {\n\ttry {\n\t\treturn realpathSync.native(path);\n\t} catch {\n\t\treturn canonicalizePath(path);\n\t}\n}\n\n/** Windows compares paths case-insensitively; POSIX does not. */\nfunction samePath(left: string, right: string): boolean {\n\treturn process.platform === \"win32\" ? left.toLowerCase() === right.toLowerCase() : left === right;\n}\n\n/** True when `child` is a strict descendant of `directory`, under the same casing rule. */\nfunction isDescendantOf(directory: string, child: string): boolean {\n\tconst prefix = `${directory}${sep}`;\n\treturn process.platform === \"win32\"\n\t\t? child.toLowerCase().startsWith(prefix.toLowerCase())\n\t\t: child.startsWith(prefix);\n}\n\n/**\n * The main repo's context file that a nested linked worktree's own copy shadows: both\n * occupy the same logical repository scope, so loading both applies that context twice. Returns\n * undefined when nothing is shadowed, leaving normal ancestor inheritance alone.\n *\n * Returned canonicalized (realpath), because `git worktree add` writes the `.git`\n * file's `gitdir:` target in realpath form while cwd may still be symlinked\n * (macOS `/tmp` -> `/private/tmp`) or short-named (Windows `RUNNER~1`).\n */\nfunction findShadowedContextFile(cwd: string): string | undefined {\n\tconst gitPaths = findGitPaths(cwd);\n\tif (!gitPaths) return undefined;\n\tconst commonGitDir = realPath(gitPaths.commonGitDir);\n\tconst worktreeRoot = realPath(gitPaths.repoDir);\n\tconst mainRepoRoot = dirname(commonGitDir);\n\t// False for an ordinary repo, where the two are the same dir, and for a sibling\n\t// worktree (`git worktree add ../feat`), whose main repo is not an ancestor.\n\tif (!isDescendantOf(mainRepoRoot, worktreeRoot)) return undefined;\n\t// dirname of the common git dir is the main worktree root only when that dir is\n\t// itself checked out from the same repo. In a bare layout (`proj/.bare` +\n\t// `proj/main`) it is just the directory holding `.bare`, which tracks nothing; a\n\t// submodule's gitdir has no `commondir`, so it lands under `.git/modules`.\n\tif (!samePath(realPath(join(mainRepoRoot, \".git\")), commonGitDir)) return undefined;\n\tconst worktreeContextFile = loadContextFileFromDir(worktreeRoot);\n\tif (!worktreeContextFile) return undefined;\n\t// An override replaces every context candidate in its directory, so it shadows\n\t// the main checkout's selected candidate even when the filenames differ.\n\tif (basename(worktreeContextFile.path) === \"AGENTS.override.md\") {\n\t\tconst mainRepoContextFile = loadContextFileFromDir(mainRepoRoot);\n\t\treturn mainRepoContextFile ? realPath(mainRepoContextFile.path) : undefined;\n\t}\n\treturn realPath(join(mainRepoRoot, basename(worktreeContextFile.path)));\n}\n\nexport function loadProjectContextFiles(options: {\n\tcwd: string;\n\tagentDir: string;\n\tprojectTrusted?: boolean;\n}): Array<{ path: string; content: string }> {\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(options.agentDir);\n\n\tconst contextFiles: Array<{ path: string; content: string }> = [];\n\tconst seenPaths = new Set<string>();\n\n\tconst contextAgentDirs = Array.from(\n\t\tnew Set(resolvedAgentDir === getAgentDir() ? getAgentDirs() : [resolvedAgentDir]),\n\t).reverse();\n\tfor (const agentDir of contextAgentDirs) {\n\t\tconst context = loadContextFileFromDir(agentDir);\n\t\tif (context && !seenPaths.has(context.path)) {\n\t\t\tcontextFiles.push(context);\n\t\t\tseenPaths.add(context.path);\n\t\t}\n\t}\n\n\tconst ancestorContextFiles: Array<{ path: string; content: string }> = [];\n\tif (options.projectTrusted === false) {\n\t\treturn contextFiles;\n\t}\n\n\tconst shadowedContextFile = findShadowedContextFile(resolvedCwd);\n\tfor (const currentDir of getAncestorDirectories(resolvedCwd)) {\n\t\tconst contextFile = loadContextFileFromDir(currentDir);\n\t\t// A nested linked worktree's context file and the main repo's selected copy\n\t\t// occupy one logical repository scope; skip the main repo's copy so it is not loaded twice.\n\t\tconst isShadowed =\n\t\t\tshadowedContextFile !== undefined &&\n\t\t\tcontextFile !== null &&\n\t\t\tsamePath(realPath(contextFile.path), shadowedContextFile);\n\t\tif (contextFile && !isShadowed && !seenPaths.has(contextFile.path)) {\n\t\t\tancestorContextFiles.unshift(contextFile);\n\t\t\tseenPaths.add(contextFile.path);\n\t\t}\n\t}\n\n\tcontextFiles.push(...ancestorContextFiles);\n\n\treturn contextFiles;\n}\n"]}
1
+ {"version":3,"file":"resource-loader-context-files.js","sourceRoot":"","sources":["../../src/core/resource-loader-context-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,UAAU,kBAAkB,CAAC,KAAyB,EAAE,WAAmB;IAChF,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC;YACJ,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM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,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;QACvF,IAAI,WAAW,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACpE,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1C,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACF,CAAC;IAED,YAAY,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAE3C,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["import { existsSync, readFileSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, dirname, join, sep } from \"node:path\";\nimport chalk from \"chalk\";\nimport { getAgentDir, getAgentDirs } from \"../config.js\";\nimport { canonicalizePath, resolvePath } from \"../utils/paths.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport { findGitPaths } from \"./footer-data-provider.ts\";\n\nexport function resolvePromptInput(input: string | undefined, description: string): string | undefined {\n\tif (!input) {\n\t\treturn undefined;\n\t}\n\n\tif (existsSync(input)) {\n\t\ttry {\n\t\t\treturn stripBom(readFileSync(input, \"utf-8\"));\n\t\t} catch (error) {\n\t\t\tconsole.error(chalk.yellow(`Warning: Could not read ${description} file ${input}: ${error}`));\n\t\t\treturn input;\n\t\t}\n\t}\n\n\treturn input;\n}\n\n/**\n * Path of a system-prompt input that is a real file, for startup disclosure.\n * `resolvePromptInput` also accepts literal prompt text, which has no path.\n */\nexport function resolveExistingPromptSourcePath(input: string | undefined): string | undefined {\n\treturn input && existsSync(input) ? resolvePath(input) : undefined;\n}\n\nexport function resolveExistingPromptSourcePaths(inputs: readonly string[]): string[] {\n\treturn inputs\n\t\t.map((input) => resolveExistingPromptSourcePath(input))\n\t\t.filter((path): path is string => path !== undefined);\n}\n\nfunction loadContextFileFromDir(dir: string): { path: string; content: string } | null {\n\tconst candidates = [\"AGENTS.override.md\", \"AGENTS.md\", \"AGENTS.MD\", \"CLAUDE.md\", \"CLAUDE.MD\"];\n\tfor (const filename of candidates) {\n\t\tconst filePath = join(dir, filename);\n\t\tif (existsSync(filePath)) {\n\t\t\ttry {\n\t\t\t\tif (!statSync(filePath).isFile()) continue;\n\t\t\t\treturn {\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tcontent: stripBom(readFileSync(filePath, \"utf-8\")),\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(chalk.yellow(`Warning: Could not read ${filePath}: ${error}`));\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function getAncestorDirectories(startDir: string, parentOf: (path: string) => string = dirname): string[] {\n\tconst directories: string[] = [];\n\tlet currentDir = startDir;\n\twhile (true) {\n\t\tdirectories.push(currentDir);\n\t\tconst parentDir = parentOf(currentDir);\n\t\tif (parentDir === currentDir) return directories;\n\t\tcurrentDir = parentDir;\n\t}\n}\n/**\n * Canonical spelling of a path, for comparing one Node derived from `cwd`\n * against one git wrote into a `.git` file.\n *\n * `canonicalizePath` uses `realpathSync`, which resolves symlinks but leaves a\n * Windows 8.3 short component alone — and `os.tmpdir()` on a GitHub Windows\n * runner is exactly that (`C:\\Users\\RUNNER~1\\AppData\\Local\\Temp`). Git records\n * the expanded long form in the `gitdir:` target, so the two spellings of one\n * directory never compared equal and the shadowing guard below silently did\n * nothing on Windows. `realpathSync.native` expands the short component; it is\n * the same pairing `subagents/runs/shared/worktree-root.ts` already relies on.\n */\nfunction realPath(path: string): string {\n\ttry {\n\t\treturn realpathSync.native(path);\n\t} catch {\n\t\treturn canonicalizePath(path);\n\t}\n}\n\n/** Windows compares paths case-insensitively; POSIX does not. */\nfunction samePath(left: string, right: string): boolean {\n\treturn process.platform === \"win32\" ? left.toLowerCase() === right.toLowerCase() : left === right;\n}\n\n/** True when `child` is a strict descendant of `directory`, under the same casing rule. */\nfunction isDescendantOf(directory: string, child: string): boolean {\n\tconst prefix = `${directory}${sep}`;\n\treturn process.platform === \"win32\"\n\t\t? child.toLowerCase().startsWith(prefix.toLowerCase())\n\t\t: child.startsWith(prefix);\n}\n\n/**\n * The main repo's context file that a nested linked worktree's own copy shadows: both\n * occupy the same logical repository scope, so loading both applies that context twice. Returns\n * undefined when nothing is shadowed, leaving normal ancestor inheritance alone.\n *\n * Returned as the main repo root's real path joined with the selected file name, not\n * the file's own real path: `git worktree add` writes the `.git` file's `gitdir:` target\n * in realpath form while cwd may still be symlinked (macOS `/tmp` -> `/private/tmp`) or\n * short-named (Windows `RUNNER~1`), and a worktree context file that symlinks to the main\n * repo's copy would otherwise resolve to the shadowed path itself.\n */\nfunction findShadowedContextFile(cwd: string): string | undefined {\n\tconst gitPaths = findGitPaths(cwd);\n\tif (!gitPaths) return undefined;\n\tconst commonGitDir = realPath(gitPaths.commonGitDir);\n\tconst worktreeRoot = realPath(gitPaths.repoDir);\n\tconst mainRepoRoot = dirname(commonGitDir);\n\t// False for an ordinary repo, where the two are the same dir, and for a sibling\n\t// worktree (`git worktree add ../feat`), whose main repo is not an ancestor.\n\tif (!isDescendantOf(mainRepoRoot, worktreeRoot)) return undefined;\n\t// dirname of the common git dir is the main worktree root only when that dir is\n\t// itself checked out from the same repo. In a bare layout (`proj/.bare` +\n\t// `proj/main`) it is just the directory holding `.bare`, which tracks nothing; a\n\t// submodule's gitdir has no `commondir`, so it lands under `.git/modules`.\n\tif (!samePath(realPath(join(mainRepoRoot, \".git\")), commonGitDir)) return undefined;\n\tconst worktreeContextFile = loadContextFileFromDir(worktreeRoot);\n\tif (!worktreeContextFile) return undefined;\n\t// An override replaces every context candidate in its directory, so it shadows\n\t// the main checkout's selected candidate even when the filenames differ.\n\tif (basename(worktreeContextFile.path) === \"AGENTS.override.md\") {\n\t\tconst mainRepoContextFile = loadContextFileFromDir(mainRepoRoot);\n\t\treturn mainRepoContextFile ? join(mainRepoRoot, basename(mainRepoContextFile.path)) : undefined;\n\t}\n\treturn join(mainRepoRoot, basename(worktreeContextFile.path));\n}\n\nexport function loadProjectContextFiles(options: {\n\tcwd: string;\n\tagentDir: string;\n\tprojectTrusted?: boolean;\n}): Array<{ path: string; content: string }> {\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(options.agentDir);\n\n\tconst contextFiles: Array<{ path: string; content: string }> = [];\n\tconst seenPaths = new Set<string>();\n\n\tconst contextAgentDirs = Array.from(\n\t\tnew Set(resolvedAgentDir === getAgentDir() ? getAgentDirs() : [resolvedAgentDir]),\n\t).reverse();\n\tfor (const agentDir of contextAgentDirs) {\n\t\tconst context = loadContextFileFromDir(agentDir);\n\t\tif (context && !seenPaths.has(context.path)) {\n\t\t\tcontextFiles.push(context);\n\t\t\tseenPaths.add(context.path);\n\t\t}\n\t}\n\n\tconst ancestorContextFiles: Array<{ path: string; content: string }> = [];\n\tif (options.projectTrusted === false) {\n\t\treturn contextFiles;\n\t}\n\n\tconst shadowedContextFile = findShadowedContextFile(resolvedCwd);\n\tfor (const currentDir of getAncestorDirectories(resolvedCwd)) {\n\t\tconst contextFile = loadContextFileFromDir(currentDir);\n\t\t// A nested linked worktree's context file and the main repo's selected copy\n\t\t// occupy one logical repository scope; skip the main repo's copy so it is not loaded twice.\n\t\t// Compare the directory's real path, not the file's, so a symlinked context file is not\n\t\t// mistaken for the main repo's copy it points to.\n\t\tconst isShadowed =\n\t\t\tshadowedContextFile !== undefined &&\n\t\t\tcontextFile !== null &&\n\t\t\tsamePath(join(realPath(currentDir), basename(contextFile.path)), shadowedContextFile);\n\t\tif (contextFile && !isShadowed && !seenPaths.has(contextFile.path)) {\n\t\t\tancestorContextFiles.unshift(contextFile);\n\t\t\tseenPaths.add(contextFile.path);\n\t\t}\n\t}\n\n\tcontextFiles.push(...ancestorContextFiles);\n\n\treturn contextFiles;\n}\n"]}
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bastani/atomic",
9
- "version": "0.9.30-alpha.1",
9
+ "version": "0.9.30-alpha.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@bastani/atomic-natives": "0.9.30-alpha.1",
13
- "@bastani/pi-ai": "0.9.30-alpha.1",
12
+ "@bastani/atomic-natives": "0.9.30-alpha.2",
13
+ "@bastani/pi-ai": "0.9.30-alpha.2",
14
14
  "@dbos-inc/dbos-sdk": "4.25.14",
15
15
  "@earendil-works/pi-agent-core": "1.1.0",
16
16
  "@earendil-works/pi-client": "1.1.0",
@@ -432,18 +432,18 @@
432
432
  }
433
433
  },
434
434
  "node_modules/@bastani/atomic-natives": {
435
- "version": "0.9.30-alpha.1",
436
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.30-alpha.1.tgz",
435
+ "version": "0.9.30-alpha.2",
436
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.30-alpha.2.tgz",
437
437
  "license": "MIT",
438
438
  "optionalDependencies": {
439
- "@bastani/atomic-natives-darwin-arm64": "0.9.30-alpha.1",
440
- "@bastani/atomic-natives-darwin-x64": "0.9.30-alpha.1",
441
- "@bastani/atomic-natives-linux-arm64-gnu": "0.9.30-alpha.1",
442
- "@bastani/atomic-natives-linux-arm64-musl": "0.9.30-alpha.1",
443
- "@bastani/atomic-natives-linux-x64-gnu": "0.9.30-alpha.1",
444
- "@bastani/atomic-natives-linux-x64-musl": "0.9.30-alpha.1",
445
- "@bastani/atomic-natives-win32-arm64-msvc": "0.9.30-alpha.1",
446
- "@bastani/atomic-natives-win32-x64-msvc": "0.9.30-alpha.1"
439
+ "@bastani/atomic-natives-darwin-arm64": "0.9.30-alpha.2",
440
+ "@bastani/atomic-natives-darwin-x64": "0.9.30-alpha.2",
441
+ "@bastani/atomic-natives-linux-arm64-gnu": "0.9.30-alpha.2",
442
+ "@bastani/atomic-natives-linux-arm64-musl": "0.9.30-alpha.2",
443
+ "@bastani/atomic-natives-linux-x64-gnu": "0.9.30-alpha.2",
444
+ "@bastani/atomic-natives-linux-x64-musl": "0.9.30-alpha.2",
445
+ "@bastani/atomic-natives-win32-arm64-msvc": "0.9.30-alpha.2",
446
+ "@bastani/atomic-natives-win32-x64-msvc": "0.9.30-alpha.2"
447
447
  },
448
448
  "engines": {
449
449
  "bun": ">=1.4.2",
@@ -451,8 +451,8 @@
451
451
  }
452
452
  },
453
453
  "node_modules/@bastani/atomic-natives-darwin-arm64": {
454
- "version": "0.9.30-alpha.1",
455
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.30-alpha.1.tgz",
454
+ "version": "0.9.30-alpha.2",
455
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.30-alpha.2.tgz",
456
456
  "license": "MIT",
457
457
  "os": [
458
458
  "darwin"
@@ -463,8 +463,8 @@
463
463
  "optional": true
464
464
  },
465
465
  "node_modules/@bastani/atomic-natives-darwin-x64": {
466
- "version": "0.9.30-alpha.1",
467
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.30-alpha.1.tgz",
466
+ "version": "0.9.30-alpha.2",
467
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.30-alpha.2.tgz",
468
468
  "license": "MIT",
469
469
  "os": [
470
470
  "darwin"
@@ -475,8 +475,8 @@
475
475
  "optional": true
476
476
  },
477
477
  "node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
478
- "version": "0.9.30-alpha.1",
479
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.30-alpha.1.tgz",
478
+ "version": "0.9.30-alpha.2",
479
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.30-alpha.2.tgz",
480
480
  "license": "MIT",
481
481
  "os": [
482
482
  "linux"
@@ -490,8 +490,8 @@
490
490
  "optional": true
491
491
  },
492
492
  "node_modules/@bastani/atomic-natives-linux-arm64-musl": {
493
- "version": "0.9.30-alpha.1",
494
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.30-alpha.1.tgz",
493
+ "version": "0.9.30-alpha.2",
494
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.30-alpha.2.tgz",
495
495
  "license": "MIT",
496
496
  "os": [
497
497
  "linux"
@@ -505,8 +505,8 @@
505
505
  "optional": true
506
506
  },
507
507
  "node_modules/@bastani/atomic-natives-linux-x64-gnu": {
508
- "version": "0.9.30-alpha.1",
509
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.30-alpha.1.tgz",
508
+ "version": "0.9.30-alpha.2",
509
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.30-alpha.2.tgz",
510
510
  "license": "MIT",
511
511
  "os": [
512
512
  "linux"
@@ -520,8 +520,8 @@
520
520
  "optional": true
521
521
  },
522
522
  "node_modules/@bastani/atomic-natives-linux-x64-musl": {
523
- "version": "0.9.30-alpha.1",
524
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.30-alpha.1.tgz",
523
+ "version": "0.9.30-alpha.2",
524
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.30-alpha.2.tgz",
525
525
  "license": "MIT",
526
526
  "os": [
527
527
  "linux"
@@ -535,8 +535,8 @@
535
535
  "optional": true
536
536
  },
537
537
  "node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
538
- "version": "0.9.30-alpha.1",
539
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.30-alpha.1.tgz",
538
+ "version": "0.9.30-alpha.2",
539
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.30-alpha.2.tgz",
540
540
  "license": "MIT",
541
541
  "os": [
542
542
  "win32"
@@ -547,8 +547,8 @@
547
547
  "optional": true
548
548
  },
549
549
  "node_modules/@bastani/atomic-natives-win32-x64-msvc": {
550
- "version": "0.9.30-alpha.1",
551
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.30-alpha.1.tgz",
550
+ "version": "0.9.30-alpha.2",
551
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.30-alpha.2.tgz",
552
552
  "license": "MIT",
553
553
  "os": [
554
554
  "win32"
@@ -559,8 +559,8 @@
559
559
  "optional": true
560
560
  },
561
561
  "node_modules/@bastani/pi-ai": {
562
- "version": "0.9.30-alpha.1",
563
- "resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.30-alpha.1.tgz",
562
+ "version": "0.9.30-alpha.2",
563
+ "resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.30-alpha.2.tgz",
564
564
  "license": "MIT",
565
565
  "dependencies": {
566
566
  "@anthropic-ai/sdk": "0.129.0",
@@ -3740,14 +3740,14 @@
3740
3740
  "license": "AGPL-3.0-or-later"
3741
3741
  },
3742
3742
  "node_modules/music-metadata": {
3743
- "version": "11.13.0",
3744
- "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.13.0.tgz",
3745
- "integrity": "sha512-uXRaov9dfjSpQufXIU7sMxVZnh+FilCQv2mXn+K5EJ/decP3dTWrgvPYa5r6MtRbieNSCE708Da4J0u1UGfQIw==",
3743
+ "version": "11.16.1",
3744
+ "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.16.1.tgz",
3745
+ "integrity": "sha512-uR/mHK6eyfl8h3jVCobF5b38Mfg1IDJMiBxIVbmm5F+G1OXEFcUpQHveO84tJBAqvY93GCRY2R4kDyx7s06Rug==",
3746
3746
  "license": "MIT",
3747
3747
  "dependencies": {
3748
3748
  "@borewit/text-codec": "^0.2.2",
3749
3749
  "@tokenizer/token": "^0.3.0",
3750
- "content-type": "^2.0.0",
3750
+ "content-type": "^2.1.0",
3751
3751
  "debug": "^4.4.3",
3752
3752
  "file-type": "^21.3.4",
3753
3753
  "media-typer": "^2.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.30-alpha.1",
3
+ "version": "0.9.30-alpha.2",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -82,8 +82,8 @@
82
82
  "prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
83
83
  },
84
84
  "dependencies": {
85
- "@bastani/atomic-natives": "0.9.30-alpha.1",
86
- "@bastani/pi-ai": "0.9.30-alpha.1",
85
+ "@bastani/atomic-natives": "0.9.30-alpha.2",
86
+ "@bastani/pi-ai": "0.9.30-alpha.2",
87
87
  "@dbos-inc/dbos-sdk": "4.25.14",
88
88
  "@earendil-works/pi-agent-core": "1.1.0",
89
89
  "@earendil-works/pi-client": "1.1.0",