stitchkit 0.120.0 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/agent-runtime/browser-control-contract.d.ts +12 -0
  3. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/coding-discovery.d.ts +25 -0
  5. package/dist/agent-runtime/coding-discovery.d.ts.map +1 -0
  6. package/dist/agent-runtime/coding-search-automaton.d.ts +37 -0
  7. package/dist/agent-runtime/coding-search-automaton.d.ts.map +1 -0
  8. package/dist/agent-runtime/coding-search-case-fold.d.ts +4 -0
  9. package/dist/agent-runtime/coding-search-case-fold.d.ts.map +1 -0
  10. package/dist/agent-runtime/coding-search-class-ranges.d.ts +10 -0
  11. package/dist/agent-runtime/coding-search-class-ranges.d.ts.map +1 -0
  12. package/dist/agent-runtime/coding-search-contract.d.ts +86 -0
  13. package/dist/agent-runtime/coding-search-contract.d.ts.map +1 -0
  14. package/dist/agent-runtime/coding-search-limits.d.ts +13 -0
  15. package/dist/agent-runtime/coding-search-limits.d.ts.map +1 -0
  16. package/dist/agent-runtime/coding-search-matcher.d.ts +33 -0
  17. package/dist/agent-runtime/coding-search-matcher.d.ts.map +1 -0
  18. package/dist/agent-runtime/coding-search-output.d.ts +5 -0
  19. package/dist/agent-runtime/coding-search-output.d.ts.map +1 -0
  20. package/dist/agent-runtime/coding-search-regex-syntax.d.ts +39 -0
  21. package/dist/agent-runtime/coding-search-regex-syntax.d.ts.map +1 -0
  22. package/dist/agent-runtime/coding-search-unit-classes.d.ts +31 -0
  23. package/dist/agent-runtime/coding-search-unit-classes.d.ts.map +1 -0
  24. package/dist/agent-runtime/coding-shell-process.d.ts +1 -0
  25. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  26. package/dist/agent-runtime/coding-tool-contract.d.ts +8 -3
  27. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  28. package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
  29. package/dist/agent-runtime/coding-tool-listing.d.ts +1 -11
  30. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  31. package/dist/agent-runtime/coding-tool-paths.d.ts +6 -2
  32. package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
  33. package/dist/agent-runtime/coding-tool-refusals.d.ts +6 -0
  34. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  35. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  36. package/dist/agent-runtime/coding-tool-search.d.ts +113 -0
  37. package/dist/agent-runtime/coding-tool-search.d.ts.map +1 -0
  38. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  39. package/dist/agent-runtime/contained-scan-budget.d.ts +32 -0
  40. package/dist/agent-runtime/contained-scan-budget.d.ts.map +1 -0
  41. package/dist/agent-runtime/contained-scan-contract.d.ts +52 -0
  42. package/dist/agent-runtime/contained-scan-contract.d.ts.map +1 -0
  43. package/dist/agent-runtime/contained-scan.d.ts +48 -13
  44. package/dist/agent-runtime/contained-scan.d.ts.map +1 -1
  45. package/dist/agent-runtime/control-schema.d.ts +27 -4
  46. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  47. package/dist/agent-runtime/event-schema.d.ts +33 -0
  48. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  49. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
  50. package/dist/agent-runtime/run-execution-state.d.ts +6 -0
  51. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
  52. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
  53. package/dist/agent-runtime/run-stream-parts.d.ts +11 -0
  54. package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -1
  55. package/dist/agent-runtime/sandbox.d.ts +5 -1
  56. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  57. package/dist/agent-runtime/tool-progress.d.ts +21 -0
  58. package/dist/agent-runtime/tool-progress.d.ts.map +1 -0
  59. package/dist/agent-runtime/workspace-glob.d.ts +6 -0
  60. package/dist/agent-runtime/workspace-glob.d.ts.map +1 -0
  61. package/dist/entrypoints/agent-runtime/browser.js +7 -3
  62. package/dist/entrypoints/agent-runtime/coding-tools.js +7 -7
  63. package/dist/entrypoints/agent-runtime/harness.js +8 -8
  64. package/dist/entrypoints/agent-runtime/realtime.js +5 -5
  65. package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
  66. package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -9
  67. package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -9
  68. package/dist/entrypoints/agent-runtime/testing.js +9 -9
  69. package/dist/entrypoints/agent-runtime.d.ts +1 -1
  70. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  71. package/dist/entrypoints/agent-runtime.js +15 -13
  72. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  73. package/dist/entrypoints/application/directory-inbox.js +5 -5
  74. package/dist/entrypoints/cli/publish.js +4 -4
  75. package/dist/entrypoints/cli.js +4 -4
  76. package/dist/entrypoints/files.js +4 -4
  77. package/dist/entrypoints/process/owner-loss.js +2 -1
  78. package/dist/entrypoints/process.js +4 -4
  79. package/dist/entrypoints/server.d.ts +1 -0
  80. package/dist/entrypoints/server.d.ts.map +1 -1
  81. package/dist/entrypoints/server.js +112 -47
  82. package/dist/entrypoints/telegram.js +3 -3
  83. package/dist/entrypoints/tools/agent.js +1 -1
  84. package/dist/entrypoints/tools/toolkit.js +5 -5
  85. package/dist/{index-yb9n4pgj.js → index-10rg78vf.js} +1 -1
  86. package/dist/{index-7zwtbak8.js → index-1fyea34p.js} +9 -4
  87. package/dist/{index-3yb5kft5.js → index-4tyt1qya.js} +1 -1
  88. package/dist/{index-8xyf8h2k.js → index-6j15ktag.js} +1 -1
  89. package/dist/{index-zrdcmg6j.js → index-72xtvcvr.js} +40 -6
  90. package/dist/{index-4qnzda76.js → index-7qyv50r4.js} +1 -1
  91. package/dist/{index-qctbzmg9.js → index-am1h8c9v.js} +69 -27
  92. package/dist/{index-e452syyh.js → index-aqmadanx.js} +2 -2
  93. package/dist/{index-yt7gyg5x.js → index-b51tzcgh.js} +1 -1
  94. package/dist/{index-aw6zahv1.js → index-dqpesdck.js} +2 -2
  95. package/dist/{index-1jwsfkfz.js → index-eeahxwvg.js} +60 -76
  96. package/dist/{index-sb9dr3tq.js → index-eh71zr32.js} +4 -4
  97. package/dist/{index-nyyam9ce.js → index-f6pw75e1.js} +1 -1
  98. package/dist/{index-qevqn3d3.js → index-gq3fnq3f.js} +1 -1
  99. package/dist/{index-bz479f0x.js → index-gtx3eknx.js} +1 -1
  100. package/dist/{index-mnkk1ffz.js → index-hs76yzt7.js} +13 -1
  101. package/dist/{index-nn9qvkww.js → index-j95jp7ee.js} +45 -9
  102. package/dist/{index-2kbysk9s.js → index-m5m9rmvt.js} +2 -0
  103. package/dist/{index-r3db01kh.js → index-nwm3ww60.js} +1 -1
  104. package/dist/index-qaqxdbxf.js +2857 -0
  105. package/dist/index-s9a0fjh3.js +305 -0
  106. package/dist/{index-b0w7rbpt.js → index-t05a2ry4.js} +39 -3
  107. package/dist/{index-pq2m7t46.js → index-v8yqk4w7.js} +22 -8
  108. package/dist/internal/contained-directory.d.ts +1 -1
  109. package/dist/internal/contained-directory.d.ts.map +1 -1
  110. package/dist/internal/contained-files.d.ts +18 -51
  111. package/dist/internal/contained-files.d.ts.map +1 -1
  112. package/dist/internal/contained-read.d.ts +17 -0
  113. package/dist/internal/contained-read.d.ts.map +1 -0
  114. package/dist/internal/darwin-binding.d.ts +3 -1
  115. package/dist/internal/darwin-binding.d.ts.map +1 -1
  116. package/dist/process/bun-child.d.ts.map +1 -1
  117. package/dist/process/command-owner.d.ts.map +1 -1
  118. package/dist/process/group.d.ts +2 -0
  119. package/dist/process/group.d.ts.map +1 -1
  120. package/dist/process/launch.d.ts +1 -0
  121. package/dist/process/launch.d.ts.map +1 -1
  122. package/dist/process/owned-child.d.ts.map +1 -1
  123. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  124. package/dist/process/owner-loss-protocol.d.ts +1 -0
  125. package/dist/process/owner-loss-protocol.d.ts.map +1 -1
  126. package/dist/server/openapi-security.d.ts +73 -0
  127. package/dist/server/openapi-security.d.ts.map +1 -0
  128. package/dist/server/openapi.d.ts +12 -0
  129. package/dist/server/openapi.d.ts.map +1 -1
  130. package/dist/tools/agent.d.ts.map +1 -1
  131. package/dist/tools/cli/format.d.ts +11 -2
  132. package/dist/tools/cli/format.d.ts.map +1 -1
  133. package/dist/tools/cli/repeatable-read.d.ts +9 -0
  134. package/dist/tools/cli/repeatable-read.d.ts.map +1 -0
  135. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  136. package/dist/tools/cli/run-native.d.ts.map +1 -1
  137. package/dist/tools/runtime-call-context.d.ts +15 -0
  138. package/dist/tools/runtime-call-context.d.ts.map +1 -0
  139. package/llms/agent-runtime-browser.txt +4 -1
  140. package/llms/agent-runtime-coding-tools.txt +9 -9
  141. package/llms/agent-runtime.2.txt +30 -108
  142. package/llms/agent-runtime.3.txt +111 -1
  143. package/llms/agent-runtime.txt +59 -24
  144. package/llms/application.3.txt +5 -2
  145. package/llms/cli.txt +21 -9
  146. package/llms/contract.txt +1 -1
  147. package/llms/process.txt +3 -1
  148. package/llms/server.2.txt +48 -0
  149. package/llms/server.5.txt +4 -0
  150. package/llms/stitchkit.txt +3 -3
  151. package/llms/tools.txt +4 -1
  152. package/llms/{upgrading-0.106.0-0.120.0.txt → upgrading-0.106.0-0.122.0.txt} +81 -3
  153. package/llms/upgrading.txt +1 -1
  154. package/llms-full.txt +255 -35
  155. package/llms.txt +7 -7
  156. package/native/darwin-arm64.node +0 -0
  157. package/native/darwin-x64.node +0 -0
  158. package/native-assets.json +4 -4
  159. package/package.json +2 -1
  160. package/dist/index-0qyrcjfs.js +0 -1478
  161. package/dist/index-aa50qwv4.js +0 -107
  162. package/dist/tools/durability-context.d.ts +0 -7
  163. package/dist/tools/durability-context.d.ts.map +0 -1
