@yanlinglabs/winter-agent-runtime 0.0.27

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 (311) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +41 -0
  3. package/README.md +64 -0
  4. package/dist/checkpoint/file-history.d.ts +81 -0
  5. package/dist/checkpoint/rewind.d.ts +55 -0
  6. package/dist/checkpoint/seam.d.ts +47 -0
  7. package/dist/checkpoint/sink.d.ts +66 -0
  8. package/dist/commands/builtins-listing.d.ts +40 -0
  9. package/dist/commands/resolver.d.ts +103 -0
  10. package/dist/commands/seam.d.ts +53 -0
  11. package/dist/compaction/controller.d.ts +23 -0
  12. package/dist/compaction/retention.d.ts +35 -0
  13. package/dist/compaction/seam.d.ts +115 -0
  14. package/dist/compaction/summarizer.d.ts +79 -0
  15. package/dist/context/agent-listing.d.ts +39 -0
  16. package/dist/context/assembler.d.ts +46 -0
  17. package/dist/context/attachments.d.ts +104 -0
  18. package/dist/context/dynamic-sections.d.ts +31 -0
  19. package/dist/context/git-fixture.d.ts +18 -0
  20. package/dist/context/git-status.d.ts +16 -0
  21. package/dist/context/imports.d.ts +22 -0
  22. package/dist/context/injection.d.ts +53 -0
  23. package/dist/context/memory-key.d.ts +46 -0
  24. package/dist/context/memory.d.ts +28 -0
  25. package/dist/context/minimal-prompt.d.ts +5 -0
  26. package/dist/context/output-styles.d.ts +68 -0
  27. package/dist/context/plan-mode.d.ts +29 -0
  28. package/dist/context/request-layout.d.ts +138 -0
  29. package/dist/context/rules.d.ts +63 -0
  30. package/dist/context/seam.d.ts +136 -0
  31. package/dist/context/tool-epoch.d.ts +118 -0
  32. package/dist/context/winter-code-preset.d.ts +39 -0
  33. package/dist/context/winter-md.d.ts +81 -0
  34. package/dist/embedded-host.d.ts +48 -0
  35. package/dist/embedded-host.js +155 -0
  36. package/dist/embedded-protocol.d.ts +44 -0
  37. package/dist/embedded-worker.d.ts +1 -0
  38. package/dist/embedded-worker.js +74 -0
  39. package/dist/embedded.d.ts +34 -0
  40. package/dist/embedded.js +9 -0
  41. package/dist/engine.d.ts +1298 -0
  42. package/dist/hooks/additional-context.d.ts +21 -0
  43. package/dist/hooks/bounds.d.ts +6 -0
  44. package/dist/hooks/bridge-invoker.d.ts +3 -0
  45. package/dist/hooks/command-invoker.d.ts +52 -0
  46. package/dist/hooks/from-config.d.ts +31 -0
  47. package/dist/hooks/hook-stage.d.ts +25 -0
  48. package/dist/hooks/input-validator.d.ts +6 -0
  49. package/dist/hooks/reducer.d.ts +74 -0
  50. package/dist/hooks/registry.d.ts +33 -0
  51. package/dist/hooks/runner.d.ts +105 -0
  52. package/dist/index-584yahed.js +6037 -0
  53. package/dist/index-97t2rmtf.js +42 -0
  54. package/dist/index-9qgkpv56.js +27183 -0
  55. package/dist/index-bef62z3r.js +437 -0
  56. package/dist/index-rkhh0457.js +187 -0
  57. package/dist/index.d.ts +37 -0
  58. package/dist/index.js +353 -0
  59. package/dist/main.d.ts +1 -0
  60. package/dist/mcp/client.d.ts +105 -0
  61. package/dist/mcp/control-seam.d.ts +25 -0
  62. package/dist/mcp/control.d.ts +5 -0
  63. package/dist/mcp/elicitation.d.ts +35 -0
  64. package/dist/mcp/env.d.ts +12 -0
  65. package/dist/mcp/lifecycle.d.ts +142 -0
  66. package/dist/mcp/output-cap.d.ts +15 -0
  67. package/dist/mcp/state.d.ts +24 -0
  68. package/dist/mcp/test-fixtures.d.ts +88 -0
  69. package/dist/mcp/transports/__fixtures__/stdio-server.d.ts +1 -0
  70. package/dist/mcp/transports/http.d.ts +5 -0
  71. package/dist/mcp/transports/sdk.d.ts +5 -0
  72. package/dist/mcp/transports/sse.d.ts +3 -0
  73. package/dist/mcp/transports/stdio.d.ts +35 -0
  74. package/dist/mcp/winter-server.d.ts +2 -0
  75. package/dist/messaging/reference-adapter.d.ts +88 -0
  76. package/dist/messaging/router.d.ts +8 -0
  77. package/dist/paths/project-dir-name.d.ts +2 -0
  78. package/dist/paths/temp.d.ts +25 -0
  79. package/dist/permissions/approvals.d.ts +107 -0
  80. package/dist/permissions/auto/caches.d.ts +53 -0
  81. package/dist/permissions/auto/config.d.ts +37 -0
  82. package/dist/permissions/auto/engine.d.ts +74 -0
  83. package/dist/permissions/auto/envelope.d.ts +45 -0
  84. package/dist/permissions/auto/inheritance.d.ts +27 -0
  85. package/dist/permissions/edit-recognition.d.ts +30 -0
  86. package/dist/permissions/evaluator.d.ts +284 -0
  87. package/dist/permissions/file-rules.d.ts +384 -0
  88. package/dist/permissions/grammar.d.ts +113 -0
  89. package/dist/permissions/paths.d.ts +32 -0
  90. package/dist/permissions/policy-state.d.ts +64 -0
  91. package/dist/permissions/prompt-stage.d.ts +3 -0
  92. package/dist/permissions/protected.d.ts +54 -0
  93. package/dist/permissions/ruleset.d.ts +134 -0
  94. package/dist/permissions/shell-structure.d.ts +41 -0
  95. package/dist/plugins/bundle.d.ts +100 -0
  96. package/dist/plugins/installed.d.ts +30 -0
  97. package/dist/plugins/loader.d.ts +56 -0
  98. package/dist/plugins/manifest.d.ts +115 -0
  99. package/dist/production-wiring.d.ts +340 -0
  100. package/dist/protocol/channel.d.ts +22 -0
  101. package/dist/provider/advisor-route.d.ts +47 -0
  102. package/dist/provider/bridge.d.ts +124 -0
  103. package/dist/provider/classifier/model-classifier.d.ts +82 -0
  104. package/dist/provider/classifier/prompt.d.ts +62 -0
  105. package/dist/provider/classifier/verdict-schema.d.ts +83 -0
  106. package/dist/provider/credential-api.d.ts +160 -0
  107. package/dist/provider/family-listing.d.ts +27 -0
  108. package/dist/provider/first-party.d.ts +4 -0
  109. package/dist/provider/keychain-store.d.ts +59 -0
  110. package/dist/provider/lean-prompt.d.ts +7 -0
  111. package/dist/provider/mock.d.ts +55 -0
  112. package/dist/provider/scenario-fake.d.ts +96 -0
  113. package/dist/provider/selection.d.ts +115 -0
  114. package/dist/provider/session-provider.d.ts +426 -0
  115. package/dist/provider/slots.d.ts +120 -0
  116. package/dist/provider/stream-frames.d.ts +25 -0
  117. package/dist/provider/tool-secret.d.ts +57 -0
  118. package/dist/rpc/bridge.d.ts +14 -0
  119. package/dist/rpc/mcp-control.d.ts +26 -0
  120. package/dist/runtime.d.ts +14 -0
  121. package/dist/sandbox/profile.d.ts +249 -0
  122. package/dist/sandbox/spawn.d.ts +139 -0
  123. package/dist/settings/env-filter.d.ts +52 -0
  124. package/dist/settings/loaders/hooks.d.ts +44 -0
  125. package/dist/settings/loaders/mcp-config.d.ts +83 -0
  126. package/dist/settings/loaders/plugin-mcp.d.ts +3 -0
  127. package/dist/settings/loaders/strict-plugin-only.d.ts +13 -0
  128. package/dist/settings/resolve.d.ts +2 -0
  129. package/dist/settings/sources.d.ts +2 -0
  130. package/dist/settings/trust.d.ts +36 -0
  131. package/dist/skills/attachment.d.ts +25 -0
  132. package/dist/skills/frontmatter.d.ts +64 -0
  133. package/dist/skills/index.d.ts +16 -0
  134. package/dist/skills/listing.d.ts +89 -0
  135. package/dist/skills/loader.d.ts +104 -0
  136. package/dist/skills/option.d.ts +68 -0
  137. package/dist/skills/permission-rules.d.ts +21 -0
  138. package/dist/skills/runtime.d.ts +21 -0
  139. package/dist/skills/store.d.ts +163 -0
  140. package/dist/store/continuation-attach.d.ts +44 -0
  141. package/dist/store/dialect.d.ts +526 -0
  142. package/dist/store/provider-state.d.ts +188 -0
  143. package/dist/store/resume.d.ts +92 -0
  144. package/dist/structured/ajv-seam.d.ts +7 -0
  145. package/dist/structured/descriptor.d.ts +9 -0
  146. package/dist/structured/seam.d.ts +51 -0
  147. package/dist/structured/validator.d.ts +22 -0
  148. package/dist/subagents/activity.d.ts +13 -0
  149. package/dist/subagents/availability.d.ts +30 -0
  150. package/dist/subagents/builtin-agents.d.ts +37 -0
  151. package/dist/subagents/child-engine.d.ts +198 -0
  152. package/dist/subagents/child-handle.d.ts +344 -0
  153. package/dist/subagents/definitions.d.ts +189 -0
  154. package/dist/subagents/fork.d.ts +55 -0
  155. package/dist/subagents/git-root.d.ts +1 -0
  156. package/dist/subagents/limits.d.ts +28 -0
  157. package/dist/subagents/notification-queue.d.ts +233 -0
  158. package/dist/subagents/plugin-agents.d.ts +5 -0
  159. package/dist/subagents/policy.d.ts +46 -0
  160. package/dist/subagents/register-default-factory.d.ts +66 -0
  161. package/dist/subagents/resolution.d.ts +56 -0
  162. package/dist/subagents/restore.d.ts +9 -0
  163. package/dist/subagents/roster.d.ts +17 -0
  164. package/dist/subagents/test-fakes.d.ts +12 -0
  165. package/dist/subagents/tool-pools.d.ts +69 -0
  166. package/dist/subagents/watchdog.d.ts +13 -0
  167. package/dist/subagents/workspace.d.ts +27 -0
  168. package/dist/testing.d.ts +5 -0
  169. package/dist/testing.js +194 -0
  170. package/dist/tools/background-tasks.d.ts +10 -0
  171. package/dist/tools/descriptors/_shared.d.ts +34 -0
  172. package/dist/tools/descriptors/advisor.d.ts +1 -0
  173. package/dist/tools/descriptors/agent.d.ts +47 -0
  174. package/dist/tools/descriptors/artifact.d.ts +1 -0
  175. package/dist/tools/descriptors/ask-user-question.d.ts +1 -0
  176. package/dist/tools/descriptors/bash.d.ts +20 -0
  177. package/dist/tools/descriptors/claude-design.d.ts +1 -0
  178. package/dist/tools/descriptors/cron-create.d.ts +1 -0
  179. package/dist/tools/descriptors/cron-delete.d.ts +1 -0
  180. package/dist/tools/descriptors/cron-list.d.ts +1 -0
  181. package/dist/tools/descriptors/edit.d.ts +1 -0
  182. package/dist/tools/descriptors/end-conversation.d.ts +1 -0
  183. package/dist/tools/descriptors/enter-plan-mode.d.ts +1 -0
  184. package/dist/tools/descriptors/enter-worktree.d.ts +1 -0
  185. package/dist/tools/descriptors/exit-plan-mode.d.ts +1 -0
  186. package/dist/tools/descriptors/exit-worktree.d.ts +1 -0
  187. package/dist/tools/descriptors/glob.d.ts +1 -0
  188. package/dist/tools/descriptors/grep.d.ts +1 -0
  189. package/dist/tools/descriptors/index.d.ts +59 -0
  190. package/dist/tools/descriptors/list-agents.d.ts +1 -0
  191. package/dist/tools/descriptors/list-mcp-resources-tool.d.ts +1 -0
  192. package/dist/tools/descriptors/lsp.d.ts +1 -0
  193. package/dist/tools/descriptors/monitor.d.ts +1 -0
  194. package/dist/tools/descriptors/notebook-edit.d.ts +1 -0
  195. package/dist/tools/descriptors/powershell.d.ts +1 -0
  196. package/dist/tools/descriptors/projects.d.ts +1 -0
  197. package/dist/tools/descriptors/propose-goal.d.ts +1 -0
  198. package/dist/tools/descriptors/propose-skills.d.ts +1 -0
  199. package/dist/tools/descriptors/push-notification.d.ts +1 -0
  200. package/dist/tools/descriptors/read-mcp-resource-dir-tool.d.ts +1 -0
  201. package/dist/tools/descriptors/read-mcp-resource-tool.d.ts +1 -0
  202. package/dist/tools/descriptors/read-notifications.d.ts +1 -0
  203. package/dist/tools/descriptors/read.d.ts +1 -0
  204. package/dist/tools/descriptors/refresh-mcp-tools.d.ts +1 -0
  205. package/dist/tools/descriptors/remote-trigger.d.ts +1 -0
  206. package/dist/tools/descriptors/repl.d.ts +1 -0
  207. package/dist/tools/descriptors/report-findings.d.ts +1 -0
  208. package/dist/tools/descriptors/schedule-wakeup.d.ts +1 -0
  209. package/dist/tools/descriptors/send-feedback.d.ts +1 -0
  210. package/dist/tools/descriptors/send-message.d.ts +1 -0
  211. package/dist/tools/descriptors/send-user-file.d.ts +1 -0
  212. package/dist/tools/descriptors/share-onboarding-guide.d.ts +1 -0
  213. package/dist/tools/descriptors/show-onboarding-role-picker.d.ts +1 -0
  214. package/dist/tools/descriptors/skill.d.ts +1 -0
  215. package/dist/tools/descriptors/structured-output.d.ts +1 -0
  216. package/dist/tools/descriptors/task-create.d.ts +1 -0
  217. package/dist/tools/descriptors/task-get.d.ts +1 -0
  218. package/dist/tools/descriptors/task-list.d.ts +1 -0
  219. package/dist/tools/descriptors/task-output.d.ts +1 -0
  220. package/dist/tools/descriptors/task-stop.d.ts +1 -0
  221. package/dist/tools/descriptors/task-update.d.ts +1 -0
  222. package/dist/tools/descriptors/todo-write.d.ts +1 -0
  223. package/dist/tools/descriptors/tool-search.d.ts +1 -0
  224. package/dist/tools/descriptors/wait-for-mcp-servers.d.ts +1 -0
  225. package/dist/tools/descriptors/web-fetch.d.ts +8 -0
  226. package/dist/tools/descriptors/web-search.d.ts +15 -0
  227. package/dist/tools/descriptors/winter-list-agents.d.ts +1 -0
  228. package/dist/tools/descriptors/winter-send-message.d.ts +1 -0
  229. package/dist/tools/descriptors/workflow.d.ts +1 -0
  230. package/dist/tools/descriptors/write.d.ts +1 -0
  231. package/dist/tools/impl/_caller.d.ts +14 -0
  232. package/dist/tools/impl/_domains.d.ts +25 -0
  233. package/dist/tools/impl/_exa-client.d.ts +122 -0
  234. package/dist/tools/impl/_exa-session-client.d.ts +23 -0
  235. package/dist/tools/impl/_inner-model.d.ts +135 -0
  236. package/dist/tools/impl/_search-budget.d.ts +36 -0
  237. package/dist/tools/impl/_web-fetch-cache.d.ts +37 -0
  238. package/dist/tools/impl/_web-fetch-html.d.ts +26 -0
  239. package/dist/tools/impl/_web-fetch-net.d.ts +99 -0
  240. package/dist/tools/impl/_web-search-assembler.d.ts +57 -0
  241. package/dist/tools/impl/advisor.d.ts +37 -0
  242. package/dist/tools/impl/agent.d.ts +10 -0
  243. package/dist/tools/impl/ask-user-question.d.ts +5 -0
  244. package/dist/tools/impl/background-task-runtime.d.ts +272 -0
  245. package/dist/tools/impl/bash.d.ts +78 -0
  246. package/dist/tools/impl/cron.d.ts +11 -0
  247. package/dist/tools/impl/edit.d.ts +1 -0
  248. package/dist/tools/impl/enter-plan-mode.d.ts +4 -0
  249. package/dist/tools/impl/enter-worktree.d.ts +25 -0
  250. package/dist/tools/impl/exit-plan-mode.d.ts +4 -0
  251. package/dist/tools/impl/exit-worktree.d.ts +4 -0
  252. package/dist/tools/impl/glob.d.ts +1 -0
  253. package/dist/tools/impl/grep.d.ts +19 -0
  254. package/dist/tools/impl/index.d.ts +37 -0
  255. package/dist/tools/impl/list-agents.d.ts +7 -0
  256. package/dist/tools/impl/list-mcp-resources-tool.d.ts +9 -0
  257. package/dist/tools/impl/monitor.d.ts +66 -0
  258. package/dist/tools/impl/notebook-edit.d.ts +1 -0
  259. package/dist/tools/impl/push-notification.d.ts +4 -0
  260. package/dist/tools/impl/read-ladder.d.ts +25 -0
  261. package/dist/tools/impl/read-mcp-resource-dir-tool.d.ts +9 -0
  262. package/dist/tools/impl/read-mcp-resource-tool.d.ts +9 -0
  263. package/dist/tools/impl/read-notifications.d.ts +5 -0
  264. package/dist/tools/impl/read.d.ts +44 -0
  265. package/dist/tools/impl/refresh-mcp-tools.d.ts +8 -0
  266. package/dist/tools/impl/report-findings.d.ts +1 -0
  267. package/dist/tools/impl/schedule-wakeup.d.ts +2 -0
  268. package/dist/tools/impl/send-message.d.ts +7 -0
  269. package/dist/tools/impl/skill.d.ts +5 -0
  270. package/dist/tools/impl/task-graph.d.ts +1 -0
  271. package/dist/tools/impl/task-output.d.ts +16 -0
  272. package/dist/tools/impl/task-stop.d.ts +11 -0
  273. package/dist/tools/impl/todo-write.d.ts +8 -0
  274. package/dist/tools/impl/tool-search.d.ts +4 -0
  275. package/dist/tools/impl/wait-for-mcp-servers.d.ts +29 -0
  276. package/dist/tools/impl/web-fetch.d.ts +36 -0
  277. package/dist/tools/impl/web-search.d.ts +30 -0
  278. package/dist/tools/impl/workflow.d.ts +5 -0
  279. package/dist/tools/impl/write.d.ts +8 -0
  280. package/dist/tools/paths-seam.d.ts +6 -0
  281. package/dist/tools/read-state.d.ts +12 -0
  282. package/dist/tools/registry.d.ts +423 -0
  283. package/dist/tools/task-graph-store.d.ts +61 -0
  284. package/dist/toolsearch/aliases.d.ts +26 -0
  285. package/dist/toolsearch/exposure.d.ts +30 -0
  286. package/dist/toolsearch/ranking.d.ts +6 -0
  287. package/dist/toolsearch/search.d.ts +45 -0
  288. package/dist/version.d.ts +1 -0
  289. package/dist/version.js +5 -0
  290. package/dist/web/fetchable-url.d.ts +28 -0
  291. package/dist/web/preapproved-hosts.d.ts +52 -0
  292. package/dist/web/private-address.d.ts +55 -0
  293. package/dist/web/session-runtime.d.ts +86 -0
  294. package/dist/workflows/bridge.d.ts +87 -0
  295. package/dist/workflows/budget.d.ts +24 -0
  296. package/dist/workflows/host-registry.d.ts +142 -0
  297. package/dist/workflows/journal.d.ts +29 -0
  298. package/dist/workflows/meta.d.ts +45 -0
  299. package/dist/workflows/registry.d.ts +24 -0
  300. package/dist/workflows/runtime.d.ts +254 -0
  301. package/dist/workflows/sandbox.d.ts +49 -0
  302. package/dist/workflows/script-api.d.ts +58 -0
  303. package/dist/workflows/seam.d.ts +92 -0
  304. package/dist/workflows/semaphore.d.ts +16 -0
  305. package/dist/workflows/store.d.ts +177 -0
  306. package/dist/workflows/subprocess-entry.d.ts +38 -0
  307. package/dist/workflows/subprocess-entry.js +14 -0
  308. package/dist/workflows/transcript.d.ts +56 -0
  309. package/dist/workflows/types.d.ts +84 -0
  310. package/dist/workflows/worker-harness.d.ts +45 -0
  311. package/package.json +76 -0
