@lensmcp/protocol-types 1.26.21 → 1.26.22

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 (49) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +1 -1
  3. package/lib/ai-cache-facts.js +1 -1
  4. package/lib/ai-cache-verdict.js +1 -1
  5. package/lib/ai-cache.js +3 -3
  6. package/lib/ai-call-groups.js +2 -2
  7. package/lib/ai-call-row.js +3 -3
  8. package/lib/ai-call.js +11 -11
  9. package/lib/ai-compare.js +3 -3
  10. package/lib/ai-context.js +6 -6
  11. package/lib/ai-origins.js +8 -8
  12. package/lib/ai-together.js +5 -5
  13. package/lib/bounded-clone.js +1 -1
  14. package/lib/bounded-map.js +1 -1
  15. package/lib/bounded-writer.js +1 -1
  16. package/lib/canvas-catalog.d.ts +63 -0
  17. package/lib/canvas-catalog.js +12 -0
  18. package/lib/canvas.d.ts +858 -0
  19. package/lib/canvas.js +1 -0
  20. package/lib/capture-demand.js +1 -1
  21. package/lib/dashboard-path.js +1 -1
  22. package/lib/docker-errors.js +1 -1
  23. package/lib/docker-jobs.js +1 -1
  24. package/lib/docker-report.js +2 -2
  25. package/lib/docker-runs.js +3 -3
  26. package/lib/error-cause.js +6 -6
  27. package/lib/error-dismissal.js +1 -1
  28. package/lib/error-verdict.js +3 -3
  29. package/lib/event-loop.js +1 -1
  30. package/lib/expected-failure.js +2 -2
  31. package/lib/finding-proof.js +1 -1
  32. package/lib/flood-guard.js +1 -1
  33. package/lib/goal-design.js +1 -1
  34. package/lib/host-agents.js +1 -1
  35. package/lib/lint-coverage.js +1 -1
  36. package/lib/lint-ignores.js +2 -2
  37. package/lib/log-query.js +1 -1
  38. package/lib/metrics-reset.js +1 -1
  39. package/lib/overseer-findings.js +1 -1
  40. package/lib/peers.js +1 -1
  41. package/lib/perf-rules.js +1 -1
  42. package/lib/pod-memory.js +1 -1
  43. package/lib/producer-health.js +1 -1
  44. package/lib/remote-instances.js +1 -1
  45. package/lib/sources.js +1 -1
  46. package/lib/static-checks.js +1 -1
  47. package/lib/system-report.js +1 -1
  48. package/lib/team.js +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The canvas component catalog (planning/canvas/00-plan.md §5): every component a canvas's MDX may use, with its props.
