@dexhq/canvas 0.13.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 +53 -0
- package/README.md +21 -18
- 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 +43 -26
- 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/tool-cursors.ts +16 -16
- 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 +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- 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/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- 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 -65
- 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/snapshot-client.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/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/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- 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 +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- 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 +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- 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 +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- 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 +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +6 -17
- package/dist/setup/project.mjs +17 -61
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- 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 +7 -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 +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- 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/snapshot-client.ts +1 -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/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- 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 +49 -15
- package/src/server/file-errors.ts +47 -13
- 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 +27 -3
- 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/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- 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 +24 -3
- package/src/setup/detect.ts +56 -14
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- 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 +11 -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/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- 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/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
|
@@ -6,13 +6,15 @@ import { prototypesDir } from "../content/prototypes.mjs";
|
|
|
6
6
|
import { checkForUpdate } from "./updates.mjs";
|
|
7
7
|
import { STUDIO_FILES, classify } from "../shared/studio-files.mjs";
|
|
8
8
|
import { openThreads } from "../content/thread-module.mjs";
|
|
9
|
+
import { localSessions } from "./channel.mjs";
|
|
9
10
|
import { WORKSPACE_ICON_FILES } from "../shared/workspace.mjs";
|
|
10
11
|
import { findConfigFile } from "../config/load.mjs";
|
|
11
12
|
import { closeScreenshotBrowser } from "../content/screenshot.mjs";
|
|
12
13
|
import { purgeTrash } from "../content/trash.mjs";
|
|
13
|
-
import {
|
|
14
|
+
import { desktopAppUnavailable, macLaunchServices, openApp, refreshDesktopApp, revealInFinder, servedApp } from "../setup/desktop-app.mjs";
|
|
14
15
|
import { AVATAR_FILES } from "../shared/avatar-file.mjs";
|
|
15
16
|
import { eventsForFile, studioEvent } from "../shared/studio-events.mjs";
|
|
17
|
+
import { claimedPresence } from "./claimed-presence.mjs";
|
|
16
18
|
import { eventHub, studioRequests } from "./requests.mjs";
|
|
17
19
|
import { existsSync, realpathSync } from "node:fs";
|
|
18
20
|
import { basename, dirname, join, relative, sep } from "node:path";
|
|
@@ -31,6 +33,17 @@ const READ_FOLDERS = /* @__PURE__ */ new Set([
|
|
|
31
33
|
]);
|
|
32
34
|
const SVG_PATH_RE = /\.svgz?$/i;
|
|
33
35
|
const SVG_POLICY = "default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox";
|
|
36
|
+
/**
|
|
37
|
+
* Whether a module is a file-only entry nothing imports any more. For each
|
|
38
|
+
* file a stylesheet depends on, such as each view's stylesheet Tailwind
|
|
39
|
+
* scans for classes, Vite makes a file-only entry (createFileOnlyEntry): a
|
|
40
|
+
* module with no id, imported by the stylesheet that depends on it. Once the
|
|
41
|
+
* file is deleted and Tailwind scans again, nothing imports the entry, but
|
|
42
|
+
* Vite keeps it; when a file is written at that path again (a review
|
|
43
|
+
* imported again, a file restored), Vite finds nothing that takes the
|
|
44
|
+
* update and reloads every page. No page imports it, so none needs it.
|
|
45
|
+
*/
|
|
46
|
+
const orphanedFileOnlyEntry = (module) => module.id === null && module.importers.size === 0;
|
|
34
47
|
/** Whether a request is for an SVG file, as Vite reads its path. */
|
|
35
48
|
const isSvgRequest = (url = "") => {
|
|
36
49
|
try {
|
|
@@ -41,17 +54,15 @@ const isSvgRequest = (url = "") => {
|
|
|
41
54
|
};
|
|
42
55
|
/**
|
|
43
56
|
* Where this studio can make its app on a Mac: the port and base it is
|
|
44
|
-
* served at, so the app opens this studio. Not in a hosted studio.
|
|
57
|
+
* served at, so the app opens this studio. Not in a hosted studio. Asked
|
|
58
|
+
* once the server listens: before, the port is the configured one, which
|
|
59
|
+
* another server may hold.
|
|
45
60
|
*/
|
|
46
|
-
const desktopHost = (project,
|
|
61
|
+
const desktopHost = (project, server) => {
|
|
47
62
|
const unavailable = desktopAppUnavailable();
|
|
48
63
|
if (unavailable) return { unavailable };
|
|
49
64
|
return {
|
|
50
|
-
app:
|
|
51
|
-
root: project.root,
|
|
52
|
-
port: config.server.port,
|
|
53
|
-
base: config.base
|
|
54
|
-
}),
|
|
65
|
+
app: servedApp(project.root, server),
|
|
55
66
|
home: homedir(),
|
|
56
67
|
reveal: revealInFinder,
|
|
57
68
|
open: openApp,
|
|
@@ -59,8 +70,8 @@ const desktopHost = (project, config) => {
|
|
|
59
70
|
};
|
|
60
71
|
};
|
|
61
72
|
/** Bring the installed app up to date when it is behind (desktop-app.ts). */
|
|
62
|
-
const refreshInstalledApp = async (project,
|
|
63
|
-
const host = desktopHost(project,
|
|
73
|
+
const refreshInstalledApp = async (project, server) => {
|
|
74
|
+
const host = desktopHost(project, server);
|
|
64
75
|
if ("app" in host) await refreshDesktopApp(host.app, host.home);
|
|
65
76
|
};
|
|
66
77
|
function studioDev(project) {
|
|
@@ -99,12 +110,21 @@ function studioDev(project) {
|
|
|
99
110
|
const parent = dirname(path);
|
|
100
111
|
return [content, realContent].some((root) => parent === join(root, ".studio") || parent === root && !READ_FOLDERS.has(basename(path)));
|
|
101
112
|
};
|
|
113
|
+
const markClaimed = claimedPresence({
|
|
114
|
+
clear: presence.clear,
|
|
115
|
+
content,
|
|
116
|
+
mark: presence.mark,
|
|
117
|
+
sessions: () => localSessions(content),
|
|
118
|
+
threads
|
|
119
|
+
});
|
|
102
120
|
const sendPresence = async () => events.send(studioEvent.presence(await presence.list()));
|
|
103
121
|
return {
|
|
104
122
|
name: "studio-dev",
|
|
105
123
|
apply: "serve",
|
|
106
|
-
hotUpdate({ file }) {
|
|
124
|
+
hotUpdate({ file, modules }) {
|
|
107
125
|
if (kindOf(file) !== "other" || isAvatar(file) || basename(file) === ".gitattributes") return [];
|
|
126
|
+
const kept = modules.filter((module) => !orphanedFileOnlyEntry(module));
|
|
127
|
+
if (kept.length < modules.length) return kept;
|
|
108
128
|
},
|
|
109
129
|
config: ({ server }) => server?.watch === null ? void 0 : { server: { watch: { ignored: [unread] } } },
|
|
110
130
|
configureServer(server) {
|
|
@@ -132,6 +152,7 @@ function studioDev(project) {
|
|
|
132
152
|
return;
|
|
133
153
|
}
|
|
134
154
|
for (const event of eventsForFile(relative(content, file))) events.send(event);
|
|
155
|
+
markClaimed(file).catch(() => void 0);
|
|
135
156
|
};
|
|
136
157
|
for (const event of [
|
|
137
158
|
"add",
|
|
@@ -160,7 +181,9 @@ function studioDev(project) {
|
|
|
160
181
|
server.watcher.on("add", onAddOrRemove);
|
|
161
182
|
server.watcher.on("unlink", onAddOrRemove);
|
|
162
183
|
purgeTrash(content).catch(() => void 0);
|
|
163
|
-
|
|
184
|
+
server.httpServer?.once("listening", () => {
|
|
185
|
+
refreshInstalledApp(project, server).catch(() => void 0);
|
|
186
|
+
});
|
|
164
187
|
checkForUpdate(content, project.root, { fresh: true }).catch(() => void 0);
|
|
165
188
|
const tick = setInterval(sendPresence, PRESENCE_TICK_MS);
|
|
166
189
|
server.httpServer?.on("close", () => {
|
|
@@ -173,7 +196,7 @@ function studioDev(project) {
|
|
|
173
196
|
events,
|
|
174
197
|
server: server.config.server,
|
|
175
198
|
base: server.config.base,
|
|
176
|
-
desktop: desktopHost(project, server
|
|
199
|
+
desktop: () => desktopHost(project, server)
|
|
177
200
|
});
|
|
178
201
|
server.middlewares.use(async (request, response, next) => {
|
|
179
202
|
if (isSvgRequest(request.url)) {
|
|
@@ -12,6 +12,11 @@ interface TransformError {
|
|
|
12
12
|
}
|
|
13
13
|
/** What went wrong in `file`, as a page shows it. */
|
|
14
14
|
export declare function describeFileError(file: string, path: string, error: TransformError): FileError;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Keeps a broken file in the content folder from breaking every page on the
|
|
17
|
+
* server. `imports` is the folder outside it that views import from, the
|
|
18
|
+
* components' (vite.ts): Vite watches only the files it loaded, so a file
|
|
19
|
+
* appearing there, such as a component shadcn adds, would go unseen.
|
|
20
|
+
*/
|
|
21
|
+
export declare const fileErrors: (content: string, imports?: string) => Plugin;
|
|
17
22
|
//#endregion
|
|
@@ -39,15 +39,33 @@ function describeFileError(file, path, error) {
|
|
|
39
39
|
...error.frame ? { frame: error.frame } : {}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Keeps a broken file in the content folder from breaking every page on the
|
|
44
|
+
* server. `imports` is the folder outside it that views import from, the
|
|
45
|
+
* components' (vite.ts): Vite watches only the files it loaded, so a file
|
|
46
|
+
* appearing there, such as a component shadcn adds, would go unseen.
|
|
47
|
+
*/
|
|
48
|
+
const fileErrors = (content, imports) => {
|
|
44
49
|
const errors = /* @__PURE__ */ new Map();
|
|
45
50
|
let server;
|
|
46
51
|
const list = () => [...errors.values()];
|
|
47
52
|
const tell = () => server?.ws.send(FILE_ERRORS_EVENT, list());
|
|
48
|
-
const
|
|
53
|
+
const listed = (file) => {
|
|
49
54
|
const path = inContent(content, file.replace(QUERY_RE, ""));
|
|
50
|
-
|
|
55
|
+
return path && errors.has(path) ? path : void 0;
|
|
56
|
+
};
|
|
57
|
+
const forget = (file) => {
|
|
58
|
+
const path = listed(file);
|
|
59
|
+
if (path) {
|
|
60
|
+
errors.delete(path);
|
|
61
|
+
tell();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const forgetAll = () => {
|
|
65
|
+
if (errors.size > 0) {
|
|
66
|
+
errors.clear();
|
|
67
|
+
tell();
|
|
68
|
+
}
|
|
51
69
|
};
|
|
52
70
|
return {
|
|
53
71
|
name: "studio-file-errors",
|
|
@@ -56,8 +74,16 @@ const fileErrors = (content) => {
|
|
|
56
74
|
server = devServer;
|
|
57
75
|
devServer.ws.on(FILE_ERRORS_EVENT, (_data, client) => client.send(FILE_ERRORS_EVENT, list()));
|
|
58
76
|
devServer.watcher.on("change", forget);
|
|
59
|
-
devServer.watcher.on("add",
|
|
77
|
+
devServer.watcher.on("add", forgetAll);
|
|
60
78
|
devServer.watcher.on("unlink", forget);
|
|
79
|
+
if (imports) devServer.watcher.add(imports);
|
|
80
|
+
devServer.middlewares.use((request, response, next) => {
|
|
81
|
+
const file = errors.size > 0 ? fileOf({}, request.url, devServer.config.root) : void 0;
|
|
82
|
+
if (file && listed(file)) response.once("finish", () => {
|
|
83
|
+
if (response.statusCode < 400) forget(file);
|
|
84
|
+
});
|
|
85
|
+
next();
|
|
86
|
+
});
|
|
61
87
|
return () => {
|
|
62
88
|
const onError = (error, request, response, next) => {
|
|
63
89
|
const file = fileOf(error, request.url, devServer.config.root);
|
|
@@ -78,9 +104,6 @@ const fileErrors = (content) => {
|
|
|
78
104
|
};
|
|
79
105
|
devServer.middlewares.use(onError);
|
|
80
106
|
};
|
|
81
|
-
},
|
|
82
|
-
transform(_code, id) {
|
|
83
|
-
if (errors.size > 0) forget(id);
|
|
84
107
|
}
|
|
85
108
|
};
|
|
86
109
|
};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/** How a lock is held. */
|
|
3
3
|
export interface LockOptions {
|
|
4
4
|
/**
|
|
5
|
-
* Keep the
|
|
5
|
+
* Keep the lease fresh while the work runs, so work longer than `staleMs`
|
|
6
6
|
* keeps it: only a lock whose process stopped goes stale.
|
|
7
7
|
*/
|
|
8
8
|
keepAlive?: boolean;
|
|
9
|
-
/** How
|
|
9
|
+
/** How long a lease lasts before it counts as left behind. */
|
|
10
10
|
staleMs?: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -1,67 +1,161 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { mkdir, readdir, rename, rm, rmdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
2
4
|
import { setTimeout } from "node:timers/promises";
|
|
3
5
|
//#region src/server/file-lock.ts
|
|
4
6
|
const LOCK_STALE_MS = 5e3;
|
|
5
7
|
const LOCK_RETRY_MS = 10;
|
|
6
|
-
/** A lock kept alive is
|
|
8
|
+
/** A lock kept alive is renewed this often per `staleMs`, so one late renewal still lands in time. */
|
|
7
9
|
const TOUCHES_PER_STALE = 3;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* How many times in a row publishing may be refused with no folder there
|
|
12
|
+
* before the refusal is taken as a real error rather than a release racing it.
|
|
13
|
+
*/
|
|
14
|
+
const REFUSALS_WITHOUT_FOLDER = 100;
|
|
15
|
+
const CLAIM_PREFIX = "holder-";
|
|
16
|
+
const claimName = (token, staleMs) => `${CLAIM_PREFIX}${token}-${Date.now() + staleMs}`;
|
|
17
|
+
const isClaim = (name) => name.startsWith(CLAIM_PREFIX);
|
|
18
|
+
const leaseEnded = (claim) => Number(claim.slice(claim.lastIndexOf("-") + 1)) <= Date.now();
|
|
19
|
+
const code = (error) => error.code;
|
|
20
|
+
/** Whether a call failed for want of what it named: it changed since it was seen. */
|
|
21
|
+
const gone = (error) => code(error) === "ENOENT";
|
|
22
|
+
/**
|
|
23
|
+
* Whether publishing failed because a folder is there: POSIX refuses a full
|
|
24
|
+
* folder, Windows any folder.
|
|
25
|
+
*/
|
|
26
|
+
const refused = (error) => [
|
|
27
|
+
"EEXIST",
|
|
28
|
+
"ENOTEMPTY",
|
|
29
|
+
"EPERM",
|
|
30
|
+
"EACCES"
|
|
31
|
+
].includes(code(error) ?? "");
|
|
32
|
+
/** Run `call`, true when it worked, false when what it named was gone. */
|
|
33
|
+
const unlessGone = (call) => call.then(() => true, (error) => {
|
|
34
|
+
if (gone(error)) return false;
|
|
35
|
+
throw error;
|
|
12
36
|
});
|
|
13
|
-
/** Whether a failed call failed because the folder was already there. */
|
|
14
|
-
const alreadyThere = (error) => error.code === "EEXIST";
|
|
15
37
|
/**
|
|
16
|
-
* Remove
|
|
17
|
-
*
|
|
18
|
-
* removal happens under a second folder, after looking at the age again.
|
|
19
|
-
* Returns whether this process did the takeover.
|
|
38
|
+
* Remove what `work` left in the lock's folder. Never a claim: one that is
|
|
39
|
+
* not this caller's is a holder's that took the lock over meanwhile.
|
|
20
40
|
*/
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
async function clearBesides(folder) {
|
|
42
|
+
for (const entry of await readdir(folder)) if (!isClaim(entry)) await rm(join(folder, entry), {
|
|
43
|
+
recursive: true,
|
|
44
|
+
force: true
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A folder with no claim is empty for a moment while it is let go, or was
|
|
49
|
+
* left by an older Dex, which held a lock as a bare folder. Once older than
|
|
50
|
+
* `staleMs`, what is in it goes, and then the folder if it is still empty:
|
|
51
|
+
* never a claim, so never a lock that is held.
|
|
52
|
+
*/
|
|
53
|
+
async function clearUnclaimed(folder, entries, staleMs) {
|
|
54
|
+
if (!await stat(folder).then((info) => Date.now() - info.mtimeMs > staleMs, () => false)) {
|
|
55
|
+
await setTimeout(LOCK_RETRY_MS);
|
|
56
|
+
return;
|
|
35
57
|
}
|
|
58
|
+
for (const entry of entries) await rm(join(folder, entry), {
|
|
59
|
+
recursive: true,
|
|
60
|
+
force: true
|
|
61
|
+
});
|
|
62
|
+
await rmdir(folder).catch(() => void 0);
|
|
36
63
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Take the lock `folder`, waiting while another process holds it. Returns
|
|
66
|
+
* the name of this caller's claim.
|
|
67
|
+
*/
|
|
68
|
+
async function lock(folder, token, staleMs) {
|
|
69
|
+
const temporary = `${folder}.${token}`;
|
|
70
|
+
let refusals = 0;
|
|
39
71
|
for (;;) {
|
|
72
|
+
const mine = claimName(token, staleMs);
|
|
73
|
+
await mkdir(temporary);
|
|
40
74
|
try {
|
|
41
|
-
await
|
|
42
|
-
|
|
75
|
+
await writeFile(join(temporary, mine), "");
|
|
76
|
+
await rename(temporary, folder);
|
|
77
|
+
return mine;
|
|
43
78
|
} catch (error) {
|
|
44
|
-
|
|
79
|
+
await rm(temporary, {
|
|
80
|
+
recursive: true,
|
|
81
|
+
force: true
|
|
82
|
+
});
|
|
83
|
+
if (!refused(error)) throw error;
|
|
84
|
+
}
|
|
85
|
+
const entries = await readdir(folder).catch((error) => {
|
|
86
|
+
if (gone(error)) return;
|
|
87
|
+
throw error;
|
|
88
|
+
});
|
|
89
|
+
if (!entries) {
|
|
90
|
+
refusals += 1;
|
|
91
|
+
if (refusals >= REFUSALS_WITHOUT_FOLDER) throw new Error(`The lock ${folder} could not be made.`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
refusals = 0;
|
|
95
|
+
const held = entries.find(isClaim);
|
|
96
|
+
if (!held) {
|
|
97
|
+
await clearUnclaimed(folder, entries, staleMs);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!leaseEnded(held)) {
|
|
101
|
+
await setTimeout(LOCK_RETRY_MS);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const taken = claimName(token, staleMs);
|
|
105
|
+
if (await unlessGone(rename(join(folder, held), join(folder, taken)))) {
|
|
106
|
+
await clearBesides(folder);
|
|
107
|
+
return taken;
|
|
45
108
|
}
|
|
46
|
-
if (!(await isStale(folder, staleMs) && await takeOver(folder, staleMs))) await setTimeout(LOCK_RETRY_MS);
|
|
47
109
|
}
|
|
48
110
|
}
|
|
111
|
+
/** A held lock's claim, renewed one at a time. */
|
|
112
|
+
function holding(folder, token, claim, staleMs) {
|
|
113
|
+
let current = claim;
|
|
114
|
+
let last = Promise.resolve();
|
|
115
|
+
/** Renew the lease, unless it was lost: the name now, or undefined. */
|
|
116
|
+
const renew = () => {
|
|
117
|
+
last = last.then(async () => {
|
|
118
|
+
if (!current) return;
|
|
119
|
+
const next = claimName(token, staleMs);
|
|
120
|
+
try {
|
|
121
|
+
await rename(join(folder, current), join(folder, next));
|
|
122
|
+
current = next;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (gone(error)) current = void 0;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return last.then(() => current);
|
|
128
|
+
};
|
|
129
|
+
return { renew };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Let the lock go, if this caller still holds it: renew it first, so it
|
|
133
|
+
* stays this caller's while the folder is cleared; touch nothing if it was
|
|
134
|
+
* taken over.
|
|
135
|
+
*/
|
|
136
|
+
async function release(folder, claim) {
|
|
137
|
+
const mine = await claim.renew();
|
|
138
|
+
if (!mine) return;
|
|
139
|
+
await clearBesides(folder);
|
|
140
|
+
if (!await unlessGone(unlink(join(folder, mine)))) return;
|
|
141
|
+
await rmdir(folder).catch(() => void 0);
|
|
142
|
+
}
|
|
49
143
|
/**
|
|
50
144
|
* Run `work` holding the lock `folder` (its parent must exist), and let it
|
|
51
145
|
* go after, whatever happens. `work` may keep files in the folder while it
|
|
52
146
|
* runs: they go with the lock.
|
|
53
147
|
*/
|
|
54
148
|
async function withLock(folder, work, { keepAlive = false, staleMs = LOCK_STALE_MS } = {}) {
|
|
55
|
-
|
|
149
|
+
const token = randomBytes(8).toString("hex");
|
|
150
|
+
const claim = holding(folder, token, await lock(folder, token, staleMs), staleMs);
|
|
56
151
|
const fresh = keepAlive ? setInterval(() => {
|
|
57
|
-
|
|
58
|
-
utimes(folder, now, now).catch(() => void 0);
|
|
152
|
+
claim.renew().catch(() => void 0);
|
|
59
153
|
}, staleMs / TOUCHES_PER_STALE) : void 0;
|
|
60
154
|
try {
|
|
61
155
|
return await work();
|
|
62
156
|
} finally {
|
|
63
157
|
clearInterval(fresh);
|
|
64
|
-
await
|
|
158
|
+
await release(folder, claim);
|
|
65
159
|
}
|
|
66
160
|
}
|
|
67
161
|
//#endregion
|
package/dist/server/mcp.d.mts
CHANGED
|
@@ -46,8 +46,6 @@ export interface StudioServerOptions {
|
|
|
46
46
|
/** The thread module, shared with the channel. */
|
|
47
47
|
threads?: ThreadModule;
|
|
48
48
|
}
|
|
49
|
-
/** The studio's MCP server (see createStudio). */
|
|
50
|
-
export declare const createStudioServer: (root: string, options?: StudioServerOptions) => McpServer;
|
|
51
49
|
/**
|
|
52
50
|
* The studio's MCP server and its agent session. `threads`
|
|
53
51
|
* (thread-module.ts) is shared with the channel, so one change feed serves
|
package/dist/server/mcp.mjs
CHANGED
|
@@ -8,8 +8,7 @@ import { CHANNEL_ENV, CHANNEL_INSTRUCTIONS, openReceipt, sessionReport, startCha
|
|
|
8
8
|
import { loadProject } from "../config/load.mjs";
|
|
9
9
|
import { openBriefing } from "./briefing.mjs";
|
|
10
10
|
import { openToolContext } from "./tools/context.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import { registerCommentTool } from "./tools/comment.mjs";
|
|
11
|
+
import { registerCommentTools } from "./comments/tools.mjs";
|
|
13
12
|
import { registerFeedbackTool } from "./tools/feedback.mjs";
|
|
14
13
|
import { registerPlaceFrameTool } from "./tools/place-frame.mjs";
|
|
15
14
|
import { registerReadingTools } from "./tools/reading.mjs";
|
|
@@ -49,8 +48,6 @@ const AGENT_NAMES = {
|
|
|
49
48
|
const agentOf = (client) => AGENT_NAMES[client.toLowerCase()];
|
|
50
49
|
/** The design system of the project a content folder belongs to, if any. */
|
|
51
50
|
const designSystemOf = (root) => loadProject(root).then((project) => project.designSystem, () => void 0);
|
|
52
|
-
/** The studio's MCP server (see createStudio). */
|
|
53
|
-
const createStudioServer = (root, options = {}) => createStudio(root, options).server;
|
|
54
51
|
/**
|
|
55
52
|
* The studio's MCP server and its agent session. `threads`
|
|
56
53
|
* (thread-module.ts) is shared with the channel, so one change feed serves
|
|
@@ -76,6 +73,7 @@ function createStudio(root, { agent, channel, threads = openThreads(root), desig
|
|
|
76
73
|
};
|
|
77
74
|
const session = openAgentSession(root, threads, {
|
|
78
75
|
agent: agentName,
|
|
76
|
+
claudeSession,
|
|
79
77
|
...sessionId ? { id: sessionId } : {}
|
|
80
78
|
});
|
|
81
79
|
const handover = registerHandover(server, session, receipt);
|
|
@@ -101,8 +99,7 @@ function createStudio(root, { agent, channel, threads = openThreads(root), desig
|
|
|
101
99
|
registerReadingTools(server, context, briefing);
|
|
102
100
|
registerThreadsTool(server, context);
|
|
103
101
|
registerWatchTool(server, context);
|
|
104
|
-
|
|
105
|
-
registerCloseAndReplyTools(server, context);
|
|
102
|
+
registerCommentTools(server, context);
|
|
106
103
|
registerPlaceFrameTool(server, context);
|
|
107
104
|
registerShowTool(server, context, findStudio);
|
|
108
105
|
registerSnapshotTool(server, context, findStudio);
|
|
@@ -117,11 +114,12 @@ function createStudio(root, { agent, channel, threads = openThreads(root), desig
|
|
|
117
114
|
async function serveMcp(root, options = {}) {
|
|
118
115
|
const channel = process.env[CHANNEL_ENV] === "1";
|
|
119
116
|
const threads = openThreads(root);
|
|
117
|
+
const claudeSession = process.env.CLAUDE_CODE_SESSION_ID;
|
|
120
118
|
const { handover, receipt, server, session } = createStudio(root, {
|
|
121
119
|
...options,
|
|
122
120
|
channel,
|
|
123
121
|
threads,
|
|
124
|
-
claudeSession
|
|
122
|
+
claudeSession
|
|
125
123
|
});
|
|
126
124
|
const client = () => server.server.getClientVersion()?.name ?? "";
|
|
127
125
|
const pushUntilHandedOver = async () => {
|
|
@@ -136,6 +134,7 @@ async function serveMcp(root, options = {}) {
|
|
|
136
134
|
holding: session.holding().length,
|
|
137
135
|
receipt
|
|
138
136
|
}), {
|
|
137
|
+
claudeSession,
|
|
139
138
|
onEnd: session.leave,
|
|
140
139
|
session: session.id
|
|
141
140
|
});
|
|
@@ -153,4 +152,4 @@ async function serveMcp(root, options = {}) {
|
|
|
153
152
|
await server.connect(new StdioServerTransport());
|
|
154
153
|
}
|
|
155
154
|
//#endregion
|
|
156
|
-
export { agentOf, createStudio,
|
|
155
|
+
export { agentOf, createStudio, serveMcp };
|
package/dist/server/me.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contributor } from "../
|
|
1
|
+
import { Contributor } from "../shared/studio-files.mjs";
|
|
2
2
|
//#region src/server/me.d.ts
|
|
3
3
|
/** The person's git user name, or "" when git has none. */
|
|
4
4
|
export declare const gitUser: (content: string) => Promise<string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ThreadWithPrototype } from "../shared/threads-core.mjs";
|
|
2
|
+
import { PresenceEntry } from "../shared/presence-core.mjs";
|
|
2
3
|
import { SavedFocus } from "./state.mjs";
|
|
3
4
|
//#region src/server/open-page.d.ts
|
|
4
5
|
/** A section of the canvas, as an agent reads it. */
|
|
@@ -44,6 +45,27 @@ export type WhereThePersonIs = {
|
|
|
44
45
|
export declare function agoFrom(ms: number): string;
|
|
45
46
|
/** Where the person is in Dex, or that nobody has it open. */
|
|
46
47
|
export declare function whereThePersonIs(root: string, now?: number): Promise<WhereThePersonIs>;
|
|
48
|
+
/** An agent the canvas shows at work on a file, as an agent reads it (`where`). */
|
|
49
|
+
export interface AtWork {
|
|
50
|
+
agent: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whose mark it is: the agent reading it (its own session, or the Claude
|
|
53
|
+
* Code session it serves, sub-agents too), another session on this
|
|
54
|
+
* machine, or a teammate in the live workspace.
|
|
55
|
+
*/
|
|
56
|
+
by: "you" | "another session" | "a teammate";
|
|
57
|
+
/** When it ends, unless it is marked again or its work ends first. */
|
|
58
|
+
ends: string;
|
|
59
|
+
/** When it was last marked. */
|
|
60
|
+
marked: string;
|
|
61
|
+
/** "view:<name>", "doc:<name>", or "prototype": shared code, so every view. */
|
|
62
|
+
on: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Who the canvas shows at work on file `slug`, from the fresh `entries`, as
|
|
66
|
+
* the agent whose marks are under the sessions `mine` reads it.
|
|
67
|
+
*/
|
|
68
|
+
export declare const atWorkOn: (entries: readonly PresenceEntry[], slug: string, mine: readonly string[]) => AtWork[];
|
|
47
69
|
/** A thread with whether it is on the page the person has open. */
|
|
48
70
|
export interface PlacedThread<T> {
|
|
49
71
|
onOpenPage: boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { canvasFrames, frameTitle, parseFrameKey, viewOf } from "../shared/canvas-core.mjs";
|
|
2
|
+
import { fromRoom } from "../shared/live-presence.mjs";
|
|
3
|
+
import { endsAt, underSession } from "../shared/presence-core.mjs";
|
|
1
4
|
import { readFocus } from "./state.mjs";
|
|
2
5
|
import { prototypeTitle } from "../content/prototypes.mjs";
|
|
3
|
-
import { canvasFrames, frameTitle, parseFrameKey, viewOf } from "../shared/canvas-core.mjs";
|
|
4
6
|
import { readCanvas } from "../content/content.mjs";
|
|
5
7
|
import { plural } from "./response-budget.mjs";
|
|
6
8
|
import { onOpenPage } from "../shared/open-page-core.mjs";
|
|
@@ -76,6 +78,22 @@ async function whereThePersonIs(root, now = Date.now()) {
|
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
/**
|
|
81
|
+
* Who the canvas shows at work on file `slug`, from the fresh `entries`, as
|
|
82
|
+
* the agent whose marks are under the sessions `mine` reads it.
|
|
83
|
+
*/
|
|
84
|
+
const atWorkOn = (entries, slug, mine) => entries.filter((entry) => entry.slug === slug).map((entry) => {
|
|
85
|
+
let by = "another session";
|
|
86
|
+
if (fromRoom(entry)) by = "a teammate";
|
|
87
|
+
else if (mine.some((session) => underSession(entry.session, session))) by = "you";
|
|
88
|
+
return {
|
|
89
|
+
agent: entry.agent,
|
|
90
|
+
on: entry.target,
|
|
91
|
+
by,
|
|
92
|
+
marked: entry.updated,
|
|
93
|
+
ends: new Date(endsAt(entry)).toISOString()
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
79
97
|
* Threads with those on the page the person has open first, then the rest
|
|
80
98
|
* of the open file's, then other files', each part in the order it came in.
|
|
81
99
|
* As they came when nobody has a file open.
|
|
@@ -98,4 +116,4 @@ function openPageFirst(threads, focus) {
|
|
|
98
116
|
}));
|
|
99
117
|
}
|
|
100
118
|
//#endregion
|
|
101
|
-
export { agoFrom, openPageFirst, whereThePersonIs };
|
|
119
|
+
export { agoFrom, atWorkOn, openPageFirst, whereThePersonIs };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/server/outcome.d.ts
|
|
2
|
+
/** What kind of refusal a problem is. */
|
|
3
|
+
export type ProblemKind = "not-found" | "conflict" | "invalid" | "not-allowed";
|
|
4
|
+
/** Why an action did not happen, in words for people: most say one thing. */
|
|
5
|
+
export interface Problem {
|
|
6
|
+
kind: ProblemKind;
|
|
7
|
+
messages: string[];
|
|
8
|
+
}
|
|
9
|
+
/** What an action did, or the problem that stopped it. */
|
|
10
|
+
export type Outcome<T> = {
|
|
11
|
+
problem?: undefined;
|
|
12
|
+
value: T;
|
|
13
|
+
} | {
|
|
14
|
+
problem: Problem;
|
|
15
|
+
value?: undefined;
|
|
16
|
+
};
|
|
17
|
+
/** An action refused, of `kind`, with what to tell people. */
|
|
18
|
+
export declare const refused: (kind: ProblemKind, messages: string[]) => {
|
|
19
|
+
problem: Problem;
|
|
20
|
+
value?: undefined;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { youOf } from "../shared/studio-routes.mjs";
|
|
2
|
-
import { prototypePaths, viewFiles } from "../content/prototypes.mjs";
|
|
3
2
|
import { stepsOf } from "../shared/canvas-core.mjs";
|
|
3
|
+
import { prototypePaths, viewFiles } from "../content/prototypes.mjs";
|
|
4
|
+
import { groupWork } from "./work-groups.mjs";
|
|
4
5
|
import { openThreads } from "../content/thread-module.mjs";
|
|
5
6
|
import { currentPerson, identify, joinCurrentPerson, placeViewFrame, readCanvas } from "../content/content.mjs";
|
|
6
|
-
import { groupWork } from "./work-groups.mjs";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
9
9
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
package/dist/server/people.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contributor } from "../
|
|
1
|
+
import { Contributor } from "../shared/studio-files.mjs";
|
|
2
2
|
import { Person } from "../shared/studio-routes.mjs";
|
|
3
3
|
//#region src/server/people.d.ts
|
|
4
4
|
/** What git's log says of each author, by name in lower case. */
|
package/dist/server/port.d.mts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ViteDevServer } from "vite";
|
|
2
2
|
//#region src/server/port.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether anything listens on `port` where `localhost` may reach it, on
|
|
5
|
+
* either address family.
|
|
6
|
+
*/
|
|
7
|
+
export declare function heldOnLocalhost(port: number): Promise<boolean>;
|
|
3
8
|
/** A web app answering on a port, as its manifest says. */
|
|
4
9
|
interface AppOnPort {
|
|
5
10
|
/** Its project, as a Dex names it in PROJECT_ID_HEADER. */
|
|
@@ -17,6 +22,8 @@ export interface PortHolder {
|
|
|
17
22
|
}
|
|
18
23
|
/** The process listening on the port, as lsof names it, where there is lsof. */
|
|
19
24
|
export declare function lsofHolder(port: number): Promise<PortHolder | undefined>;
|
|
25
|
+
/** A Dex on a port that isn't this project's, as a person is told of it. */
|
|
26
|
+
export declare const OTHER_DEX = "another checkout's Dex";
|
|
20
27
|
/** What holds a port `dex dev` wanted. */
|
|
21
28
|
export interface PortTaken {
|
|
22
29
|
/**
|
|
@@ -48,6 +55,11 @@ export interface ListenOptions {
|
|
|
48
55
|
/** The project's root, to tell its own Dex on the port from another's. */
|
|
49
56
|
root?: string;
|
|
50
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The port `server` is served on, once it listens. listenOnPort may have
|
|
60
|
+
* moved it off the configured one.
|
|
61
|
+
*/
|
|
62
|
+
export declare function servedPort(server: ViteDevServer): number;
|
|
51
63
|
/** How many ports past a taken one `dex dev` tries. */
|
|
52
64
|
export declare const MOVE_TRIES = 20;
|
|
53
65
|
/**
|