@llblab/pi-state-flow 0.26.1 → 0.26.2
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/CHANGELOG.md +4 -0
- package/dist/lib/extension.js +2 -1
- package/dist/lib/protocol.d.ts +2 -1
- package/dist/lib/protocol.js +3 -2
- package/dist/package.json +1 -1
- package/lib/extension.ts +2 -1
- package/lib/protocol.ts +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
> Each release keeps at most 8 outcome records of at most 512 characters.
|
|
4
4
|
|
|
5
|
+
## 0.26.2: Automatic Response Guidance
|
|
6
|
+
|
|
7
|
+
- `Response ownership`: Active/bootstrap and Passive prompts explicitly forbid patching `response`; the `patch_state` guidelines forbid it in Global, CWD and Session, including clearing/deleting it, and explain that Active mode captures the final answer automatically. Runtime validation and answer capture are unchanged. No migration or configuration change is required.
|
|
8
|
+
|
|
5
9
|
## 0.26.1: Consistent Temporary Paths and Mode Colors
|
|
6
10
|
|
|
7
11
|
- `Telegram mode colors`: The selected mode uses 🟣 Off, 🟡 Passive or 🟢 Active; unselected options remain ⚫️. Mode behavior and callbacks are unchanged.
|
package/dist/lib/extension.js
CHANGED
|
@@ -15,7 +15,7 @@ import { awaitInFlightBackupPushes, backupCurrentStateFlowFiles, SettledTurnBack
|
|
|
15
15
|
import { projectRecentTransitionsWithLimit } from "./history.js";
|
|
16
16
|
import { isObject, presentationJson, sameJson } from "./json.js";
|
|
17
17
|
import { StateFlowDiagnosticWriter, stateFlowLogPath } from "./logging.js";
|
|
18
|
-
import { assistantToolCallCount, conciseDiagnostic, diagnosticText, finalizedAssistantResponse, formatPatchStateArguments, PASSIVE_MEMORY_PROTOCOL, separatedFailure, separatedOutput, stateFlowProtocol } from "./protocol.js";
|
|
18
|
+
import { assistantToolCallCount, conciseDiagnostic, diagnosticText, finalizedAssistantResponse, formatPatchStateArguments, PASSIVE_MEMORY_PROTOCOL, RESPONSE_PATCH_GUIDELINE, separatedFailure, separatedOutput, stateFlowProtocol } from "./protocol.js";
|
|
19
19
|
import { OwnedOperationSlot, RenewableLifetime } from "./operation.js";
|
|
20
20
|
import { readProjectedState, readStatePath } from "./query.js";
|
|
21
21
|
import { selectedBoundaryFailure, selectRetainedCheckpoint, waitForRecovery } from "./recovery.js";
|
|
@@ -728,6 +728,7 @@ export default function stateFlowExtension(pi, options = {}) {
|
|
|
728
728
|
description: "The sole State Flow semantic mutation protocol. Supply one or more global, cwd, or session patches; all supplied scopes commit atomically. This call must be the only State Flow barrier in its assistant response. Deleting an intent also deletes same-scope working/lazy keys its {\"$ref\"} values own unless another intent refs them. Name keys in ASCII ([A-Za-z_$][A-Za-z0-9_$-]*) so read paths and refs resolve; values may use any language.",
|
|
729
729
|
promptSnippet: "Atomically patch one or more global/cwd/session scopes",
|
|
730
730
|
promptGuidelines: [
|
|
731
|
+
RESPONSE_PATCH_GUIDELINE,
|
|
731
732
|
"Use patch_state only for material durable semantic changes; ordinary answers need no finalization call.",
|
|
732
733
|
"Use patch_state as reconciliation, not append-only notes: place new knowledge at the narrowest valid scope and remove superseded or completed state from touched branches.",
|
|
733
734
|
"Call patch_state alone in an assistant response; after its acknowledgement, further reasoning, tools, and later patch_state calls remain allowed.",
|
package/dist/lib/protocol.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
2
|
export type { StateDocument } from "./state.ts";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const RESPONSE_PATCH_GUIDELINE = "Never patch response in global, cwd or session, including clearing/deleting it; State Flow captures your final answer automatically in Active mode.";
|
|
4
|
+
export declare const PASSIVE_MEMORY_PROTOCOL = "State Flow passive memory is available. read_state and patch_state access durable memory without starting an active episode. Never patch response in global, cwd or session, including clearing/deleting it; State Flow captures your final answer automatically in Active mode. Passive turns never trigger State Flow continuation or compaction. 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. Head state/recent transitions are frozen at projection start. Only state_updates matching the head's State Flow projection ID apply; other IDs are history. Results/context notices carry state_updates: effective entries replace values at key/index-segment path arrays (deleted:true means absent); cascaded lists owner paths an intent deletion removed. Direct writes may elide; shared drift stays visible. Latest entries win over earlier state; lazy bodies stay omitted. Notices replace invalidations/rehydration, including []/null.";
|
|
4
5
|
/** Keep successful patch JSON valid while separating adjacent scopes and memory sections visually. */
|
|
5
6
|
export declare function formatPatchStateArguments(args: unknown): string;
|
|
6
7
|
/** Flatten causes before transport; native tool results need not retain Error.cause or AggregateError.errors. */
|
package/dist/lib/protocol.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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.";
|
|
2
2
|
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; other IDs are history. Results/context notices carry state_updates: effective entries replace values at key/index-segment path arrays (deleted:true means absent); cascaded lists owner paths an intent deletion removed. Direct writes may elide; shared drift stays visible. Latest entries win over earlier state; lazy bodies stay omitted. Notices replace invalidations/rehydration, including []/null.";
|
|
3
|
-
export const
|
|
3
|
+
export const RESPONSE_PATCH_GUIDELINE = "Never patch response in global, cwd or session, including clearing/deleting it; State Flow captures your final answer automatically in Active mode.";
|
|
4
|
+
export const PASSIVE_MEMORY_PROTOCOL = `State Flow passive memory is available. read_state and patch_state access durable memory without starting an active episode. ${RESPONSE_PATCH_GUIDELINE} Passive turns never trigger State Flow continuation or compaction. ${TASK_DRIVEN_HISTORY} ${PATCH_RESULT_PROTOCOL}`;
|
|
4
5
|
const PATCH_DISPLAY_SECTION_KEYS = new Set(["global", "cwd", "session", "intents", "contract", "working", "artifacts", "response", "lazy"]);
|
|
5
6
|
/** Keep successful patch JSON valid while separating adjacent scopes and memory sections visually. */
|
|
6
7
|
export function formatPatchStateArguments(args) {
|
|
@@ -88,7 +89,7 @@ ${bootstrapProtocol}STATE:
|
|
|
88
89
|
- contract: durable requirements, decisions, rejections, interfaces.
|
|
89
90
|
- working: temporary context of intents: facts, validation, failures, domain state.
|
|
90
91
|
- artifacts: source-path routing metadata; descriptions do not imply body acquisition.
|
|
91
|
-
- response:
|
|
92
|
+
- response: read-only prior answer; never patch it in any scope. Auto-stored at turn_end (empty="").
|
|
92
93
|
- lazy: retrieve explicitly.
|
|
93
94
|
|
|
94
95
|
SCOPES: Use the narrowest scope: session=branch/run continuation by default; cwd=reusable project truth; global=established cross-project/user/environment knowledge.
|
package/dist/package.json
CHANGED
package/lib/extension.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { awaitInFlightBackupPushes, backupCurrentStateFlowFiles, SettledTurnBack
|
|
|
22
22
|
import { projectRecentTransitionsWithLimit } from "./history.ts";
|
|
23
23
|
import { isObject, presentationJson, sameJson } from "./json.ts";
|
|
24
24
|
import { StateFlowDiagnosticWriter, stateFlowLogPath, type DiagnosticExtras, type StateFlowDiagnosticCategory } from "./logging.ts";
|
|
25
|
-
import { assistantToolCallCount, conciseDiagnostic, diagnosticText, finalizedAssistantResponse, formatPatchStateArguments, PASSIVE_MEMORY_PROTOCOL, separatedFailure, separatedOutput, stateFlowProtocol } from "./protocol.ts";
|
|
25
|
+
import { assistantToolCallCount, conciseDiagnostic, diagnosticText, finalizedAssistantResponse, formatPatchStateArguments, PASSIVE_MEMORY_PROTOCOL, RESPONSE_PATCH_GUIDELINE, separatedFailure, separatedOutput, stateFlowProtocol } from "./protocol.ts";
|
|
26
26
|
import { OwnedOperationSlot, RenewableLifetime, type OwnedOperation } from "./operation.ts";
|
|
27
27
|
import { readProjectedState, readStatePath } from "./query.ts";
|
|
28
28
|
import { selectedBoundaryFailure, selectRetainedCheckpoint, waitForRecovery } from "./recovery.ts";
|
|
@@ -746,6 +746,7 @@ export default function stateFlowExtension(pi: ExtensionAPI, options: StateFlowE
|
|
|
746
746
|
description: "The sole State Flow semantic mutation protocol. Supply one or more global, cwd, or session patches; all supplied scopes commit atomically. This call must be the only State Flow barrier in its assistant response. Deleting an intent also deletes same-scope working/lazy keys its {\"$ref\"} values own unless another intent refs them. Name keys in ASCII ([A-Za-z_$][A-Za-z0-9_$-]*) so read paths and refs resolve; values may use any language.",
|
|
747
747
|
promptSnippet: "Atomically patch one or more global/cwd/session scopes",
|
|
748
748
|
promptGuidelines: [
|
|
749
|
+
RESPONSE_PATCH_GUIDELINE,
|
|
749
750
|
"Use patch_state only for material durable semantic changes; ordinary answers need no finalization call.",
|
|
750
751
|
"Use patch_state as reconciliation, not append-only notes: place new knowledge at the narrowest valid scope and remove superseded or completed state from touched branches.",
|
|
751
752
|
"Call patch_state alone in an assistant response; after its acknowledgement, further reasoning, tools, and later patch_state calls remain allowed.",
|
package/lib/protocol.ts
CHANGED
|
@@ -6,7 +6,9 @@ const TASK_DRIVEN_HISTORY = "Missing paths/hints do not require history search.
|
|
|
6
6
|
|
|
7
7
|
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; other IDs are history. Results/context notices carry state_updates: effective entries replace values at key/index-segment path arrays (deleted:true means absent); cascaded lists owner paths an intent deletion removed. Direct writes may elide; shared drift stays visible. Latest entries win over earlier state; lazy bodies stay omitted. Notices replace invalidations/rehydration, including []/null.";
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const RESPONSE_PATCH_GUIDELINE = "Never patch response in global, cwd or session, including clearing/deleting it; State Flow captures your final answer automatically in Active mode.";
|
|
10
|
+
|
|
11
|
+
export const PASSIVE_MEMORY_PROTOCOL = `State Flow passive memory is available. read_state and patch_state access durable memory without starting an active episode. ${RESPONSE_PATCH_GUIDELINE} Passive turns never trigger State Flow continuation or compaction. ${TASK_DRIVEN_HISTORY} ${PATCH_RESULT_PROTOCOL}`;
|
|
10
12
|
|
|
11
13
|
const PATCH_DISPLAY_SECTION_KEYS = new Set(["global", "cwd", "session", "intents", "contract", "working", "artifacts", "response", "lazy"]);
|
|
12
14
|
|
|
@@ -92,7 +94,7 @@ ${bootstrapProtocol}STATE:
|
|
|
92
94
|
- contract: durable requirements, decisions, rejections, interfaces.
|
|
93
95
|
- working: temporary context of intents: facts, validation, failures, domain state.
|
|
94
96
|
- artifacts: source-path routing metadata; descriptions do not imply body acquisition.
|
|
95
|
-
- response:
|
|
97
|
+
- response: read-only prior answer; never patch it in any scope. Auto-stored at turn_end (empty="").
|
|
96
98
|
- lazy: retrieve explicitly.
|
|
97
99
|
|
|
98
100
|
SCOPES: Use the narrowest scope: session=branch/run continuation by default; cwd=reusable project truth; global=established cross-project/user/environment knowledge.
|