arc402-cli 1.5.0 → 1.6.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.
Files changed (228) hide show
  1. package/dist/commands/agreements.d.ts.map +1 -1
  2. package/dist/commands/agreements.js +19 -0
  3. package/dist/commands/agreements.js.map +1 -1
  4. package/dist/commands/arena-v2.d.ts.map +1 -1
  5. package/dist/commands/arena-v2.js +129 -4
  6. package/dist/commands/arena-v2.js.map +1 -1
  7. package/dist/commands/auth.d.ts +11 -0
  8. package/dist/commands/auth.d.ts.map +1 -0
  9. package/dist/commands/auth.js +188 -0
  10. package/dist/commands/auth.js.map +1 -0
  11. package/dist/commands/chat.d.ts.map +1 -1
  12. package/dist/commands/chat.js +194 -3
  13. package/dist/commands/chat.js.map +1 -1
  14. package/dist/commands/compute.d.ts.map +1 -1
  15. package/dist/commands/compute.js +84 -10
  16. package/dist/commands/compute.js.map +1 -1
  17. package/dist/commands/discover.d.ts.map +1 -1
  18. package/dist/commands/discover.js +20 -0
  19. package/dist/commands/discover.js.map +1 -1
  20. package/dist/commands/hire.d.ts.map +1 -1
  21. package/dist/commands/hire.js +20 -0
  22. package/dist/commands/hire.js.map +1 -1
  23. package/dist/commands/lifecycle.d.ts +3 -0
  24. package/dist/commands/lifecycle.d.ts.map +1 -0
  25. package/dist/commands/lifecycle.js +58 -0
  26. package/dist/commands/lifecycle.js.map +1 -0
  27. package/dist/commands/security.d.ts +3 -0
  28. package/dist/commands/security.d.ts.map +1 -0
  29. package/dist/commands/security.js +44 -0
  30. package/dist/commands/security.js.map +1 -0
  31. package/dist/commands/status.d.ts.map +1 -1
  32. package/dist/commands/status.js +38 -0
  33. package/dist/commands/status.js.map +1 -1
  34. package/dist/commands/subscription.d.ts.map +1 -1
  35. package/dist/commands/subscription.js +313 -21
  36. package/dist/commands/subscription.js.map +1 -1
  37. package/dist/commands/workroom.d.ts.map +1 -1
  38. package/dist/commands/workroom.js +13 -0
  39. package/dist/commands/workroom.js.map +1 -1
  40. package/dist/program.d.ts.map +1 -1
  41. package/dist/program.js +6 -0
  42. package/dist/program.js.map +1 -1
  43. package/dist/tui/App.d.ts.map +1 -1
  44. package/dist/tui/App.js +61 -58
  45. package/dist/tui/App.js.map +1 -1
  46. package/dist/tui/InputLine.d.ts +4 -2
  47. package/dist/tui/InputLine.d.ts.map +1 -1
  48. package/dist/tui/InputLine.js +79 -60
  49. package/dist/tui/InputLine.js.map +1 -1
  50. package/dist/tui/KernelPayloadRenderer.d.ts +12 -0
  51. package/dist/tui/KernelPayloadRenderer.d.ts.map +1 -0
  52. package/dist/tui/KernelPayloadRenderer.js +41 -0
  53. package/dist/tui/KernelPayloadRenderer.js.map +1 -0
  54. package/dist/tui/Viewport.d.ts +15 -5
  55. package/dist/tui/Viewport.d.ts.map +1 -1
  56. package/dist/tui/Viewport.js +18 -24
  57. package/dist/tui/Viewport.js.map +1 -1
  58. package/dist/tui/command-catalog.d.ts +11 -0
  59. package/dist/tui/command-catalog.d.ts.map +1 -0
  60. package/dist/tui/command-catalog.js +119 -0
  61. package/dist/tui/command-catalog.js.map +1 -0
  62. package/dist/tui/command-renderers.d.ts +33 -0
  63. package/dist/tui/command-renderers.d.ts.map +1 -0
  64. package/dist/tui/command-renderers.js +215 -0
  65. package/dist/tui/command-renderers.js.map +1 -0
  66. package/dist/tui/commerce-format.d.ts +3 -0
  67. package/dist/tui/commerce-format.d.ts.map +1 -0
  68. package/dist/tui/commerce-format.js +19 -0
  69. package/dist/tui/commerce-format.js.map +1 -0
  70. package/dist/tui/components/commerce/AgentPicker.d.ts +7 -0
  71. package/dist/tui/components/commerce/AgentPicker.d.ts.map +1 -0
  72. package/dist/tui/components/commerce/AgentPicker.js +33 -0
  73. package/dist/tui/components/commerce/AgentPicker.js.map +1 -0
  74. package/dist/tui/components/commerce/AgreementList.d.ts +18 -0
  75. package/dist/tui/components/commerce/AgreementList.d.ts.map +1 -0
  76. package/dist/tui/components/commerce/AgreementList.js +25 -0
  77. package/dist/tui/components/commerce/AgreementList.js.map +1 -0
  78. package/dist/tui/components/commerce/ComputeCard.d.ts +14 -0
  79. package/dist/tui/components/commerce/ComputeCard.d.ts.map +1 -0
  80. package/dist/tui/components/commerce/ComputeCard.js +9 -0
  81. package/dist/tui/components/commerce/ComputeCard.js.map +1 -0
  82. package/dist/tui/components/commerce/DiscoverList.d.ts +20 -0
  83. package/dist/tui/components/commerce/DiscoverList.d.ts.map +1 -0
  84. package/dist/tui/components/commerce/DiscoverList.js +22 -0
  85. package/dist/tui/components/commerce/DiscoverList.js.map +1 -0
  86. package/dist/tui/components/commerce/HireCard.d.ts +14 -0
  87. package/dist/tui/components/commerce/HireCard.d.ts.map +1 -0
  88. package/dist/tui/components/commerce/HireCard.js +11 -0
  89. package/dist/tui/components/commerce/HireCard.js.map +1 -0
  90. package/dist/tui/components/commerce/ProfileCard.d.ts +19 -0
  91. package/dist/tui/components/commerce/ProfileCard.d.ts.map +1 -0
  92. package/dist/tui/components/commerce/ProfileCard.js +10 -0
  93. package/dist/tui/components/commerce/ProfileCard.js.map +1 -0
  94. package/dist/tui/components/commerce/RoundsList.d.ts +18 -0
  95. package/dist/tui/components/commerce/RoundsList.d.ts.map +1 -0
  96. package/dist/tui/components/commerce/RoundsList.js +9 -0
  97. package/dist/tui/components/commerce/RoundsList.js.map +1 -0
  98. package/dist/tui/components/commerce/SquadCard.d.ts +25 -0
  99. package/dist/tui/components/commerce/SquadCard.d.ts.map +1 -0
  100. package/dist/tui/components/commerce/SquadCard.js +10 -0
  101. package/dist/tui/components/commerce/SquadCard.js.map +1 -0
  102. package/dist/tui/components/commerce/StatusCard.d.ts +21 -0
  103. package/dist/tui/components/commerce/StatusCard.d.ts.map +1 -0
  104. package/dist/tui/components/commerce/StatusCard.js +10 -0
  105. package/dist/tui/components/commerce/StatusCard.js.map +1 -0
  106. package/dist/tui/components/commerce/SubscribeCard.d.ts +13 -0
  107. package/dist/tui/components/commerce/SubscribeCard.d.ts.map +1 -0
  108. package/dist/tui/components/commerce/SubscribeCard.js +10 -0
  109. package/dist/tui/components/commerce/SubscribeCard.js.map +1 -0
  110. package/dist/tui/components/commerce/WorkroomCard.d.ts +18 -0
  111. package/dist/tui/components/commerce/WorkroomCard.d.ts.map +1 -0
  112. package/dist/tui/components/commerce/WorkroomCard.js +10 -0
  113. package/dist/tui/components/commerce/WorkroomCard.js.map +1 -0
  114. package/dist/tui/components/commerce/common.d.ts +53 -0
  115. package/dist/tui/components/commerce/common.d.ts.map +1 -0
  116. package/dist/tui/components/commerce/common.js +71 -0
  117. package/dist/tui/components/commerce/common.js.map +1 -0
  118. package/dist/tui/components/commerce/index.d.ts +11 -0
  119. package/dist/tui/components/commerce/index.d.ts.map +1 -0
  120. package/dist/tui/components/commerce/index.js +27 -0
  121. package/dist/tui/components/commerce/index.js.map +1 -0
  122. package/dist/tui/hire-interactive.d.ts +13 -0
  123. package/dist/tui/hire-interactive.d.ts.map +1 -0
  124. package/dist/tui/hire-interactive.js +157 -0
  125. package/dist/tui/hire-interactive.js.map +1 -0
  126. package/dist/tui/kernel-payload.d.ts +45 -0
  127. package/dist/tui/kernel-payload.d.ts.map +1 -0
  128. package/dist/tui/kernel-payload.js +8 -0
  129. package/dist/tui/kernel-payload.js.map +1 -0
  130. package/dist/tui/kernel.d.ts +6 -0
  131. package/dist/tui/kernel.d.ts.map +1 -0
  132. package/dist/tui/kernel.js +791 -0
  133. package/dist/tui/kernel.js.map +1 -0
  134. package/dist/tui/render-inline.d.ts +9 -0
  135. package/dist/tui/render-inline.d.ts.map +1 -0
  136. package/dist/tui/render-inline.js +32 -0
  137. package/dist/tui/render-inline.js.map +1 -0
  138. package/dist/tui/useChat.d.ts.map +1 -1
  139. package/dist/tui/useChat.js +2 -2
  140. package/dist/tui/useChat.js.map +1 -1
  141. package/dist/tui/useCommand.d.ts +2 -2
  142. package/dist/tui/useCommand.d.ts.map +1 -1
  143. package/dist/tui/useCommand.js +57 -19
  144. package/dist/tui/useCommand.js.map +1 -1
  145. package/dist/tui/useDaemonEvents.d.ts +4 -0
  146. package/dist/tui/useDaemonEvents.d.ts.map +1 -0
  147. package/dist/tui/useDaemonEvents.js +69 -0
  148. package/dist/tui/useDaemonEvents.js.map +1 -0
  149. package/dist/tui/useTerminalSize.d.ts +11 -0
  150. package/dist/tui/useTerminalSize.d.ts.map +1 -0
  151. package/dist/tui/useTerminalSize.js +32 -0
  152. package/dist/tui/useTerminalSize.js.map +1 -0
  153. package/dist/tui-esm/App.js +136 -0
  154. package/dist/tui-esm/App.js.map +1 -0
  155. package/dist/tui-esm/Footer.js +13 -0
  156. package/dist/tui-esm/Footer.js.map +1 -0
  157. package/dist/tui-esm/Header.js +19 -0
  158. package/dist/tui-esm/Header.js.map +1 -0
  159. package/dist/tui-esm/InputLine.js +121 -0
  160. package/dist/tui-esm/InputLine.js.map +1 -0
  161. package/dist/tui-esm/Viewport.js +39 -0
  162. package/dist/tui-esm/Viewport.js.map +1 -0
  163. package/dist/tui-esm/WalletConnectPairing.js +61 -0
  164. package/dist/tui-esm/WalletConnectPairing.js.map +1 -0
  165. package/dist/tui-esm/command-catalog.js +20 -0
  166. package/dist/tui-esm/command-catalog.js.map +1 -0
  167. package/dist/tui-esm/command-renderers.js +180 -0
  168. package/dist/tui-esm/command-renderers.js.map +1 -0
  169. package/dist/tui-esm/commerce-format.js +19 -0
  170. package/dist/tui-esm/commerce-format.js.map +1 -0
  171. package/dist/tui-esm/components/Button.js +21 -0
  172. package/dist/tui-esm/components/Button.js.map +1 -0
  173. package/dist/tui-esm/components/CeremonyView.js +10 -0
  174. package/dist/tui-esm/components/CeremonyView.js.map +1 -0
  175. package/dist/tui-esm/components/CompletionDropdown.js +23 -0
  176. package/dist/tui-esm/components/CompletionDropdown.js.map +1 -0
  177. package/dist/tui-esm/components/ConfirmPrompt.js +10 -0
  178. package/dist/tui-esm/components/ConfirmPrompt.js.map +1 -0
  179. package/dist/tui-esm/components/CustomTextInput.js +99 -0
  180. package/dist/tui-esm/components/CustomTextInput.js.map +1 -0
  181. package/dist/tui-esm/components/InteractiveTable.js +61 -0
  182. package/dist/tui-esm/components/InteractiveTable.js.map +1 -0
  183. package/dist/tui-esm/components/StepSpinner.js +32 -0
  184. package/dist/tui-esm/components/StepSpinner.js.map +1 -0
  185. package/dist/tui-esm/components/Toast.js +29 -0
  186. package/dist/tui-esm/components/Toast.js.map +1 -0
  187. package/dist/tui-esm/components/commerce/AgreementList.js +25 -0
  188. package/dist/tui-esm/components/commerce/AgreementList.js.map +1 -0
  189. package/dist/tui-esm/components/commerce/ComputeCard.js +9 -0
  190. package/dist/tui-esm/components/commerce/ComputeCard.js.map +1 -0
  191. package/dist/tui-esm/components/commerce/DiscoverList.js +14 -0
  192. package/dist/tui-esm/components/commerce/DiscoverList.js.map +1 -0
  193. package/dist/tui-esm/components/commerce/HireCard.js +11 -0
  194. package/dist/tui-esm/components/commerce/HireCard.js.map +1 -0
  195. package/dist/tui-esm/components/commerce/RoundsList.js +9 -0
  196. package/dist/tui-esm/components/commerce/RoundsList.js.map +1 -0
  197. package/dist/tui-esm/components/commerce/SquadCard.js +10 -0
  198. package/dist/tui-esm/components/commerce/SquadCard.js.map +1 -0
  199. package/dist/tui-esm/components/commerce/StatusCard.js +10 -0
  200. package/dist/tui-esm/components/commerce/StatusCard.js.map +1 -0
  201. package/dist/tui-esm/components/commerce/SubscribeCard.js +10 -0
  202. package/dist/tui-esm/components/commerce/SubscribeCard.js.map +1 -0
  203. package/dist/tui-esm/components/commerce/WorkroomCard.js +10 -0
  204. package/dist/tui-esm/components/commerce/WorkroomCard.js.map +1 -0
  205. package/dist/tui-esm/components/commerce/common.js +71 -0
  206. package/dist/tui-esm/components/commerce/common.js.map +1 -0
  207. package/dist/tui-esm/components/commerce/index.js +27 -0
  208. package/dist/tui-esm/components/commerce/index.js.map +1 -0
  209. package/dist/tui-esm/index.js +55 -0
  210. package/dist/tui-esm/index.js.map +1 -0
  211. package/dist/tui-esm/kernel.js +734 -0
  212. package/dist/tui-esm/kernel.js.map +1 -0
  213. package/dist/tui-esm/render-inline.js +32 -0
  214. package/dist/tui-esm/render-inline.js.map +1 -0
  215. package/dist/tui-esm/useChat.js +91 -0
  216. package/dist/tui-esm/useChat.js.map +1 -0
  217. package/dist/tui-esm/useCommand.js +142 -0
  218. package/dist/tui-esm/useCommand.js.map +1 -0
  219. package/dist/tui-esm/useNotifications.js +17 -0
  220. package/dist/tui-esm/useNotifications.js.map +1 -0
  221. package/dist/tui-esm/useScroll.js +46 -0
  222. package/dist/tui-esm/useScroll.js.map +1 -0
  223. package/dist/tui-esm/useTerminalSize.js +32 -0
  224. package/dist/tui-esm/useTerminalSize.js.map +1 -0
  225. package/dist/ui/banner.d.ts.map +1 -1
  226. package/dist/ui/banner.js +46 -2
  227. package/dist/ui/banner.js.map +1 -1
  228. package/package.json +1 -1
