@awcp/sdk 0.0.0-dev-202601301521 → 0.0.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/dist/delegator/bin/daemon.d.ts +1 -9
- package/dist/delegator/bin/daemon.d.ts.map +1 -1
- package/dist/delegator/bin/daemon.js +7 -18
- package/dist/delegator/bin/daemon.js.map +1 -1
- package/dist/delegator/config.d.ts +71 -9
- package/dist/delegator/config.d.ts.map +1 -1
- package/dist/delegator/config.js +12 -1
- package/dist/delegator/config.js.map +1 -1
- package/dist/delegator/index.d.ts +2 -2
- package/dist/delegator/index.d.ts.map +1 -1
- package/dist/delegator/index.js +3 -3
- package/dist/delegator/index.js.map +1 -1
- package/dist/delegator/service.d.ts +69 -1
- package/dist/delegator/service.d.ts.map +1 -1
- package/dist/delegator/service.js +100 -15
- package/dist/delegator/service.js.map +1 -1
- package/dist/executor/config.d.ts +81 -11
- package/dist/executor/config.d.ts.map +1 -1
- package/dist/executor/config.js +9 -2
- package/dist/executor/config.js.map +1 -1
- package/dist/executor/index.d.ts +2 -2
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +2 -2
- package/dist/executor/index.js.map +1 -1
- package/dist/executor/policy.d.ts +55 -0
- package/dist/executor/policy.d.ts.map +1 -0
- package/dist/executor/policy.js +100 -0
- package/dist/executor/policy.js.map +1 -0
- package/dist/executor/service.d.ts +49 -3
- package/dist/executor/service.d.ts.map +1 -1
- package/dist/executor/service.js +112 -33
- package/dist/executor/service.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/delegator/export-manager.d.ts +0 -27
- package/dist/delegator/export-manager.d.ts.map +0 -1
- package/dist/delegator/export-manager.js +0 -85
- package/dist/delegator/export-manager.js.map +0 -1
- package/dist/executor/workspace-manager.d.ts +0 -30
- package/dist/executor/workspace-manager.d.ts.map +0 -1
- package/dist/executor/workspace-manager.js +0 -75
- package/dist/executor/workspace-manager.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { mkdir, readdir, rm } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Default mount root directory
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_MOUNT_ROOT = '/tmp/awcp/mounts';
|
|
7
|
+
/**
|
|
8
|
+
* Local Policy - Enforces security constraints on the Executor side.
|
|
9
|
+
*
|
|
10
|
+
* Security: startsWith(root) check prevents path traversal attacks.
|
|
11
|
+
*/
|
|
12
|
+
export class LocalPolicy {
|
|
13
|
+
config;
|
|
14
|
+
allocatedMounts = new Set();
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = config ?? {};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Allocate a mount point for a delegation
|
|
20
|
+
*/
|
|
21
|
+
allocateMountPoint(delegationId) {
|
|
22
|
+
const root = this.config.mountRoot ?? DEFAULT_MOUNT_ROOT;
|
|
23
|
+
const mountPoint = join(root, delegationId);
|
|
24
|
+
this.allocatedMounts.add(mountPoint);
|
|
25
|
+
return mountPoint;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate that a mount point is safe to use
|
|
29
|
+
*/
|
|
30
|
+
async validateMountPoint(mountPoint) {
|
|
31
|
+
const root = this.config.mountRoot ?? DEFAULT_MOUNT_ROOT;
|
|
32
|
+
if (!mountPoint.startsWith(root)) {
|
|
33
|
+
return {
|
|
34
|
+
valid: false,
|
|
35
|
+
reason: `Mount point must be under ${root}`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return { valid: true };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Prepare a mount point (create directory, ensure empty)
|
|
42
|
+
*/
|
|
43
|
+
async prepareMountPoint(mountPoint) {
|
|
44
|
+
await mkdir(mountPoint, { recursive: true });
|
|
45
|
+
const entries = await readdir(mountPoint);
|
|
46
|
+
if (entries.length > 0) {
|
|
47
|
+
throw new Error(`Mount point ${mountPoint} is not empty`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Release a mount point and remove the directory
|
|
52
|
+
*/
|
|
53
|
+
async releaseMountPoint(mountPoint) {
|
|
54
|
+
this.allocatedMounts.delete(mountPoint);
|
|
55
|
+
try {
|
|
56
|
+
await rm(mountPoint, { recursive: true, force: true });
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Ignore errors - directory may already be gone
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Cleanup stale mount directories from previous runs
|
|
64
|
+
*/
|
|
65
|
+
async cleanupStaleMounts() {
|
|
66
|
+
const root = this.config.mountRoot ?? DEFAULT_MOUNT_ROOT;
|
|
67
|
+
let cleaned = 0;
|
|
68
|
+
try {
|
|
69
|
+
const entries = await readdir(root, { withFileTypes: true });
|
|
70
|
+
for (const entry of entries) {
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
const mountPath = join(root, entry.name);
|
|
73
|
+
// Only clean directories not currently allocated
|
|
74
|
+
if (!this.allocatedMounts.has(mountPath)) {
|
|
75
|
+
await rm(mountPath, { recursive: true, force: true });
|
|
76
|
+
cleaned++;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Root directory may not exist yet
|
|
83
|
+
}
|
|
84
|
+
return cleaned;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if concurrent limit is reached
|
|
88
|
+
*/
|
|
89
|
+
canAcceptMore() {
|
|
90
|
+
const max = this.config.maxConcurrent ?? Infinity;
|
|
91
|
+
return this.allocatedMounts.size < max;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get currently allocated mount points
|
|
95
|
+
*/
|
|
96
|
+
getAllocatedMounts() {
|
|
97
|
+
return Array.from(this.allocatedMounts);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/executor/policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAsBjC;;GAEG;AACH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAe;IACrB,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAE5C,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,YAAoB;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,UAAkB;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAC;QAEzD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,6BAA6B,IAAI,EAAE;aAC5C,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAi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BACtD,OAAO,EAAE,CAAC;oBACZ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,mCAAmC;QACrC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,QAAQ,CAAC;QAClD,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,GAAG,GAAG,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -1,38 +1,84 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AWCP Executor Service
|
|
3
|
+
*
|
|
4
|
+
* Handles the AWCP delegation protocol on the Executor (Collaborator) side.
|
|
5
|
+
* Integrates with A2A SDK executor for task execution.
|
|
3
6
|
*/
|
|
4
7
|
import { type AgentExecutor } from '@a2a-js/sdk/server';
|
|
5
8
|
import { type AwcpMessage } from '@awcp/core';
|
|
6
9
|
import { type ExecutorConfig } from './config.js';
|
|
10
|
+
/**
|
|
11
|
+
* Executor service status
|
|
12
|
+
*/
|
|
7
13
|
export interface ExecutorServiceStatus {
|
|
8
14
|
pendingInvitations: number;
|
|
9
15
|
activeDelegations: number;
|
|
10
16
|
delegations: Array<{
|
|
11
17
|
id: string;
|
|
12
|
-
|
|
18
|
+
mountPoint: string;
|
|
13
19
|
startedAt: string;
|
|
14
20
|
}>;
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for creating the service
|
|
24
|
+
*/
|
|
16
25
|
export interface ExecutorServiceOptions {
|
|
26
|
+
/** A2A agent executor */
|
|
17
27
|
executor: AgentExecutor;
|
|
28
|
+
/** AWCP configuration */
|
|
18
29
|
config: ExecutorConfig;
|
|
19
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* AWCP Executor Service
|
|
33
|
+
*
|
|
34
|
+
* Manages the AWCP delegation lifecycle:
|
|
35
|
+
* 1. Receives INVITE from Delegator
|
|
36
|
+
* 2. Sends ACCEPT back
|
|
37
|
+
* 3. Receives START with credentials
|
|
38
|
+
* 4. Mounts workspace via SSHFS
|
|
39
|
+
* 5. Executes task via A2A executor
|
|
40
|
+
* 6. Unmounts and sends DONE/ERROR
|
|
41
|
+
*/
|
|
20
42
|
export declare class ExecutorService {
|
|
21
43
|
private executor;
|
|
22
44
|
private config;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
45
|
+
private policy;
|
|
46
|
+
private sshfsClient;
|
|
25
47
|
private delegatorClient;
|
|
26
48
|
private pendingInvitations;
|
|
27
49
|
private activeDelegations;
|
|
28
50
|
constructor(options: ExecutorServiceOptions);
|
|
51
|
+
/**
|
|
52
|
+
* Handle incoming AWCP message from Delegator
|
|
53
|
+
*/
|
|
29
54
|
handleMessage(message: AwcpMessage, delegatorUrl: string): Promise<AwcpMessage | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Handle INVITE message
|
|
57
|
+
*/
|
|
30
58
|
private handleInvite;
|
|
59
|
+
/**
|
|
60
|
+
* Handle START message
|
|
61
|
+
*/
|
|
31
62
|
private handleStart;
|
|
63
|
+
/**
|
|
64
|
+
* Handle ERROR message from Delegator
|
|
65
|
+
*/
|
|
32
66
|
private handleError;
|
|
67
|
+
/**
|
|
68
|
+
* Cancel a delegation (called by Delegator via /cancel endpoint)
|
|
69
|
+
*/
|
|
33
70
|
cancelDelegation(delegationId: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Execute task via A2A executor
|
|
73
|
+
*/
|
|
34
74
|
private executeViaA2A;
|
|
75
|
+
/**
|
|
76
|
+
* Get service status
|
|
77
|
+
*/
|
|
35
78
|
getStatus(): ExecutorServiceStatus;
|
|
79
|
+
/**
|
|
80
|
+
* Create an error message
|
|
81
|
+
*/
|
|
36
82
|
private createErrorMessage;
|
|
37
83
|
}
|
|
38
84
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/executor/service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/executor/service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAML,KAAK,WAAW,EAMjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,cAAc,EAAsD,MAAM,aAAa,CAAC;AAwBtG;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,QAAQ,EAAE,aAAa,CAAC;IACxB,yBAAyB;IACzB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAwC;IAClE,OAAO,CAAC,iBAAiB,CAAuC;gBAEpD,OAAO,EAAE,sBAAsB;IAW3C;;OAEG;IACG,aAAa,CACjB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAe9B;;OAEG;YACW,YAAY;IAqH1B;;OAEG;YACW,WAAW;IAsFzB;;OAEG;YACW,WAAW;IAqBzB;;OAEG;IACG,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB3D;;OAEG;YACW,aAAa;IAgD3B;;OAEG;IACH,SAAS,IAAI,qBAAqB;IAYlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAe3B"}
|
package/dist/executor/service.js
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AWCP Executor Service
|
|
3
|
+
*
|
|
4
|
+
* Handles the AWCP delegation protocol on the Executor (Collaborator) side.
|
|
5
|
+
* Integrates with A2A SDK executor for task execution.
|
|
3
6
|
*/
|
|
4
7
|
import { randomUUID } from 'node:crypto';
|
|
5
8
|
import { DefaultExecutionEventBus, } from '@a2a-js/sdk/server';
|
|
9
|
+
import { SshfsMountClient } from '@awcp/transport-sshfs';
|
|
6
10
|
import { PROTOCOL_VERSION, ErrorCodes, AwcpError, } from '@awcp/core';
|
|
7
11
|
import { resolveExecutorConfig } from './config.js';
|
|
8
|
-
import {
|
|
12
|
+
import { LocalPolicy } from './policy.js';
|
|
9
13
|
import { DelegatorClient } from './delegator-client.js';
|
|
14
|
+
/**
|
|
15
|
+
* AWCP Executor Service
|
|
16
|
+
*
|
|
17
|
+
* Manages the AWCP delegation lifecycle:
|
|
18
|
+
* 1. Receives INVITE from Delegator
|
|
19
|
+
* 2. Sends ACCEPT back
|
|
20
|
+
* 3. Receives START with credentials
|
|
21
|
+
* 4. Mounts workspace via SSHFS
|
|
22
|
+
* 5. Executes task via A2A executor
|
|
23
|
+
* 6. Unmounts and sends DONE/ERROR
|
|
24
|
+
*/
|
|
10
25
|
export class ExecutorService {
|
|
11
26
|
executor;
|
|
12
27
|
config;
|
|
13
|
-
|
|
14
|
-
|
|
28
|
+
policy;
|
|
29
|
+
sshfsClient;
|
|
15
30
|
delegatorClient;
|
|
16
31
|
pendingInvitations = new Map();
|
|
17
32
|
activeDelegations = new Map();
|
|
18
33
|
constructor(options) {
|
|
19
34
|
this.executor = options.executor;
|
|
20
35
|
this.config = resolveExecutorConfig(options.config);
|
|
21
|
-
this.
|
|
22
|
-
|
|
36
|
+
this.policy = new LocalPolicy({
|
|
37
|
+
mountRoot: this.config.mount.root,
|
|
38
|
+
maxConcurrent: this.config.policy.maxConcurrentDelegations,
|
|
39
|
+
});
|
|
40
|
+
this.sshfsClient = new SshfsMountClient();
|
|
23
41
|
this.delegatorClient = new DelegatorClient();
|
|
24
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Handle incoming AWCP message from Delegator
|
|
45
|
+
*/
|
|
25
46
|
async handleMessage(message, delegatorUrl) {
|
|
26
47
|
switch (message.type) {
|
|
27
48
|
case 'INVITE':
|
|
@@ -36,23 +57,31 @@ export class ExecutorService {
|
|
|
36
57
|
throw new Error(`Unexpected message type: ${message.type}`);
|
|
37
58
|
}
|
|
38
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Handle INVITE message
|
|
62
|
+
*/
|
|
39
63
|
async handleInvite(invite, delegatorUrl) {
|
|
40
64
|
const { delegationId } = invite;
|
|
41
|
-
if
|
|
65
|
+
// Check if we can accept more delegations
|
|
66
|
+
if (!this.policy.canAcceptMore()) {
|
|
42
67
|
return this.createErrorMessage(delegationId, ErrorCodes.DECLINED, 'Maximum concurrent delegations reached', 'Try again later when current tasks complete');
|
|
43
68
|
}
|
|
69
|
+
// Check TTL constraints
|
|
44
70
|
const maxTtl = this.config.policy.maxTtlSeconds;
|
|
45
71
|
if (invite.lease.ttlSeconds > maxTtl) {
|
|
46
72
|
return this.createErrorMessage(delegationId, ErrorCodes.DECLINED, `Requested TTL (${invite.lease.ttlSeconds}s) exceeds maximum (${maxTtl}s)`, `Request a shorter TTL (max: ${maxTtl}s)`);
|
|
47
73
|
}
|
|
74
|
+
// Check access mode
|
|
48
75
|
const allowedModes = this.config.policy.allowedAccessModes;
|
|
49
76
|
if (!allowedModes.includes(invite.lease.accessMode)) {
|
|
50
77
|
return this.createErrorMessage(delegationId, ErrorCodes.DECLINED, `Access mode '${invite.lease.accessMode}' not allowed`, `Allowed modes: ${allowedModes.join(', ')}`);
|
|
51
78
|
}
|
|
52
|
-
|
|
79
|
+
// Check dependencies
|
|
80
|
+
const depCheck = await this.sshfsClient.checkDependency();
|
|
53
81
|
if (!depCheck.available) {
|
|
54
|
-
return this.createErrorMessage(delegationId, ErrorCodes.DEP_MISSING,
|
|
82
|
+
return this.createErrorMessage(delegationId, ErrorCodes.DEP_MISSING, 'SSHFS is not available', 'Install sshfs: brew install macfuse && brew install sshfs (macOS) or apt install sshfs (Linux)');
|
|
55
83
|
}
|
|
84
|
+
// Call onInvite hook if provided
|
|
56
85
|
if (this.config.hooks.onInvite) {
|
|
57
86
|
const accepted = await this.config.hooks.onInvite(invite);
|
|
58
87
|
if (!accepted) {
|
|
@@ -60,38 +89,48 @@ export class ExecutorService {
|
|
|
60
89
|
}
|
|
61
90
|
}
|
|
62
91
|
else if (!this.config.policy.autoAccept) {
|
|
92
|
+
// No hook and not auto-accept - store as pending
|
|
63
93
|
this.pendingInvitations.set(delegationId, {
|
|
64
94
|
invite,
|
|
65
95
|
delegatorUrl,
|
|
66
96
|
receivedAt: new Date(),
|
|
67
97
|
});
|
|
98
|
+
// For now, we'll auto-decline if not auto-accept and no hook
|
|
68
99
|
return this.createErrorMessage(delegationId, ErrorCodes.DECLINED, 'Manual acceptance required but no hook provided', 'Configure autoAccept: true or provide onInvite hook');
|
|
69
100
|
}
|
|
70
|
-
|
|
71
|
-
const
|
|
101
|
+
// Allocate mount point
|
|
102
|
+
const mountPoint = this.policy.allocateMountPoint(delegationId);
|
|
103
|
+
// Validate mount point
|
|
104
|
+
const validation = await this.policy.validateMountPoint(mountPoint);
|
|
72
105
|
if (!validation.valid) {
|
|
73
|
-
await this.
|
|
74
|
-
return this.createErrorMessage(delegationId, ErrorCodes.MOUNTPOINT_DENIED, validation.reason ?? '
|
|
106
|
+
await this.policy.releaseMountPoint(mountPoint);
|
|
107
|
+
return this.createErrorMessage(delegationId, ErrorCodes.MOUNTPOINT_DENIED, validation.reason ?? 'Mount point validation failed', 'Check mount root configuration');
|
|
75
108
|
}
|
|
109
|
+
// Store pending invitation
|
|
76
110
|
this.pendingInvitations.set(delegationId, {
|
|
77
111
|
invite,
|
|
78
112
|
delegatorUrl,
|
|
79
113
|
receivedAt: new Date(),
|
|
80
114
|
});
|
|
115
|
+
// Build executor constraints
|
|
81
116
|
const executorConstraints = {
|
|
82
117
|
acceptedAccessMode: invite.lease.accessMode,
|
|
83
118
|
maxTtlSeconds: Math.min(invite.lease.ttlSeconds, maxTtl),
|
|
84
119
|
sandboxProfile: this.config.sandbox,
|
|
85
120
|
};
|
|
121
|
+
// Return ACCEPT
|
|
86
122
|
const acceptMessage = {
|
|
87
123
|
version: PROTOCOL_VERSION,
|
|
88
124
|
type: 'ACCEPT',
|
|
89
125
|
delegationId,
|
|
90
|
-
executorMount: { mountPoint
|
|
126
|
+
executorMount: { mountPoint },
|
|
91
127
|
executorConstraints,
|
|
92
128
|
};
|
|
93
129
|
return acceptMessage;
|
|
94
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Handle START message
|
|
133
|
+
*/
|
|
95
134
|
async handleStart(start, delegatorUrl) {
|
|
96
135
|
const { delegationId } = start;
|
|
97
136
|
const pending = this.pendingInvitations.get(delegationId);
|
|
@@ -99,25 +138,34 @@ export class ExecutorService {
|
|
|
99
138
|
console.warn(`[AWCP] Unknown delegation for START: ${delegationId}`);
|
|
100
139
|
return;
|
|
101
140
|
}
|
|
102
|
-
const
|
|
141
|
+
const mountPoint = this.policy.allocateMountPoint(delegationId);
|
|
103
142
|
this.pendingInvitations.delete(delegationId);
|
|
104
143
|
try {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
144
|
+
// Prepare mount point
|
|
145
|
+
await this.policy.prepareMountPoint(mountPoint);
|
|
146
|
+
// Mount the workspace
|
|
147
|
+
await this.sshfsClient.mount({
|
|
148
|
+
endpoint: start.mount.endpoint,
|
|
149
|
+
exportLocator: start.mount.exportLocator,
|
|
150
|
+
credential: start.mount.credential,
|
|
151
|
+
mountPoint,
|
|
152
|
+
options: start.mount.mountOptions,
|
|
110
153
|
});
|
|
154
|
+
// Track active delegation
|
|
111
155
|
this.activeDelegations.set(delegationId, {
|
|
112
156
|
id: delegationId,
|
|
113
157
|
delegatorUrl,
|
|
114
|
-
|
|
158
|
+
mountPoint,
|
|
115
159
|
task: pending.invite.task,
|
|
116
160
|
startedAt: new Date(),
|
|
117
161
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
162
|
+
// Call onTaskStart hook
|
|
163
|
+
this.config.hooks.onTaskStart?.(delegationId, mountPoint);
|
|
164
|
+
// Execute task via A2A executor
|
|
165
|
+
const result = await this.executeViaA2A(mountPoint, pending.invite.task);
|
|
166
|
+
// Unmount
|
|
167
|
+
await this.sshfsClient.unmount(mountPoint);
|
|
168
|
+
// Send DONE
|
|
121
169
|
const doneMessage = {
|
|
122
170
|
version: PROTOCOL_VERSION,
|
|
123
171
|
type: 'DONE',
|
|
@@ -126,14 +174,18 @@ export class ExecutorService {
|
|
|
126
174
|
highlights: result.highlights,
|
|
127
175
|
};
|
|
128
176
|
await this.delegatorClient.send(delegatorUrl, doneMessage);
|
|
177
|
+
// Call onTaskComplete hook
|
|
129
178
|
this.config.hooks.onTaskComplete?.(delegationId, result.summary);
|
|
179
|
+
// Cleanup
|
|
130
180
|
this.activeDelegations.delete(delegationId);
|
|
131
|
-
await this.
|
|
181
|
+
await this.policy.releaseMountPoint(mountPoint);
|
|
132
182
|
}
|
|
133
183
|
catch (error) {
|
|
134
|
-
|
|
184
|
+
// Cleanup on error
|
|
185
|
+
await this.sshfsClient.unmount(mountPoint).catch(() => { });
|
|
135
186
|
this.activeDelegations.delete(delegationId);
|
|
136
|
-
await this.
|
|
187
|
+
await this.policy.releaseMountPoint(mountPoint);
|
|
188
|
+
// Send ERROR
|
|
137
189
|
const errorMessage = {
|
|
138
190
|
version: PROTOCOL_VERSION,
|
|
139
191
|
type: 'ERROR',
|
|
@@ -143,26 +195,36 @@ export class ExecutorService {
|
|
|
143
195
|
hint: 'Check task requirements and try again',
|
|
144
196
|
};
|
|
145
197
|
await this.delegatorClient.send(delegatorUrl, errorMessage).catch(console.error);
|
|
198
|
+
// Call onError hook
|
|
146
199
|
this.config.hooks.onError?.(delegationId, error instanceof Error ? error : new Error(String(error)));
|
|
147
200
|
}
|
|
148
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Handle ERROR message from Delegator
|
|
204
|
+
*/
|
|
149
205
|
async handleError(error) {
|
|
150
206
|
const { delegationId } = error;
|
|
207
|
+
// Cleanup if we have an active delegation
|
|
151
208
|
const delegation = this.activeDelegations.get(delegationId);
|
|
152
209
|
if (delegation) {
|
|
153
|
-
await this.
|
|
210
|
+
await this.sshfsClient.unmount(delegation.mountPoint).catch(() => { });
|
|
154
211
|
this.activeDelegations.delete(delegationId);
|
|
155
|
-
await this.
|
|
212
|
+
await this.policy.releaseMountPoint(delegation.mountPoint);
|
|
156
213
|
}
|
|
214
|
+
// Remove pending invitation if any
|
|
157
215
|
this.pendingInvitations.delete(delegationId);
|
|
216
|
+
// Call onError hook
|
|
158
217
|
this.config.hooks.onError?.(delegationId, new AwcpError(error.code, error.message, error.hint, delegationId));
|
|
159
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Cancel a delegation (called by Delegator via /cancel endpoint)
|
|
221
|
+
*/
|
|
160
222
|
async cancelDelegation(delegationId) {
|
|
161
223
|
const delegation = this.activeDelegations.get(delegationId);
|
|
162
224
|
if (delegation) {
|
|
163
|
-
await this.
|
|
225
|
+
await this.sshfsClient.unmount(delegation.mountPoint).catch(() => { });
|
|
164
226
|
this.activeDelegations.delete(delegationId);
|
|
165
|
-
await this.
|
|
227
|
+
await this.policy.releaseMountPoint(delegation.mountPoint);
|
|
166
228
|
this.config.hooks.onError?.(delegationId, new AwcpError(ErrorCodes.CANCELLED, 'Delegation cancelled by Delegator', undefined, delegationId));
|
|
167
229
|
return;
|
|
168
230
|
}
|
|
@@ -172,7 +234,11 @@ export class ExecutorService {
|
|
|
172
234
|
}
|
|
173
235
|
throw new Error(`Delegation not found: ${delegationId}`);
|
|
174
236
|
}
|
|
175
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Execute task via A2A executor
|
|
239
|
+
*/
|
|
240
|
+
async executeViaA2A(mountPoint, task) {
|
|
241
|
+
// Create synthetic A2A message with task context
|
|
176
242
|
const message = {
|
|
177
243
|
kind: 'message',
|
|
178
244
|
messageId: randomUUID(),
|
|
@@ -181,13 +247,15 @@ export class ExecutorService {
|
|
|
181
247
|
{ kind: 'text', text: task.prompt },
|
|
182
248
|
{
|
|
183
249
|
kind: 'text',
|
|
184
|
-
text: `\n\n[AWCP Context]\nWorking directory: ${
|
|
250
|
+
text: `\n\n[AWCP Context]\nWorking directory: ${mountPoint}\nTask: ${task.description}`,
|
|
185
251
|
},
|
|
186
252
|
],
|
|
187
253
|
};
|
|
254
|
+
// Create request context
|
|
188
255
|
const taskId = randomUUID();
|
|
189
256
|
const contextId = randomUUID();
|
|
190
257
|
const requestContext = new RequestContextImpl(message, taskId, contextId);
|
|
258
|
+
// Create event bus and collect results
|
|
191
259
|
const eventBus = new DefaultExecutionEventBus();
|
|
192
260
|
const results = [];
|
|
193
261
|
eventBus.on('event', (event) => {
|
|
@@ -195,7 +263,9 @@ export class ExecutorService {
|
|
|
195
263
|
results.push(event);
|
|
196
264
|
}
|
|
197
265
|
});
|
|
266
|
+
// Execute
|
|
198
267
|
await this.executor.execute(requestContext, eventBus);
|
|
268
|
+
// Extract summary from results
|
|
199
269
|
const summary = results
|
|
200
270
|
.flatMap((m) => m.parts)
|
|
201
271
|
.filter((p) => p.kind === 'text')
|
|
@@ -205,17 +275,23 @@ export class ExecutorService {
|
|
|
205
275
|
summary: summary || 'Task completed',
|
|
206
276
|
};
|
|
207
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Get service status
|
|
280
|
+
*/
|
|
208
281
|
getStatus() {
|
|
209
282
|
return {
|
|
210
283
|
pendingInvitations: this.pendingInvitations.size,
|
|
211
284
|
activeDelegations: this.activeDelegations.size,
|
|
212
285
|
delegations: Array.from(this.activeDelegations.values()).map((d) => ({
|
|
213
286
|
id: d.id,
|
|
214
|
-
|
|
287
|
+
mountPoint: d.mountPoint,
|
|
215
288
|
startedAt: d.startedAt.toISOString(),
|
|
216
289
|
})),
|
|
217
290
|
};
|
|
218
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Create an error message
|
|
294
|
+
*/
|
|
219
295
|
createErrorMessage(delegationId, code, message, hint) {
|
|
220
296
|
return {
|
|
221
297
|
version: PROTOCOL_VERSION,
|
|
@@ -227,6 +303,9 @@ export class ExecutorService {
|
|
|
227
303
|
};
|
|
228
304
|
}
|
|
229
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Simple RequestContext implementation
|
|
308
|
+
*/
|
|
230
309
|
class RequestContextImpl {
|
|
231
310
|
userMessage;
|
|
232
311
|
taskId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/executor/service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/executor/service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,wBAAwB,GAGzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EASL,gBAAgB,EAChB,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAoD,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAA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AAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* AWCP SDK - Delegator and Executor implementations
|
|
5
5
|
*/
|
|
6
|
-
export { DelegatorService, type DelegatorServiceOptions, type DelegateParams, type DelegatorServiceStatus, type DelegatorConfig, type DelegationDefaults, type DelegatorHooks, startDelegatorDaemon, DelegatorDaemonClient, type DaemonConfig, type DaemonInstance, type DelegateRequest, type DelegateResponse, type ListDelegationsResponse, AdmissionController, type AdmissionConfig, type AdmissionResult, type WorkspaceStats,
|
|
7
|
-
export { ExecutorService, type ExecutorServiceOptions, type ExecutorServiceStatus, type ExecutorConfig, type PolicyConstraints, type ExecutorHooks,
|
|
6
|
+
export { DelegatorService, type DelegatorServiceOptions, type DelegateParams, type DelegatorServiceStatus, type DelegatorConfig, type SshConfig, type DelegationDefaults, type DelegatorHooks, startDelegatorDaemon, DelegatorDaemonClient, type DaemonConfig, type DaemonInstance, type DelegateRequest, type DelegateResponse, type ListDelegationsResponse, AdmissionController, type AdmissionConfig, type AdmissionResult, type WorkspaceStats, ExportViewManager, ExecutorClient, } from './delegator/index.js';
|
|
7
|
+
export { ExecutorService, type ExecutorServiceOptions, type ExecutorServiceStatus, type ExecutorConfig, type MountConfig, type PolicyConstraints, type ExecutorHooks, LocalPolicy, type PolicyConfig, type MountPointValidation, DelegatorClient, } from './executor/index.js';
|
|
8
8
|
export * from '@awcp/core';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAEL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAE3B,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAE5B,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAEL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAE3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAE5B,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,iBAAiB,EACjB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAEL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAE1B,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAM7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ DelegatorService,
|
|
|
12
12
|
// Daemon mode
|
|
13
13
|
startDelegatorDaemon, DelegatorDaemonClient,
|
|
14
14
|
// Utilities
|
|
15
|
-
AdmissionController,
|
|
15
|
+
AdmissionController, ExportViewManager, ExecutorClient, } from './delegator/index.js';
|
|
16
16
|
// ============================================
|
|
17
17
|
// Executor API (for executing delegations)
|
|
18
18
|
// ============================================
|
|
@@ -20,7 +20,7 @@ export {
|
|
|
20
20
|
// Service
|
|
21
21
|
ExecutorService,
|
|
22
22
|
// Utilities
|
|
23
|
-
|
|
23
|
+
LocalPolicy, DelegatorClient, } from './executor/index.js';
|
|
24
24
|
// ============================================
|
|
25
25
|
// Re-export core types for convenience
|
|
26
26
|
// ============================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,2CAA2C;AAC3C,+CAA+C;AAE/C,OAAO;AACL,UAAU;AACV,gBAAgB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,2CAA2C;AAC3C,+CAA+C;AAE/C,OAAO;AACL,UAAU;AACV,gBAAgB;AAShB,cAAc;AACd,oBAAoB,EACpB,qBAAqB;AAMrB,YAAY;AACZ,mBAAmB,EAInB,iBAAiB,EACjB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,+CAA+C;AAC/C,2CAA2C;AAC3C,+CAA+C;AAE/C,OAAO;AACL,UAAU;AACV,eAAe;AAQf,YAAY;AACZ,WAAW,EAGX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,+CAA+C;AAC/C,uCAAuC;AACvC,+CAA+C;AAE/C,cAAc,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awcp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "AWCP SDK - Delegator and Executor Daemon implementations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"test:watch": "vitest"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@awcp/core": "0.0.
|
|
44
|
+
"@awcp/core": "^0.0.1",
|
|
45
|
+
"@awcp/transport-sshfs": "^0.0.1",
|
|
45
46
|
"@a2a-js/sdk": "^0.3.5"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|