agent-canvas 0.9.0-dev.1 → 0.9.0-dev.10
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 +10 -0
- package/bin/lib/commands/review-remote.ts +186 -0
- package/bin/lib/commands/review.ts +88 -25
- package/bin/lib/instructions/app-review.md +31 -0
- package/daemon/build.ts +2 -0
- package/daemon/client/App.tsx +1 -1
- package/daemon/client/FileViewer.tsx +1 -1
- package/daemon/dist/client.css +2 -2
- package/daemon/dist/review.js +33 -3
- package/daemon/review-widget/anchor.ts +21 -4
- package/daemon/review-widget/browser.ts +46 -0
- package/daemon/review-widget/client.ts +23 -1
- package/daemon/review-widget/index.tsx +69 -11
- package/daemon/review-widget/remote-client.ts +117 -0
- package/daemon/review-widget/source.ts +43 -7
- package/daemon/review-widget/style.ts +51 -0
- package/daemon/review-widget/styles.css +30 -0
- package/daemon/review-widget/tsconfig.json +2 -1
- package/daemon/review-widget/widget.tsx +115 -17
- package/daemon/src/review/markdown.ts +6 -1
- package/daemon/src/review/model.ts +13 -1
- package/daemon/src/review/proxy.ts +30 -3
- package/daemon/src/review/remote.ts +112 -0
- package/daemon/src/review/sealing.ts +35 -0
- package/daemon/src/review/server.ts +16 -1
- package/daemon/src/review/store.ts +20 -28
- package/daemon/src/review/threads.ts +63 -0
- package/daemon/src/server.ts +1 -1
- package/daemon/tsconfig.json +1 -1
- package/package.json +23 -6
- package/skills/canvas/SKILL.md +2 -1
- package/types/bin/agent-canvas.d.ts +2 -0
- package/types/bin/lib/commands/daemon.d.ts +1 -0
- package/types/bin/lib/commands/exec.d.ts +7 -0
- package/types/bin/lib/commands/fetch.d.ts +1 -0
- package/types/bin/lib/commands/install.d.ts +1 -0
- package/types/bin/lib/commands/instructions.d.ts +1 -0
- package/types/bin/lib/commands/push.d.ts +1 -0
- package/types/bin/lib/commands/review-remote.d.ts +52 -0
- package/types/bin/lib/commands/review.d.ts +1 -0
- package/types/bin/lib/commands/watch.d.ts +1 -0
- package/types/bin/lib/config.d.ts +9 -0
- package/types/bin/lib/daemon-lifecycle.d.ts +4 -0
- package/types/bin/lib/helpers.d.ts +13 -0
- package/types/daemon/build.d.ts +1 -0
- package/types/daemon/client/App.d.ts +1 -0
- package/types/daemon/client/CompareView.d.ts +17 -0
- package/types/daemon/client/FileBrowser.d.ts +4 -0
- package/types/daemon/client/FileViewer.d.ts +6 -0
- package/types/daemon/client/OverviewView.d.ts +18 -0
- package/types/daemon/client/ReviewerIdentityDialog.d.ts +17 -0
- package/types/daemon/client/RevisionSelect.d.ts +10 -0
- package/types/daemon/client/SessionSwitcher.d.ts +6 -0
- package/types/daemon/client/ShareDialog.d.ts +30 -0
- package/types/daemon/client/apiSchemas.d.ts +1311 -0
- package/types/daemon/client/canvas-runtime.d.ts +1 -0
- package/types/daemon/client/clientApi.d.ts +112 -0
- package/types/daemon/client/components/SecretInput.d.ts +10 -0
- package/types/daemon/client/components/index.d.ts +2 -0
- package/types/daemon/client/domDiff.d.ts +37 -0
- package/types/daemon/client/errorMessage.d.ts +1 -0
- package/types/daemon/client/exportMarkdown.d.ts +1 -0
- package/types/daemon/client/lcs.d.ts +2 -0
- package/types/daemon/client/shareCrypto.d.ts +40 -0
- package/types/daemon/client/unifiedDiff.d.ts +26 -0
- package/types/daemon/langMap.d.ts +2 -0
- package/types/daemon/review-widget/anchor.d.ts +18 -0
- package/types/daemon/review-widget/browser.d.ts +6 -0
- package/types/daemon/review-widget/client.d.ts +38 -0
- package/types/daemon/review-widget/index.d.ts +1 -0
- package/types/daemon/review-widget/markup.d.ts +4 -0
- package/types/daemon/review-widget/remote-client.d.ts +29 -0
- package/types/daemon/review-widget/screenshot.d.ts +8 -0
- package/types/daemon/review-widget/source.d.ts +17 -0
- package/types/daemon/review-widget/style.d.ts +7 -0
- package/types/daemon/review-widget/widget.d.ts +7 -0
- package/types/daemon/src/components.d.ts +10 -0
- package/types/daemon/src/handlers/api.d.ts +11 -0
- package/types/daemon/src/handlers/files.d.ts +3 -0
- package/types/daemon/src/handlers/static.d.ts +2 -0
- package/types/daemon/src/handlers/uploads.d.ts +3 -0
- package/types/daemon/src/paths.d.ts +12 -0
- package/types/daemon/src/remote-feedback.d.ts +4 -0
- package/types/daemon/src/review/markdown.d.ts +3 -0
- package/types/daemon/src/review/model.d.ts +1089 -0
- package/types/daemon/src/review/proxy.d.ts +30 -0
- package/types/daemon/src/review/remote.d.ts +258 -0
- package/types/daemon/src/review/sealing.d.ts +11 -0
- package/types/daemon/src/review/server.d.ts +24 -0
- package/types/daemon/src/review/store.d.ts +34 -0
- package/types/daemon/src/review/threads.d.ts +35 -0
- package/types/daemon/src/server.d.ts +7 -0
- package/types/daemon/src/share.d.ts +98 -0
- package/types/daemon/src/stubFetch.d.ts +2 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ReviewComment, ReviewThreadState } from './model'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The thread lifecycle, shared by the daemon's file store and the share worker's encrypted store. It reads and writes
|
|
5
|
+
* only state, comments and timestamps; the anchor and the screenshot are each store's own, so a comment body here may be
|
|
6
|
+
* plaintext or ciphertext.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export class ReviewError extends Error {
|
|
10
|
+
constructor(message: string, readonly status: 400 | 404 | 409) {
|
|
11
|
+
super(message)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ThreadCore {
|
|
16
|
+
id: string
|
|
17
|
+
state: ReviewThreadState
|
|
18
|
+
comments: ReviewComment[]
|
|
19
|
+
updatedAt: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A note the person saved and has not sent: open, with their own comment last rather than the agent's answer. */
|
|
23
|
+
export function isUnsentNote(thread: ThreadCore): boolean {
|
|
24
|
+
return thread.state === 'open' && thread.comments.at(-1)?.author === 'user'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function openingState(send: boolean): ReviewThreadState {
|
|
28
|
+
return send ? 'queued' : 'open'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A comment from the person reopens a resolved thread; with `send` it goes to the agent. */
|
|
32
|
+
export function userCommented<T extends ThreadCore>(thread: T, comment: ReviewComment, send: boolean): T {
|
|
33
|
+
const state: ReviewThreadState = send ? 'queued' : thread.state === 'resolved' ? 'open' : thread.state
|
|
34
|
+
return { ...thread, comments: [...thread.comments, comment], state, updatedAt: comment.createdAt }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function sent<T extends ThreadCore>(thread: T, now: string): T {
|
|
38
|
+
if (thread.state === 'working') throw new ReviewError('The agent is already working on this thread', 409)
|
|
39
|
+
return { ...thread, state: 'queued', updatedAt: now }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Sends every unsent note at once, so the agent picks them up as one batch. */
|
|
43
|
+
export function notesSent<T extends ThreadCore>(threads: readonly T[], now: string): { threads: T[]; sent: T[] } {
|
|
44
|
+
const sentNotes = threads.filter(isUnsentNote).map((thread): T => ({ ...thread, state: 'queued', updatedAt: now }))
|
|
45
|
+
const sentById = new Map(sentNotes.map((thread) => [thread.id, thread]))
|
|
46
|
+
return { threads: threads.map((thread) => sentById.get(thread.id) ?? thread), sent: sentNotes }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function resolvedAs<T extends ThreadCore>(thread: T, resolved: boolean, now: string): T {
|
|
50
|
+
return { ...thread, state: resolved ? 'resolved' : 'open', updatedAt: now }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Hands every queued thread to the agent: they become `working` and are returned in their original order. */
|
|
54
|
+
export function claimed<T extends ThreadCore>(threads: readonly T[], now: string): { threads: T[]; claimed: T[] } {
|
|
55
|
+
const taken = threads.filter((thread) => thread.state === 'queued').map((thread): T => ({ ...thread, state: 'working', updatedAt: now }))
|
|
56
|
+
const takenById = new Map(taken.map((thread) => [thread.id, thread]))
|
|
57
|
+
return { threads: threads.map((thread) => takenById.get(thread.id) ?? thread), claimed: taken }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The agent's answer. Without `resolve` the thread goes back to the person as `open`. */
|
|
61
|
+
export function agentReplied<T extends ThreadCore>(thread: T, comment: ReviewComment, resolve: boolean): T {
|
|
62
|
+
return { ...thread, comments: [...thread.comments, comment], state: resolve ? 'resolved' : 'open', updatedAt: comment.createdAt }
|
|
63
|
+
}
|
package/daemon/src/server.ts
CHANGED
|
@@ -27,7 +27,7 @@ chmodSync(CLI_AUTH_FILE, 0o600)
|
|
|
27
27
|
const sessionManager = new SessionManager(SESSIONS_DIR)
|
|
28
28
|
const wsManager = createWebSocketManager(sessionManager)
|
|
29
29
|
const reviewStore = new ReviewStore(REVIEWS_DIR)
|
|
30
|
-
const reviewProxies = new ReviewProxies(reviewStore, `http://localhost:${PORT}/assets/review.js
|
|
30
|
+
const reviewProxies = new ReviewProxies(reviewStore, `http://localhost:${PORT}/assets/review.js`, (project, path) => review.fullReload(project, path))
|
|
31
31
|
const review = createReviewServer(reviewStore, reviewProxies)
|
|
32
32
|
|
|
33
33
|
type SocketData = WSData | ReviewSocketData
|
package/daemon/tsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-canvas",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.10",
|
|
4
4
|
"description": "Interactive visual canvas for Claude Code — rich annotatable documents in the browser",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,10 +18,27 @@
|
|
|
18
18
|
"bin",
|
|
19
19
|
"daemon",
|
|
20
20
|
"daemon/dist",
|
|
21
|
-
"skills"
|
|
21
|
+
"skills",
|
|
22
|
+
"types"
|
|
22
23
|
],
|
|
23
24
|
"exports": {
|
|
24
|
-
"./package.json": "./package.json"
|
|
25
|
+
"./package.json": "./package.json",
|
|
26
|
+
"./review/model": {
|
|
27
|
+
"types": "./types/daemon/src/review/model.d.ts",
|
|
28
|
+
"default": "./daemon/src/review/model.ts"
|
|
29
|
+
},
|
|
30
|
+
"./review/remote": {
|
|
31
|
+
"types": "./types/daemon/src/review/remote.d.ts",
|
|
32
|
+
"default": "./daemon/src/review/remote.ts"
|
|
33
|
+
},
|
|
34
|
+
"./review/sealing": {
|
|
35
|
+
"types": "./types/daemon/src/review/sealing.d.ts",
|
|
36
|
+
"default": "./daemon/src/review/sealing.ts"
|
|
37
|
+
},
|
|
38
|
+
"./review/threads": {
|
|
39
|
+
"types": "./types/daemon/src/review/threads.d.ts",
|
|
40
|
+
"default": "./daemon/src/review/threads.ts"
|
|
41
|
+
}
|
|
25
42
|
},
|
|
26
43
|
"scripts": {
|
|
27
44
|
"build": "bun daemon/build.ts",
|
|
@@ -30,9 +47,9 @@
|
|
|
30
47
|
"test": "bun test"
|
|
31
48
|
},
|
|
32
49
|
"dependencies": {
|
|
33
|
-
"@fabrika/annotations": "0.9.0-dev.
|
|
34
|
-
"@fabrika/canvas-kernel": "0.9.0-dev.
|
|
35
|
-
"@fabrika/daemon-kit": "0.9.0-dev.
|
|
50
|
+
"@fabrika/annotations": "0.9.0-dev.10",
|
|
51
|
+
"@fabrika/canvas-kernel": "0.9.0-dev.10",
|
|
52
|
+
"@fabrika/daemon-kit": "0.9.0-dev.10",
|
|
36
53
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
37
54
|
"marked": "^17.0.4",
|
|
38
55
|
"mermaid-parser-bundle": "^0.1.2",
|
package/skills/canvas/SKILL.md
CHANGED
|
@@ -44,4 +44,5 @@ bunx agent-canvas instructions --list
|
|
|
44
44
|
## Reviewing a running application
|
|
45
45
|
|
|
46
46
|
When the user wants to comment on a running application instead of a canvas, follow
|
|
47
|
-
`bunx agent-canvas instructions app-review`. Review mode needs no session ID; it uses a project name.
|
|
47
|
+
`bunx agent-canvas instructions app-review`. Review mode needs no session ID; it uses a project name. It covers a
|
|
48
|
+
deployed application too (`review share`), with the threads end-to-end encrypted on the share worker.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleDaemon(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface SecretAssignment {
|
|
2
|
+
envName: string;
|
|
3
|
+
fieldId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function parseSecretAssignments(rawAssignments: string[]): SecretAssignment[];
|
|
6
|
+
export declare function spawnWithSecretEnvironment(commandArgs: string[], assignments: SecretAssignment[], values: Map<string, string>): Promise<number>;
|
|
7
|
+
export declare function handleExec(args: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleFetch(args: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleInstall(args: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleInstructions(args: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handlePush(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ReviewThread } from '../../../daemon/src/review/model.ts';
|
|
3
|
+
/**
|
|
4
|
+
* A remote review project as this machine knows it: where it lives, the key that seals its threads and the token that
|
|
5
|
+
* lets the agent claim and answer them. Both secrets stay in this file; the worker holds only the token's hash.
|
|
6
|
+
*/
|
|
7
|
+
declare const remoteReviewSchema: z.ZodObject<{
|
|
8
|
+
endpoint: z.ZodString;
|
|
9
|
+
projectId: z.ZodString;
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
agentToken: z.ZodString;
|
|
12
|
+
appUrl: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
projectId: string;
|
|
15
|
+
agentToken: string;
|
|
16
|
+
key: string;
|
|
17
|
+
endpoint: string;
|
|
18
|
+
appUrl: string;
|
|
19
|
+
}, {
|
|
20
|
+
projectId: string;
|
|
21
|
+
agentToken: string;
|
|
22
|
+
key: string;
|
|
23
|
+
endpoint: string;
|
|
24
|
+
appUrl: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type RemoteReview = z.infer<typeof remoteReviewSchema>;
|
|
27
|
+
export declare function loadRemoteReview(project: string): RemoteReview | undefined;
|
|
28
|
+
/** Creates the project on the share worker for the application at `appUrl` and keeps its secrets on this machine. */
|
|
29
|
+
export declare function createRemoteReview(project: string, appUrl: URL): Promise<RemoteReview>;
|
|
30
|
+
/** The address the reviewer opens: the application, with the project and its key in the fragment. */
|
|
31
|
+
export declare function reviewerLink(remote: RemoteReview): string;
|
|
32
|
+
export declare function remoteSnippet(remote: RemoteReview): string;
|
|
33
|
+
/** The agent's side of a remote project: every request carries the agent token, every thread is opened here. */
|
|
34
|
+
export declare class RemoteReviewBackend {
|
|
35
|
+
private readonly project;
|
|
36
|
+
private readonly remote;
|
|
37
|
+
private key;
|
|
38
|
+
constructor(project: string, remote: RemoteReview);
|
|
39
|
+
get waitUrl(): string;
|
|
40
|
+
/** The agent's wait socket; it pings so an idle connection stays open between batches. */
|
|
41
|
+
createSocket(url: string): WebSocket;
|
|
42
|
+
/** Takes the sent threads, as markdown, or `undefined` when none are waiting. */
|
|
43
|
+
claim(): Promise<string | undefined>;
|
|
44
|
+
threads(): Promise<ReviewThread[]>;
|
|
45
|
+
reply(threadId: string, body: string, resolve: boolean): Promise<void>;
|
|
46
|
+
private open;
|
|
47
|
+
/** Writes the reviewer's screenshot where the agent can read it, as the daemon does for local threads. */
|
|
48
|
+
private saveScreenshot;
|
|
49
|
+
private cryptoKey;
|
|
50
|
+
private call;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleReview(args: string[]): Promise<undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleWatch(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PACKAGE_ROOT: string;
|
|
2
|
+
export declare const VERSION: string;
|
|
3
|
+
export declare const TEMP_DIR: string;
|
|
4
|
+
export declare const DAEMON_PORT: number;
|
|
5
|
+
export declare const BASE_URL: string;
|
|
6
|
+
export declare const WS_URL: string;
|
|
7
|
+
export declare const TIMEOUT_MS: number;
|
|
8
|
+
export declare const PID_FILE: string;
|
|
9
|
+
export declare const CLI_AUTH_FILE: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type WaiterSocket } from '@fabrika/daemon-kit';
|
|
2
|
+
export declare function getSessionId(session?: string): string;
|
|
3
|
+
export declare function consumeFeedback(sessionId: string): Promise<string | null>;
|
|
4
|
+
export declare function openBrowser(url: string): void;
|
|
5
|
+
interface FeedbackWaitOptions {
|
|
6
|
+
createSocket?: (url: string) => WaiterSocket;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
reconnectAttempts?: number;
|
|
9
|
+
reconnectDelayMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function waitForFeedback(sessionId: string, options?: FeedbackWaitOptions): Promise<string>;
|
|
12
|
+
export declare function readLine(): Promise<string>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CompareViewProps {
|
|
3
|
+
initialLeft: number;
|
|
4
|
+
initialRight: number;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
onExit: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function CompareView({ initialLeft, initialRight, sessionId, onExit }: CompareViewProps): React.JSX.Element;
|
|
9
|
+
interface ComparePanelRendererProps {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
revision: number;
|
|
12
|
+
filename: string;
|
|
13
|
+
onReady: () => void;
|
|
14
|
+
onError?: (message: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const ComparePanelRenderer: React.NamedExoticComponent<ComparePanelRendererProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RevisionInfo } from '@fabrika/canvas-kernel/client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface OverviewViewProps {
|
|
4
|
+
revision: number;
|
|
5
|
+
responseBanner?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface FileChange {
|
|
8
|
+
filename: string;
|
|
9
|
+
status: 'new' | 'changed' | 'unchanged';
|
|
10
|
+
diffStats?: {
|
|
11
|
+
added: number;
|
|
12
|
+
removed: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function categorizeChanges(currentRev: RevisionInfo | undefined, previousRev: RevisionInfo | undefined): FileChange[];
|
|
16
|
+
export declare function getAffectedFiles(changes: FileChange[]): string[];
|
|
17
|
+
export declare function OverviewView({ revision, responseBanner }: OverviewViewProps): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal shown in shared mode when a reviewer submits feedback without a
|
|
3
|
+
* cached identity. Asks for a display name that will appear on the
|
|
4
|
+
* reviewer's annotations when they land in the canvas author's local view.
|
|
5
|
+
*
|
|
6
|
+
* Identity is persisted in localStorage so the prompt only appears once
|
|
7
|
+
* per browser per share worker origin. The id is a random UUID — never
|
|
8
|
+
* tied to any authenticated account, just enough to group annotations by
|
|
9
|
+
* the same reviewer across revisions.
|
|
10
|
+
*/
|
|
11
|
+
interface ReviewerIdentityDialogProps {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
onSubmit: (name: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function ReviewerIdentityDialog({ open, onClose, onSubmit }: ReviewerIdentityDialogProps): import("react").JSX.Element | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface RevisionSelectProps {
|
|
2
|
+
value: number;
|
|
3
|
+
onChange: (rev: number) => void;
|
|
4
|
+
/** Accent color for the trigger text */
|
|
5
|
+
accent?: 'default' | 'red' | 'green' | 'amber';
|
|
6
|
+
/** Extra class on the trigger button */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function RevisionSelect({ value, onChange, accent, className }: RevisionSelectProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ShareEntry } from './apiSchemas';
|
|
2
|
+
interface ShareDialogProps {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
open: boolean;
|
|
6
|
+
shareEnabled: boolean;
|
|
7
|
+
existingShares: ShareEntry[];
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onShareCreated: (share: ShareEntry) => void;
|
|
10
|
+
onShareRevoked: (shareId: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Modal dialog for sharing a canvas revision to the cloud.
|
|
14
|
+
*
|
|
15
|
+
* Flow: user clicks Share → this dialog opens → user clicks "Create link"
|
|
16
|
+
* → POST to daemon → daemon uploads snapshot to CF Worker → daemon returns
|
|
17
|
+
* ShareEntry → dialog shows the URL with copy-to-clipboard.
|
|
18
|
+
*
|
|
19
|
+
* If a share already exists for this revision, the existing URL is shown
|
|
20
|
+
* immediately. Owner can revoke (delete on the worker side) via the
|
|
21
|
+
* stored ownerToken.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ShareDialog({ sessionId, revision, open, shareEnabled, existingShares, onClose, onShareCreated, onShareRevoked, }: ShareDialogProps): import("react").JSX.Element | null;
|
|
24
|
+
/** Small share icon button for toolbar use. */
|
|
25
|
+
export declare function ShareButton({ onClick, title, hasShare }: {
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
title?: string;
|
|
28
|
+
hasShare?: boolean;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
export {};
|