@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
@@ -1,70 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Deck, ReviewDescriptor } from './types.js';
3
- export declare const interactionOptionSchema: z.ZodObject<{
4
- id: z.ZodString;
5
- label: z.ZodString;
6
- description: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- export declare const preAnswerSchema: z.ZodObject<{
9
- selectedOptionId: z.ZodOptional<z.ZodString>;
10
- selectedOptionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
- freetext: z.ZodOptional<z.ZodString>;
12
- label: z.ZodOptional<z.ZodString>;
13
- }, z.core.$strip>;
14
- export declare const deckSchema: z.ZodObject<{
15
- title: z.ZodString;
16
- source: z.ZodOptional<z.ZodObject<{
17
- sessionName: z.ZodOptional<z.ZodString>;
18
- askedBy: z.ZodOptional<z.ZodString>;
19
- blockedSince: z.ZodOptional<z.ZodString>;
20
- nodeId: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strip>>;
22
- interactions: z.ZodArray<z.ZodObject<{
23
- id: z.ZodString;
24
- title: z.ZodString;
25
- subtitle: z.ZodString;
26
- body: z.ZodOptional<z.ZodString>;
27
- bodyPath: z.ZodOptional<z.ZodString>;
28
- options: z.ZodArray<z.ZodObject<{
29
- id: z.ZodString;
30
- label: z.ZodString;
31
- description: z.ZodOptional<z.ZodString>;
32
- }, z.core.$strip>>;
33
- multiSelect: z.ZodOptional<z.ZodBoolean>;
34
- allowFreetext: z.ZodOptional<z.ZodBoolean>;
35
- freetextLabel: z.ZodOptional<z.ZodString>;
36
- kind: z.ZodOptional<z.ZodEnum<{
37
- error: "error";
38
- context: "context";
39
- notify: "notify";
40
- review: "review";
41
- decision: "decision";
42
- }>>;
43
- preAnswered: z.ZodOptional<z.ZodObject<{
44
- selectedOptionId: z.ZodOptional<z.ZodString>;
45
- selectedOptionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
- freetext: z.ZodOptional<z.ZodString>;
47
- label: z.ZodOptional<z.ZodString>;
48
- }, z.core.$strip>>;
49
- }, z.core.$strip>>;
50
- }, z.core.$strip>;
51
- export declare const reviewDescriptorSchema: z.ZodObject<{
52
- schema: z.ZodLiteral<"humanloop.review/v1">;
53
- file: z.ZodString;
54
- output: z.ZodString;
55
- title: z.ZodString;
56
- subtitle: z.ZodString;
57
- source: z.ZodObject<{
58
- sessionName: z.ZodOptional<z.ZodString>;
59
- askedBy: z.ZodOptional<z.ZodString>;
60
- blockedSince: z.ZodOptional<z.ZodString>;
61
- nodeId: z.ZodOptional<z.ZodString>;
62
- }, z.core.$strip>;
63
- blockedSince: z.ZodString;
64
- }, z.core.$strict>;
65
- export declare function resolveDeckBodyPaths(deck: Deck, dir: string): Deck;
66
- export declare function parseDeck(path: string): Deck;
67
- export declare function validateDeck(parsed: unknown): Deck;
68
- export declare function validateReviewDescriptor(parsed: unknown): ReviewDescriptor;
69
- /** Canonicalize and authorize the one review projection boundary before every write. */
70
- export declare function validateReviewProjection(dir: string, parsed: unknown): ReviewDescriptor;
@@ -1,92 +0,0 @@
1
- import { existsSync, lstatSync, readFileSync, realpathSync } from 'node:fs';
2
- import { basename, dirname, isAbsolute, resolve, sep } from 'node:path';
3
- import { claimPath, deckPath, progressPath, responsePath, reviewPath } from './convention.js';
4
- import { z } from 'zod';
5
- import { INTERACTION_KINDS } from './types.js';
6
- import { checkMarkdown } from '../termrender/termrender.js';
7
- import { checkReviewableFile } from './visible-paths.js';
8
- export const interactionOptionSchema = z.object({ id: z.string().min(1), label: z.string().min(1), description: z.string().optional() });
9
- export const preAnswerSchema = z.object({ selectedOptionId: z.string().optional(), selectedOptionIds: z.array(z.string()).optional(), freetext: z.string().optional(), label: z.string().optional() });
10
- const interactionSchema = z.object({
11
- id: z.string().regex(/^[A-Za-z0-9_-]+$/, { error: 'interaction id must match /^[A-Za-z0-9_-]+$/' }).min(1).max(64),
12
- title: z.string().trim().min(1), subtitle: z.string().trim().min(1), body: z.string().optional(), bodyPath: z.string().optional(),
13
- options: z.array(interactionOptionSchema), multiSelect: z.boolean().optional(), allowFreetext: z.boolean().optional(), freetextLabel: z.string().optional(), kind: z.enum(INTERACTION_KINDS).optional(), preAnswered: preAnswerSchema.optional(),
14
- });
15
- const deckSourceSchema = z.object({ sessionName: z.string().optional(), askedBy: z.string().optional(), blockedSince: z.string().optional(), nodeId: z.string().optional() });
16
- export const deckSchema = z.object({ title: z.string().trim().min(1), source: deckSourceSchema.optional(), interactions: z.array(interactionSchema).min(1) }).superRefine((input, ctx) => {
17
- const seen = new Set();
18
- input.interactions.forEach((interaction, index) => {
19
- if (interaction.body !== undefined && interaction.bodyPath !== undefined)
20
- ctx.addIssue({ code: 'custom', message: 'body and bodyPath are mutually exclusive', path: ['interactions', index] });
21
- if (seen.has(interaction.id))
22
- ctx.addIssue({ code: 'custom', message: `duplicate interaction id "${interaction.id}"`, path: ['interactions', index, 'id'] });
23
- seen.add(interaction.id);
24
- });
25
- });
26
- const reviewSourceSchema = deckSourceSchema;
27
- export const reviewDescriptorSchema = z.object({
28
- schema: z.literal('humanloop.review/v1'),
29
- file: z.string().min(1).refine(isAbsolute, 'file must be absolute'),
30
- output: z.string().min(1).refine(isAbsolute, 'output must be absolute'),
31
- title: z.string().trim().min(1),
32
- subtitle: z.string().trim().min(1),
33
- source: reviewSourceSchema,
34
- blockedSince: z.string().datetime({ offset: true }),
35
- }).strict();
36
- function readBodyPathFile(dir, bodyPath) {
37
- const joined = resolve(dir, bodyPath);
38
- if (!existsSync(joined))
39
- throw new Error(`bodyPath does not exist: '${bodyPath}'`);
40
- if (!lstatSync(joined).isFile())
41
- throw new Error(`bodyPath must be a regular file: ${bodyPath}`);
42
- const realResolved = realpathSync(joined);
43
- const realDeckDir = realpathSync(dir);
44
- if (!realResolved.startsWith(realDeckDir + sep))
45
- throw new Error(`bodyPath '${bodyPath}' escapes the deck directory`);
46
- return readFileSync(joined, 'utf8');
47
- }
48
- export function resolveDeckBodyPaths(deck, dir) {
49
- return { ...deck, interactions: deck.interactions.map((interaction) => {
50
- if (interaction.bodyPath === undefined)
51
- return interaction;
52
- const { bodyPath: _bodyPath, ...rest } = interaction;
53
- return { ...rest, body: readBodyPathFile(dir, interaction.bodyPath) };
54
- }) };
55
- }
56
- export function parseDeck(path) {
57
- let raw;
58
- try {
59
- raw = JSON.parse(readFileSync(path, 'utf8'));
60
- }
61
- catch {
62
- throw new Error('deck is not valid JSON');
63
- }
64
- const deck = resolveDeckBodyPaths(deckSchema.parse(raw), dirname(path));
65
- for (const interaction of deck.interactions)
66
- if (interaction.body !== undefined) {
67
- const check = checkMarkdown(interaction.body);
68
- if (!check.ok)
69
- throw new Error(check.error);
70
- }
71
- return deck;
72
- }
73
- export function validateDeck(parsed) { return deckSchema.parse(parsed); }
74
- export function validateReviewDescriptor(parsed) { return reviewDescriptorSchema.parse(parsed); }
75
- /** Canonicalize and authorize the one review projection boundary before every write. */
76
- export function validateReviewProjection(dir, parsed) {
77
- const descriptor = validateReviewDescriptor(parsed);
78
- // Any reviewable UTF-8 text file: a .md artifact renders as a document, a
79
- // source file as a syntax-highlighted code panel.
80
- if (!existsSync(descriptor.file))
81
- throw new Error('review file must be an existing absolute path');
82
- const reviewable = checkReviewableFile(descriptor.file);
83
- if (!reviewable.ok)
84
- throw new Error(`review file is not reviewable: ${reviewable.reason}`);
85
- const file = realpathSync(descriptor.file);
86
- const output = resolve(realpathSync(dirname(descriptor.output)), basename(descriptor.output));
87
- const reserved = new Set(['deck.json', 'review.json', 'response.json', 'progress.json', 'claim.json']);
88
- const ownProtocolPaths = new Set([deckPath(dir), reviewPath(dir), responsePath(dir), progressPath(dir), claimPath(dir)]);
89
- if (output === file || reserved.has(basename(output)) || ownProtocolPaths.has(output))
90
- throw new Error('review output must not alias the source or ticket protocol files');
91
- return { ...descriptor, file, output };
92
- }