@cmodjs/core 6.3.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/commands.md +123 -65
- package/docs/dependencies.md +189 -4
- package/docs/index.md +56 -12
- package/docs/install-steps.md +20 -17
- package/docs/jobs.md +43 -16
- package/docs/mod.md +43 -27
- package/docs/options.md +2 -2
- package/docs/session.md +58 -32
- package/docs/testing.md +88 -24
- package/docs/ui.md +128 -58
- package/installer.d.ts +2 -2
- package/jobs/context.js +1 -1
- package/jobs/program.d.ts +4 -1
- package/jobs/program.d.ts.map +1 -1
- package/jobs/program.js +79 -20
- package/mod.d.ts +59 -9
- package/mod.d.ts.map +1 -1
- package/mod.js +5 -3
- package/package.json +1 -1
- package/records.d.ts +15 -2
- package/records.d.ts.map +1 -1
- package/records.js +24 -10
- package/register.d.ts.map +1 -1
- package/register.js +7 -4
- package/rpc.d.ts +7 -0
- package/rpc.d.ts.map +1 -0
- package/rpc.js +59 -0
- package/runtime/bound.d.ts +1 -0
- package/runtime/bound.d.ts.map +1 -1
- package/runtime/bound.js +10 -0
- package/runtime/bun.d.ts +20 -0
- package/runtime/bun.d.ts.map +1 -0
- package/runtime/bun.js +20 -0
- package/runtime/claude.d.ts +1 -0
- package/runtime/claude.d.ts.map +1 -1
- package/runtime/conversations.d.ts +12 -1
- package/runtime/conversations.d.ts.map +1 -1
- package/runtime/conversations.js +472 -362
- package/runtime/deadline.d.ts +4 -3
- package/runtime/deadline.d.ts.map +1 -1
- package/runtime/deadline.js +10 -4
- package/runtime/engine.d.ts +5 -4
- package/runtime/engine.d.ts.map +1 -1
- package/runtime/installer.d.ts +3 -3
- package/runtime/installer.d.ts.map +1 -1
- package/runtime/installer.js +10 -9
- package/runtime/interfaces.d.ts +262 -0
- package/runtime/interfaces.d.ts.map +1 -0
- package/runtime/interfaces.js +935 -0
- package/runtime/lifecycle.d.ts +3 -3
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +83 -52
- package/runtime/options.d.ts.map +1 -1
- package/runtime/options.js +2 -6
- package/runtime/parts.d.ts +64 -1
- package/runtime/parts.d.ts.map +1 -1
- package/runtime/parts.js +311 -4
- package/runtime/programs.d.ts +1 -0
- package/runtime/programs.d.ts.map +1 -1
- package/runtime/programs.js +5 -3
- package/runtime/rpc.d.ts +111 -0
- package/runtime/rpc.d.ts.map +1 -0
- package/runtime/rpc.js +387 -0
- package/runtime/sessions.d.ts +6 -4
- package/runtime/sessions.d.ts.map +1 -1
- package/runtime/sessions.js +59 -80
- package/runtime/toaster.js +1 -1
- package/runtime/ui.d.ts +23 -10
- package/runtime/ui.d.ts.map +1 -1
- package/runtime/ui.js +63 -52
- package/runtime/web.d.ts +0 -73
- package/runtime/web.d.ts.map +1 -1
- package/runtime/web.js +9 -5
- package/runtime/widgets.d.ts +4 -2
- package/runtime/widgets.d.ts.map +1 -1
- package/runtime/widgets.js +17 -16
- package/session/conversation.d.ts +7 -1
- package/session/conversation.d.ts.map +1 -1
- package/session/session.d.ts +31 -7
- package/session/session.d.ts.map +1 -1
- package/session/session.js +1 -0
- package/src/installer.ts +2 -2
- package/src/jobs/context.ts +1 -1
- package/src/jobs/program.ts +76 -21
- package/src/mod.ts +51 -10
- package/src/records.ts +33 -9
- package/src/register.ts +7 -4
- package/src/rpc.ts +67 -0
- package/src/runtime/bound.ts +10 -0
- package/src/runtime/bun.ts +40 -0
- package/src/runtime/claude.ts +1 -0
- package/src/runtime/conversations.ts +470 -352
- package/src/runtime/deadline.ts +13 -6
- package/src/runtime/engine.ts +5 -4
- package/src/runtime/installer.ts +13 -12
- package/src/runtime/interfaces.ts +1161 -0
- package/src/runtime/lifecycle.ts +102 -59
- package/src/runtime/options.ts +2 -5
- package/src/runtime/parts.ts +364 -5
- package/src/runtime/programs.ts +6 -3
- package/src/runtime/rpc.ts +457 -0
- package/src/runtime/sessions.ts +63 -83
- package/src/runtime/toaster.ts +1 -1
- package/src/runtime/ui.ts +82 -61
- package/src/runtime/web.ts +10 -39
- package/src/runtime/widgets.ts +20 -18
- package/src/session/conversation.ts +7 -1
- package/src/session/session.ts +22 -7
- package/src/testing/fake-claude.ts +38 -7
- package/src/testing/fake-serve.ts +144 -0
- package/src/testing/fake-sessions.ts +21 -6
- package/src/testing.ts +156 -68
- package/src/ui/areas.ts +2 -2
- package/src/ui/elements.ts +21 -16
- package/src/ui/panes.ts +14 -7
- package/testing/fake-claude.d.ts +6 -0
- package/testing/fake-claude.d.ts.map +1 -1
- package/testing/fake-claude.js +34 -7
- package/testing/fake-serve.d.ts +39 -0
- package/testing/fake-serve.d.ts.map +1 -0
- package/testing/fake-serve.js +110 -0
- package/testing/fake-sessions.d.ts.map +1 -1
- package/testing/fake-sessions.js +22 -6
- package/testing.d.ts +21 -4
- package/testing.d.ts.map +1 -1
- package/testing.js +138 -56
- package/ui/areas.d.ts +3 -1
- package/ui/areas.d.ts.map +1 -1
- package/ui/elements.d.ts +18 -9
- package/ui/elements.d.ts.map +1 -1
- package/ui/elements.js +9 -8
- package/ui/panes.d.ts +10 -6
- package/ui/panes.d.ts.map +1 -1
- package/ui/panes.js +5 -3
- package/runtime/pages.d.ts +0 -32
- package/runtime/pages.d.ts.map +0 -1
- package/runtime/pages.js +0 -142
- package/src/runtime/pages.ts +0 -183
package/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEJ,gBAAgB,EAIhB,WAAW,EAaZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEJ,g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AAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAM,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CA4tBvR"}
|
package/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hotkeyCommand, readSteps
|
|
1
|
+
import { hotkeyCommand, readSteps } from './records.js';
|
|
2
2
|
import { heldInput } from './runtime/claude.js';
|
|
3
3
|
import { answerCall, cmodPluginName, loadedMethod, notInstalled } from './runtime/dependencies.js';
|
|
4
4
|
import { closingContext, foldBefore, installBefore, withAnswer } from './runtime/before.js';
|
|
@@ -7,6 +7,7 @@ import { keepClaudeCode } from './testing/claude-code.js';
|
|
|
7
7
|
import { createRouter } from './runtime/router.js';
|
|
8
8
|
import { toolInputOf } from './runtime/tool-calls.js';
|
|
9
9
|
import { createLifecycle } from './runtime/lifecycle.js';
|
|
10
|
+
import { cmodStore } from './runtime/programs.js';
|
|
10
11
|
import { serveCmodPlugin } from './register.js';
|
|
11
12
|
import { MissingOptions } from './runtime/options.js';
|
|
12
13
|
import { conversationMethods, pickedColor } from './runtime/sessions.js';
|
|
@@ -26,11 +27,11 @@ import { fakeSessions } from './testing/fake-sessions.js';
|
|
|
26
27
|
import { listed, messageOf } from './utils/text.js';
|
|
27
28
|
import { componentOf } from './ui/styles.js';
|
|
28
29
|
import { AbovePrompt, areas, BelowPrompt, Dashboard, TurnEnd as TurnEndArea, Working } from './ui/areas.js';
|
|
29
|
-
import { drawWith, elementOf,
|
|
30
|
-
import { drawnParts } from './runtime/parts.js';
|
|
30
|
+
import { drawWith, elementOf, forClaudeCode } from './ui/elements.js';
|
|
31
|
+
import { drawnParts, pagesOf, providedBy, serveParts, viewsOf } from './runtime/parts.js';
|
|
31
32
|
import { serveWidgets } from './runtime/widgets.js';
|
|
32
33
|
import { engineOf } from './runtime/engine.js';
|
|
33
|
-
import {
|
|
34
|
+
import { createProviders, interfaceMethods, styleInterface } from './runtime/interfaces.js';
|
|
34
35
|
import { inheriting, openLink, partMethods } from './runtime/ui.js';
|
|
35
36
|
const defaultColumns = 80;
|
|
36
37
|
const defaultRows = 24;
|
|
@@ -49,6 +50,15 @@ function drawnByStyle(key) {
|
|
|
49
50
|
export function testMod(definition, options = {}) {
|
|
50
51
|
installJsx();
|
|
51
52
|
const name = definition.name;
|
|
53
|
+
const given = options.providers ?? [];
|
|
54
|
+
for (const each of given) {
|
|
55
|
+
if (each.program !== undefined)
|
|
56
|
+
continue;
|
|
57
|
+
if (each.mod === name)
|
|
58
|
+
throw new Error(`${name} is the tested mod, so its own provide answers ${each.name}. Fake another mod's provider, or a program's with program: '<executable>'.`);
|
|
59
|
+
if (each.device !== undefined)
|
|
60
|
+
throw new Error(`${each.mod}'s session code provides ${each.name} only in this session, on this computer, so it takes no device. Give the program that provides it on ${each.device.name}, with program: '<executable>'.`);
|
|
61
|
+
}
|
|
52
62
|
const isProjectPlugin = options.scope === 'project';
|
|
53
63
|
let projectRoot = options.projectRoot ?? (isProjectPlugin ? '/test/project' : `/test/plugins/${name}`);
|
|
54
64
|
const root = isProjectPlugin ? `${projectRoot}/.claude/skills/${name}` : `/test/plugins/${name}`;
|
|
@@ -87,6 +97,7 @@ export function testMod(definition, options = {}) {
|
|
|
87
97
|
if (held.color !== undefined)
|
|
88
98
|
await tellColor(held);
|
|
89
99
|
};
|
|
100
|
+
let declaredViews = [];
|
|
90
101
|
let declaredPages = [];
|
|
91
102
|
let openPages = [];
|
|
92
103
|
let shownPage;
|
|
@@ -98,10 +109,11 @@ export function testMod(definition, options = {}) {
|
|
|
98
109
|
return work;
|
|
99
110
|
};
|
|
100
111
|
const settle = async () => {
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
await fake.settle();
|
|
113
|
+
while (modeled.size > 0) {
|
|
103
114
|
await Promise.allSettled(modeled);
|
|
104
|
-
|
|
115
|
+
await fake.settle();
|
|
116
|
+
}
|
|
105
117
|
};
|
|
106
118
|
let focused;
|
|
107
119
|
const forgetFocus = (part) => {
|
|
@@ -113,7 +125,7 @@ export function testMod(definition, options = {}) {
|
|
|
113
125
|
const pane = isPane ? id : 'sidebar';
|
|
114
126
|
if (!(await holdsKeyboard(isPane, id)))
|
|
115
127
|
return `the pane "${pane}" does not hold the keyboard`;
|
|
116
|
-
const drawn = lifecycle.phase === 'active' ? (isPane ? await drawPane(id) : await
|
|
128
|
+
const drawn = lifecycle.phase === 'active' ? (isPane ? await drawPane(id) : await drawInSidebar(id)).drawing : undefined;
|
|
117
129
|
if (drawn === undefined || focusableKey(drawn, (props) => props['key'] === key) === undefined)
|
|
118
130
|
return `the pane "${pane}" draws no Button, Input, or Select with the key "${key}"`;
|
|
119
131
|
return undefined;
|
|
@@ -121,12 +133,12 @@ export function testMod(definition, options = {}) {
|
|
|
121
133
|
const applyRequests = async (requests) => {
|
|
122
134
|
for (const request of requests) {
|
|
123
135
|
if ('open' in request) {
|
|
124
|
-
const isSettings =
|
|
136
|
+
const isSettings = declaredViews.some((view) => view.id === request.open && view.place === 'settings');
|
|
125
137
|
if (!isSettings)
|
|
126
138
|
openPages = [...openPages.filter((page) => page.id !== request.open), { id: request.open, params: request.params ?? null }];
|
|
127
139
|
shownPage = { id: request.open, params: request.params ?? null, isFocused: request.focus === true };
|
|
128
140
|
if (request.focus === true)
|
|
129
|
-
forgetFocus(`
|
|
141
|
+
forgetFocus(`sidebar:${request.open}`);
|
|
130
142
|
}
|
|
131
143
|
else if ('close' in request) {
|
|
132
144
|
openPages = openPages.filter((page) => page.id !== request.close);
|
|
@@ -137,27 +149,28 @@ export function testMod(definition, options = {}) {
|
|
|
137
149
|
const key = `${name}/${request.focus}:${request.key}`;
|
|
138
150
|
const refused = await refusedFocus(false, request.focus, key);
|
|
139
151
|
if (refused === undefined)
|
|
140
|
-
focused = { part: `
|
|
152
|
+
focused = { part: `sidebar:${request.focus}`, key: request.key };
|
|
141
153
|
else
|
|
142
|
-
reportPart(`pages:${name}`, `Could not show the page ${name} asked for`, new Error(`cmod: Claude Code did not focus "${key}" in the Sidebar pane: ${refused}`));
|
|
154
|
+
reportPart(`pages:${name}`, `Could not show the view or page ${name} asked for`, new Error(`cmod: Claude Code did not focus "${key}" in the Sidebar pane: ${refused}`));
|
|
143
155
|
}
|
|
144
156
|
else if ('settings' in request) {
|
|
145
|
-
const first =
|
|
157
|
+
const first = declaredViews.find((view) => view.place === 'settings');
|
|
146
158
|
shownPage = first === undefined ? undefined : { id: first.id, params: null, isFocused: true };
|
|
147
159
|
if (first !== undefined)
|
|
148
|
-
forgetFocus(`
|
|
160
|
+
forgetFocus(`sidebar:${first.id}`);
|
|
149
161
|
}
|
|
150
162
|
}
|
|
151
163
|
await tellShown();
|
|
152
164
|
};
|
|
153
165
|
let widgets;
|
|
154
|
-
let
|
|
166
|
+
let provides = [];
|
|
155
167
|
const ownMarkdown = new Map();
|
|
156
168
|
const missedMarkdown = new Map();
|
|
157
169
|
const updated = async ({ parts, redraw, requests }) => {
|
|
158
170
|
if (parts !== undefined) {
|
|
171
|
+
declaredViews = viewsOf(parts);
|
|
159
172
|
declaredPages = pagesOf(parts);
|
|
160
|
-
|
|
173
|
+
provides = providedBy(parts);
|
|
161
174
|
ownMarkdown.clear();
|
|
162
175
|
}
|
|
163
176
|
if (parts !== undefined || redraw !== undefined)
|
|
@@ -169,7 +182,7 @@ export function testMod(definition, options = {}) {
|
|
|
169
182
|
const markdownIn = (table, at) => {
|
|
170
183
|
let unkeyed = 0;
|
|
171
184
|
return (props) => {
|
|
172
|
-
if (!
|
|
185
|
+
if (!provides.includes(styleInterface))
|
|
173
186
|
return table.Markdown(props);
|
|
174
187
|
const keyPrefix = `${name}/markdown:${props.key ?? unkeyed++}:`;
|
|
175
188
|
const drawnAt = `${at.surface}\u0000${at.columns}\u0000${props.text}`;
|
|
@@ -195,7 +208,7 @@ export function testMod(definition, options = {}) {
|
|
|
195
208
|
const openFromCmod = (href, press) => void openLink(fake.claude, href, press.surface).catch((error) => reportPart('open-link', 'Could not open the link', error));
|
|
196
209
|
const cmodClaude = {
|
|
197
210
|
...fake.claude,
|
|
198
|
-
ui: { ...fake.claude.ui, resolve: (e) =>
|
|
211
|
+
ui: { ...fake.claude.ui, resolve: (e) => forClaudeCode(fake.claude.ui.resolve(e), e.surface, openFromCmod) },
|
|
199
212
|
cmod: { call: async (input) => (input.to === name ? callMod(input.method, input.input) : fake.claude.cmod.call(input)) },
|
|
200
213
|
};
|
|
201
214
|
const tellRefusedPress = (_mod, error) => fake.claude.ui.log(`cmod: ${name} did not take the press: ${messageOf(error)}`, { to: 'debug' });
|
|
@@ -207,7 +220,7 @@ export function testMod(definition, options = {}) {
|
|
|
207
220
|
return serveWidgets({
|
|
208
221
|
claude: cmodClaude,
|
|
209
222
|
router: cmodPlugin,
|
|
210
|
-
store:
|
|
223
|
+
store: await cmodStore(fake.claude),
|
|
211
224
|
report: reportPart,
|
|
212
225
|
turnClosedBy: () => conversations.lastTurn(),
|
|
213
226
|
parts,
|
|
@@ -216,14 +229,62 @@ export function testMod(definition, options = {}) {
|
|
|
216
229
|
};
|
|
217
230
|
const widgetsOf = () => (widgets ??= servedWidgets());
|
|
218
231
|
const cmodBeneath = createRouter();
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const
|
|
232
|
+
const servedParts = serveParts({ claude: cmodClaude, router: cmodBeneath, report: reportPart, tellRefusedPress, widgets: { update: (mod, update) => void widgetsOf().then((served) => served.update(mod, update)) }, parts, tellStylers: () => undefined, tellUi: () => undefined });
|
|
233
|
+
servedParts.apply((_mod, requests) => applyRequests(requests));
|
|
234
|
+
const after = (ms, run) => fake.claude.clock.after(ms, run);
|
|
235
|
+
const report = (error) => reportPart('interfaces', 'A provider listener failed', error);
|
|
236
|
+
const sessionMods = new Map();
|
|
237
|
+
const served = fake.serve.connect({
|
|
238
|
+
tell: (_caller, heard) => new Promise((resolve) => fake.claude.clock.after(0, () => resolve(callMod(interfaceMethods.heard, heard)))),
|
|
239
|
+
sessionCode: (named) => [...(provides.includes(named) ? [name] : []), ...[...sessionMods].filter(([, each]) => each.provided().includes(named)).map(([mod]) => mod)],
|
|
240
|
+
device: async () => {
|
|
241
|
+
const { id, name: deviceName } = await fake.claude.device.read();
|
|
242
|
+
return { id, name: deviceName };
|
|
243
|
+
},
|
|
244
|
+
after,
|
|
245
|
+
report,
|
|
246
|
+
});
|
|
247
|
+
const providedInSession = given.map(({ name: named, mod, program, methods }) => {
|
|
248
|
+
if (program !== undefined)
|
|
249
|
+
return undefined;
|
|
250
|
+
const made = sessionMods.get(mod) ?? createProviders({ name: mod, call: (_to, method, input) => served.answer(method, input, mod) ?? Promise.reject(new Error(`${mod} reaches no ${method} in the test kit.`)), changed: () => undefined, after, report });
|
|
251
|
+
sessionMods.set(mod, made);
|
|
252
|
+
return made.provide(named, methods);
|
|
253
|
+
});
|
|
254
|
+
let fakesReady;
|
|
255
|
+
const fakeProviders = () => (fakesReady ??= (async () => {
|
|
256
|
+
const programs = await fake.serve.provide(given.flatMap(({ name: named, mod, program, device, methods }) => (program === undefined ? [] : [{ name: named, mod, program, ...(device === undefined ? {} : { device }), methods }])), { after, report });
|
|
257
|
+
let next = 0;
|
|
258
|
+
return providedInSession.map((inSession) => inSession ?? programs[next++]);
|
|
259
|
+
})());
|
|
260
|
+
const fakeProvider = (index) => {
|
|
261
|
+
const reached = async () => {
|
|
262
|
+
const each = (await fakeProviders())[index];
|
|
263
|
+
await fake.settle();
|
|
264
|
+
return each;
|
|
265
|
+
};
|
|
266
|
+
return {
|
|
267
|
+
remove: () => void modeling(reached().then((each) => each.remove())),
|
|
268
|
+
tell: (event, payload) => void modeling(reached().then((each) => each.tell(event, payload))),
|
|
269
|
+
ask: (event, payload) => modeling(reached().then((each) => each.ask(event, payload))),
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
const fakedPrograms = new Set(given.flatMap(({ mod, program }) => (mod === name && program !== undefined ? [program] : [])));
|
|
273
|
+
const spawnUnlessFaked = fake.claude.process.spawn;
|
|
274
|
+
fake.claude.process.spawn = (request) => {
|
|
275
|
+
const [, command, mod] = request.argv;
|
|
276
|
+
const at = request.argv.indexOf('--');
|
|
277
|
+
const executable = at === -1 ? undefined : request.argv[at + 1]?.split('/').at(-1);
|
|
278
|
+
if (command !== 'program' || mod !== name || request.argv.includes('--remove-service') || executable === undefined || !fakedPrograms.has(executable))
|
|
279
|
+
return spawnUnlessFaked(request);
|
|
280
|
+
return { [Symbol.asyncIterator]: () => ({ next: () => new Promise(() => undefined) }) };
|
|
281
|
+
};
|
|
282
|
+
const dependencies = fakeDependencies(name, options.dependencies ?? {}, conversations, served, sessionMods);
|
|
222
283
|
fake.fakes.cmod.call = async (call) => {
|
|
223
284
|
if (call.to !== cmodPluginName || call.method !== partMethods.changed)
|
|
224
285
|
return dependencies(call);
|
|
225
286
|
const { requests, isAsked, ...listing } = call.input;
|
|
226
|
-
const isHeld = isAsked === true && requests !== undefined &&
|
|
287
|
+
const isHeld = isAsked === true && requests !== undefined && servedParts.update(name, { requests, isAsked });
|
|
227
288
|
await updated(isAsked === true ? listing : call.input);
|
|
228
289
|
return { isHeld };
|
|
229
290
|
};
|
|
@@ -268,7 +329,7 @@ export function testMod(definition, options = {}) {
|
|
|
268
329
|
const runProcess = fake.claude.process.run;
|
|
269
330
|
fake.claude.process.run = async (argv, init) => {
|
|
270
331
|
const [program, command, action, mod, key] = argv;
|
|
271
|
-
if (program?.split('/').at(-1) !== 'cmod' || command !== '
|
|
332
|
+
if (program?.split('/').at(-1) !== 'cmod' || command !== 'secrets' || mod !== name || key === undefined)
|
|
272
333
|
return runProcess(argv, init);
|
|
273
334
|
const answer = (stdout, stderr = '') => ({ exitCode: stderr === '' ? 0 : 1, stdout, stderr, isStdoutTruncated: false, isStderrTruncated: false });
|
|
274
335
|
if (action === 'get')
|
|
@@ -276,7 +337,7 @@ export function testMod(definition, options = {}) {
|
|
|
276
337
|
if (action === 'delete')
|
|
277
338
|
secrets.delete(key);
|
|
278
339
|
else if (init?.stdin === undefined || init.stdin === '')
|
|
279
|
-
return answer('', `cmod
|
|
340
|
+
return answer('', `cmod secrets: cmod secrets store read no value from stdin. cmod secrets delete ${name} ${key} deletes the secret.\n`);
|
|
280
341
|
else
|
|
281
342
|
secrets.set(key, init.stdin);
|
|
282
343
|
return answer('');
|
|
@@ -311,15 +372,15 @@ export function testMod(definition, options = {}) {
|
|
|
311
372
|
await fake.settle();
|
|
312
373
|
};
|
|
313
374
|
const start = async () => {
|
|
314
|
-
started ??= lifecycle.start(fake.claude, async (claude) => ({
|
|
375
|
+
started ??= fakeProviders().then(() => lifecycle.start(fake.claude, async (claude) => ({
|
|
315
376
|
name,
|
|
316
377
|
root,
|
|
317
378
|
version: '0.0.0',
|
|
318
|
-
store:
|
|
379
|
+
store: await cmodStore(claude),
|
|
319
380
|
isInstalled: true,
|
|
320
381
|
shouldRecord: false,
|
|
321
382
|
steps: await modSteps(),
|
|
322
|
-
}));
|
|
383
|
+
})));
|
|
323
384
|
await started;
|
|
324
385
|
await fake.settle();
|
|
325
386
|
const { failure } = lifecycle;
|
|
@@ -424,36 +485,39 @@ export function testMod(definition, options = {}) {
|
|
|
424
485
|
const drawing = await route('ui.render', { surface: 'terminal', component: 'Pane', requestId: paneId, props }, elements.Box({}));
|
|
425
486
|
return { drawing, columns };
|
|
426
487
|
};
|
|
427
|
-
const
|
|
488
|
+
const drawInSidebar = async (id, columns = defaultColumns) => {
|
|
428
489
|
await start();
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
431
|
-
throw new Error(`The page "${
|
|
432
|
-
const drawn = (await callMod(partMethods.draw, { page:
|
|
490
|
+
const shown = shownPage;
|
|
491
|
+
if (shown?.id !== id)
|
|
492
|
+
throw new Error(`The view or page "${id}" of ${name} no longer shows, and a user sees one only while it shows.`);
|
|
493
|
+
const drawn = (await callMod(partMethods.draw, { page: id, params: shown.params, columns, isFocused: shown.isFocused, surface: 'terminal' }));
|
|
433
494
|
await fake.settle();
|
|
434
495
|
const tree = drawn?.tree ?? null;
|
|
435
|
-
const table =
|
|
436
|
-
const drawing = tree === null || drawn === null ? elements.Box({}) : await withOwnMarkdown(async () => drawWith(table, () => elementOf(tree, `${name}/${
|
|
496
|
+
const table = forClaudeCode(elements, 'terminal', openFromCmod);
|
|
497
|
+
const drawing = tree === null || drawn === null ? elements.Box({}) : await withOwnMarkdown(async () => drawWith(table, () => elementOf(tree, `${name}/${id}:`, (handler, args) => void modeling(pressPart({ draw: drawn.draw, handler, args }))), markdownIn(table, { surface: 'terminal', columns })));
|
|
437
498
|
checkKeys(drawing, cmodPluginName, 'Pane');
|
|
438
499
|
return { drawing, columns };
|
|
439
500
|
};
|
|
440
|
-
const shownNow = (
|
|
441
|
-
if (
|
|
501
|
+
const shownNow = (kind) => {
|
|
502
|
+
if (kind === 'pane') {
|
|
442
503
|
const id = [...fake.shown.openPanes].at(-1);
|
|
443
504
|
if (id === undefined)
|
|
444
505
|
throw new Error(`No pane of ${name} shows. Open one with pane.open(), from a slash command, a hotkey, or setup.`);
|
|
445
506
|
return { id, params: undefined };
|
|
446
507
|
}
|
|
447
|
-
|
|
448
|
-
|
|
508
|
+
const shownKind = shownPage === undefined ? undefined : declaredPages.some((page) => page.id === shownPage?.id) ? 'page' : 'view';
|
|
509
|
+
if (shownPage === undefined || shownKind !== kind) {
|
|
510
|
+
const opening = kind === 'view' ? 'view.open(), or Settings with mod.settings.open()' : 'page.open()';
|
|
511
|
+
throw new Error(`No ${kind} of ${name} shows in the Sidebar${shownPage === undefined ? '' : `, where its ${shownKind} "${shownPage.id}" shows`}. Open one with ${opening}.`);
|
|
512
|
+
}
|
|
449
513
|
return shownPage;
|
|
450
514
|
};
|
|
451
|
-
const shownPart = (
|
|
452
|
-
const
|
|
515
|
+
const shownPart = (kind) => {
|
|
516
|
+
const isPane = kind === 'pane';
|
|
453
517
|
const draw = async (columns) => {
|
|
454
518
|
await start();
|
|
455
|
-
const { id } = shownNow(
|
|
456
|
-
return { id, ...(isPane ? await drawPane(id, columns) : await
|
|
519
|
+
const { id } = shownNow(kind);
|
|
520
|
+
return { id, ...(isPane ? await drawPane(id, columns) : await drawInSidebar(id, columns)) };
|
|
457
521
|
};
|
|
458
522
|
const drawnElement = async (type, key) => {
|
|
459
523
|
const { id, drawing } = await draw();
|
|
@@ -466,10 +530,10 @@ export function testMod(definition, options = {}) {
|
|
|
466
530
|
const eventIn = (id, key) => ({ plugin: name, element: key, component: 'Pane', requestId: id, surface: 'terminal' });
|
|
467
531
|
return {
|
|
468
532
|
get id() {
|
|
469
|
-
return shownNow(
|
|
533
|
+
return shownNow(kind).id;
|
|
470
534
|
},
|
|
471
535
|
get params() {
|
|
472
|
-
return shownNow(
|
|
536
|
+
return shownNow(kind).params;
|
|
473
537
|
},
|
|
474
538
|
lines: async (lineOptions) => {
|
|
475
539
|
const { drawing, columns } = await draw(lineOptions?.columns);
|
|
@@ -511,10 +575,10 @@ export function testMod(definition, options = {}) {
|
|
|
511
575
|
},
|
|
512
576
|
async focusedKey() {
|
|
513
577
|
await start();
|
|
514
|
-
const { id } = shownNow(
|
|
578
|
+
const { id } = shownNow(kind);
|
|
515
579
|
if (!(await holdsKeyboard(isPane, id)))
|
|
516
580
|
return undefined;
|
|
517
|
-
if (focused?.part === `${
|
|
581
|
+
if (focused?.part === `${isPane ? 'pane' : 'sidebar'}:${id}`)
|
|
518
582
|
return focused.key;
|
|
519
583
|
const autoFocused = focusableKey((await draw()).drawing, (props) => props['autoFocus'] === true);
|
|
520
584
|
return isPane || autoFocused === undefined ? autoFocused : autoFocused.slice(`${name}/${id}:`.length);
|
|
@@ -543,6 +607,12 @@ export function testMod(definition, options = {}) {
|
|
|
543
607
|
checkKeys(drawing, name, component);
|
|
544
608
|
return { drawing, columns: defaultColumns };
|
|
545
609
|
};
|
|
610
|
+
const loadSettings = async (answer) => {
|
|
611
|
+
if (answer.block === undefined)
|
|
612
|
+
await lifecycle.settingsLoaded();
|
|
613
|
+
await fake.settle();
|
|
614
|
+
return answer;
|
|
615
|
+
};
|
|
546
616
|
const fire = ((event, input, below, signal) => {
|
|
547
617
|
if (event.includes('.'))
|
|
548
618
|
return route(event, input, below, signal);
|
|
@@ -569,6 +639,8 @@ export function testMod(definition, options = {}) {
|
|
|
569
639
|
const started = routed.then((answer) => ((answeredId = startedAs), answer));
|
|
570
640
|
return source === 'startup' || source === 'clear' ? started : started.then(async (answer) => (await tellHeldColor(), answer));
|
|
571
641
|
}
|
|
642
|
+
if (event === 'ConfigChange')
|
|
643
|
+
return route('classic.ConfigChange', filled, below, signal).then(loadSettings);
|
|
572
644
|
if (event !== 'PreToolUse')
|
|
573
645
|
return route(`classic.${event}`, filled, below, signal);
|
|
574
646
|
return firePreToolUse(filled, below);
|
|
@@ -672,7 +744,7 @@ export function testMod(definition, options = {}) {
|
|
|
672
744
|
}
|
|
673
745
|
const component = componentOf(target);
|
|
674
746
|
if (props === undefined || component === undefined)
|
|
675
|
-
throw new Error(`lines takes an area, such as AbovePrompt, or a row kind, such as ToolCall, with its props, and ${target} is neither. Read a pane with tested.shown.pane.lines() and a page with tested.shown.page.lines().`);
|
|
747
|
+
throw new Error(`lines takes an area, such as AbovePrompt, or a row kind, such as ToolCall, with its props, and ${target} is neither. Read a pane with tested.shown.pane.lines(), a view with tested.shown.view.lines(), and a page with tested.shown.page.lines().`);
|
|
676
748
|
const { drawing, columns } = await drawSlot(component, props, requestId);
|
|
677
749
|
return rowsOf(drawing, columns).map((row) => row.trimEnd());
|
|
678
750
|
},
|
|
@@ -749,22 +821,32 @@ export function testMod(definition, options = {}) {
|
|
|
749
821
|
return lifecycle.toasts;
|
|
750
822
|
},
|
|
751
823
|
sent: conversations.sent,
|
|
752
|
-
pane: shownPart(
|
|
753
|
-
|
|
824
|
+
pane: shownPart('pane'),
|
|
825
|
+
view: shownPart('view'),
|
|
826
|
+
page: shownPart('page'),
|
|
754
827
|
},
|
|
828
|
+
providers: given.map((_each, index) => fakeProvider(index)),
|
|
755
829
|
};
|
|
756
830
|
keepClaudeCode(tested, { fire });
|
|
757
831
|
return tested;
|
|
758
832
|
}
|
|
759
|
-
function fakeDependencies(caller, dependencies, conversations) {
|
|
760
|
-
const cmod = {
|
|
833
|
+
function fakeDependencies(caller, dependencies, conversations, served, sessionMods) {
|
|
834
|
+
const cmod = {
|
|
835
|
+
forkParent: () => null,
|
|
836
|
+
updateSettings: () => null,
|
|
837
|
+
[loadedMethod]: ({ name }) => name === caller || name === cmodPluginName || Object.hasOwn(dependencies, name) || sessionMods.has(name),
|
|
838
|
+
};
|
|
761
839
|
const apis = { [cmodPluginName]: cmod, ...dependencies };
|
|
840
|
+
const provided = ({ to, method, input }) => (to === cmodPluginName ? served.answer(method, input, caller) : sessionMods.get(to)?.answer(method, input, caller, new AbortController().signal));
|
|
762
841
|
return async (call) => {
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
return calledAnswer(caller,
|
|
842
|
+
const told = call.to === cmodPluginName ? conversations.answer(caller, call.method, call.input) : undefined;
|
|
843
|
+
if (told !== undefined)
|
|
844
|
+
return calledAnswer(caller, told);
|
|
845
|
+
const answered = provided(call);
|
|
846
|
+
if (answered !== undefined)
|
|
847
|
+
return calledAnswer(caller, await answered.then((value) => ({ value }), (error) => ({ deny: messageOf(error) })));
|
|
766
848
|
const api = apis[call.to];
|
|
767
|
-
return calledAnswer(caller, api === undefined ? { deny: notInstalled(call.to) } : await answerCall(call.to, api, call));
|
|
849
|
+
return calledAnswer(caller, api === undefined ? { deny: sessionMods.has(call.to) ? `${call.to} has no method ${call.method}.` : notInstalled(call.to) } : await answerCall(call.to, api, call));
|
|
768
850
|
};
|
|
769
851
|
}
|
|
770
852
|
function claudeCodeAnswer(event, e) {
|
package/ui/areas.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Mod, Turn } from '../mod.js';
|
|
1
|
+
import type { Mod, Surface, Turn } from '../mod.js';
|
|
2
2
|
export declare const AbovePrompt = "abovePrompt";
|
|
3
3
|
export declare const BelowPrompt = "belowPrompt";
|
|
4
4
|
export declare const Working = "working";
|
|
@@ -9,10 +9,12 @@ export type Area = (typeof areas)[number];
|
|
|
9
9
|
export type WidgetContext = {
|
|
10
10
|
readonly area: typeof TurnEnd;
|
|
11
11
|
readonly columns: number;
|
|
12
|
+
readonly surface: Surface;
|
|
12
13
|
readonly turn: Turn;
|
|
13
14
|
} | {
|
|
14
15
|
readonly area: Exclude<Area, typeof TurnEnd>;
|
|
15
16
|
readonly columns: number;
|
|
17
|
+
readonly surface: Surface;
|
|
16
18
|
};
|
|
17
19
|
export type WidgetInit<State extends object = Record<never, never>> = {
|
|
18
20
|
readonly id: string;
|
package/ui/areas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areas.d.ts","sourceRoot":"","sources":["../src/ui/areas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"areas.d.ts","sourceRoot":"","sources":["../src/ui/areas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEnD,eAAO,MAAM,WAAW,gBAAgB,CAAA;AACxC,eAAO,MAAM,WAAW,gBAAgB,CAAA;AACxC,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,eAAO,MAAM,KAAK,4EAAmE,CAAA;AAErF,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzC,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/O,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IACpE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAA;IACrF,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,GAAG,SAAS,CAAA;CACzE,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;IAC/B,MAAM,IAAI,IAAI,CAAA;CACf,CAAA"}
|
package/ui/elements.d.ts
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import type { BoxProps as ClaudeBoxProps, ButtonProps as ClaudeButtonProps, ClientProps as ClaudeClientProps, CodeProps as ClaudeCodeProps, Color as ClaudeColor, ElementConstructor, ElementTable, ImageProps as ClaudeImageProps, InputProps as ClaudeInputProps, MarkdownProps as ClaudeMarkdownProps, RasterProps as ClaudeRasterProps, RenderElement, RenderSurface, SelectProps as ClaudeSelectProps, SvgProps as ClaudeSvgProps, TextProps as ClaudeTextProps, UiPressArgument } from 'claude-code';
|
|
2
|
+
import type { Surface } from '../mod.js';
|
|
2
3
|
export type BoxProps = ClaudeBoxProps;
|
|
3
4
|
export type TextProps = ClaudeTextProps;
|
|
4
5
|
export type CodeProps = ClaudeCodeProps;
|
|
5
6
|
export type MarkdownProps = ClaudeMarkdownProps;
|
|
6
7
|
export type InputProps = ClaudeInputProps;
|
|
7
8
|
export type SelectProps = ClaudeSelectProps;
|
|
8
|
-
export type ImageProps = ClaudeImageProps
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export type ImageProps = Omit<ClaudeImageProps, 'alt'> & {
|
|
10
|
+
readonly label: string;
|
|
11
|
+
};
|
|
12
|
+
export type SvgProps = Omit<ClaudeSvgProps, 'alt'> & {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
};
|
|
15
|
+
export type RasterProps = ClaudeRasterProps & {
|
|
16
|
+
readonly label: string;
|
|
17
|
+
};
|
|
11
18
|
export type ClientProps = ClaudeClientProps;
|
|
12
19
|
export type Color = ClaudeColor;
|
|
13
|
-
export type Press = UiPressArgument
|
|
20
|
+
export type Press = Omit<UiPressArgument, 'surface'> & {
|
|
21
|
+
readonly surface: Surface;
|
|
22
|
+
};
|
|
14
23
|
export type ButtonProps = Omit<ClaudeButtonProps, 'onPress'> & ({
|
|
15
24
|
readonly onPress: (press: Press) => void;
|
|
16
25
|
readonly href?: never;
|
|
@@ -21,10 +30,10 @@ export type ButtonProps = Omit<ClaudeButtonProps, 'onPress'> & ({
|
|
|
21
30
|
export declare function drawWith<Drawn>(table: ElementTable, draw: () => Drawn, markdown?: (props: MarkdownProps) => RenderElement): Drawn;
|
|
22
31
|
export declare function drawKeyed<Drawn>(keyPrefix: string, draw: () => Drawn): Drawn;
|
|
23
32
|
export type Handler = (...args: unknown[]) => unknown;
|
|
24
|
-
export declare function elementData(value: unknown,
|
|
33
|
+
export declare function elementData(value: unknown, numberOf: (run: Handler) => number): unknown;
|
|
25
34
|
export declare function elementOf(data: unknown, keyPrefix: string, press: (handler: number, args: readonly unknown[]) => void): unknown;
|
|
26
35
|
export declare function drawsFocusable(data: unknown, key: string): boolean;
|
|
27
|
-
export declare function
|
|
36
|
+
export declare function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void): ElementTable;
|
|
28
37
|
export declare const Box: ElementConstructor<ClaudeBoxProps>;
|
|
29
38
|
export declare const Text: ElementConstructor<ClaudeTextProps>;
|
|
30
39
|
export declare const Button: ElementConstructor<ButtonProps>;
|
|
@@ -32,8 +41,8 @@ export declare const Code: ElementConstructor<ClaudeCodeProps>;
|
|
|
32
41
|
export declare const Markdown: ElementConstructor<ClaudeMarkdownProps>;
|
|
33
42
|
export declare const Input: ElementConstructor<ClaudeInputProps>;
|
|
34
43
|
export declare const Select: ElementConstructor<ClaudeSelectProps>;
|
|
35
|
-
export declare const Image: ElementConstructor<
|
|
36
|
-
export declare const Svg: ElementConstructor<
|
|
37
|
-
export declare const Raster: ElementConstructor<
|
|
44
|
+
export declare const Image: ElementConstructor<ImageProps>;
|
|
45
|
+
export declare const Svg: ElementConstructor<SvgProps>;
|
|
46
|
+
export declare const Raster: ElementConstructor<RasterProps>;
|
|
38
47
|
export declare const Client: ElementConstructor<ClaudeClientProps>;
|
|
39
48
|
//# sourceMappingURL=elements.d.ts.map
|
package/ui/elements.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../src/ui/elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,IAAI,cAAc,EAC1B,WAAW,IAAI,iBAAiB,EAChC,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,KAAK,IAAI,WAAW,EACpB,kBAAkB,EAElB,YAAY,EAEZ,UAAU,IAAI,gBAAgB,EAC9B,UAAU,IAAI,gBAAgB,EAC9B,a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,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,GAAG,OAAO,CAa/H;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,YAAY,CAe7I;AAED,eAAO,MAAM,GAAG,oCAAiB,CAAA;AACjC,eAAO,MAAM,IAAI,qCAAkB,CAAA;AACnC,eAAO,MAAM,MAAM,EAAmC,kBAAkB,CAAC,WAAW,CAAC,CAAA;AAErF,eAAO,MAAM,IAAI,qCAAkB,CAAA;AACnC,eAAO,MAAM,QAAQ,yCAAsB,CAAA;AAC3C,eAAO,MAAM,KAAK,sCAAmB,CAAA;AACrC,eAAO,MAAM,MAAM,uCAAoB,CAAA;AACvC,eAAO,MAAM,KAAK,EAAkC,kBAAkB,CAAC,UAAU,CAAC,CAAA;AAClF,eAAO,MAAM,GAAG,EAAgC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AAC5E,eAAO,MAAM,MAAM,EAAmC,kBAAkB,CAAC,WAAW,CAAC,CAAA;AACrF,eAAO,MAAM,MAAM,uCAAoB,CAAA"}
|
package/ui/elements.js
CHANGED
|
@@ -50,22 +50,22 @@ function keyed(value, keyPrefix) {
|
|
|
50
50
|
}
|
|
51
51
|
const elementKey = '$cmodElement';
|
|
52
52
|
const handlerKey = '$cmodHandler';
|
|
53
|
-
export function elementData(value,
|
|
53
|
+
export function elementData(value, numberOf) {
|
|
54
54
|
if (typeof value === 'function')
|
|
55
|
-
return { [handlerKey]:
|
|
55
|
+
return { [handlerKey]: numberOf(value) };
|
|
56
56
|
if (Array.isArray(value))
|
|
57
|
-
return value.map((each) => elementData(each,
|
|
57
|
+
return value.map((each) => elementData(each, numberOf));
|
|
58
58
|
if (typeof value !== 'object' || value === null)
|
|
59
59
|
return value;
|
|
60
60
|
if (unbuilt in value) {
|
|
61
61
|
const { name, props } = value[unbuilt];
|
|
62
62
|
if (name === 'Client')
|
|
63
63
|
throw new Error('Client draws only in panes and styles.');
|
|
64
|
-
return { [elementKey]: name, props: elementData(props,
|
|
64
|
+
return { [elementKey]: name, props: elementData(props, numberOf) };
|
|
65
65
|
}
|
|
66
66
|
if (Object.getPrototypeOf(value) !== Object.prototype)
|
|
67
67
|
throw new Error('a widget draws only the elements of ui/elements.js and ui/components.js, text, numbers, and plain objects.');
|
|
68
|
-
return Object.fromEntries(Object.entries(value).map(([key, each]) => [key, elementData(each,
|
|
68
|
+
return Object.fromEntries(Object.entries(value).map(([key, each]) => [key, elementData(each, numberOf)]));
|
|
69
69
|
}
|
|
70
70
|
export function elementOf(data, keyPrefix, press) {
|
|
71
71
|
if (Array.isArray(data))
|
|
@@ -97,8 +97,8 @@ export function drawsFocusable(data, key) {
|
|
|
97
97
|
return true;
|
|
98
98
|
return Object.values(fields).some((each) => drawsFocusable(each, key));
|
|
99
99
|
}
|
|
100
|
-
export function
|
|
101
|
-
const { Button: button, Link: link } = table;
|
|
100
|
+
export function forClaudeCode(table, surface, open) {
|
|
101
|
+
const { Button: button, Link: link, Image: image, Svg: svg, Raster: raster } = table;
|
|
102
102
|
const opening = (props) => {
|
|
103
103
|
const { href, ...rest } = props;
|
|
104
104
|
if (typeof href !== 'string')
|
|
@@ -109,7 +109,8 @@ export function withLinks(table, surface, open) {
|
|
|
109
109
|
return link({ href, ...(typeof label === 'string' ? { label } : {}), ...(hasChildren ? { children } : {}) });
|
|
110
110
|
return button({ ...rest, onPress: (press) => open(href, press) });
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
const named = (draw) => ({ label, ...rest }) => draw({ alt: label, ...rest });
|
|
113
|
+
return { ...table, Button: opening, Image: named(image), Svg: named(svg), Raster: ({ label, ...rest }) => raster(rest) };
|
|
113
114
|
}
|
|
114
115
|
export const Box = element('Box');
|
|
115
116
|
export const Text = element('Text');
|
package/ui/panes.d.ts
CHANGED
|
@@ -45,17 +45,18 @@ export type Pane<Params = undefined> = {
|
|
|
45
45
|
focus(key: string): Promise<void>;
|
|
46
46
|
remove(): void;
|
|
47
47
|
};
|
|
48
|
-
export type
|
|
48
|
+
export type ViewProps<Params> = {
|
|
49
49
|
readonly params: Params;
|
|
50
50
|
readonly isFocused: boolean;
|
|
51
51
|
readonly columns: number;
|
|
52
|
+
readonly surface: Surface;
|
|
52
53
|
};
|
|
53
|
-
export type
|
|
54
|
+
export type ViewInit<State extends object = Record<never, never>, Params = undefined> = {
|
|
54
55
|
readonly id: string;
|
|
55
56
|
readonly title: string;
|
|
56
|
-
render(mod: Mod<State>, props:
|
|
57
|
+
render(mod: Mod<State>, props: ViewProps<Params>): JSX.Element;
|
|
57
58
|
};
|
|
58
|
-
export type
|
|
59
|
+
export type View<Params = undefined> = {
|
|
59
60
|
readonly id: string;
|
|
60
61
|
readonly isOpen: boolean;
|
|
61
62
|
readonly isShown: boolean;
|
|
@@ -70,7 +71,10 @@ export type Page<Params = undefined> = {
|
|
|
70
71
|
focus(key: string): Promise<void>;
|
|
71
72
|
remove(): void;
|
|
72
73
|
};
|
|
74
|
+
export type PageProps<Params> = ViewProps<Params>;
|
|
75
|
+
export type PageInit<State extends object = Record<never, never>, Params = undefined> = ViewInit<State, Params>;
|
|
76
|
+
export type Page<Params = undefined> = View<Params>;
|
|
73
77
|
export declare const sizeKeys: readonly ['columns', 'rows'];
|
|
74
|
-
export declare function checkPart(name: string, kind: string, id: string, title: string): void;
|
|
75
|
-
export declare function checkPane<State extends object, Params>(name: string, pane: PaneInit<State, Params
|
|
78
|
+
export declare function checkPart(name: string, kind: string, id: string, title: string, takenBy: string | undefined): void;
|
|
79
|
+
export declare function checkPane<State extends object, Params>(name: string, pane: PaneInit<State, Params>, takenBy: string | undefined): void;
|
|
76
80
|
//# sourceMappingURL=panes.d.ts.map
|