konpeki 0.1.0 → 0.2.0

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.
@@ -75,7 +75,18 @@ canvas request, run `npm exec --no -- konpeki wait <composition.json>` alongside
75
75
  **Build it** submits a request; it does not launch an agent. On receiving it,
76
76
  reread the named file and compare its revision with the request. If it changed,
77
77
  reconcile against the latest document instead of applying a stale rewrite.
78
- Respect the selected component/page scope and preserve unrelated edits.
78
+ Apply every attached note to its named page, component or vector-element ID;
79
+ without notes, respect the selected scope. Preserve unrelated edits and stable
80
+ IDs. A request is already marked working when `wait` returns; it is not deleted.
81
+ Validate, render, inspect and repair the result, then run
82
+ `npm exec --no -- konpeki finish <composition.json> <request-id> --message "Updated and checked"`.
83
+ File changes alone do not resolve notes. If blocked, finish with
84
+ `--status needs-clarification --message "..."` or `--status failed --message "..."`;
85
+ unresolved notes remain for retry. Never mark a partially handled batch done.
86
+ Use `konpeki request <composition.json>` to recover an interrupted request and
87
+ verify it is still active before further writes. Cancellation does not stop your
88
+ process: stop work if the request is no longer active. Do not edit the feedback
89
+ sidecar directly. Return to `wait` only when the person requested a continuing loop.
79
90
 
80
91
  See [canvas workflow](../../../docs/workflow.md) for the full handoff contract.
81
92
  Never bypass revision checks or mutate hidden browser storage to replace the
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Konpeki
1
+ ![Konpeki — A shared canvas for you and your agents](slides/github-cover/cover.png)
2
2
 
3
3
  **An editable canvas for agent-made visuals. Create a single explanation or a
4
4
  whole presentation, then revise it together.**
@@ -15,32 +15,15 @@ editable JSON, or use **Present** for a chrome-free presentation.
15
15
  Requires **Node.js 24+**, npm, a coding agent that can edit files and run commands,
16
16
  and a browser.
17
17
 
18
- For agent-led installation, give your agent [SETUP.md](SETUP.md) and your brief.
19
- For a manual quickstart:
20
-
21
- ```sh
22
- mkdir konpeki-workspace
23
- cd konpeki-workspace
24
- npm init -y
25
- npm install --save-dev konpeki@0.1.0
26
- cp node_modules/konpeki/slides/introducing-konpeki/composition.json introduction.json
27
- npm exec --no -- konpeki preview introduction.json
28
- ```
29
-
30
- Open the exact URL printed by `preview`. Browser edits save to the composition
31
- file; valid agent edits appear on the same canvas. In a remote environment, use
32
- its authenticated preview mechanism rather than sharing a local address.
33
-
34
- Open the workspace in your coding agent and ask it to read
35
- `node_modules/konpeki/SETUP.md`. The installed package includes the authoring skill,
36
- design guidance and examples; skills inside dependencies may need to be read
37
- explicitly. Keep your documents outside `node_modules`. Give your brief in the
38
- agent's prompt field:
18
+ Give your coding agent the public setup URL and your brief. The guide covers
19
+ installation; no repository clone or manual package installation is needed first:
39
20
 
40
21
  ```text
41
- Use Konpeki to turn these notes into a three-slide explanation for engineers.
42
- Make the request flow and failure handling easy to follow. Preserve facts and
43
- caveats. Save editable composition JSON, then render, inspect and fix the result.
22
+ Read https://raw.githubusercontent.com/vcfgdev/konpeki/main/SETUP.md
23
+ and set up Konpeki in this workspace.
24
+ Turn these notes into a three-slide explanation for engineers. Make the request
25
+ flow and failure handling easy to follow. Preserve facts and caveats. Save editable composition
26
+ JSON, open the preview, then render, inspect and fix the result.
44
27
 
45
28
  [Paste notes or provide source files.]
46
29
  ```
