@rwoll/canvas-kit 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +482 -2
- package/cli/canvas-kit.mjs +148 -0
- package/cli/lib.mjs +697 -0
- package/cli/release.json +4 -0
- package/dist/client.d.ts +72 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +156 -0
- package/dist/client.js.map +1 -0
- package/dist/define.d.ts +249 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +197 -0
- package/dist/define.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +39 -0
- package/dist/errors.js.map +1 -0
- package/dist/extension.d.ts +25 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +70 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs.d.ts +56 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +33 -0
- package/dist/jobs.js.map +1 -0
- package/dist/playwright.d.ts +79 -0
- package/dist/playwright.d.ts.map +1 -0
- package/dist/playwright.js +124 -0
- package/dist/playwright.js.map +1 -0
- package/dist/react.d.ts +55 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +72 -0
- package/dist/react.js.map +1 -0
- package/dist/server/headless.d.ts +20 -0
- package/dist/server/headless.d.ts.map +1 -0
- package/dist/server/headless.js +35 -0
- package/dist/server/headless.js.map +1 -0
- package/dist/server/host.d.ts +146 -0
- package/dist/server/host.d.ts.map +1 -0
- package/dist/server/host.js +1078 -0
- package/dist/server/host.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/release.d.ts +30 -0
- package/dist/server/release.d.ts.map +1 -0
- package/dist/server/release.js +71 -0
- package/dist/server/release.js.map +1 -0
- package/dist/server/storage.d.ts +63 -0
- package/dist/server/storage.d.ts.map +1 -0
- package/dist/server/storage.js +253 -0
- package/dist/server/storage.js.map +1 -0
- package/dist/testing.d.ts +49 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +42 -0
- package/dist/testing.js.map +1 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +213 -0
- package/dist/vite.js.map +1 -0
- package/package.json +115 -3
- package/styles.css +122 -0
- package/templates/canvas/README.md +19 -0
- package/templates/canvas/e2e/canvas.spec.ts +15 -0
- package/templates/canvas/index.html +13 -0
- package/templates/canvas/package.json +29 -0
- package/templates/canvas/playwright.config.ts +5 -0
- package/templates/canvas/server/canvas.test.ts +22 -0
- package/templates/canvas/server/canvas.ts +27 -0
- package/templates/canvas/src/App.css +21 -0
- package/templates/canvas/src/App.tsx +31 -0
- package/templates/canvas/src/index.css +3 -0
- package/templates/canvas/src/main.tsx +11 -0
- package/templates/canvas/tsconfig.app.json +1 -0
- package/templates/canvas/tsconfig.json +7 -0
- package/templates/canvas/tsconfig.node.json +1 -0
- package/templates/canvas/vite.config.ts +7 -0
- package/templates/ui/README.md +18 -0
- package/templates/ui/package.json +22 -0
- package/templates/ui/src/Checklist.tsx +42 -0
- package/templates/ui/src/Header.tsx +17 -0
- package/templates/ui/src/Markdown.tsx +140 -0
- package/templates/ui/src/TextButton.tsx +6 -0
- package/templates/ui/src/index.ts +4 -0
- package/templates/ui/theme.css +143 -0
- package/templates/ui/tsconfig.json +18 -0
- package/tsconfig/canvas.json +27 -0
- package/tsconfig/node.json +24 -0
package/cli/release.json
ADDED
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { AnyCanvas, ActionInput, ActionResult, JobInput, JobStatusOf, JobWithInputName, StateOf, UiActionName } from './define.ts';
|
|
2
|
+
import { type Interval, type JobDefinitionInfo, type JobStatus } from './jobs.ts';
|
|
3
|
+
import type { ReleaseInfo } from './server/release.ts';
|
|
4
|
+
export { formatInterval, intervalMs } from './jobs.ts';
|
|
5
|
+
export type { Interval, JobControls, JobDefinitionInfo, JobStatus } from './jobs.ts';
|
|
6
|
+
export type { ReleaseInfo } from './server/release.ts';
|
|
7
|
+
export type ConnectionStatus = 'connecting' | 'live' | 'offline';
|
|
8
|
+
export interface CanvasSnapshot<S> {
|
|
9
|
+
readonly state: S;
|
|
10
|
+
/** The document's jobs, live; empty for a canvas without jobs. */
|
|
11
|
+
readonly jobs: readonly JobStatus[];
|
|
12
|
+
readonly revision: number;
|
|
13
|
+
readonly status: ConnectionStatus;
|
|
14
|
+
readonly error: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface Bootstrap {
|
|
17
|
+
base: string;
|
|
18
|
+
token: string;
|
|
19
|
+
revision: number;
|
|
20
|
+
state: unknown;
|
|
21
|
+
jobs?: JobStatus[];
|
|
22
|
+
jobDefinitions?: JobDefinitionInfo[];
|
|
23
|
+
release?: ReleaseInfo;
|
|
24
|
+
}
|
|
25
|
+
/** Options for a job added from a job with input. */
|
|
26
|
+
export interface AddJobOptions {
|
|
27
|
+
/** Defaults to the job's `every`. */
|
|
28
|
+
every?: Interval;
|
|
29
|
+
/** Add it paused. */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** An action call rejected by the canvas server. */
|
|
33
|
+
export declare class CanvasActionError extends Error {
|
|
34
|
+
readonly code: string;
|
|
35
|
+
constructor(code: string, message: string);
|
|
36
|
+
}
|
|
37
|
+
/** Actions without required input may be called without an input argument. */
|
|
38
|
+
export type InputArgs<C extends AnyCanvas, K extends UiActionName<C>> = Record<string, never> extends ActionInput<C, K> ? [input?: ActionInput<C, K>] : [input: ActionInput<C, K>];
|
|
39
|
+
export type RunAction<C extends AnyCanvas> = <K extends UiActionName<C>>(name: K, ...args: InputArgs<C, K>) => Promise<ActionResult<C, K>>;
|
|
40
|
+
/**
|
|
41
|
+
* Browser connection to the canvas server: live state over server-sent events
|
|
42
|
+
* and action calls over same-origin POST requests.
|
|
43
|
+
*/
|
|
44
|
+
export declare class CanvasClient<C extends AnyCanvas = AnyCanvas> {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(bootstrap?: Bootstrap, options?: {
|
|
47
|
+
fetch?: typeof fetch;
|
|
48
|
+
});
|
|
49
|
+
getSnapshot: () => CanvasSnapshot<StateOf<C>>;
|
|
50
|
+
/** The running build, for canvases that render their own version footer. */
|
|
51
|
+
get release(): ReleaseInfo | undefined;
|
|
52
|
+
subscribe: (listener: () => void) => (() => void);
|
|
53
|
+
/** Stop live updates. */
|
|
54
|
+
close(): void;
|
|
55
|
+
/** The jobs the canvas declares, including those users add jobs from. */
|
|
56
|
+
get jobDefinitions(): readonly JobDefinitionInfo[];
|
|
57
|
+
run: RunAction<C>;
|
|
58
|
+
/** Pause or resume a job, or change its interval, for a job whose `controls` include the UI. */
|
|
59
|
+
updateJob: (id: string, patch: {
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
every?: Interval;
|
|
62
|
+
}) => Promise<JobStatusOf<C>>;
|
|
63
|
+
/** Run a job now, even if it is paused. Fails with `job_failed` when the job throws. */
|
|
64
|
+
runJob: (id: string) => Promise<JobStatusOf<C>>;
|
|
65
|
+
/** Add a job from a job with input. It runs soon, then on its interval. */
|
|
66
|
+
addJob: <K extends JobWithInputName<C>>(job: K, input: JobInput<C, K>, options?: AddJobOptions) => Promise<JobStatusOf<C>>;
|
|
67
|
+
/** Remove a job added from a job with input. */
|
|
68
|
+
removeJob: (id: string) => Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/** The page's shared connection, created from the bootstrap data the server embeds. */
|
|
71
|
+
export declare function getCanvasClient<C extends AnyCanvas>(): CanvasClient<C>;
|
|
72
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.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ACzE,IAAI,cAAc,IAAI,SAAS,iBAAiB,EAAE,CAEjD;IAED,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAA+D;IAEhF,gGAAgG;IAChG,SAAS,GAAI,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;KAAE,KAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CACnB;IAE9E,wFAAwF;IACxF,MAAM,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAmE;IAEjH,2EAA2E;IAC3E,MAAM,GAAI,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,UAAS,aAAkB,KAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CACxC;IAErF,gDAAgD;IAChD,SAAS,GAAU,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE3C;CA4EH;AAID,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,CAGtE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { JOB_ACTIONS } from "./jobs.js";
|
|
2
|
+
export { formatInterval, intervalMs } from "./jobs.js";
|
|
3
|
+
/** An action call rejected by the canvas server. */
|
|
4
|
+
export class CanvasActionError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'CanvasActionError';
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function readBootstrap() {
|
|
13
|
+
const element = document.getElementById('canvas-kit-bootstrap');
|
|
14
|
+
if (!element?.textContent)
|
|
15
|
+
throw new Error('Canvas bootstrap data is missing; open this page through the canvas server.');
|
|
16
|
+
return JSON.parse(element.textContent);
|
|
17
|
+
}
|
|
18
|
+
const delay = (ms) => new Promise(done => setTimeout(done, ms));
|
|
19
|
+
/**
|
|
20
|
+
* Browser connection to the canvas server: live state over server-sent events
|
|
21
|
+
* and action calls over same-origin POST requests.
|
|
22
|
+
*/
|
|
23
|
+
export class CanvasClient {
|
|
24
|
+
#bootstrap;
|
|
25
|
+
#fetch;
|
|
26
|
+
#listeners = new Set();
|
|
27
|
+
#abort = new AbortController();
|
|
28
|
+
#snapshot;
|
|
29
|
+
#started = false;
|
|
30
|
+
constructor(bootstrap = readBootstrap(), options = {}) {
|
|
31
|
+
this.#bootstrap = bootstrap;
|
|
32
|
+
this.#fetch = options.fetch ?? ((input, init) => fetch(input, init));
|
|
33
|
+
this.#snapshot = {
|
|
34
|
+
state: bootstrap.state,
|
|
35
|
+
jobs: bootstrap.jobs ?? [],
|
|
36
|
+
revision: bootstrap.revision,
|
|
37
|
+
status: 'connecting',
|
|
38
|
+
error: undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
getSnapshot = () => this.#snapshot;
|
|
42
|
+
/** The running build, for canvases that render their own version footer. */
|
|
43
|
+
get release() {
|
|
44
|
+
return this.#bootstrap.release;
|
|
45
|
+
}
|
|
46
|
+
subscribe = (listener) => {
|
|
47
|
+
this.#listeners.add(listener);
|
|
48
|
+
if (!this.#started) {
|
|
49
|
+
this.#started = true;
|
|
50
|
+
void this.#connect();
|
|
51
|
+
}
|
|
52
|
+
return () => this.#listeners.delete(listener);
|
|
53
|
+
};
|
|
54
|
+
/** Stop live updates. */
|
|
55
|
+
close() {
|
|
56
|
+
this.#abort.abort();
|
|
57
|
+
}
|
|
58
|
+
/** The jobs the canvas declares, including those users add jobs from. */
|
|
59
|
+
get jobDefinitions() {
|
|
60
|
+
return this.#bootstrap.jobDefinitions ?? [];
|
|
61
|
+
}
|
|
62
|
+
run = (name, ...args) => this.#post(name, args[0] ?? {});
|
|
63
|
+
/** Pause or resume a job, or change its interval, for a job whose `controls` include the UI. */
|
|
64
|
+
updateJob = (id, patch) => this.#post(JOB_ACTIONS.update, { id, ...patch });
|
|
65
|
+
/** Run a job now, even if it is paused. Fails with `job_failed` when the job throws. */
|
|
66
|
+
runJob = (id) => this.#post(JOB_ACTIONS.run, { id });
|
|
67
|
+
/** Add a job from a job with input. It runs soon, then on its interval. */
|
|
68
|
+
addJob = (job, input, options = {}) => this.#post(JOB_ACTIONS.add, { job, input, ...options });
|
|
69
|
+
/** Remove a job added from a job with input. */
|
|
70
|
+
removeJob = async (id) => {
|
|
71
|
+
await this.#post(JOB_ACTIONS.remove, { id });
|
|
72
|
+
};
|
|
73
|
+
async #post(name, input) {
|
|
74
|
+
const response = await this.#fetch(`${this.#bootstrap.base}__canvas/actions/${encodeURIComponent(name)}`, {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
headers: { 'Content-Type': 'application/json', 'X-Canvas-Token': this.#bootstrap.token },
|
|
77
|
+
body: JSON.stringify(input),
|
|
78
|
+
});
|
|
79
|
+
const body = (await response.json().catch(() => undefined));
|
|
80
|
+
if (!response.ok || !body?.ok) {
|
|
81
|
+
const failure = body && !body.ok ? body : undefined;
|
|
82
|
+
throw new CanvasActionError(failure?.code ?? 'request_failed', failure?.message ?? `Request failed with ${response.status}`);
|
|
83
|
+
}
|
|
84
|
+
return body.result;
|
|
85
|
+
}
|
|
86
|
+
#update(patch) {
|
|
87
|
+
this.#snapshot = { ...this.#snapshot, ...patch };
|
|
88
|
+
// Lets tests and tools wait for a live page: html[data-canvas-status="live"].
|
|
89
|
+
if (typeof document !== 'undefined')
|
|
90
|
+
document.documentElement.dataset.canvasStatus = this.#snapshot.status;
|
|
91
|
+
for (const listener of this.#listeners)
|
|
92
|
+
listener();
|
|
93
|
+
}
|
|
94
|
+
async #connect() {
|
|
95
|
+
const signal = this.#abort.signal;
|
|
96
|
+
for (let attempt = 0; !signal.aborted; attempt += 1) {
|
|
97
|
+
try {
|
|
98
|
+
const response = await this.#fetch(`${this.#bootstrap.base}__canvas/events`, {
|
|
99
|
+
headers: { Accept: 'text/event-stream', 'X-Canvas-Token': this.#bootstrap.token },
|
|
100
|
+
cache: 'no-store',
|
|
101
|
+
signal,
|
|
102
|
+
});
|
|
103
|
+
if (response.status === 404 || response.status === 403) {
|
|
104
|
+
this.#update({ status: 'offline', error: 'This canvas was closed. Ask the agent to reopen it.' });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (!response.ok || !response.body)
|
|
108
|
+
throw new Error(`Live updates failed with ${response.status}`);
|
|
109
|
+
attempt = 0;
|
|
110
|
+
await this.#read(response.body);
|
|
111
|
+
throw new Error('Live updates disconnected');
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (signal.aborted)
|
|
115
|
+
return;
|
|
116
|
+
this.#update({ status: 'offline', error: error instanceof Error ? error.message : String(error) });
|
|
117
|
+
}
|
|
118
|
+
await delay(Math.min(10_000, 500 * 2 ** attempt));
|
|
119
|
+
if (signal.aborted)
|
|
120
|
+
return;
|
|
121
|
+
this.#update({ status: 'connecting' });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async #read(body) {
|
|
125
|
+
const reader = body.getReader();
|
|
126
|
+
const decoder = new TextDecoder();
|
|
127
|
+
let buffer = '';
|
|
128
|
+
for (;;) {
|
|
129
|
+
const { done, value } = await reader.read();
|
|
130
|
+
if (done)
|
|
131
|
+
return;
|
|
132
|
+
buffer += decoder.decode(value, { stream: true }).replace(/\r\n?/g, '\n');
|
|
133
|
+
let end;
|
|
134
|
+
while ((end = buffer.indexOf('\n\n')) >= 0) {
|
|
135
|
+
const event = buffer.slice(0, end);
|
|
136
|
+
buffer = buffer.slice(end + 2);
|
|
137
|
+
const data = event
|
|
138
|
+
.split('\n')
|
|
139
|
+
.filter(line => line.startsWith('data:'))
|
|
140
|
+
.map(line => line.slice(5).trimStart())
|
|
141
|
+
.join('\n');
|
|
142
|
+
if (!data)
|
|
143
|
+
continue;
|
|
144
|
+
const snapshot = JSON.parse(data);
|
|
145
|
+
this.#update({ state: snapshot.state, jobs: snapshot.jobs ?? [], revision: snapshot.revision, status: 'live', error: undefined });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
let shared;
|
|
151
|
+
/** The page's shared connection, created from the bootstrap data the server embeds. */
|
|
152
|
+
export function getCanvasClient() {
|
|
153
|
+
shared ??= new CanvasClient();
|
|
154
|
+
return shared;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyD,MAAM,WAAW,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAiCvD,oDAAoD;AACpD,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAWD,SAAS,aAAa;IACpB,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;IAC1H,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAc,CAAC;AACtD,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAExE;;;GAGG;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,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACpI,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,IAAI,MAAgC,CAAC;AAErC,uFAAuF;AACvF,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;IAC9B,OAAO,MAAoC,CAAC;AAC9C,CAAC"}
|
package/dist/define.d.ts
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Interval, type JobAction, type JobControls, type JobStatus } from './jobs.ts';
|
|
3
|
+
export { formatInterval, intervalMs } from './jobs.ts';
|
|
4
|
+
export type { Interval, JobAction, JobControls, JobDefinitionInfo, JobStatus } from './jobs.ts';
|
|
5
|
+
export type LogLevel = 'info' | 'warning' | 'error';
|
|
6
|
+
export type ActionSource = 'agent' | 'ui';
|
|
7
|
+
/** Who may call an action: the agent, the canvas UI, or both (the default). */
|
|
8
|
+
export type ActionExposure = 'both' | 'agent' | 'ui';
|
|
9
|
+
export type JsonSchema = Record<string, unknown>;
|
|
10
|
+
/** A message for the agent in the current session. */
|
|
11
|
+
export interface AgentMessage {
|
|
12
|
+
/** The full prompt the agent receives. */
|
|
13
|
+
prompt: string;
|
|
14
|
+
/** Short text shown in the chat instead of the full prompt. */
|
|
15
|
+
displayPrompt?: string;
|
|
16
|
+
/** `enqueue` (default) waits for the agent's current turn; `immediate` steers it. */
|
|
17
|
+
mode?: 'enqueue' | 'immediate';
|
|
18
|
+
}
|
|
19
|
+
export interface ActionContext<S> {
|
|
20
|
+
readonly canvasId: string;
|
|
21
|
+
readonly instanceId: string;
|
|
22
|
+
readonly source: ActionSource;
|
|
23
|
+
/** The latest state, including changes made earlier in this action. */
|
|
24
|
+
readonly state: S;
|
|
25
|
+
/** Private folder for this canvas's extra files, shared by every session on the machine. */
|
|
26
|
+
readonly dataDir: string;
|
|
27
|
+
/** Validate and apply a new state, then push it to every open view. */
|
|
28
|
+
setState(next: S | ((current: S) => S)): S;
|
|
29
|
+
/** Send a message to the agent. Fails with `agent_unavailable` when there is no session. */
|
|
30
|
+
sendToAgent(message: AgentMessage): Promise<void>;
|
|
31
|
+
log(message: string, level?: LogLevel): void;
|
|
32
|
+
/** The current time in milliseconds. Tests can fix it with the host's `now` option. */
|
|
33
|
+
now(): number;
|
|
34
|
+
}
|
|
35
|
+
/** What a scheduled job gets: the document it runs for, like an action, without an instance. */
|
|
36
|
+
export interface JobContext<S> {
|
|
37
|
+
readonly canvasId: string;
|
|
38
|
+
/** The job's name. */
|
|
39
|
+
readonly job: string;
|
|
40
|
+
/** This job's ID: its name, or the generated ID of a job added from a job with input. */
|
|
41
|
+
readonly id: string;
|
|
42
|
+
/** The document's persist key, or undefined for a canvas without `persist`. */
|
|
43
|
+
readonly key: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* True under `canvas-kit run`, which runs the job with no chat or agent:
|
|
46
|
+
* `sendToAgent` fails with `agent_unavailable`, so skip agent work.
|
|
47
|
+
*/
|
|
48
|
+
readonly headless: boolean;
|
|
49
|
+
/** When this job last ran for this document, in ISO format, or undefined before its first run. */
|
|
50
|
+
readonly lastRunAt: string | undefined;
|
|
51
|
+
readonly state: S;
|
|
52
|
+
readonly dataDir: string;
|
|
53
|
+
setState(next: S | ((current: S) => S)): S;
|
|
54
|
+
sendToAgent(message: AgentMessage): Promise<void>;
|
|
55
|
+
log(message: string, level?: LogLevel): void;
|
|
56
|
+
now(): number;
|
|
57
|
+
}
|
|
58
|
+
export interface JobSpec<S, I extends z.ZodType | undefined = undefined> {
|
|
59
|
+
/**
|
|
60
|
+
* How often to run, at least 1 second apart. For a canvas with `persist`, each
|
|
61
|
+
* document's last run is saved with it, so a job runs once per interval no matter
|
|
62
|
+
* how many chats have the document open, and runs at once when it is overdue.
|
|
63
|
+
* For a job with `input`, this is the default interval of the jobs added from it.
|
|
64
|
+
*/
|
|
65
|
+
every: Interval;
|
|
66
|
+
/** What the job does. The agent reads it, and UIs may show it. */
|
|
67
|
+
description?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Let the canvas UI (`useJobs()`), the agent (the `list_jobs`, `update_job`,
|
|
70
|
+
* `run_job`, `add_job`, and `remove_job` actions), or both pause, resume, retime,
|
|
71
|
+
* and run this job. Omit to leave it to code.
|
|
72
|
+
*/
|
|
73
|
+
controls?: JobControls;
|
|
74
|
+
/** The shortest interval that may be chosen. Defaults to `every`. */
|
|
75
|
+
minEvery?: Interval;
|
|
76
|
+
/** The longest interval that may be chosen. Defaults to 30 days, or `every` when longer. */
|
|
77
|
+
maxEvery?: Interval;
|
|
78
|
+
/**
|
|
79
|
+
* Zod schema for the input of jobs added from this one. With `input`, the job does
|
|
80
|
+
* not run on its own: the UI or the agent adds jobs from it, each with its own
|
|
81
|
+
* input, interval, and run history. Needs `controls`.
|
|
82
|
+
*/
|
|
83
|
+
input?: I;
|
|
84
|
+
/** For a job with `input`, how many jobs may be added from it per document. Defaults to 20. */
|
|
85
|
+
maxJobs?: number;
|
|
86
|
+
run(ctx: JobContext<S>, input: I extends z.ZodType ? z.output<I> : undefined): void | Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export type JobMap<S> = Record<string, JobSpec<S, any>>;
|
|
89
|
+
export interface JobHelpers<S> {
|
|
90
|
+
/** Declare a scheduled job with typed state and input. */
|
|
91
|
+
job<I extends z.ZodType | undefined = undefined>(spec: JobSpec<S, I>): NoInfer<JobSpec<S, I>>;
|
|
92
|
+
}
|
|
93
|
+
declare const emptyInput: z.ZodObject<{}, z.core.$strict>;
|
|
94
|
+
export type EmptyInput = typeof emptyInput;
|
|
95
|
+
export interface ActionSpec<S, I extends z.ZodType = EmptyInput, R = unknown, E extends ActionExposure = 'both'> {
|
|
96
|
+
description: string;
|
|
97
|
+
/** Zod schema for the input. Omit for actions without input. */
|
|
98
|
+
input?: I;
|
|
99
|
+
expose?: E;
|
|
100
|
+
run(ctx: ActionContext<S>, input: z.output<I>): R | Promise<R>;
|
|
101
|
+
}
|
|
102
|
+
export type ActionMap<S> = Record<string, ActionSpec<S, any, any, ActionExposure>>;
|
|
103
|
+
export interface ActionHelpers<S> {
|
|
104
|
+
/** Declare an action with typed input and state. */
|
|
105
|
+
action<I extends z.ZodType = EmptyInput, R = unknown, E extends ActionExposure = 'both'>(spec: ActionSpec<S, I, R, E>): NoInfer<ActionSpec<S, I, R, E>>;
|
|
106
|
+
}
|
|
107
|
+
export interface OpenContext<I> {
|
|
108
|
+
readonly instanceId: string;
|
|
109
|
+
readonly input: I;
|
|
110
|
+
}
|
|
111
|
+
export interface ReopenContext<S, I> extends OpenContext<I> {
|
|
112
|
+
readonly state: S;
|
|
113
|
+
}
|
|
114
|
+
export interface PersistOptions<I> {
|
|
115
|
+
/**
|
|
116
|
+
* Stable domain identity for the saved state, such as a file path or record ID.
|
|
117
|
+
* Every instance that returns the same key shares one document, in this chat and
|
|
118
|
+
* in other chats: changes apply one at a time under a lock, each change starts
|
|
119
|
+
* from the latest saved state, and open pages update live. Reopening an instance
|
|
120
|
+
* with input that maps to a different key switches it to that document.
|
|
121
|
+
*/
|
|
122
|
+
key(ctx: OpenContext<I>): string;
|
|
123
|
+
/** Increment when the saved state shape changes incompatibly. */
|
|
124
|
+
version?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface CanvasSpec<SS extends z.ZodType, IS extends z.ZodType, A extends ActionMap<z.output<SS>>, J extends JobMap<z.output<SS>> = Record<never, never>> {
|
|
127
|
+
/** Stable kebab-case canvas ID. Qualify generic names, for example `octo-release-board`. */
|
|
128
|
+
id: string;
|
|
129
|
+
/** Short display name, also used as the panel title. */
|
|
130
|
+
title: string;
|
|
131
|
+
/** Single-sentence description shown to the agent. */
|
|
132
|
+
description: string;
|
|
133
|
+
/** Zod schema for the instance state shared with the UI. */
|
|
134
|
+
state: SS;
|
|
135
|
+
/** Zod schema for the `open_canvas` input. Omit when the canvas takes no input. */
|
|
136
|
+
input?: IS;
|
|
137
|
+
/** Create the initial state for a new instance. */
|
|
138
|
+
init(ctx: OpenContext<z.output<IS>>): z.input<SS> | Promise<z.input<SS>>;
|
|
139
|
+
/** Update the state when an existing instance is opened again. Return nothing to keep it. */
|
|
140
|
+
reopen?(ctx: ReopenContext<z.output<SS>, z.output<IS>>): z.input<SS> | void | Promise<z.input<SS> | void>;
|
|
141
|
+
/** Optional status text returned to the host when the canvas opens. */
|
|
142
|
+
status?(state: z.output<SS>): string | undefined;
|
|
143
|
+
/** Save state privately under `<copilot-home>/extension-data/<id>/`. */
|
|
144
|
+
persist?: PersistOptions<z.output<IS>>;
|
|
145
|
+
/** Show the plugin version and publish time in a page footer. Defaults to true. */
|
|
146
|
+
versionFooter?: boolean;
|
|
147
|
+
/** Extra Content-Security-Policy sources for this canvas's pages. Other canvases keep the defaults. */
|
|
148
|
+
csp?: CanvasCsp;
|
|
149
|
+
actions?(helpers: ActionHelpers<z.output<SS>>): A;
|
|
150
|
+
/**
|
|
151
|
+
* Scheduled jobs. They run for each open document while a chat has the canvas
|
|
152
|
+
* open, and `canvas-kit run <job>` runs them for saved documents with no chat open.
|
|
153
|
+
*/
|
|
154
|
+
jobs?(helpers: JobHelpers<z.output<SS>>): J;
|
|
155
|
+
}
|
|
156
|
+
export interface CanvasCsp {
|
|
157
|
+
/**
|
|
158
|
+
* Sources added to `connect-src` after `'self'`, for example `ws://127.0.0.1:*`
|
|
159
|
+
* to open WebSockets to local services. Each entry must be a
|
|
160
|
+
* `scheme://host[:port]` source with an `http`, `https`, `ws`, or `wss` scheme.
|
|
161
|
+
*/
|
|
162
|
+
connectSrc?: readonly string[];
|
|
163
|
+
}
|
|
164
|
+
export interface CompiledAction {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly description: string;
|
|
167
|
+
readonly expose: ActionExposure;
|
|
168
|
+
readonly input: z.ZodType;
|
|
169
|
+
readonly inputJsonSchema: JsonSchema;
|
|
170
|
+
/** Set on the built-in job actions, which the host runs itself. */
|
|
171
|
+
readonly jobAction?: JobAction;
|
|
172
|
+
run(ctx: ActionContext<unknown>, input: unknown): unknown;
|
|
173
|
+
}
|
|
174
|
+
export interface CompiledJob {
|
|
175
|
+
readonly name: string;
|
|
176
|
+
readonly description: string | undefined;
|
|
177
|
+
readonly everyMs: number;
|
|
178
|
+
readonly minEveryMs: number;
|
|
179
|
+
readonly maxEveryMs: number;
|
|
180
|
+
readonly controls: JobControls | undefined;
|
|
181
|
+
/** Input schema of a job that other jobs are added from. */
|
|
182
|
+
readonly input: z.ZodType | undefined;
|
|
183
|
+
readonly maxJobs: number;
|
|
184
|
+
run(ctx: JobContext<unknown>, input: unknown): void | Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
export interface CanvasDefinition<SS extends z.ZodType = z.ZodType, IS extends z.ZodType = z.ZodType, A extends ActionMap<any> = ActionMap<any>, J extends JobMap<any> = JobMap<any>> {
|
|
187
|
+
readonly kind: 'canvas-kit/canvas';
|
|
188
|
+
readonly id: string;
|
|
189
|
+
readonly title: string;
|
|
190
|
+
readonly description: string;
|
|
191
|
+
readonly state: SS;
|
|
192
|
+
readonly input: IS | undefined;
|
|
193
|
+
readonly inputJsonSchema: JsonSchema | undefined;
|
|
194
|
+
readonly versionFooter: boolean;
|
|
195
|
+
readonly csp: {
|
|
196
|
+
readonly connectSrc: readonly string[];
|
|
197
|
+
};
|
|
198
|
+
readonly actions: ReadonlyMap<string, CompiledAction>;
|
|
199
|
+
readonly jobs: ReadonlyMap<string, CompiledJob>;
|
|
200
|
+
readonly persist: {
|
|
201
|
+
key(ctx: OpenContext<unknown>): string;
|
|
202
|
+
version: number;
|
|
203
|
+
} | undefined;
|
|
204
|
+
init(ctx: OpenContext<unknown>): unknown;
|
|
205
|
+
reopen(ctx: ReopenContext<unknown, unknown>): unknown;
|
|
206
|
+
status(state: unknown): string | undefined;
|
|
207
|
+
/** Type-only marker for the declared actions. */
|
|
208
|
+
readonly __actions?: A;
|
|
209
|
+
/** Type-only marker for the declared jobs. */
|
|
210
|
+
readonly __jobs?: J;
|
|
211
|
+
}
|
|
212
|
+
export type AnyCanvas = CanvasDefinition<any, any, any, any>;
|
|
213
|
+
export type StateOf<C extends AnyCanvas> = C extends CanvasDefinition<infer SS> ? z.output<SS> : never;
|
|
214
|
+
export type ActionsOf<C extends AnyCanvas> = C extends CanvasDefinition<z.ZodType, z.ZodType, infer A> ? A : never;
|
|
215
|
+
export type JobsOf<C extends AnyCanvas> = C extends CanvasDefinition<any, any, any, infer J> ? J : never;
|
|
216
|
+
/** Names of a canvas's scheduled jobs. */
|
|
217
|
+
export type JobName<C extends AnyCanvas> = Extract<keyof JobsOf<C>, string>;
|
|
218
|
+
type InputOfJob<T> = T extends JobSpec<any, infer I> ? I : never;
|
|
219
|
+
/** Names of jobs with `input`, which users add jobs from. */
|
|
220
|
+
export type JobWithInputName<C extends AnyCanvas> = {
|
|
221
|
+
[K in JobName<C>]: InputOfJob<JobsOf<C>[K]> extends z.ZodType ? K : never;
|
|
222
|
+
}[JobName<C>];
|
|
223
|
+
/** The input of jobs added from job `K`. */
|
|
224
|
+
export type JobInput<C extends AnyCanvas, K extends JobName<C>> = InputOfJob<JobsOf<C>[K]> extends infer I extends z.ZodType ? z.input<I> : undefined;
|
|
225
|
+
/** A job's status, typed by the canvas's jobs. */
|
|
226
|
+
export type JobStatusOf<C extends AnyCanvas> = {
|
|
227
|
+
[K in JobName<C>]: JobStatus<K, JobInput<C, K>>;
|
|
228
|
+
}[JobName<C>];
|
|
229
|
+
type AnyAction<I extends z.ZodType = any, R = any, E extends ActionExposure = any> = ActionSpec<any, I, R, E>;
|
|
230
|
+
type ExposedTo<A, Who extends ActionExposure> = {
|
|
231
|
+
[K in keyof A]: A[K] extends AnyAction<z.ZodType, unknown, infer E> ? (E extends 'both' | Who ? K : never) : never;
|
|
232
|
+
}[keyof A];
|
|
233
|
+
/** Names of actions the canvas UI may call. */
|
|
234
|
+
export type UiActionName<C extends AnyCanvas> = Extract<ExposedTo<ActionsOf<C>, 'ui'>, string>;
|
|
235
|
+
export type ActionInput<C extends AnyCanvas, K extends keyof ActionsOf<C>> = ActionsOf<C>[K] extends AnyAction<infer I> ? z.input<I> : never;
|
|
236
|
+
export type ActionResult<C extends AnyCanvas, K extends keyof ActionsOf<C>> = ActionsOf<C>[K] extends AnyAction<z.ZodType, infer R> ? Awaited<R> : never;
|
|
237
|
+
/**
|
|
238
|
+
* The job a job ID belongs to: a declared job's name, or `<name>-<hex>` for a job
|
|
239
|
+
* added from a job with input. Throws `not_found` with the canvas's job names.
|
|
240
|
+
*/
|
|
241
|
+
export declare function jobForId(canvas: AnyCanvas, id: string): CompiledJob;
|
|
242
|
+
export declare function toJsonSchema(schema: z.ZodType): JsonSchema;
|
|
243
|
+
export declare function parseWith<T extends z.ZodType>(schema: T, value: unknown, label: string): Promise<z.output<T>>;
|
|
244
|
+
/**
|
|
245
|
+
* Declare a canvas: its state, open input, and actions. The kit supplies the
|
|
246
|
+
* HTTP server, live state sync, persistence, and Copilot SDK registration.
|
|
247
|
+
*/
|
|
248
|
+
export declare function defineCanvas<SS extends z.ZodType, IS extends z.ZodType = z.ZodUndefined, A extends ActionMap<z.output<SS>> = Record<never, never>, J extends JobMap<z.output<SS>> = Record<never, never>>(spec: CanvasSpec<SS, IS, A, J>): CanvasDefinition<SS, IS, A, J>;
|
|
249
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA6C,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvI,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,W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