stitchkit 0.83.2 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,56 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.84.0] — 2026-09-07
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** anyone using `createAgentCodingTools`. The separator fix
23
+ below reaches BOTH callbacks — the required `authorize({ operation, path })`
24
+ and the optional `authorizePath`. The recursion fix reaches `authorizePath`
25
+ only. Anyone passing a non-canonical `cwd` to `run_command` is affected by the
26
+ separator fix even if they implement neither policy shape.
27
+
28
+ - **A backslash in a requested path is refused instead of silently becoming a
29
+ separator.** `contained-files` splits a relative path on `[\/]`, so
30
+ `credentials\token.txt` reached `openat` as two segments while every
31
+ authorization callback was handed the string whole and read it as one name.
32
+ A rule denying `credentials/token.txt` refused that spelling and served — then
33
+ overwrote — the same file spelled with a backslash. This bypassed the
34
+ **required** `authorize` callback, not only the `authorizePath` added in
35
+ 0.83.2, and it has been reachable since 0.70.0. Requests carrying `\` now get
36
+ a typed `FORBIDDEN`; `run_command`'s `cwd` goes through the same segment and
37
+ separator validation as every file tool.
38
+ `// before: read_file('a\b.txt') → served past a rule denying 'a/b.txt'` →
39
+ `// after: read_file('a\b.txt') → FORBIDDEN, use 'a/b.txt'`
40
+
41
+ - **`authorizePath` denies a directory on every surface it governs.** Direct
42
+ read, write and edit asked the path policy only about the leaf, so `authorizePath: p => p !== 'credentials'`
43
+ hid the directory from `glob` and served `credentials/token.txt` to
44
+ `read_file`, created files under it through `write_file` and rewrote it
45
+ through `edit_file`; `list_directory` and `glob` given a base path *inside* a
46
+ denied directory disclosed its contents and disagreed about the refusal shape.
47
+ Direct access and discovery base paths now ask about `.` and each ancestor,
48
+ outermost first, short-circuiting on the first refusal — segment-wise, so
49
+ denying `credentials` does not deny `credentials-backup`.
50
+ `// before: authorizePath asked once, about the leaf` →
51
+ `// after: asked about '.', then each ancestor, then the leaf`
52
+
53
+ **The policy must now admit every directory on the way to a file**, the way
54
+ POSIX needs `+x` on each directory in a path. A DENY-list is unaffected:
55
+ refusing `credentials` now refuses everything under it, which is what the rule
56
+ always read as. An ALLOW-list must be widened to name the directories it
57
+ leads through — `p => p.startsWith('src/')` refuses `src` itself and so loses
58
+ `src/index.ts`; write `p => p === 'src' || p.startsWith('src/')`. The
59
+ workspace root is not asked about: it is the boundary the tools already own.
60
+ A path of depth N costs N questions, and a policy keeping an audit no longer
61
+ sees the leaf once an ancestor refused.
62
+
63
+ This recursion is `authorizePath` only. The required `authorize({ operation,
64
+ path })` is still asked once, about the operation's own path, and a broad
65
+ `search` or `glob` is still one decision covering every file the walk opens —
66
+ which is the reason `authorizePath` exists at all. → ADR 0172 (amended).
67
+
18
68
  ## [0.83.2] — 2026-09-07
19
69
 
20
70
  ### Added
