mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-12-05 22:39:19 +00:00
Every remote contract declares one shape: members only some callers get are grantable(...), and its provider grants them per principal through admit (grantBy in src/runtime/chord.ts; notGranted/ungranted for a factory branch's members its principal never gets). Call sites read grants instead of variant names: live/liveWith/kept/keptWith/withGranted/expectGranted (src/runtime/refs.ts) replace liveIn/keptIn/withHeld(ref, variant)/expectVariant; useObject has no variant option. Old contract versions are refused (Chord slice 15): every remote contract is a new history base with its version bumped; the variant-era histories and accepts of Sessions, SessionTree, Envs, Projects, Views, Mcp, Discord, Search, SessionStatus and Subagents collapse into one declaration each, so pages, TUIs and workers loaded before the deploy get contract_mismatch and reload once. Catalog (local) keeps its history. Tests: holdWith/boundWith, stubs take the grants, contract-versions tests Catalog and the refusal.
13 lines
592 B
TypeScript
13 lines
592 B
TypeScript
// Reloading plugins (server): any session's worker may ask (whether its agent has `reload_plugins` is the session's
|
|
// tool selection and lock, as for bash).
|
|
import { defineFacet, forbidden } from "@p2/app/v1";
|
|
import { serverOf } from "@p2/app/v1/server";
|
|
import { PluginReload } from "./contract.ts";
|
|
|
|
export default defineFacet((host) => {
|
|
host.serve(PluginReload, (_params, principal, self) => {
|
|
if (principal.kind !== "worker") throw forbidden("session workers only");
|
|
const server = serverOf(self);
|
|
return { reload: ({ plugins }) => server().plugins.reload(plugins) };
|
|
});
|
|
});
|