@agimon-ai/doompi-computer-use 0.0.1-alpha.27 → 0.0.1-alpha.28
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 -10
- package/dist/{computerUseMode-BgtaVx_z.cjs → computerUseMode-CHpbP7yo.cjs} +81 -2
- package/dist/computerUseMode-CHpbP7yo.cjs.map +1 -0
- package/dist/{computerUseMode-nb6yoF4Y.mjs → computerUseMode-DTXNRobA.mjs} +64 -3
- package/dist/computerUseMode-DTXNRobA.mjs.map +1 -0
- package/dist/{dependencies-CuOzd5Pm.cjs → dependencies-Dub2ybTN.cjs} +15 -3
- package/dist/dependencies-Dub2ybTN.cjs.map +1 -0
- package/dist/{dependencies-gtxIMe7d.mjs → dependencies-Y1TS7gGv.mjs} +9 -3
- package/dist/dependencies-Y1TS7gGv.mjs.map +1 -0
- package/dist/extensionService-BJXeNc4R.mjs +434 -0
- package/dist/extensionService-BJXeNc4R.mjs.map +1 -0
- package/dist/extensionService-CZS-zDP0.cjs +504 -0
- package/dist/extensionService-CZS-zDP0.cjs.map +1 -0
- package/dist/extensions/mcp.cjs +11 -8
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts.map +1 -1
- package/dist/extensions/mcp.mjs +12 -9
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/pi.cjs +23 -26
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.mts +1 -1
- package/dist/extensions/pi.d.mts.map +1 -1
- package/dist/extensions/pi.mjs +23 -26
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +246 -82
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +247 -83
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +5 -2
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{index-CazCNSuR.d.mts → index-0S6V4EU9.d.mts} +116 -98
- package/dist/index-0S6V4EU9.d.mts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/docs/computer-scripts.md +58 -23
- package/package.json +9 -8
- package/src/prompts/doompi-use-computer-use/SKILL.md +25 -11
- package/src/types/computerUse.ts +15 -1
- package/dist/computerUseMode-BgtaVx_z.cjs.map +0 -1
- package/dist/computerUseMode-nb6yoF4Y.mjs.map +0 -1
- package/dist/dependencies-CuOzd5Pm.cjs.map +0 -1
- package/dist/dependencies-gtxIMe7d.mjs.map +0 -1
- package/dist/extensionService-44mLS5b_.cjs +0 -275
- package/dist/extensionService-44mLS5b_.cjs.map +0 -1
- package/dist/extensionService-nFT_46iM.mjs +0 -206
- package/dist/extensionService-nFT_46iM.mjs.map +0 -1
- package/dist/index-CazCNSuR.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@ Session-scoped semantic computer control through the DoomPi Desktop capability.
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
7
|
- Node.js 22.19.0 or newer
|
|
8
|
-
- DoomPi Desktop with Computer Use
|
|
9
|
-
-
|
|
8
|
+
- A supported packaged macOS DoomPi Desktop with native Computer Use permissions
|
|
9
|
+
- The Pi version declared by this package's peer dependencies
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ pi install npm:@agimon-ai/doompi-computer-use
|
|
|
16
16
|
|
|
17
17
|
## Use
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
In Desktop, enable Computer Use in global settings, then select the default-off **Computer Use** minor mode. Its Activity section lists eligible application windows and starts native confirmation. Only one session can hold a live Desktop run. The setting, minor-mode row, and Activity group are hidden in a normal browser, including a browser opened against the Desktop server.
|
|
20
20
|
|
|
21
21
|
The `computer-use` minor mode exposes Activate, Deactivate, and Doctor actions. `/computer-use` reports the current state.
|
|
22
22
|
|
|
@@ -24,16 +24,17 @@ While active, the package exposes three tools:
|
|
|
24
24
|
|
|
25
25
|
- `computer_state` observes the authorized window and returns a semantic snapshot.
|
|
26
26
|
- `computer_action` performs one semantic press, focus change, value change, or scroll against a current snapshot.
|
|
27
|
-
- `computer_exec`
|
|
27
|
+
- `computer_exec` executes a reusable JavaScript or erasable TypeScript function and its relative helpers in a restricted runtime, then returns a fresh semantic observation.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Generated functions receive the authorized program API, JSON input, bounded logging, and cancellation. They do not receive Node or filesystem access. Script-internal observations omit screenshots by default, and `includeScreenshot: true` requests an image explicitly. Full Node execution requires both `trusted: true` and an exact host-configured `DOOMPI_COMPUTER_USE_SCRIPT_PATHS` allowlist. Trusted scripts remain unsandboxed, including their imported dependencies. See [Author computer functions](./docs/computer-scripts.md) for the contract, limits, trust boundary, and examples.
|
|
30
30
|
|
|
31
|
-
All three tools
|
|
31
|
+
All three tools remain unavailable during setup and are admitted only after the native grant becomes active. Disabling the mode or global opt-in, stopping control, expiry, or Desktop disconnection stops further actions. Once Desktop claims a session, browser and remote MCP clients cannot drive it, including previously attached clients. This ownership stays pinned for the server lifetime and is not restored from saved session data.
|
|
32
32
|
|
|
33
33
|
## Public API
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
import {
|
|
36
|
+
import { ComputerScriptRunner, createComputerUseSessionClient } from '@agimon-ai/doompi-computer-use';
|
|
37
|
+
import type { ComputerScriptRun } from '@agimon-ai/doompi-computer-use';
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
The session-scoped server facet owns the agent and hub routes. Their host-issued context tokens remain opaque and session-bound inside the request broker.
|
|
@@ -51,6 +52,4 @@ pnpm build
|
|
|
51
52
|
|
|
52
53
|
MIT
|
|
53
54
|
|
|
54
|
-
Direct plugin
|
|
55
|
-
|
|
56
|
-
The Pi entry declares a live minor-mode collection so the global opt-in controls catalog presence. Its tool restriction is reactive and the helper owns all registration changes. Session startup begins availability polling; `onStop` cancels the timer and final disposal clears status. The server declares its session mode, activity, tools, commands, and API alongside hub channel factories.
|
|
55
|
+
Direct plugin routes live in `src/extensions`. The session root constructs one broker shared by the typed agent client and activation API. The host owns the Desktop IPC connection, native renderer authentication, session identity, and grant lifetime. The hub channel uses lifecycle events rather than polling to forward operations. The CLI compatibility runtime keeps its existing polling lifecycle. Public exports remain under `src/exports`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_extensionService = require("./extensionService-
|
|
1
|
+
const require_extensionService = require("./extensionService-CZS-zDP0.cjs");
|
|
2
2
|
//#region src/types/computerUseApi.ts
|
|
3
3
|
const API_BASE_PATH = "computer-use";
|
|
4
4
|
const computerUseChannelType = "computer_use_state";
|
|
@@ -29,6 +29,67 @@ const COMPUTER_USE_ROUTES = {
|
|
|
29
29
|
};
|
|
30
30
|
const COMPUTER_USE_WAKE_LIMIT = 1e6;
|
|
31
31
|
//#endregion
|
|
32
|
+
//#region src/services/computerToolOutput/index.ts
|
|
33
|
+
const MAX_TEXT_BYTES = 262144;
|
|
34
|
+
const MAX_IMAGE_DATA_LENGTH = 8388608;
|
|
35
|
+
function content(value, observation) {
|
|
36
|
+
const text = JSON.stringify(value);
|
|
37
|
+
if (Buffer.byteLength(text) > MAX_TEXT_BYTES) throw new Error("Computer-use text response exceeds the size limit.");
|
|
38
|
+
const screenshot = observation.screenshot;
|
|
39
|
+
if (screenshot && (screenshot.mimeType !== "image/png" || screenshot.data.length > MAX_IMAGE_DATA_LENGTH)) throw new Error("Computer-use screenshot exceeds the image limit.");
|
|
40
|
+
return [{
|
|
41
|
+
type: "text",
|
|
42
|
+
text
|
|
43
|
+
}, ...screenshot ? [{
|
|
44
|
+
type: "image",
|
|
45
|
+
mimeType: screenshot.mimeType,
|
|
46
|
+
data: screenshot.data
|
|
47
|
+
}] : []];
|
|
48
|
+
}
|
|
49
|
+
function computerObservationOutput(observation) {
|
|
50
|
+
return {
|
|
51
|
+
content: content({
|
|
52
|
+
...observation,
|
|
53
|
+
screenshot: void 0
|
|
54
|
+
}, observation),
|
|
55
|
+
details: observation
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function computerScriptOutput(result) {
|
|
59
|
+
try {
|
|
60
|
+
return {
|
|
61
|
+
content: content({
|
|
62
|
+
...result,
|
|
63
|
+
observation: {
|
|
64
|
+
...result.observation,
|
|
65
|
+
screenshot: void 0
|
|
66
|
+
}
|
|
67
|
+
}, result.observation),
|
|
68
|
+
details: result
|
|
69
|
+
};
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (result.metrics === void 0) throw error;
|
|
72
|
+
throw new require_extensionService.ComputerScriptExecutionError(error instanceof Error ? error.message : String(error), result.metrics.actions, false);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function computerScriptFailure(error) {
|
|
76
|
+
const details = {
|
|
77
|
+
error: (error instanceof Error ? error.message : String(error)).slice(0, 1024),
|
|
78
|
+
...error instanceof require_extensionService.ComputerScriptExecutionError ? {
|
|
79
|
+
completedActions: error.completedActions,
|
|
80
|
+
outcomeUncertain: error.outcomeUncertain
|
|
81
|
+
} : {}
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
content: [{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify(details)
|
|
87
|
+
}],
|
|
88
|
+
details,
|
|
89
|
+
isError: true
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
32
93
|
//#region src/models/computerUseMode.ts
|
|
33
94
|
function modeState(state, enabled = false) {
|
|
34
95
|
const phase = state?.phase ?? "inactive";
|
|
@@ -115,6 +176,24 @@ Object.defineProperty(exports, "COMPUTER_USE_WAKE_LIMIT", {
|
|
|
115
176
|
return COMPUTER_USE_WAKE_LIMIT;
|
|
116
177
|
}
|
|
117
178
|
});
|
|
179
|
+
Object.defineProperty(exports, "computerObservationOutput", {
|
|
180
|
+
enumerable: true,
|
|
181
|
+
get: function() {
|
|
182
|
+
return computerObservationOutput;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(exports, "computerScriptFailure", {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: function() {
|
|
188
|
+
return computerScriptFailure;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
Object.defineProperty(exports, "computerScriptOutput", {
|
|
192
|
+
enumerable: true,
|
|
193
|
+
get: function() {
|
|
194
|
+
return computerScriptOutput;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
118
197
|
Object.defineProperty(exports, "computerUseChannelType", {
|
|
119
198
|
enumerable: true,
|
|
120
199
|
get: function() {
|
|
@@ -134,4 +213,4 @@ Object.defineProperty(exports, "modeState", {
|
|
|
134
213
|
}
|
|
135
214
|
});
|
|
136
215
|
|
|
137
|
-
//# sourceMappingURL=computerUseMode-
|
|
216
|
+
//# sourceMappingURL=computerUseMode-CHpbP7yo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computerUseMode-CHpbP7yo.cjs","names":["ComputerScriptExecutionError","COMPUTER_USE_TOOL_NAMES"],"sources":["../src/types/computerUseApi.ts","../src/services/computerToolOutput/index.ts","../src/models/computerUseMode.ts"],"sourcesContent":["import type { DoomApiCaller } from '@agimon-ai/doompi-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'doom-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'doom-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n readonly caller: DoomApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { DoomHeadlessToolResult } from '@agimon-ai/doompi-core/headless';\n\nimport type { ComputerScriptExecutionResult } from '../../types/computerScript';\nimport type { ComputerUseObservation } from '../../types/computerUse';\nimport { ComputerScriptExecutionError } from '../computerScriptRunner';\n\nconst MAX_TEXT_BYTES = 256 * 1024;\nconst MAX_IMAGE_DATA_LENGTH = 8 * 1024 * 1024;\n\nfunction content(value: unknown, observation: ComputerUseObservation): DoomHeadlessToolResult['content'] {\n const text = JSON.stringify(value);\n if (Buffer.byteLength(text) > MAX_TEXT_BYTES) throw new Error('Computer-use text response exceeds the size limit.');\n const screenshot = observation.screenshot;\n if (screenshot && (screenshot.mimeType !== 'image/png' || screenshot.data.length > MAX_IMAGE_DATA_LENGTH)) {\n throw new Error('Computer-use screenshot exceeds the image limit.');\n }\n return [\n { type: 'text', text },\n ...(screenshot ? [{ type: 'image' as const, mimeType: screenshot.mimeType, data: screenshot.data }] : []),\n ];\n}\n\nexport function computerObservationOutput(observation: ComputerUseObservation) {\n return { content: content({ ...observation, screenshot: undefined }, observation), details: observation };\n}\n\nexport function computerScriptOutput(result: ComputerScriptExecutionResult) {\n try {\n return {\n content: content(\n { ...result, observation: { ...result.observation, screenshot: undefined } },\n result.observation,\n ),\n details: result,\n };\n } catch (error) {\n if (result.metrics === undefined) throw error;\n // Formatting happens after the actions complete. Preserve that progress so a caller does not replay them.\n throw new ComputerScriptExecutionError(\n error instanceof Error ? error.message : String(error),\n result.metrics.actions,\n false,\n );\n }\n}\n\nexport function computerScriptFailure(error: unknown) {\n const details = {\n error: (error instanceof Error ? error.message : String(error)).slice(0, 1024),\n ...(error instanceof ComputerScriptExecutionError\n ? {\n completedActions: error.completedActions,\n outcomeUncertain: error.outcomeUncertain,\n }\n : {}),\n };\n return { content: [{ type: 'text' as const, text: JSON.stringify(details) }], details, isError: true };\n}\n","import type { DoomToolRestriction } from '@agimon-ai/doompi-core/toolSurface';\nimport type { MinorModeState } from '@agimon-ai/doompi-minor-mode';\n\nimport { COMPUTER_USE_TOOL_NAMES } from '../constants/computerUse';\nimport type { ComputerUseSessionView } from '../types/computerUseApi';\nexport function modeState(state?: ComputerUseSessionView, enabled = false): MinorModeState {\n const phase = state?.phase ?? 'inactive';\n const running = phase !== 'inactive' && phase !== 'failed';\n const modeEnabled = enabled || running;\n const activation = modeEnabled\n ? phase === 'stopping'\n ? 'deactivating'\n : phase === 'awaiting_confirmation' || phase === 'activating'\n ? 'activating'\n : 'active'\n : 'inactive';\n return {\n activation,\n condition:\n phase === 'awaiting_confirmation'\n ? 'blocked'\n : phase === 'failed'\n ? 'failed'\n : phase === 'activating' || phase === 'stopping'\n ? 'queued'\n : 'ready',\n ...(modeEnabled && phase === 'inactive' ? { detail: 'configure computer use in Activity' } : {}),\n ...(phase === 'awaiting_confirmation' ? { detail: 'awaiting confirmation in Activity' } : {}),\n actions: [\n {\n id: 'activate',\n enabled: !modeEnabled,\n ...(!modeEnabled ? {} : { disabledReason: 'Computer use is already enabled.' }),\n },\n {\n id: 'deactivate',\n enabled: modeEnabled,\n ...(modeEnabled ? {} : { disabledReason: 'Computer use is not enabled.' }),\n },\n { id: 'doctor', enabled: true },\n ],\n };\n}\n\n/**\n * Hides the computer-use tools while the mode is off.\n *\n * The arbiter starts from every registered tool, so an active mode only has to\n * return the list untouched: nothing has to add the tools back.\n */\nexport function computerUseRestriction(active: boolean): DoomToolRestriction {\n const owned = new Set<string>(COMPUTER_USE_TOOL_NAMES);\n return (incoming) => (active ? incoming : incoming.filter((name) => !owned.has(name)));\n}\n"],"mappings":";;AAEA,MAAa,gBAAgB;AAC7B,MAAa,yBAAyB;AACtC,MAAa,uBAAuB;AACpC,MAAa,0BAA0B;AACvC,MAAa,+BAA+B;AAC5C,MAAa,+BAA+B;AAE5C,MAAa,sCAAsC;;;;;;;;AASnD,MAAa,sBAAsB;CACjC,UAAU;CACV,YAAY;CACZ,cAAc;CACd,aAAa;CACb,WAAW;CACX,UAAU;CACV,eAAe;CACf,kBAAkB;CAClB,SAAS;CACT,aAAa;CACb,SAAS;AACX;AAEA,MAAa,0BAA0B;;;AC1BvC,MAAM,iBAAiB;AACvB,MAAM,wBAAwB;AAE9B,SAAS,QAAQ,OAAgB,aAAwE;CACvG,MAAM,OAAO,KAAK,UAAU,KAAK;CACjC,IAAI,OAAO,WAAW,IAAI,IAAI,gBAAgB,MAAM,IAAI,MAAM,oDAAoD;CAClH,MAAM,aAAa,YAAY;CAC/B,IAAI,eAAe,WAAW,aAAa,eAAe,WAAW,KAAK,SAAS,wBACjF,MAAM,IAAI,MAAM,kDAAkD;CAEpE,OAAO,CACL;EAAE,MAAM;EAAQ;CAAK,GACrB,GAAI,aAAa,CAAC;EAAE,MAAM;EAAkB,UAAU,WAAW;EAAU,MAAM,WAAW;CAAK,CAAC,IAAI,CAAC,CACzG;AACF;AAEA,SAAgB,0BAA0B,aAAqC;CAC7E,OAAO;EAAE,SAAS,QAAQ;GAAE,GAAG;GAAa,YAAY,KAAA;EAAU,GAAG,WAAW;EAAG,SAAS;CAAY;AAC1G;AAEA,SAAgB,qBAAqB,QAAuC;CAC1E,IAAI;EACF,OAAO;GACL,SAAS,QACP;IAAE,GAAG;IAAQ,aAAa;KAAE,GAAG,OAAO;KAAa,YAAY,KAAA;IAAU;GAAE,GAC3E,OAAO,WACT;GACA,SAAS;EACX;CACF,SAAS,OAAO;EACd,IAAI,OAAO,YAAY,KAAA,GAAW,MAAM;EAExC,MAAM,IAAIA,yBAAAA,6BACR,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACrD,OAAO,QAAQ,SACf,KACF;CACF;AACF;AAEA,SAAgB,sBAAsB,OAAgB;CACpD,MAAM,UAAU;EACd,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAA,CAAG,MAAM,GAAG,IAAI;EAC7E,GAAI,iBAAiBA,yBAAAA,+BACjB;GACE,kBAAkB,MAAM;GACxB,kBAAkB,MAAM;EAC1B,IACA,CAAC;CACP;CACA,OAAO;EAAE,SAAS,CAAC;GAAE,MAAM;GAAiB,MAAM,KAAK,UAAU,OAAO;EAAE,CAAC;EAAG;EAAS,SAAS;CAAK;AACvG;;;ACpDA,SAAgB,UAAU,OAAgC,UAAU,OAAuB;CACzF,MAAM,QAAQ,OAAO,SAAS;CAE9B,MAAM,cAAc,WADJ,UAAU,cAAc,UAAU;CASlD,OAAO;EACL,YARiB,cACf,UAAU,aACR,iBACA,UAAU,2BAA2B,UAAU,eAC7C,eACA,WACJ;EAGF,WACE,UAAU,0BACN,YACA,UAAU,WACR,WACA,UAAU,gBAAgB,UAAU,aAClC,WACA;EACV,GAAI,eAAe,UAAU,aAAa,EAAE,QAAQ,qCAAqC,IAAI,CAAC;EAC9F,GAAI,UAAU,0BAA0B,EAAE,QAAQ,oCAAoC,IAAI,CAAC;EAC3F,SAAS;GACP;IACE,IAAI;IACJ,SAAS,CAAC;IACV,GAAI,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,mCAAmC;GAC/E;GACA;IACE,IAAI;IACJ,SAAS;IACT,GAAI,cAAc,CAAC,IAAI,EAAE,gBAAgB,+BAA+B;GAC1E;GACA;IAAE,IAAI;IAAU,SAAS;GAAK;EAChC;CACF;AACF;;;;;;;AAQA,SAAgB,uBAAuB,QAAsC;CAC3E,MAAM,QAAQ,IAAI,IAAYC,yBAAAA,uBAAuB;CACrD,QAAQ,aAAc,SAAS,WAAW,SAAS,QAAQ,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC;AACtF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as COMPUTER_USE_TOOL_NAMES } from "./extensionService-
|
|
1
|
+
import { n as ComputerScriptExecutionError, s as COMPUTER_USE_TOOL_NAMES } from "./extensionService-BJXeNc4R.mjs";
|
|
2
2
|
//#region src/types/computerUseApi.ts
|
|
3
3
|
const API_BASE_PATH = "computer-use";
|
|
4
4
|
const computerUseChannelType = "computer_use_state";
|
|
@@ -29,6 +29,67 @@ const COMPUTER_USE_ROUTES = {
|
|
|
29
29
|
};
|
|
30
30
|
const COMPUTER_USE_WAKE_LIMIT = 1e6;
|
|
31
31
|
//#endregion
|
|
32
|
+
//#region src/services/computerToolOutput/index.ts
|
|
33
|
+
const MAX_TEXT_BYTES = 262144;
|
|
34
|
+
const MAX_IMAGE_DATA_LENGTH = 8388608;
|
|
35
|
+
function content(value, observation) {
|
|
36
|
+
const text = JSON.stringify(value);
|
|
37
|
+
if (Buffer.byteLength(text) > MAX_TEXT_BYTES) throw new Error("Computer-use text response exceeds the size limit.");
|
|
38
|
+
const screenshot = observation.screenshot;
|
|
39
|
+
if (screenshot && (screenshot.mimeType !== "image/png" || screenshot.data.length > MAX_IMAGE_DATA_LENGTH)) throw new Error("Computer-use screenshot exceeds the image limit.");
|
|
40
|
+
return [{
|
|
41
|
+
type: "text",
|
|
42
|
+
text
|
|
43
|
+
}, ...screenshot ? [{
|
|
44
|
+
type: "image",
|
|
45
|
+
mimeType: screenshot.mimeType,
|
|
46
|
+
data: screenshot.data
|
|
47
|
+
}] : []];
|
|
48
|
+
}
|
|
49
|
+
function computerObservationOutput(observation) {
|
|
50
|
+
return {
|
|
51
|
+
content: content({
|
|
52
|
+
...observation,
|
|
53
|
+
screenshot: void 0
|
|
54
|
+
}, observation),
|
|
55
|
+
details: observation
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function computerScriptOutput(result) {
|
|
59
|
+
try {
|
|
60
|
+
return {
|
|
61
|
+
content: content({
|
|
62
|
+
...result,
|
|
63
|
+
observation: {
|
|
64
|
+
...result.observation,
|
|
65
|
+
screenshot: void 0
|
|
66
|
+
}
|
|
67
|
+
}, result.observation),
|
|
68
|
+
details: result
|
|
69
|
+
};
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (result.metrics === void 0) throw error;
|
|
72
|
+
throw new ComputerScriptExecutionError(error instanceof Error ? error.message : String(error), result.metrics.actions, false);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function computerScriptFailure(error) {
|
|
76
|
+
const details = {
|
|
77
|
+
error: (error instanceof Error ? error.message : String(error)).slice(0, 1024),
|
|
78
|
+
...error instanceof ComputerScriptExecutionError ? {
|
|
79
|
+
completedActions: error.completedActions,
|
|
80
|
+
outcomeUncertain: error.outcomeUncertain
|
|
81
|
+
} : {}
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
content: [{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify(details)
|
|
87
|
+
}],
|
|
88
|
+
details,
|
|
89
|
+
isError: true
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
32
93
|
//#region src/models/computerUseMode.ts
|
|
33
94
|
function modeState(state, enabled = false) {
|
|
34
95
|
const phase = state?.phase ?? "inactive";
|
|
@@ -67,6 +128,6 @@ function computerUseRestriction(active) {
|
|
|
67
128
|
return (incoming) => active ? incoming : incoming.filter((name) => !owned.has(name));
|
|
68
129
|
}
|
|
69
130
|
//#endregion
|
|
70
|
-
export {
|
|
131
|
+
export { computerScriptOutput as a, COMPUTER_USE_MAX_DURATION_MS as c, COMPUTER_USE_ROUTES as d, COMPUTER_USE_STATUS_KEY as f, computerScriptFailure as i, COMPUTER_USE_MODE_ID as l, computerUseChannelType as m, modeState as n, API_BASE_PATH as o, COMPUTER_USE_WAKE_LIMIT as p, computerObservationOutput as r, COMPUTER_USE_CONFIRMATION_WINDOW_MS as s, computerUseRestriction as t, COMPUTER_USE_MODE_STATUS_KEY as u };
|
|
71
132
|
|
|
72
|
-
//# sourceMappingURL=computerUseMode-
|
|
133
|
+
//# sourceMappingURL=computerUseMode-DTXNRobA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computerUseMode-DTXNRobA.mjs","names":[],"sources":["../src/types/computerUseApi.ts","../src/services/computerToolOutput/index.ts","../src/models/computerUseMode.ts"],"sourcesContent":["import type { DoomApiCaller } from '@agimon-ai/doompi-core/packageApi';\n\nexport const API_BASE_PATH = 'computer-use';\nexport const computerUseChannelType = 'computer_use_state';\nexport const COMPUTER_USE_MODE_ID = 'computer-use';\nexport const COMPUTER_USE_STATUS_KEY = 'doom-computer-use';\nexport const COMPUTER_USE_MODE_STATUS_KEY = 'doom-computer-use-mode';\nexport const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;\nexport const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;\nexport const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;\n\n/**\n * Every path this API answers on, below its mount.\n *\n * The typed route table in `./apiRoutes` is built from this, the dispatcher\n * reads that table, and the hub channel addresses the broker with these same\n * strings, so a route cannot move on one side alone.\n */\nexport const COMPUTER_USE_ROUTES = {\n activate: '/activate',\n agentState: '/agent/state',\n agentObserve: '/agent/observe',\n agentAction: '/agent/action',\n agentStop: '/agent/stop',\n hubState: '/hub/state',\n hubActivation: '/hub/activation',\n hubAuthorization: '/hub/authorization',\n hubNext: '/hub/next',\n hubComplete: '/hub/complete',\n hubStop: '/hub/stop',\n} as const;\n\nexport const COMPUTER_USE_WAKE_LIMIT = 1_000_000;\n\nexport interface ComputerUseArtifactView {\n readonly artifactId: string;\n readonly status: 'ready' | 'failed';\n readonly downloadUrl?: string;\n readonly previewUrl?: string;\n readonly actionCount?: number;\n readonly completedAt?: string;\n readonly failure?: { readonly code: string; readonly message: string };\n}\n\nexport interface ComputerUseSessionView {\n readonly sessionId: string;\n readonly revision: number;\n readonly wake: number;\n readonly phase: 'inactive' | 'awaiting_confirmation' | 'activating' | 'active' | 'stopping' | 'failed';\n readonly requestId?: string;\n readonly target?: Record<string, unknown>;\n readonly durationMs?: number;\n readonly expiresAt?: number;\n readonly failure?: { readonly code: string; readonly message: string };\n readonly artifact?: ComputerUseArtifactView;\n}\n\nexport interface ComputerUseActivationRequest {\n readonly requestId: string;\n readonly target: Record<string, unknown>;\n readonly durationSeconds: number;\n readonly createdAt: number;\n readonly confirmationExpiresAt: number;\n readonly caller: DoomApiCaller;\n}\n\nexport interface ComputerUseBrokerRequest {\n readonly id: string;\n readonly operation: 'observe' | 'act';\n readonly payload?: unknown;\n readonly grantId: string;\n readonly sequence?: number;\n}\n\nexport interface ComputerUseChannelPayload {\n readonly state: ComputerUseSessionView;\n readonly targets: readonly Record<string, unknown>[];\n readonly busy?: true;\n}\n\nexport type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };\n","import type { DoomHeadlessToolResult } from '@agimon-ai/doompi-core/headless';\n\nimport type { ComputerScriptExecutionResult } from '../../types/computerScript';\nimport type { ComputerUseObservation } from '../../types/computerUse';\nimport { ComputerScriptExecutionError } from '../computerScriptRunner';\n\nconst MAX_TEXT_BYTES = 256 * 1024;\nconst MAX_IMAGE_DATA_LENGTH = 8 * 1024 * 1024;\n\nfunction content(value: unknown, observation: ComputerUseObservation): DoomHeadlessToolResult['content'] {\n const text = JSON.stringify(value);\n if (Buffer.byteLength(text) > MAX_TEXT_BYTES) throw new Error('Computer-use text response exceeds the size limit.');\n const screenshot = observation.screenshot;\n if (screenshot && (screenshot.mimeType !== 'image/png' || screenshot.data.length > MAX_IMAGE_DATA_LENGTH)) {\n throw new Error('Computer-use screenshot exceeds the image limit.');\n }\n return [\n { type: 'text', text },\n ...(screenshot ? [{ type: 'image' as const, mimeType: screenshot.mimeType, data: screenshot.data }] : []),\n ];\n}\n\nexport function computerObservationOutput(observation: ComputerUseObservation) {\n return { content: content({ ...observation, screenshot: undefined }, observation), details: observation };\n}\n\nexport function computerScriptOutput(result: ComputerScriptExecutionResult) {\n try {\n return {\n content: content(\n { ...result, observation: { ...result.observation, screenshot: undefined } },\n result.observation,\n ),\n details: result,\n };\n } catch (error) {\n if (result.metrics === undefined) throw error;\n // Formatting happens after the actions complete. Preserve that progress so a caller does not replay them.\n throw new ComputerScriptExecutionError(\n error instanceof Error ? error.message : String(error),\n result.metrics.actions,\n false,\n );\n }\n}\n\nexport function computerScriptFailure(error: unknown) {\n const details = {\n error: (error instanceof Error ? error.message : String(error)).slice(0, 1024),\n ...(error instanceof ComputerScriptExecutionError\n ? {\n completedActions: error.completedActions,\n outcomeUncertain: error.outcomeUncertain,\n }\n : {}),\n };\n return { content: [{ type: 'text' as const, text: JSON.stringify(details) }], details, isError: true };\n}\n","import type { DoomToolRestriction } from '@agimon-ai/doompi-core/toolSurface';\nimport type { MinorModeState } from '@agimon-ai/doompi-minor-mode';\n\nimport { COMPUTER_USE_TOOL_NAMES } from '../constants/computerUse';\nimport type { ComputerUseSessionView } from '../types/computerUseApi';\nexport function modeState(state?: ComputerUseSessionView, enabled = false): MinorModeState {\n const phase = state?.phase ?? 'inactive';\n const running = phase !== 'inactive' && phase !== 'failed';\n const modeEnabled = enabled || running;\n const activation = modeEnabled\n ? phase === 'stopping'\n ? 'deactivating'\n : phase === 'awaiting_confirmation' || phase === 'activating'\n ? 'activating'\n : 'active'\n : 'inactive';\n return {\n activation,\n condition:\n phase === 'awaiting_confirmation'\n ? 'blocked'\n : phase === 'failed'\n ? 'failed'\n : phase === 'activating' || phase === 'stopping'\n ? 'queued'\n : 'ready',\n ...(modeEnabled && phase === 'inactive' ? { detail: 'configure computer use in Activity' } : {}),\n ...(phase === 'awaiting_confirmation' ? { detail: 'awaiting confirmation in Activity' } : {}),\n actions: [\n {\n id: 'activate',\n enabled: !modeEnabled,\n ...(!modeEnabled ? {} : { disabledReason: 'Computer use is already enabled.' }),\n },\n {\n id: 'deactivate',\n enabled: modeEnabled,\n ...(modeEnabled ? {} : { disabledReason: 'Computer use is not enabled.' }),\n },\n { id: 'doctor', enabled: true },\n ],\n };\n}\n\n/**\n * Hides the computer-use tools while the mode is off.\n *\n * The arbiter starts from every registered tool, so an active mode only has to\n * return the list untouched: nothing has to add the tools back.\n */\nexport function computerUseRestriction(active: boolean): DoomToolRestriction {\n const owned = new Set<string>(COMPUTER_USE_TOOL_NAMES);\n return (incoming) => (active ? incoming : incoming.filter((name) => !owned.has(name)));\n}\n"],"mappings":"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"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
const require_extensionService = require("./extensionService-
|
|
1
|
+
const require_extensionService = require("./extensionService-CZS-zDP0.cjs");
|
|
2
2
|
let node_path = require("node:path");
|
|
3
3
|
node_path = require_extensionService.__toESM(node_path, 1);
|
|
4
4
|
let _agimon_ai_doompi_config = require("@agimon-ai/doompi-config");
|
|
5
|
+
//#region src/services/sessionApiClient/index.ts
|
|
6
|
+
/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */
|
|
7
|
+
function createComputerUseSessionClient(host) {
|
|
8
|
+
return host;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
5
11
|
//#region src/services/dependencies/index.ts
|
|
6
12
|
const COMPUTER_USE_SCRIPT_PATHS_ENV = "DOOMPI_COMPUTER_USE_SCRIPT_PATHS";
|
|
7
13
|
function createComputerUseDependencies(overrides = {}) {
|
|
8
|
-
const client = overrides.client ??
|
|
14
|
+
const client = overrides.client ?? createComputerUseSessionClient();
|
|
9
15
|
const allowedScriptPaths = (process.env["DOOMPI_COMPUTER_USE_SCRIPT_PATHS"] ?? "").split(node_path.default.delimiter).filter((entry) => entry.length > 0);
|
|
10
16
|
return {
|
|
11
17
|
service: overrides.service ?? new require_extensionService.DefaultComputerUseExtensionService(client),
|
|
@@ -30,5 +36,11 @@ Object.defineProperty(exports, "createComputerUseDependencies", {
|
|
|
30
36
|
return createComputerUseDependencies;
|
|
31
37
|
}
|
|
32
38
|
});
|
|
39
|
+
Object.defineProperty(exports, "createComputerUseSessionClient", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function() {
|
|
42
|
+
return createComputerUseSessionClient;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
33
45
|
|
|
34
|
-
//# sourceMappingURL=dependencies-
|
|
46
|
+
//# sourceMappingURL=dependencies-Dub2ybTN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies-Dub2ybTN.cjs","names":["path","DefaultComputerUseExtensionService","loadDoomConfig","ComputerScriptRunner"],"sources":["../src/services/sessionApiClient/index.ts","../src/services/dependencies/index.ts"],"sourcesContent":["import type { ComputerUseSessionClient } from '../../types/computerUse';\n\nexport type { ComputerUseSessionClient } from '../../types/computerUse';\n\n/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */\nexport function createComputerUseSessionClient(host?: ComputerUseSessionClient): ComputerUseSessionClient | undefined {\n return host;\n}\n","import path from 'node:path';\n\nimport { loadDoomConfig } from '@agimon-ai/doompi-config';\n\nimport type { ComputerUseExtensionDependencies } from '../../types/extension';\nimport { ComputerScriptRunner } from '../computerScriptRunner';\nimport { DefaultComputerUseExtensionService } from '../extensionService';\nimport { createComputerUseSessionClient } from '../sessionApiClient';\n\nexport const COMPUTER_USE_SCRIPT_PATHS_ENV = 'DOOMPI_COMPUTER_USE_SCRIPT_PATHS';\nexport function createComputerUseDependencies(\n overrides: Partial<ComputerUseExtensionDependencies> = {},\n): ComputerUseExtensionDependencies {\n const client = overrides.client ?? createComputerUseSessionClient();\n const allowedScriptPaths = (process.env[COMPUTER_USE_SCRIPT_PATHS_ENV] ?? '')\n .split(path.delimiter)\n .filter((entry) => entry.length > 0);\n return {\n service: overrides.service ?? new DefaultComputerUseExtensionService(client),\n enabled:\n overrides.enabled ??\n (() => loadDoomConfig(process.env.PI_PROJECT_ROOT ?? process.cwd()).computerUse?.enabled === true),\n ...(client === undefined ? {} : { client }),\n ...(overrides.scriptRunner !== undefined\n ? { scriptRunner: overrides.scriptRunner }\n : client === undefined\n ? {}\n : { scriptRunner: new ComputerScriptRunner({ client, allowedScriptPaths }) }),\n };\n}\n"],"mappings":";;;;;;AAKA,SAAgB,+BAA+B,MAAuE;CACpH,OAAO;AACT;;;ACEA,MAAa,gCAAgC;AAC7C,SAAgB,8BACd,YAAuD,CAAC,GACtB;CAClC,MAAM,SAAS,UAAU,UAAU,+BAA+B;CAClE,MAAM,sBAAsB,QAAQ,IAAA,uCAAsC,GAAA,CACvE,MAAMA,UAAAA,QAAK,SAAS,CAAC,CACrB,QAAQ,UAAU,MAAM,SAAS,CAAC;CACrC,OAAO;EACL,SAAS,UAAU,WAAW,IAAIC,yBAAAA,mCAAmC,MAAM;EAC3E,SACE,UAAU,mBAAA,GACHC,yBAAAA,eAAAA,CAAe,QAAQ,IAAI,mBAAmB,QAAQ,IAAI,CAAC,CAAC,CAAC,aAAa,YAAY;EAC/F,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC,GAAI,UAAU,iBAAiB,KAAA,IAC3B,EAAE,cAAc,UAAU,aAAa,IACvC,WAAW,KAAA,IACT,CAAC,IACD,EAAE,cAAc,IAAIC,yBAAAA,qBAAqB;GAAE;GAAQ;EAAmB,CAAC,EAAE;CACjF;AACF"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as ComputerScriptRunner, t as DefaultComputerUseExtensionService } from "./extensionService-BJXeNc4R.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { loadDoomConfig } from "@agimon-ai/doompi-config";
|
|
4
|
+
//#region src/services/sessionApiClient/index.ts
|
|
5
|
+
/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */
|
|
6
|
+
function createComputerUseSessionClient(host) {
|
|
7
|
+
return host;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
4
10
|
//#region src/services/dependencies/index.ts
|
|
5
11
|
const COMPUTER_USE_SCRIPT_PATHS_ENV = "DOOMPI_COMPUTER_USE_SCRIPT_PATHS";
|
|
6
12
|
function createComputerUseDependencies(overrides = {}) {
|
|
@@ -17,6 +23,6 @@ function createComputerUseDependencies(overrides = {}) {
|
|
|
17
23
|
};
|
|
18
24
|
}
|
|
19
25
|
//#endregion
|
|
20
|
-
export { createComputerUseDependencies as n, COMPUTER_USE_SCRIPT_PATHS_ENV as t };
|
|
26
|
+
export { createComputerUseDependencies as n, createComputerUseSessionClient as r, COMPUTER_USE_SCRIPT_PATHS_ENV as t };
|
|
21
27
|
|
|
22
|
-
//# sourceMappingURL=dependencies-
|
|
28
|
+
//# sourceMappingURL=dependencies-Y1TS7gGv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies-Y1TS7gGv.mjs","names":[],"sources":["../src/services/sessionApiClient/index.ts","../src/services/dependencies/index.ts"],"sourcesContent":["import type { ComputerUseSessionClient } from '../../types/computerUse';\n\nexport type { ComputerUseSessionClient } from '../../types/computerUse';\n\n/** Uses the injected host-owned service. Absence never triggers transport or credential discovery. */\nexport function createComputerUseSessionClient(host?: ComputerUseSessionClient): ComputerUseSessionClient | undefined {\n return host;\n}\n","import path from 'node:path';\n\nimport { loadDoomConfig } from '@agimon-ai/doompi-config';\n\nimport type { ComputerUseExtensionDependencies } from '../../types/extension';\nimport { ComputerScriptRunner } from '../computerScriptRunner';\nimport { DefaultComputerUseExtensionService } from '../extensionService';\nimport { createComputerUseSessionClient } from '../sessionApiClient';\n\nexport const COMPUTER_USE_SCRIPT_PATHS_ENV = 'DOOMPI_COMPUTER_USE_SCRIPT_PATHS';\nexport function createComputerUseDependencies(\n overrides: Partial<ComputerUseExtensionDependencies> = {},\n): ComputerUseExtensionDependencies {\n const client = overrides.client ?? createComputerUseSessionClient();\n const allowedScriptPaths = (process.env[COMPUTER_USE_SCRIPT_PATHS_ENV] ?? '')\n .split(path.delimiter)\n .filter((entry) => entry.length > 0);\n return {\n service: overrides.service ?? new DefaultComputerUseExtensionService(client),\n enabled:\n overrides.enabled ??\n (() => loadDoomConfig(process.env.PI_PROJECT_ROOT ?? process.cwd()).computerUse?.enabled === true),\n ...(client === undefined ? {} : { client }),\n ...(overrides.scriptRunner !== undefined\n ? { scriptRunner: overrides.scriptRunner }\n : client === undefined\n ? {}\n : { scriptRunner: new ComputerScriptRunner({ client, allowedScriptPaths }) }),\n };\n}\n"],"mappings":";;;;;AAKA,SAAgB,+BAA+B,MAAuE;CACpH,OAAO;AACT;;;ACEA,MAAa,gCAAgC;AAC7C,SAAgB,8BACd,YAAuD,CAAC,GACtB;CAClC,MAAM,SAAS,UAAU,UAAU,+BAA+B;CAClE,MAAM,sBAAsB,QAAQ,IAAA,uCAAsC,GAAA,CACvE,MAAM,KAAK,SAAS,CAAC,CACrB,QAAQ,UAAU,MAAM,SAAS,CAAC;CACrC,OAAO;EACL,SAAS,UAAU,WAAW,IAAI,mCAAmC,MAAM;EAC3E,SACE,UAAU,kBACH,eAAe,QAAQ,IAAI,mBAAmB,QAAQ,IAAI,CAAC,CAAC,CAAC,aAAa,YAAY;EAC/F,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC,GAAI,UAAU,iBAAiB,KAAA,IAC3B,EAAE,cAAc,UAAU,aAAa,IACvC,WAAW,KAAA,IACT,CAAC,IACD,EAAE,cAAc,IAAI,qBAAqB;GAAE;GAAQ;EAAmB,CAAC,EAAE;CACjF;AACF"}
|