@agimon-ai/po-computer-use 0.0.0-alpha.221 → 0.0.0-alpha.222

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.
@@ -229,6 +229,8 @@ const COPY = {
229
229
  }
230
230
  }
231
231
  };
232
+ /** The two permissions the Mac checks before computer use can start; the others serve other features. */
233
+ const NEEDED_FOR_COMPUTER_USE = ["accessibility", "screen-recording"];
232
234
  const LABEL = {
233
235
  get granted() {
234
236
  return t("computerUse.ui.allowed", "Allowed");
@@ -255,9 +257,13 @@ function DesktopPermissionsView({ state, remote = true, onAsk, onRefresh }) {
255
257
  accessibilityRole: "header",
256
258
  style: styles$5.sectionTitle,
257
259
  children: t("computerUse.ui.onThePairedMac", "On the paired Mac")
258
- }), /* @__PURE__ */ jsx(Text, {
260
+ }), /* @__PURE__ */ jsxs(Text, {
259
261
  style: styles$5.detail,
260
- children: remote ? t("computerUse.ui.theseBelongToTheMacRunningPo", "These belong to the Mac running Po Desktop. When you ask from here, macOS shows its prompt on that Mac.") : t("computerUse.ui.poAsksMacOSForEachOneWhen", "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.")
262
+ children: [
263
+ t("computerUse.ui.computerUseNeedsAccessibilityAndScreen", "Computer use needs Accessibility and Screen and system audio recording. You don't need the other permissions for computer use."),
264
+ " ",
265
+ remote ? t("computerUse.ui.theseBelongToTheMacRunningPo", "These belong to the Mac running Po Desktop. When you ask from here, macOS shows its prompt on that Mac.") : t("computerUse.ui.poAsksMacOSForEachOneWhen", "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.")
266
+ ]
261
267
  })]
262
268
  }), state.status === "ready" ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
263
269
  variant: "ghost",
