@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
@@ -0,0 +1,68 @@
1
+ /**
2
+ * What a run sent, by the reader rules of requirement
3
+ * `events.tool-result-risk`. Pure; the receipt and the runs list both use it,
4
+ * so they say the same thing about a run.
5
+ *
6
+ * A call counts as sent when its `tool.result` has `risk: "send"`, a `noun`
7
+ * and `outcome: "ok"`, and as "may have sent" with `outcome: "unknown"`. A
8
+ * missing `verb` is "sent". Groups and the counts in them keep call order.
9
+ *
10
+ * @param events - the run's events, oldest first
11
+ * @returns what it sent, what it may have sent, and whether it made a tool call
12
+ *
13
+ * @example
14
+ * const { sent } = sendsOf(await runStore.events(runId));
15
+ * // gmail_send, calendar_create_event twice, drive_create_file =>
16
+ * // [{ verb: "sent", counts: [1 email, 2 invites] }, { verb: "saved", counts: [1 file] }]
17
+ */
18
+ export function sendsOf(events) {
19
+ const sends = { sent: [], maySend: [], madeToolCalls: false };
20
+ for (const event of events) {
21
+ if (!couldSend(event))
22
+ continue;
23
+ sends.madeToolCalls = true;
24
+ if (event.type !== "tool.result" || event.risk !== "send" || event.noun === undefined) {
25
+ continue;
26
+ }
27
+ const verb = event.verb ?? "sent";
28
+ if (event.outcome === "ok")
29
+ addCall(sends.sent, verb, event.noun);
30
+ if (event.outcome === "unknown")
31
+ addCall(sends.maySend, verb, event.noun);
32
+ }
33
+ return sends;
34
+ }
35
+ /**
36
+ * Whether the event is a call that could have sent something: a tool call, or
37
+ * a child run started, whose own log holds what it sent.
38
+ */
39
+ function couldSend(event) {
40
+ return (event.type === "tool.called" ||
41
+ event.type === "tool.result" ||
42
+ event.type === "workflow.started");
43
+ }
44
+ /** Count one call in its verb's group, adding the group or the noun at the end when new. */
45
+ function addCall(groups, verb, noun) {
46
+ let group = groups.find((candidate) => candidate.verb === verb);
47
+ if (group === undefined) {
48
+ group = { verb, counts: [] };
49
+ groups.push(group);
50
+ }
51
+ const count = group.counts.find((candidate) => sameNoun(candidate.noun, noun));
52
+ if (count === undefined) {
53
+ group.counts.push({ noun: { one: noun.one, many: noun.many }, calls: 1 });
54
+ }
55
+ else {
56
+ count.calls += 1;
57
+ }
58
+ }
59
+ export function countNoun(counts, noun) {
60
+ const count = counts.find((candidate) => sameNoun(candidate.noun, noun));
61
+ if (count === undefined)
62
+ counts.push({ noun: { one: noun.one, many: noun.many }, calls: 1 });
63
+ else
64
+ count.calls += 1;
65
+ }
66
+ function sameNoun(a, b) {
67
+ return a.one === b.one && a.many === b.many;
68
+ }
@@ -1,4 +1,4 @@
1
- import type { CantTryStep, RunFailureReason, RunKind, RunStatus, RunTrigger, Usage } from "./run-basics.js";
1
+ import type { CantTryStep, RunFailureCause, RunFailureReason, RunKind, RunStatus, RunTrigger, Usage } from "./run-basics.js";
2
2
  /** A tool call a run is waiting on a person's OK for, from its `approval.requested` event. */
