@agimon-ai/po-computer-use 0.0.0-alpha.13 → 0.0.0-alpha.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +149 -21
  2. package/README.md +6 -3
  3. package/dist/apiContracts.cjs +49 -3
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts.map +1 -1
  6. package/dist/apiContracts.mjs +49 -3
  7. package/dist/apiContracts.mjs.map +1 -1
  8. package/dist/extensionService-BB08HbHP.cjs +1214 -0
  9. package/dist/extensionService-BB08HbHP.cjs.map +1 -0
  10. package/dist/extensionService-D8bAAsIN.mjs +1066 -0
  11. package/dist/extensionService-D8bAAsIN.mjs.map +1 -0
  12. package/dist/extensions/mcp.cjs.map +1 -1
  13. package/dist/extensions/mcp.mjs.map +1 -1
  14. package/dist/extensions/native.mjs +1616 -6
  15. package/dist/extensions/native.mjs.map +1 -1
  16. package/dist/extensions/server.cjs +623 -612
  17. package/dist/extensions/server.cjs.map +1 -1
  18. package/dist/extensions/server.d.mts +2 -2
  19. package/dist/extensions/server.d.mts.map +1 -1
  20. package/dist/extensions/server.mjs +591 -580
  21. package/dist/extensions/server.mjs.map +1 -1
  22. package/dist/extensions/web.mjs +993 -376
  23. package/dist/extensions/web.mjs.map +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.mts +35 -2
  26. package/dist/index.d.mts.map +1 -1
  27. package/dist/index.mjs +1 -1
  28. package/docs/remote-computer-use.md +29 -0
  29. package/llms.txt +1 -1
  30. package/package.json +66 -21
  31. package/src/prompts/codemode-how-to-computer-use/SKILL.md +73 -0
  32. package/src/types/computerUse.ts +32 -1
  33. package/src/types/computerUseApi.ts +8 -0
  34. package/dist/extensionService-Bp0q295i.cjs +0 -504
  35. package/dist/extensionService-Bp0q295i.cjs.map +0 -1
  36. package/dist/extensionService-DXvF7esO.mjs +0 -434
  37. package/dist/extensionService-DXvF7esO.mjs.map +0 -1
  38. package/src/prompts/po-use-computer-use/SKILL.md +0 -34
@@ -1,19 +1,447 @@
1
- import { defineActivityGroup, defineChannelFile, defineNativePlugin, defineSessionStore } from "@agimon-ai/po-core/native";
1
+ import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, defineSettingsPanel, defineToolRenderer, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
2
+ import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
3
+ import { AppState } from "react-native";
4
+ import { View } from "react-native-unistyles/components/native/View";
5
+ import { Text } from "react-native-unistyles/components/native/Text";
6
+ import { Badge, Button, CheckIcon, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, Panel, SegmentedControl, fontOf, toolTone } from "@agimon-ai/po-native-components";
7
+ import { StyleSheet } from "react-native-unistyles";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
9
  //#region src/types/computerUseApi.ts
3
10
  const computerUseChannelType = "computer_use_state";
