agent-relay 5.0.0 → 6.0.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/dist/index.cjs +599 -197
- package/dist/packages/sdk/src/provisioner/local-jwks.d.ts +25 -0
- package/dist/packages/sdk/src/provisioner/local-jwks.d.ts.map +1 -0
- package/dist/packages/sdk/src/provisioner/local-jwks.js +70 -0
- package/dist/packages/sdk/src/provisioner/local-jwks.js.map +1 -0
- package/dist/packages/sdk/src/provisioner/token.d.ts +6 -3
- package/dist/packages/sdk/src/provisioner/token.d.ts.map +1 -1
- package/dist/packages/sdk/src/provisioner/token.js +11 -8
- package/dist/packages/sdk/src/provisioner/token.js.map +1 -1
- package/dist/src/cli/commands/on/provision.d.ts +2 -1
- package/dist/src/cli/commands/on/provision.d.ts.map +1 -1
- package/dist/src/cli/commands/on/provision.js +5 -4
- package/dist/src/cli/commands/on/provision.js.map +1 -1
- package/dist/src/cli/commands/on/services.d.ts +1 -0
- package/dist/src/cli/commands/on/services.d.ts.map +1 -1
- package/dist/src/cli/commands/on/services.js +9 -0
- package/dist/src/cli/commands/on/services.js.map +1 -1
- package/dist/src/cli/commands/on/start.d.ts +6 -3
- package/dist/src/cli/commands/on/start.d.ts.map +1 -1
- package/dist/src/cli/commands/on/start.js +310 -297
- package/dist/src/cli/commands/on/start.js.map +1 -1
- package/dist/src/cli/commands/on/token.d.ts +3 -1
- package/dist/src/cli/commands/on/token.d.ts.map +1 -1
- package/dist/src/cli/commands/on/token.js +3 -3
- package/dist/src/cli/commands/on/token.js.map +1 -1
- package/node_modules/@agent-relay/broker-darwin-arm64/README.md +11 -0
- package/node_modules/@agent-relay/broker-darwin-arm64/package.json +17 -0
- package/node_modules/@agent-relay/broker-darwin-x64/README.md +11 -0
- package/node_modules/@agent-relay/broker-darwin-x64/bin/.gitkeep +0 -0
- package/node_modules/@agent-relay/broker-darwin-x64/package.json +17 -0
- package/node_modules/@agent-relay/broker-linux-arm64/README.md +12 -0
- package/node_modules/@agent-relay/broker-linux-arm64/bin/.gitkeep +0 -0
- package/node_modules/@agent-relay/broker-linux-arm64/package.json +17 -0
- package/node_modules/@agent-relay/broker-linux-x64/README.md +12 -0
- package/node_modules/@agent-relay/broker-linux-x64/bin/.gitkeep +0 -0
- package/node_modules/@agent-relay/broker-linux-x64/package.json +17 -0
- package/node_modules/@agent-relay/broker-win32-x64/README.md +11 -0
- package/node_modules/@agent-relay/broker-win32-x64/bin/.gitkeep +0 -0
- package/node_modules/@agent-relay/broker-win32-x64/package.json +17 -0
- package/node_modules/@agent-relay/cloud/package.json +2 -2
- package/node_modules/@agent-relay/config/dist/cli-registry.generated.d.ts +353 -157
- package/node_modules/@agent-relay/config/dist/cli-registry.generated.d.ts.map +1 -1
- package/node_modules/@agent-relay/config/dist/cli-registry.generated.js +356 -160
- package/node_modules/@agent-relay/config/dist/cli-registry.generated.js.map +1 -1
- package/node_modules/@agent-relay/config/package.json +1 -1
- package/node_modules/@agent-relay/hooks/package.json +4 -4
- package/node_modules/@agent-relay/sdk/dist/broker-path.d.ts +18 -7
- package/node_modules/@agent-relay/sdk/dist/broker-path.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/broker-path.js +92 -20
- package/node_modules/@agent-relay/sdk/dist/broker-path.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/client.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/client.js +9 -2
- package/node_modules/@agent-relay/sdk/dist/client.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/audit.test.js +2 -2
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/audit.test.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/token-factory.test.js +29 -17
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/token-factory.test.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/token.test.js +8 -3
- package/node_modules/@agent-relay/sdk/dist/provisioner/__tests__/token.test.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/index.d.ts +1 -0
- package/node_modules/@agent-relay/sdk/dist/provisioner/index.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/index.js +5 -2
- package/node_modules/@agent-relay/sdk/dist/provisioner/index.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/local-jwks.d.ts +25 -0
- package/node_modules/@agent-relay/sdk/dist/provisioner/local-jwks.d.ts.map +1 -0
- package/node_modules/@agent-relay/sdk/dist/provisioner/local-jwks.js +70 -0
- package/node_modules/@agent-relay/sdk/dist/provisioner/local-jwks.js.map +1 -0
- package/node_modules/@agent-relay/sdk/dist/provisioner/token.d.ts +6 -3
- package/node_modules/@agent-relay/sdk/dist/provisioner/token.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/token.js +11 -8
- package/node_modules/@agent-relay/sdk/dist/provisioner/token.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/provisioner/types.d.ts +3 -2
- package/node_modules/@agent-relay/sdk/dist/provisioner/types.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/__tests__/sibling-links.test.d.ts +2 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/__tests__/sibling-links.test.d.ts.map +1 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/__tests__/sibling-links.test.js +166 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/__tests__/sibling-links.test.js.map +1 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/index.d.ts +2 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/index.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/index.js +1 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/index.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/runner.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/runner.js +18 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/runner.js.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/sibling-links.d.ts +100 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/sibling-links.d.ts.map +1 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/sibling-links.js +205 -0
- package/node_modules/@agent-relay/sdk/dist/workflows/sibling-links.js.map +1 -0
- package/node_modules/@agent-relay/sdk/package.json +10 -3
- package/node_modules/@agent-relay/telemetry/package.json +1 -1
- package/node_modules/@agent-relay/trajectory/package.json +2 -2
- package/node_modules/@agent-relay/user-directory/package.json +2 -2
- package/node_modules/@agent-relay/utils/package.json +2 -2
- package/node_modules/@aws-sdk/core/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +4 -4
- package/node_modules/@aws-sdk/nested-clients/package.json +14 -14
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@nodable/entities/README.md +41 -0
- package/node_modules/@nodable/entities/package.json +54 -0
- package/node_modules/@nodable/entities/src/EntityDecoder.js +543 -0
- package/node_modules/@nodable/entities/src/EntityEncoder.js +194 -0
- package/node_modules/@nodable/entities/src/entities.js +1177 -0
- package/node_modules/@nodable/entities/src/entityTries.js +49 -0
- package/node_modules/@nodable/entities/src/index.d.ts +264 -0
- package/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +3 -3
- package/node_modules/@smithy/middleware-retry/package.json +4 -4
- package/node_modules/@smithy/middleware-serde/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +27 -16
- package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +5 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +22 -16
- package/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +2 -4
- package/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-retry/dist-cjs/index.js +20 -10
- package/node_modules/@smithy/util-retry/dist-es/StandardRetryStrategy.js +20 -10
- package/node_modules/@smithy/util-retry/dist-types/StandardRetryStrategy.d.ts +12 -4
- package/node_modules/@smithy/util-retry/package.json +1 -1
- package/node_modules/@smithy/util-stream/package.json +2 -2
- package/node_modules/fast-xml-parser/CHANGELOG.md +53 -0
- package/node_modules/fast-xml-parser/README.md +8 -28
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +172 -6
- package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/fast-xml-parser/package.json +5 -4
- package/node_modules/fast-xml-parser/src/fxp.d.ts +162 -3
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +2 -5
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +15 -11
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +168 -244
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +1 -1
- package/package.json +9 -10
- package/packages/cloud/package.json +2 -2
- package/packages/config/dist/cli-registry.generated.d.ts +353 -157
- package/packages/config/dist/cli-registry.generated.d.ts.map +1 -1
- package/packages/config/dist/cli-registry.generated.js +356 -160
- package/packages/config/dist/cli-registry.generated.js.map +1 -1
- package/packages/config/package.json +1 -1
- package/packages/hooks/package.json +4 -4
- package/packages/sdk/dist/broker-path.d.ts +18 -7
- package/packages/sdk/dist/broker-path.d.ts.map +1 -1
- package/packages/sdk/dist/broker-path.js +92 -20
- package/packages/sdk/dist/broker-path.js.map +1 -1
- package/packages/sdk/dist/client.d.ts.map +1 -1
- package/packages/sdk/dist/client.js +9 -2
- package/packages/sdk/dist/client.js.map +1 -1
- package/packages/sdk/dist/provisioner/__tests__/audit.test.js +2 -2
- package/packages/sdk/dist/provisioner/__tests__/audit.test.js.map +1 -1
- package/packages/sdk/dist/provisioner/__tests__/token-factory.test.js +29 -17
- package/packages/sdk/dist/provisioner/__tests__/token-factory.test.js.map +1 -1
- package/packages/sdk/dist/provisioner/__tests__/token.test.js +8 -3
- package/packages/sdk/dist/provisioner/__tests__/token.test.js.map +1 -1
- package/packages/sdk/dist/provisioner/index.d.ts +1 -0
- package/packages/sdk/dist/provisioner/index.d.ts.map +1 -1
- package/packages/sdk/dist/provisioner/index.js +5 -2
- package/packages/sdk/dist/provisioner/index.js.map +1 -1
- package/packages/sdk/dist/provisioner/local-jwks.d.ts +25 -0
- package/packages/sdk/dist/provisioner/local-jwks.d.ts.map +1 -0
- package/packages/sdk/dist/provisioner/local-jwks.js +70 -0
- package/packages/sdk/dist/provisioner/local-jwks.js.map +1 -0
- package/packages/sdk/dist/provisioner/token.d.ts +6 -3
- package/packages/sdk/dist/provisioner/token.d.ts.map +1 -1
- package/packages/sdk/dist/provisioner/token.js +11 -8
- package/packages/sdk/dist/provisioner/token.js.map +1 -1
- package/packages/sdk/dist/provisioner/types.d.ts +3 -2
- package/packages/sdk/dist/provisioner/types.d.ts.map +1 -1
- package/packages/sdk/dist/workflows/__tests__/sibling-links.test.d.ts +2 -0
- package/packages/sdk/dist/workflows/__tests__/sibling-links.test.d.ts.map +1 -0
- package/packages/sdk/dist/workflows/__tests__/sibling-links.test.js +166 -0
- package/packages/sdk/dist/workflows/__tests__/sibling-links.test.js.map +1 -0
- package/packages/sdk/dist/workflows/index.d.ts +2 -0
- package/packages/sdk/dist/workflows/index.d.ts.map +1 -1
- package/packages/sdk/dist/workflows/index.js +1 -0
- package/packages/sdk/dist/workflows/index.js.map +1 -1
- package/packages/sdk/dist/workflows/runner.d.ts.map +1 -1
- package/packages/sdk/dist/workflows/runner.js +18 -1
- package/packages/sdk/dist/workflows/runner.js.map +1 -1
- package/packages/sdk/dist/workflows/sibling-links.d.ts +100 -0
- package/packages/sdk/dist/workflows/sibling-links.d.ts.map +1 -0
- package/packages/sdk/dist/workflows/sibling-links.js +205 -0
- package/packages/sdk/dist/workflows/sibling-links.js.map +1 -0
- package/packages/sdk/package.json +10 -3
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +2 -2
- package/scripts/postinstall.js +9 -146
- package/bin/agent-relay-broker-darwin-arm64 +0 -0
- package/bin/agent-relay-broker-darwin-x64 +0 -0
- package/bin/agent-relay-broker-linux-arm64 +0 -0
- package/bin/agent-relay-broker-linux-x64 +0 -0
- package/node_modules/fast-xml-parser/lib/pem.d.cts +0 -148
- package/node_modules/fast-xml-parser/src/pem.d.ts +0 -135
- /package/{bin → node_modules/@agent-relay/broker-darwin-arm64/bin}/.gitkeep +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sibling-package link setup for workflows that consume a package living in
|
|
3
|
+
* a sibling repo / worktree on disk.
|
|
4
|
+
*
|
|
5
|
+
* Problem it solves: agents running inside a workflow sometimes find that
|
|
6
|
+
* `npm install` (or `pip install`) resolved an older version of a package
|
|
7
|
+
* than the one the workflow actually needs — for example when the consumer
|
|
8
|
+
* workflow runs before the producer has published a new release. Rather
|
|
9
|
+
* than letting agents see a stale interface (and react by augmenting the
|
|
10
|
+
* module or writing fallback implementations), linking redirects the
|
|
11
|
+
* package resolution at dev-time to the sibling's on-disk build output.
|
|
12
|
+
*
|
|
13
|
+
* Usage (ESM):
|
|
14
|
+
*
|
|
15
|
+
* import { workflow, applySiblingLinks } from '@agent-relay/sdk/workflows';
|
|
16
|
+
*
|
|
17
|
+
* const base = workflow('my-feature').pattern('dag').agent('impl', ...);
|
|
18
|
+
* const wf = applySiblingLinks(base, {
|
|
19
|
+
* dependsOn: ['install-deps'],
|
|
20
|
+
* links: [
|
|
21
|
+
* {
|
|
22
|
+
* name: '@agent-assistant/proactive',
|
|
23
|
+
* path: '../agent-assistant/packages/proactive',
|
|
24
|
+
* expect: ['recordSignal', 'drainSignals'],
|
|
25
|
+
* },
|
|
26
|
+
* {
|
|
27
|
+
* name: '@agent-assistant/surfaces',
|
|
28
|
+
* path: '../agent-assistant/packages/surfaces',
|
|
29
|
+
* expect: ['classifySlackPresenceSignal'],
|
|
30
|
+
* },
|
|
31
|
+
* ],
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* await wf.step('plan', { agent: 'impl', dependsOn: ['setup-sibling-links'], task: ... })
|
|
35
|
+
* .run({ cwd: process.cwd() });
|
|
36
|
+
*
|
|
37
|
+
* MVP language support: npm (package.json), Python (pyproject.toml /
|
|
38
|
+
* setup.py / setup.cfg). Auto-detects from the sibling's manifest. Fails
|
|
39
|
+
* fast on missing path, unknown manifest, or missing expected exports.
|
|
40
|
+
*/
|
|
41
|
+
/** A single sibling package to link into the workflow's working directory. */
|
|
42
|
+
export interface SiblingLink {
|
|
43
|
+
/**
|
|
44
|
+
* Package name as it appears in imports (e.g. "@agent-assistant/proactive",
|
|
45
|
+
* "my_python_pkg"). For Python, use the import name (underscored), not the
|
|
46
|
+
* distribution name.
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Path to the sibling package root, relative to the workflow's cwd.
|
|
51
|
+
* For npm, this is the directory containing package.json.
|
|
52
|
+
* For Python, the directory containing pyproject.toml / setup.py.
|
|
53
|
+
*/
|
|
54
|
+
path: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional list of top-level named exports / attributes the workflow
|
|
57
|
+
* expects to find on the linked package post-setup. When provided, a
|
|
58
|
+
* language-appropriate import smoke test runs and fails the step if any
|
|
59
|
+
* are missing.
|
|
60
|
+
*/
|
|
61
|
+
expect?: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface SiblingLinkOptions {
|
|
64
|
+
/** Link declarations. All must succeed (fail-fast on any error). */
|
|
65
|
+
links: SiblingLink[];
|
|
66
|
+
/**
|
|
67
|
+
* Step name for the setup step emitted by this helper.
|
|
68
|
+
* Defaults to `"setup-sibling-links"`.
|
|
69
|
+
*/
|
|
70
|
+
stepName?: string;
|
|
71
|
+
/**
|
|
72
|
+
* dependsOn for the setup step. Typically `['install-deps']` so that
|
|
73
|
+
* `npm install` / `pip install` has run first.
|
|
74
|
+
* Defaults to `['install-deps']`.
|
|
75
|
+
*/
|
|
76
|
+
dependsOn?: string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Adds a single deterministic step to the workflow that links each sibling
|
|
80
|
+
* package into the workflow's working directory using the appropriate
|
|
81
|
+
* language-specific mechanism, then smoke-tests each linked package for
|
|
82
|
+
* expected exports.
|
|
83
|
+
*
|
|
84
|
+
* The step fails fast on:
|
|
85
|
+
* - Sibling path missing
|
|
86
|
+
* - Unknown manifest (no package.json / pyproject.toml / setup.py)
|
|
87
|
+
* - Link command failure
|
|
88
|
+
* - Missing expected export
|
|
89
|
+
*/
|
|
90
|
+
export declare function applySiblingLinks<T>(wf: T, opts: SiblingLinkOptions): T;
|
|
91
|
+
/**
|
|
92
|
+
* Builds a bash script that:
|
|
93
|
+
* 1. For each link, detects its manifest and applies the right link command.
|
|
94
|
+
* 2. After all links succeed, runs one import smoke test per link that
|
|
95
|
+
* declared expected exports.
|
|
96
|
+
*
|
|
97
|
+
* Exported for test visibility; not part of the public API.
|
|
98
|
+
*/
|
|
99
|
+
export declare function buildSiblingLinkScript(links: SiblingLink[]): string;
|
|
100
|
+
//# sourceMappingURL=sibling-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sibling-links.d.ts","sourceRoot":"","sources":["../../src/workflows/sibling-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,KAAK,EAAE,WAAW,EAAE,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,CAAC,CAkBvE;AAkBD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAsBnE"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sibling-package link setup for workflows that consume a package living in
|
|
3
|
+
* a sibling repo / worktree on disk.
|
|
4
|
+
*
|
|
5
|
+
* Problem it solves: agents running inside a workflow sometimes find that
|
|
6
|
+
* `npm install` (or `pip install`) resolved an older version of a package
|
|
7
|
+
* than the one the workflow actually needs — for example when the consumer
|
|
8
|
+
* workflow runs before the producer has published a new release. Rather
|
|
9
|
+
* than letting agents see a stale interface (and react by augmenting the
|
|
10
|
+
* module or writing fallback implementations), linking redirects the
|
|
11
|
+
* package resolution at dev-time to the sibling's on-disk build output.
|
|
12
|
+
*
|
|
13
|
+
* Usage (ESM):
|
|
14
|
+
*
|
|
15
|
+
* import { workflow, applySiblingLinks } from '@agent-relay/sdk/workflows';
|
|
16
|
+
*
|
|
17
|
+
* const base = workflow('my-feature').pattern('dag').agent('impl', ...);
|
|
18
|
+
* const wf = applySiblingLinks(base, {
|
|
19
|
+
* dependsOn: ['install-deps'],
|
|
20
|
+
* links: [
|
|
21
|
+
* {
|
|
22
|
+
* name: '@agent-assistant/proactive',
|
|
23
|
+
* path: '../agent-assistant/packages/proactive',
|
|
24
|
+
* expect: ['recordSignal', 'drainSignals'],
|
|
25
|
+
* },
|
|
26
|
+
* {
|
|
27
|
+
* name: '@agent-assistant/surfaces',
|
|
28
|
+
* path: '../agent-assistant/packages/surfaces',
|
|
29
|
+
* expect: ['classifySlackPresenceSignal'],
|
|
30
|
+
* },
|
|
31
|
+
* ],
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* await wf.step('plan', { agent: 'impl', dependsOn: ['setup-sibling-links'], task: ... })
|
|
35
|
+
* .run({ cwd: process.cwd() });
|
|
36
|
+
*
|
|
37
|
+
* MVP language support: npm (package.json), Python (pyproject.toml /
|
|
38
|
+
* setup.py / setup.cfg). Auto-detects from the sibling's manifest. Fails
|
|
39
|
+
* fast on missing path, unknown manifest, or missing expected exports.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Adds a single deterministic step to the workflow that links each sibling
|
|
43
|
+
* package into the workflow's working directory using the appropriate
|
|
44
|
+
* language-specific mechanism, then smoke-tests each linked package for
|
|
45
|
+
* expected exports.
|
|
46
|
+
*
|
|
47
|
+
* The step fails fast on:
|
|
48
|
+
* - Sibling path missing
|
|
49
|
+
* - Unknown manifest (no package.json / pyproject.toml / setup.py)
|
|
50
|
+
* - Link command failure
|
|
51
|
+
* - Missing expected export
|
|
52
|
+
*/
|
|
53
|
+
export function applySiblingLinks(wf, opts) {
|
|
54
|
+
if (opts.links.length === 0) {
|
|
55
|
+
return wf;
|
|
56
|
+
}
|
|
57
|
+
const stepName = opts.stepName ?? 'setup-sibling-links';
|
|
58
|
+
const dependsOn = opts.dependsOn ?? ['install-deps'];
|
|
59
|
+
const script = buildSiblingLinkScript(opts.links);
|
|
60
|
+
const chain = wf;
|
|
61
|
+
chain.step(stepName, {
|
|
62
|
+
type: 'deterministic',
|
|
63
|
+
dependsOn,
|
|
64
|
+
command: `bash -c ${shSingleQuote(script)}`,
|
|
65
|
+
captureOutput: true,
|
|
66
|
+
failOnError: true,
|
|
67
|
+
});
|
|
68
|
+
return wf;
|
|
69
|
+
}
|
|
70
|
+
// ─── Internal: shell-script generation ─────────────────────────────────────
|
|
71
|
+
/**
|
|
72
|
+
* Shell-quote a string for safe single-quoted inclusion in a bash command.
|
|
73
|
+
* Single-quoted strings in bash are literal for every character except the
|
|
74
|
+
* single quote itself, so `$` and backticks are NOT interpreted — which is
|
|
75
|
+
* exactly what we want for link.name / link.path / JSON payloads that must
|
|
76
|
+
* pass through bash unchanged.
|
|
77
|
+
*
|
|
78
|
+
* Embedded single quotes are escaped via the standard `'\''` POSIX idiom
|
|
79
|
+
* (close, escape, reopen).
|
|
80
|
+
*/
|
|
81
|
+
function shSingleQuote(value) {
|
|
82
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Builds a bash script that:
|
|
86
|
+
* 1. For each link, detects its manifest and applies the right link command.
|
|
87
|
+
* 2. After all links succeed, runs one import smoke test per link that
|
|
88
|
+
* declared expected exports.
|
|
89
|
+
*
|
|
90
|
+
* Exported for test visibility; not part of the public API.
|
|
91
|
+
*/
|
|
92
|
+
export function buildSiblingLinkScript(links) {
|
|
93
|
+
const lines = ['set -euo pipefail', 'echo "=== applySiblingLinks: setting up ==="'];
|
|
94
|
+
for (const link of links) {
|
|
95
|
+
// Use SINGLE-quoted shell literals for the assignments. Double-quoted
|
|
96
|
+
// literals (via JSON.stringify) would let `$`, backticks, and `\` still
|
|
97
|
+
// trigger substitution or escaping — single-quoted is literal end-to-end.
|
|
98
|
+
const escapedName = shSingleQuote(link.name);
|
|
99
|
+
const escapedPath = shSingleQuote(link.path);
|
|
100
|
+
lines.push(linkOneBlock(link, escapedName, escapedPath));
|
|
101
|
+
}
|
|
102
|
+
lines.push('echo "=== applySiblingLinks: verifying exports ==="');
|
|
103
|
+
for (const link of links) {
|
|
104
|
+
if (!link.expect || link.expect.length === 0) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
lines.push(verifyExportsBlock(link));
|
|
108
|
+
}
|
|
109
|
+
lines.push('echo "APPLY_SIBLING_LINKS_OK"');
|
|
110
|
+
return lines.join('\n');
|
|
111
|
+
}
|
|
112
|
+
function linkOneBlock(link, escapedName, escapedPath) {
|
|
113
|
+
void link;
|
|
114
|
+
return [
|
|
115
|
+
`SIBLING_PATH=${escapedPath}`,
|
|
116
|
+
`SIBLING_NAME=${escapedName}`,
|
|
117
|
+
'echo "--- link: $SIBLING_NAME <- $SIBLING_PATH ---"',
|
|
118
|
+
'if [ ! -d "$SIBLING_PATH" ]; then',
|
|
119
|
+
' echo "SIBLING_PATH_MISSING: $SIBLING_PATH" >&2',
|
|
120
|
+
' exit 1',
|
|
121
|
+
'fi',
|
|
122
|
+
'if [ -f "$SIBLING_PATH/package.json" ]; then',
|
|
123
|
+
' echo "detected: npm"',
|
|
124
|
+
' ( cd "$SIBLING_PATH" && npm link --silent )',
|
|
125
|
+
' npm link --silent "$SIBLING_NAME"',
|
|
126
|
+
'elif [ -f "$SIBLING_PATH/pyproject.toml" ] || [ -f "$SIBLING_PATH/setup.py" ] || [ -f "$SIBLING_PATH/setup.cfg" ]; then',
|
|
127
|
+
' echo "detected: python"',
|
|
128
|
+
// Try uv first (fastest when available), but uv refuses to install
|
|
129
|
+
// outside a venv without --system. Pass --system explicitly so uv
|
|
130
|
+
// works in non-venv sandboxes (common CI/agent runner shape).
|
|
131
|
+
// If uv still fails (e.g. broken install), fall through to pip/pip3
|
|
132
|
+
// via the explicit OR chain rather than relying on `set -e` to
|
|
133
|
+
// short-circuit between elif branches.
|
|
134
|
+
' if command -v uv >/dev/null 2>&1 && uv pip install --system -e "$SIBLING_PATH" --quiet 2>/dev/null; then',
|
|
135
|
+
' :',
|
|
136
|
+
' elif command -v pip >/dev/null 2>&1; then',
|
|
137
|
+
' pip install -e "$SIBLING_PATH" --quiet',
|
|
138
|
+
' elif command -v pip3 >/dev/null 2>&1; then',
|
|
139
|
+
' pip3 install -e "$SIBLING_PATH" --quiet',
|
|
140
|
+
' else',
|
|
141
|
+
' echo "NO_PYTHON_INSTALLER: uv / pip / pip3 not found or all failed" >&2',
|
|
142
|
+
' exit 1',
|
|
143
|
+
' fi',
|
|
144
|
+
'else',
|
|
145
|
+
' echo "UNKNOWN_MANIFEST: expected package.json / pyproject.toml / setup.py / setup.cfg at $SIBLING_PATH" >&2',
|
|
146
|
+
' exit 1',
|
|
147
|
+
'fi',
|
|
148
|
+
].join('\n');
|
|
149
|
+
}
|
|
150
|
+
function verifyExportsBlock(link) {
|
|
151
|
+
const escapedName = shSingleQuote(link.name);
|
|
152
|
+
const escapedPath = shSingleQuote(link.path);
|
|
153
|
+
const expectJson = JSON.stringify(link.expect ?? []);
|
|
154
|
+
// Pick the smoke-test runtime based on what manifest type the sibling had.
|
|
155
|
+
// Single-quoted assignments are literal — the JSON payload inside EXPECT
|
|
156
|
+
// survives bash untouched and downstream Node/Python JSON.parse it back.
|
|
157
|
+
return [
|
|
158
|
+
`SIBLING_PATH=${escapedPath}`,
|
|
159
|
+
`SIBLING_NAME=${escapedName}`,
|
|
160
|
+
`EXPECT=${shSingleQuote(expectJson)}`,
|
|
161
|
+
'if [ -f "$SIBLING_PATH/package.json" ]; then',
|
|
162
|
+
nodeVerifyCommand(),
|
|
163
|
+
'else',
|
|
164
|
+
pythonVerifyCommand(),
|
|
165
|
+
'fi',
|
|
166
|
+
].join('\n');
|
|
167
|
+
}
|
|
168
|
+
function nodeVerifyCommand() {
|
|
169
|
+
const script = [
|
|
170
|
+
'const want = JSON.parse(process.env.APPLY_SIBLING_LINKS_EXPECT);',
|
|
171
|
+
'const name = process.env.APPLY_SIBLING_LINKS_NAME;',
|
|
172
|
+
'const mod = await import(name);',
|
|
173
|
+
'const missing = want.filter((k) => !(k in mod));',
|
|
174
|
+
'if (missing.length) {',
|
|
175
|
+
' console.error(`MISSING_EXPORTS in ${name}: ${missing.join(",")}`);',
|
|
176
|
+
' process.exit(1);',
|
|
177
|
+
'}',
|
|
178
|
+
'console.log(`${name} OK: ${want.join(",")}`);',
|
|
179
|
+
].join(' ');
|
|
180
|
+
return ` APPLY_SIBLING_LINKS_NAME="$SIBLING_NAME" APPLY_SIBLING_LINKS_EXPECT="$EXPECT" node --input-type=module -e ${shSingleQuote(script)}`;
|
|
181
|
+
}
|
|
182
|
+
function pythonVerifyCommand() {
|
|
183
|
+
// Python < 3.12 forbids backslashes inside f-string expressions, so we
|
|
184
|
+
// can't inline `{",".join(missing)}` (which needs `\",\".` when written
|
|
185
|
+
// as a JS string literal). Bind the separator to a name outside the
|
|
186
|
+
// f-string first.
|
|
187
|
+
const script = [
|
|
188
|
+
'import json, os, importlib',
|
|
189
|
+
'name = os.environ["APPLY_SIBLING_LINKS_NAME"]',
|
|
190
|
+
'want = json.loads(os.environ["APPLY_SIBLING_LINKS_EXPECT"])',
|
|
191
|
+
'mod = importlib.import_module(name)',
|
|
192
|
+
'missing = [k for k in want if not hasattr(mod, k)]',
|
|
193
|
+
'sep = ","',
|
|
194
|
+
'if missing:',
|
|
195
|
+
' print(f"MISSING_EXPORTS in {name}: {sep.join(missing)}", flush=True)',
|
|
196
|
+
' raise SystemExit(1)',
|
|
197
|
+
'print(f"{name} OK: {sep.join(want)}", flush=True)',
|
|
198
|
+
].join('\n');
|
|
199
|
+
return [
|
|
200
|
+
' APPLY_SIBLING_LINKS_NAME="$SIBLING_NAME" APPLY_SIBLING_LINKS_EXPECT="$EXPECT" \\',
|
|
201
|
+
` python3 -c ${shSingleQuote(script)} 2>/dev/null || \\`,
|
|
202
|
+
` APPLY_SIBLING_LINKS_NAME="$SIBLING_NAME" APPLY_SIBLING_LINKS_EXPECT="$EXPECT" python -c ${shSingleQuote(script)}`,
|
|
203
|
+
].join('\n');
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=sibling-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sibling-links.js","sourceRoot":"","sources":["../../src/workflows/sibling-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAkDH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAI,EAAK,EAAE,IAAwB;IAClE,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,qBAAqB,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,EAA0B,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE;QACnB,IAAI,EAAE,eAAe;QACrB,SAAS;QACT,OAAO,EAAE,WAAW,aAAa,CAAC,MAAM,CAAC,EAAE;QAC3C,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAoB;IACzD,MAAM,KAAK,GAAa,CAAC,mBAAmB,EAAE,8CAA8C,CAAC,CAAC;IAE9F,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,sEAAsE;QACtE,wEAAwE;QACxE,0EAA0E;QAC1E,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IAClE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7C,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,YAAY,CAAC,IAAiB,EAAE,WAAmB,EAAE,WAAmB;IAC/E,KAAK,IAAI,CAAC;IACV,OAAO;QACL,gBAAgB,WAAW,EAAE;QAC7B,gBAAgB,WAAW,EAAE;QAC7B,qDAAqD;QACrD,mCAAmC;QACnC,kDAAkD;QAClD,UAAU;QACV,IAAI;QACJ,8CAA8C;QAC9C,wBAAwB;QACxB,+CAA+C;QAC/C,qCAAqC;QACrC,yHAAyH;QACzH,2BAA2B;QAC3B,mEAAmE;QACnE,kEAAkE;QAClE,8DAA8D;QAC9D,oEAAoE;QACpE,+DAA+D;QAC/D,uCAAuC;QACvC,4GAA4G;QAC5G,OAAO;QACP,6CAA6C;QAC7C,4CAA4C;QAC5C,8CAA8C;QAC9C,6CAA6C;QAC7C,QAAQ;QACR,6EAA6E;QAC7E,YAAY;QACZ,MAAM;QACN,MAAM;QACN,+GAA+G;QAC/G,UAAU;QACV,IAAI;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAiB;IAC3C,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACrD,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,OAAO;QACL,gBAAgB,WAAW,EAAE;QAC7B,gBAAgB,WAAW,EAAE;QAC7B,UAAU,aAAa,CAAC,UAAU,CAAC,EAAE;QACrC,8CAA8C;QAC9C,iBAAiB,EAAE;QACnB,MAAM;QACN,mBAAmB,EAAE;QACrB,IAAI;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,MAAM,GAAG;QACb,kEAAkE;QAClE,oDAAoD;QACpD,iCAAiC;QACjC,kDAAkD;QAClD,uBAAuB;QACvB,sEAAsE;QACtE,oBAAoB;QACpB,GAAG;QACH,+CAA+C;KAChD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,OAAO,+GAA+G,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;AAChJ,CAAC;AAED,SAAS,mBAAmB;IAC1B,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,kBAAkB;IAClB,MAAM,MAAM,GAAG;QACb,4BAA4B;QAC5B,+CAA+C;QAC/C,6DAA6D;QAC7D,qCAAqC;QACrC,oDAAoD;QACpD,WAAW;QACX,aAAa;QACb,0EAA0E;QAC1E,yBAAyB;QACzB,mDAAmD;KACpD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,OAAO;QACL,oFAAoF;QACpF,gBAAgB,aAAa,CAAC,MAAM,CAAC,oBAAoB;QACzD,6FAA6F,aAAa,CAAC,MAAM,CAAC,EAAE;KACrH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"@types/ws": "^8.5.10"
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
|
-
"@agent-relay/config": "
|
|
137
|
+
"@agent-relay/config": "6.0.0",
|
|
138
138
|
"@relaycast/sdk": "^1.1.0",
|
|
139
139
|
"@relayfile/sdk": ">=0.1.2 <1",
|
|
140
140
|
"@sinclair/typebox": "^0.34.48",
|
|
@@ -146,8 +146,15 @@
|
|
|
146
146
|
"tar": "^7.5.10",
|
|
147
147
|
"yaml": "^2.7.0"
|
|
148
148
|
},
|
|
149
|
+
"optionalDependencies": {
|
|
150
|
+
"@agent-relay/broker-darwin-arm64": "6.0.0",
|
|
151
|
+
"@agent-relay/broker-darwin-x64": "6.0.0",
|
|
152
|
+
"@agent-relay/broker-linux-arm64": "6.0.0",
|
|
153
|
+
"@agent-relay/broker-linux-x64": "6.0.0",
|
|
154
|
+
"@agent-relay/broker-win32-x64": "6.0.0"
|
|
155
|
+
},
|
|
149
156
|
"peerDependencies": {
|
|
150
|
-
"@agent-relay/credential-proxy": "
|
|
157
|
+
"@agent-relay/credential-proxy": "6.0.0",
|
|
151
158
|
"@anthropic-ai/claude-agent-sdk": ">=0.1.0",
|
|
152
159
|
"@google/adk": ">=0.5.0",
|
|
153
160
|
"@langchain/langgraph": ">=1.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/trajectory",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Trajectory integration utilities (trail/PDERO) for Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/config": "
|
|
25
|
+
"@agent-relay/config": "6.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/user-directory",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "User directory service for agent-relay (per-user credential storage)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/utils": "
|
|
25
|
+
"@agent-relay/utils": "6.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Shared utilities for agent-relay: logging, name generation, command resolution, update checking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"vitest": "^3.2.4"
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@agent-relay/config": "
|
|
114
|
+
"@agent-relay/config": "6.0.0",
|
|
115
115
|
"compare-versions": "^6.1.1"
|
|
116
116
|
},
|
|
117
117
|
"publishConfig": {
|
package/scripts/postinstall.js
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* Postinstall Script for agent-relay
|
|
4
4
|
*
|
|
5
5
|
* This script runs after npm install to:
|
|
6
|
-
* 1. Install
|
|
7
|
-
* 2.
|
|
6
|
+
* 1. Install dashboard-server and relay-acp binaries (parity with curl installer)
|
|
7
|
+
* 2. Rebuild better-sqlite3 / confirm SQLite driver
|
|
8
8
|
* 3. Patch agent-trajectories CLI
|
|
9
|
-
* 4.
|
|
9
|
+
* 4. Patch @relayauth/core exports for CommonJS require()
|
|
10
|
+
*
|
|
11
|
+
* The agent-relay-broker binary is no longer installed here — it ships as a
|
|
12
|
+
* platform-specific optional dependency of @agent-relay/sdk
|
|
13
|
+
* (`@agent-relay/broker-<platform>-<arch>`), resolved at runtime by the SDK.
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
16
|
import { execSync } from 'node:child_process';
|
|
@@ -325,132 +329,6 @@ function resignBinaryForMacOS(binaryPath) {
|
|
|
325
329
|
}
|
|
326
330
|
}
|
|
327
331
|
|
|
328
|
-
/**
|
|
329
|
-
* Get the platform-specific binary name for the broker binary.
|
|
330
|
-
* The broker binary is the Rust-compiled broker (not the Bun-compiled CLI).
|
|
331
|
-
* It is needed by the SDK (packages/sdk) for programmatic
|
|
332
|
-
* agent orchestration via `new AgentRelay()`.
|
|
333
|
-
* Returns null if platform is not supported.
|
|
334
|
-
*/
|
|
335
|
-
function getBrokerBinaryName() {
|
|
336
|
-
const platform = os.platform();
|
|
337
|
-
const arch = os.arch();
|
|
338
|
-
|
|
339
|
-
const archMap = { 'arm64': 'arm64', 'x64': 'x64' };
|
|
340
|
-
const platformMap = { 'darwin': 'darwin', 'linux': 'linux' };
|
|
341
|
-
|
|
342
|
-
const targetPlatform = platformMap[platform];
|
|
343
|
-
const targetArch = archMap[arch];
|
|
344
|
-
|
|
345
|
-
if (!targetPlatform || !targetArch) {
|
|
346
|
-
return null;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// Use the broker-specific release asset name (Rust binary, not Bun CLI)
|
|
350
|
-
return `agent-relay-broker-${targetPlatform}-${targetArch}`;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Install the broker binary into packages/sdk/bin/.
|
|
355
|
-
*
|
|
356
|
-
* The SDK's AgentRelayClient spawns this binary as a subprocess
|
|
357
|
-
* (`agent-relay-broker init --name broker --channels general`). Without it,
|
|
358
|
-
* `new AgentRelay()` will fail with "broker exited (code=1)".
|
|
359
|
-
*
|
|
360
|
-
* Resolution order:
|
|
361
|
-
* 1. Already bundled at packages/sdk/bin/agent-relay-broker (e.g. from prepack)
|
|
362
|
-
* 2. Platform-specific binary bundled in root bin/ (e.g. bin/agent-relay-broker-linux-x64)
|
|
363
|
-
* 3. Download platform-specific standalone binary from GitHub releases
|
|
364
|
-
* 4. Fall back to the local Rust debug binary at target/debug/agent-relay-broker (dev only)
|
|
365
|
-
*/
|
|
366
|
-
async function installBrokerBinary() {
|
|
367
|
-
const pkgRoot = getPackageRoot();
|
|
368
|
-
const sdkBinDir = path.join(pkgRoot, 'packages', 'sdk', 'bin');
|
|
369
|
-
const isWindows = process.platform === 'win32';
|
|
370
|
-
const binaryFilename = isWindows ? 'agent-relay-broker.exe' : 'agent-relay-broker';
|
|
371
|
-
const targetPath = path.join(sdkBinDir, binaryFilename);
|
|
372
|
-
|
|
373
|
-
// 1. Already installed? Verify it's the Rust broker (supports --name flag)
|
|
374
|
-
if (fs.existsSync(targetPath)) {
|
|
375
|
-
try {
|
|
376
|
-
const helpOutput = execSync(`"${targetPath}" init --help`, { stdio: 'pipe' }).toString();
|
|
377
|
-
// The Rust broker shows "--name <NAME>" in init --help
|
|
378
|
-
// The Bun-compiled Node.js CLI shows "First-time setup wizard"
|
|
379
|
-
if (helpOutput.includes('--name')) {
|
|
380
|
-
info('Broker binary already installed in SDK (Rust broker verified)');
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
// Wrong binary (Bun CLI instead of Rust broker) — reinstall
|
|
384
|
-
warn('Broker binary exists but is the CLI, not the Rust broker — reinstalling');
|
|
385
|
-
} catch {
|
|
386
|
-
// Binary exists but doesn't work — reinstall
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
fs.mkdirSync(sdkBinDir, { recursive: true });
|
|
391
|
-
|
|
392
|
-
const binaryName = getBrokerBinaryName();
|
|
393
|
-
|
|
394
|
-
// 2. Check for bundled platform-specific binary in root bin/
|
|
395
|
-
if (binaryName) {
|
|
396
|
-
const bundledBinary = path.join(pkgRoot, 'bin', binaryName);
|
|
397
|
-
if (fs.existsSync(bundledBinary)) {
|
|
398
|
-
try {
|
|
399
|
-
fs.copyFileSync(bundledBinary, targetPath);
|
|
400
|
-
fs.chmodSync(targetPath, 0o755);
|
|
401
|
-
resignBinaryForMacOS(targetPath);
|
|
402
|
-
success(`Installed broker binary from bundled package (${binaryName})`);
|
|
403
|
-
return true;
|
|
404
|
-
} catch (err) {
|
|
405
|
-
warn(`Failed to copy bundled broker binary: ${err.message}`);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// 3. Try downloading from GitHub releases
|
|
411
|
-
if (binaryName) {
|
|
412
|
-
const version = getPackageVersion(pkgRoot);
|
|
413
|
-
if (version) {
|
|
414
|
-
const downloadUrl = `https://github.com/AgentWorkforce/relay/releases/download/v${version}/${binaryName}`;
|
|
415
|
-
info(`Downloading broker binary from ${downloadUrl} ...`);
|
|
416
|
-
|
|
417
|
-
try {
|
|
418
|
-
await downloadBinary(downloadUrl, targetPath);
|
|
419
|
-
await verifyChecksum(targetPath, downloadUrl);
|
|
420
|
-
fs.chmodSync(targetPath, 0o755);
|
|
421
|
-
resignBinaryForMacOS(targetPath);
|
|
422
|
-
success(`Downloaded broker binary for ${os.platform()}-${os.arch()}`);
|
|
423
|
-
return true;
|
|
424
|
-
} catch (err) {
|
|
425
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
426
|
-
warn(`Failed to download broker binary: ${message}`);
|
|
427
|
-
// Clean up partial/untrusted download
|
|
428
|
-
try { fs.unlinkSync(targetPath); } catch { /* ignore */ }
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// 4. Dev fallback — check for local Rust build (release first, then debug)
|
|
434
|
-
for (const profile of ['release', 'debug']) {
|
|
435
|
-
const localBinary = path.join(pkgRoot, 'target', profile, binaryFilename);
|
|
436
|
-
if (fs.existsSync(localBinary)) {
|
|
437
|
-
try {
|
|
438
|
-
fs.copyFileSync(localBinary, targetPath);
|
|
439
|
-
fs.chmodSync(targetPath, 0o755);
|
|
440
|
-
resignBinaryForMacOS(targetPath);
|
|
441
|
-
success(`Installed broker binary from local Rust ${profile} build`);
|
|
442
|
-
return true;
|
|
443
|
-
} catch (err) {
|
|
444
|
-
warn(`Failed to copy ${profile} broker binary: ${err.message}`);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
warn('Broker binary not available — SDK programmatic usage (AgentRelay) will not work');
|
|
450
|
-
info('To fix: cargo build --release --bin agent-relay-broker (requires Rust toolchain)');
|
|
451
|
-
return false;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
332
|
/**
|
|
455
333
|
* Install the standalone dashboard-server binary.
|
|
456
334
|
*
|
|
@@ -811,7 +689,7 @@ function patchRelayauthCoreExports() {
|
|
|
811
689
|
}
|
|
812
690
|
}
|
|
813
691
|
|
|
814
|
-
function logPostinstallDiagnostics(
|
|
692
|
+
function logPostinstallDiagnostics(sqliteStatus, linkResult) {
|
|
815
693
|
// Workspace packages status (for global installs)
|
|
816
694
|
if (linkResult && linkResult.needed) {
|
|
817
695
|
if (linkResult.success) {
|
|
@@ -821,12 +699,6 @@ function logPostinstallDiagnostics(hasBrokerBinary, sqliteStatus, linkResult) {
|
|
|
821
699
|
}
|
|
822
700
|
}
|
|
823
701
|
|
|
824
|
-
if (hasBrokerBinary) {
|
|
825
|
-
console.log('✓ agent-relay-broker binary installed');
|
|
826
|
-
} else {
|
|
827
|
-
console.log('⚠ agent-relay-broker binary not installed - AgentRelay will not work');
|
|
828
|
-
}
|
|
829
|
-
|
|
830
702
|
if (sqliteStatus.ok && sqliteStatus.driver === 'better-sqlite3') {
|
|
831
703
|
console.log('✓ SQLite ready (better-sqlite3)');
|
|
832
704
|
} else if (sqliteStatus.ok && sqliteStatus.driver === 'node:sqlite') {
|
|
@@ -856,9 +728,6 @@ async function main() {
|
|
|
856
728
|
}
|
|
857
729
|
}
|
|
858
730
|
|
|
859
|
-
// Install broker binary for agent spawning and SDK programmatic usage
|
|
860
|
-
const hasBrokerBinary = await installBrokerBinary();
|
|
861
|
-
|
|
862
731
|
// Ensure SQLite driver is available (better-sqlite3 or node:sqlite)
|
|
863
732
|
const sqliteStatus = ensureSqliteDriver();
|
|
864
733
|
|
|
@@ -876,7 +745,7 @@ async function main() {
|
|
|
876
745
|
const hasAcpBinary = await installRelayAcpBinary();
|
|
877
746
|
|
|
878
747
|
// Always print diagnostics (even in CI)
|
|
879
|
-
logPostinstallDiagnostics(
|
|
748
|
+
logPostinstallDiagnostics(sqliteStatus, linkResult);
|
|
880
749
|
|
|
881
750
|
if (hasDashboardBinary) {
|
|
882
751
|
console.log('✓ dashboard-server binary installed');
|
|
@@ -884,12 +753,6 @@ async function main() {
|
|
|
884
753
|
if (hasAcpBinary) {
|
|
885
754
|
console.log('✓ relay-acp binary installed (Zed editor integration)');
|
|
886
755
|
}
|
|
887
|
-
|
|
888
|
-
if (!hasBrokerBinary) {
|
|
889
|
-
warn('agent-relay-broker binary not available');
|
|
890
|
-
info('Agent spawning will not work without the broker binary.');
|
|
891
|
-
info('To fix: cargo build --release --bin agent-relay-broker (requires Rust toolchain)');
|
|
892
|
-
}
|
|
893
756
|
}
|
|
894
757
|
|
|
895
758
|
main().catch((err) => {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|