@inflexa-ai/harness 0.41.1 → 0.42.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 (88) hide show
  1. package/dist/agents/conversation-agent.js +3 -0
  2. package/dist/agents/report-session-agent.d.ts +2 -2
  3. package/dist/agents/report-session-agent.js +4 -0
  4. package/dist/app/chat-turn.d.ts +0 -4
  5. package/dist/app/chat-turn.js +39 -25
  6. package/dist/app/message-assembly.d.ts +2 -2
  7. package/dist/app/message-assembly.js +1 -1
  8. package/dist/contracts/chat-events.d.ts +12 -5
  9. package/dist/contracts/chat-events.js +3 -3
  10. package/dist/contracts/chat-frame.d.ts +40 -0
  11. package/dist/contracts/chat-frame.js +166 -0
  12. package/dist/contracts/chat-parts.d.ts +15 -3
  13. package/dist/contracts/chat-parts.js +2 -2
  14. package/dist/contracts/index.d.ts +6 -4
  15. package/dist/contracts/index.js +1 -0
  16. package/dist/contracts/message.d.ts +7 -5
  17. package/dist/contracts/message.js +1 -1
  18. package/dist/contracts/part-registry.d.ts +6 -6
  19. package/dist/contracts/report-blocks.d.ts +10 -10
  20. package/dist/contracts/report-reference.d.ts +4 -4
  21. package/dist/contracts/schemas/chat-events.d.ts +2 -2
  22. package/dist/contracts/schemas/chat-events.js +2 -2
  23. package/dist/contracts/schemas/chat-parts.d.ts +34 -2
  24. package/dist/contracts/schemas/chat-parts.js +9 -3
  25. package/dist/contracts/schemas/index.d.ts +2 -2
  26. package/dist/contracts/schemas/index.js +2 -2
  27. package/dist/execution/run-event-parts.d.ts +4 -4
  28. package/dist/execution/run-event-parts.js +0 -0
  29. package/dist/execution/run-event-stream.d.ts +2 -2
  30. package/dist/index.d.ts +9 -6
  31. package/dist/index.js +3 -2
  32. package/dist/lib/page-capture.d.ts +27 -9
  33. package/dist/lib/page-capture.js +81 -33
  34. package/dist/loop/compaction.d.ts +8 -3
  35. package/dist/loop/run-agent.d.ts +11 -0
  36. package/dist/loop/run-agent.js +62 -35
  37. package/dist/loop/types.d.ts +3 -0
  38. package/dist/memory/ai-sdk-message-storage.d.ts +18 -3
  39. package/dist/memory/ai-sdk-message-storage.js +23 -1
  40. package/dist/memory/conversation-display-recorder.d.ts +7 -1
  41. package/dist/memory/conversation-display-recorder.js +59 -119
  42. package/dist/memory/conversation-display-replay.d.ts +3 -3
  43. package/dist/memory/conversation-display-replay.js +7 -21
  44. package/dist/memory/conversation-display-storage.d.ts +10 -10
  45. package/dist/memory/conversation-display-storage.js +9 -8
  46. package/dist/memory/conversation-view.d.ts +5 -4
  47. package/dist/memory/conversation-view.js +14 -18
  48. package/dist/memory/count-tokens.js +1 -0
  49. package/dist/memory/message-backfill.d.ts +8 -2
  50. package/dist/memory/thread-store.d.ts +9 -2
  51. package/dist/memory/thread-store.js +8 -2
  52. package/dist/prompts/compaction.d.ts +2 -2
  53. package/dist/prompts/compaction.js +2 -2
  54. package/dist/prompts/conversation.d.ts +1 -1
  55. package/dist/prompts/conversation.js +12 -0
  56. package/dist/prompts/report-session.d.ts +1 -1
  57. package/dist/prompts/report-session.js +40 -28
  58. package/dist/report-model/authoring-grammar.d.ts +4 -4
  59. package/dist/report-render/views/block-mark.d.ts +8 -0
  60. package/dist/report-render/views/block-mark.js +10 -0
  61. package/dist/report-render/views/chart-view.js +2 -1
  62. package/dist/report-render/views/prose.js +10 -6
  63. package/dist/report-render/views/values.js +5 -4
  64. package/dist/runtime/boot.d.ts +2 -2
  65. package/dist/runtime/boot.js +3 -3
  66. package/dist/state/init.d.ts +7 -6
  67. package/dist/state/init.js +51 -672
  68. package/dist/state/migrations/20260927120000_baseline.d.ts +11 -0
  69. package/dist/state/migrations/20260927120000_baseline.js +675 -0
  70. package/dist/state/migrations/20260927180000_thread_title_set_by_user.d.ts +6 -0
  71. package/dist/state/migrations/20260927180000_thread_title_set_by_user.js +10 -0
  72. package/dist/state/migrations/index.d.ts +10 -0
  73. package/dist/state/migrations/index.js +15 -0
  74. package/dist/tools/display/show-user.js +6 -4
  75. package/dist/tools/report-authoring/authoring-tools.d.ts +16 -5
  76. package/dist/tools/report-authoring/authoring-tools.js +52 -24
  77. package/dist/tools/report-session/examine-page.d.ts +29 -14
  78. package/dist/tools/report-session/examine-page.js +40 -16
  79. package/dist/tools/report-session/list-artifacts.d.ts +23 -10
  80. package/dist/tools/report-session/list-artifacts.js +51 -31
  81. package/dist/tools/report-session/page-faults.d.ts +29 -0
  82. package/dist/tools/report-session/page-faults.js +48 -0
  83. package/dist/tools/report-session/preview-report.d.ts +9 -2
  84. package/dist/tools/report-session/preview-report.js +13 -3
  85. package/dist/tools/report-session/record-version.d.ts +5 -1
  86. package/dist/tools/report-session/record-version.js +4 -3
  87. package/dist/tools/workspace/show-file.js +4 -3
  88. package/package.json +2 -1
