@akai-workflow-builder/cli-sdk 0.9.0 → 0.10.0

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to `@akai-workflow-builder/cli-sdk` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.10.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.9.0...cli-sdk-v0.10.0) (2026-09-16)
8
+
9
+
10
+ ### Features
11
+
12
+ * resolve dynamic egress to a multi-host allowlist ([2eab9f1](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/2eab9f1b5cdb4fce6d4c4a37a3f4c0bdc835a896))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * share multi-host egress resolution with the executor path ([b32568a](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/b32568a5b424e469385a23370f5c97f75c0383e1))
18
+
7
19
  ## [0.9.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.8.0...cli-sdk-v0.9.0) (2026-09-10)
8
20
 
9
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"build-ctx.d.ts","sourceRoot":"","sources":["../../src/ctx/build-ctx.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAc,MAAM,EAAiB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI1F;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6GAA6G;IAC7G,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,sGAAsG;IACtG,QAAQ,CAAC,cAAc,CAAC,EAAE,cA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AAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,8CAA8C;IAC9C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AA6ED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAqExD"}
@@ -6,7 +6,7 @@ import { createReadFile } from './read-file.js';
6
6
  import { createReadFileStream } from './read-file-stream.js';
7
7
  import { createWriteFile, unavailableWriteFile } from './write-file.js';
8
8
  import { AkaiSecretError } from '../errors.js';
