@agimon-ai/po-computer-use 0.0.0-alpha.180 → 0.0.0-alpha.182
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.
|
@@ -508,6 +508,14 @@ function createComputerUseServer(host, apiContext) {
|
|
|
508
508
|
const savedRecordings = /* @__PURE__ */ new Set();
|
|
509
509
|
const saveRecording = (artifact) => {
|
|
510
510
|
const fetchRecording = desktop.fetchRecording?.bind(desktop);
|
|
511
|
+
if (artifact?.status === "failed" && !savedRecordings.has(artifact.artifactId)) {
|
|
512
|
+
savedRecordings.add(artifact.artifactId);
|
|
513
|
+
Promise.resolve().then(() => host.context.client.notify({
|
|
514
|
+
body: `The computer-use recording failed: ${artifact.failure?.message ?? "no detail was reported."}`,
|
|
515
|
+
level: "warning"
|
|
516
|
+
})).catch(() => void 0);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
511
519
|
if (artifact?.status !== "ready" || !artifact.sizeBytes || !fetchRecording || savedRecordings.has(artifact.artifactId)) return;
|
|
512
520
|
savedRecordings.add(artifact.artifactId);
|
|
513
521
|
const { artifactId, sizeBytes } = artifact;
|
|
@@ -612,7 +620,7 @@ function createComputerUseServer(host, apiContext) {
|
|
|
612
620
|
return {
|
|
613
621
|
target,
|
|
614
622
|
durationMinutes,
|
|
615
|
-
reason
|
|
623
|
+
reason,
|
|
616
624
|
keepTrace: keepTrace === true
|
|
617
625
|
};
|
|
618
626
|
};
|
|
@@ -630,42 +638,63 @@ function createComputerUseServer(host, apiContext) {
|
|
|
630
638
|
const requestPolicy = {
|
|
631
639
|
requirement: "human",
|
|
632
640
|
ownerOnly: true,
|
|
641
|
+
resolve: ([input]) => [readRequest(input)],
|
|
633
642
|
describe(input) {
|
|
634
643
|
const { target, durationMinutes, reason, keepTrace } = readRequest(input);
|
|
644
|
+
const content = [];
|
|
645
|
+
const detail = (label, value) => {
|
|
646
|
+
if (value.length <= 300) return {
|
|
647
|
+
label,
|
|
648
|
+
value
|
|
649
|
+
};
|
|
650
|
+
content.push(`${label}:\n${value}`);
|
|
651
|
+
return {
|
|
652
|
+
label,
|
|
653
|
+
value: `See full ${label.toLowerCase()} below.`
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
const details = isDesktop(target) ? [{
|
|
657
|
+
label: "Target",
|
|
658
|
+
value: "Whole desktop"
|
|
659
|
+
}] : [
|
|
660
|
+
detail("Application", String(target.applicationName)),
|
|
661
|
+
detail("Window", String(target.windowTitle)),
|
|
662
|
+
detail("Bundle ID", String(target.bundleId)),
|
|
663
|
+
detail("Process ID", String(target.processId)),
|
|
664
|
+
detail("Window ID", String(target.windowId))
|
|
665
|
+
];
|
|
666
|
+
const reasonDetail = detail("Reason", reason);
|
|
667
|
+
const fullContent = content.join("\n\n");
|
|
668
|
+
if (fullContent.length > 65536) throw new Error("Computer-use approval content is too long.");
|
|
635
669
|
return {
|
|
670
|
+
source: "Computer use",
|
|
636
671
|
title: "Let Po control your computer",
|
|
637
|
-
summary:
|
|
672
|
+
summary: `Po can see and control ${isDesktop(target) ? "your whole desktop" : "the selected window"} for ${durationMinutes} minutes.`,
|
|
638
673
|
details: [
|
|
639
|
-
...
|
|
640
|
-
label: "Target",
|
|
641
|
-
value: "Whole desktop"
|
|
642
|
-
}] : [
|
|
643
|
-
{
|
|
644
|
-
label: "Application",
|
|
645
|
-
value: String(target.applicationName)
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
label: "Window",
|
|
649
|
-
value: String(target.windowTitle)
|
|
650
|
-
},
|
|
651
|
-
{
|
|
652
|
-
label: "Window identity",
|
|
653
|
-
value: `${String(target.bundleId)} (PID ${String(target.processId)}, window ${String(target.windowId)})`
|
|
654
|
-
}
|
|
655
|
-
],
|
|
674
|
+
...details,
|
|
656
675
|
{
|
|
657
676
|
label: "Duration",
|
|
658
677
|
value: `${durationMinutes} minutes`
|
|
659
678
|
},
|
|
679
|
+
reasonDetail,
|
|
660
680
|
{
|
|
661
681
|
label: "Recording",
|
|
662
682
|
value: keepTrace ? "Screen and audio recording, action trace and window images" : "Screen and audio recording on"
|
|
663
683
|
},
|
|
684
|
+
{
|
|
685
|
+
label: "Saved to",
|
|
686
|
+
value: "This session’s artifacts, in computer-use/."
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
label: "Who can open it",
|
|
690
|
+
value: "The session’s agent and paired clients can access session artifacts."
|
|
691
|
+
},
|
|
664
692
|
{
|
|
665
693
|
label: "Stop",
|
|
666
694
|
value: "You can stop control at any time in Activity."
|
|
667
695
|
}
|
|
668
|
-
]
|
|
696
|
+
],
|
|
697
|
+
...fullContent ? { content: fullContent } : {}
|
|
669
698
|
};
|
|
670
699
|
}
|
|
671
700
|
};
|