@@ -304,14 +304,26 @@ outermost first, stopping at the first refusal; discovery rooted at `.` also ask
304
304
  Thus denying `credentials` denies everything
305
305
  under it. The comparison is segment-wise, so it does not deny `credentials-backup`, and a path of
306
306
  depth N costs N questions for direct access. Directory decisions happen before descent; file decisions and
307
- `search_files.include` happen before opening content. Requested paths use `/`: a backslash is
307
+ `search_files.include` happen before opening content. Incompatible glob directory prefixes are
308
+ pruned before policy or directory opens. Requested paths use `/`: a backslash is
308
309
  refused rather than normalised, because the workspace walk reads it as a separator and every
309
310
  authorization callback would otherwise be asked about a different decomposition than the one opened. File paths are relative, bounded and contained after
310
311
  descriptor-relative resolution: each ancestor is opened without following symlinks. Reads and edits
311
312
  stay pinned through authorization; `write_file` plans before it and opens the parent after, because
312
313
  the parent it creates does not exist yet. Reads revalidate the pinned file identity;
313
314
  writes and patches revalidate the pinned parent identity; search and resource discovery descend
314
- only through opened directories. A path that changed during authorization refuses with `CONFLICT`.
315
+ only through opened directories. Every filesystem tool selects its root capability before operation or path authorization and retains
316
+ that identity if a callback replaces the root path or configured alias. On Linux the ordinary
317
+ command launcher spawns the command with the pinned directory's `/proc` descriptor link as its cwd;
318
+ on macOS it inherits the pinned cwd through an isolated guard — one short-lived guard process per
319
+ command, tens of milliseconds, outside `shellTimeoutMs`, which counts from the command's start. The
320
+ application process never changes cwd. Where
321
+ contained descriptors are unavailable (Windows), `run_command` accepts a cwd whose realpath is
322
+ that same name under the root — a symlink segment refuses there too — and checks the directory's
323
+ identity again immediately before launch, after every host decision.
324
+ A custom sandbox launcher owns atomic cwd capture at its pathname handoff; the SDK refuses a
325
+ changed identity after policy/prepare and immediately before that handoff. A path that changed
326
+ during direct-access authorization refuses with `CONFLICT`.
315
327
  A path spelled differently from the name stored on disk refuses before any policy reads it, so on a
