@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
@@ -7,8 +7,9 @@ import { uiProblems } from "./ui-checks.js";
7
7
  * The rules over several fields of a plugin: it has a backend or local
8
8
  * tools, its id and secret names aren't too long, its backend passes the
9
9
  * integration sheet's checks and starts no program, no id is used twice, no tool or secret name is in two parts, a
10
- * local tool's environment names its own secrets and the plugin's settings,
11
- * and its `ui` names what the plugin declares.
10
+ * local tool's environment names its own secrets and the plugin's settings
11
+ * and sets none of the variables Halonic sets itself, and its `ui` names
12
+ * what the plugin declares.
12
13
  *
13
14
  * @example
14
15
  * checkPlugin(plugin); // [] for the weather plugin in the ADR
@@ -53,7 +54,9 @@ function lengthProblems(plugin) {
53
54
  /**
54
55
  * The backend's own sheet checks, with their paths moved under `backend`.
55
56
  * A backend may not start a program: that is what local tools are for, and
56
- * only they run in the sandbox.
57
+ * only they run in the sandbox. It may not declare `signIns` yet either:
58
+ * the trust check and the trust content don't show a sign-in, so the user
59
+ * couldn't approve one.
57
60
  */
58
61
  function backendProblems(plugin) {
59
62
  const sheet = backendSheet(plugin);
@@ -64,6 +67,10 @@ function backendProblems(plugin) {
64
67
  ...found,
65
68
  path: ["backend", ...found.path],
66
69
  }));