@@ -190,8 +190,8 @@ export declare const ChartAnnotationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
190
190
  kind: z.ZodLiteral<"point-labels">;
191
191
  column: z.ZodString;
192
192
  order: z.ZodEnum<{
193
- desc: "desc";
194
193
  asc: "asc";
194
+ desc: "desc";
195
195
  }>;
196
196
  n: z.ZodNumber;
197
197
  }, z.core.$strict>], "kind">;
@@ -288,8 +288,8 @@ export declare const ChartCompositionSchema: z.ZodObject<{
288
288
  kind: z.ZodLiteral<"point-labels">;
289
289
  column: z.ZodString;
290
290
  order: z.ZodEnum<{
291
- desc: "desc";
292
291
  asc: "asc";
292
+ desc: "desc";
293
293
  }>;
294
294
  n: z.ZodNumber;
295
295
  }, z.core.$strict>], "kind">>>;
@@ -367,8 +367,8 @@ export declare const ClaimBlockSchema: z.ZodObject<{
367
367
  column: z.ZodString;
368
368
  count: z.ZodNumber;
369
369
  order: z.ZodOptional<z.ZodEnum<{
370
- desc: "desc";
371
370
  asc: "asc";
371
+ desc: "desc";
372
372
  }>>;
373
373
  }, z.core.$strict>>;
374
374
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -519,8 +519,8 @@ export declare const TableBlockSchema: z.ZodObject<{
519
519
  column: z.ZodString;
520
520
  count: z.ZodNumber;
521
521
  order: z.ZodOptional<z.ZodEnum<{
522
- desc: "desc";
523
522
  asc: "asc";
523
+ desc: "desc";
524
524
  }>>;
525
525
  }, z.core.$strict>>;
526
526
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -561,8 +561,8 @@ export declare const ChartBlockSchema: z.ZodObject<{
561
561
  column: z.ZodString;
562
562
  count: z.ZodNumber;
563
563
  order: z.ZodOptional<z.ZodEnum<{
564
- desc: "desc";
565
564
  asc: "asc";
565
+ desc: "desc";
566
566
  }>>;
567
567
  }, z.core.$strict>>;
568
568
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -715,8 +715,8 @@ export declare const ChartBlockSchema: z.ZodObject<{
715
715
  kind: z.ZodLiteral<"point-labels">;
716
716
  column: z.ZodString;
717
717
  order: z.ZodEnum<{
718
- desc: "desc";
719
718
  asc: "asc";
719
+ desc: "desc";
720
720
  }>;
721
721
  n: z.ZodNumber;
722
722
  }, z.core.$strict>], "kind">>>;
