@halonicjs/testing 0.1.0 → 0.1.1

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 (153) 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/index.d.ts +1 -0
  6. package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
  7. package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
  8. package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
  9. package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
  10. package/dist/adapters/integration-kit/src/declaration.d.ts +2 -1
  11. package/dist/adapters/integration-kit/src/declaration.js +4 -3
  12. package/dist/adapters/integration-kit/src/host.d.ts +7 -1
  13. package/dist/adapters/integration-kit/src/host.js +1 -0
  14. package/dist/adapters/integration-kit/src/index.d.ts +3 -1
  15. package/dist/adapters/integration-kit/src/index.js +1 -0
  16. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +4 -2
  17. package/dist/adapters/integration-kit/src/leak-attempt.js +5 -2
  18. package/dist/adapters/integration-kit/src/limited-http.d.ts +7 -1
  19. package/dist/adapters/integration-kit/src/limited-http.js +53 -10
  20. package/dist/adapters/integration-kit/src/loader.d.ts +29 -2
  21. package/dist/adapters/integration-kit/src/loader.js +44 -12
  22. package/dist/adapters/integration-kit/src/own-request.d.ts +2 -2
  23. package/dist/adapters/integration-kit/src/own-request.js +1 -1
  24. package/dist/adapters/integration-kit/src/plugin-load.d.ts +3 -3
  25. package/dist/adapters/integration-kit/src/plugin-load.js +5 -5
  26. package/dist/adapters/integration-kit/src/policy.d.ts +28 -0
  27. package/dist/adapters/integration-kit/src/response-body.d.ts +6 -2
  28. package/dist/adapters/integration-kit/src/secret-filter.d.ts +3 -3
  29. package/dist/adapters/integration-kit/src/secret-filter.js +19 -4
  30. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +3 -0
  31. package/dist/adapters/integration-kit/src/secret-in-request.js +8 -2
  32. package/dist/adapters/integration-kit/src/secret-placement.d.ts +35 -25
  33. package/dist/adapters/integration-kit/src/secret-placement.js +65 -95
  34. package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
  35. package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
  36. package/dist/core/events/src/blocked-sites.d.ts +57 -0
  37. package/dist/core/events/src/blocked-sites.js +89 -0
  38. package/dist/core/events/src/index.d.ts +5 -1
  39. package/dist/core/events/src/index.js +3 -0
  40. package/dist/core/events/src/run-basics.d.ts +30 -7
  41. package/dist/core/events/src/run-event.d.ts +49 -5
  42. package/dist/core/events/src/run-reads.d.ts +25 -0
  43. package/dist/core/events/src/run-reads.js +44 -0
  44. package/dist/core/events/src/run-sends.d.ts +47 -0
  45. package/dist/core/events/src/run-sends.js +68 -0
  46. package/dist/core/events/src/summarize.js +5 -1
  47. package/dist/core/events/src/timeline-entry.js +1 -0
  48. package/dist/core/format/src/index.d.ts +7 -5
  49. package/dist/core/format/src/index.js +5 -3
  50. package/dist/core/format/src/integration/index.d.ts +3 -2
  51. package/dist/core/format/src/integration/index.js +2 -1
  52. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +15 -5
  53. package/dist/core/format/src/kinds/agent/sandbox-fields.js +29 -10
  54. package/dist/core/format/src/kinds/agent/schema.js +2 -2
  55. package/dist/core/format/src/kinds/connector/is-local.js +1 -1
  56. package/dist/core/format/src/kinds/connector/kind.js +99 -0
  57. package/dist/core/format/src/kinds/connector/schema.d.ts +24 -0
  58. package/dist/core/format/src/kinds/connector/schema.js +53 -2
  59. package/dist/core/format/src/kinds/deployments/kind.js +25 -1
  60. package/dist/core/format/src/kinds/deployments/schema.d.ts +40 -0
  61. package/dist/core/format/src/kinds/deployments/schema.js +52 -0
  62. package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
  63. package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
  64. package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
  65. package/dist/core/format/src/kinds/integration/host-key.js +8 -0
  66. package/dist/core/format/src/kinds/integration/kind.d.ts +4 -2
  67. package/dist/core/format/src/kinds/integration/kind.js +49 -12
  68. package/dist/core/format/src/kinds/integration/policy.d.ts +47 -2
  69. package/dist/core/format/src/kinds/integration/policy.js +61 -2
  70. package/dist/core/format/src/kinds/integration/schema.d.ts +180 -3
  71. package/dist/core/format/src/kinds/integration/schema.js +132 -6
  72. package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +13 -0
  73. package/dist/core/format/src/kinds/integration/sign-in-checks.js +120 -0
  74. package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
  75. package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
  76. package/dist/core/format/src/kinds/plugin/checks.js +7 -1
  77. package/dist/core/format/src/kinds/plugin/schema.d.ts +130 -0
  78. package/dist/core/format/src/kinds/plugin/schema.js +2 -2
  79. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +1 -1
  80. package/dist/core/format/src/kinds/plugin/ui-checks.js +1 -10
  81. package/dist/core/format/src/kinds/routine/kind.js +38 -1
  82. package/dist/core/format/src/kinds/routine/schema.d.ts +10 -0
  83. package/dist/core/format/src/kinds/routine/schema.js +23 -1
  84. package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
  85. package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
  86. package/dist/core/format/src/kinds/workflow/schema.js +1 -1
  87. package/dist/core/format/src/kinds/workspace/kind.js +1 -1
  88. package/dist/core/format/src/kinds/workspace/schema.d.ts +2 -2
  89. package/dist/core/format/src/kinds/workspace/schema.js +1 -1
  90. package/dist/core/format/src/shared/fields.d.ts +3 -6
  91. package/dist/core/format/src/shared/fields.js +33 -13
  92. package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
  93. package/dist/core/ports/src/agent-runs-not-available.js +25 -0
  94. package/dist/core/ports/src/blob-store.d.ts +12 -0
  95. package/dist/core/ports/src/blob-store.js +22 -0
  96. package/dist/core/ports/src/connector-client.d.ts +48 -4
  97. package/dist/core/ports/src/connector-client.js +17 -0
  98. package/dist/core/ports/src/definition-store.d.ts +23 -2
  99. package/dist/core/ports/src/harness-bridge-server.d.ts +12 -3
  100. package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
  101. package/dist/core/ports/src/harness-sign-in-command.js +31 -0
  102. package/dist/core/ports/src/harness.d.ts +46 -13
  103. package/dist/core/ports/src/harness.js +1 -1
  104. package/dist/core/ports/src/host-settings-store.d.ts +116 -0
  105. package/dist/core/ports/src/host-settings-store.js +106 -0
  106. package/dist/core/ports/src/index.d.ts +18 -10
  107. package/dist/core/ports/src/index.js +15 -7
  108. package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
  109. package/dist/core/ports/src/instruction-trust-store.js +43 -0
  110. package/dist/core/ports/src/integration.d.ts +71 -7
  111. package/dist/core/ports/src/integration.js +22 -4
  112. package/dist/core/ports/src/llm-provider.d.ts +3 -1
  113. package/dist/core/ports/src/llm-provider.js +3 -0
  114. package/dist/core/ports/src/password-hasher.d.ts +36 -20
  115. package/dist/core/ports/src/port-versions.d.ts +7 -4
  116. package/dist/core/ports/src/port-versions.js +6 -0
  117. package/dist/core/ports/src/program-probe.d.ts +25 -2
  118. package/dist/core/ports/src/program-probe.js +1 -1
  119. package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
  120. package/dist/core/ports/src/provider-default-base-url.js +18 -0
  121. package/dist/core/ports/src/record-store.d.ts +17 -0
  122. package/dist/core/ports/src/record-store.js +70 -0
  123. package/dist/core/ports/src/run-executor.d.ts +5 -4
  124. package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
  125. package/dist/core/ports/src/run-target-not-found.js +41 -0
  126. package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
  127. package/dist/core/ports/src/sandbox-setting-store.js +33 -0
  128. package/dist/core/ports/src/sandbox.d.ts +130 -13
  129. package/dist/core/ports/src/sandbox.js +38 -2
  130. package/dist/core/ports/src/secrets.d.ts +73 -0
  131. package/dist/core/ports/src/secrets.js +56 -0
  132. package/dist/core/ports/src/tool-approval-store.d.ts +50 -8
  133. package/dist/core/ports/src/tool-approval-store.js +59 -0
  134. package/dist/core/ports/src/vcs-status.d.ts +8 -0
  135. package/dist/core/ports/src/vcs-status.js +90 -0
  136. package/dist/core/std/src/amount.d.ts +13 -0
  137. package/dist/core/std/src/amount.js +22 -0
  138. package/dist/core/std/src/hidden-characters.d.ts +19 -0
  139. package/dist/core/std/src/hidden-characters.js +54 -0
  140. package/dist/core/std/src/index.d.ts +5 -0
  141. package/dist/core/std/src/index.js +5 -0
  142. package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
  143. package/dist/core/std/src/public-suffixes.generated.js +10429 -0
  144. package/dist/core/std/src/registrable-domain.d.ts +10 -0
  145. package/dist/core/std/src/registrable-domain.js +62 -0
  146. package/dist/core/std/src/secret-variable-name.d.ts +12 -0
  147. package/dist/core/std/src/secret-variable-name.js +34 -0
  148. package/dist/core/std/src/site-name.d.ts +35 -0
  149. package/dist/core/std/src/site-name.js +111 -0
  150. package/dist/core/std/src/url-host.d.ts +35 -0
  151. package/dist/core/std/src/url-host.js +170 -0
  152. package/dist/testing/integration/src/load.js +3 -1
  153. package/package.json +2 -2
