@halonicjs/testing 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +1 -1
  3. package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
  4. package/dist/adapters/http-kit/src/address-checking.js +1 -0
  5. package/dist/adapters/http-kit/src/connector-host-class.d.ts +14 -0
  6. package/dist/adapters/http-kit/src/connector-host-class.js +34 -0
  7. package/dist/adapters/http-kit/src/index.d.ts +3 -0
  8. package/dist/adapters/http-kit/src/index.js +2 -0
  9. package/dist/adapters/http-kit/src/ollama-tags.d.ts +20 -0
  10. package/dist/adapters/http-kit/src/ollama-tags.js +38 -0
  11. package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
  12. package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
  13. package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
  14. package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
  15. package/dist/adapters/integration-kit/src/declaration.d.ts +2 -1
  16. package/dist/adapters/integration-kit/src/declaration.js +4 -3
  17. package/dist/adapters/integration-kit/src/host.d.ts +7 -1
  18. package/dist/adapters/integration-kit/src/host.js +1 -0
  19. package/dist/adapters/integration-kit/src/index.d.ts +5 -2
  20. package/dist/adapters/integration-kit/src/index.js +2 -0
  21. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +4 -2
  22. package/dist/adapters/integration-kit/src/leak-attempt.js +5 -2
  23. package/dist/adapters/integration-kit/src/limited-http.d.ts +7 -1
  24. package/dist/adapters/integration-kit/src/limited-http.js +53 -10
  25. package/dist/adapters/integration-kit/src/loader.d.ts +28 -11
  26. package/dist/adapters/integration-kit/src/loader.js +36 -21
  27. package/dist/adapters/integration-kit/src/own-request.d.ts +2 -2
  28. package/dist/adapters/integration-kit/src/own-request.js +1 -1
  29. package/dist/adapters/integration-kit/src/plugin-load.d.ts +3 -3
  30. package/dist/adapters/integration-kit/src/plugin-load.js +5 -5
  31. package/dist/adapters/integration-kit/src/policy.d.ts +28 -0
  32. package/dist/adapters/integration-kit/src/response-body.d.ts +6 -2
  33. package/dist/adapters/integration-kit/src/secret-filter.d.ts +3 -3
  34. package/dist/adapters/integration-kit/src/secret-filter.js +19 -4
  35. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +3 -0
  36. package/dist/adapters/integration-kit/src/secret-in-request.js +8 -2
  37. package/dist/adapters/integration-kit/src/secret-placement.d.ts +35 -25
  38. package/dist/adapters/integration-kit/src/secret-placement.js +65 -95
  39. package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
  40. package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
  41. package/dist/adapters/integration-kit/src/workspace-choices.d.ts +37 -0
  42. package/dist/adapters/integration-kit/src/workspace-choices.js +37 -0
  43. package/dist/core/events/src/blocked-sites.d.ts +57 -0
  44. package/dist/core/events/src/blocked-sites.js +89 -0
  45. package/dist/core/events/src/connector-listing-failed.d.ts +18 -0
  46. package/dist/core/events/src/connector-listing-failed.js +1 -0
  47. package/dist/core/events/src/home-path.d.ts +4 -1
  48. package/dist/core/events/src/home-path.js +14 -3
  49. package/dist/core/events/src/index.d.ts +8 -2
  50. package/dist/core/events/src/index.js +5 -0
  51. package/dist/core/events/src/provider-notes.d.ts +16 -0
  52. package/dist/core/events/src/provider-notes.js +24 -0
  53. package/dist/core/events/src/run-basics.d.ts +131 -10
  54. package/dist/core/events/src/run-event.d.ts +120 -11
  55. package/dist/core/events/src/run-reads.d.ts +25 -0
  56. package/dist/core/events/src/run-reads.js +44 -0
  57. package/dist/core/events/src/run-sends.d.ts +47 -0
  58. package/dist/core/events/src/run-sends.js +68 -0
  59. package/dist/core/events/src/run-summary.d.ts +11 -1
  60. package/dist/core/events/src/sandbox-opened-read.d.ts +2 -1
  61. package/dist/core/events/src/sandbox-opened-read.js +27 -2
  62. package/dist/core/events/src/sandbox-opened.d.ts +37 -4
  63. package/dist/core/events/src/sandbox-opened.js +13 -3
  64. package/dist/core/events/src/summarize.js +8 -1
  65. package/dist/core/events/src/timeline-entry.js +1 -0
  66. package/dist/core/events/src/tool-failure-cause.d.ts +25 -0
  67. package/dist/core/events/src/tool-failure-cause.js +66 -0
  68. package/dist/core/format/src/index.d.ts +9 -6
  69. package/dist/core/format/src/index.js +7 -3
  70. package/dist/core/format/src/integration/index.d.ts +3 -2
  71. package/dist/core/format/src/integration/index.js +2 -1
  72. package/dist/core/format/src/kinds/agent/harness-limits.d.ts +14 -0
  73. package/dist/core/format/src/kinds/agent/harness-limits.js +27 -0
  74. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +15 -5
  75. package/dist/core/format/src/kinds/agent/sandbox-fields.js +29 -10
  76. package/dist/core/format/src/kinds/agent/schema.d.ts +5 -0
  77. package/dist/core/format/src/kinds/agent/schema.js +5 -2
  78. package/dist/core/format/src/kinds/connector/is-local.js +1 -1
  79. package/dist/core/format/src/kinds/connector/kind.js +122 -2
  80. package/dist/core/format/src/kinds/connector/schema.d.ts +38 -0
  81. package/dist/core/format/src/kinds/connector/schema.js +71 -2
  82. package/dist/core/format/src/kinds/deployments/kind.js +25 -1
  83. package/dist/core/format/src/kinds/deployments/schema.d.ts +40 -0
  84. package/dist/core/format/src/kinds/deployments/schema.js +52 -0
  85. package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
  86. package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
  87. package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
  88. package/dist/core/format/src/kinds/integration/host-key.js +8 -0
  89. package/dist/core/format/src/kinds/integration/kind.d.ts +4 -2
  90. package/dist/core/format/src/kinds/integration/kind.js +49 -12
  91. package/dist/core/format/src/kinds/integration/policy.d.ts +47 -2
  92. package/dist/core/format/src/kinds/integration/policy.js +61 -2
  93. package/dist/core/format/src/kinds/integration/schema.d.ts +180 -3
  94. package/dist/core/format/src/kinds/integration/schema.js +133 -7
  95. package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +14 -0
  96. package/dist/core/format/src/kinds/integration/sign-in-checks.js +150 -0
  97. package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
  98. package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
  99. package/dist/core/format/src/kinds/plugin/checks.d.ts +3 -2
  100. package/dist/core/format/src/kinds/plugin/checks.js +24 -6
  101. package/dist/core/format/src/kinds/plugin/schema.d.ts +130 -0
  102. package/dist/core/format/src/kinds/plugin/schema.js +26 -6
  103. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +1 -1
  104. package/dist/core/format/src/kinds/plugin/ui-checks.js +1 -10
  105. package/dist/core/format/src/kinds/provider/kind.js +40 -1
  106. package/dist/core/format/src/kinds/provider/types.d.ts +19 -0
  107. package/dist/core/format/src/kinds/provider/types.js +22 -0
  108. package/dist/core/format/src/kinds/routine/kind.js +38 -1
  109. package/dist/core/format/src/kinds/routine/schema.d.ts +20 -5
  110. package/dist/core/format/src/kinds/routine/schema.js +42 -14
  111. package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
  112. package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
  113. package/dist/core/format/src/kinds/workflow/schema.js +1 -1
  114. package/dist/core/format/src/kinds/workspace/kind.js +1 -1
  115. package/dist/core/format/src/kinds/workspace/schema.d.ts +2 -2
  116. package/dist/core/format/src/kinds/workspace/schema.js +6 -5
  117. package/dist/core/format/src/parse-file.js +3 -1
  118. package/dist/core/format/src/shared/fields.d.ts +12 -8
  119. package/dist/core/format/src/shared/fields.js +48 -19
  120. package/dist/core/format/src/shared/guard.d.ts +8 -0
  121. package/dist/core/format/src/shared/guard.js +50 -1
  122. package/dist/core/format/src/shared/missing-keys.d.ts +17 -0
  123. package/dist/core/format/src/shared/missing-keys.js +110 -0
  124. package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
  125. package/dist/core/ports/src/agent-runs-not-available.js +25 -0
  126. package/dist/core/ports/src/blob-store.d.ts +12 -0
  127. package/dist/core/ports/src/blob-store.js +22 -0
  128. package/dist/core/ports/src/chat.d.ts +8 -0
  129. package/dist/core/ports/src/connector-client.d.ts +48 -4
  130. package/dist/core/ports/src/connector-client.js +17 -0
  131. package/dist/core/ports/src/connector-start-failure.d.ts +31 -0
  132. package/dist/core/ports/src/connector-start-failure.js +32 -0
  133. package/dist/core/ports/src/connector-tool-error.d.ts +33 -0
  134. package/dist/core/ports/src/connector-tool-error.js +40 -0
  135. package/dist/core/ports/src/definition-store-left-out.d.ts +46 -0
  136. package/dist/core/ports/src/definition-store-left-out.js +47 -0
  137. package/dist/core/ports/src/definition-store.d.ts +36 -5
  138. package/dist/core/ports/src/definition-store.js +1 -1
  139. package/dist/core/ports/src/deploy-target.d.ts +358 -0
  140. package/dist/core/ports/src/deploy-target.js +2 -0
  141. package/dist/core/ports/src/harness-bridge-server.d.ts +67 -7
  142. package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
  143. package/dist/core/ports/src/harness-sign-in-command.js +31 -0
  144. package/dist/core/ports/src/harness.d.ts +79 -15
  145. package/dist/core/ports/src/harness.js +1 -1
  146. package/dist/core/ports/src/host-settings-store.d.ts +116 -0
  147. package/dist/core/ports/src/host-settings-store.js +106 -0
  148. package/dist/core/ports/src/host-too-old.d.ts +23 -0
  149. package/dist/core/ports/src/host-too-old.js +27 -0
  150. package/dist/core/ports/src/index.d.ts +32 -13
  151. package/dist/core/ports/src/index.js +28 -8
  152. package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
  153. package/dist/core/ports/src/instruction-trust-store.js +43 -0
  154. package/dist/core/ports/src/integration.d.ts +71 -7
  155. package/dist/core/ports/src/integration.js +22 -4
  156. package/dist/core/ports/src/llm-provider.d.ts +39 -6
  157. package/dist/core/ports/src/llm-provider.js +46 -3
  158. package/dist/core/ports/src/pairing-codes.d.ts +111 -0
  159. package/dist/core/ports/src/pairing-codes.js +336 -0
  160. package/dist/core/ports/src/pairing-qr-bytes.d.ts +32 -0
  161. package/dist/core/ports/src/pairing-qr-bytes.js +116 -0
  162. package/dist/core/ports/src/password-hasher.d.ts +36 -20
  163. package/dist/core/ports/src/port-versions.d.ts +13 -6
  164. package/dist/core/ports/src/port-versions.js +14 -0
  165. package/dist/core/ports/src/program-probe.d.ts +25 -2
  166. package/dist/core/ports/src/program-probe.js +1 -1
  167. package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
  168. package/dist/core/ports/src/provider-default-base-url.js +18 -0
  169. package/dist/core/ports/src/record-store.d.ts +17 -0
  170. package/dist/core/ports/src/record-store.js +70 -0
  171. package/dist/core/ports/src/remote-control.d.ts +159 -0
  172. package/dist/core/ports/src/remote-control.js +26 -0
  173. package/dist/core/ports/src/remote-gateway-protocol.d.ts +220 -0
  174. package/dist/core/ports/src/remote-gateway-protocol.js +62 -0
  175. package/dist/core/ports/src/remote-gateway-session.d.ts +194 -0
  176. package/dist/core/ports/src/remote-gateway-session.js +241 -0
  177. package/dist/core/ports/src/run-executor.d.ts +44 -7
  178. package/dist/core/ports/src/run-executor.js +1 -1
  179. package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
  180. package/dist/core/ports/src/run-target-not-found.js +41 -0
  181. package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
  182. package/dist/core/ports/src/sandbox-setting-store.js +33 -0
  183. package/dist/core/ports/src/sandbox.d.ts +149 -13
  184. package/dist/core/ports/src/sandbox.js +52 -2
  185. package/dist/core/ports/src/secrets.d.ts +105 -1
  186. package/dist/core/ports/src/secrets.js +75 -2
  187. package/dist/core/ports/src/tool-approval-store.d.ts +50 -8
  188. package/dist/core/ports/src/tool-approval-store.js +59 -0
  189. package/dist/core/ports/src/tunnel-provider.d.ts +117 -0
  190. package/dist/core/ports/src/tunnel-provider.js +65 -0
  191. package/dist/core/ports/src/tunnel-resolver.d.ts +83 -0
  192. package/dist/core/ports/src/tunnel-resolver.js +36 -0
  193. package/dist/core/ports/src/vcs-status.d.ts +8 -0
  194. package/dist/core/ports/src/vcs-status.js +90 -0
  195. package/dist/core/ports/src/vcs.d.ts +30 -0
  196. package/dist/core/schema-kit/src/builders.d.ts +5 -0
  197. package/dist/core/schema-kit/src/builders.js +5 -0
  198. package/dist/core/std/src/amount.d.ts +13 -0
  199. package/dist/core/std/src/amount.js +22 -0
  200. package/dist/core/std/src/hidden-characters.d.ts +28 -0
  201. package/dist/core/std/src/hidden-characters.js +72 -0
  202. package/dist/core/std/src/index.d.ts +7 -0
  203. package/dist/core/std/src/index.js +7 -0
  204. package/dist/core/std/src/path-overlap.d.ts +22 -0
  205. package/dist/core/std/src/path-overlap.js +57 -0
  206. package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
  207. package/dist/core/std/src/public-suffixes.generated.js +10428 -0
  208. package/dist/core/std/src/registrable-domain.d.ts +10 -0
  209. package/dist/core/std/src/registrable-domain.js +62 -0
  210. package/dist/core/std/src/secret-variable-name.d.ts +12 -0
  211. package/dist/core/std/src/secret-variable-name.js +34 -0
  212. package/dist/core/std/src/site-name.d.ts +35 -0
  213. package/dist/core/std/src/site-name.js +111 -0
  214. package/dist/core/std/src/url-host.d.ts +35 -0
  215. package/dist/core/std/src/url-host.js +170 -0
  216. package/dist/core/std/src/word-diff.d.ts +28 -0
  217. package/dist/core/std/src/word-diff.js +77 -0
  218. package/dist/core/yaml/src/edit-data.d.ts +7 -0
  219. package/dist/core/yaml/src/edit-data.js +62 -3
  220. package/dist/core/yaml/src/edit.d.ts +7 -0
  221. package/dist/core/yaml/src/edit.js +34 -3
  222. package/dist/core/yaml/src/splice-node.d.ts +6 -0
  223. package/dist/core/yaml/src/splice-node.js +10 -0
  224. package/dist/core/yaml/src/splice.js +20 -10
  225. package/dist/testing/integration/src/checks.d.ts +5 -3
  226. package/dist/testing/integration/src/checks.js +31 -3
  227. package/dist/testing/integration/src/load.js +3 -1
  228. package/package.json +9 -2
