@llblab/pi-kit 0.10.8 → 0.11.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 (27) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  3. package/node_modules/@llblab/pi-state-flow/AGENTS.md +13 -10
  4. package/node_modules/@llblab/pi-state-flow/BACKLOG.md +15 -1
  5. package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +13 -0
  6. package/node_modules/@llblab/pi-state-flow/README.md +52 -261
  7. package/node_modules/@llblab/pi-state-flow/docs/README.md +5 -1
  8. package/node_modules/@llblab/pi-state-flow/docs/architecture.md +47 -26
  9. package/node_modules/@llblab/pi-state-flow/docs/compatibility.md +97 -0
  10. package/node_modules/@llblab/pi-state-flow/docs/fork-contract.md +47 -0
  11. package/node_modules/@llblab/pi-state-flow/docs/performance.md +459 -0
  12. package/node_modules/@llblab/pi-state-flow/docs/temporal-acceptance.md +35 -3
  13. package/node_modules/@llblab/pi-state-flow/docs/usage.md +134 -0
  14. package/node_modules/@llblab/pi-state-flow/lib/artifact.ts +19 -3
  15. package/node_modules/@llblab/pi-state-flow/lib/compaction.ts +74 -0
  16. package/node_modules/@llblab/pi-state-flow/lib/context.ts +12 -12
  17. package/node_modules/@llblab/pi-state-flow/lib/continuation.ts +4 -2
  18. package/node_modules/@llblab/pi-state-flow/lib/discovery.ts +21 -5
  19. package/node_modules/@llblab/pi-state-flow/lib/extension.ts +146 -37
  20. package/node_modules/@llblab/pi-state-flow/lib/git.ts +142 -42
  21. package/node_modules/@llblab/pi-state-flow/lib/publication.ts +80 -27
  22. package/node_modules/@llblab/pi-state-flow/lib/runtime.ts +109 -7
  23. package/node_modules/@llblab/pi-state-flow/lib/status.ts +7 -12
  24. package/node_modules/@llblab/pi-state-flow/lib/storage.ts +2 -1
  25. package/node_modules/@llblab/pi-state-flow/lib/transition.ts +2 -3
  26. package/node_modules/@llblab/pi-state-flow/package.json +5 -4
  27. package/package.json +2 -2
@@ -57,16 +57,11 @@ export function detailedStatus(snapshot: Snapshot, diagnostics: StatusDiagnostic
57
57
  diagnostics.recent,
58
58
  );
59
59
  const available = diagnostics.temporal !== undefined && diagnostics.durableStateError === undefined;
60
- const materialized = !available ? undefined : {
61
- global: diagnostics.scopeStates.global,
62
- cwd: diagnostics.scopeStates.cwd,
63
- session: diagnostics.scopeStates.session,
64
- effective: overlayStates(
65
- diagnostics.scopeStates.global,
66
- diagnostics.scopeStates.cwd,
67
- diagnostics.scopeStates.session,
68
- ),
69
- };
60
+ const materialized = !available ? undefined : overlayStates(
61
+ diagnostics.scopeStates.global,
62
+ diagnostics.scopeStates.cwd,
63
+ diagnostics.scopeStates.session,
64
+ );
70
65
  const stateJson = materialized === undefined ? undefined : JSON.stringify(materialized, null, 2);
71
66
  const freshnessError = diagnostics.artifactFreshnessError ?? (available ? undefined : "temporal global artifact registry is unavailable");
72
67
  const stale = freshnessError === undefined
@@ -124,7 +119,7 @@ export function detailedStatus(snapshot: Snapshot, diagnostics: StatusDiagnostic
124
119
  `Publication: ${publication}`,
125
120
  ...staleLines,
126
121
  ...(stateJson === undefined
127
- ? ["Materialized states: unavailable (global/CWD/session/effective)"]
128
- : [`Materialized states (${Buffer.byteLength(stateJson, "utf8")} bytes; global/CWD/session Git-backed, effective overlay):`, "", stateJson]),
122
+ ? ["Effective memory: unavailable"]
123
+ : [`Effective memory (${Buffer.byteLength(stateJson, "utf8")} JSON bytes; globalCWD session overlay):`, "", stateJson]),
129
124
  ].join("\n");
