@llblab/pi-state-flow 0.4.0 → 0.5.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 +3 -3
- package/BACKLOG.md +7 -3
- package/CHANGELOG.md +10 -1
- package/README.md +11 -3
- package/docs/README.md +1 -3
- package/docs/architecture.md +188 -0
- package/index.ts +148 -93
- package/lib/artifact.ts +28 -0
- package/lib/config.ts +16 -4
- package/lib/context.ts +3 -0
- package/lib/continuation.ts +268 -0
- package/lib/durable.ts +10 -0
- package/lib/extension.ts +140 -19
- package/lib/git.ts +25 -5
- package/lib/history.ts +2 -2
- package/lib/json.ts +24 -0
- package/lib/memory.ts +52 -0
- package/lib/publication.ts +296 -0
- package/lib/rehydration.ts +79 -0
- package/lib/runtime.ts +19 -14
- package/lib/snapshot.ts +12 -1
- package/lib/status.ts +23 -0
- package/lib/storage.ts +4 -4
- package/lib/temporal.ts +3 -3
- package/lib/terminal.ts +6 -0
- package/package.json +5 -1
- package/skills/state-flow-memory/SKILL.md +73 -0
package/AGENTS.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- Correlate successful exact-path reads with the current ordinary global invalidation plan. Require each acquired stale source to have a compact compiler output at the same path in a global transition, reject model-authored hash/compiler fields, and attach the runtime-observed source hash plus current ordinary compiler revision before publication. Compile routing descriptions by default, never raw Markdown or a full-file summary; preserve uncertainty and reserve richer compilations for reusable operational semantics.
|
|
11
11
|
- Apply one materialized-first acquisition policy to every source: read only for a concrete relevant gap not covered by a sufficient compilation, an exact-source operation including edits, evidenced invalidation, contradiction/failure reconciliation, explicit request, or selection by bounded maintenance. New sessions, routine recall or activation, reassurance, and an index or description alone are not reasons to read. Changed hashes require rereading; prefer the smallest sufficient read.
|
|
12
12
|
- Keep artifact maintenance opt-in, low-frequency, and side-effect free until a selected source is acquired. Select only otherwise-fresh artifacts old enough for maintenance, rank missing/unparseable `compiled_at` first then oldest timestamp and path, and enforce strict per-cycle read-count and source-byte ceilings. Treat source bytes as the conservative source-token upper bound. Never let maintenance displace correctness invalidation; use explicit invalidation refresh for full rebuilds and never mutate source files.
|
|
13
|
-
- Load optional agent-level `state-flow.json`
|
|
13
|
+
- Load optional agent-level `state-flow.json` once per extension load/reload. Its `directory` selects the state store, `autoStart` defaults false for genuinely new sessions, and `remotePublication` selects `off`, `turn-end`, or compatibility `transition`. State Flow always owns durable memory while enabled and global semantic memory is always available; these are invariants, not configuration switches. Keep runtime configuration and provenance outside model-patchable semantic state.
|
|
14
14
|
- Keep runtime configuration and provenance separate from model-patchable semantic state. Persist session `config.json` for enablement/projection settings and `meta.json` for lineage, counters, branch identity, durable base, publication, and migration metadata. Neither participates in scope overlay. New Pi checkpoints contain only a durable revision pointer, or `{disabled:true}` when no durable runtime exists on that branch. Preserve exact Git hashes for Git-backed revisions and give file-only current-cohort references an unambiguous distinct identity; file references use `file:<64 lowercase hex>`, bind the store root and complete scoped/runtime cohort, and must not pretend to provide arbitrary cold or branch history. Operationally unavailable references (including expired file cohorts, missing Git, and publication exclusion) retain selection rather than falling through to older disabled markers; malformed immutable targets remain a distinct recovery case; they are not a parallel authoritative semantic or config/meta store. Emit a disabled marker only from proven pre-runtime branch provenance; missing/invalid revisions and failed restoration do not establish that permission. Predecessor checkpoint formats are read-only migration input. Validate immutable pointer targets before acquiring the live publication basis; transient publication failures preserve the selected retry reference rather than choosing older semantic state. In Git mode, runtime `revision: "self"` resolves to the commit owning the config/meta pair, not an unrelated later repository commit. File publication uses explicit `publication: "files"` provenance and resolves the exact complete live cohort instead of claiming a Git owner. Use a distinct `meta.temporalRevision` when a runtime-only write selects older semantic scopes, so stop or lifecycle persistence does not rewind another branch's live files. Persist publication intent as unconfirmed before pushing; reconcile that exact existing commit after restart rather than embedding an impossible self-hash or inventing semantic history.
|
|
15
15
|
- Overlay materialized state recursively in `global → cwd → session` order. Scope-local deletion removes only that scope's key so a lower-scope value becomes visible again; scope never changes instruction authority. Route branch/run-local continuation to session, project-local reusable state and Skill artifacts to CWD, and cross-project reusable state to global.
|
|
16
16
|
- Reserve `state` for the runtime materialized semantic view. For each scope, current state is exactly `materialize(checkpoint.json, patches.jsonl)`: an older anchored checkpoint plus its ordered tail of at most seven materially effective semantic patches. On overflow, apply the oldest patch into the checkpoint, advance its `through` boundary, remove it, and append the new patch. Never truncate unapplied replay records or replay patches over an already-current snapshot.
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
- Keep historical reads lazy through the smallest runtime/model read interface. Normal inference gets only current effective state and useful bounded compact transition context, never eight full snapshots. `patch_state` is the sole semantic mutation tool. `read_state` exposes one cached effective/global/CWD/session projection at offset 0–7, defaulting to effective/0; it returns the exact boundary with semantic state and never publishes, appends a checkpoint, or advances history. Both tools follow branch enablement and host tool restrictions; the patch barrier blocks reader siblings too. Live/cached checkpoint plus tails own the hot path; use Git for branch restoration and explicit cold inspection, not to rebuild current state on every inference.
|
|
20
20
|
- Store runtime state in its own directory with optional Git durability, defaulting to `state-flow/` beneath Pi's configured agent directory (`~/.pi/agent/state-flow/` normally), independently from the Knowledge Markdown source root. Use exactly these owned paths: `checkpoint.json` and `patches.jsonl` for global; `<cwd-key>/checkpoint.json` and `<cwd-key>/patches.jsonl` for CWD; `<cwd-key>/<session-key>/checkpoint.json`, `patches.jsonl`, `config.json`, and `meta.json` for session. Do not create `.state-flow`, `scopes`, or another storage/history namespace. Mirror Pi's native CWD session-directory encoding and JSONL-basename session key (deriving `<header timestamp>_<UUID>` for in-memory sessions), while retaining separately verifiable canonical identity provenance in owned state. Keep the UUID authoritative, reject unsafe segments and mismatches rather than selecting another scope, and use CWD checkpoint ownership to fail closed on Pi-name collisions.
|
|
21
21
|
- Migrate legacy current `state.json` losslessly into an initial anchored checkpoint with an empty tail; current snapshots are the sole semantic recovery basis, independent of the presence or validity of explanatory journals, including historical revision reads. Preserve only proven history, remove obsolete files within the successful scoped migration, and never retain two authoritative formats. Exercise migrations in temporary repositories rather than modifying the user's active Knowledge data during development.
|
|
22
|
-
- Read and write only regular non-symlink State Flow-owned files at those exact paths, publish each file by same-directory atomic rename, preserve arbitrary repository contents, and classify ownership exactly; never use repository-wide staging. Retain opaque source bytes for file identity and rollback, not decoded-text reconstructions. Serialize cooperating Git publications through a common-Git-directory publication lock; low-level file helpers require caller exclusion. Recheck prepared bases before each replacement/deletion and restore only bytes still matching the publisher's own output. Preserve detected concurrent changes and report unresolved rollback conflicts; do not claim kernel-atomic multi-file CAS against nonparticipating writers. Markdown discovery uses its independently configured source root, defaulting to `knowledge/` beneath Pi's agent directory; a storage-root override must not redirect source discovery.
|
|
22
|
+
- Read and write only regular non-symlink State Flow-owned files at those exact paths, publish each file by same-directory atomic rename, preserve arbitrary repository contents, and classify ownership exactly; never use repository-wide staging. Retain opaque source bytes for file identity and rollback, not decoded-text reconstructions. Use validated structural JSON equality for in-process semantic comparisons; reserve cryptographic hashes for compact identities that cross inference, persistence, process, or source-freshness boundaries. Serialize cooperating Git publications through a common-Git-directory publication lock; low-level file helpers require caller exclusion. Recheck prepared bases before each replacement/deletion and restore only bytes still matching the publisher's own output. Preserve detected concurrent changes and report unresolved rollback conflicts; do not claim kernel-atomic multi-file CAS against nonparticipating writers. Markdown discovery uses its independently configured source root, defaulting to `knowledge/` beneath Pi's agent directory; a storage-root override must not redirect source discovery.
|
|
23
23
|
- At instance initialization resolve the repository, CWD key, and session key; load each scope's anchored checkpoint and tail, materialize at the selected temporal boundary, then overlay `global → cwd → session`. Install cached view and publication basis atomically only after successful restoration/initialization; unavailable publication is an error, not a semantic no-op. Preserve the selected revision across transient restore failure so an explicit start can retry it. A genuinely new session gets an empty session layer and inherits only global/CWD values; it must never reuse another same-CWD session layer.
|
|
24
24
|
- Bind every loaded scope and active Pi branch/checkpoint to the corresponding State Flow Git revision. Resume and tree restoration must recover branch-correct runtime config and semantic layers from that revision without blindly importing Git `HEAD`; reading an older revision must use object-level Git reads and never reset or check out the shared repository worktree.
|
|
25
|
-
- Every accepted semantic change, including session-only and response-only changes, atomically updates affected checkpoint/tail pairs and
|
|
25
|
+
- Every accepted semantic change, including session-only and response-only changes, atomically updates affected checkpoint/tail pairs and temporal metadata and creates one immediate local Git commit when Git is available. `remotePublication` is branch runtime policy: `turn-end` queues only the newest accepted target for asynchronous non-interactive push, `off` remains local-only, and `transition` preserves synchronous legacy behavior. Queue state is operational metadata beneath the Git common directory, not semantic history; use exact targets, destination identity, symlink-safe atomic CAS, descendant-only coalescing, cross-process worker leases, restart recovery, and truthful failure diagnostics. Remote failure never rolls back accepted state or regenerates an answer. A repository with no remote is intentionally local-only; only Git executable `ENOENT` authorizes file-only mode.
|
|
26
26
|
- Register `patch_state` as the sole semantic mutation tool. It applies one validated `session`, `cwd`, or `global` semantic patch immediately through temporal folding/publication, records the accepted lineage and durable revision, returns a compact acknowledgement, and makes the next inference receive the new `state[0]`; the previous state becomes `state[1]`. Use it only for established future-relevant state whose delayed materialization creates meaningful loss or recovery risk, never scratchpad, narration, routine progress, or speculative churn.
|
|
27
27
|
- Treat `patch_state` as a strict inference barrier. Give it sequential execution mode, inspect Pi's synchronized current assistant message during tool preflight, require exactly one `patch_state` call in that response, and block every sibling tool call before execution. After success, retain the tool call/result as current-run causality and let the model choose all subsequent actions from rematerialized context.
|
|
28
28
|
- Require exactly one terminal reconciliation after zero or more intermediate barriers in every successful enabled run. Accept a non-empty ordinary terminal answer without a State Flow comment as an empty model patch: preserve `artifacts`, `contract`, and `working`, replace session `response`, and persist that session semantic change through the same Git lifecycle. Explicit comment markers (including malformed or embedded ones) must not silently fall back to ordinary text. When a patch is present, require one top-level transcript-private `<!-- state_flow … -->` comment containing exactly a `transitions` array, one separating blank line, then the user-facing answer exactly once. Each transition must contain one unique known `scope` and an object `patch` limited to `artifacts`, `contract`, and `working`; reject model-authored `response`, runtime `config`, or provenance. Retain pre-scoped three-field envelopes only as session compatibility shorthand. At `message_end`, remove the comment and stage every affected scope against semantic hashes and the actual active causal-boundary identity, so equal values cannot authorize crossing to another lineage; at `turn_end`, reconcile session `response` with Pi's finalized assistant message after all chained handlers, atomically publish every affected checkpoint/tail pair and temporal metadata in one commit, and record its revision in the branch checkpoint. Do not write materially unchanged non-session scopes. Route missing text or a tool call added after terminal validation through the same bounded regeneration chain. Transcript-private does not mean confidential during streaming.
|
package/BACKLOG.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# BACKLOG
|
|
2
2
|
|
|
3
|
-
Canonical open work for **pi-state-flow**. [README.md](README.md) explains setup and behavior; [AGENTS.md](AGENTS.md) governs implementation.
|
|
3
|
+
Canonical open work for **pi-state-flow**. [README.md](README.md) explains setup and behavior; [AGENTS.md](AGENTS.md) governs implementation; [CHANGELOG.md](CHANGELOG.md) records completed delivery.
|
|
4
4
|
|
|
5
5
|
## Open work
|
|
6
6
|
|
|
7
|
-
No open work remains
|
|
7
|
+
No open implementation work remains for **0.5.0**.
|
|
8
|
+
|
|
9
|
+
## Deferred host integration
|
|
10
|
+
|
|
11
|
+
- [ ] **Native default session continuation:** Integrate the existing read-only recommendation, exact session selection, and knowledge-bootstrap contracts into Pi before `SessionManager` creation while preserving explicit new/resume precedence, truthful notices, and cross-process session ownership. Blocked on a Pi pre-session resolver hook: Pi 0.84.4 selects or creates `SessionManager` before package resources and extensions load, so `pi-state-flow` cannot safely alter native CLI startup by itself. The [architecture guide](docs/architecture.md#session-continuation) records the host boundary and executable extension-side prerequisites.
|
|
8
12
|
|
|
9
13
|
## Boundaries
|
|
10
14
|
|
|
11
|
-
- Preserve unrelated repository work;
|
|
15
|
+
- Preserve unrelated repository work; commits, publication, tags, and release actions require explicit release-flow gates.
|
|
12
16
|
- Exercise migrations and backend adoption in temporary repositories, not production Knowledge or state data.
|
|
13
17
|
- File-only mode retains current/hot state, not arbitrary cold branches; unavailable exact references never authorize substituting current files for selected history.
|
|
14
18
|
- Changing the configured directory selects a store; it does not automatically migrate previous files or Git history.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.5.0: Durable memory, compiled routing, and local-first publication
|
|
4
|
+
|
|
5
|
+
- Decoupled immediate local Git acceptance from optional remote replication with persisted `off`/`turn-end`/legacy `transition` policy, a symlink-safe CAS queue, descendant-only coalescing, asynchronous non-interactive workers, restart recovery, concurrency-safe confirmation, and truthful status diagnostics.
|
|
6
|
+
- Made State Flow the unconditional durable-memory owner while enabled, with global semantic memory always available at the narrowest correct scope; external promotion pointers remain optional semantic handoff records rather than runtime ownership configuration.
|
|
7
|
+
- Added extensible compiled artifact metadata, validated tags, deterministic candidate routing, and bounded visible source rehydration without persisting source bodies or treating routing as read authorization.
|
|
8
|
+
- Added read-only native-session discovery, exact State Flow provenance checks, deterministic continuation ranking, and bootstrap planning while keeping automatic default resume deferred until Pi exposes a pre-session resolver hook.
|
|
9
|
+
- Unified Pi's session UUID and native storage key as one runtime address, centralized extension runtime construction, and skipped obsolete hashed-path probing once canonical CWD materialization is proven.
|
|
10
|
+
- Replaced transient semantic-equality SHA-256 calculations with validated structural JSON comparison while retaining cryptographic hashes for durable identity, freshness, integrity, CAS, and fingerprints.
|
|
11
|
+
- Restored the empty-line boundary between the `patch_state` tool call and its materialization result in Pi and Telegram transcript rendering.
|
|
12
|
+
- Bundled the optional `state-flow-memory` Skill for explicit bounded audits, scope narrowing, contradiction cleanup, and evidence-gated external handoff without background maintenance.
|
|
4
13
|
|
|
5
14
|
## 0.4.0: Temporal state and independent durable storage
|
|
6
15
|
|
package/README.md
CHANGED
|
@@ -37,12 +37,14 @@ Optional `~/.pi/agent/state-flow.json` (or `state-flow.json` beneath `PI_CODING_
|
|
|
37
37
|
```json
|
|
38
38
|
{
|
|
39
39
|
"directory": "~/.pi/agent/state-flow",
|
|
40
|
-
"autoStart": false
|
|
40
|
+
"autoStart": false,
|
|
41
|
+
"remotePublication": "turn-end"
|
|
41
42
|
}
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
- `directory`: State storage location; omitted defaults to `state-flow/` beneath Pi's agent directory. Absolute paths, `~`/`~/` and relative paths are supported; relative paths resolve from the configuration directory, not the project CWD.
|
|
45
46
|
- `autoStart`: Set to `true` to enable State Flow automatically for genuinely new sessions, including fresh CWDs. Omitted defaults to `false`: manual activation, even when previous CWD materialization exists.
|
|
47
|
+
- `remotePublication`: For new runtimes, `turn-end` (default) queues one newest target after local acceptance and pushes asynchronously; `off` keeps commits local; `transition` preserves legacy synchronous push behavior. A resumed branch keeps its persisted policy.
|
|
46
48
|
|
|
47
49
|
Configuration is read at extension load; edit it and use `/reload` (or restart Pi) before opening a new session. Existing branches retain their stored enablement on resume/tree navigation. `/state-flow-stop` does not rewrite this file or disable automatic mode for later new sessions. Invalid JSON, unknown keys or invalid values fail extension loading rather than silently choosing another directory. A missing file uses defaults and is not generated automatically.
|
|
48
50
|
|
|
@@ -229,7 +231,7 @@ Artifacts use exact source paths as keys. Minimum metadata is:
|
|
|
229
231
|
{"description":"What this source contains and when it is useful","hash":"sha256:<64 lowercase hex characters>","compiler":"artifact-v1"}
|
|
230
232
|
```
|
|
231
233
|
|
|
232
|
-
Descriptions and compiler revisions are non-empty; hashes are canonical lowercase SHA-256. Optional `kind`, `compiled_at`, and `
|
|
234
|
+
Descriptions and compiler revisions are non-empty; hashes are canonical lowercase SHA-256. Optional `kind`, `compiled_at`, `compilation`, and `tags` are validated when present, while arbitrary unknown finite non-null JSON metadata remains forward-compatible. Tags are unique non-empty trimmed strings; `selectArtifactsByTags` provides deterministic all/any candidate filtering, but a tag match never authorizes source acquisition. Ordinary artifacts need no `kind` or tags. Hash plus compiler revision determines freshness, not `compiled_at`.
|
|
233
235
|
|
|
234
236
|
Session initialization generically discovers regular lowercase `*.md` beneath the independent canonical Knowledge source root, normally `~/.pi/agent/knowledge` (or `knowledge/` beneath the agent directory selected by `PI_CODING_AGENT_DIR`). This source directory need not be a Git repository. Discovery hashes opaque bytes and retains byte counts without decoding or storing bodies; it skips symlinks and never escapes the root. A missing root means no candidates. Root and nested Markdown are treated alike, without reserved names, frontmatter parsing, validators, templates, or a `save_knowledge` implementation/call. Arbitrary repository files remain independent from State Flow.
|
|
235
237
|
|
|
@@ -239,7 +241,7 @@ Default compilation is a compact routing description, not raw Markdown or a full
|
|
|
239
241
|
|
|
240
242
|
### Materialized-first policy
|
|
241
243
|
|
|
242
|
-
Read a source only for a concrete relevant gap not covered by sufficient compilation, an exact-source operation including edits, evidenced invalidation, contradiction/failure reconciliation, explicit request, or bounded maintenance selection. New sessions, routine recall/activation, reassurance, and a description/index alone are not reasons to reread. Changed hashes require reacquisition; prefer the smallest sufficient read. Semantic sufficiency is caller-assessed, not proven by the existence of a compilation field.
|
|
244
|
+
Read a source only for a concrete relevant gap not covered by sufficient compilation, an exact-source operation including edits, evidenced invalidation, contradiction/failure reconciliation, explicit request, or bounded maintenance selection. The explicit rehydration planner binds scope, path, candidate hash, and reason, then reuses Pi's visible native `read`; State Flow does not register a duplicate artifact-reading tool. New sessions, routine recall/activation, reassurance, and a description/index alone are not reasons to reread. Changed hashes require reacquisition; prefer the smallest sufficient read. Semantic sufficiency is caller-assessed, not proven by the existence of a compilation field.
|
|
243
245
|
|
|
244
246
|
Optional `planArtifactMaintenance` selects only otherwise-fresh old artifacts, ranking missing/unparseable timestamps first, then oldest `compiled_at` and path. Defaults admit at most one source and 16 KiB after 30 days. Strict count/byte ceilings can be zero; source bytes conservatively bound tokenizer input. The planner never reads, compiles, or modifies sources. Correctness invalidation takes precedence; explicit full refresh is separate from maintenance budgets and never an automatic startup rebuild.
|
|
245
247
|
|
|
@@ -249,6 +251,12 @@ Every successful `SKILL.md` read requires CWD compiler output at the exact execu
|
|
|
249
251
|
|
|
250
252
|
Correlation follows finalized mutable `tool_call` arguments with execution-start compatibility fallback. Legacy `contract.compiled_skills` entries migrate into artifacts, preserving behavior and marking unavailable-source fallback hashes unverified. New patches cannot recreate the retired store.
|
|
251
253
|
|
|
254
|
+
### Optional memory curation
|
|
255
|
+
|
|
256
|
+
The package includes the progressively disclosed `state-flow-memory` Skill for explicit audits, contradiction cleanup, scope narrowing, stale continuation review, and ownership migration. It is not part of routine retention and never runs as background maintenance. The Skill reads only required state projections, preserves uncertainty, verifies changed scopes, and treats external promotion as a two-phase handoff that cannot delete the only accepted copy without destination evidence. State Flow remains the memory owner and global memory remains available throughout.
|
|
257
|
+
|
|
258
|
+
External handoffs may use the generic global `working.memory_promotions` map. Each entry requires `status` (`pending`, `accepted`, `failed`, or `unknown`) and a non-empty `owner`; accepted entries additionally require an exact destination `pointer` and `revision`. Other fields remain forward-compatible and destination-specific. This bookkeeping does not replace the retained candidate: failures and uncertainty keep the accepted State Flow body plus exact continuation, while proven acceptance may remove the duplicate body and retain the compact pointer record. `/state-flow-status` reports owner mode, fallback activation, memory-bearing scopes, promotion counts, and bounded pointer/error details; malformed or incompletely evidenced accepted records appear as invalid rather than accepted.
|
|
259
|
+
|
|
252
260
|
## Handoff quality and external reality
|
|
253
261
|
|
|
254
262
|
A terminal handoff is decision-relevant memory, not narration. Preserve active constraints, unresolved questions, consequential negative results, and the next discriminating check before compression. Keep user requirements, observations, assistant decisions, and hypotheses distinct. Retain useful source locators, validity conditions, rejection reasons, and reconsideration conditions. Reconcile contradictions with evidence or user clarification; preserve unresolved conflicts as uncertain.
|
package/docs/README.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
# State Flow documentation
|
|
2
2
|
|
|
3
|
+
- [Architecture](architecture.md): Semantic state, temporal algebra, Pi lifecycle, storage, optional Git, asynchronous publication, artifact routing, durable memory, and session-continuation boundaries.
|
|
3
4
|
- [Temporal acceptance](temporal-acceptance.md): The twenty required temporal properties and their executable witnesses.
|
|
4
|
-
- [Package guide](../README.md): Installation, state model, runtime controls, storage, and development.
|
|
5
|
-
|
|
6
|
-
Open work belongs only in [BACKLOG.md](../BACKLOG.md); these documents describe contracts and evidence routes.
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# State Flow architecture
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
State Flow is a Pi extension that materializes compact, scoped semantic state across agent runs while preserving Pi's native session trace and tool loop. It is inspired by SKILL.state but uses its own temporal model, storage plane, artifact compiler, and publication lifecycle.
|
|
6
|
+
|
|
7
|
+
The extension owns durable memory while enabled. Global semantic memory is always available; there are no ownership or global-memory feature switches.
|
|
8
|
+
|
|
9
|
+
## Composition
|
|
10
|
+
|
|
11
|
+
`index.ts` is the public export and extension composition boundary. Independent modules under `lib/` own one concern each and are mirrored by tests:
|
|
12
|
+
|
|
13
|
+
- `state`, `json`: semantic shape, validation, recursive overlay and deletion.
|
|
14
|
+
- `temporal`, `history`: causal boundaries, checkpoint/tail folding and hot history.
|
|
15
|
+
- `durable`, `storage`, `git`: exact files, CAS publication, Git commits and restoration.
|
|
16
|
+
- `snapshot`, `session`, `runtime`, `recovery`, `episode`: Pi branch/runtime lifecycle.
|
|
17
|
+
- `transition`, `terminal`, `validation`, `context`: inference barriers and final reconciliation.
|
|
18
|
+
- `artifact`, `acquisition`, `maintenance`, `skills`, `rehydration`: source routing and compilation.
|
|
19
|
+
- `memory`: external promotion records and memory diagnostics.
|
|
20
|
+
- `continuation`: native-header discovery, runtime-provenance inspection, deterministic recommendation, and host startup precedence.
|
|
21
|
+
- `publication`: remote policy, durable CAS queue/store, cross-process leases, and asynchronous worker lifecycle.
|
|
22
|
+
- `status`, `extension`: operator projection and Pi adapter wiring.
|
|
23
|
+
|
|
24
|
+
## Semantic state
|
|
25
|
+
|
|
26
|
+
Every materialized scope has exactly this shape:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"artifacts": {},
|
|
31
|
+
"contract": {},
|
|
32
|
+
"working": {},
|
|
33
|
+
"response": ""
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `artifacts` maps exact source paths to compiled routing metadata.
|
|
38
|
+
- `contract` retains durable requirements, decisions, interfaces and rejected approaches.
|
|
39
|
+
- `working` retains verified current facts, unresolved work and exact continuation.
|
|
40
|
+
- `response` is the latest complete user-facing answer for the session scope.
|
|
41
|
+
|
|
42
|
+
Effective state recursively overlays:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
global → CWD → session
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Later scopes win. A scope-local `null` deletion removes only that scope's key and may reveal an inherited value. Scope represents applicability and ownership, never instruction authority.
|
|
49
|
+
|
|
50
|
+
State Flow is the memory owner while enabled. Cross-project/user/environment knowledge belongs in global state, project-only knowledge in CWD, and branch/run continuation in session. Global availability does not authorize retaining secrets, raw history, speculation or transient progress.
|
|
51
|
+
|
|
52
|
+
## Temporal model
|
|
53
|
+
|
|
54
|
+
All scopes participate in one active causal lineage. One accepted semantic transition receives one opaque identity shared by every changed scope. Sparse transitions do not create records for unchanged scopes.
|
|
55
|
+
|
|
56
|
+
Each scope stores:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
checkpoint.json + patches.jsonl
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The checkpoint is an older anchored materialization. The tail contains at most seven effective patches. On overflow, the oldest tail patch folds into the checkpoint before the new patch is appended.
|
|
63
|
+
|
|
64
|
+
`state[n]`, `state.global[n]`, `state.cwd[n]` and `state.session[n]` resolve the same nth previous causal boundary. They are not independent per-scope patch counters. Pre-origin history is unavailable rather than empty.
|
|
65
|
+
|
|
66
|
+
True semantic no-ops create no identity, commit or history step. A changed finalized response is semantic state and advances history.
|
|
67
|
+
|
|
68
|
+
## Pi lifecycle
|
|
69
|
+
|
|
70
|
+
`patch_state` is the sole mutation tool. It validates and publishes one scope patch immediately, then acts as an inference barrier. Pi executes no sibling tools from the same assistant response; the next inference sees rematerialized `state[0]`.
|
|
71
|
+
|
|
72
|
+
`read_state` reads one cached effective or scoped projection at offsets zero through seven. It never publishes or advances history.
|
|
73
|
+
|
|
74
|
+
Every successful enabled run ends with terminal reconciliation. A private `state_flow` comment may provide multi-scope transitions, followed by one blank line and the visible answer. An ordinary answer means an empty model patch but still updates session `response` when changed. Pi's finalized message at `turn_end` is authoritative for response reconciliation.
|
|
75
|
+
|
|
76
|
+
The current user specification stays at user authority and appears only in synthetic user runtime context. State is fallible assistant-produced data. Completed trajectories leave model context at user-run boundaries, while Pi's full JSONL trace remains inspectable.
|
|
77
|
+
|
|
78
|
+
## Storage and identity
|
|
79
|
+
|
|
80
|
+
The default store is `<agentDir>/state-flow`, independent from Markdown discovery at `<agentDir>/knowledge`.
|
|
81
|
+
|
|
82
|
+
Owned paths are:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
checkpoint.json
|
|
86
|
+
patches.jsonl
|
|
87
|
+
<cwd-key>/checkpoint.json
|
|
88
|
+
<cwd-key>/patches.jsonl
|
|
89
|
+
<cwd-key>/<session-key>/checkpoint.json
|
|
90
|
+
<cwd-key>/<session-key>/patches.jsonl
|
|
91
|
+
<cwd-key>/<session-key>/config.json
|
|
92
|
+
<cwd-key>/<session-key>/meta.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
CWD and session keys mirror Pi's native encoding. The Pi UUID remains authoritative; readable directory keys never replace identity validation.
|
|
96
|
+
|
|
97
|
+
`config.json` owns branch runtime behavior. `meta.json` owns lineage, counters, identity, publication provenance and remote-publication policy. Pi checkpoints retain only an exact Git revision, an exact `file:<hash>` cohort reference, or a proven ordinary-disabled marker.
|
|
98
|
+
|
|
99
|
+
All owned writes use same-directory atomic replacement, regular-file and symlink checks, prepared byte receipts and CAS validation. Unrelated files, staging and concurrent bytes are preserved. Rollback restores only bytes still matching the failed publisher's output.
|
|
100
|
+
|
|
101
|
+
## Optional Git
|
|
102
|
+
|
|
103
|
+
If Git is unavailable specifically through executable `ENOENT`, State Flow uses file-only persistence. File mode retains exact current materialization and proven hot history but offers no arbitrary cold revisions.
|
|
104
|
+
|
|
105
|
+
With Git, each effective semantic cohort creates one local commit immediately through an isolated index. Git supplies cold history and exact branch restoration. Runtime `revision: "self"` resolves to the commit that owns the runtime record, never arbitrary `HEAD`. Runtime-only writes may use `temporalRevision` to select older semantic streams without rewinding live shared files.
|
|
106
|
+
|
|
107
|
+
Installing Git over a file-only store adopts the exact current cohort without fabricating earlier history. Legacy layouts remain read-only historical inputs until explicitly migrated.
|
|
108
|
+
|
|
109
|
+
## Remote publication
|
|
110
|
+
|
|
111
|
+
Local acceptance and remote replication are separate.
|
|
112
|
+
|
|
113
|
+
The persisted `remotePublication` policy is:
|
|
114
|
+
|
|
115
|
+
- `turn-end`: default for new runtimes; local commits are immediate and the newest turn target is queued.
|
|
116
|
+
- `off`: local commits only.
|
|
117
|
+
- `transition`: synchronous compatibility behavior for legacy runtimes.
|
|
118
|
+
|
|
119
|
+
A destination is identified by canonical Git common directory, remote and full ref. Queue files live beneath the Git common directory and are not semantic history.
|
|
120
|
+
|
|
121
|
+
The queue uses exact commit targets, strict versioned JSON, symlink-safe atomic writes, CAS receipts and exclusive writer locks. A proven descendant may supersede an older target; divergent targets and changed destinations fail closed.
|
|
122
|
+
|
|
123
|
+
After terminal acceptance, an asynchronous non-interactive worker pushes the newest target. Queue failure never rolls back semantic state or regenerates an answer. Failed and interrupted attempts remain retryable across restart. Destination-scoped worker leases prevent cross-process overlap, preserve live owners, recover proven-dead owners and use exact release tokens. Confirmation removes only the exact completed target; a newer descendant remains queued.
|
|
124
|
+
|
|
125
|
+
## Artifact routing
|
|
126
|
+
|
|
127
|
+
Markdown discovery recursively finds regular lowercase `*.md` beneath the configured Knowledge root, rejects symlinks, hashes opaque bytes and never injects source bodies.
|
|
128
|
+
|
|
129
|
+
Artifact metadata requires:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"description": "routing summary",
|
|
134
|
+
"hash": "sha256:<source bytes>",
|
|
135
|
+
"compiler": "artifact-v1"
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Compiler output may add arbitrary finite non-null JSON metadata. Known optional fields include `kind`, `compiled_at`, `tags` and `compilation`. Tags are unique trimmed non-empty strings and support deterministic candidate filtering, but never authorize reading.
|
|
140
|
+
|
|
141
|
+
Freshness depends on source hash and compiler revision. New, changed, compiler-stale, malformed or explicitly refreshed sources become invalidations. Exact successful native Pi reads are correlated with current candidates; stale reads require same-path compiler output before trusted hash/compiler metadata is attached.
|
|
142
|
+
|
|
143
|
+
Compilation is routing, not a substitute for source text. Full source is read only for a concrete unresolved gap, exact source/edit operation, invalidation, contradiction/failure, explicit request or bounded maintenance. The rehydration planner supports new-bootstrap, resume-bootstrap and later-step phases while limiting read count and source bytes without performing hidden I/O.
|
|
144
|
+
|
|
145
|
+
Skills are CWD artifacts with stricter compilation: `kind: "skill"` and a non-empty compilation describing applicability, constraints and failure conditions. Their source bodies do not persist in state.
|
|
146
|
+
|
|
147
|
+
## Memory curation and promotion
|
|
148
|
+
|
|
149
|
+
The optional packaged `state-flow-memory` Skill performs bounded explicit audits, scope narrowing, contradiction cleanup and external handoffs. It is not part of ordinary retention or background maintenance.
|
|
150
|
+
|
|
151
|
+
External promotion remains a semantic two-phase handoff, not a memory-owner mode. Optional global `working.memory_promotions` entries record `pending`, `accepted`, `failed` or `unknown` status plus owner. Accepted records additionally require destination pointer and revision. Failed or uncertain promotion preserves the State Flow candidate; the only accepted copy is never deleted.
|
|
152
|
+
|
|
153
|
+
## Session continuation
|
|
154
|
+
|
|
155
|
+
The package exposes read-only host contracts that:
|
|
156
|
+
|
|
157
|
+
- read only native JSONL headers, never transcript bodies;
|
|
158
|
+
- inspect exact file/Git State Flow runtime provenance without mutation;
|
|
159
|
+
- rank exact profile, CWD, Git common-directory, worktree, branch and transport identity;
|
|
160
|
+
- fail closed for stopped, malformed, unavailable or ambiguous candidates;
|
|
161
|
+
- preserve explicit new/resume and native picker precedence;
|
|
162
|
+
- project new-bootstrap, resume-bootstrap and later-step rehydration phases.
|
|
163
|
+
|
|
164
|
+
Pi 0.84.4 chooses or creates `SessionManager` before package resources and extensions load. Therefore native default auto-resume cannot be installed safely by this extension alone. The remaining host integration requires an upstream pre-session resolver hook or an SDK/launcher that invokes the advisory resolver before constructing the session.
|
|
165
|
+
|
|
166
|
+
## Configuration
|
|
167
|
+
|
|
168
|
+
`state-flow.json` is loaded once per extension load/reload:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"directory": "~/.pi/agent/state-flow",
|
|
173
|
+
"autoStart": false,
|
|
174
|
+
"remotePublication": "turn-end"
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Unknown keys fail loading. State Flow memory ownership and global availability are fixed invariants and have no configuration options.
|
|
179
|
+
|
|
180
|
+
## Observability
|
|
181
|
+
|
|
182
|
+
`/state-flow-status` reports branch mode, runtime revision, temporal head/history depth, scope keys, patch tails, artifact freshness, memory-bearing scopes, external-promotion summaries, remote policy/queue state, pending publication and terminal retry state. Unavailable materialization is reported as unavailable, never fabricated as empty. Artifact source bodies are not read for status.
|
|
183
|
+
|
|
184
|
+
## Validation boundaries
|
|
185
|
+
|
|
186
|
+
Structural validation proves JSON shape, exact identity, causal lineage, freshness, CAS and publication invariants. It cannot prove semantic importance, truth, sufficient compilation or correct scope; those remain model protocol obligations checked through behavioral fixtures.
|
|
187
|
+
|
|
188
|
+
The executable temporal requirement map is in [temporal-acceptance.md](temporal-acceptance.md). Canonical remaining work is in [BACKLOG.md](../BACKLOG.md), and shipped outcomes belong in [CHANGELOG.md](../CHANGELOG.md).
|
package/index.ts
CHANGED
|
@@ -1,111 +1,166 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
ArtifactReadTracker,
|
|
3
|
+
decideArtifactAcquisition,
|
|
4
|
+
type ArtifactAcquisitionDecision,
|
|
5
|
+
type ArtifactAcquisitionIntent,
|
|
6
|
+
type ArtifactAcquisitionOptions,
|
|
7
|
+
type ArtifactAcquisitionReason,
|
|
8
|
+
type SuccessfulArtifactRead
|
|
9
9
|
} from "./lib/acquisition.ts";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
classifyArtifactFreshness,
|
|
12
|
+
hashArtifactSource,
|
|
13
|
+
isArtifactHash,
|
|
14
|
+
isArtifactMetadata,
|
|
15
|
+
isArtifactRegistry,
|
|
16
|
+
ORDINARY_ARTIFACT_COMPILER,
|
|
17
|
+
planArtifactInvalidation,
|
|
18
|
+
selectArtifactsByTags,
|
|
19
|
+
updateArtifactRegistry,
|
|
20
|
+
validateArtifactMetadata,
|
|
21
|
+
validateArtifactRegistry,
|
|
22
|
+
type ArtifactCompilationUpdate,
|
|
23
|
+
type ArtifactCompilerOutput,
|
|
24
|
+
type ArtifactFreshness,
|
|
25
|
+
type ArtifactInvalidationOptions,
|
|
26
|
+
type ArtifactInvalidationPlan,
|
|
27
|
+
type ArtifactInvalidationReason,
|
|
28
|
+
type ArtifactInvalidationRequest,
|
|
29
|
+
type ArtifactMetadata,
|
|
30
|
+
type ArtifactRegistry,
|
|
31
|
+
type ArtifactSourceIdentity
|
|
31
32
|
} from "./lib/artifact.ts";
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
buildContinuationCandidates,
|
|
35
|
+
discoverNativeSessionHeaders,
|
|
36
|
+
inspectStateFlowContinuationProvenance,
|
|
37
|
+
readNativeSessionHeader,
|
|
38
|
+
recommendContinuationFromProvenance,
|
|
39
|
+
resolveContinuationStartup,
|
|
40
|
+
type ContinuationCandidateProvenance,
|
|
41
|
+
type ContinuationCandidateSummary,
|
|
42
|
+
type ContinuationHostContext,
|
|
43
|
+
type ContinuationHostIntent,
|
|
44
|
+
type ContinuationProjectIdentity,
|
|
45
|
+
type ContinuationRecommendation,
|
|
46
|
+
type ContinuationRecommender,
|
|
47
|
+
type ContinuationSessionCandidate,
|
|
48
|
+
type ContinuationStartupDecision,
|
|
49
|
+
type ContinuationTransport,
|
|
50
|
+
type NativeSessionHeader
|
|
51
|
+
} from "./lib/continuation.ts";
|
|
39
52
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type ArtifactMaintenanceRequest,
|
|
47
|
-
} from "./lib/maintenance.ts";
|
|
53
|
+
discoverGlobalMarkdownSources,
|
|
54
|
+
getKnowledgeRoot,
|
|
55
|
+
GlobalMarkdownDiscovery,
|
|
56
|
+
type ArtifactSourceCandidate,
|
|
57
|
+
type GlobalMarkdownDiscoveryResult
|
|
58
|
+
} from "./lib/discovery.ts";
|
|
48
59
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
sessionRuntimePaths,
|
|
59
|
-
temporalScopePaths,
|
|
60
|
-
temporalStateFileUpdates,
|
|
61
|
-
type TemporalScopePaths,
|
|
62
|
-
type ScopeStreamSources,
|
|
60
|
+
captureTemporalFileBases,
|
|
61
|
+
cwdScopeKey,
|
|
62
|
+
getDurableRepositoryRoot,
|
|
63
|
+
isStateFlowOwnedPath,
|
|
64
|
+
loadScopeStream,
|
|
65
|
+
parseScopeStream,
|
|
66
|
+
serializeScopeStream, sessionRuntimePaths, sessionScopeKey,
|
|
67
|
+
sessionStorageKey, temporalScopePaths,
|
|
68
|
+
temporalStateFileUpdates, type ScopeStreamSources, type TemporalScopePaths
|
|
63
69
|
} from "./lib/durable.ts";
|
|
70
|
+
export { default, PATCH_STATE_TOOL_NAME, READ_STATE_TOOL_NAME, type StateFlowExtensionOptions } from "./lib/extension.ts";
|
|
64
71
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
captureTemporalGitBase,
|
|
73
|
+
isGitCommitAncestor,
|
|
74
|
+
loadTemporalRevision,
|
|
75
|
+
migrateLegacyStorageToGit,
|
|
76
|
+
publishTemporalStateToGit,
|
|
77
|
+
pushGitCommit,
|
|
78
|
+
resolveGitPushDestination, type GitPushResult, type TemporalGitBase,
|
|
79
|
+
type TemporalRevisionLoad
|
|
73
80
|
} from "./lib/git.ts";
|
|
74
81
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type RecentTransitionWindow,
|
|
82
|
-
type AcceptedTransition,
|
|
82
|
+
createAcceptedTransition,
|
|
83
|
+
projectRecentTransitionsWithLimit,
|
|
84
|
+
RECENT_TRANSITION_LIMIT,
|
|
85
|
+
validateRecentTransition, type AcceptedTransition, type RecentScopePatch,
|
|
86
|
+
type RecentTransition,
|
|
87
|
+
type RecentTransitionWindow
|
|
83
88
|
} from "./lib/history.ts";
|
|
84
89
|
export { applyPatch, canonicalJson, hashJson, isObject, validatePatch } from "./lib/json.ts";
|
|
85
90
|
export type { JsonObject, JsonValue } from "./lib/json.ts";
|
|
86
91
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
type ScopedStates,
|
|
96
|
-
type SemanticTransition,
|
|
97
|
-
type StateDocument,
|
|
98
|
-
type StatePatch,
|
|
99
|
-
type StateScope,
|
|
100
|
-
type TerminalTransition,
|
|
101
|
-
} from "./lib/state.ts";
|
|
92
|
+
DEFAULT_ARTIFACT_MAINTENANCE_MAX_READS,
|
|
93
|
+
DEFAULT_ARTIFACT_MAINTENANCE_MAX_SOURCE_BYTES,
|
|
94
|
+
DEFAULT_ARTIFACT_MAINTENANCE_MINIMUM_AGE_MS,
|
|
95
|
+
planArtifactMaintenance,
|
|
96
|
+
type ArtifactMaintenanceOptions,
|
|
97
|
+
type ArtifactMaintenancePlan,
|
|
98
|
+
type ArtifactMaintenanceRequest
|
|
99
|
+
} from "./lib/maintenance.ts";
|
|
102
100
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
inspectMemoryPromotions, MEMORY_PROMOTION_STATUSES, MEMORY_PROMOTIONS_KEY, retainedMemoryScopes,
|
|
102
|
+
type MemoryPromotionDiagnostic,
|
|
103
|
+
type MemoryPromotionStatus
|
|
104
|
+
} from "./lib/memory.ts";
|
|
105
|
+
export {
|
|
106
|
+
acquirePublicationWorkerLease,
|
|
107
|
+
beginPublicationAttempt,
|
|
108
|
+
coalescePublicationTarget,
|
|
109
|
+
confirmPublicationTarget,
|
|
110
|
+
createPublicationQueue,
|
|
111
|
+
failPublicationAttempt,
|
|
112
|
+
loadPublicationQueue,
|
|
113
|
+
parsePublicationQueue,
|
|
114
|
+
parseRemotePublicationPolicyDocument,
|
|
115
|
+
publicationQueuePath,
|
|
116
|
+
recoverPublicationQueue,
|
|
117
|
+
remotePublicationDestinationKey,
|
|
118
|
+
removePublicationQueue,
|
|
119
|
+
resolveRemotePublicationPolicy,
|
|
120
|
+
runPublicationWorker,
|
|
121
|
+
savePublicationQueue,
|
|
122
|
+
serializePublicationQueue,
|
|
123
|
+
serializeRemotePublicationPolicyDocument,
|
|
124
|
+
validatePublicationQueue,
|
|
125
|
+
type CommitAncestor,
|
|
126
|
+
type PublicationPush,
|
|
127
|
+
type PublicationQueueReceipt,
|
|
128
|
+
type PublicationQueueState,
|
|
129
|
+
type PublicationQueueStatus,
|
|
130
|
+
type PublicationWorkerLease,
|
|
131
|
+
type PublicationWorkerResult,
|
|
132
|
+
type RemotePublicationDestination,
|
|
133
|
+
type RemotePublicationMode,
|
|
134
|
+
type RemotePublicationPolicy,
|
|
135
|
+
type RemotePublicationPolicyDocument
|
|
136
|
+
} from "./lib/publication.ts";
|
|
137
|
+
export {
|
|
138
|
+
planKnowledgeRehydration,
|
|
139
|
+
type RehydrationOptions,
|
|
140
|
+
type RehydrationPhase,
|
|
141
|
+
type RehydrationPlan,
|
|
142
|
+
type RehydrationRead,
|
|
143
|
+
type RehydrationRoute
|
|
144
|
+
} from "./lib/rehydration.ts";
|
|
110
145
|
export { TemporalRuntime } from "./lib/runtime.ts";
|
|
146
|
+
export {
|
|
147
|
+
hasCompiledSkillArtifact,
|
|
148
|
+
hashSkillSource,
|
|
149
|
+
migrateLegacySkillCompilations,
|
|
150
|
+
SKILL_ARTIFACT_COMPILER,
|
|
151
|
+
type SuccessfulSkillRead
|
|
152
|
+
} from "./lib/skills.ts";
|
|
153
|
+
export {
|
|
154
|
+
emptyState,
|
|
155
|
+
isMaterializedState,
|
|
156
|
+
isStateDocument,
|
|
157
|
+
overlayStates,
|
|
158
|
+
updateMaterializedArtifacts,
|
|
159
|
+
type MaterializedState, type ScopedPatch,
|
|
160
|
+
type ScopedStates, type ScopePatch, type SemanticTransition,
|
|
161
|
+
type StateDocument,
|
|
162
|
+
type StatePatch,
|
|
163
|
+
type StateScope,
|
|
164
|
+
type TerminalTransition
|
|
165
|
+
} from "./lib/state.ts";
|
|
111
166
|
export { advanceTemporalState, readTemporalState, type TemporalState } from "./lib/temporal.ts";
|