@@ -0,0 +1,734 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getTuiTopLevelCommands = getTuiTopLevelCommands;
37
+ exports.getTuiSubCommands = getTuiSubCommands;
38
+ exports.executeTuiKernel = executeTuiKernel;
39
+ const sdk_1 = require("@arc402/sdk");
40
+ const ethers_1 = require("ethers");
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const commerce_client_1 = require("../commerce-client");
44
+ const config_1 = require("../config");
45
+ const client_1 = require("../client");
46
+ const format_1 = require("../utils/format");
47
+ const config_2 = require("../daemon/config");
48
+ const command_renderers_1 = require("./command-renderers");
49
+ function readConfiguredWallet() {
50
+ if (fs.existsSync(config_2.DAEMON_TOML)) {
51
+ try {
52
+ const wallet = (0, config_2.loadDaemonConfig)().wallet.contract_address.trim();
53
+ if (wallet)
54
+ return wallet;
55
+ }
56
+ catch {
57
+ // ignore
58
+ }
59
+ }
60
+ if ((0, config_1.configExists)()) {
61
+ try {
62
+ return (0, config_1.loadConfig)().walletContractAddress?.trim() || undefined;
63
+ }
64
+ catch {
65
+ // ignore
66
+ }
67
+ }
68
+ return undefined;
69
+ }
70
+ function renderDaemonGuidance(target) {
71
+ if (target.mode !== "local") {
72
+ return [
73
+ "Next steps:",
74
+ " 1. Confirm the remote daemon URL is correct and reachable.",
75
+ " 2. Re-run `arc402 chat --setup` if you want to switch back to a local node.",
76
+ ];
77
+ }
78
+ const lines = ["Next steps:"];
79
+ if (!fs.existsSync(config_2.DAEMON_TOML)) {
80
+ lines.push(" 1. Run `arc402 daemon init` or `arc402 setup` to create ~/.arc402/daemon.toml.");
81
+ lines.push(" 2. Fill in wallet + node settings, then start the node with `arc402 daemon start`.");
82
+ }
83
+ else {
84
+ lines.push(" 1. Start the local node with `arc402 daemon start`.");
85
+ lines.push(" 2. If it exits immediately, inspect `arc402 daemon logs` for the startup guidance.");
86
+ }
87
+ lines.push(" 3. Run `arc402 chat --setup` and choose Remote if this machine should not host the node.");
88
+ return lines;
89
+ }
90
+ const CAPABILITY_REGISTRY_EXTRA_ABI = [
91
+ "function getAgentsWithCapability(string calldata capability) external view returns (address[])",
92
+ ];
93
+ function normalise(values) {
94
+ const min = Math.min(...values);
95
+ const max = Math.max(...values);
96
+ const range = max - min;
97
+ if (range === 0)
98
+ return values.map(() => 1);
99
+ return values.map((v) => (v - min) / range);
100
+ }
101
+ function computeCompositeScores(agents) {
102
+ if (agents.length === 0)
103
+ return [];
104
+ const trustVals = normalise(agents.map((a) => a.trustScore));
105
+ const stakeVals = normalise(agents.map((a) => Number(a.stake)));
106
+ const jobsVals = normalise(agents.map((a) => a.completedJobs));
107
+ const rawPrices = agents.map((a) => (a.priceUsd !== null ? a.priceUsd : -1));
108
+ const validPrices = rawPrices.filter((p) => p >= 0);
109
+ const maxPrice = validPrices.length > 0 ? Math.max(...validPrices) : 1;
110
+ const priceInvVals = rawPrices.map((p) => (p < 0 ? 0.5 : maxPrice > 0 ? 1 - p / maxPrice : 1));
111
+ return agents.map((agent, i) => ({
112
+ ...agent,
113
+ compositeScore: trustVals[i] * 0.5 + stakeVals[i] * 0.2 + jobsVals[i] * 0.2 + priceInvVals[i] * 0.1,
114
+ rank: 0,
115
+ }));
116
+ }
117
+ async function pingEndpoint(endpoint) {
118
+ if (!endpoint || !/^https?:\/\//.test(endpoint))
119
+ return "offline";
120
+ try {
121
+ const ctrl = new AbortController();
122
+ const tid = setTimeout(() => ctrl.abort(), 3000);
123
+ const resp = await fetch(`${endpoint.replace(/\/$/, "")}/health`, { signal: ctrl.signal });
124
+ clearTimeout(tid);
125
+ return resp.ok ? "online" : "offline";
126
+ }
127
+ catch {
128
+ return "offline";
129
+ }
130
+ }
131
+ function parseTokens(input) {
132
+ const tokens = [];
133
+ let current = "";
134
+ let inQuote = false;
135
+ let quoteChar = "";
136
+ let escape = false;
137
+ for (const ch of input) {
138
+ if (escape) {
139
+ current += ch;
140
+ escape = false;
141
+ continue;
142
+ }
143
+ if (inQuote) {
144
+ if (quoteChar === '"' && ch === "\\") {
145
+ escape = true;
146
+ }
147
+ else if (ch === quoteChar) {
148
+ inQuote = false;
149
+ }
150
+ else {
151
+ current += ch;
152
+ }
153
+ }
154
+ else if (ch === '"' || ch === "'") {
155
+ inQuote = true;
156
+ quoteChar = ch;
157
+ }
158
+ else if (/\s/.test(ch)) {
159
+ if (current) {
160
+ tokens.push(current);
161
+ current = "";
162
+ }
163
+ }
164
+ else {
165
+ current += ch;
166
+ }
167
+ }
168
+ if (current)
169
+ tokens.push(current);
170
+ return tokens;
171
+ }
172
+ function readWorkroomStatusSnapshot() {
173
+ const policyFile = path.join(config_2.DAEMON_DIR, "openshell-policy.yaml");
174
+ let policyHash = "n/a";
175
+ if (fs.existsSync(policyFile)) {
176
+ const content = fs.readFileSync(policyFile, "utf-8");
177
+ const crypto = require("crypto");
178
+ policyHash = "0x" + crypto.createHash("sha256").update(content).digest("hex").slice(0, 16);
179
+ }
180
+ const workerConfigPath = path.join(config_2.DAEMON_DIR, "worker", "config.json");
181
+ let harness = "arc";
182
+ if (fs.existsSync(workerConfigPath)) {
183
+ try {
184
+ const workerConfig = JSON.parse(fs.readFileSync(workerConfigPath, "utf-8"));
185
+ harness = workerConfig.harness ?? harness;
186
+ }
187
+ catch {
188
+ // ignore
189
+ }
190
+ }
191
+ const daemonLog = path.join(config_2.DAEMON_DIR, "daemon.log");
192
+ const statusLabel = fs.existsSync(daemonLog) ? "healthy" : "idle";
193
+ return {
194
+ statusLabel,
195
+ harness,
196
+ policyHash,
197
+ queueDepth: 0,
198
+ runtime: "arc402-workroom",
199
+ };
200
+ }
201
+ function getTuiTopLevelCommands() {
202
+ return ["status", "discover", "agreements", "workroom", "subscription", "subscribe", "arena"];
203
+ }
204
+ function getTuiSubCommands() {
205
+ return new Map([
206
+ ["workroom", ["status", "worker"]],
207
+ ["subscription", ["status", "list", "cancel", "topup"]],
208
+ ["arena", ["rounds", "squad"]],
209
+ ["squad", ["list", "info"]],
210
+ ]);
211
+ }
212
+ async function executeTuiKernel(input) {
213
+ const tokens = parseTokens(input);
214
+ if (tokens.length === 0)
215
+ return false;
216
+ if (tokens[0] === "status") {
217
+ await executeStatusKernel(tokens.slice(1));
218
+ return true;
219
+ }
220
+ if (tokens[0] === "discover") {
221
+ await executeDiscoverKernel(tokens.slice(1));
222
+ return true;
223
+ }
224
+ if (tokens[0] === "agreements") {
225
+ await executeAgreementsKernel(tokens.slice(1));
226
+ return true;
227
+ }
228
+ if (tokens[0] === "workroom" && tokens[1] === "status") {
229
+ await executeWorkroomStatusKernel();
230
+ return true;
231
+ }
232
+ if (tokens[0] === "subscription") {
233
+ await executeSubscriptionKernel(tokens.slice(1));
234
+ return true;
235
+ }
236
+ if (tokens[0] === "subscribe") {
237
+ await executeSubscribeInspectKernel(tokens.slice(1));
238
+ return true;
239
+ }
240
+ if (tokens[0] === "arena" && tokens[1] === "rounds") {
241
+ await executeArenaRoundsKernel(tokens.slice(2));
242
+ return true;
243
+ }
244
+ if (tokens[0] === "arena" && tokens[1] === "squad" && tokens[2] === "list") {
245
+ await executeArenaSquadListKernel(tokens.slice(3));
246
+ return true;
247
+ }
248
+ if (tokens[0] === "arena" && tokens[1] === "squad" && tokens[2] === "info" && tokens[3]) {
249
+ await executeArenaSquadInfoKernel(tokens[3]);
250
+ return true;
251
+ }
252
+ return false;
253
+ }
254
+ async function executeStatusKernel(args) {
255
+ const daemonUrlIndex = args.indexOf("--daemon-url");
256
+ const baseUrl = daemonUrlIndex >= 0 ? args[daemonUrlIndex + 1] : undefined;
257
+ const target = (0, commerce_client_1.resolveChatDaemonTarget)({ explicitBaseUrl: baseUrl });
258
+ try {
259
+ const [health, wallet, workroom, agreements] = await Promise.all([
260
+ (0, commerce_client_1.fetchDaemonHealth)({ baseUrl: target.baseUrl }),
261
+ (0, commerce_client_1.fetchDaemonWalletStatus)({ baseUrl: target.baseUrl }),
262
+ (0, commerce_client_1.fetchDaemonWorkroomStatus)({ baseUrl: target.baseUrl }),
263
+ (0, commerce_client_1.fetchDaemonAgreements)({ baseUrl: target.baseUrl }),
264
+ ]);
265
+ const active = agreements.agreements.filter((agreement) => {
266
+ const status = String((agreement.status ?? agreement.state ?? "")).toLowerCase();
267
+ return status.includes("accept") || status.includes("active") || status.includes("proposed");
268
+ }).length;
269
+ const pendingVerification = agreements.agreements.filter((agreement) => {
270
+ const status = String((agreement.status ?? agreement.state ?? "")).toLowerCase();
271
+ return status.includes("verify") || status.includes("pending");
272
+ }).length;
273
+ const disputed = agreements.agreements.filter((agreement) => String((agreement.status ?? agreement.state ?? "")).toLowerCase().includes("disput")).length;
274
+ await (0, command_renderers_1.printStatusCard)({
275
+ wallet: wallet.wallet,
276
+ network: `chain ${wallet.chainId}`,
277
+ balance: target.mode === "local" ? target.baseUrl : `${target.mode} · ${target.baseUrl}`,
278
+ endpoint: wallet.rpcUrl,
279
+ agreements: { active, pendingVerification, disputed },
280
+ workroom: { status: workroom.status },
281
+ status: { label: health.ok ? "online" : "offline", tone: health.ok ? "success" : "danger" },
282
+ });
283
+ return;
284
+ }
285
+ catch (error) {
286
+ const message = error instanceof Error ? error.message : String(error);
287
+ const fallbackWallet = readConfiguredWallet();
288
+ const daemonState = target.mode === "local"
289
+ ? fs.existsSync(config_2.DAEMON_TOML)
290
+ ? "configured locally but not responding"
291
+ : "not configured on this machine"
292
+ : "remote node unreachable";
293
+ await (0, command_renderers_1.printStatusCard)({
294
+ wallet: fallbackWallet ?? "not configured",
295
+ network: `${target.mode} node`,
296
+ balance: target.baseUrl,
297
+ endpoint: message,
298
+ workroom: { status: "waiting for daemon context" },
299
+ status: { label: daemonState, tone: "warning" },
300
+ });
301
+ for (const line of renderDaemonGuidance(target)) {
302
+ const { writeTuiLine } = await import("./render-inline");
303
+ writeTuiLine(line);
304
+ }
305
+ }
306
+ }
307
+ async function executeDiscoverKernel(args) {
308
+ const config = (0, config_1.loadConfig)();
309
+ if (!config.agentRegistryAddress)
310
+ throw new Error("agentRegistryAddress missing in config");
311
+ const { provider } = await (0, client_1.getClient)(config);
312
+ const registryMod = await import("@arc402/sdk");
313
+ const registry = new registryMod.AgentRegistryClient(config.agentRegistryAddress, provider);
314
+ const capabilitySDK = config.capabilityRegistryAddress
315
+ ? new registryMod.CapabilityRegistryClient(config.capabilityRegistryAddress, provider)
316
+ : null;
317
+ const sponsorship = config.sponsorshipAttestationAddress
318
+ ? new registryMod.SponsorshipAttestationClient(config.sponsorshipAttestationAddress, provider)
319
+ : null;
320
+ const reputation = config.reputationOracleAddress
321
+ ? new registryMod.ReputationOracleClient(config.reputationOracleAddress, provider)
322
+ : null;
323
+ const opts = {
324
+ capability: readFlag(args, "--capability"),
325
+ capabilityPrefix: readFlag(args, "--capability-prefix"),
326
+ serviceType: readFlag(args, "--service-type") ?? readFlag(args, "--type"),
327
+ minTrust: Number(readFlag(args, "--min-trust") ?? "0"),
328
+ maxPrice: Number(readFlag(args, "--max-price") ?? "0"),
329
+ minStake: BigInt(readFlag(args, "--min-stake") ?? "0"),
330
+ top: readFlag(args, "--top"),
331
+ sort: readFlag(args, "--sort") ?? "composite",
332
+ limit: Number(readFlag(args, "--limit") ?? "20"),
333
+ online: args.includes("--online"),
334
+ };
335
+ const effectiveSort = opts.top ? "trust" : opts.sort;
336
+ const limit = opts.top ? Number(opts.top) : opts.limit;
337
+ let candidateAddresses = null;
338
+ if (opts.capability && config.capabilityRegistryAddress) {
339
+ const capContract = new ethers_1.ethers.Contract(config.capabilityRegistryAddress, CAPABILITY_REGISTRY_EXTRA_ABI, provider);
340
+ try {
341
+ candidateAddresses = await capContract.getAgentsWithCapability(opts.capability);
342
+ }
343
+ catch {
344
+ candidateAddresses = null;
345
+ }
346
+ }
347
+ let agentInfos;
348
+ if (candidateAddresses !== null) {
349
+ const results = await Promise.allSettled(candidateAddresses.map((addr) => registry.getAgent(addr)));
350
+ agentInfos = results
351
+ .filter((r) => r.status === "fulfilled")
352
+ .map((r) => r.value);
353
+ }
354
+ else {
355
+ agentInfos = await registry.listAgents(limit * 10);
356
+ }
357
+ let filtered = agentInfos.filter((a) => a.active !== false);
358
+ if (opts.capability)
359
+ filtered = filtered.filter((a) => a.capabilities.some((c) => c === opts.capability));
360
+ if (opts.capabilityPrefix)
361
+ filtered = filtered.filter((a) => a.capabilities.some((c) => c.startsWith(opts.capabilityPrefix)));
362
+ if (opts.serviceType)
363
+ filtered = filtered.filter((a) => a.serviceType.toLowerCase().includes(String(opts.serviceType).toLowerCase()));
364
+ filtered = filtered.filter((a) => Number(a.trustScore ?? 0n) >= opts.minTrust);
365
+ if (opts.minStake > 0n) {
366
+ filtered = filtered.filter((a) => BigInt(a.stake ?? 0n) >= opts.minStake);
367
+ }
368
+ const enriched = await Promise.all(filtered.slice(0, limit * 5).map(async (agent) => {
369
+ const [operational, canonicalCapabilities, rep] = await Promise.all([
370
+ registry.getOperationalMetrics(agent.wallet),
371
+ capabilitySDK ? capabilitySDK.getCapabilities(agent.wallet) : Promise.resolve([]),
372
+ reputation ? reputation.getReputation(agent.wallet) : Promise.resolve(undefined),
373
+ sponsorship ? sponsorship.getHighestTier(agent.wallet) : Promise.resolve(undefined),
374
+ ]);
375
+ let priceUsd = null;
376
+ if (agent.metadataURI && /^https?:\/\//.test(agent.metadataURI)) {
377
+ try {
378
+ const ctrl = new AbortController();
379
+ const tid = setTimeout(() => ctrl.abort(), 2000);
380
+ const resp = await fetch(agent.metadataURI, { signal: ctrl.signal });
381
+ clearTimeout(tid);
382
+ if (resp.ok) {
383
+ const meta = await resp.json();
384
+ if (meta.pricing?.priceUsd != null)
385
+ priceUsd = meta.pricing.priceUsd;
386
+ }
387
+ }
388
+ catch {
389
+ // ignore
390
+ }
391
+ }
392
+ if (opts.maxPrice > 0 && priceUsd !== null && priceUsd > opts.maxPrice)
393
+ return null;
394
+ const repObj = rep && typeof rep === "object" ? rep : {};
395
+ return {
396
+ wallet: agent.wallet,
397
+ name: agent.name,
398
+ serviceType: agent.serviceType,
399
+ endpoint: agent.endpoint,
400
+ metadataURI: agent.metadataURI,
401
+ capabilities: agent.capabilities,
402
+ canonicalCapabilities: canonicalCapabilities,
403
+ trustScore: Number(agent.trustScore ?? 0n),
404
+ stake: agent.stake ?? 0n,
405
+ completedJobs: Number(repObj.completedJobs ?? 0),
406
+ priceUsd,
407
+ compositeScore: 0,
408
+ rank: 0,
409
+ operational: {
410
+ uptimeScore: Number(operational.uptimeScore),
411
+ responseScore: Number(operational.responseScore),
412
+ },
413
+ };
414
+ }));
415
+ let scored = computeCompositeScores(enriched.filter((a) => a !== null));
416
+ switch (effectiveSort) {
417
+ case "trust":
418
+ scored.sort((a, b) => b.trustScore - a.trustScore);
419
+ break;
420
+ case "price":
421
+ scored.sort((a, b) => {
422
+ if (a.priceUsd === null && b.priceUsd === null)
423
+ return 0;
424
+ if (a.priceUsd === null)
425
+ return 1;
426
+ if (b.priceUsd === null)
427
+ return -1;
428
+ return a.priceUsd - b.priceUsd;
429
+ });
430
+ break;
431
+ case "jobs":
432
+ scored.sort((a, b) => b.completedJobs - a.completedJobs);
433
+ break;
434
+ case "stake":
435
+ scored.sort((a, b) => (b.stake > a.stake ? 1 : b.stake < a.stake ? -1 : 0));
436
+ break;
437
+ default:
438
+ scored.sort((a, b) => b.compositeScore - a.compositeScore);
439
+ }
440
+ scored = scored.slice(0, limit).map((a, i) => ({ ...a, rank: i + 1 }));
441
+ let withStatus = await Promise.all(scored.map(async (agent) => ({
442
+ ...agent,
443
+ endpointStatus: agent.endpoint ? await pingEndpoint(agent.endpoint) : "unknown",
444
+ })));
445
+ if (opts.online)
446
+ withStatus = withStatus.filter((a) => a.endpointStatus === "online");
447
+ const onlineCount = withStatus.filter((a) => a.endpointStatus === "online").length;
448
+ await (0, command_renderers_1.printDiscoverList)({
449
+ summary: `${withStatus.length} agent${withStatus.length === 1 ? "" : "s"} · ${onlineCount} online`,
450
+ status: { label: effectiveSort, tone: "info" },
451
+ agents: withStatus.map((agent) => ({
452
+ rank: agent.rank,
453
+ name: agent.name,
454
+ wallet: agent.wallet,
455
+ serviceType: agent.serviceType,
456
+ trustScore: agent.trustScore,
457
+ compositeScore: agent.compositeScore,
458
+ endpointStatus: agent.endpointStatus,
459
+ capabilitySummary: (agent.canonicalCapabilities.length ? agent.canonicalCapabilities : agent.capabilities).slice(0, 3).join(", ") || "none",
460
+ priceLabel: agent.priceUsd === null ? undefined : `$${agent.priceUsd}`,
461
+ })),
462
+ });
463
+ }
464
+ async function executeAgreementsKernel(args) {
465
+ const asIndex = args.indexOf("--as");
466
+ const role = asIndex >= 0 ? (args[asIndex + 1] ?? "client") : "client";
467
+ const config = (0, config_1.loadConfig)();
468
+ if (!config.serviceAgreementAddress)
469
+ throw new Error("serviceAgreementAddress missing in config");
470
+ const { provider, address } = await (0, client_1.getClient)(config);
471
+ if (!address)
472
+ throw new Error("No wallet configured");
473
+ const client = new sdk_1.ServiceAgreementClient(config.serviceAgreementAddress, provider);
474
+ const agreements = role === "provider"
475
+ ? await client.getProviderAgreements(address)
476
+ : await client.getClientAgreements(address);
477
+ const totalEscrowWei = agreements.reduce((sum, agreement) => sum + BigInt(agreement.price ?? 0n), 0n);
478
+ await (0, command_renderers_1.printAgreementList)({
479
+ roleLabel: role === "provider" ? "Provider Agreements" : "Client Agreements",
480
+ totalEscrowLabel: `${totalEscrowWei.toString()} wei escrowed`,
481
+ status: { label: `${agreements.length} total`, tone: "info" },
482
+ agreements: agreements.map((agreement) => ({
483
+ id: agreement.id.toString(),
484
+ counterparty: role === "provider" ? agreement.client : agreement.provider,
485
+ serviceType: agreement.serviceType,
486
+ status: (0, format_1.agreementStatusLabel)(agreement.status),
487
+ deadlineMinutes: Math.max(0, Math.round((Number(agreement.deadline) - Math.floor(Date.now() / 1000)) / 60)),
488
+ price: `${BigInt(agreement.price ?? 0n).toString()} wei`,
489
+ })),
490
+ });
491
+ }
492
+ async function executeWorkroomStatusKernel() {
493
+ const snapshot = readWorkroomStatusSnapshot();
494
+ await (0, command_renderers_1.printWorkroomCard)(snapshot);
495
+ }
496
+ async function executeSubscriptionKernel(args) {
497
+ const sub = args[0] ?? "status";
498
+ const id = args[1];
499
+ const months = Number.parseInt(readFlag(args, "--months") ?? "1", 10);
500
+ if (sub === "status") {
501
+ await (0, command_renderers_1.printSubscribeCard)({
502
+ provider: `subscription ${id ?? "unknown"}`,
503
+ planId: "status",
504
+ rateLabel: "pending query binding",
505
+ accessSummary: ["Contract/subgraph lookup pending"],
506
+ status: { label: "scaffold", tone: "warning" },
507
+ });
508
+ return;
509
+ }
510
+ if (sub === "list") {
511
+ await (0, command_renderers_1.printSubscribeCard)({
512
+ provider: "subscriptions",
513
+ planId: "list",
514
+ rateLabel: "query source pending",
515
+ accessSummary: ["List query scaffolding only"],
516
+ status: { label: "scaffold", tone: "warning" },
517
+ });
518
+ return;
519
+ }
520
+ if (sub === "cancel") {
521
+ await (0, command_renderers_1.printSubscribeCard)({
522
+ provider: `subscription ${id ?? "unknown"}`,
523
+ planId: "cancel",
524
+ rateLabel: "write path deferred",
525
+ accessSummary: ["Cancellation intentionally not wired in this phase"],
526
+ status: { label: "deferred", tone: "warning" },
527
+ });
528
+ return;
529
+ }
530
+ if (sub === "topup") {
531
+ await (0, command_renderers_1.printSubscribeCard)({
532
+ provider: `subscription ${id ?? "unknown"}`,
533
+ planId: "topup",
534
+ rateLabel: `+${months} months`,
535
+ months,
536
+ accessSummary: ["Top-up command shape is staged"],
537
+ status: { label: "scaffold", tone: "warning" },
538
+ });
539
+ return;
540
+ }
541
+ throw new Error(`Unsupported subscription subcommand: ${sub}`);
542
+ }
543
+ async function executeSubscribeInspectKernel(args) {
544
+ const endpoint = args[0];
545
+ if (!endpoint)
546
+ throw new Error("subscribe requires an endpoint");
547
+ const inspection = await (0, commerce_client_1.inspectCommerceEndpoint)(endpoint);
548
+ const months = Number.parseInt(readFlag(args, "--months") ?? "1", 10);
549
+ const plan = readFlag(args, "--plan") ?? inspection.subscription?.plan ?? "unspecified";
550
+ await (0, command_renderers_1.printSubscribeCard)({
551
+ provider: endpoint,
552
+ planId: plan,
553
+ rateLabel: inspection.subscription?.rate ?? inspection.x402?.amount ?? "n/a",
554
+ months,
555
+ paymentOptions: inspection.paymentOptions,
556
+ accessSummary: [inspection.subscription?.endpoint ?? endpoint, inspection.x402?.description ?? "read-only scaffold"],
557
+ status: { label: inspection.paymentRequired ? "payment required" : "inspect", tone: inspection.paymentRequired ? "warning" : "info" },
558
+ });
559
+ }
560
+ const ARENA_SUBGRAPH_URL = "https://api.studio.thegraph.com/query/1744310/arc-402/v0.3.0";
561
+ async function arenaGql(query) {
562
+ const res = await fetch(ARENA_SUBGRAPH_URL, {
563
+ method: "POST",
564
+ headers: { "Content-Type": "application/json" },
565
+ body: JSON.stringify({ query }),
566
+ });
567
+ if (!res.ok)
568
+ throw new Error(`Subgraph HTTP ${res.status}`);
569
+ const json = (await res.json());
570
+ if (json.errors?.length)
571
+ throw new Error(`Subgraph error: ${JSON.stringify(json.errors[0])}`);
572
+ return json.data ?? {};
573
+ }
574
+ function separator() {
575
+ return "─".repeat(60);
576
+ }
577
+ function formatSquadId(id) {
578
+ return `squad-0x${Number(id).toString(16)}`;
579
+ }
580
+ function parseSquadId(s) {
581
+ if (s.startsWith("squad-0x"))
582
+ return BigInt("0x" + s.slice(8));
583
+ return BigInt(s);
584
+ }
585
+ function truncateAddr(addr) {
586
+ return `${addr.slice(0, 6)}…${addr.slice(-4)}`;
587
+ }
588
+ function squadStatusLabel(status) {
589
+ const labels = { 0: "active", 1: "concluded", 2: "disbanded" };
590
+ return labels[status] ?? String(status);
591
+ }
592
+ function formatElapsed(ts) {
593
+ const now = Math.floor(Date.now() / 1000);
594
+ const diff = now - ts;
595
+ if (diff < 60)
596
+ return `${diff}s ago`;
597
+ if (diff < 3600)
598
+ return `${Math.floor(diff / 60)}m ago`;
599
+ if (diff < 86400)
600
+ return `${Math.floor(diff / 3600)}h ago`;
601
+ return `${Math.floor(diff / 86400)}d ago`;
602
+ }
603
+ async function executeArenaRoundsKernel(args) {
604
+ const limit = Number.parseInt(readFlag(args, "--limit") ?? "10", 10);
605
+ const data = await arenaGql(`{
606
+ arenaRounds(first: ${Math.max(1, Math.min(limit, 50))}, orderBy: createdAt, orderDirection: desc) {
607
+ id
608
+ question
609
+ category
610
+ yesPot
611
+ noPot
612
+ stakingClosesAt
613
+ resolvesAt
614
+ resolved
615
+ outcome
616
+ }
617
+ }`);
618
+ const rounds = (data["arenaRounds"] ?? []).map((round) => {
619
+ const r = round;
620
+ const yesPot = BigInt(String(r["yesPot"] ?? "0"));
621
+ const noPot = BigInt(String(r["noPot"] ?? "0"));
622
+ const resolvesAt = Number(r["resolvesAt"] ?? 0);
623
+ return {
624
+ id: String(r["id"]),
625
+ question: String(r["question"]),
626
+ category: String(r["category"] ?? ""),
627
+ yesLabel: yesPot.toString(),
628
+ noLabel: noPot.toString(),
629
+ timingLabel: resolvesAt > 0 ? formatElapsed(resolvesAt) : "timing n/a",
630
+ resolved: Boolean(r["resolved"]),
631
+ outcomeLabel: Boolean(r["outcome"]) ? "YES" : "NO",
632
+ };
633
+ });
634
+ await (0, command_renderers_1.printRoundsList)({
635
+ title: "Arena Rounds",
636
+ status: { label: "subgraph", tone: "info" },
637
+ rounds,
638
+ });
639
+ }
640
+ async function executeArenaSquadListKernel(args) {
641
+ const domain = readFlag(args, "--domain");
642
+ const domainFilter = domain ? `where: { domainTag: "${domain}" }` : "";
643
+ const data = await arenaGql(`{
644
+ researchSquads(${domainFilter} first: 50, orderBy: createdAt, orderDirection: desc) {
645
+ id name domainTag creator status inviteOnly memberCount createdAt
646
+ }
647
+ }`);
648
+ const squads = data["researchSquads"] ?? [];
649
+ const { writeTuiLine } = await import("./render-inline");
650
+ if (squads.length === 0) {
651
+ writeTuiLine("◈ Research Squads");
652
+ writeTuiLine(separator());
653
+ writeTuiLine(" No squads found.");
654
+ return;
655
+ }
656
+ for (const s of squads) {
657
+ const sq = s;
658
+ await (0, command_renderers_1.printSquadCard)({
659
+ id: formatSquadId(BigInt(String(sq["id"]))),
660
+ name: String(sq["name"]),
661
+ domainTag: String(sq["domainTag"]),
662
+ statusLabel: squadStatusLabel(Number(sq["status"])),
663
+ creator: truncateAddr(String(sq["creator"])),
664
+ memberCount: Number(sq["memberCount"]),
665
+ inviteOnly: Boolean(sq["inviteOnly"]),
666
+ briefings: [{ preview: formatElapsed(Number(sq["createdAt"])), publishedLabel: "created" }],
667
+ });
668
+ writeTuiLine("");
669
+ }
670
+ }
671
+ async function executeArenaSquadInfoKernel(squadIdArg) {
672
+ const rawId = parseSquadId(squadIdArg).toString();
673
+ // Subgraph stores squad IDs as the raw decimal integer from the contract event.
674
+ // Try the raw integer first, then the hex form used in formatSquadId if not found.
675
+ let data = await arenaGql(`{
676
+ researchSquad(id: "${rawId}") {
677
+ id name domainTag creator status inviteOnly memberCount
678
+ }
679
+ contributions(where: { squad: "${rawId}" }, first: 10, orderBy: timestamp, orderDirection: desc) {
680
+ id description timestamp author
681
+ }
682
+ squadMembers: contributions(where: { squad: "${rawId}" }, first: 100) {
683
+ author
684
+ }
685
+ }`);
686
+ let squad = data["researchSquad"];
687
+ // Subgraph may not have indexed this squad yet or ID form may differ
688
+ if (!squad) {
689
+ const { writeTuiLine } = await import("./render-inline");
690
+ writeTuiLine("◈ Squad");
691
+ writeTuiLine(separator());
692
+ writeTuiLine(` Squad not found: ${squadIdArg}`);
693
+ writeTuiLine(" The subgraph may not have indexed this squad yet.");
694
+ return;
695
+ }
696
+ // Unique authors as member proxies (contributions schema)
697
+ const allContribs = (data["squadMembers"] ?? []);
698
+ const seenAuthors = new Set();
699
+ const members = allContribs
700
+ .filter((c) => {
701
+ const author = String(c["author"] ?? "");
702
+ if (!author || seenAuthors.has(author))
703
+ return false;
704
+ seenAuthors.add(author);
705
+ return true;
706
+ })
707
+ .map((c) => ({
708
+ agent: truncateAddr(String(c["author"])),
709
+ role: "contributor",
710
+ }));
711
+ const briefings = (data["contributions"] ?? []).map((contribution) => {
712
+ const b = contribution;
713
+ return {
714
+ preview: String(b["description"] ?? "contribution"),
715
+ publishedLabel: formatElapsed(Number(b["timestamp"] ?? 0)),
716
+ };
717
+ });
718
+ await (0, command_renderers_1.printSquadCard)({
719
+ id: formatSquadId(BigInt(String(squad["id"]))),
720
+ name: String(squad["name"]),
721
+ domainTag: String(squad["domainTag"]),
722
+ statusLabel: squadStatusLabel(Number(squad["status"])),
723
+ creator: truncateAddr(String(squad["creator"])),
724
+ memberCount: Number(squad["memberCount"]),
725
+ inviteOnly: Boolean(squad["inviteOnly"]),
726
+ members,
727
+ briefings,
728
+ });
729
+ }
730
+ function readFlag(args, flag) {
731
+ const idx = args.indexOf(flag);
732
+ return idx >= 0 ? args[idx + 1] : undefined;
733
+ }
734
+ //# sourceMappingURL=kernel.js.map