11
+ const COMPUTER_USE_STATUS_KEY = "po-computer-use";
12
+ const COMPUTER_USE_MAX_DURATION_MS = 18e5;
13
+ const COMPUTER_USE_DEFAULT_DURATION_MS = 3e5;
14
+ /** The session lengths a person can pick when granting control, up to the maximum. */
15
+ const COMPUTER_USE_DURATION_CHOICES_MS = [
16
+ COMPUTER_USE_DEFAULT_DURATION_MS,
17
+ 9e5,
18
+ COMPUTER_USE_MAX_DURATION_MS
19
+ ];
20
+ /**
21
+ * Every path this API answers on, below its mount.
22
+ *
23
+ * The typed route table in `./apiRoutes` is built from this, the dispatcher
24
+ * reads that table, and the hub channel addresses the broker with these same
25
+ * strings, so a route cannot move on one side alone.
26
+ */
27
+ const COMPUTER_USE_ROUTES = {
28
+ activate: "/activate",
29
+ artifact: "/artifact",
30
+ agentState: "/agent/state",
31
+ agentObserve: "/agent/observe",
32
+ agentAction: "/agent/action",
33
+ agentStop: "/agent/stop",
34
+ hubState: "/hub/state",
35
+ hubActivation: "/hub/activation",
36
+ hubAuthorization: "/hub/authorization",
37
+ hubNext: "/hub/next",
38
+ hubComplete: "/hub/complete",
39
+ hubStop: "/hub/stop"
40
+ };
41
+ //#endregion
42
+ //#region src/types/desktopPermissions.ts
43
+ /** The macOS privacy permissions Desktop reports, in the order the settings page shows them. */
44
+ const DESKTOP_PERMISSIONS = [
45
+ "accessibility",
46
+ "screen-recording",
47
+ "microphone",
48
+ "automation",
49
+ "full-disk-access"
50
+ ];
51
+ //#endregion
52
+ //#region src/types/apiRoutes.ts
53
+ /**
54
+ * This package's routes, as data.
55
+ *
56
+ * No scope and no base path: the build reads both off
57
+ * `src/extensions/workspaces/sessions/(backend)/api/computer-use/`, so the
58
+ * mount is stated once, by the folder that creates it.
59
+ *
60
+ * The paths come from `COMPUTER_USE_ROUTES` rather than being written out
61
+ * again. That table already addressed the broker from the hub channel and from
62
+ * the broker's own dispatcher, and a second copy here is exactly the
63
+ * disagreement this file exists to prevent. The dispatcher now reads this
64
+ * table, so the page, the broker and the hub all resolve one set of strings.
65
+ *
66
+ * Activation, status, cancellation and recording reads are reachable from a browser. The `/agent/` and `/hub/` routes
67
+ * each demand a host-issued bearer token and answer 404 without one; they are
68
+ * declared here because they are this API's surface, not because a page calls
69
+ * them.
70
+ */
71
+ const routes = {
72
+ artifact: {
73
+ method: "GET",
74
+ path: COMPUTER_USE_ROUTES.artifact,
75
+ query: ["artifactId", "offset"],
76
+ raw: true
77
+ },
78
+ activationState: {
79
+ method: "GET",
80
+ path: COMPUTER_USE_ROUTES.activate,
81
+ response: void 0
82
+ },
83
+ cancelActivation: {
84
+ method: "DELETE",
85
+ path: COMPUTER_USE_ROUTES.activate,
86
+ response: void 0
87
+ },
88
+ activate: {
89
+ method: "POST",
90
+ path: COMPUTER_USE_ROUTES.activate,
91
+ response: void 0
92
+ },
93
+ agentState: {
94
+ method: "GET",
95
+ path: COMPUTER_USE_ROUTES.agentState,
96
+ response: void 0
97
+ },
98
+ /** Answers whatever the admitted Desktop provider returned, which is runtime-defined JSON. */
99
+ agentObserve: {
100
+ method: "POST",
101
+ path: COMPUTER_USE_ROUTES.agentObserve,
102
+ response: void 0
103
+ },
104
+ agentAction: {
105
+ method: "POST",
106
+ path: COMPUTER_USE_ROUTES.agentAction,
107
+ response: void 0
108
+ },
109
+ agentStop: {
110
+ method: "POST",
111
+ path: COMPUTER_USE_ROUTES.agentStop,
112
+ response: void 0
113
+ },
114
+ hubState: {
115
+ method: "GET",
116
+ path: COMPUTER_USE_ROUTES.hubState,
117
+ response: void 0
118
+ },
119
+ /** Null until a reader has confirmed one; reading it moves the session to `activating`. */
120
+ hubActivation: {
121
+ method: "GET",
122
+ path: COMPUTER_USE_ROUTES.hubActivation,
123
+ response: void 0
124
+ },
125
+ hubAuthorization: {
126
+ method: "GET",
127
+ path: COMPUTER_USE_ROUTES.hubAuthorization,
128
+ response: void 0
129
+ },
130
+ hubNext: {
131
+ method: "GET",
132
+ path: COMPUTER_USE_ROUTES.hubNext,
133
+ response: void 0
134
+ },
135
+ hubComplete: {
136
+ method: "POST",
137
+ path: COMPUTER_USE_ROUTES.hubComplete,
138
+ response: void 0
139
+ },
140
+ hubStop: {
141
+ method: "POST",
142
+ path: COMPUTER_USE_ROUTES.hubStop,
143
+ response: void 0
144
+ },
145
+ /** Desktop's macOS permission states, served by the hub's `desktop-permissions` mount. */
146
+ desktopPermissions: {
147
+ method: "GET",
148
+ path: "/",
149
+ response: void 0
150
+ },
151
+ /** Asks macOS for the body's permission on the Mac running Desktop; answers the states after. */
152
+ requestDesktopPermission: {
153
+ method: "POST",
154
+ path: "/",
155
+ response: void 0
156
+ }
157
+ };
158
+ //#endregion
159
+ //#region src/extensions/(frontend)/setting/_lib/desktopPermissions.native.ts
160
+ /** Reads the Mac, never the phone. A request uses the host's step-up transport. */
161
+ async function readDesktopPermissions(request, permission) {
162
+ try {
163
+ const api = createApiClient(routes, {
164
+ scopes: ["global"],
165
+ basePath: "desktop-permissions",
166
+ transport: request,
167
+ sessionAddress: sessionApiAddress
168
+ });
169
+ const route = permission === void 0 ? api.global.desktopPermissions : api.global.requestDesktopPermission;
170
+ const response = await request(route.url(), permission === void 0 ? void 0 : {
171
+ method: route.spec.method,
172
+ headers: { "content-type": "application/json" },
173
+ body: JSON.stringify({ permission })
174
+ });
175
+ if (response.status === 404) return { status: "unavailable" };
176
+ const body = await response.json().catch(() => void 0);
177
+ if (typeof body === "object" && body !== null && !Array.isArray(body)) {
178
+ const record = body;
179
+ if (response.ok && !("error" in record) && DESKTOP_PERMISSIONS.every((key) => [
180
+ "granted",
181
+ "denied",
182
+ "not-determined",
183
+ "per-app"
184
+ ].includes(record[key]))) return {
185
+ status: "ready",
186
+ states: record
187
+ };
188
+ if (typeof record.error === "string") return {
189
+ status: "error",
190
+ error: record.error
191
+ };
192
+ }
193
+ return {
194
+ status: "error",
195
+ error: "Po Desktop did not return permission states. Try again."
196
+ };
197
+ } catch (error) {
198
+ return {
199
+ status: "error",
200
+ error: error instanceof Error ? error.message : String(error)
201
+ };
202
+ }
203
+ }
204
+ //#endregion
205
+ //#region src/extensions/(frontend)/setting/_components/DesktopPermissionsView.native.tsx
206
+ const COPY = {
207
+ accessibility: {
208
+ title: "Accessibility",
209
+ detail: "Lets Po press buttons, fill fields and scroll in the app window you approve for computer use."
210
+ },
211
+ "screen-recording": {
212
+ title: "Screen and system audio recording",
213
+ detail: "Lets Po see and record the window you approve, with its sound. macOS asks you to reopen Po after you allow it."
214
+ },
215
+ microphone: {
216
+ title: "Microphone",
217
+ detail: "Lets you talk to Po, and adds your voice to computer-use recordings."
218
+ },
219
+ automation: {
220
+ title: "Automation",
221
+ detail: "Lets Po and its agents control other apps, such as Finder or Mail. macOS asks once for each app; your answers are listed in System Settings."
222
+ },
223
+ "full-disk-access": {
224
+ title: "Full Disk Access",
225
+ detail: "Optional. Lets agents and their tools read Documents, Downloads and Mail without a prompt for each folder."
226
+ }
227
+ };
228
+ const LABEL = {
229
+ granted: "Allowed",
230
+ denied: "Not allowed",
231
+ "not-determined": "Not asked yet",
232
+ "per-app": "Asked per app"
233
+ };
234
+ function DesktopPermissionsView({ state, remote = true, onAsk, onRefresh }) {
235
+ return /* @__PURE__ */ jsxs(View, {
236
+ style: styles$5.page,
237
+ children: [/* @__PURE__ */ jsxs(View, {
238
+ style: styles$5.sectionHead,
239
+ children: [/* @__PURE__ */ jsxs(View, {
240
+ style: styles$5.sectionText,
241
+ children: [/* @__PURE__ */ jsx(Text, {
242
+ accessibilityRole: "header",
243
+ style: styles$5.sectionTitle,
244
+ children: "On the paired Mac"
245
+ }), /* @__PURE__ */ jsx(Text, {
246
+ style: styles$5.detail,
247
+ children: remote ? "These belong to the Mac running Po Desktop. When you ask from here, macOS shows its prompt on that Mac." : "Po asks macOS for each one when you are ready. The permission prompt appears on the Mac running Po Desktop. You can change them any time in System Settings, Privacy and Security."
248
+ })]
249
+ }), state.status === "ready" ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
250
+ variant: "ghost",
251
+ disabled: state.asking !== void 0,
252
+ accessibilityLabel: "Permissions actions for the paired Mac",
253
+ style: styles$5.control,
254
+ children: "⋯"
255
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, { children: /* @__PURE__ */ jsx(DropdownMenuItem, {
256
+ onSelect: onRefresh,
257
+ children: "Check again"
258
+ }) })] }) : null]
259
+ }), /* @__PURE__ */ jsx(Panel, {
260
+ style: styles$5.card,
261
+ children: state.status === "ready" ? DESKTOP_PERMISSIONS.map((permission, index) => {
262
+ const value = state.states[permission];
263
+ const asking = state.asking === permission;
264
+ const action = asking ? "Waiting for macOS" : value === "not-determined" ? "Allow" : "Open System Settings";
265
+ return /* @__PURE__ */ jsxs(View, {
266
+ style: [styles$5.row, index > 0 && styles$5.divider],
267
+ children: [
268
+ /* @__PURE__ */ jsxs(View, {
269
+ style: styles$5.rowHeading,
270
+ children: [/* @__PURE__ */ jsx(Text, {
271
+ style: styles$5.rowTitle,
272
+ children: COPY[permission].title
273
+ }), /* @__PURE__ */ jsx(Badge, {
274
+ tone: value === "granted" ? "green" : "neutral",
275
+ children: LABEL[value]
276
+ })]
277
+ }),
278
+ /* @__PURE__ */ jsx(Text, {
279
+ style: styles$5.detail,
280
+ children: COPY[permission].detail
281
+ }),
282
+ value !== "granted" ? /* @__PURE__ */ jsx(Button, {
283
+ variant: "outline",
284
+ style: styles$5.control,
285
+ disabled: state.asking !== void 0,
286
+ accessibilityLabel: `${action}: ${COPY[permission].title} on the paired Mac`,
287
+ onPress: () => onAsk(permission),
288
+ children: action
289
+ }) : null,
290
+ asking ? /* @__PURE__ */ jsx(Text, {
291
+ accessibilityLiveRegion: "polite",
292
+ style: styles$5.detail,
293
+ children: "Waiting for your answer on the Mac."
294
+ }) : null
295
+ ]
296
+ }, permission);
297
+ }) : /* @__PURE__ */ jsxs(View, {
298
+ style: styles$5.row,
299
+ children: [
300
+ /* @__PURE__ */ jsx(Text, {
301
+ accessibilityRole: state.status === "error" ? "alert" : "header",
302
+ style: styles$5.rowTitle,
303
+ children: state.status === "loading" ? "Checking with macOS" : state.status === "unavailable" ? "Po Desktop is not running here" : "Po couldn't read the permissions just now"
304
+ }),
305
+ /* @__PURE__ */ jsx(Text, {
306
+ style: styles$5.detail,
307
+ children: state.status === "loading" ? "This takes a moment." : state.status === "unavailable" ? "Permissions belong to the Mac running Po Desktop. Open Po Desktop there to see and change them." : state.error
308
+ }),
309
+ state.status === "error" ? /* @__PURE__ */ jsx(Button, {
310
+ variant: "outline",
311
+ style: styles$5.control,
312
+ accessibilityLabel: "Try reading permissions from the paired Mac again",
313
+ onPress: onRefresh,
314
+ children: "Try again"
315
+ }) : null
316
+ ]
317
+ })
318
+ })]
319
+ });
320
+ }
321
+ const styles$5 = StyleSheet.create((theme) => ({
322
+ page: {
323
+ gap: theme.spacing(5),
324
+ uni__dependencies: [0]
325
+ },
326
+ sectionHead: {
327
+ flexDirection: "row",
328
+ alignItems: "flex-start",
329
+ gap: theme.spacing(2),
330
+ uni__dependencies: [0]
331
+ },
332
+ sectionText: {
333
+ flex: 1,
334
+ minWidth: 0,
335
+ gap: theme.spacing(2),
336
+ uni__dependencies: [0]
337
+ },
338
+ sectionTitle: {
339
+ fontFamily: fontOf(theme.fontFamily.sans),
340
+ fontSize: theme.fontSize.lg,
341
+ lineHeight: theme.lineHeight.lg,
342
+ fontWeight: theme.fontWeight.semibold,
343
+ color: theme.colors.hi,
344
+ uni__dependencies: [0]
345
+ },
346
+ detail: {
347
+ fontFamily: fontOf(theme.fontFamily.sans),
348
+ fontSize: theme.fontSize.sm,
349
+ lineHeight: theme.lineHeightRelaxed.sm,
350
+ color: theme.colors.dim,
351
+ uni__dependencies: [0]
352
+ },
353
+ card: {
354
+ padding: 0,
355
+ overflow: "hidden"
356
+ },
357
+ row: {
358
+ padding: theme.spacing(4),
359
+ gap: theme.spacing(3),
360
+ uni__dependencies: [0]
361
+ },
362
+ rowHeading: {
363
+ flexDirection: "row",
364
+ flexWrap: "wrap",
365
+ alignItems: "center",
366
+ gap: theme.spacing(2),
367
+ uni__dependencies: [0]
368
+ },
369
+ rowTitle: {
370
+ fontFamily: fontOf(theme.fontFamily.sans),
371
+ fontSize: theme.fontSize.base,
372
+ lineHeight: theme.lineHeight.base,
373
+ fontWeight: theme.fontWeight.semibold,
374
+ color: theme.colors.hi,
375
+ flexShrink: 1,
376
+ uni__dependencies: [0]
377
+ },
378
+ divider: {
379
+ borderTopWidth: StyleSheet.hairlineWidth,
380
+ borderTopColor: theme.colors["border-soft"],
381
+ uni__dependencies: [0]
382
+ },
383
+ control: {
384
+ minHeight: 44,
385
+ minWidth: 44,
386
+ alignSelf: "flex-start"
387
+ }
388
+ }));
389
+ //#endregion
390
+ //#region src/extensions/(frontend)/setting/_components/DesktopPermissionsPanel.native.tsx
391
+ function DesktopPermissionsPanel({ request, requestWithStepUp }) {
392
+ const [state, setState] = useState({ status: "loading" });
393
+ const generation = useRef(0);
394
+ const busy = useRef(false);
395
+ const run = useCallback(async (permission) => {
396
+ if (busy.current) return;
397
+ busy.current = true;
398
+ const version = ++generation.current;
399
+ setState((current) => permission !== void 0 && current.status === "ready" ? {
400
+ ...current,
401
+ asking: permission
402
+ } : { status: "loading" });
403
+ const next = await readDesktopPermissions(permission === void 0 ? request : requestWithStepUp, permission);
404
+ if (generation.current !== version) return;
405
+ busy.current = false;
406
+ setState(next);
407
+ }, [request, requestWithStepUp]);
408
+ useEffect(() => {
409
+ run();
410
+ const subscription = AppState.addEventListener("change", (next) => {
411
+ if (next === "active") run();
412
+ });
413
+ return () => {
414
+ generation.current += 1;
415
+ busy.current = false;
416
+ subscription.remove();
417
+ };
418
+ }, [run]);
419
+ return /* @__PURE__ */ jsx(DesktopPermissionsView, {
420
+ state,
421
+ onAsk: (permission) => void run(permission),
422
+ onRefresh: () => void run()
423
+ });
424
+ }
425
+ //#endregion
426
+ //#region src/extensions/(frontend)/setting/desktop-permissions.panel.native.tsx
427
+ var desktop_permissions_panel_native_default = defineSettingsPanel({
428
+ label: "Permissions",
429
+ detail: "What Po may do on the paired Mac",
430
+ order: 46,
431
+ component: DesktopPermissionsPanel
432
+ });
4
433
  //#endregion
