@llblab/pi-kit 0.27.2 → 0.27.4
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 +1 -0
- package/BACKLOG.md +3 -3
- package/CHANGELOG.md +8 -0
- package/README.md +3 -3
- package/node_modules/@llblab/pi-state-flow/BACKLOG.md +5 -3
- package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +8 -0
- package/node_modules/@llblab/pi-state-flow/dist/lib/extension.js +8 -6
- package/node_modules/@llblab/pi-state-flow/dist/lib/telegram.js +15 -18
- package/node_modules/@llblab/pi-state-flow/dist/package.json +1 -1
- package/node_modules/@llblab/pi-state-flow/docs/usage.md +2 -1
- package/node_modules/@llblab/pi-state-flow/lib/extension.ts +7 -4
- package/node_modules/@llblab/pi-state-flow/lib/telegram.ts +15 -18
- package/node_modules/@llblab/pi-state-flow/package.json +1 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
- Start work from `BACKLOG.md` and inspect the included package manifests before changing pins or resource paths.
|
|
22
22
|
- Keep `dependencies`, `bundledDependencies`, Pi resource paths, README inventory, tests, and lockfile synchronized.
|
|
23
|
+
- An explicitly requested bundled-extension release also authorizes synchronizing and releasing the kit in the same task; do not stop at local preparation. Follow the guarded repository release flow. Installation and live-client reload remain separately authorized.
|
|
23
24
|
- Bundle every included Pi package so npm installation is self-contained under this package's module root. Keep repository-local `legacy-peer-deps=true` so host-provided Pi peers are not resolved into the kit's lockfile; Pi supplies them at runtime.
|
|
24
25
|
- Expose only resources declared by each included package. Prefer published distribution entrypoints over source entrypoints when both exist.
|
|
25
26
|
- Do not copy extension source, Skills, or documentation into this repository.
|
package/BACKLOG.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
|
|
3
|
-
The 0.27.
|
|
3
|
+
The 0.27.4 composition is recorded in [CHANGELOG.md](./CHANGELOG.md). Package pins, resource order and bundled runtime ownership remain authoritative in `package.json`.
|
|
4
4
|
|
|
5
5
|
## Carried checks
|
|
6
6
|
|
|
7
|
+
- **Installed 0.27.4 inspection smoke (operator-owned):** After separately authorized installation/reload, inspect a large nested State Flow field in disposable storage. Confirm readable JSON layout, separate truncation notices and intact genuine string escapes. Packed validation does not certify installed Telegram clients.
|
|
8
|
+
- **Installed 0.27.3 single patch display smoke (operator-owned):** After separately authorized installation/reload, confirm one argument block followed by changed/no-op acknowledgements, compact configuration and visible rejected arguments/errors in disposable State Flow storage.
|
|
7
9
|
- **Installed 0.27.2 cascade receipt smoke (operator-owned):** After separately authorized installation/reload, close an intent owning a nested lazy key in disposable State Flow storage and confirm the receipt lists its owner path under `cascaded`, without the body. Packed validation does not certify installed clients.
|
|
8
|
-
|
|
9
10
|
- **Installed 0.27.1 Fast status smoke (operator-owned):** After separately authorized installation/reload, check Telegram menu Fast on/off and model switching for Codex and Claude Opus; unsupported Claude families must not show Fast. Use disposable settings and mocked quota where possible; do not mutate live stores or reconnect Telegram without separate authorization.
|
|
10
|
-
|
|
11
11
|
- **Installed 0.27.0 smoke (operator-owned):** After separately authorized installation/reload, check the exact released kit's terminal controls and optional Telegram rendering with disposable State Flow storage. Packed SDK validation does not certify the operator's running clients. Do not reconnect Telegram, change Pi settings or use live memory/usage/Recipe stores as fixtures without separate authorization.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@llblab/pi-kit` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.27.4: Readable State Flow Inspection
|
|
6
|
+
|
|
7
|
+
- `Readable Inspection`: Advances the exact State Flow pin to published `0.25.3`. Large Telegram inspection fields now show pretty-printed JSON prefixes directly, with separate truncation notices instead of escaped `preview` strings. Genuine JSON string escapes and storage semantics are preserved. Other pins, resources and load order are unchanged.
|
|
8
|
+
|
|
9
|
+
## 0.27.3: State Flow Single Patch Display
|
|
10
|
+
|
|
11
|
+
- `Single Patch Display`: Advances the exact State Flow pin to published `0.25.2`. Interactive patch rows show JSON arguments once, followed by the actual acceptance, no-op or error acknowledgement. Compact configuration still hides successful arguments. Other pins, resources, load order and storage semantics are unchanged.
|
|
12
|
+
|
|
5
13
|
## 0.27.2: State Flow Cascade Receipts
|
|
6
14
|
|
|
7
15
|
- `Cascade Receipts`: Advances the exact State Flow pin to published `0.25.1`. Accepted receipts now list every intent-cascaded owner path, including nested lazy keys, without exposing bodies or eliding the list as predictable. The lifecycle-state ceiling also counts const-bound operation slots and lifetimes. Other pins, resources, load order and storage semantics are unchanged.
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Package links lead to the owning repositories for usage, documentation, issues,
|
|
|
17
17
|
| [`@llblab/pi-clean-room`](https://github.com/llblab/pi-clean-room) | `0.3.0` | Isolated nested Pi TUI with named npm extensions and compatible model selection |
|
|
18
18
|
| [`@llblab/pi-codex-usage`](https://github.com/llblab/pi-codex-usage) | `0.12.1` | Shared Codex quota/Business credit status and persistent priority Fast toggle, mirrored in Telegram |
|
|
19
19
|
| [`@llblab/pi-grow-loop`](https://github.com/llblab/pi-grow-loop) | `0.9.0` | Visible continuation scheduling and bounded worker Skills through compiled, manifest-owned resources |
|
|
20
|
-
| [`@llblab/pi-state-flow`](https://github.com/llblab/pi-state-flow) | `0.25.
|
|
20
|
+
| [`@llblab/pi-state-flow`](https://github.com/llblab/pi-state-flow) | `0.25.3` | Scoped context/memory compiler with intent-owned memory, cascade receipts, memory-inert Off, single patch display and readable Telegram inspection |
|
|
21
21
|
| [`@llblab/pi-telegram`](https://github.com/llblab/pi-telegram) | `0.51.6` | Telegram companion with connection resume, Workspace slot recovery, follower Threads, filterable Skills, files, voice, and controls |
|
|
22
22
|
| [`@llblab/skills`](https://github.com/llblab/skills) | `1.15.0` | Portable workflows for engineering, review, design, context maintenance, and other focused tasks |
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ Versions are exact by design. An upstream release does not change an installed k
|
|
|
25
25
|
|
|
26
26
|
## Install
|
|
27
27
|
|
|
28
|
-
Requires **Pi 1.0.0+** and **Node.js 22.19.0+**. State Flow requires its canonical checkpoint/tail storage format and does not convert unsupported stores in place. Preserve existing stores and consult the [owning package's storage guidance](https://github.com/llblab/pi-state-flow/blob/v0.25.
|
|
28
|
+
Requires **Pi 1.0.0+** and **Node.js 22.19.0+**. State Flow requires its canonical checkpoint/tail storage format and does not convert unsupported stores in place. Preserve existing stores and consult the [owning package's storage guidance](https://github.com/llblab/pi-state-flow/blob/v0.25.3/docs/usage.md#moving-a-store-and-supported-formats) before changing installations.
|
|
29
29
|
|
|
30
30
|
From npm:
|
|
31
31
|
|
|
@@ -45,7 +45,7 @@ Prefer the kit instead of separately loading the same packages. If you already u
|
|
|
45
45
|
|
|
46
46
|
## Development
|
|
47
47
|
|
|
48
|
-
The `0.27.
|
|
48
|
+
The `0.27.4` composition includes published State Flow `0.25.3` with readable Telegram inspection; all other pins, resources and load order remain unchanged. `npm run validate` checks exact installed pins, declared resources, dependency audit and bundled inventory. It does not certify installed-client rendering; carried checks remain in [Backlog](./BACKLOG.md).
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npm install
|
|
@@ -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,6 +10,9 @@ The **0.25.1: Cascade Receipts** scope is implemented; outcomes belong in [CHANG
|
|
|
10
10
|
|
|
11
11
|
## Carried gates
|
|
12
12
|
|
|
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.
|
|
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.
|
|
13
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.
|
|
14
17
|
- **Installed 0.22.0, 0.23.0, 0.24.0 and 0.25.0 smokes** remain open as recorded.
|
|
15
18
|
|
|
@@ -20,5 +23,4 @@ The **0.25.1: Cascade Receipts** scope is implemented; outcomes belong in [CHANG
|
|
|
20
23
|
|
|
21
24
|
## Release boundary
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
- **Installation/reload (operator-owned).** Requires separate authorization and disposable storage. Grow Loop preparation does not cross publication or live-client gates.
|
|
26
|
+
Installation/reload requires separate authorization and disposable storage. Local validation and publication do not certify installed clients.
|
|
@@ -2,6 +2,14 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.25.2: Single Patch Display
|
|
10
|
+
|
|
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.
|
|
12
|
+
|
|
5
13
|
## 0.25.1: Cascade Receipts
|
|
6
14
|
|
|
7
15
|
- `Composition ceiling`: One invariant now counts mutable closure bindings plus `OwnedOperationSlot` and `RenewableLifetime` instances in `lib/extension.ts`, including const-bound holders, against the current total of 24 (17 + 5 + 2). Existing named owner assertions remain. Mutation checks reject an added binding, operation slot or lifetime; lifecycle source and behavior are unchanged.
|
|
@@ -730,13 +730,15 @@ export default function stateFlowExtension(pi, options = {}) {
|
|
|
730
730
|
cwd: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Optional project semantic patch" })),
|
|
731
731
|
session: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Optional session semantic patch" })),
|
|
732
732
|
}, { additionalProperties: false }),
|
|
733
|
-
|
|
733
|
+
renderCall(args, theme, context) {
|
|
734
|
+
const title = theme.fg("toolTitle", theme.bold(PATCH_STATE_TOOL_NAME));
|
|
735
|
+
if (!config.showSuccessfulPatches && !context.isError)
|
|
736
|
+
return new Text(title, 0, 0);
|
|
737
|
+
return new Text(`${title}\n${separatedOutput(theme.fg("dim", formatPatchStateArguments(args)))}`, 0, 0);
|
|
738
|
+
},
|
|
739
|
+
renderResult(result) {
|
|
734
740
|
const text = result.content.find((block) => block.type === "text")?.text ?? "";
|
|
735
|
-
|
|
736
|
-
return new Text(separatedOutput(text), 0, 0);
|
|
737
|
-
if (isPartial || !config.showSuccessfulPatches)
|
|
738
|
-
return new Text(text, 0, 0);
|
|
739
|
-
return new Text(separatedOutput(theme.fg("dim", formatPatchStateArguments(context.args))), 0, 0);
|
|
741
|
+
return new Text(separatedOutput(text), 0, 0);
|
|
740
742
|
},
|
|
741
743
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
742
744
|
signal = signal ? AbortSignal.any([signal, memoryToolLifetime.signal]) : memoryToolLifetime.signal;
|
|
@@ -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,
|
|
@@ -145,7 +145,7 @@ The canonical store is `state-flow/` beneath the agent directory. Keeping config
|
|
|
145
145
|
- Passive reads existing memory without publishing; its first explicit patch may initialize absent storage without starting an episode or compaction.
|
|
146
146
|
- Off exposes neither memory tools nor State Flow context.
|
|
147
147
|
- `logging`: Defaults to `false`. When enabled, rejected patch executions, active barrier blocks, preparation failures and accepted-answer reconciliation failures are recorded locally at `tmp/state-flow/logs.jsonl` beneath the agent directory. Asynchronous Git push failures are recorded there even when this setting is off.
|
|
148
|
-
- `showSuccessfulPatches`: Defaults to `true`. In interactive Pi,
|
|
148
|
+
- `showSuccessfulPatches`: Defaults to `true`. In interactive Pi, `patch_state` rows show pretty-printed JSON arguments once in the call, with blank lines between adjacent memory sections; the result shows the acceptance or no-op acknowledgement, never a second patch. Set it to `false` to hide call arguments and keep the compact acknowledgement. Rejected calls retain their arguments and error acknowledgement; State Flow adds no private validation turn.
|
|
149
149
|
- `historyLimit`: Defaults to `7` and accepts integers from `0` through `100`. It counts accepted semantic transitions, **not elapsed time or conversation length**, and bounds materialized-history and scope patch-history offsets.
|
|
150
150
|
- Lowering it on reload/restore/fork folds excess tails forward without losing current state; selected boundaries outside the new window become unavailable.
|
|
151
151
|
- Zero keeps only current checkpoints.
|
|
@@ -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.
|
|
@@ -746,11 +746,14 @@ export default function stateFlowExtension(pi: ExtensionAPI, options: StateFlowE
|
|
|
746
746
|
cwd: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Optional project semantic patch" })),
|
|
747
747
|
session: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Optional session semantic patch" })),
|
|
748
748
|
}, { additionalProperties: false }),
|
|
749
|
-
|
|
749
|
+
renderCall(args, theme, context) {
|
|
750
|
+
const title = theme.fg("toolTitle", theme.bold(PATCH_STATE_TOOL_NAME));
|
|
751
|
+
if (!config.showSuccessfulPatches && !context.isError) return new Text(title, 0, 0);
|
|
752
|
+
return new Text(`${title}\n${separatedOutput(theme.fg("dim", formatPatchStateArguments(args)))}`, 0, 0);
|
|
753
|
+
},
|
|
754
|
+
renderResult(result) {
|
|
750
755
|
const text = result.content.find((block) => block.type === "text")?.text ?? "";
|
|
751
|
-
|
|
752
|
-
if (isPartial || !config.showSuccessfulPatches) return new Text(text, 0, 0);
|
|
753
|
-
return new Text(separatedOutput(theme.fg("dim", formatPatchStateArguments(context.args))), 0, 0);
|
|
756
|
+
return new Text(separatedOutput(text), 0, 0);
|
|
754
757
|
},
|
|
755
758
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
756
759
|
signal = signal ? AbortSignal.any([signal, memoryToolLifetime.signal]) : memoryToolLifetime.signal;
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llblab/pi-kit",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@llblab/pi-clean-room": "0.3.0",
|
|
47
47
|
"@llblab/pi-codex-usage": "0.12.1",
|
|
48
48
|
"@llblab/pi-grow-loop": "0.9.0",
|
|
49
|
-
"@llblab/pi-state-flow": "0.25.
|
|
49
|
+
"@llblab/pi-state-flow": "0.25.3",
|
|
50
50
|
"@llblab/pi-telegram": "0.51.6",
|
|
51
51
|
"@llblab/skills": "1.15.0"
|
|
52
52
|
},
|