@oneie/cli 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,402 +0,0 @@
1
- /**
2
- * qr.ts — a QR code for a terminal, with no dependency.
3
- *
4
- * The encoder is Project Nayuki's QR Code generator (MIT), trimmed to the one mode an
5
- * address needs (byte), taken from the copy qrcode.react bundles for one.ie/web — so the
6
- * /w QR and `one wallet receive` draw from the same algorithm. Unchanged apart from the
7
- * trim and the types: version and mask selection, the Reed-Solomon code, the penalty rule.
8
- * tests/wallet-receive.test.ts pins the module matrix to that bundled copy's output.
9
- *
10
- * @license QR Code generator library (TypeScript)
11
- * Copyright (c) Project Nayuki.
12
- * SPDX-License-Identifier: MIT
13
- */
14
- const ECC = {
15
- LOW: { ordinal: 0, formatBits: 1 },
16
- MEDIUM: { ordinal: 1, formatBits: 0 },
17
- QUARTILE: { ordinal: 2, formatBits: 3 },
18
- HIGH: { ordinal: 3, formatBits: 2 },
19
- };
20
- const ECC_CODEWORDS_PER_BLOCK = [
21
- [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
22
- [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
23
- [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
24
- [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
25
- ];
26
- const NUM_ERROR_CORRECTION_BLOCKS = [
27
- [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
28
- [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
29
- [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
30
- [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81],
31
- ];
32
- const PENALTY_N1 = 3, PENALTY_N2 = 3, PENALTY_N3 = 40, PENALTY_N4 = 10;
33
- function appendBits(val, len, bb) {
34
- if (len < 0 || len > 31 || val >>> len !== 0)
35
- throw new RangeError('Value out of range');
36
- for (let i = len - 1; i >= 0; i--)
37
- bb.push((val >>> i) & 1);
38
- }
39
- const getBit = (x, i) => ((x >>> i) & 1) !== 0;
40
- function assert(cond) { if (!cond)
41
- throw new Error('Assertion error'); }
42
- function numRawDataModules(ver) {
43
- let result = (16 * ver + 128) * ver + 64;
44
- if (ver >= 2) {
45
- const numAlign = Math.floor(ver / 7) + 2;
46
- result -= (25 * numAlign - 10) * numAlign - 55;
47
- if (ver >= 7)
48
- result -= 36;
49
- }
50
- return result;
51
- }
52
- const numDataCodewords = (ver, ecl) => Math.floor(numRawDataModules(ver) / 8) - ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
53
- function rsMultiply(x, y) {
54
- let z = 0;
55
- for (let i = 7; i >= 0; i--) {
56
- z = (z << 1) ^ ((z >>> 7) * 0x11d);
57
- z ^= ((y >>> i) & 1) * x;
58
- }
59
- return z;
60
- }
61
- function rsDivisor(degree) {
62
- const result = [];
63
- for (let i = 0; i < degree - 1; i++)
64
- result.push(0);
65
- result.push(1);
66
- let root = 1;
67
- for (let i = 0; i < degree; i++) {
68
- for (let j = 0; j < result.length; j++) {
69
- result[j] = rsMultiply(result[j], root);
70
- if (j + 1 < result.length)
71
- result[j] ^= result[j + 1];
72
- }
73
- root = rsMultiply(root, 0x02);
74
- }
75
- return result;
76
- }
77
- function rsRemainder(data, divisor) {
78
- const result = divisor.map(() => 0);
79
- for (const b of data) {
80
- const factor = b ^ result.shift();
81
- result.push(0);
82
- divisor.forEach((coef, i) => { result[i] ^= rsMultiply(coef, factor); });
83
- }
84
- return result;
85
- }
86
- class QrCode {
87
- version;
88
- ecl;
89
- size;
90
- modules = [];
91
- isFunction = [];
92
- constructor(version, ecl, dataCodewords) {
93
- this.version = version;
94
- this.ecl = ecl;
95
- this.size = version * 4 + 17;
96
- const row = new Array(this.size).fill(false);
97
- for (let i = 0; i < this.size; i++) {
98
- this.modules.push(row.slice());
99
- this.isFunction.push(row.slice());
100
- }
101
- this.drawFunctionPatterns();
102
- this.drawCodewords(this.addEccAndInterleave(dataCodewords));
103
- let mask = 0;
104
- let minPenalty = 1e9;
105
- for (let i = 0; i < 8; i++) {
106
- this.applyMask(i);
107
- this.drawFormatBits(i);
108
- const penalty = this.penaltyScore();
109
- if (penalty < minPenalty) {
110
- mask = i;
111
- minPenalty = penalty;
112
- }
113
- this.applyMask(i);
114
- }
115
- this.applyMask(mask);
116
- this.drawFormatBits(mask);
117
- this.isFunction = [];
118
- }
119
- drawFunctionPatterns() {
120
- for (let i = 0; i < this.size; i++) {
121
- this.setFunctionModule(6, i, i % 2 === 0);
122
- this.setFunctionModule(i, 6, i % 2 === 0);
123
- }
124
- this.drawFinderPattern(3, 3);
125
- this.drawFinderPattern(this.size - 4, 3);
126
- this.drawFinderPattern(3, this.size - 4);
127
- const pos = this.alignmentPatternPositions();
128
- const n = pos.length;
129
- for (let i = 0; i < n; i++) {
130
- for (let j = 0; j < n; j++) {
131
- if (!((i === 0 && j === 0) || (i === 0 && j === n - 1) || (i === n - 1 && j === 0)))
132
- this.drawAlignmentPattern(pos[i], pos[j]);
133
- }
134
- }
135
- this.drawFormatBits(0);
136
- this.drawVersion();
137
- }
138
- drawFormatBits(mask) {
139
- const data = (this.ecl.formatBits << 3) | mask;
140
- let rem = data;
141
- for (let i = 0; i < 10; i++)
142
- rem = (rem << 1) ^ ((rem >>> 9) * 0x537);
143
- const bits = ((data << 10) | rem) ^ 0x5412;
144
- for (let i = 0; i <= 5; i++)
145
- this.setFunctionModule(8, i, getBit(bits, i));
146
- this.setFunctionModule(8, 7, getBit(bits, 6));
147
- this.setFunctionModule(8, 8, getBit(bits, 7));
148
- this.setFunctionModule(7, 8, getBit(bits, 8));
149
- for (let i = 9; i < 15; i++)
150
- this.setFunctionModule(14 - i, 8, getBit(bits, i));
151
- for (let i = 0; i < 8; i++)
152
- this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
153
- for (let i = 8; i < 15; i++)
154
- this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
155
- this.setFunctionModule(8, this.size - 8, true);
156
- }
157
- drawVersion() {
158
- if (this.version < 7)
159
- return;
160
- let rem = this.version;
161
- for (let i = 0; i < 12; i++)
162
- rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);
163
- const bits = (this.version << 12) | rem;
164
- for (let i = 0; i < 18; i++) {
165
- const color = getBit(bits, i);
166
- const a = this.size - 11 + (i % 3);
167
- const b = Math.floor(i / 3);
168
- this.setFunctionModule(a, b, color);
169
- this.setFunctionModule(b, a, color);
170
- }
171
- }
172
- drawFinderPattern(x, y) {
173
- for (let dy = -4; dy <= 4; dy++) {
174
- for (let dx = -4; dx <= 4; dx++) {
175
- const dist = Math.max(Math.abs(dx), Math.abs(dy));
176
- const xx = x + dx, yy = y + dy;
177
- if (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size)
178
- this.setFunctionModule(xx, yy, dist !== 2 && dist !== 4);
179
- }
180
- }
181
- }
182
- drawAlignmentPattern(x, y) {
183
- for (let dy = -2; dy <= 2; dy++) {
184
- for (let dx = -2; dx <= 2; dx++)
185
- this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
186
- }
187
- }
188
- setFunctionModule(x, y, dark) {
189
- this.modules[y][x] = dark;
190
- this.isFunction[y][x] = true;
191
- }
192
- addEccAndInterleave(data) {
193
- const ver = this.version;
194
- const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[this.ecl.ordinal][ver];
195
- const blockEccLen = ECC_CODEWORDS_PER_BLOCK[this.ecl.ordinal][ver];
196
- const rawCodewords = Math.floor(numRawDataModules(ver) / 8);
197
- const numShortBlocks = numBlocks - (rawCodewords % numBlocks);
198
- const shortBlockLen = Math.floor(rawCodewords / numBlocks);
199
- const blocks = [];
200
- const div = rsDivisor(blockEccLen);
201
- for (let i = 0, k = 0; i < numBlocks; i++) {
202
- const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
203
- k += dat.length;
204
- const ecc = rsRemainder(dat, div);
205
- if (i < numShortBlocks)
206
- dat.push(0);
207
- blocks.push(dat.concat(ecc));
208
- }
209
- const result = [];
210
- for (let i = 0; i < blocks[0].length; i++) {
211
- blocks.forEach((block, j) => {
212
- if (i !== shortBlockLen - blockEccLen || j >= numShortBlocks)
213
- result.push(block[i]);
214
- });
215
- }
216
- assert(result.length === rawCodewords);
217
- return result;
218
- }
219
- drawCodewords(data) {
220
- let i = 0;
221
- for (let right = this.size - 1; right >= 1; right -= 2) {
222
- if (right === 6)
223
- right = 5;
224
- for (let vert = 0; vert < this.size; vert++) {
225
- for (let j = 0; j < 2; j++) {
226
- const x = right - j;
227
- const upward = ((right + 1) & 2) === 0;
228
- const y = upward ? this.size - 1 - vert : vert;
229
- if (!this.isFunction[y][x] && i < data.length * 8) {
230
- this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
231
- i++;
232
- }
233
- }
234
- }
235
- }
236
- assert(i === data.length * 8);
237
- }
238
- applyMask(mask) {
239
- for (let y = 0; y < this.size; y++) {
240
- for (let x = 0; x < this.size; x++) {
241
- let invert;
242
- switch (mask) {
243
- case 0:
244
- invert = (x + y) % 2 === 0;
245
- break;
246
- case 1:
247
- invert = y % 2 === 0;
248
- break;
249
- case 2:
250
- invert = x % 3 === 0;
251
- break;
252
- case 3:
253
- invert = (x + y) % 3 === 0;
254
- break;
255
- case 4:
256
- invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;
257
- break;
258
- case 5:
259
- invert = ((x * y) % 2) + ((x * y) % 3) === 0;
260
- break;
261
- case 6:
262
- invert = (((x * y) % 2) + ((x * y) % 3)) % 2 === 0;
263
- break;
264
- default: invert = (((x + y) % 2) + ((x * y) % 3)) % 2 === 0;
265
- }
266
- if (!this.isFunction[y][x] && invert)
267
- this.modules[y][x] = !this.modules[y][x];
268
- }
269
- }
270
- }
271
- penaltyScore() {
272
- let result = 0;
273
- const line = (get) => {
274
- for (let a = 0; a < this.size; a++) {
275
- let runColor = false;
276
- let run = 0;
277
- const hist = [0, 0, 0, 0, 0, 0, 0];
278
- for (let b = 0; b < this.size; b++) {
279
- if (get(a, b) === runColor) {
280
- run++;
281
- if (run === 5)
282
- result += PENALTY_N1;
283
- else if (run > 5)
284
- result++;
285
- }
286
- else {
287
- this.finderPenaltyAddHistory(run, hist);
288
- if (!runColor)
289
- result += this.finderPenaltyCountPatterns(hist) * PENALTY_N3;
290
- runColor = get(a, b);
291
- run = 1;
292
- }
293
- }
294
- result += this.finderPenaltyTerminateAndCount(runColor, run, hist) * PENALTY_N3;
295
- }
296
- };
297
- line((y, x) => this.modules[y][x]);
298
- line((x, y) => this.modules[y][x]);
299
- for (let y = 0; y < this.size - 1; y++) {
300
- for (let x = 0; x < this.size - 1; x++) {
301
- const c = this.modules[y][x];
302
- if (c === this.modules[y][x + 1] && c === this.modules[y + 1][x] && c === this.modules[y + 1][x + 1])
303
- result += PENALTY_N2;
304
- }
305
- }
306
- let dark = 0;
307
- for (const row of this.modules)
308
- dark = row.reduce((s, c) => s + (c ? 1 : 0), dark);
309
- const total = this.size * this.size;
310
- const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
311
- result += k * PENALTY_N4;
312
- return result;
313
- }
314
- alignmentPatternPositions() {
315
- if (this.version === 1)
316
- return [];
317
- const numAlign = Math.floor(this.version / 7) + 2;
318
- const step = this.version === 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
319
- const result = [6];
320
- for (let pos = this.size - 7; result.length < numAlign; pos -= step)
321
- result.splice(1, 0, pos);
322
- return result;
323
- }
324
- finderPenaltyCountPatterns(h) {
325
- const n = h[1];
326
- const core = n > 0 && h[2] === n && h[3] === n * 3 && h[4] === n && h[5] === n;
327
- return (core && h[0] >= n * 4 && h[6] >= n ? 1 : 0) + (core && h[6] >= n * 4 && h[0] >= n ? 1 : 0);
328
- }
329
- finderPenaltyTerminateAndCount(color, run, h) {
330
- if (color) {
331
- this.finderPenaltyAddHistory(run, h);
332
- run = 0;
333
- }
334
- run += this.size;
335
- this.finderPenaltyAddHistory(run, h);
336
- return this.finderPenaltyCountPatterns(h);
337
- }
338
- finderPenaltyAddHistory(run, h) {
339
- if (h[0] === 0)
340
- run += this.size;
341
- h.pop();
342
- h.unshift(run);
343
- }
344
- }
345
- /** Byte mode, error-correction MEDIUM boosted when it fits for free — Nayuki's encodeBinary. */
346
- export function qrMatrix(text) {
347
- const bytes = Array.from(new TextEncoder().encode(text));
348
- const data = [];
349
- for (const b of bytes)
350
- appendBits(b, 8, data);
351
- let ecl = ECC.MEDIUM;
352
- let version = 1;
353
- let usedBits = 0;
354
- for (;; version++) {
355
- const cc = version < 10 ? 8 : 16;
356
- usedBits = bytes.length >= 1 << cc ? Infinity : 4 + cc + data.length;
357
- if (usedBits <= numDataCodewords(version, ecl) * 8)
358
- break;
359
- if (version >= 40)
360
- throw new RangeError('Data too long');
361
- }
362
- for (const e of [ECC.MEDIUM, ECC.QUARTILE, ECC.HIGH])
363
- if (usedBits <= numDataCodewords(version, e) * 8)
364
- ecl = e;
365
- const bb = [];
366
- appendBits(4, 4, bb);
367
- appendBits(bytes.length, version < 10 ? 8 : 16, bb);
368
- bb.push(...data);
369
- const cap = numDataCodewords(version, ecl) * 8;
370
- appendBits(0, Math.min(4, cap - bb.length), bb);
371
- appendBits(0, (8 - (bb.length % 8)) % 8, bb);
372
- for (let pad = 0xec; bb.length < cap; pad ^= 0xec ^ 0x11)
373
- appendBits(pad, 8, bb);
374
- const words = new Array(bb.length / 8).fill(0);
375
- bb.forEach((b, i) => { words[i >>> 3] |= b << (7 - (i & 7)); });
376
- return new QrCode(version, ecl, words).modules;
377
- }
378
- /**
379
- * The matrix as terminal text: two module rows per line with half blocks, a 2-module quiet
380
- * zone, dark modules drawn as the terminal's background so it scans on a dark or light theme
381
- * alike (light = '█'). Plain characters only — no colour codes, so it survives a pipe.
382
- */
383
- export function qrTerminal(text) {
384
- const m = qrMatrix(text);
385
- const q = 2;
386
- const n = m.length + q * 2;
387
- const light = (x, y) => {
388
- const xx = x - q, yy = y - q;
389
- return !(xx >= 0 && yy >= 0 && xx < m.length && yy < m.length && m[yy][xx]);
390
- };
391
- const lines = [];
392
- for (let y = 0; y < n; y += 2) {
393
- let s = '';
394
- for (let x = 0; x < n; x++) {
395
- const top = light(x, y);
396
- const bottom = y + 1 < n ? light(x, y + 1) : true;
397
- s += top && bottom ? '█' : top ? '▀' : bottom ? '▄' : ' ';
398
- }
399
- lines.push(s);
400
- }
401
- return lines.join('\n');
402
- }
@@ -1,20 +0,0 @@
1
- import type { Seat } from './tasks-lens.js';
2
- export type RosterResult = {
3
- ok: true;
4
- seats: Seat[];
5
- source: string;
6
- } | {
7
- ok: false;
8
- error: string;
9
- };
10
- /** Keep only well-formed seats; a role with no id is not addressable. */
11
- export declare function toSeats(raw: unknown): Seat[];
12
- /** The roster route answers on the web host only — never the gateway. */
13
- export declare function webBase(base: string): string;
14
- export declare function loadRoster(opts: {
15
- base: string;
16
- workspace?: string;
17
- file?: string;
18
- headers: Record<string, string>;
19
- fetchImpl?: typeof fetch;
20
- }): Promise<RosterResult>;
@@ -1,79 +0,0 @@
1
- // roster — where a seat's stake is read from, for `brief --as` / `route` / `next`.
2
- //
3
- // The stake is the persona's `subscribes:` and its place in the chart is `reports_to:`.
4
- // Both are served by ONE route, GET /api/agents/roster (one.ie/web — the same parse of
5
- // `{slug}/agents/*.md` that world:sync-subscriptions turns into follows rows), so the
6
- // lens and the router read one declaration. Three facts measured 2026-09-28 shape this:
7
- // - the route lives on the web host only: api.one.ie answers it 404, so the base is
8
- // rewritten to one.ie whatever --api says;
9
- // - `source=workspace` needs authority over the group (403 for a key that lacks it),
10
- // `source=fleet` needs only a world key — so we fall back to the bundled fleet and SAY
11
- // so, because fleet is not what the router reads for a group with its own personas;
12
- // - the shared gateway service key is not a world key (401 no_session on both), so
13
- // `--roster <file>` (a saved response) is the door for a caller holding only that.
14
- import { readFileSync } from 'node:fs';
15
- /** Keep only well-formed seats; a role with no id is not addressable. */
16
- export function toSeats(raw) {
17
- const list = Array.isArray(raw) ? raw : raw && typeof raw === 'object' && Array.isArray(raw.roles) ? raw.roles : [];
18
- const out = [];
19
- for (const r of list) {
20
- if (!r || typeof r.id !== 'string' || !r.id)
21
- continue;
22
- out.push({
23
- id: r.id,
24
- ...(typeof r.tier === 'string' ? { tier: r.tier } : {}),
25
- reportsTo: typeof r.reportsTo === 'string' && r.reportsTo ? r.reportsTo : null,
26
- subscribes: Array.isArray(r.subscribes) ? r.subscribes.filter((t) => typeof t === 'string') : [],
27
- });
28
- }
29
- return out;
30
- }
31
- /** The roster route answers on the web host only — never the gateway. */
32
- export function webBase(base) {
33
- return new URL(base).hostname === 'api.one.ie' ? 'https://one.ie' : base;
34
- }
35
- export async function loadRoster(opts) {
36
- if (opts.file) {
37
- try {
38
- const seats = toSeats(JSON.parse(readFileSync(opts.file, 'utf8')));
39
- if (!seats.length)
40
- return { ok: false, error: `--roster ${opts.file}: no roles in it (want {roles:[{id,reportsTo,subscribes}]})` };
41
- return { ok: true, seats, source: `file ${opts.file}` };
42
- }
43
- catch (e) {
44
- return { ok: false, error: `--roster: ${e instanceof Error ? e.message : String(e)}` };
45
- }
46
- }
47
- if (!opts.workspace)
48
- return { ok: false, error: 'reading a seat lens needs --workspace (whose roster?), --roster <file>, or --tags' };
49
- const f = opts.fetchImpl ?? fetch;
50
- const web = webBase(opts.base);
51
- const url = (source) => `${web}/api/agents/roster?slug=${encodeURIComponent(opts.workspace)}${source ? `&source=${source}` : ''}`;
52
- const refusals = [];
53
- for (const source of [undefined, 'fleet']) {
54
- let res;
55
- try {
56
- res = await f(url(source), { headers: opts.headers });
57
- }
58
- catch (e) {
59
- refusals.push(`${source ?? 'workspace'}: ${e instanceof Error ? e.message : String(e)}`);
60
- continue;
61
- }
62
- const text = await res.text();
63
- if (!res.ok) {
64
- refusals.push(`${source ?? 'workspace'}: ${res.status} ${text.slice(0, 80)}`);
65
- continue;
66
- }
67
- try {
68
- const seats = toSeats(JSON.parse(text));
69
- if (seats.length) {
70
- return { ok: true, seats, source: source === 'fleet' ? 'fleet (bundled agents — NOT this group\'s own personas; the router reads those)' : `workspace ${opts.workspace}` };
71
- }
72
- refusals.push(`${source ?? 'workspace'}: empty roster`);
73
- }
74
- catch {
75
- refusals.push(`${source ?? 'workspace'}: ${res.status} not JSON`);
76
- }
77
- }
78
- return { ok: false, error: `could not read the roster (${refusals.join('; ')}) — pass --roster <file> or --tags` };
79
- }
@@ -1,117 +0,0 @@
1
- export type SaleKind = 'product' | 'service' | 'subscription' | 'course';
2
- export type SaleRail = 'card' | 'crypto';
3
- export type SaleChannel = 'web' | 'chat' | 'whatsapp' | 'instagram' | 'sms' | 'email';
4
- export type SalePhase = 'idle' | 'paid';
5
- export interface SaleOffer {
6
- kind: SaleKind;
7
- kindLabel: string;
8
- name: string;
9
- detail: string;
10
- price: string;
11
- cents: number;
12
- cadence: string;
13
- verb: string;
14
- stamp: string;
15
- link: string;
16
- live: boolean;
17
- rails: readonly SaleRail[];
18
- }
19
- export declare const SALE_OFFERS: readonly SaleOffer[];
20
- export interface SaleRailCopy {
21
- id: SaleRail;
22
- label: string;
23
- issuer: string;
24
- lands: string;
25
- }
26
- export declare const SALE_RAILS: readonly SaleRailCopy[];
27
- export interface SaleChannelCopy {
28
- id: SaleChannel;
29
- label: string;
30
- bar: string;
31
- native: boolean;
32
- }
33
- export declare const SALE_CHANNELS: readonly SaleChannelCopy[];
34
- export declare const SALE_COPY: {
35
- readonly opens: "the link opens on the card";
36
- readonly cardOnly: "Monthly is card only.";
37
- readonly example: "Example sale. Nothing here is a real payment.";
38
- readonly exampleOffer: "Example price.";
39
- readonly address: "0x5a1e…0e01";
40
- readonly settled: "On Sui";
41
- readonly shop: "Your shop";
42
- readonly from: "hello@yourshop.example";
43
- readonly ask: "How much is it?";
44
- readonly time: "10:02";
45
- readonly emailFrom: "From";
46
- readonly emailSubject: "Subject";
47
- readonly emailPay: "Pay";
48
- };
49
- export declare const SALE_KIND_IDS: SaleKind[];
50
- export declare const SALE_RAIL_IDS: SaleRail[];
51
- export declare const SALE_CHANNEL_IDS: SaleChannel[];
52
- export declare const saleOffer: (kind: SaleKind) => SaleOffer;
53
- export declare const saleRail: (id: SaleRail) => SaleRailCopy;
54
- export declare const saleChannel: (id: SaleChannel) => SaleChannelCopy;
55
- /** Asking a card-only offer for crypto gives card — the same rule the web face follows. */
56
- export declare const saleRailFor: (offer: SaleOffer, rail: SaleRail) => SaleRail;
57
- export declare const salePrice: (offer: SaleOffer) => string;
58
- export declare const salePay: (offer: SaleOffer) => string;
59
- /** From cents, so a dollar price never rounds into a different coin amount. */
60
- export declare function saleUsdc(offer: SaleOffer): string;
61
- export declare const salePayOn: (offer: SaleOffer, rail: SaleRail) => string;
62
- export declare function saleMessage(channel: SaleChannel, offer: SaleOffer): string;
63
- export declare const saleSubject: (offer: SaleOffer) => string;
64
- /** The `?via=` tag is how /sales counts which channel a sale came through. */
65
- export declare const saleLink: (offer: SaleOffer, channel: SaleChannel) => string;
66
- /** A string from a flag, or null: the CLI refuses a word it does not know rather than drawing the default. */
67
- export declare const saleKindOf: (v: unknown) => SaleKind | null;
68
- export declare const saleRailOf: (v: unknown) => SaleRail | null;
69
- export declare const saleChannelOf: (v: unknown) => SaleChannel | null;
70
- /** The skill's limit (.claude/skills/ascii): every line fits a phone and a chat panel. */
71
- export declare const SALE_MAX_WIDTH = 70;
72
- export interface SaleDrawOpts {
73
- rail?: SaleRail;
74
- channel?: SaleChannel;
75
- phase?: SalePhase;
76
- /** Plain ASCII: a pipe, a log or NO_COLOR. */
77
- ascii?: boolean;
78
- }
79
- /** One offer as a payment card, on the rail it can really take. */
80
- export declare function saleCardLines(kind: SaleKind, opts?: SaleDrawOpts): string[];
81
- /** The card inside a channel's thread: who, the agent's words and link, then the card it opens on. */
82
- export declare function saleFrameLines(kind: SaleKind, channel: SaleChannel, opts?: SaleDrawOpts): string[];
83
- /** The whole drawing: one offer or several, framed or bare, with the example line once at the end. */
84
- export declare function drawSale(kinds: readonly SaleKind[], opts?: SaleDrawOpts): string;
85
- /** The same sale as data, for --json and for an agent: what would be drawn, never a payment. */
86
- export declare function saleJson(kinds: readonly SaleKind[], opts?: SaleDrawOpts): {
87
- ok: boolean;
88
- example: boolean;
89
- note: "Example sale. Nothing here is a real payment.";
90
- offers: ({
91
- channel: SaleChannel;
92
- message: string;
93
- link: string;
94
- lands: string;
95
- stamp?: string | undefined;
96
- pay: string;
97
- cardOnly?: "Monthly is card only." | undefined;
98
- kind: SaleKind;
99
- name: string;
100
- price: string;
101
- cents: number;
102
- live: boolean;
103
- rail: SaleRail;
104
- } | {
105
- link: string;
106
- lands: string;
107
- stamp?: string | undefined;
108
- pay: string;
109
- cardOnly?: "Monthly is card only." | undefined;
110
- kind: SaleKind;
111
- name: string;
112
- price: string;
113
- cents: number;
114
- live: boolean;
115
- rail: SaleRail;
116
- })[];
117
- };