@@ -65,7 +65,56 @@ declare const Backend: import("zod").ZodObject<{
65
65
  optional: import("zod").ZodDefault<import("zod").ZodBoolean>;
66
66
  as: import("zod").ZodLiteral<"form">;
67
67
  field: import("zod").ZodString;
68
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
69
+ purpose: import("zod").ZodString;
70
+ as: import("zod").ZodOptional<import("zod").ZodLiteral<undefined>>;
68
71
  }, import("zod/v4/core").$strict>], "as">>>;
72
+ signIns: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
73
+ purpose: import("zod").ZodString;
74
+ flow: import("zod").ZodLiteral<"oauth-code">;
75
+ authorizeUrl: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
76
+ fromSetting: import("zod").ZodString;
77
+ path: import("zod").ZodOptional<import("zod").ZodString>;
78
+ }, import("zod/v4/core").$strict>]>;
79
+ tokenUrl: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
80
+ fromSetting: import("zod").ZodString;
81
+ path: import("zod").ZodOptional<import("zod").ZodString>;
82
+ }, import("zod/v4/core").$strict>]>;
83
+ revokeUrl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
84
+ fromSetting: import("zod").ZodString;
85
+ path: import("zod").ZodOptional<import("zod").ZodString>;
86
+ }, import("zod/v4/core").$strict>]>>;
87
+ revokeEndsClientGrants: import("zod").ZodOptional<import("zod").ZodBoolean>;
88
+ issuer: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
89
+ fromSetting: import("zod").ZodString;
90
+ path: import("zod").ZodOptional<import("zod").ZodString>;
91
+ }, import("zod/v4/core").$strict>]>>;
92
+ clientId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
93
+ fromSetting: import("zod").ZodString;
94
+ }, import("zod/v4/core").$strict>]>;
95
+ clientSecret: import("zod").ZodOptional<import("zod").ZodString>;
96
+ clientAuth: import("zod").ZodDefault<import("zod").ZodEnum<{
97
+ basic: "basic";
98
+ post: "post";
99
+ }>>;
100
+ scopes: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
101
+ scope: import("zod").ZodString;
102
+ reason: import("zod").ZodString;
103
+ }, import("zod/v4/core").$strict>>>;
104
+ access: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
105
+ hosts: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
106
+ fromSetting: import("zod").ZodString;
107
+ }, import("zod/v4/core").$strict>]>>;
108
+ as: import("zod").ZodLiteral<"bearer">;
109
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
110
+ hosts: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
111
+ fromSetting: import("zod").ZodString;
112
+ }, import("zod/v4/core").$strict>]>>;
113
+ as: import("zod").ZodLiteral<"header">;
114
+ header: import("zod").ZodString;
115
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
116
+ }, import("zod/v4/core").$strict>], "as">;
117
+ }, import("zod/v4/core").$strict>>>;
69
118
  googleScopes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