@@ -0,0 +1,99 @@
1
+ export declare const WEB_FETCH_MAX_BYTES = 10485760;
2
+ export declare const WEB_FETCH_TIMEOUT_MS = 60000;
3
+ export declare const WEB_FETCH_MAX_REDIRECTS = 10;
4
+ /** claude's own `I_e(code)`: a FIXED table lookup, never the wire's own (server-controlled) reason phrase -- see the module header, finding M1. */
5
+ export declare function reasonPhrase(status: number): string;
6
+ /** The three-value policy AFTER `web-fetch.ts`'s own fail-closed coercion -- this module trusts it verbatim. */
7
+ export type NormalizedPrivateAddressPolicy = "allow" | "deny" | "ask";
8
+ export interface WebFetchNetDeps {
9
+ fetchImpl?: (url: string, init: {
10
+ redirect: "manual";
11
+ headers: Record<string, string>;
12
+ signal: AbortSignal;
13
+ decompress: false;
14
+ tls: {
15
+ serverName: string;
16
+ };
17
+ }) => Promise<Response>;
18
+ resolveHost?: (hostname: string) => Promise<readonly string[]>;
19
+ now?: () => number;
20
+ timeoutMs?: number;
21
+ }
22
+ export interface WebFetchNetOptions {
23
+ blockedDomains: readonly string[];
24
+ privateAddressPolicy: NormalizedPrivateAddressPolicy;
25
+ userAgent: string;
26
+ signal?: AbortSignal;
27
+ }
28
+ export type WebFetchNetOutcome = {
29
+ kind: "invalid-url";
30
+ message: string;
31
+ } | {
32
+ kind: "blocked-domain";
33
+ host: string;
34
+ } | {
35
+ kind: "private-address";
36
+ host: string;
37
+ policy: "deny" | "ask";
38
+ } | {
39
+ kind: "redirect-blocked";
40
+ message: string;
41
+ } | {
42
+ kind: "too-many-redirects";
43
+ message: string;
44
+ } | {
45
+ kind: "http-error";
46
+ status: number;
47
+ statusText: string;
48
+ retryAfter?: string;
49
+ } | {
50
+ kind: "size-exceeded";
51
+ message: string;
52
+ } | {
53
+ kind: "timeout";
54
+ message: string;
55
+ } | {
56
+ kind: "aborted";
57
+ } | {
58
+ kind: "network-error";
59
+ message: string;
60
+ } | {
61
+ kind: "success";
62
+ finalUrl: string;
63
+ status: number;
64
+ statusText: string;
65
+ contentType: string;
66
+ body: Uint8Array;
67
+ };
68
+ /** Exported so `web-fetch.ts`'s own upfront (pre-cache) gate uses the SAME default resolver -- never a second, drifting copy. */
69
+ export declare function defaultResolveHost(hostname: string): Promise<readonly string[]>;
70
+ /**
71
+ * `validateInput`'s own parse-failure text -- WITH the `Error: ` prefix (fidelity #2).
72
+ *
73
+ * A real string in claude's binary that NO input can reach there: claude validates a call against the
74
+ * tool's input schema (`url: format uri`) BEFORE the tool's own validation, so an unparseable URL is
75
+ * refused by the schema (`InputValidationError: [...] "Invalid URL"`) and anything the schema lets
76
+ * through also parses here. This runtime has no schema-validation step in front of its executors, so
77
+ * the same text IS reachable, as the backstop for exactly the inputs claude's schema refuses. It
78
+ * stops being reachable the day such a step exists.
79
+ */
80
+ export declare function parseFailureMessage(raw: string): string;
81
+ export declare const WEB_FETCH_MAX_ENCODED_BYTES: number;
82
+ export type BodyReadResult = {
83
+ kind: "ok";
84
+ body: Uint8Array;
85
+ } | {
86
+ kind: "output-cap-exceeded";
87
+ } | {
88
+ kind: "input-cap-exceeded";
89
+ } | {
90
+ kind: "unsupported-encoding";
91
+ encoding: string;
92
+ };
93
+ /**
94
+ * Performs the whole fetch, including the manual redirect walk -- one HTTP request per hop, each
95
+ * hop re-checked against the domain floor and the private-address policy (closing the short-link
96
+ * bypass: a blocked/private host reached via an intermediate redirect is refused exactly like one
97
+ * reached directly).
98
+ */
99
+ export declare function performWebFetch(inputUrl: string, prompt: string, opts: WebFetchNetOptions, deps?: WebFetchNetDeps): Promise<WebFetchNetOutcome>;
@@ -0,0 +1,57 @@
1
+ /** A search hit as the OUTER (main-loop) model is allowed to see it: title and url ONLY -- no highlight, no date, no encrypted content. */
2
+ export interface WebSearchOutputHit {
3
+ title: string;
4
+ url: string;
5
+ }
6
+ /**
7
+ * The claude-shaped BLOCK STREAM: text deltas (accumulate), a search that returned hits (a
8
+ * `web_search_tool_result` block), or a search that failed (a result-block error, which claude
9
+ * renders as the STRING `Web search error: ${code}` -- NOT as an empty links item; see the research
10
+ * file's own "a result-block error pushes the string" line).
11
+ */
12
+ export type WebSearchStreamEvent = {
13
+ type: "text";
14
+ text: string;
15
+ } | {
16
+ type: "search_result";
17
+ hits: readonly WebSearchOutputHit[];
18
+ } | {
19
+ type: "search_error";
20
+ code: string;
21
+ };
22
+ /** claude's own structured shape (research file, verbatim, `tool_use_id` dropped -- see the module header). */
23
+ export type WebSearchResultItem = string | {
24
+ content: readonly WebSearchOutputHit[];
25
+ };
26
+ /**
27
+ * Stage 1: the stream walk. Text concatenates (raw block-delta accumulation, no separator -- the
28
+ * research file's "text blocks accumulate"); a search boundary flushes the trimmed buffer as a STRING
29
+ * item WHEN IT IS NON-EMPTY (see the module header), then pushes the search's own item (a links item
30
+ * for a result, a string for an error); the buffer flushes once more at the end for any trailing
31
+ * commentary, under the identical non-empty rule.
32
+ */
33
+ export declare function flushWebSearchStream(events: readonly WebSearchStreamEvent[]): WebSearchResultItem[];
34
+ /**
35
+ * Stage 2: the render. Verbatim from the research file: header + `"\n\n"`; each item + `"\n\n"`
36
+ * (a string item as-is; a links item as `Links: ` + COMPACT `JSON.stringify` of `[{title,url}]`, or
37
+ * `No links found.` when its `content` is empty); then `"\n"` + the reminder; the WHOLE string
38
+ * `.trim()`ed once at the end (which is what removes the header's own leading blank-line pair when
39
+ * there happen to be zero items, and any trailing blank line before the reminder).
40
+ */
41
+ export declare function renderWebSearchToolResult(query: string, items: readonly WebSearchResultItem[]): string;
42
+ /** Both stages composed -- what a caller with no use for the intermediate item list reaches for. */
43
+ export declare function assembleWebSearchOutput(query: string, events: readonly WebSearchStreamEvent[]): string;
44
+ /**
45
+ * `renderWebSearchToolResult`, but never longer than `cap` -- and the cap NEVER costs the header or
46
+ * the REMINDER footer (review fix: a raw `text.slice(0, cap)` on the FULL render chops from the end,
47
+ * which is exactly where the "you MUST include sources" trailer lives -- the one line most worth
48
+ * keeping when there was the most to cite). Items are dropped from the END, in stream order (the
49
+ * earliest results and commentary are kept), one at a time, until what remains renders under `cap`;
50
+ * with zero items left the render is just `header + "\n\n" + REMINDER`, which is the floor this
51
+ * function can promise -- a `cap` smaller than THAT floor (an unrealistic value for a 100,000-char
52
+ * default and an ordinary query) is the one input this cannot fully honour, and is left uncapped
53
+ * further than that floor rather than truncating the header or the reminder itself.
54
+ */
55
+ export declare function renderWebSearchToolResultCapped(query: string, items: readonly WebSearchResultItem[], cap: number): string;
56
+ /** Both stages composed, capped -- what `impl/web-search.ts` calls instead of slicing the finished string. */
57
+ export declare function assembleWebSearchOutputCapped(query: string, events: readonly WebSearchStreamEvent[], cap: number): string;
@@ -0,0 +1,37 @@
1
+ import "../descriptors/advisor.ts";
2
+ import type { Provider } from "../../engine.js";
3
+ import { type ToolExecutor } from "../registry.js";
4
+ import { type TranscriptEntry, type TranscriptSource } from "@yanlinglabs/winter-agent-sdk/tools";
5
+ /**
6
+ * D29: the canonical name IS the advertised name, and it is bare. Read off the one definition, so
7
+ * the registered name and the descriptor's can never disagree.
8
+ */
9
+ export declare const ADVISOR_TOOL_NAME: string;
10
+ export type { TranscriptEntry, TranscriptSource };
11
+ export { assembleReviewerMessages, ADVISOR_DEFAULT_MAX_CHARS, OPAQUE_MARKERS, stripOpaqueMarkers } from "@yanlinglabs/winter-agent-sdk/tools";
12
+ /**
13
+ * Resolves BOTH the provider to call and the model id the result must report, TOGETHER: WS-06 §4's
14
+ * result shape pins `model: string` as required, but `Provider` has no `model` field to read back --
15
+ * whatever backs the `winter.reviewer-model` capability must hand back the model id alongside the
16
+ * provider instance it resolved, in ONE seam, rather than two seams that could disagree.
17
+ *
18
+ * Typed against THIS runtime's `Provider` (not the SDK's `AdvisorReviewer`): the resolver is the
19
+ * provider layer's own door, and the narrowing happens at the boundary below.
20
+ */
21
+ export interface ResolvedReviewer {
22
+ provider: Provider;
23
+ model: string;
24
+ }
25
+ export type ReviewerResolver = () => ResolvedReviewer | undefined;
26
+ export interface AdvisorExecutorDeps {
27
+ transcriptSource: TranscriptSource;
28
+ resolveReviewer: ReviewerResolver;
29
+ /** Injectable so tests can pin the truncation boundary without a multi-KB fixture transcript. */
30
+ maxChars?: number;
31
+ }
32
+ /**
33
+ * NO CACHE (WS-06 §4's closing line: "the advisor and the auto-mode classifier are separate routes
34
+ * and MUST NOT share a verdict cache"). The SDK factory memoizes nothing, and neither does this
35
+ * wrapper -- every call re-resolves the reviewer, re-assembles the transcript and re-generates.
36
+ */
37
+ export declare function createAdvisorExecutor(deps: AdvisorExecutorDeps): ToolExecutor;
@@ -0,0 +1,10 @@
1
+ import { type ToolExecutor } from "../registry.js";
2
+ export declare const AGENT_TOOL_NAME = "Agent";
3
+ /** R-S5 / claude's own wording (an error message, not prompt text -- R-S4). */
4
+ export declare const FORK_INSIDE_FORK_REFUSAL = "Fork is not available inside a forked worker. Complete your task directly using your tools.";
5
+ /**
6
+ * R-S5: claude's fork+remote refusal. The research file truncates claude's string after the dash; the
7
+ * tail is a WINTER completion (disclosed).
8
+ */
9
+ export declare const FORK_REMOTE_REFUSAL = "Fork cannot use isolation: \"remote\" \u2014 a fork inherits this session's live conversation, which a remote environment cannot receive. Omit isolation, or use isolation: \"worktree\".";
10
+ export declare const agentExecutor: ToolExecutor;
@@ -0,0 +1,5 @@
1
+ import "../descriptors/ask-user-question.ts";
2
+ import { type ToolExecutor } from "../registry.js";
3
+ export declare const ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion";
4
+ export declare const ASK_USER_QUESTION_ANSWER_KEY_FIELD: "question";
5
+ export declare const askUserQuestionExecutor: ToolExecutor;
@@ -0,0 +1,272 @@
1
+ export type BackgroundTaskKind = "bash" | "monitor" | "monitor_ws" | "workflow" | "agent";
2
+ import type { BackgroundTaskMessage } from "@yanlinglabs/winter-agent-sdk";
3
+ import type { RunCommandResult } from "../../sandbox/spawn.js";
4
+ export type BackgroundTaskStatus = "running" | "completed" | "failed" | "stopped";
5
+ export interface TaskFrameEmitter {
6
+ emitFrame: (frame: BackgroundTaskMessage) => void;
7
+ sessionId: string;
8
+ }
9
+ export interface BackgroundTaskHandle {
10
+ taskId: string;
11
+ kind: BackgroundTaskKind;
12
+ outputPath: string;
13
+ /** Required -- WS-06 §3.5's own task_started frame requires `description`; callers fall back to the command text when the model didn't supply one. */
14
+ description: string;
15
+ command?: string;
16
+ /** The spawned child's pid. Always the process-GROUP leader (spawn.ts's `detached: true`), so killTaskProcessGroup's negative-pid signal reaps the whole group, matching WS-12 §5.2. */
17
+ pid?: number;
18
+ /**
19
+ * A generic stop callback for a task with no OS process to signal -- Monitor's `ws` half is a
20
+ * live socket, not a child process, so it has no pid at all. `stopTask` (below) tries
21
+ * `killTaskProcessGroup` first (bash / Monitor's `command` half) and falls back to this callback
22
+ * (Monitor's `ws` half) so TaskStop has exactly ONE call to make regardless of which kind of
23
+ * background task it is stopping.
24
+ */
25
+ stop?: () => void;
26
+ status: BackgroundTaskStatus;
27
+ startedAt: number;
28
+ /**
29
+ * Task-frames parity (contract §1/§2): only meaningful for a `local_agent`/`local_bash` row (the
30
+ * two wire kinds the pin's own `register()` puts the flag on at all) -- `undefined` for every other
31
+ * kind (workflow, monitor_ws), which never carry it on `task_started` either. `false` marks a
32
+ * FOREGROUND row: excluded from `listRunningTasks()`'s own `background_tasks_changed` listing
33
+ * (§1's `"isBackgrounded" in task && task.isBackgrounded === false` rule). A foreground BASH row
34
+ * terminates through a caller-built notification + `removeTask` (§3, no task_updated); a
35
+ * foreground AGENT row terminates through `updateTask` exactly like a background one (§4, corrected
36
+ * from a live run of the pin).
37
+ */
38
+ isBackgrounded?: boolean;
39
+ /** The model's own `tool_use` id for the call that created this task, when known -- carried onto this row's own `task_notification`/`task_updated` unless a call overrides it. */
40
+ toolUseId?: string;
41
+ endTime?: number;
42
+ totalPausedMs?: number;
43
+ error?: string;
44
+ emitter?: TaskFrameEmitter;
45
+ /**
46
+ * Review r1 finding 4: the row's LIVE usage counters, when the task kind has any (an agent row --
47
+ * `tools/impl/agent.ts` wires it to the child's own progress snapshot). `notifyTerminal` reads it
48
+ * as the default `task_notification.usage`, so EVERY terminal door for an agent row -- the agent's
49
+ * own result path AND a TaskStop that finalizes the row first -- reports the same usage, instead
50
+ * of the TaskStop door silently dropping it.
51
+ */
52
+ usage?: () => TaskUsage | undefined;
53
+ /**
54
+ * The spawning engine's own agent key (`ToolExecutionContext.agentId`) -- absent for a task the
55
+ * TOP-LEVEL session started. Read only by `stopSessionShellTasks` below (engine teardown), which is
56
+ * what makes a subagent's teardown stop the shells THAT subagent started and nothing else (the
57
+ * pin's own `killShellTasksForAgent` on agent exit).
58
+ */
59
+ ownerAgentId?: string;
60
+ /**
61
+ * Contract §1's `ambient` (a row that runs for the session rather than for a request). NOTHING sets
62
+ * it today -- it exists because the print-mode background WAIT excludes an ambient `monitor_ws` row
63
+ * (claude's own `Mtn`), and a filter written against a field nobody can set would be a filter that
64
+ * silently means nothing the day someone does set it.
65
+ */
66
+ ambient?: boolean;
67
+ }
68
+ export interface TaskUsage {
69
+ total_tokens: number;
70
+ tool_uses: number;
71
+ duration_ms: number;
72
+ }
73
+ export interface StartTrackingInput {
74
+ taskId: string;
75
+ kind: BackgroundTaskKind;
76
+ outputPath: string;
77
+ description: string;
78
+ command?: string;
79
+ pid?: number;
80
+ stop?: () => void;
81
+ isBackgrounded?: boolean;
82
+ toolUseId?: string;
83
+ emitter?: TaskFrameEmitter;
84
+ usage?: () => TaskUsage | undefined;
85
+ ownerAgentId?: string;
86
+ ambient?: boolean;
87
+ }
88
+ export declare function startTracking(input: StartTrackingInput): BackgroundTaskHandle;
89
+ export declare function getTask(taskId: string): BackgroundTaskHandle | undefined;
90
+ export declare function listTasks(): readonly BackgroundTaskHandle[];
91
+ export declare function listRunningTasks(): readonly BackgroundTaskHandle[];
92
+ export declare function killTaskProcessGroup(taskId: string): boolean;
93
+ /**
94
+ * Review r2 finding 10 (whole-branch, "the option that keeps callers correct"): the counterpart to
95
+ * `startTracking` never re-arming a terminal row. bash.ts/monitor.ts's own `onSpawned` callback
96
+ * calls `startTracking` a SECOND time once the real OS process exists, to attach its pid to the
97
+ * registry row -- but if a TaskStop landed in the window between the pre-spawn registration and
98
+ * this call (the row is now terminal, and correctly stays that way per finding 10), the row NEVER
99
+ * learns this pid, because `startTracking` returns the terminal row untouched rather than merging
100
+ * it in. Without this function the OS process itself -- which really did just get spawned, is
101
+ * really still running, and really was supposed to die with its already-stopped task -- would leak
102
+ * for the rest of the daemon's process lifetime: nothing else ever learns its pid. `onSpawned`
103
+ * calls this directly (bypassing the registry entirely, since the registry has no pid to act on)
104
+ * exactly when the row it gets back from `startTracking` is not `"running"`.
105
+ */
106
+ export declare function killOrphanedSpawn(pid: number): boolean;
107
+ /**
108
+ * Review r2 finding 9 (whole-branch): main.ts's own SIGTERM/SIGINT handler calls this directly --
109
+ * unlike `stopSessionShellTasks` (the ORDINARY "session going away" door, engine.ts's teardown),
110
+ * this is a raw, synchronous, FRAME-FREE sweep over EVERY row in the process with a live pid,
111
+ * regardless of session or kind (`bash`, `monitor`'s command half, and any future pid-bearing kind
112
+ * alike -- `monitor_ws`'s own socket half has no pid, `agent`/`workflow` rows have no pid either and
113
+ * are the child engine's own responsibility, unaffected by this sweep either way).
114
+ *
115
+ * NO `updateTask`/`emitFrame` call here, deliberately: a signal handler must return fast and must
116
+ * never depend on the event loop still turning normally or on a frame sink that may itself be
117
+ * mid-teardown -- `stopSessionShellTasks`' own `task_updated`/`task_notification` bookkeeping is a
118
+ * normal-exit courtesy, not a safety property. The property this function alone guarantees is
119
+ * process cleanup: no `detached: true` process group this `winter` child process ever spawned
120
+ * survives the process being asked to exit. Never throws; each row is attempted independently so
121
+ * one failure (already exited, ESRCH) never strands the rest of the sweep.
122
+ */
123
+ export declare function killAllTaskProcessGroups(): string[];
124
+ export declare function stopTask(taskId: string): boolean;
125
+ export declare function toBackgroundTasksChangedEntry(t: BackgroundTaskHandle): {
126
+ task_id: string;
127
+ task_type: string;
128
+ description: string;
129
+ };
130
+ export interface TaskNotificationInput {
131
+ summary: string;
132
+ /** Defaults to `task.outputPath`; a foreground task's own caller passes `""` explicitly (§3/§4: "no output file"). */
133
+ outputFile?: string;
134
+ /** Defaults to the row's own `usage()` accessor, when it has one (finding 4). */
135
+ usage?: TaskUsage;
136
+ /** Defaults to `task.toolUseId`. */
137
+ toolUseId?: string;
138
+ skipTranscript?: boolean;
139
+ ambient?: boolean;
140
+ /** Lane N: see `TaskNotificationEmission.modelNotification`. */
141
+ modelNotification?: string | null;
142
+ }
143
+ export interface TaskUpdateChanges {
144
+ status?: BackgroundTaskStatus;
145
+ description?: string;
146
+ endTime?: number;
147
+ totalPausedMs?: number;
148
+ error?: string;
149
+ isBackgrounded?: boolean;
150
+ /**
151
+ * Consulted ONLY when this call's own status change crosses non-terminal -> terminal; ignored
152
+ * otherwise. §1: "same synchronous call, AFTER the task_updated" -- supplying both the state
153
+ * change and its eventual notification content to ONE call is what makes that true structurally,
154
+ * rather than relying on the caller to remember to follow up with a second call in the right order.
155
+ */
156
+ notification?: TaskNotificationInput;
157
+ }
158
+ export interface TaskNotificationEmission {
159
+ status: "completed" | "failed" | "stopped";
160
+ outputFile: string;
161
+ summary: string;
162
+ usage?: {
163
+ total_tokens: number;
164
+ tool_uses: number;
165
+ duration_ms: number;
166
+ };
167
+ toolUseId?: string;
168
+ skipTranscript?: boolean;
169
+ ambient?: boolean;
170
+ /**
171
+ * SDK 0.0.16 Lane N: the MODEL-facing `<task-notification>` document for this same terminal event
172
+ * (`subagents/notification-queue.ts`). Three cases, and the default is the interesting one:
173
+ *
174
+ * - ABSENT -- derived from the row: a BACKGROUND row gets the shell/monitor document, carrying the
175
+ * same pinned `summary` the frame carries (claude's `AMe` uses one text on both surfaces), and a
176
+ * FOREGROUND row (`isBackgrounded === false`) gets NONE, because the model is already being
177
+ * handed that task's result as its own `tool_result`.
178
+ * - a STRING -- this exact document (the agent/workflow/TaskStop shapes, whose XML says more than
179
+ * the frame's summary does: `<result>`, `<usage>`, the actor that stopped it).
180
+ * - `null` -- explicitly no model notification.
181
+ */
182
+ modelNotification?: string | null;
183
+ }
184
+ /**
185
+ * §1's `Ik`: `task_notification` is sent at most once per task id, ever -- a second attempt (the
186
+ * process's own natural-exit handler racing a TaskStop that already finalized the row, or a
187
+ * foreground caller notifying after `removeTask`) is a silent no-op. The ONE place every
188
+ * `task_notification` this package emits goes through, whether reached via `updateTask`'s own
189
+ * terminal detection below or a foreground remove-then-notify caller (bash.ts/agent.ts) that has
190
+ * nothing left in the registry to update.
191
+ */
192
+ export declare function emitTaskNotification(task: Pick<BackgroundTaskHandle, "taskId" | "emitter" | "toolUseId"> & Partial<Pick<BackgroundTaskHandle, "kind" | "description" | "isBackgrounded" | "ownerAgentId" | "outputPath">>, notification: TaskNotificationEmission): void;
193
+ /**
194
+ * §1's update(id, fn): applies `changes`, diffs OLD vs NEW on exactly the six pinned fields, and (if
195
+ * the patch is non-empty) emits `task_updated {task_id, patch}` -- then, if this call's own status
196
+ * change crossed non-terminal -> terminal, emits `task_notification` (same synchronous call, AFTER
197
+ * the task_updated), through `emitTaskNotification`'s own once-per-id claim.
198
+ *
199
+ * A field counts as "changed" here by the same rule for all six: `changes.<field> !== undefined`
200
+ * (a caller never means to explicitly unset one of these) AND it differs from the row's current
201
+ * value -- which already satisfies the table's extra "AND new value is defined" clause on
202
+ * `error`/`isBackgrounded` for free, since neither is ever applied from an `undefined` input.
203
+ *
204
+ * Returns `undefined` for an unknown taskId (never throws).
205
+ *
206
+ * Review r1 finding 6: a TERMINAL row is settled. Its `status`, `end_time`, `error` and
207
+ * `is_backgrounded` no longer move -- a late second terminal attempt (a foreground agent's own
208
+ * result path arriving after a TaskStop already finalized the row, a process exit handler racing a
209
+ * kill) used to leave a stray `task_updated {end_time}` on the wire AFTER the notification, and
210
+ * could flip a `stopped` row to `completed`. The first terminal verdict wins, permanently.
211
+ */
212
+ export declare function updateTask(taskId: string, changes: TaskUpdateChanges): BackgroundTaskHandle | undefined;
213
+ /**
214
+ * §1's remove(id): deletes the row, emitting NO `task_updated`. Used for a foreground BASH command
215
+ * that finishes in the foreground (§3) -- the caller builds and sends the `task_notification` itself,
216
+ * through `emitTaskNotification`, BEFORE calling this (review r1 finding 10: the engine's
217
+ * Notification-hook guard reads the row to tell a foreground notification from a background one, so
218
+ * the row must still exist when the frame is emitted). Removing also drops the id's notification
219
+ * claim (finding 12 -- see `notifiedTaskIds`). Returns `undefined` for an unknown taskId, never throws.
220
+ */
221
+ export declare function removeTask(taskId: string): BackgroundTaskHandle | undefined;
222
+ export declare const AGENT_STOPPED_SUMMARY = "stopped by request";
223
+ export declare function killedTaskSummary(kind: BackgroundTaskKind, description: string): string;
224
+ /**
225
+ * Review r1 finding 2: the ONE status derivation for a background shell's natural end (Bash and
226
+ * Monitor's command half share it -- it lives here, not in bash.ts, because an impl module must not
227
+ * import another executor module: impl-isolation.test.ts). `aborted` is a kill THIS runtime issued
228
+ * through the run's own signal -> `stopped` (the kill wording). Exit 0 with no timeout/cap ->
229
+ * `completed`. Everything else -> `failed`, carrying the real exit code only when one exists -- a
230
+ * timeout, an output cap or an outside kill has none, and none is invented.
231
+ */
232
+ export declare function resolveBackgroundOutcome(result: Pick<RunCommandResult, "exitCode" | "timedOut" | "aborted" | "streamKilled">): {
233
+ status: "completed" | "failed" | "stopped";
234
+ exitCode: number | null;
235
+ };
236
+ /**
237
+ * Review r1 finding 2 (controller ruling): a BACKGROUND shell no longer dies with the turn that
238
+ * started it -- the pin's `ShellCommand.background()` drops its abort listeners, so only its own
239
+ * exit, a TaskStop, or the session going away ends it. This is the "session going away" door: the
240
+ * engine's teardown calls it for its own `sessionId`, and for a subagent engine its own `agentId`
241
+ * (the pin's `killShellTasksForAgent` on agent exit). Each still-running background shell row
242
+ * (`bash`, Monitor's `monitor`/`monitor_ws` halves) the caller owns is finalized through the ONE
243
+ * update door -- `task_updated {killed}` then the kill-worded notification -- and THEN killed, the
244
+ * same order TaskStop uses so the process's own exit handler finds a terminal row and stays silent.
245
+ * Returns the ids it stopped. Never throws.
246
+ */
247
+ export declare function stopSessionShellTasks(owner: {
248
+ sessionId: string;
249
+ agentId?: string;
250
+ }): string[];
251
+ /**
252
+ * SDK 0.0.16 Lane N: every still-running BACKGROUND row of one session (foreground rows excluded, as
253
+ * everywhere else). This is what a closed-input session waits on before it tears down -- the pin's own
254
+ * `sge(appState).filter(kf && …)`. An AMBIENT `monitor_ws` row is excluded: it runs for the session,
255
+ * not for a request, so waiting on it would mean never exiting (claude's `Mtn`).
256
+ */
257
+ export declare function listSessionRunningTasks(owner: {
258
+ sessionId: string;
259
+ agentId?: string;
260
+ }): readonly BackgroundTaskHandle[];
261
+ /**
262
+ * Lane N: the print-mode WIND-DOWN sweep (claude's `$u`), reached only after the wait ceiling and its
263
+ * grace have both passed. Unlike `stopSessionShellTasks` (the teardown door, shells only) this covers
264
+ * EVERY kind: a shell is killed, and an agent/workflow row is finalized as stopped -- which, through
265
+ * the one update door, both emits its `task_updated`/`task_notification` pair and enqueues the
266
+ * model-facing "was stopped" document the pin sends in exactly this situation. Returns the ids swept.
267
+ */
268
+ export declare function sweepSessionBackgroundTasks(owner: {
269
+ sessionId: string;
270
+ agentId?: string;
271
+ }): string[];
272
+ export declare function resetBackgroundTaskRuntimeForTest(): void;
@@ -0,0 +1,78 @@
1
+ import "../descriptors/bash.ts";
2
+ import { type ToolExecutor, type ToolExecutionContext } from "../registry.js";
3
+ import { type GlobDenyEntry } from "../../permissions/file-rules.js";
4
+ import { type ExtractedPaths } from "../paths-seam.js";
5
+ import { type SandboxBrand } from "../../sandbox/profile.js";
6
+ interface BashInput {
7
+ command: string;
8
+ timeout?: number;
9
+ description?: string;
10
+ run_in_background?: boolean;
11
+ dangerouslyDisableSandbox?: boolean;
12
+ }
13
+ declare function parseBashInput(input: unknown): BashInput | {
14
+ error: string;
15
+ };
16
+ declare const CEILING_TIMEOUT_MS = 600000;
17
+ declare function resolveTimeout(requested: number | undefined): number;
18
+ declare function computeWritableRoots(ctx: ToolExecutionContext): string[];
19
+ declare function buildRunCommandOptions(input: BashInput, ctx: ToolExecutionContext): {
20
+ cwd: string;
21
+ env: NodeJS.ProcessEnv;
22
+ settings: typeof ctx.sandboxSettings;
23
+ writableRoots: string[];
24
+ denyWritePaths?: string[];
25
+ denyReadPaths?: string[];
26
+ /** Fix round 11: glob-shaped denyWrite/denyRead entries, pre-converted to SBPL regex source -- see `splitDenyPathsByGlobShape`'s own header. */
27
+ denyWriteRegexes?: string[];
28
+ denyReadRegexes?: string[];
29
+ /** Fix round 12: each glob-shaped denyWrite/denyRead entry's own canonicalized fixed-prefix directory -- feeds the ancestor-rename-bypass fix. */
30
+ denyWriteGlobFixedPrefixes?: string[];
31
+ denyReadGlobFixedPrefixes?: string[];
32
+ /** Fix round 13: each glob-shaped denyRead entry, its regex PAIRED with its own fixed prefix -- feeds the read-deny-keep-in-place fix. */
33
+ denyReadGlobEntries?: GlobDenyEntry[];
34
+ home: string;
35
+ /** Phase 5 fix wave, I1: the resolved winter root, distinct from the OS home above. */
36
+ winterHome?: string;
37
+ /** WS-21 fix round 1, item 4: the shared store home -- see `ToolExecutionContext.storeHome`. */
38
+ storeHome?: string;
39
+ /** P7a (D19): the session's brand -- the dot-dir names the seatbelt fences. */
40
+ brand?: SandboxBrand;
41
+ /** Fix round 16, item 2: `sandbox.filesystem.allowGitConfig` -- see `SandboxFilesystemSettings.allowGitConfig`'s own header. */
42
+ allowGitConfigWrites?: boolean;
43
+ dangerouslyDisableSandbox?: boolean;
44
+ /**
45
+ * Phase 6 Task 3 (R6-6, P4 carry): the engine's per-turn abort.
46
+ *
47
+ * `runCommand` ALREADY had the machinery -- `detached: true` makes the child its own group leader
48
+ * and an abort triggers the negative-pid SIGKILL that reaps sandbox-exec, bash and every forked
49
+ * grandchild. What was missing was the CHANNEL: nothing upstream of this function had an
50
+ * `AbortSignal` to give it, so an interrupted turn abandoned the await and the command kept
51
+ * running. Threading `ctx.signal` here is the entire fix.
52
+ *
53
+ * FOREGROUND ONLY (review r1 finding 2, controller ruling): `runBackground` strips this field. The
54
+ * pin's `ShellCommand.background()` drops its abort listeners, so a turn interrupt never kills a
55
+ * backgrounded command -- it ends by its own exit, a TaskStop, or the session's teardown
56
+ * (`stopSessionShellTasks`, background-task-runtime.ts).
57
+ */
58
+ signal?: AbortSignal;
59
+ };
60
+ interface CappedOutput {
61
+ text: string;
62
+ persistedPath?: string;
63
+ }
64
+ declare function capOutput(ctx: ToolExecutionContext, stream: "stdout" | "stderr", raw: string, success: boolean): CappedOutput;
65
+ declare function formatForegroundResult(parts: {
66
+ stdout: CappedOutput;
67
+ stderr: CappedOutput;
68
+ exitCode: number | null;
69
+ timedOut: boolean;
70
+ aborted: boolean;
71
+ timeoutMs: number;
72
+ posture: string;
73
+ sandboxOverrideRequested: boolean;
74
+ streamKilled: boolean;
75
+ }): string;
76
+ declare function extractBashPaths(input: unknown): ExtractedPaths;
77
+ export declare const bashExecutor: ToolExecutor;
78
+ export { parseBashInput, resolveTimeout, extractBashPaths, computeWritableRoots, capOutput, formatForegroundResult, buildRunCommandOptions, CEILING_TIMEOUT_MS };
@@ -0,0 +1,11 @@
1
+ import "../descriptors/index.ts";
2
+ export interface CronJobRecord {
3
+ id: string;
4
+ cron: string;
5
+ prompt: string;
6
+ recurring: boolean;
7
+ durable: boolean;
8
+ }
9
+ export declare function validateCronExpression(cron: string): void;
10
+ export declare function humanizeCron(cron: string): string;
11
+ export declare function resetInMemoryCronStoreForTest(): void;
@@ -0,0 +1 @@
1
+ import "../descriptors/index.ts";
@@ -0,0 +1,4 @@
1
+ import "../descriptors/enter-plan-mode.ts";
2
+ import { type ToolExecutor } from "../registry.js";
3
+ export declare const ENTER_PLAN_MODE_TOOL_NAME = "EnterPlanMode";
4
+ export declare const enterPlanModeExecutor: ToolExecutor;
@@ -0,0 +1,25 @@
1
+ import { type ToolExecutor } from "../registry.js";
2
+ import "../descriptors/enter-worktree.ts";
3
+ export declare const ENTER_WORKTREE_TOOL_NAME = "EnterWorktree";
4
+ export interface GitRunResult {
5
+ ok: boolean;
6
+ stdout: string;
7
+ stderr: string;
8
+ }
9
+ export declare function runGit(args: string[], cwd: string): Promise<GitRunResult>;
10
+ export declare function safeRealpath(path: string): string | undefined;
11
+ export interface WorktreeInfo {
12
+ path: string;
13
+ realPath: string;
14
+ headSha: string;
15
+ branch?: string;
16
+ isMain: boolean;
17
+ }
18
+ export declare function listWorktrees(cwd: string): Promise<{
19
+ ok: true;
20
+ worktrees: WorktreeInfo[];
21
+ } | {
22
+ ok: false;
23
+ stderr: string;
24
+ }>;
25
+ export declare const enterWorktreeExecutor: ToolExecutor;
@@ -0,0 +1,4 @@
1
+ import "../descriptors/exit-plan-mode.ts";
2
+ import { type ToolExecutor } from "../registry.js";
3
+ export declare const EXIT_PLAN_MODE_TOOL_NAME = "ExitPlanMode";
4
+ export declare const exitPlanModeExecutor: ToolExecutor;
@@ -0,0 +1,4 @@
1
+ import { type ToolExecutor } from "../registry.js";
2
+ import "../descriptors/exit-worktree.ts";
3
+ export declare const EXIT_WORKTREE_TOOL_NAME = "ExitWorktree";
4
+ export declare const exitWorktreeExecutor: ToolExecutor;
@@ -0,0 +1 @@
1
+ import "../descriptors/index.ts";
@@ -0,0 +1,19 @@
1
+ import "../descriptors/index.ts";
2
+ type OutputMode = "content" | "files_with_matches" | "count";
3
+ export interface GrepContentRow {
4
+ file: string;
5
+ line?: number;
6
+ text: string;
7
+ match?: true;
8
+ }
9
+ export interface GrepResult {
10
+ mode: OutputMode;
11
+ files?: string[];
12
+ content?: GrepContentRow[];
13
+ counts?: Record<string, number>;
14
+ truncated: boolean;
15
+ limit: number;
16
+ offset: number;
17
+ skippedOversized: number;
18
+ }
19
+ export {};