pi-fabric 0.76.2 → 0.77.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/dist/agents/bash-worktree-add.d.ts +24 -0
- package/dist/agents/bash-worktree-add.d.ts.map +1 -0
- package/dist/agents/clone-first-worktree.d.ts +17 -0
- package/dist/agents/clone-first-worktree.d.ts.map +1 -0
- package/dist/agents/cow-clone.d.ts +8 -0
- package/dist/agents/cow-clone.d.ts.map +1 -0
- package/dist/agents/worktree-manager.d.ts.map +1 -1
- package/dist/agents/worktree-paths.d.ts +5 -0
- package/dist/agents/worktree-paths.d.ts.map +1 -0
- package/dist/chunks/{chunk-F2GKEXGI.js → chunk-4DRVOAFY.js} +271 -145
- package/dist/chunks/chunk-4DRVOAFY.js.map +7 -0
- package/dist/chunks/{chunk-BT6UELLP.js → chunk-SBHF6CVR.js} +2 -2
- package/dist/chunks/{fabric-runtime-state-VCLWTB55.js → fabric-runtime-state-H7UA3DJC.js} +188 -87
- package/dist/chunks/fabric-runtime-state-H7UA3DJC.js.map +7 -0
- package/dist/index.js +1 -1
- package/dist/providers/pi-tools-provider.d.ts.map +1 -1
- package/dist/residency/client.d.ts.map +1 -1
- package/dist/residency/host.js +2 -2
- package/dist/residency/pi-entry.js +2 -2
- package/docs/agents.md +1 -1
- package/docs/architecture.md +1 -1
- package/package.json +1 -1
- package/skills/fabric-exec/references/agents.md +3 -3
- package/dist/chunks/chunk-F2GKEXGI.js.map +0 -7
- package/dist/chunks/fabric-runtime-state-VCLWTB55.js.map +0 -7
- /package/dist/chunks/{chunk-BT6UELLP.js.map → chunk-SBHF6CVR.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -3306,7 +3306,7 @@ var FabricState = class {
|
|
|
3306
3306
|
return activation;
|
|
3307
3307
|
}
|
|
3308
3308
|
async #createRuntime() {
|
|
3309
|
-
const module = await (this.#options.runtimeLoader?.() ?? import("./chunks/fabric-runtime-state-
|
|
3309
|
+
const module = await (this.#options.runtimeLoader?.() ?? import("./chunks/fabric-runtime-state-H7UA3DJC.js"));
|
|
3310
3310
|
return new module.FabricRuntimeState(
|
|
3311
3311
|
this.pi,
|
|
3312
3312
|
this.capturedTools,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-tools-provider.d.ts","sourceRoot":"","sources":["../../src/providers/pi-tools-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pi-tools-provider.d.ts","sourceRoot":"","sources":["../../src/providers/pi-tools-provider.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EAEvB,cAAc,EACd,yBAAyB,EAE1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAmJrE,qBAAa,eAAgB,YAAW,cAAc;;IACpD,QAAQ,CAAC,IAAI,QAAQ;IACrB,QAAQ,CAAC,WAAW,gCAAgC;gBAQlD,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,mBAAmB,EAC7B,aAAa,CAAC,EAAE,qBAAqB;IAgBjC,IAAI,CACR,OAAO,EAAE,yBAAyB,EAClC,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAY9B,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAS9C,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAsCtF,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC;CAqTpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/residency/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/residency/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAK3H,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAuB,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAQL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AA6DvB,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,uBAAuB,CAAC;IACtC,SAAS,EAAE,qBAAqB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAe;;IAed,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAdpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAcH,OAAO,EAAE,sBAAsB;IAYpD,KAAK,IAAI,IAAI;IAUP,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5B,mBAAmB,CAAC,QAAQ,EAAE,SAAS,wBAAwB,EAAE,GAAG,IAAI;IAWlE,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAqCxC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtC,UAAU,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAsB1F,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI7B,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe;IAezD,UAAU,IAAI,KAAK,CAAC,cAAc,GAAG,eAAe,CAAC;IAkB/C,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAmB1E,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,cAAc;IAiBrF,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAatD,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CA4KpF"}
|
package/dist/residency/host.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runResidentHostFromConfigPath
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-SBHF6CVR.js";
|
|
5
|
+
import "../chunks/chunk-4DRVOAFY.js";
|
|
6
6
|
import "../chunks/chunk-PM5I335G.js";
|
|
7
7
|
import "../chunks/chunk-VPPIJRNZ.js";
|
|
8
8
|
import "../chunks/chunk-QWIKS6CT.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runResidentHostFromConfigPath
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-SBHF6CVR.js";
|
|
4
|
+
import "../chunks/chunk-4DRVOAFY.js";
|
|
5
5
|
import "../chunks/chunk-PM5I335G.js";
|
|
6
6
|
import "../chunks/chunk-VPPIJRNZ.js";
|
|
7
7
|
import "../chunks/chunk-QWIKS6CT.js";
|
package/docs/agents.md
CHANGED
|
@@ -228,7 +228,7 @@ localterm start
|
|
|
228
228
|
|
|
229
229
|
`/fabric agents` lists the children. Run `/fabric attach <id>` to show the correct attach command. Abort signals propagate to the transport and the selected child process. When a program uses orchestration entry points such as `agent`/`workflow.agent`, `agents.run`/`agents.wait`/`agents.ask`, `council.run`, or `rlm.query`, Fabric increases the whole-program `executor.timeoutMs` to at least `agents.timeoutMs`. The same increase applies to `agents.*` refs called through `tools.call()` and to refs calculated at runtime. The parent deadline then cannot stop a child that remains within its own agent budget.
|
|
230
230
|
|
|
231
|
-
Set `worktree: true` to create a dedicated Git worktree and a `pi-fabric/<name>-<id>` branch from the repository containing the selected `cwd`. Fabric retains worktrees for inspection until you call `agents.cleanup()`. When the selected cwd is a repository subdirectory, Fabric uses the matching subdirectory in the generated worktree when it exists; otherwise it uses the worktree root. The reported effective cwd is the generated worktree path, and Pi evaluates that generated path as its own canonical cwd. The caller's project and mesh roots remain unchanged, so a child targeting another repository still belongs to the orchestrating Fabric topology. A recursive child in a worktree stays in the same participant directory and does not create another `.pi/fabric/mesh` inside that worktree.
|
|
231
|
+
Set `worktree: true` to create a dedicated Git worktree and a `pi-fabric/<name>-<id>` branch from the repository containing the selected `cwd`. Fabric writes that worktree at `<repo>/.pi/fabric/worktrees/<id>` so copy-on-write cloning can keep ignored build artifacts on the same volume, and it records the path in the repository `.git/info/exclude` file. Simple `git worktree add` commands run through `pi.bash` take the same clone-first path. Fabric retains worktrees for inspection until you call `agents.cleanup()`. When the selected cwd is a repository subdirectory, Fabric uses the matching subdirectory in the generated worktree when it exists; otherwise it uses the worktree root. The reported effective cwd is the generated worktree path, and Pi evaluates that generated path as its own canonical cwd. The caller's project and mesh roots remain unchanged, so a child targeting another repository still belongs to the orchestrating Fabric topology. A recursive child in a worktree stays in the same participant directory and does not create another `.pi/fabric/mesh` inside that worktree.
|
|
232
232
|
|
|
233
233
|
[Model-guidance components](components.md#model-facing-guidance-components) can target participants by canonical provider/model. Direct agents and actors retain their role prompt and receive matching append guidance after it. Recursive Pi children load the project components and resolve their own replaceable Fabric execution slot, so the parent does not duplicate guidance. Durable owners use the latest atomically committed guidance snapshot for each launch. Guidance changes prompts only; it cannot widen tools, approvals, or committed capabilities. Task text, message envelopes, run IDs, and timestamps stay out of the guidance system prompt, so repeated runs with the same role, model, and component projection retain a byte-stable prefix.
|
|
234
234
|
|
package/docs/architecture.md
CHANGED
|
@@ -123,7 +123,7 @@ Control topics and topology and legacy state prefixes are reserved from guest me
|
|
|
123
123
|
- `/fabric prewalk` pre-authorizes the same one-shot delegation through `prewalk.model` or an interactively selected Pi executor. The command adapts [Stencil's Prewalk](https://stencil.so/blog/prewalk) and [oh-my-pi's in-place implementation](https://github.com/can1357/oh-my-pi/blob/main/packages/coding-agent/src/session/agent-session.ts) into a prompt-free form. It uses a coarser atomic boundary. The first monitored mutation marks the outer Fabric invocation, every remaining nested call still runs, and the executor starts only from the complete native `fabric_exec` call/result pair.
|
|
124
124
|
- Claude `extensions: true` preserves the user's normal Claude Code customizations, including applicable settings and hooks. Those hooks execute with their usual host privileges. Set `extensions: false` for Claude safe mode. When allowed, `Bash` stays unrestricted inside the child, in the same way as Fabric's `bash` capability.
|
|
125
125
|
- Claude model discovery sends a local initialization control request and never invokes a model. One-shot and actor activations use the account or API billing already configured in Claude Code. Fabric records the CLI's reported `total_cost_usd` in its normal usage and budget ledgers.
|
|
126
|
-
- A Git worktree isolates files. It does not isolate credentials, network access, processes, or external services.
|
|
126
|
+
- A Git worktree isolates files. It does not isolate credentials, network access, processes, or external services. Fabric-managed worktrees live at `<repo>/.pi/fabric/worktrees/<id>` and clone the source tree copy-on-write when the filesystem allows it.
|
|
127
127
|
- Fabric projects agent transcripts from local `events.jsonl` run logs. The dashboard redacts common credentials from compact tool previews. The permission-restricted raw event log can still contain assistant text, tool arguments and results, diagnostics, and extension protocol payloads. Persisted `fabric_exec` traces also retain projected bash command text for command previews. Treat retained session and run data as sensitive.
|
|
128
128
|
- Fabric stops session-resident background children when the parent Pi session shuts down. A hidden per-root resident host launches `agents.spawn({ residency: "durable" })`, and that child continues after the TUI exits. A detached spawn sends a follow-up completion message unless the caller later waits for it or `notifyOnComplete` is disabled. Resident completion messages queue in mesh state until Main resumes. Durable participant lifecycle subscriptions deliver source-qualified Pi and run notifications across roots, agents, and actors with no transcript disclosure. Completed worktrees are retained on purpose.
|
|
129
129
|
- Fabric suspends session-resident actors on shutdown and restores them after project trust. `agents.create({ residency: "durable" })` transfers execution to the hidden resident host before it returns. The mailbox, mesh subscriptions, relayed Main events, and runner session continue after Main exits.
|
package/package.json
CHANGED
|
@@ -22,11 +22,11 @@ For Pi leaf agents, selecting `cwd` neither grants nor requires project trust. F
|
|
|
22
22
|
- `tools` defaults to `agents.defaultTools`. Claude maps `read→Read`, `grep→Grep`, `find/ls→Glob`, `bash→Bash`, `edit→Edit`, and `write→Write`; other tool names fail before launch.
|
|
23
23
|
- `schema` is a JSON Schema; the worker returns validated structured data in `result.value`.
|
|
24
24
|
- `cwd` changes only a leaf child's execution directory. Workflow helpers and `council.run()` forward it; recursive `rlm.query()` deliberately does not accept it. Persistent actor definitions and trajectory handoff also do not accept it. A request combining `cwd` with `recursive: true` is rejected before launch.
|
|
25
|
-
- `worktree: true` creates a dedicated Git worktree on branch `pi-fabric/<name>-<id>` from the repository containing the selected `cwd`, retained until `agents.cleanup()`. A selected repository subdirectory is preserved in the generated worktree when available. The effective cwd is the generated canonical path. Project and mesh ownership remain those of the caller.
|
|
26
|
-
- Worktree path gotcha
|
|
25
|
+
- `worktree: true` creates a dedicated Git worktree on branch `pi-fabric/<name>-<id>` from the repository containing the selected `cwd`, retained until `agents.cleanup()`. Fabric writes it at `<repo>/.pi/fabric/worktrees/<id>` (agent id, not the target repo name) and clone-first copy-on-write keeps ignored build artifacts when the filesystem supports it. A selected repository subdirectory is preserved in the generated worktree when available. The effective cwd is the generated canonical path. Project and mesh ownership remain those of the caller.
|
|
26
|
+
- Worktree path gotcha: the directory name is the agent id, not the target repo. Repo identity lives in the registered worktree list and branch tip. Never instruct an agent to verify its location by directory-name pattern; verify by repo (`git rev-parse --show-toplevel` + `git log -1 --format=%H` against the expected base, or `git remote get-url origin`).
|
|
27
27
|
- Preferred pattern for parallel implementers (deterministic, full branch control): pre-create the worktrees yourself in the target repo (`git worktree add -b <branch> <path> <base>`), pass each canonical path as `cwd`, leave `worktree` unset, and state the exact expected top-level in the task. Canonical-path gotcha on macOS: `git rev-parse --show-toplevel` reports `/private/tmp/...` for worktrees created under `/tmp/...` — assign and verify the canonical `/private` form or the agent's guard will correctly refuse.
|
|
28
28
|
- Give every autonomous coding agent a mandatory first command that verifies repo identity (exact canonical toplevel or remote URL) and a hard rule to abort with zero changes on mismatch. Guards cost one cheap round when wrong and prevent cross-repo contamination when right — four successive guards caught a wrong-repo worktree, a self-inflicted symlink mismatch, and a too-literal directory check at zero bytes of damage.
|
|
29
|
-
- Cleanup after cancelled/failed agent runs: check `agents.list({ scope: "project" })` and `agents.stop` any still-running handles first; worktree registrations live in the repo that OWNS the worktree (check `git worktree list` in every candidate repo
|
|
29
|
+
- Cleanup after cancelled/failed agent runs: check `agents.list({ scope: "project" })` and `agents.stop` any still-running handles first; worktree registrations live in the repo that OWNS the worktree (check `git worktree list` in every candidate repo; `.pi/fabric/worktrees/<id>` names the agent, not the repo), then `git worktree remove --force` + `git branch -D` + `git worktree prune` in each. Leave pre-existing non-agent worktrees alone; filter by the branch prefix your runs created (e.g. `pi-fabric/<name>`).
|
|
30
30
|
- `residency` is available on `agents.spawn` only: `"session"` (default) ties the run to the current Pi host; `"durable"` launches it on Fabric's hidden resident host so it can finish after Main exits. Durable handles still support `status`, `wait`, `log`, `stop`, and `cleanup` when the same root resumes. It requires a trusted project mesh and is unavailable in Schema enforce mode.
|
|
31
31
|
- Omit `timeoutMs` normally. It defaults to `agents.timeoutMs` (60 minutes by default), and per-call values below that configured default are ignored. Set it only to request a longer run.
|
|
32
32
|
|