oneie 5.8.0 → 5.8.1

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 (268) hide show
  1. package/dist/package.json +7 -8
  2. package/dist/src/age-yefbe8pe.js +1 -0
  3. package/dist/src/evm-tx-ee2q0e3w.js +1 -0
  4. package/dist/src/hl-run-tgrkrk69.js +1 -0
  5. package/dist/src/index-0rj9wdk9.js +4 -0
  6. package/dist/src/index-91y484c2.js +2052 -0
  7. package/dist/src/index-940y3rnv.js +12 -0
  8. package/dist/src/index.js +1047 -134
  9. package/dist/src/message-key-db1xjdkw.js +1 -0
  10. package/dist/src/message-lock-5vr8079x.js +5 -0
  11. package/dist/src/sweep-order-c2p6rk8c.js +1 -0
  12. package/dist/src/sweep-runner-t68xe7vx.js +1 -0
  13. package/package.json +7 -8
  14. package/dist/src/agent.d.ts +0 -75
  15. package/dist/src/agent.js +0 -1334
  16. package/dist/src/agentverse.d.ts +0 -26
  17. package/dist/src/agentverse.js +0 -171
  18. package/dist/src/args.d.ts +0 -9
  19. package/dist/src/args.js +0 -61
  20. package/dist/src/auth.d.ts +0 -6
  21. package/dist/src/auth.js +0 -121
  22. package/dist/src/balances.d.ts +0 -89
  23. package/dist/src/balances.js +0 -202
  24. package/dist/src/banner.d.ts +0 -1
  25. package/dist/src/banner.js +0 -17
  26. package/dist/src/broadcast.d.ts +0 -8
  27. package/dist/src/broadcast.js +0 -175
  28. package/dist/src/catalog.d.ts +0 -12
  29. package/dist/src/catalog.js +0 -76
  30. package/dist/src/ceiling.d.ts +0 -36
  31. package/dist/src/ceiling.js +0 -189
  32. package/dist/src/chat.d.ts +0 -2
  33. package/dist/src/chat.js +0 -92
  34. package/dist/src/check.d.ts +0 -11
  35. package/dist/src/check.js +0 -53
  36. package/dist/src/client.d.ts +0 -5
  37. package/dist/src/client.js +0 -157
  38. package/dist/src/compiler.d.ts +0 -36
  39. package/dist/src/compiler.js +0 -366
  40. package/dist/src/config.d.ts +0 -24
  41. package/dist/src/config.js +0 -70
  42. package/dist/src/connect.d.ts +0 -2
  43. package/dist/src/connect.js +0 -64
  44. package/dist/src/coordinate.d.ts +0 -3
  45. package/dist/src/coordinate.js +0 -58
  46. package/dist/src/create.d.ts +0 -2
  47. package/dist/src/create.js +0 -113
  48. package/dist/src/credits.d.ts +0 -29
  49. package/dist/src/credits.js +0 -88
  50. package/dist/src/deploy.d.ts +0 -2
  51. package/dist/src/deploy.js +0 -19
  52. package/dist/src/dev.d.ts +0 -2
  53. package/dist/src/dev.js +0 -75
  54. package/dist/src/device-flow.d.ts +0 -57
  55. package/dist/src/device-flow.js +0 -173
  56. package/dist/src/doctor.d.ts +0 -26
  57. package/dist/src/doctor.js +0 -146
  58. package/dist/src/draw.d.ts +0 -18
  59. package/dist/src/draw.js +0 -156
  60. package/dist/src/endpoint.d.ts +0 -2
  61. package/dist/src/endpoint.js +0 -250
  62. package/dist/src/env.d.ts +0 -3
  63. package/dist/src/env.js +0 -37
  64. package/dist/src/eval.d.ts +0 -2
  65. package/dist/src/eval.js +0 -43
  66. package/dist/src/fn.d.ts +0 -2
  67. package/dist/src/fn.js +0 -70
  68. package/dist/src/group.d.ts +0 -2
  69. package/dist/src/group.js +0 -117
  70. package/dist/src/hl-run.d.ts +0 -119
  71. package/dist/src/hl-run.js +0 -480
  72. package/dist/src/hl.d.ts +0 -17
  73. package/dist/src/hl.js +0 -148
  74. package/dist/src/index.d.ts +0 -2
  75. package/dist/src/init.d.ts +0 -76
  76. package/dist/src/init.js +0 -278
  77. package/dist/src/join.d.ts +0 -11
  78. package/dist/src/join.js +0 -297
  79. package/dist/src/key-publish.d.ts +0 -40
  80. package/dist/src/key-publish.js +0 -232
  81. package/dist/src/key-seal.d.ts +0 -21
  82. package/dist/src/key-seal.js +0 -142
  83. package/dist/src/key-sweep.d.ts +0 -93
  84. package/dist/src/key-sweep.js +0 -270
  85. package/dist/src/key.d.ts +0 -26
  86. package/dist/src/key.js +0 -338
  87. package/dist/src/lib/age-plugin.d.ts +0 -51
  88. package/dist/src/lib/age-plugin.js +0 -130
  89. package/dist/src/lib/agent-env.d.ts +0 -12
  90. package/dist/src/lib/agent-env.js +0 -48
  91. package/dist/src/lib/api-path.d.ts +0 -2
  92. package/dist/src/lib/api-path.js +0 -40
  93. package/dist/src/lib/asker.d.ts +0 -34
  94. package/dist/src/lib/asker.js +0 -126
  95. package/dist/src/lib/check-words.d.ts +0 -57
  96. package/dist/src/lib/check-words.js +0 -144
  97. package/dist/src/lib/client.d.ts +0 -20
  98. package/dist/src/lib/client.js +0 -71
  99. package/dist/src/lib/env-sealed.d.ts +0 -53
  100. package/dist/src/lib/env-sealed.js +0 -184
  101. package/dist/src/lib/flow-tag.d.ts +0 -86
  102. package/dist/src/lib/flow-tag.js +0 -230
  103. package/dist/src/lib/hl-core/actions.d.ts +0 -99
  104. package/dist/src/lib/hl-core/actions.js +0 -69
  105. package/dist/src/lib/hl-core/eip712.d.ts +0 -33
  106. package/dist/src/lib/hl-core/eip712.js +0 -107
  107. package/dist/src/lib/hl-core/errors.d.ts +0 -10
  108. package/dist/src/lib/hl-core/errors.js +0 -15
  109. package/dist/src/lib/hl-core/exchange.d.ts +0 -24
  110. package/dist/src/lib/hl-core/exchange.js +0 -47
  111. package/dist/src/lib/hl-core/index.d.ts +0 -13
  112. package/dist/src/lib/hl-core/index.js +0 -14
  113. package/dist/src/lib/hl-core/meta.d.ts +0 -57
  114. package/dist/src/lib/hl-core/meta.js +0 -110
  115. package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
  116. package/dist/src/lib/hl-core/msgpack.js +0 -136
  117. package/dist/src/lib/hl-core/net.d.ts +0 -2
  118. package/dist/src/lib/hl-core/net.js +0 -7
  119. package/dist/src/lib/hl-core/signing.d.ts +0 -103
  120. package/dist/src/lib/hl-core/signing.js +0 -295
  121. package/dist/src/lib/hl-core/wire.d.ts +0 -34
  122. package/dist/src/lib/hl-core/wire.js +0 -81
  123. package/dist/src/lib/invoked-as.d.ts +0 -2
  124. package/dist/src/lib/invoked-as.js +0 -24
  125. package/dist/src/lib/journey-words.d.ts +0 -84
  126. package/dist/src/lib/journey-words.js +0 -363
  127. package/dist/src/lib/journey.d.ts +0 -150
  128. package/dist/src/lib/journey.js +0 -264
  129. package/dist/src/lib/key-receipt.d.ts +0 -48
  130. package/dist/src/lib/key-receipt.js +0 -116
  131. package/dist/src/lib/key-source.d.ts +0 -9
  132. package/dist/src/lib/key-source.js +0 -33
  133. package/dist/src/lib/keyfile.d.ts +0 -136
  134. package/dist/src/lib/keyfile.js +0 -397
  135. package/dist/src/lib/launch-claude.d.ts +0 -5
  136. package/dist/src/lib/launch-claude.js +0 -45
  137. package/dist/src/lib/lock-lookup.d.ts +0 -40
  138. package/dist/src/lib/lock-lookup.js +0 -92
  139. package/dist/src/lib/message-seal.d.ts +0 -63
  140. package/dist/src/lib/message-seal.js +0 -150
  141. package/dist/src/lib/net-choice.d.ts +0 -28
  142. package/dist/src/lib/net-choice.js +0 -72
  143. package/dist/src/lib/network.d.ts +0 -22
  144. package/dist/src/lib/network.js +0 -50
  145. package/dist/src/lib/next-words.d.ts +0 -105
  146. package/dist/src/lib/next-words.js +0 -298
  147. package/dist/src/lib/paths.d.ts +0 -41
  148. package/dist/src/lib/paths.js +0 -91
  149. package/dist/src/lib/plan-draw.d.ts +0 -56
  150. package/dist/src/lib/plan-draw.js +0 -219
  151. package/dist/src/lib/plan-live.d.ts +0 -20
  152. package/dist/src/lib/plan-live.js +0 -192
  153. package/dist/src/lib/qr.d.ts +0 -21
  154. package/dist/src/lib/qr.js +0 -402
  155. package/dist/src/lib/roster.d.ts +0 -20
  156. package/dist/src/lib/roster.js +0 -79
  157. package/dist/src/lib/sale-card.d.ts +0 -117
  158. package/dist/src/lib/sale-card.js +0 -261
  159. package/dist/src/lib/shop-init.d.ts +0 -62
  160. package/dist/src/lib/shop-init.js +0 -63
  161. package/dist/src/lib/sui-grpc-send.d.ts +0 -90
  162. package/dist/src/lib/sui-grpc-send.js +0 -128
  163. package/dist/src/lib/swap-core.d.ts +0 -163
  164. package/dist/src/lib/swap-core.js +0 -405
  165. package/dist/src/lib/tasks-digest.d.ts +0 -66
  166. package/dist/src/lib/tasks-digest.js +0 -200
  167. package/dist/src/lib/tasks-graph.d.ts +0 -79
  168. package/dist/src/lib/tasks-graph.js +0 -463
  169. package/dist/src/lib/tasks-lens.d.ts +0 -31
  170. package/dist/src/lib/tasks-lens.js +0 -47
  171. package/dist/src/lib/tasks-next.d.ts +0 -25
  172. package/dist/src/lib/tasks-next.js +0 -103
  173. package/dist/src/lib/tasks-prove.d.ts +0 -15
  174. package/dist/src/lib/tasks-prove.js +0 -68
  175. package/dist/src/lib/tasks-route.d.ts +0 -29
  176. package/dist/src/lib/tasks-route.js +0 -151
  177. package/dist/src/lib/tasks-score.d.ts +0 -36
  178. package/dist/src/lib/tasks-score.js +0 -152
  179. package/dist/src/lib/tasks-workspace.d.ts +0 -18
  180. package/dist/src/lib/tasks-workspace.js +0 -73
  181. package/dist/src/lib/timed-fetch.d.ts +0 -33
  182. package/dist/src/lib/timed-fetch.js +0 -59
  183. package/dist/src/lib/vault-read.d.ts +0 -24
  184. package/dist/src/lib/vault-read.js +0 -77
  185. package/dist/src/lib/vaultfile.d.ts +0 -103
  186. package/dist/src/lib/vaultfile.js +0 -249
  187. package/dist/src/lib/wallet-money.d.ts +0 -222
  188. package/dist/src/lib/wallet-money.js +0 -578
  189. package/dist/src/lib/wallet-request.d.ts +0 -50
  190. package/dist/src/lib/wallet-request.js +0 -86
  191. package/dist/src/links.d.ts +0 -5
  192. package/dist/src/links.js +0 -45
  193. package/dist/src/media.d.ts +0 -29
  194. package/dist/src/media.js +0 -487
  195. package/dist/src/message-receipt.d.ts +0 -25
  196. package/dist/src/message-receipt.js +0 -71
  197. package/dist/src/message.d.ts +0 -13
  198. package/dist/src/message.js +0 -92
  199. package/dist/src/move.d.ts +0 -36
  200. package/dist/src/move.js +0 -152
  201. package/dist/src/network-cmd.d.ts +0 -17
  202. package/dist/src/network-cmd.js +0 -74
  203. package/dist/src/next.d.ts +0 -12
  204. package/dist/src/next.js +0 -67
  205. package/dist/src/onboard.d.ts +0 -16
  206. package/dist/src/onboard.js +0 -149
  207. package/dist/src/plugin.d.ts +0 -2
  208. package/dist/src/plugin.js +0 -193
  209. package/dist/src/push.d.ts +0 -2
  210. package/dist/src/push.js +0 -115
  211. package/dist/src/render.d.ts +0 -21
  212. package/dist/src/render.js +0 -32
  213. package/dist/src/secrets-device.d.ts +0 -32
  214. package/dist/src/secrets-device.js +0 -127
  215. package/dist/src/secrets-give.d.ts +0 -125
  216. package/dist/src/secrets-give.js +0 -236
  217. package/dist/src/secrets-list.d.ts +0 -27
  218. package/dist/src/secrets-list.js +0 -84
  219. package/dist/src/secrets-run.d.ts +0 -31
  220. package/dist/src/secrets-run.js +0 -182
  221. package/dist/src/secrets.d.ts +0 -33
  222. package/dist/src/secrets.js +0 -200
  223. package/dist/src/setup.d.ts +0 -6
  224. package/dist/src/setup.js +0 -127
  225. package/dist/src/ship.d.ts +0 -2
  226. package/dist/src/ship.js +0 -18
  227. package/dist/src/shop-buy.d.ts +0 -16
  228. package/dist/src/shop-buy.js +0 -101
  229. package/dist/src/shop.d.ts +0 -10
  230. package/dist/src/shop.js +0 -112
  231. package/dist/src/skill-parser.d.ts +0 -14
  232. package/dist/src/skill-parser.js +0 -113
  233. package/dist/src/skill.d.ts +0 -2
  234. package/dist/src/skill.js +0 -493
  235. package/dist/src/slug.d.ts +0 -2
  236. package/dist/src/slug.js +0 -6
  237. package/dist/src/social.d.ts +0 -2
  238. package/dist/src/social.js +0 -106
  239. package/dist/src/staff.d.ts +0 -2
  240. package/dist/src/staff.js +0 -104
  241. package/dist/src/start.d.ts +0 -27
  242. package/dist/src/start.js +0 -225
  243. package/dist/src/status.d.ts +0 -2
  244. package/dist/src/status.js +0 -52
  245. package/dist/src/substrate.d.ts +0 -2
  246. package/dist/src/substrate.js +0 -258
  247. package/dist/src/swap.d.ts +0 -93
  248. package/dist/src/swap.js +0 -622
  249. package/dist/src/tasks.d.ts +0 -2
  250. package/dist/src/tasks.js +0 -743
  251. package/dist/src/templates.d.ts +0 -1
  252. package/dist/src/templates.js +0 -213
  253. package/dist/src/thread.d.ts +0 -2
  254. package/dist/src/thread.js +0 -52
  255. package/dist/src/trade.d.ts +0 -2
  256. package/dist/src/trade.js +0 -91
  257. package/dist/src/trail.d.ts +0 -2
  258. package/dist/src/trail.js +0 -41
  259. package/dist/src/validate.d.ts +0 -13
  260. package/dist/src/validate.js +0 -35
  261. package/dist/src/wallet-money.d.ts +0 -158
  262. package/dist/src/wallet-money.js +0 -664
  263. package/dist/src/wallet.d.ts +0 -169
  264. package/dist/src/wallet.js +0 -973
  265. package/dist/src/workflow.d.ts +0 -2
  266. package/dist/src/workflow.js +0 -169
  267. package/dist/src/write.d.ts +0 -43
  268. package/dist/src/write.js +0 -180
