@beeos-ai/device-agent 0.6.0 → 0.7.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/adapters/agent-gateway-client.d.ts +25 -0
- package/dist/adapters/agent-gateway-client.js +49 -0
- package/dist/adapters/agent-gateway-client.js.map +1 -1
- package/dist/adapters/user-file-uploader.d.ts +74 -0
- package/dist/adapters/user-file-uploader.js +78 -0
- package/dist/adapters/user-file-uploader.js.map +1 -0
- package/dist/app/plugin-commands/registry.d.ts +41 -0
- package/dist/app/plugin-commands/registry.js +62 -0
- package/dist/app/plugin-commands/registry.js.map +1 -0
- package/dist/app/plugin-commands/screenshot-command.d.ts +32 -0
- package/dist/app/plugin-commands/screenshot-command.js +44 -0
- package/dist/app/plugin-commands/screenshot-command.js.map +1 -0
- package/dist/app/plugin-commands/types.d.ts +63 -0
- package/dist/app/plugin-commands/types.js +26 -0
- package/dist/app/plugin-commands/types.js.map +1 -0
- package/dist/app/screenshot-service.d.ts +68 -0
- package/dist/app/screenshot-service.js +64 -0
- package/dist/app/screenshot-service.js.map +1 -0
- package/dist/app/session-manager.d.ts +32 -0
- package/dist/app/session-manager.js +67 -0
- package/dist/app/session-manager.js.map +1 -1
- package/dist/bootstrap.js +5 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/inbound/acp/handlers/device.d.ts +9 -1
- package/dist/inbound/acp/handlers/device.js +9 -1
- package/dist/inbound/acp/handlers/device.js.map +1 -1
- package/dist/inbound/acp/handlers/initialize.d.ts +9 -5
- package/dist/inbound/acp/handlers/initialize.js +10 -6
- package/dist/inbound/acp/handlers/initialize.js.map +1 -1
- package/dist/inbound/acp/handlers/skills.d.ts +24 -2
- package/dist/inbound/acp/handlers/skills.js +31 -2
- package/dist/inbound/acp/handlers/skills.js.map +1 -1
- package/dist/plugins/acp/index.d.ts +8 -0
- package/dist/plugins/acp/index.js +37 -0
- package/dist/plugins/acp/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -242,6 +242,31 @@ export declare function putPresignedBytes(opts: {
|
|
|
242
242
|
timeoutMs?: number;
|
|
243
243
|
fetchImpl?: typeof fetch;
|
|
244
244
|
}): Promise<void>;
|
|
245
|
+
export interface ConfirmFileUploadOptions {
|
|
246
|
+
agentGatewayUrl: string;
|
|
247
|
+
identity: AgentGatewayIdentity;
|
|
248
|
+
fileId: string;
|
|
249
|
+
timeoutMs?: number;
|
|
250
|
+
fetchImpl?: typeof fetch;
|
|
251
|
+
now?: () => number;
|
|
252
|
+
randomUUID?: () => string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* POST /api/v1/agent/files/confirm — transition a presigned upload to
|
|
256
|
+
* "ready" so it appears in the platform's file index (user-visible
|
|
257
|
+
* attachments, beeos-file:// references, etc.). The `presignFileUpload`
|
|
258
|
+
* + `putPresignedBytes` pair alone is enough for VLM image_url use,
|
|
259
|
+
* but anything the user is supposed to see (chat attachments,
|
|
260
|
+
* `/screenshot` plugin command output, …) MUST be confirmed.
|
|
261
|
+
*
|
|
262
|
+
* The response is the same `FileMetaResponse` shape that
|
|
263
|
+
* `resolveAgentFile` returns — fileId + filename + mimeType + size +
|
|
264
|
+
* fresh presigned downloadUrl.
|
|
265
|
+
*
|
|
266
|
+
* Throws `AgentGatewayError` on non-2xx (including 404 if the fileId
|
|
267
|
+
* doesn't belong to the calling agent's owner).
|
|
268
|
+
*/
|
|
269
|
+
export declare function confirmFileUpload(opts: ConfirmFileUploadOptions): Promise<ResolvedAgentFile>;
|
|
245
270
|
/**
|
|
246
271
|
* Result of `GET /api/v1/agent/files/{fileId}/resolve`. Mirrors the
|
|
247
272
|
* Go DTO at `backend/services/agent-gateway/internal/dto/response.go`
|
|
@@ -259,6 +259,55 @@ export async function putPresignedBytes(opts) {
|
|
|
259
259
|
clearTimeout(timer);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* POST /api/v1/agent/files/confirm — transition a presigned upload to
|
|
264
|
+
* "ready" so it appears in the platform's file index (user-visible
|
|
265
|
+
* attachments, beeos-file:// references, etc.). The `presignFileUpload`
|
|
266
|
+
* + `putPresignedBytes` pair alone is enough for VLM image_url use,
|
|
267
|
+
* but anything the user is supposed to see (chat attachments,
|
|
268
|
+
* `/screenshot` plugin command output, …) MUST be confirmed.
|
|
269
|
+
*
|
|
270
|
+
* The response is the same `FileMetaResponse` shape that
|
|
271
|
+
* `resolveAgentFile` returns — fileId + filename + mimeType + size +
|
|
272
|
+
* fresh presigned downloadUrl.
|
|
273
|
+
*
|
|
274
|
+
* Throws `AgentGatewayError` on non-2xx (including 404 if the fileId
|
|
275
|
+
* doesn't belong to the calling agent's owner).
|
|
276
|
+
*/
|
|
277
|
+
export async function confirmFileUpload(opts) {
|
|
278
|
+
if (!opts.fileId)
|
|
279
|
+
throw new AgentGatewayError("confirmFileUpload: empty fileId");
|
|
280
|
+
const path = "/api/v1/agent/files/confirm";
|
|
281
|
+
const url = `${trimSlash(opts.agentGatewayUrl)}${path}`;
|
|
282
|
+
const body = JSON.stringify({ fileId: opts.fileId });
|
|
283
|
+
const headers = {
|
|
284
|
+
...buildAuthHeaders({
|
|
285
|
+
method: "POST",
|
|
286
|
+
path,
|
|
287
|
+
identity: opts.identity,
|
|
288
|
+
now: opts.now,
|
|
289
|
+
randomUUID: opts.randomUUID,
|
|
290
|
+
}),
|
|
291
|
+
"Content-Type": "application/json",
|
|
292
|
+
};
|
|
293
|
+
const data = (await gwRequest("POST", url, headers, body, opts.timeoutMs ?? 10_000, opts.fetchImpl));
|
|
294
|
+
const obj = (data ?? {});
|
|
295
|
+
const fileId = typeof obj.fileId === "string" ? obj.fileId : "";
|
|
296
|
+
const fileName = typeof obj.fileName === "string" ? obj.fileName : "";
|
|
297
|
+
const mimeType = typeof obj.mimeType === "string" ? obj.mimeType : "";
|
|
298
|
+
const size = typeof obj.size === "number" ? obj.size : 0;
|
|
299
|
+
const downloadUrl = typeof obj.downloadUrl === "string" ? obj.downloadUrl : "";
|
|
300
|
+
if (!fileId) {
|
|
301
|
+
throw new AgentGatewayError(`files/confirm: missing fileId (got ${JSON.stringify(data)})`);
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
fileId,
|
|
305
|
+
fileName,
|
|
306
|
+
mimeType,
|
|
307
|
+
size,
|
|
308
|
+
downloadUrl,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
262
311
|
/**
|
|
263
312
|
* Look up file metadata + a fresh short-lived presigned download URL
|
|
264
313
|
* for an upload that already lives in the platform's file storage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-gateway-client.js","sourceRoot":"","sources":["../../src/adapters/agent-gateway-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AA6B/C,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAGxB;IACA;IAHlB,YACE,OAAe,EACC,MAAe,EACf,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA8B;IAE9B,MAAM,IAAI,GAAG,uBAAuB,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9E,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;IAEhE,MAAM,OAAO,GAAG,gBAAgB,CAAC;QAC/B,MAAM,EAAE,KAAK;QACb,IAAI;QACJ,QAAQ,EAAE,IAAI,CAA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AI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,iBAAiB;YAAE,MAAM,CAAC,CAAC;QAC5C,IAAK,CAAW,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACvC,MAAM,IAAI,iBAAiB,CAAC,yCAAyC,SAAS,IAAI,CAAC,CAAC;QACtF,CAAC;QACD,MAAM,IAAI,iBAAiB,CAAC,iCAAkC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAc;IACxC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserFileUploader — composes the three Agent Gateway file-upload steps
|
|
3
|
+
* (presign → PUT → confirm) into a single call that returns a stable
|
|
4
|
+
* `beeos-file://${fileId}` URI suitable for ACP `resource_link` blocks.
|
|
5
|
+
*
|
|
6
|
+
* bytes ──▶ uploader ──▶ { fileId, uri, mimeType, fileName }
|
|
7
|
+
*
|
|
8
|
+
* Why this exists alongside `HttpUrlTransport`:
|
|
9
|
+
*
|
|
10
|
+
* - `HttpUrlTransport` (in `model/image/transport.ts`) is for VLM
|
|
11
|
+
* image_url delivery: presign + PUT only, returns a presigned GET
|
|
12
|
+
* URL straight to the model. NO `confirm` step — the upload never
|
|
13
|
+
* surfaces in the user's file index, and the URL is a one-shot
|
|
14
|
+
* short-lived link used by `llama.cpp` and friends.
|
|
15
|
+
*
|
|
16
|
+
* - `UserFileUploader` (this file) is for user-visible attachments
|
|
17
|
+
* such as the `/screenshot` plugin command output: presign + PUT +
|
|
18
|
+
* CONFIRM. After confirm, the file lives in the platform's file
|
|
19
|
+
* index and resolves through `beeos-file://` URIs in chat
|
|
20
|
+
* conversations and the FileAttachmentRenderer.
|
|
21
|
+
*
|
|
22
|
+
* The two pipelines deliberately use different `keyPrefix` values
|
|
23
|
+
* (`vlm-screenshots/` vs `device-screenshots/`) so S3 lifecycle rules
|
|
24
|
+
* can target one without affecting the other.
|
|
25
|
+
*/
|
|
26
|
+
import { type AgentGatewayIdentity } from "./agent-gateway-client.js";
|
|
27
|
+
export interface UploadOpts {
|
|
28
|
+
/** File bytes to stage. Must already be in the final wire format. */
|
|
29
|
+
bytes: Buffer;
|
|
30
|
+
/** MIME type — MUST match between presign and PUT (S3 sigv4 binds it). */
|
|
31
|
+
mimeType: string;
|
|
32
|
+
/** Logical name presented in the platform file index and downstream UI. */
|
|
33
|
+
fileName: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional object-key prefix. Defaults to `user-attachments/`. Concrete
|
|
36
|
+
* callers SHOULD pass a more specific prefix (e.g. `device-screenshots/`)
|
|
37
|
+
* so storage lifecycle rules can target a category cleanly.
|
|
38
|
+
*/
|
|
39
|
+
keyPrefix?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface UploadResult {
|
|
42
|
+
fileId: string;
|
|
43
|
+
/** `beeos-file://${fileId}` — stable platform reference. */
|
|
44
|
+
uri: string;
|
|
45
|
+
mimeType: string;
|
|
46
|
+
fileName: string;
|
|
47
|
+
}
|
|
48
|
+
export interface UserFileUploader {
|
|
49
|
+
upload(opts: UploadOpts): Promise<UploadResult>;
|
|
50
|
+
}
|
|
51
|
+
export interface AgentGatewayUserFileUploaderOptions {
|
|
52
|
+
agentGatewayUrl: string;
|
|
53
|
+
identity: AgentGatewayIdentity;
|
|
54
|
+
/** Per-step timeout (presign / put / confirm). Default 30s for PUT, 10s for the others. */
|
|
55
|
+
presignTimeoutMs?: number;
|
|
56
|
+
putTimeoutMs?: number;
|
|
57
|
+
confirmTimeoutMs?: number;
|
|
58
|
+
/** Test seam — defaults to `globalThis.fetch`. */
|
|
59
|
+
fetchImpl?: typeof fetch;
|
|
60
|
+
/** Test seam — defaults to `Date.now()`. */
|
|
61
|
+
now?: () => number;
|
|
62
|
+
/** Test seam — defaults to `crypto.randomUUID()`. */
|
|
63
|
+
randomUUID?: () => string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Concrete `UserFileUploader` backed by the live Agent Gateway HTTP
|
|
67
|
+
* surface (Ed25519 auth). The three steps run sequentially; any failure
|
|
68
|
+
* surfaces as `AgentGatewayError` from the underlying helper.
|
|
69
|
+
*/
|
|
70
|
+
export declare class AgentGatewayUserFileUploader implements UserFileUploader {
|
|
71
|
+
private readonly opts;
|
|
72
|
+
constructor(opts: AgentGatewayUserFileUploaderOptions);
|
|
73
|
+
upload(input: UploadOpts): Promise<UploadResult>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserFileUploader — composes the three Agent Gateway file-upload steps
|
|
3
|
+
* (presign → PUT → confirm) into a single call that returns a stable
|
|
4
|
+
* `beeos-file://${fileId}` URI suitable for ACP `resource_link` blocks.
|
|
5
|
+
*
|
|
6
|
+
* bytes ──▶ uploader ──▶ { fileId, uri, mimeType, fileName }
|
|
7
|
+
*
|
|
8
|
+
* Why this exists alongside `HttpUrlTransport`:
|
|
9
|
+
*
|
|
10
|
+
* - `HttpUrlTransport` (in `model/image/transport.ts`) is for VLM
|
|
11
|
+
* image_url delivery: presign + PUT only, returns a presigned GET
|
|
12
|
+
* URL straight to the model. NO `confirm` step — the upload never
|
|
13
|
+
* surfaces in the user's file index, and the URL is a one-shot
|
|
14
|
+
* short-lived link used by `llama.cpp` and friends.
|
|
15
|
+
*
|
|
16
|
+
* - `UserFileUploader` (this file) is for user-visible attachments
|
|
17
|
+
* such as the `/screenshot` plugin command output: presign + PUT +
|
|
18
|
+
* CONFIRM. After confirm, the file lives in the platform's file
|
|
19
|
+
* index and resolves through `beeos-file://` URIs in chat
|
|
20
|
+
* conversations and the FileAttachmentRenderer.
|
|
21
|
+
*
|
|
22
|
+
* The two pipelines deliberately use different `keyPrefix` values
|
|
23
|
+
* (`vlm-screenshots/` vs `device-screenshots/`) so S3 lifecycle rules
|
|
24
|
+
* can target one without affecting the other.
|
|
25
|
+
*/
|
|
26
|
+
import { confirmFileUpload, presignFileUpload, putPresignedBytes, } from "./agent-gateway-client.js";
|
|
27
|
+
/**
|
|
28
|
+
* Concrete `UserFileUploader` backed by the live Agent Gateway HTTP
|
|
29
|
+
* surface (Ed25519 auth). The three steps run sequentially; any failure
|
|
30
|
+
* surfaces as `AgentGatewayError` from the underlying helper.
|
|
31
|
+
*/
|
|
32
|
+
export class AgentGatewayUserFileUploader {
|
|
33
|
+
opts;
|
|
34
|
+
constructor(opts) {
|
|
35
|
+
this.opts = opts;
|
|
36
|
+
}
|
|
37
|
+
async upload(input) {
|
|
38
|
+
const prefix = (input.keyPrefix ?? "user-attachments/").replace(/\/?$/, "/");
|
|
39
|
+
// The presign request just takes the logical fileName — the gateway /
|
|
40
|
+
// storage layer is free to namespace it however it likes. We embed
|
|
41
|
+
// our keyPrefix in the fileName field so callers can still reason
|
|
42
|
+
// about object layout without an extra API surface.
|
|
43
|
+
const objectName = `${prefix}${input.fileName}`;
|
|
44
|
+
const presigned = await presignFileUpload({
|
|
45
|
+
agentGatewayUrl: this.opts.agentGatewayUrl,
|
|
46
|
+
identity: this.opts.identity,
|
|
47
|
+
fileName: objectName,
|
|
48
|
+
mimeType: input.mimeType,
|
|
49
|
+
timeoutMs: this.opts.presignTimeoutMs,
|
|
50
|
+
fetchImpl: this.opts.fetchImpl,
|
|
51
|
+
now: this.opts.now,
|
|
52
|
+
randomUUID: this.opts.randomUUID,
|
|
53
|
+
});
|
|
54
|
+
await putPresignedBytes({
|
|
55
|
+
uploadUrl: presigned.uploadUrl,
|
|
56
|
+
bytes: input.bytes,
|
|
57
|
+
mimeType: input.mimeType,
|
|
58
|
+
timeoutMs: this.opts.putTimeoutMs ?? 30_000,
|
|
59
|
+
fetchImpl: this.opts.fetchImpl,
|
|
60
|
+
});
|
|
61
|
+
const confirmed = await confirmFileUpload({
|
|
62
|
+
agentGatewayUrl: this.opts.agentGatewayUrl,
|
|
63
|
+
identity: this.opts.identity,
|
|
64
|
+
fileId: presigned.fileId,
|
|
65
|
+
timeoutMs: this.opts.confirmTimeoutMs,
|
|
66
|
+
fetchImpl: this.opts.fetchImpl,
|
|
67
|
+
now: this.opts.now,
|
|
68
|
+
randomUUID: this.opts.randomUUID,
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
fileId: confirmed.fileId,
|
|
72
|
+
uri: `beeos-file://${confirmed.fileId}`,
|
|
73
|
+
mimeType: confirmed.mimeType || input.mimeType,
|
|
74
|
+
fileName: confirmed.fileName || input.fileName,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=user-file-uploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-file-uploader.js","sourceRoot":"","sources":["../../src/adapters/user-file-uploader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,2BAA2B,CAAC;AA4CnC;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;I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;YACxB,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB;YACrC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;YAC9B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG;YAClB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;SACjC,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,GAAG,EAAE,gBAAgB,SAAS,CAAC,MAAM,EAAE;YACvC,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ;YAC9C,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ;SAC/C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PluginCommandRegistry — name → handler lookup with prefix matching.
|
|
3
|
+
*
|
|
4
|
+
* Simplified port of OpenClaw's `matchPluginCommand`
|
|
5
|
+
* (`openclaw/src/plugins/commands.ts:62-100`). Drops some of the
|
|
6
|
+
* upstream high-end features (hyphen/underscore aliases, alternate
|
|
7
|
+
* invocation keys) — the device-agent only needs `/screenshot` today
|
|
8
|
+
* and we'll port more as needed.
|
|
9
|
+
*
|
|
10
|
+
* Match contract:
|
|
11
|
+
* - Input MUST start with `/`. Whitespace-only / non-slash strings
|
|
12
|
+
* short-circuit to `null` so natural-language prompts ("截屏发给
|
|
13
|
+
* 我") fall through unchanged to the AgentRunner.
|
|
14
|
+
* - Command name extraction: `/<name>` or `/<name> <args...>`.
|
|
15
|
+
* Names match case-insensitively (typing `/Screenshot` still
|
|
16
|
+
* hits the registered handler).
|
|
17
|
+
* - Argument gating: when the matched command has `acceptsArgs:
|
|
18
|
+
* false` (default), passing arguments DROPS the match — the line
|
|
19
|
+
* falls through to the AgentRunner so a misspelled builtin
|
|
20
|
+
* doesn't accidentally swallow real user intent.
|
|
21
|
+
*/
|
|
22
|
+
import type { PluginCommand } from "./types.js";
|
|
23
|
+
export interface PluginCommandMatch {
|
|
24
|
+
command: PluginCommand;
|
|
25
|
+
args?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class PluginCommandRegistry {
|
|
28
|
+
private readonly commands;
|
|
29
|
+
/** Register (or replace) a command. Names are case-insensitive. */
|
|
30
|
+
register(cmd: PluginCommand): void;
|
|
31
|
+
/**
|
|
32
|
+
* Match a free-form prompt string against the registry. Returns the
|
|
33
|
+
* matched command + parsed args, or `null` when the prompt is not
|
|
34
|
+
* a slash command or doesn't match any registered name.
|
|
35
|
+
*/
|
|
36
|
+
match(text: string): PluginCommandMatch | null;
|
|
37
|
+
/** Snapshot of registered commands, in insertion order. */
|
|
38
|
+
list(): PluginCommand[];
|
|
39
|
+
/** Number of registered commands — convenience for tests. */
|
|
40
|
+
size(): number;
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PluginCommandRegistry — name → handler lookup with prefix matching.
|
|
3
|
+
*
|
|
4
|
+
* Simplified port of OpenClaw's `matchPluginCommand`
|
|
5
|
+
* (`openclaw/src/plugins/commands.ts:62-100`). Drops some of the
|
|
6
|
+
* upstream high-end features (hyphen/underscore aliases, alternate
|
|
7
|
+
* invocation keys) — the device-agent only needs `/screenshot` today
|
|
8
|
+
* and we'll port more as needed.
|
|
9
|
+
*
|
|
10
|
+
* Match contract:
|
|
11
|
+
* - Input MUST start with `/`. Whitespace-only / non-slash strings
|
|
12
|
+
* short-circuit to `null` so natural-language prompts ("截屏发给
|
|
13
|
+
* 我") fall through unchanged to the AgentRunner.
|
|
14
|
+
* - Command name extraction: `/<name>` or `/<name> <args...>`.
|
|
15
|
+
* Names match case-insensitively (typing `/Screenshot` still
|
|
16
|
+
* hits the registered handler).
|
|
17
|
+
* - Argument gating: when the matched command has `acceptsArgs:
|
|
18
|
+
* false` (default), passing arguments DROPS the match — the line
|
|
19
|
+
* falls through to the AgentRunner so a misspelled builtin
|
|
20
|
+
* doesn't accidentally swallow real user intent.
|
|
21
|
+
*/
|
|
22
|
+
export class PluginCommandRegistry {
|
|
23
|
+
commands = new Map();
|
|
24
|
+
/** Register (or replace) a command. Names are case-insensitive. */
|
|
25
|
+
register(cmd) {
|
|
26
|
+
this.commands.set(cmd.name.toLowerCase(), cmd);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Match a free-form prompt string against the registry. Returns the
|
|
30
|
+
* matched command + parsed args, or `null` when the prompt is not
|
|
31
|
+
* a slash command or doesn't match any registered name.
|
|
32
|
+
*/
|
|
33
|
+
match(text) {
|
|
34
|
+
const trimmed = text.trim();
|
|
35
|
+
if (!trimmed.startsWith("/"))
|
|
36
|
+
return null;
|
|
37
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
38
|
+
const rawName = spaceIdx === -1 ? trimmed.slice(1) : trimmed.slice(1, spaceIdx);
|
|
39
|
+
const name = rawName.toLowerCase();
|
|
40
|
+
if (!name)
|
|
41
|
+
return null;
|
|
42
|
+
const args = spaceIdx === -1 ? undefined : trimmed.slice(spaceIdx + 1).trim();
|
|
43
|
+
const command = this.commands.get(name);
|
|
44
|
+
if (!command)
|
|
45
|
+
return null;
|
|
46
|
+
// Reject extra args for commands that don't accept them — the line
|
|
47
|
+
// falls through to the AgentRunner so e.g. `/screenshot please`
|
|
48
|
+
// doesn't get swallowed silently.
|
|
49
|
+
if (args && !command.acceptsArgs)
|
|
50
|
+
return null;
|
|
51
|
+
return { command, args: args || undefined };
|
|
52
|
+
}
|
|
53
|
+
/** Snapshot of registered commands, in insertion order. */
|
|
54
|
+
list() {
|
|
55
|
+
return Array.from(this.commands.values());
|
|
56
|
+
}
|
|
57
|
+
/** Number of registered commands — convenience for tests. */
|
|
58
|
+
size() {
|
|
59
|
+
return this.commands.size;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.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O,IAAI,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,SAAS,EAAE,CAAC;IAC9C,CAAC;IAED,2DAA2D;IAC3D,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,6DAA6D;IAC7D,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/screenshot` plugin command handler.
|
|
3
|
+
*
|
|
4
|
+
* Adapter layer between the ACP-unaware `ScreenshotService` and the
|
|
5
|
+
* session/notifier surface. Responsibilities are intentionally narrow:
|
|
6
|
+
*
|
|
7
|
+
* 1. Drive `ScreenshotService.captureAndUpload()` to stage the
|
|
8
|
+
* current device frame as a `beeos-file://${fileId}` attachment.
|
|
9
|
+
* 2. Translate the resulting `ChatAttachment` into an ACP
|
|
10
|
+
* `agent_message_chunk` carrying a `resource_link` block.
|
|
11
|
+
* 3. Push that update onto the caller's session via the injected
|
|
12
|
+
* `SessionUpdateNotifier`.
|
|
13
|
+
*
|
|
14
|
+
* Strict separation-of-concerns boundary:
|
|
15
|
+
* - DOES NOT touch MCP / `Buffer` / upload internals — those live
|
|
16
|
+
* entirely inside `ScreenshotService` + `UserFileUploader`.
|
|
17
|
+
* - Errors propagate up to `SessionManager` which renders them as a
|
|
18
|
+
* `system_message_chunk` notice (no toast logic here).
|
|
19
|
+
*/
|
|
20
|
+
import type { ScreenshotService } from "../screenshot-service.js";
|
|
21
|
+
import type { SessionUpdateNotifier } from "../session-manager.js";
|
|
22
|
+
import type { PluginCommand, PluginCommandContext } from "./types.js";
|
|
23
|
+
export declare class ScreenshotCommandHandler implements PluginCommand {
|
|
24
|
+
private readonly service;
|
|
25
|
+
private readonly notifier;
|
|
26
|
+
readonly name = "screenshot";
|
|
27
|
+
readonly description = "Take a device screenshot and send it to the chat";
|
|
28
|
+
readonly emoji = "\uD83D\uDCF8";
|
|
29
|
+
readonly acceptsArgs = false;
|
|
30
|
+
constructor(service: ScreenshotService, notifier: SessionUpdateNotifier);
|
|
31
|
+
handle(ctx: PluginCommandContext): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/screenshot` plugin command handler.
|
|
3
|
+
*
|
|
4
|
+
* Adapter layer between the ACP-unaware `ScreenshotService` and the
|
|
5
|
+
* session/notifier surface. Responsibilities are intentionally narrow:
|
|
6
|
+
*
|
|
7
|
+
* 1. Drive `ScreenshotService.captureAndUpload()` to stage the
|
|
8
|
+
* current device frame as a `beeos-file://${fileId}` attachment.
|
|
9
|
+
* 2. Translate the resulting `ChatAttachment` into an ACP
|
|
10
|
+
* `agent_message_chunk` carrying a `resource_link` block.
|
|
11
|
+
* 3. Push that update onto the caller's session via the injected
|
|
12
|
+
* `SessionUpdateNotifier`.
|
|
13
|
+
*
|
|
14
|
+
* Strict separation-of-concerns boundary:
|
|
15
|
+
* - DOES NOT touch MCP / `Buffer` / upload internals — those live
|
|
16
|
+
* entirely inside `ScreenshotService` + `UserFileUploader`.
|
|
17
|
+
* - Errors propagate up to `SessionManager` which renders them as a
|
|
18
|
+
* `system_message_chunk` notice (no toast logic here).
|
|
19
|
+
*/
|
|
20
|
+
export class ScreenshotCommandHandler {
|
|
21
|
+
service;
|
|
22
|
+
notifier;
|
|
23
|
+
name = "screenshot";
|
|
24
|
+
description = "Take a device screenshot and send it to the chat";
|
|
25
|
+
emoji = "📸";
|
|
26
|
+
acceptsArgs = false;
|
|
27
|
+
constructor(service, notifier) {
|
|
28
|
+
this.service = service;
|
|
29
|
+
this.notifier = notifier;
|
|
30
|
+
}
|
|
31
|
+
async handle(ctx) {
|
|
32
|
+
const att = await this.service.captureAndUpload();
|
|
33
|
+
this.notifier.send(ctx.sessionId, {
|
|
34
|
+
sessionUpdate: "agent_message_chunk",
|
|
35
|
+
content: {
|
|
36
|
+
type: "resource_link",
|
|
37
|
+
uri: att.uri,
|
|
38
|
+
name: att.fileName,
|
|
39
|
+
mimeType: att.mimeType,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=screenshot-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshot-command.js","sourceRoot":"","sources":["../../../src/app/plugin-commands/screenshot-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,MAAM,OAAO,wBAAwB;IAOhB;IACA;IAPV,IAAI,GAAG,YAAY,CAAC;IACpB,WAAW,GAAG,kDAAkD,CAAC;IACjE,KAAK,GAAG,IAAI,CAAC;IACb,WAAW,GAAG,KAAK,CAAC;IAE7B,YACmB,OAA0B,EAC1B,QAA+B;QAD/B,YAAO,GAAP,OAAO,CAAmB;QAC1B,aAAQ,GAAR,QAAQ,CAAuB;IAC/C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,GAAyB;QACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;YAChC,aAAa,EAAE,qBAAqB;YACpC,OAAO,EAAE;gBACP,IAAI,EAAE,eAAe;gBACrB,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,IAAI,EAAE,GAAG,CAAC,QAAQ;gBAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;aACvB;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Command abstraction — server-side, channel-agnostic slash
|
|
3
|
+
* commands that bypass the LLM / AgentRunner.
|
|
4
|
+
*
|
|
5
|
+
* Modelled directly after OpenClaw's `OpenClawPluginCommandDefinition`
|
|
6
|
+
* (see `openclaw/src/plugins/types.ts:1946-1980`):
|
|
7
|
+
*
|
|
8
|
+
* - Each command bundles its own `handle()` so the SessionManager
|
|
9
|
+
* only has to dispatch by name.
|
|
10
|
+
* - All channels (ACP web chat, future Telegram / Discord / CLI)
|
|
11
|
+
* deliver these as plain `/name [args]` text in `session/prompt`,
|
|
12
|
+
* pre-LLM. The registry is responsible for prefix matching.
|
|
13
|
+
* - Surface metadata (`name`, `description`, `emoji`) lives on the
|
|
14
|
+
* command itself so `skills/list` can be generated from a single
|
|
15
|
+
* source of truth.
|
|
16
|
+
*
|
|
17
|
+
* Strict separation-of-concerns boundary:
|
|
18
|
+
* - This module imports NOTHING from `inbound/acp/*` — the registry
|
|
19
|
+
* / commands stay protocol-agnostic so a future HTTP or CLI surface
|
|
20
|
+
* can drive them too.
|
|
21
|
+
* - Concrete command implementations (`screenshot-command.ts`, etc.)
|
|
22
|
+
* are free to import session-side ports (notifier) — they're the
|
|
23
|
+
* adapter layer between business capabilities and the protocol.
|
|
24
|
+
*/
|
|
25
|
+
export interface PluginCommandContext {
|
|
26
|
+
/**
|
|
27
|
+
* The session to deliver the command's output to. SessionManager
|
|
28
|
+
* passes its own session id through; handlers use this when calling
|
|
29
|
+
* `notifier.notify(sessionId, …)` to push their result.
|
|
30
|
+
*/
|
|
31
|
+
sessionId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Trimmed argument string after the command name. Empty / undefined
|
|
34
|
+
* when the command was invoked bare (`/screenshot`). Only forwarded
|
|
35
|
+
* to commands that opt in via `acceptsArgs: true`.
|
|
36
|
+
*/
|
|
37
|
+
args?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PluginCommand {
|
|
40
|
+
/** Command name without the leading slash (e.g. `"screenshot"`). */
|
|
41
|
+
readonly name: string;
|
|
42
|
+
/** Description shown in `skills/list` and slash-autocomplete UI. */
|
|
43
|
+
readonly description: string;
|
|
44
|
+
/** Optional emoji prefix for surface presentation (Web slash, /help). */
|
|
45
|
+
readonly emoji?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the command accepts arguments after its name. Commands
|
|
48
|
+
* with `acceptsArgs: false` only match bare `/name` invocations —
|
|
49
|
+
* `/name foo` falls through to the AgentRunner so a misspelled
|
|
50
|
+
* builtin doesn't accidentally swallow user intent.
|
|
51
|
+
*/
|
|
52
|
+
readonly acceptsArgs?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Execute the command. Bypasses LLM / AgentRunner — the handler is
|
|
55
|
+
* responsible for emitting any session-side notifications it wants
|
|
56
|
+
* the user to see (typically through the injected notifier).
|
|
57
|
+
*
|
|
58
|
+
* Throwing here surfaces as a `system_message_chunk` error notice
|
|
59
|
+
* via SessionManager's central error handler — handlers SHOULD let
|
|
60
|
+
* exceptions propagate rather than swallow them silently.
|
|
61
|
+
*/
|
|
62
|
+
handle(ctx: PluginCommandContext): Promise<void>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Command abstraction — server-side, channel-agnostic slash
|
|
3
|
+
* commands that bypass the LLM / AgentRunner.
|
|
4
|
+
*
|
|
5
|
+
* Modelled directly after OpenClaw's `OpenClawPluginCommandDefinition`
|
|
6
|
+
* (see `openclaw/src/plugins/types.ts:1946-1980`):
|
|
7
|
+
*
|
|
8
|
+
* - Each command bundles its own `handle()` so the SessionManager
|
|
9
|
+
* only has to dispatch by name.
|
|
10
|
+
* - All channels (ACP web chat, future Telegram / Discord / CLI)
|
|
11
|
+
* deliver these as plain `/name [args]` text in `session/prompt`,
|
|
12
|
+
* pre-LLM. The registry is responsible for prefix matching.
|
|
13
|
+
* - Surface metadata (`name`, `description`, `emoji`) lives on the
|
|
14
|
+
* command itself so `skills/list` can be generated from a single
|
|
15
|
+
* source of truth.
|
|
16
|
+
*
|
|
17
|
+
* Strict separation-of-concerns boundary:
|
|
18
|
+
* - This module imports NOTHING from `inbound/acp/*` — the registry
|
|
19
|
+
* / commands stay protocol-agnostic so a future HTTP or CLI surface
|
|
20
|
+
* can drive them too.
|
|
21
|
+
* - Concrete command implementations (`screenshot-command.ts`, etc.)
|
|
22
|
+
* are free to import session-side ports (notifier) — they're the
|
|
23
|
+
* adapter layer between business capabilities and the protocol.
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/app/plugin-commands/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|