pi-fabric 0.52.0 → 0.53.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/README.md CHANGED
@@ -17,14 +17,14 @@ _One type-checked program for tools, MCP, agents, workflows, actors, mesh, counc
17
17
  [![license](https://img.shields.io/badge/license-MIT-f4c430?style=for-the-badge)](LICENSE)
18
18
 
19
19
  <p align="center">
20
- 🏆 <strong><a href="https://arcprize.org/scorecards/d4c56c67-136b-4643-b648-62ae28fe2a54">100% on ARC-AGI-3</a></strong> a Fabric-powered agent won <strong>all 25 environments</strong> in one 22.4-hour session with ~4 minutes of human time ($1,349 in model spend).
20
+ 🏆 <strong><a href="https://arcprize.org/scorecards/d4c56c67-136b-4643-b648-62ae28fe2a54">100% on ARC-AGI-3</a></strong>. A Fabric-powered agent won <strong>all 25 environments</strong> in one 22.4-hour session with 4 minutes of human time ($1,349 in model spend).
21
21
  </p>
22
22
 
23
23
  </div>
24
24
 
25
25
  ---
26
26
 
27
- You keep talking to Pi the way you always do. Fabric gives the model **one programmable tool** `fabric_exec` that it uses to compose Pi's core tools, MCP servers, captured extension tools, child agents, persistent actors, and durable coordination into a single type-checked TypeScript program. The program runs in a QuickJS sandbox by default; an explicit unsafe Node-process executor is available for trusted workloads that exceed WASM32 memory. Only the final result comes back to the conversation. Branching, loops, fan-out, and data flow become code the model writes and type-checks — not a stack of separate tool calls you have to orchestrate.
27
+ Fabric gives Pi one programmable tool called `fabric_exec`, which composes core tools and MCP servers with captured extension tools in a checked TypeScript program. That program can call agents or actors, use durable coordination, and run inside QuickJS. Trusted workloads that exceed WASM32 memory may use the unsafe Node process. After execution, the conversation receives the result of the program's branches, loops, fan-out, and data flow.
28
28
 
29
29
  ## Why Fabric?
30
30
 
@@ -39,11 +39,12 @@ You keep talking to Pi the way you always do. Fabric gives the model **one progr
39
39
 
40
40
  ## How it works
41
41
 
42
- 1. **You ask** in plain language, as usual.
43
- 2. **Pi writes one program** that calls the tools, agents, and MCP servers it needs. The program is type-checked before it runs.
44
- 3. **Only the result returns** to your conversation. Intermediate work stays in the sandbox and surfaces in the activity panel and dashboard.
42
+ 1. **You ask** in plain language.
43
+ 2. **Pi writes one program** that calls the required tools and agents.
44
+ 3. **The type checker validates the program** before execution.
45
+ 4. **The result returns** to your conversation. Intermediate work stays in the sandbox and appears in the activity panel and dashboard.
45
46
 
46
- Under the hood, the model writes something like this — you don't:
47
+ The model can write this program:
47
48
 
48
49
  ```ts
49
50
  const [manifest, sources] = await Promise.all([
@@ -56,7 +57,7 @@ return {
56
57
  };
57
58
  ```
58
59
 
59
- Independent calls run in parallel; only the returned object enters the model context. Known providers use concise direct calls such as `mcp.fal_ai.get_model_schema(...)`, `memory.recall(...)`, `state.get()`, `schema.status()`, and `compact.status()`; `tools.call({ ref, args })` remains the fallback for refs discovered or computed at runtime.
60
+ Independent calls run in parallel, and the returned object enters the model context. Known providers support concise direct calls such as `mcp.fal_ai.get_model_schema(...)`, `memory.recall(...)`, `state.get()`, `schema.status()`, and `compact.status()`. Refs found or computed at runtime use `tools.call({ ref, args })`.
60
61
 
61
62
  ## Install
62
63
 
@@ -93,7 +94,7 @@ pi -e /absolute/path/to/pi-fabric
93
94
 
94
95
  ## What you can ask for
95
96
 
96
- Advanced patterns are user-invoked and are not advertised for automatic selection. Run `/skill:fabric-guide` when you want one recommendation, or invoke the exact `/skill:<name>` yourself. Describing an ordinary coding task keeps Pi on the core `fabric-exec` path.
97
+ Pi loads advanced patterns after direct user invocation. Run `/skill:fabric-guide` for one recommendation, or invoke the exact `/skill:<name>` yourself. An ordinary coding task keeps Pi on the core `fabric-exec` path.
97
98
 
98
99
  | You want | Run |
99
100
  | -------- | --- |
@@ -105,7 +106,7 @@ Advanced patterns are user-invoked and are not advertised for automatic selectio
105
106
  | A quiet decision-point reviewer | `/skill:fabric-advisor Focus on migration correctness.` |
106
107
  | Same-model independent reviewers and one decision | `/skill:fabric-council Review this design for correctness, security, and operability.` |
107
108
  | Multi-model compare-not-merge deliberation or act mode | `/skill:fabric-fusion Deliberate this design across models.` |
108
- | One command that infers advisor versus supervisor | `/skill:fabric-ambient advisor Focus on migration correctness.` |
109
+ | One command that chooses advisor or supervisor | `/skill:fabric-ambient advisor Focus on migration correctness.` |
109
110
  | A durable team coordinating through versioned tasks | `/skill:fabric-swarm Coordinate this migration across owned task partitions.` |
110
111
  | Evidence-gated edits with postconditions | `/skill:fabric-schema Make this parser change only if focused tests stay green.` |
111
112
 
@@ -113,23 +114,23 @@ The foundation is the `fabric-exec` reference skill: the model loads it before i
113
114
 
114
115
  ## The dashboard
115
116
 
116
- Fabric adds a live activity surface to Pi, no extra extension required:
117
+ Fabric includes a live activity surface in Pi:
117
118
 
118
119
  - A compact widget above the chat (like `pi-supervisor`) whose header follows the current phase while its rows show active/completed agents, active actors, and their recent nested tool or code-change activity.
119
- - `/fabric` (or `/fabric dashboard`) **Activity** and **Topology** views where the user-facing Pi session is always present as **Main**. Queue/steer Main, active children, actors, and observed mesh agents; navigate a spring-followed unified topology of runs and project mesh, with paged transcripts, topics, state, and routes.
120
- - `/fabric settings` mirrors Pi's `/settings` and writes changes to `fabric.json`.
120
+ - `/fabric` (or `/fabric dashboard`): opens the **Activity** and **Topology** views. The user-facing Pi session appears as **Main**. You can queue or steer participants and inspect the project topology.
121
+ - `/fabric settings`: mirrors Pi's `/settings` and writes changes to `fabric.json`.
121
122
 
122
123
  See the [interface & commands reference](docs/interface.md) for every view, keybinding, and slash command.
123
124
 
124
125
  ## Reference
125
126
 
126
- - [Configuration](docs/configuration.md) `fabric.json`, code modes, tool capture, approvals, and budgets.
127
- - [Interface & commands](docs/interface.md) dashboard, settings, keybindings, slash commands, and headless runs.
128
- - [Agents, actors & mesh](docs/agents.md) — agents, trajectory-preserving model handoff and `/fabric prewalk`, the Claude and Veda runners, transports, steering, persistent actors, global templates, councils, recursive queries, and durable coordination.
129
- - [Components & committed capabilities](docs/components.md) supervised effects, exact requirements, transactional reload, provider generations, actor commitments, and the linked executable component calculus.
130
- - [External providers](docs/providers.md) the versioned provider protocol for extensions.
131
- - [Architecture & security](docs/architecture.md) the host bridge, sandboxing, tool-call robustness, and limitations.
132
- - [Skills](docs/skills.md) the core-first invocation policy and user-invoked advanced patterns.
127
+ - [Configuration](docs/configuration.md): `fabric.json`, code modes, tool capture, approvals, and budgets.
128
+ - [Interface & commands](docs/interface.md): dashboard, settings, keybindings, slash commands, and headless runs.
129
+ - [Agents, actors & mesh](docs/agents.md): model handoff, `/fabric prewalk`, runners, transports, actors, councils, recursive queries, and durable coordination.
130
+ - [Components & committed capabilities](docs/components.md): supervised effects, exact requirements, rolling provider generations, actor commitments, and both formal calculi.
131
+ - [External providers](docs/providers.md): the versioned provider protocol for extensions.
132
+ - [Architecture & security](docs/architecture.md): the host bridge, sandboxing, tool-call robustness, and limits.
133
+ - [Skills](docs/skills.md): the core-first invocation policy and user-invoked advanced patterns.
133
134
 
134
135
  ## Development
135
136
 
@@ -140,12 +141,19 @@ pnpm test
140
141
  pnpm build
141
142
  ```
142
143
 
143
- The test suite covers configuration, schema validation, provider dispatch, registered-tool interception and execution, QuickJS isolation, Pi built-in invocation, agents, fake Claude stream-JSON and model discovery, fake Veda JSON runs, workflows, durable mesh state, actor mailboxes and subscriptions, and Pi/Claude actor restoration. Claude and Veda fixtures never make a billable request.
144
+ The test suite covers:
145
+
146
+ - configuration and schema validation
147
+ - provider dispatch, registered-tool execution, QuickJS isolation, and Pi built-in calls
148
+ - agent fixtures for Claude and Veda
149
+ - workflows, durable mesh state, actor mailboxes, subscriptions, and actor restoration
150
+
151
+ Claude and Veda fixtures use local test processes with zero billable requests.
144
152
 
145
153
  ## Acknowledgments
146
154
 
147
- - Thanks to [@hazrid93](https://github.com/hazrid93), who originally requested a better LLM advisor pattern that saved on tokens — the idea that became Fabric's advisor.
148
- - Thanks to Chad Gibson at [Neuralwatt](https://neuralwatt.com), who opened the door to extended testing of long MCR sessions and patiently listened to every debugging woe along the way.
155
+ - Thanks to [@hazrid93](https://github.com/hazrid93), whose request for a token-efficient LLM advisor pattern led to Fabric's advisor.
156
+ - Thanks to Chad Gibson at [Neuralwatt](https://neuralwatt.com), who supported extended tests of long MCR sessions and the related debugging work.
149
157
 
150
158
  ## License
151
159
 
@@ -1755,6 +1755,116 @@ var leanRun = (run) => ({
1755
1755
  ...run.error ? { error: run.error } : {}
1756
1756
  });
1757
1757
 
1758
+ // src/components/provider-component.ts
1759
+ var FABRIC_PROVIDER_COMPONENT_PREFIX = "fabric.provider.";
1760
+ var FABRIC_COMPONENT_PROVIDER_NAMES = [
1761
+ "pi",
1762
+ "extensions",
1763
+ "mcp",
1764
+ "mesh",
1765
+ "state",
1766
+ "schema",
1767
+ "compact",
1768
+ "agents",
1769
+ "memory"
1770
+ ];
1771
+ var FabricProviderComponentManifest = class {
1772
+ constructor(catalog, loader) {
1773
+ this.catalog = catalog;
1774
+ this.loader = loader;
1775
+ }
1776
+ #entries = [];
1777
+ entries() {
1778
+ return this.#entries.map((entry) => structuredClone(entry));
1779
+ }
1780
+ async install(component) {
1781
+ const definitionName = component.definition.name;
1782
+ const provider = definitionName.startsWith(FABRIC_PROVIDER_COMPONENT_PREFIX) ? definitionName.slice(FABRIC_PROVIDER_COMPONENT_PREFIX.length) : void 0;
1783
+ if (!provider || component.entry.id !== definitionName || component.entry.component !== definitionName || component.definition.provides?.length !== 1 || component.definition.provides[0] !== provider) {
1784
+ throw new Error(`Invalid Fabric provider component manifest entry: ${definitionName}`);
1785
+ }
1786
+ if (this.#entries.some((entry) => entry.id === component.entry.id)) {
1787
+ throw new Error(`Duplicate Fabric provider component: ${component.entry.id}`);
1788
+ }
1789
+ const previousDefinition = this.catalog.get(component.definition.name)?.definition;
1790
+ this.catalog.register(component.definition, {
1791
+ overwrite: previousDefinition !== void 0
1792
+ });
1793
+ this.#entries.push(structuredClone(component.entry));
1794
+ try {
1795
+ await this.loader.installPinned(this.#entries);
1796
+ } catch (error) {
1797
+ this.#entries.pop();
1798
+ if (previousDefinition) {
1799
+ this.catalog.register(previousDefinition, { overwrite: true });
1800
+ } else {
1801
+ this.catalog.unregister(component.definition.name);
1802
+ }
1803
+ throw error;
1804
+ }
1805
+ }
1806
+ assertActive(expectedProviders, registry) {
1807
+ const expected = new Set(expectedProviders);
1808
+ const installed = new Set(
1809
+ this.#entries.map(
1810
+ (entry) => entry.component.slice(FABRIC_PROVIDER_COMPONENT_PREFIX.length)
1811
+ )
1812
+ );
1813
+ const missing = [...expected].filter(
1814
+ (name) => !installed.has(name) || !registry.has(name)
1815
+ );
1816
+ const unexpected = [...installed].filter((name) => !expected.has(name));
1817
+ if (missing.length > 0 || unexpected.length > 0) {
1818
+ throw new Error(
1819
+ `Fabric provider component manifest mismatch. Missing: ${missing.join(",") || "none"}. Unexpected: ${unexpected.join(",") || "none"}.`
1820
+ );
1821
+ }
1822
+ }
1823
+ };
1824
+ var providerComponentName = (provider) => `${FABRIC_PROVIDER_COMPONENT_PREFIX}${provider}`;
1825
+ var createProviderComponent = (spec) => {
1826
+ const name = providerComponentName(spec.provider);
1827
+ const definition = {
1828
+ name,
1829
+ description: spec.description,
1830
+ ...spec.requires ? { requires: spec.requires } : {},
1831
+ provides: [spec.provider],
1832
+ guarantee: "managed",
1833
+ async activate(context) {
1834
+ const provider = await spec.create(context);
1835
+ if (provider.name !== spec.provider) {
1836
+ await provider.close?.();
1837
+ throw new Error(
1838
+ `Fabric provider component ${name} created ${provider.name}, expected ${spec.provider}`
1839
+ );
1840
+ }
1841
+ try {
1842
+ context.provide(provider);
1843
+ } catch (error) {
1844
+ await provider.close?.();
1845
+ throw error;
1846
+ }
1847
+ if (spec.mounted) {
1848
+ try {
1849
+ spec.mounted(provider);
1850
+ } catch (error) {
1851
+ spec.unmounted?.(provider);
1852
+ throw error;
1853
+ }
1854
+ context.defer(
1855
+ () => spec.unmounted?.(provider),
1856
+ `provider-component:${spec.provider}:holder`
1857
+ );
1858
+ }
1859
+ await spec.start?.(provider);
1860
+ }
1861
+ };
1862
+ return {
1863
+ entry: { id: name, component: name },
1864
+ definition
1865
+ };
1866
+ };
1867
+
1758
1868
  // src/prewalk/controller.ts
1759
1869
  var PREWALK_TRIGGER_REFS = /* @__PURE__ */ new Set([
1760
1870
  "pi.edit",
@@ -2230,9 +2340,13 @@ export {
2230
2340
  loadCachedMcpDescriptors,
2231
2341
  toMcpAdvisoryDescriptor,
2232
2342
  FabricActivityStore,
2343
+ FABRIC_PROVIDER_COMPONENT_PREFIX,
2344
+ FABRIC_COMPONENT_PROVIDER_NAMES,
2345
+ FabricProviderComponentManifest,
2346
+ createProviderComponent,
2233
2347
  PrewalkController,
2234
2348
  PrewalkDriftTracker,
2235
2349
  resolveFabricIdentity,
2236
2350
  MainAgentController
2237
2351
  };
2238
- //# sourceMappingURL=chunk-BQWXUWCN.js.map
2352
+ //# sourceMappingURL=chunk-WXY7GS3P.js.map