@agimon-ai/po-remote 0.0.0-alpha.176 → 0.0.0-alpha.177
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/web.mjs +56 -34
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +146 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +20 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +146 -16
- package/dist/index.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +8 -8
package/dist/extensions/web.mjs
CHANGED
|
@@ -100,8 +100,9 @@ async function startRelayLink(origin) {
|
|
|
100
100
|
}, (body) => {
|
|
101
101
|
const cloud = URL.parse(origin);
|
|
102
102
|
const url = typeof body.url === "string" ? URL.parse(body.url) : null;
|
|
103
|
-
return cloud?.protocol === "https:" && url?.origin === cloud.origin && !url.username && !url.password && url.
|
|
103
|
+
return cloud?.protocol === "https:" && url?.origin === cloud.origin && !url.username && !url.password && !url.hash && typeof body.userCode === "string" && /^[A-Za-z0-9-]{4,16}$/u.test(body.userCode) && url.searchParams.get("user_code") === body.userCode && typeof body.expiresAt === "number" && Number.isSafeInteger(body.expiresAt) && body.expiresAt > Date.now() ? {
|
|
104
104
|
url: url.href,
|
|
105
|
+
userCode: body.userCode,
|
|
105
106
|
expiresAt: body.expiresAt
|
|
106
107
|
} : void 0;
|
|
107
108
|
});
|
|
@@ -377,7 +378,6 @@ async function advanceRelaySetup() {
|
|
|
377
378
|
active: true
|
|
378
379
|
} });
|
|
379
380
|
}
|
|
380
|
-
if (remoteAccessStore.state.step !== "closed") await newPairingCode(independent ? "relay" : void 0);
|
|
381
381
|
} finally {
|
|
382
382
|
endConnectionAction();
|
|
383
383
|
}
|
|
@@ -439,18 +439,20 @@ async function changeRemoteConnection(route, enabled) {
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
async function pairRemoteConnection(route) {
|
|
442
|
-
const { view,
|
|
443
|
-
if (!independent || busy || step === "closed" ||
|
|
442
|
+
const { view, independent, busy, step } = remoteAccessStore.state;
|
|
443
|
+
if (route !== "tunnel" || !independent || busy || step === "closed" || view?.status !== "on") return;
|
|
444
444
|
begin();
|
|
445
445
|
connectionError(route);
|
|
446
446
|
try {
|
|
447
447
|
await newPairingCode(route);
|
|
448
|
-
|
|
448
|
+
await refreshPasskeys();
|
|
449
449
|
} finally {
|
|
450
450
|
endConnectionAction();
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
async function newPairingCode(route) {
|
|
454
|
+
const state = remoteAccessStore.state;
|
|
455
|
+
if (route === "relay" || route === void 0 && !state.independent && state.relay?.active) return;
|
|
454
456
|
const minted = await mintPairingCode(route);
|
|
455
457
|
if ("error" in minted) {
|
|
456
458
|
if (route) connectionError(route, minted.error);
|
|
@@ -1382,9 +1384,9 @@ function RemoteAccessPairing({ route }) {
|
|
|
1382
1384
|
//#endregion
|
|
1383
1385
|
//#region src/extensions/(frontend)/_components/RemoteAccessRelayTarget.tsx
|
|
1384
1386
|
/** Presentation shared by the live dialog and its approved state stories. */
|
|
1385
|
-
function RemoteAccessRelayTarget({ phase, address, error, busy, locked, linked, approvalUrl, qr, illustrative, onAddressChange, onTunnel, onAdvance, onClose }) {
|
|
1387
|
+
function RemoteAccessRelayTarget({ phase, address, error, busy, locked, linked, accountRelay, approvalUrl, approvalCode, qr, illustrative, onAddressChange, onTunnel, onAdvance, onClose }) {
|
|
1386
1388
|
const pending = approvalUrl !== void 0 || phase === "pending";
|
|
1387
|
-
const connected = phase === "connected" && qr !== void 0;
|
|
1389
|
+
const connected = phase === "connected" && (accountRelay || qr !== void 0);
|
|
1388
1390
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
1389
1391
|
open: true,
|
|
1390
1392
|
onOpenChange: (open) => {
|
|
@@ -1440,7 +1442,7 @@ function RemoteAccessRelayTarget({ phase, address, error, busy, locked, linked,
|
|
|
1440
1442
|
children: "Private relay"
|
|
1441
1443
|
}), /* @__PURE__ */ jsx("span", {
|
|
1442
1444
|
className: "text-sm text-po-dim",
|
|
1443
|
-
children: "Traffic is encrypted end to end. Po Cloud only forwards it."
|
|
1445
|
+
children: accountRelay ? "Po Cloud can read the requests it forwards over an encrypted connection." : "Traffic is encrypted end to end. Po Cloud only forwards it."
|
|
1444
1446
|
})]
|
|
1445
1447
|
}), /* @__PURE__ */ jsx(Badge, {
|
|
1446
1448
|
tone: "green",
|
|
@@ -1477,21 +1479,21 @@ function RemoteAccessRelayTarget({ phase, address, error, busy, locked, linked,
|
|
|
1477
1479
|
}),
|
|
1478
1480
|
/* @__PURE__ */ jsx("p", {
|
|
1479
1481
|
className: "text-center text-sm text-po-dim",
|
|
1480
|
-
children: illustrative ? "Scan with the phone camera. Illustrative code, not a real credential." : "Scan to open the Po app. Then approve the phone on this computer."
|
|
1482
|
+
children: accountRelay ? "Sign in to Po on your phone with this account. No QR code needed." : illustrative ? "Scan with the phone camera. Illustrative code, not a real credential." : "Scan to open the Po app. Then approve the phone on this computer."
|
|
1481
1483
|
}),
|
|
1482
|
-
/* @__PURE__ */ jsx("div", {
|
|
1484
|
+
!accountRelay && qr ? /* @__PURE__ */ jsx("div", {
|
|
1483
1485
|
className: "rounded-lg bg-po-hi p-3 text-po-deep",
|
|
1484
1486
|
children: /* @__PURE__ */ jsx(QrCode, {
|
|
1485
1487
|
value: qr,
|
|
1486
1488
|
size: 200,
|
|
1487
1489
|
label: illustrative ? "Illustrative pairing code" : "Scan to pair this device"
|
|
1488
1490
|
})
|
|
1489
|
-
})
|
|
1491
|
+
}) : null
|
|
1490
1492
|
]
|
|
1491
1493
|
}) : /* @__PURE__ */ jsxs("p", {
|
|
1492
1494
|
"data-testid": "remote-relay-passkey-step",
|
|
1493
1495
|
className: "text-sm leading-relaxed text-po-dim",
|
|
1494
|
-
children: [pending ?
|
|
1496
|
+
children: [pending ? approvalCode ? `Approve in Po Cloud and check it shows ${approvalCode}, then come back here to check approval.` : "Approve in Po Cloud, then come back here to check approval." : linked ? accountRelay ? "This computer is linked. Turn on the relay to reach it from Po on your phone." : "This computer is linked. Connect to Po Cloud to pair a device." : "Approve in Po Cloud to link this computer to your account, not the whole team.", approvalUrl ? /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("a", {
|
|
1495
1497
|
className: "underline text-po-blue",
|
|
1496
1498
|
href: approvalUrl,
|
|
1497
1499
|
target: "_blank",
|
|
@@ -1518,7 +1520,7 @@ function RemoteAccessRelayTarget({ phase, address, error, busy, locked, linked,
|
|
|
1518
1520
|
"data-testid": "remote-relay-link",
|
|
1519
1521
|
loading: busy,
|
|
1520
1522
|
onClick: onAdvance,
|
|
1521
|
-
children: pending ? "Check approval" : phase === "failed" ? "Try again" : linked ? "Connect and show code" : "Link to Po Cloud"
|
|
1523
|
+
children: pending ? "Check approval" : phase === "failed" ? "Try again" : linked ? accountRelay ? "Turn on relay" : "Connect and show code" : "Link to Po Cloud"
|
|
1522
1524
|
})
|
|
1523
1525
|
})
|
|
1524
1526
|
]
|
|
@@ -1540,7 +1542,7 @@ function ConnectionStatus({ status }) {
|
|
|
1540
1542
|
});
|
|
1541
1543
|
}
|
|
1542
1544
|
function RemoteConnectionsDialog(props) {
|
|
1543
|
-
const { address, relayStatus, tunnelStatus, approvalUrl, linked, busy, relayError, tunnelError } = props;
|
|
1545
|
+
const { address, relayStatus, tunnelStatus, approvalUrl, approvalCode, linked, busy, relayError, tunnelError } = props;
|
|
1544
1546
|
const relayOn = relayStatus === "on";
|
|
1545
1547
|
const tunnelOn = tunnelStatus === "on";
|
|
1546
1548
|
const relayBusy = busy || relayStatus === "starting";
|
|
@@ -1568,11 +1570,17 @@ function RemoteConnectionsDialog(props) {
|
|
|
1568
1570
|
}),
|
|
1569
1571
|
/* @__PURE__ */ jsx("p", {
|
|
1570
1572
|
className: "text-sm text-po-dim",
|
|
1571
|
-
children: "Traffic is encrypted end to end. Po Cloud only forwards it.
|
|
1573
|
+
children: props.accountRelay ? "Po Cloud can read the requests it forwards over an encrypted connection. Only your account can use this computer through Po Cloud." : "Traffic is encrypted end to end. Po Cloud only forwards it. You approve this computer in Po Cloud, for your account, not the whole team."
|
|
1572
1574
|
}),
|
|
1573
|
-
relayOn ? /* @__PURE__ */
|
|
1574
|
-
className: "
|
|
1575
|
-
children:
|
|
1575
|
+
relayOn ? /* @__PURE__ */ jsxs("div", {
|
|
1576
|
+
className: "flex flex-col gap-1",
|
|
1577
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1578
|
+
className: "text-sm text-po-text",
|
|
1579
|
+
children: address
|
|
1580
|
+
}), props.accountRelay ? /* @__PURE__ */ jsx("p", {
|
|
1581
|
+
className: "text-sm text-po-dim",
|
|
1582
|
+
children: "Sign in to Po on your phone with this account. No QR code needed."
|
|
1583
|
+
}) : null]
|
|
1576
1584
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
1577
1585
|
className: "flex flex-col gap-1.5",
|
|
1578
1586
|
children: [
|
|
@@ -1597,13 +1605,24 @@ function RemoteConnectionsDialog(props) {
|
|
|
1597
1605
|
}),
|
|
1598
1606
|
approvalUrl ? /* @__PURE__ */ jsxs("p", {
|
|
1599
1607
|
className: "text-sm text-po-dim",
|
|
1600
|
-
children: [
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsx("a", {
|
|
1610
|
+
className: "text-po-blue underline",
|
|
1611
|
+
href: approvalUrl,
|
|
1612
|
+
target: "_blank",
|
|
1613
|
+
rel: "noopener noreferrer",
|
|
1614
|
+
children: "Open approval in Po Cloud"
|
|
1615
|
+
}),
|
|
1616
|
+
approvalCode ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1617
|
+
" ",
|
|
1618
|
+
"and check it shows ",
|
|
1619
|
+
/* @__PURE__ */ jsx("strong", {
|
|
1620
|
+
className: "font-mono text-po-text",
|
|
1621
|
+
children: approvalCode
|
|
1622
|
+
})
|
|
1623
|
+
] }) : null,
|
|
1624
|
+
", then return here to check it."
|
|
1625
|
+
]
|
|
1607
1626
|
}) : null,
|
|
1608
1627
|
relayError ? /* @__PURE__ */ jsx("p", {
|
|
1609
1628
|
role: "alert",
|
|
@@ -1612,12 +1631,12 @@ function RemoteConnectionsDialog(props) {
|
|
|
1612
1631
|
}) : null,
|
|
1613
1632
|
/* @__PURE__ */ jsxs("div", {
|
|
1614
1633
|
className: "flex flex-wrap gap-2",
|
|
1615
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
1634
|
+
children: [!relayOn || !props.accountRelay ? /* @__PURE__ */ jsx(Button, {
|
|
1616
1635
|
variant: relayOn ? "outline" : "primary",
|
|
1617
1636
|
disabled: relayBusy,
|
|
1618
1637
|
onClick: props.onRelayAdvance,
|
|
1619
1638
|
children: relayOn ? "Pair through relay" : approvalUrl ? "Check approval" : linked ? "Turn on relay" : "Link to Po Cloud"
|
|
1620
|
-
}), relayOn ? /* @__PURE__ */ jsx(Button, {
|
|
1639
|
+
}) : null, relayOn ? /* @__PURE__ */ jsx(Button, {
|
|
1621
1640
|
variant: "ghost",
|
|
1622
1641
|
disabled: busy,
|
|
1623
1642
|
onClick: props.onRelayStop,
|
|
@@ -1665,7 +1684,7 @@ function RemoteConnectionsDialog(props) {
|
|
|
1665
1684
|
}),
|
|
1666
1685
|
/* @__PURE__ */ jsxs("div", {
|
|
1667
1686
|
className: "flex flex-col gap-2 text-sm text-po-dim",
|
|
1668
|
-
children: [/* @__PURE__ */ jsx("p", { children: "Paired devices can prompt the agent, approve tool calls, and run shell commands as you. Pair only devices you hold." }), /* @__PURE__ */ jsx("p", { children: "An approved Po app can use its existing device key when you choose another connection. Po never switches connections for you." })]
|
|
1687
|
+
children: [/* @__PURE__ */ jsx("p", { children: "Paired devices can prompt the agent, approve tool calls, and run shell commands as you. Pair only devices you hold." }), /* @__PURE__ */ jsx("p", { children: props.accountRelay ? "Phones already paired through the relay stay paired until you forget them. Po never switches connections for you." : "An approved Po app can use its existing device key when you choose another connection. Po never switches connections for you." })]
|
|
1669
1688
|
})
|
|
1670
1689
|
]
|
|
1671
1690
|
}),
|
|
@@ -1698,17 +1717,19 @@ function RemoteAccessDialog() {
|
|
|
1698
1717
|
if (view?.pending?.length || state.relayView?.pending?.length) return null;
|
|
1699
1718
|
const { relay, independent, relayView, connectionError } = state;
|
|
1700
1719
|
if (state.step !== "closed" && independent && relay) {
|
|
1701
|
-
if (!pairing) return /* @__PURE__ */ jsx(RemoteConnectionsDialog, {
|
|
1720
|
+
if (!pairing || state.route === "relay") return /* @__PURE__ */ jsx(RemoteConnectionsDialog, {
|
|
1702
1721
|
relayStatus: relayView?.status ?? "off",
|
|
1703
1722
|
tunnelStatus: view?.status ?? "off",
|
|
1704
1723
|
address: relay.address,
|
|
1724
|
+
accountRelay: true,
|
|
1705
1725
|
approvalUrl: relay.approval?.url,
|
|
1726
|
+
approvalCode: relay.approval?.userCode,
|
|
1706
1727
|
linked: URL.parse(relay.address.trim())?.href === `${relay.linkedOrigin}/`,
|
|
1707
1728
|
busy: state.busy || !view || !relayView,
|
|
1708
1729
|
relayError: connectionError?.relay ?? relayView?.error,
|
|
1709
1730
|
tunnelError: connectionError?.tunnel ?? view?.error,
|
|
1710
1731
|
onAddressChange: editRelayAddress,
|
|
1711
|
-
onRelayAdvance: () => void
|
|
1732
|
+
onRelayAdvance: () => void advanceRelaySetup(),
|
|
1712
1733
|
onRelayStop: () => void changeRemoteConnection("relay", false),
|
|
1713
1734
|
onTunnelAdvance: () => void (view?.status === "on" ? pairRemoteConnection("tunnel") : changeRemoteConnection("tunnel", true)),
|
|
1714
1735
|
onTunnelStop: () => void changeRemoteConnection("tunnel", false),
|
|
@@ -1722,7 +1743,7 @@ function RemoteAccessDialog() {
|
|
|
1722
1743
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
1723
1744
|
width: "lg",
|
|
1724
1745
|
children: [
|
|
1725
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children:
|
|
1746
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Pair through tunnel" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Scan this with the device you want to use." })] }),
|
|
1726
1747
|
/* @__PURE__ */ jsxs(DialogBody, {
|
|
1727
1748
|
className: "flex flex-col gap-4",
|
|
1728
1749
|
children: [/* @__PURE__ */ jsx(RemoteAccessPairing, { route: state.route }), state.route && connectionError?.[state.route] ? /* @__PURE__ */ jsx("p", {
|
|
@@ -1744,16 +1765,17 @@ function RemoteAccessDialog() {
|
|
|
1744
1765
|
});
|
|
1745
1766
|
}
|
|
1746
1767
|
if (state.step !== "closed" && relay && state.route === "relay" && (view?.status !== "on" || relay.active)) {
|
|
1747
|
-
const
|
|
1768
|
+
const connected = relay.active && view?.status === "on";
|
|
1748
1769
|
return /* @__PURE__ */ jsx(RemoteAccessRelayTarget, {
|
|
1749
|
-
phase:
|
|
1770
|
+
phase: connected ? "connected" : state.error ? "failed" : relay.approval ? "pending" : "ready",
|
|
1771
|
+
accountRelay: true,
|
|
1750
1772
|
address: relay.address,
|
|
1751
1773
|
error: state.error,
|
|
1752
1774
|
busy: starting,
|
|
1753
1775
|
locked: relay.active,
|
|
1754
1776
|
linked: URL.parse(relay.address.trim())?.href === `${relay.linkedOrigin}/` || relay.active,
|
|
1755
1777
|
approvalUrl: relay.approval?.url,
|
|
1756
|
-
|
|
1778
|
+
approvalCode: relay.approval?.userCode,
|
|
1757
1779
|
onAddressChange: editRelayAddress,
|
|
1758
1780
|
onTunnel: () => chooseRemoteRoute("tunnel"),
|
|
1759
1781
|
onAdvance: () => void advanceRelaySetup(),
|