@dexhq/canvas 0.14.0 → 0.15.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/CHANGELOG.md +36 -0
- package/README.md +5 -3
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +9 -9
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +88 -8
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +88 -8
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/glyphs.tsx +4 -0
- package/app/main.tsx +3 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/config/project-files.d.mts +6 -0
- package/dist/config/project-files.mjs +14 -2
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -62
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paste/paste.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +13 -24
- package/dist/server/channel.mjs +55 -37
- package/dist/server/claimed-presence.d.mts +3 -2
- package/dist/server/claimed-presence.mjs +15 -7
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +27 -13
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +33 -48
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +17 -3
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +2 -2
- package/dist/server/web-app.mjs +4 -7
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +67 -17
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +19 -3
- package/dist/setup/detect.d.mts +0 -2
- package/dist/setup/detect.mjs +1 -3
- package/dist/setup/doctor.mjs +1 -1
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/project.d.mts +6 -1
- package/dist/setup/project.mjs +9 -9
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +7 -1
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +1 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +2 -2
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/hook.ts +4 -1
- package/src/config/project-files.ts +21 -6
- package/src/config/renamed.ts +0 -3
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -241
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/channel.ts +94 -52
- package/src/server/claimed-presence.ts +26 -10
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +36 -15
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +26 -2
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/web-app.ts +11 -9
- package/src/setup/create.ts +91 -17
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +23 -2
- package/src/setup/detect.ts +0 -4
- package/src/setup/project.ts +9 -8
- package/src/setup/starters.ts +8 -1
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +2 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
|
@@ -76,4 +76,12 @@ export interface SendOptions {
|
|
|
76
76
|
}
|
|
77
77
|
/** Send feedback to the relay, if it is ready; never throws. */
|
|
78
78
|
export declare const sendFeedback: (feedback: Feedback, { fetch, url }?: SendOptions) => Promise<Sent>;
|
|
79
|
+
/**
|
|
80
|
+
* Post a form to a relay and read its answer: the tracker's id, or why not.
|
|
81
|
+
* A form, so a simple request with no preflight; sign-ups travel this way
|
|
82
|
+
* too (signup.ts). Never throws.
|
|
83
|
+
*/
|
|
84
|
+
export declare const postToRelay: (url: string, form: FormData, fetch: NonNullable<SendOptions["fetch"]>) => Promise<Exclude<Sent, {
|
|
85
|
+
reason: "invalid";
|
|
86
|
+
}>>;
|
|
79
87
|
//#endregion
|
package/dist/shared/feedback.mjs
CHANGED
|
@@ -154,10 +154,18 @@ const sendFeedback = async (feedback, { fetch = globalThis.fetch, url = FEEDBACK
|
|
|
154
154
|
reason: "invalid",
|
|
155
155
|
problems
|
|
156
156
|
};
|
|
157
|
+
return await postToRelay(url, toForm(feedback), fetch);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Post a form to a relay and read its answer: the tracker's id, or why not.
|
|
161
|
+
* A form, so a simple request with no preflight; sign-ups travel this way
|
|
162
|
+
* too (signup.ts). Never throws.
|
|
163
|
+
*/
|
|
164
|
+
const postToRelay = async (url, form, fetch) => {
|
|
157
165
|
try {
|
|
158
166
|
const response = await fetch(url, {
|
|
159
167
|
method: "POST",
|
|
160
|
-
body:
|
|
168
|
+
body: form
|
|
161
169
|
});
|
|
162
170
|
if (response.ok) {
|
|
163
171
|
const { id } = await response.json();
|
|
@@ -189,4 +197,4 @@ const sendFeedback = async (feedback, { fetch = globalThis.fetch, url = FEEDBACK
|
|
|
189
197
|
}
|
|
190
198
|
};
|
|
191
199
|
//#endregion
|
|
192
|
-
export { FEEDBACK_ACCEPT, FEEDBACK_KINDS, FEEDBACK_LIMITS, FEEDBACK_SOURCES, FEEDBACK_URL, checkFeedback, feedbackFileType, feedbackTypeOfName, isFeedbackFile, receiveFeedback, sendFeedback };
|
|
200
|
+
export { FEEDBACK_ACCEPT, FEEDBACK_KINDS, FEEDBACK_LIMITS, FEEDBACK_SOURCES, FEEDBACK_URL, checkFeedback, feedbackFileType, feedbackTypeOfName, isFeedbackFile, postToRelay, receiveFeedback, sendFeedback };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReviewFile } from "./review-file.mjs";
|
|
1
2
|
//#region src/shared/page-review.d.ts
|
|
2
3
|
/** A spot, in pixels. */
|
|
3
4
|
interface Point {
|
|
@@ -51,7 +52,7 @@ export interface ReviewPage {
|
|
|
51
52
|
viewport: Size;
|
|
52
53
|
}
|
|
53
54
|
/** A Markup review, checked. */
|
|
54
|
-
export interface PageReviewFile {
|
|
55
|
+
export interface PageReviewFile extends Pick<ReviewFile, "review" | "reviewer"> {
|
|
55
56
|
/** The app it is of: its origin, unless its config names it. */
|
|
56
57
|
app: string;
|
|
57
58
|
/** The outline's tasks, in its order. */
|
|
@@ -62,16 +63,6 @@ export interface PageReviewFile {
|
|
|
62
63
|
}[];
|
|
63
64
|
};
|
|
64
65
|
pages: ReviewPage[];
|
|
65
|
-
review: {
|
|
66
|
-
completed?: string;
|
|
67
|
-
created?: string;
|
|
68
|
-
id: string;
|
|
69
|
-
title: string;
|
|
70
|
-
};
|
|
71
|
-
reviewer: {
|
|
72
|
-
key: string;
|
|
73
|
-
name: string;
|
|
74
|
-
};
|
|
75
66
|
threads: PageComment[];
|
|
76
67
|
}
|
|
77
68
|
export type PageReviewAnswer = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isRecord, isText } from "./checks.mjs";
|
|
2
2
|
import { THREAD_ID_RE } from "./threads-core.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { isReviewFormat, reviewHeader } from "./review-file.mjs";
|
|
4
4
|
import { unzip } from "./unzip.mjs";
|
|
5
5
|
//#region src/shared/page-review.ts
|
|
6
6
|
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
@@ -76,8 +76,8 @@ const outlineOf = (value) => {
|
|
|
76
76
|
function parsePageReview(value) {
|
|
77
77
|
if (!(isRecord(value) && isRecord(value.review) && isRecord(value.reviewer))) return { problem: "unreadable" };
|
|
78
78
|
if (value.version !== 1) return { problem: "newer" };
|
|
79
|
-
const
|
|
80
|
-
if (!(
|
|
79
|
+
const header = reviewHeader(value.review, value.reviewer);
|
|
80
|
+
if (!(header && isText(value.app))) return { problem: "unreadable" };
|
|
81
81
|
const listed = Array.isArray(value.threads) ? value.threads : [];
|
|
82
82
|
const threads = listed.flatMap((each) => commentOf(each) ?? []);
|
|
83
83
|
if (threads.length < listed.length) return { problem: "unreadable" };
|
|
@@ -85,16 +85,7 @@ function parsePageReview(value) {
|
|
|
85
85
|
const outline = outlineOf(value.outline);
|
|
86
86
|
return { review: {
|
|
87
87
|
app: value.app,
|
|
88
|
-
|
|
89
|
-
id: review.id,
|
|
90
|
-
title: isText(review.title) ? review.title.trim() : "",
|
|
91
|
-
...isText(review.created) ? { created: review.created } : {},
|
|
92
|
-
...isText(review.completed) ? { completed: review.completed } : {}
|
|
93
|
-
},
|
|
94
|
-
reviewer: {
|
|
95
|
-
key: reviewer.key,
|
|
96
|
-
name: isText(reviewer.name) ? reviewer.name.trim() : GUEST_NAME
|
|
97
|
-
},
|
|
88
|
+
...header,
|
|
98
89
|
...outline ? { outline } : {},
|
|
99
90
|
threads,
|
|
100
91
|
pages
|
|
@@ -13,8 +13,19 @@ export interface PresenceEntry extends PresenceTarget {
|
|
|
13
13
|
/** When it was last marked, as an ISO date. */
|
|
14
14
|
updated: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The session a Claude Code sub-agent's marks are under: its agent's
|
|
18
|
+
* session, then its own id, so each sub-agent shows on its own.
|
|
19
|
+
*/
|
|
20
|
+
export declare const workerSession: (session: string, agentId: string) => string;
|
|
21
|
+
/** Whether marks under session `marked` are `session`'s own or its sub-agents'. */
|
|
22
|
+
export declare const underSession: (marked: string, session: string) => boolean;
|
|
16
23
|
/** How long an entry lasts after it was last marked. */
|
|
17
24
|
export declare const PRESENCE_TTL_MS = 120000;
|
|
25
|
+
/** When an entry ends, unless it is marked again first: as an epoch time. */
|
|
26
|
+
export declare const endsAt: (entry: {
|
|
27
|
+
updated: string;
|
|
28
|
+
}) => number;
|
|
18
29
|
/** The entries that have not expired at `now`. */
|
|
19
30
|
export declare const freshPresence: <Entry extends {
|
|
20
31
|
updated: string;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
//#region src/shared/presence-core.ts
|
|
2
|
+
/**
|
|
3
|
+
* The session a Claude Code sub-agent's marks are under: its agent's
|
|
4
|
+
* session, then its own id, so each sub-agent shows on its own.
|
|
5
|
+
*/
|
|
6
|
+
const workerSession = (session, agentId) => `${session}/${agentId}`;
|
|
7
|
+
/** Whether marks under session `marked` are `session`'s own or its sub-agents'. */
|
|
8
|
+
const underSession = (marked, session) => marked === session || marked.startsWith(`${session}/`);
|
|
2
9
|
/** How long an entry lasts after it was last marked. */
|
|
3
10
|
const PRESENCE_TTL_MS = 12e4;
|
|
11
|
+
/** When an entry ends, unless it is marked again first: as an epoch time. */
|
|
12
|
+
const endsAt = (entry) => Date.parse(entry.updated) + PRESENCE_TTL_MS;
|
|
4
13
|
/** The entries that have not expired at `now`. */
|
|
5
|
-
const freshPresence = (entries, now) => entries.filter((entry) => now
|
|
14
|
+
const freshPresence = (entries, now) => entries.filter((entry) => now < endsAt(entry));
|
|
6
15
|
//#endregion
|
|
7
|
-
export { PRESENCE_TTL_MS, freshPresence };
|
|
16
|
+
export { PRESENCE_TTL_MS, endsAt, freshPresence, underSession, workerSession };
|
|
@@ -57,6 +57,11 @@ export interface ReviewImport {
|
|
|
57
57
|
added: number;
|
|
58
58
|
skipped: number;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Who reviewed and which review, as a review file and a Markup review both
|
|
62
|
+
* keep them; undefined without the review's id and the reviewer's key.
|
|
63
|
+
*/
|
|
64
|
+
export declare const reviewHeader: (review: Record<string, unknown>, reviewer: Record<string, unknown>) => Pick<ReviewFile, "review" | "reviewer"> | undefined;
|
|
60
65
|
/** A file's review, checked, or why it cannot be imported. */
|
|
61
66
|
export declare function parseReviewFile(value: unknown): ReviewFileAnswer;
|
|
62
67
|
/**
|
|
@@ -30,17 +30,13 @@ const commentOf = (value) => {
|
|
|
30
30
|
}))
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!(isText(review.id) && isText(reviewer.key))) return
|
|
39
|
-
|
|
40
|
-
const read = threads.filter((thread) => thread !== void 0);
|
|
41
|
-
if (read.length < threads.length) return { problem: "unreadable" };
|
|
42
|
-
return { review: {
|
|
43
|
-
...isText(value.prototype) ? { prototype: value.prototype } : {},
|
|
33
|
+
/**
|
|
34
|
+
* Who reviewed and which review, as a review file and a Markup review both
|
|
35
|
+
* keep them; undefined without the review's id and the reviewer's key.
|
|
36
|
+
*/
|
|
37
|
+
const reviewHeader = (review, reviewer) => {
|
|
38
|
+
if (!(isText(review.id) && isText(reviewer.key))) return;
|
|
39
|
+
return {
|
|
44
40
|
review: {
|
|
45
41
|
id: review.id,
|
|
46
42
|
title: isText(review.title) ? review.title.trim() : "",
|
|
@@ -50,7 +46,21 @@ function parseReviewFile(value) {
|
|
|
50
46
|
reviewer: {
|
|
51
47
|
key: reviewer.key,
|
|
52
48
|
name: isText(reviewer.name) ? reviewer.name.trim() : GUEST_NAME
|
|
53
|
-
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/** A file's review, checked, or why it cannot be imported. */
|
|
53
|
+
function parseReviewFile(value) {
|
|
54
|
+
if (!(isRecord(value) && isReviewFormat(value.format) && isRecord(value.review) && isRecord(value.reviewer))) return { problem: "not-a-review" };
|
|
55
|
+
if (value.version !== 1) return { problem: "newer" };
|
|
56
|
+
const header = reviewHeader(value.review, value.reviewer);
|
|
57
|
+
if (!header) return { problem: "not-a-review" };
|
|
58
|
+
const threads = (Array.isArray(value.threads) ? value.threads : []).map(commentOf);
|
|
59
|
+
const read = threads.filter((thread) => thread !== void 0);
|
|
60
|
+
if (read.length < threads.length) return { problem: "unreadable" };
|
|
61
|
+
return { review: {
|
|
62
|
+
...isText(value.prototype) ? { prototype: value.prototype } : {},
|
|
63
|
+
...header,
|
|
54
64
|
threads: read
|
|
55
65
|
} };
|
|
56
66
|
}
|
|
@@ -94,4 +104,4 @@ const isReviewIn = (threads, file) => {
|
|
|
94
104
|
return added.length === 0 && edited.length === 0;
|
|
95
105
|
};
|
|
96
106
|
//#endregion
|
|
97
|
-
export { GUEST_NAME, OLD_REVIEW_FORMAT, REVIEW_FORMAT, REVIEW_VERSION, isReviewFormat, isReviewIn, parseReviewFile, reviewFor, reviewNews };
|
|
107
|
+
export { GUEST_NAME, OLD_REVIEW_FORMAT, REVIEW_FORMAT, REVIEW_VERSION, isReviewFormat, isReviewIn, parseReviewFile, reviewFor, reviewHeader, reviewNews };
|
|
@@ -27,7 +27,7 @@ const FAILURE_CAUSES = [
|
|
|
27
27
|
cause: "Its packages aren't installed in {project}. Install them, then try again."
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
pattern: "EADDRINUSE",
|
|
30
|
+
pattern: "EADDRINUSE|Port [0-9]+ is in use",
|
|
31
31
|
cause: "Another program is using its port. Close it, then try again."
|
|
32
32
|
},
|
|
33
33
|
{
|
package/dist/shared/signup.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SendOptions } from "./feedback.mjs";
|
|
1
2
|
//#region src/shared/signup.d.ts
|
|
2
3
|
/** Where sign-ups go: the relay on Dex's site. */
|
|
3
4
|
export declare const SIGNUP_URL = "https://sudio-site.vercel.app/api/signup";
|
|
@@ -33,10 +34,6 @@ export type SignupSent = {
|
|
|
33
34
|
ok: false;
|
|
34
35
|
reason: "invalid" | "limited" | "unavailable" | "failed";
|
|
35
36
|
};
|
|
36
|
-
export interface SignupSendOptions {
|
|
37
|
-
fetch?: (url: string, init: RequestInit) => Promise<Response>;
|
|
38
|
-
url?: string;
|
|
39
|
-
}
|
|
40
37
|
/** Send a sign-up to the relay, if it is ready; never throws. */
|
|
41
|
-
export declare const sendSignup: (signup: Signup, { fetch, url }?:
|
|
38
|
+
export declare const sendSignup: (signup: Signup, { fetch, url }?: SendOptions) => Promise<SignupSent>;
|
|
42
39
|
//#endregion
|
package/dist/shared/signup.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { postToRelay } from "./feedback.mjs";
|
|
1
2
|
//#region src/shared/signup.ts
|
|
2
3
|
/** Where sign-ups go: the relay on Dex's site. */
|
|
3
4
|
const SIGNUP_URL = "https://sudio-site.vercel.app/api/signup";
|
|
@@ -48,8 +49,6 @@ const receiveSignup = (form) => {
|
|
|
48
49
|
signup
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
|
-
const TOO_MANY_REQUESTS = 429;
|
|
52
|
-
const SERVICE_UNAVAILABLE = 503;
|
|
53
52
|
/** Send a sign-up to the relay, if it is ready; never throws. */
|
|
54
53
|
const sendSignup = async (signup, { fetch = globalThis.fetch, url = SIGNUP_URL } = {}) => {
|
|
55
54
|
if (checkSignup(signup).length > 0) return {
|
|
@@ -59,39 +58,7 @@ const sendSignup = async (signup, { fetch = globalThis.fetch, url = SIGNUP_URL }
|
|
|
59
58
|
const form = new FormData();
|
|
60
59
|
form.set("name", signup.name.trim());
|
|
61
60
|
form.set("email", signup.email.trim());
|
|
62
|
-
|
|
63
|
-
const response = await fetch(url, {
|
|
64
|
-
method: "POST",
|
|
65
|
-
body: form
|
|
66
|
-
});
|
|
67
|
-
if (response.ok) {
|
|
68
|
-
const { id } = await response.json();
|
|
69
|
-
return typeof id === "string" && id ? {
|
|
70
|
-
ok: true,
|
|
71
|
-
id
|
|
72
|
-
} : {
|
|
73
|
-
ok: false,
|
|
74
|
-
reason: "failed"
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (response.status === TOO_MANY_REQUESTS) return {
|
|
78
|
-
ok: false,
|
|
79
|
-
reason: "limited"
|
|
80
|
-
};
|
|
81
|
-
if (response.status === SERVICE_UNAVAILABLE) return {
|
|
82
|
-
ok: false,
|
|
83
|
-
reason: "unavailable"
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
ok: false,
|
|
87
|
-
reason: "failed"
|
|
88
|
-
};
|
|
89
|
-
} catch {
|
|
90
|
-
return {
|
|
91
|
-
ok: false,
|
|
92
|
-
reason: "failed"
|
|
93
|
-
};
|
|
94
|
-
}
|
|
61
|
+
return await postToRelay(url, form, fetch);
|
|
95
62
|
};
|
|
96
63
|
//#endregion
|
|
97
64
|
export { SIGNUP_LIMITS, SIGNUP_URL, checkSignup, receiveSignup, sendSignup };
|
|
@@ -33,12 +33,6 @@ export interface ConnectedAgent {
|
|
|
33
33
|
*/
|
|
34
34
|
watching?: boolean;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* How an agent comes by new feedback: pushed to it as it is left, pushed
|
|
38
|
-
* with nothing yet to say it arrives, or only when it is asked or watches.
|
|
39
|
-
*/
|
|
40
|
-
export type Hearing = "pushed" | "unproven" | "asked";
|
|
41
|
-
export declare const hearingOf: (agent: ConnectedAgent) => Hearing;
|
|
42
36
|
export type StudioEvent = {
|
|
43
37
|
type: "presence";
|
|
44
38
|
presence: PresenceEntry[];
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { UNSEEN_PARTS, splitPrototypePath } from "./prototypes-core.mjs";
|
|
2
2
|
import { classify } from "./studio-files.mjs";
|
|
3
3
|
//#region src/shared/studio-events.ts
|
|
4
|
-
const hearingOf = (agent) => {
|
|
5
|
-
if (agent.channel) return "pushed";
|
|
6
|
-
return agent.unproven ? "unproven" : "asked";
|
|
7
|
-
};
|
|
8
4
|
/** Each event, made from what it carries. */
|
|
9
5
|
const studioEvent = {
|
|
10
6
|
presence: (presence) => ({
|
|
@@ -92,4 +88,4 @@ function eventsForFile(file) {
|
|
|
92
88
|
return [];
|
|
93
89
|
}
|
|
94
90
|
//#endregion
|
|
95
|
-
export { STUDIO_EVENT_TYPES, eventMessage, eventsForFile, handleStudioEvent,
|
|
91
|
+
export { STUDIO_EVENT_TYPES, eventMessage, eventsForFile, handleStudioEvent, studioEvent };
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
//#region src/shared/studio-files.d.ts
|
|
2
|
+
export declare const DISCIPLINES: readonly ["product", "brand", "engineering"];
|
|
3
|
+
export type Discipline = (typeof DISCIPLINES)[number];
|
|
4
|
+
/** A person who makes prototypes, from contributors.json. */
|
|
5
|
+
export interface Contributor {
|
|
6
|
+
discipline: Discipline;
|
|
7
|
+
/** Git user names that identify this person, so the agent knows who it is working for. */
|
|
8
|
+
git: string[];
|
|
9
|
+
/** Their GitHub username, for their avatar. */
|
|
10
|
+
github?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
slug: string;
|
|
13
|
+
}
|
|
2
14
|
/** Where each of the studio's own files is, relative to its content root. */
|
|
3
15
|
export declare const STUDIO_FILES: {
|
|
4
16
|
/** Who works in the studio, and the git users that are them. */
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PROTOTYPES_FOLDER, isSlug, splitPrototypePath } from "./prototypes-core.mjs";
|
|
2
2
|
//#region src/shared/studio-files.ts
|
|
3
|
+
const DISCIPLINES = [
|
|
4
|
+
"product",
|
|
5
|
+
"brand",
|
|
6
|
+
"engineering"
|
|
7
|
+
];
|
|
3
8
|
/** Where each of the studio's own files is, relative to its content root. */
|
|
4
9
|
const STUDIO_FILES = {
|
|
5
10
|
/** Who works in the studio, and the git users that are them. */
|
|
@@ -55,4 +60,4 @@ function classify(file) {
|
|
|
55
60
|
return "other";
|
|
56
61
|
}
|
|
57
62
|
//#endregion
|
|
58
|
-
export { STUDIO_FILES, classify, guidelinesPerson, isEditableMarkdown, isInstructionsFile, personGuidelinesPath };
|
|
63
|
+
export { DISCIPLINES, STUDIO_FILES, classify, guidelinesPerson, isEditableMarkdown, isInstructionsFile, personGuidelinesPath };
|
|
@@ -7,6 +7,7 @@ import { PasteSource } from "./snapshot-clipboard.mjs";
|
|
|
7
7
|
import { Devices } from "./devices.mjs";
|
|
8
8
|
import { AvatarFile } from "./avatar-file.mjs";
|
|
9
9
|
import { BuildSettings } from "./build-settings.mjs";
|
|
10
|
+
import { CommentAnswers, CommentBodies } from "./comments/routes.mjs";
|
|
10
11
|
import { RemovedView } from "./removed-views-core.mjs";
|
|
11
12
|
import { ReviewImport } from "./review-file.mjs";
|
|
12
13
|
import { ConnectedAgent } from "./studio-events.mjs";
|
|
@@ -304,7 +305,7 @@ export type GitStepName = GitStepBody["step"];
|
|
|
304
305
|
* The bodies the contract declares, by request and method; the rest are
|
|
305
306
|
* unknown, checked by their handlers.
|
|
306
307
|
*/
|
|
307
|
-
export interface StudioBodies {
|
|
308
|
+
export interface StudioBodies extends CommentBodies {
|
|
308
309
|
"agent-launch": {
|
|
309
310
|
POST: {
|
|
310
311
|
agent: LaunchAgentId;
|
|
@@ -382,7 +383,7 @@ export type StudioBodyOf<Name extends StudioRouteName, Method extends StudioMeth
|
|
|
382
383
|
* Each request, by name, and its answer to each method it takes. The query
|
|
383
384
|
* a request needs is in its comment.
|
|
384
385
|
*/
|
|
385
|
-
export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
386
|
+
export interface StudioAnswers<Own extends OwnTypes = OwnTypes> extends CommentAnswers {
|
|
386
387
|
/**
|
|
387
388
|
* Open an agent, or a plain terminal, where agents start: in a terminal
|
|
388
389
|
* window on this Mac (`opened`), else the command to run. Only from this
|
|
@@ -652,6 +653,19 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
652
653
|
views: string[];
|
|
653
654
|
};
|
|
654
655
|
};
|
|
656
|
+
/** A find and replace's changes, or what its undo put back. */
|
|
657
|
+
replace: {
|
|
658
|
+
POST: {
|
|
659
|
+
files: string[];
|
|
660
|
+
left?: number;
|
|
661
|
+
replaced: number;
|
|
662
|
+
skipped: number;
|
|
663
|
+
undo?: string;
|
|
664
|
+
} | {
|
|
665
|
+
kept: string[];
|
|
666
|
+
restored: string[];
|
|
667
|
+
};
|
|
668
|
+
};
|
|
655
669
|
/**
|
|
656
670
|
* GET: how a restart goes, from this Dex or, while none answers, its
|
|
657
671
|
* supervisor; POST: the run Dex restarts from.
|
|
@@ -697,11 +711,6 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
697
711
|
file: string;
|
|
698
712
|
};
|
|
699
713
|
};
|
|
700
|
-
/** ?slug= for one prototype's, or none for every one's. */
|
|
701
|
-
threads: {
|
|
702
|
-
GET: ThreadWithPrototype[];
|
|
703
|
-
POST: ThreadWithPrototype;
|
|
704
|
-
};
|
|
705
714
|
trash: {
|
|
706
715
|
DELETE: Done;
|
|
707
716
|
};
|
|
@@ -773,61 +782,6 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
773
782
|
export type StudioRouteName = keyof StudioAnswers;
|
|
774
783
|
/** The methods a request takes. */
|
|
775
784
|
export type StudioMethodOf<Name extends StudioRouteName> = keyof StudioAnswers[Name] & StudioMethod;
|
|
776
|
-
/**
|
|
777
|
-
* The requests and the methods each takes, for what has to know them as it
|
|
778
|
-
* runs: the server's test that it serves each one as declared.
|
|
779
|
-
*/
|
|
780
|
-
export declare const STUDIO_ROUTES: {
|
|
781
|
-
readonly canvas: readonly ["GET", "PUT"];
|
|
782
|
-
readonly annotations: readonly ["GET", "PUT", "DELETE"];
|
|
783
|
-
readonly events: readonly ["GET"];
|
|
784
|
-
readonly "removed-views": readonly ["GET", "POST"];
|
|
785
|
-
readonly reviews: readonly ["POST"];
|
|
786
|
-
readonly trash: readonly ["DELETE"];
|
|
787
|
-
readonly threads: readonly ["GET", "POST"];
|
|
788
|
-
readonly "spec-suggestion": readonly ["POST"];
|
|
789
|
-
readonly instructions: readonly ["GET", "PUT"];
|
|
790
|
-
readonly focus: readonly ["PUT"];
|
|
791
|
-
readonly me: readonly ["GET"];
|
|
792
|
-
readonly people: readonly ["GET"];
|
|
793
|
-
readonly prototypes: readonly ["POST"];
|
|
794
|
-
readonly paste: readonly ["POST"];
|
|
795
|
-
readonly frame: readonly ["POST"];
|
|
796
|
-
readonly show: readonly ["POST"];
|
|
797
|
-
readonly text: readonly ["POST"];
|
|
798
|
-
readonly props: readonly ["POST"];
|
|
799
|
-
readonly insert: readonly ["POST"];
|
|
800
|
-
readonly screenshot: readonly ["POST"];
|
|
801
|
-
readonly snapshot: readonly ["POST"];
|
|
802
|
-
readonly picture: readonly ["POST"];
|
|
803
|
-
readonly agents: readonly ["GET"];
|
|
804
|
-
readonly edited: readonly ["GET"];
|
|
805
|
-
readonly extension: readonly ["GET"];
|
|
806
|
-
readonly "agent-setup": readonly ["GET", "POST"];
|
|
807
|
-
readonly "agent-launch": readonly ["POST"];
|
|
808
|
-
readonly "agent-stop": readonly ["POST"];
|
|
809
|
-
readonly preferences: readonly ["GET", "PUT"];
|
|
810
|
-
readonly watch: readonly ["GET", "POST"];
|
|
811
|
-
readonly welcome: readonly ["GET", "POST"];
|
|
812
|
-
readonly update: readonly ["GET", "POST"];
|
|
813
|
-
readonly "machine-update": readonly ["GET", "POST"];
|
|
814
|
-
readonly "other-dexes": readonly ["GET", "POST"];
|
|
815
|
-
readonly restart: readonly ["GET", "POST"];
|
|
816
|
-
readonly "desktop-app": readonly ["GET", "POST"];
|
|
817
|
-
readonly devices: readonly ["GET", "PUT"];
|
|
818
|
-
readonly git: readonly ["GET", "POST"];
|
|
819
|
-
readonly "git-branches": readonly ["GET"];
|
|
820
|
-
readonly "git-sync": readonly ["POST"];
|
|
821
|
-
readonly "git-pull-base": readonly ["POST"];
|
|
822
|
-
readonly "git-saved": readonly ["GET", "POST"];
|
|
823
|
-
readonly "git-checks": readonly ["POST"];
|
|
824
|
-
readonly "git-settings": readonly ["GET", "PUT"];
|
|
825
|
-
readonly "build-settings": readonly ["GET", "PUT"];
|
|
826
|
-
readonly commands: readonly ["GET", "POST", "PUT", "DELETE"];
|
|
827
|
-
readonly "workspace-settings": readonly ["GET", "PUT"];
|
|
828
|
-
readonly "workspace-icon": readonly ["GET", "PUT", "DELETE"];
|
|
829
|
-
readonly avatar: readonly ["PUT", "DELETE"];
|
|
830
|
-
};
|
|
831
785
|
/** The web app manifest `dex dev` serves. */
|
|
832
786
|
export declare const MANIFEST_FILE = "manifest.webmanifest";
|
|
833
787
|
/**
|
|
@@ -52,74 +52,6 @@ const START_LINK_META = "dex-start-link";
|
|
|
52
52
|
* standalone display says in a browser.
|
|
53
53
|
*/
|
|
54
54
|
const DESKTOP_APP_AGENT = "DexApp";
|
|
55
|
-
/**
|
|
56
|
-
* The requests and the methods each takes, for what has to know them as it
|
|
57
|
-
* runs: the server's test that it serves each one as declared.
|
|
58
|
-
*/
|
|
59
|
-
const STUDIO_ROUTES = {
|
|
60
|
-
canvas: ["GET", "PUT"],
|
|
61
|
-
annotations: [
|
|
62
|
-
"GET",
|
|
63
|
-
"PUT",
|
|
64
|
-
"DELETE"
|
|
65
|
-
],
|
|
66
|
-
events: ["GET"],
|
|
67
|
-
"removed-views": ["GET", "POST"],
|
|
68
|
-
reviews: ["POST"],
|
|
69
|
-
trash: ["DELETE"],
|
|
70
|
-
threads: ["GET", "POST"],
|
|
71
|
-
"spec-suggestion": ["POST"],
|
|
72
|
-
instructions: ["GET", "PUT"],
|
|
73
|
-
focus: ["PUT"],
|
|
74
|
-
me: ["GET"],
|
|
75
|
-
people: ["GET"],
|
|
76
|
-
prototypes: ["POST"],
|
|
77
|
-
paste: ["POST"],
|
|
78
|
-
frame: ["POST"],
|
|
79
|
-
show: ["POST"],
|
|
80
|
-
text: ["POST"],
|
|
81
|
-
props: ["POST"],
|
|
82
|
-
insert: ["POST"],
|
|
83
|
-
screenshot: ["POST"],
|
|
84
|
-
snapshot: ["POST"],
|
|
85
|
-
picture: ["POST"],
|
|
86
|
-
agents: ["GET"],
|
|
87
|
-
edited: ["GET"],
|
|
88
|
-
extension: ["GET"],
|
|
89
|
-
"agent-setup": ["GET", "POST"],
|
|
90
|
-
"agent-launch": ["POST"],
|
|
91
|
-
"agent-stop": ["POST"],
|
|
92
|
-
preferences: ["GET", "PUT"],
|
|
93
|
-
watch: ["GET", "POST"],
|
|
94
|
-
welcome: ["GET", "POST"],
|
|
95
|
-
update: ["GET", "POST"],
|
|
96
|
-
"machine-update": ["GET", "POST"],
|
|
97
|
-
"other-dexes": ["GET", "POST"],
|
|
98
|
-
restart: ["GET", "POST"],
|
|
99
|
-
"desktop-app": ["GET", "POST"],
|
|
100
|
-
devices: ["GET", "PUT"],
|
|
101
|
-
git: ["GET", "POST"],
|
|
102
|
-
"git-branches": ["GET"],
|
|
103
|
-
"git-sync": ["POST"],
|
|
104
|
-
"git-pull-base": ["POST"],
|
|
105
|
-
"git-saved": ["GET", "POST"],
|
|
106
|
-
"git-checks": ["POST"],
|
|
107
|
-
"git-settings": ["GET", "PUT"],
|
|
108
|
-
"build-settings": ["GET", "PUT"],
|
|
109
|
-
commands: [
|
|
110
|
-
"GET",
|
|
111
|
-
"POST",
|
|
112
|
-
"PUT",
|
|
113
|
-
"DELETE"
|
|
114
|
-
],
|
|
115
|
-
"workspace-settings": ["GET", "PUT"],
|
|
116
|
-
"workspace-icon": [
|
|
117
|
-
"GET",
|
|
118
|
-
"PUT",
|
|
119
|
-
"DELETE"
|
|
120
|
-
],
|
|
121
|
-
avatar: ["PUT", "DELETE"]
|
|
122
|
-
};
|
|
123
55
|
/** The web app manifest `dex dev` serves. */
|
|
124
56
|
const MANIFEST_FILE = "manifest.webmanifest";
|
|
125
57
|
/**
|
|
@@ -134,4 +66,4 @@ const PROJECT_ID_HEADER = "x-dex-project";
|
|
|
134
66
|
*/
|
|
135
67
|
const OLD_PROJECT_ID_HEADER = "x-sudio-project";
|
|
136
68
|
//#endregion
|
|
137
|
-
export { DESKTOP_APP_AGENT, DESKTOP_APP_INSTALLED, DESKTOP_APP_KEY, EXTENSION_FILE, GITHUB_SIGN_IN_COMMAND, GIT_NAME_COMMAND, MANIFEST_FILE, ME_META, NOT_RECOGNISED, OLD_PROJECT_ID_HEADER, PROJECT_ID_HEADER, STALE_PICTURE_HEADER, START_LINK_META,
|
|
69
|
+
export { DESKTOP_APP_AGENT, DESKTOP_APP_INSTALLED, DESKTOP_APP_KEY, EXTENSION_FILE, GITHUB_SIGN_IN_COMMAND, GIT_NAME_COMMAND, MANIFEST_FILE, ME_META, NOT_RECOGNISED, OLD_PROJECT_ID_HEADER, PROJECT_ID_HEADER, STALE_PICTURE_HEADER, START_LINK_META, canLaunch, nameOfMe, youOf };
|
|
@@ -73,8 +73,8 @@ export type ThreadTarget = {
|
|
|
73
73
|
selector?: string;
|
|
74
74
|
/**
|
|
75
75
|
* The start of the element's text, or its label or placeholder when it
|
|
76
|
-
* has none, to help find it in code
|
|
77
|
-
*
|
|
76
|
+
* has none, to help find it in code, and on the page when it moves.
|
|
77
|
+
* Its pin stays in its place when the words change.
|
|
78
78
|
*/
|
|
79
79
|
text?: string;
|
|
80
80
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { prototypeFiles } from "./prototypes-core.mjs";
|
|
2
1
|
import { isOneOf, isRecord, isText } from "./checks.mjs";
|
|
2
|
+
import { prototypeFiles } from "./prototypes-core.mjs";
|
|
3
3
|
import { cleanSketch, describeSketch, threadSketchProblems } from "./sketch-core.mjs";
|
|
4
4
|
import { VIEWPORTS, isSpecPath } from "./canvas-core.mjs";
|
|
5
5
|
import "./spec-quote.mjs";
|