130
125
  }
@@ -90,7 +90,8 @@ export function planTemporalPublication(
90
90
  changedScopes.push(scope);
91
91
  }
92
92
  const provenanceUpdates: OwnedFileUpdate[] = [];
93
- if (provenance !== undefined) {
93
+ // Shared provenance belongs to its semantic scopes, not the session config being saved.
94
+ if (!runtimeOnly && provenance !== undefined) {
94
95
  for (const scope of ["global", "cwd"] as const) {
95
96
  const paths = temporalScopePaths(cwd, sessionId, scope, root, sessionKey);
96
97
  const registry = provenance[scope];
@@ -3,6 +3,7 @@ import {
3
3
  ORDINARY_ARTIFACT_COMPILER,
4
4
  validateArtifactMetadata,
5
5
  validateArtifactRegistry,
6
+ validateModelArtifactPatch,
6
7
  type ArtifactCompilerOutput,
7
8
  type ArtifactProvenance,
8
9
  } from "./artifact.ts";
@@ -77,9 +78,6 @@ function compileReadSkills(
77
78
  if (!isObject(output)) {
78
79
  throw new Error(`Every successfully read Skill must have a CWD artifact compiler output at artifacts[exactReadPath]; missing: ${read.path}`);
79
80
  }
80
- if (Object.hasOwn(output, "hash") || Object.hasOwn(output, "compiler")) {
81
- throw new Error(`Skill artifact compiler output at ${read.path} cannot set runtime-owned hash or compiler fields`);
82
- }
83
81
  if (typeof output.description !== "string" || output.description.trim().length === 0) {
84
82
  throw new Error(`Skill artifact compiler output at ${read.path} must have a non-empty description`);
85
83
  }
@@ -133,6 +131,7 @@ function validateScopePatch(scope: unknown, patch: unknown): asserts patch is Sc
133
131
  throw new Error(`Scoped State Flow patch field ${key} must be a JSON object`);
134
132
  }
135
133
  }
134
+ if (isObject(patch.artifacts)) validateModelArtifactPatch(patch.artifacts);
136
135
  }
137
136
 
138
137
  function completePatch(patch: ScopePatch, response: string): StatePatch {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-state-flow",
3
- "version": "0.9.6",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "description": "Incremental scoped state/context compiler for Pi, inspired by SKILL.state",
6
6
  "keywords": [
@@ -30,6 +30,7 @@
30
30
  "scripts": {
31
31
  "check": "node --experimental-strip-types -e \"await import('./index.ts')\"",
32
32
  "test": "node --experimental-strip-types --test tests/*.test.ts",
33
+ "benchmark": "node --experimental-strip-types benchmarks/benchmark.ts",
33
34
  "typecheck": "tsc --noEmit",
34
35
  "validate": "npm run typecheck && npm test && npm run check",
35
36
  "prepack": "npm run validate"
@@ -50,9 +51,9 @@
50
51
  "node": ">=22.19.0"
51
52
  },
52
53
  "peerDependencies": {
53
- "@earendil-works/pi-agent-core": "^0.84.4",
54
- "@earendil-works/pi-ai": "^0.84.4",
55
- "@earendil-works/pi-coding-agent": "^0.84.4"
54
+ "@earendil-works/pi-agent-core": "^0.84.4 || ^0.85.1",
55
+ "@earendil-works/pi-ai": "^0.84.4 || ^0.85.1",
56
+ "@earendil-works/pi-coding-agent": "^0.84.4 || ^0.85.1"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/node": "latest",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-kit",
3
- "version": "0.10.8",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,7 +44,7 @@
44
44
  "@llblab/pi-clean-room": "0.1.1",
45
45
  "@llblab/pi-codex-usage": "0.9.4",
46
46
  "@llblab/pi-grow-loop": "0.8.1",
47
- "@llblab/pi-state-flow": "0.9.6",
47
+ "@llblab/pi-state-flow": "0.10.0",
48
48
  "@llblab/pi-telegram": "0.45.8",
49
49
  "@llblab/skills": "1.15.0"
50
50
  },