@cmodjs/core 5.6.0 → 5.8.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 +7 -5
- package/docs/dependencies.md +2 -2
- package/docs/install-steps.md +1 -1
- package/docs/mod.md +1 -1
- package/docs/ui.md +5 -3
- package/package.json +2 -2
- package/records.d.ts +15 -2
- package/records.d.ts.map +1 -1
- package/records.js +15 -3
- package/register.d.ts +3 -0
- package/register.d.ts.map +1 -1
- package/register.js +25 -15
- package/runtime/before.d.ts +3 -0
- package/runtime/before.d.ts.map +1 -1
- package/runtime/before.js +66 -31
- package/runtime/conversations.d.ts.map +1 -1
- package/runtime/conversations.js +29 -9
- package/runtime/lifecycle.d.ts +24 -2
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +36 -31
- package/runtime/pages.d.ts +2 -1
- package/runtime/pages.d.ts.map +1 -1
- package/runtime/pages.js +3 -6
- package/runtime/programs.d.ts +1 -0
- package/runtime/programs.d.ts.map +1 -1
- package/runtime/programs.js +8 -1
- package/runtime/router.d.ts +4 -2
- package/runtime/router.d.ts.map +1 -1
- package/runtime/router.js +10 -8
- package/runtime/toaster.d.ts.map +1 -1
- package/runtime/toaster.js +15 -7
- package/runtime/ui.d.ts.map +1 -1
- package/runtime/ui.js +27 -24
- package/src/records.ts +17 -3
- package/src/register.ts +29 -13
- package/src/runtime/before.ts +71 -34
- package/src/runtime/conversations.ts +26 -8
- package/src/runtime/lifecycle.ts +61 -43
- package/src/runtime/pages.ts +4 -3
- package/src/runtime/programs.ts +12 -1
- package/src/runtime/router.ts +11 -9
- package/src/runtime/toaster.ts +15 -7
- package/src/runtime/ui.ts +24 -21
- package/src/testing/fake-elements.ts +15 -3
- package/src/testing.ts +6 -3
- package/testing/fake-elements.js +15 -3
- package/testing.d.ts.map +1 -1
- package/testing.js +6 -3
- package/vendor-markdown.js +4 -8698
- package/vendor.js +7 -3384
package/testing.js
CHANGED
|
@@ -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 { serveCmodPlugin } from './register.js';
|
|
10
11
|
import { MissingOptions } from './runtime/options.js';
|
|
11
12
|
import { conversationMethods, pickedColor } from './runtime/sessions.js';
|
|
12
13
|
import { deviceNote } from './session/context/turn/device.js';
|
|
@@ -192,7 +193,8 @@ export function testMod(definition, options = {}) {
|
|
|
192
193
|
};
|
|
193
194
|
const cmodClaude = { ...fake.claude, cmod: { call: async (input) => (input.to === name ? callMod(input.method, input.input) : fake.claude.cmod.call(input)) } };
|
|
194
195
|
const reportPart = (_id, message, error) => fake.claude.ui.log(`cmod: ${message}: ${messageOf(error)}`, { to: 'debug' });
|
|
195
|
-
const
|
|
196
|
+
const tellRefusedPress = (_mod, error) => fake.claude.ui.log(`cmod: ${name} did not take the press: ${messageOf(error)}`, { to: 'debug' });
|
|
197
|
+
const parts = drawnParts({ claude: cmodClaude, report: reportPart, press: (mod, input) => void pressPart(input).catch((error) => tellRefusedPress(mod, error)) });
|
|
196
198
|
const servedWidgets = async () => {
|
|
197
199
|
const own = name === cmodPluginName && lifecycle.mod !== undefined ? engineOf(lifecycle.mod).widgets : undefined;
|
|
198
200
|
if (own !== undefined)
|
|
@@ -209,7 +211,7 @@ export function testMod(definition, options = {}) {
|
|
|
209
211
|
};
|
|
210
212
|
const widgetsOf = () => (widgets ??= servedWidgets());
|
|
211
213
|
const cmodBeneath = createRouter();
|
|
212
|
-
const pages = servePages({ claude: cmodClaude, router: cmodBeneath, report: reportPart, widgets: { update: (mod, update) => void widgetsOf().then((served) => served.update(mod, update)) }, parts, tellStylers: () => undefined });
|
|
214
|
+
const pages = servePages({ claude: cmodClaude, router: cmodBeneath, report: reportPart, tellRefusedPress, widgets: { update: (mod, update) => void widgetsOf().then((served) => served.update(mod, update)) }, parts, tellStylers: () => undefined });
|
|
213
215
|
pages.apply((_mod, requests) => applyRequests(requests));
|
|
214
216
|
const dependencies = fakeDependencies(name, options.dependencies ?? {}, conversations);
|
|
215
217
|
fake.fakes.cmod.call = async (call) => {
|
|
@@ -286,7 +288,7 @@ export function testMod(definition, options = {}) {
|
|
|
286
288
|
const starting = options.state;
|
|
287
289
|
const declared = Object.entries(definition.state ?? {});
|
|
288
290
|
const state = Object.fromEntries(declared.map(([lifetime, values]) => [lifetime, { ...values, ...starting?.[lifetime] }]));
|
|
289
|
-
const lifecycle = createLifecycle({ ...definition, state }, () => permissionRoutes, (options.options ?? {}), false);
|
|
291
|
+
const lifecycle = createLifecycle({ ...definition, state }, () => permissionRoutes, (options.options ?? {}), false, definition.name === cmodPluginName ? serveCmodPlugin : undefined);
|
|
290
292
|
let started;
|
|
291
293
|
let isColorTold = false;
|
|
292
294
|
let deviceNoted;
|
|
@@ -345,6 +347,7 @@ export function testMod(definition, options = {}) {
|
|
|
345
347
|
place: async () => conversations.place(),
|
|
346
348
|
wants: async (event) => conversations.wants(name, event),
|
|
347
349
|
fold: decide,
|
|
350
|
+
failedBefore: () => undefined,
|
|
348
351
|
},
|
|
349
352
|
});
|
|
350
353
|
const route = async (event, input, below, signal) => {
|