@llblab/pi-state-flow 0.25.2 → 0.25.3
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/BACKLOG.md +3 -2
- package/CHANGELOG.md +4 -0
- package/dist/lib/telegram.js +15 -18
- package/dist/package.json +1 -1
- package/docs/usage.md +1 -0
- package/lib/telegram.ts +15 -18
- package/package.json +1 -1
package/BACKLOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
|
|
3
|
-
The **0.25.
|
|
3
|
+
The **0.25.3: Readable Telegram Inspection** hotfix is prepared; outcomes belong in [CHANGELOG.md](CHANGELOG.md). This backlog retains installed-client gates and deferred decisions. Cascade semantics, canonical storage, stored patch records and lifecycle behaviour remain unchanged.
|
|
4
4
|
|
|
5
5
|
## Out of scope
|
|
6
6
|
|
|
@@ -10,7 +10,8 @@ The **0.25.2: Single Patch Display** hotfix is prepared; implementation outcomes
|
|
|
10
10
|
|
|
11
11
|
## Carried gates
|
|
12
12
|
|
|
13
|
-
- **0.25.
|
|
13
|
+
- **0.25.3 publication.** Validate and publish through the exact-tag workflow; verify GitHub Release and npm commit, then synchronize and release Pi Kit.
|
|
14
|
+
- **Installed 0.25.3 inspection smoke (operator-owned).** After separately authorized installation/reload, inspect a large nested field: real layout newlines/quotes, separate omitted-character notice and intact genuine JSON string escapes. Use disposable storage; local adapter tests do not certify installed Telegram clients.
|
|
14
15
|
- **Installed 0.25.2 smoke (operator-owned).** Disposable store: confirm one patch argument block followed by changed/no-op acknowledgements, compact rows with `showSuccessfulPatches: false`, and visible rejected arguments/errors.
|
|
15
16
|
- **Installed 0.25.1 smoke (operator-owned).** Disposable store: close an intent that owns a nested lazy key and confirm the receipt lists it under `cascaded`. May be combined with the open 0.25.0 smoke.
|
|
16
17
|
- **Installed 0.22.0, 0.23.0, 0.24.0 and 0.25.0 smokes** remain open as recorded.
|
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.25.3: Readable Telegram Inspection
|
|
6
|
+
|
|
7
|
+
- `Readable inspection`: Telegram memory inspection shows large fields as direct pretty-printed JSON prefixes instead of JSON-encoded `preview` strings with escaped layout and quotes. A separate notice reports omitted characters. Transport-aware budgeting preserves the Rich message ceiling and Unicode boundaries; genuine JSON string escapes, stored state and exact `read_state` results remain unchanged.
|
|
8
|
+
|
|
5
9
|
## 0.25.2: Single Patch Display
|
|
6
10
|
|
|
7
11
|
- `Single patch display`: Interactive `patch_state` rows show JSON arguments once in the call, followed by the actual acceptance, no-op or error acknowledgement instead of a second patch. `showSuccessfulPatches: false` hides call arguments while retaining compact acknowledgements; rejected arguments remain visible. Atomic publication, stored state and model-facing `state_updates` receipts are unchanged.
|
package/dist/lib/telegram.js
CHANGED
|
@@ -73,35 +73,32 @@ const STATE_FLOW_SCOPE_LABELS = {
|
|
|
73
73
|
session: "💬 Session",
|
|
74
74
|
effective: "🧬 Effective",
|
|
75
75
|
};
|
|
76
|
-
//
|
|
77
|
-
//
|
|
76
|
+
// Budget the transport-serialized text, leaving room for six fields and notices
|
|
77
|
+
// below Telegram's 32,768-character Rich message ceiling.
|
|
78
78
|
const STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS = 3_000;
|
|
79
79
|
function renderStateFlowTelegramField(value) {
|
|
80
80
|
const json = JSON.stringify(value, null, 2);
|
|
81
|
-
if (json.length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS)
|
|
82
|
-
return json;
|
|
81
|
+
if (JSON.stringify(json).length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
82
|
+
return [{ type: "pre", language: "json", text: json }];
|
|
83
|
+
}
|
|
83
84
|
let low = 0;
|
|
84
|
-
let high = json.length;
|
|
85
|
-
let rendered = "";
|
|
85
|
+
let high = Math.min(json.length, STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS);
|
|
86
86
|
while (low <= high) {
|
|
87
87
|
const length = Math.floor((low + high) / 2);
|
|
88
|
-
|
|
89
|
-
truncated: true,
|
|
90
|
-
...(value !== null && typeof value === "object" && !Array.isArray(value)
|
|
91
|
-
? { keys: Object.keys(value) }
|
|
92
|
-
: {}),
|
|
93
|
-
preview: json.slice(0, length),
|
|
94
|
-
omittedChars: json.length - length,
|
|
95
|
-
}, null, 2);
|
|
96
|
-
if (candidate.length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
97
|
-
rendered = candidate;
|
|
88
|
+
if (JSON.stringify(json.slice(0, length)).length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
98
89
|
low = length + 1;
|
|
99
90
|
}
|
|
100
91
|
else {
|
|
101
92
|
high = length - 1;
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
|
-
|
|
95
|
+
// Do not split a Unicode surrogate pair at the preview boundary.
|
|
96
|
+
if (/[\uD800-\uDBFF]/.test(json.charAt(high - 1)))
|
|
97
|
+
high -= 1;
|
|
98
|
+
return [
|
|
99
|
+
{ type: "pre", language: "json", text: json.slice(0, high) },
|
|
100
|
+
{ type: "pre", text: `Truncated preview — ${json.length - high} characters omitted.` },
|
|
101
|
+
];
|
|
105
102
|
}
|
|
106
103
|
export function renderStateFlowRichState(scope, revisions, state) {
|
|
107
104
|
const fields = scope === "global" || scope === "cwd"
|
|
@@ -120,7 +117,7 @@ export function renderStateFlowRichState(scope, revisions, state) {
|
|
|
120
117
|
...fields.filter((field) => state[field] !== undefined && state[field] !== "").map((field) => ({
|
|
121
118
|
type: "details",
|
|
122
119
|
summary: { type: "code", text: field },
|
|
123
|
-
blocks:
|
|
120
|
+
blocks: renderStateFlowTelegramField(state[field]),
|
|
124
121
|
})),
|
|
125
122
|
],
|
|
126
123
|
skip_entity_detection: true,
|
package/dist/package.json
CHANGED
package/docs/usage.md
CHANGED
|
@@ -224,6 +224,7 @@ When `pi-telegram` is available, its main-menu section shows `State Flow: active
|
|
|
224
224
|
**Memory inspection:**
|
|
225
225
|
|
|
226
226
|
- Owner-scope Rich snapshots show `#revision`; Effective shows the vector.
|
|
227
|
+
- Fields show pretty-printed JSON directly. Large fields show a bounded JSON prefix with a separate truncation notice and omitted-character count, not a JSON-encoded `preview` string. The preview may end mid-value; actual escapes inside JSON string values remain intact. These presentation limits never truncate stored memory or successful `read_state` results.
|
|
227
228
|
- During a failed-Passive write fence, memory-enabled inspection uses the accepted cache without a potentially conflicting refresh.
|
|
228
229
|
- Otherwise, inspection waits cancelably to load or refresh one coherent shared view, even when passive model tools are disabled. It does not initialize, publish or advance storage.
|
|
229
230
|
- Data and displayed revisions come from the same observation; absent or invalid memory stays unavailable.
|
package/lib/telegram.ts
CHANGED
|
@@ -191,34 +191,31 @@ const STATE_FLOW_SCOPE_LABELS: Record<StateFlowTelegramScope, string> = {
|
|
|
191
191
|
effective: "🧬 Effective",
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
//
|
|
195
|
-
//
|
|
194
|
+
// Budget the transport-serialized text, leaving room for six fields and notices
|
|
195
|
+
// below Telegram's 32,768-character Rich message ceiling.
|
|
196
196
|
const STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS = 3_000;
|
|
197
197
|
|
|
198
|
-
function renderStateFlowTelegramField(value: unknown):
|
|
198
|
+
function renderStateFlowTelegramField(value: unknown): StateFlowTelegramRichBlock[] {
|
|
199
199
|
const json = JSON.stringify(value, null, 2);
|
|
200
|
-
if (json.length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS)
|
|
200
|
+
if (JSON.stringify(json).length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
201
|
+
return [{ type: "pre", language: "json", text: json }];
|
|
202
|
+
}
|
|
201
203
|
let low = 0;
|
|
202
|
-
let high = json.length;
|
|
203
|
-
let rendered = "";
|
|
204
|
+
let high = Math.min(json.length, STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS);
|
|
204
205
|
while (low <= high) {
|
|
205
206
|
const length = Math.floor((low + high) / 2);
|
|
206
|
-
|
|
207
|
-
truncated: true,
|
|
208
|
-
...(value !== null && typeof value === "object" && !Array.isArray(value)
|
|
209
|
-
? { keys: Object.keys(value) }
|
|
210
|
-
: {}),
|
|
211
|
-
preview: json.slice(0, length),
|
|
212
|
-
omittedChars: json.length - length,
|
|
213
|
-
}, null, 2);
|
|
214
|
-
if (candidate.length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
215
|
-
rendered = candidate;
|
|
207
|
+
if (JSON.stringify(json.slice(0, length)).length <= STATE_FLOW_TELEGRAM_FIELD_MAX_CHARS) {
|
|
216
208
|
low = length + 1;
|
|
217
209
|
} else {
|
|
218
210
|
high = length - 1;
|
|
219
211
|
}
|
|
220
212
|
}
|
|
221
|
-
|
|
213
|
+
// Do not split a Unicode surrogate pair at the preview boundary.
|
|
214
|
+
if (/[\uD800-\uDBFF]/.test(json.charAt(high - 1))) high -= 1;
|
|
215
|
+
return [
|
|
216
|
+
{ type: "pre", language: "json", text: json.slice(0, high) },
|
|
217
|
+
{ type: "pre", text: `Truncated preview — ${json.length - high} characters omitted.` },
|
|
218
|
+
];
|
|
222
219
|
}
|
|
223
220
|
|
|
224
221
|
export function renderStateFlowRichState(scope: StateFlowTelegramScope, revisions: ScopeRevisions, state: StateFlowTelegramState): StateFlowTelegramRichMessage {
|
|
@@ -238,7 +235,7 @@ export function renderStateFlowRichState(scope: StateFlowTelegramScope, revision
|
|
|
238
235
|
...fields.filter((field) => state[field] !== undefined && state[field] !== "").map((field) => ({
|
|
239
236
|
type: "details" as const,
|
|
240
237
|
summary: { type: "code" as const, text: field },
|
|
241
|
-
blocks:
|
|
238
|
+
blocks: renderStateFlowTelegramField(state[field]),
|
|
242
239
|
})),
|
|
243
240
|
],
|
|
244
241
|
skip_entity_detection: true,
|