pi-fabric 0.62.8 → 0.64.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.
Files changed (84) hide show
  1. package/README.md +1 -1
  2. package/dist/audit/projection.d.ts.map +1 -1
  3. package/dist/chunks/{chunk-64LZJ3EJ.js → chunk-6F6YQ2DS.js} +4 -4
  4. package/dist/chunks/{chunk-5PMNF4ON.js → chunk-725BGPJU.js} +51 -6
  5. package/dist/chunks/{chunk-5PMNF4ON.js.map → chunk-725BGPJU.js.map} +2 -2
  6. package/dist/chunks/{chunk-RQIQA7CW.js → chunk-E3V22XGU.js} +2 -2
  7. package/dist/chunks/{chunk-GWDVAULL.js → chunk-EBGSP7Q7.js} +15 -4
  8. package/dist/chunks/{chunk-GWDVAULL.js.map → chunk-EBGSP7Q7.js.map} +2 -2
  9. package/dist/chunks/{chunk-YWV4KFMB.js → chunk-EICYV4YL.js} +2 -2
  10. package/dist/chunks/{chunk-PNTJXMP7.js → chunk-F5ZTKVJD.js} +2 -1
  11. package/dist/chunks/{chunk-PNTJXMP7.js.map → chunk-F5ZTKVJD.js.map} +2 -2
  12. package/dist/chunks/{chunk-X32MQBTA.js → chunk-GFZYWVIK.js} +24 -1
  13. package/dist/chunks/chunk-GFZYWVIK.js.map +7 -0
  14. package/dist/chunks/{chunk-HFYEEIXR.js → chunk-IDTQ2B5W.js} +6 -1
  15. package/dist/chunks/{chunk-HFYEEIXR.js.map → chunk-IDTQ2B5W.js.map} +2 -2
  16. package/dist/chunks/{chunk-KDEOYZTK.js → chunk-L3RGWRBJ.js} +19 -1
  17. package/dist/chunks/{chunk-KDEOYZTK.js.map → chunk-L3RGWRBJ.js.map} +2 -2
  18. package/dist/chunks/{chunk-VK3MWAOL.js → chunk-LPKYDCZ2.js} +2 -2
  19. package/dist/chunks/{chunk-6HIZWKOP.js → chunk-NLY3MSQJ.js} +2 -2
  20. package/dist/chunks/{chunk-IAAKH5GZ.js → chunk-OKQHLYTU.js} +3 -3
  21. package/dist/chunks/{chunk-QEP3ZBVZ.js → chunk-TGRIZ7E4.js} +81 -1
  22. package/dist/chunks/chunk-TGRIZ7E4.js.map +7 -0
  23. package/dist/chunks/{chunk-X2AL6J4G.js → chunk-UACA2AKF.js} +108 -3
  24. package/dist/chunks/{chunk-X2AL6J4G.js.map → chunk-UACA2AKF.js.map} +3 -3
  25. package/dist/chunks/{chunk-XRADSGKL.js → chunk-Z4ITC2TP.js} +2 -2
  26. package/dist/chunks/{core-override-guest-types-ZI3RRM7R.js → core-override-guest-types-ILO6C7PF.js} +2 -2
  27. package/dist/chunks/{fabric-runtime-state-CY3V6Y7M.js → fabric-runtime-state-STCXP7AK.js} +112 -20
  28. package/dist/chunks/fabric-runtime-state-STCXP7AK.js.map +7 -0
  29. package/dist/chunks/{guest-types-GC7QVDA4.js → guest-types-MI75B3IY.js} +2 -2
  30. package/dist/chunks/{node-process-runtime-O7BIVTEM.js → node-process-runtime-XEDYAHOS.js} +2 -2
  31. package/dist/chunks/{quickjs-runtime-DGJOVTNF.js → quickjs-runtime-6OKFLKJ4.js} +2 -2
  32. package/dist/chunks/{settings-W2242VKH.js → settings-GYHFWT4K.js} +2 -2
  33. package/dist/commands/fabric.d.ts.map +1 -1
  34. package/dist/compaction/hook.js +3 -3
  35. package/dist/config.d.ts +5 -0
  36. package/dist/config.d.ts.map +1 -1
  37. package/dist/core/action-registry.js +3 -3
  38. package/dist/core/model-resolution.d.ts +44 -0
  39. package/dist/core/model-resolution.d.ts.map +1 -0
  40. package/dist/fabric-runtime-state.d.ts.map +1 -1
  41. package/dist/index.js +67 -10
  42. package/dist/index.js.map +2 -2
  43. package/dist/main-agent.d.ts +12 -0
  44. package/dist/main-agent.d.ts.map +1 -1
  45. package/dist/memory/discovery.js +4 -4
  46. package/dist/memory/normalize.js +3 -3
  47. package/dist/memory/search.js +4 -4
  48. package/dist/protocol.d.ts +59 -0
  49. package/dist/protocol.d.ts.map +1 -1
  50. package/dist/protocol.js +9 -1
  51. package/dist/providers/agents-actions.d.ts.map +1 -1
  52. package/dist/providers/agents-provider.d.ts +3 -1
  53. package/dist/providers/agents-provider.d.ts.map +1 -1
  54. package/dist/providers/memory-provider.js +6 -6
  55. package/dist/residency/host.js +6 -6
  56. package/dist/runtime/guest-types.d.ts +1 -1
  57. package/dist/runtime/guest-types.d.ts.map +1 -1
  58. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  59. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  60. package/dist/topology/participant-directory.d.ts.map +1 -1
  61. package/dist/topology/peer-settle.d.ts +52 -0
  62. package/dist/topology/peer-settle.d.ts.map +1 -0
  63. package/dist/topology/types.d.ts +7 -0
  64. package/dist/topology/types.d.ts.map +1 -1
  65. package/dist/worker.js +0 -0
  66. package/docs/agents.md +24 -0
  67. package/docs/configuration.md +21 -0
  68. package/package.json +17 -15
  69. package/skills/fabric-exec/references/agents.md +1 -0
  70. package/dist/chunks/chunk-QEP3ZBVZ.js.map +0 -7
  71. package/dist/chunks/chunk-X32MQBTA.js.map +0 -7
  72. package/dist/chunks/fabric-runtime-state-CY3V6Y7M.js.map +0 -7
  73. /package/dist/chunks/{chunk-64LZJ3EJ.js.map → chunk-6F6YQ2DS.js.map} +0 -0
  74. /package/dist/chunks/{chunk-RQIQA7CW.js.map → chunk-E3V22XGU.js.map} +0 -0
  75. /package/dist/chunks/{chunk-YWV4KFMB.js.map → chunk-EICYV4YL.js.map} +0 -0
  76. /package/dist/chunks/{chunk-VK3MWAOL.js.map → chunk-LPKYDCZ2.js.map} +0 -0
  77. /package/dist/chunks/{chunk-6HIZWKOP.js.map → chunk-NLY3MSQJ.js.map} +0 -0
  78. /package/dist/chunks/{chunk-IAAKH5GZ.js.map → chunk-OKQHLYTU.js.map} +0 -0
  79. /package/dist/chunks/{chunk-XRADSGKL.js.map → chunk-Z4ITC2TP.js.map} +0 -0
  80. /package/dist/chunks/{core-override-guest-types-ZI3RRM7R.js.map → core-override-guest-types-ILO6C7PF.js.map} +0 -0
  81. /package/dist/chunks/{guest-types-GC7QVDA4.js.map → guest-types-MI75B3IY.js.map} +0 -0
  82. /package/dist/chunks/{node-process-runtime-O7BIVTEM.js.map → node-process-runtime-XEDYAHOS.js.map} +0 -0
  83. /package/dist/chunks/{quickjs-runtime-DGJOVTNF.js.map → quickjs-runtime-6OKFLKJ4.js.map} +0 -0
  84. /package/dist/chunks/{settings-W2242VKH.js.map → settings-GYHFWT4K.js.map} +0 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  _One type-checked program for tools, MCP, agents, workflows, actors, mesh, councils, and recursion._