70
119
  scope: import("zod").ZodString;
71
120
  reason: import("zod").ZodString;
@@ -96,6 +145,14 @@ declare const Backend: import("zod").ZodObject<{
96
145
  one: import("zod").ZodString;
97
146
  many: import("zod").ZodString;
98
147
  }, import("zod/v4/core").$strict>>;
148
+ verb: import("zod").ZodOptional<import("zod").ZodEnum<{
149
+ created: "created";
150
+ drafted: "drafted";
151
+ moved: "moved";
152
+ saved: "saved";
153
+ sent: "sent";
154
+ updated: "updated";
155
+ }>>;
99
156
  untrusted: import("zod").ZodBoolean;
100
157
  }, import("zod/v4/core").$strict>>>;
101
158
  needs: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodEnum<{
@@ -184,6 +241,14 @@ declare const LocalTool: import("zod").ZodObject<{
184
241
  one: import("zod").ZodString;
185
242
  many: import("zod").ZodString;
186
243
  }, import("zod/v4/core").$strict>>;
244
+ verb: import("zod").ZodOptional<import("zod").ZodEnum<{
245
+ created: "created";
246
+ drafted: "drafted";
247
+ moved: "moved";
248
+ saved: "saved";
249
+ sent: "sent";
250
+ updated: "updated";
251
+ }>>;
187
252
  untrusted: import("zod").ZodBoolean;
188
253
  }, import("zod/v4/core").$strict>>;