@@ -50,6 +33,24 @@ approval” when you want a checkpoint. Supply a visual direction or leave it op
50
33
  [authoring modes](AUTHORING.md#authoring-mode) provide defaults without requiring
51
34
  you to choose fonts, colors or layouts first.
52
35
 
36
+ The package includes the authoring skill, design guidance and examples—no GitHub
37
+ clone is required. Keep your documents outside `node_modules`.
38
+
39
+ ## Try an editable example
40
+
41
+ For a manual start, install [Konpeki from npm](https://www.npmjs.com/package/konpeki)
42
+ in your workspace (run `npm init -y` first in a new, empty directory):
43
+
44
+ ```sh
45
+ npm install --save-dev konpeki@latest
46
+ curl -fL https://raw.githubusercontent.com/vcfgdev/konpeki/main/slides/introducing-konpeki/composition.json -o introduction.json
47
+ npm exec --no -- konpeki preview introduction.json
48
+ ```
49
+
50
+ Open the exact URL printed by `preview`. Browser edits save to your downloaded file;
51
+ valid agent edits appear on the same canvas. In a remote environment, use its
52
+ authenticated preview mechanism rather than sharing a local address.
53
+
53
54
  ## Examples and guides
54
55
 
55
56
  - [Example gallery](slides/README.md): 18 fictional examples and an editable
package/SETUP.md CHANGED
@@ -25,7 +25,7 @@ agent. An in-app browser is convenient but not required.
25
25
  reuse the same CLI version. Do not edit files inside `node_modules`.
26
26
 
27
27
  ```sh
28
- npm install --save-dev konpeki@0.1.0
28
+ npm install --save-dev konpeki@0.1.1
29
29
  ```
30
30
 
31
31
  In a new empty directory, run `npm init -y` first. Run subsequent commands from
@@ -1,6 +1,6 @@
1
1
  # Composition contract
2
2
 
3
- `konpeki-composition/v18` describes one or more bounded visual pages
3
+ `konpeki-composition/v1` describes one or more bounded visual pages
4
4
  shared by a person and coding agent. It is a visual intent contract, while the
5
5
  Konpeki canvas is its editor and presentation preview. Component rectangles are
6
6
  preferences; factual fidelity and readable
@@ -9,67 +9,44 @@ default is `none`; rules/dividers are separate appearance parameters. Editor
9
9
  guides never enter the contract. The contract is tool-agnostic: no Konpeki
10
10
  package, repository checkout, or separate authoring kit is required.
11
11
 
12
- Schema identifiers are immutable compatibility boundaries. New fields or
13
- vocabularies that an older reader could reject require a new identifier. Konpeki
14
- migrates compatible v1–v4 single-slide documents to a one-slide deck on import
15
- or load. V1 and v2 obsolete
16
- authoring-kit targets are removed; v3 callouts and comparisons become configured
17
- Text blocks without changing component IDs, geometry, slots, relationships or
18
- orders. V5 Evidence becomes Visual; Process and System map become a typed
19
- Diagram; and the Page-number component becomes a slide setting. V7 makes the
20
- Headline optional while retaining its singleton and reading-order constraints
21
- when present. V8 adds standalone Image, Icon and Shape primitives, Pie visuals,
22
- Text-block logical order and empty slides; v7 Image visuals migrate to Image
23
- components. V9 adds a first-class Table primitive with content-derived dimensions,
24
- header placement, grid treatment, density and color scheme. V10 adds optional
25
- slide-coordinate preferred rectangles to explicit diagram nodes so circular,
26
- branched and asymmetric topology can preserve authored geometry. V11 merges
27
- Headline and Footnote into Text-block roles, renames Visual to Chart, moves Icon
28
- and Shape into Diagram nodes, and renames Diagram `template` to `layout`. Schema
29
- v12 replaces Diagram's coarse process/system and layout pair with 32 semantic
30
- grammars adapted from the MIT-licensed Diagram Design taxonomy. The previous six
31
- layouts become derived implementation engines; all v11 combinations migrate
32
- deterministically. Diagram owns structural grammars while Chart owns the six
33
- scale-based historical grammars (bar, line, radar, treemap, scatter and Sankey).
34
- Pie and Annotated detail are additional Konpeki Chart grammars. V13 lets any of
35
- the same five semantic components own an optional self-contained SVG interior.
36
- V14 adds a structured vector interior: lines, shapes, paths and text have stable
37
- IDs, editable attributes and parent relationships. Legacy SVG remains an opaque
38
- compatibility fallback. The composition is authoritative for both outer geometry
39
- and editable vector internals. V15 adds explicit theme bindings to vector styles;
40
- v14 documents migrate with their literal styles unchanged. Current exports are
41
- always v18. Consumers must reject unknown future versions rather than interpreting them as v18. The JSON
42
- Schema `$id` and deterministic compiler version are versioned with this contract.
12
+ Schema identifiers are immutable compatibility boundaries. This is the first
13
+ public contract, so current exports use v1 and unknown versions are rejected.
14
+ The JSON Schema `$id` and deterministic compiler version are versioned with this
15
+ contract.
43
16
 
44
- V18 adds Diagram and Chart `appearance.selection`: `auto` delegates form selection
45
- to the agent; `explicit` makes the diagram type or chart template binding. Omission
46
- means explicit, never permission to switch. New canvas diagrams and charts use auto.
47
- Older documents migrate to explicit because their selection provenance is unknown.
48
- Type/template, artwork and geometry remain
49
- unchanged. The agent must ask before changing an explicit form or component kind,
50
- and may not silently reset it to auto. This is a handoff requirement, not a runtime
51
- permission barrier against arbitrary external file edits.
52
- The form picker remains available for finished vectors and legacy SVG as well as
17
+ The contract has five semantic component kinds: Text block, Diagram, Chart,
18
+ Image and Table. Any component can own optional self-contained SVG or structured
19
+ vector artwork. Structured lines, shapes, paths and text have stable IDs,
20
+ editable attributes and parent relationships. Opaque SVG remains a supported
21
+ fallback. The composition is authoritative for both outer geometry and editable
22
+ vector internals.
23
+
24
+ Diagram and Chart `appearance.selection` controls form choice: `auto` delegates
25
+ selection to the agent; `explicit` makes the diagram type or chart template
26
+ binding. Omission means explicit, never permission to switch. New canvas diagrams
27
+ and charts use auto. The agent must ask before changing an explicit form or
28
+ component kind, and may not silently reset it to auto. This is a handoff
29
+ requirement, not a runtime permission barrier against arbitrary external file edits.
30
+ The form picker remains available for finished vectors and opaque SVG as well as
53
31
  drafts. Changing the requirement preserves existing artwork; it does not redraw it.
54
32
  Sankey topology cannot be discarded by selecting another template, even in Auto.
55
33
 
56
- V17 makes each page's `canvas.width` and `canvas.height` integers from 256 to 4096.
34
+ Each page's `canvas.width` and `canvas.height` are integers from 256 to 4096.
57
35
  `innerPadding` is nonnegative and must leave a content area. Component rectangles
58
36
  must fit their owning page. `intendedViewingSize` accepts `presentation`, `social`,
59
- `article` or `custom`. Existing v16 decks migrate without geometry or content changes.
37
+ `article` or `custom`.
60
38
  The JSON key `slides` remains the ordered page collection for compatibility; it
61
39
  does not restrict the document to presentations. Resizing does not transform content.
62
40
 
63
- V16 gives ordinary Text blocks plain `content` and optional `textStyle`: size
41
+ Ordinary Text blocks have plain `content` and optional `textStyle`: size
64
42
  (8–240 slide pixels), weight (400/500/600), lineHeight (1–3), color
65
43
  (ink/muted/accent), and font (heading/body). Newlines are preserved and lines wrap
66
44
  inside the component. Missing content is empty; new manually added blocks start
67
45
  with editable “Text”. `intent` is separate agent guidance and never supplies live
68
- displayed copy. Legacy non-vector blocks copy their formerly displayed intent to
69
- content once on import; legacy custom visuals remain untouched. Custom visuals,
70
- when present, still own rendering. Ordinary text should not use custom visuals.
71
- Layout/purpose metadata from older drafts remains agent guidance rather than fake
72
- placeholder lines. Use separate Text blocks when independently positioned copy is needed.
46
+ displayed copy. Custom visuals, when present, still own rendering. Ordinary text
47
+ should not use custom visuals. Layout and purpose metadata remains agent guidance
48
+ rather than displayed copy. Use separate Text blocks when independently positioned
49
+ copy is needed.
73
50
 
74
51
  ### Theme-linked vector styles
75
52
 
@@ -117,7 +117,7 @@ function compileSlidePlan(slide: CompositionSlide, index: number) {
117
117
  const custom = component.customVisual
118
118
  ? component.customVisual.format === "vector"
119
119
  ? ` Custom visual — ${component.customVisual.elements.length} editable vector elements in a ${component.customVisual.viewBox.width}×${component.customVisual.viewBox.height} local viewport, ${component.customVisual.fit ?? "contain"} fit; preserve element IDs and edit individual geometry or styling while this component ID and preferred rectangle own slide placement.`
120
- : ` Custom visual — legacy self-contained SVG, ${component.customVisual.viewBox.width}×${component.customVisual.viewBox.height} local viewport, ${component.customVisual.fit ?? "contain"} fit; convert its source to editable vector elements when revising while this component ID and preferred rectangle own slide placement.`
120
+ : ` Custom visual — opaque self-contained SVG, ${component.customVisual.viewBox.width}×${component.customVisual.viewBox.height} local viewport, ${component.customVisual.fit ?? "contain"} fit; convert its source to editable vector elements when revising while this component ID and preferred rectangle own slide placement.`
121
121
  : "";
122
122
  return `- ${componentLabel(component)}, ${placement(component, slide)}: ${component.intent?.trim() || "Use its content-slot instructions."} Appearance — ${appearance(component)}.${grammar}${custom} Required slots — ${slotLabels}.`;
123
123
  });
@@ -8,29 +8,14 @@ import {
8
8
  type CompositionSlide,
9
9
  type ContentSlot,
10
10
  type Rect,
11
- type SemanticRelationship,
12
- type ThemeId,
13
- type AuthoringMode,
14
11
  } from "./types.ts";
15
12
  import { validateComposition } from "./validate.ts";
16
13
  import { appearanceOptions } from "./schema.ts";
17
14
  import { diagramDefinition } from "./visualizations.ts";
18
15
 
19
16
  export type Draft = CompositionDocument;
20
- type LegacyDraft = {
21
- title: string;
22
- audience: string;
23
- question: string;
24
- themeId: ThemeId;
25
- themeMode: "paper" | "night";
26
- authoringMode?: AuthoringMode;
27
- components: CompositionComponent[];
28
- readingOrder: string[];
29
- paintOrder: string[];
30
- relationships: SemanticRelationship[];
31
- };
32
17
  export type StoredDraftResult =
33
- { ok: true; draft: Draft; migrated: boolean } | { ok: false };
18
+ { ok: true; draft: Draft } | { ok: false };
34
19
  export type ParsedComposition =
35
20
  | { ok: true; document: CompositionDocument }
36
21
  | { ok: false; message: string };
@@ -574,78 +559,6 @@ export function duplicateComponent(draft: Draft, id: string, slideId?: string):
574
559
  };