316
328
  case-insensitive volume a rule on `credentials` cannot be passed by asking for `CREDENTIALS`.
317
329
  NUL bytes are refused before either host policy sees a path.
@@ -365,11 +377,51 @@ crosses a process boundary and is rebuilt from the wire.
365
377
  excluded directory is not "no files", and a model told only "nothing found" concludes the wrong
366
378
  thing. `search_files` takes `regex`, `context` lines and an anchored `include` pattern matched
367
379
  against the whole workspace-relative path. `*` does not cross `/`, so files in subdirectories need
368
- `**/`; `scannedFiles` counts files admitted by both that filter and host authorization. A `hint`
369
- explains the zero only when the filter produced it, rejecting every file the scan reached; an empty
370
- tree and a host refusal return the same empty result without blaming the pattern. Regex is bounded by
371
- refusing backreferences and lookaround and capping line length rather than by a timeout, because a
372
- JavaScript `RegExp` cannot be interrupted once it starts backtracking. With an optional `AgentCodingArtifactStore`, shell output beyond the inline
380
+ `**/`; `scannedFiles` counts files admitted by both that filter and host authorization that reached
381
+ comparison. One finite glob automaton matches files and prunes incompatible directory prefixes;
382
+ `glob` also confines its walk to the requested path. A `hint` can explain include filtering or
383
+ pruning, without counting files below unopened directories.
384
+
385
+ Search processes one file at a time. List, glob and search share directory, entry, serialized-output,
386
+ timeout and cancellation budgets, including canonical spelling checks before path authorization.
387
+ `list_directory` caps raw enumeration at the smaller of `maxListEntries` and `maxSearchEntries`;
388
+ its coverage scope lists symlinks while glob/search skip them. Glob patterns are limited to 4,096
389
+ UTF-16 units. A scoped glob measures depth from its requested base directory. In addition to `maxSearchFiles` (10,000), `maxSearchDepth`
390
+ (32), `maxSearchResults` (100) and `maxReadBytes` (262,144), hosts can configure
391
+ `maxSearchDirectories` (1,000 directory-open attempts, root included), `maxSearchEntries`
392
+ (20,000 entries observed by bounded readers), `maxSearchBytes` (16,777,216 aggregate content
393
+ bytes, including rejected UTF-8), `maxSearchOutputBytes` (65,536 bytes for the entire serialized
394
+ UTF-8 JSON, minimum 1,024) and `searchTimeoutMs` (5,000). An input whose minimum coverage
395
+ envelope cannot fit the output ceiling refuses before filesystem access. Directory readers cap
396
+ enumeration before materialization and sorting; reaching an entry or result ceiling is
397
+ conservatively partial, without reading a lookahead entry or match.
398
+
399
+ `list_directory`, `glob` and `search_files` return `coverage.complete` and `coverage.reasons`
400
+ to distinguish full empty results from partial work. Glob `resultTruncated` conservatively marks
401
+ the result ceiling even when no extra match was read.
402
+ Coverage names the include/exclusion/symlink scope, directory and entry counters, actual content
403
+ bytes and elapsed milliseconds. Limits, cancellation, denial, unreadable files and oversized
404
+ lines are explicit reasons. `errors` names only a workspace-relative path, operation and safe code;
405
+ `errorsTruncated` and `deniedTruncated` report shortened diagnostics. Excluded directories and
406
+ symlinks are outside the declared search scope. The caller's signal and deadline reach host
407
+ authorization, file reads and traversal; CPU checkpoints and asynchronous races stop further work.
408
+ Late opened handles are closed, while already-running kernel calls may finish later. Directory
409
+ enumeration and glob matching have internal checkpoints; cancellation stops their producer loops.
410
+ Host policy and visitor exceptions propagate to error hooks with their original cause, rather
411
+ than becoming filesystem diagnostics. Diagnostic byte admission is linear and checks the deadline
412
+ even for an empty result.
413
+
414
+ Regex searches use JavaScript `RegExp` syntax without flags — groups, alternation, classes,
415
+ anchors, `\b`, quantifiers and `(?ims-ims:…)` modifiers — with bounded cost per line. A line
416
+ whose backtracking work (paths × longest path × line length × (number of groups + 1), every
417
+ repetition capped at the line length beyond the iterations it requires) stays within 2^24 steps runs on the native engine, so ordinary `.*` searches over code
418
+ lines keep native speed and the deadline is observed between lines; any other line runs on a
419
+ cached linear automaton, so `(a+)+$` on a long line costs the same as `a+` and the deadline is
420
+ observed inside the line. Backreferences and
421
+ lookaround refuse before I/O; lines over 8,192 UTF-8 bytes are skipped with incomplete coverage.
422
+ Literal queries allow up to 8,192 UTF-16 units and include patterns up to 4,096.
423
+
424
+ With an optional `AgentCodingArtifactStore`, shell output beyond the inline
373
425
  preview continues into an opaque bounded artifact and `read_output` reads slices without
