@1agh/maude 1.8.1 → 1.9.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/apps/studio/acp/bridge.ts +14 -2
- package/apps/studio/acp/probe.ts +51 -1
- package/apps/studio/api.ts +19 -4
- package/apps/studio/bin/_curl-local.mjs +7 -0
- package/apps/studio/bin/annotate.mjs +16 -7
- package/apps/studio/bin/read-annotations.mjs +62 -4
- package/apps/studio/client/app.jsx +428 -15977
- package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
- package/apps/studio/client/dialogs/command-palette.jsx +112 -0
- package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
- package/apps/studio/client/dialogs/help-modal.jsx +324 -0
- package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
- package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
- package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
- package/apps/studio/client/hooks/use-project-data.jsx +90 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
- package/apps/studio/client/hooks/use-tabs.jsx +723 -0
- package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
- package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
- package/apps/studio/client/inspector/color-picker.jsx +196 -0
- package/apps/studio/client/inspector/color.js +92 -0
- package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
- package/apps/studio/client/inspector/css-vocab.jsx +131 -0
- package/apps/studio/client/inspector/ds-tokens.js +90 -0
- package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
- package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
- package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
- package/apps/studio/client/inspector/layers.jsx +322 -0
- package/apps/studio/client/inspector/selection.js +65 -0
- package/apps/studio/client/inspector/token-popover.jsx +301 -0
- package/apps/studio/client/menus/menubar.jsx +856 -0
- package/apps/studio/client/selection-scope.js +40 -0
- package/apps/studio/client/shell/banners.jsx +272 -0
- package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
- package/apps/studio/client/shell/comments-panel.jsx +177 -0
- package/apps/studio/client/shell/constants.js +60 -0
- package/apps/studio/client/shell/dock.jsx +131 -0
- package/apps/studio/client/shell/icons.jsx +370 -0
- package/apps/studio/client/shell/status-bar.jsx +215 -0
- package/apps/studio/client/shell/util.js +332 -0
- package/apps/studio/client/shell/viewport.jsx +254 -0
- package/apps/studio/client/system/system-view.jsx +255 -0
- package/apps/studio/client/tree/tree.jsx +1243 -0
- package/apps/studio/comments-overlay.tsx +6 -4
- package/apps/studio/config.schema.json +5 -0
- package/apps/studio/context.ts +13 -0
- package/apps/studio/dist/client.bundle.js +1337 -1337
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/exporters/_browser-bundles.ts +21 -2
- package/apps/studio/exporters/jobs.ts +75 -15
- package/apps/studio/exporters/scope.ts +15 -12
- package/apps/studio/format.ts +296 -0
- package/apps/studio/http.ts +213 -23
- package/apps/studio/server.ts +118 -29
- package/apps/studio/sync/accepted-link.ts +6 -0
- package/apps/studio/sync/agent.ts +9 -1
- package/apps/studio/sync/cold-start-apply.ts +29 -4
- package/apps/studio/sync/cold-start.ts +78 -0
- package/apps/studio/sync/file-plane.ts +61 -1
- package/apps/studio/sync/format-sync.ts +160 -0
- package/apps/studio/sync/index.ts +134 -10
- package/apps/studio/sync/journal-client.ts +25 -5
- package/apps/studio/sync/migrate-seed.ts +8 -1
- package/apps/studio/sync/status.ts +2 -0
- package/apps/studio/sync/transaction-client.ts +130 -13
- package/apps/studio/ui-prefs.ts +95 -10
- package/apps/studio/whats-new.json +9 -0
- package/apps/studio/ws.ts +19 -4
- package/cli/bin/claude-design-server.mjs +0 -0
- package/package.json +10 -8
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// Project format version — the studio side of V2-1.12 (Gate 0 A17), §5.2/§5.6.
|
|
2
|
+
//
|
|
3
|
+
// One integer per project. `.design/config.json` `formatVersion` (absent = 1)
|
|
4
|
+
// for local, git and Syncthing projects; for a hub-linked project the hub's
|
|
5
|
+
// store is the authority and this Mac mirrors it raise-only in
|
|
6
|
+
// `_state/hub-format.json`. A build EDITS a project only when the project's
|
|
7
|
+
// format equals the format it supports; any other format opens view only.
|
|
8
|
+
//
|
|
9
|
+
// projectFormat = max(config.formatVersion ?? 1, linked ? (hubLive ?? hubCached ?? 1) : 1)
|
|
10
|
+
//
|
|
11
|
+
// This module is pure policy + the one cache file. The lead wires it:
|
|
12
|
+
// http.ts projectReadOnly(req) ||= formatGate(ctx) !== null; the refusal;
|
|
13
|
+
// /_config + formatVersion / formatGate / readOnlyReason
|
|
14
|
+
// context.ts DevServerConfig.formatVersion?: number
|
|
15
|
+
// sync/index.ts noteHubFormat() from /health + the `maude.mode` notice (H1–H5)
|
|
16
|
+
// (see the V2-2.14 hand-back for the exact patch).
|
|
17
|
+
|
|
18
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The format THIS build edits. The v2 branch is 2. The 1.x compatibility
|
|
23
|
+
* release (V2-2.18) cuts this module with 1 — the one-line difference between
|
|
24
|
+
* the two builds' gates. THIS is the 1.x cut: a format-2 project opens view
|
|
25
|
+
* only here ("Update Maude to edit"); a format-1 project stays fully editable.
|
|
26
|
+
*/
|
|
27
|
+
export const SUPPORTED_FORMAT = 1;
|
|
28
|
+
|
|
29
|
+
/** The highest format any build knows of (the hub's 422 `max`). */
|
|
30
|
+
export const MAX_KNOWN_FORMAT = 2;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* In a cloud cell the studio is the hub's own child: the hub writes the mirror
|
|
34
|
+
* itself under this key (V2-1.12 §5.2 — "studio child reads its paired hub"),
|
|
35
|
+
* whether or not the child also runs a paired sync link.
|
|
36
|
+
*/
|
|
37
|
+
export const CELL_SELF_HUB = 'cell:self';
|
|
38
|
+
|
|
39
|
+
/** Which hub's mirror applies to this studio: its own cell hub, the linked hub, or none. */
|
|
40
|
+
export function formatHubUrl(
|
|
41
|
+
ctx: FormatCtx,
|
|
42
|
+
env: Record<string, string | undefined> = process.env
|
|
43
|
+
): string | null {
|
|
44
|
+
if (env.MAUDE_WORKSPACE_MODE === '1') return CELL_SELF_HUB;
|
|
45
|
+
return ctx.cfg.linkedHub?.url ?? null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Design-root-relative cache of the linked hub's format (runtime, DDR-115). */
|
|
49
|
+
export const HUB_FORMAT_REL = path.join('_state', 'hub-format.json');
|
|
50
|
+
|
|
51
|
+
export interface FormatCtx {
|
|
52
|
+
cfg: { formatVersion?: unknown; linkedHub?: { url: string } | null };
|
|
53
|
+
paths: { designRoot: string };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface FormatGate {
|
|
57
|
+
projectFormat: number;
|
|
58
|
+
supported: number;
|
|
59
|
+
source: 'config' | 'hub';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A config value → a format: a positive integer, else 1 (absent = 1). */
|
|
63
|
+
export function asFormat(v: unknown): number {
|
|
64
|
+
return typeof v === 'number' && Number.isInteger(v) && v >= 1 ? v : 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface HubFormatCache {
|
|
68
|
+
hub: string;
|
|
69
|
+
formatVersion: number;
|
|
70
|
+
epoch: number;
|
|
71
|
+
seenAt: string;
|
|
72
|
+
/** SUPPORTED_FORMAT of the build that wrote the record (absent = an older build). */
|
|
73
|
+
writtenBy?: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const normHub = (u: string) => u.replace(/\/+$/, '');
|
|
77
|
+
|
|
78
|
+
/** The cached hub format for THIS link, or null (absent, unreadable, or a
|
|
79
|
+
* cache left by another hub — a relink starts from nothing). */
|
|
80
|
+
export function readHubFormatCache(
|
|
81
|
+
designRoot: string,
|
|
82
|
+
hubUrl: string,
|
|
83
|
+
env: Record<string, string | undefined> = process.env
|
|
84
|
+
): HubFormatCache | null {
|
|
85
|
+
// A cell's own hub keeps the mirror in ITS data dir and points the studio
|
|
86
|
+
// child at it (MAUDE_HUB_FORMAT_FILE) — never inside the tenant's checkout.
|
|
87
|
+
const file =
|
|
88
|
+
hubUrl === CELL_SELF_HUB
|
|
89
|
+
? env.MAUDE_HUB_FORMAT_FILE || null
|
|
90
|
+
: path.join(designRoot, HUB_FORMAT_REL);
|
|
91
|
+
if (!file) return null;
|
|
92
|
+
try {
|
|
93
|
+
const raw = JSON.parse(readFileSync(file, 'utf8')) as Partial<HubFormatCache>;
|
|
94
|
+
if (typeof raw?.hub !== 'string' || normHub(raw.hub) !== normHub(hubUrl)) return null;
|
|
95
|
+
return {
|
|
96
|
+
hub: raw.hub,
|
|
97
|
+
formatVersion: asFormat(raw.formatVersion),
|
|
98
|
+
epoch: typeof raw.epoch === 'number' ? raw.epoch : 0,
|
|
99
|
+
seenAt: typeof raw.seenAt === 'string' ? raw.seenAt : '',
|
|
100
|
+
...(typeof raw.writtenBy === 'number' ? { writtenBy: raw.writtenBy } : {}),
|
|
101
|
+
};
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Record what the hub said (from `/health` or the `maude.mode` notice).
|
|
109
|
+
* RAISE-ONLY per hub (§5.2): a hub can raise the mirrored value, never lower
|
|
110
|
+
* it — only the owner's `maude migrate v2 --reverse` lowers both, and it does
|
|
111
|
+
* that by unflipping the hub (epoch + 1) and calling this with `allowLower`.
|
|
112
|
+
* Returns true when the cached value changed (the caller emits
|
|
113
|
+
* `config-updated` so shells refetch `/_config`).
|
|
114
|
+
*/
|
|
115
|
+
export function noteHubFormat(
|
|
116
|
+
designRoot: string,
|
|
117
|
+
seen: { hub: string; formatVersion: number; epoch?: number },
|
|
118
|
+
opts: { now?: () => Date; allowLower?: boolean } = {}
|
|
119
|
+
): boolean {
|
|
120
|
+
// The cell's mirror belongs to its hub; the child only reads it.
|
|
121
|
+
if (seen.hub === CELL_SELF_HUB) return false;
|
|
122
|
+
const cur = readHubFormatCache(designRoot, seen.hub);
|
|
123
|
+
const next = asFormat(seen.formatVersion);
|
|
124
|
+
if (cur && !opts.allowLower && next <= cur.formatVersion) return false;
|
|
125
|
+
if (cur && cur.formatVersion === next) return false;
|
|
126
|
+
const file = path.join(designRoot, HUB_FORMAT_REL);
|
|
127
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
128
|
+
const rec: HubFormatCache = {
|
|
129
|
+
hub: normHub(seen.hub),
|
|
130
|
+
formatVersion: next,
|
|
131
|
+
epoch: seen.epoch ?? cur?.epoch ?? 0,
|
|
132
|
+
seenAt: (opts.now?.() ?? new Date()).toISOString(),
|
|
133
|
+
// Which build wrote it: a newer build seeing a mirror written by an older
|
|
134
|
+
// one has not seen the flip with its own eyes (§5.9 first sight).
|
|
135
|
+
writtenBy: SUPPORTED_FORMAT,
|
|
136
|
+
};
|
|
137
|
+
writeFileSync(`${file}.tmp`, `${JSON.stringify(rec)}\n`);
|
|
138
|
+
renameSync(`${file}.tmp`, file);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The project's format, and which authority set it. */
|
|
143
|
+
export function projectFormat(
|
|
144
|
+
ctx: FormatCtx,
|
|
145
|
+
live: { hubFormat?: number | null } = {}
|
|
146
|
+
): { value: number; source: 'config' | 'hub' } {
|
|
147
|
+
const fromConfig = asFormat(ctx.cfg.formatVersion);
|
|
148
|
+
const hub = formatHubUrl(ctx);
|
|
149
|
+
if (!hub) return { value: fromConfig, source: 'config' };
|
|
150
|
+
const hubValue =
|
|
151
|
+
typeof live.hubFormat === 'number'
|
|
152
|
+
? asFormat(live.hubFormat)
|
|
153
|
+
: (readHubFormatCache(ctx.paths.designRoot, hub)?.formatVersion ?? 1);
|
|
154
|
+
return hubValue > fromConfig
|
|
155
|
+
? { value: hubValue, source: 'hub' }
|
|
156
|
+
: { value: fromConfig, source: 'config' };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Null when this build may edit the project; else why not. */
|
|
160
|
+
export interface FormatGateOptions {
|
|
161
|
+
supported?: number;
|
|
162
|
+
hubFormat?: number | null;
|
|
163
|
+
/**
|
|
164
|
+
* Gate only projects NEWER than this build (the 1.x direction), and leave
|
|
165
|
+
* older ones editable. The contract's full behaviour (§4.1: v2 opens a
|
|
166
|
+
* format-1 project view only until it is updated) is `false`; `true` is the
|
|
167
|
+
* staged wiring for the branch until the "Update project" dialog and
|
|
168
|
+
* format-2 test sandboxes exist — measured: the full gate turns every
|
|
169
|
+
* existing project and test sandbox view-only (V2-2.14 hand-back).
|
|
170
|
+
*/
|
|
171
|
+
newerOnly?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function formatGate(ctx: FormatCtx, opts: FormatGateOptions = {}): FormatGate | null {
|
|
175
|
+
const supported = opts.supported ?? SUPPORTED_FORMAT;
|
|
176
|
+
const p = projectFormat(ctx, { hubFormat: opts.hubFormat });
|
|
177
|
+
if (p.value === supported) return null;
|
|
178
|
+
if (opts.newerOnly && p.value < supported) return null;
|
|
179
|
+
return { projectFormat: p.value, supported, source: p.source };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** CONTRACT §4 voice; "Update Maude to edit" is the signed A17 wording (§5.8). */
|
|
183
|
+
export const FORMAT_COPY = {
|
|
184
|
+
/** A newer project in an older build — the 1.x refusal text. */
|
|
185
|
+
newerRefusal: 'This project now uses Maude 2. Update Maude to edit it.',
|
|
186
|
+
newerBanner: "This project now uses Maude 2. It's open here to look at — nothing in it is lost.",
|
|
187
|
+
newerBannerAction: 'Update Maude to edit',
|
|
188
|
+
newerBannerNoBuild:
|
|
189
|
+
"This project now uses Maude 2, which isn't out yet. It stays open here to look at.",
|
|
190
|
+
newerCloudTab: "This project now uses Maude 2. It's open here to look at.",
|
|
191
|
+
newerCanvas: 'This canvas uses Maude 2. Update Maude to see it.',
|
|
192
|
+
/** An older project in v2 — view only until it is updated. */
|
|
193
|
+
olderStatus: 'View only — this project still uses Maude 1.',
|
|
194
|
+
olderStatusAction: 'Update project',
|
|
195
|
+
olderNonOwner: "View only — the owner hasn't updated this project for Maude 2 yet.",
|
|
196
|
+
olderHubTooOld:
|
|
197
|
+
'View only — the team server needs an update before this project can move to Maude 2.',
|
|
198
|
+
olderOwnerOffline:
|
|
199
|
+
'View only — updating the project needs the team server, and this Mac is offline.',
|
|
200
|
+
dialogTitle: (projectName: string) => `Update "${projectName}" for Maude 2?`,
|
|
201
|
+
dialogBody:
|
|
202
|
+
"People still on Maude 1 can look at it but can't change it until they update. Nothing in the project is lost.",
|
|
203
|
+
dialogAction: 'Update project',
|
|
204
|
+
toastUpdated: 'Updated for Maude 2. People on Maude 1 can look but not edit.',
|
|
205
|
+
} as const;
|
|
206
|
+
|
|
207
|
+
/** The line a refusal carries, by direction. */
|
|
208
|
+
export function gateMessage(gate: FormatGate): string {
|
|
209
|
+
return gate.projectFormat > gate.supported ? FORMAT_COPY.newerRefusal : FORMAT_COPY.olderStatus;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** §5.6 — the studio's 403 for a write while gated (NOT 426: that is the
|
|
213
|
+
* hub's door; a studio refusal must read like the read-only one, plus why). */
|
|
214
|
+
export function formatRefusalResponse(gate: FormatGate): Response {
|
|
215
|
+
return Response.json(
|
|
216
|
+
{
|
|
217
|
+
error: 'read-only',
|
|
218
|
+
reason: 'read-only',
|
|
219
|
+
detail: 'format',
|
|
220
|
+
formatVersion: gate.projectFormat,
|
|
221
|
+
message: gateMessage(gate),
|
|
222
|
+
},
|
|
223
|
+
{ status: 403, headers: { 'Cache-Control': 'no-store' } }
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The format-gate allowlist (§5.6): what a read-only session may write
|
|
229
|
+
* (per-user runtime, export/download, reports, link/sign-in/sign-out) MINUS
|
|
230
|
+
* comments (§9 Q3 — v2 anchors may grow and 1.x re-clamps them: look only),
|
|
231
|
+
* PLUS the one route that leaves the gate: `POST /_api/project/migrate`.
|
|
232
|
+
*/
|
|
233
|
+
export const FORMAT_GATE_REFUSED_WRITES: ReadonlySet<string> = new Set(['/_comments']);
|
|
234
|
+
export const FORMAT_GATE_REFUSED_PATTERNS: readonly RegExp[] = [
|
|
235
|
+
/^\/_api\/comments\/[A-Za-z0-9_-]+\/reply$/,
|
|
236
|
+
];
|
|
237
|
+
export const FORMAT_GATE_EXTRA_WRITES: ReadonlySet<string> = new Set(['/_api/project/migrate']);
|
|
238
|
+
|
|
239
|
+
export function formatGateAllowsWrite(
|
|
240
|
+
pathname: string,
|
|
241
|
+
readOnlyAllowed: { exact: ReadonlySet<string>; patterns: readonly RegExp[] }
|
|
242
|
+
): boolean {
|
|
243
|
+
if (FORMAT_GATE_EXTRA_WRITES.has(pathname)) return true;
|
|
244
|
+
if (FORMAT_GATE_REFUSED_WRITES.has(pathname)) return false;
|
|
245
|
+
if (FORMAT_GATE_REFUSED_PATTERNS.some((re) => re.test(pathname))) return false;
|
|
246
|
+
return (
|
|
247
|
+
readOnlyAllowed.exact.has(pathname) || readOnlyAllowed.patterns.some((re) => re.test(pathname))
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The gate options the studio runs with today — STAGED (V2-2.14): only a
|
|
253
|
+
* project NEWER than this build is gated. `http.ts` and the sync runtime both
|
|
254
|
+
* pass this constant (test/format-sync.test.ts pins it).
|
|
255
|
+
*/
|
|
256
|
+
export const STAGED_FORMAT_GATE_OPTS: FormatGateOptions = { newerOnly: true };
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* A canvas build that failed because the canvas imports a `@maude/canvas-lib`
|
|
260
|
+
* export this build does not have — the shape of "this canvas uses a Maude 2
|
|
261
|
+
* feature" (V2-1.12 §5.3: v2 canvas-lib exports; 1.x maps it to a line).
|
|
262
|
+
*/
|
|
263
|
+
export function isMissingCanvasLibExport(message: string): boolean {
|
|
264
|
+
return /No matching export in "[^"]*canvas-lib[^"]*" for import/.test(message);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* §5.8 — the line a gated project's canvas build error leads with when the
|
|
269
|
+
* canvas needs a newer canvas-lib; null otherwise (the raw error stands alone).
|
|
270
|
+
*/
|
|
271
|
+
export function canvasFormatLine(message: string, gate: FormatGate | null): string | null {
|
|
272
|
+
if (!gate || gate.projectFormat <= gate.supported) return null;
|
|
273
|
+
return isMissingCanvasLibExport(message) ? FORMAT_COPY.newerCanvas : null;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** The `/_config` additions (§5.6). `roleReadOnly` = the existing role gate. */
|
|
277
|
+
export function formatConfigFields(
|
|
278
|
+
ctx: FormatCtx,
|
|
279
|
+
roleReadOnly: boolean,
|
|
280
|
+
opts: FormatGateOptions = {}
|
|
281
|
+
): {
|
|
282
|
+
formatVersion: number;
|
|
283
|
+
formatGate: FormatGate | null;
|
|
284
|
+
readOnly: boolean;
|
|
285
|
+
readOnlyReason: 'role' | 'format' | null;
|
|
286
|
+
} {
|
|
287
|
+
const gate = formatGate(ctx, opts);
|
|
288
|
+
return {
|
|
289
|
+
formatVersion: projectFormat(ctx, { hubFormat: opts.hubFormat }).value,
|
|
290
|
+
formatGate: gate,
|
|
291
|
+
readOnly: roleReadOnly || gate !== null,
|
|
292
|
+
// The role is the stronger statement (it survives an update), so it names
|
|
293
|
+
// the reason when both hold.
|
|
294
|
+
readOnlyReason: roleReadOnly ? 'role' : gate ? 'format' : null,
|
|
295
|
+
};
|
|
296
|
+
}
|
package/apps/studio/http.ts
CHANGED
|
@@ -53,6 +53,14 @@ import type { ActiveJsonShape } from './exporters/scope.ts';
|
|
|
53
53
|
import { createFigmaEndpoints } from './figma/endpoints.ts';
|
|
54
54
|
import { generatedClipAnalysis } from './footage/schema.ts';
|
|
55
55
|
import { createFootageStore, FOOTAGE_MAX_BYTES } from './footage-store.ts';
|
|
56
|
+
import {
|
|
57
|
+
canvasFormatLine,
|
|
58
|
+
formatGate,
|
|
59
|
+
formatGateAllowsWrite,
|
|
60
|
+
formatRefusalResponse,
|
|
61
|
+
projectFormat,
|
|
62
|
+
STAGED_FORMAT_GATE_OPTS,
|
|
63
|
+
} from './format.ts';
|
|
56
64
|
import {
|
|
57
65
|
type AudioMatch,
|
|
58
66
|
type Candidate,
|
|
@@ -299,8 +307,18 @@ export function cspForCanvasShell(
|
|
|
299
307
|
}
|
|
300
308
|
|
|
301
309
|
/**
|
|
302
|
-
* CSP for
|
|
303
|
-
*
|
|
310
|
+
* CSP for a main-origin CAPTURE render (DDR-148 security, attacker F1).
|
|
311
|
+
*
|
|
312
|
+
* V2-2.8 S9: while the origin split is on, captures no longer render on the
|
|
313
|
+
* main origin at all — the main origin 307s them to the read-only capture
|
|
314
|
+
* origin, which serves the strict canvas CSP (`cspForCanvasShell`, DDR-232).
|
|
315
|
+
* This policy now applies only where a capture still renders on the main
|
|
316
|
+
* origin: with the split OFF (`MAUDE_CANVAS_ORIGIN_SPLIT=0`). (Maude's own
|
|
317
|
+
* local `_draw/` / `_photo/` harnesses stay on the main origin too, but only
|
|
318
|
+
* as bare `?canvas=` requests — one carrying `hide-chrome` is redirected.)
|
|
319
|
+
*
|
|
320
|
+
* Original rationale: the export rendered the (untrusted, DDR-054) canvas on
|
|
321
|
+
* the MAIN origin — where the normal
|
|
304
322
|
* shell CSP is env-gated off — and the capture shim ACTIVELY primes+seeks every
|
|
305
323
|
* `<video>`, so a canvas with `<Video src="http://169.254.169.254/…">` or comp
|
|
306
324
|
* JS doing `fetch(internal)` would turn ⌘E into read-SSRF + exfil-via-artifact.
|
|
@@ -682,6 +700,20 @@ export interface ServeCanvasTestHooks {
|
|
|
682
700
|
afterRead?: () => void | Promise<void>;
|
|
683
701
|
}
|
|
684
702
|
|
|
703
|
+
/**
|
|
704
|
+
* A canvas that failed to build. V2-1.12 §5.8: in a project newer than this
|
|
705
|
+
* build, a canvas importing a `@maude/canvas-lib` export this build lacks says
|
|
706
|
+
* so first ("This canvas uses Maude 2. Update Maude to see it.").
|
|
707
|
+
*/
|
|
708
|
+
function canvasBuildErrorResponse(err: unknown, ctx: Context): Response {
|
|
709
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
710
|
+
const line = canvasFormatLine(msg, formatGate(ctx, STAGED_FORMAT_GATE_OPTS));
|
|
711
|
+
return new Response(`Canvas build error: ${line ? `${line}\n\n` : ''}${msg}`, {
|
|
712
|
+
status: 500,
|
|
713
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
685
717
|
export async function serveCanvasTsx(
|
|
686
718
|
absPath: string,
|
|
687
719
|
req: Request,
|
|
@@ -779,11 +811,7 @@ export async function serveCanvasTsx(
|
|
|
779
811
|
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
780
812
|
});
|
|
781
813
|
}
|
|
782
|
-
|
|
783
|
-
return new Response(`Canvas build error: ${msg}`, {
|
|
784
|
-
status: 500,
|
|
785
|
-
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
786
|
-
});
|
|
814
|
+
return canvasBuildErrorResponse(err, ctx);
|
|
787
815
|
}
|
|
788
816
|
// The signature against the freshly-parsed deps — this very edit may have
|
|
789
817
|
// added or removed a `.css` import — stamped before the build (above).
|
|
@@ -1002,11 +1030,7 @@ async function serveHistoricalCanvas(
|
|
|
1002
1030
|
if (oldest !== undefined) historicalCanvasCache.delete(oldest);
|
|
1003
1031
|
}
|
|
1004
1032
|
} catch (err) {
|
|
1005
|
-
|
|
1006
|
-
return new Response(`Canvas build error: ${msg}`, {
|
|
1007
|
-
status: 500,
|
|
1008
|
-
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
1009
|
-
});
|
|
1033
|
+
return canvasBuildErrorResponse(err, ctx);
|
|
1010
1034
|
}
|
|
1011
1035
|
}
|
|
1012
1036
|
if (req.headers.get('if-none-match') === cached.etag) {
|
|
@@ -1222,8 +1246,38 @@ async function serveMediaFile(
|
|
|
1222
1246
|
return new Response(file, { headers: base });
|
|
1223
1247
|
}
|
|
1224
1248
|
|
|
1249
|
+
/**
|
|
1250
|
+
* V2-2.8 S6 — the committer list as the UNTRUSTED canvas origin (DDR-054) may
|
|
1251
|
+
* see it: names and commit counts, NO e-mail field. The in-canvas comment
|
|
1252
|
+
* composer only needs a name to suggest and insert `@firstname`; the trusted
|
|
1253
|
+
* shell keeps the full `git shortlog -sne` rows on the main origin. A name that
|
|
1254
|
+
* is itself an address keeps only the part before `@`, and rows that collapse
|
|
1255
|
+
* to one name merge (git keys a committer by name AND e-mail).
|
|
1256
|
+
* Decision `v2-2.8-s6-committers-projection` — a deliberate deviation from
|
|
1257
|
+
* V2-1.16 L15/L17 ("remove the route"): the feature stays, the leak goes.
|
|
1258
|
+
*/
|
|
1259
|
+
export function canvasCommitters(
|
|
1260
|
+
rows: ReadonlyArray<{ name: string; commits: number }>
|
|
1261
|
+
): Array<{ name: string; commits: number }> {
|
|
1262
|
+
const byName = new Map<string, number>();
|
|
1263
|
+
for (const row of rows) {
|
|
1264
|
+
const name = (String(row?.name ?? '').split('@')[0] ?? '').trim();
|
|
1265
|
+
if (!name) continue;
|
|
1266
|
+
byName.set(name, (byName.get(name) ?? 0) + (Number(row.commits) || 0));
|
|
1267
|
+
}
|
|
1268
|
+
return [...byName]
|
|
1269
|
+
.map(([name, commits]) => ({ name, commits }))
|
|
1270
|
+
.sort((a, b) => b.commits - a.commits);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1225
1273
|
export interface Http {
|
|
1226
1274
|
routes: Record<string, (req: Request) => Response | Promise<Response>>;
|
|
1275
|
+
/**
|
|
1276
|
+
* V2-2.8 S6 — handlers the canvas origins mount INSTEAD of the main-origin
|
|
1277
|
+
* one at the same path, because they answer a narrower projection
|
|
1278
|
+
* (server.ts `startCanvasServer` routes map). Same path, same allowlists.
|
|
1279
|
+
*/
|
|
1280
|
+
canvasRoutes: Record<'/_api/git-committers', (req: Request) => Response | Promise<Response>>;
|
|
1227
1281
|
fetch(req: Request): Promise<Response>;
|
|
1228
1282
|
/**
|
|
1229
1283
|
* T2 (9.1-A) — build the canvas mount-harness response. `applyCsp` adds the
|
|
@@ -1585,6 +1639,19 @@ export function createHttp(
|
|
|
1585
1639
|
};
|
|
1586
1640
|
}
|
|
1587
1641
|
|
|
1642
|
+
// V2-1.12 §5.6 — the format gate, STAGED: `newerOnly: true` gates only a
|
|
1643
|
+
// project newer than this build. One constant in format.ts, so the sync
|
|
1644
|
+
// runtime (sync/format-sync.ts) can never disagree with this gate.
|
|
1645
|
+
// (V2-2.18 1.x compat cut: the outbox and `maude migrate v2` route tables
|
|
1646
|
+
// of V2-2.14/V2-2.16 are v2-only and are not mounted here — a 1.x build
|
|
1647
|
+
// has no "Update project".)
|
|
1648
|
+
const gateNow = () => formatGate(ctx, STAGED_FORMAT_GATE_OPTS);
|
|
1649
|
+
/** What a read-only session may still write (the module allowlist). */
|
|
1650
|
+
const readOnlyAllowed = {
|
|
1651
|
+
exact: READ_ONLY_ALLOWED_WRITES as ReadonlySet<string>,
|
|
1652
|
+
patterns: READ_ONLY_ALLOWED_WRITE_PATTERNS as readonly RegExp[],
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1588
1655
|
const routes = {
|
|
1589
1656
|
'/_health': () =>
|
|
1590
1657
|
Response.json({
|
|
@@ -1811,6 +1878,12 @@ export function createHttp(
|
|
|
1811
1878
|
.replace(/[^a-z0-9_-]/gi, '')
|
|
1812
1879
|
.slice(0, 64);
|
|
1813
1880
|
if (req.method === 'DELETE') {
|
|
1881
|
+
// V2-2.8 S2 — the same CSRF + loopback gate as PATCH below. Ungated, a
|
|
1882
|
+
// blind cross-site DELETE (or a DNS-rebound page) erased a transcript.
|
|
1883
|
+
if (!sameOriginWrite(req))
|
|
1884
|
+
return new Response('cross-origin write rejected', { status: 403 });
|
|
1885
|
+
if (!isTrustedRequestHost(req))
|
|
1886
|
+
return new Response('local request required (DNS-rebinding guard)', { status: 403 });
|
|
1814
1887
|
const removed = id ? deleteChat(ctx.paths.designRoot, id) : false;
|
|
1815
1888
|
return Response.json({ ok: removed }, { headers: { 'Cache-Control': 'no-store' } });
|
|
1816
1889
|
}
|
|
@@ -1955,7 +2028,14 @@ export function createHttp(
|
|
|
1955
2028
|
Response.json({
|
|
1956
2029
|
...ctx.cfg,
|
|
1957
2030
|
canvasOrigin: ctx.canvasOrigin,
|
|
2031
|
+
// V2-1.12 §5.6 — readOnly is the role OR the format gate
|
|
2032
|
+
// (projectReadOnly covers both); the client shows WHY, and
|
|
2033
|
+
// `formatGate` drives the banner. Named one by one: the client
|
|
2034
|
+
// projection names every computed field (config-projection.test.ts).
|
|
1958
2035
|
readOnly: projectReadOnly(req),
|
|
2036
|
+
formatVersion: projectFormat(ctx).value,
|
|
2037
|
+
formatGate: gateNow(),
|
|
2038
|
+
readOnlyReason: roleReadOnly(req) ? 'role' : gateNow() ? 'format' : null,
|
|
1959
2039
|
// DDR-247 — the apps allowed to frame this studio for `?embed=1`. The
|
|
1960
2040
|
// embed view posts its status ONLY to a parent on this list, never to
|
|
1961
2041
|
// '*'. Public already: the same origins ride in the page's CSP header.
|
|
@@ -2197,8 +2277,15 @@ export function createHttp(
|
|
|
2197
2277
|
);
|
|
2198
2278
|
},
|
|
2199
2279
|
|
|
2200
|
-
|
|
2201
|
-
|
|
2280
|
+
// V2-2.8 S7 — the proxy-vouched role decides whether the Runtime group
|
|
2281
|
+
// (other members' session files) is listed; a desktop has no role.
|
|
2282
|
+
'/_index-data': async (req: Request) =>
|
|
2283
|
+
Response.json(
|
|
2284
|
+
await api.buildIndexData({
|
|
2285
|
+
role: isWorkspaceMode() ? req.headers.get('x-maude-role') : null,
|
|
2286
|
+
}),
|
|
2287
|
+
{ headers: { 'Cache-Control': 'no-store' } }
|
|
2288
|
+
),
|
|
2202
2289
|
|
|
2203
2290
|
'/_system-data': async (req: Request) => {
|
|
2204
2291
|
// DDR-048 — `?ds=<name>` scopes to one design system (per-DS tokens,
|
|
@@ -2251,7 +2338,7 @@ export function createHttp(
|
|
|
2251
2338
|
// `.meta.json`, so a read-only session is refused here, in-handler,
|
|
2252
2339
|
// where the two lanes are distinguishable.
|
|
2253
2340
|
if (projectReadOnly(req) && 'layout' in body.patch) {
|
|
2254
|
-
return
|
|
2341
|
+
return readOnlyRefusalFor(req);
|
|
2255
2342
|
}
|
|
2256
2343
|
const next = await api.patchCanvasMeta(body.file, body.patch);
|
|
2257
2344
|
if (!next) return new Response('Not found or rejected', { status: 404 });
|
|
@@ -5930,10 +6017,18 @@ export function createHttp(
|
|
|
5930
6017
|
// Query parameter ?canvas=<path-relative-to-designRoot> tells the shell
|
|
5931
6018
|
// which canvas to import + mount. See plugins/design/templates/_shell.html.
|
|
5932
6019
|
if (pathname === '/_canvas-shell.html' || pathname === '/_canvas-shell') {
|
|
6020
|
+
// V2-2.8 S9 (V2-1.16 L21) — only the MAIN listener reaches this branch
|
|
6021
|
+
// (the canvas and capture listeners answer the shell themselves, in
|
|
6022
|
+
// server.ts). While the split is on, every request here goes to the
|
|
6023
|
+
// read-only capture origin, bar Maude's own local harnesses (see
|
|
6024
|
+
// captureRedirect) — so what follows serves only those, and every
|
|
6025
|
+
// shell when the split is OFF.
|
|
6026
|
+
const toCapture = captureRedirect(req, url);
|
|
6027
|
+
if (toCapture) return toCapture;
|
|
5933
6028
|
// The segregated canvas origin (server.ts) calls serveCanvasShell(true)
|
|
5934
6029
|
// directly with CSP always on; on the legacy main origin the CSP stays
|
|
5935
6030
|
// env-gated (MAUDE_CSP_POC) for the POC / backwards-compat. A capture
|
|
5936
|
-
// render (?hide-chrome=1
|
|
6031
|
+
// render (?hide-chrome=1) that still lands here ALWAYS gets the
|
|
5937
6032
|
// network-locked capture CSP so it can't SSRF/exfil (attacker F1).
|
|
5938
6033
|
const capture = url.searchParams.get('hide-chrome') === '1';
|
|
5939
6034
|
return serveCanvasShell(process.env.MAUDE_CSP_POC === '1', capture);
|
|
@@ -6148,6 +6243,62 @@ export function createHttp(
|
|
|
6148
6243
|
});
|
|
6149
6244
|
}
|
|
6150
6245
|
|
|
6246
|
+
/**
|
|
6247
|
+
* V2-2.8 S9 (V2-1.16 L21, decision `v2-2.8-read-only-capture-origin`) —
|
|
6248
|
+
* headless renders (⌘E export via `canvasShellUrl`, `maude design
|
|
6249
|
+
* screenshot`, smoke, perf, canvas-rects, visual-sanity, older CLIs) load the
|
|
6250
|
+
* shell from the MAIN origin, where tenant canvas code (DDR-054) is
|
|
6251
|
+
* same-origin with every privileged route and passes `sameOriginWrite` +
|
|
6252
|
+
* `isTrustedRequestHost`. While the split is on, every such request gets a
|
|
6253
|
+
* 307 to the read-only capture origin (server.ts
|
|
6254
|
+
* `startCanvasServer(0, { capture: true })`) — same
|
|
6255
|
+
* route table, GET/HEAD only, no upgrades, strict CSP; the capture origin's
|
|
6256
|
+
* own `isCanvasSafeRoute` door then refuses whatever it must not serve.
|
|
6257
|
+
*
|
|
6258
|
+
* FAIL CLOSED: every main-origin shell request redirects. The shell builds
|
|
6259
|
+
* its module URL from the REQUEST's `designRel` + `canvas` (and loads
|
|
6260
|
+
* `tokens`/`components`/`layout`/`sha` too), so predicting which module a
|
|
6261
|
+
* URL will load and redirecting "only the dangerous ones" fails open on any
|
|
6262
|
+
* input the prediction misreads (V2-2.8 security review).
|
|
6263
|
+
*
|
|
6264
|
+
* The ONE exception (a named residual): Maude's own local harnesses, matched
|
|
6265
|
+
* exactly — `maude design draw-proof` (`_draw/<slug>.proof.tsx`) and
|
|
6266
|
+
* `photo-bg-remove` (`_photo/<slug>.bgremove.tsx`), with no parameter beyond
|
|
6267
|
+
* `canvas` and the server's own `designRel`. They live under DDR-115
|
|
6268
|
+
* runtime dirs the canvas-safe table refuses, and are generated on this
|
|
6269
|
+
* machine (never synced), so they keep rendering here exactly as before —
|
|
6270
|
+
* but only when the helper itself navigated there: Fetch Metadata `none`
|
|
6271
|
+
* (a browser-initiated `goto`/`open`) or absent (a non-browser client). A
|
|
6272
|
+
* page — another site, or a canvas on the canvas origin (same-site) —
|
|
6273
|
+
* steering a browser to a leftover harness URL is redirected like the rest.
|
|
6274
|
+
* Nothing is redirected when the split is off or in a cell (no capture
|
|
6275
|
+
* listener; a cell's proxy never routes the main-origin shell).
|
|
6276
|
+
*/
|
|
6277
|
+
const LOCAL_HARNESS =
|
|
6278
|
+
/^_(?:draw\/[a-z0-9_][a-z0-9._-]*\.proof|photo\/[a-z0-9_][a-z0-9._-]*\.bgremove)\.tsx$/;
|
|
6279
|
+
function isLocalHarness(req: Request, url: URL): boolean {
|
|
6280
|
+
const site = req.headers.get('sec-fetch-site');
|
|
6281
|
+
if (site !== null && site !== 'none') return false;
|
|
6282
|
+
const params = [...url.searchParams.keys()];
|
|
6283
|
+
if (params.some((k) => k !== 'canvas' && k !== 'designRel')) return false;
|
|
6284
|
+
const canvases = url.searchParams.getAll('canvas');
|
|
6285
|
+
if (canvases.length !== 1 || !LOCAL_HARNESS.test(canvases[0] ?? '')) return false;
|
|
6286
|
+
const own = ctx.paths.designRel.replace(/^\/+|\/+$/g, '');
|
|
6287
|
+
const asked = url.searchParams.getAll('designRel');
|
|
6288
|
+
return asked.length === 0 || (asked.length === 1 && asked[0] === own);
|
|
6289
|
+
}
|
|
6290
|
+
function captureRedirect(req: Request, url: URL): Response | null {
|
|
6291
|
+
if (!ctx.captureOrigin) return null;
|
|
6292
|
+
if (isLocalHarness(req, url)) return null;
|
|
6293
|
+
return new Response(null, {
|
|
6294
|
+
status: 307,
|
|
6295
|
+
headers: {
|
|
6296
|
+
Location: `${ctx.captureOrigin}/_canvas-shell.html${url.search}`,
|
|
6297
|
+
'Cache-Control': 'no-store',
|
|
6298
|
+
},
|
|
6299
|
+
});
|
|
6300
|
+
}
|
|
6301
|
+
|
|
6151
6302
|
async function serveCanvasShell(applyCsp: boolean, capture = false): Promise<Response> {
|
|
6152
6303
|
// `comment-mount.js` is versioned for the same reason as the studio page's
|
|
6153
6304
|
// bundle (see `serveIndexHtml`): a fixed URL outlives a release in any
|
|
@@ -6225,7 +6376,7 @@ export function createHttp(
|
|
|
6225
6376
|
'/_api/asset/chunk',
|
|
6226
6377
|
'/_api/asset/chunk-finish',
|
|
6227
6378
|
'/_api/photo-edit', // feature-photo-editor — PhotoEdit sidecar GET/PUT (cap-stack gated). MIRROR in server.ts routes.
|
|
6228
|
-
'/_api/git-committers', // @mention autocomplete
|
|
6379
|
+
'/_api/git-committers', // @mention autocomplete — a no-e-mail projection here (V2-2.8 S6)
|
|
6229
6380
|
'/_api/ai', // AI-activity banner
|
|
6230
6381
|
'/_comments', // per-file comment list (renders pins)
|
|
6231
6382
|
]);
|
|
@@ -6313,7 +6464,7 @@ export function createHttp(
|
|
|
6313
6464
|
// covers all three doors at once: the main-origin `routes` table, the
|
|
6314
6465
|
// canvas-origin `routes` allowlist in server.ts (it references these same
|
|
6315
6466
|
// handlers), and the dynamic-path `fetch` fall-through (comment replies).
|
|
6316
|
-
function
|
|
6467
|
+
function roleReadOnly(req?: Request): boolean {
|
|
6317
6468
|
// ---- Cloud Phase 27 A3/A4 (DDR-209): the role is PER SESSION ----------
|
|
6318
6469
|
//
|
|
6319
6470
|
// In a cell this process serves an owner and a viewer at the same time, so
|
|
@@ -6332,20 +6483,44 @@ export function createHttp(
|
|
|
6332
6483
|
return ctx.cfg.linkedHub ? isHubReadOnly(ctx.cfg.linkedHub.url) : false;
|
|
6333
6484
|
}
|
|
6334
6485
|
|
|
6486
|
+
/**
|
|
6487
|
+
* V2-1.12 §5.6 — read-only for the ROLE, or because this build does not
|
|
6488
|
+
* edit this project's FORMAT (format.ts `formatGate`: a 1.x build on a
|
|
6489
|
+
* format-2 project). Every in-handler `projectReadOnly` check therefore
|
|
6490
|
+
* covers both.
|
|
6491
|
+
*/
|
|
6492
|
+
function projectReadOnly(req?: Request): boolean {
|
|
6493
|
+
return roleReadOnly(req) || gateNow() !== null;
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6496
|
+
/** The refusal an in-handler check answers with: the format copy when the
|
|
6497
|
+
* format is the only reason, else the role copy. */
|
|
6498
|
+
function readOnlyRefusalFor(req: Request): Response {
|
|
6499
|
+
const gate = roleReadOnly(req) ? null : gateNow();
|
|
6500
|
+
return gate ? formatRefusalResponse(gate) : readOnlyRefusalResponse();
|
|
6501
|
+
}
|
|
6502
|
+
|
|
6335
6503
|
function readOnlyRefusal(req: Request): Response | null {
|
|
6336
6504
|
if (READ_ONLY_SAFE_METHODS.has(req.method)) return null;
|
|
6337
|
-
|
|
6505
|
+
const role = roleReadOnly(req);
|
|
6506
|
+
const gate = gateNow();
|
|
6507
|
+
if (!role && !gate) return null;
|
|
6338
6508
|
let pathname: string;
|
|
6339
6509
|
try {
|
|
6340
6510
|
pathname = new URL(req.url).pathname;
|
|
6341
6511
|
} catch {
|
|
6342
|
-
return
|
|
6512
|
+
return readOnlyRefusalFor(req);
|
|
6343
6513
|
}
|
|
6344
|
-
|
|
6514
|
+
// The format gate: per-user runtime, export, reports and sign-in still
|
|
6515
|
+
// work; comments are look-only (V2-1.12 §9 Q3).
|
|
6516
|
+
if (gate && !formatGateAllowsWrite(pathname, readOnlyAllowed))
|
|
6517
|
+
return formatRefusalResponse(gate);
|
|
6518
|
+
if (!role) return null;
|
|
6519
|
+
if (readOnlyAllowed.exact.has(pathname)) return null;
|
|
6345
6520
|
// The dynamic half of the comment lane. An exact-match set cannot express
|
|
6346
6521
|
// it, and leaving it out would mean a viewer may leave a comment but not
|
|
6347
6522
|
// reply to one — a distinction nobody promised and nobody wants.
|
|
6348
|
-
if (
|
|
6523
|
+
if (readOnlyAllowed.patterns.some((re) => re.test(pathname))) return null;
|
|
6349
6524
|
return readOnlyRefusalResponse();
|
|
6350
6525
|
}
|
|
6351
6526
|
|
|
@@ -6360,5 +6535,20 @@ export function createHttp(
|
|
|
6360
6535
|
return readOnlyRefusal(req) ?? handleFallthrough(req);
|
|
6361
6536
|
}
|
|
6362
6537
|
|
|
6363
|
-
|
|
6538
|
+
const canvasRoutes: Http['canvasRoutes'] = {
|
|
6539
|
+
// V2-2.8 S6 — the @mention feed without e-mails (see canvasCommitters).
|
|
6540
|
+
'/_api/git-committers': async (req: Request) => {
|
|
6541
|
+
if (req.method !== 'GET') return new Response('Method not allowed', { status: 405 });
|
|
6542
|
+
const committers = canvasCommitters(await api.gitCommitters());
|
|
6543
|
+
return Response.json({ committers }, { headers: { 'Cache-Control': 'no-store' } });
|
|
6544
|
+
},
|
|
6545
|
+
};
|
|
6546
|
+
|
|
6547
|
+
return {
|
|
6548
|
+
routes: guardedRoutes,
|
|
6549
|
+
canvasRoutes,
|
|
6550
|
+
fetch: guardedFetch,
|
|
6551
|
+
serveCanvasShell,
|
|
6552
|
+
isCanvasSafeRoute,
|
|
6553
|
+
};
|
|
6364
6554
|
}
|