@north-light/crouter 0.3.192 → 0.3.193

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 (167) hide show
  1. package/dist/api/client.d.ts +31 -10
  2. package/dist/api/client.js +83 -24
  3. package/dist/api/dto/bash-jobs.d.ts +22 -0
  4. package/dist/api/dto/bash-jobs.js +9 -0
  5. package/dist/api/dto/human.d.ts +3 -4
  6. package/dist/api/dto/inbox.d.ts +106 -65
  7. package/dist/api/dto/inbox.js +2 -8
  8. package/dist/api/index.d.ts +1 -0
  9. package/dist/api/index.js +1 -0
  10. package/dist/api/routes.d.ts +7 -0
  11. package/dist/api/routes.js +7 -0
  12. package/dist/builtin-memory/internal/storage-tiers.md +1 -1
  13. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/serial/provider-rotation.test.ts +101 -3
  14. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.d.ts +6 -2
  15. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +68 -14
  16. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +87 -13
  17. package/dist/clients/attach/__tests__/chat-view-snapshot-ordering.test.js +2 -2
  18. package/dist/clients/attach/__tests__/group-activity.test.js +2 -2
  19. package/dist/clients/attach/chrome/canvas-panels.d.ts +1 -1
  20. package/dist/clients/attach/chrome/canvas-panels.js +1 -1
  21. package/dist/clients/attach/input/overlay-owner.js +1 -1
  22. package/dist/clients/attach/overlays/auth.js +34 -8
  23. package/dist/clients/attach/overlays/pickers.d.ts +5 -8
  24. package/dist/clients/attach/overlays/pickers.js +37 -43
  25. package/dist/clients/attach/viewer.js +643 -620
  26. package/dist/clients/inbox/__tests__/serial/inbox-controller.test.js +38 -128
  27. package/dist/clients/inbox/__tests__/serial/mount-panel.test.js +72 -148
  28. package/dist/clients/inbox/controller.d.ts +2 -3
  29. package/dist/clients/inbox/controller.js +41 -42
  30. package/dist/clients/inbox/page-adapter.d.ts +33 -0
  31. package/dist/clients/inbox/page-adapter.js +54 -0
  32. package/dist/clients/inbox/resolve.d.ts +2 -2
  33. package/dist/clients/inbox/resolve.js +1 -1
  34. package/dist/clients/inbox/review-visibility.d.ts +1 -1
  35. package/dist/clients/inbox/review-visibility.js +1 -1
  36. package/dist/clients/inbox/tui/ansi.d.ts +1 -1
  37. package/dist/clients/inbox/tui/ansi.js +2 -2
  38. package/dist/clients/inbox/tui/input.d.ts +1 -3
  39. package/dist/clients/inbox/tui/input.js +242 -553
  40. package/dist/clients/inbox/tui/panel.d.ts +3 -1
  41. package/dist/clients/inbox/tui/panel.js +59 -187
  42. package/dist/clients/inbox/tui/render.d.ts +0 -25
  43. package/dist/clients/inbox/tui/render.js +165 -416
  44. package/dist/clients/inbox/tui/slots.d.ts +32 -0
  45. package/dist/clients/inbox/tui/slots.js +156 -0
  46. package/dist/clients/inbox/tui/types.d.ts +25 -13
  47. package/dist/clients/inbox/tui.js +5 -3
  48. package/dist/commands/attention.js +2 -2
  49. package/dist/commands/human/doc.js +66 -20
  50. package/dist/commands/human/prompts.d.ts +3 -3
  51. package/dist/commands/human/prompts.js +158 -112
  52. package/dist/commands/human/queue.d.ts +0 -1
  53. package/dist/commands/human/queue.js +34 -94
  54. package/dist/commands/human/shared.d.ts +10 -4
  55. package/dist/commands/human/shared.js +62 -13
  56. package/dist/commands/human.js +8 -4
  57. package/dist/commands/memory/read.js +13 -5
  58. package/dist/commands/node/bash.js +15 -28
  59. package/dist/commands/surface/node/focus.js +1 -1
  60. package/dist/core/__tests__/human-deliver.test.js +40 -46
  61. package/dist/core/__tests__/seam/broker-attach-stream.test.js +7 -1
  62. package/dist/core/__tests__/serial/human-deliver-e2e.test.js +40 -31
  63. package/dist/core/__tests__/serial/spawn-root.test.js +3 -1
  64. package/dist/core/__tests__/spawn-worktree-id-conflict.test.js +3 -1
  65. package/dist/core/auth-interaction.d.ts +2 -2
  66. package/dist/core/bash-jobs.d.ts +32 -0
  67. package/dist/core/bash-jobs.js +72 -1
  68. package/dist/core/canvas/__tests__/attention.test.js +16 -10
  69. package/dist/core/canvas/__tests__/render-remote.test.js +9 -3
  70. package/dist/core/canvas/attention.js +1 -1
  71. package/dist/core/canvas/browse/app.js +1 -1
  72. package/dist/core/canvas/nav-model.d.ts +1 -1
  73. package/dist/core/canvas/nav-model.js +1 -1
  74. package/dist/core/canvas/remote-canvas-source.js +1 -1
  75. package/dist/core/config.js +4 -1
  76. package/dist/core/human/__tests__/page-render.test.d.ts +1 -0
  77. package/dist/core/human/__tests__/page-render.test.js +49 -0
  78. package/dist/core/human/__tests__/page-tickets.test.d.ts +1 -0
  79. package/dist/core/human/__tests__/page-tickets.test.js +112 -0
  80. package/dist/core/human/__tests__/page.test.d.ts +1 -0
  81. package/dist/core/human/__tests__/page.test.js +139 -0
  82. package/dist/core/human/__tests__/serial/inbox-core.test.js +42 -32
  83. package/dist/core/human/claim.js +2 -2
  84. package/dist/core/human/convention.d.ts +4 -4
  85. package/dist/core/human/convention.js +6 -13
  86. package/dist/core/human/markdown-html.d.ts +8 -0
  87. package/dist/core/human/markdown-html.js +581 -0
  88. package/dist/core/human/page-catalog.d.ts +6 -0
  89. package/dist/core/human/page-catalog.js +43 -0
  90. package/dist/core/human/page-render.d.ts +3 -0
  91. package/dist/core/human/page-render.js +131 -0
  92. package/dist/core/human/page-schema.d.ts +312 -0
  93. package/dist/core/human/page-schema.js +291 -0
  94. package/dist/core/human/page-synth.d.ts +9 -0
  95. package/dist/core/human/page-synth.js +17 -0
  96. package/dist/core/human/page.d.ts +22 -0
  97. package/dist/core/human/page.js +427 -0
  98. package/dist/core/human/review-schema.d.ts +19 -0
  99. package/dist/core/human/review-schema.js +34 -0
  100. package/dist/core/human/scan.d.ts +12 -3
  101. package/dist/core/human/scan.js +69 -26
  102. package/dist/core/human/summary.d.ts +5 -6
  103. package/dist/core/human/summary.js +54 -37
  104. package/dist/core/human/tickets.d.ts +61 -11
  105. package/dist/core/human/tickets.js +100 -57
  106. package/dist/core/human/types.d.ts +21 -66
  107. package/dist/core/human/types.js +1 -5
  108. package/dist/core/preview-registry.js +0 -1
  109. package/dist/core/review/ticket-filter.d.ts +1 -1
  110. package/dist/core/review/ticket-filter.js +2 -8
  111. package/dist/core/runtime/broker/read-ops.js +3 -0
  112. package/dist/core/runtime/broker.js +19 -10
  113. package/dist/core/runtime/package-health.js +1 -1
  114. package/dist/core/termrender/termrender.d.ts +1 -1
  115. package/dist/core/termrender/termrender.js +2 -2
  116. package/dist/core/tui/page-host.d.ts +1 -1
  117. package/dist/core/tui/page-host.js +2 -2
  118. package/dist/core/user-settings.d.ts +19 -0
  119. package/dist/core/user-settings.js +22 -0
  120. package/dist/daemon/api/handlers/bash-jobs.d.ts +2 -0
  121. package/dist/daemon/api/handlers/bash-jobs.js +89 -0
  122. package/dist/daemon/api/handlers/human.js +16 -14
  123. package/dist/daemon/api/handlers/inbox.js +311 -227
  124. package/dist/daemon/api/router.d.ts +5 -1
  125. package/dist/daemon/api/router.js +5 -0
  126. package/dist/daemon/api/server.js +2 -0
  127. package/dist/daemon/cron-run.js +23 -10
  128. package/dist/daemon/human/finish.d.ts +8 -3
  129. package/dist/daemon/human/finish.js +35 -15
  130. package/dist/pages/bundle.css +1 -0
  131. package/dist/pages/bundle.js +1347 -0
  132. package/dist/pages/comments.d.ts +34 -0
  133. package/dist/pages/comments.js +72 -0
  134. package/dist/pages/elements/cards.d.ts +17 -0
  135. package/dist/pages/elements/cards.js +785 -0
  136. package/dist/pages/elements/chart.d.ts +1 -0
  137. package/dist/pages/elements/chart.js +648 -0
  138. package/dist/pages/elements/options.d.ts +21 -0
  139. package/dist/pages/elements/options.js +604 -0
  140. package/dist/pages/elements/pages.d.ts +24 -0
  141. package/dist/pages/elements/pages.js +355 -0
  142. package/dist/pages/elements/slot.d.ts +21 -0
  143. package/dist/pages/elements/slot.js +105 -0
  144. package/dist/pages/elements/table.d.ts +19 -0
  145. package/dist/pages/elements/table.js +906 -0
  146. package/dist/pages/elements/text.d.ts +25 -0
  147. package/dist/pages/elements/text.js +951 -0
  148. package/dist/pages/entry.d.ts +8 -0
  149. package/dist/pages/entry.js +8 -0
  150. package/dist/pages/host.d.ts +132 -0
  151. package/dist/pages/host.js +149 -0
  152. package/dist/pages/register.d.ts +2 -0
  153. package/dist/pages/register.js +3 -0
  154. package/dist/pages/slot-config.d.ts +36 -0
  155. package/dist/pages/slot-config.js +50 -0
  156. package/dist/pages/types.d.ts +98 -0
  157. package/dist/pages/types.js +23 -0
  158. package/dist/types.d.ts +4 -0
  159. package/dist/types.js +2 -0
  160. package/package.json +8 -8
  161. package/runtime.lock.json +156 -101
  162. package/dist/clients/inbox/deck-adapter.d.ts +0 -29
  163. package/dist/clients/inbox/deck-adapter.js +0 -63
  164. package/dist/core/human/deck-factories.d.ts +0 -8
  165. package/dist/core/human/deck-factories.js +0 -15
  166. package/dist/core/human/deck-schema.d.ts +0 -70
  167. package/dist/core/human/deck-schema.js +0 -92