374
426
  exposing a host path. Without a store, the previous finite output-limit behavior is unchanged.
375
427
 
@@ -768,20 +820,3 @@ as `lost`, not misreported as a provider failure.
768
820
  `createAgentChildTools` adds `subagent`, `subagent_fork`, `list_agents`,
769
821
  `send_message` and `interrupt_agent`; final output stays behind its bounded
770
822
  result locator.
771
-
772
- ## Durable order
773
-
774
- `acceptInputAndAssignRun` is one atomic operation. It is followed by ownership
775
- acquisition, revision-checked assistant checkpoints and one terminal CAS. The
776
- process-local coordinator releases its lane only after terminal commit.
777
-
778
- A queued admission is durable immediately, even if its predecessor is still awaiting ownership
779
- or its first checkpoint. Snapshots expose causal turn order rather than physical append order:
780
- the predecessor's assigned input(s) and assistant come before the successor input(s). Execution
781
- uses the same run boundary, so neither `prompt({ snapshot })` nor default/custom history
782
- projection can see inputs assigned to a later run. `inject` remains the explicit path that moves
783
- a successor input into the run already in flight.
784
-
785
- ```text
786
- input + queued run → running → execution settled → terminal CAS → successor
787
- ```
@@ -14,6 +14,8 @@ Parts of this slice:
14
14
 
15
15
  ## `stitchkit/application`
16
16
 
17
+ Construct a directory inbox with `createDirectoryInbox` from `stitchkit/application/directory-inbox`.
18
+
17
19
  `StartFact` also carries `previousDrainUpperBoundMs`: the time from a predecessor's recorded admission stop to this start when its exit is `interrupted`, otherwise `null`. This is an upper bound, and does not identify a kill signal or supervisor deadline.