3
3
  export interface PendingApproval {
4
4
  /** The state's agent: the one that asked, or the one whose subagent asked. */
@@ -8,7 +8,10 @@ export interface PendingApproval {
8
8
  * `events.agent-resume-inner`); absent when `agent` asked itself.
9
9
  */
10
10
  subagent?: string;
11
+ /** The bare tool name, as the model was offered it. */
11
12
  tool: string;
13
+ /** The connector the tool comes from (requirement `events.approval-requested-connector`); absent for a built-in tool and in older logs. */
14
+ connector?: string;
12
15
  args: unknown;
13
16
  callId: string;
14
17
  /** ISO time the approval was asked for. */
@@ -56,6 +59,13 @@ export interface RunSummary {
56
59
  * failed, and for older logs whose `run.failed` gives no reason.
57
60
  */
58
61
  reason: RunFailureReason | null;
62
+ /**
63
+ * The typed cause of the failure, from its `run.failed` event (requirement
64
+ * `events.run-failed-cause`). Absent while the run hasn't failed, for older
65
+ * logs and when the failing error had no kind. Read it, not `error`, to
66
+ * tell one failure from another on a screen.
67
+ */
68
+ cause?: RunFailureCause;
59
69
  definitionsVersion: string;
60
70
  trigger: RunTrigger | null;
61
71
  /** The run that started this one (subflows). */
@@ -2,7 +2,8 @@ import { type SandboxOpenedView } from "./sandbox-opened.js";
2
2
  /**
3
3
  * Reads the `sandbox` of a stored `sandbox.opened` event (requirement
4
4
  * `events.sandbox-opened`). It never throws: a value that is damaged, from
5
- * another version or missing a field gives `null`, so a screen says it
5
+ * another version or missing a field gives `null`, and so does a damaged
6
+ * sign-in, though an event without one reads fine, so a screen says it
6
7
  * couldn't read what the step could do instead of showing part of it. It
7
8
  * copies only the view's fields, so an extra field in a damaged log never
8
9
  * reaches a screen either.
@@ -1,5 +1,9 @@
1
1
  import { deniedPathGroupCodes, } from "./sandbox-opened.js";
2
2
  const strengths = ["os", "vm", "remote"];
3
+ const subscriptionProviders = [
4
+ "anthropic",
5
+ "openai",
6
+ ];
3
7
  const groupCodes = deniedPathGroupCodes;
4
8
  /** A list of strings, or `null` when the value is anything else. */
5
9
  function stringsOf(value) {
@@ -18,10 +22,29 @@ function groupCodesOf(value) {
18
22
  return null;
19
23
  return codes;
20
24
  }
25
+ /**
26
+ * A stored sign-in with only its kind and provider; `undefined` when there is
27
+ * none, and `null` when it is damaged.
28
+ */
29
+ function signInOf(value) {
30
+ if (value === undefined)
31
+ return undefined;
32
+ if (typeof value !== "object" || value === null)
33
+ return null;
34
+ const { kind, provider } = value;
35
+ if (kind === "key" && typeof provider === "string" && provider !== "") {
36
+ return { kind, provider };
37
+ }
38
+ if (kind === "subscription" && subscriptionProviders.includes(provider)) {
39
+ return { kind, provider: provider };
40
+ }
41
+ return null;
42
+ }
21
43
  /**
22
44
  * Reads the `sandbox` of a stored `sandbox.opened` event (requirement
23
45
  * `events.sandbox-opened`). It never throws: a value that is damaged, from
24
- * another version or missing a field gives `null`, so a screen says it
46
+ * another version or missing a field gives `null`, and so does a damaged
47
+ * sign-in, though an event without one reads fine, so a screen says it
25
48
  * couldn't read what the step could do instead of showing part of it. It
26
49
  * copies only the view's fields, so an extra field in a damaged log never
27
50
  * reaches a screen either.
@@ -42,6 +65,7 @@ export function readSandboxOpened(value) {
42
65
  const deniedGroups = groupCodesOf(fields.deniedGroups);
43
66
  const deniedPaths = stringsOf(fields.deniedPaths);
44
67
  const allowedSites = stringsOf(fields.allowedSites);
68
+ const signIn = signInOf(fields.signIn);
45
69
  if (!strengths.includes(strength) || typeof workingFolder !== "string")
46
70
  return null;
47
71
  if (typeof timeLimitMs !== "number" || !Number.isFinite(timeLimitMs) || timeLimitMs < 0) {
@@ -49,7 +73,7 @@ export function readSandboxOpened(value) {
49
73
  }
50
74
  if (readOnlyPaths === null || deniedGroups === null)
51
75
  return null;
52
- if (deniedPaths === null || allowedSites === null)
76
+ if (deniedPaths === null || allowedSites === null || signIn === null)
53
77
  return null;
54
78
  return {
55
79
  strength: strength,
@@ -59,5 +83,6 @@ export function readSandboxOpened(value) {
59
83
  deniedPaths,
60
84
  allowedSites,
61
85
  timeLimitMs,
86
+ ...(signIn === undefined ? {} : { signIn }),
62
87
  };
63
88
  }
@@ -6,12 +6,37 @@
6
6
  export type SandboxStrength = "os" | "vm" | "remote";
7
7
  /**
8
8
  * The codes of the groups of paths a sandbox denies: the person's SSH keys,
9
- * their cloud sign-ins, browser data, password stores, Halonic's own data and
10
- * other agents' settings (such as `~/.claude`). One list, so the profile
9
+ * their cloud sign-ins, browser data, password stores, package registry tokens,
10
+ * shell histories, Halonic's own data and other agents' settings (such as `~/.claude`). One list, so the profile
11
11
  * builder, the run log and the screens name the same groups. Screens word
12
12
  * each code through the message catalogue.
13
13
  */
14
- export declare const deniedPathGroupCodes: readonly ["ssh-keys", "cloud-sign-ins", "browser-data", "password-stores", "halonic-data", "agent-settings"];
14
+ export declare const deniedPathGroupCodes: readonly ["ssh-keys", "cloud-sign-ins", "browser-data", "password-stores", "registry-tokens", "shell-history", "halonic-data", "agent-settings"];
15
+ /** The model providers a person can sign in to with their own subscription: Claude, and ChatGPT. */
16
+ export type SubscriptionProvider = "anthropic" | "openai";
17
+ /**
18
+ * How a sandboxed step's agent signs in to its model, for the run page's
19
+ * Your sign-in row. It names the kind and the provider only: never a key,
20
+ * the name of the secret that holds it, an address or a path.
21
+ */
22
+ export type SandboxSignIn =
23
+ /**
24
+ * With a key Halonic keeps: the agent never sees it, and Halonic adds it to
25
+ * requests on their way to `provider`, the id of the provider the key is
26
+ * for, such as `anthropic` or `zai`.
27
+ */
28
+ {
29
+ kind: "key";
30
+ provider: string;
31
+ }
32
+ /**
33
+ * With the person's own subscription, saved in the agent's own settings
34
+ * folder, which the agent can read while it runs.
35
+ */
36
+ | {
37
+ kind: "subscription";
38
+ provider: SubscriptionProvider;
39
+ };
15
40
  /** A group of denied paths: one of {@link deniedPathGroupCodes}. */
16
41
  export type DeniedPathGroupCode = (typeof deniedPathGroupCodes)[number];
17
42
  /**
@@ -39,6 +64,11 @@ export interface SandboxOpenedView {
39
64
  allowedSites: string[];
40
65
  /** How long the step may last, in milliseconds. */
41
66
  timeLimitMs: number;
67
+ /**
68
+ * How the agent signs in to its model. Absent when the host didn't say,
69
+ * and in events logged before it was recorded.
70
+ */
71
+ signIn?: SandboxSignIn;
42
72
  }
43
73
  /**
44
74
  * The parts of a sandbox profile that {@link sandboxOpenedView} reads. The
@@ -69,12 +99,15 @@ export interface SandboxOpenedOptions {
69
99
  home: string | null;
70
100
  /** The groups the profile's denied paths were built from. */
71
101
  deniedGroups: readonly DeniedPathGroup[];
102
+ /** How the agent signs in to its model, when the host knows. */
103
+ signIn?: SandboxSignIn;
72
104
  }
73
105
  /**
74
106
  * Makes the display copy of a sandbox profile that a `sandbox.opened` event
75
107
  * carries (requirement `events.sandbox-opened`). It copies a fixed list of
76
108
  * fields and nothing else, so the profile's `env`, its temp and settings
77
- * folders and any field added later never reach the run log. A group is named when it has paths and all of them
109
+ * folders and any field added later never reach the run log; of the sign-in
110
+ * it copies only the kind and the provider. A group is named when it has paths and all of them
78
111
  * are denied, so a group with no paths never claims something was blocked;
79
112
  * the denied paths outside the named groups are listed one by one. Paths in
80
113
  * the person's home folder start with `~`.
@@ -1,8 +1,8 @@
1
1
  import { shortenHome } from "./home-path.js";
2
2
  /**
3
3
  * The codes of the groups of paths a sandbox denies: the person's SSH keys,
4
- * their cloud sign-ins, browser data, password stores, Halonic's own data and
5
- * other agents' settings (such as `~/.claude`). One list, so the profile
4
+ * their cloud sign-ins, browser data, password stores, package registry tokens,
5
+ * shell histories, Halonic's own data and other agents' settings (such as `~/.claude`). One list, so the profile
6
6
  * builder, the run log and the screens name the same groups. Screens word
7
7
  * each code through the message catalogue.
8
8
  */
@@ -11,6 +11,8 @@ export const deniedPathGroupCodes = [
11
11
  "cloud-sign-ins",
12
12
  "browser-data",
13
13
  "password-stores",
14
+ "registry-tokens",
15
+ "shell-history",
14
16
  "halonic-data",
15
17
  "agent-settings",
16
18
  ];
@@ -18,7 +20,8 @@ export const deniedPathGroupCodes = [
18
20
  * Makes the display copy of a sandbox profile that a `sandbox.opened` event
19
21
  * carries (requirement `events.sandbox-opened`). It copies a fixed list of
20
22
  * fields and nothing else, so the profile's `env`, its temp and settings
21
- * folders and any field added later never reach the run log. A group is named when it has paths and all of them
23
+ * folders and any field added later never reach the run log; of the sign-in
24
+ * it copies only the kind and the provider. A group is named when it has paths and all of them
22
25
  * are denied, so a group with no paths never claims something was blocked;
23
26
  * the denied paths outside the named groups are listed one by one. Paths in
24
27
  * the person's home folder start with `~`.
@@ -48,5 +51,12 @@ export function sandboxOpenedView(profile, options) {
48
51
  deniedPaths: [...denied].filter((path) => !inNamedGroup.has(path)).map(shorten),
49
52
  allowedSites: [...profile.network.allowedSites],
50
53
  timeLimitMs: profile.timeLimitMs,
54
+ ...(options.signIn === undefined ? {} : { signIn: signInOf(options.signIn) }),
51
55
  };
52
56
  }
57
+ /** The sign-in's kind and provider, and nothing else it may carry. */
58
+ function signInOf(signIn) {
59
+ return signIn.kind === "key"
60
+ ? { kind: "key", provider: signIn.provider }
61
+ : { kind: "subscription", provider: signIn.provider };
62
+ }
@@ -104,6 +104,7 @@ function applyEvent(summary, event) {
104
104
  return;
105
105
  case "event.received":
106
106
  case "workflow.finished":
107
+ case "workflow.resumed":
107
108
  case "timer.fired":
108
109
  summary.status = "running";
109
110
  summary.waitingOn = null;
@@ -125,6 +126,8 @@ function applyEvent(summary, event) {
125
126
  summary.endedAt = event.at;
126
127
  summary.error = event.error;
127
128
  summary.reason = event.reason ?? null;
129
+ if (event.cause !== undefined)
130
+ summary.cause = event.cause;
128
131
  summary.approvals = [];
129
132
  return;
130
133
  case "run.cant-try":
@@ -143,6 +146,7 @@ function pendingApproval(event) {
143
146
  agent: event.agent,
144
147
  ...(event.subagent === undefined ? {} : { subagent: event.subagent }),
145
148
  tool: event.tool,
149
+ ...(event.connector === undefined ? {} : { connector: event.connector }),
146
150
  args: event.args,
147
151
  callId: event.callId,
148
152
  at: event.at,
@@ -163,9 +167,12 @@ function removeApproval(approvals, callId) {
163
167
  }
164
168
  /**
165
169
  * Add one model call's tokens, and its cost when it has a price. A call the
166
- * person's subscription paid for is counted on its own, never priced.
170
+ * person's subscription paid for is counted on its own, never priced. An
171
+ * answer from the cache made no model call, so it adds nothing at all.
167
172
  */
168
173
  function addModelCall(summary, call) {
174
+ if (call.cached === true)
175
+ return;
169
176
  summary.usage = addUsage(summary.usage, call.usage);
170
177
  if (call.paidBy === "subscription")
171
178
  summary.subscriptionCalls++;
@@ -98,6 +98,7 @@ function updateOf(event) {
98
98
  // Only while the run waits; otherwise no entry is open and it stands alone.
99
99
  case "timer.fired":
100
100
  case "event.received":
101
+ case "workflow.resumed":
101
102
  return { opener: "run.waiting", fields: [], closes: true };
102
103
  default:
103
104
  return null;
@@ -0,0 +1,25 @@
1
+ import type { ToolFailureCause } from "./run-basics.js";
2
+ import type { RunEventBody } from "./run-event.js";
3
+ /** A `tool.result` event, whose `cause` this reads. */
4
+ type ToolResultEvent = Extract<RunEventBody, {
5
+ type: "tool.result";
6
+ }>;
7
+ /** The longest `name` a `connector-not-started` cause carries; the engine cuts a longer one. */
8
+ export declare const maxCauseNameLength = 120;
9
+ /**
10
+ * Reads the `cause` of a stored `tool.result` event (requirement
11
+ * `events.tool-result-cause`). It never throws: a cause with a code it
12
+ * doesn't know, a field of the wrong type or a missing field reads as
13
+ * absent, so a screen falls back to its plain line instead of showing part
14
+ * of a cause. It copies only the cause's own fields, so an extra field in a
15
+ * log never reaches a screen.
16
+ *
17
+ * @param event - the `tool.result` event, as parsed from the log
18
+ * @returns the cause, or `undefined` when there is none it can read
19
+ *
20
+ * @example
21
+ * toolFailureCauseOf(result); // cause { code: "time-limit", seconds: 60 } => { code: "time-limit", seconds: 60 }
22
+ * toolFailureCauseOf(result); // cause { code: "melted" } => undefined
23
+ */
24
+ export declare function toolFailureCauseOf(event: ToolResultEvent): ToolFailureCause | undefined;
25
+ export {};
@@ -0,0 +1,66 @@
1
+ /** The longest `name` a `connector-not-started` cause carries; the engine cuts a longer one. */
2
+ export const maxCauseNameLength = 120;
3
+ const notMadeReasons = [
4
+ "not-connected",
5
+ "tool-gone",
6
+ "sending-off",
7
+ "bad-arguments",
8
+ ];
9
+ const startReasons = [
10
+ "program-missing",
11
+ "secret-not-set",
12
+ "other",
13
+ ];
14
+ /**
15
+ * Reads the `cause` of a stored `tool.result` event (requirement
16
+ * `events.tool-result-cause`). It never throws: a cause with a code it
17
+ * doesn't know, a field of the wrong type or a missing field reads as
18
+ * absent, so a screen falls back to its plain line instead of showing part
19
+ * of a cause. It copies only the cause's own fields, so an extra field in a
20
+ * log never reaches a screen.
21
+ *
22
+ * @param event - the `tool.result` event, as parsed from the log
23
+ * @returns the cause, or `undefined` when there is none it can read
24
+ *
25
+ * @example
26
+ * toolFailureCauseOf(result); // cause { code: "time-limit", seconds: 60 } => { code: "time-limit", seconds: 60 }
27
+ * toolFailureCauseOf(result); // cause { code: "melted" } => undefined
28
+ */
29
+ export function toolFailureCauseOf(event) {
30
+ // Typed, but parsed from a file: it may hold anything.
31
+ const cause = event.cause;
32
+ if (typeof cause !== "object" || cause === null)
33
+ return undefined;
34
+ const fields = cause;
35
+ switch (fields.code) {
36
+ case "time-limit":
37
+ return isSeconds(fields.seconds)
38
+ ? { code: "time-limit", seconds: fields.seconds }
39
+ : undefined;
40
+ case "engine-stopped":
41
+ return { code: "engine-stopped" };
42
+ case "not-made":
43
+ return notMadeReasons.includes(fields.why)
44
+ ? { code: "not-made", why: fields.why }
45
+ : undefined;
46
+ case "connector-not-started":
47
+ return connectorNotStarted(fields);
48
+ default:
49
+ return undefined;
50
+ }
51
+ }
52
+ /** A time limit in seconds: a finite number above zero. */
53
+ function isSeconds(value) {
54
+ return typeof value === "number" && Number.isFinite(value) && value > 0;
55
+ }
56
+ function connectorNotStarted(fields) {
57
+ if (!startReasons.includes(fields.why))
58
+ return undefined;
59
+ const why = fields.why;
60
+ const { name } = fields;
61
+ if (name === undefined)
62
+ return { code: "connector-not-started", why };
63
+ if (typeof name !== "string" || name === "" || name.length > maxCauseNameLength)
64
+ return undefined;
65
+ return { code: "connector-not-started", why, name };
66
+ }
@@ -1,19 +1,20 @@
1
1
  export { compact } from "./compact.js";
2
2
  export { jsonSchemaOf } from "./json-schema.js";
3
3
  export type { FileKind, FilePlace, KindCheckProblem, KindSyntax } from "./kind.js";
4
- export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
4
+ export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, PROTECTED_TOP_NAMES, workingFolderProblem, } from "./kinds/agent/sandbox-fields.js";
5
5
  export type { Agent, AgentMethod, AgentOutput, MethodField } from "./kinds/agent/schema.js";
6
6
  export { type ConnectorStart, type FolderLookup, touchesWorkingFolder, type WorkingFolderReach, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
7
7
  export type { Collection, CollectionField, CollectionView } from "./kinds/collection/schema.js";
8
8
  export { FIELD_TYPES } from "./kinds/collection/schema.js";
9
9
  export { connectorIsLocal } from "./kinds/connector/is-local.js";
10
- export { approveAll, type Connector, needsApproval } from "./kinds/connector/schema.js";
11
- export type { Deployment, Deployments } from "./kinds/deployments/schema.js";
10
+ export { approveAll, asksBeforeEachUse, type Connector, marksRead, needsApproval, } from "./kinds/connector/schema.js";
11
+ export type { CloudflareSettings, Deployment, DeploymentLimits, Deployments, } from "./kinds/deployments/schema.js";
12
12
  export type { Hub, HubUses } from "./kinds/hub/schema.js";
13
+ export { approvedSignIns, type ResolvedSignIn, } from "./kinds/integration/approved-sign-ins.js";
13
14
  export { checkIntegrationSheet } from "./kinds/integration/kind.js";
14
15
  export { parseIntegrationSheet, type SheetProblem } from "./kinds/integration/parse-sheet.js";
15
- export { type DeclaredPlacement, type DeclaredSecret, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "./kinds/integration/policy.js";
16
- export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
16
+ export { type DeclaredClientSecret, type DeclaredPlacement, type DeclaredSecret, type DeclaredSignIn, type DeclaredSignInPlacement, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "./kinds/integration/policy.js";
17
+ export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationClientSecret, type IntegrationHost, type IntegrationSecret, type IntegrationSecretEntry, type IntegrationSecretHost, IntegrationSheet, type IntegrationSignIn, type IntegrationTool, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "./kinds/integration/schema.js";
17
18
  export type { KnowledgeSource } from "./kinds/knowledge/schema.js";
18
19
  export type { ModelAlias, Models } from "./kinds/models/schema.js";
19
20
  export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
@@ -21,7 +22,9 @@ export { checkPlugin } from "./kinds/plugin/checks.js";
21
22
  export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLUGIN_ID_LENGTH, MAX_PLUGIN_SECRET_NAME_LENGTH, NPM_EXACT_VERSION_PATTERN, networkSiteProblem, Plugin, type PluginBackend, type PluginLocalTool, type PluginUi, PYPI_EXACT_VERSION_PATTERN, pluginPathProblem, } from "./kinds/plugin/schema.js";
22
23
  export { type PluginSettingField, type PluginSettingValue, settingValueProblem, } from "./kinds/plugin/setting-values.js";
23
24
  export type { Provider } from "./kinds/provider/schema.js";
25
+ export { isProviderType, openAiCompatibleTypes, type ProviderType, providerTypes, providerTypesInWords, } from "./kinds/provider/types.js";
24
26
  export type { Routine, RoutineTarget, RoutineTrigger } from "./kinds/routine/schema.js";
27
+ export { WEBHOOK_REFUSED_HEADERS } from "./kinds/routine/webhook-headers.js";
25
28
  export type { Runtime } from "./kinds/runtime/schema.js";
26
29
  export type { Skill } from "./kinds/skill/schema.js";
27
30
  export { type PathLookup, skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
@@ -32,6 +35,6 @@ export { type FileProblem, type ParsedFile, type ParseFileOptions, parseFile, }
32
35
  export { fileKinds, isKindName, type KindName, type KindValues, kindNames } from "./registry.js";
33
36
  export { isReservedPath, RESERVED_FOLDER } from "./reserved.js";
34
37
  export { SCHEMA_VERSION } from "./shared/fields.js";
35
- export type { Guard } from "./shared/guard.js";
38
+ export { type Guard, isGuard } from "./shared/guard.js";
36
39
  export { type NamedPath, type ProgramStart, pathsNamedBy } from "./shared/program-start.js";
37
40
  export { foldName } from "./shared/relative-path.js";
@@ -1,23 +1,27 @@
1
1
  // The public API of @halonicjs/format. Internal code imports by relative path.
2
2
  export { compact } from "./compact.js";
3
3
  export { jsonSchemaOf } from "./json-schema.js";
4
- export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
4
+ export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, PROTECTED_TOP_NAMES, workingFolderProblem, } from "./kinds/agent/sandbox-fields.js";
5
5
  export { touchesWorkingFolder, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
6
6
  export { FIELD_TYPES } from "./kinds/collection/schema.js";
7
7
  export { connectorIsLocal } from "./kinds/connector/is-local.js";
8
- export { approveAll, needsApproval } from "./kinds/connector/schema.js";
8
+ export { approveAll, asksBeforeEachUse, marksRead, needsApproval, } from "./kinds/connector/schema.js";
9
+ export { approvedSignIns, } from "./kinds/integration/approved-sign-ins.js";
9
10
  export { checkIntegrationSheet } from "./kinds/integration/kind.js";
10
11
  export { parseIntegrationSheet } from "./kinds/integration/parse-sheet.js";
11
12
  export { integrationPolicy, } from "./kinds/integration/policy.js";
12
- export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
13
+ export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "./kinds/integration/schema.js";
13
14
  export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
14
15
  export { checkPlugin } from "./kinds/plugin/checks.js";
15
16
  export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLUGIN_ID_LENGTH, MAX_PLUGIN_SECRET_NAME_LENGTH, NPM_EXACT_VERSION_PATTERN, networkSiteProblem, Plugin, PYPI_EXACT_VERSION_PATTERN, pluginPathProblem, } from "./kinds/plugin/schema.js";
16
17
  export { settingValueProblem, } from "./kinds/plugin/setting-values.js";
18
+ export { isProviderType, openAiCompatibleTypes, providerTypes, providerTypesInWords, } from "./kinds/provider/types.js";
19
+ export { WEBHOOK_REFUSED_HEADERS } from "./kinds/routine/webhook-headers.js";
17
20
  export { skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
18
21
  export { parseFile, } from "./parse-file.js";
19
22
  export { fileKinds, isKindName, kindNames } from "./registry.js";
20
23
  export { isReservedPath, RESERVED_FOLDER } from "./reserved.js";
21
24
  export { SCHEMA_VERSION } from "./shared/fields.js";
25
+ export { isGuard } from "./shared/guard.js";
22
26
  export { pathsNamedBy } from "./shared/program-start.js";
23
27
  export { foldName } from "./shared/relative-path.js";
@@ -1,6 +1,7 @@
1
+ export { approvedSignIns, type ResolvedSignIn, } from "../kinds/integration/approved-sign-ins.js";
1
2
  export { checkIntegrationSheet } from "../kinds/integration/kind.js";
2
3
  export { parseIntegrationSheet, type SheetProblem } from "../kinds/integration/parse-sheet.js";
3
- export { type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "../kinds/integration/policy.js";
4
- export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
4
+ export { type DeclaredClientSecret, type DeclaredSignIn, type DeclaredSignInPlacement, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "../kinds/integration/policy.js";
5
+ export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationClientSecret, type IntegrationHost, type IntegrationSecret, type IntegrationSecretEntry, type IntegrationSecretHost, IntegrationSheet, type IntegrationSignIn, type IntegrationTool, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "../kinds/integration/schema.js";
5
6
  export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
6
7
  export { Plugin } from "../kinds/plugin/schema.js";
@@ -1,9 +1,10 @@
1
1
  // The public API of @halonicjs/format/integration: the permission sheet for
2
2
  // the integration kit and the conformance suite. It must not import `yaml`,
3
3
  // even indirectly; integration-entry.test.ts checks that.
4
+ export { approvedSignIns, } from "../kinds/integration/approved-sign-ins.js";
4
5
  export { checkIntegrationSheet } from "../kinds/integration/kind.js";
5
6
  export { parseIntegrationSheet } from "../kinds/integration/parse-sheet.js";
6
7
  export { integrationPolicy, } from "../kinds/integration/policy.js";
7
- export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
8
+ export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "../kinds/integration/schema.js";
8
9
  export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
9
10
  export { Plugin } from "../kinds/plugin/schema.js";
@@ -0,0 +1,14 @@
1
+ /** The most model calls `harnessLimits.maxSteps` may allow. */
2
+ export declare const MAX_HARNESS_STEPS = 10000;
3
+ /** The most minutes `harnessLimits.maxMinutes` may allow: one day. */
4
+ export declare const MAX_HARNESS_MINUTES = 1440;
5
+ /**
6
+ * `harnessLimits`: what one step of the agent may use when it runs in a
7
+ * harness program (`claude-code`, `codex`). Each field is optional; a limit
8
+ * left out doesn't apply. Halonic's own loop ignores the block.
9
+ */
10
+ export declare const HarnessLimits: import("zod").ZodObject<{
11
+ maxSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
12
+ maxMinutes: import("zod").ZodOptional<import("zod").ZodNumber>;
13
+ maxCost: import("zod").ZodOptional<import("zod").ZodNumber>;
14
+ }, import("zod/v4/core").$strict>;
@@ -0,0 +1,27 @@
1
+ // The limits on one step of a harness agent (requirement
2
+ // format.agent-harness-limits). A program such as Claude Code makes hundreds
3
+ // of model calls in a step, so the agent's `maxSteps`, sized for Halonic's
4
+ // own loop, can't bound it; these fields do, and only for a harness step.
5
+ import { s } from "../../../../schema-kit/src/index.js";
6
+ /** The most model calls `harnessLimits.maxSteps` may allow. */
7
+ export const MAX_HARNESS_STEPS = 10_000;
8
+ /** The most minutes `harnessLimits.maxMinutes` may allow: one day. */
9
+ export const MAX_HARNESS_MINUTES = 1440;
10
+ /**
11
+ * `harnessLimits`: what one step of the agent may use when it runs in a
12
+ * harness program (`claude-code`, `codex`). Each field is optional; a limit
13
+ * left out doesn't apply. Halonic's own loop ignores the block.
14
+ */
15
+ export const HarnessLimits = s
16
+ .object({
17
+ /** Most model calls the program makes in one step. */
18
+ maxSteps: s.number().int().min(1).max(MAX_HARNESS_STEPS).optional(),
19
+ /** Most minutes one step runs, not counting the time it waits for a person's answer. */
20
+ maxMinutes: s.number().int().min(1).max(MAX_HARNESS_MINUTES).optional(),
21
+ /**
22
+ * Most one step may spend, in the workspace budget's currency. Calls a
23
+ * subscription pays for count as 0, so only time and steps bound those.
24
+ */
25
+ maxCost: s.number().positive().optional(),
26
+ })
27
+ .strict();
@@ -31,12 +31,14 @@ export declare function defaultWorkingFolder(agentId: string): string;
31
31
  * Why a working folder can't be used, or `null` when it can. It must be a
32
32
  * path relative to the workspace with `/` between its parts, that stays in
33
33
  * the workspace and doesn't point into a {@link PROTECTED_TOP_NAMES} entry
34
- * or a top folder whose name starts with `.`: tools such as git, Claude
35
- * Code, Codex and editors read hooks, commands and tasks from those
34
+ * or, at any depth, a folder whose name starts with `.`: tools such as git,
35
+ * Claude Code, Codex and editors read hooks, commands and tasks from those
36
36
  * (`.git`, `.claude`, `.codex`, `.vscode`), and would run them outside the
37
- * sandbox. Parts that Windows or macOS would read as another name are refused
38
- * too, in fullwidth forms as well (see {@link relativePathProblem}). Symlinks
39
- * are resolved later, when the sandbox profile is built.
37
+ * sandbox. Any depth, because a nested clone such as `vendor/lib` has a
38
+ * `.git` of its own (HAL-5951). Parts that Windows or macOS would read as
39
+ * another name are refused too, in fullwidth forms as well (see
40
+ * {@link relativePathProblem}). Symlinks are resolved later, when the
41
+ * sandbox profile is built.
40
42
  *
41
43
  * @param path - the `workingFolder` value
42
44
  * @returns a message, or `null`
@@ -87,3 +89,11 @@ export declare function asciiAllowedSites(sites: readonly string[]): string[];
87
89
  export declare const WorkingFolder: import("zod").ZodString;
88
90
  /** One `allowedSites` entry: a host name, or `*.` and a domain. */
89
91
  export declare const AllowedSite: import("zod").ZodString;
92
+ /**
93
+ * A list of {@link AllowedSite}s, at most {@link MAX_ALLOWED_SITES}, for a
94
+ * field inside a union, such as a connector's `transport`. The cap is a
95
+ * refinement rather than `max`, because a union reports a list that's too
96
+ * long only as its whole input being wrong, not at the list. The JSON
97
+ * Schema still shows the cap as `maxItems`, so editors know it too.
98
+ */
99
+ export declare const AllowedSitesInUnion: import("zod").ZodArray<import("zod").ZodString>;