@agimon-ai/po-computer-use 0.0.0-alpha.196 → 0.0.0-alpha.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/server.cjs +69 -20
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +69 -20
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +2 -6
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +12 -12
|
@@ -10,6 +10,7 @@ let node_crypto = require("node:crypto");
|
|
|
10
10
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
11
11
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
12
12
|
let _agimon_ai_po_core_codemode = require("@agimon-ai/po-core/codemode");
|
|
13
|
+
let _agimon_ai_po_core_locale = require("@agimon-ai/po-core/locale");
|
|
13
14
|
let _agimon_ai_po_mode = require("@agimon-ai/po-mode");
|
|
14
15
|
let _agimon_ai_po_core_hubChannel = require("@agimon-ai/po-core/hubChannel");
|
|
15
16
|
//#region src/services/mcpTools/index.ts
|
|
@@ -469,6 +470,14 @@ function output(value, isError = false) {
|
|
|
469
470
|
};
|
|
470
471
|
}
|
|
471
472
|
function createComputerUseServer(host, apiContext) {
|
|
473
|
+
let localeContext;
|
|
474
|
+
const t = (key, fallback, vars) => (localeContext && (0, _agimon_ai_po_core_locale.readPoLang)(localeContext)?.t((0, _agimon_ai_po_core_locale.readPoPersonLocale)(localeContext)?.read(), key, fallback, vars)) ?? (0, _agimon_ai_po_core_locale.formatMessage)(fallback, vars);
|
|
475
|
+
const bindLocale = (context) => {
|
|
476
|
+
localeContext = context;
|
|
477
|
+
context.effect(() => () => {
|
|
478
|
+
localeContext = void 0;
|
|
479
|
+
});
|
|
480
|
+
};
|
|
472
481
|
if (!apiContext?.computerUse?.available || !apiContext.directEvents) return {
|
|
473
482
|
tools: [],
|
|
474
483
|
commands: []
|
|
@@ -512,6 +521,11 @@ function createComputerUseServer(host, apiContext) {
|
|
|
512
521
|
savedRecordings.add(artifact.artifactId);
|
|
513
522
|
Promise.resolve().then(() => host.context.client.notify({
|
|
514
523
|
body: `The computer-use recording failed: ${artifact.failure?.message ?? "no detail was reported."}`,
|
|
524
|
+
localization: { body: {
|
|
525
|
+
key: "computerUse.notification.recordingFailed",
|
|
526
|
+
fallback: "The computer-use recording failed: {error}",
|
|
527
|
+
vars: { error: artifact.failure?.message ?? t("computerUse.notification.noDetail", "no detail was reported.") }
|
|
528
|
+
} },
|
|
515
529
|
level: "warning"
|
|
516
530
|
})).catch(() => void 0);
|
|
517
531
|
return;
|
|
@@ -536,6 +550,11 @@ function createComputerUseServer(host, apiContext) {
|
|
|
536
550
|
if (lifetime.signal.aborted) return;
|
|
537
551
|
return host.context.client.notify({
|
|
538
552
|
body: `A computer-use trace file was not saved to artifacts: ${error instanceof Error ? error.message : String(error)}`,
|
|
553
|
+
localization: { body: {
|
|
554
|
+
key: "computerUse.notification.traceNotSaved",
|
|
555
|
+
fallback: "A computer-use trace file was not saved to artifacts: {error}",
|
|
556
|
+
vars: { error: error instanceof Error ? error.message : String(error) }
|
|
557
|
+
} },
|
|
539
558
|
level: "warning"
|
|
540
559
|
});
|
|
541
560
|
}).catch(() => void 0);
|
|
@@ -545,11 +564,21 @@ function createComputerUseServer(host, apiContext) {
|
|
|
545
564
|
read: (range) => fetchRecording(artifactId, range)
|
|
546
565
|
}).then((saved) => host.context.client.notify({
|
|
547
566
|
body: `Computer-use recording saved to ${saved}.`,
|
|
567
|
+
localization: { body: {
|
|
568
|
+
key: "computerUse.notification.recordingSaved",
|
|
569
|
+
fallback: "Computer-use recording saved to {path}.",
|
|
570
|
+
vars: { path: saved }
|
|
571
|
+
} },
|
|
548
572
|
level: "info"
|
|
549
573
|
}), (error) => {
|
|
550
574
|
if (lifetime.signal.aborted) return;
|
|
551
575
|
return host.context.client.notify({
|
|
552
576
|
body: `The computer-use recording was not saved to artifacts: ${error instanceof Error ? error.message : String(error)}`,
|
|
577
|
+
localization: { body: {
|
|
578
|
+
key: "computerUse.notification.recordingNotSaved",
|
|
579
|
+
fallback: "The computer-use recording was not saved to artifacts: {error}",
|
|
580
|
+
vars: { error: error instanceof Error ? error.message : String(error) }
|
|
581
|
+
} },
|
|
553
582
|
level: "warning"
|
|
554
583
|
});
|
|
555
584
|
}).catch(() => void 0);
|
|
@@ -641,21 +670,32 @@ function createComputerUseServer(host, apiContext) {
|
|
|
641
670
|
resolve: ([input]) => [readRequest(input)],
|
|
642
671
|
describe(input) {
|
|
643
672
|
const { target, durationMinutes, reason, keepTrace } = readRequest(input);
|
|
673
|
+
const labelText = (label) => {
|
|
674
|
+
switch (label) {
|
|
675
|
+
case "Application": return t("computerUse.approval.application", "Application");
|
|
676
|
+
case "Window": return t("computerUse.approval.window", "Window");
|
|
677
|
+
case "Bundle ID": return t("computerUse.approval.bundleId", "Bundle ID");
|
|
678
|
+
case "Process ID": return t("computerUse.approval.processId", "Process ID");
|
|
679
|
+
case "Window ID": return t("computerUse.approval.windowId", "Window ID");
|
|
680
|
+
case "Reason": return t("computerUse.approval.reason", "Reason");
|
|
681
|
+
default: return label;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
644
684
|
const content = [];
|
|
645
685
|
const detail = (label, value) => {
|
|
646
686
|
if (value.length <= 300) return {
|
|
647
|
-
label,
|
|
687
|
+
label: labelText(label),
|
|
648
688
|
value
|
|
649
689
|
};
|
|
650
690
|
content.push(`${label}:\n${value}`);
|
|
651
691
|
return {
|
|
652
|
-
label,
|
|
653
|
-
value:
|
|
692
|
+
label: labelText(label),
|
|
693
|
+
value: t("computerUse.approval.fullValue", "See full {label} below.", { label: labelText(label).toLowerCase() })
|
|
654
694
|
};
|
|
655
695
|
};
|
|
656
696
|
const details = isDesktop(target) ? [{
|
|
657
|
-
label: "Target",
|
|
658
|
-
value: "Whole desktop"
|
|
697
|
+
label: t("computerUse.approval.target", "Target"),
|
|
698
|
+
value: t("computerUse.approval.wholeDesktop", "Whole desktop")
|
|
659
699
|
}] : [
|
|
660
700
|
detail("Application", String(target.applicationName)),
|
|
661
701
|
detail("Window", String(target.windowTitle)),
|
|
@@ -667,31 +707,31 @@ function createComputerUseServer(host, apiContext) {
|
|
|
667
707
|
const fullContent = content.join("\n\n");
|
|
668
708
|
if (fullContent.length > 65536) throw new Error("Computer-use approval content is too long.");
|
|
669
709
|
return {
|
|
670
|
-
source: "Computer use",
|
|
671
|
-
title: "Let Po control your computer",
|
|
672
|
-
summary:
|
|
710
|
+
source: t("computerUse.approval.source", "Computer use"),
|
|
711
|
+
title: t("computerUse.approval.title", "Let Po control your computer"),
|
|
712
|
+
summary: isDesktop(target) ? t("computerUse.approval.desktopSummary", "Po can see and control your whole desktop for {minutes} minutes.", { minutes: durationMinutes }) : t("computerUse.approval.windowSummary", "Po can see and control the selected window for {minutes} minutes.", { minutes: durationMinutes }),
|
|
673
713
|
details: [
|
|
674
714
|
...details,
|
|
675
715
|
{
|
|
676
|
-
label: "Duration",
|
|
677
|
-
value:
|
|
716
|
+
label: t("computerUse.approval.duration", "Duration"),
|
|
717
|
+
value: t("computerUse.approval.minutes", "{minutes} minutes", { minutes: durationMinutes })
|
|
678
718
|
},
|
|
679
719
|
reasonDetail,
|
|
680
720
|
{
|
|
681
|
-
label: "Recording",
|
|
682
|
-
value: keepTrace ? "Screen and audio recording, action trace and window images" : "Screen and audio recording on"
|
|
721
|
+
label: t("computerUse.approval.recording", "Recording"),
|
|
722
|
+
value: keepTrace ? t("computerUse.approval.recordingWithTrace", "Screen and audio recording, action trace and window images") : t("computerUse.approval.recordingOn", "Screen and audio recording on")
|
|
683
723
|
},
|
|
684
724
|
{
|
|
685
|
-
label: "Saved to",
|
|
686
|
-
value: "This session’s artifacts, in computer-use/."
|
|
725
|
+
label: t("computerUse.approval.savedTo", "Saved to"),
|
|
726
|
+
value: t("computerUse.approval.location", "This session’s artifacts, in computer-use/.")
|
|
687
727
|
},
|
|
688
728
|
{
|
|
689
|
-
label: "Who can open it",
|
|
690
|
-
value: "The session’s agent and paired clients can access session artifacts."
|
|
729
|
+
label: t("computerUse.approval.whoCanOpen", "Who can open it"),
|
|
730
|
+
value: t("computerUse.approval.access", "The session’s agent and paired clients can access session artifacts.")
|
|
691
731
|
},
|
|
692
732
|
{
|
|
693
|
-
label: "Stop",
|
|
694
|
-
value: "You can stop control at any time in Activity."
|
|
733
|
+
label: t("computerUse.approval.stop", "Stop"),
|
|
734
|
+
value: t("computerUse.approval.stopHint", "You can stop control at any time in Activity.")
|
|
695
735
|
}
|
|
696
736
|
],
|
|
697
737
|
...fullContent ? { content: fullContent } : {}
|
|
@@ -746,27 +786,35 @@ function createComputerUseServer(host, apiContext) {
|
|
|
746
786
|
source: SOURCE,
|
|
747
787
|
id: require_extensionService.COMPUTER_USE_MODE_ID,
|
|
748
788
|
label: "Computer Use",
|
|
789
|
+
labelKey: "mode.computer-use.computerUse",
|
|
749
790
|
description: "Session-scoped semantic control through Po Desktop.",
|
|
791
|
+
descriptionKey: "mode.computer-use.sessionScopedSemanticControlThroughPoDesktop",
|
|
750
792
|
order: 450,
|
|
751
793
|
actions: [
|
|
752
794
|
{
|
|
753
795
|
id: "activate",
|
|
754
796
|
label: "Activate",
|
|
797
|
+
labelKey: "mode.computer-use.activate",
|
|
755
798
|
description: "Enable computer use for this session.",
|
|
799
|
+
descriptionKey: "mode.computer-use.enableComputerUseForThisSession",
|
|
756
800
|
contexts: ["headless"],
|
|
757
801
|
parameters: []
|
|
758
802
|
},
|
|
759
803
|
{
|
|
760
804
|
id: "deactivate",
|
|
761
805
|
label: "Deactivate",
|
|
806
|
+
labelKey: "mode.computer-use.deactivate",
|
|
762
807
|
description: "Stop this session computer-use run.",
|
|
808
|
+
descriptionKey: "mode.computer-use.stopThisSessionComputerUseRun",
|
|
763
809
|
contexts: ["headless"],
|
|
764
810
|
parameters: []
|
|
765
811
|
},
|
|
766
812
|
{
|
|
767
813
|
id: "doctor",
|
|
768
814
|
label: "Doctor",
|
|
815
|
+
labelKey: "mode.computer-use.doctor",
|
|
769
816
|
description: "Report Desktop availability and session state.",
|
|
817
|
+
descriptionKey: "mode.computer-use.reportDesktopAvailabilityAndSessionState",
|
|
770
818
|
contexts: ["headless"],
|
|
771
819
|
parameters: []
|
|
772
820
|
}
|
|
@@ -791,7 +839,7 @@ function createComputerUseServer(host, apiContext) {
|
|
|
791
839
|
if (!desktop.available || desktop.enabled === false) throw new Error("Enable computer use in global Desktop settings first.");
|
|
792
840
|
await selectMode(true);
|
|
793
841
|
await refresh(execution.signal);
|
|
794
|
-
return { message: "Computer use is on. Po asks for approval before it takes control." };
|
|
842
|
+
return { message: t("computerUse.mode.activated", "Computer use is on. Po asks for approval before it takes control.") };
|
|
795
843
|
}
|
|
796
844
|
if (actionId === "doctor") {
|
|
797
845
|
await refresh(execution.signal);
|
|
@@ -801,7 +849,7 @@ function createComputerUseServer(host, apiContext) {
|
|
|
801
849
|
if (client && state?.phase !== void 0 && state.phase !== "inactive" && state.phase !== "failed") await client.stop(execution.signal);
|
|
802
850
|
await selectMode(false);
|
|
803
851
|
await refresh(execution.signal);
|
|
804
|
-
return { message: "Computer use deactivated." };
|
|
852
|
+
return { message: t("computerUse.mode.deactivated", "Computer use deactivated.") };
|
|
805
853
|
}
|
|
806
854
|
throw new Error(`Unknown computer-use action: ${actionId}`);
|
|
807
855
|
}
|
|
@@ -858,6 +906,7 @@ function createComputerUseServer(host, apiContext) {
|
|
|
858
906
|
start: () => broker
|
|
859
907
|
}],
|
|
860
908
|
services: [
|
|
909
|
+
bindLocale,
|
|
861
910
|
(context) => {
|
|
862
911
|
context.inject(["po/profile-runtime"], (child) => {
|
|
863
912
|
const profile = child.get("po/profile-runtime");
|