@femtomc/mu-core 26.2.101 → 26.2.103
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/README.md +3 -0
- package/dist/hud.d.ts +195 -0
- package/dist/hud.d.ts.map +1 -1
- package/dist/hud.js +219 -0
- package/dist/node/memory_runtime.d.ts +1 -1
- package/dist/node/memory_runtime.d.ts.map +1 -1
- package/dist/node/memory_runtime.js +0 -92
- package/dist/node/store.d.ts.map +1 -1
- package/dist/node/store.js +0 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,10 +40,13 @@ console.log(await jsonl.read());
|
|
|
40
40
|
|
|
41
41
|
- `HudDocSchema`, `HUD_CONTRACT_VERSION`
|
|
42
42
|
- `parseHudDoc(...)`, `normalizeHudDocs(...)`
|
|
43
|
+
- `resolveHudStylePresetName(...)`, `applyHudStylePreset(...)`, `hudStylePresetWarnings(...)`
|
|
43
44
|
- `serializeHudDocTextFallback(...)`, `serializeHudDocsTextFallback(...)`
|
|
44
45
|
- `stableSerializeJson(...)`
|
|
45
46
|
- `HudRuntime` + `HudProvider` for provider registration, reducer updates, ordered effect execution, and HUD snapshot emission
|
|
46
47
|
|
|
48
|
+
`HudDoc` also supports optional presentation hints (`title_style`, `snapshot_style`, chip/item/section/action style objects) and metadata style presets (`metadata.style_preset` currently `planning|subagents`) so renderers can opt into richer emphasis while preserving deterministic plain-text fallbacks.
|
|
49
|
+
|
|
47
50
|
These are runtime-agnostic primitives intended for shared HUD capture/render pipelines.
|
|
48
51
|
|
|
49
52
|
## Tests / Typecheck
|
package/dist/hud.d.ts
CHANGED
|
@@ -16,6 +16,20 @@ export declare const HudActionKindSchema: z.ZodEnum<{
|
|
|
16
16
|
danger: "danger";
|
|
17
17
|
}>;
|
|
18
18
|
export type HudActionKind = z.infer<typeof HudActionKindSchema>;
|
|
19
|
+
export declare const HudTextWeightSchema: z.ZodEnum<{
|
|
20
|
+
normal: "normal";
|
|
21
|
+
strong: "strong";
|
|
22
|
+
}>;
|
|
23
|
+
export type HudTextWeight = z.infer<typeof HudTextWeightSchema>;
|
|
24
|
+
export declare const HudTextStyleSchema: z.ZodObject<{
|
|
25
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
normal: "normal";
|
|
27
|
+
strong: "strong";
|
|
28
|
+
}>>;
|
|
29
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type HudTextStyle = z.infer<typeof HudTextStyleSchema>;
|
|
19
33
|
export declare const HudChipSchema: z.ZodObject<{
|
|
20
34
|
key: z.ZodString;
|
|
21
35
|
label: z.ZodString;
|
|
@@ -28,6 +42,14 @@ export declare const HudChipSchema: z.ZodObject<{
|
|
|
28
42
|
accent: "accent";
|
|
29
43
|
dim: "dim";
|
|
30
44
|
}>>;
|
|
45
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
normal: "normal";
|
|
48
|
+
strong: "strong";
|
|
49
|
+
}>>;
|
|
50
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strict>>;
|
|
31
53
|
}, z.core.$strict>;
|
|
32
54
|
export type HudChip = z.infer<typeof HudChipSchema>;
|
|
33
55
|
export declare const HudKvItemSchema: z.ZodObject<{
|
|
@@ -43,17 +65,41 @@ export declare const HudKvItemSchema: z.ZodObject<{
|
|
|
43
65
|
accent: "accent";
|
|
44
66
|
dim: "dim";
|
|
45
67
|
}>>;
|
|
68
|
+
value_style: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
normal: "normal";
|
|
71
|
+
strong: "strong";
|
|
72
|
+
}>>;
|
|
73
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
46
76
|
}, z.core.$strict>;
|
|
47
77
|
export type HudKvItem = z.infer<typeof HudKvItemSchema>;
|
|
48
78
|
export declare const HudChecklistItemSchema: z.ZodObject<{
|
|
49
79
|
id: z.ZodString;
|
|
50
80
|
label: z.ZodString;
|
|
51
81
|
done: z.ZodBoolean;
|
|
82
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
normal: "normal";
|
|
85
|
+
strong: "strong";
|
|
86
|
+
}>>;
|
|
87
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
52
90
|
}, z.core.$strict>;
|
|
53
91
|
export type HudChecklistItem = z.infer<typeof HudChecklistItemSchema>;
|
|
54
92
|
export declare const HudSectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
93
|
kind: z.ZodLiteral<"kv">;
|
|
56
94
|
title: z.ZodOptional<z.ZodString>;
|
|
95
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
normal: "normal";
|
|
98
|
+
strong: "strong";
|
|
99
|
+
}>>;
|
|
100
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
57
103
|
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
58
104
|
key: z.ZodString;
|
|
59
105
|
label: z.ZodString;
|
|
@@ -67,22 +113,62 @@ export declare const HudSectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
67
113
|
accent: "accent";
|
|
68
114
|
dim: "dim";
|
|
69
115
|
}>>;
|
|
116
|
+
value_style: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
118
|
+
normal: "normal";
|
|
119
|
+
strong: "strong";
|
|
120
|
+
}>>;
|
|
121
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
70
124
|
}, z.core.$strict>>>;
|
|
71
125
|
}, z.core.$strict>, z.ZodObject<{
|
|
72
126
|
kind: z.ZodLiteral<"checklist">;
|
|
73
127
|
title: z.ZodOptional<z.ZodString>;
|
|
128
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
normal: "normal";
|
|
131
|
+
strong: "strong";
|
|
132
|
+
}>>;
|
|
133
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
74
136
|
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
75
137
|
id: z.ZodString;
|
|
76
138
|
label: z.ZodString;
|
|
77
139
|
done: z.ZodBoolean;
|
|
140
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
normal: "normal";
|
|
143
|
+
strong: "strong";
|
|
144
|
+
}>>;
|
|
145
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
146
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
}, z.core.$strict>>;
|
|
78
148
|
}, z.core.$strict>>>;
|
|
79
149
|
}, z.core.$strict>, z.ZodObject<{
|
|
80
150
|
kind: z.ZodLiteral<"activity">;
|
|
81
151
|
title: z.ZodOptional<z.ZodString>;
|
|
152
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
154
|
+
normal: "normal";
|
|
155
|
+
strong: "strong";
|
|
156
|
+
}>>;
|
|
157
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
158
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
}, z.core.$strict>>;
|
|
82
160
|
lines: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
83
161
|
}, z.core.$strict>, z.ZodObject<{
|
|
84
162
|
kind: z.ZodLiteral<"text">;
|
|
85
163
|
title: z.ZodOptional<z.ZodString>;
|
|
164
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
normal: "normal";
|
|
167
|
+
strong: "strong";
|
|
168
|
+
}>>;
|
|
169
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
+
}, z.core.$strict>>;
|
|
86
172
|
text: z.ZodString;
|
|
87
173
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
88
174
|
error: "error";
|
|
@@ -93,6 +179,14 @@ export declare const HudSectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
93
179
|
accent: "accent";
|
|
94
180
|
dim: "dim";
|
|
95
181
|
}>>;
|
|
182
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
184
|
+
normal: "normal";
|
|
185
|
+
strong: "strong";
|
|
186
|
+
}>>;
|
|
187
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
96
190
|
}, z.core.$strict>], "kind">;
|
|
97
191
|
export type HudSection = z.infer<typeof HudSectionSchema>;
|
|
98
192
|
export declare const HudActionSchema: z.ZodObject<{
|
|
@@ -104,12 +198,28 @@ export declare const HudActionSchema: z.ZodObject<{
|
|
|
104
198
|
secondary: "secondary";
|
|
105
199
|
danger: "danger";
|
|
106
200
|
}>>;
|
|
201
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
203
|
+
normal: "normal";
|
|
204
|
+
strong: "strong";
|
|
205
|
+
}>>;
|
|
206
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
}, z.core.$strict>>;
|
|
107
209
|
}, z.core.$strict>;
|
|
108
210
|
export type HudAction = z.infer<typeof HudActionSchema>;
|
|
109
211
|
export declare const HudDocSchema: z.ZodObject<{
|
|
110
212
|
v: z.ZodDefault<z.ZodLiteral<1>>;
|
|
111
213
|
hud_id: z.ZodString;
|
|
112
214
|
title: z.ZodString;
|
|
215
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
216
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
217
|
+
normal: "normal";
|
|
218
|
+
strong: "strong";
|
|
219
|
+
}>>;
|
|
220
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
}, z.core.$strict>>;
|
|
113
223
|
scope: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
114
224
|
chips: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
115
225
|
key: z.ZodString;
|
|
@@ -123,10 +233,26 @@ export declare const HudDocSchema: z.ZodObject<{
|
|
|
123
233
|
accent: "accent";
|
|
124
234
|
dim: "dim";
|
|
125
235
|
}>>;
|
|
236
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
238
|
+
normal: "normal";
|
|
239
|
+
strong: "strong";
|
|
240
|
+
}>>;
|
|
241
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
}, z.core.$strict>>;
|
|
126
244
|
}, z.core.$strict>>>;
|
|
127
245
|
sections: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
128
246
|
kind: z.ZodLiteral<"kv">;
|
|
129
247
|
title: z.ZodOptional<z.ZodString>;
|
|
248
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
250
|
+
normal: "normal";
|
|
251
|
+
strong: "strong";
|
|
252
|
+
}>>;
|
|
253
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
254
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
255
|
+
}, z.core.$strict>>;
|
|
130
256
|
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
131
257
|
key: z.ZodString;
|
|
132
258
|
label: z.ZodString;
|
|
@@ -140,22 +266,62 @@ export declare const HudDocSchema: z.ZodObject<{
|
|
|
140
266
|
accent: "accent";
|
|
141
267
|
dim: "dim";
|
|
142
268
|
}>>;
|
|
269
|
+
value_style: z.ZodOptional<z.ZodObject<{
|
|
270
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
271
|
+
normal: "normal";
|
|
272
|
+
strong: "strong";
|
|
273
|
+
}>>;
|
|
274
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
275
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
276
|
+
}, z.core.$strict>>;
|
|
143
277
|
}, z.core.$strict>>>;
|
|
144
278
|
}, z.core.$strict>, z.ZodObject<{
|
|
145
279
|
kind: z.ZodLiteral<"checklist">;
|
|
146
280
|
title: z.ZodOptional<z.ZodString>;
|
|
281
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
282
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
283
|
+
normal: "normal";
|
|
284
|
+
strong: "strong";
|
|
285
|
+
}>>;
|
|
286
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
287
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
}, z.core.$strict>>;
|
|
147
289
|
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
148
290
|
id: z.ZodString;
|
|
149
291
|
label: z.ZodString;
|
|
150
292
|
done: z.ZodBoolean;
|
|
293
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
294
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
295
|
+
normal: "normal";
|
|
296
|
+
strong: "strong";
|
|
297
|
+
}>>;
|
|
298
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
300
|
+
}, z.core.$strict>>;
|
|
151
301
|
}, z.core.$strict>>>;
|
|
152
302
|
}, z.core.$strict>, z.ZodObject<{
|
|
153
303
|
kind: z.ZodLiteral<"activity">;
|
|
154
304
|
title: z.ZodOptional<z.ZodString>;
|
|
305
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
normal: "normal";
|
|
308
|
+
strong: "strong";
|
|
309
|
+
}>>;
|
|
310
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
311
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
312
|
+
}, z.core.$strict>>;
|
|
155
313
|
lines: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
156
314
|
}, z.core.$strict>, z.ZodObject<{
|
|
157
315
|
kind: z.ZodLiteral<"text">;
|
|
158
316
|
title: z.ZodOptional<z.ZodString>;
|
|
317
|
+
title_style: z.ZodOptional<z.ZodObject<{
|
|
318
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
319
|
+
normal: "normal";
|
|
320
|
+
strong: "strong";
|
|
321
|
+
}>>;
|
|
322
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
323
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
}, z.core.$strict>>;
|
|
159
325
|
text: z.ZodString;
|
|
160
326
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
161
327
|
error: "error";
|
|
@@ -166,6 +332,14 @@ export declare const HudDocSchema: z.ZodObject<{
|
|
|
166
332
|
accent: "accent";
|
|
167
333
|
dim: "dim";
|
|
168
334
|
}>>;
|
|
335
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
336
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
337
|
+
normal: "normal";
|
|
338
|
+
strong: "strong";
|
|
339
|
+
}>>;
|
|
340
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
341
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
342
|
+
}, z.core.$strict>>;
|
|
169
343
|
}, z.core.$strict>], "kind">>>;
|
|
170
344
|
actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
171
345
|
id: z.ZodString;
|
|
@@ -176,13 +350,34 @@ export declare const HudDocSchema: z.ZodObject<{
|
|
|
176
350
|
secondary: "secondary";
|
|
177
351
|
danger: "danger";
|
|
178
352
|
}>>;
|
|
353
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
354
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
355
|
+
normal: "normal";
|
|
356
|
+
strong: "strong";
|
|
357
|
+
}>>;
|
|
358
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
359
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
360
|
+
}, z.core.$strict>>;
|
|
179
361
|
}, z.core.$strict>>>;
|
|
180
362
|
snapshot_compact: z.ZodString;
|
|
363
|
+
snapshot_style: z.ZodOptional<z.ZodObject<{
|
|
364
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
365
|
+
normal: "normal";
|
|
366
|
+
strong: "strong";
|
|
367
|
+
}>>;
|
|
368
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
369
|
+
code: z.ZodOptional<z.ZodBoolean>;
|
|
370
|
+
}, z.core.$strict>>;
|
|
181
371
|
snapshot_multiline: z.ZodOptional<z.ZodString>;
|
|
182
372
|
updated_at_ms: z.ZodNumber;
|
|
183
373
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
184
374
|
}, z.core.$strict>;
|
|
185
375
|
export type HudDoc = z.infer<typeof HudDocSchema>;
|
|
376
|
+
export declare const HUD_STYLE_PRESET_NAMES: readonly ["planning", "subagents"];
|
|
377
|
+
export type HudStylePresetName = (typeof HUD_STYLE_PRESET_NAMES)[number];
|
|
378
|
+
export declare function hudStylePresetWarnings(input: unknown): string[];
|
|
379
|
+
export declare function resolveHudStylePresetName(input: unknown): HudStylePresetName | null;
|
|
380
|
+
export declare function applyHudStylePreset(input: unknown): HudDoc | null;
|
|
186
381
|
export declare function stableSerializeJson(value: unknown, opts?: {
|
|
187
382
|
pretty?: boolean;
|
|
188
383
|
}): string;
|
package/dist/hud.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hud.d.ts","sourceRoot":"","sources":["../src/hud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC,eAAO,MAAM,aAAa;;;;;;;;EAA4E,CAAC;AACvG,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,mBAAmB;;;;EAA6C,CAAC;AAC9E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"hud.d.ts","sourceRoot":"","sources":["../src/hud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC,eAAO,MAAM,aAAa;;;;;;;;EAA4E,CAAC;AACvG,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,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C,EAAE,MAAM,CAAC;CACf,GACJ,MAAM,CAiBR;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,EAAE,CAoB1F"}
|
package/dist/hud.js
CHANGED
|
@@ -3,11 +3,20 @@ export const HUD_CONTRACT_VERSION = 1;
|
|
|
3
3
|
const NonEmptyTextSchema = z.string().trim().min(1);
|
|
4
4
|
export const HudToneSchema = z.enum(["info", "success", "warning", "error", "muted", "accent", "dim"]);
|
|
5
5
|
export const HudActionKindSchema = z.enum(["primary", "secondary", "danger"]);
|
|
6
|
+
export const HudTextWeightSchema = z.enum(["normal", "strong"]);
|
|
7
|
+
export const HudTextStyleSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
weight: HudTextWeightSchema.optional(),
|
|
10
|
+
italic: z.boolean().optional(),
|
|
11
|
+
code: z.boolean().optional(),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
6
14
|
export const HudChipSchema = z
|
|
7
15
|
.object({
|
|
8
16
|
key: NonEmptyTextSchema,
|
|
9
17
|
label: NonEmptyTextSchema,
|
|
10
18
|
tone: HudToneSchema.optional(),
|
|
19
|
+
style: HudTextStyleSchema.optional(),
|
|
11
20
|
})
|
|
12
21
|
.strict();
|
|
13
22
|
export const HudKvItemSchema = z
|
|
@@ -16,6 +25,7 @@ export const HudKvItemSchema = z
|
|
|
16
25
|
label: NonEmptyTextSchema,
|
|
17
26
|
value: NonEmptyTextSchema,
|
|
18
27
|
tone: HudToneSchema.optional(),
|
|
28
|
+
value_style: HudTextStyleSchema.optional(),
|
|
19
29
|
})
|
|
20
30
|
.strict();
|
|
21
31
|
export const HudChecklistItemSchema = z
|
|
@@ -23,6 +33,7 @@ export const HudChecklistItemSchema = z
|
|
|
23
33
|
id: NonEmptyTextSchema,
|
|
24
34
|
label: NonEmptyTextSchema,
|
|
25
35
|
done: z.boolean(),
|
|
36
|
+
style: HudTextStyleSchema.optional(),
|
|
26
37
|
})
|
|
27
38
|
.strict();
|
|
28
39
|
export const HudSectionSchema = z.discriminatedUnion("kind", [
|
|
@@ -30,6 +41,7 @@ export const HudSectionSchema = z.discriminatedUnion("kind", [
|
|
|
30
41
|
.object({
|
|
31
42
|
kind: z.literal("kv"),
|
|
32
43
|
title: NonEmptyTextSchema.optional(),
|
|
44
|
+
title_style: HudTextStyleSchema.optional(),
|
|
33
45
|
items: z.array(HudKvItemSchema).default([]),
|
|
34
46
|
})
|
|
35
47
|
.strict(),
|
|
@@ -37,6 +49,7 @@ export const HudSectionSchema = z.discriminatedUnion("kind", [
|
|
|
37
49
|
.object({
|
|
38
50
|
kind: z.literal("checklist"),
|
|
39
51
|
title: NonEmptyTextSchema.optional(),
|
|
52
|
+
title_style: HudTextStyleSchema.optional(),
|
|
40
53
|
items: z.array(HudChecklistItemSchema).default([]),
|
|
41
54
|
})
|
|
42
55
|
.strict(),
|
|
@@ -44,6 +57,7 @@ export const HudSectionSchema = z.discriminatedUnion("kind", [
|
|
|
44
57
|
.object({
|
|
45
58
|
kind: z.literal("activity"),
|
|
46
59
|
title: NonEmptyTextSchema.optional(),
|
|
60
|
+
title_style: HudTextStyleSchema.optional(),
|
|
47
61
|
lines: z.array(NonEmptyTextSchema).default([]),
|
|
48
62
|
})
|
|
49
63
|
.strict(),
|
|
@@ -51,8 +65,10 @@ export const HudSectionSchema = z.discriminatedUnion("kind", [
|
|
|
51
65
|
.object({
|
|
52
66
|
kind: z.literal("text"),
|
|
53
67
|
title: NonEmptyTextSchema.optional(),
|
|
68
|
+
title_style: HudTextStyleSchema.optional(),
|
|
54
69
|
text: NonEmptyTextSchema,
|
|
55
70
|
tone: HudToneSchema.optional(),
|
|
71
|
+
style: HudTextStyleSchema.optional(),
|
|
56
72
|
})
|
|
57
73
|
.strict(),
|
|
58
74
|
]);
|
|
@@ -62,6 +78,7 @@ export const HudActionSchema = z
|
|
|
62
78
|
label: NonEmptyTextSchema,
|
|
63
79
|
command_text: NonEmptyTextSchema,
|
|
64
80
|
kind: HudActionKindSchema.optional(),
|
|
81
|
+
style: HudTextStyleSchema.optional(),
|
|
65
82
|
})
|
|
66
83
|
.strict();
|
|
67
84
|
export const HudDocSchema = z
|
|
@@ -69,11 +86,13 @@ export const HudDocSchema = z
|
|
|
69
86
|
v: z.literal(HUD_CONTRACT_VERSION).default(HUD_CONTRACT_VERSION),
|
|
70
87
|
hud_id: NonEmptyTextSchema,
|
|
71
88
|
title: NonEmptyTextSchema,
|
|
89
|
+
title_style: HudTextStyleSchema.optional(),
|
|
72
90
|
scope: NonEmptyTextSchema.nullable().default(null),
|
|
73
91
|
chips: z.array(HudChipSchema).default([]),
|
|
74
92
|
sections: z.array(HudSectionSchema).default([]),
|
|
75
93
|
actions: z.array(HudActionSchema).default([]),
|
|
76
94
|
snapshot_compact: NonEmptyTextSchema,
|
|
95
|
+
snapshot_style: HudTextStyleSchema.optional(),
|
|
77
96
|
snapshot_multiline: NonEmptyTextSchema.optional(),
|
|
78
97
|
updated_at_ms: z.number().int().nonnegative(),
|
|
79
98
|
metadata: z.record(z.string(), z.unknown()).default({}),
|
|
@@ -89,6 +108,206 @@ function parseHudDocCandidate(value) {
|
|
|
89
108
|
}
|
|
90
109
|
return parsed.data;
|
|
91
110
|
}
|
|
111
|
+
export const HUD_STYLE_PRESET_NAMES = ["planning", "subagents"];
|
|
112
|
+
function isHudStylePresetName(value) {
|
|
113
|
+
return HUD_STYLE_PRESET_NAMES.includes(value);
|
|
114
|
+
}
|
|
115
|
+
function hudStylePresetNameFromMetadata(metadata) {
|
|
116
|
+
const raw = metadata.style_preset;
|
|
117
|
+
if (typeof raw !== "string") {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const normalized = raw.trim().toLowerCase();
|
|
121
|
+
if (!normalized || !isHudStylePresetName(normalized)) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return normalized;
|
|
125
|
+
}
|
|
126
|
+
function mergeHudTextStyle(preferred, fallback) {
|
|
127
|
+
if (!preferred && !fallback) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const merged = {
|
|
131
|
+
...(fallback ?? {}),
|
|
132
|
+
...(preferred ?? {}),
|
|
133
|
+
};
|
|
134
|
+
if (merged.weight === undefined && merged.italic === undefined && merged.code === undefined) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
return merged;
|
|
138
|
+
}
|
|
139
|
+
function defaultChipStyle(chip) {
|
|
140
|
+
if (chip.tone === "dim" || chip.tone === "muted") {
|
|
141
|
+
return { weight: "normal" };
|
|
142
|
+
}
|
|
143
|
+
return { weight: "strong" };
|
|
144
|
+
}
|
|
145
|
+
function planningKvValueStyle(item) {
|
|
146
|
+
switch (item.key) {
|
|
147
|
+
case "root":
|
|
148
|
+
case "next":
|
|
149
|
+
case "next_action":
|
|
150
|
+
return { code: true };
|
|
151
|
+
default:
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function applyPlanningPreset(doc) {
|
|
156
|
+
return {
|
|
157
|
+
...doc,
|
|
158
|
+
title_style: mergeHudTextStyle(doc.title_style, { weight: "strong" }),
|
|
159
|
+
snapshot_style: mergeHudTextStyle(doc.snapshot_style, { italic: true }),
|
|
160
|
+
chips: doc.chips.map((chip) => ({
|
|
161
|
+
...chip,
|
|
162
|
+
style: mergeHudTextStyle(chip.style, defaultChipStyle(chip)),
|
|
163
|
+
})),
|
|
164
|
+
sections: doc.sections.map((section) => {
|
|
165
|
+
switch (section.kind) {
|
|
166
|
+
case "kv":
|
|
167
|
+
return {
|
|
168
|
+
...section,
|
|
169
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
170
|
+
items: section.items.map((item) => ({
|
|
171
|
+
...item,
|
|
172
|
+
value_style: mergeHudTextStyle(item.value_style, planningKvValueStyle(item)),
|
|
173
|
+
})),
|
|
174
|
+
};
|
|
175
|
+
case "checklist":
|
|
176
|
+
return {
|
|
177
|
+
...section,
|
|
178
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
179
|
+
};
|
|
180
|
+
case "activity":
|
|
181
|
+
return {
|
|
182
|
+
...section,
|
|
183
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
184
|
+
};
|
|
185
|
+
case "text":
|
|
186
|
+
return {
|
|
187
|
+
...section,
|
|
188
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
192
|
+
actions: doc.actions.map((action) => ({
|
|
193
|
+
...action,
|
|
194
|
+
style: mergeHudTextStyle(action.style, { italic: true }),
|
|
195
|
+
})),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function applySubagentsPreset(doc) {
|
|
199
|
+
return {
|
|
200
|
+
...doc,
|
|
201
|
+
title_style: mergeHudTextStyle(doc.title_style, { weight: "strong" }),
|
|
202
|
+
snapshot_style: mergeHudTextStyle(doc.snapshot_style, { italic: true }),
|
|
203
|
+
chips: doc.chips.map((chip) => ({
|
|
204
|
+
...chip,
|
|
205
|
+
style: mergeHudTextStyle(chip.style, defaultChipStyle(chip)),
|
|
206
|
+
})),
|
|
207
|
+
sections: doc.sections.map((section) => {
|
|
208
|
+
switch (section.kind) {
|
|
209
|
+
case "kv":
|
|
210
|
+
return {
|
|
211
|
+
...section,
|
|
212
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
213
|
+
};
|
|
214
|
+
case "checklist":
|
|
215
|
+
return {
|
|
216
|
+
...section,
|
|
217
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
218
|
+
};
|
|
219
|
+
case "activity":
|
|
220
|
+
return {
|
|
221
|
+
...section,
|
|
222
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
223
|
+
};
|
|
224
|
+
case "text":
|
|
225
|
+
return {
|
|
226
|
+
...section,
|
|
227
|
+
title_style: mergeHudTextStyle(section.title_style, { weight: "strong" }),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
}),
|
|
231
|
+
actions: doc.actions.map((action) => ({
|
|
232
|
+
...action,
|
|
233
|
+
style: mergeHudTextStyle(action.style, { weight: "strong" }),
|
|
234
|
+
})),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function hasChipKey(doc, key) {
|
|
238
|
+
return doc.chips.some((chip) => chip.key === key);
|
|
239
|
+
}
|
|
240
|
+
function hasSectionKind(doc, kind) {
|
|
241
|
+
return doc.sections.some((section) => section.kind === kind);
|
|
242
|
+
}
|
|
243
|
+
function hudStylePresetWarningsForDoc(doc, preset) {
|
|
244
|
+
const warnings = [];
|
|
245
|
+
switch (preset) {
|
|
246
|
+
case "planning":
|
|
247
|
+
if (doc.hud_id !== "planning") {
|
|
248
|
+
warnings.push(`style_preset=planning expects hud_id=planning (got ${doc.hud_id})`);
|
|
249
|
+
}
|
|
250
|
+
if (!hasChipKey(doc, "phase")) {
|
|
251
|
+
warnings.push("style_preset=planning recommends chip key 'phase'");
|
|
252
|
+
}
|
|
253
|
+
if (!hasSectionKind(doc, "kv")) {
|
|
254
|
+
warnings.push("style_preset=planning recommends a kv section");
|
|
255
|
+
}
|
|
256
|
+
if (!hasSectionKind(doc, "checklist")) {
|
|
257
|
+
warnings.push("style_preset=planning recommends a checklist section");
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case "subagents":
|
|
261
|
+
if (doc.hud_id !== "subagents") {
|
|
262
|
+
warnings.push(`style_preset=subagents expects hud_id=subagents (got ${doc.hud_id})`);
|
|
263
|
+
}
|
|
264
|
+
if (!hasChipKey(doc, "health")) {
|
|
265
|
+
warnings.push("style_preset=subagents recommends chip key 'health'");
|
|
266
|
+
}
|
|
267
|
+
if (!hasSectionKind(doc, "kv")) {
|
|
268
|
+
warnings.push("style_preset=subagents recommends a kv section");
|
|
269
|
+
}
|
|
270
|
+
if (!hasSectionKind(doc, "activity")) {
|
|
271
|
+
warnings.push("style_preset=subagents recommends an activity section");
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
return warnings;
|
|
276
|
+
}
|
|
277
|
+
export function hudStylePresetWarnings(input) {
|
|
278
|
+
const doc = parseHudDocCandidate(input);
|
|
279
|
+
if (!doc) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
const preset = hudStylePresetNameFromMetadata(doc.metadata);
|
|
283
|
+
if (!preset) {
|
|
284
|
+
return [];
|
|
285
|
+
}
|
|
286
|
+
return hudStylePresetWarningsForDoc(doc, preset);
|
|
287
|
+
}
|
|
288
|
+
export function resolveHudStylePresetName(input) {
|
|
289
|
+
const doc = parseHudDocCandidate(input);
|
|
290
|
+
if (!doc) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
return hudStylePresetNameFromMetadata(doc.metadata);
|
|
294
|
+
}
|
|
295
|
+
export function applyHudStylePreset(input) {
|
|
296
|
+
const doc = parseHudDocCandidate(input);
|
|
297
|
+
if (!doc) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
const preset = hudStylePresetNameFromMetadata(doc.metadata);
|
|
301
|
+
if (!preset) {
|
|
302
|
+
return doc;
|
|
303
|
+
}
|
|
304
|
+
switch (preset) {
|
|
305
|
+
case "planning":
|
|
306
|
+
return applyPlanningPreset(doc);
|
|
307
|
+
case "subagents":
|
|
308
|
+
return applySubagentsPreset(doc);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
92
311
|
function deterministicHudDocChoice(a, b) {
|
|
93
312
|
if (a.updated_at_ms !== b.updated_at_ms) {
|
|
94
313
|
return a.updated_at_ms > b.updated_at_ms ? a : b;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CONTEXT_SOURCE_KINDS: readonly ["issues", "forum", "events", "cp_commands", "cp_outbox", "cp_adapter_audit", "cp_operator_turns", "cp_telegram_ingress", "
|
|
1
|
+
export declare const CONTEXT_SOURCE_KINDS: readonly ["issues", "forum", "events", "cp_commands", "cp_outbox", "cp_adapter_audit", "cp_operator_turns", "cp_telegram_ingress", "operator_sessions", "cp_operator_sessions"];
|
|
2
2
|
export type ContextSourceKind = (typeof CONTEXT_SOURCE_KINDS)[number];
|
|
3
3
|
export type ContextItem = {
|
|
4
4
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory_runtime.d.ts","sourceRoot":"","sources":["../../src/node/memory_runtime.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"memory_runtime.d.ts","sourceRoot":"","sources":["../../src/node/memory_runtime.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB,iLAWvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,iBAAiB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,gBAAgB,EAAE,MAAM,GAA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AE;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;CAC/C,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoB9B"}
|
|
@@ -22,7 +22,6 @@ export const CONTEXT_SOURCE_KINDS = [
|
|
|
22
22
|
"cp_adapter_audit",
|
|
23
23
|
"cp_operator_turns",
|
|
24
24
|
"cp_telegram_ingress",
|
|
25
|
-
"session_flash",
|
|
26
25
|
"operator_sessions",
|
|
27
26
|
"cp_operator_sessions",
|
|
28
27
|
];
|
|
@@ -907,94 +906,6 @@ async function collectTelegramIngress(repoRoot, path) {
|
|
|
907
906
|
}
|
|
908
907
|
return out;
|
|
909
908
|
}
|
|
910
|
-
async function collectSessionFlash(repoRoot, path) {
|
|
911
|
-
const out = [];
|
|
912
|
-
const created = new Map();
|
|
913
|
-
const delivered = new Map();
|
|
914
|
-
for (const row of await readJsonlRows(path)) {
|
|
915
|
-
const rec = asRecord(row.value);
|
|
916
|
-
if (!rec) {
|
|
917
|
-
continue;
|
|
918
|
-
}
|
|
919
|
-
const kind = nonEmptyString(rec.kind);
|
|
920
|
-
if (kind === "session_flash.create") {
|
|
921
|
-
const flashId = nonEmptyString(rec.flash_id);
|
|
922
|
-
const sessionId = nonEmptyString(rec.session_id);
|
|
923
|
-
const body = nonEmptyString(rec.body);
|
|
924
|
-
const tsMs = asInt(rec.ts_ms) ?? 0;
|
|
925
|
-
if (!flashId || !sessionId || !body) {
|
|
926
|
-
continue;
|
|
927
|
-
}
|
|
928
|
-
const contextIds = Array.isArray(rec.context_ids)
|
|
929
|
-
? rec.context_ids
|
|
930
|
-
.map((value) => nonEmptyString(value))
|
|
931
|
-
.filter((value) => value != null)
|
|
932
|
-
: [];
|
|
933
|
-
created.set(flashId, {
|
|
934
|
-
created_at_ms: tsMs,
|
|
935
|
-
flash_id: flashId,
|
|
936
|
-
session_id: sessionId,
|
|
937
|
-
session_kind: nonEmptyString(rec.session_kind),
|
|
938
|
-
body,
|
|
939
|
-
context_ids: contextIds,
|
|
940
|
-
source: nonEmptyString(rec.source),
|
|
941
|
-
metadata: asRecord(rec.metadata) ?? {},
|
|
942
|
-
source_line: row.line,
|
|
943
|
-
});
|
|
944
|
-
continue;
|
|
945
|
-
}
|
|
946
|
-
if (kind === "session_flash.delivery") {
|
|
947
|
-
const flashId = nonEmptyString(rec.flash_id);
|
|
948
|
-
if (!flashId) {
|
|
949
|
-
continue;
|
|
950
|
-
}
|
|
951
|
-
delivered.set(flashId, {
|
|
952
|
-
delivered_at_ms: asInt(rec.ts_ms) ?? 0,
|
|
953
|
-
delivered_by: nonEmptyString(rec.delivered_by),
|
|
954
|
-
note: nonEmptyString(rec.note),
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
for (const create of created.values()) {
|
|
959
|
-
const delivery = delivered.get(create.flash_id);
|
|
960
|
-
const status = delivery ? "delivered" : "pending";
|
|
961
|
-
pushItem(out, {
|
|
962
|
-
id: `session_flash:${create.flash_id}`,
|
|
963
|
-
ts_ms: create.created_at_ms,
|
|
964
|
-
source_kind: "session_flash",
|
|
965
|
-
source_path: normalizeRelative(repoRoot, path),
|
|
966
|
-
source_line: create.source_line,
|
|
967
|
-
repo_root: repoRoot,
|
|
968
|
-
issue_id: null,
|
|
969
|
-
run_id: null,
|
|
970
|
-
session_id: create.session_id,
|
|
971
|
-
channel: null,
|
|
972
|
-
channel_tenant_id: null,
|
|
973
|
-
channel_conversation_id: null,
|
|
974
|
-
actor_binding_id: null,
|
|
975
|
-
conversation_key: null,
|
|
976
|
-
topic: null,
|
|
977
|
-
author: create.source,
|
|
978
|
-
role: "user",
|
|
979
|
-
tags: ["session_flash", status, create.session_kind ?? "unknown"],
|
|
980
|
-
metadata: {
|
|
981
|
-
flash_id: create.flash_id,
|
|
982
|
-
session_kind: create.session_kind,
|
|
983
|
-
context_ids: create.context_ids,
|
|
984
|
-
delivery: delivery
|
|
985
|
-
? {
|
|
986
|
-
delivered_at_ms: delivery.delivered_at_ms,
|
|
987
|
-
delivered_by: delivery.delivered_by,
|
|
988
|
-
note: delivery.note,
|
|
989
|
-
}
|
|
990
|
-
: null,
|
|
991
|
-
...create.metadata,
|
|
992
|
-
},
|
|
993
|
-
text: [create.body, create.context_ids.join(" "), status].filter((part) => part.length > 0).join("\n"),
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
return out;
|
|
997
|
-
}
|
|
998
909
|
function sessionIdFromPath(path) {
|
|
999
910
|
const fileName = path.split(/[\\/]/).pop() ?? path;
|
|
1000
911
|
return fileName.replace(/\.jsonl$/i, "") || `session-${crypto.randomUUID()}`;
|
|
@@ -1104,9 +1015,6 @@ async function collectContextItems(repoRoot, requestedSources) {
|
|
|
1104
1015
|
if (include("cp_telegram_ingress")) {
|
|
1105
1016
|
tasks.push(collectTelegramIngress(repoRoot, join(cpDir, "telegram_ingress.jsonl")));
|
|
1106
1017
|
}
|
|
1107
|
-
if (include("session_flash")) {
|
|
1108
|
-
tasks.push(collectSessionFlash(repoRoot, join(cpDir, "session_flash.jsonl")));
|
|
1109
|
-
}
|
|
1110
1018
|
if (include("operator_sessions")) {
|
|
1111
1019
|
tasks.push(collectSessionMessages({
|
|
1112
1020
|
repoRoot,
|
package/dist/node/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/node/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/node/store.ts"],"names":[],"mappings":"AAqCA,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,CAelE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAe1D"}
|
package/dist/node/store.js
CHANGED