@khanglvm/relay 0.21.0 → 0.22.1

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 (89) hide show
  1. package/docs/AGENT.md +14 -2
  2. package/package.json +6 -1
  3. package/schema/spec.v1.json +55 -3
  4. package/skills/relay/SKILL.md +2 -1
  5. package/src/a2ui/board-catalog.json +1004 -0
  6. package/src/a2ui/board-constants.js +35 -0
  7. package/src/a2ui/board.js +5 -0
  8. package/src/a2ui/from-a2ui.js +71 -0
  9. package/src/a2ui/negotiate.js +38 -0
  10. package/src/a2ui/to-a2ui.js +147 -0
  11. package/src/cli/args.js +4 -2
  12. package/src/cli/ask.js +4 -3
  13. package/src/cli/boards.js +10 -7
  14. package/src/cli/git.js +5 -3
  15. package/src/cli/help.js +3 -1
  16. package/src/cli/io.js +21 -0
  17. package/src/cli/mcp.js +31 -2
  18. package/src/file-access.js +117 -0
  19. package/src/file-preview.js +1 -1
  20. package/src/mcp/boards.js +30 -7
  21. package/src/mcp/constants.js +3 -1
  22. package/src/mcp/schemas.js +5 -2
  23. package/src/mcp/serve.js +4 -4
  24. package/src/mcp/server.js +2 -1
  25. package/src/mcp/store.js +2 -2
  26. package/src/mcp/token.js +33 -8
  27. package/src/mcp/tools.js +16 -7
  28. package/src/mcp-ui/board/normalize.js +12 -0
  29. package/src/mcp-ui/board/render.js +2 -1
  30. package/src/mcp-ui/board/state.js +3 -0
  31. package/src/server/board.js +30 -22
  32. package/src/server/files.js +10 -0
  33. package/src/server/http.js +19 -0
  34. package/src/server/page.js +4 -0
  35. package/src/spec/blocks/a2ui.js +1 -1
  36. package/src/spec/blocks/chart.js +1 -1
  37. package/src/spec/blocks/code.js +4 -4
  38. package/src/spec/blocks/diagram.js +3 -3
  39. package/src/spec/blocks/git-conflict.js +2 -2
  40. package/src/spec/blocks/image.js +6 -5
  41. package/src/spec/blocks/markdown.js +2 -2
  42. package/src/spec/blocks/pdf.js +4 -10
  43. package/src/spec/blocks/table.js +5 -4
  44. package/src/spec/blocks/video.js +4 -10
  45. package/src/spec/blocks/widgets.js +6 -6
  46. package/src/spec/constants.js +13 -1
  47. package/src/spec/index.js +1 -0
  48. package/src/spec/lookup.js +1 -0
  49. package/src/spec/normalize.js +20 -10
  50. package/src/spec/pick.js +104 -0
  51. package/src/spec/schema.js +26 -3
  52. package/src/spec/sources.js +19 -24
  53. package/src/store.js +6 -1
  54. package/src/ui/app/drafts.js +3 -0
  55. package/src/ui/app/render.js +1 -0
  56. package/src/ui/app/submit.js +1 -1
  57. package/src/ui/manifest.js +2 -1
  58. package/src/ui/pick.css +32 -0
  59. package/src/ui/pick.js +246 -0
  60. package/types/a2ui/board-constants.d.ts +24 -0
  61. package/types/a2ui/from-a2ui.d.ts +16 -0
  62. package/types/a2ui/negotiate.d.ts +17 -0
  63. package/types/a2ui/to-a2ui.d.ts +12 -0
  64. package/types/file-access.d.ts +62 -0
  65. package/types/mcp/boards.d.ts +13 -2
  66. package/types/mcp/schemas.d.ts +5 -2
  67. package/types/mcp/serve.d.ts +5 -2
  68. package/types/mcp/store.d.ts +6 -3
  69. package/types/mcp/token.d.ts +5 -1
  70. package/types/mcp/tools.d.ts +2 -0
  71. package/types/spec/blocks/a2ui.d.ts +1 -1
  72. package/types/spec/blocks/chart.d.ts +1 -1
  73. package/types/spec/blocks/code.d.ts +2 -2
  74. package/types/spec/blocks/diagram.d.ts +3 -3
  75. package/types/spec/blocks/git-conflict.d.ts +1 -1
  76. package/types/spec/blocks/image.d.ts +2 -2
  77. package/types/spec/blocks/markdown.d.ts +1 -1
  78. package/types/spec/blocks/pdf.d.ts +1 -1
  79. package/types/spec/blocks/table.d.ts +1 -1
  80. package/types/spec/blocks/video.d.ts +1 -1
  81. package/types/spec/blocks/widgets.d.ts +4 -4
  82. package/types/spec/constants.d.ts +9 -0
  83. package/types/spec/index.d.ts +1 -0
  84. package/types/spec/lookup.d.ts +2 -1
  85. package/types/spec/normalize.d.ts +7 -1
  86. package/types/spec/pick.d.ts +25 -0
  87. package/types/spec/schema.d.ts +48 -0
  88. package/types/spec/sources.d.ts +5 -4
  89. package/types/store.d.ts +8 -1
