arc402-cli 0.9.19 → 0.10.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/README.md +41 -2
- package/dist/abis.d.ts +1 -0
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +45 -14
- 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 +61 -27
- 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 +9 -5
- package/dist/client.js.map +1 -1
- package/dist/coinbase-smart-wallet.js +4 -1
- package/dist/coinbase-smart-wallet.js.map +1 -1
- package/dist/commands/accept.js +28 -25
- package/dist/commands/accept.js.map +1 -1
- package/dist/commands/agent-handshake.js +18 -15
- package/dist/commands/agent-handshake.js.map +1 -1
- package/dist/commands/agent.js +104 -98
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/agreements.js +98 -62
- package/dist/commands/agreements.js.map +1 -1
- package/dist/commands/arbitrator.js +81 -45
- package/dist/commands/arbitrator.js.map +1 -1
- package/dist/commands/arena-handshake.d.ts.map +1 -1
- package/dist/commands/arena-handshake.js +35 -53
- package/dist/commands/arena-handshake.js.map +1 -1
- package/dist/commands/arena.js +18 -12
- package/dist/commands/arena.js.map +1 -1
- package/dist/commands/backup.js +36 -30
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/cancel.js +18 -15
- package/dist/commands/cancel.js.map +1 -1
- package/dist/commands/channel.js +81 -45
- package/dist/commands/channel.js.map +1 -1
- package/dist/commands/coldstart.js +34 -31
- package/dist/commands/coldstart.js.map +1 -1
- package/dist/commands/compute.d.ts +14 -0
- package/dist/commands/compute.d.ts.map +1 -0
- package/dist/commands/compute.js +466 -0
- package/dist/commands/compute.js.map +1 -0
- package/dist/commands/config.js +30 -24
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contract-interaction.js +15 -12
- package/dist/commands/contract-interaction.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +135 -98
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/deliver.js +76 -37
- package/dist/commands/deliver.js.map +1 -1
- package/dist/commands/discover.js +27 -24
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/dispute.js +110 -104
- package/dist/commands/dispute.js.map +1 -1
- package/dist/commands/doctor.js +55 -16
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/endpoint.js +95 -56
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/feed.js +18 -11
- package/dist/commands/feed.js.map +1 -1
- package/dist/commands/hire.js +40 -37
- package/dist/commands/hire.js.map +1 -1
- package/dist/commands/migrate.js +33 -30
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/negotiate.d.ts.map +1 -1
- package/dist/commands/negotiate.js +36 -34
- package/dist/commands/negotiate.js.map +1 -1
- package/dist/commands/openshell.js +104 -68
- package/dist/commands/openshell.js.map +1 -1
- package/dist/commands/owner.js +20 -17
- package/dist/commands/owner.js.map +1 -1
- package/dist/commands/policy.js +43 -41
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/relay.d.ts.map +1 -1
- package/dist/commands/relay.js +51 -18
- package/dist/commands/relay.js.map +1 -1
- package/dist/commands/remediate.js +23 -20
- package/dist/commands/remediate.js.map +1 -1
- package/dist/commands/reputation.js +27 -25
- package/dist/commands/reputation.js.map +1 -1
- package/dist/commands/setup.js +104 -65
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/trust.js +20 -17
- package/dist/commands/trust.js.map +1 -1
- package/dist/commands/verify.js +21 -18
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/wallet.d.ts.map +1 -1
- package/dist/commands/wallet.js +645 -679
- package/dist/commands/wallet.js.map +1 -1
- package/dist/commands/watch.js +36 -33
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/watchtower.js +73 -37
- package/dist/commands/watchtower.js.map +1 -1
- package/dist/commands/workroom.d.ts.map +1 -1
- package/dist/commands/workroom.js +282 -143
- package/dist/commands/workroom.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +71 -22
- package/dist/config.js.map +1 -1
- package/dist/daemon/compute-metering.d.ts +61 -0
- package/dist/daemon/compute-metering.d.ts.map +1 -0
- package/dist/daemon/compute-metering.js +299 -0
- package/dist/daemon/compute-metering.js.map +1 -0
- package/dist/daemon/compute-session.d.ts +100 -0
- package/dist/daemon/compute-session.d.ts.map +1 -0
- package/dist/daemon/compute-session.js +231 -0
- package/dist/daemon/compute-session.js.map +1 -0
- package/dist/daemon/config.d.ts +19 -1
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +90 -16
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/credentials.d.ts +24 -0
- package/dist/daemon/credentials.d.ts.map +1 -0
- package/dist/daemon/credentials.js +80 -0
- package/dist/daemon/credentials.js.map +1 -0
- package/dist/daemon/delivery-client.d.ts +35 -0
- package/dist/daemon/delivery-client.d.ts.map +1 -0
- package/dist/daemon/delivery-client.js +231 -0
- package/dist/daemon/delivery-client.js.map +1 -0
- package/dist/daemon/file-delivery.d.ts +98 -0
- package/dist/daemon/file-delivery.d.ts.map +1 -0
- package/dist/daemon/file-delivery.js +461 -0
- package/dist/daemon/file-delivery.js.map +1 -0
- 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 +47 -13
- package/dist/daemon/hire-listener.js.map +1 -1
- package/dist/daemon/index.d.ts +2 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +526 -53
- 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 +51 -11
- 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 +53 -19
- package/dist/daemon/notify.js.map +1 -1
- package/dist/daemon/token-metering.js +47 -8
- 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 +27 -23
- 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 +12 -8
- package/dist/daemon/wallet-monitor.js.map +1 -1
- package/dist/daemon/worker-executor.d.ts +71 -0
- package/dist/daemon/worker-executor.d.ts.map +1 -0
- package/dist/daemon/worker-executor.js +382 -0
- package/dist/daemon/worker-executor.js.map +1 -0
- package/dist/drain-v4.js +64 -26
- package/dist/drain-v4.js.map +1 -1
- package/dist/endpoint-config.js +63 -20
- package/dist/endpoint-config.js.map +1 -1
- package/dist/endpoint-notify.d.ts.map +1 -1
- package/dist/endpoint-notify.js +49 -15
- package/dist/endpoint-notify.js.map +1 -1
- package/dist/index.js +50 -18
- package/dist/index.js.map +1 -1
- package/dist/openshell-runtime.d.ts.map +1 -1
- package/dist/openshell-runtime.js +82 -38
- package/dist/openshell-runtime.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +85 -78
- package/dist/program.js.map +1 -1
- package/dist/repl.js +31 -25
- package/dist/repl.js.map +1 -1
- package/dist/signing.js +6 -3
- package/dist/signing.js.map +1 -1
- package/dist/telegram-notify.js +40 -3
- package/dist/telegram-notify.js.map +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +56 -89
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/Footer.js +7 -4
- package/dist/tui/Footer.js.map +1 -1
- package/dist/tui/Header.d.ts +1 -1
- package/dist/tui/Header.d.ts.map +1 -1
- package/dist/tui/Header.js +14 -9
- package/dist/tui/Header.js.map +1 -1
- package/dist/tui/InputLine.d.ts +2 -1
- package/dist/tui/InputLine.d.ts.map +1 -1
- package/dist/tui/InputLine.js +47 -97
- package/dist/tui/InputLine.js.map +1 -1
- package/dist/tui/Viewport.d.ts +1 -2
- package/dist/tui/Viewport.d.ts.map +1 -1
- package/dist/tui/Viewport.js +26 -6
- package/dist/tui/Viewport.js.map +1 -1
- package/dist/tui/WalletConnectPairing.js +19 -16
- package/dist/tui/WalletConnectPairing.js.map +1 -1
- package/dist/tui/components/Button.js +9 -6
- package/dist/tui/components/Button.js.map +1 -1
- package/dist/tui/components/CeremonyView.js +8 -5
- package/dist/tui/components/CeremonyView.js.map +1 -1
- package/dist/tui/components/CompletionDropdown.js +9 -6
- package/dist/tui/components/CompletionDropdown.js.map +1 -1
- package/dist/tui/components/ConfirmPrompt.js +8 -5
- package/dist/tui/components/ConfirmPrompt.js.map +1 -1
- package/dist/tui/components/CustomTextInput.js +14 -11
- package/dist/tui/components/CustomTextInput.js.map +1 -1
- package/dist/tui/components/InteractiveTable.js +12 -9
- package/dist/tui/components/InteractiveTable.js.map +1 -1
- package/dist/tui/components/StepSpinner.js +13 -10
- package/dist/tui/components/StepSpinner.js.map +1 -1
- package/dist/tui/components/Toast.js +12 -8
- package/dist/tui/components/Toast.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +21 -28
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/useChat.js +19 -13
- package/dist/tui/useChat.js.map +1 -1
- package/dist/tui/useCommand.d.ts +2 -3
- package/dist/tui/useCommand.d.ts.map +1 -1
- package/dist/tui/useCommand.js +24 -100
- package/dist/tui/useCommand.js.map +1 -1
- package/dist/tui/useNotifications.js +8 -5
- package/dist/tui/useNotifications.js.map +1 -1
- package/dist/tui/useScroll.d.ts.map +1 -1
- package/dist/tui/useScroll.js +12 -15
- package/dist/tui/useScroll.js.map +1 -1
- package/dist/ui/banner.d.ts +0 -12
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +19 -35
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/colors.js +19 -13
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/format.js +14 -6
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/qr-render.js +11 -4
- package/dist/ui/qr-render.js.map +1 -1
- package/dist/ui/rpc-fallback.js +11 -6
- package/dist/ui/rpc-fallback.js.map +1 -1
- package/dist/ui/spinner.js +12 -6
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/tree.js +6 -3
- package/dist/ui/tree.js.map +1 -1
- package/dist/utils/format.js +41 -27
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/hash.js +42 -4
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/time.js +6 -2
- 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 +19 -12
- 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 +11 -6
- package/dist/walletconnect-session.js.map +1 -1
- package/dist/walletconnect.d.ts +5 -6
- package/dist/walletconnect.d.ts.map +1 -1
- package/dist/walletconnect.js +35 -32
- package/dist/walletconnect.js.map +1 -1
- package/package.json +11 -10
- package/INK6-UX-SPEC.md +0 -446
- package/MIGRATION-SPEC.md +0 -108
- package/TUI-SPEC.md +0 -214
- package/scripts/authorize-machine-key.ts +0 -43
- package/scripts/drain-wallet.ts +0 -149
- package/scripts/execute-spend-only.ts +0 -81
- package/scripts/register-agent-userop.ts +0 -186
- package/src/abis.ts +0 -187
- package/src/bundler.ts +0 -235
- package/src/client.ts +0 -36
- package/src/coinbase-smart-wallet.ts +0 -51
- package/src/commands/accept.ts +0 -64
- package/src/commands/agent-handshake.ts +0 -72
- package/src/commands/agent.ts +0 -691
- package/src/commands/agreements.ts +0 -350
- package/src/commands/arbitrator.ts +0 -180
- package/src/commands/arena-handshake.ts +0 -274
- package/src/commands/arena.ts +0 -122
- package/src/commands/backup.ts +0 -117
- package/src/commands/cancel.ts +0 -35
- package/src/commands/channel.ts +0 -218
- package/src/commands/coldstart.ts +0 -165
- package/src/commands/config.ts +0 -68
- package/src/commands/contract-interaction.ts +0 -166
- package/src/commands/daemon.ts +0 -1054
- package/src/commands/deliver.ts +0 -148
- package/src/commands/discover.ts +0 -350
- package/src/commands/dispute.ts +0 -375
- package/src/commands/doctor.ts +0 -172
- package/src/commands/endpoint.ts +0 -620
- package/src/commands/feed.ts +0 -229
- package/src/commands/hire.ts +0 -245
- package/src/commands/migrate.ts +0 -177
- package/src/commands/negotiate.ts +0 -272
- package/src/commands/openshell.ts +0 -1055
- package/src/commands/owner.ts +0 -35
- package/src/commands/policy.ts +0 -263
- package/src/commands/relay.ts +0 -277
- package/src/commands/remediate.ts +0 -24
- package/src/commands/reputation.ts +0 -79
- package/src/commands/setup.ts +0 -343
- package/src/commands/trust.ts +0 -27
- package/src/commands/verify.ts +0 -91
- package/src/commands/wallet.ts +0 -3548
- package/src/commands/watch.ts +0 -220
- package/src/commands/watchtower.ts +0 -248
- package/src/commands/workroom.ts +0 -963
- package/src/config.ts +0 -220
- package/src/daemon/config.ts +0 -344
- package/src/daemon/hire-listener.ts +0 -226
- package/src/daemon/index.ts +0 -1089
- package/src/daemon/job-lifecycle.ts +0 -215
- package/src/daemon/notify.ts +0 -297
- package/src/daemon/token-metering.ts +0 -183
- package/src/daemon/userops.ts +0 -119
- package/src/daemon/wallet-monitor.ts +0 -90
- package/src/drain-v4.ts +0 -159
- package/src/endpoint-config.ts +0 -83
- package/src/endpoint-notify.ts +0 -134
- package/src/index.ts +0 -74
- package/src/openshell-runtime.ts +0 -281
- package/src/program.ts +0 -88
- package/src/repl.ts +0 -178
- package/src/signing.ts +0 -28
- package/src/telegram-notify.ts +0 -88
- package/src/tui/App.tsx +0 -263
- package/src/tui/Footer.tsx +0 -18
- package/src/tui/Header.tsx +0 -45
- package/src/tui/InputLine.tsx +0 -243
- package/src/tui/Viewport.tsx +0 -51
- package/src/tui/WalletConnectPairing.tsx +0 -114
- package/src/tui/components/Button.tsx +0 -38
- package/src/tui/components/CeremonyView.tsx +0 -39
- package/src/tui/components/CompletionDropdown.tsx +0 -56
- package/src/tui/components/ConfirmPrompt.tsx +0 -36
- package/src/tui/components/CustomTextInput.tsx +0 -132
- package/src/tui/components/InteractiveTable.tsx +0 -106
- package/src/tui/components/StepSpinner.tsx +0 -84
- package/src/tui/components/Toast.tsx +0 -59
- package/src/tui/index.tsx +0 -90
- package/src/tui/useChat.ts +0 -103
- package/src/tui/useCommand.ts +0 -238
- package/src/tui/useNotifications.ts +0 -28
- package/src/tui/useScroll.ts +0 -69
- package/src/ui/banner.ts +0 -78
- package/src/ui/colors.ts +0 -30
- package/src/ui/format.ts +0 -78
- package/src/ui/qr-render.ts +0 -92
- package/src/ui/rpc-fallback.ts +0 -59
- package/src/ui/spinner.ts +0 -56
- package/src/ui/tree.ts +0 -16
- package/src/utils/format.ts +0 -48
- package/src/utils/hash.ts +0 -5
- package/src/utils/time.ts +0 -15
- package/src/wallet-router.ts +0 -178
- package/src/walletconnect-session.ts +0 -27
- package/src/walletconnect.ts +0 -309
- package/test/time.test.js +0 -11
- package/tsconfig.json +0 -33
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerContractInteractionCommands = registerContractInteractionCommands;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const client_1 = require("../client");
|
|
7
|
+
const sdk_1 = require("@arc402/sdk");
|
|
8
|
+
function registerContractInteractionCommands(program) {
|
|
6
9
|
const contract = program.command("contract").description("Direct contract interaction via ARC402Wallet");
|
|
7
10
|
contract
|
|
8
11
|
.command("call <target> <method> [args...]")
|
|
@@ -10,15 +13,15 @@ export function registerContractInteractionCommands(program) {
|
|
|
10
13
|
.option("--abi <json>", "ABI fragment array as JSON string, e.g. '[\"function swap(...)\"]'")
|
|
11
14
|
.option("--value <wei>", "ETH value to send with the call (in wei)", "0")
|
|
12
15
|
.option("--min-return <value>", "Minimum return value for slippage guard", "0")
|
|
13
|
-
.option("--approval-token <address>", "ERC-20 token to approve before call", ethers.ZeroAddress)
|
|
16
|
+
.option("--approval-token <address>", "ERC-20 token to approve before call", ethers_1.ethers.ZeroAddress)
|
|
14
17
|
.option("--approval-amount <value>", "Max ERC-20 approval for this call (in token units)", "0")
|
|
15
18
|
.option("--with-agreement <id>", "Execute under ServiceAgreement escrow (requires walletContractAddress in config)")
|
|
16
19
|
.option("--attest", "Create intent attestation before executing (requires intentAttestationAddress in config)")
|
|
17
20
|
.option("--dry-run", "Build and print the encoded payload without executing")
|
|
18
21
|
.option("--json", "Output as JSON")
|
|
19
22
|
.action(async (target, method, rawArgs, opts) => {
|
|
20
|
-
const config = loadConfig();
|
|
21
|
-
const { signer, address } = await requireSigner(config);
|
|
23
|
+
const config = (0, config_1.loadConfig)();
|
|
24
|
+
const { signer, address } = await (0, client_1.requireSigner)(config);
|
|
22
25
|
// Parse ABI — accept a JSON array of ABI fragments, or construct a minimal one
|
|
23
26
|
let abi;
|
|
24
27
|
if (opts.abi) {
|
|
@@ -49,7 +52,7 @@ export function registerContractInteractionCommands(program) {
|
|
|
49
52
|
console.error("intentAttestationAddress missing in config");
|
|
50
53
|
process.exit(1);
|
|
51
54
|
}
|
|
52
|
-
const client = new ContractInteractionClient(intentAttestationAddress, signer, address);
|
|
55
|
+
const client = new sdk_1.ContractInteractionClient(intentAttestationAddress, signer, address);
|
|
53
56
|
let payload;
|
|
54
57
|
try {
|
|
55
58
|
payload = client.buildContractCall(target, abi, method, parsedArgs, {
|
|
@@ -137,14 +140,14 @@ export function registerContractInteractionCommands(program) {
|
|
|
137
140
|
.option("--expected <hex>", "Expected return data (hex) to verify against")
|
|
138
141
|
.option("--json")
|
|
139
142
|
.action(async (txHash, opts) => {
|
|
140
|
-
const config = loadConfig();
|
|
141
|
-
const { signer, address } = await requireSigner(config);
|
|
143
|
+
const config = (0, config_1.loadConfig)();
|
|
144
|
+
const { signer, address } = await (0, client_1.requireSigner)(config);
|
|
142
145
|
const intentAttestationAddress = config.intentAttestationAddress;
|
|
143
146
|
if (!intentAttestationAddress) {
|
|
144
147
|
console.error("intentAttestationAddress missing in config");
|
|
145
148
|
process.exit(1);
|
|
146
149
|
}
|
|
147
|
-
const client = new ContractInteractionClient(intentAttestationAddress, signer, address);
|
|
150
|
+
const client = new sdk_1.ContractInteractionClient(intentAttestationAddress, signer, address);
|
|
148
151
|
const result = await client.verifyContractCallResult(txHash, opts.expected);
|
|
149
152
|
if (opts.json) {
|
|
150
153
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-interaction.js","sourceRoot":"","sources":["../../src/commands/contract-interaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract-interaction.js","sourceRoot":"","sources":["../../src/commands/contract-interaction.ts"],"names":[],"mappings":";;AAMA,kFA+JC;AApKD,mCAAgC;AAChC,sCAAuC;AACvC,sCAA0C;AAC1C,qCAAuE;AAEvE,SAAgB,mCAAmC,CAAC,OAAgB;IAClE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;IAEzG,QAAQ;SACL,OAAO,CAAC,kCAAkC,CAAC;SAC3C,WAAW,CAAC,kEAAkE,CAAC;SAC/E,MAAM,CAAC,cAAc,EAAE,oEAAoE,CAAC;SAC5F,MAAM,CAAC,eAAe,EAAE,0CAA0C,EAAE,GAAG,CAAC;SACxE,MAAM,CAAC,sBAAsB,EAAE,yCAAyC,EAAE,GAAG,CAAC;SAC9E,MAAM,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M,GAAG,IAAI,+BAAyB,CAAC,wBAAwB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACxF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5E,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9C,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YACxF,IAAI,MAAM,CAAC,UAAU;gBAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuepC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmjB7D"}
|
package/dist/commands/daemon.js
CHANGED
|
@@ -1,22 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.registerDaemonCommands = registerDaemonCommands;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const net = __importStar(require("net"));
|
|
43
|
+
const os = __importStar(require("os"));
|
|
44
|
+
const child_process_1 = require("child_process");
|
|
45
|
+
const ethers_1 = require("ethers");
|
|
46
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
47
|
+
const config_1 = require("../config");
|
|
48
|
+
const client_1 = require("../client");
|
|
49
|
+
const spinner_1 = require("../ui/spinner");
|
|
50
|
+
const tree_1 = require("../ui/tree");
|
|
51
|
+
const colors_1 = require("../ui/colors");
|
|
52
|
+
const abis_1 = require("../abis");
|
|
53
|
+
const config_2 = require("../daemon/config");
|
|
54
|
+
const notify_1 = require("../daemon/notify");
|
|
55
|
+
const openshell_runtime_1 = require("../openshell-runtime");
|
|
20
56
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
21
57
|
const CHANNEL_STATES_DIR = path.join(os.homedir(), ".arc402", "channel-states");
|
|
22
58
|
// ─── Harness registry ─────────────────────────────────────────────────────────
|
|
@@ -46,7 +82,7 @@ function loadLocalState(channelId) {
|
|
|
46
82
|
* ABI-encode a ChannelState for submission to challengeChannel().
|
|
47
83
|
*/
|
|
48
84
|
function encodeChannelState(state) {
|
|
49
|
-
return ethers.AbiCoder.defaultAbiCoder().encode(["tuple(bytes32,uint256,uint256,uint256,address,uint256,bytes,bytes)"], [[
|
|
85
|
+
return ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["tuple(bytes32,uint256,uint256,uint256,address,uint256,bytes,bytes)"], [[
|
|
50
86
|
state.channelId,
|
|
51
87
|
BigInt(state.sequenceNumber),
|
|
52
88
|
BigInt(state.callCount),
|
|
@@ -136,12 +172,12 @@ async function runChannelWatchLoop(opts) {
|
|
|
136
172
|
process.stdin.resume();
|
|
137
173
|
}
|
|
138
174
|
function sendIpcCommand(cmd) {
|
|
139
|
-
if (!fs.existsSync(DAEMON_SOCK)) {
|
|
175
|
+
if (!fs.existsSync(config_2.DAEMON_SOCK)) {
|
|
140
176
|
console.error("Daemon is not running. Launch path: run `arc402 openshell init` first, then `arc402 daemon start`.");
|
|
141
177
|
process.exit(1);
|
|
142
178
|
}
|
|
143
179
|
return new Promise((resolve, reject) => {
|
|
144
|
-
const socket = net.createConnection(DAEMON_SOCK, () => {
|
|
180
|
+
const socket = net.createConnection(config_2.DAEMON_SOCK, () => {
|
|
145
181
|
socket.write(JSON.stringify(cmd) + "\n");
|
|
146
182
|
});
|
|
147
183
|
let buf = "";
|
|
@@ -180,9 +216,9 @@ function sendIpcCommand(cmd) {
|
|
|
180
216
|
}
|
|
181
217
|
// ─── PID helpers ─────────────────────────────────────────────────────────────
|
|
182
218
|
function readPid() {
|
|
183
|
-
if (!fs.existsSync(DAEMON_PID))
|
|
219
|
+
if (!fs.existsSync(config_2.DAEMON_PID))
|
|
184
220
|
return null;
|
|
185
|
-
const raw = fs.readFileSync(DAEMON_PID, "utf-8").trim();
|
|
221
|
+
const raw = fs.readFileSync(config_2.DAEMON_PID, "utf-8").trim();
|
|
186
222
|
const pid = parseInt(raw, 10);
|
|
187
223
|
return isNaN(pid) ? null : pid;
|
|
188
224
|
}
|
|
@@ -201,14 +237,14 @@ const REMOTE_DAEMON_PID = path.posix.join(REMOTE_ARC402_DIR, "daemon.pid");
|
|
|
201
237
|
const REMOTE_DAEMON_LOG = path.posix.join(REMOTE_ARC402_DIR, "daemon.log");
|
|
202
238
|
const REMOTE_DAEMON_TOML = path.posix.join(REMOTE_ARC402_DIR, "daemon.toml");
|
|
203
239
|
function syncDaemonConfigToSandbox(sandboxName) {
|
|
204
|
-
if (!fs.existsSync(DAEMON_TOML)) {
|
|
240
|
+
if (!fs.existsSync(config_2.DAEMON_TOML)) {
|
|
205
241
|
throw new Error("daemon.toml not found. Run `arc402 daemon init` first.");
|
|
206
242
|
}
|
|
207
|
-
provisionFileToSandbox(sandboxName, DAEMON_TOML, REMOTE_DAEMON_TOML);
|
|
243
|
+
(0, openshell_runtime_1.provisionFileToSandbox)(sandboxName, config_2.DAEMON_TOML, REMOTE_DAEMON_TOML);
|
|
208
244
|
}
|
|
209
245
|
async function readRemotePid(sandboxName) {
|
|
210
|
-
const { configPath, host } = buildOpenShellSshConfig(sandboxName);
|
|
211
|
-
const pidRead = runCmd("ssh", [
|
|
246
|
+
const { configPath, host } = (0, openshell_runtime_1.buildOpenShellSshConfig)(sandboxName);
|
|
247
|
+
const pidRead = (0, openshell_runtime_1.runCmd)("ssh", [
|
|
212
248
|
"-F", configPath,
|
|
213
249
|
host,
|
|
214
250
|
`test -f ${REMOTE_DAEMON_PID} && cat ${REMOTE_DAEMON_PID}`,
|
|
@@ -232,17 +268,17 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
232
268
|
let child;
|
|
233
269
|
if (sandboxName) {
|
|
234
270
|
syncDaemonConfigToSandbox(sandboxName);
|
|
235
|
-
const { configPath, host } = buildOpenShellSshConfig(sandboxName);
|
|
236
|
-
const remoteRoot = runtimeRemoteRoot ?? DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
271
|
+
const { configPath, host } = (0, openshell_runtime_1.buildOpenShellSshConfig)(sandboxName);
|
|
272
|
+
const remoteRoot = runtimeRemoteRoot ?? openshell_runtime_1.DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
237
273
|
const remoteDaemonEntry = path.posix.join(remoteRoot, "dist/daemon/index.js");
|
|
238
|
-
const secretExports = buildOpenShellSecretExports(true);
|
|
274
|
+
const secretExports = (0, openshell_runtime_1.buildOpenShellSecretExports)(true);
|
|
239
275
|
const remoteCommand = [
|
|
240
276
|
`mkdir -p ${REMOTE_ARC402_DIR}`,
|
|
241
277
|
`rm -f ${REMOTE_DAEMON_PID}`,
|
|
242
278
|
secretExports,
|
|
243
279
|
`nohup env HOME=/sandbox ARC402_DAEMON_PROCESS=1 node ${remoteDaemonEntry} > /tmp/arc402-daemon-stdout.log 2> /tmp/arc402-daemon-stderr.log < /dev/null &`,
|
|
244
280
|
].filter(Boolean).join(" && ");
|
|
245
|
-
child = spawn("ssh", [
|
|
281
|
+
child = (0, child_process_1.spawn)("ssh", [
|
|
246
282
|
"-F", configPath,
|
|
247
283
|
host,
|
|
248
284
|
remoteCommand,
|
|
@@ -258,7 +294,7 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
258
294
|
let telegramBotToken;
|
|
259
295
|
let telegramChatId;
|
|
260
296
|
try {
|
|
261
|
-
const config = loadConfig();
|
|
297
|
+
const config = (0, config_1.loadConfig)();
|
|
262
298
|
machineKey = config.privateKey;
|
|
263
299
|
telegramBotToken = config.telegramBotToken;
|
|
264
300
|
telegramChatId = config.telegramChatId;
|
|
@@ -272,7 +308,7 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
272
308
|
childEnv["TELEGRAM_BOT_TOKEN"] = telegramBotToken;
|
|
273
309
|
if (telegramChatId)
|
|
274
310
|
childEnv["TELEGRAM_CHAT_ID"] = telegramChatId;
|
|
275
|
-
child = spawn(process.execPath, [daemonEntry], {
|
|
311
|
+
child = (0, child_process_1.spawn)(process.execPath, [daemonEntry], {
|
|
276
312
|
detached: true,
|
|
277
313
|
stdio: "ignore",
|
|
278
314
|
env: childEnv,
|
|
@@ -286,8 +322,8 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
286
322
|
if (sandboxName) {
|
|
287
323
|
const remotePid = await readRemotePid(sandboxName);
|
|
288
324
|
if (remotePid) {
|
|
289
|
-
console.log(` ${c.success} ARC-402 daemon started (OpenShell)`);
|
|
290
|
-
renderTree([
|
|
325
|
+
console.log(` ${colors_1.c.success} ARC-402 daemon started (OpenShell)`);
|
|
326
|
+
(0, tree_1.renderTree)([
|
|
291
327
|
{ label: "PID", value: String(remotePid) },
|
|
292
328
|
{ label: "Log", value: REMOTE_DAEMON_LOG, last: true },
|
|
293
329
|
]);
|
|
@@ -297,10 +333,10 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
297
333
|
else {
|
|
298
334
|
const pid = readPid();
|
|
299
335
|
if (pid && isProcessAlive(pid)) {
|
|
300
|
-
console.log(` ${c.success} ARC-402 daemon started`);
|
|
301
|
-
renderTree([
|
|
336
|
+
console.log(` ${colors_1.c.success} ARC-402 daemon started`);
|
|
337
|
+
(0, tree_1.renderTree)([
|
|
302
338
|
{ label: "PID", value: String(pid) },
|
|
303
|
-
{ label: "Log", value: DAEMON_LOG, last: true },
|
|
339
|
+
{ label: "Log", value: config_2.DAEMON_LOG, last: true },
|
|
304
340
|
]);
|
|
305
341
|
return;
|
|
306
342
|
}
|
|
@@ -312,7 +348,7 @@ async function startDaemonBackground(sandboxName, runtimeRemoteRoot) {
|
|
|
312
348
|
console.error(`Expected remote log: ${REMOTE_DAEMON_LOG}`);
|
|
313
349
|
}
|
|
314
350
|
else {
|
|
315
|
-
console.error(`Check logs: ${DAEMON_LOG}`);
|
|
351
|
+
console.error(`Check logs: ${config_2.DAEMON_LOG}`);
|
|
316
352
|
}
|
|
317
353
|
process.exit(1);
|
|
318
354
|
}
|
|
@@ -323,7 +359,7 @@ async function stopDaemon(opts = {}) {
|
|
|
323
359
|
}
|
|
324
360
|
if (!isProcessAlive(pid)) {
|
|
325
361
|
// Stale PID file
|
|
326
|
-
fs.unlinkSync(DAEMON_PID);
|
|
362
|
+
fs.unlinkSync(config_2.DAEMON_PID);
|
|
327
363
|
return false;
|
|
328
364
|
}
|
|
329
365
|
try {
|
|
@@ -340,8 +376,8 @@ async function stopDaemon(opts = {}) {
|
|
|
340
376
|
await new Promise((r) => setTimeout(r, 200));
|
|
341
377
|
if (!isProcessAlive(pid)) {
|
|
342
378
|
// Clean up stale PID file if daemon didn't remove it
|
|
343
|
-
if (fs.existsSync(DAEMON_PID))
|
|
344
|
-
fs.unlinkSync(DAEMON_PID);
|
|
379
|
+
if (fs.existsSync(config_2.DAEMON_PID))
|
|
380
|
+
fs.unlinkSync(config_2.DAEMON_PID);
|
|
345
381
|
return true;
|
|
346
382
|
}
|
|
347
383
|
}
|
|
@@ -358,9 +394,9 @@ function formatStatus(data) {
|
|
|
358
394
|
const watchtowerStatus = data.watchtower_enabled ? "active" : "disabled";
|
|
359
395
|
const bundlerStatus = `${data.bundler_mode} — ${data.bundler_endpoint || "default"}`;
|
|
360
396
|
const pending = Number(data.pending_approval ?? 0);
|
|
361
|
-
console.log(`${c.mark} ARC-402 Daemon Status`);
|
|
397
|
+
console.log(`${colors_1.c.mark} ARC-402 Daemon Status`);
|
|
362
398
|
console.log();
|
|
363
|
-
renderTree([
|
|
399
|
+
(0, tree_1.renderTree)([
|
|
364
400
|
{ label: "State", value: String(data.state ?? "unknown") },
|
|
365
401
|
{ label: "PID", value: String(data.pid ?? "unknown") },
|
|
366
402
|
{ label: "Uptime", value: String(data.uptime ?? "unknown") },
|
|
@@ -404,7 +440,7 @@ function formatHireTable(rows) {
|
|
|
404
440
|
}
|
|
405
441
|
}
|
|
406
442
|
// ─── Command registration ─────────────────────────────────────────────────────
|
|
407
|
-
|
|
443
|
+
function registerDaemonCommands(program) {
|
|
408
444
|
const daemon = program
|
|
409
445
|
.command("daemon")
|
|
410
446
|
.description("ARC-402 daemon management and hire request workflow (Spec 32)");
|
|
@@ -417,22 +453,22 @@ export function registerDaemonCommands(program) {
|
|
|
417
453
|
.action(async (opts) => {
|
|
418
454
|
const foreground = opts.foreground;
|
|
419
455
|
const forceHost = opts.host;
|
|
420
|
-
if (!fs.existsSync(DAEMON_TOML)) {
|
|
456
|
+
if (!fs.existsSync(config_2.DAEMON_TOML)) {
|
|
421
457
|
console.error("daemon.toml not found.");
|
|
422
458
|
console.error("Run `arc402 daemon init` first so the OpenShell-owned runtime has a wallet, relay, and harness configuration to boot.");
|
|
423
459
|
process.exit(1);
|
|
424
460
|
}
|
|
425
|
-
const openShellCfg = forceHost ? undefined : readOpenShellConfig();
|
|
461
|
+
const openShellCfg = forceHost ? undefined : (0, openshell_runtime_1.readOpenShellConfig)();
|
|
426
462
|
const sandboxName = openShellCfg?.sandbox.name;
|
|
427
463
|
if (forceHost) {
|
|
428
464
|
console.log("Running in host mode (--host). Sandbox bypassed.");
|
|
429
465
|
}
|
|
430
|
-
let runtimeRemoteRoot = openShellCfg?.runtime?.remote_root ?? DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
466
|
+
let runtimeRemoteRoot = openShellCfg?.runtime?.remote_root ?? openshell_runtime_1.DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
431
467
|
if (sandboxName) {
|
|
432
468
|
try {
|
|
433
|
-
const provisioned = provisionRuntimeToSandbox(sandboxName, runtimeRemoteRoot);
|
|
469
|
+
const provisioned = (0, openshell_runtime_1.provisionRuntimeToSandbox)(sandboxName, runtimeRemoteRoot);
|
|
434
470
|
runtimeRemoteRoot = provisioned.remoteRoot;
|
|
435
|
-
writeOpenShellConfig({
|
|
471
|
+
(0, openshell_runtime_1.writeOpenShellConfig)({
|
|
436
472
|
sandbox: openShellCfg?.sandbox ?? { name: sandboxName },
|
|
437
473
|
runtime: {
|
|
438
474
|
local_tarball: provisioned.tarballPath,
|
|
@@ -450,9 +486,9 @@ export function registerDaemonCommands(program) {
|
|
|
450
486
|
if (sandboxName) {
|
|
451
487
|
syncDaemonConfigToSandbox(sandboxName);
|
|
452
488
|
const remoteDaemonEntry = path.posix.join(runtimeRemoteRoot, "dist/daemon/index.js");
|
|
453
|
-
const { configPath, host } = buildOpenShellSshConfig(sandboxName);
|
|
454
|
-
const secretExports = buildOpenShellSecretExports(true);
|
|
455
|
-
const result = spawnSync("ssh", [
|
|
489
|
+
const { configPath, host } = (0, openshell_runtime_1.buildOpenShellSshConfig)(sandboxName);
|
|
490
|
+
const secretExports = (0, openshell_runtime_1.buildOpenShellSecretExports)(true);
|
|
491
|
+
const result = (0, child_process_1.spawnSync)("ssh", [
|
|
456
492
|
"-F", configPath,
|
|
457
493
|
host,
|
|
458
494
|
[
|
|
@@ -472,7 +508,8 @@ export function registerDaemonCommands(program) {
|
|
|
472
508
|
}
|
|
473
509
|
else {
|
|
474
510
|
// Foreground mode without sandbox: import and run directly (blocking)
|
|
475
|
-
|
|
511
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
512
|
+
const { runDaemon } = require("../daemon/index");
|
|
476
513
|
await runDaemon(true);
|
|
477
514
|
}
|
|
478
515
|
return;
|
|
@@ -484,8 +521,8 @@ export function registerDaemonCommands(program) {
|
|
|
484
521
|
process.exit(0);
|
|
485
522
|
}
|
|
486
523
|
// Remove stale PID file if present
|
|
487
|
-
if (fs.existsSync(DAEMON_PID))
|
|
488
|
-
fs.unlinkSync(DAEMON_PID);
|
|
524
|
+
if (fs.existsSync(config_2.DAEMON_PID))
|
|
525
|
+
fs.unlinkSync(config_2.DAEMON_PID);
|
|
489
526
|
if (sandboxName) {
|
|
490
527
|
console.log(`Starting ARC-402 daemon inside OpenShell sandbox: ${sandboxName}`);
|
|
491
528
|
console.log(`Using provisioned runtime: ${runtimeRemoteRoot}`);
|
|
@@ -497,16 +534,16 @@ export function registerDaemonCommands(program) {
|
|
|
497
534
|
.command("stop")
|
|
498
535
|
.description("Gracefully stop the running daemon (SIGTERM + wait for exit).")
|
|
499
536
|
.action(async () => {
|
|
500
|
-
const openShellCfg = readOpenShellConfig();
|
|
537
|
+
const openShellCfg = (0, openshell_runtime_1.readOpenShellConfig)();
|
|
501
538
|
if (openShellCfg?.sandbox.name) {
|
|
502
539
|
const remotePid = await readRemotePid(openShellCfg.sandbox.name);
|
|
503
540
|
if (!remotePid) {
|
|
504
541
|
console.log("Daemon is not running.");
|
|
505
542
|
process.exit(0);
|
|
506
543
|
}
|
|
507
|
-
const { configPath, host } = buildOpenShellSshConfig(openShellCfg.sandbox.name);
|
|
508
|
-
const stopSpinnerRemote = startSpinner(`Stopping daemon (OpenShell PID ${remotePid})...`);
|
|
509
|
-
runCmd("ssh", ["-F", configPath, host, `kill ${remotePid}`], { timeout: 20000 });
|
|
544
|
+
const { configPath, host } = (0, openshell_runtime_1.buildOpenShellSshConfig)(openShellCfg.sandbox.name);
|
|
545
|
+
const stopSpinnerRemote = (0, spinner_1.startSpinner)(`Stopping daemon (OpenShell PID ${remotePid})...`);
|
|
546
|
+
(0, openshell_runtime_1.runCmd)("ssh", ["-F", configPath, host, `kill ${remotePid}`], { timeout: 20000 });
|
|
510
547
|
stopSpinnerRemote.succeed("Stop signal sent");
|
|
511
548
|
return;
|
|
512
549
|
}
|
|
@@ -515,7 +552,7 @@ export function registerDaemonCommands(program) {
|
|
|
515
552
|
console.log("Daemon is not running.");
|
|
516
553
|
process.exit(0);
|
|
517
554
|
}
|
|
518
|
-
const stopSpinner = startSpinner(`Stopping daemon (PID ${pid})...`);
|
|
555
|
+
const stopSpinner = (0, spinner_1.startSpinner)(`Stopping daemon (PID ${pid})...`);
|
|
519
556
|
const stopped = await stopDaemon({ wait: true });
|
|
520
557
|
if (stopped) {
|
|
521
558
|
stopSpinner.succeed("Daemon stopped");
|
|
@@ -543,15 +580,15 @@ export function registerDaemonCommands(program) {
|
|
|
543
580
|
}
|
|
544
581
|
else {
|
|
545
582
|
console.log("Daemon was not running.");
|
|
546
|
-
if (fs.existsSync(DAEMON_PID))
|
|
547
|
-
fs.unlinkSync(DAEMON_PID);
|
|
583
|
+
if (fs.existsSync(config_2.DAEMON_PID))
|
|
584
|
+
fs.unlinkSync(config_2.DAEMON_PID);
|
|
548
585
|
}
|
|
549
|
-
const openShellCfg = readOpenShellConfig();
|
|
550
|
-
let runtimeRemoteRoot = openShellCfg?.runtime?.remote_root ?? DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
586
|
+
const openShellCfg = (0, openshell_runtime_1.readOpenShellConfig)();
|
|
587
|
+
let runtimeRemoteRoot = openShellCfg?.runtime?.remote_root ?? openshell_runtime_1.DEFAULT_RUNTIME_REMOTE_ROOT;
|
|
551
588
|
if (openShellCfg?.sandbox.name) {
|
|
552
|
-
const provisioned = provisionRuntimeToSandbox(openShellCfg.sandbox.name, runtimeRemoteRoot);
|
|
589
|
+
const provisioned = (0, openshell_runtime_1.provisionRuntimeToSandbox)(openShellCfg.sandbox.name, runtimeRemoteRoot);
|
|
553
590
|
runtimeRemoteRoot = provisioned.remoteRoot;
|
|
554
|
-
writeOpenShellConfig({
|
|
591
|
+
(0, openshell_runtime_1.writeOpenShellConfig)({
|
|
555
592
|
sandbox: openShellCfg.sandbox,
|
|
556
593
|
runtime: {
|
|
557
594
|
local_tarball: provisioned.tarballPath,
|
|
@@ -567,7 +604,7 @@ export function registerDaemonCommands(program) {
|
|
|
567
604
|
.command("status")
|
|
568
605
|
.description("Show current daemon status via IPC.")
|
|
569
606
|
.action(async () => {
|
|
570
|
-
const openShellCfg = readOpenShellConfig();
|
|
607
|
+
const openShellCfg = (0, openshell_runtime_1.readOpenShellConfig)();
|
|
571
608
|
if (openShellCfg?.sandbox.name) {
|
|
572
609
|
const remotePid = await readRemotePid(openShellCfg.sandbox.name);
|
|
573
610
|
if (!remotePid) {
|
|
@@ -575,13 +612,13 @@ export function registerDaemonCommands(program) {
|
|
|
575
612
|
console.log("Launch path: arc402 openshell init, then arc402 daemon start");
|
|
576
613
|
process.exit(1);
|
|
577
614
|
}
|
|
578
|
-
console.log(`${c.mark} ARC-402 Daemon Status`);
|
|
615
|
+
console.log(`${colors_1.c.mark} ARC-402 Daemon Status`);
|
|
579
616
|
console.log();
|
|
580
|
-
renderTree([
|
|
617
|
+
(0, tree_1.renderTree)([
|
|
581
618
|
{ label: "State", value: "running (OpenShell sandbox)" },
|
|
582
619
|
{ label: "PID", value: String(remotePid) },
|
|
583
620
|
{ label: "Sandbox", value: openShellCfg.sandbox.name },
|
|
584
|
-
{ label: "Runtime", value: openShellCfg.runtime?.remote_root ?? DEFAULT_RUNTIME_REMOTE_ROOT },
|
|
621
|
+
{ label: "Runtime", value: openShellCfg.runtime?.remote_root ?? openshell_runtime_1.DEFAULT_RUNTIME_REMOTE_ROOT },
|
|
585
622
|
{ label: "Log", value: REMOTE_DAEMON_LOG, last: true },
|
|
586
623
|
]);
|
|
587
624
|
return;
|
|
@@ -609,13 +646,13 @@ export function registerDaemonCommands(program) {
|
|
|
609
646
|
.action((opts) => {
|
|
610
647
|
const follow = opts.follow;
|
|
611
648
|
const lines = parseInt(opts.lines, 10) || 50;
|
|
612
|
-
const openShellCfg = readOpenShellConfig();
|
|
649
|
+
const openShellCfg = (0, openshell_runtime_1.readOpenShellConfig)();
|
|
613
650
|
if (openShellCfg?.sandbox.name) {
|
|
614
|
-
const { configPath, host } = buildOpenShellSshConfig(openShellCfg.sandbox.name);
|
|
651
|
+
const { configPath, host } = (0, openshell_runtime_1.buildOpenShellSshConfig)(openShellCfg.sandbox.name);
|
|
615
652
|
const baseCmd = follow
|
|
616
653
|
? `test -f ${REMOTE_DAEMON_LOG} && tail -f -n ${lines} ${REMOTE_DAEMON_LOG}`
|
|
617
654
|
: `test -f ${REMOTE_DAEMON_LOG} && tail -n ${lines} ${REMOTE_DAEMON_LOG}`;
|
|
618
|
-
const result = spawn("ssh", ["-F", configPath, host, baseCmd], { stdio: "inherit" });
|
|
655
|
+
const result = (0, child_process_1.spawn)("ssh", ["-F", configPath, host, baseCmd], { stdio: "inherit" });
|
|
619
656
|
result.on("error", (err) => {
|
|
620
657
|
console.error(`Failed to read remote log: ${err.message}`);
|
|
621
658
|
process.exit(1);
|
|
@@ -628,14 +665,14 @@ export function registerDaemonCommands(program) {
|
|
|
628
665
|
}
|
|
629
666
|
return;
|
|
630
667
|
}
|
|
631
|
-
if (!fs.existsSync(DAEMON_LOG)) {
|
|
632
|
-
console.log(`Log file not found: ${DAEMON_LOG}`);
|
|
668
|
+
if (!fs.existsSync(config_2.DAEMON_LOG)) {
|
|
669
|
+
console.log(`Log file not found: ${config_2.DAEMON_LOG}`);
|
|
633
670
|
console.log("Has the OpenShell-owned runtime been started? Run `arc402 openshell init` first if needed, then `arc402 daemon start`.");
|
|
634
671
|
process.exit(0);
|
|
635
672
|
}
|
|
636
673
|
if (follow) {
|
|
637
674
|
// Stream with tail -f equivalent using spawn
|
|
638
|
-
const tail = spawn("tail", ["-f", "-n", String(lines), DAEMON_LOG], {
|
|
675
|
+
const tail = (0, child_process_1.spawn)("tail", ["-f", "-n", String(lines), config_2.DAEMON_LOG], {
|
|
639
676
|
stdio: "inherit",
|
|
640
677
|
});
|
|
641
678
|
tail.on("error", (err) => {
|
|
@@ -649,7 +686,7 @@ export function registerDaemonCommands(program) {
|
|
|
649
686
|
}
|
|
650
687
|
else {
|
|
651
688
|
// Read last N lines
|
|
652
|
-
const content = fs.readFileSync(DAEMON_LOG, "utf-8");
|
|
689
|
+
const content = fs.readFileSync(config_2.DAEMON_LOG, "utf-8");
|
|
653
690
|
const allLines = content.split("\n").filter((l) => l.trim());
|
|
654
691
|
const slice = allLines.slice(-lines);
|
|
655
692
|
for (const line of slice) {
|
|
@@ -758,8 +795,8 @@ export function registerDaemonCommands(program) {
|
|
|
758
795
|
.action(async (opts) => {
|
|
759
796
|
const force = opts.force;
|
|
760
797
|
const reconfigureHarness = opts.reconfigureHarness;
|
|
761
|
-
if (fs.existsSync(DAEMON_TOML) && !force && !reconfigureHarness) {
|
|
762
|
-
console.log(`daemon.toml already exists at ${DAEMON_TOML}`);
|
|
798
|
+
if (fs.existsSync(config_2.DAEMON_TOML) && !force && !reconfigureHarness) {
|
|
799
|
+
console.log(`daemon.toml already exists at ${config_2.DAEMON_TOML}`);
|
|
763
800
|
console.log("Use --force to overwrite, or --reconfigure-harness to update the harness only.");
|
|
764
801
|
process.exit(0);
|
|
765
802
|
}
|
|
@@ -772,7 +809,7 @@ export function registerDaemonCommands(program) {
|
|
|
772
809
|
console.log(" 4. opencode (OpenCode)");
|
|
773
810
|
console.log(" 5. custom (enter your own exec_command)");
|
|
774
811
|
console.log();
|
|
775
|
-
const harnessResponse = await
|
|
812
|
+
const harnessResponse = await (0, prompts_1.default)({
|
|
776
813
|
type: "select",
|
|
777
814
|
name: "harness",
|
|
778
815
|
message: "Select harness",
|
|
@@ -788,7 +825,7 @@ export function registerDaemonCommands(program) {
|
|
|
788
825
|
const selectedHarness = harnessResponse.harness ?? "openclaw";
|
|
789
826
|
let execCommand = HARNESS_REGISTRY[selectedHarness] ?? "";
|
|
790
827
|
if (selectedHarness === "custom") {
|
|
791
|
-
const customResponse = await
|
|
828
|
+
const customResponse = await (0, prompts_1.default)({
|
|
792
829
|
type: "text",
|
|
793
830
|
name: "exec_command",
|
|
794
831
|
message: "Enter your exec_command (use {task} as placeholder)",
|
|
@@ -808,23 +845,23 @@ export function registerDaemonCommands(program) {
|
|
|
808
845
|
: [`# To change harness later: arc402 daemon init --reconfigure-harness`]),
|
|
809
846
|
"",
|
|
810
847
|
].join("\n");
|
|
811
|
-
if (reconfigureHarness && fs.existsSync(DAEMON_TOML)) {
|
|
812
|
-
let existing = fs.readFileSync(DAEMON_TOML, "utf-8");
|
|
848
|
+
if (reconfigureHarness && fs.existsSync(config_2.DAEMON_TOML)) {
|
|
849
|
+
let existing = fs.readFileSync(config_2.DAEMON_TOML, "utf-8");
|
|
813
850
|
if (!/^\[work\]/m.test(existing)) {
|
|
814
851
|
console.error("[work] section not found in daemon.toml. Run: arc402 daemon init --force");
|
|
815
852
|
process.exit(1);
|
|
816
853
|
}
|
|
817
854
|
existing = existing.replace(/\[work\][\s\S]*$/, workSection);
|
|
818
|
-
fs.writeFileSync(DAEMON_TOML, existing, { mode: 0o600 });
|
|
855
|
+
fs.writeFileSync(config_2.DAEMON_TOML, existing, { mode: 0o600 });
|
|
819
856
|
console.log(`\nHarness updated: ${selectedHarness}`);
|
|
820
857
|
console.log(`exec_command: ${execCommand}`);
|
|
821
858
|
return;
|
|
822
859
|
}
|
|
823
860
|
// ── Write full daemon.toml ────────────────────────────────────────────────
|
|
824
|
-
const toml = TEMPLATE_DAEMON_TOML.replace(/\[work\][\s\S]*$/, workSection);
|
|
825
|
-
fs.mkdirSync(DAEMON_DIR, { recursive: true, mode: 0o700 });
|
|
826
|
-
fs.writeFileSync(DAEMON_TOML, toml, { mode: 0o600 });
|
|
827
|
-
console.log(`\nCreated ${DAEMON_TOML}`);
|
|
861
|
+
const toml = config_2.TEMPLATE_DAEMON_TOML.replace(/\[work\][\s\S]*$/, workSection);
|
|
862
|
+
fs.mkdirSync(config_2.DAEMON_DIR, { recursive: true, mode: 0o700 });
|
|
863
|
+
fs.writeFileSync(config_2.DAEMON_TOML, toml, { mode: 0o600 });
|
|
864
|
+
console.log(`\nCreated ${config_2.DAEMON_TOML}`);
|
|
828
865
|
console.log(`Harness: ${selectedHarness}${selectedHarness !== "custom" ? ` (${execCommand})` : ""}`);
|
|
829
866
|
console.log();
|
|
830
867
|
console.log("Next steps:");
|
|
@@ -842,11 +879,11 @@ export function registerDaemonCommands(program) {
|
|
|
842
879
|
.command("show")
|
|
843
880
|
.description("Show all configured notification channels")
|
|
844
881
|
.action(() => {
|
|
845
|
-
if (!fs.existsSync(DAEMON_TOML)) {
|
|
882
|
+
if (!fs.existsSync(config_2.DAEMON_TOML)) {
|
|
846
883
|
console.error("daemon.toml not found. Run `arc402 daemon init` first.");
|
|
847
884
|
process.exit(1);
|
|
848
885
|
}
|
|
849
|
-
const cfg = loadDaemonConfig();
|
|
886
|
+
const cfg = (0, config_2.loadDaemonConfig)();
|
|
850
887
|
const notif = cfg.notifications;
|
|
851
888
|
const channels = [];
|
|
852
889
|
if (notif.telegram_bot_token && notif.telegram_chat_id) {
|
|
@@ -876,12 +913,12 @@ export function registerDaemonCommands(program) {
|
|
|
876
913
|
.command("test")
|
|
877
914
|
.description("Send a test message to all configured channels")
|
|
878
915
|
.action(async () => {
|
|
879
|
-
if (!fs.existsSync(DAEMON_TOML)) {
|
|
916
|
+
if (!fs.existsSync(config_2.DAEMON_TOML)) {
|
|
880
917
|
console.error("daemon.toml not found. Run `arc402 daemon init` first.");
|
|
881
918
|
process.exit(1);
|
|
882
919
|
}
|
|
883
|
-
const cfg = loadDaemonConfig();
|
|
884
|
-
const notifier = buildNotifier(cfg);
|
|
920
|
+
const cfg = (0, config_2.loadDaemonConfig)();
|
|
921
|
+
const notifier = (0, notify_1.buildNotifier)(cfg);
|
|
885
922
|
if (!notifier.isEnabled()) {
|
|
886
923
|
console.log("No notification channels configured. Nothing to test.");
|
|
887
924
|
process.exit(0);
|
|
@@ -910,13 +947,13 @@ export function registerDaemonCommands(program) {
|
|
|
910
947
|
.option("--poll-interval <ms>", "Polling interval in milliseconds", "30000")
|
|
911
948
|
.option("--json", "Machine-parseable output (one JSON object per line)")
|
|
912
949
|
.action(async (opts) => {
|
|
913
|
-
const config = loadConfig();
|
|
950
|
+
const config = (0, config_1.loadConfig)();
|
|
914
951
|
if (!config.serviceAgreementAddress) {
|
|
915
952
|
console.error("serviceAgreementAddress missing in config. Run `arc402 config init`.");
|
|
916
953
|
process.exit(1);
|
|
917
954
|
}
|
|
918
|
-
const { signer, address } = await requireSigner(config);
|
|
919
|
-
const contract = new ethers.Contract(config.serviceAgreementAddress, SERVICE_AGREEMENT_ABI, signer);
|
|
955
|
+
const { signer, address } = await (0, client_1.requireSigner)(config);
|
|
956
|
+
const contract = new ethers_1.ethers.Contract(config.serviceAgreementAddress, abis_1.SERVICE_AGREEMENT_ABI, signer);
|
|
920
957
|
await runChannelWatchLoop({
|
|
921
958
|
pollInterval: parseInt(opts.pollInterval, 10),
|
|
922
959
|
wallet: address,
|