oneie 5.8.0 → 5.9.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 (270) hide show
  1. package/README.md +114 -6
  2. package/dist/package.json +37 -11
  3. package/dist/src/age-1k8hs4ec.js +1 -0
  4. package/dist/src/client-n6fpnd9f.js +1 -0
  5. package/dist/src/evm-tx-cqhm9rtt.js +1 -0
  6. package/dist/src/hl-run-0pv1e0p2.js +1 -0
  7. package/dist/src/index-f5vhzspa.js +12 -0
  8. package/dist/src/index-h3nrt8bx.js +4 -0
  9. package/dist/src/index-st6k9vhc.js +2062 -0
  10. package/dist/src/index.js +1122 -134
  11. package/dist/src/message-key-yczrxszr.js +1 -0
  12. package/dist/src/message-lock-thr851d5.js +5 -0
  13. package/dist/src/sweep-order-jrq2hkye.js +1 -0
  14. package/dist/src/sweep-runner-jftw9em7.js +1 -0
  15. package/package.json +37 -11
  16. package/dist/src/agent.d.ts +0 -75
  17. package/dist/src/agent.js +0 -1334
  18. package/dist/src/agentverse.d.ts +0 -26
  19. package/dist/src/agentverse.js +0 -171
  20. package/dist/src/args.d.ts +0 -9
  21. package/dist/src/args.js +0 -61
  22. package/dist/src/auth.d.ts +0 -6
  23. package/dist/src/auth.js +0 -121
  24. package/dist/src/balances.d.ts +0 -89
  25. package/dist/src/balances.js +0 -202
  26. package/dist/src/banner.d.ts +0 -1
  27. package/dist/src/banner.js +0 -17
  28. package/dist/src/broadcast.d.ts +0 -8
  29. package/dist/src/broadcast.js +0 -175
  30. package/dist/src/catalog.d.ts +0 -12
  31. package/dist/src/catalog.js +0 -76
  32. package/dist/src/ceiling.d.ts +0 -36
  33. package/dist/src/ceiling.js +0 -189
  34. package/dist/src/chat.d.ts +0 -2
  35. package/dist/src/chat.js +0 -92
  36. package/dist/src/check.d.ts +0 -11
  37. package/dist/src/check.js +0 -53
  38. package/dist/src/client.d.ts +0 -5
  39. package/dist/src/client.js +0 -157
  40. package/dist/src/compiler.d.ts +0 -36
  41. package/dist/src/compiler.js +0 -366
  42. package/dist/src/config.d.ts +0 -24
  43. package/dist/src/config.js +0 -70
  44. package/dist/src/connect.d.ts +0 -2
  45. package/dist/src/connect.js +0 -64
  46. package/dist/src/coordinate.d.ts +0 -3
  47. package/dist/src/coordinate.js +0 -58
  48. package/dist/src/create.d.ts +0 -2
  49. package/dist/src/create.js +0 -113
  50. package/dist/src/credits.d.ts +0 -29
  51. package/dist/src/credits.js +0 -88
  52. package/dist/src/deploy.d.ts +0 -2
  53. package/dist/src/deploy.js +0 -19
  54. package/dist/src/dev.d.ts +0 -2
  55. package/dist/src/dev.js +0 -75
  56. package/dist/src/device-flow.d.ts +0 -57
  57. package/dist/src/device-flow.js +0 -173
  58. package/dist/src/doctor.d.ts +0 -26
  59. package/dist/src/doctor.js +0 -146
  60. package/dist/src/draw.d.ts +0 -18
  61. package/dist/src/draw.js +0 -156
  62. package/dist/src/endpoint.d.ts +0 -2
  63. package/dist/src/endpoint.js +0 -250
  64. package/dist/src/env.d.ts +0 -3
  65. package/dist/src/env.js +0 -37
  66. package/dist/src/eval.d.ts +0 -2
  67. package/dist/src/eval.js +0 -43
  68. package/dist/src/fn.d.ts +0 -2
  69. package/dist/src/fn.js +0 -70
  70. package/dist/src/group.d.ts +0 -2
  71. package/dist/src/group.js +0 -117
  72. package/dist/src/hl-run.d.ts +0 -119
  73. package/dist/src/hl-run.js +0 -480
  74. package/dist/src/hl.d.ts +0 -17
  75. package/dist/src/hl.js +0 -148
  76. package/dist/src/index.d.ts +0 -2
  77. package/dist/src/init.d.ts +0 -76
  78. package/dist/src/init.js +0 -278
  79. package/dist/src/join.d.ts +0 -11
  80. package/dist/src/join.js +0 -297
  81. package/dist/src/key-publish.d.ts +0 -40
  82. package/dist/src/key-publish.js +0 -232
  83. package/dist/src/key-seal.d.ts +0 -21
  84. package/dist/src/key-seal.js +0 -142
  85. package/dist/src/key-sweep.d.ts +0 -93
  86. package/dist/src/key-sweep.js +0 -270
  87. package/dist/src/key.d.ts +0 -26
  88. package/dist/src/key.js +0 -338
  89. package/dist/src/lib/age-plugin.d.ts +0 -51
  90. package/dist/src/lib/age-plugin.js +0 -130
  91. package/dist/src/lib/agent-env.d.ts +0 -12
  92. package/dist/src/lib/agent-env.js +0 -48
  93. package/dist/src/lib/api-path.d.ts +0 -2
  94. package/dist/src/lib/api-path.js +0 -40
  95. package/dist/src/lib/asker.d.ts +0 -34
  96. package/dist/src/lib/asker.js +0 -126
  97. package/dist/src/lib/check-words.d.ts +0 -57
  98. package/dist/src/lib/check-words.js +0 -144
  99. package/dist/src/lib/client.d.ts +0 -20
  100. package/dist/src/lib/client.js +0 -71
  101. package/dist/src/lib/env-sealed.d.ts +0 -53
  102. package/dist/src/lib/env-sealed.js +0 -184
  103. package/dist/src/lib/flow-tag.d.ts +0 -86
  104. package/dist/src/lib/flow-tag.js +0 -230
  105. package/dist/src/lib/hl-core/actions.d.ts +0 -99
  106. package/dist/src/lib/hl-core/actions.js +0 -69
  107. package/dist/src/lib/hl-core/eip712.d.ts +0 -33
  108. package/dist/src/lib/hl-core/eip712.js +0 -107
  109. package/dist/src/lib/hl-core/errors.d.ts +0 -10
  110. package/dist/src/lib/hl-core/errors.js +0 -15
  111. package/dist/src/lib/hl-core/exchange.d.ts +0 -24
  112. package/dist/src/lib/hl-core/exchange.js +0 -47
  113. package/dist/src/lib/hl-core/index.d.ts +0 -13
  114. package/dist/src/lib/hl-core/index.js +0 -14
  115. package/dist/src/lib/hl-core/meta.d.ts +0 -57
  116. package/dist/src/lib/hl-core/meta.js +0 -110
  117. package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
  118. package/dist/src/lib/hl-core/msgpack.js +0 -136
  119. package/dist/src/lib/hl-core/net.d.ts +0 -2
  120. package/dist/src/lib/hl-core/net.js +0 -7
  121. package/dist/src/lib/hl-core/signing.d.ts +0 -103
  122. package/dist/src/lib/hl-core/signing.js +0 -295
  123. package/dist/src/lib/hl-core/wire.d.ts +0 -34
  124. package/dist/src/lib/hl-core/wire.js +0 -81
  125. package/dist/src/lib/invoked-as.d.ts +0 -2
  126. package/dist/src/lib/invoked-as.js +0 -24
  127. package/dist/src/lib/journey-words.d.ts +0 -84
  128. package/dist/src/lib/journey-words.js +0 -363
  129. package/dist/src/lib/journey.d.ts +0 -150
  130. package/dist/src/lib/journey.js +0 -264
  131. package/dist/src/lib/key-receipt.d.ts +0 -48
  132. package/dist/src/lib/key-receipt.js +0 -116
  133. package/dist/src/lib/key-source.d.ts +0 -9
  134. package/dist/src/lib/key-source.js +0 -33
  135. package/dist/src/lib/keyfile.d.ts +0 -136
  136. package/dist/src/lib/keyfile.js +0 -397
  137. package/dist/src/lib/launch-claude.d.ts +0 -5
  138. package/dist/src/lib/launch-claude.js +0 -45
  139. package/dist/src/lib/lock-lookup.d.ts +0 -40
  140. package/dist/src/lib/lock-lookup.js +0 -92
  141. package/dist/src/lib/message-seal.d.ts +0 -63
  142. package/dist/src/lib/message-seal.js +0 -150
  143. package/dist/src/lib/net-choice.d.ts +0 -28
  144. package/dist/src/lib/net-choice.js +0 -72
  145. package/dist/src/lib/network.d.ts +0 -22
  146. package/dist/src/lib/network.js +0 -50
  147. package/dist/src/lib/next-words.d.ts +0 -105
  148. package/dist/src/lib/next-words.js +0 -298
  149. package/dist/src/lib/paths.d.ts +0 -41
  150. package/dist/src/lib/paths.js +0 -91
  151. package/dist/src/lib/plan-draw.d.ts +0 -56
  152. package/dist/src/lib/plan-draw.js +0 -219
  153. package/dist/src/lib/plan-live.d.ts +0 -20
  154. package/dist/src/lib/plan-live.js +0 -192
  155. package/dist/src/lib/qr.d.ts +0 -21
  156. package/dist/src/lib/qr.js +0 -402
  157. package/dist/src/lib/roster.d.ts +0 -20
  158. package/dist/src/lib/roster.js +0 -79
  159. package/dist/src/lib/sale-card.d.ts +0 -117
  160. package/dist/src/lib/sale-card.js +0 -261
  161. package/dist/src/lib/shop-init.d.ts +0 -62
  162. package/dist/src/lib/shop-init.js +0 -63
  163. package/dist/src/lib/sui-grpc-send.d.ts +0 -90
  164. package/dist/src/lib/sui-grpc-send.js +0 -128
  165. package/dist/src/lib/swap-core.d.ts +0 -163
  166. package/dist/src/lib/swap-core.js +0 -405
  167. package/dist/src/lib/tasks-digest.d.ts +0 -66
  168. package/dist/src/lib/tasks-digest.js +0 -200
  169. package/dist/src/lib/tasks-graph.d.ts +0 -79
  170. package/dist/src/lib/tasks-graph.js +0 -463
  171. package/dist/src/lib/tasks-lens.d.ts +0 -31
  172. package/dist/src/lib/tasks-lens.js +0 -47
  173. package/dist/src/lib/tasks-next.d.ts +0 -25
  174. package/dist/src/lib/tasks-next.js +0 -103
  175. package/dist/src/lib/tasks-prove.d.ts +0 -15
  176. package/dist/src/lib/tasks-prove.js +0 -68
  177. package/dist/src/lib/tasks-route.d.ts +0 -29
  178. package/dist/src/lib/tasks-route.js +0 -151
  179. package/dist/src/lib/tasks-score.d.ts +0 -36
  180. package/dist/src/lib/tasks-score.js +0 -152
  181. package/dist/src/lib/tasks-workspace.d.ts +0 -18
  182. package/dist/src/lib/tasks-workspace.js +0 -73
  183. package/dist/src/lib/timed-fetch.d.ts +0 -33
  184. package/dist/src/lib/timed-fetch.js +0 -59
  185. package/dist/src/lib/vault-read.d.ts +0 -24
  186. package/dist/src/lib/vault-read.js +0 -77
  187. package/dist/src/lib/vaultfile.d.ts +0 -103
  188. package/dist/src/lib/vaultfile.js +0 -249
  189. package/dist/src/lib/wallet-money.d.ts +0 -222
  190. package/dist/src/lib/wallet-money.js +0 -578
  191. package/dist/src/lib/wallet-request.d.ts +0 -50
  192. package/dist/src/lib/wallet-request.js +0 -86
  193. package/dist/src/links.d.ts +0 -5
  194. package/dist/src/links.js +0 -45
  195. package/dist/src/media.d.ts +0 -29
  196. package/dist/src/media.js +0 -487
  197. package/dist/src/message-receipt.d.ts +0 -25
  198. package/dist/src/message-receipt.js +0 -71
  199. package/dist/src/message.d.ts +0 -13
  200. package/dist/src/message.js +0 -92
  201. package/dist/src/move.d.ts +0 -36
  202. package/dist/src/move.js +0 -152
  203. package/dist/src/network-cmd.d.ts +0 -17
  204. package/dist/src/network-cmd.js +0 -74
  205. package/dist/src/next.d.ts +0 -12
  206. package/dist/src/next.js +0 -67
  207. package/dist/src/onboard.d.ts +0 -16
  208. package/dist/src/onboard.js +0 -149
  209. package/dist/src/plugin.d.ts +0 -2
  210. package/dist/src/plugin.js +0 -193
  211. package/dist/src/push.d.ts +0 -2
  212. package/dist/src/push.js +0 -115
  213. package/dist/src/render.d.ts +0 -21
  214. package/dist/src/render.js +0 -32
  215. package/dist/src/secrets-device.d.ts +0 -32
  216. package/dist/src/secrets-device.js +0 -127
  217. package/dist/src/secrets-give.d.ts +0 -125
  218. package/dist/src/secrets-give.js +0 -236
  219. package/dist/src/secrets-list.d.ts +0 -27
  220. package/dist/src/secrets-list.js +0 -84
  221. package/dist/src/secrets-run.d.ts +0 -31
  222. package/dist/src/secrets-run.js +0 -182
  223. package/dist/src/secrets.d.ts +0 -33
  224. package/dist/src/secrets.js +0 -200
  225. package/dist/src/setup.d.ts +0 -6
  226. package/dist/src/setup.js +0 -127
  227. package/dist/src/ship.d.ts +0 -2
  228. package/dist/src/ship.js +0 -18
  229. package/dist/src/shop-buy.d.ts +0 -16
  230. package/dist/src/shop-buy.js +0 -101
  231. package/dist/src/shop.d.ts +0 -10
  232. package/dist/src/shop.js +0 -112
  233. package/dist/src/skill-parser.d.ts +0 -14
  234. package/dist/src/skill-parser.js +0 -113
  235. package/dist/src/skill.d.ts +0 -2
  236. package/dist/src/skill.js +0 -493
  237. package/dist/src/slug.d.ts +0 -2
  238. package/dist/src/slug.js +0 -6
  239. package/dist/src/social.d.ts +0 -2
  240. package/dist/src/social.js +0 -106
  241. package/dist/src/staff.d.ts +0 -2
  242. package/dist/src/staff.js +0 -104
  243. package/dist/src/start.d.ts +0 -27
  244. package/dist/src/start.js +0 -225
  245. package/dist/src/status.d.ts +0 -2
  246. package/dist/src/status.js +0 -52
  247. package/dist/src/substrate.d.ts +0 -2
  248. package/dist/src/substrate.js +0 -258
  249. package/dist/src/swap.d.ts +0 -93
  250. package/dist/src/swap.js +0 -622
  251. package/dist/src/tasks.d.ts +0 -2
  252. package/dist/src/tasks.js +0 -743
  253. package/dist/src/templates.d.ts +0 -1
  254. package/dist/src/templates.js +0 -213
  255. package/dist/src/thread.d.ts +0 -2
  256. package/dist/src/thread.js +0 -52
  257. package/dist/src/trade.d.ts +0 -2
  258. package/dist/src/trade.js +0 -91
  259. package/dist/src/trail.d.ts +0 -2
  260. package/dist/src/trail.js +0 -41
  261. package/dist/src/validate.d.ts +0 -13
  262. package/dist/src/validate.js +0 -35
  263. package/dist/src/wallet-money.d.ts +0 -158
  264. package/dist/src/wallet-money.js +0 -664
  265. package/dist/src/wallet.d.ts +0 -169
  266. package/dist/src/wallet.js +0 -973
  267. package/dist/src/workflow.d.ts +0 -2
  268. package/dist/src/workflow.js +0 -169
  269. package/dist/src/write.d.ts +0 -43
  270. package/dist/src/write.js +0 -180
