oneie 3.8.2 → 4.0.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 (373) hide show
  1. package/LICENSE +86 -0
  2. package/README.md +63 -952
  3. package/dist/package.json +38 -0
  4. package/dist/src/agent.d.ts +2 -0
  5. package/dist/src/agent.js +888 -0
  6. package/dist/src/args.d.ts +9 -0
  7. package/dist/src/args.js +61 -0
  8. package/dist/src/auth.d.ts +6 -0
  9. package/dist/src/auth.js +122 -0
  10. package/dist/src/broadcast.d.ts +6 -0
  11. package/dist/src/broadcast.js +150 -0
  12. package/dist/src/catalog.d.ts +2 -0
  13. package/dist/src/catalog.js +78 -0
  14. package/dist/src/chat.d.ts +2 -0
  15. package/dist/src/chat.js +92 -0
  16. package/dist/src/client.d.ts +5 -0
  17. package/dist/src/client.js +151 -0
  18. package/dist/src/compiler.d.ts +36 -0
  19. package/dist/src/compiler.js +314 -0
  20. package/dist/src/config.d.ts +24 -0
  21. package/dist/src/config.js +70 -0
  22. package/dist/src/connect.d.ts +2 -0
  23. package/dist/src/connect.js +64 -0
  24. package/dist/src/coordinate.d.ts +3 -0
  25. package/dist/src/coordinate.js +58 -0
  26. package/dist/src/create.d.ts +2 -0
  27. package/dist/src/create.js +106 -0
  28. package/dist/src/deploy.d.ts +2 -0
  29. package/dist/src/deploy.js +19 -0
  30. package/dist/src/dev.d.ts +2 -0
  31. package/dist/src/dev.js +75 -0
  32. package/dist/src/device-flow.d.ts +57 -0
  33. package/dist/src/device-flow.js +173 -0
  34. package/dist/src/doctor.d.ts +26 -0
  35. package/dist/src/doctor.js +91 -0
  36. package/dist/src/env.d.ts +3 -0
  37. package/dist/src/env.js +37 -0
  38. package/dist/src/eval.d.ts +2 -0
  39. package/dist/src/eval.js +42 -0
  40. package/dist/src/fn.d.ts +2 -0
  41. package/dist/src/fn.js +73 -0
  42. package/dist/src/group.d.ts +2 -0
  43. package/dist/src/group.js +115 -0
  44. package/dist/src/index.d.ts +2 -0
  45. package/dist/src/index.js +101 -0
  46. package/dist/src/init.d.ts +11 -0
  47. package/dist/src/init.js +121 -0
  48. package/dist/src/lib/agent-env.d.ts +5 -0
  49. package/dist/src/lib/agent-env.js +25 -0
  50. package/dist/src/lib/api-path.d.ts +1 -0
  51. package/dist/src/lib/api-path.js +9 -0
  52. package/dist/src/lib/client.d.ts +16 -0
  53. package/dist/src/lib/client.js +57 -0
  54. package/dist/src/links.d.ts +5 -0
  55. package/dist/src/links.js +44 -0
  56. package/dist/src/onboard.d.ts +16 -0
  57. package/dist/src/onboard.js +146 -0
  58. package/dist/src/plugin.d.ts +2 -0
  59. package/dist/src/plugin.js +184 -0
  60. package/dist/src/push.d.ts +2 -0
  61. package/dist/src/push.js +114 -0
  62. package/dist/src/render.d.ts +20 -0
  63. package/dist/src/render.js +32 -0
  64. package/dist/src/setup.d.ts +6 -0
  65. package/dist/src/setup.js +118 -0
  66. package/dist/src/ship.d.ts +2 -0
  67. package/dist/src/ship.js +18 -0
  68. package/dist/src/skill-parser.d.ts +14 -0
  69. package/dist/src/skill-parser.js +113 -0
  70. package/dist/src/skill.d.ts +2 -0
  71. package/dist/src/skill.js +377 -0
  72. package/dist/src/slug.d.ts +2 -0
  73. package/dist/src/slug.js +6 -0
  74. package/dist/src/social.d.ts +2 -0
  75. package/dist/src/social.js +87 -0
  76. package/dist/src/staff.d.ts +2 -0
  77. package/dist/src/staff.js +93 -0
  78. package/dist/src/status.d.ts +2 -0
  79. package/dist/src/status.js +38 -0
  80. package/dist/src/substrate.d.ts +2 -0
  81. package/dist/src/substrate.js +243 -0
  82. package/dist/src/templates.d.ts +1 -0
  83. package/dist/src/templates.js +205 -0
  84. package/dist/src/trade.d.ts +2 -0
  85. package/dist/src/trade.js +95 -0
  86. package/dist/src/trail.d.ts +2 -0
  87. package/dist/src/trail.js +41 -0
  88. package/dist/src/validate.d.ts +13 -0
  89. package/dist/src/validate.js +35 -0
  90. package/dist/src/wallet.d.ts +9 -0
  91. package/dist/src/wallet.js +209 -0
  92. package/package.json +26 -54
  93. package/LICENSE.md +0 -89
  94. package/dist/admin/build.d.ts +0 -15
  95. package/dist/admin/build.d.ts.map +0 -1
  96. package/dist/admin/build.js +0 -295
  97. package/dist/admin/build.js.map +0 -1
  98. package/dist/admin/index.d.ts +0 -24
  99. package/dist/admin/index.d.ts.map +0 -1
  100. package/dist/admin/index.js +0 -98
  101. package/dist/admin/index.js.map +0 -1
  102. package/dist/admin/list.d.ts +0 -14
  103. package/dist/admin/list.d.ts.map +0 -1
  104. package/dist/admin/list.js +0 -90
  105. package/dist/admin/list.js.map +0 -1
  106. package/dist/admin/manifest.d.ts +0 -86
  107. package/dist/admin/manifest.d.ts.map +0 -1
  108. package/dist/admin/manifest.js +0 -183
  109. package/dist/admin/manifest.js.map +0 -1
  110. package/dist/admin/monorepo.d.ts +0 -25
  111. package/dist/admin/monorepo.d.ts.map +0 -1
  112. package/dist/admin/monorepo.js +0 -59
  113. package/dist/admin/monorepo.js.map +0 -1
  114. package/dist/admin/release.d.ts +0 -17
  115. package/dist/admin/release.d.ts.map +0 -1
  116. package/dist/admin/release.js +0 -144
  117. package/dist/admin/release.js.map +0 -1
  118. package/dist/admin/sync.d.ts +0 -14
  119. package/dist/admin/sync.d.ts.map +0 -1
  120. package/dist/admin/sync.js +0 -104
  121. package/dist/admin/sync.js.map +0 -1
  122. package/dist/admin/validate.d.ts +0 -15
  123. package/dist/admin/validate.d.ts.map +0 -1
  124. package/dist/admin/validate.js +0 -169
  125. package/dist/admin/validate.js.map +0 -1
  126. package/dist/banner.d.ts +0 -2
  127. package/dist/banner.d.ts.map +0 -1
  128. package/dist/banner.js +0 -15
  129. package/dist/banner.js.map +0 -1
  130. package/dist/clone-docs.d.ts +0 -17
  131. package/dist/clone-docs.d.ts.map +0 -1
  132. package/dist/clone-docs.js +0 -62
  133. package/dist/clone-docs.js.map +0 -1
  134. package/dist/clone-web.d.ts +0 -12
  135. package/dist/clone-web.d.ts.map +0 -1
  136. package/dist/clone-web.js +0 -50
  137. package/dist/clone-web.js.map +0 -1
  138. package/dist/commands/agent.d.ts +0 -20
  139. package/dist/commands/agent.d.ts.map +0 -1
  140. package/dist/commands/agent.js +0 -315
  141. package/dist/commands/agent.js.map +0 -1
  142. package/dist/commands/ask.d.ts +0 -4
  143. package/dist/commands/ask.d.ts.map +0 -1
  144. package/dist/commands/ask.js +0 -8
  145. package/dist/commands/ask.js.map +0 -1
  146. package/dist/commands/bounty.d.ts +0 -4
  147. package/dist/commands/bounty.d.ts.map +0 -1
  148. package/dist/commands/bounty.js +0 -24
  149. package/dist/commands/bounty.js.map +0 -1
  150. package/dist/commands/buy.d.ts +0 -19
  151. package/dist/commands/buy.d.ts.map +0 -1
  152. package/dist/commands/buy.js +0 -63
  153. package/dist/commands/buy.js.map +0 -1
  154. package/dist/commands/capabilities.d.ts +0 -4
  155. package/dist/commands/capabilities.d.ts.map +0 -1
  156. package/dist/commands/capabilities.js +0 -18
  157. package/dist/commands/capabilities.js.map +0 -1
  158. package/dist/commands/claw.d.ts +0 -4
  159. package/dist/commands/claw.d.ts.map +0 -1
  160. package/dist/commands/claw.js +0 -14
  161. package/dist/commands/claw.js.map +0 -1
  162. package/dist/commands/commend.d.ts +0 -4
  163. package/dist/commands/commend.d.ts.map +0 -1
  164. package/dist/commands/commend.js +0 -13
  165. package/dist/commands/commend.js.map +0 -1
  166. package/dist/commands/completion.d.ts +0 -4
  167. package/dist/commands/completion.d.ts.map +0 -1
  168. package/dist/commands/completion.js +0 -49
  169. package/dist/commands/completion.js.map +0 -1
  170. package/dist/commands/config.d.ts +0 -4
  171. package/dist/commands/config.d.ts.map +0 -1
  172. package/dist/commands/config.js +0 -78
  173. package/dist/commands/config.js.map +0 -1
  174. package/dist/commands/deploy.d.ts +0 -4
  175. package/dist/commands/deploy.d.ts.map +0 -1
  176. package/dist/commands/deploy.js +0 -45
  177. package/dist/commands/deploy.js.map +0 -1
  178. package/dist/commands/doctor.d.ts +0 -4
  179. package/dist/commands/doctor.d.ts.map +0 -1
  180. package/dist/commands/doctor.js +0 -72
  181. package/dist/commands/doctor.js.map +0 -1
  182. package/dist/commands/domain.d.ts +0 -4
  183. package/dist/commands/domain.d.ts.map +0 -1
  184. package/dist/commands/domain.js +0 -19
  185. package/dist/commands/domain.js.map +0 -1
  186. package/dist/commands/export.d.ts +0 -4
  187. package/dist/commands/export.d.ts.map +0 -1
  188. package/dist/commands/export.js +0 -15
  189. package/dist/commands/export.js.map +0 -1
  190. package/dist/commands/fade.d.ts +0 -4
  191. package/dist/commands/fade.d.ts.map +0 -1
  192. package/dist/commands/fade.js +0 -15
  193. package/dist/commands/fade.js.map +0 -1
  194. package/dist/commands/flag.d.ts +0 -4
  195. package/dist/commands/flag.d.ts.map +0 -1
  196. package/dist/commands/flag.js +0 -13
  197. package/dist/commands/flag.js.map +0 -1
  198. package/dist/commands/forget.d.ts +0 -4
  199. package/dist/commands/forget.d.ts.map +0 -1
  200. package/dist/commands/forget.js +0 -16
  201. package/dist/commands/forget.js.map +0 -1
  202. package/dist/commands/frontier.d.ts +0 -4
  203. package/dist/commands/frontier.d.ts.map +0 -1
  204. package/dist/commands/frontier.js +0 -11
  205. package/dist/commands/frontier.js.map +0 -1
  206. package/dist/commands/health.d.ts +0 -4
  207. package/dist/commands/health.d.ts.map +0 -1
  208. package/dist/commands/health.js +0 -11
  209. package/dist/commands/health.js.map +0 -1
  210. package/dist/commands/highways.d.ts +0 -4
  211. package/dist/commands/highways.d.ts.map +0 -1
  212. package/dist/commands/highways.js +0 -14
  213. package/dist/commands/highways.js.map +0 -1
  214. package/dist/commands/hire.d.ts +0 -4
  215. package/dist/commands/hire.d.ts.map +0 -1
  216. package/dist/commands/hire.js +0 -16
  217. package/dist/commands/hire.js.map +0 -1
  218. package/dist/commands/init.d.ts +0 -17
  219. package/dist/commands/init.d.ts.map +0 -1
  220. package/dist/commands/init.js +0 -308
  221. package/dist/commands/init.js.map +0 -1
  222. package/dist/commands/invite.d.ts +0 -4
  223. package/dist/commands/invite.d.ts.map +0 -1
  224. package/dist/commands/invite.js +0 -37
  225. package/dist/commands/invite.js.map +0 -1
  226. package/dist/commands/know.d.ts +0 -4
  227. package/dist/commands/know.d.ts.map +0 -1
  228. package/dist/commands/know.js +0 -8
  229. package/dist/commands/know.js.map +0 -1
  230. package/dist/commands/launch.d.ts +0 -4
  231. package/dist/commands/launch.d.ts.map +0 -1
  232. package/dist/commands/launch.js +0 -16
  233. package/dist/commands/launch.js.map +0 -1
  234. package/dist/commands/mark.d.ts +0 -4
  235. package/dist/commands/mark.d.ts.map +0 -1
  236. package/dist/commands/mark.js +0 -15
  237. package/dist/commands/mark.js.map +0 -1
  238. package/dist/commands/pay.d.ts +0 -4
  239. package/dist/commands/pay.d.ts.map +0 -1
  240. package/dist/commands/pay.js +0 -21
  241. package/dist/commands/pay.js.map +0 -1
  242. package/dist/commands/pipe.d.ts +0 -4
  243. package/dist/commands/pipe.d.ts.map +0 -1
  244. package/dist/commands/pipe.js +0 -35
  245. package/dist/commands/pipe.js.map +0 -1
  246. package/dist/commands/publish.d.ts +0 -4
  247. package/dist/commands/publish.d.ts.map +0 -1
  248. package/dist/commands/publish.js +0 -23
  249. package/dist/commands/publish.js.map +0 -1
  250. package/dist/commands/recall.d.ts +0 -4
  251. package/dist/commands/recall.d.ts.map +0 -1
  252. package/dist/commands/recall.js +0 -12
  253. package/dist/commands/recall.js.map +0 -1
  254. package/dist/commands/repl.d.ts +0 -4
  255. package/dist/commands/repl.d.ts.map +0 -1
  256. package/dist/commands/repl.js +0 -56
  257. package/dist/commands/repl.js.map +0 -1
  258. package/dist/commands/reveal.d.ts +0 -4
  259. package/dist/commands/reveal.d.ts.map +0 -1
  260. package/dist/commands/reveal.js +0 -11
  261. package/dist/commands/reveal.js.map +0 -1
  262. package/dist/commands/revenue.d.ts +0 -4
  263. package/dist/commands/revenue.d.ts.map +0 -1
  264. package/dist/commands/revenue.js +0 -11
  265. package/dist/commands/revenue.js.map +0 -1
  266. package/dist/commands/select.d.ts +0 -4
  267. package/dist/commands/select.d.ts.map +0 -1
  268. package/dist/commands/select.js +0 -19
  269. package/dist/commands/select.js.map +0 -1
  270. package/dist/commands/sell.d.ts +0 -15
  271. package/dist/commands/sell.d.ts.map +0 -1
  272. package/dist/commands/sell.js +0 -49
  273. package/dist/commands/sell.js.map +0 -1
  274. package/dist/commands/signal.d.ts +0 -4
  275. package/dist/commands/signal.d.ts.map +0 -1
  276. package/dist/commands/signal.js +0 -8
  277. package/dist/commands/signal.js.map +0 -1
  278. package/dist/commands/stats.d.ts +0 -4
  279. package/dist/commands/stats.d.ts.map +0 -1
  280. package/dist/commands/stats.js +0 -11
  281. package/dist/commands/stats.js.map +0 -1
  282. package/dist/commands/status.d.ts +0 -4
  283. package/dist/commands/status.d.ts.map +0 -1
  284. package/dist/commands/status.js +0 -18
  285. package/dist/commands/status.js.map +0 -1
  286. package/dist/commands/subscribe.d.ts +0 -14
  287. package/dist/commands/subscribe.d.ts.map +0 -1
  288. package/dist/commands/subscribe.js +0 -33
  289. package/dist/commands/subscribe.js.map +0 -1
  290. package/dist/commands/sync.d.ts +0 -4
  291. package/dist/commands/sync.d.ts.map +0 -1
  292. package/dist/commands/sync.js +0 -20
  293. package/dist/commands/sync.js.map +0 -1
  294. package/dist/commands/tail.d.ts +0 -4
  295. package/dist/commands/tail.d.ts.map +0 -1
  296. package/dist/commands/tail.js +0 -51
  297. package/dist/commands/tail.js.map +0 -1
  298. package/dist/commands/warn.d.ts +0 -4
  299. package/dist/commands/warn.d.ts.map +0 -1
  300. package/dist/commands/warn.js +0 -15
  301. package/dist/commands/warn.js.map +0 -1
  302. package/dist/copy-claude-config.d.ts +0 -2
  303. package/dist/copy-claude-config.d.ts.map +0 -1
  304. package/dist/copy-claude-config.js +0 -32
  305. package/dist/copy-claude-config.js.map +0 -1
  306. package/dist/create-org-profile.d.ts +0 -10
  307. package/dist/create-org-profile.d.ts.map +0 -1
  308. package/dist/create-org-profile.js +0 -136
  309. package/dist/create-org-profile.js.map +0 -1
  310. package/dist/create-user-profile.d.ts +0 -9
  311. package/dist/create-user-profile.d.ts.map +0 -1
  312. package/dist/create-user-profile.js +0 -115
  313. package/dist/create-user-profile.js.map +0 -1
  314. package/dist/index.d.ts +0 -3
  315. package/dist/index.d.ts.map +0 -1
  316. package/dist/index.js +0 -365
  317. package/dist/index.js.map +0 -1
  318. package/dist/lib/agent-detection.d.ts +0 -19
  319. package/dist/lib/agent-detection.d.ts.map +0 -1
  320. package/dist/lib/agent-detection.js +0 -87
  321. package/dist/lib/agent-detection.js.map +0 -1
  322. package/dist/lib/args.d.ts +0 -11
  323. package/dist/lib/args.d.ts.map +0 -1
  324. package/dist/lib/args.js +0 -57
  325. package/dist/lib/args.js.map +0 -1
  326. package/dist/lib/config.d.ts +0 -12
  327. package/dist/lib/config.d.ts.map +0 -1
  328. package/dist/lib/config.js +0 -38
  329. package/dist/lib/config.js.map +0 -1
  330. package/dist/lib/detect.d.ts +0 -45
  331. package/dist/lib/detect.d.ts.map +0 -1
  332. package/dist/lib/detect.js +0 -221
  333. package/dist/lib/detect.js.map +0 -1
  334. package/dist/lib/http.d.ts +0 -9
  335. package/dist/lib/http.d.ts.map +0 -1
  336. package/dist/lib/http.js +0 -25
  337. package/dist/lib/http.js.map +0 -1
  338. package/dist/lib/output.d.ts +0 -5
  339. package/dist/lib/output.d.ts.map +0 -1
  340. package/dist/lib/output.js +0 -32
  341. package/dist/lib/output.js.map +0 -1
  342. package/dist/lib/sdk.d.ts +0 -10
  343. package/dist/lib/sdk.d.ts.map +0 -1
  344. package/dist/lib/sdk.js +0 -22
  345. package/dist/lib/sdk.js.map +0 -1
  346. package/dist/lib/telemetry.d.ts +0 -4
  347. package/dist/lib/telemetry.d.ts.map +0 -1
  348. package/dist/lib/telemetry.js +0 -61
  349. package/dist/lib/telemetry.js.map +0 -1
  350. package/dist/sync-agents.d.ts +0 -5
  351. package/dist/sync-agents.d.ts.map +0 -1
  352. package/dist/sync-agents.js +0 -28
  353. package/dist/sync-agents.js.map +0 -1
  354. package/dist/sync-ontology.d.ts +0 -4
  355. package/dist/sync-ontology.d.ts.map +0 -1
  356. package/dist/sync-ontology.js +0 -40
  357. package/dist/sync-ontology.js.map +0 -1
  358. package/dist/utils/file-resolver.d.ts +0 -83
  359. package/dist/utils/file-resolver.d.ts.map +0 -1
  360. package/dist/utils/file-resolver.js +0 -194
  361. package/dist/utils/file-resolver.js.map +0 -1
  362. package/dist/utils/installation-setup.d.ts +0 -88
  363. package/dist/utils/installation-setup.d.ts.map +0 -1
  364. package/dist/utils/installation-setup.js +0 -409
  365. package/dist/utils/installation-setup.js.map +0 -1
  366. package/dist/utils/launch-claude.d.ts +0 -7
  367. package/dist/utils/launch-claude.d.ts.map +0 -1
  368. package/dist/utils/launch-claude.js +0 -86
  369. package/dist/utils/launch-claude.js.map +0 -1
  370. package/dist/utils/validation.d.ts +0 -48
  371. package/dist/utils/validation.d.ts.map +0 -1
  372. package/dist/utils/validation.js +0 -73
  373. package/dist/utils/validation.js.map +0 -1
