awb-agent-manager 1.6.76 → 1.6.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +18 -9
  2. package/dist/lib/agent-manager-commands.d.ts +2 -0
  3. package/dist/lib/agent-manager-commands.js +31 -13
  4. package/dist/lib/agent-manager-commands.js.map +1 -1
  5. package/dist/lib/cli-adapters/index.d.ts +3 -0
  6. package/dist/lib/cli-adapters/index.js +12 -3
  7. package/dist/lib/cli-adapters/index.js.map +1 -1
  8. package/dist/lib/constants.d.ts +1 -0
  9. package/dist/lib/constants.js +1 -0
  10. package/dist/lib/constants.js.map +1 -1
  11. package/dist/lib/event-dispatcher.d.ts +4 -0
  12. package/dist/lib/event-dispatcher.js +146 -0
  13. package/dist/lib/event-dispatcher.js.map +1 -1
  14. package/dist/lib/instance-heartbeat.d.ts +3 -0
  15. package/dist/lib/instance-heartbeat.js +4 -0
  16. package/dist/lib/instance-heartbeat.js.map +1 -1
  17. package/dist/lib/managed-agent-context.d.ts +2 -0
  18. package/dist/lib/managed-agent-context.js +1 -0
  19. package/dist/lib/managed-agent-context.js.map +1 -1
  20. package/dist/lib/managed-agent-store.d.ts +2 -0
  21. package/dist/lib/managed-agent-store.js.map +1 -1
  22. package/dist/lib/orphan-cleanup.d.ts +1 -0
  23. package/dist/lib/orphan-cleanup.js +56 -1
  24. package/dist/lib/orphan-cleanup.js.map +1 -1
  25. package/dist/lib/outbox.d.ts +28 -0
  26. package/dist/lib/outbox.js +169 -0
  27. package/dist/lib/outbox.js.map +1 -0
  28. package/dist/lib/rest.d.ts +36 -2
  29. package/dist/lib/rest.js +78 -6
  30. package/dist/lib/rest.js.map +1 -1
  31. package/dist/lib/runtime/acp/acp-client.d.ts +29 -0
  32. package/dist/lib/runtime/acp/acp-client.js +227 -0
  33. package/dist/lib/runtime/acp/acp-client.js.map +1 -0
  34. package/dist/lib/runtime/acp/acp-types.d.ts +118 -0
  35. package/dist/lib/runtime/acp/acp-types.js +2 -0
  36. package/dist/lib/runtime/acp/acp-types.js.map +1 -0
  37. package/dist/lib/runtime/acp/json-rpc-peer.d.ts +34 -0
  38. package/dist/lib/runtime/acp/json-rpc-peer.js +262 -0
  39. package/dist/lib/runtime/acp/json-rpc-peer.js.map +1 -0
  40. package/dist/lib/runtime/collaboration-governor.d.ts +29 -0
  41. package/dist/lib/runtime/collaboration-governor.js +125 -0
  42. package/dist/lib/runtime/collaboration-governor.js.map +1 -0
  43. package/dist/lib/runtime/hermes/hermes-process.d.ts +26 -0
  44. package/dist/lib/runtime/hermes/hermes-process.js +128 -0
  45. package/dist/lib/runtime/hermes/hermes-process.js.map +1 -0
  46. package/dist/lib/runtime/hermes/hermes-runtime.d.ts +38 -0
  47. package/dist/lib/runtime/hermes/hermes-runtime.js +146 -0
  48. package/dist/lib/runtime/hermes/hermes-runtime.js.map +1 -0
  49. package/dist/lib/runtime/hermes/hermes-session-store.d.ts +29 -0
  50. package/dist/lib/runtime/hermes/hermes-session-store.js +96 -0
  51. package/dist/lib/runtime/hermes/hermes-session-store.js.map +1 -0
  52. package/dist/lib/runtime/runtime-events.d.ts +48 -0
  53. package/dist/lib/runtime/runtime-events.js +2 -0
  54. package/dist/lib/runtime/runtime-events.js.map +1 -0
  55. package/dist/lib/runtime/runtime-health.d.ts +22 -0
  56. package/dist/lib/runtime/runtime-health.js +105 -0
  57. package/dist/lib/runtime/runtime-health.js.map +1 -0
  58. package/dist/lib/runtime/runtime-registry.d.ts +7 -0
  59. package/dist/lib/runtime/runtime-registry.js +142 -0
  60. package/dist/lib/runtime/runtime-registry.js.map +1 -0
  61. package/dist/lib/runtime/runtime-supervisor.d.ts +54 -0
  62. package/dist/lib/runtime/runtime-supervisor.js +234 -0
  63. package/dist/lib/runtime/runtime-supervisor.js.map +1 -0
  64. package/dist/lib/runtime/runtime-types.d.ts +36 -0
  65. package/dist/lib/runtime/runtime-types.js +11 -0
  66. package/dist/lib/runtime/runtime-types.js.map +1 -0
  67. package/dist/lib/service-install.js +1 -1
  68. package/dist/lib/setup.js +1 -1
  69. package/dist/lib/setup.js.map +1 -1
  70. package/dist/lib/skills/skill-materializer.d.ts +23 -0
  71. package/dist/lib/skills/skill-materializer.js +82 -0
  72. package/dist/lib/skills/skill-materializer.js.map +1 -0
  73. package/dist/lib/ticket-ref-capture.js +1 -0
  74. package/dist/lib/ticket-ref-capture.js.map +1 -1
  75. package/dist/main.js +110 -19
  76. package/dist/main.js.map +1 -1
  77. package/dist/package.json +2 -2
  78. package/package.json +2 -2
