@north-light/crouter 0.3.291 → 0.3.293

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.
@@ -32,6 +32,16 @@ export interface CrtrPreview {
32
32
  jsonl?: Record<string, unknown>[];
33
33
  error?: Record<string, unknown>;
34
34
  }
35
+ /** Every crtr invocation's own structured result in one bash tool result, in
36
+ * invocation order — mirrored onto `details` by the canvas preview extension
37
+ * (pi-extensions/canvas-preview-result.ts), and present on live tool events and
38
+ * on rebuilt snapshot messages alike.
39
+ *
40
+ * `crtrPreviews` carries every invocation in the call; `crtrPreview` (the last
41
+ * record alone) is all a transcript persisted before the channel became a list
42
+ * can offer, so both are read. This validates only the transport envelope —
43
+ * command-owned summaries validate the fields they use. */
44
+ export declare function crtrPreviewRecords(result: unknown): CrtrPreview[];
35
45
  type SummaryInput = {
36
46
  result?: Record<string, unknown>;
37
47
  jsonl?: Record<string, unknown>[];
@@ -185,6 +185,42 @@ export function iconForPath(tokens) {
185
185
  const familyCp = tokens.length > 0 ? FAMILY_ICON_CP[tokens[0]] : undefined;
186
186
  return familyCp !== undefined ? String.fromCodePoint(familyCp) : '◆';
187
187
  }
188
+ function plainObject(value) {
189
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
190
+ ? value
191
+ : undefined;
192
+ }
193
+ /** Every crtr invocation's own structured result in one bash tool result, in
194
+ * invocation order — mirrored onto `details` by the canvas preview extension
195
+ * (pi-extensions/canvas-preview-result.ts), and present on live tool events and
196
+ * on rebuilt snapshot messages alike.
197
+ *
198
+ * `crtrPreviews` carries every invocation in the call; `crtrPreview` (the last
199
+ * record alone) is all a transcript persisted before the channel became a list
200
+ * can offer, so both are read. This validates only the transport envelope —
201
+ * command-owned summaries validate the fields they use. */
202
+ export function crtrPreviewRecords(result) {
203
+ const details = plainObject(plainObject(result)?.['details']);
204
+ if (details === undefined)
205
+ return [];
206
+ const all = details['crtrPreviews'];
207
+ const records = Array.isArray(all) ? all : [details['crtrPreview']];
208
+ return records.flatMap((entry) => {
209
+ const record = plainObject(entry);
210
+ if (record === undefined || typeof record['path'] !== 'string')
211
+ return [];
212
+ const jsonl = record['jsonl'];
213
+ return [{
214
+ path: record['path'],
215
+ result: plainObject(record['result']),
216
+ jsonl: Array.isArray(jsonl) ? jsonl.flatMap((row) => {
217
+ const parsed = plainObject(row);
218
+ return parsed === undefined ? [] : [parsed];
219
+ }) : undefined,
220
+ error: plainObject(record['error']),
221
+ }];
222
+ });
223
+ }
188
224
  const MEMORY_READ_CONTENT_LINES = 3;
189
225
  function record(input) {
190
226
  return input.result;
@@ -142,3 +142,10 @@ export declare function effectiveDocKind(doc: MemoryDoc): string;
142
142
  * lives once here to prevent drift. Light cleanup normalizes the trailing
143
143
  * period. */
144
144
  export declare function previewLine(doc: Pick<SubstrateSchema, 'whenAndWhyToRead'>): string;
145
+ /** Tolerant `surfaces` parse: a non-array yields `[]`; invalid entries are
146
+ * dropped (bad `on`, bad `at`, a read/memory-read/command/pre-command entry
147
+ * left with neither `match` nor — read only — `match-frontmatter`). `match-frontmatter`
148
+ * on a non-read event is dropped from the entry, which survives iff it still
149
+ * carries a `match`; an invalid entry `gate` is dropped. Lint owns strict
150
+ * enforcement; the runtime parser maps over many docs and must never throw. */
151
+ export declare function parseSurfaces(v: unknown): SurfaceEntry[];
@@ -137,7 +137,7 @@ function parseGate(v) {
137
137
  * on a non-read event is dropped from the entry, which survives iff it still
138
138
  * carries a `match`; an invalid entry `gate` is dropped. Lint owns strict
139
139
  * enforcement; the runtime parser maps over many docs and must never throw. */
140
- function parseSurfaces(v) {
140
+ export function parseSurfaces(v) {
141
141
  if (!Array.isArray(v))
142
142
  return [];
143
143
  const out = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.291",
3
+ "version": "0.3.293",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.291",
3
+ "version": "0.3.293",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.291",
9
+ "version": "0.3.293",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "workspaces": [
@@ -4244,17 +4244,17 @@
4244
4244
  },
4245
4245
  "packages/crouter-api": {
4246
4246
  "name": "@north-light/crouter-api",
4247
- "version": "0.3.291",
4247
+ "version": "0.3.293",
4248
4248
  "license": "UNLICENSED"
4249
4249
  },
4250
4250
  "packages/crouter-env-docker": {
4251
4251
  "name": "@north-light/crouter-env-docker",
4252
- "version": "0.3.291",
4252
+ "version": "0.3.293",
4253
4253
  "license": "UNLICENSED"
4254
4254
  },
4255
4255
  "packages/crouter-sdk": {
4256
4256
  "name": "@north-light/crouter-sdk",
4257
- "version": "0.3.291",
4257
+ "version": "0.3.293",
4258
4258
  "license": "UNLICENSED",
4259
4259
  "dependencies": {
4260
4260
  "@north-light/crouter-api": "*"