@@ -280,13 +286,20 @@ function DesktopPermissionsView({ state, remote = true, onAsk, onRefresh }) {
280
286
  children: [
281
287
  /* @__PURE__ */ jsxs(View, {
282
288
  style: styles$5.rowHeading,
283
- children: [/* @__PURE__ */ jsx(Text, {
284
- style: styles$5.rowTitle,
285
- children: COPY[permission].title
286
- }), /* @__PURE__ */ jsx(Badge, {
287
- tone: value === "granted" ? "green" : "neutral",
288
- children: LABEL[value]
289
- })]
289
+ children: [
290
+ /* @__PURE__ */ jsx(Text, {
291
+ style: styles$5.rowTitle,
292
+ children: COPY[permission].title
293
+ }),
294
+ /* @__PURE__ */ jsx(Badge, {
295
+ tone: value === "granted" ? "green" : "neutral",
296
+ children: LABEL[value]
297
+ }),
298
+ NEEDED_FOR_COMPUTER_USE.includes(permission) ? /* @__PURE__ */ jsx(Badge, {
299
+ tone: "neutral",
300
+ children: t("computerUse.ui.neededForComputerUse", "Needed for computer use")
301
+ }) : null
302
+ ]
290
303
  }),
291
304
  /* @__PURE__ */ jsx(Text, {
292
305
  style: styles$5.detail,
@@ -487,6 +500,13 @@ const computerUseChannel = computerUse.channel({
487
500
  var computer_use_native_default = defineChannelFile(computerUseChannel);
488
501
  //#endregion
489
502
  //#region src/extensions/workspaces/sessions/(frontend)/fill/_components/ComputerUsePanel.native.tsx
503
+ function targetLabel(target, translate) {
504
+ if (target?.scope === "desktop") return translate("computerUse.ui.yourWholeDesktop", "your whole desktop");
505
+ const app = typeof target?.applicationName === "string" ? target.applicationName.trim() : "";
506
+ const windowTitle = typeof target?.windowTitle === "string" ? target.windowTitle.trim() : "";
507
+ if (app && windowTitle) return `${app}: ${windowTitle}`;
508
+ return app || translate("computerUse.ui.theChosenWindow", "the chosen window");
509
+ }
490
510
  function remaining(ms) {
491
511
  const seconds = Math.max(0, Math.ceil(ms / 1e3));
492
512
  return t("computerUse.ui.remainingTime", "{time} left", { time: `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}` });
@@ -505,7 +525,7 @@ function ComputerUseView({ state, error, onCancel, onStop }) {
505
525
  }, [expiresAt]);
506
526
  const left = expiresAt === void 0 ? void 0 : expiresAt - now;
507
527
  const total = state.durationMs ?? 3e5;
508
- const controlled = state.target?.scope === "desktop" ? t("computerUse.ui.yourWholeDesktop", "your whole desktop") : typeof state.target?.applicationName === "string" ? state.target.applicationName : t("computerUse.ui.theChosenWindow", "the chosen window");
528
+ const controlled = targetLabel(state.target, t);
509
529
  if (state.phase === "inactive") return null;
510
530
  return /* @__PURE__ */ jsxs(View, {
511
531
  style: styles$4.panel,
@@ -518,10 +538,16 @@ function ComputerUseView({ state, error, onCancel, onStop }) {
518
538
  children: t("computerUse.ui.computerUseText", "Computer use")
519
539
  })
520
540
  }),
521
- failure ? /* @__PURE__ */ jsx(Text, {
522
- style: styles$4.error,
523
- accessibilityRole: "alert",
524
- children: failure
541
+ failure ? /* @__PURE__ */ jsxs(View, {
542
+ style: styles$4.failure,
543
+ children: [/* @__PURE__ */ jsx(Text, {
544
+ style: styles$4.error,
545
+ accessibilityRole: "alert",
546
+ children: failure
547
+ }), /* @__PURE__ */ jsx(Text, {
548
+ style: styles$4.detail,
549
+ children: t("computerUse.ui.askPoToRequestControlAgain", "To try again, ask Po to request control again.")
550
+ })]
525
551
  }) : null,
526
552
  state.artifact?.status === "ready" ? /* @__PURE__ */ jsxs(View, {
527
553
  style: styles$4.row,
@@ -540,14 +566,24 @@ function ComputerUseView({ state, error, onCancel, onStop }) {
540
566
  style: styles$4.error,
541
567
  children: state.artifact.failure.message
542
568
  }) : null,
543
- pending ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
544
- style: styles$4.text,
545
- children: t("computerUse.ui.desktopActivationIsPending", "Desktop activation is pending.")
546
- }), /* @__PURE__ */ jsx(Button, {
547
- variant: "outline",
548
- onPress: onCancel,
549
- children: t("computerUse.ui.cancelActivation", "Cancel activation")
550
- })] }) : active ? /* @__PURE__ */ jsxs(Fragment, { children: [
569
+ pending ? /* @__PURE__ */ jsxs(Fragment, { children: [
570
+ /* @__PURE__ */ jsx(Text, {
571
+ style: styles$4.text,
572
+ children: t("computerUse.ui.approvedWaitingForDesktop", "Approved. Waiting for Po Desktop to start.")
573
+ }),
574
+ state.durationMs === void 0 ? null : /* @__PURE__ */ jsx(Text, {
575
+ style: styles$4.detail,
576
+ children: t("computerUse.ui.willControlForMinutes", "Po will control {target} for {minutes} minutes.", {
577
+ target: controlled,
578
+ minutes: Math.round(state.durationMs / 6e4)
579
+ })
580
+ }),
581
+ /* @__PURE__ */ jsx(Button, {
582
+ variant: "outline",
583
+ onPress: onCancel,
584
+ children: t("computerUse.ui.cancel", "Cancel")
585
+ })
586
+ ] }) : active ? /* @__PURE__ */ jsxs(Fragment, { children: [
551
587
  /* @__PURE__ */ jsxs(View, {
552
588
  style: styles$4.row,
553
589
  accessibilityLiveRegion: "polite",
@@ -578,7 +614,11 @@ function ComputerUseView({ state, error, onCancel, onStop }) {
578
614
  disabled: state.phase === "stopping",
579
615
  onPress: onStop,
580
616
  children: t("computerUse.ui.stopComputerUse", "Stop computer use")
581
- })
617
+ }),
618
+ state.phase === "active" ? /* @__PURE__ */ jsx(Text, {
619
+ style: styles$4.detail,
620
+ children: t("computerUse.ui.stopShortcutHint", "On the Mac, you can also press Cmd+Shift+Esc.")
621
+ }) : null
582
622
  ] }) : null
583
623
  ]
584
624
  });
@@ -630,6 +670,10 @@ const styles$4 = StyleSheet.create((theme) => ({
630
670
  gap: theme.spacing(3),
631
671
  uni__dependencies: [0]
632
672
  },
673
+ failure: {
674
+ gap: theme.spacing(1),
675
+ uni__dependencies: [0]
676
+ },
633
677
  header: {
634
678
  flexDirection: "row",
635
679
  alignItems: "center",
@@ -751,7 +795,7 @@ var Computeruse_help_guides_native_default = defineFill({
751
795
  question: "How do I start and stop computer use?",
752
796
  order: 1,
753
797
  answerKey: "computerUse.help.use.answer",
754
- answer: "1. Enable Computer use in Settings > Permissions on your Mac.\n2. Turn on Computer use from the mode menu and approve Po's request when it appears.\n3. Stop control at any time from Activity or by pressing Cmd+Shift+Esc on macOS.",
798
+ answer: "1. On your Mac, turn on Settings > computer use, then allow Accessibility and Screen and system audio recording in Settings > permissions.\n2. Choose Computer Use from the mode menu, then ask Po to do the task. When Po asks for control, check the window and time limit, and approve only if they match.\n3. Stop control at any time from Activity or by pressing Cmd+Shift+Esc on the Mac.",
755
799
  keywords: [
756
800
  "stop",
757
801
  "approval",
@@ -764,6 +808,16 @@ var Computeruse_help_guides_native_default = defineFill({
764
808
  }
765
809
  });
766
810
  const MS_PER_SECOND = 1e3;
811
+ /** Person-facing title for each computer-use tool card header. */
812
+ function computerToolTitle(toolName) {
813
+ switch (toolName) {
814
+ case "computer_action": return "Computer action";
815
+ case "computer_state": return "Inspect approved target";
816
+ case "computer_targets": return "List windows";
817
+ case "computer_request": return "Request control";
818
+ default: return toolName;
819
+ }
820
+ }
767
821
  /**
768
822
  * The computer_action call as its two pieces: the action kind first, the element
769
823
  * it targets second. Either may be missing; the empty ones are dropped.
@@ -996,7 +1050,7 @@ function ComputerResultBody({ props, expanded }) {
996
1050
  }) : null,
997
1051
  view.kind === "applied" ? /* @__PURE__ */ jsx(Text, {
998
1052
  style: [styles$3.sans, styles$3.text],
999
- children: t("computerUse.ui.appliedToTheElement", "Applied to the element.")
1053
+ children: t("computerUse.ui.actionCompleted", "Action completed.")
1000
1054
  }) : null,
1001
1055
  view.kind === "launched" ? /* @__PURE__ */ jsxs(View, {
1002
1056
  style: styles$3.figure,
@@ -1324,7 +1378,7 @@ function ComputerActionToolCard(props) {
1324
1378
  }),
1325
1379
  expandable: computerResultExpandable(props),
1326
1380
  children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1327
- title: toolName,
1381
+ title: computerToolTitle(toolName),
1328
1382
  children: /* @__PURE__ */ jsxs(View, {
1329
1383
  testID: `tool-call-${toolName}`,
1330
1384
  style: styles$2.summary,
@@ -1452,7 +1506,6 @@ var computer_exec_native_default = defineToolRenderer({
1452
1506
  * window in the header, the observation's first lines beneath it.
1453
1507
  */
1454
1508
  function ComputerStateToolCard(props) {
1455
- const t = useT();
1456
1509
  const { toolName, running, isError } = props;
1457
1510
  return /* @__PURE__ */ jsx(MessageItem, {
1458
1511
  tone: toolTone({
@@ -1461,15 +1514,10 @@ function ComputerStateToolCard(props) {
1461
1514
  }),
1462
1515
  expandable: computerResultExpandable(props),
1463
1516
  children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1464
- title: toolName,
1517
+ title: computerToolTitle(toolName),
1465
1518
  children: /* @__PURE__ */ jsx(View, {
1466
1519
  testID: `tool-call-${toolName}`,
1467
- style: styles.summary,
1468
- children: /* @__PURE__ */ jsx(Text, {
1469
- numberOfLines: 1,
1470
- style: [styles.sans, styles.primary],
1471
- children: toolName === "computer_state" ? t("computerUse.ui.authorizedWindow", "authorized window") : null
1472
- })
1520
+ style: styles.summary
1473
1521
  })
1474
1522
  }), /* @__PURE__ */ jsx(ComputerResultBody, {
1475
1523
  props,
@@ -1477,27 +1525,14 @@ function ComputerStateToolCard(props) {
1477
1525
  })] })
1478
1526
  });
1479
1527
  }
1480
- const styles = StyleSheet.create((theme) => ({
1481
- summary: {
1482
- flex: 1,
1483
- flexDirection: "row",
1484
- alignItems: "center",
1485
- gap: theme.spacing(2),
1486
- minWidth: 0,
1487
- uni__dependencies: [0]
1488
- },
1489
- sans: {
1490
- fontFamily: fontOf(theme.fontFamily.sans),
1491
- fontSize: theme.fontSize.base,
1492
- lineHeight: theme.lineHeight.base,
1493
- uni__dependencies: [0]
1494
- },
1495
- primary: {
1496
- flexShrink: 1,
1497
- color: theme.colors.text,
1498
- uni__dependencies: [0]
1499
- }
1500
- }));
1528
+ const styles = StyleSheet.create((theme) => ({ summary: {
1529
+ flex: 1,
1530
+ flexDirection: "row",
1531
+ alignItems: "center",
1532
+ gap: theme.spacing(2),
1533
+ minWidth: 0,
1534
+ uni__dependencies: [0]
1535
+ } }));
1501
1536
  //#endregion
1502
1537
  //#region src/extensions/workspaces/sessions/(frontend)/tool/computer-state.native.tsx
1503
1538
  var computer_state_native_default = defineToolRenderer({