18
20
 
19
21
 
@@ -39,7 +41,7 @@ cutovers are covered by the executable
39
41
  | `NotificationOutboxItem` / `NotificationOutboxReceipt` / `NotificationOutboxState` / `NotificationSend` / `NotificationFailureClassification` / `DroppedNotification` / `EnqueueNotification` | _type_ | versioned queue records, stable send identity and delivery decisions |
40
42
  | `notificationOutboxStateSchema` | function | strict persisted-state schema over an application payload schema |
41
43
  | `notificationOutboxResource` / `NotificationOutboxResource` / `NotificationOutboxResourceConfig` | function / _type_ | thin managed-resource scheduler over an outbox handle |
42
- | `createDirectoryInbox` (from `stitchkit/application/directory-inbox`) / `DirectoryInbox` / `DirectoryInboxConfig` / `DirectoryInboxDelivery` / `DirectoryInboxResource` | function / _type_ | one managed directory inbox for files or durable `accept({ source, key, entry })` (`entry` is the schema's input, stored as given); a hard-linked file is set aside as `invalid`; first payload wins, bounded capacity/bytes/receipts and renewable fenced leases; delivery begins after readiness and effects remain at least once |
44
+ | `DirectoryInbox` / `DirectoryInboxConfig` / `DirectoryInboxDelivery` / `DirectoryInboxResource` | _type_ | one managed directory inbox for files or durable `accept({ source, key, entry })` (`entry` is the schema's input, stored as given); a hard-linked file is set aside as `invalid`; first payload wins, bounded capacity/bytes/receipts and renewable fenced leases; delivery begins after readiness and effects remain at least once |
43
45
  | `DirectoryInboxIdentitySchema` / `DirectoryInboxIdentity` / `DirectoryInboxAccept` / `DirectoryInboxAcceptResultSchema` / `DirectoryInboxAcceptResult` | schema / _type_ | validated source/key, typed entry and durable accepted/duplicate result with filename; duplicates do not replace the first payload |
44
46
  | `StateStoreUpdateContext` | _type_ | real active protected transaction: `assertHeld()` refuses after ownership loss or completion; custom adapters supply this context to their transition |
45
47
  | `DirectoryInboxStateSchema` / `DirectoryInboxState` / `DirectoryInboxRejection` / `DirectoryInboxRejectionReasonSchema` / `DirectoryInboxRejectionReason` | schema / _type_ | the inbox's claims, receipts and rejections (`invalid`, `too-large`, `attempt-limit`) |
@@ -122,9 +124,10 @@ cutovers are covered by the executable
122
124
 
123
125
  ### Bounded diagnostic journal
124
126
 
127
+ Construct the writer with `createDiagnosticJournal` from `stitchkit/application/diagnostic-journal`.
128
+
125
129
  | Export | Kind | Summary |
126
130
  |--------|------|---------|
127
- | `createDiagnosticJournal` | function | create one schema-owned FIFO JSONL writer with bounded retained memory, exclusive local path ownership and finite rotation |
128
131
  | `DiagnosticJournalConfig` / `DiagnosticJournal` | _type_ | owner schema/path/limits/failure observer, `startupScan` (`tails` by default, or `full`), `onStartupRefusal` (`quarantine` by default, or `fail`) and the synchronous `submit`, bounded-wait `flush`/`close`, status handle |
129
132
  | `DiagnosticJournalLimitsSchema` / `DiagnosticJournalLimits` | schema / _type_ | positive event, pending-item, pending-byte, file-byte and retained-file limits |
130
133
  | `DiagnosticJournalLockPolicySchema` / `DiagnosticJournalLockPolicy` | schema / _type_ | `refuse` (default) or `reclaim-stale`, which reclaims only a lock whose recorded owner is provably gone |
package/llms/cli.txt CHANGED
@@ -702,15 +702,27 @@ Rules worth knowing before you rely on them:
702
702
  A failed call still reports its own error and exit code. An aggregate over an
703
703
  error is not an answer to the question that was asked.
704
704
 
705
- If the command succeeds but its requested view cannot be built, the CLI writes
706
- the complete original result to stdout, using the normal JSON format (`--json`
707
- still selects compact output). It writes a separate structured
708
- `CLI_PRESENTATION_FAILED` diagnostic to stderr and exits with `8`, configurable
709
- through `exitCodes`. Its `details.operationSucceeded: true` and `retryable: false`
710
- distinguish a presentation refusal from a failed operation; `details.cause`
711
- preserves the safe reason. Recover the answer from stdout instead of repeating
712
- the mutation. Domain retry hints are not appended to this diagnostic. CLI
713
- argument errors detected before execution still exit with `2`
705
+ If the command succeeds but its requested view cannot be built, the CLI writes a
706
+ structured `CLI_PRESENTATION_FAILED` diagnostic to stderr and exits with `8`,
707
+ configurable through `exitCodes`. Its `details.operationSucceeded: true` and
708
+ `retryable: false` distinguish a presentation refusal from a failed operation;
709
+ `details.cause` preserves the safe reason, such as the misspelled field and the
710
+ fields that are there. Domain retry hints are not appended to this diagnostic.
711
+
712
+ What reaches stdout depends on whether the command can be called again for its answer,
713
+ and `details.resultOnStdout` states which case occurred:
714
+
715
+ | Command | stdout | Recover the answer by |
716
+ |---|---|---|
717
+ | has an effect | the complete original result in the normal JSON format (`--json` still selects compact output) | reading stdout — never by repeating the mutation |
718
+ | only reads | nothing | repeating the command with a corrected view |
719
+
720
+ A managed command only reads when its tool declares `annotations.readOnlyHint: true`,
721
+ or declares no `readOnlyHint` and its method is `GET`. `readOnlyHint: false` on a `GET`
722
+ endpoint keeps the result on stdout. A native `defineCliCommand` declares neither fact,
723
+ so a failed `present` always keeps the validated result on stdout.
724
+
725
+ CLI argument errors detected before execution still exit with `2`
714
726
  and have no successful result to preserve.
715
727
 
716
728
  ## Named profiles
package/llms/contract.txt CHANGED
@@ -567,7 +567,7 @@ from the root `stitchkit`.
567
567
  | `McpProgressUpdate` | _type_ | one mid-call progress update — `message`, and `progress`/`total` when the operation knows a scale |
568
568
  | `McpReportProgress` | _type_ | `ctx.reportProgress` — sends one update to the host that asked for progress; a no-op when none did, and never throws |
569
569
  | `McpRoundOutcome` | _type_ | managed multi-round attempt outcome |
570
- | `EndpointHandlerContext` | _type_ | one endpoint handler's fully inferred params, input, files and runtime context |
570
+ | `HandlerContext` | _type_ | contract handler's fully inferred params, input, files and runtime context |
571
571
  | `EndpointFn` | _type_ | the call signature of one client method |
572
572
  | `TypedClient` | _type_ | the full typed client for a contract |
573
573
  | `TypedHttpClient` | _type_ | the typed client, HTTP endpoints only (`= ScopedHttpClient<C, unknown>`) |
package/llms/process.txt CHANGED
@@ -172,7 +172,9 @@ concurrently or cancel the stream you ignore. Cancelling a stream drops its late
172
172
  command fails or is stopped, both streams error and the bytes still queued are dropped.
173
173
 
174
174
  A command needs a caller `signal` or a finite `timeoutMs` (1 to 2147483647 ms, the native timer
175
- range; a larger value is refused, never turned into 1 ms). Streaming runs for the caller's lifetime,
175
+ range; a larger value is refused, never turned into 1 ms). `timeoutMs` counts from the moment the
176
+ command started. A guarded command (`ownerLoss: 'terminate'`) first starts its guard; that start is
177
+ bounded by `timeoutMs` or 5 seconds, whichever is longer, and does not use the command's budget. Streaming runs for the caller's lifetime,
176
178
  with no hidden 60-second timeout or 1 MiB output limit. `capture` defaults to false; `true` requires
177
179
  `maxOutputBytes` for the combined stdout and stderr. The limit counts source bytes; the API returns
178
180
  `Uint8Array` and does not decode invalid UTF-8. The result holds the observed `exitCode: number | null`
package/llms/server.2.txt CHANGED
@@ -507,3 +507,51 @@ is simply never emitted, so nothing about a hidden endpoint leaks.
507
507
  const internal = openApiRoute('/internal/openapi.json', fullDoc) // behind auth
508
508
  const publicSpec = openApiRoute('/openapi.json', publicDoc) // curated
509
509
  ```
510
+
511
+ ### Security schemes — `security`
512
+
513
+ A generic client reads the spec to learn how to authenticate, and a scope name
514
+ alone does not tell it which header to send. Pass `security` to describe that in
515
+ standard OpenAPI terms: named schemes become `components.securitySchemes`, and
516
+ every protected operation gets a `security` requirement. It is keyed by the
517
+ scopes your contracts already declare, so there is no second list of which
518
+ endpoint is protected:
519
+
520
+ ```ts
521
+ const publicDoc = generateOpenApiDocument({
522
+ info: { title: 'Public API', version: '1.0.0' },
523
+ services: [account],
524
+ includeMethod: (m) => m.meta?.public === true,
525
+ security: {
526
+ schemes: {
527
+ apiKey: { type: 'http', scheme: 'bearer', description: 'An account API key' },
528
+ },
529
+ // Each protected scope → the schemes that satisfy it, any one of them.
530
+ scopes: { account: ['apiKey'] },
531
+ },
532
+ })
533
+ ```
534
+
535
+ A scheme is `{ type: 'http', scheme: 'bearer' | 'basic' }` or
536
+ `{ type: 'apiKey', in: 'header' | 'query' | 'cookie', name }` (a session cookie
537
+ is the `cookie` form). An operation is described by the scope the auth hook
538
+ checks it under:
539
+
540
+ | The operation's scope | In the document |
541
+ |---|---|
542
+ | `'public'` | no `security`, no 401/403 |
543
+ | listed in `scopes` with schemes | `security: [{ apiKey: [] }, …]` and 401/403 |
544
+ | listed with an empty list — a custom scope whose rule is `'public'` | no `security`, no 401/403 |
545
+ | not listed | generation throws, naming the operation |
546
+ | none of its own | read as `defaultScope` — pass the same value as `createAuthHook({ defaultScope })` |
547
+
548
+ Generation refuses a protected scope it cannot describe instead of emitting the
549
+ operation as open — a client would otherwise call it without a credential. Only
550
+ the operations the document advertises need a mapping: a method `includeMethod`
551
+ filters out is never checked. A scheme `scopes` names but `schemes` does not
552
+ declare, and an entry for `'public'`, are refused the same way.
553
+
554
+ The metadata describes your policy; it does not enforce it. The auth hook is
555
+ still the only gate, and removing `security` changes the document, never a
556
+ 401 or 403. Credential values never belong here: describe where the key goes,
557
+ not what it is.
package/llms/server.5.txt CHANGED
@@ -19,6 +19,8 @@ Also read:
19
19
 
20
20
  ## `stitchkit/server`
21
21
 
22
+ `EndpointHandlerContext` is the server endpoint handler’s inferred params, input, files and runtime context.
23
+
22
24
  Server-only. Builds and runs the HTTP server, and carries the server primitives.
23
25
  Also re-exports the error helpers from `stitchkit/contract`.
24
26
 
@@ -234,6 +236,8 @@ Also re-exports the error helpers from `stitchkit/contract`.
234
236
  | `OpenApiConfig` | _type_ | config for `generateOpenApiDocument` (incl. `includeMethod` — curate a public subset) — [guide](../guide/server.md#curating-the-spec--includemethod) |
235
237
  | `OpenApiDocument` | _type_ | the generated document |
236
238
  | `OpenApiInfo` | _type_ | the spec `info` block |
239
+ | `OpenApiSecurity` | _type_ | `OpenApiConfig.security` — named schemes and the schemes each protected scope accepts — [guide](../guide/server.md#security-schemes--security) |
240
+ | `OpenApiSecurityScheme` | _type_ | one way a caller presents its credential: HTTP bearer or basic, or an API key in a header, query or cookie |
237
241
  | `OpenApiServer` | _type_ | a spec `servers` entry |
238
242
 
239
243
  ---
@@ -92,13 +92,13 @@ own, recorded as an ADR.
92
92
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
93
93
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
94
94
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
95
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 65 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
95
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 67 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
96
96
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
97
97
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
98
98
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
99
99
  | `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
100
100
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
101
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the 65 minors since 0.56.2, most recently 0.115.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
101
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 67 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
102
102
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
103
103
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
104
104
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -110,7 +110,7 @@ own, recorded as an ADR.
110
110
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
111
111
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
112
112
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
113
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 65 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
113
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 67 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
114
114
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
115
115
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
116
116
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
package/llms/tools.txt CHANGED
@@ -498,7 +498,10 @@ render: async (ctx) => {
498
498
 
499
499
  `reportProgress` is present on every **tool** call — MCP, agent and CLI — so a
500
500
  handler never branches on transport, and it does nothing wherever nobody is
501
- listening. It is absent on the HTTP transport, which has no channel for it, so a
501
+ listening. Under the agent runtime somebody is: each report becomes a transient
502
+ `tool-progress` event of the run, so the person watching the agent sees the
503
+ stage while the model still reads only the tool's result (see
504
+ [Agent runtime → events](./agent-runtime.md)). It is absent on the HTTP transport, which has no channel for it, so a
502
505
  handler that also serves HTTP writes `ctx.reportProgress?.(…)`. It never throws and never
503
506
  rejects: a message about work must not be able to kill the work it describes, so
504
507
  a refused notification leaves the host exactly where a host that never asked for
@@ -1,14 +1,92 @@
1
- # Upgrading 0.106.0 → 0.120.0 — stitchkit docs slice
1
+ # Upgrading 0.106.0 → 0.122.0 — stitchkit docs slice
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
5
 
6
- Contains: Guide: Upgrading, 0.106.0 → 0.120.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.106.0 → 0.122.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.106.0 → 0.120.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.106.0 → 0.122.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.122.0
13
+
14
+ ### read-view-refusal
15
+
16
+ **Who must act:** scripts and agents that read stdout after a managed CLI command exits with
17
+ `CLI_PRESENTATION_FAILED` (`8` by default) when that command is a `GET` endpoint or a tool
18
+ declaring `annotations.readOnlyHint: true`. Commands with an effect and native
19
+ `defineCliCommand` presenters change nothing.
20
+
21
+ A read no longer prints its complete result when the requested view is refused; stdout is
22
+ empty and the diagnostic carries `details.resultOnStdout: false`.
23
+
24
+ ```sh
25
+ # before: the full list arrived on stdout beside the diagnostic
26
+ app user_list --table id,nosuchcolumn > users.json # exit 8, users.json holds every record
27
+
28
+ # after: repeat the read with a field the diagnostic names
29
+ app user_list --table id,nosuchcolumn # exit 8, stdout empty
30
+ app user_list --table id,name
31
+ ```
32
+
33
+ A `GET` endpoint whose call has an effect that must not be repeated declares it, and keeps
34
+ its result on stdout:
35
+
36
+ ```ts
37
+ tool: { name: 'token_rotate', annotations: { readOnlyHint: false } }
38
+ ```
39
+
40
+ ## Released migration: 0.121.0
41
+
42
+ ### bounded-coding-search
43
+
44
+ **Who must act:** hosts that construct a complete `AgentCodingToolLimits` value, inspect exact
45
+ `list_directory`, `glob` or `search_files` output objects, rely on symlink cwd aliases, call `glob` on a path that may not exist, or send regex named backreferences or counted repetition above 1,000.
46
+
47
+ Partial `limits` still fill finite defaults. Complete values add:
48
+
49
+ ```ts
50
+ maxSearchDirectories: 1_000,
51
+ maxSearchEntries: 20_000,
52
+ maxSearchBytes: 16_777_216,
53
+ maxSearchOutputBytes: 65_536,
54
+ searchTimeoutMs: 5_000,
55
+ ```
56
+
57
+ Read `coverage.complete` on list, glob and search before interpreting an empty result.
58
+ List raw enumeration is also capped by `maxListEntries`; glob patterns have a 4,096-unit ceiling.
59
+ The ordinary command cwd is a pinned directory, so descendant symlink cwd aliases are refused;
60
+ use the real relative directory name. Custom sandbox launchers own atomic cwd capture.
61
+ `coverage.reasons` names stopped
62
+ budgets, cancellation, denial, unreadable files and lines beyond the searchable byte ceiling.
63
+ `coverage.scope` names the workspace-relative include, exclusion policy and symlink policy;
64
+ directory/entry/read-byte counters report work reached by the bounded reader. Denied and error
65
+ lists can themselves be truncated. The entire UTF-8 JSON result fits `maxSearchOutputBytes`
66
+ (minimum 1,024); an input whose minimum envelope cannot fit refuses before I/O.
67
+
68
+ Regex queries keep JavaScript syntax, `(?ims-ims:…)` modifiers and Annex B forms, and their
69
+ cost is bounded per line: a line whose backtracking work, repetition capped at the line's length,
70
+ stays within 2^24 steps runs natively, any other line in linear time. Named backreferences,
71
+ counted repetition above 1,000 and patterns needing the automaton with more than 16,384 automaton states, 65,536
72
+ construction steps (nested repetition of an empty group such as `(?:(?:){1000}){1000}`) or
73
+ 4,194,304 overlapping character-set memberships now return `BAD_REQUEST`
74
+ before authorization or file access, as
75
+ numbered backreferences and lookaround already did. Spell the repeated text out, for example
76
+ replace `{ query: '(?<w>ab)\\k<w>', regex: true }` with `{ query: '(ab)ab', regex: true }`.
77
+
78
+ `glob` with a `path` that is missing, a file or a symlink now refuses (`NOT_FOUND` or
79
+ `BAD_REQUEST`, with a hint) instead of returning no paths; treat that refusal as "nothing
80
+ there". `run_command` refuses such a `cwd` the same way.
81
+
82
+ Glob matching preserves `**`, `*`, `?` and literal punctuation, including embedded `**`.
83
+ A pattern that prunes directories may produce an explanatory `hint` without counting unseen
84
+ files. `glob` confines traversal to its requested path and viable pattern prefixes.
85
+
86
+ Traversal checks cancellation and deadlines at CPU checkpoints and races asynchronous waits.
87
+ Late opened handles are closed; in-flight operating-system calls are not claimed to be interrupted.
88
+ Reaching an entry or result ceiling conservatively reports partial coverage without a lookahead.
89
+
12
90
  ## Released migration: 0.120.0
13
91
 
14
92
  ### tools-barrel-subpaths
@@ -11,7 +11,7 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
11
11
 
12
12
  Load this slice, then every range slice between your installed version and the target:
13
13
 
14
- - 0.106.0 → 0.120.0: `llms/upgrading-0.106.0-0.120.0.txt`
14
+ - 0.106.0 → 0.122.0: `llms/upgrading-0.106.0-0.122.0.txt`
15
15
  - 0.96.0 → 0.105.0: `llms/upgrading-0.96.0-0.105.0.txt`
16
16
  - 0.69.0 → 0.95.0: `llms/upgrading-0.69.0-0.95.0.txt`
17
17
  - 0.55.0 → 0.68.0: `llms/upgrading-0.55.0-0.68.0.txt`