agent-canvas 0.9.0-dev.7 → 0.9.0-dev.9
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/dist/review.js +3 -3
- package/daemon/review-widget/client.ts +16 -1
- package/daemon/review-widget/index.tsx +69 -11
- package/daemon/review-widget/remote-client.ts +117 -0
- package/daemon/review-widget/widget.tsx +3 -9
- package/daemon/src/review/model.ts +0 -5
- package/daemon/src/review/remote.ts +112 -0
- package/daemon/src/review/sealing.ts +35 -0
- package/daemon/src/review/server.ts +2 -1
- package/daemon/src/review/store.ts +16 -35
- package/daemon/src/review/threads.ts +63 -0
- 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 @@
|
|
|
1
|
+
export * from '@fabrika/canvas-kernel/runtime';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client API layer — abstracts over daemon-local vs. shared (CF Worker)
|
|
3
|
+
* modes. Every fetch-adjacent function in the client should go through
|
|
4
|
+
* this module instead of hardcoding URLs, so shared mode works without
|
|
5
|
+
* scattering branches across components.
|
|
6
|
+
*
|
|
7
|
+
* Mode is determined once at module load by checking
|
|
8
|
+
* `window.__CANVAS_SHARE__`, which the CF Worker injects into the HTML
|
|
9
|
+
* shell it serves. Local daemon never sets this, so the app defaults to
|
|
10
|
+
* local mode.
|
|
11
|
+
*
|
|
12
|
+
* End-to-end encryption
|
|
13
|
+
* ---------------------
|
|
14
|
+
* When the share URL carries a `#k=<base64url>` fragment, every secret
|
|
15
|
+
* payload going over the wire is encrypted with that key:
|
|
16
|
+
* - canvas JS bodies (decrypted before being imported as ES modules),
|
|
17
|
+
* - origin.sessionId / origin.label in the meta response,
|
|
18
|
+
* - feedback fields submitted by the reviewer.
|
|
19
|
+
* The key is never sent to the worker — browsers strip URL fragments
|
|
20
|
+
* before issuing requests. Legacy shares with no fragment continue to
|
|
21
|
+
* work in cleartext.
|
|
22
|
+
*/
|
|
23
|
+
import type { CanvasHost } from '@fabrika/canvas-kernel/client';
|
|
24
|
+
import { type SessionMeta } from './apiSchemas';
|
|
25
|
+
declare global {
|
|
26
|
+
interface Window {
|
|
27
|
+
__CANVAS_SHARE__?: {
|
|
28
|
+
shareId: string;
|
|
29
|
+
mode: 'shared';
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export interface SharedModeInfo {
|
|
34
|
+
isShared: true;
|
|
35
|
+
shareId: string;
|
|
36
|
+
/** Lazy-imported AES-GCM key parsed from the URL fragment, if any. */
|
|
37
|
+
encryptionKey: Promise<CryptoKey> | null;
|
|
38
|
+
}
|
|
39
|
+
export interface LocalModeInfo {
|
|
40
|
+
isShared: false;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
}
|
|
43
|
+
export type ModeInfo = SharedModeInfo | LocalModeInfo;
|
|
44
|
+
/** One-time detection. In shared mode the daemon-provided sessionId from
|
|
45
|
+
* the URL path is ignored in favor of the worker-injected shareId. */
|
|
46
|
+
export declare function detectMode(): ModeInfo;
|
|
47
|
+
export declare const MODE: ModeInfo;
|
|
48
|
+
/** True iff we're in a shared canvas AND have a fragment key. */
|
|
49
|
+
export declare function isEncryptedShare(): boolean;
|
|
50
|
+
/** Build a canonical id-ish string used as React keys / identifiers. */
|
|
51
|
+
export declare function getIdentifier(): string;
|
|
52
|
+
/** Metadata endpoint (revisions, canvas files, project root). */
|
|
53
|
+
export declare function metaUrl(): string;
|
|
54
|
+
/** Compiled canvas JS module for a given filename (+ optional revision). */
|
|
55
|
+
export declare function canvasJsUrl(filename: string, revision?: number): string;
|
|
56
|
+
/** Upload endpoint for annotation images. */
|
|
57
|
+
export declare function uploadUrl(): string;
|
|
58
|
+
/** Return only readiness metadata. The secret value is never sent back to the browser. */
|
|
59
|
+
export declare function getLocalSecretStatus(fieldId: string): Promise<boolean>;
|
|
60
|
+
/** Deposit a secret into the daemon's in-memory vault. */
|
|
61
|
+
export declare function storeLocalSecret(fieldId: string, value: string): Promise<void>;
|
|
62
|
+
/** Remove a deposited secret without retrieving its value. */
|
|
63
|
+
export declare function clearLocalSecret(fieldId: string): Promise<void>;
|
|
64
|
+
/** Fetch + parse meta, decrypting origin.sessionId/label for encrypted
|
|
65
|
+
* shares. The shape returned is the same as the worker/daemon emits, so
|
|
66
|
+
* callers don't have to branch. */
|
|
67
|
+
export declare function fetchMeta(): Promise<SessionMeta>;
|
|
68
|
+
/** Dynamically import the compiled canvas JS for a revision. In encrypted
|
|
69
|
+
* shared mode the body is ciphertext, so we fetch it, decrypt to plain JS
|
|
70
|
+
* source, then materialize as a Blob URL the browser can `import()`.
|
|
71
|
+
* Import maps still apply to Blob-URL module imports, so the resulting
|
|
72
|
+
* module's `#canvas/runtime` / `#canvas/components` imports resolve
|
|
73
|
+
* exactly as they would for an in-place script. */
|
|
74
|
+
export declare const loadCanvasModule: CanvasHost['loadCanvasModule'];
|
|
75
|
+
export declare function getReviewerIdentity(): {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
} | null;
|
|
79
|
+
export declare function setReviewerIdentity(name: string): {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Shape submitted by the shared-mode client when a reviewer submits
|
|
85
|
+
* feedback. Matches the worker's `FeedbackPostBody`.
|
|
86
|
+
*/
|
|
87
|
+
export interface SharedFeedbackPayload {
|
|
88
|
+
author: {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
};
|
|
92
|
+
revision: number;
|
|
93
|
+
annotations: Array<Record<string, unknown>>;
|
|
94
|
+
generalNote?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Submit feedback in shared mode. Throws on HTTP error. Caller is
|
|
98
|
+
* responsible for collecting + prompting for the reviewer's name before
|
|
99
|
+
* invoking this. Transparently encrypts when the share URL carried a
|
|
100
|
+
* fragment key.
|
|
101
|
+
*/
|
|
102
|
+
export declare function submitSharedFeedback(payload: SharedFeedbackPayload): Promise<void>;
|
|
103
|
+
/** Are daemon-only filesystem endpoints (file tree, file viewer) available? */
|
|
104
|
+
export declare const FS_AVAILABLE: boolean;
|
|
105
|
+
/** Is live WebSocket session updates available? */
|
|
106
|
+
export declare const WS_AVAILABLE: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* What the kernel's annotation surface needs from this host. agent-canvas
|
|
109
|
+
* serves canvases in two modes, so these cannot use the kernel's local-only
|
|
110
|
+
* defaults: shared canvases come from the worker (and may be encrypted).
|
|
111
|
+
*/
|
|
112
|
+
export declare const canvasHost: CanvasHost;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface SecretInputProps {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
env: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Local-only secret handoff that never enters annotation or feedback state. */
|
|
9
|
+
export declare function SecretInput({ id, label, env, placeholder, required }: SecretInputProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word-level DOM diff engine.
|
|
3
|
+
*
|
|
4
|
+
* Three stages:
|
|
5
|
+
* 1. Extract words from a DOM container with source-node mapping
|
|
6
|
+
* 2. Compute word-level LCS diff
|
|
7
|
+
* 3. Inject highlight <span> elements into the DOM
|
|
8
|
+
*/
|
|
9
|
+
interface WordEntry {
|
|
10
|
+
text: string;
|
|
11
|
+
node: Text;
|
|
12
|
+
offset: number;
|
|
13
|
+
}
|
|
14
|
+
/** Walk all text nodes, tokenize into words+whitespace, record originating node+offset. */
|
|
15
|
+
export declare function extractWords(container: HTMLElement): {
|
|
16
|
+
words: string[];
|
|
17
|
+
map: WordEntry[];
|
|
18
|
+
};
|
|
19
|
+
interface DiffOp {
|
|
20
|
+
type: 'same' | 'added' | 'removed';
|
|
21
|
+
index: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compute word-level LCS and return diff ops for both sides.
|
|
25
|
+
*
|
|
26
|
+
* For large inputs (>5k tokens), falls back to chunked diffing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeWordDiff(oldWords: string[], newWords: string[]): {
|
|
29
|
+
oldOps: DiffOp[];
|
|
30
|
+
newOps: DiffOp[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Main entry point: run the full diff pipeline on two rendered containers.
|
|
34
|
+
* Returns true if there were any changes.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runDomDiff(oldContainer: HTMLElement, newContainer: HTMLElement): boolean;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function errorMessage(error: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function exportCanvasToMarkdown(container: HTMLElement): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AES-GCM-256 helpers for end-to-end encrypted canvas shares.
|
|
3
|
+
*
|
|
4
|
+
* The same module is loaded in the browser (decrypts payloads) and in the
|
|
5
|
+
* daemon's Bun runtime (encrypts payloads + decrypts polled feedback). It
|
|
6
|
+
* only uses `crypto.subtle`, `TextEncoder`/`TextDecoder`, and
|
|
7
|
+
* `btoa`/`atob` — all available in both environments.
|
|
8
|
+
*
|
|
9
|
+
* Wire format
|
|
10
|
+
* -----------
|
|
11
|
+
* - Key: 32 random bytes, transported in the URL fragment as base64url
|
|
12
|
+
* (e.g. `#k=<key>`). Fragments are never sent to the worker, so the
|
|
13
|
+
* worker cannot decrypt the payloads it stores.
|
|
14
|
+
* - Each encrypted string is `base64(IV || ciphertext-with-tag)` where the
|
|
15
|
+
* IV is 12 fresh random bytes. This is the standard AES-GCM packing.
|
|
16
|
+
* - The presence of an `encryption: { alg: "AES-GCM", v: 1 }` marker on a
|
|
17
|
+
* SharePayload / FeedbackPostBody / ShareRecord tells the consumer that
|
|
18
|
+
* the marked fields contain ciphertext rather than plaintext.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CRYPTO_ALG: "AES-GCM";
|
|
21
|
+
export declare const CRYPTO_VERSION: 1;
|
|
22
|
+
export interface EncryptionMeta {
|
|
23
|
+
alg: typeof CRYPTO_ALG;
|
|
24
|
+
v: typeof CRYPTO_VERSION;
|
|
25
|
+
}
|
|
26
|
+
export declare const ENCRYPTION_META: EncryptionMeta;
|
|
27
|
+
/** Generate a fresh 256-bit AES-GCM key. */
|
|
28
|
+
export declare function generateShareKey(): Promise<CryptoKey>;
|
|
29
|
+
/** Export a CryptoKey to a base64url string suitable for URL fragments. */
|
|
30
|
+
export declare function exportShareKey(key: CryptoKey): Promise<string>;
|
|
31
|
+
/** Import a base64url-encoded key for AES-GCM. */
|
|
32
|
+
export declare function importShareKey(encoded: string): Promise<CryptoKey>;
|
|
33
|
+
/** Encrypt a UTF-8 string. Returns base64(IV || ciphertext+tag). */
|
|
34
|
+
export declare function encryptString(key: CryptoKey, plaintext: string): Promise<string>;
|
|
35
|
+
/** Decrypt a base64-encoded ciphertext back to a UTF-8 string. */
|
|
36
|
+
export declare function decryptString(key: CryptoKey, ciphertext: string): Promise<string>;
|
|
37
|
+
/** Convenience: encrypt a JSON-serializable value as a single ciphertext blob. */
|
|
38
|
+
export declare function encryptJson(key: CryptoKey, value: unknown): Promise<string>;
|
|
39
|
+
/** Convenience: decrypt a ciphertext blob into a JSON value. */
|
|
40
|
+
export declare function decryptJson<T = unknown>(key: CryptoKey, ciphertext: string): Promise<T>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified (inline) diff view: block-level matching + word-level inline highlights.
|
|
3
|
+
*
|
|
4
|
+
* 1. Extract block trees from rendered old/new containers using data-md attributes
|
|
5
|
+
* 2. Match blocks by key using LCS for ordering
|
|
6
|
+
* 3. Build a single unified DOM with inline add/remove highlights
|
|
7
|
+
*/
|
|
8
|
+
interface BlockDescriptor {
|
|
9
|
+
key: string;
|
|
10
|
+
type: string;
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
children: BlockDescriptor[];
|
|
13
|
+
}
|
|
14
|
+
interface BlockMatch {
|
|
15
|
+
kind: 'matched' | 'added' | 'removed';
|
|
16
|
+
oldBlock?: BlockDescriptor;
|
|
17
|
+
newBlock?: BlockDescriptor;
|
|
18
|
+
childMatches?: BlockMatch[];
|
|
19
|
+
}
|
|
20
|
+
export declare function extractBlockTree(container: HTMLElement): BlockDescriptor[];
|
|
21
|
+
export declare function matchBlocks(oldBlocks: BlockDescriptor[], newBlocks: BlockDescriptor[]): BlockMatch[];
|
|
22
|
+
export declare function buildUnifiedDom(matches: BlockMatch[]): {
|
|
23
|
+
fragment: DocumentFragment;
|
|
24
|
+
hasChanges: boolean;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReviewAnchor } from '../src/review/model';
|
|
2
|
+
export declare function roleOf(element: Element): string | undefined;
|
|
3
|
+
/** The accessible name, approximated: the sources a reviewer's element usually has, in the order the spec reads them. */
|
|
4
|
+
export declare function nameOf(element: Element): string | undefined;
|
|
5
|
+
/** A CSS path from the nearest ancestor with an id, or from `body`, using `:nth-of-type` only where siblings share a tag. */
|
|
6
|
+
export declare function selectorOf(element: Element): string;
|
|
7
|
+
/** Owner components of a React development build, outermost first; empty for other renderers and production builds. */
|
|
8
|
+
export declare function componentsOf(element: Element): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Describes the element, or the selection inside it, so the agent can find it in code and the widget in the page.
|
|
11
|
+
* Source positions need the page's source maps, so the caller resolves them separately.
|
|
12
|
+
*/
|
|
13
|
+
export declare function describe(element: Element, url: string, range?: Range): ReviewAnchor;
|
|
14
|
+
/**
|
|
15
|
+
* Re-finds the anchored element after the page re-rendered: the CSS path when it still points at an element with the
|
|
16
|
+
* same role and name, otherwise the only element with that role and name.
|
|
17
|
+
*/
|
|
18
|
+
export declare function find(document: Document, anchor: ReviewAnchor): Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReviewAnchor } from '../src/review/model';
|
|
2
|
+
type ReviewBrowser = NonNullable<ReviewAnchor['browser']>;
|
|
3
|
+
/** Browser, major version and operating system, e.g. `Chrome 141 · Linux`; the rest of a user agent is noise. */
|
|
4
|
+
export declare function browserName(userAgent: string): string;
|
|
5
|
+
export declare function browserOf(view: Window): ReviewBrowser;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReviewAnchor, type ReviewThread } from '../src/review/model';
|
|
2
|
+
export interface ReviewEvents {
|
|
3
|
+
threads(threads: readonly ReviewThread[]): void;
|
|
4
|
+
agentWatching(watching: boolean): void;
|
|
5
|
+
connected(connected: boolean): void;
|
|
6
|
+
reload(path: string): void;
|
|
7
|
+
}
|
|
8
|
+
/** Where the widget keeps threads: the local daemon, or a remote project on the share worker. */
|
|
9
|
+
export interface ReviewClient {
|
|
10
|
+
/** The presence label while the widget cannot reach its store. */
|
|
11
|
+
readonly offlineLabel: string;
|
|
12
|
+
connect(events: ReviewEvents): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
createThread(anchor: ReviewAnchor, body: string, send: boolean, screenshot?: string): Promise<unknown>;
|
|
15
|
+
comment(threadId: string, body: string, send: boolean): Promise<unknown>;
|
|
16
|
+
send(threadId: string): Promise<unknown>;
|
|
17
|
+
sendNotes(): Promise<unknown>;
|
|
18
|
+
setResolved(threadId: string, resolved: boolean): Promise<unknown>;
|
|
19
|
+
delete(threadId: string): Promise<unknown>;
|
|
20
|
+
}
|
|
21
|
+
/** The widget's side of the daemon: thread mutations over HTTP, the thread list and agent presence over a WebSocket. */
|
|
22
|
+
export declare class DaemonReviewClient implements ReviewClient {
|
|
23
|
+
private readonly daemonOrigin;
|
|
24
|
+
private readonly project;
|
|
25
|
+
readonly offlineLabel = "Daemon offline";
|
|
26
|
+
private socket;
|
|
27
|
+
private closed;
|
|
28
|
+
constructor(daemonOrigin: string, project: string);
|
|
29
|
+
connect(events: ReviewEvents): void;
|
|
30
|
+
close(): void;
|
|
31
|
+
createThread(anchor: ReviewAnchor, body: string, send: boolean, screenshot?: string): Promise<unknown>;
|
|
32
|
+
comment(threadId: string, body: string, send: boolean): Promise<unknown>;
|
|
33
|
+
send(threadId: string): Promise<unknown>;
|
|
34
|
+
sendNotes(): Promise<unknown>;
|
|
35
|
+
setResolved(threadId: string, resolved: boolean): Promise<unknown>;
|
|
36
|
+
delete(threadId: string): Promise<unknown>;
|
|
37
|
+
private request;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The element's markup, shallower until it fits: the agent sees structure, classes and attributes, not whole subtrees. */
|
|
2
|
+
export declare function htmlOf(element: Element): string;
|
|
3
|
+
/** The page heading and the nearest section and dialog around the element, outermost first. */
|
|
4
|
+
export declare function contextOf(element: Element): string | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReviewAnchor } from '../src/review/model';
|
|
2
|
+
import type { ReviewClient, ReviewEvents } from './client';
|
|
3
|
+
/**
|
|
4
|
+
* The widget's side of a remote review project on the share worker. Everything the reviewer writes is sealed with the
|
|
5
|
+
* project key before it leaves the page, and every thread the worker sends is opened here.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RemoteReviewClient implements ReviewClient {
|
|
8
|
+
private readonly workerOrigin;
|
|
9
|
+
private readonly projectId;
|
|
10
|
+
private readonly key;
|
|
11
|
+
readonly offlineLabel = "Offline";
|
|
12
|
+
private socket;
|
|
13
|
+
private keepalive;
|
|
14
|
+
private closed;
|
|
15
|
+
/** Opening threads is asynchronous; only the newest list may reach the widget. */
|
|
16
|
+
private generation;
|
|
17
|
+
constructor(workerOrigin: string, projectId: string, key: CryptoKey);
|
|
18
|
+
connect(events: ReviewEvents): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
createThread(anchor: ReviewAnchor, body: string, send: boolean, screenshot?: string): Promise<unknown>;
|
|
21
|
+
comment(threadId: string, body: string, send: boolean): Promise<unknown>;
|
|
22
|
+
send(threadId: string): Promise<unknown>;
|
|
23
|
+
sendNotes(): Promise<unknown>;
|
|
24
|
+
setResolved(threadId: string, resolved: boolean): Promise<unknown>;
|
|
25
|
+
delete(threadId: string): Promise<unknown>;
|
|
26
|
+
/** A thread that does not open was not sealed with this project's key; the reviewer never sees it. */
|
|
27
|
+
private publish;
|
|
28
|
+
private request;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real pixels of the element in its surroundings, the element outlined, the widget hidden: the browser asks the
|
|
3
|
+
* reviewer to share this tab for one frame. Rendering the DOM into a picture instead gets fonts and text wrapping
|
|
4
|
+
* wrong, which is exactly what a visual comment is about.
|
|
5
|
+
*
|
|
6
|
+
* Call it straight from the click handler: the browser lets a page ask for the tab only during a user gesture.
|
|
7
|
+
*/
|
|
8
|
+
export declare function captureElement(element: Element, widgetHost: HTMLElement): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReviewSource } from '../src/review/model';
|
|
2
|
+
/** A frame of a development stack, still in the bundle the page loaded. */
|
|
3
|
+
export interface BundleFrame {
|
|
4
|
+
label: string;
|
|
5
|
+
url: string;
|
|
6
|
+
line: number;
|
|
7
|
+
column: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Where the element and its nearest components were created, read off React 19 development fibers (`_debugStack`).
|
|
11
|
+
* Empty for other renderers and production builds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function bundleFrames(element: Element): BundleFrame[];
|
|
14
|
+
/** Whether a dependency, not the application, created the fiber's element; unknown without a development stack. */
|
|
15
|
+
export declare function createdInLibrary(fiber: Record<string, unknown>): boolean;
|
|
16
|
+
/** Source positions of the frames, through the bundles' source maps; frames a map does not cover are left out. */
|
|
17
|
+
export declare function resolveSources(frames: readonly BundleFrame[]): Promise<ReviewSource[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ComputedStyle = Pick<CSSStyleDeclaration, 'getPropertyValue'>;
|
|
2
|
+
/**
|
|
3
|
+
* The computed values that explain an element's box, layout and type, as CSS declarations. Initial values are left
|
|
4
|
+
* out; flex and grid properties only appear on flex and grid containers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function styleOf(style: ComputedStyle): string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReviewAnchor } from '../src/review/model';
|
|
2
|
+
import type { ReviewClient } from './client';
|
|
3
|
+
export declare function anchorLabel(anchor: ReviewAnchor): string;
|
|
4
|
+
export declare function ReviewWidget(props: {
|
|
5
|
+
client: ReviewClient;
|
|
6
|
+
host: HTMLElement;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Components agent-canvas adds on top of the kernel's set.
|
|
3
|
+
*
|
|
4
|
+
* Keep in sync with `daemon/client/components/index.ts` — the compiler injects
|
|
5
|
+
* these names into authored JSX, and the browser resolves them from that barrel
|
|
6
|
+
* through `#canvas/components`. A name here with no matching export renders as
|
|
7
|
+
* undefined.
|
|
8
|
+
*/
|
|
9
|
+
import type { CanvasComponents } from '@fabrika/canvas-kernel/server';
|
|
10
|
+
export declare const HOST_COMPONENTS: CanvasComponents;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SessionManager } from '@fabrika/canvas-kernel/server';
|
|
2
|
+
import { type Route } from '@fabrika/daemon-kit';
|
|
3
|
+
export interface ApiContext {
|
|
4
|
+
sessionManager: SessionManager;
|
|
5
|
+
broadcastPlanUpdate: (id: string) => void;
|
|
6
|
+
broadcastRevisionUpdate: (id: string) => void;
|
|
7
|
+
port: number;
|
|
8
|
+
version: string;
|
|
9
|
+
cliAuthToken: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createApiHandlers(ctx: ApiContext): Route[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** agent-canvas's on-disk layout. Kept in sync with bin/lib/config.ts. */
|
|
2
|
+
export declare const paths: import("@fabrika/canvas-kernel/server").CanvasPaths;
|
|
3
|
+
export declare const DATA_DIR: string;
|
|
4
|
+
export declare const SESSIONS_DIR: string;
|
|
5
|
+
export declare const TEMP_DIR: string;
|
|
6
|
+
export declare const PID_FILE: string;
|
|
7
|
+
export declare const COMPILE_TEMP_DIR: string;
|
|
8
|
+
export declare const UPLOADS_DIR: string;
|
|
9
|
+
/** Capability used only by the CLI to resolve secret values */
|
|
10
|
+
export declare const CLI_AUTH_FILE: string;
|
|
11
|
+
/** Review-mode threads, one JSON file per project */
|
|
12
|
+
export declare const REVIEWS_DIR: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RemoteFeedbackEntry, SessionManager } from '@fabrika/canvas-kernel/server';
|
|
2
|
+
export declare function startRemoteFeedbackPoller(sessionManager: SessionManager, broadcastRemoteFeedback: (sessionId: string, revision: number, entries: RemoteFeedbackEntry[]) => void, version: string): {
|
|
3
|
+
stop: () => void;
|
|
4
|
+
};
|