9
- import { resolveDynamicEgressHost } from './dynamic-egress.js';
9
+ import { resolveDynamicEgressHosts } from './dynamic-egress.js';
10
10
  function resolveTool(cli, toolName) {
11
11
  const t = cli.tools[toolName];
12
12
  if (!t) {
@@ -18,12 +18,13 @@ function toEgressList(egress, cliId, toolName, secrets, properties) {
18
18
  if (Array.isArray(egress))
19
19
  return egress;
20
20
  // Dynamic egress (`{ from: 'secret:KEY' | 'property:KEY' }`) — resolve the bound
21
- // secret/property to its host here, from the same scoped values this ctx was
21
+ // secret/property to its host(s) here, from the same scoped values this ctx was
22
22
  // built with, so the step-fetcher path (which calls buildCtx directly) reaches
23
- // the same host the executor derives. Throws AkaiSpecError on an unsupported
24
- // prefix, AkaiSecretError/AkaiPropertyError when the binding is unset or not a
25
- // valid host — fail closed, never a bare egress.
26
- return [resolveDynamicEgressHost(egress, secrets, properties, cliId, toolName)];
23
+ // the same hosts the executor derives. The value may be a single host or a
24
+ // comma/newline allowlist. Throws AkaiSpecError on an unsupported prefix,
25
+ // AkaiSecretError/AkaiPropertyError when the binding is unset or not a valid
26
+ // host — fail closed, never a bare egress.
27
+ return resolveDynamicEgressHosts(egress, secrets, properties, cliId, toolName);
27
28
  }
28
29
  /**
29
30
  * Resolve a tool's `network.clientCert` secret-key references to PEM values
@@ -1,18 +1,43 @@
1
1
  import type { DynamicEgress } from '../types.js';
2
2
  /**
3
3
  * Resolve a tool's dynamic egress (`{ from: 'secret:KEY' | 'property:KEY' }`) to
4
- * the single static host it points at, reading `KEY` from the tool-scoped secret
4
+ * the set of static hosts it points at, reading `KEY` from the tool-scoped secret
5
5
  * or property record. Connectors whose upstream host is per-connection (each
6
6
  * customer's payroll system lives at its own URL — sunfish, kontek, primavera, …)
7
7
  * declare egress this way instead of a static list.
8
8
  *
9
+ * The bound value may name a SINGLE host (`api.stripe.com`, or an absolute URL) or
10
+ * an ALLOWLIST of several, separated by commas or newlines (`a.com, b.com`). Each
11
+ * entry is resolved to its hostname and the whole set becomes the egress allowlist,
12
+ * so an owner can let one connection reach several hosts it configured — while
13
+ * safe-fetch still blocks every host that is not on the list. Every entry must be a
14
+ * valid host/URL: one bad entry fails the whole binding closed, never a partial or
15
+ * bare egress.
16
+ *
9
17
  * Mirrors the host runtime executor's own resolution so `buildCtx` (the
10
- * step-fetcher path) and `executeTool` agree on the derived host. Throws a typed
18
+ * step-fetcher path) and `executeTool` agree on the derived hosts. Throws a typed
11
19
  * error the caller maps to its own failure shape:
12
20
  * - `AkaiSecretError` — a `secret:` binding that is unset or not a host/URL,
13
21
  * - `AkaiPropertyError` — the same for a `property:` binding,
14
22
  * - `AkaiSpecError` — an unsupported `from` prefix (should be caught earlier by
15
23
  * `defineCLI`/manifest validation; guarded here for hand-built CLIDefs).
16
24
  */
17
- export declare function resolveDynamicEgressHost(egress: DynamicEgress, secrets: Readonly<Record<string, string | undefined>>, properties: Readonly<Record<string, string | undefined>>, cliId: string, toolName: string): string;
25
+ export declare function resolveDynamicEgressHosts(egress: DynamicEgress, secrets: Readonly<Record<string, string | undefined>>, properties: Readonly<Record<string, string | undefined>>, cliId: string, toolName: string): string[];
26
+ /**
27
+ * Split a dynamic-egress value into its entries on commas/newlines (NOT spaces —
28
+ * a lone space stays part of an invalid host like "not a host"), trimming each and
29
+ * dropping blanks. A single value ("api.stripe.com") yields one entry; an allowlist
30
+ * ("a.com, b.com") yields several. Shared with the executor's egress resolver so
31
+ * `buildCtx` and `executeTool` split identically.
32
+ */
33
+ export declare function splitEgressEntries(raw: string): string[];
34
+ /**
35
+ * Derive the hostname from a dynamic-egress value: an absolute URL yields its
36
+ * hostname; a bare `host[:port]` (e.g. sunfish's `SUNFISH_HOST`) parses as a bogus
37
+ * scheme with an empty hostname, so it is retried under an `https://` prefix and
38
+ * accepted only as a clean bare authority (no credentials/path/query/fragment).
39
+ * Returns `undefined` when the value is neither — the caller fails closed.
40
+ * Exported so the executor's egress resolver derives hosts identically.
41
+ */
42
+ export declare function hostFromValue(raw: string): string | undefined;
18
43
  //# sourceMappingURL=dynamic-egress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-egress.d.ts","sourceRoot":"","sources":["../../src/ctx/dynamic-egress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,MAAM,CA+BR"}
1
+ {"version":3,"file":"dynamic-egress.d.ts","sourceRoot":"","sources":["../../src/ctx/dynamic-egress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,CAiBV;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxD;AAsCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB7D"}
@@ -2,20 +2,62 @@ import { DYNAMIC_EGRESS_PREFIXES } from '../tool.js';
2
2
  import { AkaiPropertyError, AkaiSecretError, AkaiSpecError } from '../errors.js';
3
3
  /**
4
4
  * Resolve a tool's dynamic egress (`{ from: 'secret:KEY' | 'property:KEY' }`) to
5
- * the single static host it points at, reading `KEY` from the tool-scoped secret
5
+ * the set of static hosts it points at, reading `KEY` from the tool-scoped secret
6
6
  * or property record. Connectors whose upstream host is per-connection (each
7
7
  * customer's payroll system lives at its own URL — sunfish, kontek, primavera, …)
8
8
  * declare egress this way instead of a static list.
9
9
  *
10
+ * The bound value may name a SINGLE host (`api.stripe.com`, or an absolute URL) or
11
+ * an ALLOWLIST of several, separated by commas or newlines (`a.com, b.com`). Each
12
+ * entry is resolved to its hostname and the whole set becomes the egress allowlist,
13
+ * so an owner can let one connection reach several hosts it configured — while
14
+ * safe-fetch still blocks every host that is not on the list. Every entry must be a
15
+ * valid host/URL: one bad entry fails the whole binding closed, never a partial or
16
+ * bare egress.
17
+ *
10
18
  * Mirrors the host runtime executor's own resolution so `buildCtx` (the
11
- * step-fetcher path) and `executeTool` agree on the derived host. Throws a typed
19
+ * step-fetcher path) and `executeTool` agree on the derived hosts. Throws a typed
12
20
  * error the caller maps to its own failure shape:
13
21
  * - `AkaiSecretError` — a `secret:` binding that is unset or not a host/URL,
14
22
  * - `AkaiPropertyError` — the same for a `property:` binding,
15
23
  * - `AkaiSpecError` — an unsupported `from` prefix (should be caught earlier by
16
24
  * `defineCLI`/manifest validation; guarded here for hand-built CLIDefs).
17
25
  */
18
- export function resolveDynamicEgressHost(egress, secrets, properties, cliId, toolName) {
26
+ export function resolveDynamicEgressHosts(egress, secrets, properties, cliId, toolName) {
27
+ const { key, isSecret, raw } = resolveBinding(egress, secrets, properties, cliId, toolName);
28
+ const entries = splitEgressEntries(raw);
29
+ if (entries.length === 0)
30
+ throw unsetError(isSecret, key);
31
+ const hosts = [];
32
+ for (const entry of entries) {
33
+ const host = hostFromValue(entry);
34
+ if (host === undefined) {
35
+ // Never put the raw entry in `meta`: for a secret binding the executor
36
+ // forwards it in the failure envelope, which would leak the secret value.
37
+ throw isSecret
38
+ ? new AkaiSecretError(`secret \`${key}\` must be a hostname or absolute URL`, { key })
39
+ : new AkaiPropertyError(`property \`${key}\` must be a hostname or absolute URL`, { key });
40
+ }
41
+ if (!hosts.includes(host))
42
+ hosts.push(host);
43
+ }
44
+ return hosts;
45
+ }
46
+ /**
47
+ * Split a dynamic-egress value into its entries on commas/newlines (NOT spaces —
48
+ * a lone space stays part of an invalid host like "not a host"), trimming each and
49
+ * dropping blanks. A single value ("api.stripe.com") yields one entry; an allowlist
50
+ * ("a.com, b.com") yields several. Shared with the executor's egress resolver so
51
+ * `buildCtx` and `executeTool` split identically.
52
+ */
53
+ export function splitEgressEntries(raw) {
54
+ return raw
55
+ .split(/[,\n]+/)
56
+ .map((e) => e.trim())
57
+ .filter((e) => e !== '');
58
+ }
59
+ /** Strip the `secret:`/`property:` prefix and read the bound, trimmed value. */
60
+ function resolveBinding(egress, secrets, properties, cliId, toolName) {
19
61
  const from = egress.from;
20
62
  // Match the SDK's prefix set and strip it by LENGTH — do NOT split on ':', the
21
63
  // value is a URL whose host:port also contains colons.
@@ -26,18 +68,14 @@ export function resolveDynamicEgressHost(egress, secrets, properties, cliId, too
26
68
  const key = from.slice(prefix.length);
27
69
  const isSecret = prefix === 'secret:';
28
70
  const raw = (isSecret ? secrets[key] : properties[key])?.trim();
29
- if (raw === undefined || raw === '') {
30
- throw isSecret
31
- ? new AkaiSecretError(`tool \`${cliId}.${toolName}\` egress is bound to secret \`${key}\` but it is unset; set the '${key}' secret on the connection`, { key })
32
- : new AkaiPropertyError(`tool \`${cliId}.${toolName}\` egress is bound to property \`${key}\` but it is unset; set the connection's base URL`, { key });
33
- }
34
- const host = hostFromValue(raw);
35
- if (host === undefined) {
36
- throw isSecret
37
- ? new AkaiSecretError(`secret \`${key}\` must be a hostname or absolute URL`, { key })
38
- : new AkaiPropertyError(`property \`${key}\` must be a hostname or absolute URL`, { key });
39
- }
40
- return host;
71
+ if (raw === undefined || raw === '')
72
+ throw unsetError(isSecret, key);
73
+ return { key, isSecret, raw };
74
+ }
75
+ function unsetError(isSecret, key) {
76
+ return isSecret
77
+ ? new AkaiSecretError(`egress is bound to secret \`${key}\` but it is unset; set the '${key}' secret on the connection`, { key })
78
+ : new AkaiPropertyError(`egress is bound to property \`${key}\` but it is unset; set the '${key}' property on the connection`, { key });
41
79
  }
42
80
  /**
43
81
  * Derive the hostname from a dynamic-egress value: an absolute URL yields its
@@ -45,8 +83,9 @@ export function resolveDynamicEgressHost(egress, secrets, properties, cliId, too
45
83
  * scheme with an empty hostname, so it is retried under an `https://` prefix and
46
84
  * accepted only as a clean bare authority (no credentials/path/query/fragment).
47
85
  * Returns `undefined` when the value is neither — the caller fails closed.
86
+ * Exported so the executor's egress resolver derives hosts identically.
48
87
  */
49
- function hostFromValue(raw) {
88
+ export function hostFromValue(raw) {
50
89
  try {
51
90
  const h = new URL(raw).hostname;
52
91
  if (h !== '')
@@ -1 +1 @@
1
- {"version":3,"file":"index.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AAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;QAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACzC,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAyR/E"}
@@ -15,6 +15,7 @@ import os from 'node:os';
15
15
  import path from 'node:path';
16
16
  import { createRequire } from 'node:module';
17
17
  import { buildCtx } from '../../ctx/build-ctx.js';
18
+ import { splitEgressEntries, hostFromValue } from '../../ctx/dynamic-egress.js';
18
19
  import { AkaiError, AkaiEgressError, AkaiPropertyError, AkaiResponseTooLargeError, AkaiSecretError, AkaiSpecError, } from '../../errors.js';
19
20
  import { DYNAMIC_EGRESS_PREFIXES } from '../../tool.js';
20
21
  import { create as tarCreate } from 'tar';
@@ -323,39 +324,32 @@ function resolveEgress(cli, toolName, body) {
323
324
  if (raw === undefined || raw === '') {
324
325
  return isSecret
325
326
  ? failure('secret_missing', `tool '${body.cli}.${toolName}' egress is bound to secret '${key}' but it is unset; set the '${key}' secret on the connection`, { key })
326
- : failure('property_missing', `tool '${body.cli}.${toolName}' egress is bound to property '${key}' but it is unset; set the connection's base URL`, { key });
327
+ : failure('property_missing', `tool '${body.cli}.${toolName}' egress is bound to property '${key}' but it is unset; set the '${key}' property on the connection`, { key });
327
328
  }
328
- // Bare host[:port] fallback for secrets like sunfish's SUNFISH_HOST; "host:port" alone parses as a bogus scheme with empty hostname, not a throw.
329
- let host;
330
- try {
331
- host = new URL(raw).hostname;
332
- }
333
- catch {
334
- host = '';
335
- }
336
- if (host === '') {
337
- let fallback;
338
- try {
339
- fallback = new URL(`https://${raw}`);
340
- }
341
- catch {
342
- return notAbsoluteUrl(isSecret, key);
343
- }
344
- const isBareHost = fallback.username === '' && fallback.password === '' &&
345
- fallback.pathname === '/' && fallback.search === '' && fallback.hash === '';
346
- if (!isBareHost || fallback.hostname === '') {
329
+ // The value may be a single host or a comma/newline ALLOWLIST of several. Split
330
+ // and resolve each entry through the SAME helpers buildCtx uses, so both paths
331
+ // derive identical hosts. Any invalid entry fails closed — never a partial or
332
+ // widened egress. (`hostFromValue` handles the bare host[:port] fallback for
333
+ // secrets like sunfish's SUNFISH_HOST.)
334
+ const entries = splitEgressEntries(raw);
335
+ if (entries.length === 0)
336
+ return notAbsoluteUrl(isSecret, key);
337
+ const hosts = [];
338
+ for (const entry of entries) {
339
+ const host = hostFromValue(entry);
340
+ if (host === undefined)
347
341
  return notAbsoluteUrl(isSecret, key);
348
- }
349
- host = fallback.hostname;
342
+ if (!hosts.includes(host))
343
+ hosts.push(host);
350
344
  }
351
- // Shallow-clone the shared registry def down to the egress array, narrowing
352
- // it to exactly the one resolved host. Preserve any other `network` settings
345
+ // Shallow-clone the shared registry def down to the egress array, narrowing it
346
+ // to exactly the resolved host allowlist. Preserve any other `network` settings
353
347
  // and override only `egress` so future SDK network fields are not dropped.
354
348
  const resolvedTool = {
355
349
  ...tool,
356
350
  options: {
357
351
  ...tool.options,
358
- network: { ...tool.options.network, egress: [host] },
352
+ network: { ...tool.options.network, egress: hosts },
359
353
  },
360
354
  };
361
355
  const resolvedCli = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akai-workflow-builder/cli-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Authoring SDK for atomic, agent-executable CLIs and tools.",
5
5
  "keywords": [
6
6
  "akai",