@@ -826,8 +826,8 @@ export declare const ATOM_BLOCK_SCHEMAS: readonly [z.ZodObject<{
826
826
  column: z.ZodString;
827
827
  count: z.ZodNumber;
828
828
  order: z.ZodOptional<z.ZodEnum<{
829
- desc: "desc";
830
829
  asc: "asc";
830
+ desc: "desc";
831
831
  }>>;
832
832
  }, z.core.$strict>>;
833
833
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -974,8 +974,8 @@ export declare const ATOM_BLOCK_SCHEMAS: readonly [z.ZodObject<{
974
974
  column: z.ZodString;
975
975
  count: z.ZodNumber;
976
976
  order: z.ZodOptional<z.ZodEnum<{
977
- desc: "desc";
978
977
  asc: "asc";
978
+ desc: "desc";
979
979
  }>>;
980
980
  }, z.core.$strict>>;
981
981
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1005,8 +1005,8 @@ export declare const ATOM_BLOCK_SCHEMAS: readonly [z.ZodObject<{
1005
1005
  column: z.ZodString;
1006
1006
  count: z.ZodNumber;
1007
1007
  order: z.ZodOptional<z.ZodEnum<{
1008
- desc: "desc";
1009
1008
  asc: "asc";
1009
+ desc: "desc";
1010
1010
  }>>;
1011
1011
  }, z.core.$strict>>;
1012
1012
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1159,8 +1159,8 @@ export declare const ATOM_BLOCK_SCHEMAS: readonly [z.ZodObject<{
1159
1159
  kind: z.ZodLiteral<"point-labels">;
1160
1160
  column: z.ZodString;
1161
1161
  order: z.ZodEnum<{
1162
- desc: "desc";
1163
1162
  asc: "asc";
1163
+ desc: "desc";
1164
1164
  }>;
1165
1165
  n: z.ZodNumber;
1166
1166
  }, z.core.$strict>], "kind">>>;
@@ -59,8 +59,8 @@ export declare const RowBoundSchema: z.ZodObject<{
59
59
  column: z.ZodString;
60
60
  count: z.ZodNumber;
61
61
  order: z.ZodOptional<z.ZodEnum<{
62
- desc: "desc";
63
62
  asc: "asc";
63
+ desc: "desc";
64
64
  }>>;
65
65
  }, z.core.$strict>;
66
66
  /**
@@ -79,8 +79,8 @@ export declare const ArtifactTableReferenceSchema: z.ZodObject<{
79
79
  column: z.ZodString;
80
80
  count: z.ZodNumber;
81
81
  order: z.ZodOptional<z.ZodEnum<{
82
- desc: "desc";
83
82
  asc: "asc";
83
+ desc: "desc";
84
84
  }>>;
85
85
  }, z.core.$strict>>;
86
86
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -231,8 +231,8 @@ export declare const ReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
231
  column: z.ZodString;
232
232
  count: z.ZodNumber;
233
233
  order: z.ZodOptional<z.ZodEnum<{
234
- desc: "desc";
235
234
  asc: "asc";
235
+ desc: "desc";
236
236
  }>>;
237
237
  }, z.core.$strict>>;
238
238
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -417,8 +417,8 @@ export declare const UnresolvedReferenceSchema: z.ZodObject<{
417
417
  column: z.ZodString;
418
418
  count: z.ZodNumber;
419
419
  order: z.ZodOptional<z.ZodEnum<{
420
- desc: "desc";
421
420
  asc: "asc";
421
+ desc: "desc";
422
422
  }>>;
423
423
  }, z.core.$strict>>;
424
424
  columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Zod schemas for Cortex-native chat-stream events — validation at boundaries.
2
+ * Zod schemas for chat-stream events — validation at boundaries.
3
3
  */
4
4
  import { z } from "zod";
5
5
  export declare const EventSourceSchema: z.ZodObject<{
@@ -83,7 +83,7 @@ export declare const ChatErrorEventSchema: z.ZodObject<{
83
83
  callPath: z.ZodArray<z.ZodString>;
84
84
  }, z.core.$strip>;
85
85
  }, z.core.$strip>;
86
- export declare const CortexChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
87
87
  type: z.ZodLiteral<"text-delta">;
88
88
  text: z.ZodString;
89
89
  source: z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Zod schemas for Cortex-native chat-stream events — validation at boundaries.
2
+ * Zod schemas for chat-stream events — validation at boundaries.
3
3
  */
4
4
  import { z } from "zod";
5
5
  import { TokenUsageRollupSchema } from "./usage.js";
@@ -45,7 +45,7 @@ export const ChatErrorEventSchema = z.object({
45
45
  reason: z.string().optional(),
46
46
  source: EventSourceSchema,
47
47
  });
48
- export const CortexChatEventSchema = z.discriminatedUnion("type", [
48
+ export const ChatEventSchema = z.discriminatedUnion("type", [
49
49
  TextDeltaEventSchema,
50
50
  ToolStartedEventSchema,
51
51
  ToolFinishedEventSchema,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Zod schemas for Cortex chat data parts — validation at boundaries.
2
+ * Zod schemas for chat data parts — validation at boundaries.
3
3
  */
4
4
  import { z } from "zod";
5
5
  export declare const PlanStepSchema: z.ZodObject<{
@@ -11,8 +11,16 @@ export declare const PlanStepSchema: z.ZodObject<{
11
11
  resources: z.ZodOptional<z.ZodObject<{
12
12
  cpu: z.ZodNumber;
13
13
  memoryGb: z.ZodNumber;
14
+ gpu: z.ZodOptional<z.ZodObject<{
15
+ count: z.ZodNumber;
16
+ }, z.core.$strip>>;
14
17
  }, z.core.$strip>>;
15
18
  maxSteps: z.ZodNumber;
19
+ track: z.ZodOptional<z.ZodString>;
20
+ step_type: z.ZodOptional<z.ZodString>;
21
+ acceptance_criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
+ caveats: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
24
  }, z.core.$strip>;
17
25
  export declare const PresentationContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
26
  kind: z.ZodLiteral<"echart">;
@@ -93,8 +101,16 @@ export declare const PlanPartSchema: z.ZodObject<{
93
101
  resources: z.ZodOptional<z.ZodObject<{
94
102
  cpu: z.ZodNumber;
95
103
  memoryGb: z.ZodNumber;
104
+ gpu: z.ZodOptional<z.ZodObject<{
105
+ count: z.ZodNumber;
106
+ }, z.core.$strip>>;
96
107
  }, z.core.$strip>>;
97
108
  maxSteps: z.ZodNumber;
109
+ track: z.ZodOptional<z.ZodString>;
110
+ step_type: z.ZodOptional<z.ZodString>;
111
+ acceptance_criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
+ caveats: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
114
  }, z.core.$strip>>>;
99
115
  analytical_narrative: z.ZodOptional<z.ZodString>;
100
116
  omicsType: z.ZodOptional<z.ZodString>;
@@ -484,8 +500,12 @@ export declare const CompactionPartSchema: z.ZodObject<{
484
500
  tokensBefore: z.ZodNumber;
485
501
  tokensAfter: z.ZodOptional<z.ZodNumber>;
486
502
  durationMs: z.ZodOptional<z.ZodNumber>;
503
+ trigger: z.ZodOptional<z.ZodEnum<{
504
+ "turn-start": "turn-start";
505
+ "mid-turn": "mid-turn";
506
+ }>>;
487
507
  }, z.core.$strip>;
488
- export declare const CortexChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
508
+ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
489
509
  type: z.ZodLiteral<"data-presentation">;
490
510
  id: z.ZodString;
491
511
  title: z.ZodOptional<z.ZodString>;
@@ -533,8 +553,16 @@ export declare const CortexChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
533
553
  resources: z.ZodOptional<z.ZodObject<{
534
554
  cpu: z.ZodNumber;
535
555
  memoryGb: z.ZodNumber;
556
+ gpu: z.ZodOptional<z.ZodObject<{
557
+ count: z.ZodNumber;
558
+ }, z.core.$strip>>;
536
559
  }, z.core.$strip>>;
537
560
  maxSteps: z.ZodNumber;
561
+ track: z.ZodOptional<z.ZodString>;
562
+ step_type: z.ZodOptional<z.ZodString>;
563
+ acceptance_criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
564
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
565
+ caveats: z.ZodOptional<z.ZodArray<z.ZodString>>;
538
566
  }, z.core.$strip>>>;
539
567
  analytical_narrative: z.ZodOptional<z.ZodString>;
540
568
  omicsType: z.ZodOptional<z.ZodString>;
@@ -788,4 +816,8 @@ export declare const CortexChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
788
816
  tokensBefore: z.ZodNumber;
789
817
  tokensAfter: z.ZodOptional<z.ZodNumber>;
790
818
  durationMs: z.ZodOptional<z.ZodNumber>;
819
+ trigger: z.ZodOptional<z.ZodEnum<{
820
+ "turn-start": "turn-start";
821
+ "mid-turn": "mid-turn";
822
+ }>>;
791
823
  }, z.core.$strip>], "type">;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Zod schemas for Cortex chat data parts — validation at boundaries.
2
+ * Zod schemas for chat data parts — validation at boundaries.
3
3
  */
4
4
  import { z } from "zod";
5
5
  import { TokenUsageRollupSchema } from "./usage.js";
@@ -10,8 +10,13 @@ export const PlanStepSchema = z.object({
10
10
  agent: z.string(),
11
11
  question: z.string(),
12
12
  depends_on: z.array(z.string()),
13
- resources: z.object({ cpu: z.number(), memoryGb: z.number() }).optional(),
13
+ resources: z.object({ cpu: z.number(), memoryGb: z.number(), gpu: z.object({ count: z.number() }).optional() }).optional(),
14
14
  maxSteps: z.number(),
15
+ track: z.string().optional(),
16
+ step_type: z.string().optional(),
17
+ acceptance_criteria: z.array(z.string()).optional(),
18
+ constraints: z.array(z.string()).optional(),
19
+ caveats: z.array(z.string()).optional(),
15
20
  });
16
21
  export const PresentationContentSchema = z.discriminatedUnion("kind", [
17
22
  z.object({
@@ -307,9 +312,10 @@ export const CompactionPartSchema = z.object({
307
312
  tokensBefore: z.number().int().nonnegative(),
308
313
  tokensAfter: z.number().int().nonnegative().optional(),
309
314
  durationMs: z.number().int().nonnegative().optional(),
315
+ trigger: z.enum(["turn-start", "mid-turn"]).optional(),
310
316
  });
311
317
  // ── Union ───────────────────────────────────────────────────────────
312
- export const CortexChatPartSchema = z.discriminatedUnion("type", [
318
+ export const ChatPartSchema = z.discriminatedUnion("type", [
313
319
  PresentationPartSchema,
314
320
  PlanPartSchema,
315
321
  RunCardPartSchema,
@@ -1,3 +1,3 @@
1
- export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, CortexChatPartSchema, } from "./chat-parts.js";
2
- export { EventSourceSchema, TextDeltaEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, CortexChatEventSchema, } from "./chat-events.js";
1
+ export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
2
+ export { EventSourceSchema, TextDeltaEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, ChatEventSchema, } from "./chat-events.js";
3
3
  export { TokenUsageRollupSchema } from "./usage.js";
@@ -1,3 +1,3 @@
1
- export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, CortexChatPartSchema, } from "./chat-parts.js";
2
- export { EventSourceSchema, TextDeltaEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, CortexChatEventSchema, } from "./chat-events.js";
1
+ export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
2
+ export { EventSourceSchema, TextDeltaEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, ChatEventSchema, } from "./chat-events.js";
3
3
  export { TokenUsageRollupSchema } from "./usage.js";
@@ -8,14 +8,14 @@
8
8
  * durability engine, no clock — and keeping them here is what lets that be
9
9
  * proven directly instead of inferred from a driven subscription.
10
10
  */
11
- import type { CortexChatPart } from "../contracts/chat-parts.js";
11
+ import type { ChatPart } from "../contracts/chat-parts.js";
12
12
  /**
13
13
  * Narrow one raw stream value to a chat data part, or `null` when it is not one.
14
14
  *
15
15
  * A run's streams carry more than the contract: a sandbox step also writes its
16
16
  * loop orchestration under envelopes (`data-loop-event`, `data-sandbox-event`)
17
17
  * that belong to the workflow layer and have no registry entry. The seam's
18
- * contract is the `CortexChatPart` union, so anything the registry does not
18
+ * contract is the `ChatPart` union, so anything the registry does not
19
19
  * classify is not deliverable — which also covers a part written by a producer
20
20
  * newer than the reader.
21
21
  *
@@ -26,7 +26,7 @@ import type { CortexChatPart } from "../contracts/chat-parts.js";
26
26
  * the discriminant is the boundary that can actually drift (a producer emitting
27
27
  * something else entirely) and the one worth checking.
28
28
  */
29
- export declare function parseRunEventPart(value: unknown): CortexChatPart | null;
29
+ export declare function parseRunEventPart(value: unknown): ChatPart | null;
30
30
  /**
31
31
  * Collapse a batch of parts so each reconciling id appears once, carrying its
32
32
  * latest value, and every other part survives untouched in write order.
@@ -41,4 +41,4 @@ export declare function parseRunEventPart(value: unknown): CortexChatPart | null
41
41
  * A survivor keeps the position of its LAST occurrence, so relative order among
42
42
  * the parts that are delivered is the order they were written.
43
43
  */
44
- export declare function foldRunEventParts(parts: readonly CortexChatPart[]): CortexChatPart[];
44
+ export declare function foldRunEventParts(parts: readonly ChatPart[]): ChatPart[];
Binary file
@@ -31,7 +31,7 @@
31
31
  * writer it observes.
32
32
  */
33
33
  import type { Pool } from "pg";
34
- import type { CortexChatPart } from "../contracts/chat-parts.js";
34
+ import type { ChatPart } from "../contracts/chat-parts.js";
35
35
  import type { Logger } from "../lib/logger.js";
36
36
  /**
37
37
  * Construction-time dependencies. The pool is the application pool the run
@@ -48,7 +48,7 @@ export interface RunEventStreamDeps {
48
48
  * never invoked concurrently with itself and back-pressure is the caller's to
49
49
  * exert by taking its time. A throw is logged and swallowed.
50
50
  */
51
- export type RunEventPartHandler = (part: CortexChatPart) => void | Promise<void>;
51
+ export type RunEventPartHandler = (part: ChatPart) => void | Promise<void>;
52
52
  /** Call-time parameters of one subscription. */
53
53
  export interface RunEventSubscribeOptions {
54
54
  /** The run to observe. Also the parent workflow's id. */
package/dist/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export { UnavailableAsk, AskRejectedError } from "./tools/approval/contract.js";
60
60
  export type { Ask, AskRequest, AskReply, AskApproval } from "./tools/approval/contract.js";
61
61
  export { runAgent, finalText } from "./loop/run-agent.js";
62
62
  export type { RunAgentOptions, RunAgentResult, AgentFinish, AgentRound } from "./loop/run-agent.js";
63
- export type { CompactionPolicy } from "./loop/compaction.js";
63
+ export type { CompactionPolicy, CompactionRules } from "./loop/compaction.js";
64
64
  export type { ToolMask } from "./loop/tool-mask.js";
65
65
  export type { AgentDefinition, RunStep, EmitFn, EmitEvent, EventSource } from "./loop/types.js";
66
66
  export type { KeptToolOutput, ToolOutputStore } from "./loop/tool-output.js";
@@ -82,7 +82,7 @@ export type { SuspendOn } from "./providers/errors.js";
82
82
  export { suspensionOfFailure } from "./workflows/suspension.js";
83
83
  export type { Suspension } from "./workflows/suspension.js";
84
84
  export { createStreamingChat } from "./providers/streaming-chat.js";
85
- export { DEFAULT_CONVERSATION_BUDGET, openChatTurn, prepareChatTurn, runChatTurn } from "./app/chat-turn.js";
85
+ export { openChatTurn, prepareChatTurn, runChatTurn } from "./app/chat-turn.js";
86
86
  export type { ChatTurnOutcome, ChatTurnRan, ChatTurnRefusal, ChatTurnResult, ChatTurnSession, OpenChatTurn, OpenChatTurnParams, PrepareChatTurnDeps, PrepareChatTurnParams, PrepareChatTurnResult, RunChatTurnDeps, RunChatTurnParams, RunOpenChatTurnParams, } from "./app/chat-turn.js";
87
87
  export { createThreadStore } from "./memory/thread-store.js";
88
88
  export type { ThreadStore, Thread, ThreadType, ThreadInputError, CreateThreadInput, ListThreadsInput, ThreadPage } from "./memory/thread-store.js";
@@ -93,12 +93,15 @@ export { createConversationDisplayRecorder } from "./memory/conversation-display
93
93
  export type { ConversationDisplayRecorder, ConversationDisplayRecorderOptions } from "./memory/conversation-display-recorder.js";
94
94
  export { envelopeDisplayMessages, parseStoredDisplayEnvelope } from "./memory/conversation-display-storage.js";
95
95
  export type { ConversationDisplayMetadata, ConversationUIData, ConversationUIMessage, StoredDisplayEnvelope } from "./memory/conversation-display-storage.js";
96
- export { storedMessagesToCortex } from "./memory/conversation-display-replay.js";
97
- export type { CortexChatEvent, TextDeltaEvent, ToolStartedEvent, ToolFinishedEvent, ToolOutcome, ToolCallOutcome, ToolCallDetail, FinishEvent, ChatErrorEvent, } from "./contracts/chat-events.js";
96
+ export { storedMessagesToChat } from "./memory/conversation-display-replay.js";
97
+ export type { ChatEvent, ChatFrame, ChatPartFrame, TextDeltaEvent, ToolStartedEvent, ToolFinishedEvent, ToolOutcome, ToolCallOutcome, ToolCallDetail, FinishEvent, ChatErrorEvent, } from "./contracts/chat-events.js";
98
+ export { toChatFrame, applyChatFrame, checkChatPart } from "./contracts/chat-frame.js";
99
+ export type { TextPart, ToolCallPart, MessagePart, ChatMessage } from "./contracts/message.js";
100
+ export type { TurnTerminal, ApplyFrameResult, ChatPartCheck } from "./contracts/chat-frame.js";
98
101
  export type { TokenUsageRollup } from "./contracts/usage.js";
99
- export type { CortexChatPart, PresentationPart, PresentationContent, PlanPart, RunCardPart, FileReferencePart, FileReferenceEntry, RunStartedPart, DagStatePart, DagStepState, StepStatus, StepActivityPart, StepPhase, StepFileTreePart, FileTreeEntry, StepOutputPart, StepOutputFile, StepSummaryPart, StepUsagePart, StepBlockedPart, RunSynthesisPart, SynthesizedFinding, BiologicalTheme, SynthesisProgressPart, SynthesisPhase, RunCompletedPart, RunCompletedFinding, RunFailedPart, CompactionPart, } from "./contracts/chat-parts.js";
102
+ export type { ChatPart, PresentationPart, PresentationContent, PlanPart, RunCardPart, FileReferencePart, FileReferenceEntry, RunStartedPart, DagStatePart, DagStepState, StepStatus, StepActivityPart, StepPhase, StepFileTreePart, FileTreeEntry, StepOutputPart, StepOutputFile, StepSummaryPart, StepUsagePart, StepBlockedPart, RunSynthesisPart, SynthesizedFinding, BiologicalTheme, SynthesisProgressPart, SynthesisPhase, RunCompletedPart, RunCompletedFinding, RunFailedPart, CompactionPart, AskPart, ChildSessionStartedPart, ReportRenderedPart, } from "./contracts/chat-parts.js";
100
103
  export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./contracts/part-registry.js";
101
- export type { CortexChatPartType, PartDescriptor, PartEmitter, PartConsumer } from "./contracts/part-registry.js";
104
+ export type { ChatPartType, PartDescriptor, PartEmitter, PartConsumer } from "./contracts/part-registry.js";
102
105
  export { parseStructureUrl, alphafoldEntryUrl, alphafoldPredictionUrl } from "./contracts/structure-source.js";
103
106
  export type { StructureSource, StructureFormat } from "./contracts/structure-source.js";
104
107
  export { launchDbos, shutdownDbos, sweepEphemeralWorkflows } from "./runtime/dbos.js";
package/dist/index.js CHANGED
@@ -130,7 +130,7 @@ export { createStreamingChat } from "./providers/streaming-chat.js";
130
130
  // and gives only its transport values: the harness stores the opening, each round,
131
131
  // and the outcome. `appendTurn` stays for a record of a host. `createThreadStore`
132
132
  // owns thread metadata (create/list/title).
133
- export { DEFAULT_CONVERSATION_BUDGET, openChatTurn, prepareChatTurn, runChatTurn } from "./app/chat-turn.js";
133
+ export { openChatTurn, prepareChatTurn, runChatTurn } from "./app/chat-turn.js";
134
134
  export { createThreadStore } from "./memory/thread-store.js";
135
135
  export { createThreadHistory, conversationRecordTurn } from "./memory/thread-history.js";
136
136
  // The synthetic-message primitives. A host appends a record of out-of-band work (an analysis run's
@@ -154,7 +154,8 @@ export { envelopeDisplayMessages, parseStoredDisplayEnvelope } from "./memory/co
154
154
  // along with the startup backfill that was its only caller. `parseStoredDisplayEnvelope` absorbs the
155
155
  // one thing a read can now meet and not understand — a part whose key this vocabulary has retired —
156
156
  // by dropping that part, so one stale row cannot fail a whole thread.
157
- export { storedMessagesToCortex } from "./memory/conversation-display-replay.js";
157
+ export { storedMessagesToChat } from "./memory/conversation-display-replay.js";
158
+ export { toChatFrame, applyChatFrame, checkChatPart } from "./contracts/chat-frame.js";
158
159
  export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./contracts/part-registry.js";
159
160
  // The source grammar of a `structure` presentation card — a host re-runs the same parse over a
160
161
  // persisted `url` before it fetches, so the rule lives in one place for both sides.
@@ -5,12 +5,16 @@
5
5
  * readiness signal of the page, and gives back base64 screenshots. The eyes tool of a report session reads
6
6
  * this module.
7
7
  *
8
+ * The layout resolves at the CSS width of a reader, and the picture renders at half the device scale. A
9
+ * picture costs tokens in proportion to its area, thus the half scale lets one look hold a whole report.
10
+ *
8
11
  * A short page captures as one full-page shot. A tall page captures as consecutive vertical slices, because
9
- * one tall picture dies twice on the provider path: a picture past the hard dimension cap rejects the whole
10
- * request, and a legal tall picture downscales to about 1568 pixels on the long side, which compresses the
11
- * text past legibility. A slice of about two window heights survives both. The slice budget bounds what one
12
- * look costs, and a page past the budget truncates with the captured and the total pixels on the coverage,
13
- * thus the truncation is never silent.
12
+ * the model reads a picture whole only up to a limit on the long edge, and a taller picture downscales or
13
+ * refuses the request. The slice budget bounds what one look costs, and a page past the budget truncates
14
+ * with the captured and the total pixels on the coverage, thus the truncation is never silent.
15
+ *
16
+ * A capture can also take one block alone. The renderer marks each block with its id, and the capture clips
17
+ * the union box of the marked elements with a margin. A page that holds no such mark gives no picture.
14
18
  *
15
19
  * The readiness contract is the reason for one shared body. The renderer emits the event name and the
16
20
  * sentinel name, and `report-render/page.ts` owns both constants together with the two budgets. This module
@@ -45,6 +49,9 @@ export interface CapturedShot {
45
49
  * thus `capturedPx < totalPx` says that the slice budget ran out and the tail of the page is absent. `viewport`
46
50
  * appears when a screenshot threw and the retry at the window passed, thus the one picture shows the top
47
51
  * window alone and a section below the fold is absent from it.
52
+ *
53
+ * `block` is the box of one block and its margin; `capturedPx < totalPx` says that the slice budget cut it.
54
+ * `no-block` means that no element of the page carries the mark of the block, thus no picture exists.
48
55
  */
49
56
  export type CaptureCoverage = {
50
57
  readonly kind: "full";
@@ -54,10 +61,19 @@ export type CaptureCoverage = {
54
61
  readonly totalPx: number;
55
62
  } | {
56
63
  readonly kind: "viewport";
64
+ } | {
65
+ readonly kind: "block";
66
+ readonly capturedPx: number;
67
+ readonly totalPx: number;
68
+ } | {
69
+ readonly kind: "no-block";
57
70
  };
58
71
  /** The pictures and the faults of one page capture. */
59
72
  export interface PageCapture {
60
- /** The pictures in document order: one shot under `full` and `viewport`, the slices under `tiled`. */
73
+ /**
74
+ * The pictures in document order: one shot under `full` and `viewport`, the slices under `tiled` and
75
+ * `block`, and none under `no-block`.
76
+ */
61
77
  screenshots: CapturedShot[];
62
78
  coverage: CaptureCoverage;
63
79
  consoleErrors: string[];
@@ -68,13 +84,15 @@ export interface PageCapture {
68
84
  * speaks the throw protocol, because the chrome connection does. A test injects a seam that reads no
69
85
  * browser, thus a tool orchestration runs with no chrome sidecar.
70
86
  */
71
- export type CapturePage = (url: string) => Promise<PageCapture>;
72
- /** The extra settle steps that one call site needs. A call site that needs neither passes nothing. */
87
+ export type CapturePage = (url: string, options?: CaptureOptions) => Promise<PageCapture>;
88
+ /** The extra settle steps and the target of one capture. A call site that needs none passes nothing. */
73
89
  export interface CaptureOptions {
74
90
  /** A CSS selector to wait for after the readiness signal. The wait is best-effort. */
75
91
  readonly waitForSelector?: string;
76
92
  /** An extra settle time in milliseconds after the readiness signal, for a late paint. */
77
93
  readonly waitMs?: number;
94
+ /** The id of the one block to capture. Absent, the capture takes the whole document. */
95
+ readonly blockId?: string;
78
96
  }
79
97
  /**
80
98
  * Capture one page: the screenshots, the console errors, and the failed requests.
@@ -82,7 +100,7 @@ export interface CaptureOptions {
82
100
  * The pictures hold the document, and not the window alone. Thus a caller can judge a section that a reader
83
101
  * reaches by a scroll. A short page arrives as one full-page shot, and a tall page arrives as consecutive
84
102
  * slices in document order. A refused bitmap degrades to the window, and the coverage of the result names
85
- * what the pictures hold.
103
+ * what the pictures hold. A capture that names a block holds that block alone.
86
104
  *
87
105
  * The readiness wait is best-effort. A page that never signals still captures at the readiness budget, thus
88
106
  * a broken page gives a picture that shows what broke.