8
8
 
9
9
  <p>
10
- <img src="https://raw.githubusercontent.com/monotykamary/pi-fabric/main/media/cover.jpg" alt="Pi Fabric composing tools and agents in the Pi TUI" width="1100">
10
+ <img src="https://raw.githubusercontent.com/monotykamary/pi-fabric/main/media/banner.svg" alt="Animated banner: one checked TypeScript program weaving pi core tools, MCP servers, agents, and mesh into a single result" width="100%">
11
11
  </p>
12
12
 
13
13
  [![npm version](https://img.shields.io/npm/v/pi-fabric?style=for-the-badge&logo=npm&color=cb3837)](https://www.npmjs.com/package/pi-fabric)
@@ -1 +1 @@
1
- {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/audit/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAwJD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,qBAuGF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EACX,QAAQ,OAAO,KACd,qBAAqB,GAAG,SAwB1B,CAAC"}
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/audit/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAwJD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,qBA4GF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EACX,QAAQ,OAAO,KACd,qBAAqB,GAAG,SAwB1B,CAAC"}
@@ -3,7 +3,7 @@ import {
3
3
  enumerateAllSessions,
4
4
  resolveScope,
5
5
  resolveSessionTarget
6
- } from "./chunk-RQIQA7CW.js";
6
+ } from "./chunk-E3V22XGU.js";
7
7
  import {
8
8
  DEFAULT_HOT_SESSIONS,
9
9
  DEFAULT_REGEX_MAX_HAYSTACK_BYTES,
@@ -15,11 +15,11 @@ import {
15
15
  loadTieredIndex,
16
16
  reconstructSessionLineage,
17
17
  searchMemoryIndex
18
- } from "./chunk-6HIZWKOP.js";
18
+ } from "./chunk-NLY3MSQJ.js";
19
19
  import {
20
20
  expandSessionEntriesChecked,
21
21
  normalizeSession
22
- } from "./chunk-XRADSGKL.js";
22
+ } from "./chunk-Z4ITC2TP.js";
23
23
 
24
24
  // src/providers/memory-provider.ts
25
25
  import path from "node:path";
@@ -851,4 +851,4 @@ export {
851
851
  normalizeMemoryArgs,
852
852
  MemoryProvider
853
853
  };
854
- //# sourceMappingURL=chunk-64LZJ3EJ.js.map
854
+ //# sourceMappingURL=chunk-6F6YQ2DS.js.map
@@ -16,8 +16,9 @@ import {
16
16
  normalizeVedaModel
17
17
  } from "./chunk-VPPIJRNZ.js";
18
18
  import {
19
+ peerLabelPrefix,
19
20
  writeHandoffSession
20
- } from "./chunk-X2AL6J4G.js";
21
+ } from "./chunk-UACA2AKF.js";
21
22
  import {
22
23
  FABRIC_ACTOR_HOST_EVENTS,
23
24
  readJsonlPage
@@ -28,7 +29,7 @@ import {
28
29
  MIN_AGENT_TIMEOUT_MS,
29
30
  writeFileAtomic,
30
31
  writeJsonAtomic
31
- } from "./chunk-QEP3ZBVZ.js";
32
+ } from "./chunk-TGRIZ7E4.js";
32
33
  import {
33
34
  isFabricThinking
34
35
  } from "./chunk-7B55UIZL.js";