@@ -1,6 +1,14 @@
1
1
  import { s } from "../../../../schema-kit/src/index.js";
2
2
  import { DURATION_PATTERN, id, version } from "../../shared/fields.js";
3
3
  import { Guard } from "../../shared/guard.js";
4
+ import { WEBHOOK_HEADER_PATTERN } from "./webhook-headers.js";
5
+ /**
6
+ * Reads a number as text, for an interval such as "15m". YAML reads
7
+ * `every: 15` as a number; as the text "15" it gets the interval's message
8
+ * for a count without a unit, instead of failing the whole trigger
9
+ * (HAL-12607). No number passes: the pattern needs a unit.
10
+ */
11
+ const numberAsText = (value) => (typeof value === "number" ? String(value) : value);
4
12
  /** On a schedule: five-field cron or a shortcut such as @daily, in a time zone. */
5
13
  const ScheduleTrigger = s
6
14
  .object({
@@ -12,9 +20,9 @@ const ScheduleTrigger = s
12
20
  /** At a fixed interval. */
13
21
  const EveryTrigger = s
14
22
  .object({
15
- every: s
23
+ every: s.preprocess(numberAsText, s
16
24
  .string()
17
- .regex(DURATION_PATTERN, 'use a number and a unit, e.g. "15m", "1h", "1d" (runs are placed from midnight UTC)'),
25
+ .regex(DURATION_PATTERN, 'use a number and a unit, e.g. "15m", "1h", "1d" (runs are placed from midnight UTC)')),
18
26
  })
19
27
  .strict();
20
28
  /** Only when someone starts it. */
@@ -39,22 +47,42 @@ const MailTrigger = s
39
47
  * any number of more than one digit, such as "15m"
40
48
  * (format.routine-mail-interval).
41
49
  */
42
- every: s
50
+ every: s.preprocess(numberAsText, s.string().regex(DURATION_PATTERN, 'use a number and a unit, e.g. "2m"').default("2m")),
51
+ })
52
+ .strict(),
53
+ })
54
+ .strict();
55
+ /**
56
+ * A request from outside, signed with a secret. The host gives each routine its
57
+ * own address; this file names only the secret and the headers the run may read.
58
+ */
59
+ const WebhookTrigger = s
60
+ .object({
61
+ webhook: s
62
+ .object({
63
+ /** The name of the secret that signs the request body; the file never holds its value. */
64
+ secret: s.string().min(1),
65
+ /** Lowercase request headers the run may read as {{trigger.headers.<name>}}; none by default. */
66
+ headers: s
67
+ .array(s
43
68
  .string()
44
- .regex(DURATION_PATTERN, 'use a number and a unit, e.g. "2m"')
45
- .default("2m"),
69
+ .regex(WEBHOOK_HEADER_PATTERN, "use a lowercase header name: letters, digits or '-', such as x-event"))
70
+ .default([]),
46
71
  })
47
72
  .strict(),
48
73
  })
