@genesislcap/ai-assistant 15.86.1 → 15.87.0

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.
Files changed (84) hide show
  1. package/dist/ai-assistant.api.json +5026 -645
  2. package/dist/ai-assistant.d.ts +802 -0
  3. package/dist/chat-driver.cjs +1487 -132
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +1480 -132
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +2779 -657
  8. package/dist/dts/autopilot/autopilot-session.d.ts +25 -0
  9. package/dist/dts/autopilot/autopilot-session.d.ts.map +1 -1
  10. package/dist/dts/chat-driver-node.d.ts +2 -0
  11. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  12. package/dist/dts/components/ai-driver/ai-driver.d.ts +15 -0
  13. package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
  14. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts +6 -0
  15. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts.map +1 -1
  16. package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -0
  17. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  18. package/dist/dts/components/chat-driver/interaction-controller.d.ts +12 -0
  19. package/dist/dts/components/chat-driver/interaction-controller.d.ts.map +1 -1
  20. package/dist/dts/headless/describe-interaction.d.ts +17 -0
  21. package/dist/dts/headless/describe-interaction.d.ts.map +1 -0
  22. package/dist/dts/headless/headless-debug.d.ts +28 -0
  23. package/dist/dts/headless/headless-debug.d.ts.map +1 -0
  24. package/dist/dts/headless/headless-persistence.d.ts +35 -0
  25. package/dist/dts/headless/headless-persistence.d.ts.map +1 -0
  26. package/dist/dts/headless/headless-session.d.ts +180 -0
  27. package/dist/dts/headless/headless-session.d.ts.map +1 -0
  28. package/dist/dts/headless/headless.types.d.ts +435 -0
  29. package/dist/dts/headless/headless.types.d.ts.map +1 -0
  30. package/dist/dts/headless/index.d.ts +5 -0
  31. package/dist/dts/headless/index.d.ts.map +1 -0
  32. package/dist/dts/headless-server/compact.d.ts +52 -0
  33. package/dist/dts/headless-server/compact.d.ts.map +1 -0
  34. package/dist/dts/headless-server/index.d.ts +23 -0
  35. package/dist/dts/headless-server/index.d.ts.map +1 -0
  36. package/dist/dts/headless-server/server.d.ts +13 -0
  37. package/dist/dts/headless-server/server.d.ts.map +1 -0
  38. package/dist/dts/headless-server/types.d.ts +210 -0
  39. package/dist/dts/headless-server/types.d.ts.map +1 -0
  40. package/dist/dts/index.d.ts +2 -0
  41. package/dist/dts/index.d.ts.map +1 -1
  42. package/dist/dts/main/main.d.ts.map +1 -1
  43. package/dist/dts/state/debug-event-log.d.ts +1 -1
  44. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  45. package/dist/dts/state/decision-surface.d.ts +5 -4
  46. package/dist/dts/state/decision-surface.d.ts.map +1 -1
  47. package/dist/dts/state/persistence/debug-log-assembly.d.ts +49 -0
  48. package/dist/dts/state/persistence/debug-log-assembly.d.ts.map +1 -0
  49. package/dist/dts/state/persistence/index.d.ts +1 -0
  50. package/dist/dts/state/persistence/index.d.ts.map +1 -1
  51. package/dist/dts/state/persistence/session-persister.d.ts +7 -0
  52. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  53. package/dist/dts/types/interaction-surface.d.ts +30 -0
  54. package/dist/dts/types/interaction-surface.d.ts.map +1 -1
  55. package/dist/esm/autopilot/autopilot-session.js +31 -16
  56. package/dist/esm/chat-driver-node.js +8 -0
  57. package/dist/esm/components/ai-driver/base-driver-decorator.js +12 -0
  58. package/dist/esm/components/chat-driver/chat-driver.js +8 -0
  59. package/dist/esm/components/chat-driver/interaction-controller.js +66 -0
  60. package/dist/esm/headless/describe-interaction.js +55 -0
  61. package/dist/esm/headless/headless-debug.js +62 -0
  62. package/dist/esm/headless/headless-persistence.js +192 -0
  63. package/dist/esm/headless/headless-session.js +808 -0
  64. package/dist/esm/headless/headless.types.js +1 -0
  65. package/dist/esm/headless/index.js +3 -0
  66. package/dist/esm/headless-server/compact.js +160 -0
  67. package/dist/esm/headless-server/index.js +21 -0
  68. package/dist/esm/headless-server/server.js +746 -0
  69. package/dist/esm/headless-server/types.js +3 -0
  70. package/dist/esm/index.js +3 -0
  71. package/dist/esm/main/main.js +18 -37
  72. package/dist/esm/state/debug-event-log.js +6 -1
  73. package/dist/esm/state/decision-surface.js +75 -48
  74. package/dist/esm/state/persistence/debug-log-assembly.js +69 -0
  75. package/dist/esm/state/persistence/index.js +1 -0
  76. package/dist/esm/state/persistence/session-persister.js +16 -0
  77. package/dist/headless-server.cjs +853 -0
  78. package/dist/headless-server.cjs.map +7 -0
  79. package/dist/headless-server.mjs +819 -0
  80. package/dist/headless-server.mjs.map +7 -0
  81. package/package.json +28 -18
  82. package/scripts/build-headless-server-node.mjs +42 -0
  83. package/scripts/smoke-chat-driver-node.mjs +3 -0
  84. package/scripts/smoke-headless-server-node.mjs +112 -0
