arc402-cli 0.7.5 → 0.8.0
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/MIGRATION-SPEC.md +108 -0
- package/dist/abis.js +14 -17
- package/dist/abis.js.map +1 -1
- package/dist/bundler.d.ts +1 -1
- package/dist/bundler.d.ts.map +1 -1
- package/dist/bundler.js +27 -61
- package/dist/bundler.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -9
- package/dist/client.js.map +1 -1
- package/dist/coinbase-smart-wallet.js +1 -4
- package/dist/coinbase-smart-wallet.js.map +1 -1
- package/dist/commands/accept.js +25 -28
- package/dist/commands/accept.js.map +1 -1
- package/dist/commands/agent-handshake.js +15 -18
- package/dist/commands/agent-handshake.js.map +1 -1
- package/dist/commands/agent.js +98 -104
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/agreements.js +62 -98
- package/dist/commands/agreements.js.map +1 -1
- package/dist/commands/arbitrator.js +45 -81
- package/dist/commands/arbitrator.js.map +1 -1
- package/dist/commands/arena-handshake.js +27 -30
- package/dist/commands/arena-handshake.js.map +1 -1
- package/dist/commands/arena.js +12 -18
- package/dist/commands/arena.js.map +1 -1
- package/dist/commands/backup.js +30 -36
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/cancel.js +15 -18
- package/dist/commands/cancel.js.map +1 -1
- package/dist/commands/channel.js +45 -81
- package/dist/commands/channel.js.map +1 -1
- package/dist/commands/coldstart.js +31 -34
- package/dist/commands/coldstart.js.map +1 -1
- package/dist/commands/config.js +23 -29
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contract-interaction.js +12 -15
- package/dist/commands/contract-interaction.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +98 -135
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/deliver.js +37 -76
- package/dist/commands/deliver.js.map +1 -1
- package/dist/commands/discover.js +24 -27
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/dispute.js +104 -110
- package/dist/commands/dispute.js.map +1 -1
- package/dist/commands/doctor.js +16 -55
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/endpoint.js +56 -95
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/feed.js +11 -18
- package/dist/commands/feed.js.map +1 -1
- package/dist/commands/hire.js +37 -40
- package/dist/commands/hire.js.map +1 -1
- package/dist/commands/migrate.js +30 -33
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/negotiate.d.ts.map +1 -1
- package/dist/commands/negotiate.js +34 -36
- package/dist/commands/negotiate.js.map +1 -1
- package/dist/commands/openshell.js +68 -104
- package/dist/commands/openshell.js.map +1 -1
- package/dist/commands/owner.js +17 -20
- package/dist/commands/owner.js.map +1 -1
- package/dist/commands/policy.js +41 -43
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/relay.d.ts.map +1 -1
- package/dist/commands/relay.js +18 -51
- package/dist/commands/relay.js.map +1 -1
- package/dist/commands/remediate.js +20 -23
- package/dist/commands/remediate.js.map +1 -1
- package/dist/commands/reputation.js +25 -27
- package/dist/commands/reputation.js.map +1 -1
- package/dist/commands/setup.js +65 -104
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/trust.js +17 -20
- package/dist/commands/trust.js.map +1 -1
- package/dist/commands/verify.js +18 -21
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/wallet.js +619 -625
- package/dist/commands/wallet.js.map +1 -1
- package/dist/commands/watch.js +33 -36
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/watchtower.js +37 -73
- package/dist/commands/watchtower.js.map +1 -1
- package/dist/commands/workroom.d.ts.map +1 -1
- package/dist/commands/workroom.js +138 -171
- package/dist/commands/workroom.js.map +1 -1
- package/dist/config.js +21 -65
- package/dist/config.js.map +1 -1
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +16 -53
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/hire-listener.d.ts +3 -3
- package/dist/daemon/hire-listener.d.ts.map +1 -1
- package/dist/daemon/hire-listener.js +13 -47
- package/dist/daemon/hire-listener.js.map +1 -1
- package/dist/daemon/index.d.ts +1 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +50 -88
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/job-lifecycle.d.ts +1 -1
- package/dist/daemon/job-lifecycle.d.ts.map +1 -1
- package/dist/daemon/job-lifecycle.js +11 -51
- package/dist/daemon/job-lifecycle.js.map +1 -1
- package/dist/daemon/notify.d.ts +1 -1
- package/dist/daemon/notify.d.ts.map +1 -1
- package/dist/daemon/notify.js +19 -53
- package/dist/daemon/notify.js.map +1 -1
- package/dist/daemon/token-metering.js +8 -47
- package/dist/daemon/token-metering.js.map +1 -1
- package/dist/daemon/userops.d.ts +2 -2
- package/dist/daemon/userops.d.ts.map +1 -1
- package/dist/daemon/userops.js +23 -27
- package/dist/daemon/userops.js.map +1 -1
- package/dist/daemon/wallet-monitor.d.ts +1 -1
- package/dist/daemon/wallet-monitor.d.ts.map +1 -1
- package/dist/daemon/wallet-monitor.js +8 -12
- package/dist/daemon/wallet-monitor.js.map +1 -1
- package/dist/drain-v4.js +26 -64
- package/dist/drain-v4.js.map +1 -1
- package/dist/endpoint-config.js +20 -63
- package/dist/endpoint-config.js.map +1 -1
- package/dist/endpoint-notify.js +9 -48
- package/dist/endpoint-notify.js.map +1 -1
- package/dist/index.js +16 -50
- package/dist/index.js.map +1 -1
- package/dist/openshell-runtime.d.ts.map +1 -1
- package/dist/openshell-runtime.js +38 -82
- package/dist/openshell-runtime.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +77 -83
- package/dist/program.js.map +1 -1
- package/dist/repl.js +25 -31
- package/dist/repl.js.map +1 -1
- package/dist/signing.js +3 -6
- package/dist/signing.js.map +1 -1
- package/dist/telegram-notify.js +3 -40
- package/dist/telegram-notify.js.map +1 -1
- package/dist/tui/App.d.ts +1 -9
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +47 -65
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/Footer.js +4 -7
- package/dist/tui/Footer.js.map +1 -1
- package/dist/tui/Header.d.ts +1 -2
- package/dist/tui/Header.d.ts.map +1 -1
- package/dist/tui/Header.js +8 -14
- package/dist/tui/Header.js.map +1 -1
- package/dist/tui/InputLine.js +17 -23
- package/dist/tui/InputLine.js.map +1 -1
- package/dist/tui/Viewport.d.ts +5 -4
- package/dist/tui/Viewport.d.ts.map +1 -1
- package/dist/tui/Viewport.js +20 -13
- package/dist/tui/Viewport.js.map +1 -1
- package/dist/tui/WalletConnectPairing.d.ts +23 -0
- package/dist/tui/WalletConnectPairing.d.ts.map +1 -0
- package/dist/tui/WalletConnectPairing.js +75 -0
- package/dist/tui/WalletConnectPairing.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +14 -21
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/useChat.js +13 -19
- package/dist/tui/useChat.js.map +1 -1
- package/dist/tui/useCommand.d.ts +2 -7
- package/dist/tui/useCommand.d.ts.map +1 -1
- package/dist/tui/useCommand.js +77 -165
- package/dist/tui/useCommand.js.map +1 -1
- package/dist/tui/useScroll.js +9 -12
- package/dist/tui/useScroll.js.map +1 -1
- package/dist/ui/banner.js +12 -19
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/colors.js +13 -19
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/format.js +6 -14
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/spinner.js +6 -12
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/tree.js +3 -6
- package/dist/ui/tree.js.map +1 -1
- package/dist/utils/format.js +27 -41
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/hash.js +4 -42
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/time.js +2 -6
- package/dist/utils/time.js.map +1 -1
- package/dist/wallet-router.d.ts +1 -1
- package/dist/wallet-router.d.ts.map +1 -1
- package/dist/wallet-router.js +12 -19
- package/dist/wallet-router.js.map +1 -1
- package/dist/walletconnect-session.d.ts +1 -1
- package/dist/walletconnect-session.d.ts.map +1 -1
- package/dist/walletconnect-session.js +6 -11
- package/dist/walletconnect-session.js.map +1 -1
- package/dist/walletconnect.d.ts +6 -1
- package/dist/walletconnect.d.ts.map +1 -1
- package/dist/walletconnect.js +32 -35
- package/dist/walletconnect.js.map +1 -1
- package/package.json +7 -6
- package/src/bundler.ts +1 -1
- package/src/client.ts +1 -1
- package/src/commands/accept.ts +7 -7
- package/src/commands/agent-handshake.ts +4 -4
- package/src/commands/agent.ts +9 -9
- package/src/commands/agreements.ts +8 -8
- package/src/commands/arbitrator.ts +5 -5
- package/src/commands/arena-handshake.ts +6 -6
- package/src/commands/arena.ts +2 -2
- package/src/commands/backup.ts +1 -1
- package/src/commands/cancel.ts +6 -6
- package/src/commands/channel.ts +6 -6
- package/src/commands/coldstart.ts +5 -5
- package/src/commands/config.ts +2 -2
- package/src/commands/contract-interaction.ts +2 -2
- package/src/commands/daemon.ts +14 -11
- package/src/commands/deliver.ts +9 -9
- package/src/commands/discover.ts +5 -5
- package/src/commands/dispute.ts +7 -7
- package/src/commands/doctor.ts +2 -2
- package/src/commands/endpoint.ts +6 -6
- package/src/commands/feed.ts +1 -1
- package/src/commands/hire.ts +10 -10
- package/src/commands/migrate.ts +7 -7
- package/src/commands/negotiate.ts +6 -5
- package/src/commands/openshell.ts +4 -4
- package/src/commands/owner.ts +5 -5
- package/src/commands/policy.ts +5 -5
- package/src/commands/relay.ts +5 -1
- package/src/commands/remediate.ts +5 -5
- package/src/commands/reputation.ts +6 -6
- package/src/commands/setup.ts +1 -1
- package/src/commands/trust.ts +6 -6
- package/src/commands/verify.ts +6 -6
- package/src/commands/wallet.ts +15 -15
- package/src/commands/watch.ts +3 -3
- package/src/commands/watchtower.ts +6 -6
- package/src/commands/workroom.ts +14 -10
- package/src/daemon/config.ts +2 -1
- package/src/daemon/hire-listener.ts +3 -3
- package/src/daemon/index.ts +10 -9
- package/src/daemon/job-lifecycle.ts +1 -1
- package/src/daemon/notify.ts +4 -4
- package/src/daemon/userops.ts +4 -4
- package/src/daemon/wallet-monitor.ts +2 -2
- package/src/endpoint-notify.ts +1 -1
- package/src/index.ts +8 -7
- package/src/openshell-runtime.ts +5 -1
- package/src/program.ts +36 -36
- package/src/repl.ts +3 -3
- package/src/tui/App.tsx +26 -47
- package/src/tui/Header.tsx +3 -10
- package/src/tui/InputLine.tsx +1 -1
- package/src/tui/Viewport.tsx +22 -18
- package/src/tui/WalletConnectPairing.tsx +131 -0
- package/src/tui/index.tsx +7 -8
- package/src/tui/useChat.ts +1 -1
- package/src/tui/useCommand.ts +86 -183
- package/src/ui/banner.ts +2 -2
- package/src/ui/tree.ts +1 -1
- package/src/wallet-router.ts +2 -2
- package/src/walletconnect-session.ts +1 -1
- package/src/walletconnect.ts +20 -5
- package/tsconfig.json +16 -7
package/dist/tui/Viewport.js
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Viewport = Viewport;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const ink_1 = require("ink");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from "ink";
|
|
6
3
|
/**
|
|
7
|
-
* Scrollable output area
|
|
8
|
-
*
|
|
4
|
+
* Scrollable output area that fills remaining terminal space.
|
|
5
|
+
* Renders a window slice of the buffer, not terminal scroll.
|
|
6
|
+
* scrollOffset=0 means pinned to bottom (auto-scroll).
|
|
7
|
+
* Positive scrollOffset means scrolled up by that many lines.
|
|
9
8
|
*/
|
|
10
|
-
function Viewport({ lines, scrollOffset, isAutoScroll
|
|
11
|
-
const { stdout } =
|
|
9
|
+
export function Viewport({ lines, scrollOffset, isAutoScroll }) {
|
|
10
|
+
const { stdout } = useStdout();
|
|
12
11
|
const termRows = stdout?.rows ?? 24;
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
// We'll compute the viewport height: total rows minus fixed areas
|
|
13
|
+
// Header is approximately bannerLines + separator (~14-16 rows)
|
|
14
|
+
// Footer is 1 row
|
|
15
|
+
// We'll use a reasonable estimate here; the parent App can pass exact height
|
|
16
|
+
const HEADER_ROWS = 15; // approximate
|
|
17
|
+
const FOOTER_ROWS = 1;
|
|
18
|
+
const viewportHeight = Math.max(1, termRows - HEADER_ROWS - FOOTER_ROWS);
|
|
16
19
|
// Compute the window slice
|
|
20
|
+
// scrollOffset=0 → show last viewportHeight lines
|
|
21
|
+
// scrollOffset=N → show lines ending viewportHeight+N from end
|
|
17
22
|
const totalLines = lines.length;
|
|
18
23
|
let endIdx;
|
|
19
24
|
let startIdx;
|
|
20
25
|
if (scrollOffset === 0) {
|
|
26
|
+
// Auto-scroll: pinned to bottom
|
|
21
27
|
endIdx = totalLines;
|
|
22
28
|
startIdx = Math.max(0, endIdx - viewportHeight);
|
|
23
29
|
}
|
|
24
30
|
else {
|
|
31
|
+
// Scrolled up: scrollOffset lines from bottom
|
|
25
32
|
endIdx = Math.max(0, totalLines - scrollOffset);
|
|
26
33
|
startIdx = Math.max(0, endIdx - viewportHeight);
|
|
27
34
|
}
|
|
@@ -33,6 +40,6 @@ function Viewport({ lines, scrollOffset, isAutoScroll, innerWidth = 58 }) {
|
|
|
33
40
|
...visibleLines,
|
|
34
41
|
];
|
|
35
42
|
const canScrollDown = scrollOffset > 0;
|
|
36
|
-
return ((
|
|
43
|
+
return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, children: paddedLines.map((line, i) => (_jsx(Text, { children: line }, i))) }), canScrollDown && !isAutoScroll && (_jsx(Box, { justifyContent: "flex-end", children: _jsx(Text, { dimColor: true, children: "\u2193 more" }) }))] }));
|
|
37
44
|
}
|
|
38
45
|
//# sourceMappingURL=Viewport.js.map
|
package/dist/tui/Viewport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../src/tui/Viewport.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../src/tui/Viewport.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAQ3C;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAiB;IAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;IAEpC,kEAAkE;IAClE,gEAAgE;IAChE,kBAAkB;IAClB,6EAA6E;IAC7E,MAAM,WAAW,GAAG,EAAE,CAAC,CAAC,cAAc;IACtC,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;IAEzE,2BAA2B;IAC3B,kDAAkD;IAClD,+DAA+D;IAC/D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,IAAI,MAAc,CAAC;IACnB,IAAI,QAAgB,CAAC;IAErB,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,gCAAgC;QAChC,MAAM,GAAG,UAAU,CAAC;QACpB,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,8CAA8C;QAC9C,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC;QAChD,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEnD,oDAAoD;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG;QAClB,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,GAAG,YAAY;KAChB,CAAC;IAEF,MAAM,aAAa,GAAG,YAAY,GAAG,CAAC,CAAC;IAEvC,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,aACrC,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,YACpC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5B,KAAC,IAAI,cAAU,IAAI,IAAR,CAAC,CAAe,CAC5B,CAAC,GACE,EACL,aAAa,IAAI,CAAC,YAAY,IAAI,CACjC,KAAC,GAAG,IAAC,cAAc,EAAC,UAAU,YAC5B,KAAC,IAAI,IAAC,QAAQ,kCAAc,GACxB,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WCCallbacks } from "../walletconnect.js";
|
|
2
|
+
export type WCStage = "connecting" | "connected" | "chain-switching" | "ready" | "error";
|
|
3
|
+
interface WalletConnectPairingProps {
|
|
4
|
+
projectId: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
onComplete: (result: {
|
|
7
|
+
account: string;
|
|
8
|
+
}) => void;
|
|
9
|
+
onError: (err: string) => void;
|
|
10
|
+
/** Called once the component mounts — parent passes the connect function */
|
|
11
|
+
connect: (callbacks: WCCallbacks) => Promise<{
|
|
12
|
+
account: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders WalletConnect pairing inside the Ink TUI viewport:
|
|
17
|
+
* - ASCII QR code
|
|
18
|
+
* - Deep links for MetaMask, Rainbow, Trust, etc.
|
|
19
|
+
* - Status transitions: connecting → connected → chain-switching → ready
|
|
20
|
+
*/
|
|
21
|
+
export declare function WalletConnectPairing({ onComplete, onError, connect, }: WalletConnectPairingProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=WalletConnectPairing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletConnectPairing.d.ts","sourceRoot":"","sources":["../../src/tui/WalletConnectPairing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzF,UAAU,yBAAyB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAClD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,OAAO,EACP,OAAO,GACR,EAAE,yBAAyB,2CAyG3B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
|
+
import { Box, Text } from "ink";
|
|
4
|
+
/**
|
|
5
|
+
* Renders WalletConnect pairing inside the Ink TUI viewport:
|
|
6
|
+
* - ASCII QR code
|
|
7
|
+
* - Deep links for MetaMask, Rainbow, Trust, etc.
|
|
8
|
+
* - Status transitions: connecting → connected → chain-switching → ready
|
|
9
|
+
*/
|
|
10
|
+
export function WalletConnectPairing({ onComplete, onError, connect, }) {
|
|
11
|
+
const [stage, setStage] = useState("connecting");
|
|
12
|
+
const [uri, setUri] = useState(null);
|
|
13
|
+
const [links, setLinks] = useState({});
|
|
14
|
+
const [account, setAccount] = useState(null);
|
|
15
|
+
const [qrLines, setQrLines] = useState([]);
|
|
16
|
+
const [detail, setDetail] = useState("");
|
|
17
|
+
const handleUri = useCallback((wcUri, wcLinks) => {
|
|
18
|
+
setUri(wcUri);
|
|
19
|
+
setLinks(wcLinks);
|
|
20
|
+
// Generate ASCII QR
|
|
21
|
+
try {
|
|
22
|
+
// qrcode-terminal writes to stdout — capture it
|
|
23
|
+
const origWrite = process.stdout.write.bind(process.stdout);
|
|
24
|
+
const captured = [];
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
process.stdout.write = (chunk) => {
|
|
27
|
+
const str = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
28
|
+
captured.push(str);
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
+
import("qrcode-terminal").then((qr) => {
|
|
33
|
+
qr.default.generate(wcUri, { small: true }, (code) => {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
process.stdout.write = origWrite;
|
|
36
|
+
setQrLines(code.split("\n"));
|
|
37
|
+
});
|
|
38
|
+
}).catch(() => {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
process.stdout.write = origWrite;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// QR rendering is best-effort
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
const handleStatus = useCallback((status, statusDetail) => {
|
|
48
|
+
setStage(status);
|
|
49
|
+
if (statusDetail)
|
|
50
|
+
setDetail(statusDetail);
|
|
51
|
+
if (status === "connected" && statusDetail) {
|
|
52
|
+
setAccount(statusDetail);
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const callbacks = {
|
|
57
|
+
onUri: handleUri,
|
|
58
|
+
onStatus: handleStatus,
|
|
59
|
+
};
|
|
60
|
+
connect(callbacks)
|
|
61
|
+
.then((result) => onComplete(result))
|
|
62
|
+
.catch((err) => onError(err instanceof Error ? err.message : String(err)));
|
|
63
|
+
}, [connect, handleUri, handleStatus, onComplete, onError]);
|
|
64
|
+
const statusIcon = stage === "error" ? "✗" : stage === "ready" ? "✓" : "◈";
|
|
65
|
+
const statusColor = stage === "error" ? "red" : stage === "ready" ? "green" : "cyan";
|
|
66
|
+
const statusMessages = {
|
|
67
|
+
connecting: "Waiting for wallet approval...",
|
|
68
|
+
connected: `Connected: ${account ?? ""}`,
|
|
69
|
+
"chain-switching": `Switching chain${detail ? `: ${detail}` : ""}...`,
|
|
70
|
+
ready: `Ready — ${account ?? ""}`,
|
|
71
|
+
error: detail || "Connection failed",
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "WalletConnect Pairing" }), _jsx(Text, { children: " " }), _jsxs(Box, { children: [_jsxs(Text, { color: statusColor, children: [statusIcon, " "] }), _jsx(Text, { children: statusMessages[stage] })] }), _jsx(Text, { children: " " }), uri && stage === "connecting" && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: "Tap a link for your wallet app:" }), _jsx(Text, { children: " " }), Object.entries(links).map(([name, link]) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "white", children: [name, ":"] }), _jsx(Text, { dimColor: true, children: link }), _jsx(Text, { children: " " })] }, name))), qrLines.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: "Or scan QR:" }), qrLines.map((line, i) => (_jsx(Text, { children: line }, i)))] }))] }))] }));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=WalletConnectPairing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletConnectPairing.js","sourceRoot":"","sources":["../../src/tui/WalletConnectPairing.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAchC;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,UAAU,EACV,OAAO,EACP,OAAO,GACmB;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,YAAY,CAAC,CAAC;IAC1D,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,KAAa,EAAE,OAA+B,EAAE,EAAE;QAC/E,MAAM,CAAC,KAAK,CAA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
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"AA8CA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAwB/C"}
|
package/dist/tui/index.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const os_1 = __importDefault(require("os"));
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
14
|
-
const pkg = require("../../package.json");
|
|
15
|
-
const CONFIG_PATH = path_1.default.join(os_1.default.homedir(), ".arc402", "config.json");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from "ink";
|
|
3
|
+
import { App } from "./App.js";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
const pkg = createRequire(import.meta.url)("../../package.json");
|
|
9
|
+
const CONFIG_PATH = path.join(os.homedir(), ".arc402", "config.json");
|
|
16
10
|
async function loadConfig() {
|
|
17
|
-
if (!
|
|
11
|
+
if (!fs.existsSync(CONFIG_PATH))
|
|
18
12
|
return {};
|
|
19
13
|
try {
|
|
20
|
-
return JSON.parse(
|
|
14
|
+
return JSON.parse(fs.readFileSync(CONFIG_PATH, "utf-8"));
|
|
21
15
|
}
|
|
22
16
|
catch {
|
|
23
17
|
return {};
|
|
@@ -25,8 +19,7 @@ async function loadConfig() {
|
|
|
25
19
|
}
|
|
26
20
|
async function getBalance(rpcUrl, address) {
|
|
27
21
|
try {
|
|
28
|
-
|
|
29
|
-
const ethersLib = require("ethers");
|
|
22
|
+
const ethersLib = await import("ethers");
|
|
30
23
|
const provider = new ethersLib.ethers.JsonRpcProvider(rpcUrl);
|
|
31
24
|
const bal = await Promise.race([
|
|
32
25
|
provider.getBalance(address),
|
|
@@ -38,7 +31,7 @@ async function getBalance(rpcUrl, address) {
|
|
|
38
31
|
return undefined;
|
|
39
32
|
}
|
|
40
33
|
}
|
|
41
|
-
async function launchTUI() {
|
|
34
|
+
export async function launchTUI() {
|
|
42
35
|
const config = await loadConfig();
|
|
43
36
|
let walletDisplay;
|
|
44
37
|
if (config.walletContractAddress) {
|
|
@@ -49,7 +42,7 @@ async function launchTUI() {
|
|
|
49
42
|
if (config.rpcUrl && config.walletContractAddress) {
|
|
50
43
|
balance = await getBalance(config.rpcUrl, config.walletContractAddress);
|
|
51
44
|
}
|
|
52
|
-
const { waitUntilExit } =
|
|
45
|
+
const { waitUntilExit } = render(_jsx(App, { version: pkg.version, network: config.network, wallet: walletDisplay, balance: balance }));
|
|
53
46
|
await waitUntilExit();
|
|
54
47
|
}
|
|
55
48
|
//# sourceMappingURL=index.js.map
|
package/dist/tui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,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IAAI,aAAiC,CAAC;IACtC,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC;QACvC,aAAa,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,OAA2B,CAAC;IAChC,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClD,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAC9B,KAAC,GAAG,IACF,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;IAEF,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/tui/useChat.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useChat = useChat;
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const colors_1 = require("../ui/colors");
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { c } from "../ui/colors.js";
|
|
10
4
|
/**
|
|
11
5
|
* Sends messages to the OpenClaw gateway and streams responses
|
|
12
6
|
* line-by-line into the viewport buffer via onLine callback.
|
|
13
7
|
*/
|
|
14
|
-
function useChat() {
|
|
15
|
-
const [isSending, setIsSending] =
|
|
16
|
-
const send =
|
|
8
|
+
export function useChat() {
|
|
9
|
+
const [isSending, setIsSending] = useState(false);
|
|
10
|
+
const send = useCallback(async (message, onLine) => {
|
|
17
11
|
setIsSending(true);
|
|
18
12
|
const trimmed = message.trim().slice(0, 10000);
|
|
19
13
|
// Show thinking placeholder
|
|
20
|
-
onLine(
|
|
14
|
+
onLine(chalk.dim(" ◈ ") + chalk.dim("thinking..."));
|
|
21
15
|
let res;
|
|
22
16
|
try {
|
|
23
17
|
res = await fetch("http://localhost:19000/api/agent", {
|
|
@@ -35,19 +29,19 @@ function useChat() {
|
|
|
35
29
|
msg.includes("UND_ERR_SOCKET");
|
|
36
30
|
if (isDown) {
|
|
37
31
|
onLine(" " +
|
|
38
|
-
|
|
32
|
+
chalk.yellow("⚠") +
|
|
39
33
|
" " +
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
chalk.dim("OpenClaw gateway not running. Start with: ") +
|
|
35
|
+
chalk.white("openclaw gateway start"));
|
|
42
36
|
}
|
|
43
37
|
else {
|
|
44
|
-
onLine(` ${
|
|
38
|
+
onLine(` ${c.failure} ${chalk.red(msg)}`);
|
|
45
39
|
}
|
|
46
40
|
setIsSending(false);
|
|
47
41
|
return;
|
|
48
42
|
}
|
|
49
43
|
if (!res.body) {
|
|
50
|
-
onLine(
|
|
44
|
+
onLine(chalk.dim(" ◈ ") + chalk.white("(empty response)"));
|
|
51
45
|
setIsSending(false);
|
|
52
46
|
return;
|
|
53
47
|
}
|
|
@@ -66,7 +60,7 @@ function useChat() {
|
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
if (line.trim()) {
|
|
69
|
-
onLine(
|
|
63
|
+
onLine(chalk.dim(" ◈ ") + chalk.white(line));
|
|
70
64
|
}
|
|
71
65
|
};
|
|
72
66
|
const reader = res.body.getReader();
|
package/dist/tui/useChat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChat.js","sourceRoot":"","sources":["../../src/tui/useChat.ts"],"names":[],"mappings":"
|
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9
|
-
* process.stdout.write and routes output to the viewport.
|
|
10
|
-
*
|
|
11
|
-
* INTERACTIVE commands (WalletConnect, prompts): spawns a child process
|
|
12
|
-
* running `arc402 <command>` with inherited stdin so that QR codes render
|
|
13
|
-
* and prompts accept input. Output is captured line-by-line into the viewport.
|
|
7
|
+
* Captures stdout/stderr by monkey-patching process.stdout.write
|
|
8
|
+
* and routes all output to the viewport buffer via onLine callback.
|
|
14
9
|
*/
|
|
15
10
|
export declare function useCommand(): UseCommandResult;
|
|
16
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommand.d.ts","sourceRoot":"","sources":["../../src/tui/useCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCommand.d.ts","sourceRoot":"","sources":["../../src/tui/useCommand.ts"],"names":[],"mappings":"AAKA,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,gBAAgB,CA+F7C"}
|
package/dist/tui/useCommand.js
CHANGED
|
@@ -1,178 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useCommand = useCommand;
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const program_1 = require("../program");
|
|
9
|
-
const child_process_1 = require("child_process");
|
|
10
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const colors_1 = require("../ui/colors");
|
|
12
|
-
/**
|
|
13
|
-
* Commands that use interactive prompts or WalletConnect QR flows.
|
|
14
|
-
* These MUST run in a child process so they can own stdin/stdout directly,
|
|
15
|
-
* because Ink holds stdin in raw mode for its own input handling.
|
|
16
|
-
*/
|
|
17
|
-
const INTERACTIVE_COMMANDS = new Set([
|
|
18
|
-
"wallet deploy",
|
|
19
|
-
"wallet set-guardian",
|
|
20
|
-
"wallet unfreeze",
|
|
21
|
-
"wallet authorize-machine-key",
|
|
22
|
-
"wallet revoke-machine-key",
|
|
23
|
-
"wallet set-passkey",
|
|
24
|
-
"wallet set-interceptor",
|
|
25
|
-
"wallet set-velocity-limit",
|
|
26
|
-
"wallet upgrade-registry",
|
|
27
|
-
"wallet execute-registry-upgrade",
|
|
28
|
-
"wallet cancel-registry-upgrade",
|
|
29
|
-
"wallet register-policy",
|
|
30
|
-
"wallet whitelist-contract",
|
|
31
|
-
"wallet governance setup",
|
|
32
|
-
"wallet policy set-limit",
|
|
33
|
-
"wallet policy set-daily-limit",
|
|
34
|
-
"wallet policy set",
|
|
35
|
-
"wallet import",
|
|
36
|
-
"config init",
|
|
37
|
-
]);
|
|
38
|
-
function isInteractiveCommand(input) {
|
|
39
|
-
const normalized = input.trim();
|
|
40
|
-
for (const cmd of INTERACTIVE_COMMANDS) {
|
|
41
|
-
if (normalized === cmd || normalized.startsWith(cmd + " "))
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import { createProgram } from "../program.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { c } from "../ui/colors.js";
|
|
46
5
|
/**
|
|
47
6
|
* Dispatches parsed commands to the commander program.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* process.stdout.write and routes output to the viewport.
|
|
51
|
-
*
|
|
52
|
-
* INTERACTIVE commands (WalletConnect, prompts): spawns a child process
|
|
53
|
-
* running `arc402 <command>` with inherited stdin so that QR codes render
|
|
54
|
-
* and prompts accept input. Output is captured line-by-line into the viewport.
|
|
7
|
+
* Captures stdout/stderr by monkey-patching process.stdout.write
|
|
8
|
+
* and routes all output to the viewport buffer via onLine callback.
|
|
55
9
|
*/
|
|
56
|
-
function useCommand() {
|
|
57
|
-
const [isRunning, setIsRunning] =
|
|
58
|
-
const execute =
|
|
10
|
+
export function useCommand() {
|
|
11
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
12
|
+
const execute = useCallback(async (input, onLine) => {
|
|
59
13
|
setIsRunning(true);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
14
|
+
// Capture stdout/stderr
|
|
15
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
16
|
+
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
17
|
+
let captureBuffer = "";
|
|
18
|
+
const flushBuffer = () => {
|
|
19
|
+
if (!captureBuffer)
|
|
20
|
+
return;
|
|
21
|
+
const lines = captureBuffer.split("\n");
|
|
22
|
+
captureBuffer = lines.pop() ?? "";
|
|
23
|
+
for (const line of lines) {
|
|
24
|
+
onLine(line);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const capturedWrite = (chunk, encodingOrCb, cb) => {
|
|
28
|
+
const str = typeof chunk === "string"
|
|
29
|
+
? chunk
|
|
30
|
+
: Buffer.from(chunk).toString("utf8");
|
|
31
|
+
captureBuffer += str;
|
|
32
|
+
flushBuffer();
|
|
33
|
+
// call callback if provided
|
|
34
|
+
const callback = typeof encodingOrCb === "function" ? encodingOrCb : cb;
|
|
35
|
+
if (callback)
|
|
36
|
+
callback();
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
// Monkey-patch (cast through unknown to bypass strict overload checking)
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
process.stdout.write = capturedWrite;
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
process.stderr.write = capturedWrite;
|
|
44
|
+
try {
|
|
45
|
+
const tokens = parseTokens(input);
|
|
46
|
+
const prog = createProgram();
|
|
47
|
+
prog.exitOverride();
|
|
48
|
+
prog.configureOutput({
|
|
49
|
+
writeOut: (str) => process.stdout.write(str),
|
|
50
|
+
writeErr: (str) => process.stderr.write(str),
|
|
51
|
+
});
|
|
52
|
+
await prog.parseAsync(["node", "arc402", ...tokens]);
|
|
65
53
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// Use stdio: 'inherit' so the child owns stdin/stdout/stderr directly.
|
|
81
|
-
// This means its output goes straight to the terminal (not captured in viewport)
|
|
82
|
-
// but that's correct — the child needs raw terminal access for QR codes, prompts, etc.
|
|
83
|
-
const child = (0, child_process_1.spawn)(process.execPath, [process.argv[1], ...tokens], {
|
|
84
|
-
stdio: "inherit",
|
|
85
|
-
env: { ...process.env, ARC402_NO_TUI: "1" }, // prevent child from launching its own TUI
|
|
86
|
-
cwd: process.cwd(),
|
|
87
|
-
});
|
|
88
|
-
child.on("close", (code) => {
|
|
89
|
-
onLine("");
|
|
90
|
-
if (code === 0) {
|
|
91
|
-
onLine(` ${colors_1.c.success} ${chalk_1.default.dim("Command completed")}`);
|
|
54
|
+
catch (err) {
|
|
55
|
+
const e = err;
|
|
56
|
+
if (e.code === "commander.helpDisplayed" ||
|
|
57
|
+
e.code === "commander.version" ||
|
|
58
|
+
e.code === "commander.executeSubCommandAsync") {
|
|
59
|
+
// already written or normal exit — no-op
|
|
60
|
+
}
|
|
61
|
+
else if (e.code === "commander.unknownCommand") {
|
|
62
|
+
const tokens = parseTokens(input);
|
|
63
|
+
onLine(` ${c.failure} ${chalk.red(`Unknown command: ${chalk.white(tokens[0])}`)} `);
|
|
64
|
+
onLine(chalk.dim(" Type 'help' for available commands"));
|
|
65
|
+
}
|
|
66
|
+
else if (e.code?.startsWith("commander.")) {
|
|
67
|
+
onLine(` ${c.failure} ${chalk.red(e.message ?? String(err))}`);
|
|
92
68
|
}
|
|
93
69
|
else {
|
|
94
|
-
onLine(` ${
|
|
70
|
+
onLine(` ${c.failure} ${chalk.red(e.message ?? String(err))}`);
|
|
95
71
|
}
|
|
96
|
-
resolve();
|
|
97
|
-
});
|
|
98
|
-
child.on("error", (err) => {
|
|
99
|
-
onLine(` ${colors_1.c.failure} ${chalk_1.default.red(`Failed to spawn: ${err.message}`)}`);
|
|
100
|
-
resolve();
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Run a non-interactive command in-process with captured output.
|
|
106
|
-
*/
|
|
107
|
-
async function executeInProcess(input, onLine) {
|
|
108
|
-
// Capture stdout/stderr
|
|
109
|
-
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
110
|
-
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
111
|
-
let captureBuffer = "";
|
|
112
|
-
const flushBuffer = () => {
|
|
113
|
-
if (!captureBuffer)
|
|
114
|
-
return;
|
|
115
|
-
const lines = captureBuffer.split("\n");
|
|
116
|
-
captureBuffer = lines.pop() ?? "";
|
|
117
|
-
for (const line of lines) {
|
|
118
|
-
onLine(line);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const capturedWrite = (chunk, encodingOrCb, cb) => {
|
|
122
|
-
const str = typeof chunk === "string"
|
|
123
|
-
? chunk
|
|
124
|
-
: Buffer.from(chunk).toString("utf8");
|
|
125
|
-
captureBuffer += str;
|
|
126
|
-
flushBuffer();
|
|
127
|
-
const callback = typeof encodingOrCb === "function" ? encodingOrCb : cb;
|
|
128
|
-
if (callback)
|
|
129
|
-
callback();
|
|
130
|
-
return true;
|
|
131
|
-
};
|
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
133
|
-
process.stdout.write = capturedWrite;
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
-
process.stderr.write = capturedWrite;
|
|
136
|
-
try {
|
|
137
|
-
const tokens = parseTokens(input);
|
|
138
|
-
const prog = (0, program_1.createProgram)();
|
|
139
|
-
prog.exitOverride();
|
|
140
|
-
prog.configureOutput({
|
|
141
|
-
writeOut: (str) => process.stdout.write(str),
|
|
142
|
-
writeErr: (str) => process.stderr.write(str),
|
|
143
|
-
});
|
|
144
|
-
await prog.parseAsync(["node", "arc402", ...tokens]);
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
const e = err;
|
|
148
|
-
if (e.code === "commander.helpDisplayed" ||
|
|
149
|
-
e.code === "commander.version" ||
|
|
150
|
-
e.code === "commander.executeSubCommandAsync") {
|
|
151
|
-
// already written or normal exit — no-op
|
|
152
|
-
}
|
|
153
|
-
else if (e.code === "commander.unknownCommand") {
|
|
154
|
-
const tokens = parseTokens(input);
|
|
155
|
-
onLine(` ${colors_1.c.failure} ${chalk_1.default.red(`Unknown command: ${chalk_1.default.white(tokens[0])}`)} `);
|
|
156
|
-
onLine(chalk_1.default.dim(" Type 'help' for available commands"));
|
|
157
|
-
}
|
|
158
|
-
else if (e.code?.startsWith("commander.")) {
|
|
159
|
-
onLine(` ${colors_1.c.failure} ${chalk_1.default.red(e.message ?? String(err))}`);
|
|
160
72
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
73
|
+
finally {
|
|
74
|
+
// Flush remaining buffer
|
|
75
|
+
if (captureBuffer.trim()) {
|
|
76
|
+
onLine(captureBuffer);
|
|
77
|
+
captureBuffer = "";
|
|
78
|
+
}
|
|
79
|
+
// Restore original write functions
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
process.stdout.write = originalStdoutWrite;
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
process.stderr.write = originalStderrWrite;
|
|
84
|
+
setIsRunning(false);
|
|
170
85
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
-
process.stderr.write = originalStderrWrite;
|
|
175
|
-
}
|
|
86
|
+
}, []);
|
|
87
|
+
return { execute, isRunning };
|
|
176
88
|
}
|
|
177
89
|
// Shell-style tokenizer
|
|
178
90
|
function parseTokens(input) {
|