feat(chord): keep services available during facet reloads

This commit is contained in:
Armin Ronacher 2026-09-01 10:47:08 +02:00
parent 7cf456aa1c
commit c4b0e35abe
13 changed files with 386 additions and 163 deletions

View file

@ -11,14 +11,17 @@ export default defineFacet({
const ui = env.use(PresentationUI);
env.onActivate(() => {
env.own(
commands.register({
commands.replace({
name: "hello",
description: "Call the bundled Session worker facet",
argumentHint: "<name>",
async run(args, context) {
const message = args.length === 0 ? "from the TUI" : args;
const reply = await example.greet({ name: message }, context);
ui.showStatus(`${reply.message} Worker activations: ${reply.workerActivations}.`, context);
ui.showStatus(
`We got this: ${reply.message} Worker activations: ${reply.workerActivations}.`,
context,
);
return controller.prompt({ message: `pong: ${message}`, images: null }, context);
},
}),