575
560
  return validMutation(draft, next);
576
561
  }
577
- function legacyToComposition(draft: LegacyDraft): unknown {
578
- const components = draft.components;
579
- const rawComponents = components as unknown as Array<
580
- {
581
- id: string;
582
- kind: string;
583
- slotIds: string[];
584
- appearance?: { role?: string };
585
- intent?: string;
586
- }
587
- >;
588
- const contentSlots = rawComponents.flatMap((component) =>
589
- component.slotIds.map((id) => {
590
- const kind = component.kind;
591
- const source =
592
- kind === "footnote" ||
593
- (kind === "text-block" && component.appearance?.role === "footnote");
594
- const role = source
595
- ? "source"
596
- : kind === "headline" ||
597
- (kind === "text-block" && component.appearance?.role === "title")
598
- ? "takeaway"
599
- : ["visual", "evidence", "chart"].includes(kind)
600
- ? "evidence"
601
- : kind === "image"
602
- ? "image"
603
- : kind === "table"
604
- ? "table"
605
- : ["diagram", "process"].includes(kind)
606
- ? "process-step"
607
- : kind === "text-block"
608
- ? "body"
609
- : "entity";
610
- const base = {
611
- id,
612
- label: componentLabels[component.kind as CompositionComponent["kind"]] ??
613
- kind.replaceAll("-", " "),
614
- required: true,
615
- instruction: component.intent?.trim() || `Describe ${kind.replaceAll("-", " ")} content.`,
616
- };
617
- return role === "source"
618
- ? {
619
- ...base,
620
- role,
621
- targets: rawComponents
622
- .filter((candidate) => candidate.id !== component.id)
623
- .map((candidate) => candidate.id),
624
- }
625
- : { ...base, role };
626
- }),
627
- );
628
- return {
629
- schema: "konpeki-composition/v3",
630
- title: draft.title,
631
- ...(draft.authoringMode ? { authoringMode: draft.authoringMode } : {}),
632
- theme: { id: draft.themeId, mode: draft.themeMode },
633
- slide: {
634
- id: "slide-1",
635
- canvas: canvasSize,
636
- innerPadding: canvasPadding,
637
- audience: draft.audience,
638
- question: draft.question,
639
- intendedViewingSize: "presentation",
640
- contentSlots,
641
- components,
642
- groups: [],
643
- readingOrder: draft.readingOrder.map((id) => ({ kind: "component", id })),
644
- paintOrder: draft.paintOrder,
645
- relationships: draft.relationships,
646
- },
647
- };
648
- }
649
562
  export function serializeDraft(draft: Draft) {
650
563
  return JSON.stringify({ version: 2, document: draft });
651
564
  }