@@ -15,6 +15,34 @@ export declare function editableCodingPath(root: string, requested: string, maxP
15
15
  export declare function authorizeCodingTool(config: AgentCodingToolConfig, request: AgentCodingToolAuthorization): Promise<void>;
16
16
  export declare function isCodingPathAuthorized(config: AgentCodingToolConfig, path: string): Promise<boolean>;
17
17
  export declare function authorizeCodingPath(config: AgentCodingToolConfig, path: string): Promise<void>;
18
+ /**
19
+ * Ask the policy about the target AND every directory above it.
20
+ *
21
+ * A denied directory means two different things until this exists. The walk
22
+ * refuses to descend into one, so denial is recursive during discovery; direct
23
+ * access asked only about the leaf, so a host writing the obvious rule —
24
+ * `path !== 'credentials'` — got a listing that hid the directory and a
25
+ * `read_file` that served the secret inside it, plus a `write_file` that
26
+ * created directories under it and an `edit_file` that rewrote it.
27
+ *
28
+ * Outermost first, so the broadest refusal is the one the caller is told about
29
+ * and nothing below a denied directory is ever asked about. Segment-wise, not
30
+ * `startsWith`: a rule denying `credentials` must not also deny
31
+ * `credentials-backup`.
32
+ *
33
+ * The chain asks about the ANCESTORS OF THE PATH, and `.` is one only when the
34
+ * path itself is `.`. Asking about `.` unconditionally looks symmetrical with
35
+ * the walk — `search_files` and `list_directory('.')` do ask it — but there `.`
36
+ * is the base path the caller named, not an ancestor of it. Asked on every
37
+ * direct access it silently inverts every ALLOW-list: a host exposing one
38
+ * subtree with `p => p.startsWith('src/')` answers `false` for `.` and loses
39
+ * `src/index.ts` too, having denied nothing.
40
+ *
41
+ * The cost is stated rather than hidden: a path of depth N costs N questions,
42
+ * and a policy that keeps an audit no longer sees the leaf once an ancestor has
43
+ * refused.
44
+ */
45
+ export declare function authorizeCodingPathChain(config: AgentCodingToolConfig, relative: string): Promise<void>;
18
46
  /** Serialize framework-owned compare-and-replace transactions for one canonical target. */
19
47
  export declare function withCodingPathLock<T>(target: string, work: () => Promise<T>): Promise<T>;
20
48
  export declare function textOccurrences(source: string, search: string): number;
@@ -1 +1 @@
1
- {"version":3,"file":"coding-tool-paths.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,qBAAqB,EAE3B,MAAM,wBAAwB,CAAC;AAkChC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAezF;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAKrB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAarB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAQrB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAIf;AAID,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUtE"}
1
+ {"version":3,"file":"coding-tool-paths.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,qBAAqB,EAE3B,MAAM,wBAAwB,CAAC;AAkChC,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAmCzF;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAKrB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAarB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAQrB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAMf;AAID,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUtE"}
@@ -1 +1 @@
1
- {"version":3,"file":"coding-tool-search-patch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-search-patch.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAyHhC,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAuMtC"}
1
+ {"version":3,"file":"coding-tool-search-patch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-search-patch.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AA0HhC,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAuMtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"coding-tool-shell.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-shell.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAG3B,MAAM,wBAAwB,CAAC;AAgKhC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,yBAAyB,CAkD3B"}
1
+ {"version":3,"file":"coding-tool-shell.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-shell.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAG3B,MAAM,wBAAwB,CAAC;AAoKhC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,yBAAyB,CA4D3B"}
@@ -243,7 +243,13 @@ function inputPath(root, requested, maxPathBytes) {
243
243
  }
244
244
  function boundedCodingRelativePath(requested, maxPathBytes) {
245
245
  inputPath(path.parse(process.cwd()).root, requested, maxPathBytes);
246
- const segments = requested.split(/[\\/]/u);
246
+ if (requested.includes("\\")) {
247
+ codingRefusal("FORBIDDEN", "Path separators must be `/`", {
248
+ details: { path: requested },
249
+ hint: "Use `/` between segments; a backslash is refused because the workspace walk reads it as a separator."
250
+ });
251
+ }
252
+ const segments = requested.split("/");
247
253
  if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
248
254
  codingRefusal("FORBIDDEN", "Path segments must name real entries under the root", {
249
255
  details: { path: requested },
@@ -271,7 +277,18 @@ async function isCodingPathAuthorized(config, path2) {
271
277
  }
272
278
  async function authorizeCodingPath(config, path2) {
273
279
  if (!await isCodingPathAuthorized(config, path2)) {
274
- forbidden("Coding tool path permission denied");
280
+ codingRefusal("FORBIDDEN", "Coding tool path permission denied", {
281
+ details: { path: path2 },
282
+ hint: "The host policy refused this path or a directory above it."
283
+ });
284
+ }
285
+ }
286
+ async function authorizeCodingPathChain(config, relative) {
287
+ if (!config.authorizePath)
288
+ return;
289
+ const segments = relative === "." ? ["."] : relative.split("/");
290
+ for (let depth = 1;depth <= segments.length; depth += 1) {
291
+ await authorizeCodingPath(config, segments.slice(0, depth).join("/"));
275
292
  }
276
293
  }
277
294
  var codingPathLocks = new Map;
@@ -332,7 +349,7 @@ function createFileCodingTools(config, limits) {
332
349
  handler: async ({ input }) => {
333
350
  const root = await realpath2(config.root);
334
351
  const relative = boundedCodingRelativePath(input.path, limits.maxPathBytes);
335
- await authorizeCodingPath(config, relative);
352
+ await authorizeCodingPathChain(config, relative);
336
353
  const handle = await openContainedFile(root, relative).catch((error) => refuseMissingCodingPath(error, relative));
337
354
  const maximum = Math.min(input.maxBytes ?? limits.maxReadBytes, limits.maxReadBytes);
338
355
  let selected;
@@ -379,7 +396,7 @@ function createFileCodingTools(config, limits) {
379
396
  handler: async ({ input }) => {
380
397
  const root = await realpath2(config.root);
381
398
  const relative = boundedCodingRelativePath(input.path, limits.maxPathBytes);
382
- await authorizeCodingPath(config, relative);
399
+ await authorizeCodingPathChain(config, relative);
383
400
  const bytes = Buffer.byteLength(input.content);
384
401
  if (bytes > limits.maxWriteBytes) {
385
402
  codingPathRefusal("BAD_REQUEST", `The content is ${bytes} bytes, over the ${limits.maxWriteBytes}-byte limit`, relative, {
@@ -514,7 +531,7 @@ function createListingCodingTools(config, limits) {
514
531
  handler: async ({ input }) => {
515
532
  const root = await realpath3(config.root);
516
533
  const relative = input.path === "." ? "." : boundedCodingRelativePath(input.path, limits.maxPathBytes);
517
- await authorizeCodingPath(config, relative);
534
+ await authorizeCodingPathChain(config, relative);
518
535
  await authorizeCodingTool(config, { operation: "list", path: relative });
519
536
  const listing = await listContainedDirectory(root, relative, limits.maxListEntries, (candidate) => isCodingPathAuthorized(config, candidate)).catch((error) => {
520
537
  if (error instanceof Error && error.message.includes("ancestor is not a directory")) {
@@ -548,7 +565,7 @@ function createListingCodingTools(config, limits) {
548
565
  transports: ["AGENT"],
549
566
  handler: async ({ input }) => {
550
567
  const relative = input.path === "." ? "." : boundedCodingRelativePath(input.path, limits.maxPathBytes);
551
- await authorizeCodingPath(config, relative);
568
+ await authorizeCodingPathChain(config, relative);
552
569
  await authorizeCodingTool(config, {
553
570
  operation: "glob",
554
571
  pattern: input.pattern,
@@ -745,7 +762,7 @@ function createSearchAndPatchCodingTools(config, limits) {
745
762
  handler: async ({ input }) => {
746
763
  const root = await realpath4(config.root);
747
764
  const relative = boundedCodingRelativePath(input.path, limits.maxPathBytes);
748
- await authorizeCodingPath(config, relative);
765
+ await authorizeCodingPathChain(config, relative);
749
766
  const parent = await openContainedParent(root, relative).catch((error) => refuseMissingCodingPath(error, relative));
750
767
  try {
751
768
  return await withCodingPathLock(`${root}:${relative}`, async () => {
@@ -989,7 +1006,7 @@ function createShellCodingTool(config, limits) {
989
1006
  if (!executable)
990
1007
  throw new Error("Coding tool executable is not declared");
991
1008
  const root = await realpath5(config.root);
992
- const cwd = await existingCodingPath(root, input.cwd, limits.maxPathBytes);
1009
+ const cwd = await existingCodingPath(root, input.cwd === "." ? "." : boundedCodingRelativePath(input.cwd, limits.maxPathBytes), limits.maxPathBytes);
993
1010
  if (!(await stat(cwd.absolute)).isDirectory()) {
994
1011
  throw new Error("Coding tool cwd is not a directory");
995
1012
  }
package/llms-full.txt CHANGED
@@ -63,11 +63,11 @@ own, recorded as an ADR.
63
63
  | `stitchkit/tracking/server` | server (Bun or Node) | evolving | the decisions a tracking backend makes — dispositions, visit lease over an application-owned store, active intervals, presence; no database |
64
64
  | `stitchkit/release` | browser **and** server | evolving | a page follows the release it was built for — `createReleaseMarker` on the server, `createReleaseWatcher` in the browser, the `X-Build-Id` header and a socket event between them |
65
65
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
66
- | `stitchkit/observability` | server | stable<br>_redefined in 1 of the 28 minors since 0.56.2, most recently 0.83.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
66
+ | `stitchkit/observability` | server | stable<br>_redefined in 1 of the 29 minors since 0.56.2, most recently 0.83.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
67
67
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the store and managed-resource conformance kits |
68
68
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
69
69
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
70
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 12 of the 28 minors since 0.56.2, most recently 0.83.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
70
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 15 of the 29 minors since 0.56.2, most recently 0.84.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
71
71
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
72
72
  | `stitchkit/agent-runtime/coding-tools` | server (Bun or Node) | evolving | bounded host-authorized direct file and shell tools; a root boundary, not an OS sandbox |
73
73
  | `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
@@ -75,7 +75,7 @@ own, recorded as an ADR.
75
75
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
76
76
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
77
77
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
78
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 28 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
78
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 29 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
79
79
  | `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
80
80
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
81
81
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -4719,8 +4719,13 @@ approval input fails the run with a private diagnostic rather than starting a fr
4719
4719
  `read_output`. Every call passes a required host authorization callback. An optional async/sync
4720
4720
  `authorizePath({ path })` is the one operation-independent policy for direct file access and
4721
4721
  discovery: direct read/write/edit refuses a denied path, while listing, glob and search omit it.
4722
- Directory decisions happen before descent; file decisions and `search_files.include` happen before
4723
- opening content. File paths are relative, bounded and contained after
4722
+ Denial is recursive on every surface direct access and discovery base paths ask about `.` and each
4723
+ ancestor, outermost first, stopping at the first refusal, so denying `credentials` denies everything
4724
+ under it. The comparison is segment-wise, so it does not deny `credentials-backup`, and a path of
4725
+ depth N costs N+1 questions. Directory decisions happen before descent; file decisions and
4726
+ `search_files.include` happen before opening content. Requested paths use `/`: a backslash is
4727
+ refused rather than normalised, because the workspace walk reads it as a separator and every
4728
+ authorization callback would otherwise be asked about a different decomposition than the one opened. File paths are relative, bounded and contained after
4724
4729
  descriptor-relative resolution: each ancestor is opened without following symlinks and remains
4725
4730
  pinned through authorization and the filesystem effect. Reads revalidate the pinned file identity;
4726
4731
  writes and patches revalidate the pinned parent identity; search and resource discovery descend
@@ -11031,6 +11036,59 @@ makes one thing your job rather than the resolver's:
11031
11036
  The mechanical part is identical either way. Only the *noticing* differs, and an
11032
11037
  exact pin moves it onto you.
11033
11038
 
11039
+ ## Released migration: 0.84.0
11040
+
11041
+ Only if you call `createAgentCodingTools`.
11042
+
11043
+ ```bash
11044
+ rg -n "createAgentCodingTools"
11045
+ ```
11046
+
11047
+ **1. Backslashes are refused.** If anything in your system hands the tools a Windows-style path,
11048
+ it now gets `FORBIDDEN`. Convert to `/` at the boundary:
11049
+
11050
+ ```ts
11051
+ // before: read_file({ path: 'src\\index.ts' }) // reached openat as two segments
11052
+ // after: read_file({ path: 'src/index.ts' })
11053
+ ```
11054
+
11055
+ This is the half that matters most: until now a backslash bypassed your **required**
11056
+ `authorize({ operation, path })` callback, not just `authorizePath`. A rule denying
11057
+ `credentials/token.txt` refused that spelling and served — and overwrote — the same file spelled
11058
+ `credentials\token.txt`. If your policy denies specific files, re-read your audit logs for
11059
+ backslash spellings.
11060
+
11061
+ **2. Denying a directory now denies everything under it — and a policy must admit every directory
11062
+ on the way to a file**, the way POSIX needs `+x` on each directory in a path.
11063
+
11064
+ If your policy is a DENY-list, it now does what it read as:
11065
+
11066
+ ```ts
11067
+ authorizePath: ({ path }) => path !== 'credentials'
11068
+ // before: hid `credentials` from glob, served `credentials/token.txt` to read_file
11069
+ // after: refuses `credentials/token.txt`, `credentials/nested/deep.txt` and writes under it
11070
+ ```
11071
+
11072
+ If you relied on the old behaviour — a directory hidden from discovery but readable directly — you
11073
+ were relying on a defect, and the two halves of one callback disagreeing. Name the paths you
11074
+ actually want reachable instead.
11075
+
11076
+ If your policy is an ALLOW-list, widen it to the directories it leads through, or nothing under
11077
+ them is reachable:
11078
+
11079
+ ```ts
11080
+ // before: allowed src/index.ts, because only the leaf was ever asked
11081
+ authorizePath: ({ path }) => path.startsWith('src/')
11082
+ // after: `src` itself is asked first and refused, so the file is refused too
11083
+ authorizePath: ({ path }) => path === 'src' || path.startsWith('src/')
11084
+ ```
11085
+
11086
+ The workspace root is not asked about — it is the boundary the tools already own.
11087
+
11088
+ **3. The policy is called more often.** A path of depth N costs N+1 calls (`.`, then each ancestor,
11089
+ then the leaf), outermost first, stopping at the first refusal. A policy that logs or meters will
11090
+ see a different sequence, and will no longer see the leaf once an ancestor has refused.
11091
+
11034
11092
  ## Released migration: 0.83.0
11035
11093
 
11036
11094
  Two things, both mechanical, and only if you touch an observability sink.
@@ -15274,8 +15332,12 @@ boundary, not an OS sandbox; executable behavior, process
15274
15332
  isolation, credentials and external-effect idempotency remain host responsibilities.
15275
15333
 
15276
15334
  When `authorizePath` denies a path, direct read/write/edit returns `FORBIDDEN`, while
15277
- `list_directory`, `glob` and `search_files` omit it. Directory admission happens before descent and
15278
- file admission before opening; `search_files.include` is also applied before content is read.
15335
+ `list_directory`, `glob` and `search_files` omit it. Denial is recursive: direct access and
15336
+ discovery base paths are checked against `.` and every ancestor, outermost first and segment-wise,
15337
+ so denying `credentials` denies `credentials/token.txt` but not `credentials-backup`. Directory
15338
+ admission happens before descent and file admission before opening; `search_files.include` is also
15339
+ applied before content is read. Requested paths must use `/` — a backslash is refused, because the
15340
+ containment walk reads it as a separator while a callback would read it as one name.
15279
15341
  `run_command` is intentionally outside this guarantee because an executable needs process isolation,
15280
15342
  not path filtering, to constrain its filesystem access. → ADR 0172.
15281
15343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.83.2",
3
+ "version": "0.84.0",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",