@@ -0,0 +1,435 @@
1
+ import type { AggregateUsage, ChatAttachment } from '@genesislcap/foundation-ai';
2
+ import type { AutopilotHost } from '../autopilot/autopilot-driver';
3
+ import type { WidgetTools } from '../autopilot/widget-tools';
4
+ import type { AgenticActivityBus } from '../channel/ai-activity-bus';
5
+ import type { AiDriver } from '../components/ai-driver/ai-driver';
6
+ import type { AgentConfig } from '../config/config';
7
+ import type { DebugLog } from '../state/persistence/diagnostics';
8
+ import type { InteractionContext } from '../types/interaction-context';
9
+ import type { InvokeResult } from '../types/interaction-surface';
10
+ /**
11
+ * One action of a pending interaction, as a model reads it: a SurfaceAction cut to what is
12
+ * useful to choose by, with the number {@link describeInteraction} gave it. Plain data.
13
+ *
14
+ * @beta
15
+ */
16
+ export interface DescribedAction {
17
+ /**
18
+ * The number the action is chosen by, when it is a numbered option: the same number the
19
+ * autopilot's list gives it, so "1" means the same option to both. Absent on a platform-owned
20
+ * action (`select`, `reply`) or a named, full-form one, which are chosen by `name`.
21
+ */
22
+ readonly n?: number;
23
+ /** The action's name: what `act` runs when it is not chosen by number. */
24
+ readonly name: string;
25
+ /** What the person would read on the button, when it differs from the name. */
26
+ readonly label?: string;
27
+ /** What a full-form action does, as its widget wrote it. */
28
+ readonly description?: string;
29
+ /** Whether it can be taken now. */
30
+ readonly enabled: boolean;
31
+ /** Why it cannot be, when it is not enabled and the widget said. */
32
+ readonly unavailable?: string;
33
+ /**
34
+ * What it takes: `'options'` (`select`: several, by number or label), `'text'` (written words)
35
+ * or `'fields'` (a JSON object fitting `argsSchema`). Absent: nothing.
36
+ */
37
+ readonly args?: 'options' | 'text' | 'fields';
38
+ /** The shape `fields` must fit, for an action that takes them. */
39
+ readonly argsSchema?: Readonly<Record<string, unknown>>;
40
+ /** Whether running it settles the interaction. */
41
+ readonly finishes: boolean;
42
+ /** Whether it is a written refinement: one that counts against a step's limit. */
43
+ readonly refines?: boolean;
44
+ }
45
+ /**
46
+ * What a pending interaction needs from the person, as a compact, JSON-serialisable view a model
47
+ * can read and answer.
48
+ *
49
+ * @beta
50
+ */
51
+ export interface InteractionDescription {
52
+ readonly interactionId: string;
53
+ /** The widget type. */
54
+ readonly component: string;
55
+ /** Who holds it: `'user'`, or a claimant such as `'autopilot'`. */
56
+ readonly heldBy: string;
57
+ /**
58
+ * Whether the widget has a controller and so a surface to act on. `false`: nothing here can be
59
+ * run with `act`; `text` is all the widget says, and only a raw `resolve` can settle it.
60
+ */
61
+ readonly controller: boolean;
62
+ /**
63
+ * Whether the person can act now. A widget with no controller is ready; one with a surface is
64
+ * ready when it has an enabled finishing action and is not busy working.
65
+ */
66
+ readonly ready: boolean;
67
+ /**
68
+ * What the autopilot would be sent for it: the same `renderDecision` text (the widget as text,
69
+ * its views and facts, the numbered actions), or the widget as text alone where there is no
70
+ * surface.
71
+ */
72
+ readonly text: string;
73
+ /** Every action, in the order the list shows them. Empty with no surface. */
74
+ readonly actions: readonly DescribedAction[];
75
+ /** The views `read` takes, each with what it holds. */
76
+ readonly views?: Readonly<Record<string, string>>;
77
+ /** The surface's facts, as they stand now. */
78
+ readonly facts?: Readonly<Record<string, unknown>>;
79
+ }
80
+ /**
81
+ * What a headless session logs, one entry per thing that happened. Every entry has a `seq` (from
82
+ * 1, rising by one) and an `at` (an ISO time); `wait` is cursored by `seq`.
83
+ *
84
+ * @beta
85
+ */
86
+ export type HeadlessEvent = HeadlessEventBase & (({
87
+ readonly type: 'decision';
88
+ } & InteractionDescription & {
89
+ /** The agents that asked for it, outermost first. */
90
+ readonly ownerPath?: readonly string[];
91
+ }) | {
92
+ readonly type: 'working';
93
+ readonly interactionId: string;
94
+ readonly component: string;
95
+ /** Who holds it; `'user'` when it is the person's but not ready yet. */
96
+ readonly heldBy: string;
97
+ } | {
98
+ readonly type: 'settled';
99
+ readonly interactionId: string;
100
+ readonly component: string;
101
+ /** Who answered it; absent for a timeout, a stop, or one that settled by itself. */
102
+ readonly answeredBy?: string;
103
+ /** Set when the widget settled by itself and nobody answered. */
104
+ readonly resolvedItself?: boolean;
105
+ /** Set when the session settled it for a widget that settles itself in a browser. */
106
+ readonly auto?: boolean;
107
+ /** Set when the host settled it raw, bypassing the widget's actions. */
108
+ readonly raw?: boolean;
109
+ } | {
110
+ readonly type: 'message';
111
+ /** One line of what the person would see, as the autopilot reads it ("Assistant: ..."). */
112
+ readonly text: string;
113
+ /** The line's full length, in characters, when `text` was cut. */
114
+ readonly chars?: number;
115
+ } | {
116
+ readonly type: 'turn';
117
+ /** The driver's reason, `'done'` for a finished turn; `'error'` when it threw. */
118
+ readonly reason: string;
119
+ /** Set when the turn ended in a typed failure rather than completing. */
120
+ readonly failureReason?: string;
121
+ /** The assistant's final text for the turn, when it said any. */
122
+ readonly text?: string;
123
+ /** The text's full length, in characters, when `text` was cut. */
124
+ readonly chars?: number;
125
+ } | {
126
+ readonly type: 'autopilot';
127
+ readonly mode: string;
128
+ readonly status: string;
129
+ readonly needsUser: boolean;
130
+ readonly working: boolean;
131
+ /** Why it is paused, when it said. */
132
+ readonly reason?: string;
133
+ } | {
134
+ readonly type: 'probe';
135
+ /** What the host's probe reads now. */
136
+ readonly probe: Readonly<Record<string, unknown>>;
137
+ /** The keys whose values changed since the last entry. */
138
+ readonly changed: readonly string[];
139
+ } | {
140
+ readonly type: 'error';
141
+ /** What failed: `'turn'`, `'auto-settle'`, `'probe'`, … */
142
+ readonly where: string;
143
+ readonly message: string;
144
+ });
145
+ /**
146
+ * The fields every {@link HeadlessEvent} has.
147
+ *
148
+ * @beta
149
+ */
150
+ export interface HeadlessEventBase {
151
+ readonly seq: number;
152
+ /** When it was logged, as an ISO time. */
153
+ readonly at: string;
154
+ }
155
+ /**
156
+ * The type of a {@link HeadlessEvent}.
157
+ *
158
+ * @beta
159
+ */
160
+ export type HeadlessEventType = HeadlessEvent['type'];
161
+ /**
162
+ * Options for a {@link HeadlessSession}.
163
+ *
164
+ * @beta
165
+ */
166
+ export interface HeadlessSessionOptions {
167
+ /** The debug-log key its meta events go under: the driver's own. Defaults to `''`. */
168
+ readonly sessionKey?: string;
169
+ /** What the host calls itself, recorded with `headless.attached`, e.g. `'cli'`. */
170
+ readonly label?: string;
171
+ /**
172
+ * Widgets that settle themselves in a browser when their element mounts, with no controller
173
+ * to act on, by widget type: each maps the widget's `data` to the result to settle it with.
174
+ * When one opens the session settles it with that result (once the open has completed), logs
175
+ * `settled` with `auto: true`, and never reports it as a `decision`.
176
+ */
177
+ readonly autoSettle?: Readonly<Record<string, (data: unknown) => unknown>>;
178
+ /** The widget tools `read({ tool })` may run, as for the autopilot. */
179
+ readonly widgetTools?: readonly WidgetTools[];
180
+ /**
181
+ * Host state shown in `state()` as `probe`, e.g. its app phase. Read again at every event; a
182
+ * change in any top-level value is logged as a `probe` event.
183
+ */
184
+ readonly probe?: () => Record<string, unknown>;
185
+ /** Whether `resolve` (settling an interaction raw) is allowed. Default `true`. */
186
+ readonly allowRaw?: boolean;
187
+ /**
188
+ * The autopilot, when the driver handed to the session is not itself one (a decorator wrapped
189
+ * over it hides it). Default: the driver, when it has the shape of an `AutopilotHost`.
190
+ */
191
+ readonly autopilot?: AutopilotLike;
192
+ /** The time source for `at`, in milliseconds. Default `Date.now`. */
193
+ readonly clock?: () => number;
194
+ /**
195
+ * Where the session is saved, as `headlessPersistence(...)` builds it: the same
196
+ * `sessions/<key>` snapshot and `diag/<key>` stream the browser writes. Absent: nothing is
197
+ * saved, and `debugLog()` is the current page's.
198
+ */
199
+ readonly persistence?: HeadlessPersistence;
200
+ /**
201
+ * What `debugLog()` reports of the host when nothing is persisted (with `persistence` its own
202
+ * options are used instead).
203
+ */
204
+ readonly debug?: HeadlessDebugOptions;
205
+ /**
206
+ * The bus the driver was built with (`ChatDriver`'s `activityBus` option), to hear turns end the
207
+ * moment they do, whoever started them. Without it a turn the session did not start is noticed
208
+ * by watching the driver's history and polling `isBusy()`, which is the slower route.
209
+ */
210
+ readonly activityBus?: Pick<AgenticActivityBus, 'subscribe'>;
211
+ }
212
+ /**
213
+ * What a debug log reports of the host that built it: the `meta` block's agents, state and host.
214
+ *
215
+ * @beta
216
+ */
217
+ export interface HeadlessDebugOptions {
218
+ /** The configured agents, as the element's `agents` are. */
219
+ readonly agents?: () => readonly AgentConfig[];
220
+ /** The host's own debug state, shown as `meta.debug`. */
221
+ readonly debugState?: () => unknown;
222
+ /** The host name `meta.host` carries. The element's is `window.location.host`. Default `'headless'`. */
223
+ readonly host?: string;
224
+ /**
225
+ * The active model and its context window, which the element learns from the provider registry's
226
+ * status; the session has no registry, so the host says. Read each time they are needed.
227
+ */
228
+ readonly context?: () => {
229
+ model?: string;
230
+ contextLimit?: number;
231
+ } | undefined;
232
+ }
233
+ /**
234
+ * What a persistence binding is built from: the session's driver, and its debug-log key.
235
+ *
236
+ * @beta
237
+ */
238
+ export interface HeadlessPersistenceHost {
239
+ readonly driver: AiDriver;
240
+ readonly sessionKey: string;
241
+ }
242
+ /**
243
+ * A session's saving, attached to a driver: it keeps what the persister reads current and asks it
244
+ * to save when the browser's element would. Built by `HeadlessPersistence.attach`.
245
+ *
246
+ * @beta
247
+ */
248
+ export interface HeadlessPersistenceBinding {
249
+ /** Note the prompt a person is about to send, for the flow it may start (`flowActivationPrompt`). */
250
+ notePrompt(text: string): void;
251
+ /** Save the snapshot and append the diagnostics now, rather than at the next throttled flush. */
252
+ flush(): Promise<void>;
253
+ /** The debug log for the whole session, stitched from the stored stream (see `lifetimeDebugLog`). */
254
+ debugLog(): Promise<DebugLog>;
255
+ /** Stop watching the driver and cancel pending saves. The saved session is left as it is. */
256
+ dispose(): void;
257
+ }
258
+ /**
259
+ * Persistence for a {@link HeadlessSession}, as `headlessPersistence(...)` builds it. Lives apart
260
+ * from the session so that the session itself, and the Node entry that exports it, never reach the
261
+ * store, the persister or the framework they use.
262
+ *
263
+ * @beta
264
+ */
265
+ export interface HeadlessPersistence {
266
+ /** The session key: the file under `sessions/` and the stream under `diag/`. */
267
+ readonly stateKey: string;
268
+ attach(host: HeadlessPersistenceHost): HeadlessPersistenceBinding;
269
+ }
270
+ /**
271
+ * The part of an `AutopilotHost` a session uses. `keepPaused` is optional, so a host built before it
272
+ * still fits; `autopilot('keepPaused')` says so when it is missing.
273
+ *
274
+ * @beta
275
+ */
276
+ export type AutopilotLike = Pick<AutopilotHost, 'state' | 'subscribe' | 'pause' | 'resume' | 'stop'> & Partial<Pick<AutopilotHost, 'keepPaused'>>;
277
+ /**
278
+ * What `send` may carry besides the words.
279
+ *
280
+ * @beta
281
+ */
282
+ export interface HeadlessSendOptions {
283
+ readonly attachments?: ChatAttachment[];
284
+ /** Route the turn to this agent, as `SendMessageOptions.agent` does. */
285
+ readonly agent?: string;
286
+ }
287
+ /**
288
+ * What `act` is given besides the action: the arguments a person would fill in.
289
+ *
290
+ * @beta
291
+ */
292
+ export interface HeadlessActArgs {
293
+ /** Written words, for an action that takes `text`, such as `reply`. */
294
+ readonly text?: string;
295
+ /** Options for `select`, by number or label. */
296
+ readonly options?: readonly string[];
297
+ /** A form's fields: an object, or JSON text of one. */
298
+ readonly fields?: unknown;
299
+ }
300
+ /**
301
+ * The result of `act`: the driver's, plus the interaction as it stands when it is still open.
302
+ *
303
+ * @beta
304
+ */
305
+ export type HeadlessActResult = InvokeResult & {
306
+ /** The interaction after the action, when it is still pending. */
307
+ readonly description?: InteractionDescription;
308
+ };
309
+ /**
310
+ * What `read` asks for: a view of the widget, or one of the widget's tools (not both).
311
+ *
312
+ * @beta
313
+ */
314
+ export interface HeadlessReadRequest {
315
+ /** A view's name, from the description's `views`. Absent (with no `tool`): the default read. */
316
+ readonly view?: string;
317
+ /** A widget tool's name, from `HeadlessSessionOptions.widgetTools`. */
318
+ readonly tool?: string;
319
+ /** The tool's arguments. */
320
+ readonly args?: Record<string, unknown>;
321
+ }
322
+ /**
323
+ * The result of `read`: what was read as text (capped), or why it was refused.
324
+ *
325
+ * @beta
326
+ */
327
+ export type HeadlessReadResult = {
328
+ readonly ok: true;
329
+ readonly content: string;
330
+ readonly error?: never;
331
+ } | {
332
+ readonly ok: false;
333
+ readonly content?: never;
334
+ readonly error: string;
335
+ };
336
+ /**
337
+ * What `wait` takes.
338
+ *
339
+ * @beta
340
+ */
341
+ export interface HeadlessWaitRequest {
342
+ /**
343
+ * The cursor: the `seq` of the last event already seen. Events after it are returned. Absent:
344
+ * from the start of the log.
345
+ */
346
+ readonly since?: number;
347
+ /**
348
+ * The event types that end the wait. Default: `decision`, `turn`, `error`, and an `autopilot`
349
+ * entry that `needsUser`. One naming `autopilot` ends it on any autopilot entry.
350
+ */
351
+ readonly until?: readonly HeadlessEventType[];
352
+ /**
353
+ * The longest to wait, in milliseconds. Cut to what a timer can hold (about 24 days); a value that is
354
+ * not a number is no wait at all.
355
+ */
356
+ readonly maxWaitMs: number;
357
+ /** Ends the wait early, with status `'working'`, when it aborts: a caller that has gone away. */
358
+ readonly signal?: AbortSignal;
359
+ }
360
+ /**
361
+ * What `wait` returns.
362
+ *
363
+ * @beta
364
+ */
365
+ export interface HeadlessWaitResult {
366
+ /** Every event after `since`, up to now. */
367
+ readonly events: readonly HeadlessEvent[];
368
+ /**
369
+ * `'ready'`: an event the caller was waiting for is among them. `'working'`: none came in
370
+ * time. `'closed'`: the session was disposed.
371
+ */
372
+ readonly status: 'ready' | 'working' | 'closed';
373
+ /** The cursor to pass as `since` next time: the `seq` of the last event logged. */
374
+ readonly nextSeq: number;
375
+ }
376
+ /**
377
+ * Something else pending, besides the one `state().pending` describes.
378
+ *
379
+ * @beta
380
+ */
381
+ export interface PendingSummary {
382
+ readonly interactionId: string;
383
+ readonly component: string;
384
+ readonly heldBy: string;
385
+ readonly ready: boolean;
386
+ }
387
+ /**
388
+ * What a headless session is doing now.
389
+ *
390
+ * @beta
391
+ */
392
+ export interface HeadlessState {
393
+ /** Whether the driver is running a turn. */
394
+ readonly busy: boolean;
395
+ /** The oldest interaction the person holds and can act on, or `null`. */
396
+ readonly pending: InteractionDescription | null;
397
+ /** The other open interactions: a claimant's, or not ready yet, or behind the first. */
398
+ readonly others: readonly PendingSummary[];
399
+ /** The autopilot's state, when there is one. */
400
+ readonly autopilot?: {
401
+ readonly mode: string;
402
+ readonly status: string;
403
+ readonly needsUser: boolean;
404
+ readonly working: boolean;
405
+ };
406
+ /** What the conversation has cost so far, in `sumUsage`'s four buckets. */
407
+ readonly cost: AggregateUsage;
408
+ /** The host's probe, read now. */
409
+ readonly probe: Readonly<Record<string, unknown>>;
410
+ /** The `seq` of the last event logged: `wait`'s cursor. */
411
+ readonly lastSeq: number;
412
+ }
413
+ /**
414
+ * The input of {@link describeInteraction}: a pending interaction as the driver knows it.
415
+ *
416
+ * @beta
417
+ */
418
+ export interface DescribeInteractionInput {
419
+ readonly ctx: InteractionContext;
420
+ readonly componentName: string;
421
+ readonly data: unknown;
422
+ }
423
+ /**
424
+ * The result of a call that may be refused: the reason, as words, in `error`.
425
+ *
426
+ * @beta
427
+ */
428
+ export type HeadlessResult = {
429
+ readonly ok: true;
430
+ readonly error?: never;
431
+ } | {
432
+ readonly ok: false;
433
+ readonly error: string;
434
+ };
435
+ //# sourceMappingURL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CAAC;IAC3C,gDAAgD;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC7C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { describeInteraction } from './describe-interaction';
2
+ export { headlessCurrentDebugLog, headlessDiagnosticEntries, headlessMetaSnapshot, } from './headless-debug';
3
+ export { HeadlessSession } from './headless-session';
4
+ export type { AutopilotLike, DescribedAction, DescribeInteractionInput, HeadlessActArgs, HeadlessActResult, HeadlessDebugOptions, HeadlessEvent, HeadlessEventBase, HeadlessEventType, HeadlessPersistence, HeadlessPersistenceBinding, HeadlessPersistenceHost, HeadlessReadRequest, HeadlessReadResult, HeadlessResult, HeadlessSendOptions, HeadlessSessionOptions, HeadlessState, HeadlessWaitRequest, HeadlessWaitResult, InteractionDescription, PendingSummary, } from './headless.types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/headless/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { HeadlessEvent, InteractionDescription } from '../headless';
2
+ import type { CompactDecision, CompactEvent, DecisionText } from './types';
3
+ /** The first `lines` lines of `text`, at most `chars` characters, and its full length when it was cut. */
4
+ export declare function firstLines(text: string, lines: number, chars: number): {
5
+ text: string;
6
+ chars?: number;
7
+ };
8
+ /** The keys of `source` that are set, as a new object: a field with nothing to say is dropped. */
9
+ export declare function present<T extends Record<string, unknown>>(source: T): Partial<T>;
10
+ export interface CompactOptions {
11
+ probeEvent?: {
12
+ name: string;
13
+ keys: readonly string[];
14
+ };
15
+ }
16
+ /**
17
+ * One session event, compact. `decision` and `working` are not reported as events: what the person is asked
18
+ * is the reply's `decision`, and what is working is its `working`. A message carries its first lines and
19
+ * its length; a probe event is the host's view of it (see `ServerOptions.probeEvent`).
20
+ */
21
+ export declare function compactEvent(event: HeadlessEvent, options?: CompactOptions): CompactEvent | undefined;
22
+ /**
23
+ * A decision's text without its `Now: <the preview view as JSON>` line, and nothing else (`decisionText:
24
+ * "lean"`). `renderDecision` writes the preview as `Now: ${capRead(JSON.stringify(view))}`: `JSON.stringify`
25
+ * with no indent never breaks a line, so the JSON is the one line, and `capRead` adds a second, `[Cut at …]`,
26
+ * only when it cut it. Both go; in their place is a pointer to `read`. The line is found by position, not
27
+ * by prefix alone: it follows the Views list, whose entry for the preview ends `(shown below as Now)`, so a
28
+ * card that itself has a line starting `Now: ` is not mistaken for it.
29
+ *
30
+ * The text comes back as it was when there is no preview to find (a card with no preview view, or a short-form
31
+ * decision, which shows no `Now:`), or when `views` does not name the one the Views list marks.
32
+ */
33
+ export declare function leanDecisionText(text: string, views?: Readonly<Record<string, string>>): string;
34
+ /**
35
+ * A decision as the reply carries it: what to read and what to choose from, and nothing empty. With
36
+ * `decisionText: "lean"` its `text` leaves out the preview view's JSON ({@link leanDecisionText}); nothing
37
+ * else about it changes.
38
+ */
39
+ export declare function compactDecision(description: InteractionDescription, decisionText?: DecisionText): CompactDecision;
40
+ /**
41
+ * A decision cut to what a caller who has already read the card needs: which interaction, and the actions as
42
+ * `n`, `name`, `enabled`. For the reply to an edit, and to a refused action, where the card has not changed
43
+ * enough to be worth sending again.
44
+ */
45
+ export declare function shortDecision(interactionId: string, component: string, actions: ReadonlyArray<{
46
+ n?: number;
47
+ name: string;
48
+ enabled: boolean;
49
+ }>): CompactDecision;
50
+ /** What an editing action returned, as the reply carries it: whole when small, else its first characters. */
51
+ export declare function capOutput(output: unknown): unknown;
52
+ //# sourceMappingURL=compact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../src/headless-server/compact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,OAA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,EAAE,OAAO,GAAG,OAAO,CASlD"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Node-only entry point for the headless assistant protocol server
3
+ * (`@genesislcap/ai-assistant/headless-server`).
4
+ *
5
+ * The server speaks a small HTTP/JSON protocol over a {@link HeadlessSession}: one JSON command in,
6
+ * one compact JSON reply out. A coding agent or a script can drive an assistant journey with no
7
+ * browser. It uses `node:http` and `node:fs`, so it has an entry of its own, built for Node
8
+ * (`dist/headless-server.{mjs,cjs}`), and is never reachable from the package root
9
+ * (`src/index.ts`): a browser bundle must not see a `node:` import.
10
+ *
11
+ * It knows only a session and Node built-ins. Its imports of `../headless` are type-only, so the
12
+ * bundle carries no second copy of `HeadlessSession`: the session it is given comes from
13
+ * `@genesislcap/ai-assistant` (or `/chat-driver`), whichever the host built it with.
14
+ * `headless-server-entry.test.ts` holds all of this.
15
+ *
16
+ * @packageDocumentation
17
+ * @beta
18
+ */
19
+ export { capOutput, compactDecision, compactEvent, firstLines, leanDecisionText, shortDecision, } from './compact';
20
+ export { createHeadlessServer } from './server';
21
+ export { DECISION_TEXTS, DEFAULT_DECISION_TEXT } from './types';
22
+ export type { Command, CompactAction, CompactDecision, CompactEvent, Composer, DecisionText, ExtraOp, ExtraOpResult, HeadlessServer, HeadlessServerHandle, Reply, ServerOptions, Status, WorkingInfo, } from './types';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/headless-server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChE,YAAY,EACV,OAAO,EACP,aAAa,EACb,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,KAAK,EACL,aAAa,EACb,MAAM,EACN,WAAW,GACZ,MAAM,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type HeadlessServer, type ServerOptions } from './types';
2
+ /**
3
+ * The headless server (PLAN §5, D7): `node:http` on 127.0.0.1, `GET /health` and `POST /cmd`.
4
+ *
5
+ * Every command is APPLIED and then LONG-POLLS (§5.5): the reply comes when the journey next needs the
6
+ * person (an interaction is held by them and ready), a turn ends, the run ends, or something fails, or at
7
+ * `maxWaitMs` with `status: "working"`. Nothing is lost on a client timeout: the command was applied before
8
+ * the wait, events carry `seq`, and `{op: "wait", since}` returns everything after it.
9
+ *
10
+ * The session is the only thing it drives; what the host owns is reached through {@link ServerOptions}.
11
+ */
12
+ export declare function createHeadlessServer(options: ServerOptions): HeadlessServer;
13
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/headless-server/server.ts"],"names":[],"mappings":"AAeA,OAAO,EAQL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAqEjB;;;;;;;;;GASG;AAEH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAiwB3E"}