@agent-relay/harness-driver 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/actions.d.ts +10 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +140 -0
- package/dist/actions.js.map +1 -0
- package/dist/broker-driver.d.ts +17 -0
- package/dist/broker-driver.d.ts.map +1 -0
- package/dist/broker-driver.js +56 -0
- package/dist/broker-driver.js.map +1 -0
- package/dist/broker-path.d.ts +31 -0
- package/dist/broker-path.d.ts.map +1 -0
- package/dist/broker-path.js +216 -0
- package/dist/broker-path.js.map +1 -0
- package/dist/client.d.ts +293 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +892 -0
- package/dist/client.js.map +1 -0
- package/dist/driver-types.d.ts +43 -0
- package/dist/driver-types.d.ts.map +1 -0
- package/dist/driver-types.js +2 -0
- package/dist/driver-types.js.map +1 -0
- package/dist/event-bus.d.ts +57 -0
- package/dist/event-bus.d.ts.map +1 -0
- package/dist/event-bus.js +76 -0
- package/dist/event-bus.js.map +1 -0
- package/dist/harness.d.ts +82 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +96 -0
- package/dist/harness.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle-hooks.d.ts +166 -0
- package/dist/lifecycle-hooks.d.ts.map +1 -0
- package/dist/lifecycle-hooks.js +25 -0
- package/dist/lifecycle-hooks.js.map +1 -0
- package/dist/protocol.d.ts +527 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +2 -0
- package/dist/protocol.js.map +1 -0
- package/dist/transport.d.ts +104 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +520 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @agent-relay/harness-driver
|
|
2
|
+
|
|
3
|
+
Managed harness runtime for Agent Relay.
|
|
4
|
+
|
|
5
|
+
Use this package when Agent Relay needs to own the harness boundary: attach,
|
|
6
|
+
wrap, spawn, inject messages into a runtime, observe readiness, and collect
|
|
7
|
+
logs. The core `@agent-relay/sdk` package owns messaging, delivery contracts,
|
|
8
|
+
and action protocol; this package provides optional managed runtime
|
|
9
|
+
implementations.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentRelayActions } from '@agent-relay/sdk/actions';
|
|
2
|
+
import type { AgentDriver } from './driver-types.js';
|
|
3
|
+
export interface RegisterDriverActionsOptions {
|
|
4
|
+
actionPrefix?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface RegisteredDriverActions {
|
|
7
|
+
unregister(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerDriverActions(actions: AgentRelayActions, driver: AgentDriver, options?: RegisterDriverActionsOptions): RegisteredDriverActions;
|
|
10
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,4BAA4B;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,IAAI,IAAI,CAAC;CACpB;AAiED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,4BAAiC,GACzC,uBAAuB,CA0GzB"}
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const createAgentSchema = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
required: ['name', 'cli'],
|
|
4
|
+
additionalProperties: false,
|
|
5
|
+
properties: {
|
|
6
|
+
name: { type: 'string', minLength: 1 },
|
|
7
|
+
cli: { type: 'string', minLength: 1 },
|
|
8
|
+
args: { type: 'array', items: { type: 'string' } },
|
|
9
|
+
channels: { type: 'array', items: { type: 'string' } },
|
|
10
|
+
task: { type: 'string' },
|
|
11
|
+
model: { type: 'string' },
|
|
12
|
+
cwd: { type: 'string' },
|
|
13
|
+
transport: { enum: ['pty', 'headless'] },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const releaseAgentSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
required: ['name'],
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
properties: {
|
|
21
|
+
name: { type: 'string', minLength: 1 },
|
|
22
|
+
reason: { type: 'string' },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const statusAgentSchema = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
required: ['name'],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
properties: {
|
|
30
|
+
name: { type: 'string', minLength: 1 },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function actionName(prefix, name) {
|
|
34
|
+
return prefix ? `${prefix}.${name}` : name;
|
|
35
|
+
}
|
|
36
|
+
export function registerDriverActions(actions, driver, options = {}) {
|
|
37
|
+
const prefix = options.actionPrefix ?? 'agent';
|
|
38
|
+
const runtimes = new Map();
|
|
39
|
+
const handles = [
|
|
40
|
+
actions.register({
|
|
41
|
+
name: actionName(prefix, 'create'),
|
|
42
|
+
description: 'Create a managed agent runtime through the Agent Relay driver.',
|
|
43
|
+
inputSchema: createAgentSchema,
|
|
44
|
+
outputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
required: ['agent', 'delivery'],
|
|
47
|
+
properties: {
|
|
48
|
+
agent: { type: 'object' },
|
|
49
|
+
delivery: { type: 'object' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
handler: async (input) => {
|
|
53
|
+
const runtime = await driver.spawn(input);
|
|
54
|
+
runtimes.set(runtime.agent.name, runtime);
|
|
55
|
+
return { agent: runtime.agent, delivery: runtime.delivery };
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
actions.register({
|
|
59
|
+
name: actionName(prefix, 'release'),
|
|
60
|
+
description: 'Release a managed agent runtime through the Agent Relay driver.',
|
|
61
|
+
inputSchema: releaseAgentSchema,
|
|
62
|
+
outputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
required: ['name', 'released'],
|
|
65
|
+
properties: {
|
|
66
|
+
name: { type: 'string' },
|
|
67
|
+
released: { type: 'boolean' },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
handler: async ({ name, reason }) => {
|
|
71
|
+
const runtime = runtimes.get(name);
|
|
72
|
+
if (runtime) {
|
|
73
|
+
await runtime.release(reason);
|
|
74
|
+
runtimes.delete(name);
|
|
75
|
+
}
|
|
76
|
+
else if (driver.release) {
|
|
77
|
+
await driver.release(name, reason);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Error(`Driver cannot release unmanaged runtime: ${name}`);
|
|
81
|
+
}
|
|
82
|
+
return { name, released: true };
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
actions.register({
|
|
86
|
+
name: actionName(prefix, 'status'),
|
|
87
|
+
description: 'Read managed agent runtime status through the Agent Relay driver.',
|
|
88
|
+
inputSchema: statusAgentSchema,
|
|
89
|
+
outputSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
required: ['name', 'status'],
|
|
92
|
+
properties: {
|
|
93
|
+
name: { type: 'string' },
|
|
94
|
+
status: { enum: ['idle', 'busy', 'offline', 'unknown'] },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
handler: async ({ name }) => {
|
|
98
|
+
const runtime = runtimes.get(name);
|
|
99
|
+
const status = driver.status
|
|
100
|
+
? await driver.status(name)
|
|
101
|
+
: runtime
|
|
102
|
+
? await runtime.status()
|
|
103
|
+
: 'offline';
|
|
104
|
+
return { name, status };
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
];
|
|
108
|
+
if (driver.attach) {
|
|
109
|
+
handles.push(actions.register({
|
|
110
|
+
name: actionName(prefix, 'attach'),
|
|
111
|
+
description: 'Attach an externally managed agent runtime through the Agent Relay driver.',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
required: ['name', 'kind'],
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
properties: {
|
|
117
|
+
name: { type: 'string', minLength: 1 },
|
|
118
|
+
kind: { type: 'string', minLength: 1 },
|
|
119
|
+
cwd: { type: 'string' },
|
|
120
|
+
endpoint: { type: 'string' },
|
|
121
|
+
metadata: { type: 'object' },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
handler: async (input) => {
|
|
125
|
+
const runtime = await driver.attach(input);
|
|
126
|
+
runtimes.set(runtime.agent.name, runtime);
|
|
127
|
+
return { agent: runtime.agent, delivery: runtime.delivery };
|
|
128
|
+
},
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
unregister: () => {
|
|
133
|
+
for (const handle of handles) {
|
|
134
|
+
handle.unregister();
|
|
135
|
+
}
|
|
136
|
+
runtimes.clear();
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAwCA,MAAM,iBAAiB,GAAe;IACpC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IACzB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,IAAI,EA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ACL,UAAU,EAAE,GAAG,EAAE;YACf,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,CAAC;YACD,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HarnessDriverClient, type RuntimeSpawnOptions } from './client.js';
|
|
2
|
+
import type { AgentDriver, DriverRuntimeStatus, SpawnRuntimeInput, SpawnedAgentRuntime } from './driver-types.js';
|
|
3
|
+
export interface BrokerDriverOptions extends RuntimeSpawnOptions {
|
|
4
|
+
client?: HarnessDriverClient;
|
|
5
|
+
}
|
|
6
|
+
export declare class BrokerDriver implements AgentDriver {
|
|
7
|
+
private readonly options;
|
|
8
|
+
readonly kind = "broker";
|
|
9
|
+
private client?;
|
|
10
|
+
constructor(options?: BrokerDriverOptions);
|
|
11
|
+
spawn(input: SpawnRuntimeInput): Promise<SpawnedAgentRuntime>;
|
|
12
|
+
private ensureClient;
|
|
13
|
+
private runtimeHandle;
|
|
14
|
+
release(name: string, reason?: string): Promise<void>;
|
|
15
|
+
status(name: string): Promise<DriverRuntimeStatus>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=broker-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-driver.d.ts","sourceRoot":"","sources":["../src/broker-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAkB3B,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,qBAAa,YAAa,YAAW,WAAW;IAKlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,QAAQ,CAAC,IAAI,YAAY;IAEzB,OAAO,CAAC,MAAM,CAAC,CAAsB;gBAER,OAAO,GAAE,mBAAwB;IAIxD,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAUrD,YAAY;IAO1B,OAAO,CAAC,aAAa;IAWf,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAKzD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HarnessDriverClient } from './client.js';
|
|
2
|
+
function statusFromManagedAgent(agent) {
|
|
3
|
+
if (!agent) {
|
|
4
|
+
return 'offline';
|
|
5
|
+
}
|
|
6
|
+
const currentState = 'current_state' in agent && typeof agent.current_state === 'string' ? agent.current_state : undefined;
|
|
7
|
+
if (currentState === 'working' || currentState === 'blocked_on_send') {
|
|
8
|
+
return 'busy';
|
|
9
|
+
}
|
|
10
|
+
if (currentState === 'idle') {
|
|
11
|
+
return 'idle';
|
|
12
|
+
}
|
|
13
|
+
return 'unknown';
|
|
14
|
+
}
|
|
15
|
+
export class BrokerDriver {
|
|
16
|
+
options;
|
|
17
|
+
kind = 'broker';
|
|
18
|
+
client;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.client = options.client;
|
|
22
|
+
}
|
|
23
|
+
async spawn(input) {
|
|
24
|
+
const client = await this.ensureClient();
|
|
25
|
+
const transport = input.transport ?? 'pty';
|
|
26
|
+
const { transport: _transport, ...spawnInput } = input;
|
|
27
|
+
const result = transport === 'headless' ? await client.spawnHeadless(spawnInput) : await client.spawnPty(spawnInput);
|
|
28
|
+
return this.runtimeHandle(client, result);
|
|
29
|
+
}
|
|
30
|
+
async ensureClient() {
|
|
31
|
+
if (!this.client) {
|
|
32
|
+
this.client = await HarnessDriverClient.spawn(this.options);
|
|
33
|
+
}
|
|
34
|
+
return this.client;
|
|
35
|
+
}
|
|
36
|
+
runtimeHandle(client, result) {
|
|
37
|
+
return {
|
|
38
|
+
agent: { name: result.name, id: result.sessionId },
|
|
39
|
+
delivery: { mode: 'managed' },
|
|
40
|
+
status: async () => this.status(result.name),
|
|
41
|
+
release: async (reason) => {
|
|
42
|
+
await client.release(result.name, reason);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async release(name, reason) {
|
|
47
|
+
const client = await this.ensureClient();
|
|
48
|
+
await client.release(name, reason);
|
|
49
|
+
}
|
|
50
|
+
async status(name) {
|
|
51
|
+
const client = await this.ensureClient();
|
|
52
|
+
const agents = await client.listAgents();
|
|
53
|
+
return statusFromManagedAgent(agents.find((agent) => agent.name === name));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=broker-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-driver.js","sourceRoot":"","sources":["../src/broker-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA4B,MAAM,aAAa,CAAC;AAS5E,SAAS,sBAAsB,CAAC,KAA+C;IAC7E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAChB,eAAe,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,iBAAiB,EAAE,CAAC;QACrE,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,SAAS,CAAC;AAC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E,KAAK,EAAE,MAAe,EAAE,EAAE;gBACjC,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,MAAe;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QACzC,OAAO,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the agent-relay-broker binary path at runtime.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { getBrokerBinaryPath } from '@agent-relay/harness-driver/broker-path';
|
|
6
|
+
* const binPath = getBrokerBinaryPath();
|
|
7
|
+
*/
|
|
8
|
+
export declare function getOptionalDepPackageName(platform?: NodeJS.Platform, arch?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the agent-relay-broker binary path.
|
|
11
|
+
*
|
|
12
|
+
* Search order:
|
|
13
|
+
* 1. Explicit env override (BROKER_BINARY_PATH / AGENT_RELAY_BIN)
|
|
14
|
+
* 2. Local Cargo build when the runtime is loaded from an agent-relay source
|
|
15
|
+
* checkout
|
|
16
|
+
* 3. Platform-specific optional-dep package
|
|
17
|
+
* (`@agent-relay/broker-<platform>-<arch>`) — primary production path
|
|
18
|
+
* 4. Cargo development paths (target/release and target/debug)
|
|
19
|
+
* 5. PATH lookup via `which` / `where`
|
|
20
|
+
*
|
|
21
|
+
* @returns Absolute path to the broker binary, or null if not found
|
|
22
|
+
*/
|
|
23
|
+
export declare function getBrokerBinaryPath(): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Human-readable error message explaining that the optional-dep broker
|
|
26
|
+
* package for the current platform/arch isn't installed. Used by the SDK
|
|
27
|
+
* at broker-spawn time so users get a clear message instead of an
|
|
28
|
+
* inscrutable `spawn agent-relay-broker ENOENT`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatBrokerNotFoundError(): string;
|
|
31
|
+
//# sourceMappingURL=broker-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-path.d.ts","sourceRoot":"","sources":["../src/broker-path.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,wBAAgB,yBAAyB,CACvC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAqB,GAC1B,MAAM,CAER;AAyJD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CA8CnD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CASlD"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the agent-relay-broker binary path at runtime.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { getBrokerBinaryPath } from '@agent-relay/harness-driver/broker-path';
|
|
6
|
+
* const binPath = getBrokerBinaryPath();
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
9
|
+
import { join, dirname, resolve } from 'node:path';
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
const BROKER_NAME = 'agent-relay-broker';
|
|
14
|
+
export function getOptionalDepPackageName(platform = process.platform, arch = process.arch) {
|
|
15
|
+
return `@agent-relay/broker-${platform}-${arch}`;
|
|
16
|
+
}
|
|
17
|
+
function addUniquePath(paths, candidate) {
|
|
18
|
+
if (!candidate || paths.includes(candidate)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
paths.push(candidate);
|
|
22
|
+
}
|
|
23
|
+
function getImportMetaUrl() {
|
|
24
|
+
try {
|
|
25
|
+
return import.meta.url;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function getCurrentModuleDir() {
|
|
32
|
+
if (typeof __dirname === 'string' && __dirname) {
|
|
33
|
+
return __dirname;
|
|
34
|
+
}
|
|
35
|
+
if (typeof __filename === 'string' && __filename) {
|
|
36
|
+
return dirname(__filename);
|
|
37
|
+
}
|
|
38
|
+
const importMetaUrl = getImportMetaUrl();
|
|
39
|
+
if (!importMetaUrl) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return dirname(fileURLToPath(importMetaUrl));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getCurrentModuleReference() {
|
|
50
|
+
if (typeof __filename === 'string' && __filename) {
|
|
51
|
+
return __filename;
|
|
52
|
+
}
|
|
53
|
+
if (typeof __dirname === 'string' && __dirname) {
|
|
54
|
+
return join(__dirname, 'broker-path.js');
|
|
55
|
+
}
|
|
56
|
+
return getImportMetaUrl();
|
|
57
|
+
}
|
|
58
|
+
function getResolutionReferences() {
|
|
59
|
+
const refs = [];
|
|
60
|
+
addUniquePath(refs, getCurrentModuleReference());
|
|
61
|
+
// Also try the entry script so CLI consumers and bundled installs
|
|
62
|
+
// (where the SDK lives under the consuming package's node_modules) can
|
|
63
|
+
// still find the optional-dep package.
|
|
64
|
+
if (process.argv[1]) {
|
|
65
|
+
addUniquePath(refs, process.argv[1]);
|
|
66
|
+
}
|
|
67
|
+
// Fall back to the cwd's package.json as a final resolution anchor.
|
|
68
|
+
// `createRequire` only needs a file path that sits inside a project root
|
|
69
|
+
// — it doesn't have to exist. This catches setups where the SDK's module
|
|
70
|
+
// path and the entry script both sit outside the consumer's node_modules
|
|
71
|
+
// tree (e.g. a globally-installed SDK importing per-project optional deps,
|
|
72
|
+
// some vite/webpack bundling configurations, repl experimentation), but
|
|
73
|
+
// the consumer's cwd is inside their own project. We only use this
|
|
74
|
+
// reference to run require.resolve; no file I/O is triggered on misses.
|
|
75
|
+
addUniquePath(refs, join(process.cwd(), 'package.json'));
|
|
76
|
+
return refs;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve the broker binary via the platform-specific optional-dependency
|
|
80
|
+
* package (`@agent-relay/broker-<platform>-<arch>`). Returns null when the
|
|
81
|
+
* optional dep is not installed (expected when users install with
|
|
82
|
+
* --no-optional / --omit=optional / --include= omits optional, or when the
|
|
83
|
+
* broker hasn't been published for their platform yet).
|
|
84
|
+
*/
|
|
85
|
+
function getOptionalDepBinaryPath(ext) {
|
|
86
|
+
const pkgName = getOptionalDepPackageName();
|
|
87
|
+
const binaryFile = `${BROKER_NAME}${ext}`;
|
|
88
|
+
for (const ref of getResolutionReferences()) {
|
|
89
|
+
try {
|
|
90
|
+
const pkgJsonPath = createRequire(ref).resolve(`${pkgName}/package.json`);
|
|
91
|
+
const binPath = join(dirname(pkgJsonPath), 'bin', binaryFile);
|
|
92
|
+
if (existsSync(binPath))
|
|
93
|
+
return binPath;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Try the next reference.
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function findAncestorSourceCheckoutRoot(start) {
|
|
102
|
+
let current = resolve(start);
|
|
103
|
+
for (let i = 0; i < 8; i++) {
|
|
104
|
+
if (isSourceCheckoutRoot(current)) {
|
|
105
|
+
return current;
|
|
106
|
+
}
|
|
107
|
+
const parent = resolve(current, '..');
|
|
108
|
+
if (parent === current)
|
|
109
|
+
break;
|
|
110
|
+
current = parent;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
function getDevelopmentBinaryPaths(ext) {
|
|
115
|
+
const binaryPaths = [];
|
|
116
|
+
const repoRoots = new Set();
|
|
117
|
+
const addRepoRoot = (candidate) => {
|
|
118
|
+
if (!candidate) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const repoRoot = resolve(candidate);
|
|
122
|
+
if (repoRoots.has(repoRoot)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
repoRoots.add(repoRoot);
|
|
126
|
+
addUniquePath(binaryPaths, join(repoRoot, 'target', 'release', `${BROKER_NAME}${ext}`));
|
|
127
|
+
addUniquePath(binaryPaths, join(repoRoot, 'target', 'debug', `${BROKER_NAME}${ext}`));
|
|
128
|
+
};
|
|
129
|
+
addRepoRoot(process.cwd());
|
|
130
|
+
addRepoRoot(findAncestorSourceCheckoutRoot(process.cwd()));
|
|
131
|
+
const currentModuleDir = getCurrentModuleDir();
|
|
132
|
+
if (currentModuleDir) {
|
|
133
|
+
addRepoRoot(resolve(currentModuleDir, '..', '..', '..'));
|
|
134
|
+
}
|
|
135
|
+
return binaryPaths;
|
|
136
|
+
}
|
|
137
|
+
function isSourceCheckoutRoot(candidate) {
|
|
138
|
+
const repoRoot = resolve(candidate);
|
|
139
|
+
return (existsSync(join(repoRoot, 'Cargo.toml')) &&
|
|
140
|
+
existsSync(join(repoRoot, 'crates', 'broker', 'src', 'main.rs')) &&
|
|
141
|
+
existsSync(join(repoRoot, 'packages', 'runtime', 'package.json')));
|
|
142
|
+
}
|
|
143
|
+
function getSourceCheckoutBinaryPaths(ext) {
|
|
144
|
+
return getDevelopmentBinaryPaths(ext).filter((binaryPath) => isSourceCheckoutRoot(resolve(dirname(binaryPath), '..', '..')));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve the agent-relay-broker binary path.
|
|
148
|
+
*
|
|
149
|
+
* Search order:
|
|
150
|
+
* 1. Explicit env override (BROKER_BINARY_PATH / AGENT_RELAY_BIN)
|
|
151
|
+
* 2. Local Cargo build when the runtime is loaded from an agent-relay source
|
|
152
|
+
* checkout
|
|
153
|
+
* 3. Platform-specific optional-dep package
|
|
154
|
+
* (`@agent-relay/broker-<platform>-<arch>`) — primary production path
|
|
155
|
+
* 4. Cargo development paths (target/release and target/debug)
|
|
156
|
+
* 5. PATH lookup via `which` / `where`
|
|
157
|
+
*
|
|
158
|
+
* @returns Absolute path to the broker binary, or null if not found
|
|
159
|
+
*/
|
|
160
|
+
export function getBrokerBinaryPath() {
|
|
161
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
162
|
+
const override = process.env.BROKER_BINARY_PATH ?? process.env.AGENT_RELAY_BIN;
|
|
163
|
+
if (override) {
|
|
164
|
+
const resolvedOverride = resolve(override);
|
|
165
|
+
if (existsSync(resolvedOverride)) {
|
|
166
|
+
return resolvedOverride;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// 1. Prefer a local Cargo build when this runtime is being used from a source checkout.
|
|
170
|
+
for (const developmentPath of getSourceCheckoutBinaryPaths(ext)) {
|
|
171
|
+
if (existsSync(developmentPath)) {
|
|
172
|
+
return developmentPath;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// 2. Platform-specific optional-dep package — the primary production path.
|
|
176
|
+
const optionalDepBinary = getOptionalDepBinaryPath(ext);
|
|
177
|
+
if (optionalDepBinary) {
|
|
178
|
+
return optionalDepBinary;
|
|
179
|
+
}
|
|
180
|
+
// 3. Common development paths for local Cargo builds.
|
|
181
|
+
for (const developmentPath of getDevelopmentBinaryPaths(ext)) {
|
|
182
|
+
if (existsSync(developmentPath)) {
|
|
183
|
+
return developmentPath;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// 4. PATH lookup.
|
|
187
|
+
try {
|
|
188
|
+
const cmd = process.platform === 'win32' ? 'where' : 'which';
|
|
189
|
+
const result = execFileSync(cmd, [BROKER_NAME], {
|
|
190
|
+
encoding: 'utf-8',
|
|
191
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
192
|
+
}).trim();
|
|
193
|
+
if (result) {
|
|
194
|
+
return result.split(/\r?\n/u)[0].trim();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
// Not found on PATH
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Human-readable error message explaining that the optional-dep broker
|
|
204
|
+
* package for the current platform/arch isn't installed. Used by the SDK
|
|
205
|
+
* at broker-spawn time so users get a clear message instead of an
|
|
206
|
+
* inscrutable `spawn agent-relay-broker ENOENT`.
|
|
207
|
+
*/
|
|
208
|
+
export function formatBrokerNotFoundError() {
|
|
209
|
+
const pkgName = getOptionalDepPackageName();
|
|
210
|
+
return (`@agent-relay/harness-driver couldn't find an agent-relay-broker binary for ` +
|
|
211
|
+
`${process.platform}-${process.arch}. The optional dependency ` +
|
|
212
|
+
`${pkgName} is expected to be installed alongside @agent-relay/harness-driver. ` +
|
|
213
|
+
`Try reinstalling with --include=optional, or set BROKER_BINARY_PATH ` +
|
|
214
|
+
`to point at a broker binary you've downloaded manually.`);
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=broker-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-path.js","sourceRoot":"","sources":["../src/broker-path.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,E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