@@ -2701,7 +2702,7 @@ var MAX_PREDICATE_SOURCE_CHARS = 16e3;
2701
2702
  var PREDICATE_TIMEOUT_MS = 100;
2702
2703
  var PREDICATE_MEMORY_BYTES = 16 * 1024 * 1024;
2703
2704
  var runtimeInstance;
2704
- var runtime = async () => runtimeInstance ??= new (await import("./quickjs-runtime-DGJOVTNF.js")).QuickJsRuntime();
2705
+ var runtime = async () => runtimeInstance ??= new (await import("./quickjs-runtime-6OKFLKJ4.js")).QuickJsRuntime();
2705
2706
  var predicateProgram = (source, invoke) => [
2706
2707
  `const predicate = (${source});`,
2707
2708
  'if (typeof predicate !== "function") throw new TypeError("validWhile must be a function");',
@@ -5612,6 +5613,7 @@ var FabricControlPlane = class {
5612
5613
  // src/topology/participant-directory.ts
5613
5614
  import { createHash as createHash3 } from "node:crypto";
5614
5615
  var PARTICIPANT_PREFIX = "topology/participants/";
5616
+ var PEER_SEQ_KEY = "topology/peer-seq";
5615
5617
  var HOST_PREFIX = "topology/hosts/";
5616
5618
  var LEGACY_SESSION_PREFIX = "sessions/";
5617
5619
  var LEGACY_ACTOR_PREFIX = "actors/";
@@ -5663,7 +5665,8 @@ var peerFromParticipant = (participant) => {
5663
5665
  }
5664
5666
  return {
5665
5667
  id: participant.id,
5666
- name: "Peer " + participant.sessionId.slice(0, 8),
5668
+ name: participant.label ?? "Peer " + participant.sessionId.slice(0, 8),
5669
+ ...participant.label ? { label: participant.label } : {},
5667
5670
  kind: "peer",
5668
5671
  status: participant.status,
5669
5672
  runner: "pi",
@@ -5977,6 +5980,7 @@ var ParticipantDirectory = class {
5977
5980
  desired.set(record.id, record);
5978
5981
  }
5979
5982
  }
5983
+ await this.#ensurePeerLabels(desired);
5980
5984
  this.#localRecords.clear();
5981
5985
  for (const [id, record] of desired) this.#localRecords.set(id, record);
5982
5986
  if (!this.options.enabled) return;
@@ -6008,7 +6012,8 @@ var ParticipantDirectory = class {
6008
6012
  key: legacySessionKey,
6009
6013
  value: {
6010
6014
  id: root.id,
6011
- name: `Peer ${root.sessionId.slice(0, 8)}`,
6015
+ name: root.label ?? `Peer ${root.sessionId.slice(0, 8)}`,
6016
+ ...root.label ? { label: root.label } : {},
6012
6017
  kind: "peer",
6013
6018
  status: root.status === "running" ? "running" : "idle",
6014
6019
  runner: "pi",
@@ -6076,6 +6081,46 @@ var ParticipantDirectory = class {
6076
6081
  await this.mesh.delete({ key: entry.key, ifVersion: entry.version }).catch(() => void 0);
6077
6082
  }
6078
6083
  }
6084
+ /**
6085
+ * Mint missing labels for this host's root participants. Labels persist in
6086
+ * the peer's own participant record, so every session computes the same
6087
+ * label and retired numbers are never reused even if a peer record dies.
6088
+ */
6089
+ async #ensurePeerLabels(desired) {
6090
+ if (!this.options.enabled) return;
6091
+ for (const record of desired.values()) {
6092
+ if (record.kind !== "root" || record.id !== this.options.rootId || record.label) continue;
6093
+ const existingEntry = this.mesh.get(keyFor(PARTICIPANT_PREFIX, record.id));
6094
+ const existing = existingEntry ? participantFromEntry(existingEntry) : void 0;
6095
+ if (existing?.label) {
6096
+ record.label = existing.label;
6097
+ continue;
6098
+ }
6099
+ const seq = await this.#claimPeerSeq();
6100
+ if (seq !== void 0) record.label = `${peerLabelPrefix(record.cwd)}-${seq}`;
6101
+ }
6102
+ }
6103
+ /** CAS-claim the next project-wide peer sequence number. ifVersion 0 creates. */
6104
+ async #claimPeerSeq() {
6105
+ for (let attempt = 0; attempt < 8; attempt += 1) {
6106
+ const entry = this.mesh.get(PEER_SEQ_KEY);
6107
+ const current = entry && isObject4(entry.value) && typeof entry.value.next === "number" && Number.isInteger(entry.value.next) && entry.value.next >= 1 ? entry.value.next : 0;
6108
+ try {
6109
+ await this.mesh.put({
6110
+ key: PEER_SEQ_KEY,
6111
+ value: { format: 1, next: current + 1 },
6112
+ identity: this.options.identity,
6113
+ ifVersion: entry?.version ?? 0
6114
+ });
6115
+ return current + 1;
6116
+ } catch (error) {
6117
+ if (!/compare-and-swap/.test(error instanceof Error ? error.message : String(error))) {
6118
+ throw error;
6119
+ }
6120
+ }
6121
+ }
6122
+ return void 0;
6123
+ }
6079
6124
  #legacySessionKey() {
6080
6125
  if (this.options.identity.kind !== "main") return void 0;
6081
6126
  return `sessions/${this.options.identity.sessionId ?? this.options.identity.id}`;
@@ -6186,4 +6231,4 @@ export {
6186
6231
  residentRoot,
6187
6232
  residentDeliveryPrefix
6188
6233
  };
6189
- //# sourceMappingURL=chunk-5PMNF4ON.js.map
6234
+ //# sourceMappingURL=chunk-725BGPJU.js.map