189
254
  }, import("zod/v4/core").$strict>;
@@ -327,7 +392,56 @@ export declare const Plugin: import("zod").ZodObject<{
327
392
  optional: import("zod").ZodDefault<import("zod").ZodBoolean>;
328
393
  as: import("zod").ZodLiteral<"form">;
329
394
  field: import("zod").ZodString;
395
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
396
+ purpose: import("zod").ZodString;
397
+ as: import("zod").ZodOptional<import("zod").ZodLiteral<undefined>>;
330
398
  }, import("zod/v4/core").$strict>], "as">>>;
399
+ signIns: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
400
+ purpose: import("zod").ZodString;
401
+ flow: import("zod").ZodLiteral<"oauth-code">;
402
+ authorizeUrl: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
403
+ fromSetting: import("zod").ZodString;
404
+ path: import("zod").ZodOptional<import("zod").ZodString>;
405
+ }, import("zod/v4/core").$strict>]>;
406
+ tokenUrl: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
407
+ fromSetting: import("zod").ZodString;
408
+ path: import("zod").ZodOptional<import("zod").ZodString>;
409
+ }, import("zod/v4/core").$strict>]>;
410
+ revokeUrl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
411
+ fromSetting: import("zod").ZodString;
412
+ path: import("zod").ZodOptional<import("zod").ZodString>;
413
+ }, import("zod/v4/core").$strict>]>>;
414
+ revokeEndsClientGrants: import("zod").ZodOptional<import("zod").ZodBoolean>;
415
+ issuer: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
416
+ fromSetting: import("zod").ZodString;
417
+ path: import("zod").ZodOptional<import("zod").ZodString>;
418
+ }, import("zod/v4/core").$strict>]>>;
419
+ clientId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
420
+ fromSetting: import("zod").ZodString;
421
+ }, import("zod/v4/core").$strict>]>;
422
+ clientSecret: import("zod").ZodOptional<import("zod").ZodString>;
423
+ clientAuth: import("zod").ZodDefault<import("zod").ZodEnum<{
424
+ basic: "basic";
425
+ post: "post";
426
+ }>>;
427
+ scopes: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
428
+ scope: import("zod").ZodString;
429
+ reason: import("zod").ZodString;
430
+ }, import("zod/v4/core").$strict>>>;
431
+ access: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
432
+ hosts: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
433
+ fromSetting: import("zod").ZodString;
434
+ }, import("zod/v4/core").$strict>]>>;
435
+ as: import("zod").ZodLiteral<"bearer">;
436
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
437
+ hosts: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
438
+ fromSetting: import("zod").ZodString;
439
+ }, import("zod/v4/core").$strict>]>>;
440
+ as: import("zod").ZodLiteral<"header">;
441
+ header: import("zod").ZodString;
442
+ prefix: import("zod").ZodOptional<import("zod").ZodString>;
443
+ }, import("zod/v4/core").$strict>], "as">;
444
+ }, import("zod/v4/core").$strict>>>;
331
445
  googleScopes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