@@ -0,0 +1,131 @@
1
+ // The default page template: one authored page document → the body-level HTML
2
+ // payload the page runtime (`src/pages`) boots against. Both dialects render
3
+ // here so an md page and an html page reach the runtime as ONE structure.
4
+ //
5
+ // What the payload carries: in-document chrome only — the page's own prose and
6
+ // its `crtr-*` slot elements, wrapped in the `<crtr-pages>`/`<crtr-page>` pager
7
+ // when the page bears a response.
8
+ //
9
+ // What it deliberately does NOT carry: the runtime bundle's `<script>`/`<link>`
10
+ // tags (the consuming host injects its own bundle URLs), the page title and
11
+ // subtitle (host-rendered from the manifest), and any dismiss/save chrome
12
+ // (host-owned). The payload is a fragment, not a document: the host wraps it.
13
+ import { escapeHtmlAttribute, renderMarkdownToHtml } from './markdown-html.js';
14
+ import { parsePageSource } from './page.js';
15
+ import { isResponseBearingSlot } from './page-schema.js';
16
+ /** Render one page ticket's authored document as the runtime's HTML payload. */
17
+ export function renderPageHtml(manifest, document, productKinds = []) {
18
+ // Re-projects the document AND re-verifies it against the manifest, so the
19
+ // payload can never disagree with the slots the manifest publishes.
20
+ const projection = parsePageSource(document, manifest, productKinds);
21
+ if (manifest.dialect === 'html')
22
+ return renderAuthoredHtml(document);
23
+ const body = projection
24
+ .map((block) => (block.kind === 'prose' ? renderMarkdownToHtml(block.markdown) : renderSlotElement(manifest.slots[block.slotIndex])))
25
+ .filter((part) => part !== '')
26
+ .join('\n');
27
+ // md is always one step, so the pager renders submit-only chrome — no step
28
+ // label is emitted, because `<crtr-page label>` only surfaces at steps > 1.
29
+ if (!manifest.slots.some(isResponseBearingSlot))
30
+ return body;
31
+ return `<crtr-pages>\n<crtr-page>\n${body}\n</crtr-page>\n</crtr-pages>`;
32
+ }
33
+ /** The pinned slot form the page runtime reads (`src/pages/slot-config.ts`). */
34
+ function renderSlotElement(slot) {
35
+ const tag = slot.unvalidated === true ? 'crtr-slot' : `crtr-${slot.kind}`;
36
+ const attributes = [
37
+ ...(slot.unvalidated === true ? [` kind="${escapeHtmlAttribute(slot.kind)}"`] : []),
38
+ ...(slot.id === undefined ? [] : [` slot-id="${escapeHtmlAttribute(slot.id)}"`]),
39
+ ].join('');
40
+ return `<${tag}${attributes}><script type="application/json">${embedJson(slot.config)}</script></${tag}>`;
41
+ }
42
+ /** Serialize config for a `<script>` text node. Escaping every `<` as `\u003c`
43
+ * — legal JSON that parses back identically — makes `</script>`, `<!--`, and
44
+ * `<script` unrepresentable in the emitted text, so no config value can end
45
+ * the element early. */
46
+ function embedJson(config) {
47
+ return JSON.stringify(config).replace(/</g, '\\u003c');
48
+ }
49
+ // ---------------------------------------------------------------------------
50
+ // html dialect — normalized passthrough
51
+ // ---------------------------------------------------------------------------
52
+ /** The authored document's body, with two normalizations and nothing else:
53
+ * `<style>` elements from `<head>` are hoisted in front of it (the payload is
54
+ * body-level, so authored presentation would otherwise be lost), and every
55
+ * `crtr-*` slot element carrying an authored `id` gains the matching
56
+ * `slot-id`, which is the attribute the runtime actually reads. Authored
57
+ * `<head>` `<link>` and `<script>` elements do not survive — the page runtime
58
+ * is the only script a page needs. */
59
+ function renderAuthoredHtml(document) {
60
+ const styles = headStyles(document);
61
+ const body = normalizeSlotIds(bodyInnerHtml(document)).trim();
62
+ return styles.length === 0 ? body : `${styles.join('\n')}\n${body}`;
63
+ }
64
+ /** Index just past the `>` closing the tag that starts at `start`. Quote-aware,
65
+ * so an attribute value containing `>` cannot end the tag early. */
66
+ function tagEndIndex(html, start) {
67
+ let quote = null;
68
+ for (let index = start + 1; index < html.length; index++) {
69
+ const character = html[index];
70
+ if (quote !== null) {
71
+ if (character === quote)
72
+ quote = null;
73
+ continue;
74
+ }
75
+ if (character === '"' || character === "'") {
76
+ quote = character;
77
+ continue;
78
+ }
79
+ if (character === '>')
80
+ return index + 1;
81
+ }
82
+ throw new Error(`unterminated HTML tag beginning at byte ${start}`);
83
+ }
84
+ function bodyInnerHtml(document) {
85
+ const open = /<body(?=[\s>])/i.exec(document);
86
+ if (open === null)
87
+ throw new Error('page document has no <body> element');
88
+ const start = tagEndIndex(document, open.index);
89
+ const close = document.toLowerCase().lastIndexOf('</body');
90
+ return close === -1 ? document.slice(start) : document.slice(start, close);
91
+ }
92
+ function headStyles(document) {
93
+ const open = /<head(?=[\s>])/i.exec(document);
94
+ if (open === null)
95
+ return [];
96
+ const start = tagEndIndex(document, open.index);
97
+ const close = document.toLowerCase().indexOf('</head', start);
98
+ const head = document.slice(start, close === -1 ? document.length : close);
99
+ return [...head.matchAll(/<style\b[^>]*>[\s\S]*?<\/style>/gi)].map((match) => match[0]);
100
+ }
101
+ const PAGER_TAGS = new Set(['crtr-pages', 'crtr-page']);
102
+ function normalizeSlotIds(html) {
103
+ let out = '';
104
+ let cursor = 0;
105
+ for (;;) {
106
+ const at = html.toLowerCase().indexOf('<crtr-', cursor);
107
+ if (at === -1) {
108
+ out += html.slice(cursor);
109
+ return out;
110
+ }
111
+ const end = tagEndIndex(html, at);
112
+ const tag = html.slice(at, end);
113
+ out += html.slice(cursor, at) + withSlotId(tag);
114
+ cursor = end;
115
+ }
116
+ }
117
+ function withSlotId(tag) {
118
+ const name = /^<([A-Za-z][A-Za-z0-9-]*)/.exec(tag)?.[1]?.toLowerCase();
119
+ if (name === undefined || PAGER_TAGS.has(name))
120
+ return tag;
121
+ const attributes = new Map();
122
+ for (const match of tag.slice(1 + name.length, -1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)) {
123
+ attributes.set(match[1].toLowerCase(), match[2] ?? match[3] ?? match[4] ?? '');
124
+ }
125
+ const id = attributes.get('id');
126
+ if (id === undefined || id === '' || attributes.has('slot-id'))
127
+ return tag;
128
+ const selfClosing = /\/\s*>$/.test(tag);
129
+ const head = tag.slice(0, tag.lastIndexOf(selfClosing ? '/' : '>')).trimEnd();
130
+ return `${head} slot-id="${escapeHtmlAttribute(id)}"${selfClosing ? ' />' : '>'}`;
131
+ }
@@ -0,0 +1,312 @@
1
+ import { z } from 'zod';
2
+ export declare const PAGE_SLOT_ID_PATTERN: RegExp;
3
+ export declare const commentAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ kind: z.ZodLiteral<"whole">;
5
+ }, z.core.$strict>, z.ZodObject<{
6
+ kind: z.ZodLiteral<"option">;
7
+ optionId: z.ZodString;
8
+ }, z.core.$strict>, z.ZodObject<{
9
+ kind: z.ZodLiteral<"row">;
10
+ rowId: z.ZodString;
11
+ }, z.core.$strict>, z.ZodObject<{
12
+ kind: z.ZodLiteral<"column">;
13
+ columnId: z.ZodString;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ kind: z.ZodLiteral<"card">;
16
+ cardId: z.ZodString;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ kind: z.ZodLiteral<"range">;
19
+ start: z.ZodNumber;
20
+ end: z.ZodNumber;
21
+ quote: z.ZodString;
22
+ }, z.core.$strict>], "kind">;
23
+ export type CommentAnchor = z.infer<typeof commentAnchorSchema>;
24
+ export declare const commentSchema: z.ZodObject<{
25
+ id: z.ZodString;
26
+ anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
27
+ kind: z.ZodLiteral<"whole">;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ kind: z.ZodLiteral<"option">;
30
+ optionId: z.ZodString;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ kind: z.ZodLiteral<"row">;
33
+ rowId: z.ZodString;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ kind: z.ZodLiteral<"column">;
36
+ columnId: z.ZodString;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ kind: z.ZodLiteral<"card">;
39
+ cardId: z.ZodString;
40
+ }, z.core.$strict>, z.ZodObject<{
41
+ kind: z.ZodLiteral<"range">;
42
+ start: z.ZodNumber;
43
+ end: z.ZodNumber;
44
+ quote: z.ZodString;
45
+ }, z.core.$strict>], "kind">;
46
+ text: z.ZodString;
47
+ }, z.core.$strict>;
48
+ export type Comment = z.infer<typeof commentSchema>;
49
+ export declare const optionSchema: z.ZodObject<{
50
+ id: z.ZodString;
51
+ label: z.ZodString;
52
+ description: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>;
54
+ export declare const optionsConfigSchema: z.ZodObject<{
55
+ options: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ label: z.ZodString;
58
+ description: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strict>>;
60
+ mode: z.ZodEnum<{
61
+ single: "single";
62
+ multi: "multi";
63
+ }>;
64
+ allowFreetext: z.ZodOptional<z.ZodBoolean>;
65
+ freetextLabel: z.ZodOptional<z.ZodString>;
66
+ freetextPlaceholder: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strict>;
68
+ export type OptionsConfig = z.infer<typeof optionsConfigSchema>;
69
+ export declare const optionsResponseSchema: z.ZodObject<{
70
+ selectedOptionIds: z.ZodArray<z.ZodString>;
71
+ comments: z.ZodArray<z.ZodObject<{
72
+ id: z.ZodString;
73
+ anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ kind: z.ZodLiteral<"whole">;
75
+ }, z.core.$strict>, z.ZodObject<{
76
+ kind: z.ZodLiteral<"option">;
77
+ optionId: z.ZodString;
78
+ }, z.core.$strict>, z.ZodObject<{
79
+ kind: z.ZodLiteral<"row">;
80
+ rowId: z.ZodString;
81
+ }, z.core.$strict>, z.ZodObject<{
82
+ kind: z.ZodLiteral<"column">;
83
+ columnId: z.ZodString;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ kind: z.ZodLiteral<"card">;
86
+ cardId: z.ZodString;
87
+ }, z.core.$strict>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"range">;
89
+ start: z.ZodNumber;
90
+ end: z.ZodNumber;
91
+ quote: z.ZodString;
92
+ }, z.core.$strict>], "kind">;
93
+ text: z.ZodString;
94
+ }, z.core.$strict>>;
95
+ freetext: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>;
97
+ export type OptionsResponse = z.infer<typeof optionsResponseSchema>;
98
+ export declare const textConfigSchema: z.ZodObject<{
99
+ initialText: z.ZodString;
100
+ editable: z.ZodOptional<z.ZodBoolean>;
101
+ placeholder: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$strict>;
103
+ export type TextConfig = z.infer<typeof textConfigSchema>;
104
+ export declare const textResponseSchema: z.ZodObject<{
105
+ text: z.ZodString;
106
+ edited: z.ZodBoolean;
107
+ comments: z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
110
+ kind: z.ZodLiteral<"whole">;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ kind: z.ZodLiteral<"option">;
113
+ optionId: z.ZodString;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ kind: z.ZodLiteral<"row">;
116
+ rowId: z.ZodString;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"column">;
119
+ columnId: z.ZodString;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"card">;
122
+ cardId: z.ZodString;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ kind: z.ZodLiteral<"range">;
125
+ start: z.ZodNumber;
126
+ end: z.ZodNumber;
127
+ quote: z.ZodString;
128
+ }, z.core.$strict>], "kind">;
129
+ text: z.ZodString;
130
+ }, z.core.$strict>>;
131
+ }, z.core.$strict>;
132
+ export type TextResponse = z.infer<typeof textResponseSchema>;
133
+ export declare const tableColumnSchema: z.ZodObject<{
134
+ id: z.ZodString;
135
+ label: z.ZodString;
136
+ align: z.ZodOptional<z.ZodEnum<{
137
+ right: "right";
138
+ left: "left";
139
+ }>>;
140
+ mono: z.ZodOptional<z.ZodBoolean>;
141
+ }, z.core.$strict>;
142
+ export declare const tableCellSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
143
+ export declare const tableRowSchema: z.ZodObject<{
144
+ id: z.ZodString;
145
+ cells: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
146
+ }, z.core.$strict>;
147
+ export declare const tableConfigSchema: z.ZodObject<{
148
+ columns: z.ZodArray<z.ZodObject<{
149
+ id: z.ZodString;
150
+ label: z.ZodString;
151
+ align: z.ZodOptional<z.ZodEnum<{
152
+ right: "right";
153
+ left: "left";
154
+ }>>;
155
+ mono: z.ZodOptional<z.ZodBoolean>;
156
+ }, z.core.$strict>>;
157
+ rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
158
+ id: z.ZodString;
159
+ cells: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
160
+ }, z.core.$strict>>>;
161
+ source: z.ZodOptional<z.ZodString>;
162
+ rowSelect: z.ZodDefault<z.ZodEnum<{
163
+ none: "none";
164
+ single: "single";
165
+ multi: "multi";
166
+ }>>;
167
+ columnSelect: z.ZodDefault<z.ZodEnum<{
168
+ none: "none";
169
+ single: "single";
170
+ multi: "multi";
171
+ }>>;
172
+ caption: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strict>;
174
+ export type TableConfig = z.infer<typeof tableConfigSchema>;
175
+ export declare const tableResponseSchema: z.ZodObject<{
176
+ selectedRowIds: z.ZodArray<z.ZodString>;
177
+ selectedColumnIds: z.ZodArray<z.ZodString>;
178
+ comments: z.ZodArray<z.ZodObject<{
179
+ id: z.ZodString;
180
+ anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
181
+ kind: z.ZodLiteral<"whole">;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ kind: z.ZodLiteral<"option">;
184
+ optionId: z.ZodString;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ kind: z.ZodLiteral<"row">;
187
+ rowId: z.ZodString;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ kind: z.ZodLiteral<"column">;
190
+ columnId: z.ZodString;
191
+ }, z.core.$strict>, z.ZodObject<{
192
+ kind: z.ZodLiteral<"card">;
193
+ cardId: z.ZodString;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ kind: z.ZodLiteral<"range">;
196
+ start: z.ZodNumber;
197
+ end: z.ZodNumber;
198
+ quote: z.ZodString;
199
+ }, z.core.$strict>], "kind">;
200
+ text: z.ZodString;
201
+ }, z.core.$strict>>;
202
+ }, z.core.$strict>;
203
+ export type TableResponse = z.infer<typeof tableResponseSchema>;
204
+ export declare const cardSchema: z.ZodObject<{
205
+ id: z.ZodString;
206
+ title: z.ZodString;
207
+ subtitle: z.ZodOptional<z.ZodString>;
208
+ body: z.ZodOptional<z.ZodString>;
209
+ tag: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strict>;
211
+ export declare const cardsConfigSchema: z.ZodObject<{
212
+ cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
213
+ id: z.ZodString;
214
+ title: z.ZodString;
215
+ subtitle: z.ZodOptional<z.ZodString>;
216
+ body: z.ZodOptional<z.ZodString>;
217
+ tag: z.ZodOptional<z.ZodString>;
218
+ }, z.core.$strict>>>;
219
+ source: z.ZodOptional<z.ZodString>;
220
+ mode: z.ZodEnum<{
221
+ single: "single";
222
+ multi: "multi";
223
+ }>;
224
+ columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
225
+ }, z.core.$strict>;
226
+ export type CardsConfig = z.infer<typeof cardsConfigSchema>;
227
+ export declare const cardsResponseSchema: z.ZodObject<{
228
+ selectedCardIds: z.ZodArray<z.ZodString>;
229
+ comments: z.ZodArray<z.ZodObject<{
230
+ id: z.ZodString;
231
+ anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
232
+ kind: z.ZodLiteral<"whole">;
233
+ }, z.core.$strict>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"option">;
235
+ optionId: z.ZodString;
236
+ }, z.core.$strict>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"row">;
238
+ rowId: z.ZodString;
239
+ }, z.core.$strict>, z.ZodObject<{
240
+ kind: z.ZodLiteral<"column">;
241
+ columnId: z.ZodString;
242
+ }, z.core.$strict>, z.ZodObject<{
243
+ kind: z.ZodLiteral<"card">;
244
+ cardId: z.ZodString;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ kind: z.ZodLiteral<"range">;
247
+ start: z.ZodNumber;
248
+ end: z.ZodNumber;
249
+ quote: z.ZodString;
250
+ }, z.core.$strict>], "kind">;
251
+ text: z.ZodString;
252
+ }, z.core.$strict>>;
253
+ }, z.core.$strict>;
254
+ export type CardsResponse = z.infer<typeof cardsResponseSchema>;
255
+ export declare const chartSeriesSchema: z.ZodObject<{
256
+ field: z.ZodString;
257
+ label: z.ZodOptional<z.ZodString>;
258
+ }, z.core.$strict>;
259
+ export declare const chartConfigSchema: z.ZodObject<{
260
+ kind: z.ZodEnum<{
261
+ line: "line";
262
+ bar: "bar";
263
+ area: "area";
264
+ }>;
265
+ x: z.ZodString;
266
+ y: z.ZodArray<z.ZodObject<{
267
+ field: z.ZodString;
268
+ label: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strict>>;
270
+ title: z.ZodOptional<z.ZodString>;
271
+ data: z.ZodOptional<z.ZodUnknown>;
272
+ source: z.ZodOptional<z.ZodString>;
273
+ }, z.core.$strict>;
274
+ export type ChartConfig = z.infer<typeof chartConfigSchema>;
275
+ export type SlotConfig = OptionsConfig | TextConfig | TableConfig | CardsConfig | ChartConfig | Record<string, unknown>;
276
+ export type SlotResponse = OptionsResponse | TextResponse | TableResponse | CardsResponse | Record<string, unknown>;
277
+ export interface PageSlot {
278
+ id?: string;
279
+ kind: string;
280
+ step: number;
281
+ config: SlotConfig;
282
+ unvalidated?: true;
283
+ }
284
+ export interface PageSource {
285
+ sessionName?: string;
286
+ askedBy?: string;
287
+ blockedSince?: string;
288
+ nodeId?: string;
289
+ }
290
+ export interface PageManifest {
291
+ schema: 'crtr.page/v1';
292
+ dialect: 'md' | 'html';
293
+ title: string;
294
+ subtitle?: string;
295
+ placement: 'inline' | 'panel';
296
+ document: 'page.md' | 'page.html';
297
+ steps: number;
298
+ slots: PageSlot[];
299
+ source?: PageSource;
300
+ }
301
+ /** The canonical response-bearing predicate used by every page consumer. */
302
+ export declare function isResponseBearingSlot(slot: PageSlot): boolean;
303
+ /** Validate and normalize a derived or stored manifest against the resolved product catalog. */
304
+ export declare function validatePageManifest(parsed: unknown, productKinds?: string[]): PageManifest;
305
+ export declare function createPageManifestSchema(productKinds?: string[]): z.ZodType<PageManifest>;
306
+ /** Built-in-only manifest schema; product-aware callers use createPageManifestSchema. */
307
+ export declare const pageManifestSchema: z.ZodType<PageManifest, unknown, z.core.$ZodTypeInternals<PageManifest, unknown>>;
308
+ export type PageResponses = Record<string, SlotResponse>;
309
+ /** Validate a complete final response map. */
310
+ export declare function validatePageResponses(manifest: PageManifest, responses: unknown): PageResponses;
311
+ /** Validate an autosaved response map, permitting omitted response-bearing slots. */
312
+ export declare function validatePartialPageResponses(manifest: PageManifest, responses: unknown): PageResponses;