@rebon/cli-darwin-arm64 1.8.7 → 1.9.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 (43) hide show
  1. package/bin/compose-runtime/payload/compose/shims/dsh-environment.js +34 -0
  2. package/bin/compose-runtime/src/commands-runtime.mjs +72 -0
  3. package/bin/compose-runtime/src/loader.mjs +7 -0
  4. package/bin/compose-runtime/src/probe.mjs +77 -0
  5. package/bin/compose-runtime/src/provided-modules.json +38 -0
  6. package/bin/compose-runtime/src/realm.mjs +5 -3
  7. package/bin/compose-runtime/src/registry.mjs +15 -2
  8. package/bin/compose-runtime/src/resolve.mjs +3 -33
  9. package/bin/marketplace/.claude-plugin/marketplace.json +258 -0
  10. package/bin/marketplace/plugins/dsh-llm-deepseek/LICENSE +21 -0
  11. package/bin/marketplace/plugins/dsh-llm-deepseek/llm-deepseek.js +672 -0
  12. package/bin/marketplace/plugins/dsh-llm-deepseek/rebon-plugin.json +27 -0
  13. package/bin/marketplace/plugins/dsh-tool-todo/LICENSE +21 -0
  14. package/bin/marketplace/plugins/dsh-tool-todo/rebon-plugin.json +27 -0
  15. package/bin/marketplace/plugins/dsh-tool-todo/tool-todo.js +143 -0
  16. package/bin/marketplace/plugins/dsh-tool-web/LICENSE +21 -0
  17. package/bin/marketplace/plugins/dsh-tool-web/rebon-plugin.json +27 -0
  18. package/bin/marketplace/plugins/dsh-tool-web/tool-web.js +1527 -0
  19. package/bin/marketplace/plugins/dsh-web-search-exa/LICENSE +21 -0
  20. package/bin/marketplace/plugins/dsh-web-search-exa/rebon-plugin.json +27 -0
  21. package/bin/marketplace/plugins/dsh-web-search-exa/web-search-exa.js +122 -0
  22. package/bin/mods-runtime/package.json +13 -0
  23. package/bin/mods-runtime/src/chain.mjs +188 -0
  24. package/bin/mods-runtime/src/classic.mjs +217 -0
  25. package/bin/mods-runtime/src/claude-code.mjs +101 -0
  26. package/bin/mods-runtime/src/client.mjs +316 -0
  27. package/bin/mods-runtime/src/engine.mjs +196 -0
  28. package/bin/mods-runtime/src/index.mjs +58 -0
  29. package/bin/mods-runtime/src/jsx-transform.mjs +324 -0
  30. package/bin/mods-runtime/src/mod.mjs +370 -0
  31. package/bin/mods-runtime/src/render.mjs +122 -0
  32. package/bin/mods-runtime/src/transpile.mjs +167 -0
  33. package/bin/plugin-host/src/cli.mjs +13 -0
  34. package/bin/plugin-host/src/host.mjs +11 -1
  35. package/bin/plugin-host/src/methods.mjs +4 -1
  36. package/bin/plugin-host/src/protocol.mjs +38 -4
  37. package/bin/rebon +2 -2
  38. package/bin/rebon-boa-helper +0 -0
  39. package/bin/rebon-browser-mcp +0 -0
  40. package/bin/rebon-computer-use +0 -0
  41. package/bin/rebon-lsp-mcp +0 -0
  42. package/bin/sandbox-win +0 -0
  43. package/package.json +1 -1