5
434
  //#region src/extensions/workspaces/sessions/(frontend)/activity-group/computer-use.native.ts
6
- /** Computer control remains a desktop capability, including when its status is reported to a phone. */
435
+ /** Remote clients request control from the Desktop host through their session Activity. */
7
436
  var computer_use_native_default$1 = defineActivityGroup({
8
437
  name: "computer-use",
9
438
  keys: "c e",
10
439
  order: 70,
11
- statusKey: "po-computer-use",
440
+ statusKey: COMPUTER_USE_STATUS_KEY,
12
441
  hideWhenEmpty: true,
13
- desktopOnly: true,
14
442
  marksBackgroundWork: false
15
443
  });
16
- const computerUse = defineSessionStore({
444
+ const computerUse$1 = defineSessionStore({
17
445
  state: {
18
446
  sessionId: "",
19
447
  revision: 0,
@@ -22,10 +450,17 @@ const computerUse = defineSessionStore({
22
450
  },
23
451
  targets: []
24
452
  });
453
+ /** Revision zero must hydrate the empty selector once; equal status polls then retain identity. */
454
+ function updateComputerUseState(sessionId, state) {
455
+ computerUse$1.update(sessionId, (current) => current.state.sessionId === "" || state.revision > current.state.revision ? {
456
+ ...current,
457
+ state
458
+ } : current);
459
+ }
25
460
  function isRecord(value) {
26
461
  return typeof value === "object" && value !== null && !Array.isArray(value);
27
462
  }
28
- const computerUseChannel = computerUse.channel({
463
+ const computerUseChannel = computerUse$1.channel({
29
464
  channel: computerUseChannelType,
30
465
  parse(input) {
31
466
  if (!isRecord(input) || !isRecord(input.state) || !Array.isArray(input.targets)) return null;
@@ -37,6 +472,1165 @@ const computerUseChannel = computerUse.channel({
37
472
  //#endregion
38
473
  //#region src/extensions/workspaces/sessions/(frontend)/channel/computer-use.native.ts
39
474
  var computer_use_native_default = defineChannelFile(computerUseChannel);
475
+ const computerUse = createApiClient(routes, {
476
+ scopes: ["session"],
477
+ basePath: "computer-use",
478
+ transport: nativeApiTransport,
479
+ sessionAddress: sessionApiAddress
480
+ });
481
+ createApiClient(routes, {
482
+ scopes: [
483
+ "global",
484
+ "workspace",
485
+ "session"
486
+ ],
487
+ basePath: "desktop-permissions",
488
+ transport: nativeApiTransport,
489
+ sessionAddress: sessionApiAddress
490
+ });
491
+ //#endregion
492
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/_components/ComputerUsePanel.native.tsx
493
+ function text$1(value, fallback) {
494
+ return typeof value === "string" || typeof value === "number" ? String(value) : fallback;
495
+ }
496
+ function remaining(ms) {
497
+ const seconds = Math.max(0, Math.ceil(ms / 1e3));
498
+ return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")} left`;
499
+ }
500
+ const DURATION_OPTIONS = COMPUTER_USE_DURATION_CHOICES_MS.map((choice) => ({
501
+ value: String(choice),
502
+ label: `${choice / 6e4} min`
503
+ }));
504
+ function ComputerUseView({ state, targets = [], busy = false, error, submitting = false, durationMs = COMPUTER_USE_DEFAULT_DURATION_MS, onDurationChange, onRefreshTargets, onActivate, onCancel, onStop }) {
505
+ const [selected, setSelected] = useState(0);
506
+ const [confirmation, setConfirmation] = useState();
507
+ const choices = [{
508
+ label: "Whole desktop",
509
+ target: { scope: "desktop" }
510
+ }, ...targets.map((target) => ({
511
+ label: `${text$1(target.applicationName, "Application")}: ${text$1(target.windowTitle, text$1(target.windowId, "Window"))}`,
512
+ target
513
+ }))];
514
+ const chosen = choices[selected] ?? choices[0];
515
+ const pending = state.phase === "awaiting_confirmation" || state.phase === "activating";
516
+ const active = state.phase === "active" || state.phase === "stopping";
517
+ const failure = error ?? state.failure?.message;
518
+ const expiresAt = state.phase === "active" ? state.expiresAt : void 0;
519
+ const [now, setNow] = useState(Date.now);
520
+ useEffect(() => {
521
+ if (expiresAt === void 0) return;
522
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
523
+ return () => clearInterval(timer);
524
+ }, [expiresAt]);
525
+ const left = expiresAt === void 0 ? void 0 : expiresAt - now;
526
+ const total = state.durationMs ?? 3e5;
527
+ const controlled = state.target?.scope === "desktop" ? "your whole desktop" : typeof state.target?.applicationName === "string" ? state.target.applicationName : "the chosen window";
528
+ return /* @__PURE__ */ jsxs(View, {
529
+ style: styles$4.panel,
530
+ children: [
531
+ /* @__PURE__ */ jsxs(View, {
532
+ style: styles$4.header,
533
+ children: [/* @__PURE__ */ jsx(Text, {
534
+ style: styles$4.title,
535
+ accessibilityRole: "header",
536
+ children: "Computer use"
537
+ }), !pending && !active && onRefreshTargets ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
538
+ variant: "ghost",
539
+ accessibilityLabel: "Computer use actions",
540
+ children: "Actions"
541
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, { children: /* @__PURE__ */ jsx(DropdownMenuItem, {
542
+ disabled: busy || submitting,
543
+ onSelect: onRefreshTargets,
544
+ children: "Refresh targets"
545
+ }) })] }) : null]
546
+ }),
547
+ busy ? /* @__PURE__ */ jsx(Text, {
548
+ style: styles$4.detail,
549
+ children: "Computer use is busy in another session."
550
+ }) : null,
551
+ failure ? /* @__PURE__ */ jsx(Text, {
552
+ style: styles$4.error,
553
+ accessibilityRole: "alert",
554
+ children: failure
555
+ }) : null,
556
+ state.artifact?.status === "ready" ? /* @__PURE__ */ jsxs(View, {
557
+ style: styles$4.row,
558
+ children: [/* @__PURE__ */ jsx(View, {
559
+ style: styles$4.check,
560
+ children: /* @__PURE__ */ jsx(CheckIcon, {
561
+ size: 12,
562
+ color: "rail"
563
+ })
564
+ }), /* @__PURE__ */ jsx(Text, {
565
+ style: styles$4.text,
566
+ children: "Recording saved to session artifacts."
567
+ })]
568
+ }) : null,
569
+ state.artifact?.failure ? /* @__PURE__ */ jsx(Text, {
570
+ style: styles$4.error,
571
+ children: state.artifact.failure.message
572
+ }) : null,
573
+ pending ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
574
+ style: styles$4.text,
575
+ children: "Desktop activation is pending."
576
+ }), /* @__PURE__ */ jsx(Button, {
577
+ variant: "outline",
578
+ disabled: submitting,
579
+ onPress: onCancel,
580
+ children: "Cancel activation"
581
+ })] }) : active ? /* @__PURE__ */ jsxs(Fragment, { children: [
582
+ /* @__PURE__ */ jsxs(View, {
583
+ style: styles$4.row,
584
+ accessibilityLiveRegion: "polite",
585
+ children: [/* @__PURE__ */ jsx(View, { style: styles$4.dot }), /* @__PURE__ */ jsx(Text, {
586
+ style: styles$4.live,
587
+ children: state.phase === "stopping" ? "Po is handing control back" : `Po is controlling ${controlled}`
588
+ })]
589
+ }),
590
+ left === void 0 ? null : /* @__PURE__ */ jsxs(View, {
591
+ style: styles$4.row,
592
+ children: [/* @__PURE__ */ jsx(View, {
593
+ style: styles$4.track,
594
+ accessibilityRole: "progressbar",
595
+ accessibilityLabel: "Time left",
596
+ accessibilityValue: {
597
+ min: 0,
598
+ max: total,
599
+ now: Math.max(0, left)
600
+ },
601
+ children: /* @__PURE__ */ jsx(View, { style: [styles$4.fill, { width: `${Math.min(100, Math.max(0, left / total * 100))}%` }] })
602
+ }), /* @__PURE__ */ jsx(Text, {
603
+ style: styles$4.detail,
604
+ children: remaining(left)
605
+ })]
606
+ }),
607
+ /* @__PURE__ */ jsx(Button, {
608
+ variant: "outline",
609
+ disabled: submitting || state.phase === "stopping",
610
+ onPress: onStop,
611
+ children: "Stop computer use"
612
+ })
613
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
614
+ /* @__PURE__ */ jsx(Text, {
615
+ style: styles$4.detail,
616
+ children: "Po asks before it takes control. You can stop at any time."
617
+ }),
618
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
619
+ variant: "outline",
620
+ disabled: busy || submitting,
621
+ accessibilityLabel: "What Po may control",
622
+ children: chosen.label
623
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, { children: choices.map((choice, index) => /* @__PURE__ */ jsx(DropdownMenuItem, {
624
+ onSelect: () => setSelected(index),
625
+ children: choice.label
626
+ }, `${index}:${choice.label}`)) })] }),
627
+ onDurationChange ? /* @__PURE__ */ jsx(SegmentedControl, {
628
+ accessibilityLabel: "For how long",
629
+ options: DURATION_OPTIONS,
630
+ value: String(durationMs),
631
+ disabled: busy || submitting,
632
+ onValueChange: (value) => onDurationChange(Number(value))
633
+ }) : null,
634
+ /* @__PURE__ */ jsx(Button, {
635
+ variant: "primary",
636
+ disabled: busy || submitting,
637
+ onPress: () => setConfirmation({
638
+ target: Object.freeze({ ...chosen.target }),
639
+ durationMs
640
+ }),
641
+ children: "Request activation"
642
+ })
643
+ ] }),
644
+ confirmation ? /* @__PURE__ */ jsx(ComputerUseConfirmation, {
645
+ target: confirmation.target,
646
+ durationMs: confirmation.durationMs,
647
+ onCancel: () => setConfirmation(void 0),
648
+ onConfirm: () => {
649
+ setConfirmation(void 0);
650
+ onActivate(confirmation.target, confirmation.durationMs);
651
+ }
652
+ }) : null
653
+ ]
654
+ });
655
+ }
656
+ function SessionPanel({ sessionId, sendSessionFrame }) {
657
+ const subscribe = useCallback((listener) => {
658
+ const subscription = computerUse$1.store.subscribe(listener);
659
+ return () => subscription.unsubscribe();
660
+ }, []);
661
+ const session = useSyncExternalStore(subscribe, () => computerUse$1.select(computerUse$1.store.state, sessionId));
662
+ const [error, setError] = useState();
663
+ const [submitting, setSubmitting] = useState(false);
664
+ const [durationMs, setDurationMs] = useState(COMPUTER_USE_DEFAULT_DURATION_MS);
665
+ const requests = useRef(null);
666
+ useEffect(() => {
667
+ const controller = new AbortController();
668
+ requests.current = controller;
669
+ let timer;
670
+ sendSessionFrame(sessionId, {
671
+ type: computerUseChannelType,
672
+ payload: { action: "status" }
673
+ });
674
+ sendSessionFrame(sessionId, {
675
+ type: computerUseChannelType,
676
+ payload: { action: "targets" }
677
+ });
678
+ const poll = async () => {
679
+ try {
680
+ const result = await computerUse.session(sessionId).activationState({ signal: controller.signal });
681
+ if (result.ok && !controller.signal.aborted) updateComputerUseState(sessionId, result.data);
682
+ } catch {
683
+ if (!controller.signal.aborted) setError("The session is unreachable.");
684
+ }
685
+ if (!controller.signal.aborted) timer = setTimeout(() => void poll(), 2e3);
686
+ };
687
+ poll();
688
+ return () => {
689
+ controller.abort();
690
+ clearTimeout(timer);
691
+ };
692
+ }, [sessionId, sendSessionFrame]);
693
+ const submit = async (action, target, approvedDurationMs = durationMs) => {
694
+ const signal = requests.current?.signal;
695
+ if (!signal || signal.aborted || submitting) return;
696
+ setError(void 0);
697
+ setSubmitting(true);
698
+ try {
699
+ const client = computerUse.session(sessionId);
700
+ const result = action === "activate" ? await client.activate({
701
+ body: {
702
+ target,
703
+ durationMs: approvedDurationMs,
704
+ confirmed: true
705
+ },
706
+ signal
707
+ }) : await client.cancelActivation({ signal });
708
+ if (signal.aborted) return;
709
+ if (result.ok) updateComputerUseState(sessionId, result.data);
710
+ else setError(result.status === 0 ? "The session is unreachable." : result.error || "The activation request failed.");
711
+ } catch {
712
+ if (!signal.aborted) setError("The activation request is unavailable.");
713
+ } finally {
714
+ if (!signal.aborted) setSubmitting(false);
715
+ }
716
+ };
717
+ return /* @__PURE__ */ jsx(ComputerUseView, {
718
+ state: session.state,
719
+ targets: session.targets,
720
+ busy: session.busy,
721
+ error,
722
+ submitting,
723
+ durationMs,
724
+ onDurationChange: setDurationMs,
725
+ onRefreshTargets: () => {
726
+ if (session.busy || submitting) return;
727
+ setError(void 0);
728
+ try {
729
+ sendSessionFrame(sessionId, {
730
+ type: computerUseChannelType,
731
+ payload: { action: "targets" }
732
+ });
733
+ } catch {
734
+ setError("The target list could not be refreshed.");
735
+ }
736
+ },
737
+ onActivate: (target, duration) => void submit("activate", target, duration),
738
+ onCancel: () => void submit("cancel"),
739
+ onStop: () => {
740
+ setError(void 0);
741
+ try {
742
+ sendSessionFrame(sessionId, {
743
+ type: computerUseChannelType,
744
+ payload: { action: "stop" }
745
+ });
746
+ } catch {
747
+ setError("The stop request is unavailable.");
748
+ }
749
+ }
750
+ });
751
+ }
752
+ function ComputerUsePanel(props) {
753
+ return props.sessionId === null ? /* @__PURE__ */ jsx(Text, {
754
+ style: styles$4.detail,
755
+ children: "Select a session."
756
+ }) : /* @__PURE__ */ jsx(SessionPanel, {
757
+ ...props,
758
+ sessionId: props.sessionId
759
+ }, props.sessionId);
760
+ }
761
+ function ComputerUseConfirmation({ target, durationMs, onConfirm, onCancel }) {
762
+ const desktop = target.scope === "desktop";
763
+ return /* @__PURE__ */ jsx(Dialog, {
764
+ open: true,
765
+ onOpenChange: (open) => {
766
+ if (!open) onCancel();
767
+ },
768
+ children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { children: [
769
+ "Allow Po to control ",
770
+ desktop ? "your whole desktop" : "this window",
771
+ "?"
772
+ ] }) }), /* @__PURE__ */ jsxs(DialogBody, { children: [
773
+ /* @__PURE__ */ jsx(DialogDescription, { children: desktop ? "Every app window on the main display, except Po and system security windows." : `${text$1(target.applicationName, "Application")}: ${text$1(target.windowTitle, text$1(target.windowId, "Window"))}` }),
774
+ /* @__PURE__ */ jsxs(Text, {
775
+ style: styles$4.text,
776
+ children: [
777
+ "For ",
778
+ durationMs / 6e4,
779
+ " minutes. You can stop at any time."
780
+ ]
781
+ }),
782
+ /* @__PURE__ */ jsxs(Text, {
783
+ style: styles$4.detail,
784
+ children: [
785
+ "Po records ",
786
+ desktop ? "the main display" : "this window",
787
+ ", system sound and microphone audio when permission is granted."
788
+ ]
789
+ }),
790
+ /* @__PURE__ */ jsx(Text, {
791
+ style: styles$4.detail,
792
+ children: "Only this session and its approved device receive control."
793
+ }),
794
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
795
+ variant: "outline",
796
+ onPress: onCancel,
797
+ children: "Cancel"
798
+ }), /* @__PURE__ */ jsx(Button, {
799
+ variant: "primary",
800
+ onPress: onConfirm,
801
+ children: "Allow control"
802
+ })] })
803
+ ] })] })
804
+ });
805
+ }
806
+ const styles$4 = StyleSheet.create((theme) => ({
807
+ panel: {
808
+ gap: theme.spacing(3),
809
+ uni__dependencies: [0]
810
+ },
811
+ header: {
812
+ flexDirection: "row",
813
+ alignItems: "center",
814
+ gap: theme.spacing(2),
815
+ paddingBottom: theme.spacing(2),
816
+ borderBottomWidth: 1,
817
+ borderBottomColor: theme.colors["border-soft"],
818
+ uni__dependencies: [0]
819
+ },
820
+ title: {
821
+ flex: 1,
822
+ fontFamily: fontOf(theme.fontFamily.sans),
823
+ fontSize: theme.fontSize.base,
824
+ fontWeight: "600",
825
+ color: theme.colors.hi,
826
+ uni__dependencies: [0]
827
+ },
828
+ row: {
829
+ flexDirection: "row",
830
+ alignItems: "center",
831
+ gap: theme.spacing(2),
832
+ uni__dependencies: [0]
833
+ },
834
+ dot: {
835
+ width: 8,
836
+ height: 8,
837
+ borderRadius: 4,
838
+ backgroundColor: theme.colors.green,
839
+ uni__dependencies: [0]
840
+ },
841
+ live: {
842
+ fontFamily: fontOf(theme.fontFamily.sans),
843
+ fontSize: theme.fontSize.base,
844
+ lineHeight: theme.lineHeightRelaxed.base,
845
+ color: theme.colors.green,
846
+ uni__dependencies: [0]
847
+ },
848
+ track: {
849
+ flex: 1,
850
+ height: 6,
851
+ borderRadius: 3,
852
+ overflow: "hidden",
853
+ backgroundColor: theme.colors["border-soft"],
854
+ uni__dependencies: [0]
855
+ },
856
+ fill: {
857
+ height: "100%",
858
+ borderRadius: 3,
859
+ backgroundColor: theme.colors.green,
860
+ uni__dependencies: [0]
861
+ },
862
+ check: {
863
+ width: 20,
864
+ height: 20,
865
+ borderRadius: 10,
866
+ alignItems: "center",
867
+ justifyContent: "center",
868
+ backgroundColor: theme.colors.green,
869
+ uni__dependencies: [0]
870
+ },
871
+ text: {
872
+ fontFamily: fontOf(theme.fontFamily.sans),
873
+ fontSize: theme.fontSize.base,
874
+ lineHeight: theme.lineHeightRelaxed.base,
875
+ color: theme.colors.text,
876
+ uni__dependencies: [0]
877
+ },
878
+ detail: {
879
+ fontFamily: fontOf(theme.fontFamily.sans),
880
+ fontSize: theme.fontSize.sm,
881
+ lineHeight: theme.lineHeightRelaxed.sm,
882
+ color: theme.colors.dim,
883
+ uni__dependencies: [0]
884
+ },
885
+ error: {
886
+ fontFamily: fontOf(theme.fontFamily.sans),
887
+ fontSize: theme.fontSize.base,
888
+ lineHeight: theme.lineHeightRelaxed.base,
889
+ color: theme.colors.red,
890
+ uni__dependencies: [0]
891
+ }
892
+ }));
893
+ //#endregion
894
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/ComputerUse.activity.computer-use.native.tsx
895
+ var ComputerUse_activity_computer_use_native_default = defineFill({
896
+ id: "computer-use",
897
+ slot: "activity.computer-use",
898
+ component: ComputerUsePanel
899
+ });
900
+ const MS_PER_SECOND = 1e3;
901
+ /** The computer_state call's summary: it always observes the one authorized window. */
902
+ function computerStateCallSummary(_args) {
903
+ return "authorized window";
904
+ }
905
+ /**
906
+ * The computer_action call as its two pieces: the action kind first, the element
907
+ * it targets second. Either may be missing; the empty ones are dropped.
908
+ */
909
+ function computerActionCallParts(args) {
910
+ return [typeof args.kind === "string" ? args.kind : "", typeof args.elementRef === "string" ? args.elementRef : ""].filter(Boolean);
911
+ }
912
+ /** The computer_exec call's summary: the script it ran. */
913
+ function computerExecCallSummary(args) {
914
+ return typeof args.scriptPath === "string" ? args.scriptPath : "";
915
+ }
916
+ /**
917
+ * The script path as its folder and its file name, so a phone header can let the
918
+ * folder truncate while the script name stays whole.
919
+ */
920
+ function computerExecPathParts(path) {
921
+ const cut = path.lastIndexOf("/");
922
+ return cut < 0 ? {
923
+ folder: "",
924
+ name: path
925
+ } : {
926
+ folder: path.slice(0, cut + 1),
927
+ name: path.slice(cut + 1)
928
+ };
929
+ }
930
+ function record(value) {
931
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
932
+ }
933
+ const text = (value) => typeof value === "string" ? value : "";
934
+ const count = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
935
+ /** The result's text blocks joined; images (the screenshot) are dropped, as the web cards drop them. */
936
+ function computerResultText(content) {
937
+ return content.flatMap((block) => {
938
+ const entry = record(block);
939
+ return entry?.type === "text" && typeof entry.text === "string" ? [entry.text] : [];
940
+ }).join("\n");
941
+ }
942
+ /** `AXTextField` as `text field`; a role without the AX prefix is kept as it came. */
943
+ function computerRoleWords(role) {
944
+ if (!role.startsWith("AX")) return role;
945
+ return role.slice(2).replace(/([a-z])([A-Z])/gu, "$1 $2").toLowerCase();
946
+ }
947
+ function element(value) {
948
+ const entry = record(value);
949
+ if (entry === void 0 || typeof entry.ref !== "string") return [];
950
+ return [{
951
+ ref: entry.ref,
952
+ role: computerRoleWords(text(entry.role)),
953
+ label: text(entry.label) || text(entry.value),
954
+ enabled: entry.enabled !== false,
955
+ secure: entry.secure === true
956
+ }];
957
+ }
958
+ /** An observation when the value is one: an application name and an element list. */
959
+ function computerObservationView(value) {
960
+ const entry = record(value);
961
+ if (entry === void 0 || typeof entry.applicationName !== "string" || !Array.isArray(entry.elements)) return void 0;
962
+ const nextOffset = count(entry.nextOffset);
963
+ const artifact = text(entry.screenshotArtifact);
964
+ return {
965
+ applicationName: entry.applicationName,
966
+ windowTitle: text(entry.windowTitle),
967
+ elements: entry.elements.flatMap(element),
968
+ truncated: entry.truncated === true || nextOffset !== void 0,
969
+ ...nextOffset === void 0 ? {} : { nextOffset },
970
+ ...artifact.length > 0 ? { screenshotArtifact: artifact } : {}
971
+ };
972
+ }
973
+ /** One value of a script result as a short phrase: scalars as they read, collections by their size. */
974
+ function phrase(value) {
975
+ if (value === null || value === void 0) return "none";
976
+ if (typeof value === "string") return value;
977
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
978
+ if (Array.isArray(value)) return `${String(value.length)} item${value.length === 1 ? "" : "s"}`;
979
+ const size = Object.keys(value).length;
980
+ return `${String(size)} field${size === 1 ? "" : "s"}`;
981
+ }
982
+ /** A script's return value as fields: an object's own keys, or one `result` field for anything else. */
983
+ function computerResultFields(value) {
984
+ if (value === void 0) return [];
985
+ const entry = record(value);
986
+ if (entry === void 0) return [{
987
+ key: "result",
988
+ value: phrase(value)
989
+ }];
990
+ return Object.entries(entry).map(([key, field]) => ({
991
+ key,
992
+ value: phrase(field)
993
+ }));
994
+ }
995
+ function run(entry) {
996
+ if (!Array.isArray(entry.logs)) return void 0;
997
+ const observation = computerObservationView(entry.observation);
998
+ const metrics = record(entry.metrics);
999
+ const actions = count(metrics?.actions);
1000
+ const observations = count(metrics?.observations);
1001
+ const durationMs = count(metrics?.durationMs);
1002
+ return {
1003
+ fields: computerResultFields(entry.result),
1004
+ logs: entry.logs.filter((line) => typeof line === "string"),
1005
+ ...actions === void 0 ? {} : { actions },
1006
+ ...observations === void 0 ? {} : { observations },
1007
+ ...durationMs === void 0 ? {} : { duration: `${(durationMs / MS_PER_SECOND).toFixed(1)}s` },
1008
+ ...observation === void 0 ? {} : { observation }
1009
+ };
1010
+ }
1011
+ function failure(entry) {
1012
+ if (typeof entry.error !== "string") return void 0;
1013
+ const completedActions = count(entry.completedActions);
1014
+ return {
1015
+ reason: entry.error,
1016
+ ...completedActions === void 0 ? {} : { completedActions },
1017
+ outcomeUncertain: entry.outcomeUncertain === true
1018
+ };
1019
+ }
1020
+ /** The text as lines a card can count: CRLF folded, tabs widened, trailing blank lines dropped. */
1021
+ function lines(value) {
1022
+ if (value.length === 0) return [];
1023
+ const split = value.replaceAll("\r\n", "\n").replaceAll(" ", " ").split("\n");
1024
+ while (split.length > 0 && split.at(-1)?.trim() === "") split.pop();
1025
+ return split;
1026
+ }
1027
+ /**
1028
+ * A computer tool result as the card lays it out. The tools answer in JSON (an
1029
+ * observation, an action's outcome, a script run, a script failure) or in a
1030
+ * plain sentence when they fail early; anything that does not parse as a shape
1031
+ * the card knows falls back to its text lines.
1032
+ */
1033
+ function computerResultView(content) {
1034
+ const raw = computerResultText(content);
1035
+ let parsed;
1036
+ try {
1037
+ parsed = JSON.parse(raw);
1038
+ } catch {
1039
+ return {
1040
+ kind: "text",
1041
+ lines: lines(raw)
1042
+ };
1043
+ }
1044
+ const entry = record(parsed);
1045
+ const observation = computerObservationView(parsed);
1046
+ if (observation !== void 0) return {
1047
+ kind: "observation",
1048
+ observation
1049
+ };
1050
+ const ran = entry === void 0 ? void 0 : run(entry);
1051
+ if (ran !== void 0) return {
1052
+ kind: "run",
1053
+ run: ran
1054
+ };
1055
+ const failed = entry === void 0 ? void 0 : failure(entry);
1056
+ if (failed !== void 0) return {
1057
+ kind: "failure",
1058
+ failure: failed
1059
+ };
1060
+ if (entry?.launched === true && typeof entry.applicationName === "string") return {
1061
+ kind: "launched",
1062
+ applicationName: entry.applicationName,
1063
+ bundleId: text(entry.bundleId)
1064
+ };
1065
+ if (entry?.applied === true) return { kind: "applied" };
1066
+ return {
1067
+ kind: "text",
1068
+ lines: lines(raw)
1069
+ };
1070
+ }
1071
+ /** How many rows the view holds back while collapsed, so the card offers expand only when it reveals something. */
1072
+ function computerResultHidden(view) {
1073
+ switch (view.kind) {
1074
+ case "observation": return Math.max(0, view.observation.elements.length - 5);
1075
+ case "run": return Math.max(0, view.run.logs.length - 3);
1076
+ case "text": return Math.max(0, view.lines.length - 8);
1077
+ default: return 0;
1078
+ }
1079
+ }
1080
+ //#endregion
1081
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerResultBody.native.tsx
1082
+ /** The parsed result, or none before the tool answers. */
1083
+ function computerResult(props) {
1084
+ return props.result === null ? void 0 : computerResultView(props.result.content);
1085
+ }
1086
+ /** Whether the card has rows to reveal: the header offers expand only then, and never on a failure. */
1087
+ function computerResultExpandable(props) {
1088
+ const view = computerResult(props);
1089
+ return !props.isError && view !== void 0 && computerResultHidden(view) > 0;
1090
+ }
1091
+ /**
1092
+ * The body the three computer tool cards share on native. The web cards print
1093
+ * the result's text; the tools answer in JSON, so this lays the parsed result
1094
+ * out instead: the window and its elements, a script's figures and logs, an
1095
+ * action's outcome. A preview shows while collapsed, as the web's first lines
1096
+ * do. A failure shows only its reason in red, with a quiet note of any actions
1097
+ * that already ran; the header's edge and outcome already say it failed.
1098
+ */
1099
+ function ComputerResultBody({ props, expanded }) {
1100
+ const { toolName, output, running, isError } = props;
1101
+ const view = computerResult(props);
1102
+ const testID = `tool-result-${toolName}`;
1103
+ if (isError) {
1104
+ const failure = view?.kind === "failure" ? view.failure : {
1105
+ reason: view?.kind === "text" ? view.lines.join("\n") : output.trim(),
1106
+ outcomeUncertain: false
1107
+ };
1108
+ return failure.reason.length === 0 ? null : /* @__PURE__ */ jsx(MessageItemBody, {
1109
+ testID,
1110
+ children: /* @__PURE__ */ jsx(FailureBlock, { failure })
1111
+ });
1112
+ }
1113
+ if (view === void 0) return running ? /* @__PURE__ */ jsx(MessageItemBody, {
1114
+ testID,
1115
+ children: /* @__PURE__ */ jsx(MessageItemStatus, {
1116
+ tone: "running",
1117
+ children: "running"
1118
+ })
1119
+ }) : null;
1120
+ if (view.kind === "text" && view.lines.length === 0) return null;
1121
+ return /* @__PURE__ */ jsx(MessageItemBody, {
1122
+ testID,
1123
+ children: /* @__PURE__ */ jsxs(View, {
1124
+ style: styles$3.stack,
1125
+ children: [
1126
+ view.kind === "observation" ? /* @__PURE__ */ jsx(ObservationBlock, {
1127
+ observation: view.observation,
1128
+ expanded
1129
+ }) : null,
1130
+ view.kind === "run" ? /* @__PURE__ */ jsx(RunBlock, {
1131
+ run: view.run,
1132
+ expanded
1133
+ }) : null,
1134
+ view.kind === "applied" ? /* @__PURE__ */ jsx(Text, {
1135
+ style: [styles$3.sans, styles$3.text],
1136
+ children: "Applied to the element."
1137
+ }) : null,
1138
+ view.kind === "launched" ? /* @__PURE__ */ jsxs(View, {
1139
+ style: styles$3.figure,
1140
+ children: [/* @__PURE__ */ jsxs(Text, {
1141
+ numberOfLines: 1,
1142
+ style: [
1143
+ styles$3.sans,
1144
+ styles$3.strong,
1145
+ styles$3.keep
1146
+ ],
1147
+ children: ["Opened ", view.applicationName]
1148
+ }), /* @__PURE__ */ jsx(Text, {
1149
+ numberOfLines: 1,
1150
+ style: [
1151
+ styles$3.mono,
1152
+ styles$3.faint,
1153
+ styles$3.yield
1154
+ ],
1155
+ children: view.bundleId
1156
+ })]
1157
+ }) : null,
1158
+ view.kind === "text" ? /* @__PURE__ */ jsx(TextLines, {
1159
+ lines: view.lines,
1160
+ expanded
1161
+ }) : null,
1162
+ running ? /* @__PURE__ */ jsx(MessageItemStatus, {
1163
+ tone: "running",
1164
+ children: "running"
1165
+ }) : null
1166
+ ]
1167
+ })
1168
+ });
1169
+ }
1170
+ function FailureBlock({ failure }) {
1171
+ const done = failure.completedActions;
1172
+ const note = [done === void 0 ? "" : `${String(done)} action${done === 1 ? "" : "s"} already ran`, failure.outcomeUncertain ? "the last outcome is uncertain" : ""].filter(Boolean);
1173
+ return /* @__PURE__ */ jsxs(View, {
1174
+ style: styles$3.stack,
1175
+ children: [/* @__PURE__ */ jsx(Text, {
1176
+ selectable: true,
1177
+ style: [styles$3.sans, styles$3.error],
1178
+ children: failure.reason
1179
+ }), note.length > 0 ? /* @__PURE__ */ jsxs(Text, {
1180
+ style: [styles$3.small, styles$3.faint],
1181
+ children: [note.join(", "), "."]
1182
+ }) : null]
1183
+ });
1184
+ }
1185
+ function WindowLine({ observation, lead }) {
1186
+ return /* @__PURE__ */ jsxs(View, {
1187
+ style: styles$3.figure,
1188
+ children: [/* @__PURE__ */ jsxs(Text, {
1189
+ numberOfLines: 1,
1190
+ style: [
1191
+ styles$3.sans,
1192
+ styles$3.strong,
1193
+ styles$3.keep
1194
+ ],
1195
+ children: [lead === void 0 ? "" : `${lead} `, observation.applicationName]
1196
+ }), observation.windowTitle.length > 0 ? /* @__PURE__ */ jsx(Text, {
1197
+ numberOfLines: 1,
1198
+ style: [
1199
+ styles$3.sans,
1200
+ styles$3.dim,
1201
+ styles$3.yield
1202
+ ],
1203
+ children: observation.windowTitle
1204
+ }) : null]
1205
+ });
1206
+ }
1207
+ function ElementRow({ element }) {
1208
+ const secure = element.secure && !element.role.includes("secure");
1209
+ const traits = [
1210
+ element.role,
1211
+ element.enabled ? "" : "disabled",
1212
+ secure ? "secure" : ""
1213
+ ].filter(Boolean);
1214
+ return /* @__PURE__ */ jsxs(View, {
1215
+ style: styles$3.row,
1216
+ accessibilityLabel: `${element.label} ${traits.join(" ")} ${element.ref}`,
1217
+ children: [
1218
+ /* @__PURE__ */ jsx(Text, {
1219
+ numberOfLines: 1,
1220
+ style: [
1221
+ styles$3.sans,
1222
+ element.enabled ? styles$3.text : styles$3.faint,
1223
+ styles$3.yield
1224
+ ],
1225
+ children: element.label.length > 0 ? element.label : element.role
1226
+ }),
1227
+ /* @__PURE__ */ jsx(Text, {
1228
+ numberOfLines: 1,
1229
+ style: [
1230
+ styles$3.small,
1231
+ styles$3.faint,
1232
+ styles$3.keep
1233
+ ],
1234
+ children: traits.join(" · ")
1235
+ }),
1236
+ /* @__PURE__ */ jsx(Text, {
1237
+ numberOfLines: 1,
1238
+ style: [
1239
+ styles$3.mono,
1240
+ styles$3.faint,
1241
+ styles$3.ref
1242
+ ],
1243
+ children: element.ref
1244
+ })
1245
+ ]
1246
+ });
1247
+ }
1248
+ function ObservationBlock({ observation, expanded }) {
1249
+ const { elements } = observation;
1250
+ const shown = expanded ? elements : elements.slice(0, 5);
1251
+ const hidden = elements.length - shown.length;
1252
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1253
+ /* @__PURE__ */ jsx(WindowLine, { observation }),
1254
+ /* @__PURE__ */ jsxs(View, {
1255
+ style: styles$3.chips,
1256
+ children: [/* @__PURE__ */ jsx(Badge, {
1257
+ size: "xs",
1258
+ children: `${String(elements.length)} element${elements.length === 1 ? "" : "s"}`
1259
+ }), observation.truncated ? /* @__PURE__ */ jsx(Badge, {
1260
+ size: "xs",
1261
+ tone: "yellow",
1262
+ children: observation.nextOffset === void 0 ? "more not shown" : `more from offset ${String(observation.nextOffset)}`
1263
+ }) : null]
1264
+ }),
1265
+ shown.length > 0 ? /* @__PURE__ */ jsx(View, {
1266
+ style: styles$3.list,
1267
+ children: shown.map((element) => /* @__PURE__ */ jsx(ElementRow, { element }, element.ref))
1268
+ }) : null,
1269
+ hidden > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
1270
+ expands: true,
1271
+ children: [hidden, " more elements"]
1272
+ }) : null,
1273
+ observation.screenshotArtifact === void 0 ? null : /* @__PURE__ */ jsxs(Text, {
1274
+ numberOfLines: 2,
1275
+ style: [styles$3.small, styles$3.faint],
1276
+ children: ["Screenshot saved to ", observation.screenshotArtifact]
1277
+ })
1278
+ ] });
1279
+ }
1280
+ function RunBlock({ run, expanded }) {
1281
+ const figures = [
1282
+ run.actions === void 0 ? "" : `${String(run.actions)} action${run.actions === 1 ? "" : "s"}`,
1283
+ run.observations === void 0 ? "" : `${String(run.observations)} observation${run.observations === 1 ? "" : "s"}`,
1284
+ run.duration ?? ""
1285
+ ].filter(Boolean);
1286
+ const logs = expanded ? run.logs : run.logs.slice(0, 3);
1287
+ const hidden = run.logs.length - logs.length;
1288
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1289
+ figures.length > 0 ? /* @__PURE__ */ jsx(View, {
1290
+ style: styles$3.chips,
1291
+ children: figures.map((figure) => /* @__PURE__ */ jsx(Badge, {
1292
+ size: "xs",
1293
+ children: figure
1294
+ }, figure))
1295
+ }) : null,
1296
+ run.fields.length > 0 ? /* @__PURE__ */ jsx(View, {
1297
+ style: styles$3.list,
1298
+ children: run.fields.map((field) => /* @__PURE__ */ jsxs(View, {
1299
+ style: styles$3.row,
1300
+ children: [/* @__PURE__ */ jsx(Text, {
1301
+ numberOfLines: 1,
1302
+ style: [
1303
+ styles$3.small,
1304
+ styles$3.faint,
1305
+ styles$3.key
1306
+ ],
1307
+ children: field.key
1308
+ }), /* @__PURE__ */ jsx(Text, {
1309
+ numberOfLines: 1,
1310
+ selectable: true,
1311
+ style: [
1312
+ styles$3.sans,
1313
+ styles$3.text,
1314
+ styles$3.yield
1315
+ ],
1316
+ children: field.value
1317
+ })]
1318
+ }, field.key))
1319
+ }) : null,
1320
+ logs.length > 0 ? /* @__PURE__ */ jsx(View, {
1321
+ style: styles$3.list,
1322
+ children: logs.map((line, index) => /* @__PURE__ */ jsx(Text, {
1323
+ numberOfLines: 1,
1324
+ selectable: true,
1325
+ style: [styles$3.mono, styles$3.dim],
1326
+ children: line
1327
+ }, `${String(index)}-${line}`))
1328
+ }) : null,
1329
+ hidden > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
1330
+ expands: true,
1331
+ children: [hidden, " more log lines"]
1332
+ }) : null,
1333
+ run.observation === void 0 ? null : /* @__PURE__ */ jsx(WindowLine, {
1334
+ observation: run.observation,
1335
+ lead: "Ended on"
1336
+ })
1337
+ ] });
1338
+ }
1339
+ function TextLines({ lines, expanded }) {
1340
+ const shown = expanded ? lines : lines.slice(0, 8);
1341
+ const hidden = lines.length - shown.length;
1342
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(View, {
1343
+ style: styles$3.list,
1344
+ children: shown.map((line, index) => /* @__PURE__ */ jsx(Text, {
1345
+ selectable: true,
1346
+ style: [styles$3.sans, styles$3.dim],
1347
+ children: line
1348
+ }, `${String(index)}-${line}`))
1349
+ }), hidden > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
1350
+ expands: true,
1351
+ children: [hidden, " more line(s)"]
1352
+ }) : null] });
1353
+ }
1354
+ const styles$3 = StyleSheet.create((theme) => ({
1355
+ stack: {
1356
+ gap: theme.spacing(2),
1357
+ uni__dependencies: [0]
1358
+ },
1359
+ list: {
1360
+ gap: theme.spacing(1),
1361
+ uni__dependencies: [0]
1362
+ },
1363
+ chips: {
1364
+ flexDirection: "row",
1365
+ flexWrap: "wrap",
1366
+ gap: theme.spacing(1.5),
1367
+ uni__dependencies: [0]
1368
+ },
1369
+ figure: {
1370
+ flexDirection: "row",
1371
+ alignItems: "baseline",
1372
+ gap: theme.spacing(2),
1373
+ minWidth: 0,
1374
+ uni__dependencies: [0]
1375
+ },
1376
+ row: {
1377
+ flexDirection: "row",
1378
+ alignItems: "baseline",
1379
+ gap: theme.spacing(2),
1380
+ minWidth: 0,
1381
+ uni__dependencies: [0]
1382
+ },
1383
+ sans: {
1384
+ fontFamily: fontOf(theme.fontFamily.sans),
1385
+ fontSize: theme.fontSize.base,
1386
+ lineHeight: theme.lineHeight.base,
1387
+ uni__dependencies: [0]
1388
+ },
1389
+ small: {
1390
+ fontFamily: fontOf(theme.fontFamily.sans),
1391
+ fontSize: theme.fontSize.sm,
1392
+ lineHeight: theme.lineHeight.sm,
1393
+ uni__dependencies: [0]
1394
+ },
1395
+ mono: {
1396
+ fontFamily: fontOf(theme.fontFamily.mono),
1397
+ fontSize: theme.fontSize.sm,
1398
+ lineHeight: theme.lineHeight.sm,
1399
+ uni__dependencies: [0]
1400
+ },
1401
+ strong: {
1402
+ color: theme.colors.text,
1403
+ fontWeight: theme.fontWeight.semibold,
1404
+ uni__dependencies: [0]
1405
+ },
1406
+ text: {
1407
+ color: theme.colors.text,
1408
+ uni__dependencies: [0]
1409
+ },
1410
+ dim: {
1411
+ color: theme.colors.dim,
1412
+ uni__dependencies: [0]
1413
+ },
1414
+ faint: {
1415
+ color: theme.colors.faint,
1416
+ uni__dependencies: [0]
1417
+ },
1418
+ error: {
1419
+ color: theme.colors.red,
1420
+ uni__dependencies: [0]
1421
+ },
1422
+ keep: {
1423
+ flexShrink: 0,
1424
+ maxWidth: "60%"
1425
+ },
1426
+ yield: {
1427
+ flexShrink: 1,
1428
+ minWidth: 0
1429
+ },
1430
+ key: {
1431
+ flexShrink: 0,
1432
+ maxWidth: "40%"
1433
+ },
1434
+ ref: {
1435
+ flexShrink: 0,
1436
+ marginLeft: "auto"
1437
+ }
1438
+ }));
1439
+ //#endregion
1440
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerActionToolCard.native.tsx
1441
+ /**
1442
+ * The computer_action tool's timeline item on native, as the web's: the action
1443
+ * and the element it targets in the header, the outcome's first lines beneath.
1444
+ */
1445
+ function ComputerActionToolCard(props) {
1446
+ const { toolName, args, running, isError } = props;
1447
+ const [kind, ...target] = computerActionCallParts(args);
1448
+ return /* @__PURE__ */ jsx(MessageItem, {
1449
+ tone: toolTone({
1450
+ running,
1451
+ isError
1452
+ }),
1453
+ expandable: computerResultExpandable(props),
1454
+ children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1455
+ title: toolName,
1456
+ children: /* @__PURE__ */ jsxs(View, {
1457
+ testID: `tool-call-${toolName}`,
1458
+ style: styles$2.summary,
1459
+ children: [kind === void 0 ? null : /* @__PURE__ */ jsx(Text, {
1460
+ numberOfLines: 1,
1461
+ style: [styles$2.sans, styles$2.primary],
1462
+ children: kind
1463
+ }), target.length > 0 ? /* @__PURE__ */ jsx(Text, {
1464
+ numberOfLines: 1,
1465
+ style: [styles$2.sans, styles$2.detail],
1466
+ children: target.join(" ")
1467
+ }) : null]
1468
+ })
1469
+ }), /* @__PURE__ */ jsx(ComputerResultBody, {
1470
+ props,
1471
+ expanded
1472
+ })] })
1473
+ });
1474
+ }
1475
+ const styles$2 = StyleSheet.create((theme) => ({
1476
+ summary: {
1477
+ flex: 1,
1478
+ flexDirection: "row",
1479
+ alignItems: "center",
1480
+ gap: theme.spacing(2),
1481
+ minWidth: 0,
1482
+ uni__dependencies: [0]
1483
+ },
1484
+ sans: {
1485
+ fontFamily: fontOf(theme.fontFamily.sans),
1486
+ fontSize: theme.fontSize.base,
1487
+ lineHeight: theme.lineHeight.base,
1488
+ uni__dependencies: [0]
1489
+ },
1490
+ primary: {
1491
+ flexShrink: 0,
1492
+ maxWidth: "45%",
1493
+ color: theme.colors.text,
1494
+ uni__dependencies: [0]
1495
+ },
1496
+ detail: {
1497
+ flexShrink: 1,
1498
+ color: theme.colors.dim,
1499
+ uni__dependencies: [0]
1500
+ }
1501
+ }));
1502
+ //#endregion
1503
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/computer-action.native.tsx
1504
+ var computer_action_native_default = defineToolRenderer({
1505
+ tools: ["computer_action"],
1506
+ message: ComputerActionToolCard
1507
+ });
1508
+ //#endregion
1509
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerExecToolCard.native.tsx
1510
+ /**
1511
+ * The computer_exec tool's timeline item on native, as the web's: the script
1512
+ * path in the header, the run's first lines beneath it.
1513
+ */
1514
+ function ComputerExecToolCard(props) {
1515
+ const { toolName, args, running, isError } = props;
1516
+ const path = computerExecPathParts(computerExecCallSummary(args));
1517
+ return /* @__PURE__ */ jsx(MessageItem, {
1518
+ tone: toolTone({
1519
+ running,
1520
+ isError
1521
+ }),
1522
+ expandable: computerResultExpandable(props),
1523
+ children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1524
+ title: toolName,
1525
+ children: /* @__PURE__ */ jsxs(View, {
1526
+ testID: `tool-call-${toolName}`,
1527
+ style: styles$1.summary,
1528
+ children: [path.folder.length > 0 ? /* @__PURE__ */ jsx(Text, {
1529
+ numberOfLines: 1,
1530
+ style: [styles$1.sans, styles$1.folder],
1531
+ children: path.folder
1532
+ }) : null, /* @__PURE__ */ jsx(Text, {
1533
+ numberOfLines: 1,
1534
+ style: [styles$1.sans, styles$1.primary],
1535
+ children: path.name
1536
+ })]
1537
+ })
1538
+ }), /* @__PURE__ */ jsx(ComputerResultBody, {
1539
+ props,
1540
+ expanded
1541
+ })] })
1542
+ });
1543
+ }
1544
+ const styles$1 = StyleSheet.create((theme) => ({
1545
+ summary: {
1546
+ flex: 1,
1547
+ flexDirection: "row",
1548
+ alignItems: "center",
1549
+ minWidth: 0
1550
+ },
1551
+ sans: {
1552
+ fontFamily: fontOf(theme.fontFamily.sans),
1553
+ fontSize: theme.fontSize.base,
1554
+ lineHeight: theme.lineHeight.base,
1555
+ uni__dependencies: [0]
1556
+ },
1557
+ folder: {
1558
+ flexShrink: 1,
1559
+ minWidth: 0,
1560
+ color: theme.colors.dim,
1561
+ uni__dependencies: [0]
1562
+ },
1563
+ primary: {
1564
+ flexShrink: 0,
1565
+ maxWidth: "100%",
1566
+ color: theme.colors.text,
1567
+ uni__dependencies: [0]
1568
+ }
1569
+ }));
1570
+ //#endregion
1571
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/computer-exec.native.tsx
1572
+ var computer_exec_native_default = defineToolRenderer({
1573
+ tools: ["computer_exec"],
1574
+ message: ComputerExecToolCard
1575
+ });
1576
+ //#endregion
1577
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ComputerStateToolCard.native.tsx
1578
+ /**
1579
+ * The computer_state tool's timeline item on native, as the web's: the observed
1580
+ * window in the header, the observation's first lines beneath it.
1581
+ */
1582
+ function ComputerStateToolCard(props) {
1583
+ const { toolName, args, running, isError } = props;
1584
+ return /* @__PURE__ */ jsx(MessageItem, {
1585
+ tone: toolTone({
1586
+ running,
1587
+ isError
1588
+ }),
1589
+ expandable: computerResultExpandable(props),
1590
+ children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1591
+ title: toolName,
1592
+ children: /* @__PURE__ */ jsx(View, {
1593
+ testID: `tool-call-${toolName}`,
1594
+ style: styles.summary,
1595
+ children: /* @__PURE__ */ jsx(Text, {
1596
+ numberOfLines: 1,
1597
+ style: [styles.sans, styles.primary],
1598
+ children: computerStateCallSummary(args)
1599
+ })
1600
+ })
1601
+ }), /* @__PURE__ */ jsx(ComputerResultBody, {
1602
+ props,
1603
+ expanded
1604
+ })] })
1605
+ });
1606
+ }
1607
+ const styles = StyleSheet.create((theme) => ({
1608
+ summary: {
1609
+ flex: 1,
1610
+ flexDirection: "row",
1611
+ alignItems: "center",
1612
+ gap: theme.spacing(2),
1613
+ minWidth: 0,
1614
+ uni__dependencies: [0]
1615
+ },
1616
+ sans: {
1617
+ fontFamily: fontOf(theme.fontFamily.sans),
1618
+ fontSize: theme.fontSize.base,
1619
+ lineHeight: theme.lineHeight.base,
1620
+ uni__dependencies: [0]
1621
+ },
1622
+ primary: {
1623
+ flexShrink: 1,
1624
+ color: theme.colors.text,
1625
+ uni__dependencies: [0]
1626
+ }
1627
+ }));
1628
+ //#endregion
1629
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/computer-state.native.tsx
1630
+ var computer_state_native_default = defineToolRenderer({
1631
+ tools: ["computer_state"],
1632
+ message: ComputerStateToolCard
1633
+ });
40
1634
  //#endregion