332
446
  scope: import("zod").ZodString;
333
447
  reason: import("zod").ZodString;
@@ -358,6 +472,14 @@ export declare const Plugin: import("zod").ZodObject<{
358
472
  one: import("zod").ZodString;
359
473
  many: import("zod").ZodString;
360
474
  }, import("zod/v4/core").$strict>>;
475
+ verb: import("zod").ZodOptional<import("zod").ZodEnum<{
476
+ created: "created";
477
+ drafted: "drafted";
478
+ moved: "moved";
479
+ saved: "saved";
480
+ sent: "sent";
481
+ updated: "updated";
482
+ }>>;
361
483
  untrusted: import("zod").ZodBoolean;
362
484
  }, import("zod/v4/core").$strict>>>;
363
485
  needs: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodEnum<{
@@ -431,6 +553,14 @@ export declare const Plugin: import("zod").ZodObject<{
431
553
  one: import("zod").ZodString;
432
554
  many: import("zod").ZodString;
433
555
  }, import("zod/v4/core").$strict>>;
556
+ verb: import("zod").ZodOptional<import("zod").ZodEnum<{
557
+ created: "created";
558
+ drafted: "drafted";
559
+ moved: "moved";
560
+ saved: "saved";
561
+ sent: "sent";
562
+ updated: "updated";
563
+ }>>;
434
564
  untrusted: import("zod").ZodBoolean;
435
565
  }, import("zod/v4/core").$strict>>;
436
566
  }, import("zod/v4/core").$strict>>>;
@@ -219,7 +219,7 @@ const Command = s
219
219
  show,
220
220
  })
221
221
  .strict();
222
- /** A card in the plugin's panel, filled by one `read` tool call with fixed arguments. */
222
+ /** A card on Home and in the plugin's panel, if it has one, filled by one `read` tool call with fixed arguments. */
223
223
  const Card = s
224
224
  .object({
225
225
  id: name,
@@ -229,7 +229,7 @@ const Card = s
229
229
  show,
230
230
  })
231
231
  .strict();
232
- /** The plugin's one panel window: its cards, then its commands, in manifest order. */
232
+ /** The plugin's one panel, opened in its own tab: its commands, then its cards, in manifest order. */
233
233
  const Panel = s.object({ title: label }).strict();
234
234
  /** What Studio draws for the plugin. It is data only; no plugin code runs in Studio. */
235
235
  const Ui = s
@@ -3,6 +3,6 @@ import type { Plugin } from "./schema.js";
3
3
  /**
4
4
  * The problems in a plugin's `ui`: an id twice, a secret field for a secret
5
5
  * no part declares, a choice default that isn't a choice, a command or card
6
- * whose tool isn't a declared `read` tool, and cards without a panel.
6
+ * whose tool isn't a declared `read` tool.
7
7
  */
8
8
  export declare function uiProblems(plugin: Plugin): KindCheckProblem[];