70
+ for (const name of Object.keys(sheet.signIns)) {
71
+ const message = `a backend can't declare the sign-in ${name} yet: the trust check doesn't show sign-ins`;
72
+ problems.push(problem(plugin, "backend-sign-in", ["backend", "signIns", name], message));
73
+ }
67
74
  sheet.needs.forEach((need, index) => {
68
75
  if (need === "process") {
69
76
  const message = "a backend can't start a program; declare it under localTools instead";
@@ -81,15 +88,26 @@ function localToolProblems(plugin) {
81
88
  return problems;
82
89
  }
83
90
  /**
84
- * An `env` value names one of this local tool's own secrets, never another
85
- * part's, so a secret reaches only the program it was declared for. A
86
- * setting it names exists and isn't a `secret` field: secrets go by `secret`.
91
+ * The variables Halonic sets itself for every local tool: its `PATH`, and
92
+ * its home and temp folders inside the session.
93
+ */
94
+ const halonicVariables = new Set(["HOME", "PATH", "TMPDIR", "TEMP", "TMP"]);
95
+ /**
96
+ * An `env` variable isn't one Halonic sets itself. Its value names one of
97
+ * this local tool's own secrets, never another part's, so a secret reaches
98
+ * only the program it was declared for. A setting it names exists and isn't
99
+ * a `secret` field: secrets go by `secret`.
87
100
  */
88
101
  function envProblems(plugin, localTool, index) {
89
102
  const settings = plugin.ui?.settings ?? {};
90
103
  const problems = [];
91
104
  for (const [variable, value] of Object.entries(localTool.env)) {
92
105
  const path = ["localTools", index, "env", variable];
106
+ if (halonicVariables.has(variable)) {
107
+ const message = `${variable} is set by Halonic for every local tool; use another name`;
108
+ problems.push(problem(plugin, "env-reserved", path, message));
109
+ continue;
110
+ }
93
111
  if ("secret" in value) {
94
112
  if (!Object.hasOwn(localTool.secrets, value.secret)) {
95
113
  const message = `${variable} takes the secret ${value.secret}, which local tool "${localTool.id}" doesn't declare in its secrets`;
@@ -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>>>;
@@ -18,8 +18,23 @@ export const ARGUMENT_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*$/;
18
18
  const argumentName = s
19
19
  .string()
20
20
  .regex(ARGUMENT_NAME_PATTERN, "use the tool argument's name, such as 'city' or 'folderId'");
21
+ /**
22
+ * A control character, or a mark that turns the direction of the text around it.
23
+ * In text a person reads, either can make one name look like another, in the
24
+ * Plugins list and in the trust dialog. A line break is the one exception, and
25
+ * only in longer text.
26
+ */
27
+ const HIDDEN_MARK = /[\p{Cc}\p{Bidi_Control}]/u;
28
+ const HIDDEN_MARK_BUT_LINE_BREAK = /(?!\n)[\p{Cc}\p{Bidi_Control}]/u;
29
+ const NO_HIDDEN_MARKS = "don't use control characters or text-direction marks";
30
+ /** Whether a description or help text has no hidden mark. It may break lines. */
31
+ const withoutHiddenMarks = (text) => !HIDDEN_MARK_BUT_LINE_BREAK.test(text);
21
32
  /** Text a person reads: a title or a label. Studio shows it as untrusted text. */
22
- const label = s.string().min(1).max(80);
33
+ const label = s
34
+ .string()
35
+ .min(1)
36
+ .max(80)
37
+ .refine((text) => !HIDDEN_MARK.test(text), NO_HIDDEN_MARKS);
23
38
  /**
24
39
  * Why a local tool's `network` entry can't be used, or `null` when it can.
25
40
  * The list is the sandbox's allow-list for code Halonic doesn't trust, so it
@@ -179,7 +194,7 @@ const LocalTool = s
179
194
  /** What every field says, whatever its type. */
180
195
  const fieldBase = {
181
196
  label,
182
- help: s.string().min(1).max(500).optional(),
197
+ help: s.string().min(1).max(500).refine(withoutHiddenMarks, NO_HIDDEN_MARKS).optional(),
183
198
  required: s.boolean().default(false),
184
199
  };
185
200
  /** The field types a setting and a command's form share. */
@@ -192,7 +207,12 @@ const inputFields = [
192
207
  .object({
193
208
  ...fieldBase,
194
209
  type: s.literal("choice"),
195
- choices: s.array(s.string().min(1)).min(1),
210
+ choices: s
211
+ .array(s
212
+ .string()
213
+ .min(1)
214
+ .refine((text) => !HIDDEN_MARK.test(text), NO_HIDDEN_MARKS))
215
+ .min(1),
196
216
  default: s.string().optional(),
197
217
  })
198
218
  .strict(),
@@ -219,7 +239,7 @@ const Command = s
219
239
  show,
220
240
  })
221
241
  .strict();
222
- /** A card in the plugin's panel, filled by one `read` tool call with fixed arguments. */
242
+ /** A card on Home and in the plugin's panel, if it has one, filled by one `read` tool call with fixed arguments. */
223
243
  const Card = s
224
244
  .object({
225
245
  id: name,
@@ -229,7 +249,7 @@ const Card = s
229
249
  show,
230
250
  })
231
251
  .strict();
232
- /** The plugin's one panel window: its cards, then its commands, in manifest order. */
252
+ /** The plugin's one panel, opened in its own tab: its commands, then its cards, in manifest order. */
233
253
  const Panel = s.object({ title: label }).strict();
234
254
  /** What Studio draws for the plugin. It is data only; no plugin code runs in Studio. */
235
255
  const Ui = s
@@ -253,7 +273,7 @@ export const Plugin = s
253
273
  sdk: IntegrationSheet.shape.kit,
254
274
  name: label,
255
275
  /** Empty for an `integration.yaml` read as a plugin, which has no description. */
256
- description: s.string().max(500).default(""),
276
+ description: s.string().max(500).refine(withoutHiddenMarks, NO_HIDDEN_MARKS).default(""),
257
277
  backend: Backend.optional(),
258
278
  localTools: s.array(LocalTool).min(1).optional(),
259
279
  ui: Ui.optional(),
@@ -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,6 +1,7 @@
1
1
  import { checkKeysIn } from "../../shared/key-in-value.js";
2
2
  import { checkSecretName } from "../../shared/secret-name.js";
3
3
  import { Provider } from "./schema.js";
4
+ import { isProviderType, providerTypesInWords } from "./types.js";
4
5
  /** `providers/<id>.yaml` at the workspace root. */
5
6
  export const providerKind = {
6
7
  name: "provider",
@@ -13,12 +14,50 @@ export const providerKind = {
13
14
  };
14
15
  /**
15
16
  * The secret is named in the file, so a bad name or a pasted key is caught
16
- * here, not at run time. A key pasted into `options` is caught too.
17
+ * here, not at run time. A key pasted into `options` is caught too, and so
18
+ * is a type Halonic can't call, or a `baseUrl` it can't reach, which would
19
+ * only fail once a run reached the model (HAL-14260).
17
20
  */
18
21
  function checkProvider(provider) {
19
22
  const problem = provider.secret === undefined ? undefined : checkSecretName(provider.secret, ["secret"]);
20
23
  return [
24
+ ...checkType(provider),
25
+ ...checkBaseUrl(provider),
21
26
  ...(problem === undefined ? [] : [problem]),
22
27
  ...checkKeysIn(provider.options, ["options"], "provider-option"),
23
28
  ];
24
29
  }
30
+ /**
31
+ * `provider-type` on the `type:` line, worded like the run's fix:
32
+ * "Halonic can't call provider type antropic: set type in
33
+ * providers/mock.yaml to one of anthropic, … or mock".
34
+ */
35
+ function checkType(provider) {
36
+ if (isProviderType(provider.type))
37
+ return [];
38
+ return [
39
+ {
40
+ severity: "error",
41
+ code: "provider-type",
42
+ path: ["type"],
43
+ message: `Halonic can't call provider type ${provider.type}: set type in providers/${provider.id}.yaml to one of ${providerTypesInWords}`,
44
+ },
45
+ ];
46
+ }
47
+ /**
48
+ * `provider-base-url` on the `baseUrl:` line when it doesn't start with
49
+ * http:// or https://. `localhost:11434` passes as a URL, but its scheme is
50
+ * "localhost:", so the run would try to reach an empty address.
51
+ */
52
+ function checkBaseUrl(provider) {
53
+ if (provider.baseUrl === undefined || /^https?:\/\//iu.test(provider.baseUrl))
54
+ return [];
55
+ return [
56
+ {
57
+ severity: "error",
58
+ code: "provider-base-url",
59
+ path: ["baseUrl"],
60
+ message: "baseUrl needs http:// or https://, such as http://localhost:11434",
61
+ },
62
+ ];
63
+ }
@@ -0,0 +1,19 @@
1
+ /** The types that speak OpenAI's chat completions API. */
2
+ export declare const openAiCompatibleTypes: readonly ["openai", "openai-compatible", "ollama", "lmstudio"];
3
+ /** Every type Halonic can call, in the order a fix lists them. */
4
+ export declare const providerTypes: readonly ["anthropic", "openai", "openai-compatible", "ollama", "lmstudio", "mock"];
5
+ /** One of {@link providerTypes}. */
6
+ export type ProviderType = (typeof providerTypes)[number];
7
+ /**
8
+ * The types as a fix lists them: "anthropic, openai, openai-compatible,
9
+ * ollama, lmstudio or mock".
10
+ */
11
+ export declare const providerTypesInWords: string;
12
+ /**
13
+ * Whether Halonic can call a provider of this type.
14
+ *
15
+ * @example
16
+ * isProviderType("anthropic"); // true
17
+ * isProviderType("antropic"); // false
18
+ */
19
+ export declare function isProviderType(type: string): type is ProviderType;
@@ -0,0 +1,22 @@
1
+ // The provider types a workspace's provider file can name. The run builds a
2
+ // provider for each of them, and `halonic validate` refuses any other, so
3
+ // both read this one list and can't drift apart (HAL-14260).
4
+ /** The types that speak OpenAI's chat completions API. */
5
+ export const openAiCompatibleTypes = ["openai", "openai-compatible", "ollama", "lmstudio"];
6
+ /** Every type Halonic can call, in the order a fix lists them. */
7
+ export const providerTypes = ["anthropic", ...openAiCompatibleTypes, "mock"];
8
+ /**
9
+ * The types as a fix lists them: "anthropic, openai, openai-compatible,
10
+ * ollama, lmstudio or mock".
11
+ */
12
+ export const providerTypesInWords = `${providerTypes.slice(0, -1).join(", ")} or ${providerTypes.at(-1)}`;
13
+ /**
14
+ * Whether Halonic can call a provider of this type.
15
+ *
16
+ * @example
17
+ * isProviderType("anthropic"); // true
18
+ * isProviderType("antropic"); // false
19
+ */
20
+ export function isProviderType(type) {
21
+ return providerTypes.includes(type);
22
+ }
@@ -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"];
@@ -1,11 +1,16 @@
1
1
  import { type Infer } from "../../../../schema-kit/src/index.js";
2
2
  import { Guard } from "../../shared/guard.js";
3
- /** When a routine starts. */
3
+ /**
4
+ * When a routine starts. A trigger that matches none of the kinds, such as
5
+ * two at once or `manual: false`, gets one message that names them all
6
+ * (HAL-14299), instead of Zod's "Invalid input". A mistake inside one kind,
7
+ * such as `every: 15`, still gets that kind's own message.
8
+ */
4
9
  export declare const RoutineTrigger: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
5
10
  schedule: import("zod").ZodString;
6
11
  timezone: import("zod").ZodOptional<import("zod").ZodString>;
7
12
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
8
- every: import("zod").ZodString;
13
+ every: import("zod").ZodPreprocess<import("zod").ZodString, unknown>;
9
14
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
10
15
  manual: import("zod").ZodLiteral<true>;
11
16
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
@@ -17,7 +22,12 @@ export declare const RoutineTrigger: import("zod").ZodUnion<readonly [import("zo
17
22
  mail: import("zod").ZodObject<{
18
23
  connector: import("zod").ZodString;
19
24
  query: import("zod").ZodDefault<import("zod").ZodString>;
20
- every: import("zod").ZodDefault<import("zod").ZodString>;
25
+ every: import("zod").ZodPreprocess<import("zod").ZodDefault<import("zod").ZodString>, unknown>;
26
+ }, import("zod/v4/core").$strict>;
27
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
28
+ webhook: import("zod").ZodObject<{
29
+ secret: import("zod").ZodString;
30
+ headers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
21
31
  }, import("zod/v4/core").$strict>;
22
32
  }, import("zod/v4/core").$strict>]>;
23
33
  /** What a routine runs: a workflow with input, or one agent with a prompt. */
@@ -41,7 +51,7 @@ export declare const Routine: import("zod").ZodObject<{
41
51
  schedule: import("zod").ZodString;
42
52
  timezone: import("zod").ZodOptional<import("zod").ZodString>;
43
53
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
44
- every: import("zod").ZodString;
54
+ every: import("zod").ZodPreprocess<import("zod").ZodString, unknown>;
45
55
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
46
56
  manual: import("zod").ZodLiteral<true>;
47
57
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
@@ -53,7 +63,12 @@ export declare const Routine: import("zod").ZodObject<{
53
63
  mail: import("zod").ZodObject<{
54
64
  connector: import("zod").ZodString;
55
65
  query: import("zod").ZodDefault<import("zod").ZodString>;
56
- every: import("zod").ZodDefault<import("zod").ZodString>;
66
+ every: import("zod").ZodPreprocess<import("zod").ZodDefault<import("zod").ZodString>, unknown>;
67
+ }, import("zod/v4/core").$strict>;
68
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
69
+ webhook: import("zod").ZodObject<{
70
+ secret: import("zod").ZodString;
71
+ headers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
57
72
  }, import("zod/v4/core").$strict>;
58
73
  }, import("zod/v4/core").$strict>]>;
59
74
  run: import("zod").ZodUnion<readonly [import("zod").ZodObject<{