arc402-cli 1.8.3 → 1.8.4
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/chat/harness.d.ts +1 -0
- package/dist/chat/harness.d.ts.map +1 -1
- package/dist/chat/harness.js +28 -3
- package/dist/chat/harness.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +4 -3
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +57 -11
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/openshell.d.ts.map +1 -1
- package/dist/commands/openshell.js +12 -2
- package/dist/commands/openshell.js.map +1 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +60 -1
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/worker-executor.d.ts +1 -0
- package/dist/daemon/worker-executor.d.ts.map +1 -1
- package/dist/daemon/worker-executor.js +16 -1
- package/dist/daemon/worker-executor.js.map +1 -1
- package/dist/openshell-runtime.d.ts +6 -0
- package/dist/openshell-runtime.d.ts.map +1 -1
- package/dist/openshell-runtime.js +93 -4
- package/dist/openshell-runtime.js.map +1 -1
- package/dist/renderer/ThemedText.d.ts +2 -1
- package/dist/renderer/ThemedText.d.ts.map +1 -1
- package/dist/renderer/ThemedText.js +4 -1
- package/dist/renderer/ThemedText.js.map +1 -1
- package/dist/renderer/reconciler.d.ts.map +1 -1
- package/dist/renderer/reconciler.js +13 -1
- package/dist/renderer/reconciler.js.map +1 -1
- package/dist/tui/App.d.ts +3 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +44 -6
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/Header.d.ts.map +1 -1
- package/dist/tui/Header.js +2 -1
- package/dist/tui/Header.js.map +1 -1
- package/dist/tui/InputLine.d.ts.map +1 -1
- package/dist/tui/InputLine.js +2 -1
- package/dist/tui/InputLine.js.map +1 -1
- package/dist/tui/KernelPayloadRenderer.d.ts.map +1 -1
- package/dist/tui/KernelPayloadRenderer.js +17 -0
- package/dist/tui/KernelPayloadRenderer.js.map +1 -1
- package/dist/tui/Viewport.d.ts +4 -8
- package/dist/tui/Viewport.d.ts.map +1 -1
- package/dist/tui/Viewport.js +18 -28
- package/dist/tui/Viewport.js.map +1 -1
- package/dist/tui/command-catalog.d.ts.map +1 -1
- package/dist/tui/command-catalog.js +7 -2
- package/dist/tui/command-catalog.js.map +1 -1
- package/dist/tui/command-renderers.d.ts +20 -12
- package/dist/tui/command-renderers.d.ts.map +1 -1
- package/dist/tui/command-renderers.js +154 -37
- package/dist/tui/command-renderers.js.map +1 -1
- package/dist/tui/components/AnsiTextLine.d.ts +4 -0
- package/dist/tui/components/AnsiTextLine.d.ts.map +1 -0
- package/dist/tui/components/AnsiTextLine.js +92 -0
- package/dist/tui/components/AnsiTextLine.js.map +1 -0
- package/dist/tui/components/Button.js +1 -1
- package/dist/tui/components/Button.js.map +1 -1
- package/dist/tui/components/ChatHarnessSelector.d.ts.map +1 -1
- package/dist/tui/components/ChatHarnessSelector.js +4 -3
- package/dist/tui/components/ChatHarnessSelector.js.map +1 -1
- package/dist/tui/components/CompletionDropdown.d.ts.map +1 -1
- package/dist/tui/components/CompletionDropdown.js +4 -3
- package/dist/tui/components/CompletionDropdown.js.map +1 -1
- package/dist/tui/components/ConfirmPrompt.d.ts.map +1 -1
- package/dist/tui/components/ConfirmPrompt.js +2 -1
- package/dist/tui/components/ConfirmPrompt.js.map +1 -1
- package/dist/tui/components/commerce/FeedCard.d.ts +13 -0
- package/dist/tui/components/commerce/FeedCard.d.ts.map +1 -0
- package/dist/tui/components/commerce/FeedCard.js +26 -0
- package/dist/tui/components/commerce/FeedCard.js.map +1 -0
- package/dist/tui/components/commerce/JobStatusCard.d.ts +17 -0
- package/dist/tui/components/commerce/JobStatusCard.d.ts.map +1 -0
- package/dist/tui/components/commerce/JobStatusCard.js +11 -0
- package/dist/tui/components/commerce/JobStatusCard.js.map +1 -0
- package/dist/tui/components/commerce/RoundsList.js +1 -1
- package/dist/tui/components/commerce/RoundsList.js.map +1 -1
- package/dist/tui/components/commerce/StandingsCard.d.ts +13 -0
- package/dist/tui/components/commerce/StandingsCard.d.ts.map +1 -0
- package/dist/tui/components/commerce/StandingsCard.js +9 -0
- package/dist/tui/components/commerce/StandingsCard.js.map +1 -0
- package/dist/tui/components/commerce/StatusCard.d.ts.map +1 -1
- package/dist/tui/components/commerce/StatusCard.js +1 -2
- package/dist/tui/components/commerce/StatusCard.js.map +1 -1
- package/dist/tui/components/commerce/common.d.ts.map +1 -1
- package/dist/tui/components/commerce/common.js +13 -12
- package/dist/tui/components/commerce/common.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +3 -1
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/kernel-payload.d.ts +23 -0
- package/dist/tui/kernel-payload.d.ts.map +1 -1
- package/dist/tui/kernel.d.ts.map +1 -1
- package/dist/tui/kernel.js +350 -2
- package/dist/tui/kernel.js.map +1 -1
- package/dist/tui/useDaemonEvents.d.ts.map +1 -1
- package/dist/tui/useDaemonEvents.js +142 -44
- package/dist/tui/useDaemonEvents.js.map +1 -1
- package/dist/tui/viewport-measure.d.ts +28 -0
- package/dist/tui/viewport-measure.d.ts.map +1 -0
- package/dist/tui/viewport-measure.js +35 -0
- package/dist/tui/viewport-measure.js.map +1 -0
- package/dist/walletconnect.d.ts +1 -0
- package/dist/walletconnect.d.ts.map +1 -1
- package/dist/walletconnect.js +195 -126
- package/dist/walletconnect.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/tui/components/commerce/common.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/tui/components/commerce/common.tsx"],"names":[],"mappings":";;AA8BA,gCAMC;AAkBD,oCA4BC;AA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I,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACtC,OAAO,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC;AAC9B,CAAC"}
|
package/dist/tui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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":"AAuDA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CA+C/C"}
|
package/dist/tui/index.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.launchTUI = launchTUI;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const ink_js_1 = require("../renderer/ink.js");
|
|
9
9
|
const index_js_1 = require("../renderer/index.js");
|
|
10
|
+
const ThemeProvider_js_1 = require("../renderer/ThemeProvider.js");
|
|
10
11
|
const App_1 = require("./App");
|
|
11
12
|
const fs_1 = __importDefault(require("fs"));
|
|
12
13
|
const path_1 = __importDefault(require("path"));
|
|
@@ -74,7 +75,8 @@ async function launchTUI() {
|
|
|
74
75
|
// but also wire process-level signals to be safe)
|
|
75
76
|
process.on('SIGINT', () => { screen.exit(); process.exit(0); });
|
|
76
77
|
process.on('SIGTERM', () => { screen.exit(); process.exit(0); });
|
|
77
|
-
const
|
|
78
|
+
const chainId = config.network === "base-sepolia" ? 84532 : 8453;
|
|
79
|
+
const { waitUntilExit } = (0, ink_js_1.render)((0, jsx_runtime_1.jsx)(ThemeProvider_js_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(App_1.App, { version: pkg.version, network: config.network, wallet: walletDisplay, balance: balance, chainId: chainId, walletConnectProjectId: config.walletConnectProjectId }) }));
|
|
78
80
|
await waitUntilExit();
|
|
79
81
|
screen.exit();
|
|
80
82
|
}
|
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":";;;;;AAuDA,8BA+CC;;AArGD,+CAA4C;AAC5C,mDAAqD;AACrD,mEAA6D;AAC7D,+BAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AAEpB,8DAA8D;AAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AAEjE,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAStE,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAW,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CACvB,MAAc,EACd,OAAe;IAEf,IAAI,QAAsD,CAAC;IAC3D,IAAI,CAAC;QACH,8DAA8D;QAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAA4B,CAAC;QAC/D,2DAA2D;QAC3D,QAAQ,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,e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,OAAO,EACpB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,GACrD,GACY,CACjB,CAAC;IAEF,MAAM,aAAa,EAAE,CAAC;IACtB,MAAM,CAAC,IAAI,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -10,6 +10,11 @@ import type { WorkroomCardProps } from "./components/commerce/WorkroomCard";
|
|
|
10
10
|
import type { SubscribeCardProps } from "./components/commerce/SubscribeCard";
|
|
11
11
|
import type { RoundsListProps } from "./components/commerce/RoundsList";
|
|
12
12
|
import type { SquadCardProps } from "./components/commerce/SquadCard";
|
|
13
|
+
import type { ComputeCardProps } from "./components/commerce/ComputeCard";
|
|
14
|
+
import type { FeedCardProps } from "./components/commerce/FeedCard";
|
|
15
|
+
import type { JobStatusCardProps } from "./components/commerce/JobStatusCard";
|
|
16
|
+
import type { ProfileCardProps } from "./components/commerce/ProfileCard";
|
|
17
|
+
import type { StandingsCardProps } from "./components/commerce/StandingsCard";
|
|
13
18
|
export type KernelPayload = {
|
|
14
19
|
type: "status";
|
|
15
20
|
props: StatusCardProps;
|
|
@@ -35,6 +40,24 @@ export type KernelPayload = {
|
|
|
35
40
|
} | {
|
|
36
41
|
type: "squads";
|
|
37
42
|
cards: SquadCardProps[];
|
|
43
|
+
} | {
|
|
44
|
+
type: "compute";
|
|
45
|
+
props: ComputeCardProps;
|
|
46
|
+
} | {
|
|
47
|
+
type: "computes";
|
|
48
|
+
cards: ComputeCardProps[];
|
|
49
|
+
} | {
|
|
50
|
+
type: "feed";
|
|
51
|
+
props: FeedCardProps;
|
|
52
|
+
} | {
|
|
53
|
+
type: "job";
|
|
54
|
+
props: JobStatusCardProps;
|
|
55
|
+
} | {
|
|
56
|
+
type: "profile";
|
|
57
|
+
props: ProfileCardProps;
|
|
58
|
+
} | {
|
|
59
|
+
type: "standings";
|
|
60
|
+
props: StandingsCardProps;
|
|
38
61
|
} | {
|
|
39
62
|
type: "not_found";
|
|
40
63
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-payload.d.ts","sourceRoot":"","sources":["../../src/tui/kernel-payload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"kernel-payload.d.ts","sourceRoot":"","sources":["../../src/tui/kernel-payload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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gB,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/tui/kernel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../src/tui/kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../src/tui/kernel.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkNtD,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CASzD;AAsED,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAqE1F;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAKtE"}
|
package/dist/tui/kernel.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.executeTuiKernel = executeTuiKernel;
|
|
|
40
40
|
const sdk_1 = require("@arc402/sdk");
|
|
41
41
|
const ethers_1 = require("ethers");
|
|
42
42
|
const fs = __importStar(require("fs"));
|
|
43
|
+
const net = __importStar(require("net"));
|
|
43
44
|
const path = __importStar(require("path"));
|
|
44
45
|
const commerce_client_1 = require("../commerce-client");
|
|
45
46
|
const config_1 = require("../config");
|
|
@@ -68,6 +69,42 @@ function readConfiguredWallet() {
|
|
|
68
69
|
}
|
|
69
70
|
return undefined;
|
|
70
71
|
}
|
|
72
|
+
function sendDaemonIpcCommand(cmd) {
|
|
73
|
+
const socketPath = path.join(config_2.DAEMON_DIR, "daemon.sock");
|
|
74
|
+
if (!fs.existsSync(socketPath)) {
|
|
75
|
+
throw new Error("Daemon IPC socket not found. Start the daemon first.");
|
|
76
|
+
}
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const socket = net.createConnection(socketPath, () => {
|
|
79
|
+
socket.write(JSON.stringify(cmd) + "\n");
|
|
80
|
+
});
|
|
81
|
+
let buf = "";
|
|
82
|
+
socket.on("data", (data) => {
|
|
83
|
+
buf += data.toString();
|
|
84
|
+
const lines = buf.split("\n");
|
|
85
|
+
buf = lines.pop() ?? "";
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
if (!line.trim())
|
|
88
|
+
continue;
|
|
89
|
+
try {
|
|
90
|
+
resolve(JSON.parse(line));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
reject(new Error("Invalid JSON response from daemon"));
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
socket.destroy();
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
socket.on("error", reject);
|
|
102
|
+
socket.setTimeout(5000, () => {
|
|
103
|
+
socket.destroy();
|
|
104
|
+
reject(new Error("Daemon IPC timeout"));
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
71
108
|
function renderDaemonGuidance(target) {
|
|
72
109
|
if (target.mode !== "local") {
|
|
73
110
|
return [
|
|
@@ -200,13 +237,15 @@ function readWorkroomStatusSnapshot() {
|
|
|
200
237
|
};
|
|
201
238
|
}
|
|
202
239
|
function getTuiTopLevelCommands() {
|
|
203
|
-
return ["status", "discover", "agreements", "workroom", "subscription", "subscribe", "arena"];
|
|
240
|
+
return ["status", "discover", "agreements", "workroom", "subscription", "subscribe", "compute", "job", "arena"];
|
|
204
241
|
}
|
|
205
242
|
function getTuiSubCommands() {
|
|
206
243
|
return new Map([
|
|
207
244
|
["workroom", ["status", "worker"]],
|
|
208
245
|
["subscription", ["status", "list", "cancel", "topup"]],
|
|
209
|
-
["
|
|
246
|
+
["compute", ["status", "sessions"]],
|
|
247
|
+
["job", ["status"]],
|
|
248
|
+
["arena", ["rounds", "squad", "profile", "standings", "feed"]],
|
|
210
249
|
["squad", ["list", "info"]],
|
|
211
250
|
]);
|
|
212
251
|
}
|
|
@@ -245,6 +284,32 @@ async function renderKernelPayload(payload) {
|
|
|
245
284
|
writeTuiLine("");
|
|
246
285
|
}
|
|
247
286
|
break;
|
|
287
|
+
case "compute":
|
|
288
|
+
await (0, command_renderers_1.printComputeCard)(payload.props);
|
|
289
|
+
break;
|
|
290
|
+
case "computes":
|
|
291
|
+
for (const card of payload.cards) {
|
|
292
|
+
await (0, command_renderers_1.printComputeCard)(card);
|
|
293
|
+
const { writeTuiLine } = await Promise.resolve().then(() => __importStar(require("./render-inline")));
|
|
294
|
+
writeTuiLine("");
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "feed": {
|
|
298
|
+
const { buildFeedCardLines } = await Promise.resolve().then(() => __importStar(require("./command-renderers")));
|
|
299
|
+
const { writeTuiLine } = await Promise.resolve().then(() => __importStar(require("./render-inline")));
|
|
300
|
+
for (const line of buildFeedCardLines(payload.props))
|
|
301
|
+
writeTuiLine(line);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
case "job":
|
|
305
|
+
await (0, command_renderers_1.printJobStatusCard)(payload.props);
|
|
306
|
+
break;
|
|
307
|
+
case "profile":
|
|
308
|
+
await (0, command_renderers_1.printProfileCard)(payload.props);
|
|
309
|
+
break;
|
|
310
|
+
case "standings":
|
|
311
|
+
await (0, command_renderers_1.printStandings)(payload.props);
|
|
312
|
+
break;
|
|
248
313
|
case "not_found":
|
|
249
314
|
case "error": {
|
|
250
315
|
const { writeTuiLine } = await Promise.resolve().then(() => __importStar(require("./render-inline")));
|
|
@@ -275,9 +340,30 @@ async function executeKernelForPayload(input) {
|
|
|
275
340
|
if (tokens[0] === "subscribe") {
|
|
276
341
|
return fetchSubscribeInspectProps(tokens.slice(1));
|
|
277
342
|
}
|
|
343
|
+
if (tokens[0] === "compute" && tokens[1] === "status") {
|
|
344
|
+
return fetchComputeStatusProps(tokens.slice(2));
|
|
345
|
+
}
|
|
346
|
+
if (tokens[0] === "compute" && tokens[1] === "sessions") {
|
|
347
|
+
return fetchComputeSessionsProps();
|
|
348
|
+
}
|
|
349
|
+
if (tokens[0] === "job" && tokens[1] === "status") {
|
|
350
|
+
return fetchJobStatusProps(tokens.slice(2));
|
|
351
|
+
}
|
|
352
|
+
if (tokens[0] === "feed") {
|
|
353
|
+
return fetchArenaFeedProps(tokens.slice(1));
|
|
354
|
+
}
|
|
355
|
+
if (tokens[0] === "arena" && tokens[1] === "feed") {
|
|
356
|
+
return fetchArenaFeedProps(tokens.slice(2));
|
|
357
|
+
}
|
|
278
358
|
if (tokens[0] === "arena" && tokens[1] === "rounds") {
|
|
279
359
|
return fetchArenaRoundsProps(tokens.slice(2));
|
|
280
360
|
}
|
|
361
|
+
if (tokens[0] === "arena" && tokens[1] === "profile") {
|
|
362
|
+
return fetchArenaProfileProps(tokens.slice(2));
|
|
363
|
+
}
|
|
364
|
+
if (tokens[0] === "arena" && tokens[1] === "standings") {
|
|
365
|
+
return fetchArenaStandingsProps(tokens.slice(2));
|
|
366
|
+
}
|
|
281
367
|
if (tokens[0] === "arena" && tokens[1] === "squad" && tokens[2] === "list") {
|
|
282
368
|
return fetchArenaSquadListProps(tokens.slice(3));
|
|
283
369
|
}
|
|
@@ -543,6 +629,135 @@ async function fetchWorkroomStatusProps() {
|
|
|
543
629
|
const snapshot = readWorkroomStatusSnapshot();
|
|
544
630
|
return { type: "workroom", props: snapshot };
|
|
545
631
|
}
|
|
632
|
+
function getLocalDaemonPort() {
|
|
633
|
+
if (fs.existsSync(config_2.DAEMON_TOML)) {
|
|
634
|
+
try {
|
|
635
|
+
const cfg = (0, config_2.loadDaemonConfig)();
|
|
636
|
+
return cfg.relay?.listen_port ?? 4402;
|
|
637
|
+
}
|
|
638
|
+
catch {
|
|
639
|
+
// use default
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return 4402;
|
|
643
|
+
}
|
|
644
|
+
async function fetchComputeStatusProps(args) {
|
|
645
|
+
const sessionId = args[0];
|
|
646
|
+
if (!sessionId)
|
|
647
|
+
return fetchComputeSessionsProps();
|
|
648
|
+
const res = await fetch(`http://127.0.0.1:${getLocalDaemonPort()}/compute/session/${sessionId}`);
|
|
649
|
+
if (!res.ok) {
|
|
650
|
+
return { type: "not_found", message: `Compute session not found: ${sessionId}` };
|
|
651
|
+
}
|
|
652
|
+
const data = (await res.json());
|
|
653
|
+
const session = data.session;
|
|
654
|
+
const current = data.current;
|
|
655
|
+
const proposal = (session.proposal ?? {});
|
|
656
|
+
const consumedMinutes = Number(session.consumedMinutes ?? current?.consumedMinutes ?? 0);
|
|
657
|
+
const maxHours = Number(proposal.maxHours ?? 0);
|
|
658
|
+
const ratePerHourWei = String(proposal.ratePerHourWei ?? "0");
|
|
659
|
+
const totalBudgetWei = maxHours > 0 ? BigInt(ratePerHourWei) * BigInt(maxHours) : 0n;
|
|
660
|
+
const costWei = current?.costWei ? BigInt(String(current.costWei)) : (BigInt(ratePerHourWei) * BigInt(consumedMinutes)) / 60n;
|
|
661
|
+
const remainingWei = totalBudgetWei > 0n ? (totalBudgetWei - costWei > 0n ? totalBudgetWei - costWei : 0n) : 0n;
|
|
662
|
+
const pct = totalBudgetWei > 0n ? Number((costWei * 10000n) / totalBudgetWei) / 100 : undefined;
|
|
663
|
+
return {
|
|
664
|
+
type: "compute",
|
|
665
|
+
props: {
|
|
666
|
+
sessionId,
|
|
667
|
+
provider: String(proposal.clientAddress ?? "unknown"),
|
|
668
|
+
gpuSpec: String(proposal.gpuSpecHash ?? "gpu session"),
|
|
669
|
+
rateLabel: `${ratePerHourWei} wei/hr`,
|
|
670
|
+
consumedLabel: `${consumedMinutes} minutes`,
|
|
671
|
+
costLabel: `${costWei.toString()} wei`,
|
|
672
|
+
remainingLabel: totalBudgetWei > 0n ? `${remainingWei.toString()} wei` : undefined,
|
|
673
|
+
utilizationPercent: pct,
|
|
674
|
+
status: { label: String(session.status ?? "unknown"), tone: "info" },
|
|
675
|
+
},
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
async function fetchComputeSessionsProps() {
|
|
679
|
+
const res = await fetch(`http://127.0.0.1:${getLocalDaemonPort()}/compute/sessions`);
|
|
680
|
+
if (!res.ok) {
|
|
681
|
+
return { type: "error", message: `Failed to load compute sessions (HTTP ${res.status})` };
|
|
682
|
+
}
|
|
683
|
+
const data = (await res.json());
|
|
684
|
+
const sessions = data.sessions ?? [];
|
|
685
|
+
if (sessions.length === 0) {
|
|
686
|
+
return { type: "not_found", message: "No compute sessions found." };
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
type: "computes",
|
|
690
|
+
cards: sessions.map((raw) => {
|
|
691
|
+
const proposal = (raw.proposal ?? {});
|
|
692
|
+
const ratePerHourWei = String(proposal.ratePerHourWei ?? "0");
|
|
693
|
+
const maxHours = Number(proposal.maxHours ?? 0);
|
|
694
|
+
const consumedMinutes = Number(raw.consumedMinutes ?? 0);
|
|
695
|
+
const totalBudgetWei = BigInt(ratePerHourWei) * BigInt(maxHours);
|
|
696
|
+
const costWei = (BigInt(ratePerHourWei) * BigInt(consumedMinutes)) / 60n;
|
|
697
|
+
return {
|
|
698
|
+
sessionId: String(proposal.sessionId ?? "unknown"),
|
|
699
|
+
provider: String(proposal.clientAddress ?? "unknown"),
|
|
700
|
+
gpuSpec: String(proposal.gpuSpecHash ?? "gpu session"),
|
|
701
|
+
rateLabel: `${ratePerHourWei} wei/hr`,
|
|
702
|
+
consumedLabel: `${consumedMinutes} minutes`,
|
|
703
|
+
costLabel: `${costWei.toString()} wei`,
|
|
704
|
+
remainingLabel: `${(totalBudgetWei - costWei > 0n ? totalBudgetWei - costWei : 0n).toString()} wei`,
|
|
705
|
+
utilizationPercent: totalBudgetWei > 0n ? Number((costWei * 10000n) / totalBudgetWei) / 100 : undefined,
|
|
706
|
+
status: { label: String(raw.status ?? "unknown"), tone: "info" },
|
|
707
|
+
};
|
|
708
|
+
}),
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
async function fetchJobStatusProps(args) {
|
|
712
|
+
const agreementId = args[0];
|
|
713
|
+
if (!agreementId) {
|
|
714
|
+
return { type: "error", message: "job status requires an agreement id" };
|
|
715
|
+
}
|
|
716
|
+
const statusRes = await sendDaemonIpcCommand({ command: "worker-status" });
|
|
717
|
+
if (!statusRes.ok) {
|
|
718
|
+
return { type: "error", message: statusRes.error ?? "Failed to load worker status" };
|
|
719
|
+
}
|
|
720
|
+
const jobs = (statusRes.data?.jobs ?? []);
|
|
721
|
+
const job = jobs.find((entry) => String(entry.agreementId ?? "") === agreementId);
|
|
722
|
+
if (!job) {
|
|
723
|
+
return { type: "not_found", message: `No worker job found for agreement ${agreementId}` };
|
|
724
|
+
}
|
|
725
|
+
const logsRes = await sendDaemonIpcCommand({ command: "worker-logs", id: agreementId, tail: 20 });
|
|
726
|
+
const logTail = logsRes.ok
|
|
727
|
+
? String((logsRes.data?.log ?? ""))
|
|
728
|
+
.split("\n")
|
|
729
|
+
.map((line) => line.trimEnd())
|
|
730
|
+
.filter(Boolean)
|
|
731
|
+
.slice(-12)
|
|
732
|
+
: [];
|
|
733
|
+
const completedAt = Number(job.completedAt ?? 0);
|
|
734
|
+
const startedAt = Number(job.startedAt ?? 0);
|
|
735
|
+
const status = String(job.status ?? "unknown");
|
|
736
|
+
const tone = status === "completed"
|
|
737
|
+
? "success"
|
|
738
|
+
: status === "failed"
|
|
739
|
+
? "danger"
|
|
740
|
+
: status === "running"
|
|
741
|
+
? "info"
|
|
742
|
+
: "warning";
|
|
743
|
+
return {
|
|
744
|
+
type: "job",
|
|
745
|
+
props: {
|
|
746
|
+
agreementId,
|
|
747
|
+
capability: String(job.capability ?? "unknown"),
|
|
748
|
+
status: { label: status, tone },
|
|
749
|
+
harness: String(job.agentType ?? "n/a"),
|
|
750
|
+
jobDir: String(job.jobDir ?? "n/a"),
|
|
751
|
+
pid: job.pid != null ? String(job.pid) : undefined,
|
|
752
|
+
startedAt: startedAt > 0 ? new Date(startedAt).toLocaleString() : undefined,
|
|
753
|
+
completedAt: completedAt > 0 ? new Date(completedAt).toLocaleString() : undefined,
|
|
754
|
+
exitCode: job.exitCode != null ? String(job.exitCode) : undefined,
|
|
755
|
+
deliverableHash: job.deliverableHash ? String(job.deliverableHash) : undefined,
|
|
756
|
+
error: job.error ? String(job.error) : undefined,
|
|
757
|
+
logTail,
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
}
|
|
546
761
|
async function fetchSubscriptionProps(args) {
|
|
547
762
|
const sub = args[0] ?? "status";
|
|
548
763
|
const id = args[1];
|
|
@@ -632,6 +847,11 @@ async function arenaGql(query) {
|
|
|
632
847
|
throw new Error(`Subgraph error: ${JSON.stringify(json.errors[0])}`);
|
|
633
848
|
return json.data ?? {};
|
|
634
849
|
}
|
|
850
|
+
function formatUsdc(raw) {
|
|
851
|
+
const whole = raw / 1000000n;
|
|
852
|
+
const frac = raw % 1000000n;
|
|
853
|
+
return `${whole}.${frac.toString().padStart(6, "0").replace(/0+$/, "") || "0"}`;
|
|
854
|
+
}
|
|
635
855
|
function separator() {
|
|
636
856
|
return "─".repeat(60);
|
|
637
857
|
}
|
|
@@ -661,6 +881,134 @@ function formatElapsed(ts) {
|
|
|
661
881
|
return `${Math.floor(diff / 3600)}h ago`;
|
|
662
882
|
return `${Math.floor(diff / 86400)}d ago`;
|
|
663
883
|
}
|
|
884
|
+
async function fetchArenaFeedProps(args) {
|
|
885
|
+
const type = readFlag(args, "--type");
|
|
886
|
+
const limit = Number.parseInt(readFlag(args, "--limit") ?? "20", 10);
|
|
887
|
+
const typeFilter = type ? `eventType: "${type}"` : "";
|
|
888
|
+
const whereClause = typeFilter ? `where: { ${typeFilter} }` : "";
|
|
889
|
+
const data = await arenaGql(`{
|
|
890
|
+
feedEvents(${whereClause} first: ${Math.max(1, Math.min(limit, 50))}, orderBy: timestamp, orderDirection: desc) {
|
|
891
|
+
id
|
|
892
|
+
eventType
|
|
893
|
+
agent
|
|
894
|
+
data
|
|
895
|
+
timestamp
|
|
896
|
+
}
|
|
897
|
+
}`);
|
|
898
|
+
const events = data["feedEvents"] ?? [];
|
|
899
|
+
return {
|
|
900
|
+
type: "feed",
|
|
901
|
+
props: {
|
|
902
|
+
title: type ? `Arena Feed — ${type}` : "Arena Feed",
|
|
903
|
+
entries: events.map((ev) => {
|
|
904
|
+
const e = ev;
|
|
905
|
+
return {
|
|
906
|
+
id: String(e["id"]),
|
|
907
|
+
eventType: String(e["eventType"] ?? "event"),
|
|
908
|
+
agent: truncateAddr(String(e["agent"] ?? "")),
|
|
909
|
+
summary: String(e["data"] ?? "").slice(0, 80),
|
|
910
|
+
timestampLabel: formatElapsed(Number(e["timestamp"] ?? 0)),
|
|
911
|
+
};
|
|
912
|
+
}),
|
|
913
|
+
},
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
async function fetchArenaProfileProps(args) {
|
|
917
|
+
const target = args[0] ?? readConfiguredWallet();
|
|
918
|
+
if (!target) {
|
|
919
|
+
return { type: "error", message: "arena profile requires an address or configured wallet" };
|
|
920
|
+
}
|
|
921
|
+
const addr = target.toLowerCase();
|
|
922
|
+
const data = await arenaGql(`{
|
|
923
|
+
agent(id: "${addr}") {
|
|
924
|
+
id
|
|
925
|
+
name
|
|
926
|
+
serviceType
|
|
927
|
+
endpoint
|
|
928
|
+
registeredAt
|
|
929
|
+
active
|
|
930
|
+
}
|
|
931
|
+
arenaEntries(where: { agent: "${addr}" }, first: 1000) {
|
|
932
|
+
id
|
|
933
|
+
side
|
|
934
|
+
amount
|
|
935
|
+
round { id resolved outcome }
|
|
936
|
+
}
|
|
937
|
+
statuses(where: { agent: "${addr}" }, first: 5, orderBy: timestamp, orderDirection: desc) {
|
|
938
|
+
content
|
|
939
|
+
timestamp
|
|
940
|
+
}
|
|
941
|
+
}`);
|
|
942
|
+
const agent = data["agent"];
|
|
943
|
+
const entries = data["arenaEntries"] ?? [];
|
|
944
|
+
const statuses = data["statuses"] ?? [];
|
|
945
|
+
let wins = 0;
|
|
946
|
+
let losses = 0;
|
|
947
|
+
let netUsdc = 0n;
|
|
948
|
+
for (const e of entries) {
|
|
949
|
+
const entry = e;
|
|
950
|
+
const round = entry["round"];
|
|
951
|
+
if (!round || !round["resolved"])
|
|
952
|
+
continue;
|
|
953
|
+
const side = Number(entry["side"]);
|
|
954
|
+
const outcome = Boolean(round["outcome"]);
|
|
955
|
+
const amount = BigInt(String(entry["amount"] ?? "0"));
|
|
956
|
+
const won = (side === 0 && outcome) || (side === 1 && !outcome);
|
|
957
|
+
if (won) {
|
|
958
|
+
wins++;
|
|
959
|
+
netUsdc += amount;
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
losses++;
|
|
963
|
+
netUsdc -= amount;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
const latestStatusContent = statuses.length > 0
|
|
967
|
+
? String(statuses[0]["content"] ?? "")
|
|
968
|
+
: undefined;
|
|
969
|
+
return {
|
|
970
|
+
type: "profile",
|
|
971
|
+
props: {
|
|
972
|
+
address: target,
|
|
973
|
+
name: agent ? String(agent["name"] ?? "") || undefined : undefined,
|
|
974
|
+
serviceType: agent ? String(agent["serviceType"] ?? "") || undefined : undefined,
|
|
975
|
+
endpoint: agent ? String(agent["endpoint"] ?? "") || undefined : undefined,
|
|
976
|
+
isActive: agent ? Boolean(agent["active"]) : false,
|
|
977
|
+
wins,
|
|
978
|
+
losses,
|
|
979
|
+
netUsdc: netUsdc >= 0n ? formatUsdc(netUsdc) : "-" + formatUsdc(-netUsdc),
|
|
980
|
+
latestStatus: latestStatusContent,
|
|
981
|
+
},
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
async function fetchArenaStandingsProps(args) {
|
|
985
|
+
const category = readFlag(args, "--category");
|
|
986
|
+
const limit = Number.parseInt(readFlag(args, "--limit") ?? "20", 10);
|
|
987
|
+
const catFilter = category ? `where: { category: "${category}" }` : "";
|
|
988
|
+
const data = await arenaGql(`{
|
|
989
|
+
agentStandings(${catFilter} first: ${Math.max(1, Math.min(limit, 50))}, orderBy: wins, orderDirection: desc) {
|
|
990
|
+
id agent wins losses netUsdc
|
|
991
|
+
}
|
|
992
|
+
}`);
|
|
993
|
+
const standings = data["agentStandings"] ?? [];
|
|
994
|
+
return {
|
|
995
|
+
type: "standings",
|
|
996
|
+
props: {
|
|
997
|
+
title: category ? `Standings — ${category}` : "Global Leaderboard",
|
|
998
|
+
entries: standings.map((s, i) => {
|
|
999
|
+
const st = s;
|
|
1000
|
+
const net = BigInt(String(st["netUsdc"] ?? "0"));
|
|
1001
|
+
return {
|
|
1002
|
+
rank: i + 1,
|
|
1003
|
+
agent: truncateAddr(String(st["agent"])),
|
|
1004
|
+
wins: Number(st["wins"]),
|
|
1005
|
+
losses: Number(st["losses"]),
|
|
1006
|
+
netUsdc: net >= 0n ? "+" + formatUsdc(net) : "-" + formatUsdc(-net),
|
|
1007
|
+
};
|
|
1008
|
+
}),
|
|
1009
|
+
},
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
664
1012
|
async function fetchArenaRoundsProps(args) {
|
|
665
1013
|
const limit = Number.parseInt(readFlag(args, "--limit") ?? "10", 10);
|
|
666
1014
|
const data = await arenaGql(`{
|