@e4779/pi-fabric 0.131.0-fork.32 → 0.132.6-fork.34
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 +1 -1
- package/dist/activity/store.d.ts.map +1 -1
- package/dist/actors/feedback.d.ts +5 -0
- package/dist/actors/feedback.d.ts.map +1 -0
- package/dist/actors/global-registry.d.ts.map +1 -1
- package/dist/actors/manager.d.ts.map +1 -1
- package/dist/agents/completion-inbox.d.ts +2 -1
- package/dist/agents/completion-inbox.d.ts.map +1 -1
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/transports/herdr-core-socket.d.ts +13 -0
- package/dist/agents/transports/herdr-core-socket.d.ts.map +1 -0
- package/dist/agents/transports/herdr-core-transport.d.ts +10 -0
- package/dist/agents/transports/herdr-core-transport.d.ts.map +1 -0
- package/dist/agents.js +5 -1
- package/dist/agents.js.map +1 -1
- package/dist/async-settlement.d.ts +1 -1
- package/dist/async-settlement.d.ts.map +1 -1
- package/dist/audit/details.d.ts +2 -0
- package/dist/audit/details.d.ts.map +1 -1
- package/dist/chunks/{chunk-HSEZPCL5.js → chunk-2OC4YJOL.js} +3 -3
- package/dist/chunks/{chunk-TXCNZCZP.js → chunk-2QJ4MNS6.js} +2 -2
- package/dist/chunks/{chunk-QOEOKW2X.js → chunk-3QH6JAE3.js} +2 -2
- package/dist/chunks/{chunk-3XT5WHSG.js → chunk-4Y5KEJP4.js} +3 -3
- package/dist/chunks/{chunk-RAA3FAYZ.js → chunk-5PSEJOJB.js} +2 -2
- package/dist/chunks/{chunk-XFOSUGLU.js → chunk-66UTGL7T.js} +2 -2
- package/dist/chunks/{chunk-WWTGWGH7.js → chunk-6ZPEPRUV.js} +27 -9
- package/dist/chunks/chunk-6ZPEPRUV.js.map +7 -0
- package/dist/chunks/{chunk-7TB7NXSL.js → chunk-7CIQQOOD.js} +11 -3
- package/dist/chunks/{chunk-7TB7NXSL.js.map → chunk-7CIQQOOD.js.map} +2 -2
- package/dist/chunks/{chunk-3PKZSIRA.js → chunk-ASOJYFKU.js} +8 -4
- package/dist/chunks/chunk-ASOJYFKU.js.map +7 -0
- package/dist/chunks/{chunk-PUBHBEYO.js → chunk-B2FIGOPI.js} +2 -2
- package/dist/chunks/{chunk-ZFWICFNJ.js → chunk-DGUXJSYA.js} +41 -17
- package/dist/chunks/chunk-DGUXJSYA.js.map +7 -0
- package/dist/chunks/{chunk-WGMCNCP6.js → chunk-F3D7GTBK.js} +228 -90
- package/dist/chunks/chunk-F3D7GTBK.js.map +7 -0
- package/dist/chunks/{chunk-X7QETPBC.js → chunk-F6GIK5GO.js} +8 -8
- package/dist/chunks/{chunk-LKYLD5SN.js → chunk-FMEOJJ6Y.js} +3 -2
- package/dist/chunks/chunk-FMEOJJ6Y.js.map +7 -0
- package/dist/chunks/{chunk-4PBW54I2.js → chunk-GGQ43B7T.js} +3 -3
- package/dist/chunks/{chunk-MSDL7U6Q.js → chunk-JSHIS7GO.js} +2 -2
- package/dist/chunks/{chunk-VNWQIGQL.js → chunk-JWERGULW.js} +421 -254
- package/dist/chunks/chunk-JWERGULW.js.map +7 -0
- package/dist/chunks/{chunk-HRDMBGMY.js → chunk-K4VRQ7WZ.js} +4 -4
- package/dist/chunks/{chunk-5BOTHX47.js → chunk-LP5EVMBB.js} +157 -4
- package/dist/chunks/chunk-LP5EVMBB.js.map +7 -0
- package/dist/chunks/{chunk-4KX6BIPL.js → chunk-LRSZFYUC.js} +2 -2
- package/dist/chunks/chunk-LRSZFYUC.js.map +7 -0
- package/dist/chunks/{chunk-56NMRVTV.js → chunk-MGFSQXAJ.js} +23 -23
- package/dist/chunks/{chunk-56NMRVTV.js.map → chunk-MGFSQXAJ.js.map} +2 -2
- package/dist/chunks/{chunk-RWKQ5SRW.js → chunk-MTAFECXB.js} +2 -2
- package/dist/chunks/{chunk-UFMYN5TA.js → chunk-MX53BRAC.js} +2 -2
- package/dist/chunks/{chunk-7CIES6X2.js → chunk-NGXAEGD2.js} +12 -2
- package/dist/chunks/chunk-NGXAEGD2.js.map +7 -0
- package/dist/chunks/{chunk-IOGDTIGN.js → chunk-NSV7WTCT.js} +3 -3
- package/dist/chunks/{chunk-IOGDTIGN.js.map → chunk-NSV7WTCT.js.map} +1 -1
- package/dist/chunks/{chunk-3VK6UGAN.js → chunk-O5SHIUIL.js} +6 -1
- package/dist/chunks/chunk-O5SHIUIL.js.map +7 -0
- package/dist/chunks/{chunk-4WKD3YM3.js → chunk-OILZ4PDY.js} +3 -3
- package/dist/chunks/{chunk-H57KPL3V.js → chunk-S2JWFXW5.js} +2 -2
- package/dist/chunks/{chunk-HFDJWLMS.js → chunk-SOEUGSY4.js} +2 -2
- package/dist/chunks/{chunk-YHFWMAQ5.js → chunk-TEMKDJJY.js} +151 -52
- package/dist/chunks/chunk-TEMKDJJY.js.map +7 -0
- package/dist/chunks/{chunk-KIFOEBYJ.js → chunk-VEXCD3RA.js} +2 -2
- package/dist/chunks/{chunk-GS67KDMV.js → chunk-VN7AE3EY.js} +2 -2
- package/dist/chunks/{chunk-MPMEK3IQ.js → chunk-WYLBWFAO.js} +2 -2
- package/dist/chunks/{chunk-6GWDGTHC.js → chunk-YLO62DWD.js} +4 -4
- package/dist/chunks/{chunk-4BYS4ZLY.js → chunk-YN4K3FNB.js} +5 -5
- package/dist/chunks/{chunk-OJ4HAALD.js → chunk-YO5UIWDY.js} +3 -3
- package/dist/chunks/{chunk-7N7IC3Z2.js → chunk-ZCXW3GR7.js} +2 -2
- package/dist/chunks/{chunk-36XQFTEN.js → chunk-ZY375C2U.js} +2 -2
- package/dist/commands/fabric-handler.js +2 -2
- package/dist/commands/fabric-handler.js.map +1 -1
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/compaction/claim-events.js +8 -8
- package/dist/compaction/hook.js +6 -6
- package/dist/compaction/owner.js +7 -7
- package/dist/compaction/threshold.d.ts.map +1 -1
- package/dist/components/configuration.js +3 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-registry.d.ts +1 -1
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +8 -8
- package/dist/core/attached-monitors.d.ts +39 -0
- package/dist/core/attached-monitors.d.ts.map +1 -0
- package/dist/core/call-presentation.d.ts +14 -0
- package/dist/core/call-presentation.d.ts.map +1 -0
- package/dist/core/execution-guidelines.d.ts +6 -0
- package/dist/core/execution-guidelines.d.ts.map +1 -0
- package/dist/core/guidance-delivery.d.ts +19 -0
- package/dist/core/guidance-delivery.d.ts.map +1 -0
- package/dist/core/observation-actions.d.ts +9 -0
- package/dist/core/observation-actions.d.ts.map +1 -0
- package/dist/core/prompt-guidance.d.ts +1 -0
- package/dist/core/prompt-guidance.d.ts.map +1 -1
- package/dist/core/prompt-guidance.js +50 -1
- package/dist/core/prompt-guidance.js.map +3 -3
- package/dist/core/provider-operations.js +1 -1
- package/dist/core/shell-inbox.d.ts +1 -1
- package/dist/core/shell-inbox.d.ts.map +1 -1
- package/dist/core/shell-jobs.d.ts +17 -1
- package/dist/core/shell-jobs.d.ts.map +1 -1
- package/dist/core/shell-monitor.d.ts +1 -0
- package/dist/core/shell-monitor.d.ts.map +1 -1
- package/dist/durable/agent.d.ts.map +1 -1
- package/dist/durable/worker-host.js +1 -1
- package/dist/durable-extension.d.ts +2 -2
- package/dist/durable-extension.d.ts.map +1 -1
- package/dist/durable-extension.js +215 -1
- package/dist/durable-extension.js.map +3 -3
- package/dist/durable-host.js +1 -1
- package/dist/durable.d.ts.map +1 -1
- package/dist/durable.js +5 -4
- package/dist/durable.js.map +2 -2
- package/dist/entropy/index.js +9 -9
- package/dist/extension-bootstrap.d.ts.map +1 -1
- package/dist/extension-bootstrap.js +12 -12
- package/dist/extension.d.ts.map +1 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +410 -230
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.d.ts.map +1 -0
- package/dist/index.js +21 -21
- package/dist/jev/client.js +2 -2
- package/dist/jev/observation.js +5 -5
- package/dist/jev.js +10 -10
- package/dist/main-agent.d.ts +2 -1
- package/dist/main-agent.d.ts.map +1 -1
- package/dist/memory/discovery.js +6 -6
- package/dist/memory/file-worker.js +8 -8
- package/dist/memory/normalize.js +5 -5
- package/dist/memory/search.js +6 -6
- package/dist/memory/worker-provider.js +9 -9
- package/dist/memory.js +9 -9
- package/dist/providers/agents-actions.d.ts.map +1 -1
- package/dist/providers/agents-message-router.d.ts.map +1 -1
- package/dist/providers/agents-provider.d.ts +2 -0
- package/dist/providers/agents-provider.d.ts.map +1 -1
- package/dist/providers/jev-provider.js +10 -10
- package/dist/providers/memory-provider.js +8 -8
- package/dist/providers/tasks-provider.d.ts +3 -1
- package/dist/providers/tasks-provider.d.ts.map +1 -1
- package/dist/residency/host.js +9 -9
- package/dist/residency/pi-entry.js +9 -9
- package/dist/runtime/core-override-guest-types.js +2 -2
- package/dist/runtime/cpython-runtime.js +1 -1
- package/dist/runtime/guest-types.d.ts +1 -1
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/monty-runtime.js +2 -2
- package/dist/runtime/node-process-runtime.js +3 -3
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +2 -2
- package/dist/runtime/typescript-kernel.js +5 -5
- package/dist/runtime-state-builtins.d.ts +2 -0
- package/dist/runtime-state-builtins.d.ts.map +1 -1
- package/dist/topology/participant-directory.d.ts.map +1 -1
- package/dist/topology/peer-presence.d.ts.map +1 -1
- package/dist/topology/provider-participants.d.ts +1 -0
- package/dist/topology/provider-participants.d.ts.map +1 -1
- package/dist/type-error-guidance.js +1 -1
- package/dist/ui/code-preview-shell.d.ts +1 -0
- package/dist/ui/code-preview-shell.d.ts.map +1 -1
- package/dist/ui/dashboard-model.d.ts.map +1 -1
- package/dist/ui/dashboard.js +8 -5
- package/dist/ui/dashboard.js.map +2 -2
- package/dist/ui/fabric-render.d.ts +1 -0
- package/dist/ui/fabric-render.d.ts.map +1 -1
- package/dist/ui/settings-values.d.ts +1 -1
- package/dist/ui/settings-values.d.ts.map +1 -1
- package/dist/ui/settings.js +3 -3
- package/dist/ui/settings.js.map +2 -2
- package/dist/ui/shell-tasks.d.ts.map +1 -1
- package/dist/ui/shell-tasks.js +20 -4
- package/dist/ui/shell-tasks.js.map +2 -2
- package/dist/ui/widget.d.ts +8 -4
- package/dist/ui/widget.d.ts.map +1 -1
- package/dist/verified/generated/manifest.json +12 -3
- package/dist/verified/generated/prompt-guidance.d.ts +4 -0
- package/dist/verified/generated/prompt-guidance.js +17 -0
- package/docs/agents.md +26 -6
- package/docs/background-tasks.md +98 -14
- package/docs/configuration.md +2 -0
- package/docs/interface.md +3 -1
- package/docs/jev.md +1 -1
- package/docs/verified-kernels.md +23 -0
- package/package.json +9 -9
- package/proofs/index.ts +2 -0
- package/proofs/prompt-guidance.ts +38 -0
- package/scripts/verified-kernels.ts +1 -1
- package/skillsets/python/fabric-council/SKILL.md +25 -14
- package/skillsets/typescript/fabric-council/SKILL.md +24 -15
- package/skillsets/typescript/fabric-exec/references/agents.md +5 -5
- package/dist/chunks/chunk-3PKZSIRA.js.map +0 -7
- package/dist/chunks/chunk-3VK6UGAN.js.map +0 -7
- package/dist/chunks/chunk-4KX6BIPL.js.map +0 -7
- package/dist/chunks/chunk-5BOTHX47.js.map +0 -7
- package/dist/chunks/chunk-7CIES6X2.js.map +0 -7
- package/dist/chunks/chunk-LKYLD5SN.js.map +0 -7
- package/dist/chunks/chunk-VNWQIGQL.js.map +0 -7
- package/dist/chunks/chunk-WGMCNCP6.js.map +0 -7
- package/dist/chunks/chunk-WWTGWGH7.js.map +0 -7
- package/dist/chunks/chunk-YHFWMAQ5.js.map +0 -7
- package/dist/chunks/chunk-ZFWICFNJ.js.map +0 -7
- /package/dist/chunks/{chunk-HSEZPCL5.js.map → chunk-2OC4YJOL.js.map} +0 -0
- /package/dist/chunks/{chunk-TXCNZCZP.js.map → chunk-2QJ4MNS6.js.map} +0 -0
- /package/dist/chunks/{chunk-QOEOKW2X.js.map → chunk-3QH6JAE3.js.map} +0 -0
- /package/dist/chunks/{chunk-3XT5WHSG.js.map → chunk-4Y5KEJP4.js.map} +0 -0
- /package/dist/chunks/{chunk-RAA3FAYZ.js.map → chunk-5PSEJOJB.js.map} +0 -0
- /package/dist/chunks/{chunk-XFOSUGLU.js.map → chunk-66UTGL7T.js.map} +0 -0
- /package/dist/chunks/{chunk-PUBHBEYO.js.map → chunk-B2FIGOPI.js.map} +0 -0
- /package/dist/chunks/{chunk-X7QETPBC.js.map → chunk-F6GIK5GO.js.map} +0 -0
- /package/dist/chunks/{chunk-4PBW54I2.js.map → chunk-GGQ43B7T.js.map} +0 -0
- /package/dist/chunks/{chunk-MSDL7U6Q.js.map → chunk-JSHIS7GO.js.map} +0 -0
- /package/dist/chunks/{chunk-HRDMBGMY.js.map → chunk-K4VRQ7WZ.js.map} +0 -0
- /package/dist/chunks/{chunk-RWKQ5SRW.js.map → chunk-MTAFECXB.js.map} +0 -0
- /package/dist/chunks/{chunk-UFMYN5TA.js.map → chunk-MX53BRAC.js.map} +0 -0
- /package/dist/chunks/{chunk-4WKD3YM3.js.map → chunk-OILZ4PDY.js.map} +0 -0
- /package/dist/chunks/{chunk-H57KPL3V.js.map → chunk-S2JWFXW5.js.map} +0 -0
- /package/dist/chunks/{chunk-HFDJWLMS.js.map → chunk-SOEUGSY4.js.map} +0 -0
- /package/dist/chunks/{chunk-KIFOEBYJ.js.map → chunk-VEXCD3RA.js.map} +0 -0
- /package/dist/chunks/{chunk-GS67KDMV.js.map → chunk-VN7AE3EY.js.map} +0 -0
- /package/dist/chunks/{chunk-MPMEK3IQ.js.map → chunk-WYLBWFAO.js.map} +0 -0
- /package/dist/chunks/{chunk-6GWDGTHC.js.map → chunk-YLO62DWD.js.map} +0 -0
- /package/dist/chunks/{chunk-4BYS4ZLY.js.map → chunk-YN4K3FNB.js.map} +0 -0
- /package/dist/chunks/{chunk-OJ4HAALD.js.map → chunk-YO5UIWDY.js.map} +0 -0
- /package/dist/chunks/{chunk-7N7IC3Z2.js.map → chunk-ZCXW3GR7.js.map} +0 -0
- /package/dist/chunks/{chunk-36XQFTEN.js.map → chunk-ZY375C2U.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-tasks.d.ts","sourceRoot":"","sources":["../../src/ui/shell-tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAmE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClJ,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIrF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,0EAA0E;AAC1E,qBAAa,cAAe,YAAW,SAAS;;IAWlC,QAAQ,CAAC,OAAO,EAAE,iBAAiB;gBAA1B,OAAO,EAAE,iBAAiB;IA6C/C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"shell-tasks.d.ts","sourceRoot":"","sources":["../../src/ui/shell-tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAmE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClJ,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIrF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,0EAA0E;AAC1E,qBAAa,cAAe,YAAW,SAAS;;IAWlC,QAAQ,CAAC,OAAO,EAAE,iBAAiB;gBAA1B,OAAO,EAAE,iBAAiB;IA6C/C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA+E/B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA0B/B,UAAU,IAAI,IAAI;IAClB,OAAO,IAAI,IAAI;CAOhB"}
|
package/dist/ui/shell-tasks.js
CHANGED
|
@@ -106,7 +106,8 @@ var ShellTasksView = class {
|
|
|
106
106
|
const active = job.finishedAt === void 0;
|
|
107
107
|
const color = job.stopping ? "warning" : active ? "accent" : failed ? "error" : job.status === "exited" ? "success" : "dim";
|
|
108
108
|
const glyph = active ? spinnerFrame() : failed ? "\u2717" : job.status === "exited" ? "\u2713" : "\u25A0";
|
|
109
|
-
|
|
109
|
+
const status = job.observes ? job.stopping ? "stopping observation" : active ? "observing" : job.status === "timed_out" ? "observation expired" : job.status === "killed" ? "observation stopped" : "observation ended" : job.stopping ? "stopping" : job.status;
|
|
110
|
+
return this.options.theme.fg(color, `${glyph} ${status}`);
|
|
110
111
|
}
|
|
111
112
|
#section(label, width) {
|
|
112
113
|
const title = truncateToWidth(` ${label} `, width);
|
|
@@ -125,6 +126,20 @@ var ShellTasksView = class {
|
|
|
125
126
|
meta.push(theme.fg("muted", `Monitor: ${job.monitor.delivery === "wake" ? "wake owning agent" : "UI only"} \xB7 deadline ${formatDuration(job.monitor.timeoutMs)} \xB7 ${job.eventCount} events`));
|
|
126
127
|
if (job.lastEvent) meta.push(theme.fg("dim", `Latest event: ${safeText(job.lastEvent.lines.at(-1))}`));
|
|
127
128
|
}
|
|
129
|
+
if (job.observes) {
|
|
130
|
+
const target = job.observes.kind === "task" ? this.options.jobs.get(job.observes.id)?.info() : void 0;
|
|
131
|
+
meta.splice(
|
|
132
|
+
1,
|
|
133
|
+
0,
|
|
134
|
+
theme.fg("muted", `Target: ${job.observes.kind} ${safeText(target?.description ?? job.observes.id)}${target ? ` \xB7 ${target.status}` : ""}`),
|
|
135
|
+
theme.fg("dim", "Stopping observation leaves the target running.")
|
|
136
|
+
);
|
|
137
|
+
if (job.finishedAt === void 0 && job.monitor) meta.splice(
|
|
138
|
+
3,
|
|
139
|
+
0,
|
|
140
|
+
theme.fg("dim", `Observation expires in ${formatDuration(Math.max(0, job.startedAt + job.monitor.timeoutMs - Date.now())) || "0s"}`)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
128
143
|
const rows = meta.slice(0, Math.max(0, height - 6));
|
|
129
144
|
if (height >= 5) {
|
|
130
145
|
rows.push(this.#section("Command", width));
|
|
@@ -152,15 +167,16 @@ var ShellTasksView = class {
|
|
|
152
167
|
const job = this.options.jobs.get(this.options.id)?.info();
|
|
153
168
|
const active = job !== void 0 && job.finishedAt === void 0;
|
|
154
169
|
const armed = active && this.#stopArmed !== void 0 && Date.now() - this.#stopArmed < 3e3;
|
|
155
|
-
const
|
|
156
|
-
const
|
|
170
|
+
const stopLabel = job?.observes ? "stop watching" : "stop";
|
|
171
|
+
const hint = armed ? `${job?.observes ? "Press x again to stop watching; target continues" : "Press x again to stop this task"} \xB7 esc close` : width < 70 ? `\u2191\u2193 \xB7 G tail${active ? ` \xB7 x\xD72 ${stopLabel}` : ""} \xB7 esc` : `\u2191\u2193/pg scroll \xB7 G tail${active ? ` \xB7 x twice ${stopLabel}` : ""} \xB7 esc close`;
|
|
172
|
+
const title = `Fabric \xB7 ${job?.observes ? "observation" : "task"} ${this.options.id}`;
|
|
157
173
|
if (width < 8 || height < 7) return [title, hint].slice(0, height).map((row2) => truncateToWidth(row2, width));
|
|
158
174
|
const inner = width - 4;
|
|
159
175
|
const border = (text) => theme.fg("borderMuted", text);
|
|
160
176
|
const row = (text) => `${border("\u2502")} ${padToWidth(text, inner)} ${border("\u2502")}`;
|
|
161
177
|
const heading = truncateToWidth(title, width - 6);
|
|
162
178
|
const top = border("\u256D\u2500") + ` ${theme.fg("accent", heading)} ` + border("\u2500".repeat(Math.max(0, width - visibleWidth(heading) - 6)) + "\u2500\u256E");
|
|
163
|
-
const summary = job ? `${this.#status(job)} \xB7 Elapsed ${elapsed(job)}${job.exitCode !== void 0 ? ` \xB7 exit ${job.exitCode}` : ""}` : "Task no longer retained.";
|
|
179
|
+
const summary = job ? `${this.#status(job)} \xB7 Elapsed ${elapsed(job)}${!job.observes && job.exitCode !== void 0 ? ` \xB7 exit ${job.exitCode}` : ""}` : "Task no longer retained.";
|
|
164
180
|
const bodyHeight = height - 6;
|
|
165
181
|
const body = job ? this.#detail(job, inner, bodyHeight) : ["Task no longer retained."];
|
|
166
182
|
while (body.length < bodyHeight) body.push("");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ui/shell-tasks.ts"],
|
|
4
|
-
"sourcesContent": ["import { stripVTControlCharacters } from \"node:util\";\nimport type { Theme } from \"@earendil-works/pi-coding-agent\";\nimport { getKeybindings, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component, type KeybindingsManager } from \"@earendil-works/pi-tui\";\nimport type { FabricShellJobInfo, FabricShellJobStore } from \"../core/shell-jobs.js\";\nimport { formatDuration, padToWidth, safeText, wrapPlainText } from \"./format.js\";\nimport { spinnerFrame } from \"./spinner.js\";\n\nexport interface ShellTasksOptions {\n jobs: FabricShellJobStore;\n theme: Theme;\n done: () => void;\n requestRender: () => void;\n rows: () => number;\n keys?: KeybindingsManager;\n id: string;\n}\n\nconst elapsed = (job: FabricShellJobInfo): string => formatDuration((job.finishedAt ?? Date.now()) - job.startedAt) || \"0s\";\nconst outputLine = (line: string): string => stripVTControlCharacters(line)\n .replace(/\\t/g, \" \").replace(/[\\u0000-\\u0008\\u000b-\\u001f\\u007f-\\u009f]/g, \"\");\n\n/** Lazy single-task detail. Task selection belongs to the footer list. */\nexport class ShellTasksView implements Component {\n #pageSize = 1;\n #output = \"\";\n #scroll = 0;\n #stopArmed: number | undefined;\n #reading = false;\n #readAgain = false;\n #closed = false;\n #timer: ReturnType<typeof setInterval> | undefined;\n #unsubscribe: () => void;\n\n constructor(readonly options: ShellTasksOptions) {\n this.#refresh();\n this.#unsubscribe = options.jobs.subscribe(event => {\n if (event.job.id !== options.id) return;\n this.#refresh();\n void this.#read();\n });\n void this.#read();\n }\n\n #refresh(): void {\n if (this.#closed) return;\n const job = this.options.jobs.get(this.options.id)?.info();\n const active = job !== undefined && job.finishedAt === undefined;\n // Frames sample the selected task's live tail, never disk logs.\n if (active && !this.#timer) {\n this.#timer = setInterval(() => this.options.requestRender(), 250);\n this.#timer.unref?.();\n } else if (!active && this.#timer) {\n clearInterval(this.#timer);\n this.#timer = undefined;\n }\n this.options.requestRender();\n }\n\n async #read(): Promise<void> {\n if (this.#closed) return;\n if (this.#reading) { this.#readAgain = true; return; }\n const job = this.options.jobs.get(this.options.id);\n if (!job) { this.#output = \"Task no longer retained.\"; return; }\n this.#reading = true;\n try {\n const output = await job.outputText();\n if (!this.#closed) this.#output = output;\n } catch (error) {\n if (!this.#closed) this.#output = `Output unavailable: ${safeText(error instanceof Error ? error.message : error)}`;\n } finally {\n this.#reading = false;\n if (!this.#closed) {\n this.options.requestRender();\n if (this.#readAgain) { this.#readAgain = false; void this.#read(); }\n }\n }\n }\n\n handleInput(data: string): void {\n if (this.#closed) return;\n const keys = this.options.keys ?? getKeybindings();\n if (keys.matches(data, \"tui.select.cancel\")) { this.dispose(); this.options.done(); return; }\n if (data === \"x\") {\n const now = Date.now();\n const job = this.options.jobs.get(this.options.id);\n if (job && !job.finished) {\n if (this.#stopArmed !== undefined && now - this.#stopArmed < 3000) { job.stop(); this.#stopArmed = undefined; }\n else this.#stopArmed = now;\n }\n } else {\n this.#stopArmed = undefined;\n if (keys.matches(data, \"tui.select.up\")) this.#scroll++;\n if (keys.matches(data, \"tui.select.down\")) this.#scroll = Math.max(0, this.#scroll - 1);\n if (keys.matches(data, \"tui.select.pageUp\")) this.#scroll += this.#pageSize;\n if (keys.matches(data, \"tui.select.pageDown\")) this.#scroll = Math.max(0, this.#scroll - this.#pageSize);\n if (data === \"G\") this.#scroll = 0;\n }\n this.options.requestRender();\n }\n\n #status(job: FabricShellJobInfo): string {\n const failed = job.status === \"failed\" || job.status === \"timed_out\";\n const active = job.finishedAt === undefined;\n const color = job.stopping ? \"warning\" : active ? \"accent\" : failed ? \"error\" : job.status === \"exited\" ? \"success\" : \"dim\";\n const glyph = active ? spinnerFrame() : failed ? \"\u2717\" : job.status === \"exited\" ? \"\u2713\" : \"\u25A0\";\n return this.options.theme.fg(color, `${glyph} ${job.stopping ? \"stopping\" : job.status}`);\n }\n\n #section(label: string, width: number): string {\n const title = truncateToWidth(` ${label} `, width);\n return this.options.theme.fg(\"borderMuted\", title + \"\u2500\".repeat(Math.max(0, width - visibleWidth(title))));\n }\n\n #detail(job: FabricShellJobInfo, width: number, height: number): string[] {\n const { theme } = this.options;\n const meta = [\n theme.fg(\"accent\", safeText(job.description || job.command)),\n theme.fg(\"dim\", `${job.lastOutputAt !== undefined ? `last output ${formatDuration(Date.now() - job.lastOutputAt) || \"0s\"} ago` : \"no output yet\"}${job.pid ? ` \u00B7 pid ${job.pid}` : \"\"}`),\n theme.fg(\"muted\", `cwd: ${safeText(job.cwd ?? \"unknown\")}`),\n theme.fg(\"dim\", `Log: ${safeText(job.logPath ?? \"available after backgrounding\")}`),\n ];\n if (job.durable) meta.push(theme.fg(\"muted\", `Durable: jev-fabric ${job.durable.jobId ? `job ${safeText(job.durable.jobId)}` : \"job starting\"}${job.durable.adopted ? \" \u00B7 reattached\" : \"\"} \u00B7 survives Pi exit`));\n if (job.monitor) {\n meta.push(theme.fg(\"muted\", `Monitor: ${job.monitor.delivery === \"wake\" ? \"wake owning agent\" : \"UI only\"} \u00B7 deadline ${formatDuration(job.monitor.timeoutMs)} \u00B7 ${job.eventCount} events`));\n if (job.lastEvent) meta.push(theme.fg(\"dim\", `Latest event: ${safeText(job.lastEvent.lines.at(-1))}`));\n }\n const rows = meta.slice(0, Math.max(0, height - 6));\n if (height >= 5) {\n rows.push(this.#section(\"Command\", width));\n const commandSpace = Math.max(1, Math.min(3, height - rows.length - 4));\n const command = wrapPlainText(job.command.slice(0, 12000), width, commandSpace + 1);\n const clipped = command.length > commandSpace || job.command.length > 12000;\n rows.push(...command.slice(0, commandSpace).map(line => theme.fg(\"muted\", line)));\n if (clipped) rows[rows.length - 1] = theme.fg(\"dim\", truncateToWidth(\"\u2026 command clipped \u00B7 tasks.get for full text\", width));\n }\n const available = Math.max(1, height - rows.length - 1);\n // append() intentionally emits no store event for every output chunk.\n const text = job.finishedAt === undefined ? this.options.jobs.get(job.id)?.snapshotText(8000) ?? \"\" : this.#output;\n const output = text ? text.split(\"\\n\").flatMap(line => wrapTextWithAnsi(outputLine(line), width)) : [job.finishedAt === undefined ? \"Waiting for output\u2026\" : \"No output captured.\"];\n this.#scroll = Math.min(this.#scroll, Math.max(0, output.length - available));\n const end = output.length - this.#scroll;\n const start = Math.max(0, end - available);\n this.#pageSize = available;\n rows.push(this.#section(`Output \u00B7 ${this.#scroll ? `${start + 1}\u2013${end}/${output.length}` : \"tail\"} \u00B7 bounded`, width));\n rows.push(...output.slice(start, end).map(line => theme.fg(\"toolOutput\", line)));\n return rows.slice(0, height);\n }\n\n render(width: number): string[] {\n if (width <= 0) return [];\n const { theme } = this.options;\n const height = Math.max(1, Math.floor(this.options.rows() * 0.8));\n const job = this.options.jobs.get(this.options.id)?.info();\n const active = job !== undefined && job.finishedAt === undefined;\n const armed = active && this.#stopArmed !== undefined && Date.now() - this.#stopArmed < 3000;\n const hint = armed ? \"Press x again to stop this task \u00B7 esc close\"\n : width < 70 ? `\u2191\u2193 \u00B7 G tail${active ? \" \u00B7 x\u00D72 stop\" : \"\"} \u00B7 esc`\n : `\u2191\u2193/pg scroll \u00B7 G tail${active ? \" \u00B7 x twice stop\" : \"\"} \u00B7 esc close`;\n const title = `Fabric \u00B7 task ${this.options.id}`;\n if (width < 8 || height < 7) return [title, hint].slice(0, height).map(row => truncateToWidth(row, width));\n const inner = width - 4;\n const border = (text: string) => theme.fg(\"borderMuted\", text);\n const row = (text: string) => `${border(\"\u2502\")} ${padToWidth(text, inner)} ${border(\"\u2502\")}`;\n const heading = truncateToWidth(title, width - 6);\n const top = border(\"\u256D\u2500\") + ` ${theme.fg(\"accent\", heading)} ` + border(\"\u2500\".repeat(Math.max(0, width - visibleWidth(heading) - 6)) + \"\u2500\u256E\");\n const summary = job ? `${this.#status(job)} \u00B7 Elapsed ${elapsed(job)}${job.exitCode !== undefined ? ` \u00B7 exit ${job.exitCode}` : \"\"}` : \"Task no longer retained.\";\n const bodyHeight = height - 6;\n const body = job ? this.#detail(job, inner, bodyHeight) : [\"Task no longer retained.\"];\n while (body.length < bodyHeight) body.push(\"\");\n const separator = border(`\u251C${\"\u2500\".repeat(width - 2)}\u2524`);\n return [top, row(summary), separator, ...body.map(row), separator, row(theme.fg(armed ? \"warning\" : \"dim\", hint)), border(`\u2570${\"\u2500\".repeat(width - 2)}\u256F`)];\n }\n\n invalidate(): void { /* Theme and width are evaluated on every render. */ }\n dispose(): void {\n if (this.#closed) return;\n this.#closed = true;\n if (this.#timer) clearInterval(this.#timer);\n this.#timer = undefined;\n this.#unsubscribe();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAAA,SAAS,gCAAgC;AAEzC,SAAS,gBAAgB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AAqB,EAAG,MAAK,UAAU,KAAK,IAAI,GAAG,KAAK,UAAU,KAAK,SAAS;AACvG,UAAI,SAAS,IAAK,MAAK,UAAU;AAAA,IACnC;AACA,SAAK,QAAQ,cAAc;AAAA,EAC7B;AAAA,EAEA,QAAQ,KAAiC;AACvC,UAAM,SAAS,IAAI,WAAW,YAAY,IAAI,WAAW;AACzD,UAAM,SAAS,IAAI,eAAe;AAClC,UAAM,QAAQ,IAAI,WAAW,YAAY,SAAS,WAAW,SAAS,UAAU,IAAI,WAAW,WAAW,YAAY;AACtH,UAAM,QAAQ,SAAS,aAAa,IAAI,SAAS,WAAM,IAAI,WAAW,WAAW,WAAM;AACvF,
|
|
4
|
+
"sourcesContent": ["import { stripVTControlCharacters } from \"node:util\";\nimport type { Theme } from \"@earendil-works/pi-coding-agent\";\nimport { getKeybindings, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component, type KeybindingsManager } from \"@earendil-works/pi-tui\";\nimport type { FabricShellJobInfo, FabricShellJobStore } from \"../core/shell-jobs.js\";\nimport { formatDuration, padToWidth, safeText, wrapPlainText } from \"./format.js\";\nimport { spinnerFrame } from \"./spinner.js\";\n\nexport interface ShellTasksOptions {\n jobs: FabricShellJobStore;\n theme: Theme;\n done: () => void;\n requestRender: () => void;\n rows: () => number;\n keys?: KeybindingsManager;\n id: string;\n}\n\nconst elapsed = (job: FabricShellJobInfo): string => formatDuration((job.finishedAt ?? Date.now()) - job.startedAt) || \"0s\";\nconst outputLine = (line: string): string => stripVTControlCharacters(line)\n .replace(/\\t/g, \" \").replace(/[\\u0000-\\u0008\\u000b-\\u001f\\u007f-\\u009f]/g, \"\");\n\n/** Lazy single-task detail. Task selection belongs to the footer list. */\nexport class ShellTasksView implements Component {\n #pageSize = 1;\n #output = \"\";\n #scroll = 0;\n #stopArmed: number | undefined;\n #reading = false;\n #readAgain = false;\n #closed = false;\n #timer: ReturnType<typeof setInterval> | undefined;\n #unsubscribe: () => void;\n\n constructor(readonly options: ShellTasksOptions) {\n this.#refresh();\n this.#unsubscribe = options.jobs.subscribe(event => {\n if (event.job.id !== options.id) return;\n this.#refresh();\n void this.#read();\n });\n void this.#read();\n }\n\n #refresh(): void {\n if (this.#closed) return;\n const job = this.options.jobs.get(this.options.id)?.info();\n const active = job !== undefined && job.finishedAt === undefined;\n // Frames sample the selected task's live tail, never disk logs.\n if (active && !this.#timer) {\n this.#timer = setInterval(() => this.options.requestRender(), 250);\n this.#timer.unref?.();\n } else if (!active && this.#timer) {\n clearInterval(this.#timer);\n this.#timer = undefined;\n }\n this.options.requestRender();\n }\n\n async #read(): Promise<void> {\n if (this.#closed) return;\n if (this.#reading) { this.#readAgain = true; return; }\n const job = this.options.jobs.get(this.options.id);\n if (!job) { this.#output = \"Task no longer retained.\"; return; }\n this.#reading = true;\n try {\n const output = await job.outputText();\n if (!this.#closed) this.#output = output;\n } catch (error) {\n if (!this.#closed) this.#output = `Output unavailable: ${safeText(error instanceof Error ? error.message : error)}`;\n } finally {\n this.#reading = false;\n if (!this.#closed) {\n this.options.requestRender();\n if (this.#readAgain) { this.#readAgain = false; void this.#read(); }\n }\n }\n }\n\n handleInput(data: string): void {\n if (this.#closed) return;\n const keys = this.options.keys ?? getKeybindings();\n if (keys.matches(data, \"tui.select.cancel\")) { this.dispose(); this.options.done(); return; }\n if (data === \"x\") {\n const now = Date.now();\n const job = this.options.jobs.get(this.options.id);\n if (job && !job.finished) {\n if (this.#stopArmed !== undefined && now - this.#stopArmed < 3000) { job.stop(); this.#stopArmed = undefined; }\n else this.#stopArmed = now;\n }\n } else {\n this.#stopArmed = undefined;\n if (keys.matches(data, \"tui.select.up\")) this.#scroll++;\n if (keys.matches(data, \"tui.select.down\")) this.#scroll = Math.max(0, this.#scroll - 1);\n if (keys.matches(data, \"tui.select.pageUp\")) this.#scroll += this.#pageSize;\n if (keys.matches(data, \"tui.select.pageDown\")) this.#scroll = Math.max(0, this.#scroll - this.#pageSize);\n if (data === \"G\") this.#scroll = 0;\n }\n this.options.requestRender();\n }\n\n #status(job: FabricShellJobInfo): string {\n const failed = job.status === \"failed\" || job.status === \"timed_out\";\n const active = job.finishedAt === undefined;\n const color = job.stopping ? \"warning\" : active ? \"accent\" : failed ? \"error\" : job.status === \"exited\" ? \"success\" : \"dim\";\n const glyph = active ? spinnerFrame() : failed ? \"\u2717\" : job.status === \"exited\" ? \"\u2713\" : \"\u25A0\";\n const status = job.observes ? (job.stopping ? \"stopping observation\" : active ? \"observing\" : job.status === \"timed_out\" ? \"observation expired\" : job.status === \"killed\" ? \"observation stopped\" : \"observation ended\") : job.stopping ? \"stopping\" : job.status;\n return this.options.theme.fg(color, `${glyph} ${status}`);\n }\n\n #section(label: string, width: number): string {\n const title = truncateToWidth(` ${label} `, width);\n return this.options.theme.fg(\"borderMuted\", title + \"\u2500\".repeat(Math.max(0, width - visibleWidth(title))));\n }\n\n #detail(job: FabricShellJobInfo, width: number, height: number): string[] {\n const { theme } = this.options;\n const meta = [\n theme.fg(\"accent\", safeText(job.description || job.command)),\n theme.fg(\"dim\", `${job.lastOutputAt !== undefined ? `last output ${formatDuration(Date.now() - job.lastOutputAt) || \"0s\"} ago` : \"no output yet\"}${job.pid ? ` \u00B7 pid ${job.pid}` : \"\"}`),\n theme.fg(\"muted\", `cwd: ${safeText(job.cwd ?? \"unknown\")}`),\n theme.fg(\"dim\", `Log: ${safeText(job.logPath ?? \"available after backgrounding\")}`),\n ];\n if (job.durable) meta.push(theme.fg(\"muted\", `Durable: jev-fabric ${job.durable.jobId ? `job ${safeText(job.durable.jobId)}` : \"job starting\"}${job.durable.adopted ? \" \u00B7 reattached\" : \"\"} \u00B7 survives Pi exit`));\n if (job.monitor) {\n meta.push(theme.fg(\"muted\", `Monitor: ${job.monitor.delivery === \"wake\" ? \"wake owning agent\" : \"UI only\"} \u00B7 deadline ${formatDuration(job.monitor.timeoutMs)} \u00B7 ${job.eventCount} events`));\n if (job.lastEvent) meta.push(theme.fg(\"dim\", `Latest event: ${safeText(job.lastEvent.lines.at(-1))}`));\n }\n if (job.observes) {\n const target = job.observes.kind === \"task\" ? this.options.jobs.get(job.observes.id)?.info() : undefined;\n meta.splice(1, 0,\n theme.fg(\"muted\", `Target: ${job.observes.kind} ${safeText(target?.description ?? job.observes.id)}${target ? ` \u00B7 ${target.status}` : \"\"}`),\n theme.fg(\"dim\", \"Stopping observation leaves the target running.\"));\n if (job.finishedAt === undefined && job.monitor) meta.splice(3, 0,\n theme.fg(\"dim\", `Observation expires in ${formatDuration(Math.max(0, job.startedAt + job.monitor.timeoutMs - Date.now())) || \"0s\"}`));\n }\n const rows = meta.slice(0, Math.max(0, height - 6));\n if (height >= 5) {\n rows.push(this.#section(\"Command\", width));\n const commandSpace = Math.max(1, Math.min(3, height - rows.length - 4));\n const command = wrapPlainText(job.command.slice(0, 12000), width, commandSpace + 1);\n const clipped = command.length > commandSpace || job.command.length > 12000;\n rows.push(...command.slice(0, commandSpace).map(line => theme.fg(\"muted\", line)));\n if (clipped) rows[rows.length - 1] = theme.fg(\"dim\", truncateToWidth(\"\u2026 command clipped \u00B7 tasks.get for full text\", width));\n }\n const available = Math.max(1, height - rows.length - 1);\n // append() intentionally emits no store event for every output chunk.\n const text = job.finishedAt === undefined ? this.options.jobs.get(job.id)?.snapshotText(8000) ?? \"\" : this.#output;\n const output = text ? text.split(\"\\n\").flatMap(line => wrapTextWithAnsi(outputLine(line), width)) : [job.finishedAt === undefined ? \"Waiting for output\u2026\" : \"No output captured.\"];\n this.#scroll = Math.min(this.#scroll, Math.max(0, output.length - available));\n const end = output.length - this.#scroll;\n const start = Math.max(0, end - available);\n this.#pageSize = available;\n rows.push(this.#section(`Output \u00B7 ${this.#scroll ? `${start + 1}\u2013${end}/${output.length}` : \"tail\"} \u00B7 bounded`, width));\n rows.push(...output.slice(start, end).map(line => theme.fg(\"toolOutput\", line)));\n return rows.slice(0, height);\n }\n\n render(width: number): string[] {\n if (width <= 0) return [];\n const { theme } = this.options;\n const height = Math.max(1, Math.floor(this.options.rows() * 0.8));\n const job = this.options.jobs.get(this.options.id)?.info();\n const active = job !== undefined && job.finishedAt === undefined;\n const armed = active && this.#stopArmed !== undefined && Date.now() - this.#stopArmed < 3000;\n const stopLabel = job?.observes ? \"stop watching\" : \"stop\";\n const hint = armed ? `${job?.observes ? \"Press x again to stop watching; target continues\" : \"Press x again to stop this task\"} \u00B7 esc close`\n : width < 70 ? `\u2191\u2193 \u00B7 G tail${active ? ` \u00B7 x\u00D72 ${stopLabel}` : \"\"} \u00B7 esc`\n : `\u2191\u2193/pg scroll \u00B7 G tail${active ? ` \u00B7 x twice ${stopLabel}` : \"\"} \u00B7 esc close`;\n const title = `Fabric \u00B7 ${job?.observes ? \"observation\" : \"task\"} ${this.options.id}`;\n if (width < 8 || height < 7) return [title, hint].slice(0, height).map(row => truncateToWidth(row, width));\n const inner = width - 4;\n const border = (text: string) => theme.fg(\"borderMuted\", text);\n const row = (text: string) => `${border(\"\u2502\")} ${padToWidth(text, inner)} ${border(\"\u2502\")}`;\n const heading = truncateToWidth(title, width - 6);\n const top = border(\"\u256D\u2500\") + ` ${theme.fg(\"accent\", heading)} ` + border(\"\u2500\".repeat(Math.max(0, width - visibleWidth(heading) - 6)) + \"\u2500\u256E\");\n const summary = job ? `${this.#status(job)} \u00B7 Elapsed ${elapsed(job)}${!job.observes && job.exitCode !== undefined ? ` \u00B7 exit ${job.exitCode}` : \"\"}` : \"Task no longer retained.\";\n const bodyHeight = height - 6;\n const body = job ? this.#detail(job, inner, bodyHeight) : [\"Task no longer retained.\"];\n while (body.length < bodyHeight) body.push(\"\");\n const separator = border(`\u251C${\"\u2500\".repeat(width - 2)}\u2524`);\n return [top, row(summary), separator, ...body.map(row), separator, row(theme.fg(armed ? \"warning\" : \"dim\", hint)), border(`\u2570${\"\u2500\".repeat(width - 2)}\u256F`)];\n }\n\n invalidate(): void { /* Theme and width are evaluated on every render. */ }\n dispose(): void {\n if (this.#closed) return;\n this.#closed = true;\n if (this.#timer) clearInterval(this.#timer);\n this.#timer = undefined;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,UAAU,gBAAgB,OAAO,QAAQ,CAAC;AAChD,UAAM,MAAM,OAAO,cAAI,IAAI,IAAI,MAAM,GAAG,UAAU,OAAO,CAAC,MAAM,OAAO,SAAI,OAAO,KAAK,IAAI,GAAG,QAAQ,aAAa,OAAO,IAAI,CAAC,CAAC,IAAI,cAAI;AACxI,UAAM,UAAU,MAAM,GAAG,KAAK,QAAQ,GAAG,CAAC,iBAAc,QAAQ,GAAG,CAAC,GAAG,CAAC,IAAI,YAAY,IAAI,aAAa,SAAY,cAAW,IAAI,QAAQ,KAAK,EAAE,KAAK;AACxJ,UAAM,aAAa,SAAS;AAC5B,UAAM,OAAO,MAAM,KAAK,QAAQ,KAAK,OAAO,UAAU,IAAI,CAAC,0BAA0B;AACrF,WAAO,KAAK,SAAS,WAAY,MAAK,KAAK,EAAE;AAC7C,UAAM,YAAY,OAAO,SAAI,SAAI,OAAO,QAAQ,CAAC,CAAC,QAAG;AACrD,WAAO,CAAC,KAAK,IAAI,OAAO,GAAG,WAAW,GAAG,KAAK,IAAI,GAAG,GAAG,WAAW,IAAI,MAAM,GAAG,QAAQ,YAAY,OAAO,IAAI,CAAC,GAAG,OAAO,SAAI,SAAI,OAAO,QAAQ,CAAC,CAAC,QAAG,CAAC;AAAA,EACzJ;AAAA,EAEA,aAAmB;AAAA,EAAuD;AAAA,EAC1E,UAAgB;AACd,QAAI,KAAK,QAAS;AAClB,SAAK,UAAU;AACf,QAAI,KAAK,OAAQ,eAAc,KAAK,MAAM;AAC1C,SAAK,SAAS;AACd,SAAK,aAAa;AAAA,EACpB;AACF;",
|
|
6
6
|
"names": ["row"]
|
|
7
7
|
}
|
package/dist/ui/widget.d.ts
CHANGED
|
@@ -53,11 +53,15 @@ export declare const shouldShowFabricWidget: (snapshot: FabricDashboardSnapshot,
|
|
|
53
53
|
export declare const WIDGET_TERMINAL_ROW_SHARE = 0.5;
|
|
54
54
|
/** Effective row budget: the configured maximum, bounded by the live pane. */
|
|
55
55
|
export declare const widgetRowLimit: (maxRows: number, terminalRows?: number) => number;
|
|
56
|
-
/**
|
|
57
|
-
* Row budget while the widget has focus. Focus is a request to see the list,
|
|
58
|
-
* so it may use its whole terminal share instead of `maxRows`, but never more.
|
|
59
|
-
*/
|
|
56
|
+
/** Keyboard focus must not resize the footer or move the transcript. */
|
|
60
57
|
export declare const widgetFocusedRowLimit: (maxRows: number, terminalRows?: number) => number;
|
|
58
|
+
/** Keep the viewport height fixed, replacing the overflow cue with content at the bottom. */
|
|
59
|
+
export declare const widgetViewport: (contentRows: number, budget: number, offset: number) => {
|
|
60
|
+
windowRows: number;
|
|
61
|
+
hasCue: boolean;
|
|
62
|
+
maxOffset: number;
|
|
63
|
+
offset: number;
|
|
64
|
+
};
|
|
61
65
|
export declare class FabricWidget implements Component, Focusable {
|
|
62
66
|
#private;
|
|
63
67
|
readonly theme: Theme;
|
package/dist/ui/widget.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/ui/widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/ui/widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAA4B,MAAM,gBAAgB,CAAC;AAQjF,OAAO,EA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|
"proofs/kernel.ts": "0edaa003d2ca5f33c4e30e65a427efb6d0b2135e097875f62732907f5a4b411b",
|
|
7
7
|
"proofs/policy.ts": "525f2306ee56395ce5424495ea0cd7031c6b64238b1673c05be09d4292ede621",
|
|
8
8
|
"proofs/compaction.ts": "b559117f9f2224ba7bace8a94fc06af0ff60dd7cd997af5d177990202b4ca9b2",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"proofs/speculation.ts": "dc1f1b59f2e5414a439e7e62c897bd238b3470c7e608a9228fcf9e3b18dc9477",
|
|
16
16
|
"proofs/budget.ts": "a6aa3ce2aaffe80d411f8addb6953cbee82c522743a7934dca12e823cf8e3f13",
|
|
17
17
|
"proofs/actor-name.ts": "777738fad15d31e9367d4290f6f4f8f3178a41adbedc4c889222ba317552d358",
|
|
18
|
-
"
|
|
18
|
+
"proofs/prompt-guidance.ts": "dba83fcc37ae159fbd82187524142d87dc8bc99ad32505d7a5c1bc8fa0bb583c",
|
|
19
|
+
"scripts/verified-kernels.ts": "f16617c4442d7c3c8102a346abd02f7675340750b3f37324c163637ad1af8bfa",
|
|
19
20
|
"scripts/verified-kernel-pool.ts": "7869f607e4ff87ac219fe2b14df06887fbc56a43c783118e64387f477e5ead42",
|
|
20
21
|
"scripts/verified-kernel-worker.ts": "d9a9a4a6e80d92f515ee4f8018193418d6937255688cf2f7e52953813bc65a4f"
|
|
21
22
|
},
|
|
@@ -41,7 +42,9 @@
|
|
|
41
42
|
"src/verified/generated/budget.js": "d9361fc2ad9be99aa67004540ed1506742afb5220528c0f8d43ff19c845e06e1",
|
|
42
43
|
"src/verified/generated/budget.d.ts": "9e5156ed081c60fb9af6a015e51356b8a473e6c3d60276817792d0eabb8116b4",
|
|
43
44
|
"src/verified/generated/actor-name.js": "8eee0026642a99f7130f9ba28a7882911e2e6957cae0de4248c4176fde9065e7",
|
|
44
|
-
"src/verified/generated/actor-name.d.ts": "7b694c53e405e0b283ebec2c38d4d1bcd93693add9e0078fb57472098582f7f0"
|
|
45
|
+
"src/verified/generated/actor-name.d.ts": "7b694c53e405e0b283ebec2c38d4d1bcd93693add9e0078fb57472098582f7f0",
|
|
46
|
+
"src/verified/generated/prompt-guidance.js": "9297b840b08e4ed615c14cabc8ec07d6f01f71d8a219b84f4253b9a4e829e558",
|
|
47
|
+
"src/verified/generated/prompt-guidance.d.ts": "e5df630be45b7f9963433ea5e78d32f6a07fd9269925da5bdd8ef647d273d8d1"
|
|
45
48
|
},
|
|
46
49
|
"claims": {
|
|
47
50
|
"policy": [
|
|
@@ -138,6 +141,12 @@
|
|
|
138
141
|
"budgetAdmission: budget_complete: valid observations below the threshold are admitted",
|
|
139
142
|
"budgetAdmission: budget_exhausted: equality and larger observations are refused",
|
|
140
143
|
"budgetAdmission: budget_invalid: invalid observations are never admitted"
|
|
144
|
+
],
|
|
145
|
+
"prompt-guidance": [
|
|
146
|
+
"promptGuidance: active guidance has exactly one portable destination and no duplicate native rules",
|
|
147
|
+
"promptGuidance: inactive guidance keeps native ownership and injects nothing",
|
|
148
|
+
"promptGuidance: an unforced structured prompt carries guidance in its section",
|
|
149
|
+
"promptGuidance: a forced or legacy prompt carries guidance in its append"
|
|
141
150
|
]
|
|
142
151
|
}
|
|
143
152
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/verified-kernels.ts from proofs/prompt-guidance.ts with gdp-wired@0.31.1. Do not edit.
|
|
2
|
+
export interface MachineState { scalars: Record<string, number>; maps: Record<string, Map<number, number>>; defaults?: Record<string, number> }
|
|
3
|
+
export interface Machine { init(params: object): MachineState; step(params: object, state: MachineState, input: object): MachineState }
|
|
4
|
+
export declare const promptGuidance: Machine;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Generated by scripts/verified-kernels.ts from proofs/prompt-guidance.ts with gdp-wired@0.31.1. Do not edit.
|
|
2
|
+
function $n(v, what) { if (typeof v !== 'number' || !Number.isSafeInteger(v) || v < 0) throw new RangeError(what + ' must be a natural below 2^53, not ' + v); return v; }
|
|
3
|
+
|
|
4
|
+
export const promptGuidance = /* @__PURE__ */ (() => {
|
|
5
|
+
// Generated from the machine portable prompt guidance. step consumes its state: keep the one it returns (fork to branch).
|
|
6
|
+
function init(params) {
|
|
7
|
+
const env = {}, s = {};
|
|
8
|
+
return {scalars: {"out.section": 0, "out.append": 0, "out.native": 0}, maps: {}};
|
|
9
|
+
}
|
|
10
|
+
function step(params, state, input) {
|
|
11
|
+
const env = {"active": $n(input["active"], "input active"), "sections": $n(input["sections"], "input sections"), "forced": $n(input["forced"], "input forced")}, s = state.scalars, dft = {...state.defaults}, maps = state.maps;
|
|
12
|
+
if (!((env["active"] <= 1) && (env["sections"] <= 1) && (env["forced"] <= 1))) throw new RangeError("portable prompt guidance: the request fails the rule's assumption, so no proof covers the step it would take");
|
|
13
|
+
const scalars = {...s, "out.section": (((env["active"] === 1) && (env["sections"] === 1) && (!(env["forced"] === 1))) ? 1 : 0), "out.append": (((env["active"] === 1) && ((!(env["sections"] === 1)) || (env["forced"] === 1))) ? 1 : 0), "out.native": ((!(env["active"] === 1)) ? 1 : 0)};
|
|
14
|
+
return Object.keys(dft).length ? {scalars, maps: state.maps, defaults: dft} : {scalars, maps: state.maps};
|
|
15
|
+
}
|
|
16
|
+
return { init, step };
|
|
17
|
+
})();
|
package/docs/agents.md
CHANGED
|
@@ -32,6 +32,20 @@ You can give `fabric_exec` optional `agentBudget` and `tokenBudget` limits. Conf
|
|
|
32
32
|
|
|
33
33
|
`agents.wait`/`join`, terminal `agents.status`, and cleanup acknowledge the result and retract any pending notification, including completion that arrived before the wait. Running status and UI/list polling do not acknowledge results. Acknowledgment means the Fabric program received the result: return the relevant outcome to Main when it needs to reason about it. Prefer `wait` over a polling loop.
|
|
34
34
|
|
|
35
|
+
### Observe an existing run
|
|
36
|
+
|
|
37
|
+
`agents.observe({id, delivery: "ui" | "wake", ...})` attaches bounded operational
|
|
38
|
+
observation to an existing local run or `provider:` participant. It returns an
|
|
39
|
+
observation task handle; use `tasks.get/watch/stop` with that handle's id. Events
|
|
40
|
+
default to progress, blocked and terminal; quiet detection is opt-in and never
|
|
41
|
+
proves failure. No agent is launched, and stopping or expiring the observation
|
|
42
|
+
never stops the observed run. Transcript/thinking output is not exposed.
|
|
43
|
+
|
|
44
|
+
`tasks.observe` provides the same contract for an existing shell or background
|
|
45
|
+
program's output. There is no separate `monitors` provider. Ordinary completion
|
|
46
|
+
notifications and `agents.subscribe` lifecycle routing are unchanged. See
|
|
47
|
+
[attached observation](background-tasks.md#attached-task-and-participant-monitors).
|
|
48
|
+
|
|
35
49
|
### Queued spawns
|
|
36
50
|
|
|
37
51
|
By default `agents.spawn` waits inside the call for a free `agents.maxConcurrent` slot. A program that spawns more children than the limit blocks there, and if its deadline passes first, the waiting spawns never launch and the program cannot return the ids of the runs that did.
|
|
@@ -549,7 +563,10 @@ This is the host-level equivalent of the `pi-model-switch` extension's `switch_m
|
|
|
549
563
|
| `screen` | Creates one detached GNU Screen session for each child | `screen -r …` |
|
|
550
564
|
| `localterm` | Creates one pinned LocalTerm PTY for each child | `localterm session attach …` |
|
|
551
565
|
| `herdr` | Creates one background Herdr tab for each child | `herdr terminal attach …` |
|
|
552
|
-
| `
|
|
566
|
+
| `herdr-core` | Creates one background Herdr Core terminal per child | `hc attach tN` |
|
|
567
|
+
| `auto` | Tries Herdr Core, Herdr, LocalTerm, tmux, screen, and then process | Depends on the transport |
|
|
568
|
+
|
|
569
|
+
Herdr Core (`herdr-core`) is a separate terminal service, not the Herdr workspace/tab API. Both explicit selection (`transport: "herdr-core"`) and auto-selection require the parent’s injected `HC_TERMINAL_ID` and `HC_TERMINAL_SOCKET`, and a reachable generation-1 service advertising terminal run/get/kill. Fabric uses only that socket (including native Windows pipe names); it does not search other sessions, start/restart the service, or require a CLI on PATH. Auto falls through safely when this context is missing, unreachable or incompatible; explicit selection reports unavailable. Each child receives direct argv and cwd, a unique sanitized name, and Core’s own child identity, not a copy of the parent’s environment. Launches disable typed parent notifications, waiting, keep/recovery, and outliving the parent. Handles report Core terminal addresses and `hc attach tN`; use `herdr-core attach tN` if the `hc` alias is absent, in the same Core session. Finished or removed terminals are not alive. Stop kills only that child; it does not remove retained output or mutate the service lifecycle. RPC failures other than a missing child remain visible. Existing Herdr status and session-label UI features still apply only to legacy Herdr.
|
|
553
570
|
|
|
554
571
|
Herdr uses its local socket API to create an argv-backed background tab as one atomic operation. It does not change focus or require shell quoting. Automatic selection works only when the parent Pi process already runs in Herdr. This requires `HERDR_ENV=1` with an injected workspace and socket. Select `transport: "herdr"` under the same conditions. Use the attach command in the handle to open a child directly.
|
|
555
572
|
|
|
@@ -635,6 +652,8 @@ Fabric uses one participant directory for each project. Every live entity has a
|
|
|
635
652
|
|
|
636
653
|
`agents.self()` returns the participant record for the caller. `agents.sessions()` lists every live root Pi session, including the caller's root and peers, as symmetric participant records for session-to-session coordination. Call `agents.members({ scope?, kinds?, includeStale? })` to list all kinds. `agents.list({ scope? })` lists agents and uses `scope: "local"` by default. Set the scope to `"lineage"` for descendants of the same root across recursive runtimes. Use `"project"` for all live project agents. `agents.main()` and `agents.peers()` remain convenient compatibility projections. Standard discovery hides participants with expired execution-host leases. Shared summaries include operational metadata. They exclude agent prompts, results, and errors.
|
|
637
654
|
|
|
655
|
+
A child's Main is its owning lineage root, not the Main of whichever peer is viewing it. Launch instructions name that root explicitly. In a Fabric-enabled child, use `agents.self()` for the child identity, `agents.main()` for its root, and `agents.steer({ id: "main", message })` to report back. `rootId` identifies the lineage; `ownerHostId` identifies the process that controls a participant and is not a substitute for its participant ID. Cross-peer messages to one-shot agents route through that execution owner just like messages to roots and actors. Children without Fabric tools report through their ordinary response, which the host delivers.
|
|
656
|
+
|
|
638
657
|
Live discovery never returns a session that has left. To see recent departures, call `agents.departed({ limit? })`. It lists other root Pi sessions that are no longer live, newest first, each with `status`, `sessionId`, `cwd`, `label`, `startedAt`, and `lastSeenAt`. `status: "stopped"` means the session closed cleanly and left a tombstone. `status: "lost"` means its host lease expired without a clean close, so `lastSeenAt` is its last heartbeat. A session that is live again drops out of the list. Tombstones live under their own mesh prefix, so `agents.sessions()`, `agents.peers()`, and `agents.members()` never read them. Only roots get tombstones; child agents and actors simply leave. `mesh.departedLimit` and `mesh.departedRetentionMs` bound how many tombstones are kept and for how long.
|
|
639
658
|
|
|
640
659
|
```ts
|
|
@@ -644,7 +663,7 @@ const peerRoot = sessions.find((participant) => participant.id !== main.id);
|
|
|
644
663
|
if (peerRoot) {
|
|
645
664
|
await agents.steer({ id: peerRoot.id, message: "Coordinate on the shared migration." });
|
|
646
665
|
}
|
|
647
|
-
await agents.
|
|
666
|
+
await agents.steer({ id: main.id, message: "Reconcile these audit findings." });
|
|
648
667
|
|
|
649
668
|
const lineage = await agents.list({ scope: "lineage" });
|
|
650
669
|
return { self: await agents.self(), lineage };
|
|
@@ -654,7 +673,7 @@ Child dialogs (`select`, `confirm`, `input`, `editor`) are cancelled by default.
|
|
|
654
673
|
|
|
655
674
|
Routing also gives a Pi child with extensions the tools in `agents.childQuestionTools` (default `["ask"]`), so the caller does not have to name them in `tools`. A child's system prompt lists only the extension tools its `tools` allowlist permits.
|
|
656
675
|
|
|
657
|
-
For Main and one-shot agents, `steer` arrives after the tool calls in the current turn and before the next model call. A workflow that runs inside one `fabric_exec` is one tool call, so Main's steer waits for all of it; move the program to the background (Ctrl+B twice, or `background: true`) to steer Main while it runs, see [Background programs](background-tasks.md#background-programs). `followUp` waits until the current run settles. For actors, both operations add a message to the serial mailbox. `agents.status({ id })` accepts any participant ID. It returns complete details for a local run or actor and a bounded directory summary for a remote participant. `agents.setSteeringMode` and `setFollowUpMode` continue to control local one-shot runs.
|
|
676
|
+
For Main and one-shot agents, `steer` arrives after the tool calls in the current turn and before the next model call. Incoming agent-originated Main feedback (including child, actor, peer, lifecycle, and resident relay messages) uses **hidden steering**, even when the sender requested `followUp`. Main records the actual delivery and the requested mode in message details. The human sees a bounded, single-line notification naming the sender, not a chat bubble; the full message and JSON-serializable data remain in model context and session audit. UI-less hosts still receive the hidden feedback; notification failure never replays it. A workflow that runs inside one `fabric_exec` is one tool call, so Main's steer waits for all of it; move the program to the background (Ctrl+B twice, or `background: true`) to steer Main while it runs, see [Background programs](background-tasks.md#background-programs). For one-shot targets, `followUp` still waits until the current run settles. Direct human Main messages retain their chosen steer/follow-up controls. For actors, both operations add a message to the serial mailbox. `triggerTurn: false` remains passive: it never starts idle Main, and Pi appends it after the current turn when Main is active. Intentional blocking handoff final-answer continuations retain their existing behavior. `agents.status({ id })` accepts any participant ID. It returns complete details for a local run or actor and a bounded directory summary for a remote participant. `agents.setSteeringMode` and `setFollowUpMode` continue to control local one-shot runs.
|
|
658
677
|
|
|
659
678
|
Local routing returns `"main"` or `"local"`. For cross-process `steer`, `followUp`, and `stop`, Fabric resolves the exact owner of the target. It sends a control command addressed to that owner and waits for an acknowledgement that matches the version, target, and owner identity. Success returns `routed: "mesh", acknowledged: true` after this verified acknowledgement. Unknown IDs, stale owners, rejection, and timeout throw an error. The dashboard actions `s`, `u`, and `x` use the same route. Set `mesh.enabled` to use cross-process control. See [`references/agents.md`](../skillsets/typescript/fabric-exec/references/agents.md).
|
|
660
679
|
|
|
@@ -687,6 +706,7 @@ File or git changes you did not make may be theirs: do not revert or overwrite t
|
|
|
687
706
|
</fabric-peers>
|
|
688
707
|
```
|
|
689
708
|
|
|
709
|
+
- **Display.** The full notice stays in the model context as a hidden transcript entry. The human sees a compact Pi notification, such as `Fabric peers: joined FAB-2; 1 active`. The transcript card is hidden. Notification failures do not discard the model advice.
|
|
690
710
|
- **When.** At the start of a prompt, and at the end of any turn that continues into another model call, so a peer that joins during a long run is noticed before the next request. A final turn adds nothing; the next prompt folds every change made while idle into one notice.
|
|
691
711
|
- **Cache safety.** The notice is a persistent transcript message appended at a turn boundary. The system prompt, tool declarations, and every earlier message stay byte-identical, so the provider's cached prefix remains valid and only the notice itself is new input. The mid-run notice is a native `turn_end` boundary entry: it rides the request the run was about to make and never triggers an extra one. The text is deterministic for a given change. It carries labels, participant ids, and a working directory when that differs from the caller's, and no clock, run status, or model.
|
|
692
712
|
- **Once per change.** Fabric rebuilds what the model was told from the notices on the active branch, so resuming or navigating a session does not repeat one. A compaction may drop earlier notices from the context, so the current peers are stated again at the next boundary.
|
|
@@ -719,7 +739,7 @@ if (peer) {
|
|
|
719
739
|
|
|
720
740
|
Pi events use these names: `pi.input`, `pi.agent_start`, `pi.agent_end`, `pi.turn_end`, `pi.agent_settled`, `pi.tool_error`, and `pi.session_compact`. Runner-neutral terminal events use `run.completed`, `run.failed`, `run.stopped`, and `run.timed_out`. Recovery events use `run.resumed` for a relaunched attempt after an unexpected stop, and `run.detached` for a run that outlived its caller's cancellation. The `tokens.usage` event provides bounded usage. The `component.state` event reports supervised component transitions. Lifecycle envelopes contain source identity and bounded operational metadata. They do not contain session transcripts.
|
|
721
741
|
|
|
722
|
-
A detached
|
|
742
|
+
A detached `agents.spawn()` has a smaller convenience route. When `agents.notifyOnComplete` is enabled, local and resident completions show a concise UI notification immediately. The completion inbox batches unread result summaries as hidden steering after the current tool turn, or wakes idle Main once. Full results remain in the run store (`agents.wait`/`agents.log`); summaries are bounded. `agents.wait()`/`join()` and terminal `agents.status()` acknowledge the result and retract pending context delivery, even if completion preceded the wait. Running status and UI/list polling do not acknowledge it. Interrupted results stay parked until new input; a recovered error can release them. Durable spawns preserve unread deliveries and acknowledgments across reconnects. This convenience route is distinct from explicit lifecycle subscriptions, whose delivery remains at-least-once across a crash.
|
|
723
743
|
|
|
724
744
|
For a code-owned typed alternative to a reasoning actor, use [Jev Main-turn observers](jev.md#main-turn-advisors-and-supervisors). They consume bounded selected event context with `program.nextEvent()`, work without mesh, and can explicitly opt into freshness-checked advice. They are session-owned Jev runs, not participant subscription targets.
|
|
725
745
|
|
|
@@ -884,7 +904,7 @@ Choose one of these response modes:
|
|
|
884
904
|
- With `text`, each non-empty response becomes an actor outbox message.
|
|
885
905
|
- With `directive`, validated output in the form `{ action: "silent" | "message" | "stop", message?, data? }` lets the actor choose whether to intervene.
|
|
886
906
|
|
|
887
|
-
Delivery can stay in `mailbox` or enter
|
|
907
|
+
Delivery can stay in `mailbox` or enter Main through `steer`, legacy `followUp` (now a steering alias for incoming feedback), or intentional `nextTurn`. Actor output uses a bounded sender notification and a hidden full-content message, including structured directive data. For `steer` and `followUp`, explicitly set `triggerTurn: true | false`. A value of `true` starts Main when it is idle. A value of `false` is passive, and Fabric labels it as unable to start Main. The `mailbox` and `nextTurn` modes never start Main, so they reject `triggerTurn: true`. This policy keeps a delivered actor message from looking like a stalled continuation. Fabric applies no extra 8,000-character truncation to local actor or agent messages sent to Main. Standard limits for model context, providers, and cross-mesh event size still apply. `nextTurn` still waits for the next user prompt; `mailbox` stays out of Main entirely. No scheduling, ownership, or deduplication policy is changed by the notification projection.
|
|
888
908
|
|
|
889
909
|
The actor cannot change delivery from its response. The owner can update a live actor or global template and keep its history:
|
|
890
910
|
|
|
@@ -896,7 +916,7 @@ await agents.setDeliveryPolicy({
|
|
|
896
916
|
});
|
|
897
917
|
```
|
|
898
918
|
|
|
899
|
-
Set `scope: "global"` to update a reusable template. In the dashboard, press `y` on an actor or template, then choose mailbox, steer, follow-up, or next-turn delivery. Lowercase `m` and `e` change this Pi session. Uppercase `M` and `E` change the owner-gated project defaults. These changes keep the Pi or Claude runner session. Use `agents.ask()` for a blocking exchange and `agents.tell()` for fire-and-forget mail. Both accept one-activation `model` and `thinking` overrides. Read shared history with `agents.messages()`. `agents.remove()` is local-owner-only for session actors and routes durable actors to the resident owner.
|
|
919
|
+
Set `scope: "global"` to update a reusable template. In the dashboard, press `y` on an actor or template, then choose mailbox, steer, legacy follow-up (steering alias), or next-turn delivery. Lowercase `m` and `e` change this Pi session. Uppercase `M` and `E` change the owner-gated project defaults. These changes keep the Pi or Claude runner session. Use `agents.ask()` for a blocking exchange and `agents.tell()` for fire-and-forget mail. Both accept one-activation `model` and `thinking` overrides. Read shared history with `agents.messages()`. `agents.remove()` is local-owner-only for session actors and routes durable actors to the resident owner.
|
|
900
920
|
|
|
901
921
|
## Paged agent logs
|
|
902
922
|
|
package/docs/background-tasks.md
CHANGED
|
@@ -39,9 +39,16 @@ Main takes the steer on its next request.
|
|
|
39
39
|
`fabric_exec` runs. A nested shell that is still waiting is spilled first, as
|
|
40
40
|
before; press the chord again to move the program. With text in the editor,
|
|
41
41
|
Ctrl+B stays cursor-left.
|
|
42
|
+
- **`/fabric background`** moves the whole running workflow to the background
|
|
43
|
+
directly, even when a nested shell is still waiting. Extension commands are
|
|
44
|
+
handled before queued chat input. It does not stop or restart any work. This
|
|
45
|
+
command applies to all currently running foreground Fabric programs; the
|
|
46
|
+
existing Ctrl+B chord remains shell-first.
|
|
42
47
|
- **`background: true`** on the `fabric_exec` call starts the program as a task
|
|
43
|
-
and returns at once.
|
|
44
|
-
|
|
48
|
+
and returns at once. Long workflows can keep necessary shell/agent awaits
|
|
49
|
+
inside the background program even when their results are required for the
|
|
50
|
+
assignment. Main should continue independent work or yield for completion,
|
|
51
|
+
not immediately open another foreground wait. Yielding is not task completion.
|
|
45
52
|
|
|
46
53
|
The tool call returns the task ID. The program keeps running with its own
|
|
47
54
|
cancellation signal: Esc and later turns no longer stop it, and `tasks.stop`,
|
|
@@ -88,14 +95,24 @@ before sealing their log, regardless of extension shutdown order.
|
|
|
88
95
|
|
|
89
96
|
## Agent awareness and yielding
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
discards the nested shell result, the owning agent can
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
When a task moves to the background, Fabric appends one note to the result of
|
|
99
|
+
the tool call that spilled it, independently of the returned `fabric_exec`
|
|
100
|
+
value. Even if a program discards the nested shell result, the owning agent can
|
|
101
|
+
see that work is running. Tasks spilled by one call share one note, which
|
|
102
|
+
includes at most eight task IDs and short, quoted labels, with an omitted count
|
|
103
|
+
for additional jobs, and never elapsed time or process output. The note
|
|
104
|
+
**never triggers a turn** itself.
|
|
105
|
+
|
|
106
|
+
The note records a moment and is never edited or retracted; later task events
|
|
107
|
+
report each outcome in transcript order. Fabric does not rewrite requests for
|
|
108
|
+
awareness, so each request extends the previous one and the provider's prompt
|
|
109
|
+
cache keeps hitting while tasks run. A reminder projected at the end of every
|
|
110
|
+
request would be missing from the next request in that position, which caps
|
|
111
|
+
the cached prefix at the last request without it. The note lives in an ordinary
|
|
112
|
+
tool result, not a custom message, because Pi rebuilds custom-message objects
|
|
113
|
+
on every refresh and its idle cache warmer, which compares objects by identity,
|
|
114
|
+
then treats the conversation as changed. After compaction, which replaces the
|
|
115
|
+
prefix anyway, Fabric restates still-running tasks on the next tool result.
|
|
99
116
|
|
|
100
117
|
For ordinary detached commands and wake-enabled monitors, it tells the agent to
|
|
101
118
|
continue independent work or **end the turn if it needs their results**. Completion
|
|
@@ -104,10 +121,12 @@ are unnecessary. UI-only monitors are explicitly marked **no automatic wakeup**,
|
|
|
104
121
|
including on completion, so the agent must not yield expecting them to resume it.
|
|
105
122
|
Pending required results are not evidence that the assignment is complete.
|
|
106
123
|
|
|
107
|
-
Foreground
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
124
|
+
Foreground jobs, jobs that end before the next tool result, abandoned-branch
|
|
125
|
+
jobs, and durable tasks reattached after a restart are not announced; the
|
|
126
|
+
process that spilled a reattached task already wrote its note. A note stays on
|
|
127
|
+
its own branch of the session tree. Reload/session shutdown closes the inbox.
|
|
128
|
+
Awareness works without a terminal and does not restore processes across Pi
|
|
129
|
+
restarts.
|
|
111
130
|
|
|
112
131
|
### Prompt-cache warming while yielded
|
|
113
132
|
|
|
@@ -315,6 +334,71 @@ const seen = await tools.call({ref: "tasks.watch", args: {id, match: "listening
|
|
|
315
334
|
- `tasks.watch` with `match` scans complete lines after a byte cursor for a case-sensitive literal chosen at watch time, like `jev-fabric watch <id> <literal>`. The cursor stops at line boundaries, so an unfinished line is matched once it ends or the task exits. Up to 64 lines per call; call again while `more` is true.
|
|
316
335
|
- Neither consumes, acknowledges, wakes the agent, or stops the task. Without `match`, `tasks.watch` keeps reading a launch-time monitor as below.
|
|
317
336
|
|
|
337
|
+
## Attached task and participant monitors
|
|
338
|
+
|
|
339
|
+
`tasks.observe` and `agents.observe` observe work that already exists. There is no separate `monitors` provider. It does not start another shell,
|
|
340
|
+
restart an agent, or invoke a model. It is available beside `tasks` in native
|
|
341
|
+
full-code / Schema enforce sessions, not closed-world managed hosts.
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
const {task: watch} = await tools.call({ref: "tasks.observe", args: {
|
|
345
|
+
id: taskId,
|
|
346
|
+
delivery: "wake", match: "BUILD:", timeoutMs: 600000,
|
|
347
|
+
}});
|
|
348
|
+
return {monitorId: watch.id};
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
For a local agent run ID or a local `provider:...` participant ref:
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
return await tools.call({ref: "agents.observe", args: {
|
|
355
|
+
id: agentId, delivery: "ui",
|
|
356
|
+
events: ["progress", "blocked", "quiet", "terminal"],
|
|
357
|
+
quietAfterMs: 120000, timeoutMs: 600000,
|
|
358
|
+
}});
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
- `delivery` is required. `ui` never wakes the owner; `wake` uses the existing
|
|
362
|
+
bounded, batched task inbox. There is at most one attached wake observer per
|
|
363
|
+
target and eight active monitors total, shared with shell launch monitors.
|
|
364
|
+
- Task events default to `output, terminal`; participant events default to
|
|
365
|
+
`progress, blocked, terminal`. Task output is **new combined stdout/stderr**
|
|
366
|
+
after attachment, filtered with the optional literal `match`. Retained earlier
|
|
367
|
+
output remains in `tasks.read`. Participant observation exposes only operational
|
|
368
|
+
metadata (status, tool/turn counters, current tool/milestone, waiting state, or
|
|
369
|
+
provider phase/message), not transcripts, thinking, or tool results.
|
|
370
|
+
- Output and progress are bounded and batched with `intervalMs`. Terminal outcomes
|
|
371
|
+
always bypass filters and cannot be disabled. Terminal replay is a JSON line
|
|
372
|
+
identifying the target and status; output lines otherwise retain their text.
|
|
373
|
+
- `quiet` requires `quietAfterMs` and fires once per quiet period. Real output or
|
|
374
|
+
changed operational metadata re-arms it; heartbeat timestamps do not. Quiet is
|
|
375
|
+
**not evidence of a hang or failure**, and never triggers a stop or restart.
|
|
376
|
+
- A participant replacement or disappearance ends observation with an unavailable
|
|
377
|
+
outcome; it is not silently followed or classified as successful completion.
|
|
378
|
+
Remote peers, resident actors and hosted/project-only participants are not
|
|
379
|
+
supported by this first local adapter.
|
|
380
|
+
- `timeoutMs` defaults to five minutes, maximum thirty minutes. **Expiration,
|
|
381
|
+
`tasks.stop({id: watch.id})`, interruption and session teardown stop only the observer**, not
|
|
382
|
+
its target. This deliberately differs from a launch-time shell `monitor`, whose
|
|
383
|
+
deadline owns and stops its watcher command. No automatic renewal.
|
|
384
|
+
- `tasks.list/get/watch/stop` inspect and control observation handles. In the
|
|
385
|
+
footer, observations appear beneath their task or local participant, with separate
|
|
386
|
+
work/observation counts, delivery and expiry. The inspector labels “stop watching”
|
|
387
|
+
separately from stopping the target. `tasks.watch` returns the
|
|
388
|
+
existing bounded line-cursor replay and loss records; an observation timeout or
|
|
389
|
+
cancellation never stops the observer. Stopping an observer discards pending
|
|
390
|
+
notifications. A wake observer replaces the target's ordinary completion wakeup,
|
|
391
|
+
avoiding duplicates; retrieve a participant's full result with `agents.wait`.
|
|
392
|
+
`tasks.watch` remains a bounded read/wait, not a persistent subscription.
|
|
393
|
+
`agents.subscribe` remains the separate durable lifecycle-routing API.
|
|
394
|
+
Neither observe action launches a supervisor agent or changes ordinary completion defaults.
|
|
395
|
+
|
|
396
|
+
The foreground shell/program shortcut is shown as a connected status line,
|
|
397
|
+
`╰─ (ctrl+b to run in background)`, joining existing output/timing arcs. The
|
|
398
|
+
existing confirmation chord remains: press Ctrl+B again within one second to
|
|
399
|
+
confirm. The hint disappears on completion or detachment; with editor text,
|
|
400
|
+
program backgrounding retains Ctrl+B as cursor-left.
|
|
401
|
+
|
|
318
402
|
## Opt-in monitors
|
|
319
403
|
|
|
320
404
|
```ts
|
package/docs/configuration.md
CHANGED
|
@@ -685,6 +685,8 @@ Fabric attributes each file through a `session_info` marker (`fabricagent-<name>
|
|
|
685
685
|
|
|
686
686
|
ccusage's double-count guard rejects a named store that overlaps the default pi store, so the isolated-row form requires the separate directory.
|
|
687
687
|
|
|
688
|
+
`agents.transport` accepts `process` (default), `auto`, `tmux`, `screen`, `localterm`, `herdr`, and `herdr-core`; per-call `transport` uses the same values. Herdr Core requires the existing parent terminal’s `HC_TERMINAL_ID` and `HC_TERMINAL_SOCKET` plus a reachable generation-1 service. It never starts a server. `auto` tries Core before legacy Herdr and falls back when unavailable.
|
|
689
|
+
|
|
688
690
|
See [agents, actors & mesh](agents.md) for the runner and transport details.
|
|
689
691
|
|
|
690
692
|
## MCP
|
package/docs/interface.md
CHANGED
|
@@ -10,6 +10,8 @@ Nested `pi.read`, `pi.bash`, `pi.powershell`, `pi.grep`, `pi.find`, `pi.ls`, `pi
|
|
|
10
10
|
|
|
11
11
|
Fabric keeps its orchestration-specific behavior around those previews. Multi-call rows stay compact, and live write composition with phase/call progress stays visible during the run. Agent and actor audits can expose their current child tools directly in the parent card, with owner, runner, and run metadata. One execution-wide throttle coalesces parallel nested-call updates before they reach Pi, and continuous streams are not starved. Long ANSI rows are bounded without clearing the enclosing tool background. The widget lease plus result-to-source row transfer keep completion height stable. The highlighter initializes lazily and falls back to plain text until it is ready. When Pi switches between its light and dark variants, the highlighter swaps themes live. Collapsed previews use the configured expand keybinding, for example `Ctrl-O`.
|
|
12
12
|
|
|
13
|
+
Successful internal `native.load` calls are hidden from ordinary tool rows and call totals, including partial updates, resumed cards, and dashboard summaries. Errors remain visible, and the raw audits and execution trace still record the calls. This is a presentation filter only: branch-local `load`/`store` behavior and commit ordering are unchanged. Built-in provider actions use scoped labels and bounded, allowlisted target metadata (for example `tasks.wait task-id`); stdin, credentials, arbitrary program input, and model state are not used as fallback labels.
|
|
14
|
+
|
|
13
15
|
## Terminal title
|
|
14
16
|
|
|
15
17
|
In an interactive session, the terminal window/tab title carries the declared `fabric_exec` display name: `record release evidence`, `Apply migration`, and so on. Nested call detail such as `read src/config.ts · typescript` never reaches the window; it stays in the transcript and the activity surface, where there is room for it.
|
|
@@ -24,7 +26,7 @@ See [Background tasks and monitors](background-tasks.md) for completion delivery
|
|
|
24
26
|
|
|
25
27
|
## Agent list
|
|
26
28
|
|
|
27
|
-
The Fabric widget sits at the bottom of the screen, below Pi's footer and a blank row, as in Claude Code. Its header is the main session's row: `● FAB-3` shows the session's [peer label](agents.md#peer-labels-and-queue-gates), followed by the current run's declared name and totals. A new session takes its label at its first Fabric use, so a session that has done nothing yet shows none. Without a label it reads `● Fabric`. A session with a label also shows it on the right of the editor's top border, in a badge like the one a conversation window shows for its target, whether or not the list is showing. While the list has no row to select, with no agent, actor worker, or shell task (idle actors have none), it takes no rows. The badge yields to Pi's own border text, such as a scroll indicator, and needs the list to be placed after the footer; otherwise the header row stays. Below it, running agents and actors are listed as a tree, above any background shell tasks, each child under its parent and indented by depth. Each row shows a circle, the participant's name, what it is doing, its model, tool calls, tokens, and elapsed time. What it is doing is the latest display name the agent declared for a `fabric_exec` call, which holds until it declares another; before that, the row shows the current tool or `thinking`. A finished row shows its result or error. The circle's colour is the status: accent while running, green when done, red on failure. Shell tasks list one per row after agents and actors, within the same row budget. Shell rows are selectable like agents: **Enter** or a click on a shell opens that task's detail with its output, status, and stop action. There is no secondary task-list overlay. **Esc** closes a task opened this way in one step, and focus returns to the list. Lines disclose progressively: when a line is too wide, its statistics drop first, then its title or activity is shortened, and its key hints go last. Pi gives extensions no slot below its footer, so Fabric registers an empty below-editor widget and places the list after the footer itself, in both the fullscreen and the regular renderer. Pi's footer and footers from other extensions stay as they are. In fullscreen mode, the list uses only the rows left after Pi's editor, other widgets (including Better OpenAI's status line), and footer, keeping at least one transcript row. It shrinks or temporarily disappears when those need the space, and returns when space is available. If Pi's layout is not the one Fabric expects, the list falls back to below the editor and stays last among the widgets other extensions place there. Press **↓** in an empty editor to move into the list; **ctrl+shift+e**, **`/fabric focus`**, or a click on a row also focuses it. The filled circle `●` marks the selected row, and **↑↓** or **j/k** moves it. **↑** on the top row returns to the editor. **Enter** or a click opens the participant's full conversation, where you can read its whole transcript, see its model and thinking level, and steer it or send a follow-up. Closing that view returns focus to the list. As in Claude Code, there is no inline preview: the conversation is where a participant's activity is shown. In Pi's fullscreen renderer, hovering the pointer over a row fills its circle too. Pi turns on hover tracking only outside tmux, zellij, and screen, and there is no event for leaving the widget, so the hover clears when the pointer crosses the header or the next key is pressed. **Esc** returns focus to the editor; while the list has focus, Esc does not halt background workers. Any other key returns focus to the editor and reaches it, so typing, Ctrl+C, and shortcuts keep working; only a click on a participant row takes focus.
|
|
29
|
+
The Fabric widget sits at the bottom of the screen, below Pi's footer and a blank row, as in Claude Code. Its header is the main session's row: `● FAB-3` shows the session's [peer label](agents.md#peer-labels-and-queue-gates), followed by the current run's declared name and totals. A new session takes its label at its first Fabric use, so a session that has done nothing yet shows none. Without a label it reads `● Fabric`. A session with a label also shows it on the right of the editor's top border, in a badge like the one a conversation window shows for its target, whether or not the list is showing. While the list has no row to select, with no agent, actor worker, or shell task (idle actors have none), it takes no rows. The badge yields to Pi's own border text, such as a scroll indicator, and needs the list to be placed after the footer; otherwise the header row stays. Below it, running agents and actors are listed as a tree, above any background shell tasks, each child under its parent and indented by depth. Each row shows a circle, the participant's name, what it is doing, its model, tool calls, tokens, and elapsed time. What it is doing is the latest display name the agent declared for a `fabric_exec` call, which holds until it declares another; before that, the row shows the current tool or `thinking`. A finished row shows its result or error. The circle's colour is the status: accent while running, green when done, red on failure. Shell tasks list one per row after agents and actors, within the same row budget. Shell rows are selectable like agents: **Enter** or a click on a shell opens that task's detail with its output, status, and stop action. There is no secondary task-list overlay. **Esc** closes a task opened this way in one step, and focus returns to the list. Lines disclose progressively: when a line is too wide, its statistics drop first, then its title or activity is shortened, and its key hints go last. Pi gives extensions no slot below its footer, so Fabric registers an empty below-editor widget and places the list after the footer itself, in both the fullscreen and the regular renderer. Pi's footer and footers from other extensions stay as they are. In fullscreen mode, the list uses only the rows left after Pi's editor, other widgets (including Better OpenAI's status line), and footer, keeping at least one transcript row. It shrinks or temporarily disappears when those need the space, and returns when space is available. If Pi's layout is not the one Fabric expects, the list falls back to below the editor and stays last among the widgets other extensions place there. Press **↓** in an empty editor to move into the list; **ctrl+shift+e**, **`/fabric focus`**, or a click on a row also focuses it. The filled circle `●` marks the selected row, and **↑↓** or **j/k** moves it. **↑** on the top row returns to the editor. **Enter** or a click opens the participant's full conversation, where you can read its whole transcript, see its model and thinking level, and steer it or send a follow-up. Closing that view returns focus to the list. As in Claude Code, there is no inline preview: the conversation is where a participant's activity is shown. In Pi's fullscreen renderer, hovering the pointer over a row fills its circle too. Pi turns on hover tracking only outside tmux, zellij, and screen, and there is no event for leaving the widget, so the hover clears when the pointer crosses the header or the next key is pressed. **Esc** returns focus to the editor; while the list has focus, Esc does not halt background workers. Any other key returns focus to the editor and reaches it, so typing, Ctrl+C, and shortcuts keep working; only a click on a participant row takes focus. The list never grows past `ui.maxRows` on focus and remains bounded by half the terminal height and the space left in the fullscreen dock. Arrow keys and the mouse wheel over the list scroll within that viewport, keeping every participant and task reachable without moving the footer. When content overflows, a bottom cue row shows `↓ N more` while children remain below. At the end, another agent or shell row replaces the cue, filling the viewport without changing its height. `↑ N more` appears in the main header when children are above the viewport. Very short viewports prioritize the header and a reachable child over the cue. Short or idle lists do not reserve a large empty area.
|
|
28
30
|
|
|
29
31
|
## Focused conversations
|
|
30
32
|
|
package/docs/jev.md
CHANGED
|
@@ -330,7 +330,7 @@ return {id:observer.id, state:observer.state};
|
|
|
330
330
|
|
|
331
331
|
### Delivery, freshness, and interruption
|
|
332
332
|
|
|
333
|
-
Delivery defaults to off. Opt into `"steer"` or `"followUp"
|
|
333
|
+
Delivery defaults to off. Opt into `"steer"` or legacy `"followUp"` (both deliver Main feedback as hidden steering); `triggerTurn` defaults to false and never wakes idle Main when false. UI hosts show a bounded notification naming the advisor and omit the chat bubble. The full advice remains in model context and session audit, with actual and requested delivery modes. `maxAdvice` bounds delivery attempts for the run (feedback/stale suppression does not consume a delivery attempt) (1–16, default 4). Advice must be sent before requesting the next event; it needs the last consumed event ID and must still match the latest completed-turn/task/context revision and age limit. A next turn may be in flight; a newer completed turn, real input, compaction, or cancellation invalidates old advice. The check is at enqueue time, not a guarantee that context cannot change before Main consumes a queued message.
|
|
334
334
|
|
|
335
335
|
There is at most **one delivery attempt across all Jev observers per external user input**. Automatic continuations and extension-injected input do not reset this feedback latch. Duplicate, stale, disabled, over-budget, feedback-gated, or failed deliveries return `{delivered:false,reason}`; failures are not replayed. This prevents an advisor from repeatedly waking/steering Main based on its own intervention. Additional turns may still be classified and recorded within budget. Broader separately granted tools retain their own authority; these safeguards specifically govern `jev.advise`.
|
|
336
336
|
|