@khanglvm/relay 0.22.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 (52) hide show
  1. package/docs/AGENT.md +1 -1
  2. package/package.json +1 -1
  3. package/src/cli/args.js +4 -2
  4. package/src/cli/ask.js +4 -3
  5. package/src/cli/boards.js +10 -7
  6. package/src/cli/git.js +5 -3
  7. package/src/cli/help.js +1 -0
  8. package/src/cli/io.js +21 -0
  9. package/src/cli/mcp.js +12 -1
  10. package/src/file-access.js +117 -0
  11. package/src/file-preview.js +1 -1
  12. package/src/mcp/boards.js +4 -3
  13. package/src/mcp/serve.js +4 -4
  14. package/src/mcp/store.js +2 -2
  15. package/src/mcp/tools.js +2 -1
  16. package/src/server/board.js +18 -13
  17. package/src/server/files.js +10 -0
  18. package/src/spec/blocks/a2ui.js +1 -1
  19. package/src/spec/blocks/chart.js +1 -1
  20. package/src/spec/blocks/code.js +4 -4
  21. package/src/spec/blocks/diagram.js +3 -3
  22. package/src/spec/blocks/git-conflict.js +2 -2
  23. package/src/spec/blocks/image.js +6 -5
  24. package/src/spec/blocks/markdown.js +2 -2
  25. package/src/spec/blocks/pdf.js +4 -10
  26. package/src/spec/blocks/table.js +5 -4
  27. package/src/spec/blocks/video.js +4 -10
  28. package/src/spec/blocks/widgets.js +6 -6
  29. package/src/spec/normalize.js +18 -11
  30. package/src/spec/pick.js +4 -4
  31. package/src/spec/sources.js +19 -24
  32. package/src/store.js +6 -1
  33. package/types/file-access.d.ts +62 -0
  34. package/types/mcp/boards.d.ts +2 -1
  35. package/types/mcp/serve.d.ts +5 -2
  36. package/types/mcp/store.d.ts +6 -3
  37. package/types/mcp/tools.d.ts +2 -0
  38. package/types/spec/blocks/a2ui.d.ts +1 -1
  39. package/types/spec/blocks/chart.d.ts +1 -1
  40. package/types/spec/blocks/code.d.ts +2 -2
  41. package/types/spec/blocks/diagram.d.ts +3 -3
  42. package/types/spec/blocks/git-conflict.d.ts +1 -1
  43. package/types/spec/blocks/image.d.ts +2 -2
  44. package/types/spec/blocks/markdown.d.ts +1 -1
  45. package/types/spec/blocks/pdf.d.ts +1 -1
  46. package/types/spec/blocks/table.d.ts +1 -1
  47. package/types/spec/blocks/video.d.ts +1 -1
  48. package/types/spec/blocks/widgets.d.ts +4 -4
  49. package/types/spec/normalize.d.ts +7 -1
  50. package/types/spec/pick.d.ts +1 -1
  51. package/types/spec/sources.d.ts +5 -4
  52. package/types/store.d.ts +8 -1
@@ -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;
@@ -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;
@@ -4,7 +4,7 @@
4
4
  * @param {Record<string, any>} q the question being built
5
5
  * @param {Record<string, any>} rq what the agent wrote
6
6
  */
7
- export declare function normalizePick(q: Record<string, any>, rq: Record<string, any>, where: any, cwd: any): void;
7
+ export declare function normalizePick(q: Record<string, any>, rq: Record<string, any>, where: any, files: any): void;
8
8
  /**
9
9
  * The answer to a pick question, cut down to what the question allows: known ids
10
10
  * once each, at most `max` of them in the order picked, notes only when the tiles
@@ -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;