@@ -0,0 +1,96 @@
1
+ import { promises as fsp } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ export class HermesSessionOwnershipError extends Error {
4
+ code;
5
+ constructor(code, message) {
6
+ super(message);
7
+ this.name = 'HermesSessionOwnershipError';
8
+ this.code = code;
9
+ }
10
+ }
11
+ export class HermesSessionStore {
12
+ #path;
13
+ #records = new Map();
14
+ #loaded = false;
15
+ #writeQueue = Promise.resolve();
16
+ constructor(path) {
17
+ this.#path = path;
18
+ }
19
+ async load() {
20
+ if (this.#loaded)
21
+ return;
22
+ this.#loaded = true;
23
+ try {
24
+ const parsed = JSON.parse(await fsp.readFile(this.#path, 'utf8'));
25
+ if (!Array.isArray(parsed))
26
+ return;
27
+ for (const value of parsed) {
28
+ if (value
29
+ && typeof value === 'object'
30
+ && typeof value.runId === 'string'
31
+ && typeof value.agentId === 'string'
32
+ && typeof value.sessionId === 'string'
33
+ && typeof value.leaseId === 'string'
34
+ && typeof value.cwd === 'string') {
35
+ this.#records.set(value.runId, {
36
+ ...value,
37
+ cwd: resolve(value.cwd),
38
+ });
39
+ }
40
+ }
41
+ }
42
+ catch (error) {
43
+ if (error?.code !== 'ENOENT')
44
+ throw error;
45
+ }
46
+ }
47
+ get(runId) {
48
+ return this.#records.get(runId) ?? null;
49
+ }
50
+ require(identity) {
51
+ const record = this.#records.get(identity.runId);
52
+ if (!record) {
53
+ throw new HermesSessionOwnershipError('hermes_session_not_found', `No Hermes session is recorded for run ${identity.runId}`);
54
+ }
55
+ if (record.agentId !== identity.agentId) {
56
+ throw new HermesSessionOwnershipError('hermes_session_owner_mismatch', `Hermes session for run ${identity.runId} belongs to another Agent`);
57
+ }
58
+ if (record.leaseId !== identity.leaseId) {
59
+ throw new HermesSessionOwnershipError('hermes_session_lease_mismatch', `Hermes session for run ${identity.runId} belongs to another worktree lease`);
60
+ }
61
+ if (resolve(record.cwd) !== resolve(identity.cwd)) {
62
+ throw new HermesSessionOwnershipError('hermes_session_cwd_mismatch', `Hermes session for run ${identity.runId} belongs to another working directory`);
63
+ }
64
+ return record;
65
+ }
66
+ async set(identity, sessionId) {
67
+ const now = new Date().toISOString();
68
+ const existing = this.#records.get(identity.runId);
69
+ const record = {
70
+ ...identity,
71
+ cwd: resolve(identity.cwd),
72
+ sessionId,
73
+ createdAt: existing?.createdAt ?? now,
74
+ updatedAt: now,
75
+ };
76
+ this.#records.set(identity.runId, record);
77
+ await this.#persist();
78
+ return record;
79
+ }
80
+ async delete(runId) {
81
+ const deleted = this.#records.delete(runId);
82
+ if (deleted)
83
+ await this.#persist();
84
+ return deleted;
85
+ }
86
+ #persist() {
87
+ this.#writeQueue = this.#writeQueue.then(async () => {
88
+ await fsp.mkdir(dirname(this.#path), { recursive: true, mode: 0o700 });
89
+ const temp = `${this.#path}.${process.pid}.tmp`;
90
+ await fsp.writeFile(temp, JSON.stringify(Array.from(this.#records.values()), null, 2), { mode: 0o600 });
91
+ await fsp.rename(temp, this.#path);
92
+ });
93
+ return this.#writeQueue;
94
+ }
95
+ }
96
+ //# sourceMappingURL=hermes-session-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hermes-session-store.js","sourceRoot":"","sources":["../../../../src/lib/runtime/hermes/hermes-session-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,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AC,CAAC,EAC3D,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAC;YACF,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ export type RuntimeEvent = {
2
+ type: 'message_delta';
3
+ sessionId: string;
4
+ text: string;
5
+ } | {
6
+ type: 'reasoning_delta';
7
+ sessionId: string;
8
+ text: string;
9
+ } | {
10
+ type: 'tool_started';
11
+ sessionId: string;
12
+ toolCallId: string;
13
+ title: string;
14
+ kind?: string;
15
+ input?: unknown;
16
+ } | {
17
+ type: 'tool_updated' | 'tool_completed';
18
+ sessionId: string;
19
+ toolCallId: string;
20
+ status?: string;
21
+ output?: unknown;
22
+ } | {
23
+ type: 'usage';
24
+ sessionId: string;
25
+ inputTokens: number;
26
+ outputTokens: number;
27
+ totalTokens: number;
28
+ cachedReadTokens?: number;
29
+ thoughtTokens?: number;
30
+ } | {
31
+ type: 'diagnostic';
32
+ method: string;
33
+ sessionId?: string;
34
+ data?: unknown;
35
+ } | {
36
+ type: 'child_started';
37
+ sessionId: string;
38
+ childRunId: string;
39
+ title: string;
40
+ kind?: string;
41
+ input?: unknown;
42
+ } | {
43
+ type: 'child_finished';
44
+ sessionId: string;
45
+ childRunId: string;
46
+ status: 'completed' | 'failed' | 'cancelled';
47
+ output?: unknown;
48
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtime-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-events.js","sourceRoot":"","sources":["../../../src/lib/runtime/runtime-events.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import type { RuntimeCapabilities } from './runtime-types.js';
2
+ export interface RuntimeProbeResult {
3
+ installed: boolean;
4
+ healthy: boolean;
5
+ version: string | null;
6
+ reason: string | null;
7
+ }
8
+ export interface RuntimeHealth extends RuntimeProbeResult {
9
+ capabilities: RuntimeCapabilities;
10
+ }
11
+ export type RuntimeCapabilityReport = Record<string, RuntimeHealth>;
12
+ export interface RuntimeProbeCommand {
13
+ command: string;
14
+ args: string[];
15
+ }
16
+ export interface RuntimeDiscoveryOptions {
17
+ resolveCommand?: (runtimeId: string) => RuntimeProbeCommand;
18
+ probe?: (command: string, args: string[]) => Promise<RuntimeProbeResult>;
19
+ }
20
+ export declare function resolveRuntimeProbeCommand(runtimeId: string): RuntimeProbeCommand;
21
+ export declare function probeRuntimeCommand(command: string, args: string[]): Promise<RuntimeProbeResult>;
22
+ export declare function discoverRuntimeCapabilities(options?: RuntimeDiscoveryOptions): Promise<RuntimeCapabilityReport>;
@@ -0,0 +1,105 @@
1
+ import crossSpawn from 'cross-spawn';
2
+ import { createAdapter } from '../cli-adapters/index.js';
3
+ import { getRuntimeDescriptor, KNOWN_RUNTIME_IDS, } from './runtime-registry.js';
4
+ const PROBE_TIMEOUT_MS = 2_500;
5
+ const MAX_PROBE_OUTPUT = 16 * 1024;
6
+ function firstVersionLine(output) {
7
+ const line = output
8
+ .split(/\r?\n/)
9
+ .map((value) => value.trim())
10
+ .find(Boolean);
11
+ return line ? line.slice(0, 160) : null;
12
+ }
13
+ export function resolveRuntimeProbeCommand(runtimeId) {
14
+ if (runtimeId === 'hermes') {
15
+ return {
16
+ command: process.env.HERMES_ACP_COMMAND?.trim() || 'hermes-acp',
17
+ args: ['--help'],
18
+ };
19
+ }
20
+ return {
21
+ command: createAdapter(runtimeId).resolveBin(),
22
+ args: ['--version'],
23
+ };
24
+ }
25
+ export async function probeRuntimeCommand(command, args) {
26
+ return new Promise((resolve) => {
27
+ let settled = false;
28
+ let output = '';
29
+ let started = false;
30
+ const finish = (result) => {
31
+ if (settled)
32
+ return;
33
+ settled = true;
34
+ clearTimeout(timer);
35
+ resolve(result);
36
+ };
37
+ const child = crossSpawn(command, args, {
38
+ windowsHide: true,
39
+ stdio: ['ignore', 'pipe', 'pipe'],
40
+ });
41
+ child.once('spawn', () => {
42
+ started = true;
43
+ });
44
+ const append = (chunk) => {
45
+ if (output.length >= MAX_PROBE_OUTPUT)
46
+ return;
47
+ output += String(chunk).slice(0, MAX_PROBE_OUTPUT - output.length);
48
+ };
49
+ child.stdout?.on('data', append);
50
+ child.stderr?.on('data', append);
51
+ child.once('error', (error) => {
52
+ finish({
53
+ installed: false,
54
+ healthy: false,
55
+ version: null,
56
+ reason: error.code === 'ENOENT' ? 'not_found' : 'not_executable',
57
+ });
58
+ });
59
+ child.once('close', (code) => {
60
+ finish({
61
+ installed: true,
62
+ healthy: code === 0,
63
+ version: firstVersionLine(output),
64
+ reason: code === 0 ? null : 'probe_failed',
65
+ });
66
+ });
67
+ const timer = setTimeout(() => {
68
+ if (started)
69
+ child.kill();
70
+ finish({
71
+ installed: started,
72
+ healthy: false,
73
+ version: firstVersionLine(output),
74
+ reason: 'probe_timeout',
75
+ });
76
+ }, PROBE_TIMEOUT_MS);
77
+ timer.unref?.();
78
+ });
79
+ }
80
+ export async function discoverRuntimeCapabilities(options = {}) {
81
+ const resolveCommand = options.resolveCommand ?? resolveRuntimeProbeCommand;
82
+ const probe = options.probe ?? probeRuntimeCommand;
83
+ const rows = await Promise.all(KNOWN_RUNTIME_IDS.map(async (runtimeId) => {
84
+ const capabilities = getRuntimeDescriptor(runtimeId).capabilities;
85
+ try {
86
+ const { command, args } = resolveCommand(runtimeId);
87
+ const result = await probe(command, args);
88
+ return [runtimeId, { ...result, capabilities }];
89
+ }
90
+ catch {
91
+ return [
92
+ runtimeId,
93
+ {
94
+ installed: false,
95
+ healthy: false,
96
+ version: null,
97
+ reason: 'probe_unavailable',
98
+ capabilities,
99
+ },
100
+ ];
101
+ }
102
+ }));
103
+ return Object.fromEntries(rows);
104
+ }
105
+ //# sourceMappingURL=runtime-health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-health.js","sourceRoot":"","sources":["../../../src/lib/runtime/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AAO;gBACL,SAAS;gBACT;oBACE,SAAS,EAAE,KAAK;oBAChB,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,mBAAmB;oBAC3B,YAAY;iBACb;aACO,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type AgentRuntimeConfig, type RuntimeDescriptor } from './runtime-types.js';
2
+ import { HermesRuntime, type HermesRuntimeOptions } from './hermes/hermes-runtime.js';
3
+ export declare const KNOWN_RUNTIME_IDS: readonly string[];
4
+ export type RuntimeOwner = HermesRuntime;
5
+ export declare function createRuntimeOwner(runtimeId: string, options: HermesRuntimeOptions): RuntimeOwner;
6
+ export declare function getRuntimeDescriptor(runtimeId: string | null | undefined): RuntimeDescriptor;
7
+ export declare function validateRuntimeConfig(runtimeId: string, input: unknown): AgentRuntimeConfig;
@@ -0,0 +1,142 @@
1
+ import { RuntimeSelectionError, } from './runtime-types.js';
2
+ import { HermesRuntime, } from './hermes/hermes-runtime.js';
3
+ const CLI_NATIVE_MCP = {
4
+ protocol: 'stream-json',
5
+ session: 'persistent',
6
+ native_mcp: true,
7
+ native_approvals: false,
8
+ steering: true,
9
+ cancellation: true,
10
+ usage: 'tokens-and-cost',
11
+ collaboration: [],
12
+ skill_delivery: ['prompt', 'filesystem'],
13
+ };
14
+ const DESCRIPTORS = new Map([
15
+ ['claude', { id: 'claude', capabilities: CLI_NATIVE_MCP }],
16
+ ['deepseek', { id: 'deepseek', capabilities: { ...CLI_NATIVE_MCP } }],
17
+ ['codex', {
18
+ id: 'codex',
19
+ capabilities: {
20
+ protocol: 'jsonl',
21
+ session: 'oneshot',
22
+ native_mcp: true,
23
+ native_approvals: false,
24
+ steering: false,
25
+ cancellation: true,
26
+ usage: 'tokens',
27
+ collaboration: [],
28
+ skill_delivery: ['prompt', 'filesystem'],
29
+ },
30
+ }],
31
+ ['antigravity', {
32
+ id: 'antigravity',
33
+ capabilities: {
34
+ protocol: 'jsonl',
35
+ session: 'oneshot',
36
+ native_mcp: false,
37
+ native_approvals: false,
38
+ steering: false,
39
+ cancellation: true,
40
+ usage: 'none',
41
+ collaboration: [],
42
+ skill_delivery: ['prompt'],
43
+ },
44
+ }],
45
+ ['pi', {
46
+ id: 'pi',
47
+ capabilities: {
48
+ protocol: 'jsonl',
49
+ session: 'oneshot',
50
+ native_mcp: true,
51
+ native_approvals: false,
52
+ steering: false,
53
+ cancellation: true,
54
+ usage: 'tokens',
55
+ collaboration: [],
56
+ skill_delivery: ['prompt', 'filesystem'],
57
+ },
58
+ }],
59
+ ['hermes', {
60
+ id: 'hermes',
61
+ capabilities: {
62
+ protocol: 'acp',
63
+ session: 'resumable',
64
+ native_mcp: true,
65
+ native_approvals: true,
66
+ steering: true,
67
+ cancellation: true,
68
+ usage: 'tokens',
69
+ collaboration: ['delegated', 'swarm'],
70
+ skill_delivery: ['filesystem', 'native'],
71
+ },
72
+ }],
73
+ ]);
74
+ export const KNOWN_RUNTIME_IDS = Object.freeze(Array.from(DESCRIPTORS.keys()));
75
+ export function createRuntimeOwner(runtimeId, options) {
76
+ const descriptor = getRuntimeDescriptor(runtimeId);
77
+ if (descriptor.id === 'hermes')
78
+ return new HermesRuntime(options);
79
+ throw new RuntimeSelectionError('runtime_unavailable', descriptor.id, `Runtime ${descriptor.id} does not use a protocol process owner`);
80
+ }
81
+ export function getRuntimeDescriptor(runtimeId) {
82
+ const normalized = String(runtimeId ?? '').trim().toLowerCase();
83
+ if (!normalized) {
84
+ throw new RuntimeSelectionError('runtime_not_configured', null, 'Agent runtime is not configured');
85
+ }
86
+ const descriptor = DESCRIPTORS.get(normalized);
87
+ if (!descriptor) {
88
+ throw new RuntimeSelectionError('runtime_unknown', normalized, `Unknown agent runtime: ${normalized}`);
89
+ }
90
+ return descriptor;
91
+ }
92
+ function invalid(runtimeId, message) {
93
+ throw new RuntimeSelectionError('runtime_config_invalid', runtimeId, message);
94
+ }
95
+ export function validateRuntimeConfig(runtimeId, input) {
96
+ const descriptor = getRuntimeDescriptor(runtimeId);
97
+ if (!input || typeof input !== 'object' || Array.isArray(input)) {
98
+ return invalid(descriptor.id, 'Runtime configuration must be an object');
99
+ }
100
+ const raw = input;
101
+ const strategy = raw.strategy;
102
+ if (strategy !== 'single' && strategy !== 'delegated' && strategy !== 'swarm') {
103
+ return invalid(descriptor.id, 'Runtime strategy must be explicitly configured');
104
+ }
105
+ if (strategy !== 'single'
106
+ && !descriptor.capabilities.collaboration.includes(strategy)) {
107
+ return invalid(descriptor.id, `Runtime ${descriptor.id} does not support ${strategy} collaboration`);
108
+ }
109
+ const permissionMode = raw.permission_mode;
110
+ if (permissionMode !== 'strict'
111
+ && permissionMode !== 'approve'
112
+ && permissionMode !== 'trusted') {
113
+ return invalid(descriptor.id, 'Runtime permission mode must be explicitly configured');
114
+ }
115
+ const config = {
116
+ strategy,
117
+ permission_mode: permissionMode,
118
+ };
119
+ if (raw.profile !== undefined) {
120
+ if (typeof raw.profile !== 'string' || !raw.profile.trim()) {
121
+ return invalid(descriptor.id, 'Runtime profile must be a non-empty string');
122
+ }
123
+ config.profile = raw.profile.trim();
124
+ }
125
+ for (const field of ['max_children', 'max_iterations']) {
126
+ const value = raw[field];
127
+ if (value === undefined)
128
+ continue;
129
+ if (!Number.isInteger(value) || Number(value) < 1 || Number(value) > 1_000) {
130
+ return invalid(descriptor.id, `${field} must be an integer between 1 and 1000`);
131
+ }
132
+ config[field] = Number(value);
133
+ }
134
+ if (raw.extra !== undefined) {
135
+ if (!raw.extra || typeof raw.extra !== 'object' || Array.isArray(raw.extra)) {
136
+ return invalid(descriptor.id, 'Runtime extra configuration must be an object');
137
+ }
138
+ config.extra = raw.extra;
139
+ }
140
+ return config;
141
+ }
142
+ //# sourceMappingURL=runtime-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":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E,EAAE,GAAG,KAAK,wCAAwC,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5E,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,+CAA+C,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAgC,CAAC;IACtD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { AcpPermissionOutcome, AcpPermissionRequest, AcpPromptResponse, AcpUsage } from './acp/acp-types.js';
2
+ import { type HermesRuntimeOptions } from './hermes/hermes-runtime.js';
3
+ import type { HermesSessionRecord } from './hermes/hermes-session-store.js';
4
+ import type { AgentRuntimeConfig, RuntimeErrorCode } from './runtime-types.js';
5
+ import type { RuntimeEvent } from './runtime-events.js';
6
+ export type RuntimeDispatchErrorCode = RuntimeErrorCode | 'runtime_not_supported' | 'runtime_collaboration_denied';
7
+ export declare class RuntimeDispatchError extends Error {
8
+ readonly code: RuntimeDispatchErrorCode;
9
+ readonly runtimeId: string | null;
10
+ constructor(code: RuntimeDispatchErrorCode, runtimeId: string | null, message: string);
11
+ }
12
+ export interface RuntimeDispatchRequest {
13
+ agentId: string;
14
+ runId: string;
15
+ leaseId: string;
16
+ cwd: string;
17
+ apiKey: string;
18
+ runtimeId: string;
19
+ runtimeConfig: AgentRuntimeConfig | null | undefined;
20
+ systemContext?: string;
21
+ task: string;
22
+ model?: string | null;
23
+ }
24
+ export interface RuntimeDispatchContext {
25
+ agentId: string;
26
+ runId: string;
27
+ sessionId: string;
28
+ strategy: AgentRuntimeConfig['strategy'];
29
+ }
30
+ export interface RuntimeDispatchResult {
31
+ sessionId: string;
32
+ stopReason: string;
33
+ usage: Required<Pick<AcpUsage, 'inputTokens' | 'outputTokens' | 'totalTokens'>> & AcpUsage;
34
+ }
35
+ export interface RuntimeSupervisorOptions extends Pick<HermesRuntimeOptions, 'rootDir' | 'command' | 'args' | 'requestTimeoutMs' | 'env'> {
36
+ awbUrl: string;
37
+ onEvent?: (context: RuntimeDispatchContext, event: RuntimeEvent) => void;
38
+ requestApproval?: (context: RuntimeDispatchContext, request: AcpPermissionRequest) => AcpPermissionOutcome | Promise<AcpPermissionOutcome>;
39
+ onStderr?: (agentId: string, line: string) => void;
40
+ }
41
+ export declare class RuntimeSupervisor {
42
+ #private;
43
+ constructor(options: RuntimeSupervisorOptions);
44
+ dispatch(request: RuntimeDispatchRequest): Promise<RuntimeDispatchResult>;
45
+ steer(agentId: string, runId: string, instruction: string): Promise<AcpPromptResponse>;
46
+ cancel(agentId: string, runId: string): Promise<void>;
47
+ close(agentId: string, runId: string): Promise<void>;
48
+ getSession(agentId: string, runId: string): HermesSessionRecord | null;
49
+ stopForAgent(agentId: string): Promise<{
50
+ count: number;
51
+ inflight: [];
52
+ }>;
53
+ stopAll(): Promise<void>;
54
+ }