41
1635
  //#region generated/native.ts
42
1636
  const via = (identity, value) => value === void 0 ? void 0 : {
@@ -45,12 +1639,28 @@ const via = (identity, value) => value === void 0 ? void 0 : {
45
1639
  };
46
1640
  const nativePlugin = defineNativePlugin({
47
1641
  id: "computer-use",
1642
+ global: { get settingsPanels() {
1643
+ return [via({ id: "desktop-permissions" }, desktop_permissions_panel_native_default)];
1644
+ } },
48
1645
  session: {
49
1646
  get activityGroups() {
50
1647
  return [via({ name: "computer-use" }, computer_use_native_default$1)];
51
1648
  },
52
1649
  get channels() {
53
1650
  return [via({ channel: "computer_use" }, computer_use_native_default)];
1651
+ },
1652
+ get fills() {
1653
+ return [via({
1654
+ slot: "activity.computer-use",
1655
+ id: "computer-use"
1656
+ }, ComputerUse_activity_computer_use_native_default)];
1657
+ },
1658
+ get toolRenderers() {
1659
+ return [
1660
+ via({ tools: ["computer_action"] }, computer_action_native_default),
1661
+ via({ tools: ["computer_exec"] }, computer_exec_native_default),
1662
+ via({ tools: ["computer_state"] }, computer_state_native_default)
1663
+ ];
54
1664
  }
55
1665
  }
56
1666
  });