@@ -7,7 +7,7 @@ const riskVerbs = {
7
7
  /**
8
8
  * The problems in a plugin's `ui`: an id twice, a secret field for a secret
9
9
  * no part declares, a choice default that isn't a choice, a command or card
10
- * whose tool isn't a declared `read` tool, and cards without a panel.
10
+ * whose tool isn't a declared `read` tool.
11
11
  */
12
12
  export function uiProblems(plugin) {
13
13
  const ui = plugin.ui;
@@ -19,7 +19,6 @@ export function uiProblems(plugin) {
19
19
  ...duplicates(plugin, ui.cards.map((card) => card.id), (index) => ["ui", "cards", index, "id"], "card"),
20
20
  ...fieldProblems(plugin, ui),
21
21
  ...toolProblems(plugin, ui),
22
- ...panelProblems(plugin, ui),
23
22
  ];
24
23
  }
25
24
  /** A secret field names a secret the backend or a local tool declares; a choice default is a choice. */
@@ -84,11 +83,3 @@ function toolProblems(plugin, ui) {
84
83
  }
85
84
  return problems;
86
85
  }
87
- /** Cards show only in the plugin's panel, so a plugin with cards has one. */
88
- function panelProblems(plugin, ui) {
89
- if (ui.cards.length === 0 || ui.panel !== undefined) {
90
- return [];
91
- }
92
- const message = "cards show only in the plugin's panel; add ui.panel with a title";
93
- return [problem(plugin, "cards-need-panel", ["ui", "cards"], message)];
94
- }
@@ -1,5 +1,7 @@
1
1
  import { isMap, renameKey } from "../../shared/legacy-keys.js";
2
+ import { checkSecretName } from "../../shared/secret-name.js";
2
3
  import { Routine } from "./schema.js";
4
+ import { WEBHOOK_REFUSED_HEADERS } from "./webhook-headers.js";
3
5
  /**
4
6
  * `workflows/routines/<id>.routine.yaml`, at the root or in a hub. Checking
5
7
  * the cron text and time zone is `@halonicjs/routines`' job, which sits
@@ -7,13 +9,48 @@ import { Routine } from "./schema.js";
7
9
  */
8
10
  export const routineKind = {
9
11
  name: "routine",
10
- about: "When a workflow or an agent runs on its own: a schedule, an interval, a signal or mail.",
12
+ about: "When a workflow or an agent runs on its own: a schedule, an interval, a signal, mail or a webhook.",
11
13
  syntax: "yaml",
12
14
  schema: Routine,
13
15
  places: [{ scope: "workspace-and-hub", folder: "workflows/routines", name: "<id>.routine.yaml" }],
14
16
  idFromPlace: "fallback",
15
17
  upgradeKeys: upgradeRoutineKeys,
18
+ check: checkRoutine,
16
19
  };
20
+ /**
21
+ * A webhook's secret is named in the file, so a bad name or a pasted key is
22
+ * caught here, and so is a header the run must not read.
23
+ */
24
+ function checkRoutine(routine) {
25
+ const { trigger } = routine;
26
+ if (!("webhook" in trigger)) {
27
+ return [];
28
+ }
29
+ const problem = checkSecretName(trigger.webhook.secret, ["trigger", "webhook", "secret"]);
30
+ const problems = problem === undefined ? [] : [problem];
31
+ const seen = new Set();
32
+ trigger.webhook.headers.forEach((header, index) => {
33
+ const path = ["trigger", "webhook", "headers", index];
34
+ if (WEBHOOK_REFUSED_HEADERS.includes(header)) {
35
+ problems.push({
36
+ severity: "error",
37
+ code: "webhook-header-refused",
38
+ path,
39
+ message: `A run can't read the "${header}" header: it carries a credential or is used to verify the request. Remove it.`,
40
+ });
41
+ }
42
+ else if (seen.has(header)) {
43
+ problems.push({
44
+ severity: "error",
45
+ code: "webhook-header-duplicate",
46
+ path,
47
+ message: `The "${header}" header is listed twice. List each header once.`,
48
+ });
49
+ }
50
+ seen.add(header);
51
+ });
52
+ return problems;
53
+ }
17
54
  /** Workflows were called flows and hubs projects: `run.flow` and `run.project` still load. */