@@ -664,31 +577,9 @@ export function parseStoredDraft(raw: string): StoredDraftResult {
664
577
  return {
665
578
  ok: true,
666
579
  draft: { ...result.document, title: document.title },
667
- migrated: result.document.schema !== document.schema,
668
580
  };
669
581
  }
670
- const legacy = (parsed?.version === 1 ? parsed.draft : parsed) as LegacyDraft;
671
- if (
672
- !legacy ||
673
- typeof legacy.title !== "string" ||
674
- typeof legacy.audience !== "string" ||
675
- typeof legacy.question !== "string" ||
676
- !Array.isArray(legacy.readingOrder) ||
677
- !legacy.readingOrder.every((id: unknown) => typeof id === "string")
678
- )
679
- return { ok: false };
680
- const document = legacyToComposition(legacy) as { title: string };
681
- const result = validateComposition({
682
- ...document,
683
- title: document.title.trim() || "Untitled composition",
684
- });
685
- if (!result.ok)
686
- return { ok: false };
687
- return {
688
- ok: true,
689
- draft: { ...result.document, title: document.title },
690
- migrated: true,
691
- };
582
+ return { ok: false };
692
583
  } catch {
693
584
  return { ok: false };
694
585
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://vcfgdev.github.io/konpeki/composition/v18/schema.json",
2
+ "$id": "https://vcfgdev.github.io/konpeki/composition/v1/schema.json",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "additionalProperties": false,
5
5
  "properties": {
@@ -11,7 +11,7 @@
11
11
  "type": "string"
12
12
  },
13
13
  "schema": {
14
- "const": "konpeki-composition/v18"
14
+ "const": "konpeki-composition/v1"
15
15
  },
16
16
  "slides": {
17
17
  "items": {
@@ -2987,6 +2987,6 @@
2987
2987
  "title",
2988
2988
  "slides"
2989
2989
  ],
2990
- "title": "konpeki-composition/v18",
2990
+ "title": "konpeki-composition/v1",
2991
2991
  "type": "object"
2992
2992
  }
@@ -309,7 +309,7 @@ const components = componentKinds.map((kind) => {
309
309
  });
310
310
  export const schema = {
311
311
  $schema: "https://json-schema.org/draft/2020-12/schema",
312
- $id: "https://vcfgdev.github.io/konpeki/composition/v18/schema.json",
312
+ $id: "https://vcfgdev.github.io/konpeki/composition/v1/schema.json",
313
313
  title: compositionSchema,
314
314
  ...object(
315
315
  {
@@ -1,26 +1,7 @@
1
1
  import type { ChartTemplate, DiagramType } from "./visualizations.ts";
2
2
  export type { ChartTemplate, DiagramType } from "./visualizations.ts";
3
3
 
4
- export const compositionSchema = "konpeki-composition/v18" as const;
5
- export const legacyCompositionSchemas = [
6
- "konpeki-composition/v1",
7
- "konpeki-composition/v2",
8
- "konpeki-composition/v3",
9
- "konpeki-composition/v4",
10
- "konpeki-composition/v5",
11
- "konpeki-composition/v6",
12
- "konpeki-composition/v7",
13
- "konpeki-composition/v8",
14
- "konpeki-composition/v9",
15
- "konpeki-composition/v10",
16
- "konpeki-composition/v11",
17
- "konpeki-composition/v12",
18
- "konpeki-composition/v13",
19
- "konpeki-composition/v14",
20
- "konpeki-composition/v15",
21
- "konpeki-composition/v16",
22
- "konpeki-composition/v17",
23
- ] as const;
4
+ export const compositionSchema = "konpeki-composition/v1" as const;
24
5
  export type CanvasSize = { width: number; height: number };
25
6
  export const canvasSize = { width: 1920, height: 1080 } as const;
26
7
  export const canvasPadding = {