@calca/shared 0.0.0-stage → 0.7.5
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.
- package/README.md +6 -2
- package/package.json +33 -4
- package/src/index.ts +4 -0
- package/src/types/canvas.ts +6 -0
- package/src/types/comment.ts +22 -0
- package/src/types/design.ts +39 -0
- package/src/types/pipeline.ts +32 -0
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @calca/shared
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared TypeScript types for the Calca stack — canvas (`Point`, `ToolMode`), comments, design documents (`DesignIteration`, `GenerationGroup`, `CanvasImage`), and generation-pipeline status (`PipelineStage`, `PipelineStatus`). Types only; consumed by `@calca/canvas-*`, `@calca/mcp-*`, and the Calca app.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calca/shared",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.7.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./src/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "echo 'build: not yet implemented'",
|
|
19
|
+
"typecheck": "bunx tsc --noEmit",
|
|
20
|
+
"lint": "oxlint --fix .",
|
|
21
|
+
"format": "oxfmt --write .",
|
|
22
|
+
"test": "vitest run --passWithNoTests",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"validate": "bun ../../scripts/validate.ts --cwd $INIT_CWD"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"vitest": "^4.1.5"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/espetro/calca",
|
|
33
|
+
"directory": "packages/calca-shared"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Point } from "./canvas";
|
|
2
|
+
|
|
3
|
+
export type CommentStatus = "waiting" | "working" | "done";
|
|
4
|
+
|
|
5
|
+
export interface CommentMessage {
|
|
6
|
+
id: string;
|
|
7
|
+
role: "user" | "calca";
|
|
8
|
+
text: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Comment {
|
|
13
|
+
id: string;
|
|
14
|
+
position: Point; // Relative to the iteration
|
|
15
|
+
text: string;
|
|
16
|
+
number: number;
|
|
17
|
+
resolved?: boolean;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
status?: CommentStatus;
|
|
20
|
+
aiResponse?: string;
|
|
21
|
+
thread?: CommentMessage[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Point } from "./canvas";
|
|
2
|
+
import type { Comment } from "./comment";
|
|
3
|
+
|
|
4
|
+
export interface DesignIteration {
|
|
5
|
+
id: string;
|
|
6
|
+
html: string;
|
|
7
|
+
label: string;
|
|
8
|
+
position: Point;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
prompt: string;
|
|
12
|
+
comments: Comment[];
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
isRegenerating?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SummaryData {
|
|
18
|
+
title: string;
|
|
19
|
+
rationale: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GenerationGroup {
|
|
23
|
+
id: string;
|
|
24
|
+
prompt: string;
|
|
25
|
+
iterations: DesignIteration[];
|
|
26
|
+
position: Point;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
summary?: SummaryData;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CanvasImage {
|
|
32
|
+
id: string;
|
|
33
|
+
dataUrl: string; // Base64 data URI
|
|
34
|
+
name: string;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
position: Point;
|
|
38
|
+
thumbnail: string; // Smaller version for UI
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Pipeline stages for multi-model generation */
|
|
2
|
+
|
|
3
|
+
export type PipelineStage =
|
|
4
|
+
| "queued"
|
|
5
|
+
| "layout"
|
|
6
|
+
| "images"
|
|
7
|
+
| "compositing"
|
|
8
|
+
| "review"
|
|
9
|
+
| "refining"
|
|
10
|
+
| "done"
|
|
11
|
+
| "error";
|
|
12
|
+
|
|
13
|
+
export interface PipelineStatus {
|
|
14
|
+
stage: PipelineStage;
|
|
15
|
+
progress: number; // 0-1
|
|
16
|
+
skipped?: boolean;
|
|
17
|
+
reason?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const STAGE_CONFIG: Record<
|
|
21
|
+
PipelineStage,
|
|
22
|
+
{ label: string; progress: number; icon: string }
|
|
23
|
+
> = {
|
|
24
|
+
compositing: { label: "Compositing…", progress: 0.65, icon: "🔧" },
|
|
25
|
+
done: { label: "Complete", progress: 1, icon: "✅" },
|
|
26
|
+
error: { label: "Error", progress: 0, icon: "❌" },
|
|
27
|
+
images: { label: "Adding images…", progress: 0.45, icon: "🎨" },
|
|
28
|
+
layout: { label: "Generating layout…", progress: 0.2, icon: "🏗️" },
|
|
29
|
+
queued: { label: "Queued", progress: 0, icon: "⏳" },
|
|
30
|
+
refining: { label: "Preparing next variation…", progress: 0.9, icon: "✨" },
|
|
31
|
+
review: { label: "Reviewing design…", progress: 0.8, icon: "👁️" },
|
|
32
|
+
};
|