@@ -1,366 +0,0 @@
1
- import { readdirSync, readFileSync, statSync, existsSync } from 'node:fs';
2
- import { join, basename } from 'node:path';
3
- // The 8 LOCKED workflow step kinds (one-ie/CLAUDE.md · @oneie/sdk/schemas StepKind).
4
- const WORKFLOW_STEP_KINDS = new Set(['trigger', 'tool', 'skill', 'agent', 'condition', 'human', 'delay', 'sell']);
5
- /**
6
- * Parse a workflow `.md` into a WorkflowDiff (`{add, connect}` per @oneie/sdk/schemas).
7
- * The deterministic step graph rides in a fenced ```graph JSON block:
8
- * { "steps": [{ "id", "kind", "name", "config": {…} }],
9
- * "edges": [ ["a","b"], { "from":"a", "to":"b", "condition":"…" } ] }
10
- * Prose above the block is human docs. `config` objects are JSON-stringified (the receiver
11
- * wants a string). Frontmatter `trigger:` seeds a trigger step when the graph omits one.
12
- * No graph block → null (the workflow is created as a shell). Unknown kind → throws.
13
- */
14
- export function parseWorkflowGraph(md, fm) {
15
- const m = md.match(/```graph\s*\n([\s\S]*?)```/);
16
- if (!m)
17
- return null;
18
- let graph;
19
- try {
20
- graph = JSON.parse(m[1]);
21
- }
22
- catch (e) {
23
- throw new Error(`invalid \`\`\`graph JSON: ${String(e)}`);
24
- }
25
- const steps = Array.isArray(graph.steps) ? graph.steps : [];
26
- const add = steps.map((s) => {
27
- const kind = String(s.kind ?? '');
28
- if (!WORKFLOW_STEP_KINDS.has(kind))
29
- throw new Error(`unknown workflow step kind "${kind}"`);
30
- const config = typeof s.config === 'string' ? s.config : JSON.stringify(s.config ?? {});
31
- return { tempId: String(s.id ?? ''), kind, name: String(s.name ?? s.id ?? ''), config };
32
- });
33
- const edges = Array.isArray(graph.edges) ? graph.edges : [];
34
- const connect = edges.map((e) => {
35
- if (Array.isArray(e))
36
- return { source: String(e[0]), target: String(e[1]) };
37
- const o = e;
38
- return { source: String(o.from), target: String(o.to), ...(o.condition ? { condition: String(o.condition) } : {}) };
39
- });
40
- // Seed a trigger from frontmatter when the graph has none, wiring it to the first step.
41
- if (fm.trigger && !add.some((s) => s.kind === 'trigger')) {
42
- add.unshift({ tempId: 'trigger', kind: 'trigger', name: String(fm.label ?? 'Trigger'), config: JSON.stringify({ source: fm.trigger }) });
43
- if (add.length > 1)
44
- connect.unshift({ source: 'trigger', target: String(add[1].tempId) });
45
- }
46
- return { add, connect };
47
- }
48
- /** Minimal TOML parser: key="v", key=123, key=true, [section], key=["a","b"] */
49
- export function parseToml(src) {
50
- const root = {};
51
- let current = root;
52
- for (const rawLine of src.split('\n')) {
53
- const line = rawLine.trim();
54
- if (!line || line.startsWith('#'))
55
- continue;
56
- if (line.startsWith('[[') && line.endsWith(']]')) {
57
- // Array-of-tables: [[stages]] / [[fields]] — append a fresh item, point at it.
58
- const key = line.slice(2, -2).trim();
59
- if (!Array.isArray(root[key]))
60
- root[key] = [];
61
- const item = {};
62
- root[key].push(item);
63
- current = item;
64
- continue;
65
- }
66
- if (line.startsWith('[') && line.endsWith(']')) {
67
- const key = line.slice(1, -1).trim();
68
- if (!root[key])
69
- root[key] = {};
70
- current = root[key];
71
- continue;
72
- }
73
- const eq = line.indexOf('=');
74
- if (eq === -1)
75
- continue;
76
- const k = line.slice(0, eq).trim();
77
- const raw = line.slice(eq + 1).trim();
78
- if (raw.startsWith('[')) {
79
- current[k] = raw.slice(1, raw.lastIndexOf(']')).split(',').map((s) => s.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
80
- }
81
- else if (raw === 'true')
82
- current[k] = true;
83
- else if (raw === 'false')
84
- current[k] = false;
85
- else if (!Number.isNaN(Number(raw)) && raw !== '')
86
- current[k] = Number(raw);
87
- else
88
- current[k] = raw.replace(/^["']|["']$/g, '');
89
- }
90
- return root;
91
- }
92
- function walk(dir, ext) {
93
- if (!existsSync(dir))
94
- return [];
95
- const result = [];
96
- for (const entry of readdirSync(dir)) {
97
- const full = join(dir, entry);
98
- if (statSync(full).isDirectory())
99
- result.push(...walk(full, ext));
100
- else if (entry.endsWith(ext) && !entry.startsWith('_'))
101
- result.push(full);
102
- }
103
- return result;
104
- }
105
- function frontmatter(md) {
106
- const m = md.match(/^---\n([\s\S]*?)\n---/);
107
- if (!m)
108
- return {};
109
- const out = {};
110
- for (const line of m[1].split('\n')) {
111
- const kv = line.match(/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/);
112
- if (kv)
113
- out[kv[1]] = kv[2].trim();
114
- }
115
- return out;
116
- }
117
- function safeSlug(s) {
118
- return s.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
119
- }
120
- function namespaced(agency, name) {
121
- return `${safeSlug(agency)}--${safeSlug(name)}`;
122
- }
123
- /** Merge clientSlug's ai/ + data/ over root items by basename. Client file wins. */
124
- function mergeClient(base, clientDir, slug, agencySlug) {
125
- if (!existsSync(clientDir))
126
- return base;
127
- const byBase = new Map(base.map((item) => [basename(item.path), item]));
128
- // Walk client dir for any .md and .toml files
129
- for (const sub of ['ai/agents', 'ai/skills', 'data/lifecycles', 'data/types']) {
130
- const dir = join(clientDir, sub);
131
- if (!existsSync(dir))
132
- continue;
133
- for (const f of readdirSync(dir)) {
134
- if (f.startsWith('_'))
135
- continue;
136
- const full = join(dir, f);
137
- if (!statSync(full).isFile())
138
- continue;
139
- const content = readFileSync(full, 'utf8');
140
- // Build a replacement item for this file
141
- let item = null;
142
- if (f.endsWith('.md')) {
143
- const fm = frontmatter(content);
144
- if (!fm.name)
145
- continue;
146
- const name = namespaced(`${agencySlug}--${safeSlug(slug)}`, fm.name);
147
- const type = sub.includes('agents') ? 'agent' : 'skill';
148
- item = { path: full, receiver: 'world:create-thing', payload: { name, type, md: content } };
149
- }
150
- else if (f.endsWith('.toml') && sub.includes('lifecycles')) {
151
- const toml = parseToml(content);
152
- const lifecycle = String(toml.lifecycle ?? basename(f, '.toml'));
153
- item = { path: full, receiver: 'lifecycle:save', payload: { slug, lifecycle, def: content } };
154
- }
155
- if (item)
156
- byBase.set(f, item);
157
- }
158
- }
159
- return [...byBase.values()];
160
- }
161
- export async function compileNode(dir, agencySlug, opts) {
162
- const compiled = [];
163
- const errors = [];
164
- // ai/agents/*.md → world:create-thing (agent)
165
- for (const f of walk(join(dir, 'ai', 'agents'), '.md')) {
166
- try {
167
- // A README is documentation ABOUT the agents beside it, never an agent.
168
- // `ai/agents/templates/README.md` explains the starter org chart, has no
169
- // frontmatter, and was reported as `frontmatter \`name\` required` on every
170
- // push — an error the author cannot fix without deleting the explanation.
171
- if (basename(f).toLowerCase() === 'readme.md')
172
- continue;
173
- const md = readFileSync(f, 'utf8');
174
- const fm = frontmatter(md);
175
- if (!fm.name) {
176
- errors.push({ path: f, message: 'frontmatter `name` required' });
177
- continue;
178
- }
179
- if (!fm.description) {
180
- errors.push({ path: f, message: 'frontmatter `description` required' });
181
- continue;
182
- }
183
- compiled.push({ path: f, receiver: 'world:create-thing', payload: { name: namespaced(agencySlug, fm.name), type: 'agent', md } });
184
- }
185
- catch (e) {
186
- errors.push({ path: f, message: String(e) });
187
- }
188
- }
189
- // ai/skills/*/SKILL.md → world:create-thing (catalog listing) + skill:save (runnable
190
- // body in the workspace R2 catalog — the store skill:run reads, bare name). Without
191
- // the second item a pushed skill exists only as a world_things row and skill:run
192
- // returns skill_not_found (verified live 2026-07-12).
193
- for (const f of walk(join(dir, 'ai', 'skills'), 'SKILL.md')) {
194
- try {
195
- const md = readFileSync(f, 'utf8');
196
- const fm = frontmatter(md);
197
- if (!fm.name) {
198
- errors.push({ path: f, message: 'frontmatter `name` required' });
199
- continue;
200
- }
201
- compiled.push({ path: f, receiver: 'world:create-thing', payload: { name: namespaced(agencySlug, fm.name), type: 'skill', md } });
202
- compiled.push({ path: f, receiver: 'skill:save', payload: { slug: safeSlug(agencySlug), name: safeSlug(fm.name), content: md } });
203
- }
204
- catch (e) {
205
- errors.push({ path: f, message: String(e) });
206
- }
207
- }
208
- // ai/context.md → settings:write
209
- const contextPath = join(dir, 'ai', 'context.md');
210
- if (existsSync(contextPath)) {
211
- const value = readFileSync(contextPath, 'utf8');
212
- compiled.push({ path: contextPath, receiver: 'settings:write', payload: { slug: agencySlug, key: 'company_context', value } });
213
- }
214
- // ai/tools/*.toml → tools:connect
215
- for (const f of walk(join(dir, 'ai', 'tools'), '.toml')) {
216
- try {
217
- const toml = parseToml(readFileSync(f, 'utf8'));
218
- compiled.push({ path: f, receiver: 'tools:connect', payload: { slug: agencySlug, toolkit: String(toml.toolkit ?? basename(f, '.toml')), mode: String(toml.mode ?? 'api') } });
219
- }
220
- catch (e) {
221
- errors.push({ path: f, message: String(e) });
222
- }
223
- }
224
- // data/types/*.toml → world:declare-types
225
- // The receiver wants { group, types: [{ key, label, dimension, type, columns[], fields[] }] }
226
- // with each column/field { field, label, kind(enum) }. The TOML authors { id, label,
227
- // dimension?, [[fields]]{ name, type, label } }; map field.type → a render `kind`.
228
- const TYPE_KIND = {
229
- string: 'text', url: 'text', number: 'number', currency: 'currency', date: 'date',
230
- tags: 'tags', select: 'select', image: 'image', markdown: 'markdown', relation: 'relation', bool: 'select',
231
- };
232
- // ONE call carrying EVERY type, not one call per file. `world:declare-types`
233
- // REPLACES the whole manifest (world-receivers.ts:1953 — `INSERT … ON CONFLICT
234
- // DO UPDATE SET manifest = excluded.manifest`), and push.ts sends compiled
235
- // items sequentially, so a per-file call made every type after the first
236
- // delete the one before it. Measured 2026-09-22 on a two-file fixture:
237
- // `declare-types calls emitted: 2 → ["order"], ["product"]`, push reports
238
- // `Pushed 2/2 item(s).`, and the workspace keeps ONE type. Silent, and it is
239
- // the exact path baas-features.md sells as "declare your types, a full admin
240
- // appears" — so a starter could never ship a type SET. Files are walked in a
241
- // stable order and the batch keeps it, so the manifest order is the file order.
242
- const declaredTypes = [];
243
- const typeFiles = [];
244
- for (const f of walk(join(dir, 'data', 'types'), '.toml')) {
245
- try {
246
- const toml = parseToml(readFileSync(f, 'utf8'));
247
- const rawFields = Array.isArray(toml.fields) ? toml.fields : [];
248
- const cols = rawFields.map((fl) => {
249
- const field = String(fl.name ?? fl.field ?? '');
250
- return {
251
- field,
252
- label: String(fl.label ?? field),
253
- kind: String(fl.kind ?? TYPE_KIND[String(fl.type ?? 'string')] ?? 'text'),
254
- };
255
- });
256
- const key = String(toml.id ?? basename(f, '.toml'));
257
- const type = {
258
- key,
259
- label: String(toml.label ?? key),
260
- dimension: String(toml.dimension ?? 'things'),
261
- type: key,
262
- columns: cols,
263
- fields: cols,
264
- };
265
- declaredTypes.push(type);
266
- typeFiles.push(f);
267
- }
268
- catch (e) {
269
- errors.push({ path: f, message: String(e) });
270
- }
271
- }
272
- if (declaredTypes.length > 0) {
273
- // `path` names every file that fed the batch — a dry-run must still say which
274
- // TOMLs are in play, and an error must be traceable to more than "data/types".
275
- compiled.push({
276
- path: typeFiles.join(', '),
277
- receiver: 'world:declare-types',
278
- payload: { group: agencySlug, types: declaredTypes },
279
- });
280
- }
281
- // data/lifecycles/*.toml → lifecycle:save
282
- // Build the LifecycleDef that the receiver's saveDef() persists. The TOML authors the
283
- // human bits {id,label,tags,description,[[stages]]}; the rest is derived deterministically:
284
- // stage.slot numeric order (the wall loads ORDER BY slot) → the stage index
285
- // stage.tag full namespaced tag lifecycle:<id>:<stageId> (LifecycleStage.tag)
286
- // stage.subSteps always empty — TOML has no sub-step authoring surface
287
- // stage.enter_when optional TOML field, straight through (null when absent) — the
288
- // C7 rule engine grammar (an exact event name or a conversion-stage
289
- // category, e.g. "purchase"/"intent"); the compiler does not validate
290
- // it against event-vocabulary.ts (that package isn't a CLI dependency),
291
- // so an author who wants the stage to self-populate from real traffic
292
- // must use a value the web app's isValidEnterWhen() accepts — a bad
293
- // value just leaves the stage manual-only (evaluate() never matches it).
294
- // stage.goal / principle / band plain string fields, straight through if present
295
- // stage.levers parseToml has no nested array-of-tables, so a lever is one string per
296
- // entry in a bracket list: levers = ["page:/pricing", "agent:one"] —
297
- // "<kind>:<id>", kind ∈ page|workflow|agent|human (LeverKind)
298
- for (const f of walk(join(dir, 'data', 'lifecycles'), '.toml')) {
299
- try {
300
- const toml = parseToml(readFileSync(f, 'utf8'));
301
- const id = String(toml.id ?? toml.lifecycle ?? basename(f, '.toml'));
302
- const rawStages = Array.isArray(toml.stages) ? toml.stages : [];
303
- const stages = rawStages.map((s, i) => {
304
- const stageId = String(s.id ?? '');
305
- const rawLevers = Array.isArray(s.levers) ? s.levers : [];
306
- const levers = rawLevers.map((l) => {
307
- const [kind, ...rest] = l.split(':');
308
- return { kind, id: rest.join(':') };
309
- }).filter((l) => l.kind && l.id);
310
- return {
311
- id: stageId,
312
- label: String(s.label ?? stageId),
313
- tag: `lifecycle:${id}:${stageId}`,
314
- slot: i,
315
- subSteps: [],
316
- enter_when: s.enter_when ? String(s.enter_when) : null,
317
- ...(s.goal ? { goal: String(s.goal) } : {}),
318
- ...(s.principle ? { principle: String(s.principle) } : {}),
319
- ...(s.band ? { band: String(s.band) } : {}),
320
- ...(levers.length > 0 ? { levers } : {}),
321
- };
322
- });
323
- const def = { id, name: String(toml.label ?? id), version: 1, stages, transitions: [], arcs: [], monotonic: true };
324
- compiled.push({ path: f, receiver: 'lifecycle:save', payload: { slug: agencySlug, lifecycle: id, def } });
325
- }
326
- catch (e) {
327
- errors.push({ path: f, message: String(e) });
328
- }
329
- }
330
- // ai/workflows/*.md → workflow:create (+ workflow:apply-diff via item.applyDiff, two-phase in push)
331
- for (const f of walk(join(dir, 'ai', 'workflows'), '.md')) {
332
- try {
333
- const md = readFileSync(f, 'utf8');
334
- const fm = frontmatter(md);
335
- const name = String(fm.label ?? fm.id ?? basename(f, '.md'));
336
- const item = { path: f, receiver: 'workflow:create', payload: { name, description: String(fm.description ?? '') } };
337
- const graph = parseWorkflowGraph(md, fm);
338
- if (graph && graph.add.length)
339
- item.applyDiff = graph;
340
- compiled.push(item);
341
- }
342
- catch (e) {
343
- errors.push({ path: f, message: String(e) });
344
- }
345
- }
346
- // data/content/contacts.csv → people:create (batch)
347
- const contactsPath = join(dir, 'data', 'content', 'contacts.csv');
348
- if (existsSync(contactsPath)) {
349
- const csv = readFileSync(contactsPath, 'utf8');
350
- const [headerLine, ...rows] = csv.trim().split('\n');
351
- const headers = (headerLine ?? '').split(',').map((h) => h.trim());
352
- const contacts = rows.map((row) => {
353
- const vals = row.split(',').map((v) => v.trim());
354
- return Object.fromEntries(headers.map((h, i) => [h, vals[i] ?? '']));
355
- });
356
- if (contacts.length > 0) {
357
- compiled.push({ path: contactsPath, receiver: 'people:create', payload: { slug: agencySlug, contacts } });
358
- }
359
- }
360
- // Client inheritance: clients/<slug>/ merges over root by basename
361
- if (opts?.clientSlug) {
362
- const clientDir = join(dir, 'clients', opts.clientSlug);
363
- return { compiled: mergeClient(compiled, clientDir, opts.clientSlug, agencySlug), errors };
364
- }
365
- return { compiled, errors };
366
- }
@@ -1,24 +0,0 @@
1
- export type Plan = 'starter' | 'free' | 'pro' | 'agency' | 'enterprise';
2
- export interface AgencyConfig {
3
- slug: string;
4
- name: string;
5
- plan: Plan;
6
- markup_pct: number;
7
- brand?: boolean;
8
- pool?: number;
9
- }
10
- export interface ClientConfig {
11
- name: string;
12
- slug: string;
13
- owner?: string;
14
- plan: Plan;
15
- markup_pct?: number;
16
- monthly_cap?: number;
17
- brand_lock?: boolean;
18
- credits?: number;
19
- agents?: string[];
20
- }
21
- /** Minimal TOML parser: handles key = "value", key = 123, key = true, [section] headers, key = ["a","b"]. */
22
- export declare function parseToml(src: string): Record<string, unknown>;
23
- export declare function readAgency(path?: string): AgencyConfig;
24
- export declare function readClient(path: string): ClientConfig;
@@ -1,70 +0,0 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- /** Minimal TOML parser: handles key = "value", key = 123, key = true, [section] headers, key = ["a","b"]. */
3
- export function parseToml(src) {
4
- const root = {};
5
- let current = root;
6
- for (const rawLine of src.split('\n')) {
7
- const line = rawLine.trim();
8
- if (!line || line.startsWith('#'))
9
- continue;
10
- if (line.startsWith('[') && line.endsWith(']')) {
11
- const key = line.slice(1, -1).trim();
12
- if (!root[key])
13
- root[key] = {};
14
- current = root[key];
15
- continue;
16
- }
17
- const eq = line.indexOf('=');
18
- if (eq === -1)
19
- continue;
20
- const k = line.slice(0, eq).trim();
21
- const raw = line.slice(eq + 1).trim();
22
- if (raw.startsWith('[')) {
23
- // simple inline array of strings
24
- current[k] = raw.slice(1, raw.lastIndexOf(']')).split(',').map((s) => s.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
25
- }
26
- else if (raw === 'true')
27
- current[k] = true;
28
- else if (raw === 'false')
29
- current[k] = false;
30
- else if (!Number.isNaN(Number(raw)) && raw !== '')
31
- current[k] = Number(raw);
32
- else
33
- current[k] = raw.replace(/^["']|["']$/g, '');
34
- }
35
- return root;
36
- }
37
- function readToml(path) {
38
- if (!existsSync(path))
39
- throw new Error(`not found: ${path}`);
40
- return parseToml(readFileSync(path, 'utf8'));
41
- }
42
- export function readAgency(path = '_node.toml') {
43
- const raw = readToml(path);
44
- if (!raw.slug || !raw.name)
45
- throw new Error(`${path}: 'slug' and 'name' are required`);
46
- return {
47
- slug: String(raw.slug),
48
- name: String(raw.name),
49
- plan: raw.plan ?? 'agency',
50
- markup_pct: Number(raw.markup_pct ?? 0),
51
- brand: Boolean(raw.brand ?? false),
52
- pool: raw.pool != null ? Number(raw.pool) : undefined,
53
- };
54
- }
55
- export function readClient(path) {
56
- const raw = readToml(path);
57
- if (!raw.slug || !raw.name)
58
- throw new Error(`${path}: 'slug' and 'name' are required`);
59
- return {
60
- name: String(raw.name),
61
- slug: String(raw.slug),
62
- owner: raw.owner != null ? String(raw.owner) : undefined,
63
- plan: raw.plan ?? 'free',
64
- markup_pct: raw.markup_pct != null ? Number(raw.markup_pct) : undefined,
65
- monthly_cap: raw.monthly_cap != null ? Number(raw.monthly_cap) : undefined,
66
- brand_lock: raw.brand_lock != null ? Boolean(raw.brand_lock) : undefined,
67
- credits: raw.credits != null ? Number(raw.credits) : undefined,
68
- agents: Array.isArray(raw.agents) ? raw.agents.map(String) : undefined,
69
- };
70
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function connectCmd(): Command;
@@ -1,64 +0,0 @@
1
- import { Command } from 'commander';
2
- import { out, resolveBase, resolveKey } from './lib/client.js';
3
- const DEFAULT_API = resolveBase({}, 'https://one.ie');
4
- function readApiKey() {
5
- const key = resolveKey();
6
- return key || null;
7
- }
8
- // `one connect <channel> --token <t>` — token-paste connect. The CLI never
9
- // implements getMe/setWebhook; it POSTs to the web /api/connect/<channel> route
10
- // which verifies + hands the secret to channels' sealed sink. The token is sent
11
- // once in the request body and is NEVER echoed back to stdout (out() prints
12
- // only the route's response, which carries status + public handle, no secret).
13
- // With no channel argument it lists connection status (GET /api/connect/status).
14
- export function connectCmd() {
15
- const cmd = new Command('connect').description('Connect a channel to your workspace, or list connected channels with no argument');
16
- cmd
17
- .argument('[channel]', 'Channel to connect (telegram); omit to list status')
18
- .option('--token <token>', 'Channel credential (e.g. @BotFather bot token)')
19
- .option('--slug <slug>', 'Workspace slug (defaults to the authenticated owner)')
20
- .option('--api <url>', 'API base URL', DEFAULT_API)
21
- .action(async (channel, opts) => {
22
- const key = readApiKey();
23
- if (!key) {
24
- out(cmd, { ok: false, error: 'no API key — run: oneie auth login' });
25
- return;
26
- }
27
- const base = opts.api.replace(/\/$/, '');
28
- if (!channel) {
29
- // status listing — read-only, never carries credentials either way
30
- const res = await fetch(`${base}/api/connect/status`, {
31
- headers: { Authorization: `Bearer ${key}` },
32
- });
33
- if (!res.ok) {
34
- const data = (await res.json().catch(() => ({})));
35
- out(cmd, { ok: false, error: `${res.status}: ${data.error ?? 'status failed'}` });
36
- return;
37
- }
38
- const data = (await res.json());
39
- const connections = data.connections ?? [];
40
- out(cmd, { ok: true, connected: connections.length, connections });
41
- return;
42
- }
43
- if (!opts.token) {
44
- out(cmd, { ok: false, error: 'token required — e.g. one connect telegram --token <t>' });
45
- return;
46
- }
47
- const body = { token: opts.token };
48
- if (opts.slug)
49
- body.slug = opts.slug;
50
- const res = await fetch(`${base}/api/connect/${encodeURIComponent(channel)}`, {
51
- method: 'POST',
52
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
53
- body: JSON.stringify(body),
54
- });
55
- if (!res.ok) {
56
- const data = (await res.json().catch(() => ({})));
57
- out(cmd, { ok: false, error: `${res.status}: ${data.error ?? 'connect failed'}` });
58
- return;
59
- }
60
- const data = (await res.json());
61
- out(cmd, { ok: true, channel, status: data.status ?? 'active', account: data.username ?? data.inbound });
62
- });
63
- return cmd;
64
- }
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const REPUTATION_PENDING: string;
3
- export declare function coordinateCommands(program: Command): void;
@@ -1,58 +0,0 @@
1
- import { askPath } from './lib/api-path.js';
2
- const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
3
- function apiKey() {
4
- return process.env.ONEIE_API_KEY ?? process.env.ONE_API_KEY ?? '';
5
- }
6
- function base(opts) {
7
- return (opts.api ?? DEFAULT_API).replace(/\/$/, '');
8
- }
9
- function authHeaders() {
10
- const h = { 'Content-Type': 'application/json' };
11
- const k = apiKey();
12
- if (k)
13
- h['Authorization'] = `Bearer ${k}`;
14
- return h;
15
- }
16
- export const REPUTATION_PENDING = 'reputation: pending — meta:reputation is not yet shipped (agent-first follow-on).\n' +
17
- ' Standing lives in TypeDB paths; until the receiver lands, one shows no score (no stub).';
18
- function formatRecall(out) {
19
- const hyps = (out?.hypotheses ?? []);
20
- if (!hyps.length)
21
- return ' (no memory yet — recall returns what this caller has learned)';
22
- return hyps.map((h) => ` · [${h.status}] ${h.claim}${h.confidence != null ? ` (${h.confidence})` : ''}`).join('\n');
23
- }
24
- export function coordinateCommands(program) {
25
- program
26
- .command('recall')
27
- .description('Read cross-session memory (meta:recall)')
28
- .option('--about <term>', 'Filter by keyword')
29
- .option('--limit <n>', 'Max results', '20')
30
- .option('--api <url>', 'API base URL', DEFAULT_API)
31
- .option('--json', 'Output raw JSON')
32
- .action(async (opts) => {
33
- const payload = { limit: Number(opts.limit) };
34
- if (opts.about)
35
- payload.match = opts.about;
36
- const res = await fetch(askPath(base(opts), 'meta:recall'), {
37
- method: 'POST',
38
- headers: authHeaders(),
39
- body: JSON.stringify({ data: payload }),
40
- });
41
- if (!res.ok) {
42
- process.stderr.write(`meta:recall → ${res.status}\n`);
43
- process.exit(1);
44
- }
45
- const data = await res.json();
46
- if (opts.json) {
47
- process.stdout.write(JSON.stringify(data, null, 2) + '\n');
48
- return;
49
- }
50
- process.stdout.write(formatRecall(data) + '\n');
51
- });
52
- program
53
- .command('reputation')
54
- .description('Agent reputation standing (pending)')
55
- .action(() => {
56
- process.stdout.write(REPUTATION_PENDING + '\n');
57
- });
58
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createCmd(): Command;