3
+ * ONE table read by three parts: the checker refuses a prop or a component not here and quotes the entry's schema
4
+ * (`@lensmcp/canvas-engine`), the frame runtime draws them (`@lensmcp/canvas-frame`), and the dashboard's safe view
5
+ * draws each as a labelled card (tier 3). The skill (`skill://lensmcp-canvas`) is written from it.
6
+ *
7
+ * Interactive components (`Question`, `Checklist`, `Field`, `Options`) and `When` take LITERAL props only — strings,
8
+ * numbers, booleans, and array/object literals of those — so the contract can be read without running anything.
9
+ * Display components may also take `{expressions}`, which run in the frame only.
10
+ */
11
+ export type CanvasPropType = 'string' | 'number' | 'boolean' | 'enum'
12
+ /** A string or an array of strings (`y="cost"` or `y={["cost","budget"]}`). */
13
+ | 'strings'
14
+ /** `[{id, label, detail?}]`, or `["Postgres", "SQLite"]` (ids are then derived: `postgres`, `sqlite`). */
15
+ | 'options'
16
+ /** Inline rows: an array of objects. */
17
+ | 'rows'
18
+ /** Table columns: `["month","cost"]` or `[{key, label, format?}]`. */
19
+ | 'columns'
20
+ /** A JSON Pointer into the data or a `lens:` / `canvas:` / `https:` uri. */
21
+ | 'source'
22
+ /** Anything a display component can read — runs in the frame only. */
23
+ | 'any';
24
+ export interface CanvasPropSpec {
25
+ type: CanvasPropType;
26
+ required?: boolean;
27
+ values?: readonly string[];
28
+ /** Must be a literal (checked at write time) even on a display component. */
29
+ literal?: boolean;
30
+ describe: string;
31
+ }
32
+ export type CanvasComponentGroup = 'layout' | 'data' | 'reference' | 'decision' | 'interactive';
33
+ export interface CanvasComponentSpec {
34
+ name: string;
35
+ group: CanvasComponentGroup;
36
+ describe: string;
37
+ props: Readonly<Record<string, CanvasPropSpec>>;
38
+ /** What it holds: nothing, inline text, any blocks, or only `Tab`/`Option` children. */
39
+ children: 'none' | 'text' | 'blocks' | 'Tab' | 'Option';
40
+ /** Must sit directly inside this component. */
41
+ parent?: string;
42
+ /** Its props are literal only, and it lands in the contract. */
43
+ interactive?: boolean;
44
+ example: string;
45
+ }
46
+ export declare const CANVAS_CHART_TYPES: readonly ["bar", "line", "area", "stacked", "pie", "scatter"];
47
+ export type CanvasChartType = (typeof CANVAS_CHART_TYPES)[number];
48
+ export declare const CANVAS_CALLOUT_TYPES: readonly ["note", "info", "tip", "warning", "danger", "success"];
49
+ export declare const CANVAS_COMPONENTS: readonly CanvasComponentSpec[];
50
+ export declare const CANVAS_COMPONENT_NAMES: readonly string[];
51
+ export declare const canvasComponent: (name: string) => CanvasComponentSpec | undefined;
52
+ /** Fenced code a canvas may use for diagrams: ```mermaid (mermaid ≥ 11, strict) and ```diff. */
53
+ export declare const CANVAS_FENCES: readonly ["mermaid", "diff"];
54
+ /** The props schema of a component, as a refusal quotes it: `Chart { type*: bar|line|…, source: source, … }`. */
55
+ export declare function canvasComponentSchema(spec: CanvasComponentSpec): string;
56
+ /** An option given as a bare label gets an id derived from it: `"Postgres 16"` → `postgres-16`. */
57
+ export declare function canvasOptionId(label: string): string;
58
+ /**
59
+ * Components the COMPILER inserts and the runtime draws, never written by an author (the checker refuses them in MDX):
60
+ * `CanvasBlock` wraps each top-level block in an error boundary (`line`, `id`), `CanvasMermaid` and `CanvasDiffBlock`
61
+ * draw ```mermaid and ```diff fences (`code`, `line`).
62
+ */
63
+ export declare const CANVAS_INTERNAL_COMPONENTS: readonly ["CanvasBlock", "CanvasMermaid", "CanvasDiffBlock"];
@@ -0,0 +1,12 @@
1
+ "use strict";var o=Object.defineProperty;var r=(e,t)=>o(e,"name",{value:t,configurable:!0});var d=Object.defineProperty,s=r((e,t)=>d(e,"name",{value:t,configurable:!0}),"i");const n=["neutral","info","success","warning","danger"];export const CANVAS_CHART_TYPES=["bar","line","area","stacked","pie","scatter"],CANVAS_CALLOUT_TYPES=["note","info","tip","warning","danger","success"],CANVAS_COMPONENTS=[{name:"Callout",group:"layout",describe:"A highlighted note.",props:{type:{type:"enum",values:CANVAS_CALLOUT_TYPES,describe:"How it reads: note (default), info, tip, warning, danger, success."},title:{type:"string",describe:"A short heading."}},children:"blocks",example:'<Callout type="warning" title="Before you merge">The migration locks `orders` for about 2 s.</Callout>'},{name:"Details",group:"layout",describe:"A section the person opens.",props:{summary:{type:"string",required:!0,describe:"What the closed section says."},open:{type:"boolean",describe:"Open at first."}},children:"blocks",example:'<Details summary="How it was measured">Three runs on the dev Mac \u2026</Details>'},{name:"Tabs",group:"layout",describe:"Tabs; each child is a `Tab`.",props:{},children:"Tab",example:`<Tabs>
2
+ <Tab title="Before">\u2026</Tab>
3
+ <Tab title="After">\u2026</Tab>
4
+ </Tabs>`},{name:"Tab",group:"layout",describe:"One tab of a `Tabs`.",props:{title:{type:"string",required:!0,describe:"The tab\u2019s label."}},children:"blocks",parent:"Tabs",example:'<Tab title="After">\u2026</Tab>'},{name:"Columns",group:"layout",describe:"Children side by side (stacked on a narrow screen).",props:{count:{type:"number",describe:"How many columns (2\u20134, default: one per child)."}},children:"blocks",example:`<Columns>
5
+ <Stat label="p95" value="120 ms" />
6
+ <Stat label="Errors" value={3} />
7
+ </Columns>`},{name:"Badge",group:"layout",describe:"A small label.",props:{tone:{type:"enum",values:n,describe:"Its color."}},children:"text",example:'<Badge tone="success">shipped</Badge>'},{name:"Stat",group:"data",describe:"One number with a label.",props:{label:{type:"string",required:!0,describe:"What it counts."},value:{type:"any",describe:"The value (or `source`)."},source:{type:"source",describe:"Where the value is: a JSON Pointer into the data (`/totals/cost`) or a get."},unit:{type:"string",describe:"Shown after the value."},delta:{type:"any",describe:"A change to show beside it (`+12%`, or a number)."},tone:{type:"enum",values:n,describe:"Its color."}},children:"none",example:'<Stat label="Monthly cost" source="/totals/cost" unit="USD" />'},{name:"Chart",group:"data",describe:"A chart of rows: bar, line, area, stacked, pie, scatter.",props:{type:{type:"enum",values:CANVAS_CHART_TYPES,required:!0,describe:"Which chart."},data:{type:"rows",describe:"Inline rows (or `source`)."},source:{type:"source",describe:"Where the rows are: a JSON Pointer to an array of objects."},x:{type:"string",required:!0,describe:"The key each row\u2019s x (or slice, for pie) is under."},y:{type:"strings",required:!0,describe:"The numeric key(s) to draw: one series each."},title:{type:"string",describe:"A heading."},unit:{type:"string",describe:"The values\u2019 unit."},height:{type:"number",describe:"Pixels (default 260)."}},children:"none",example:'<Chart type="bar" source="/costs/monthly" x="month" y={["cost"]} unit="USD" />'},{name:"Table",group:"data",describe:"Rows as a sortable table (virtualised past 500 rows).",props:{data:{type:"rows",describe:"Inline rows (or `source`)."},source:{type:"source",describe:"A JSON Pointer to an array of objects."},columns:{type:"columns",describe:"Which keys, in order (default: the first row\u2019s)."},title:{type:"string",describe:"A heading."}},children:"none",example:'<Table source="/checks" columns={["name","state","ms"]} />'},{name:"Timeline",group:"data",describe:"Dated events in order.",props:{data:{type:"rows",describe:"Inline events (or `source`): objects with a date and a title."},source:{type:"source",describe:"A JSON Pointer to an array of objects."},date:{type:"string",describe:"The key of each event\u2019s date (default `date`)."},label:{type:"string",describe:"The key of each event\u2019s title (default `title`)."}},children:"none",example:'<Timeline source="/milestones" />'},{name:"TaskRef",group:"reference",describe:"A link to a task.",props:{id:{type:"string",required:!0,literal:!0,describe:"The task id."}},children:"text",example:'<TaskRef id="6f1c\u2026" />'},{name:"GoalRef",group:"reference",describe:"A link to a goal.",props:{id:{type:"string",required:!0,literal:!0,describe:"The goal id."}},children:"text",example:'<GoalRef id="g-42" />'},{name:"CanvasRef",group:"reference",describe:"A link to another canvas.",props:{id:{type:"string",required:!0,literal:!0,describe:"The canvas id (`cv-\u2026`)."}},children:"text",example:'<CanvasRef id="cv-0123456789abcdef" />'},{name:"FileRef",group:"reference",describe:"A link to a file of the project (opened on the Changes page).",props:{path:{type:"string",required:!0,literal:!0,describe:"Repository-relative path."},line:{type:"number",literal:!0,describe:"A line to open at."}},children:"text",example:'<FileRef path="libs/core/src/index.ts" line={12} />'},{name:"Options",group:"decision",describe:"A decision between options, each an `Option` with its own text; the person picks one.",props:{qid:{type:"string",required:!0,describe:"The decision\u2019s id: what the answer is keyed by."},title:{type:"string",required:!0,describe:"The question the options answer."},blocking:{type:"boolean",describe:"Its task needs the answer: it waits flagged in Team \u203A Inbox \u203A Canvases until the person answers."},inbox:{type:"boolean",describe:"Also ask it in Team \u203A Inbox \u203A Canvases."}},children:"Option",interactive:!0,example:`<Options qid="store" title="Where do canvases live?">
8
+ <Option id="sqlite" title="One SQLite database" recommended>\u2026</Option>
9
+ <Option id="files" title="Files per canvas">\u2026</Option>
10
+ </Options>`},{name:"Option",group:"decision",describe:"One option of an `Options`: its body is the argument for it.",props:{id:{type:"string",required:!0,describe:"The option\u2019s id (the answer\u2019s value)."},title:{type:"string",required:!0,describe:"Its name."},recommended:{type:"boolean",describe:"The one you recommend."}},children:"blocks",parent:"Options",interactive:!0,example:'<Option id="sqlite" title="One SQLite database" recommended>Transactions, one writer \u2026</Option>'},{name:"Question",group:"interactive",describe:"A question the person answers in the document.",props:{qid:{type:"string",required:!0,describe:"Its id: what the answer is keyed by. Letters, digits, `-`, `_`."},kind:{type:"enum",values:["choice","multi","text","number","confirm","approve"],required:!0,describe:"choice (one option), multi (any), text, number, confirm (yes/no), approve (approve / ask for changes)."},title:{type:"string",required:!0,describe:"The question, as the control shows it."},detail:{type:"string",describe:"A line of context under it."},options:{type:"options",describe:'For choice and multi: `[{id, label, detail?}]` or `["A", "B"]`.'},recommended:{type:"string",describe:"The option id you recommend."},blocking:{type:"boolean",describe:"Its task needs the answer: it waits flagged in Team \u203A Inbox \u203A Canvases until the person answers."},inbox:{type:"boolean",describe:"Also ask it in Team \u203A Inbox \u203A Canvases."},required:{type:"boolean",describe:"An answer is needed."},min:{type:"number",describe:"For number: the least."},max:{type:"number",describe:"For number: the most."},placeholder:{type:"string",describe:"For text and number."}},children:"none",interactive:!0,example:'<Question qid="db" kind="choice" title="Which database?" options={["Postgres", "SQLite"]} recommended="sqlite" />'},{name:"Checklist",group:"interactive",describe:"Items the person ticks; each item is its own answer (`qid/itemId`).",props:{qid:{type:"string",required:!0,describe:"Its id."},title:{type:"string",required:!0,describe:"What the list is for."},items:{type:"options",required:!0,describe:'`[{id, label}]` or `["Lint", "Tests"]`.'}},children:"none",interactive:!0,example:'<Checklist qid="release" title="Before release" items={["Changelog", "Docs", "Smoke test"]} />'},{name:"Field",group:"interactive",describe:"One value the person fills in.",props:{qid:{type:"string",required:!0,describe:"Its id."},label:{type:"string",required:!0,describe:"What to fill in."},kind:{type:"enum",values:["text","number","date","file","image"],required:!0,describe:"text, number, date, file or image."},placeholder:{type:"string",describe:"A hint inside it."},required:{type:"boolean",describe:"An answer is needed."},min:{type:"number",describe:"For number."},max:{type:"number",describe:"For number."}},children:"none",interactive:!0,example:'<Field qid="deadline" label="Ship by" kind="date" />'},{name:"When",group:"interactive",describe:"Shows its content (follow-up text and questions) once a question is answered so.",props:{qid:{type:"string",required:!0,describe:"The question it follows."},is:{type:"strings",required:!0,describe:'The option id(s) \u2014 or "yes"/"no" for a confirm \u2014 that show it.'}},children:"blocks",interactive:!0,example:`<When qid="db" is="postgres">
11
+ <Question qid="pg-host" kind="text" title="Which host?" />
12
+ </When>`}],CANVAS_COMPONENT_NAMES=CANVAS_COMPONENTS.map(e=>e.name),canvasComponent=s(e=>CANVAS_COMPONENTS.find(t=>t.name===e),"canvasComponent"),CANVAS_FENCES=["mermaid","diff"];export function canvasComponentSchema(e){const t=Object.entries(e.props).map(([a,i])=>`${a}${i.required?"*":""}: ${i.type==="enum"?(i.values??[]).join("|"):i.type}`);return`${e.name} { ${t.join(", ")} }${e.children==="none"?"":` children: ${e.children}`}`}r(canvasComponentSchema,"canvasComponentSchema"),s(canvasComponentSchema,"canvasComponentSchema");export function canvasOptionId(e){const t=e.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63);return/^[a-z]/.test(t)?t:`o-${t||"x"}`.slice(0,63)}r(canvasOptionId,"canvasOptionId"),s(canvasOptionId,"canvasOptionId");export const CANVAS_INTERNAL_COMPONENTS=["CanvasBlock","CanvasMermaid","CanvasDiffBlock"];