@@ -0,0 +1,93 @@
1
+ import { Command } from 'commander';
2
+ import { authHeaders, out, resolveBase, resolveKey } from './lib/client.js';
3
+ const DEFAULT_API = resolveBase({}, 'https://one.ie');
4
+ const VALID_ROLES = ['owner', 'admin', 'member', 'viewer'];
5
+ export function staffCmd() {
6
+ const cmd = new Command('staff').description('Workspace staff management');
7
+ cmd
8
+ .command('invite [email]')
9
+ .description('Invite a human to your workspace; omit email to get an invite URL without sending mail')
10
+ .option('--role <role>', `Role to assign: ${VALID_ROLES.join('|')}`, 'admin')
11
+ .option('--workspace <slug>', 'Workspace slug (defaults to authenticated workspace)')
12
+ .option('--dry-run', 'Print plan without sending invite')
13
+ .option('--api <url>', 'API base URL', DEFAULT_API)
14
+ .action(async (email, opts) => {
15
+ const role = opts.role;
16
+ if (!VALID_ROLES.includes(role)) {
17
+ out(cmd, { ok: false, error: `--role must be one of: ${VALID_ROLES.join(', ')}` });
18
+ return;
19
+ }
20
+ if (opts.dryRun) {
21
+ out(cmd, { ok: true, dry_run: true, email: email ?? '(url-only)', role, workspace: opts.workspace ?? '(authenticated)' });
22
+ return;
23
+ }
24
+ const key = resolveKey();
25
+ if (!key) {
26
+ out(cmd, { ok: false, error: 'no API key — set ONEIE_API_KEY or run: oneie auth login' });
27
+ return;
28
+ }
29
+ const base = opts.api.replace(/\/$/, '');
30
+ const body = { role };
31
+ if (email)
32
+ body.email = email;
33
+ if (opts.workspace)
34
+ body.workspace = opts.workspace;
35
+ const res = await fetch(`${base}/api/ask/world:invite-member`, {
36
+ method: 'POST',
37
+ headers: authHeaders({ key }),
38
+ body: JSON.stringify({ data: body }),
39
+ });
40
+ if (!res.ok) {
41
+ const text = await res.text().catch(() => '');
42
+ out(cmd, { ok: false, error: `${res.status}: ${text}` });
43
+ return;
44
+ }
45
+ const json = (await res.json());
46
+ if (json.error) {
47
+ out(cmd, { ok: false, error: json.error });
48
+ return;
49
+ }
50
+ const inviteUrl = json.inviteUrl ?? (json.token ? `${base}/join?token=${encodeURIComponent(json.token)}` : undefined);
51
+ out(cmd, { ok: true, email: email ?? '(url-only)', role, invite_url: inviteUrl ?? '(sent)' });
52
+ });
53
+ cmd
54
+ .command('add-agent <name>')
55
+ .description('Create an agent in your workspace and print its key once')
56
+ .option('--role <role>', `Role to assign: ${VALID_ROLES.join('|')}`, 'member')
57
+ .option('--workspace <slug>', 'Workspace slug (defaults to authenticated workspace)')
58
+ .option('--api <url>', 'API base URL', DEFAULT_API)
59
+ .action(async (name, opts) => {
60
+ const role = opts.role;
61
+ if (!VALID_ROLES.includes(role)) {
62
+ out(cmd, { ok: false, error: `--role must be one of: ${VALID_ROLES.join(', ')}` });
63
+ return;
64
+ }
65
+ const key = resolveKey();
66
+ if (!key) {
67
+ out(cmd, { ok: false, error: 'no API key — set ONEIE_API_KEY or run: oneie auth login' });
68
+ return;
69
+ }
70
+ const base = opts.api.replace(/\/$/, '');
71
+ const body = { name, role };
72
+ if (opts.workspace)
73
+ body.workspace = opts.workspace;
74
+ const res = await fetch(`${base}/api/ask/world:invite-agent`, {
75
+ method: 'POST',
76
+ headers: authHeaders({ key }),
77
+ body: JSON.stringify({ data: body }),
78
+ });
79
+ if (!res.ok) {
80
+ const text = await res.text().catch(() => '');
81
+ out(cmd, { ok: false, error: `${res.status}: ${text}` });
82
+ return;
83
+ }
84
+ const json = (await res.json());
85
+ if (json.error) {
86
+ out(cmd, { ok: false, error: json.error });
87
+ return;
88
+ }
89
+ const result = json.result ?? json;
90
+ out(cmd, { ok: true, name, role, aid: result.aid, key: result.key });
91
+ });
92
+ return cmd;
93
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function statusCmd(): Command;
@@ -0,0 +1,38 @@
1
+ import { Command } from 'commander';
2
+ import { mergeEnv } from './env.js';
3
+ import { renderStatus } from './render.js';
4
+ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
5
+ export function statusCmd() {
6
+ return new Command('status')
7
+ .description('Agency P&L dashboard (pool, margin, per-client burns)')
8
+ .option('--api <url>', 'API base URL', DEFAULT_API)
9
+ .option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
10
+ .option('--json', 'Output raw JSON')
11
+ .action(async (opts) => {
12
+ const dir = process.cwd();
13
+ const env = mergeEnv(dir);
14
+ const key = opts.key ?? env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? '';
15
+ if (!key || !env.AGENCY_SLUG) {
16
+ process.stderr.write('not set up — run `one setup` first\n');
17
+ process.exit(1);
18
+ }
19
+ const base = opts.api.replace(/\/$/, '');
20
+ const res = await fetch(`${base}/api/ask/${encodeURIComponent('billing:clients')}`, {
21
+ method: 'POST',
22
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
23
+ body: JSON.stringify({ data: {} }),
24
+ });
25
+ if (!res.ok) {
26
+ process.stderr.write(`billing:clients → ${res.status}\n`);
27
+ process.exit(1);
28
+ }
29
+ const data = await res.json();
30
+ if (opts.json) {
31
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
32
+ return;
33
+ }
34
+ const agency = (data.agency ?? { slug: env.AGENCY_SLUG, name: env.AGENCY_NAME ?? null, markup_pct: 0, pool: 0 });
35
+ const clients = (data.clients ?? []);
36
+ process.stdout.write(renderStatus(agency, clients) + '\n');
37
+ });
38
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function substrateCommands(program: Command): void;
@@ -0,0 +1,243 @@
1
+ import { authHeaders, resolveBase } from './lib/client.js';
2
+ const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
3
+ function base(opts) {
4
+ return resolveBase(opts, 'https://api.one.ie');
5
+ }
6
+ async function api(url, init) {
7
+ const res = await fetch(url, { headers: authHeaders(), ...init });
8
+ if (!res.ok) {
9
+ const body = await res.text().catch(() => '');
10
+ process.stderr.write(`${init?.method ?? 'GET'} ${url} → ${res.status}\n${body}\n`);
11
+ process.exit(1);
12
+ }
13
+ const ct = res.headers.get('content-type') ?? '';
14
+ return ct.includes('json') ? res.json() : res.text();
15
+ }
16
+ function out(data) {
17
+ process.stdout.write(JSON.stringify(data, null, 2) + '\n');
18
+ }
19
+ function parseJson(raw, flag) {
20
+ try {
21
+ return JSON.parse(raw);
22
+ }
23
+ catch {
24
+ process.stderr.write(`error: ${flag} must be valid JSON\n`);
25
+ process.exit(1);
26
+ }
27
+ }
28
+ async function readStdin() {
29
+ return new Promise((resolve) => {
30
+ let buf = '';
31
+ process.stdin.setEncoding('utf8');
32
+ process.stdin.on('data', (chunk) => { buf += chunk; });
33
+ process.stdin.on('end', () => resolve(buf.trim()));
34
+ });
35
+ }
36
+ export function substrateCommands(program) {
37
+ program
38
+ .command('signal <receiver>')
39
+ .description('Fire-and-forget signal to any receiver')
40
+ .option('--data <json>', 'Signal data as JSON. Use "-" to read from stdin.')
41
+ .option('--api <url>', 'API base URL', DEFAULT_API)
42
+ .action(async (receiver, opts) => {
43
+ let data;
44
+ if (opts.data === '-')
45
+ data = parseJson(await readStdin(), '--data');
46
+ else if (opts.data)
47
+ data = parseJson(opts.data, '--data');
48
+ out(await api(`${base(opts)}/api/signal/${encodeURIComponent(receiver)}`, {
49
+ method: 'POST',
50
+ body: JSON.stringify({ data }),
51
+ }));
52
+ });
53
+ program
54
+ .command('ask <receiver>')
55
+ .description('Signal + wait for outcome (result | timeout | dissolved | failure)')
56
+ .option('--data <json>', 'Signal data as JSON. Use "-" to read from stdin.')
57
+ .option('--timeout <ms>', 'Timeout in milliseconds', '10000')
58
+ .option('--api <url>', 'API base URL', DEFAULT_API)
59
+ .action(async (receiver, opts) => {
60
+ let data;
61
+ if (opts.data === '-')
62
+ data = parseJson(await readStdin(), '--data');
63
+ else if (opts.data)
64
+ data = parseJson(opts.data, '--data');
65
+ out(await api(`${base(opts)}/api/ask/${encodeURIComponent(receiver)}`, {
66
+ method: 'POST',
67
+ body: JSON.stringify({ data, timeoutMs: Number(opts.timeout) }),
68
+ }));
69
+ });
70
+ program
71
+ .command('mark <edge>')
72
+ .description('Strengthen a path. Edge format: source>target')
73
+ .option('--strength <n>', 'Strength value', '1')
74
+ .option('--api <url>', 'API base URL', DEFAULT_API)
75
+ .action(async (edge, opts) => {
76
+ out(await api(`${base(opts)}/api/mark/${encodeURIComponent(edge)}`, {
77
+ method: 'POST',
78
+ body: JSON.stringify({ strength: Number(opts.strength) }),
79
+ }));
80
+ });
81
+ program
82
+ .command('warn <edge>')
83
+ .description('Raise resistance on a path. Edge format: source>target')
84
+ .option('--strength <n>', 'Strength value', '1')
85
+ .option('--api <url>', 'API base URL', DEFAULT_API)
86
+ .action(async (edge, opts) => {
87
+ out(await api(`${base(opts)}/api/warn/${encodeURIComponent(edge)}`, {
88
+ method: 'POST',
89
+ body: JSON.stringify({ strength: Number(opts.strength) }),
90
+ }));
91
+ });
92
+ program
93
+ .command('fade')
94
+ .description('Asymmetric decay of all paths')
95
+ .option('--rate <n>', 'Decay rate 0–1')
96
+ .option('--api <url>', 'API base URL', DEFAULT_API)
97
+ .action(async (opts) => {
98
+ out(await api(`${base(opts)}/api/fade`, {
99
+ method: 'POST',
100
+ body: JSON.stringify({ rate: opts.rate !== undefined ? Number(opts.rate) : undefined }),
101
+ }));
102
+ });
103
+ program
104
+ .command('sub <tag> <actor>')
105
+ .description('Subscribe an actor to a tag')
106
+ .option('--scope <scope>', 'private | public', 'private')
107
+ .option('--api <url>', 'API base URL', DEFAULT_API)
108
+ .action(async (tag, actor, opts) => {
109
+ out(await api(`${base(opts)}/api/sub`, {
110
+ method: 'POST',
111
+ body: JSON.stringify({ receiver: actor, tags: [tag], scope: opts.scope }),
112
+ }));
113
+ });
114
+ program
115
+ .command('follow <type>')
116
+ .description('Deterministic path selection — strongest path for a type')
117
+ .option('--api <url>', 'API base URL', DEFAULT_API)
118
+ .action(async (type, opts) => {
119
+ out(await api(`${base(opts)}/api/follow?tag=${encodeURIComponent(type)}`));
120
+ });
121
+ program
122
+ .command('select <type>')
123
+ .description('Probabilistic path selection (strength-weighted)')
124
+ .option('--exploration <n>', 'Exploration factor 0–1')
125
+ .option('--api <url>', 'API base URL', DEFAULT_API)
126
+ .action(async (type, opts) => {
127
+ const q = new URLSearchParams({ type });
128
+ if (opts.exploration)
129
+ q.set('exploration', opts.exploration);
130
+ out(await api(`${base(opts)}/api/select?${q}`));
131
+ });
132
+ program
133
+ .command('groups')
134
+ .description('List groups (dimension 1 — containers)')
135
+ .option('--type <type>')
136
+ .option('--limit <n>', 'Max results', '20')
137
+ .option('--after <cursor>', 'Pagination cursor')
138
+ .option('--api <url>', 'API base URL', DEFAULT_API)
139
+ .action(async (opts) => {
140
+ const q = new URLSearchParams({ limit: opts.limit });
141
+ if (opts.type)
142
+ q.set('type', opts.type);
143
+ if (opts.after)
144
+ q.set('after', opts.after);
145
+ out(await api(`${base(opts)}/api/export/groups?${q}`));
146
+ });
147
+ program
148
+ .command('actors')
149
+ .description('List actors (dimension 2 — humans, agents, bots)')
150
+ .option('--type <type>')
151
+ .option('--tag <tag>')
152
+ .option('--limit <n>', 'Max results', '20')
153
+ .option('--after <cursor>')
154
+ .option('--api <url>', 'API base URL', DEFAULT_API)
155
+ .action(async (opts) => {
156
+ const q = new URLSearchParams({ limit: opts.limit });
157
+ if (opts.type)
158
+ q.set('type', opts.type);
159
+ if (opts.tag)
160
+ q.set('tag', opts.tag);
161
+ if (opts.after)
162
+ q.set('after', opts.after);
163
+ out(await api(`${base(opts)}/api/export/actors?${q}`));
164
+ });
165
+ program
166
+ .command('things')
167
+ .description('List things (dimension 3 — skills, tasks, tokens)')
168
+ .option('--type <type>')
169
+ .option('--tag <tag>')
170
+ .option('--limit <n>', 'Max results', '20')
171
+ .option('--after <cursor>')
172
+ .option('--api <url>', 'API base URL', DEFAULT_API)
173
+ .action(async (opts) => {
174
+ const q = new URLSearchParams({ limit: opts.limit });
175
+ if (opts.type)
176
+ q.set('type', opts.type);
177
+ if (opts.tag)
178
+ q.set('tag', opts.tag);
179
+ if (opts.after)
180
+ q.set('after', opts.after);
181
+ out(await api(`${base(opts)}/api/things?${q}`));
182
+ });
183
+ program
184
+ .command('paths')
185
+ .description('List paths (dimension 4 — weighted connections)')
186
+ .option('--source <source>')
187
+ .option('--target <target>')
188
+ .option('--min-strength <n>', 'Minimum strength filter')
189
+ .option('--limit <n>', 'Max results', '20')
190
+ .option('--after <cursor>')
191
+ .option('--api <url>', 'API base URL', DEFAULT_API)
192
+ .action(async (opts) => {
193
+ const q = new URLSearchParams({ limit: opts.limit });
194
+ if (opts.source)
195
+ q.set('source', opts.source);
196
+ if (opts.target)
197
+ q.set('target', opts.target);
198
+ if (opts.minStrength)
199
+ q.set('minStrength', opts.minStrength);
200
+ if (opts.after)
201
+ q.set('after', opts.after);
202
+ out(await api(`${base(opts)}/api/export/paths?${q}`));
203
+ });
204
+ program
205
+ .command('events')
206
+ .description('List events (dimension 5 — signals, payments)')
207
+ .option('--actor <actor>')
208
+ .option('--tag <tag>')
209
+ .option('--from <iso>', 'ISO timestamp filter from')
210
+ .option('--to <iso>', 'ISO timestamp filter to')
211
+ .option('--limit <n>', 'Max results', '20')
212
+ .option('--api <url>', 'API base URL', DEFAULT_API)
213
+ .action(async (opts) => {
214
+ const q = new URLSearchParams({ limit: opts.limit });
215
+ if (opts.actor)
216
+ q.set('actor', opts.actor);
217
+ if (opts.tag)
218
+ q.set('tag', opts.tag);
219
+ if (opts.from)
220
+ q.set('from', opts.from);
221
+ if (opts.to)
222
+ q.set('to', opts.to);
223
+ out(await api(`${base(opts)}/api/events?${q}`));
224
+ });
225
+ program
226
+ .command('learning')
227
+ .description('List hypotheses (dimension 6 — what was discovered)')
228
+ .option('--status <status>', 'pending | testing | confirmed | rejected')
229
+ .option('--actor <actor>')
230
+ .option('--tag <tag>')
231
+ .option('--limit <n>', 'Max results', '20')
232
+ .option('--api <url>', 'API base URL', DEFAULT_API)
233
+ .action(async (opts) => {
234
+ const q = new URLSearchParams({ limit: opts.limit });
235
+ if (opts.status)
236
+ q.set('status', opts.status);
237
+ if (opts.actor)
238
+ q.set('actor', opts.actor);
239
+ if (opts.tag)
240
+ q.set('tag', opts.tag);
241
+ out(await api(`${base(opts)}/api/learning?${q}`));
242
+ });
243
+ }
@@ -0,0 +1 @@
1
+ export declare const TEMPLATES: Record<string, string>;
@@ -0,0 +1,205 @@
1
+ export const TEMPLATES = {
2
+ core: `---
3
+ agentmd: "0.1"
4
+ name: template
5
+ title: Template Agent
6
+ model: anthropic/claude-haiku-4-5
7
+ summary: A helpful agent.
8
+ description: Use when you need to accomplish tasks.
9
+ sensitivity: public
10
+ lifecycle: active
11
+ ---
12
+
13
+ You are a helpful assistant. Complete tasks clearly and concisely.
14
+ `,
15
+ commerce: `---
16
+ agentmd: "0.1"
17
+ name: template
18
+ title: Template Commerce Agent
19
+ model: anthropic/claude-haiku-4-5
20
+ summary: An agent that provides paid services.
21
+ description: Use when you need paid skill execution with x402 payments.
22
+ sensitivity: public
23
+ lifecycle: active
24
+ skills: []
25
+ wallet: ""
26
+ accepts:
27
+ - scheme: exact
28
+ network: "eip155:8453"
29
+ asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
30
+ max: "0.05"
31
+ ---
32
+
33
+ You provide services at a fee. Verify payment before executing paid skills.
34
+ `,
35
+ asi: `---
36
+ agentmd: "0.1"
37
+ name: template
38
+ title: Template ASI Agent
39
+ model: anthropic/claude-opus-4-7
40
+ summary: An autonomous agent registered on Fetch.ai Almanac.
41
+ description: Use for long-running autonomous tasks and multi-agent coordination.
42
+ sensitivity: restricted
43
+ lifecycle: active
44
+ mailbox: true
45
+ agentverse: https://agentverse.ai
46
+ intervals:
47
+ - period: 300
48
+ task: Check for new signals and coordinate with peer agents.
49
+ skills: []
50
+ ---
51
+
52
+ You are an autonomous agent. Coordinate with peers, monitor signals, and act on intervals.
53
+ `,
54
+ 'travel-planner': `---
55
+ agentmd: "0.1"
56
+ name: template
57
+ title: Travel Planner
58
+ model: anthropic/claude-sonnet-4-5
59
+ summary: Creates detailed travel itineraries with real logistics and budgets.
60
+ description: Use when you need personalised travel planning — itinerary, budget, packing.
61
+ sensitivity: public
62
+ lifecycle: active
63
+ tools:
64
+ - emit_card
65
+ - emit_chips
66
+ skills:
67
+ - name: plan
68
+ description: Research and create a day-by-day travel itinerary
69
+ price: 0.10
70
+ tags: [travel, planning, itinerary]
71
+ - name: budget
72
+ description: Estimate trip costs including flights, hotels, meals, activities
73
+ price: 0.05
74
+ tags: [travel, budget, finance]
75
+ ---
76
+
77
+ You are a personal travel planner. You turn destinations and dates into detailed, actionable itineraries — real places, real logistics, real costs.
78
+
79
+ Ask first: where, when, how long, who's going, budget range. Then deliver a day-by-day plan with morning/afternoon/evening blocks, transport options, and booking notes.
80
+ `,
81
+ 'marketing-strategist': `---
82
+ agentmd: "0.1"
83
+ name: template
84
+ title: Marketing Strategist
85
+ model: anthropic/claude-sonnet-4-5
86
+ summary: Audits channels, plans campaigns, writes copy, and reads metrics.
87
+ description: Use when you need strategic marketing thinking plus concrete deliverables.
88
+ sensitivity: public
89
+ lifecycle: active
90
+ tools:
91
+ - emit_card
92
+ - emit_chips
93
+ skills:
94
+ - name: audit
95
+ description: Audit existing marketing channels and surface quick wins
96
+ price: 0.08
97
+ tags: [marketing, audit, analysis]
98
+ - name: campaign
99
+ description: Plan a campaign from brief to launch checklist
100
+ price: 0.12
101
+ tags: [marketing, campaign, strategy]
102
+ - name: copy
103
+ description: Write headlines, CTAs, email subjects, ad copy variants
104
+ price: 0.06
105
+ tags: [marketing, copy, writing]
106
+ ---
107
+
108
+ You are a senior marketing strategist. You think in funnels and ICPs, then translate that into concrete copy and launch plans any team can execute.
109
+
110
+ Start by understanding the product, the customer, and the current state of marketing. Then: audit → recommend → plan → execute.
111
+ `,
112
+ 'support-tier1': `---
113
+ agentmd: "0.1"
114
+ name: template
115
+ title: Support — Tier 1
116
+ model: anthropic/claude-sonnet-4-5
117
+ summary: Resolves common support issues fast; escalates edge cases with full context.
118
+ description: Use as a first-line support agent for how-to, account, and billing questions.
119
+ sensitivity: public
120
+ lifecycle: active
121
+ tools:
122
+ - emit_card
123
+ - emit_chips
124
+ skills:
125
+ - name: triage
126
+ description: Classify the issue and route to the right resolution path
127
+ price: 0.02
128
+ tags: [support, triage, routing]
129
+ - name: resolve
130
+ description: Walk the user through a step-by-step fix
131
+ price: 0.03
132
+ tags: [support, resolution, troubleshooting]
133
+ - name: escalate
134
+ description: Prepare a structured escalation summary for Tier 2
135
+ price: 0.02
136
+ tags: [support, escalation, handoff]
137
+ ---
138
+
139
+ You are a Tier 1 support agent. Your job is to resolve common issues fast, escalate edge cases with full context, and leave every user feeling heard.
140
+
141
+ 1. Acknowledge — one sentence that shows you understand the problem. 2. Triage — classify: account / billing / bug / how-to / feature request. 3. Resolve — walk through it step by step. 4. Escalate — prepare a clean handoff summary.
142
+ `,
143
+ 'sales-discovery': `---
144
+ agentmd: "0.1"
145
+ name: template
146
+ title: Sales Discovery
147
+ model: anthropic/claude-sonnet-4-5
148
+ summary: Qualifies leads, preps discovery calls, handles objections, and structures proposals.
149
+ description: Use to accelerate the discovery-to-proposal stage of your sales process.
150
+ sensitivity: restricted
151
+ lifecycle: active
152
+ tools:
153
+ - emit_card
154
+ - emit_chips
155
+ skills:
156
+ - name: qualify
157
+ description: Run a BANT qualification check on an inbound lead
158
+ price: 0.04
159
+ tags: [sales, qualification, lead]
160
+ - name: discovery
161
+ description: Deep-dive discovery call questions for a specific ICP
162
+ price: 0.06
163
+ tags: [sales, discovery, questions]
164
+ - name: proposal
165
+ description: Outline a custom proposal structure for a qualified account
166
+ price: 0.08
167
+ tags: [sales, proposal, closing]
168
+ ---
169
+
170
+ You are a sales discovery specialist. You help sales reps qualify faster, ask sharper questions, and turn stalled conversations into momentum.
171
+
172
+ Start with the lead context: industry, size, role, how they came in. Then run the right playbook: qualify → discover → handle objections → propose.
173
+ `,
174
+ 'code-reviewer': `---
175
+ agentmd: "0.1"
176
+ name: template
177
+ title: Code Reviewer
178
+ model: anthropic/claude-sonnet-4-5
179
+ summary: Gives concrete, severity-labelled code review findings with actionable fixes.
180
+ description: Use for code review, security audits, performance checks, and refactor suggestions.
181
+ sensitivity: restricted
182
+ lifecycle: active
183
+ tools:
184
+ - emit_card
185
+ - emit_chips
186
+ skills:
187
+ - name: review
188
+ description: Full code review with severity-labelled findings
189
+ price: 0.08
190
+ tags: [engineering, review, quality]
191
+ - name: security
192
+ description: Security-focused audit for OWASP Top 10 and common patterns
193
+ price: 0.10
194
+ tags: [engineering, security, audit]
195
+ - name: refactor
196
+ description: Propose a concrete refactor with before/after diffs
197
+ price: 0.08
198
+ tags: [engineering, refactor, design]
199
+ ---
200
+
201
+ You are a senior code reviewer. You give concrete, actionable feedback that improves code quality without creating review theatre.
202
+
203
+ Label every finding: BLOCKER / MAJOR / MINOR / NIT. Always include the specific line reference and a concrete fix — not vague advice.
204
+ `,
205
+ };
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function tradeCommands(program: Command): void;