package/dist/src/skill.js DELETED
@@ -1,493 +0,0 @@
1
- import { Command } from 'commander';
2
- import { KEY_FILE } from './lib/paths.js';
3
- import { readFileSync, writeFileSync, existsSync, mkdirSync, statSync, readdirSync } from 'node:fs';
4
- import { resolve, basename, join } from 'node:path';
5
- import { parse as parseSkill } from './skill-parser.js';
6
- import { askPath } from './lib/api-path.js';
7
- export function skillCmd() {
8
- const cmd = new Command('skill').description('Skill management');
9
- cmd.command('new <name>')
10
- .description('Scaffold a new skill from template (includes 3 example evals)')
11
- .action((name) => {
12
- const body = [
13
- '---',
14
- `name: ${name}`,
15
- `title: ${name}`,
16
- 'summary: ',
17
- 'description: Use when ',
18
- 'tags: []',
19
- 'price: 0.02',
20
- 'evals:',
21
- ' - prompt: Replace with a representative request your skill should handle.',
22
- ' assertions:',
23
- ' - Produces the expected outcome',
24
- ' - Tone matches the skill description',
25
- ' - prompt: Edge case — replace with a tricky input.',
26
- ' assertions:',
27
- ' - Handles the edge case correctly',
28
- ' - Does not invent facts',
29
- ' - prompt: Negative case — input the skill should refuse or redirect.',
30
- ' assertions:',
31
- ' - Declines or redirects politely',
32
- ' - Suggests the right next step',
33
- '---',
34
- '',
35
- `# ${name}`,
36
- '',
37
- 'Skill behavior here.',
38
- '',
39
- ].join('\n');
40
- mkdirSync('skills', { recursive: true });
41
- const path = `skills/${name}.md`;
42
- writeFileSync(path, body);
43
- out(cmd, { ok: true, path, lines: body.split('\n').length });
44
- });
45
- cmd.command('emit <path>')
46
- .description('Emit agentskills.io directory format from flat skill.md')
47
- .option('--out <dir>', 'Output directory', './')
48
- .action((path, opts) => {
49
- if (!existsSync(path)) {
50
- out(cmd, { ok: false, error: `not found: ${path}` });
51
- return;
52
- }
53
- const name = basename(path, '.md');
54
- const outDir = resolve(opts.out, name);
55
- mkdirSync(outDir, { recursive: true });
56
- const content = readFileSync(path, 'utf8');
57
- writeFileSync(resolve(outDir, 'SKILL.md'), content);
58
- out(cmd, { ok: true, source: path, emitted: outDir, files: ['SKILL.md'] });
59
- });
60
- cmd.command('publish <path>')
61
- .description('Publish skill to agentskills.io directory')
62
- .action((path) => {
63
- if (!existsSync(path)) {
64
- out(cmd, { ok: false, error: `not found: ${path}` });
65
- return;
66
- }
67
- out(cmd, { ok: false, reason: 'agentskills.io API key required — set AGENTSKILLS_API_KEY' });
68
- });
69
- cmd.command('refresh <slug> [refs...]')
70
- .description('Re-fetch remote imported skills for a slug')
71
- .action((slug, refs) => {
72
- out(cmd, { ok: true, slug, refreshed: 0, failed: 0, total: refs.length });
73
- });
74
- cmd.command('import <ref>')
75
- .description('Import a skill from URL, npm, or github shorthand')
76
- .option('--slug <slug>', 'Owner slug', process.env.ONEIE_SLUG ?? 'local')
77
- .option('--price <usd>', 'Price USD', '0.02')
78
- .option('--name <name>', 'Override skill name')
79
- .option('--yes', 'Skip approval prompt (CI-friendly)')
80
- .action(async (ref, opts) => {
81
- const keyFile = KEY_FILE;
82
- const token = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
83
- if (!token) {
84
- out(cmd, { ok: false, error: 'not authenticated — run `oneie auth login`' });
85
- return;
86
- }
87
- const baseUrl = process.env.ONEIE_BASE_URL ?? 'https://one.ie';
88
- try {
89
- const res = await fetch(`${baseUrl}/api/skill/import`, {
90
- method: 'POST',
91
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
92
- body: JSON.stringify({ ref, slug: opts.slug, price: Number(opts.price), name: opts.name }),
93
- });
94
- const data = await res.json().catch(() => ({}));
95
- if (!res.ok) {
96
- out(cmd, { ok: false, status: res.status, ...data });
97
- return;
98
- }
99
- const sealed = data?.skill?.sealed === true;
100
- out(cmd, {
101
- ok: true,
102
- ref,
103
- slug: opts.slug,
104
- name: data?.skill?.name,
105
- price: data?.skill?.price,
106
- tier: sealed ? 'sealed (run-only)' : 'open',
107
- sealed,
108
- key: data?.key,
109
- diagnostics: data?.diagnostics ?? [],
110
- });
111
- }
112
- catch (err) {
113
- out(cmd, { ok: false, error: err.message, hint: 'try `oneie skill validate <path>` for offline validation' });
114
- }
115
- });
116
- // `skill:save` is the ONLY writer of the store `skill:run` / `skills:list`
117
- // actually read (`{slug}/skills/{name}/SKILL.md` in R2). It had no CLI verb:
118
- // `skill publish` writes the agentskills.io directory format to the LOCAL disk
119
- // and `skill import` pulls someone else's in, so the one thing an author could
120
- // not do from the CLI was push their own skill to their own workspace. `one push`
121
- // reaches it, but only by compiling a whole `ai/` tree — there was no way to
122
- // send a single file.
123
- cmd.command('push <path>')
124
- .description("Upload a SKILL.md into a workspace's R2 catalog — the store skill:run and skills:list read")
125
- .requiredOption('--slug <slug>', 'Workspace slug')
126
- .option('--api <url>', 'API base URL', 'https://one.ie')
127
- .option('--name <name>', 'Override skill name (defaults to frontmatter name:)')
128
- .action(async (path, opts) => {
129
- if (!existsSync(path)) {
130
- out(cmd, { ok: false, error: `not found: ${path}` });
131
- return;
132
- }
133
- const content = readFileSync(path, 'utf8');
134
- // THE NAME IS NEVER GUESSED FROM THE PATH. An earlier draft fell back to the
135
- // parent directory name, and `skill push /etc/hosts --slug one` therefore
136
- // published a skill called "etc" containing the host file — accepted, live,
137
- // and resolvable by `skill:run`. R2 has no skill-delete receiver, so that had
138
- // to be cleaned up with a direct `wrangler r2 object delete`. A path is not
139
- // an identity: the frontmatter declares the name, or the caller does.
140
- if (!/^---\s*$/m.test(content.split('\n')[0] ?? '')) {
141
- out(cmd, { ok: false, error: `not a skill: ${path} has no YAML frontmatter (a SKILL.md opens with ---)` });
142
- return;
143
- }
144
- const fmName = /^name:\s*(\S+)\s*$/m.exec(content.split(/^---\s*$/m)[1] ?? '')?.[1];
145
- const name = opts.name ?? fmName;
146
- if (!name) {
147
- out(cmd, { ok: false, error: 'no skill name — add `name:` to the frontmatter, or pass --name <name>' });
148
- return;
149
- }
150
- if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) {
151
- out(cmd, { ok: false, error: `invalid skill name "${name}" — lowercase alphanumeric and hyphens only` });
152
- return;
153
- }
154
- const keyFile = KEY_FILE;
155
- const key = process.env.ONE_API_KEY ?? process.env.ONEIE_API_KEY
156
- ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
157
- if (!key) {
158
- out(cmd, { ok: false, error: 'no API key — run `oneie auth login` or set ONE_API_KEY' });
159
- return;
160
- }
161
- try {
162
- const res = await fetch(askPath(opts.api.replace(/\/$/, ''), 'skill:save'), {
163
- method: 'POST',
164
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
165
- body: JSON.stringify({ data: { slug: opts.slug, name, content } }),
166
- });
167
- const text = await res.text();
168
- const envelope = (text ? JSON.parse(text) : {});
169
- const result = envelope.result ?? {};
170
- // THE ASK ENVELOPE ANSWERS HTTP 200 ON A REFUSAL — `outcome: "failure"`
171
- // carries the receiver's error under a 200, so `res.ok` alone would report
172
- // a refused push as a success.
173
- if (!res.ok || envelope.outcome === 'failure' || result.ok === false) {
174
- const base = result.error ?? text ?? 'push failed';
175
- const hint = result.callerRole === 'anonymous'
176
- ? 'the key was not recognised — run `oneie auth login`, or set ONE_API_KEY to a world key (it starts `one-` or `osk_`)'
177
- : result.error === 'forbidden'
178
- ? `the key is valid but does not control workspace "${opts.slug}"`
179
- : undefined;
180
- out(cmd, { ok: false, status: res.status, error: hint ? `${base} — ${hint}` : base });
181
- return;
182
- }
183
- out(cmd, { ok: true, name: result.name ?? name, slug: opts.slug, bytes: result.bytes ?? content.length });
184
- }
185
- catch (err) {
186
- out(cmd, { ok: false, error: err.message });
187
- }
188
- });
189
- cmd.command('fork <name>')
190
- .description('Copy an open skill into a workspace (refuses sealed — invoke-only)')
191
- .requiredOption('--slug <slug>', 'Workspace slug')
192
- .option('--api <url>', 'API base URL', 'https://one.ie')
193
- .action(async (name, opts) => {
194
- const keyFile = KEY_FILE;
195
- const key = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
196
- if (!key) {
197
- out(cmd, { ok: false, error: 'no API key — run `oneie auth login`' });
198
- return;
199
- }
200
- const token = key; // PLAIN key: requireAuth resolves a world key by `one-`/`osk_` PREFIX; a `slug:` prefix breaks it
201
- try {
202
- const res = await fetch(`${opts.api.replace(/\/$/, '')}/api/skills/workspace?slug=${encodeURIComponent(opts.slug)}`, {
203
- headers: { Authorization: `Bearer ${token}` },
204
- });
205
- const data = await res.json();
206
- if (!res.ok) {
207
- out(cmd, { ok: false, status: res.status, error: data.error ?? 'fork failed' });
208
- return;
209
- }
210
- const skill = (data.skills ?? []).find((s) => s.name === name);
211
- if (!skill) {
212
- out(cmd, { ok: false, error: `not found: ${name}` });
213
- return;
214
- }
215
- if (skill.sealed) {
216
- out(cmd, { ok: false, error: 'sealed skills are invoke-only' });
217
- return;
218
- }
219
- out(cmd, { ok: true, forked: name, slug: opts.slug, tier: 'open' });
220
- }
221
- catch (err) {
222
- out(cmd, { ok: false, error: err.message });
223
- }
224
- });
225
- cmd.command('list')
226
- .description('List skills imported into a workspace')
227
- .requiredOption('--slug <slug>', 'Workspace slug')
228
- .option('--api <url>', 'API base URL', 'https://one.ie')
229
- .action(async (opts) => {
230
- const keyFile = KEY_FILE;
231
- const key = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
232
- if (!key) {
233
- out(cmd, { ok: false, error: 'no API key — run `oneie auth login`' });
234
- return;
235
- }
236
- const token = key; // PLAIN key: requireAuth resolves a world key by `one-`/`osk_` PREFIX; a `slug:` prefix breaks it
237
- try {
238
- const res = await fetch(`${opts.api.replace(/\/$/, '')}/api/skills/workspace?slug=${encodeURIComponent(opts.slug)}`, {
239
- headers: { Authorization: `Bearer ${token}` },
240
- });
241
- const data = await res.json();
242
- if (!res.ok) {
243
- out(cmd, { ok: false, status: res.status, error: data.error ?? 'list failed' });
244
- return;
245
- }
246
- out(cmd, { ok: true, ...data });
247
- }
248
- catch (err) {
249
- out(cmd, { ok: false, error: err.message });
250
- }
251
- });
252
- cmd.command('unimport <name>')
253
- .description('Remove an imported skill from a workspace')
254
- .requiredOption('--slug <slug>', 'Workspace slug')
255
- .option('--api <url>', 'API base URL', 'https://one.ie')
256
- .action(async (name, opts) => {
257
- const keyFile = KEY_FILE;
258
- const key = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
259
- if (!key) {
260
- out(cmd, { ok: false, error: 'no API key — run `oneie auth login`' });
261
- return;
262
- }
263
- const token = key; // PLAIN key: requireAuth resolves a world key by `one-`/`osk_` PREFIX; a `slug:` prefix breaks it
264
- try {
265
- const res = await fetch(`${opts.api.replace(/\/$/, '')}/api/skill/${encodeURIComponent(name)}?slug=${encodeURIComponent(opts.slug)}`, {
266
- method: 'DELETE',
267
- headers: { Authorization: `Bearer ${token}` },
268
- });
269
- const data = await res.json();
270
- if (!res.ok) {
271
- out(cmd, { ok: false, status: res.status, error: data.error ?? 'unimport failed' });
272
- return;
273
- }
274
- out(cmd, { ok: true, ...data });
275
- }
276
- catch (err) {
277
- out(cmd, { ok: false, error: err.message });
278
- }
279
- });
280
- cmd.command('validate <path>')
281
- .description('Validate a skill file or directory; reports diagnostics')
282
- .action((path) => {
283
- if (!existsSync(path)) {
284
- out(cmd, { ok: false, error: `not found: ${path}` });
285
- return;
286
- }
287
- const targets = [];
288
- const walk = (dir, depth) => {
289
- if (depth > 4)
290
- return;
291
- const skillMd = join(dir, 'SKILL.md');
292
- if (existsSync(skillMd) && statSync(skillMd).isFile()) {
293
- targets.push({ file: skillMd, stem: basename(dir) });
294
- return;
295
- }
296
- for (const entry of readdirSync(dir)) {
297
- if (entry.startsWith('.') || entry === 'node_modules')
298
- continue;
299
- const full = join(dir, entry);
300
- const sub = statSync(full);
301
- if (sub.isFile() && entry.endsWith('.md') && entry !== 'SKILL.md') {
302
- targets.push({ file: full, stem: basename(entry, '.md') });
303
- }
304
- else if (sub.isDirectory()) {
305
- walk(full, depth + 1);
306
- }
307
- }
308
- };
309
- const st = statSync(path);
310
- if (st.isDirectory()) {
311
- walk(path, 0);
312
- }
313
- else {
314
- const stem = path.endsWith('/SKILL.md')
315
- ? basename(resolve(path, '..'))
316
- : basename(path, '.md');
317
- targets.push({ file: path, stem });
318
- }
319
- const results = targets.map(t => {
320
- const text = readFileSync(t.file, 'utf8');
321
- const parsed = parseSkill(text, { pathStem: t.stem });
322
- const warns = parsed.diagnostics.filter((d) => d.level === 'warn');
323
- return {
324
- file: t.file,
325
- name: parsed.meta.name ?? null,
326
- ok: typeof parsed.meta.name === 'string' && !!parsed.meta.description,
327
- diagnostics: parsed.diagnostics,
328
- warnCount: warns.length,
329
- };
330
- });
331
- const okCount = results.filter(r => r.ok).length;
332
- out(cmd, { ok: okCount === results.length, total: results.length, passed: okCount, results });
333
- });
334
- cmd.command('eval <path>')
335
- .description('Run skill evals from frontmatter evals[] via POST /api/eval')
336
- .option('--slug <slug>', 'Workspace slug', process.env.ONEIE_SLUG ?? 'local')
337
- .option('--api <url>', 'API base URL', process.env.ONEIE_BASE_URL ?? 'https://one.ie')
338
- .option('--iteration <n>', 'Iteration number', '1')
339
- .action(async (path, opts) => {
340
- if (!existsSync(path)) {
341
- out(cmd, { ok: false, error: `not found: ${path}` });
342
- return;
343
- }
344
- const keyFile = KEY_FILE;
345
- const token = process.env.ONEIE_API_KEY ?? (existsSync(keyFile) ? readFileSync(keyFile, 'utf8').trim() : '');
346
- if (!token) {
347
- out(cmd, { ok: false, error: 'not authenticated — run `oneie auth login`' });
348
- return;
349
- }
350
- const content = readFileSync(path, 'utf8');
351
- const parsed = parseSkill(content, { pathStem: basename(path, '.md') });
352
- const skillName = typeof parsed.meta.name === 'string' ? parsed.meta.name : basename(path, '.md');
353
- // Frontmatter is canonical when present; otherwise fall back to the bank.
354
- const frontmatterEvals = extractEvals(content);
355
- const evals = frontmatterEvals.length ? frontmatterEvals : readSidecarEvals(path);
356
- if (!evals.length) {
357
- out(cmd, { ok: false, error: `no evals for ${skillName} — add an evals: block to the frontmatter, or an evals/evals.json bank beside it (see \`oneie skill new\`)` });
358
- return;
359
- }
360
- try {
361
- const res = await fetch(`${opts.api.replace(/\/$/, '')}/api/eval`, {
362
- method: 'POST',
363
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
364
- body: JSON.stringify({ slug: opts.slug, skillPath: skillName, iteration: Number(opts.iteration), draftContent: content, draftEvals: evals }),
365
- });
366
- const data = await res.json().catch(() => ({}));
367
- if (!res.ok) {
368
- out(cmd, { ok: false, status: res.status, error: data?.error ?? 'eval failed' });
369
- return;
370
- }
371
- const b = data?.benchmark;
372
- const m = data?.mastery;
373
- out(cmd, {
374
- ok: true,
375
- skill: skillName,
376
- cases: evals.length,
377
- pass_rate: b?.with_skill?.pass_rate,
378
- delta_pass: b?.delta?.pass_rate,
379
- mastery_level: m?.level,
380
- mastery_prob: m?.prob,
381
- });
382
- }
383
- catch (err) {
384
- out(cmd, { ok: false, error: err.message });
385
- }
386
- });
387
- return cmd;
388
- }
389
- /**
390
- * Evals live in two places and only one of them was ever read here:
391
- * 1. an `evals:` block in SKILL.md frontmatter
392
- * 2. a sibling `evals/evals.json` bank
393
- * Every shipped skill uses (2) — measured 51 sidecar banks and 0 frontmatter
394
- * blocks under one.ie/ai/skills — so `skill eval` refused every real skill with
395
- * "no evals found in frontmatter". The server already reads both
396
- * (pages/api/eval.ts), so this only brings the CLI's local read in line.
397
- *
398
- * The bank is either a bare array or `{ skill_name, evals: [...] }`, and its
399
- * cases say `expected_output` where TestCase says `expected`. Normalise both.
400
- */
401
- function readSidecarEvals(skillPath) {
402
- const dir = skillPath.endsWith('.md') ? resolve(skillPath, '..') : skillPath;
403
- const bank = join(dir, 'evals', 'evals.json');
404
- if (!existsSync(bank))
405
- return [];
406
- try {
407
- const raw = JSON.parse(readFileSync(bank, 'utf8'));
408
- const list = Array.isArray(raw)
409
- ? raw
410
- : Array.isArray(raw.evals)
411
- ? raw.evals
412
- : [];
413
- return list
414
- .map((c, i) => {
415
- const o = c;
416
- return {
417
- id: o.id === undefined ? `case-${i + 1}` : String(o.id),
418
- prompt: typeof o.prompt === 'string' ? o.prompt : '',
419
- expected: String(o.expected ?? o.expected_output ?? ''),
420
- assertions: Array.isArray(o.assertions) ? o.assertions.map(String) : [],
421
- };
422
- })
423
- .filter(c => c.prompt && c.assertions.length > 0);
424
- }
425
- catch {
426
- return [];
427
- }
428
- }
429
- // Mirrors one.ie/web/src/lib/eval/evals-source.ts and packages/mcp/src/tools/lifecycle.ts
430
- function extractEvals(content) {
431
- const fm = content.match(/^---\n([\s\S]*?)\n---/)?.[1];
432
- if (!fm)
433
- return [];
434
- const lines = fm.split('\n');
435
- const startIdx = lines.findIndex(l => /^evals:\s*$/.test(l));
436
- if (startIdx < 0)
437
- return [];
438
- const unquote = (s) => s.replace(/^["']|["']$/g, '');
439
- const cases = [];
440
- let cur = null;
441
- let inAssertions = false;
442
- for (let i = startIdx + 1; i < lines.length; i++) {
443
- const line = lines[i];
444
- if (/^[A-Za-z_][\w-]*:/.test(line))
445
- break;
446
- const promptMatch = line.match(/^\s+-\s+prompt:\s*(.+?)\s*$/);
447
- if (promptMatch) {
448
- if (cur)
449
- cases.push(cur);
450
- cur = { id: `case-${cases.length + 1}`, prompt: unquote(promptMatch[1]), expected: '', assertions: [] };
451
- inAssertions = false;
452
- continue;
453
- }
454
- if (!cur)
455
- continue;
456
- const idMatch = line.match(/^\s+id:\s*(.+?)\s*$/);
457
- if (idMatch) {
458
- cur.id = unquote(idMatch[1]);
459
- continue;
460
- }
461
- const expectedMatch = line.match(/^\s+expected:\s*(.+?)\s*$/);
462
- if (expectedMatch) {
463
- cur.expected = unquote(expectedMatch[1]);
464
- continue;
465
- }
466
- if (/^\s+assertions:\s*$/.test(line)) {
467
- inAssertions = true;
468
- continue;
469
- }
470
- const itemMatch = line.match(/^\s+-\s+(.+?)\s*$/);
471
- if (itemMatch && inAssertions)
472
- cur.assertions.push(unquote(itemMatch[1]));
473
- }
474
- if (cur)
475
- cases.push(cur);
476
- return cases.filter(c => c.prompt && c.assertions.length > 0);
477
- }
478
- function out(cmd, data) {
479
- const isJson = cmd.parent?.opts().json;
480
- if (isJson) {
481
- process.stdout.write(JSON.stringify(data) + '\n');
482
- }
483
- else if (data.ok) {
484
- const pairs = Object.entries(data)
485
- .filter(([k]) => k !== 'ok')
486
- .map(([k, v]) => `${k}=${JSON.stringify(v)}`)
487
- .join(' ');
488
- console.log('✓', pairs);
489
- }
490
- else {
491
- console.error('✗', String(data.error ?? data.reason ?? JSON.stringify(data)));
492
- }
493
- }
@@ -1,2 +0,0 @@
1
- export declare function safeSlug(s: string): string;
2
- export declare function namespaced(agency: string, name: string): string;
package/dist/src/slug.js DELETED
@@ -1,6 +0,0 @@
1
- export function safeSlug(s) {
2
- return s.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
3
- }
4
- export function namespaced(agency, name) {
5
- return `${safeSlug(agency)}--${safeSlug(name)}`;
6
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function socialCmd(): Command;
@@ -1,106 +0,0 @@
1
- import { Command } from 'commander';
2
- import { out, resolveBase, resolveKey } from './lib/client.js';
3
- import { webBase } from './lib/roster.js';
4
- const DEFAULT_API = resolveBase({}, 'https://one.ie');
5
- function readApiKey() {
6
- const key = resolveKey();
7
- return key || null;
8
- }
9
- export function socialCmd() {
10
- const cmd = new Command('social').description('Social post management');
11
- cmd
12
- .command('list')
13
- .description('List social posts for a group')
14
- .requiredOption('--group <groupId>', 'Group ID')
15
- .option('--status <status>', 'Filter: draft|scheduled|publishing|published|failed')
16
- .option('--limit <n>', 'Max results', '50')
17
- .option('--api <url>', 'API base URL', DEFAULT_API)
18
- .action(async (opts) => {
19
- const key = readApiKey();
20
- const base = webBase(opts.api).replace(/\/$/, '');
21
- const params = new URLSearchParams({ groupId: opts.group, limit: opts.limit });
22
- if (opts.status)
23
- params.set('status', opts.status);
24
- const res = await fetch(`${base}/api/social/posts?${params}`, {
25
- headers: key ? { Authorization: `Bearer ${key}` } : {},
26
- });
27
- if (!res.ok) {
28
- out(cmd, { ok: false, error: `${res.status}` });
29
- return;
30
- }
31
- const data = await res.json();
32
- out(cmd, { ok: true, posts: data.posts, count: data.posts.length });
33
- });
34
- cmd
35
- .command('create')
36
- .description('Create a DRAFT social post. A key drafts only — scheduling or publishing is a person\'s step on ' +
37
- '/u/<group>/marketing/social, because a scheduled post publishes itself with nobody in the loop.')
38
- .requiredOption('--group <groupId>', 'Group ID')
39
- .requiredOption('--content <text>', 'Post content')
40
- .requiredOption('--platforms <list>', 'Comma-separated platforms (twitter,linkedin,...)')
41
- .option('--media-url <url>', 'Absolute URL of an image or video (e.g. the url `one media upload` prints)')
42
- .option('--media-type <type>', 'image | video (default: guessed from the URL extension)')
43
- .option('--api <url>', 'API base URL', DEFAULT_API)
44
- .action(async (opts) => {
45
- const key = readApiKey();
46
- if (!key) {
47
- out(cmd, { ok: false, error: 'no API key — run: oneie auth login' });
48
- return;
49
- }
50
- const base = webBase(opts.api).replace(/\/$/, '');
51
- const platforms = opts.platforms.split(',').map((p) => p.trim());
52
- const body = { groupId: opts.group, content: opts.content, platforms };
53
- if (opts.mediaUrl) {
54
- if (!/^https?:\/\//i.test(opts.mediaUrl)) {
55
- out(cmd, { ok: false, error: '--media-url must be absolute — platforms fetch it from their own servers' });
56
- return;
57
- }
58
- const mediaType = opts.mediaType ?? (/\.(mp4|m4v|mov|webm)(\?|#|$)/i.test(opts.mediaUrl) ? 'video' : 'image');
59
- if (mediaType !== 'image' && mediaType !== 'video') {
60
- out(cmd, { ok: false, error: "--media-type must be 'image' or 'video'" });
61
- return;
62
- }
63
- body.mediaUrl = opts.mediaUrl;
64
- body.mediaType = mediaType;
65
- }
66
- const res = await fetch(`${base}/api/social/posts`, {
67
- method: 'POST',
68
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
69
- body: JSON.stringify(body),
70
- });
71
- if (!res.ok) {
72
- const text = await res.text();
73
- out(cmd, { ok: false, error: `${res.status}: ${text}` });
74
- return;
75
- }
76
- const data = await res.json();
77
- out(cmd, {
78
- ok: true,
79
- id: data.post.id,
80
- status: data.post.status,
81
- review: `${base}/u/${opts.group}/marketing/social`,
82
- });
83
- });
84
- cmd
85
- .command('accounts')
86
- .description('List connected social accounts for the authenticated user')
87
- .option('--api <url>', 'API base URL', DEFAULT_API)
88
- .action(async (opts) => {
89
- const key = readApiKey();
90
- if (!key) {
91
- out(cmd, { ok: false, error: 'no API key — run: oneie auth login' });
92
- return;
93
- }
94
- const base = webBase(opts.api).replace(/\/$/, '');
95
- const res = await fetch(`${base}/api/social/accounts`, {
96
- headers: { Authorization: `Bearer ${key}` },
97
- });
98
- if (!res.ok) {
99
- out(cmd, { ok: false, error: `${res.status}` });
100
- return;
101
- }
102
- const data = await res.json();
103
- out(cmd, { ok: true, accounts: data.accounts, count: data.accounts.length });
104
- });
105
- return cmd;
106
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function staffCmd(): Command;