@akai-workflow-builder/cli-sdk 0.16.0 → 0.18.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 +24 -0
- package/dist/ctx/build-ctx.d.ts.map +1 -1
- package/dist/ctx/build-ctx.js +41 -4
- package/dist/ctx/dynamic-egress.d.ts +11 -0
- package/dist/ctx/dynamic-egress.d.ts.map +1 -1
- package/dist/ctx/dynamic-egress.js +7 -2
- package/dist/ctx/safe-fetch.d.ts +1 -0
- package/dist/ctx/safe-fetch.d.ts.map +1 -1
- package/dist/ctx/safe-fetch.js +1 -1
- package/dist/ctx/sftp-egress.d.ts +47 -0
- package/dist/ctx/sftp-egress.d.ts.map +1 -0
- package/dist/ctx/sftp-egress.js +99 -0
- package/dist/ctx/sftp.d.ts +101 -0
- package/dist/ctx/sftp.d.ts.map +1 -0
- package/dist/ctx/sftp.js +426 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/json-schema.d.ts +15 -0
- package/dist/manifest/json-schema.d.ts.map +1 -1
- package/dist/manifest/json-schema.js +11 -2
- package/dist/manifest/to-schema.d.ts.map +1 -1
- package/dist/manifest/to-schema.js +10 -0
- package/dist/manifest/types.d.ts +10 -1
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/runtime/executor/index.d.ts.map +1 -1
- package/dist/runtime/executor/index.js +22 -6
- package/dist/runtime/registry/loader.d.ts +18 -10
- package/dist/runtime/registry/loader.d.ts.map +1 -1
- package/dist/runtime/registry/loader.js +282 -143
- package/dist/runtime/registry/types.d.ts +11 -3
- package/dist/runtime/registry/types.d.ts.map +1 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +30 -1
- package/dist/types.d.ts +13 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -16,6 +16,7 @@ import path from 'node:path';
|
|
|
16
16
|
import { createRequire } from 'node:module';
|
|
17
17
|
import { buildCtx } from '../../ctx/build-ctx.js';
|
|
18
18
|
import { splitEgressEntries, hostFromValue } from '../../ctx/dynamic-egress.js';
|
|
19
|
+
import { formatSftpEgressEntry, parseSftpEgress } from '../../ctx/sftp-egress.js';
|
|
19
20
|
import { AkaiError, AkaiEgressError, AkaiPropertyError, AkaiResponseTooLargeError, AkaiSecretError, AkaiSpecError, } from '../../errors.js';
|
|
20
21
|
import { DYNAMIC_EGRESS_PREFIXES } from '../../tool.js';
|
|
21
22
|
import { create as tarCreate } from 'tar';
|
|
@@ -340,6 +341,17 @@ function resolveEgress(cli, toolName, body) {
|
|
|
340
341
|
? 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 })
|
|
341
342
|
: 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 });
|
|
342
343
|
}
|
|
344
|
+
// An sftp tool's entries carry a port and an optional host-key pin, so they are
|
|
345
|
+
// parsed by the sftp grammar and kept whole (canonicalised) rather than reduced
|
|
346
|
+
// to hostnames. Same all-or-nothing rule.
|
|
347
|
+
if (tool.transport === 'sftp') {
|
|
348
|
+
const parsed = parseSftpEgress(raw);
|
|
349
|
+
if (parsed === undefined) {
|
|
350
|
+
const message = `${isSecret ? 'secret' : 'property'} '${key}' must be a list of host[:port] entries, each optionally followed by a SHA256: host-key fingerprint`;
|
|
351
|
+
return failure(isSecret ? 'secret_missing' : 'property_missing', message, { key });
|
|
352
|
+
}
|
|
353
|
+
return { ok: true, cli: withResolvedEgress(cli, toolName, tool, parsed.map(formatSftpEgressEntry)) };
|
|
354
|
+
}
|
|
343
355
|
// The value may be a single host or a comma/newline ALLOWLIST of several. Split
|
|
344
356
|
// and resolve each entry through the SAME helpers buildCtx uses, so both paths
|
|
345
357
|
// derive identical hosts. Any invalid entry fails closed — never a partial or
|
|
@@ -356,21 +368,25 @@ function resolveEgress(cli, toolName, body) {
|
|
|
356
368
|
if (!hosts.includes(host))
|
|
357
369
|
hosts.push(host);
|
|
358
370
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
371
|
+
return { ok: true, cli: withResolvedEgress(cli, toolName, tool, hosts) };
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Shallow-clone the shared registry def down to the egress array, narrowing it
|
|
375
|
+
* to exactly the resolved allowlist. Preserve any other `network` settings and
|
|
376
|
+
* override only `egress` so future SDK network fields are not dropped.
|
|
377
|
+
*/
|
|
378
|
+
function withResolvedEgress(cli, toolName, tool, egress) {
|
|
362
379
|
const resolvedTool = {
|
|
363
380
|
...tool,
|
|
364
381
|
options: {
|
|
365
382
|
...tool.options,
|
|
366
|
-
network: { ...tool.options.network, egress
|
|
383
|
+
network: { ...tool.options.network, egress },
|
|
367
384
|
},
|
|
368
385
|
};
|
|
369
|
-
|
|
386
|
+
return {
|
|
370
387
|
...cli,
|
|
371
388
|
tools: { ...cli.tools, [toolName]: resolvedTool },
|
|
372
389
|
};
|
|
373
|
-
return { ok: true, cli: resolvedCli };
|
|
374
390
|
}
|
|
375
391
|
/** A dynamic-egress value that's neither an absolute URL nor a bare hostname
|
|
376
392
|
* — fail closed with the source-accurate code/message (secret vs property). */
|
|
@@ -9,21 +9,28 @@ export interface LoadRegistryOptions {
|
|
|
9
9
|
readonly customerPath?: string;
|
|
10
10
|
readonly logger?: ToolLogger;
|
|
11
11
|
/**
|
|
12
|
-
* How to treat a duplicate CLI id / connection slug
|
|
12
|
+
* How to treat a duplicate CLI id / connection slug, and a baseline package
|
|
13
|
+
* that fails to load.
|
|
13
14
|
*
|
|
14
15
|
* `false` (default, PRODUCTION): resilient. The first definition wins (baseline
|
|
15
16
|
* is scanned before customer, so baseline always wins), and the colliding
|
|
16
17
|
* later definition is skipped, logged loudly, and recorded as a `LoadFailure`.
|
|
17
18
|
* A duplicate is a bad *connection*, never a reason to fail-closed and take
|
|
18
19
|
* every tenant's tools down — the lesson from the employee-navigator/kota
|
|
19
|
-
* cross-repo outages.
|
|
20
|
+
* cross-repo outages. A package that fails to load (unreadable package.json,
|
|
21
|
+
* import error, failed brand/shape check) is likewise skipped and recorded
|
|
22
|
+
* (`kind: 'load-error'`) whether it is baseline or customer, so the rest of
|
|
23
|
+
* the catalog still loads. This matters when the host loads a baseline bundle
|
|
24
|
+
* built with a NEWER cli-sdk than its own: one package the older loader cannot
|
|
25
|
+
* read must cost that package, not every tool on every tenant.
|
|
20
26
|
*
|
|
21
|
-
* `true` (CI / authoring): strict. An ACCIDENTAL duplicate throws, so
|
|
22
|
-
*
|
|
23
|
-
* being logged at runtime.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* and
|
|
27
|
+
* `true` (CI / authoring): strict. An ACCIDENTAL duplicate throws, and so does
|
|
28
|
+
* a BASELINE package that fails to load, so either fails a PR pre-merge where
|
|
29
|
+
* it's cheap to fix, instead of only being logged at runtime. A customer
|
|
30
|
+
* package that fails to load is still recorded, not thrown. An explicit
|
|
31
|
+
* customer override (see `resolveCollision`) is intentional, not accidental —
|
|
32
|
+
* it is honored and recorded, never thrown, even in strict mode. Used by the
|
|
33
|
+
* bundle-import gate and the baseline self-check.
|
|
27
34
|
*/
|
|
28
35
|
readonly strict?: boolean;
|
|
29
36
|
/**
|
|
@@ -85,8 +92,9 @@ export declare class Registry {
|
|
|
85
92
|
* host can dispatch an arbitrary recorded step for it without a tool key.
|
|
86
93
|
*/
|
|
87
94
|
getCli(cliId: string): Promise<BrandedCLI | undefined>;
|
|
88
|
-
/** Packages skipped at load: failed brand/shape check
|
|
89
|
-
* a duplicate id/slug
|
|
95
|
+
/** Packages skipped at load: failed to load (import / brand / shape check —
|
|
96
|
+
* baseline too, unless strict), or the dropped side of a duplicate id/slug
|
|
97
|
+
* collision. */
|
|
90
98
|
failures(): ReadonlyArray<LoadFailure>;
|
|
91
99
|
stats(): RegistryStats;
|
|
92
100
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/loader.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAIjB,eAAe,EACf,WAAW,EACX,aAAa,EAEb,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAItF,OAAO,KAAK,EAAgB,eAAe,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/loader.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAIjB,eAAe,EACf,WAAW,EACX,aAAa,EAEb,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAItF,OAAO,KAAK,EAAgB,eAAe,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;AA4D1F,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,QAAQ;I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