@@ -1,14 +1,14 @@
1
- export declare function normalizeMermaidBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeMermaidBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  code: string;
5
5
  };
6
- export declare function normalizeGraphvizBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
6
+ export declare function normalizeGraphvizBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
7
7
  id: any;
8
8
  type: string;
9
9
  dot: string;
10
10
  };
11
- export declare function normalizePlantumlBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
11
+ export declare function normalizePlantumlBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
12
12
  id: any;
13
13
  type: string;
14
14
  code: string;
@@ -1,4 +1,4 @@
1
- export declare function normalizeGitConflictBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeGitConflictBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  filename: string;
@@ -1,5 +1,5 @@
1
- export declare function resolveImageSrc(srcRaw: any, cwd: any, where: any, field: any): string;
2
- export declare function normalizeImageBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function resolveImageSrc(srcRaw: any, files: any, where: any, field: any): string;
2
+ export declare function normalizeImageBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
3
3
  id: any;
4
4
  type: string;
5
5
  };
@@ -1,4 +1,4 @@
1
- export declare function normalizeMarkdownBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeMarkdownBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  md: any;
@@ -1,4 +1,4 @@
1
- export declare function normalizePdfBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizePdfBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare function normalizeTableBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeTableBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  columns: {
@@ -1,4 +1,4 @@
1
- export declare function normalizeVideoBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeVideoBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  };
@@ -1,20 +1,20 @@
1
- export declare function normalizeKpiBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
1
+ export declare function normalizeKpiBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
2
2
  id: any;
3
3
  type: string;
4
4
  items: any;
5
5
  };
6
- export declare function normalizeTypographyBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
6
+ export declare function normalizeTypographyBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
7
7
  id: any;
8
8
  type: string;
9
9
  specimens: any;
10
10
  };
11
- export declare function normalizeCompareBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
11
+ export declare function normalizeCompareBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
12
12
  id: any;
13
13
  type: string;
14
14
  before: string;
15
15
  after: string;
16
16
  };