49
74
  .strict();
50
- /** When a routine starts. */
51
- export const RoutineTrigger = s.union([
52
- ScheduleTrigger,
53
- EveryTrigger,
54
- ManualTrigger,
55
- SignalTrigger,
56
- MailTrigger,
57
- ]);
75
+ /**
76
+ * When a routine starts. A trigger that matches none of the kinds, such as
77
+ * two at once or `manual: false`, gets one message that names them all
78
+ * (HAL-14299), instead of Zod's "Invalid input". A mistake inside one kind,
79
+ * such as `every: 15`, still gets that kind's own message.
80
+ */
81
+ export const RoutineTrigger = s.union([ScheduleTrigger, EveryTrigger, ManualTrigger, SignalTrigger, MailTrigger, WebhookTrigger], {
82
+ error: (issue) => issue.code === "invalid_union"
83
+ ? "trigger needs exactly one of: schedule, every, manual: true, signal, mail or webhook."
84
+ : undefined,
85
+ });
58
86
  /** What a routine runs: a workflow with input, or one agent with a prompt. */
59
87
  export const RoutineTarget = s.union([
60
88
  s
@@ -62,7 +90,7 @@ export const RoutineTarget = s.union([
62
90
  /** The workflow's hub. Required for workspace-level routines. */
63
91
  hub: id.optional(),
64
92
  workflow: id,
65
- /** Workflow input; text may use {{trigger.at}}, {{trigger.lastRun}} and {{trigger.message}}. */
93
+ /** Workflow input; text may use {{trigger.at}}, {{trigger.lastRun}}, {{trigger.message}} and, for a webhook, {{trigger.body}} and {{trigger.headers.<name>}}. */
66
94
  input: s.record(s.string(), s.unknown()).default({}),
67
95
  })
68
96
  .strict(),
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request headers a webhook routine may never copy into a run: the sender's
3
+ * credentials, and the headers the host's server reads to verify a request.
4
+ * Node gives header names in lowercase, so the names are too. The host
5
+ * imports this list, so the file check and the server agree.
6
+ */
7
+ export declare const WEBHOOK_REFUSED_HEADERS: readonly string[];
8
+ /** A lowercase HTTP header name that also works in `{{trigger.headers.<name>}}`. */
9
+ export declare const WEBHOOK_HEADER_PATTERN: RegExp;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Request headers a webhook routine may never copy into a run: the sender's
3
+ * credentials, and the headers the host's server reads to verify a request.
4
+ * Node gives header names in lowercase, so the names are too. The host
5
+ * imports this list, so the file check and the server agree.
6
+ */
7
+ export const WEBHOOK_REFUSED_HEADERS = [
8
+ "authorization",
9
+ "proxy-authorization",
10
+ "cookie",
11
+ "set-cookie",
12
+ "x-halonic-signature",
13
+ "x-halonic-timestamp",
14
+ "x-halonic-delivery",
15
+ "x-hub-signature",
16
+ "x-hub-signature-256",
17
+ "x-signature",
18
+ "x-webhook-signature",
19
+ "x-webhook-timestamp",
20
+ "x-webhook-id",
21
+ "webhook-signature",
22
+ "webhook-timestamp",
23
+ "webhook-id",
24
+ ];
25
+ /** A lowercase HTTP header name that also works in `{{trigger.headers.<name>}}`. */
26
+ export const WEBHOOK_HEADER_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
@@ -53,7 +53,7 @@ export const WorkflowState = s
53
53
  output: s.string().optional(),
54
54
  /** Task states: a context key that keeps the conversation across turns. */
55
55
  conversation: s.string().optional(),
56
- /** Task states: the reply format for this step, instead of the agent's own. */
56
+ /** Task and for-each states: the reply format, instead of the method's or the agent's. */
57
57
  format: s.enum(["text", "json"]).optional(),
58
58
  /** After this step: a signal routines can start on. */
59
59
  signal: s
@@ -2,7 +2,7 @@ import { WorkspaceSettings } from "./schema.js";
2
2
  /** `workspace.yaml` at the workspace root. */
3
3
  export const workspaceKind = {
4
4
  name: "workspace",
5
- about: "The workspace's name, privacy, budget, defaults and session AI.",
5
+ about: "The workspace's name, privacy, budget, defaults and assistant model.",
6
6
  syntax: "yaml",
7
7
  schema: WorkspaceSettings,
8
8
  places: [{ scope: "workspace", folder: "", name: "workspace.yaml" }],
@@ -1,6 +1,6 @@
1
1
  import { type Infer } from "../../../../schema-kit/src/index.js";
2
2
  /**
3
- * This workspace's own choices for the session AI (chat sessions, Build
3
+ * This workspace's own choices for the assistant model (chat sessions, Build
4
4
  * mode), on top of the global AI agent each person sets. An empty field
5
5
  * follows the global agent.
6
6
  */
@@ -68,5 +68,5 @@ export declare const WorkspaceSettings: import("zod").ZodObject<{
68
68
  }, import("zod/v4/core").$strict>;
69
69
  /** The settings in `workspace.yaml`, with defaults filled in. */
70
70
  export type WorkspaceSettings = Infer<typeof WorkspaceSettings>;
71
- /** The session AI settings of a workspace. */
71
+ /** The assistant settings of a workspace. */
72
72
  export type SessionAssistant = Infer<typeof SessionAssistant>;
@@ -1,7 +1,7 @@
1
1
  import { s } from "../../../../schema-kit/src/index.js";
2
2
  import { id, ModelParams, version } from "../../shared/fields.js";
3
3
  /**
4
- * This workspace's own choices for the session AI (chat sessions, Build
4
+ * This workspace's own choices for the assistant model (chat sessions, Build
5
5
  * mode), on top of the global AI agent each person sets. An empty field
6
6
  * follows the global agent.
7
7
  */
@@ -33,10 +33,11 @@ export const WorkspaceSettings = s
33
33
  .strict()
34
34
  .default({ localOnly: false }),
35
35
  /**
36
- * Spending limits in `currency`, counted from model prices. Not enforced
37
- * in 0.1: nothing reads `perRun` or `monthly` yet. `currency` names the
38
- * currency the prices in `models.yaml` are written in; Halonic doesn't
39
- * convert between currencies.
36
+ * Spending limits in `currency`, counted from model prices. The engine
37
+ * stops a run (`run.failed` with the reason `budget`) before a model call
38
+ * once the run has spent `perRun` or the month has spent `monthly`
39
+ * (`engine.budget-stops`). `currency` names the currency the prices in
40
+ * `models.yaml` are written in; Halonic doesn't convert between currencies.
40
41
  */
41
42
  budget: s
42
43
  .object({
@@ -2,6 +2,7 @@ import { parse } from "../../schema-kit/src/index.js";
2
2
  import { err, ok } from "../../std/src/index.js";
3
3
  import { fileKinds } from "./registry.js";
4
4
  import { isMap } from "./shared/legacy-keys.js";
5
+ import { wordIssues } from "./shared/missing-keys.js";
5
6
  import { readSource } from "./source.js";
6
7
  /**
7
8
  * Reads and checks one workspace file of a known kind.
@@ -28,7 +29,8 @@ export function parseFile(kind, text, options = {}) {
28
29
  const prepared = prepare(fileKind, source.data, options.id);
29
30
  const parsed = parse(fileKind.schema, prepared.data);
30
31
  if (!parsed.ok) {
31
- const problems = parsed.error.map((issue) => schemaProblem(issue, source));
32
+ const issues = wordIssues(parsed.error, prepared.data);
33
+ const problems = issues.map((issue) => schemaProblem(issue, source));
32
34
  return err(prepared.idFromPlace ? problems.map((problem) => namePlaceId(problem, options.id)) : problems);
33
35
  }
34
36
  const found = fileKind.check?.(parsed.value) ?? [];
@@ -2,13 +2,10 @@
2
2
  export declare const SCHEMA_VERSION: 1;
3
3
  /** An item's id: lowercase letters, digits, `-` and `_`, starting with a letter or digit. */
4
4
  export declare const id: import("zod").ZodString;
5
- /**
6
- * A deployment's id: an {@link id} of at most 64 characters that isn't a
7
- * Windows device name, because it names the deployment's runs folder.
8
- * The device names are refused through a pattern, not a refinement, so the
9
- * JSON Schema carries the rule too.
10
- */
5
+ /** A deployment's id, which names the deployment's runs folder. */
11
6
  export declare const deploymentId: import("zod").ZodString;
7
+ /** An agent's id, which names the agent's harness settings folder. */
8
+ export declare const agentId: import("zod").ZodString;
12
9
  /**
13
10
  * A workspace collection's id: lowercase letters, digits and `-`, starting
14
11
  * with a letter or digit. Halonic's own collections (`_tokens`,
@@ -18,9 +15,16 @@ export declare const deploymentId: import("zod").ZodString;
18
15
  * their names.
19
16
  */
20
17
  export declare const collectionId: import("zod").ZodString;
21
- /** The `version` key: `1`, and `1` when the file leaves it out. */
18
+ /**
19
+ * The `version` key: `1`, and `1` when the file leaves it out. The message
20
+ * names the one allowed value instead of Zod's "Invalid input: expected 1".
21
+ */
22
22
  export declare const version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
23
- /** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
23
+ /**
24
+ * A whole number of up to five digits and a unit: minutes, hours or days
25
+ * ("30m", "4h", "2d"). The most is 99999 days, about 273 years: longer would
26
+ * leave the range of a date, so no timer could be set for it.
27
+ */
24
28
  export declare const DURATION_PATTERN: RegExp;
25
29
  /** Tuning passed to a model (temperature, maxTokens, …). */
26
30
  export declare const ModelParams: import("zod").ZodObject<{
@@ -7,24 +7,44 @@ export const SCHEMA_VERSION = 1;
7
7
  export const id = s
8
8
  .string()
9
9
  .min(1)
10
- .regex(/^[a-z0-9][a-z0-9-_]*$/, "use lowercase letters, digits, '-' or '_'");
10
+ .regex(/^[a-z0-9][a-z0-9-_]*$/, "use lowercase letters, digits, '-' or '_', starting with a letter or digit");
11
11
  /**
12
- * The most characters a deployment id may have. Each deployment's runs live
13
- * in a folder named after it (`deployments/<id>/runs` in the profile), and
14
- * 64 keeps that path well under Windows' 260-character limit.
12
+ * The most characters an id that names a folder may have. A deployment's runs
13
+ * live in `deployments/<id>/runs` and an agent's harness settings in
14
+ * `harness-settings/<id>/<harness>` in the profile, and 64 keeps those paths
15
+ * well under Windows' 260-character limit.
15
16
  */
16
- const DEPLOYMENT_ID_MAX_LENGTH = 64;
17
- /** Names Windows keeps for devices, as pattern alternatives; no file or folder can have them. */
18
- const WINDOWS_DEVICE_NAMES = "con|prn|aux|nul|com[0-9]|lpt[0-9]";
17
+ const FOLDER_ID_MAX_LENGTH = 64;
18
+ /** Names Windows keeps for devices; no file or folder can have them. */
19
+ const WINDOWS_DEVICE_NAME = /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/;
19
20
  /**
20
- * A deployment's id: an {@link id} of at most 64 characters that isn't a
21
- * Windows device name, because it names the deployment's runs folder.
22
- * The device names are refused through a pattern, not a refinement, so the
23
- * JSON Schema carries the rule too.
21
+ * An {@link id} that names a folder in the profile: at most 64 characters
22
+ * and not a Windows device name. `owner` says whose folder it is in the
23
+ * message. The device names are refused by a separate rule that the JSON
24
+ * Schema carries as `not: { pattern }`, not by a lookahead, so the pattern
25
+ * also works in Go and Rust regex libraries, which have no lookaround.
26
+ * `@halonicjs/profile` keeps the same rule, and a test in each kind that
27
+ * uses it holds the two together.
24
28
  */
25
- export const deploymentId = id
26
- .max(DEPLOYMENT_ID_MAX_LENGTH, `use at most ${DEPLOYMENT_ID_MAX_LENGTH} characters, so the deployment's folder fits in a Windows path`)
27
- .regex(new RegExp(`^(?!(?:${WINDOWS_DEVICE_NAMES})$)`), "use a name Windows doesn't keep for a device (con, prn, aux, nul, com0-com9, lpt0-lpt9)");
29
+ function folderId(owner) {
30
+ return id
31
+ .max(FOLDER_ID_MAX_LENGTH, `use at most ${FOLDER_ID_MAX_LENGTH} characters, so the ${owner}'s folder fits in a Windows path`)
32
+ .superRefine((name, context) => {
33
+ if (WINDOWS_DEVICE_NAME.test(name)) {
34
+ context.addIssue({
35
+ code: "invalid_format",
36
+ format: "regex",
37
+ pattern: WINDOWS_DEVICE_NAME.source,
38
+ message: "use a name Windows doesn't keep for a device (con, prn, aux, nul, com0-com9, lpt0-lpt9)",
39
+ });
40
+ }
41
+ })
42
+ .meta({ not: { pattern: WINDOWS_DEVICE_NAME.source } });
43
+ }
44
+ /** A deployment's id, which names the deployment's runs folder. */
45
+ export const deploymentId = folderId("deployment");
46
+ /** An agent's id, which names the agent's harness settings folder. */
47
+ export const agentId = folderId("agent");
28
48
  /**
29
49
  * A workspace collection's id: lowercase letters, digits and `-`, starting
30
50
  * with a letter or digit. Halonic's own collections (`_tokens`,
@@ -35,11 +55,20 @@ export const deploymentId = id
35
55
  */
36
56
  export const collectionId = s
37
57
  .string()
38
- .regex(/^[a-z0-9][a-z0-9-]*$/, "use lowercase letters, digits or '-'");
39
- /** The `version` key: `1`, and `1` when the file leaves it out. */
40
- export const version = s.literal(SCHEMA_VERSION).default(SCHEMA_VERSION);
41
- /** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
42
- export const DURATION_PATTERN = /^[1-9]\d*(m|h|d)$/;
58
+ .regex(/^[a-z0-9][a-z0-9-]*$/, "use lowercase letters, digits or '-', starting with a letter or digit");
59
+ /**
60
+ * The `version` key: `1`, and `1` when the file leaves it out. The message
61
+ * names the one allowed value instead of Zod's "Invalid input: expected 1".
62
+ */
63
+ export const version = s
64
+ .literal(SCHEMA_VERSION, { error: `version must be ${SCHEMA_VERSION}` })
65
+ .default(SCHEMA_VERSION);
66
+ /**
67
+ * A whole number of up to five digits and a unit: minutes, hours or days
68
+ * ("30m", "4h", "2d"). The most is 99999 days, about 273 years: longer would
69
+ * leave the range of a date, so no timer could be set for it.
70
+ */
71
+ export const DURATION_PATTERN = /^[1-9]\d{0,4}(m|h|d)$/;
43
72
  /** Tuning passed to a model (temperature, maxTokens, …). */
44
73
  export const ModelParams = s
45
74
  .object({
@@ -28,5 +28,13 @@ export type Guard = {
28
28
  } | {
29
29
  any: Guard[];
30
30
  };
31
+ /**
32
+ * Says what is wrong with a value that is no condition, instead of Zod's
33
+ * "Invalid input": an unknown kind and the allowed ones, or what a known
34
+ * kind takes.
35
+ */
36
+ export declare function guardProblem(input: unknown): string;
31
37
  /** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
32
38
  export declare const Guard: Schema<Guard>;
39
+ /** Whether a value is a condition the engine accepts, so callers can check before they write one. */
40
+ export declare function isGuard(value: unknown): value is Guard;
@@ -1,5 +1,50 @@
1
1
  import { s } from "../../../schema-kit/src/index.js";
2
2
  const pair = () => s.tuple([s.unknown(), s.unknown()]);
3
+ /** The condition kinds, in the order the schema tries them. */
4
+ const GUARD_KINDS = [
5
+ "equals",
6
+ "notEquals",
7
+ "contains",
8
+ "exists",
9
+ "gt",
10
+ "gte",
11
+ "lt",
12
+ "lte",
13
+ "not",
14
+ "all",
15
+ "any",
16
+ ];
17
+ /** What each kind takes, for the message about a known kind written the wrong way. */
18
+ const GUARD_SHAPES = {
19
+ equals: "a list of two values",
20
+ notEquals: "a list of two values",
21
+ contains: "a list of two values",
22
+ exists: "a path, such as input.email",
23
+ gt: "a list of two values",
24
+ gte: "a list of two values",
25
+ lt: "a list of two values",
26
+ lte: "a list of two values",
27
+ not: "one condition",
28
+ all: "a list of conditions",
29
+ any: "a list of conditions",
30
+ };
31
+ /**
32
+ * Says what is wrong with a value that is no condition, instead of Zod's
33
+ * "Invalid input": an unknown kind and the allowed ones, or what a known
34
+ * kind takes.
35
+ */
36
+ export function guardProblem(input) {
37
+ const allowed = `allowed: ${GUARD_KINDS.join(", ")}`;
38
+ const keys = typeof input === "object" && input !== null && !Array.isArray(input) ? Object.keys(input) : [];
39
+ if (keys.length !== 1) {
40
+ return `a condition is a map with exactly one kind, such as { equals: [a, b] }; ${allowed}`;
41
+ }
42
+ const [kind = ""] = keys;
43
+ const shape = GUARD_SHAPES[kind];
44
+ return shape === undefined
45
+ ? `unknown condition kind "${kind}"; ${allowed}`
46
+ : `condition "${kind}" takes ${shape}`;
47
+ }
3
48
  /** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
4
49
  export const Guard = s.lazy(() => s.union([
5
50
  s.object({ equals: pair() }).strict(),
@@ -13,4 +58,8 @@ export const Guard = s.lazy(() => s.union([
13
58
  s.object({ not: Guard }).strict(),
14
59
  s.object({ all: s.array(Guard) }).strict(),
15
60
  s.object({ any: s.array(Guard) }).strict(),
16
- ]));
61
+ ], { error: (issue) => guardProblem(issue.input) }));
62
+ /** Whether a value is a condition the engine accepts, so callers can check before they write one. */
63
+ export function isGuard(value) {
64
+ return Guard.safeParse(value).success;
65
+ }
@@ -0,0 +1,17 @@
1
+ import { type Issue } from "../../../schema-kit/src/index.js";
2
+ /**
3
+ * Words the schema's issues the way a person fixes them (HAL-12126). A
4
+ * required key that isn't there says so by name, instead of Zod's "Invalid
5
+ * input: expected string, received undefined", whose path the line doesn't
6
+ * show. An unrecognized key next to it that is a near spelling of a missing
7
+ * key asks "Did you mean …?". Codes and paths stay Zod's.
8
+ *
9
+ * @param issues - the schema's issues for one file
10
+ * @param data - the data the schema got, to tell a missing key from a wrong value
11
+ *
12
+ * @example
13
+ * // { nmae: "Acme" } for a kind that needs `name`:
14
+ * wordIssues(issues, data).map((issue) => issue.message);
15
+ * // ['Missing required key "name"', 'Unrecognized key: "nmae". Did you mean "name"?']
16
+ */
17
+ export declare function wordIssues(issues: readonly Issue[], data: unknown): Issue[];
@@ -0,0 +1,110 @@
1
+ import { formatPath } from "../../../schema-kit/src/index.js";
2
+ import { isMap } from "./legacy-keys.js";
3
+ /**
4
+ * How far a misspelled key may be from a missing one for "did you mean": the
5
+ * CLI's limit for a typed command (cli-output 1.3), so "nmae" finds "name".
6
+ */
7
+ const nearDistance = 2;
8
+ /**
9
+ * Words the schema's issues the way a person fixes them (HAL-12126). A
10
+ * required key that isn't there says so by name, instead of Zod's "Invalid
11
+ * input: expected string, received undefined", whose path the line doesn't
12
+ * show. An unrecognized key next to it that is a near spelling of a missing
13
+ * key asks "Did you mean …?". Codes and paths stay Zod's.
14
+ *
15
+ * @param issues - the schema's issues for one file
16
+ * @param data - the data the schema got, to tell a missing key from a wrong value
17
+ *
18
+ * @example
19
+ * // { nmae: "Acme" } for a kind that needs `name`:
20
+ * wordIssues(issues, data).map((issue) => issue.message);
21
+ * // ['Missing required key "name"', 'Unrecognized key: "nmae". Did you mean "name"?']
22
+ */
23
+ export function wordIssues(issues, data) {
24
+ const missing = issues.filter((issue) => isMissingKey(issue, data));
25
+ return issues.map((issue) => {
26
+ if (missing.includes(issue)) {
27
+ return { ...issue, message: `Missing required key "${String(issue.path.at(-1))}"` };
28
+ }
29
+ if (issue.code === "unrecognized_keys" && issue.keys !== undefined) {
30
+ const near = nearMissingKeys(issue.keys, missingKeysIn(missing, issue.path));
31
+ return near === "" ? issue : { ...issue, message: `${issue.message}. ${near}` };
32
+ }
33
+ return issue;
34
+ });
35
+ }
36
+ /** Whether Zod found a wrong type because the key isn't in its map at all. */
37
+ function isMissingKey(issue, data) {
38
+ const key = issue.path.at(-1);
39
+ if (issue.code !== "invalid_type" || typeof key !== "string") {
40
+ return false;
41
+ }
42
+ const parent = valueAt(data, issue.path.slice(0, -1));
43
+ return isMap(parent) && !Object.hasOwn(parent, key);
44
+ }
45
+ /** The value at a path, or `undefined` when a step of it isn't there. */
46
+ function valueAt(data, path) {
47
+ let value = data;
48
+ for (const segment of path) {
49
+ if (Array.isArray(value) && typeof segment === "number") {
50
+ value = value[segment];
51
+ }
52
+ else if (isMap(value) && typeof segment === "string" && Object.hasOwn(value, segment)) {
53
+ value = value[segment];
54
+ }
55
+ else {
56
+ return undefined;
57
+ }
58
+ }
59
+ return value;
60
+ }
61
+ /** The missing keys of the map at `path`. */
62
+ function missingKeysIn(missing, path) {
63
+ const where = formatPath(path);
64
+ return missing
65
+ .filter((issue) => formatPath(issue.path.slice(0, -1)) === where)
66
+ .map((issue) => String(issue.path.at(-1)));
67
+ }
68
+ /**
69
+ * "Did you mean "name"?" for one unrecognized key, or with the key named for
70
+ * several: 'Did you mean "name" for "nmae"?'. A key with no missing key
71
+ * near it, or with two equally likely, gets no guess.
72
+ */
73
+ function nearMissingKeys(unrecognized, missing) {
74
+ const pairs = unrecognized.flatMap((key) => {
75
+ const near = missing.filter((candidate) => editDistance(key, candidate) <= nearDistance);
76
+ return near.length === 1 ? [{ key, near: near[0] }] : [];
77
+ });
78
+ if (pairs.length === 0) {
79
+ return "";
80
+ }
81
+ if (unrecognized.length === 1) {
82
+ return `Did you mean "${pairs[0]?.near}"?`;
83
+ }
84
+ return `Did you mean ${pairs.map(({ key, near }) => `"${near}" for "${key}"`).join(", ")}?`;
85
+ }
86
+ /**
87
+ * The fewest single-character insertions, deletions, substitutions and swaps
88
+ * of two neighbours that turn `from` into `to`, so "nmae" and "name" are one apart.
89
+ * The CLI has its own copy for commands; core can't use the CLI's.
90
+ */
91
+ function editDistance(from, to) {
92
+ const width = to.length + 1;
93
+ const cells = new Array((from.length + 1) * width).fill(0);
94
+ const at = (i, j) => cells[i * width + j] ?? 0;
95
+ for (let i = 0; i <= from.length; i += 1) {
96
+ for (let j = 0; j <= to.length; j += 1) {
97
+ if (i === 0 || j === 0) {
98
+ cells[i * width + j] = i + j;
99
+ continue;
100
+ }
101
+ const cost = from[i - 1] === to[j - 1] ? 0 : 1;
102
+ let best = Math.min(at(i - 1, j) + 1, at(i, j - 1) + 1, at(i - 1, j - 1) + cost);
103
+ if (i > 1 && j > 1 && from[i - 1] === to[j - 2] && from[i - 2] === to[j - 1]) {
104
+ best = Math.min(best, at(i - 2, j - 2) + 1);
105
+ }
106
+ cells[i * width + j] = best;
107
+ }
108
+ }
109
+ return at(from.length, to.length);
110
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What {@link RunExecutor.startAgent} throws when the executor refuses an agent run on purpose
3
+ * because agent runs aren't built yet (requirement `ports.agent-runs-not-available`). A caller
4
+ * that answers a person, such as the host's run routes, can then tell "not built yet" from a
5
+ * real failure.
6
+ *
7
+ * Check for it with {@link isAgentRunsNotAvailable}, not `instanceof`: an executor may be built
8
+ * against its own copy of this package.
9
+ *
10
+ * TODO(engine step 4): remove this with the mapping in `host/server` when the agent loop lands.
11
+ */
12
+ export declare class AgentRunsNotAvailable extends Error {
13
+ readonly name = "AgentRunsNotAvailable";
14
+ /** @param message - safe to log; the host doesn't send it to a client */
15
+ constructor(message: string);
16
+ }
17
+ /**
18
+ * Whether `value` is an {@link AgentRunsNotAvailable}: an `Error` named "AgentRunsNotAvailable".
19
+ * It works across copies of this package, where `instanceof` doesn't.
20
+ */
21
+ export declare function isAgentRunsNotAvailable(value: unknown): value is AgentRunsNotAvailable;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What {@link RunExecutor.startAgent} throws when the executor refuses an agent run on purpose
3
+ * because agent runs aren't built yet (requirement `ports.agent-runs-not-available`). A caller
4
+ * that answers a person, such as the host's run routes, can then tell "not built yet" from a
5
+ * real failure.
6
+ *
7
+ * Check for it with {@link isAgentRunsNotAvailable}, not `instanceof`: an executor may be built
8
+ * against its own copy of this package.
9
+ *
10
+ * TODO(engine step 4): remove this with the mapping in `host/server` when the agent loop lands.
11
+ */
12
+ export class AgentRunsNotAvailable extends Error {
13
+ name = "AgentRunsNotAvailable";
14
+ /** @param message - safe to log; the host doesn't send it to a client */
15
+ constructor(message) {
16
+ super(message);
17
+ }
18
+ }
19
+ /**
20
+ * Whether `value` is an {@link AgentRunsNotAvailable}: an `Error` named "AgentRunsNotAvailable".
21
+ * It works across copies of this package, where `instanceof` doesn't.
22
+ */
23
+ export function isAgentRunsNotAvailable(value) {
24
+ return value instanceof Error && value.name === "AgentRunsNotAvailable";
25
+ }
@@ -31,3 +31,15 @@ export interface BlobStore {
31
31
  */
32
32
  get(hash: string): Promise<Uint8Array | null>;
33
33
  }
34
+ /**
35
+ * Refuses a media type {@link BlobStore.put} must not store: anything but
36
+ * `type/subtype` made of HTTP token characters.
37
+ *
38
+ * @throws RangeError naming the media type
39
+ */
40
+ export declare function checkBlobMediaType(mediaType: string): void;
41
+ /**
42
+ * Whether a hash can name a blob: 64 lowercase hex characters. Any other
43
+ * is answered with `null` by {@link BlobStore.get} before it reaches storage.
44
+ */
45
+ export declare function isBlobHash(hash: string): boolean;
@@ -1,2 +1,24 @@
1
1
  /** Version of the {@link BlobStore} port. A breaking change bumps it and comes with an ADR. */
2
2
  export const blobStoreVersion = 1;
3
+ /** HTTP token characters (RFC 9110), for each half of `type/subtype`. */
4
+ const mediaTypeToken = "[!#$%&'*+.^_`|~0-9A-Za-z-]+";
5
+ const mediaTypePattern = new RegExp(`^${mediaTypeToken}/${mediaTypeToken}$`, "u");
6
+ const blobHashPattern = /^[0-9a-f]{64}$/u;
7
+ /**
8
+ * Refuses a media type {@link BlobStore.put} must not store: anything but
9
+ * `type/subtype` made of HTTP token characters.
10
+ *
11
+ * @throws RangeError naming the media type
12
+ */
13
+ export function checkBlobMediaType(mediaType) {
14
+ if (!mediaTypePattern.test(mediaType)) {
15
+ throw new RangeError(`Media type ${JSON.stringify(mediaType)} is not type/subtype without parameters.`);
16
+ }
17
+ }
18
+ /**
19
+ * Whether a hash can name a blob: 64 lowercase hex characters. Any other
20
+ * is answered with `null` by {@link BlobStore.get} before it reaches storage.
21
+ */
22
+ export function isBlobHash(hash) {
23
+ return blobHashPattern.test(hash);
24
+ }
@@ -85,6 +85,14 @@ export interface ChatResponse {
85
85
  finishReason: "stop" | "tool_calls" | "length" | "error" | "other";
86
86
  /** The provider's record of this turn; the engine copies it onto the assistant message unchanged. */
87
87
  replay?: ProviderReplay;
88
+ /**
89
+ * Plain sentences from the provider on how it changed the call, for the
90
+ * person who reads the run log, such as "Left out temperature:
91
+ * claude-sonnet-5-5 doesn't take it." The provider's own words: never the
92
+ * vendor's text, never a key. The engine keeps them on the call's
93
+ * `llm.response`, out of the conversation. Absent when it changed nothing.
94
+ */
95
+ notes?: string[];
88
96
  }
89
97
  /**
90
98
  * One piece of a streamed answer. Deltas arrive in the order the model