@@ -0,0 +1,324 @@
1
+ // JSX to `h(...)` calls, as a source-to-source transform.
2
+ //
3
+ // A Claude Code mod draws with JSX that compiles against the global `h`
4
+ // (`jsxFactory: "h"`, `jsxFragmentFactory: "Fragment"`). Node evaluates
5
+ // TypeScript by stripping its types, and strips nothing from a `.tsx` file:
6
+ // the JSX has to go first. This is that pass, and nothing more — type
7
+ // annotations survive it untouched for `stripTypeScriptTypes` to take out
8
+ // afterwards, which is why the two run in that order.
9
+ //
10
+ // It is a scanner, not a parser. It walks the source as JavaScript tokens,
11
+ // enough to know where a string, a template, a comment or a regular
12
+ // expression literal is, and treats `<` as the start of an element only where
13
+ // an expression may start — after `(`, `=`, `return`, `?`, `:` and their
14
+ // kind — and an identifier or `>` follows. Everything else is copied through.
15
+ // TSX's own rule for a generic arrow function (`<T,>(x: T) => x`) is honoured
16
+ // by bailing out of an element whose tag is followed by `,` or `extends`.
17
+ //
18
+ // What a bail-out costs is nothing: the `<` is copied as an operator and the
19
+ // rest of the source goes on, which is what the TypeScript parser would have
20
+ // done with it too. A JSX element that is malformed (an unclosed tag, a
21
+ // mismatched close) is left in the source as written, and the module then
22
+ // fails to load with Node's own syntax error naming the line.
23
+
24
+ const IDENT_START = /[A-Za-z_$]/;
25
+ const IDENT_PART = /[A-Za-z0-9_$]/;
26
+ const TAG_PART = /[A-Za-z0-9_$.:-]/;
27
+
28
+ /// Tokens after which the next `<` or `/` begins an expression rather than
29
+ /// continuing one.
30
+ const EXPRESSION_START_WORDS = new Set([
31
+ 'return', 'yield', 'await', 'typeof', 'void', 'delete', 'in', 'of', 'case',
32
+ 'else', 'do', 'throw', 'new', 'instanceof', 'export', 'default',
33
+ ]);
34
+ const CONTINUATION_PUNCT = new Set([')', ']', '}']);
35
+
36
+ const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ' };
37
+
38
+ /// Replaces every JSX element in `source` with `h(...)` calls.
39
+ export function transformJsx(source, { factory = 'h', fragment = 'Fragment' } = {}) {
40
+ return transformRange(source, 0, source.length, { factory, fragment });
41
+ }
42
+
43
+ function isExpressionStart(last) {
44
+ if (last === '') return true;
45
+ if (last.kind === 'word') return EXPRESSION_START_WORDS.has(last.text);
46
+ if (last.kind === 'punct') return !CONTINUATION_PUNCT.has(last.text);
47
+ // A string, number, template or element: an expression just ended.
48
+ return false;
49
+ }
50
+
51
+ function transformRange(src, start, end, options) {
52
+ let out = '';
53
+ let i = start;
54
+ let last = '';
55
+ while (i < end) {
56
+ const ch = src[i];
57
+ if (ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r') { out += ch; i += 1; continue; }
58
+ if (ch === '/' && src[i + 1] === '/') {
59
+ const stop = src.indexOf('\n', i);
60
+ const until = stop === -1 || stop > end ? end : stop;
61
+ out += src.slice(i, until); i = until; continue;
62
+ }
63
+ if (ch === '/' && src[i + 1] === '*') {
64
+ const stop = src.indexOf('*/', i + 2);
65
+ const until = stop === -1 || stop + 2 > end ? end : stop + 2;
66
+ out += src.slice(i, until); i = until; continue;
67
+ }
68
+ if (ch === '"' || ch === "'") {
69
+ const until = skipString(src, i, end);
70
+ out += src.slice(i, until); i = until; last = { kind: 'value' }; continue;
71
+ }
72
+ if (ch === '`') {
73
+ const { code, end: until } = copyTemplate(src, i, end, options);
74
+ out += code; i = until; last = { kind: 'value' }; continue;
75
+ }
76
+ if (ch === '/' && isExpressionStart(last)) {
77
+ const until = skipRegex(src, i, end);
78
+ out += src.slice(i, until); i = until; last = { kind: 'value' }; continue;
79
+ }
80
+ if (ch === '<' && isExpressionStart(last) && (IDENT_START.test(src[i + 1] ?? '') || src[i + 1] === '>')) {
81
+ const element = parseElement(src, i, end, options);
82
+ if (element !== null) {
83
+ out += element.code; i = element.end; last = { kind: 'value' }; continue;
84
+ }
85
+ }
86
+ if (IDENT_START.test(ch)) {
87
+ let j = i + 1;
88
+ while (j < end && IDENT_PART.test(src[j])) j += 1;
89
+ const word = src.slice(i, j);
90
+ out += word; i = j; last = { kind: 'word', text: word }; continue;
91
+ }
92
+ if (/[0-9]/.test(ch)) {
93
+ let j = i + 1;
94
+ while (j < end && /[0-9A-Za-z_.]/.test(src[j])) j += 1;
95
+ out += src.slice(i, j); i = j; last = { kind: 'value' }; continue;
96
+ }
97
+ out += ch; i += 1; last = { kind: 'punct', text: ch };
98
+ }
99
+ return out;
100
+ }
101
+
102
+ function skipString(src, i, end) {
103
+ const quote = src[i];
104
+ let j = i + 1;
105
+ while (j < end) {
106
+ if (src[j] === '\\') { j += 2; continue; }
107
+ if (src[j] === quote) return j + 1;
108
+ if (src[j] === '\n') return j;
109
+ j += 1;
110
+ }
111
+ return end;
112
+ }
113
+
114
+ /// A regular expression literal, with its character classes and flags.
115
+ function skipRegex(src, i, end) {
116
+ let j = i + 1;
117
+ let inClass = false;
118
+ while (j < end) {
119
+ const ch = src[j];
120
+ if (ch === '\\') { j += 2; continue; }
121
+ if (ch === '\n') return j;
122
+ if (inClass) { if (ch === ']') inClass = false; j += 1; continue; }
123
+ if (ch === '[') { inClass = true; j += 1; continue; }
124
+ if (ch === '/') { j += 1; while (j < end && IDENT_PART.test(src[j])) j += 1; return j; }
125
+ j += 1;
126
+ }
127
+ return end;
128
+ }
129
+
130
+ /// Copies a template literal, transforming the expressions inside `${}`.
131
+ function copyTemplate(src, i, end, options) {
132
+ let code = '`';
133
+ let j = i + 1;
134
+ while (j < end) {
135
+ const ch = src[j];
136
+ if (ch === '\\') { code += src.slice(j, j + 2); j += 2; continue; }
137
+ if (ch === '`') return { code: code + '`', end: j + 1 };
138
+ if (ch === '$' && src[j + 1] === '{') {
139
+ const close = findMatching(src, j + 1, end);
140
+ code += '${' + transformRange(src, j + 2, close, options) + '}';
141
+ j = close + 1;
142
+ continue;
143
+ }
144
+ code += ch; j += 1;
145
+ }
146
+ return { code, end };
147
+ }
148
+
149
+ /// The index of the `}` matching the `{` at `open`, or `end` when none.
150
+ function findMatching(src, open, end) {
151
+ let depth = 0;
152
+ let j = open;
153
+ let last = '';
154
+ while (j < end) {
155
+ const ch = src[j];
156
+ if (ch === '/' && src[j + 1] === '/') { const stop = src.indexOf('\n', j); j = stop === -1 ? end : stop; continue; }
157
+ if (ch === '/' && src[j + 1] === '*') { const stop = src.indexOf('*/', j + 2); j = stop === -1 ? end : stop + 2; continue; }
158
+ if (ch === '"' || ch === "'") { j = skipString(src, j, end); last = { kind: 'value' }; continue; }
159
+ if (ch === '`') { j = skipTemplate(src, j, end); last = { kind: 'value' }; continue; }
160
+ if (ch === '/' && isExpressionStart(last)) { j = skipRegex(src, j, end); last = { kind: 'value' }; continue; }
161
+ if (ch === '<' && isExpressionStart(last) && (IDENT_START.test(src[j + 1] ?? '') || src[j + 1] === '>')) {
162
+ const element = parseElement(src, j, end, { factory: 'h', fragment: 'Fragment' });
163
+ if (element !== null) { j = element.end; last = { kind: 'value' }; continue; }
164
+ }
165
+ if (ch === '{') depth += 1;
166
+ if (ch === '}') { depth -= 1; if (depth === 0) return j; }
167
+ if (IDENT_START.test(ch)) {
168
+ let k = j + 1;
169
+ while (k < end && IDENT_PART.test(src[k])) k += 1;
170
+ last = { kind: 'word', text: src.slice(j, k) }; j = k; continue;
171
+ }
172
+ if (/[0-9]/.test(ch)) { last = { kind: 'value' }; j += 1; continue; }
173
+ if (!/\s/.test(ch)) last = { kind: 'punct', text: ch };
174
+ j += 1;
175
+ }
176
+ return end;
177
+ }
178
+
179
+ function skipTemplate(src, i, end) {
180
+ let j = i + 1;
181
+ while (j < end) {
182
+ const ch = src[j];
183
+ if (ch === '\\') { j += 2; continue; }
184
+ if (ch === '`') return j + 1;
185
+ if (ch === '$' && src[j + 1] === '{') { j = findMatching(src, j + 1, end) + 1; continue; }
186
+ j += 1;
187
+ }
188
+ return end;
189
+ }
190
+
191
+ function skipSpace(src, j, end) {
192
+ while (j < end && /\s/.test(src[j])) j += 1;
193
+ return j;
194
+ }
195
+
196
+ function decodeEntities(text) {
197
+ return text.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (whole, body) => {
198
+ if (body[0] === '#') {
199
+ const code = body[1] === 'x' || body[1] === 'X' ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);
200
+ return Number.isFinite(code) ? String.fromCodePoint(code) : whole;
201
+ }
202
+ return Object.prototype.hasOwnProperty.call(ENTITIES, body) ? ENTITIES[body] : whole;
203
+ });
204
+ }
205
+
206
+ /// JSX text, with its lines trimmed the way the JSX grammar trims them.
207
+ function jsxText(raw) {
208
+ const lines = raw.split('\n');
209
+ const kept = [];
210
+ lines.forEach((line, index) => {
211
+ let text = line.replace(/\r$/, '');
212
+ if (index > 0) text = text.replace(/^[ \t]+/, '');
213
+ if (index < lines.length - 1) text = text.replace(/[ \t]+$/, '');
214
+ if (text.length > 0) kept.push(text);
215
+ });
216
+ return decodeEntities(kept.join(' '));
217
+ }
218
+
219
+ /// One element starting at the `<` at `i`, or `null` where that `<` is not
220
+ /// an element after all.
221
+ function parseElement(src, i, end, options) {
222
+ let j = i + 1;
223
+ let tag = '';
224
+ if (src[j] === '>') {
225
+ j += 1;
226
+ } else {
227
+ while (j < end && TAG_PART.test(src[j])) j += 1;
228
+ tag = src.slice(i + 1, j);
229
+ if (tag === '' || tag.endsWith('.') || tag.endsWith('-')) return null;
230
+ const after = skipSpace(src, j, end);
231
+ if (src[after] === ',' || src.startsWith('extends', after)) return null;
232
+ }
233
+ const props = [];
234
+ let selfClosing = false;
235
+ if (tag !== '') {
236
+ for (;;) {
237
+ j = skipSpace(src, j, end);
238
+ if (j >= end) return null;
239
+ if (src[j] === '/' && src[j + 1] === '>') { selfClosing = true; j += 2; break; }
240
+ if (src[j] === '>') { j += 1; break; }
241
+ if (src[j] === '{') {
242
+ const close = findMatching(src, j, end);
243
+ if (close >= end) return null;
244
+ const inner = src.slice(j + 1, close).trim();
245
+ if (!inner.startsWith('...')) return null;
246
+ props.push({ spread: transformRange(src, j + 1, close, options).trim().slice(3) });
247
+ j = close + 1;
248
+ continue;
249
+ }
250
+ if (!IDENT_START.test(src[j])) return null;
251
+ let k = j + 1;
252
+ while (k < end && TAG_PART.test(src[k])) k += 1;
253
+ const name = src.slice(j, k);
254
+ j = skipSpace(src, k, end);
255
+ if (src[j] !== '=') { props.push({ name, value: 'true' }); continue; }
256
+ j = skipSpace(src, j + 1, end);
257
+ if (src[j] === '"' || src[j] === "'") {
258
+ const close = src.indexOf(src[j], j + 1);
259
+ if (close === -1 || close > end) return null;
260
+ props.push({ name, value: JSON.stringify(decodeEntities(src.slice(j + 1, close))) });
261
+ j = close + 1;
262
+ continue;
263
+ }
264
+ if (src[j] === '{') {
265
+ const close = findMatching(src, j, end);
266
+ if (close >= end) return null;
267
+ props.push({ name, value: '(' + transformRange(src, j + 1, close, options).trim() + ')' });
268
+ j = close + 1;
269
+ continue;
270
+ }
271
+ if (src[j] === '<') {
272
+ const nested = parseElement(src, j, end, options);
273
+ if (nested === null) return null;
274
+ props.push({ name, value: nested.code });
275
+ j = nested.end;
276
+ continue;
277
+ }
278
+ return null;
279
+ }
280
+ }
281
+ const children = [];
282
+ if (!selfClosing) {
283
+ for (;;) {
284
+ if (j >= end) return null;
285
+ if (src[j] === '<' && src[j + 1] === '/') {
286
+ const close = src.indexOf('>', j + 2);
287
+ if (close === -1 || close > end) return null;
288
+ const closing = src.slice(j + 2, close).trim();
289
+ if (closing !== tag) return null;
290
+ j = close + 1;
291
+ break;
292
+ }
293
+ if (src[j] === '{') {
294
+ const close = findMatching(src, j, end);
295
+ if (close >= end) return null;
296
+ const inner = src.slice(j + 1, close).trim();
297
+ if (inner !== '' && !(inner.startsWith('/*') && inner.endsWith('*/'))) {
298
+ children.push(transformRange(src, j + 1, close, options).trim());
299
+ }
300
+ j = close + 1;
301
+ continue;
302
+ }
303
+ if (src[j] === '<') {
304
+ const nested = parseElement(src, j, end, options);
305
+ if (nested === null) return null;
306
+ children.push(nested.code);
307
+ j = nested.end;
308
+ continue;
309
+ }
310
+ let k = j;
311
+ while (k < end && src[k] !== '<' && src[k] !== '{') k += 1;
312
+ const text = jsxText(src.slice(j, k));
313
+ if (text.length > 0) children.push(JSON.stringify(text));
314
+ j = k;
315
+ }
316
+ }
317
+ const type = tag === '' ? options.fragment : /^[a-z]/.test(tag) && !tag.includes('.') ? JSON.stringify(tag) : tag;
318
+ let propsCode = 'null';
319
+ if (props.length > 0) {
320
+ propsCode = '{ ' + props.map((prop) => (prop.spread !== undefined ? `...(${prop.spread})` : `${JSON.stringify(prop.name)}: ${prop.value}`)).join(', ') + ' }';
321
+ }
322
+ const parts = [type, propsCode, ...children];
323
+ return { code: `${options.factory}(${parts.join(', ')})`, end: j };
324
+ }