18
55
  function upgradeRoutineKeys(data) {
19
56
  const run = data["run"];
@@ -19,6 +19,11 @@ export declare const RoutineTrigger: import("zod").ZodUnion<readonly [import("zo
19
19
  query: import("zod").ZodDefault<import("zod").ZodString>;
20
20
  every: import("zod").ZodDefault<import("zod").ZodString>;
21
21
  }, import("zod/v4/core").$strict>;
22
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
23
+ webhook: import("zod").ZodObject<{
24
+ secret: import("zod").ZodString;
25
+ headers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
26
+ }, import("zod/v4/core").$strict>;
22
27
  }, import("zod/v4/core").$strict>]>;
23
28
  /** What a routine runs: a workflow with input, or one agent with a prompt. */
24
29
  export declare const RoutineTarget: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
@@ -55,6 +60,11 @@ export declare const Routine: import("zod").ZodObject<{
55
60
  query: import("zod").ZodDefault<import("zod").ZodString>;
56
61
  every: import("zod").ZodDefault<import("zod").ZodString>;
57
62
  }, import("zod/v4/core").$strict>;
63
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
64
+ webhook: import("zod").ZodObject<{
65
+ secret: import("zod").ZodString;
66
+ headers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
67
+ }, import("zod/v4/core").$strict>;
58
68
  }, import("zod/v4/core").$strict>]>;
59
69
  run: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
60
70
  hub: import("zod").ZodOptional<import("zod").ZodString>;
@@ -1,6 +1,7 @@
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";
4
5
  /** On a schedule: five-field cron or a shortcut such as @daily, in a time zone. */
5
6
  const ScheduleTrigger = s
6
7
  .object({
@@ -47,6 +48,26 @@ const MailTrigger = s
47
48
  .strict(),
48
49
  })
49
50
  .strict();
51
+ /**
52
+ * A request from outside, signed with a secret. The host gives each routine its
53
+ * own address; this file names only the secret and the headers the run may read.
54
+ */
55
+ const WebhookTrigger = s
56
+ .object({
57
+ webhook: s
58
+ .object({
59
+ /** The name of the secret that signs the request body; the file never holds its value. */
60
+ secret: s.string().min(1),
61
+ /** Lowercase request headers the run may read as {{trigger.headers.<name>}}; none by default. */
62
+ headers: s
63
+ .array(s
64
+ .string()
65
+ .regex(WEBHOOK_HEADER_PATTERN, "use a lowercase header name: letters, digits or '-', such as x-event"))
66
+ .default([]),
67
+ })
68
+ .strict(),
69
+ })
70
+ .strict();
50
71
  /** When a routine starts. */
51
72
  export const RoutineTrigger = s.union([
52
73
  ScheduleTrigger,
@@ -54,6 +75,7 @@ export const RoutineTrigger = s.union([
54
75
  ManualTrigger,
55
76
  SignalTrigger,
56
77
  MailTrigger,
78
+ WebhookTrigger,
57
79
  ]);
58
80
  /** What a routine runs: a workflow with input, or one agent with a prompt. */
59
81
  export const RoutineTarget = s.union([
@@ -62,7 +84,7 @@ export const RoutineTarget = s.union([
62
84
  /** The workflow's hub. Required for workspace-level routines. */
63
85
  hub: id.optional(),
64
86
  workflow: id,
65
- /** Workflow input; text may use {{trigger.at}}, {{trigger.lastRun}} and {{trigger.message}}. */
87
+ /** Workflow input; text may use {{trigger.at}}, {{trigger.lastRun}}, {{trigger.message}} and, for a webhook, {{trigger.body}} and {{trigger.headers.<name>}}. */
66
88
  input: s.record(s.string(), s.unknown()).default({}),
67
89
  })
68
90
  .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
  */
@@ -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`,
@@ -9,22 +9,42 @@ export const id = s
9
9
  .min(1)
10
10
  .regex(/^[a-z0-9][a-z0-9-_]*$/, "use lowercase letters, digits, '-' or '_'");
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`,
@@ -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
+ }