17
- export declare function normalizePaletteBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
17
+ export declare function normalizePaletteBlock(rawBlock: any, id: any, files: any, where: any, hasHeight: any): {
18
18
  id: any;
19
19
  type: string;
20
20
  palettes: any;
@@ -28,6 +28,9 @@ export declare const ALIASES: {
28
28
  budget: string;
29
29
  distribute: string;
30
30
  points: string;
31
+ tiles: string;
32
+ gallery: string;
33
+ shortlist: string;
31
34
  };
32
35
  export declare const BLOCK_ALIASES: {
33
36
  md: string;
@@ -79,3 +82,9 @@ export declare const IMAGE_MIMES: {
79
82
  bmp: string;
80
83
  };
81
84
  export declare const IMAGE_MAX_BYTES: number;
85
+ export declare const PICK: {
86
+ maxItems: number;
87
+ maxImageBytes: number;
88
+ maxNoteChars: number;
89
+ maxOverallChars: number;
90
+ };
@@ -3,3 +3,4 @@ export { assertSpecReady } from './ready.js';
3
3
  export { normalizeSpec, questionFromInline } from './normalize.js';
4
4
  export { SPEC_SCHEMA } from './schema.js';
5
5
  export { lookupSchema } from './lookup.js';
6
+ export { cleanAnswers, cleanPick } from './pick.js';
@@ -29,6 +29,7 @@ export declare const QUESTION_FIELDS: {
29
29
  rank: string[];
30
30
  checklist: string[];
31
31
  allocate: string[];
32
+ pick: string[];
32
33
  };
33
34
  /** The property names the schema defines for blocks and for questions. */
34
35
  export declare function schemaFieldNames(): {
@@ -41,12 +42,12 @@ export declare function schemaFieldNames(): {
41
42
  * collides today; a block wins if one ever does.
42
43
  */
43
44
  export declare function lookupSchema(name: any): {
45
+ required?: undefined;
44
46
  kind: string;
45
47
  type: string;
46
48
  fields: {
47
49
  [k: string]: any;
48
50
  };
49
- required?: undefined;
50
51
  } | {
51
52
  kind: string;
52
53
  type: string;
@@ -1,5 +1,11 @@
1
- export declare function normalizeSpec(raw: any, { cwd }?: {
1
+ /**
2
+ * @param {Record<string, any>} raw
3
+ * @param {{ cwd?: string, fileRoots?: string[] }} [options] `fileRoots` limits which local files the spec may read
4
+ * (default: `cwd` only); `[]` allows none, for a spec that came from a remote client.
5
+ */
6
+ export declare function normalizeSpec(raw: Record<string, any>, { cwd, fileRoots }?: {
2
7
  cwd?: string;
8
+ fileRoots?: string[];
3
9
  }): {
4
10
  title: string;
5
11
  intro: string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Adds the pick fields to a normalized question: `items`, `min`, `max`, `itemNote`, `overall`.
3
+ * The generic per-question note stays off: a pick carries its own notes.
4
+ * @param {Record<string, any>} q the question being built
5
+ * @param {Record<string, any>} rq what the agent wrote
6
+ */
7
+ export declare function normalizePick(q: Record<string, any>, rq: Record<string, any>, where: any, files: any): void;
8
+ /**
9
+ * The answer to a pick question, cut down to what the question allows: known ids
10
+ * once each, at most `max` of them in the order picked, notes only when the tiles
11
+ * take them. Returns undefined when nothing is left, which reads as skipped.
12
+ * @returns {{ picks: Array<{ id: string, note?: string }>, overall?: string } | undefined}
13
+ */
14
+ export declare function cleanPick(q: any, value: any): {
15
+ picks: Array<{
16
+ id: string;
17
+ note?: string;
18
+ }>;
19
+ overall?: string;
20
+ } | undefined;
21
+ /**
22
+ * A copy of a board's answers in which every pick answer is cleaned. Other
23
+ * answers pass through as sent, which is how every board already treats them.
24
+ */
25
+ export declare function cleanAnswers(spec: any, answers: any): any;
@@ -747,6 +747,54 @@ export declare const SPEC_SCHEMA: {
747
747
  })[];
748
748
  };
749
749
  };
750
+ items: {
751
+ type: string;
752
+ description: string;
753
+ items: {
754
+ anyOf: ({
755
+ properties?: undefined;
756
+ type: string;
757
+ required?: undefined;
758
+ } | {
759
+ type: string;
760
+ required: string[];
761
+ properties: {
762
+ id: {
763
+ type: string;
764
+ description: string;
765
+ };
766
+ title: {
767
+ type: string;
768
+ };
769
+ caption: {
770
+ type: string;
771
+ };
772
+ image: {
773
+ type: string;
774
+ description: string;
775
+ };
776
+ video: {
777
+ type: string;
778
+ description: string;
779
+ };
780
+ url: {
781
+ type: string;
782
+ description: string;
783
+ };
784
+ };
785
+ })[];
786
+ };
787
+ };
788
+ itemNote: {
789
+ type: string;
790
+ default: boolean;
791
+ description: string;
792
+ };
793
+ overall: {
794
+ type: string;
795
+ default: boolean;
796
+ description: string;
797
+ };
750
798
  other: {
751
799
  type: string;
752
800
  description: string;
@@ -1,9 +1,10 @@
1
1
  export declare const asStr: (v: any) => string;
2
2
  export declare function clampInt(v: any, min: any, max: any, def: any): any;
3
- export declare function readHtml(obj: any, cwd: any, where: any): any;
4
- export declare function readBlockHtml(block: any, cwd: any, where: any): any;
5
- export declare function readTextSource(block: any, inlineKey: any, fileKey: any, cwd: any, where: any): any;
6
- export declare function readAnyTextSource(block: any, inlineKeys: any, fileKeys: any, cwd: any, where: any, label: any): {
3
+ /** Reads `htmlFile` through the file roots; an inline `html` string wins. */
4
+ export declare function readHtml(obj: any, files: any, where: any): any;
5
+ export declare function readBlockHtml(block: any, files: any, where: any): any;
6
+ export declare function readTextSource(block: any, inlineKey: any, fileKey: any, files: any, where: any): any;
7
+ export declare function readAnyTextSource(block: any, inlineKeys: any, fileKeys: any, files: any, where: any, label: any): {
7
8
  text: string;
8
9
  sourceKey: any;
9
10
  file?: undefined;
package/types/store.d.ts CHANGED
@@ -5,11 +5,18 @@ export declare function ensureDirs(): void;
5
5
  export declare function newId(): string;
6
6
  export declare const artifactDirPath: (id: any) => string;
7
7
  export declare function saveBoardArtifact(id: any, bytes: any, ext?: string): string;
8
- export declare function createBoard(spec: any): {
8
+ /**
9
+ * @param {any} spec a normalized spec
10
+ * @param {{ fileRoots?: string[] }} [options] the roots the spec was read under; the live server opens only files inside them
11
+ */
12
+ export declare function createBoard(spec: any, { fileRoots }?: {
13
+ fileRoots?: string[];
14
+ }): {
9
15
  id: string;
10
16
  createdAt: string;
11
17
  title: any;
12
18
  cwd: string;
19
+ fileRoots: string[];
13
20
  spec: any;
14
21
  draft: any;
15
22
  result: any;