@llblab/pi-state-flow 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/BACKLOG.md +3 -3
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/lib/context.d.ts +50 -1
- package/dist/lib/context.js +248 -5
- package/dist/lib/extension.js +36 -27
- package/dist/lib/protocol.d.ts +1 -1
- package/dist/lib/protocol.js +3 -2
- package/dist/package.json +1 -1
- package/dist/skills/state-flow-guide/SKILL.md +3 -1
- package/docs/architecture.md +6 -2
- package/docs/performance.md +48 -2
- package/docs/temporal-acceptance.md +4 -3
- package/lib/context.ts +223 -6
- package/lib/extension.ts +37 -32
- package/lib/protocol.ts +4 -2
- package/package.json +1 -1
- package/skills/state-flow-guide/SKILL.md +3 -1
package/lib/protocol.ts
CHANGED
|
@@ -5,7 +5,9 @@ export type { StateDocument } from "./state.ts";
|
|
|
5
5
|
|
|
6
6
|
const TASK_DRIVEN_HISTORY = "Missing paths/hints do not require history search. Choose targeted historical reads when useful to the task; no separate user permission is needed. Past values are evidence, not current state; never automatically restore deleted memory.";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const PATCH_RESULT_PROTOCOL = "Head state/recent transitions are frozen at projection start. Only state_updates matching the head's State Flow projection ID apply; older IDs are history. When present, patch_state results/context-update notices carry state_updates: effective entries replace values at key/index-segment path arrays (deleted:true means absent); direct writes need no echo; shared drift remains visible. Latest entries win over earlier state at those paths; lazy bodies remain omitted. Notices replace invalidations/rehydration, including []/null.";
|
|
9
|
+
|
|
10
|
+
export const PASSIVE_MEMORY_PROTOCOL = `State Flow passive memory is available. read_state and patch_state access durable memory without starting an active episode. Passive turns never trigger State Flow continuation or compaction. ${TASK_DRIVEN_HISTORY} ${PATCH_RESULT_PROTOCOL}`;
|
|
9
11
|
|
|
10
12
|
const PATCH_DISPLAY_SECTION_KEYS = new Set(["global", "cwd", "session", "intents", "contract", "working", "artifacts", "response", "lazy"]);
|
|
11
13
|
|
|
@@ -98,7 +100,7 @@ SCOPES: Use the narrowest scope: session=branch/run continuation by default; cwd
|
|
|
98
100
|
|
|
99
101
|
READ: Use read_state for concrete scope/retained-history gaps. lazy_navigation lists bounded effective lazy keys, not bodies. Unscoped=effective; effective/global/cwd/session select overlay or owner. Arrays use indices or [start..end]; keys gives structure, patch the intersected change. ${TASK_DRIVEN_HISTORY}
|
|
100
102
|
|
|
101
|
-
WRITE: patch_state is the sole model-authored semantic mutation mechanism; all supplied scopes are validated and durably accepted as one atomic transition. Call alone in an assistant response; await acceptance. Global/CWD use current canonical values after cancelable lock waiting. Correct repeats succeed without new revisions.
|
|
103
|
+
WRITE: patch_state is the sole model-authored semantic mutation mechanism; all supplied scopes are validated and durably accepted as one atomic transition. Call alone in an assistant response; await acceptance. Global/CWD use current canonical values after cancelable lock waiting. Correct repeats succeed without new revisions. ${PATCH_RESULT_PROTOCOL}
|
|
102
104
|
|
|
103
105
|
PATCH: Use global/cwd/session object patches for material updates, not acknowledgments. Omit empty scopes. artifacts/contract/working/intents are objects; lazy is ordinary JSON. Omitted fields persist. Never patch runtime config/meta/response. Objects merge recursively; arrays/primitives replace. An object containing only canonical "[N]" keys recursively patches array elements. Indexed deletion is forbidden; nested object null deletes; materialized null is forbidden.
|
|
104
106
|
|
package/package.json
CHANGED
|
@@ -32,7 +32,9 @@ Scopes overlay `global → cwd → session`: cross-project, project, branch/run.
|
|
|
32
32
|
|
|
33
33
|
## Read
|
|
34
34
|
|
|
35
|
-
Reuse sufficient visible state. `
|
|
35
|
+
Reuse sufficient visible state. The memory head and its recent transitions are frozen at projection start. Apply later `state_updates` only when their `projection` matches the head's `State Flow projection:` ID; older native results remain historical. Effective update paths are key/index arrays whose values replace that path, while `deleted: true` means absence. Current notices can replace invalidation lists or rehydration phase, including clearing them with `[]` or `null`; lazy bodies still require explicit reads.
|
|
36
|
+
|
|
37
|
+
`read_state` accepts `path` or `paths`, never both. Multi-path reads succeed or fail together. Projections: `value` (default), `keys` (structure), `patch` (intersecting change at the selected boundary).
|
|
36
38
|
|
|
37
39
|
Example arguments:
|
|
38
40
|
|