Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Hub: an author edits their publication in place; the keynote starter shows its artwork (#1293)

Jacob Pham96018ab38c29
diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma
index 69df56af3..083764ac0 100644
--- a/backend/prisma/schema.prisma
+++ b/backend/prisma/schema.prisma
@@ -26,6 +26,8 @@ model CommunityHarness {
credits Json @default("[]")
deletedAt DateTime?
createdAt DateTime @default(now())
+ // Set when its author edits it (routes/communityEdit.ts); never on publishing.
+ updatedAt DateTime?
@@index([autonomousEnv, deletedAt, createdAt])
@@index([autonomousEnv, authorId])
diff --git a/backend/src/lib/communityFeed.ts b/backend/src/lib/communityFeed.ts
index f4f3d7038..6fffef2be 100644
--- a/backend/src/lib/communityFeed.ts
+++ b/backend/src/lib/communityFeed.ts
@@ -4,7 +4,7 @@ export const feedSorts = ['newest', 'popular'] as const
export type FeedSort = typeof feedSorts[number]
/** What a feed card reads: never the files or the cover's bytes. */
-const feedSelect = { id: true, title: true, description: true, category: true, engine: true, harnessId: true, authorId: true, authorName: true, forkedFrom: true, createdAt: true } as const
+const feedSelect = { id: true, title: true, description: true, category: true, engine: true, harnessId: true, authorId: true, authorName: true, forkedFrom: true, createdAt: true, updatedAt: true } as const
const feedPageSize = 30
type FeedWhere = NonNullable<Parameters<typeof prisma.communityHarness.findMany>[0]>['where']
diff --git a/backend/src/routes/community.test.ts b/backend/src/routes/community.test.ts
index 1a451d4e3..6aa3a481f 100644
--- a/backend/src/routes/community.test.ts
+++ b/backend/src/routes/community.test.ts
@@ -54,6 +54,7 @@ const db = vi.hoisted(() => {
})
vi.mock('../lib/prisma.js', () => ({ prisma: db }))
import { communityRoutes, publicationSchema } from './community.js'
+import { communityEditRoutes, resetEditRateLimits } from './communityEdit.js'
import { registerAuthMiddleware } from '../middlewares/authMiddleware.js'
import { errorHandler } from '../middlewares/errorHandler.js'
import { communityStarters, isPublicCommunityRead } from '../lib/communityAccess.js'
@@ -71,13 +72,13 @@ async function publish(token = 'alice', payload = sample, env = 'prod') {
}
beforeEach(async () => {
for (const model of [db.communityHarness, db.communityLike, db.communityComment, db.communityFollow]) model.rows.splice(0)
- vi.clearAllMocks()
+ vi.clearAllMocks(); resetEditRateLimits()
app = Fastify(); app.setErrorHandler(errorHandler)
registerAuthMiddleware(app, async (token, autonomousEnv = 'prod') => {
if (!['alice', 'bob'].includes(token)) throw new Error('Invalid token')
return { sub: token, email: `${token}@example.com`, role: 'user', autonomousEnv }
})
- await app.register(communityRoutes); await app.ready()
+ await app.register(communityRoutes); await app.register(communityEditRoutes); await app.ready()
})
afterEach(async () => app.close())
@@ -114,6 +115,31 @@ describe('publications and access', () => {
// Bounded: a small body that would inflate past the snapshot is refused, not unpacked.
expect((await send(gzipSync(Buffer.alloc(7_000_000, 32)))).statusCode).toBe(400)
})
+ it('lets the author edit a publication in place, keeping its address, likes, origin and cover', async () => {
+ const cover = 'data:image/png;base64,' + Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).toString('base64')
+ const original = await publish('bob', { ...sample, title: 'Original' })
+ const id = await publish('alice', { ...sample, forkedFrom: original, cover } as typeof sample)
+ await call('PUT', `harnesses/${id}/like`, 'bob', { liked: true })
+ const { confirmed, license, ...rest } = sample
+ const edit = { ...rest, title: 'TANK 1987', files: [{ path: 'tank/index.html', content: '<canvas></canvas><script>go()</script>' }], viewerPath: 'tank/index.html', confirmed, license }
+ expect((await call('PUT', `harnesses/${id}`, 'alice', edit)).statusCode).toBe(200)
+ const read = (await call('GET', `harnesses/${id}`, 'alice')).json().data
+ expect(read.harness).toMatchObject({ id, title: 'TANK 1987', viewerPath: 'tank/index.html', forkedFrom: original })
+ expect(read.harness.cover).toMatch(new RegExp(`^/api/community/harnesses/${id}/cover\\?v=\\d+$`))
+ expect(read.social.likes).toBe(1)
+ expect(db.communityHarness.rows).toHaveLength(2)
+ })
+ it('refuses an edit by anyone but the author, of a starter, or that changes where it came from', async () => {
+ const id = await publish('alice')
+ const { confirmed, license, ...rest } = sample
+ const edit = { ...rest, title: 'Mine now', confirmed, license }
+ expect((await call('PUT', `harnesses/${id}`, 'bob', edit)).statusCode).toBe(403)
+ expect((await call('PUT', `harnesses/${id}`, undefined, edit)).statusCode).toBe(401)
+ expect((await call('PUT', `harnesses/${starter}`, 'alice', edit)).statusCode).toBe(400)
+ expect((await call('PUT', `harnesses/${id}`, 'alice', { ...edit, forkedFrom: starter })).statusCode).toBe(400)
+ expect((await call('PUT', `harnesses/${id}`, 'alice', { ...edit, viewerPath: 'missing.html' })).statusCode).toBe(400)
+ expect((await call('GET', `harnesses/${id}`)).json().data.harness.title).toBe(sample.title)
+ })
it('returns the same publication after a lost-response retry', async () => {
const payload = { ...sample, clientId: crypto.randomUUID() }
const first = await publish('alice', payload)
diff --git a/backend/src/routes/community.ts b/backend/src/routes/community.ts
index 1148b8ff1..660c7c238 100644
--- a/backend/src/routes/community.ts
+++ b/backend/src/routes/community.ts
@@ -23,10 +23,14 @@ export function coverImage(value: string): { type: string; bytes: Buffer } | nul
return valid ? { type: `image/${match[1]}`, bytes } : null
}
-/** Readers get a cover's address, never its bytes: a feed page would otherwise carry every image inline. */
-function withCoverPath<T extends { id: string; cover: string | null }>(row: T): Omit<T, 'cover'> & { cover?: string } {
+/**
+ * Readers get a cover's address, never its bytes: a feed page would otherwise carry every image inline.
+ * The address names the version, since the website caches a cover for a day and an edit can change it.
+ */
+function withCoverPath<T extends { id: string; cover: string | null; updatedAt?: Date | null }>(row: T): Omit<T, 'cover'> & { cover?: string } {
const { cover, ...rest } = row
- return { ...rest, ...(cover ? { cover: `/api/community/harnesses/${row.id}/cover` } : {}) }
+ const version = row.updatedAt ? `?v=${row.updatedAt.getTime()}` : ''
+ return { ...rest, ...(cover ? { cover: `/api/community/harnesses/${row.id}/cover${version}` } : {}) }
}
const searchMaxChars = 80
/** The fields a reader searches by. TODO(BE): an unanchored match scans the environment's publications; move to an Atlas Search index once the feed outgrows that. */
@@ -48,7 +52,7 @@ const file = z.object({
encoding: z.literal('base64').optional(),
}).strict()
-export const publicationSchema = z.object({
+const publicationFields = z.object({
title: z.string().trim().min(1).max(100),
description: z.string().trim().min(1).max(300),
category: z.enum(communityCategories),
@@ -62,7 +66,11 @@ export const publicationSchema = z.object({
clientId: z.string().uuid().optional(),
license: z.literal('MIT'),
confirmed: z.literal(true),
-}).strict().superRefine((value, ctx) => {
+})
+type Snapshot = Pick<z.infer<typeof publicationFields>, 'files' | 'viewerPath' | 'harnessId'>
+
+/** What every published snapshot must hold, new or edited. */
+function checkSnapshot(value: Snapshot, ctx: z.RefinementCtx): void {
for (const file of value.files) {
if (file.encoding && (!/^[A-Za-z0-9+/]*={0,2}$/.test(file.content) || file.content.length % 4 !== 0)) ctx.addIssue({ code: 'custom', message: 'Invalid binary file encoding.' })
const lower = file.path.toLowerCase();
@@ -76,9 +84,17 @@ export const publicationSchema = z.object({
if (marker && !value.files.some(file => file.path === marker && !file.encoding)) ctx.addIssue({ code: 'custom', message: 'Include the harness project source.' })
if (Buffer.byteLength(JSON.stringify(value)) > communityLimits.snapshotBytes)
ctx.addIssue({ code: 'custom', message: 'Keep the published snapshot under 6 MB.' })
-})
+}
+
+export const publicationSchema = publicationFields.strict().superRefine(checkSnapshot)
+
+/**
+ * An edit replaces what a publication shows; where it came from (`forkedFrom`, its credits) stays
+ * as it was published. A cover left out keeps the one it has.
+ */
+export const publicationEditSchema = publicationFields.omit({ forkedFrom: true, clientId: true }).strict().superRefine(checkSnapshot)
-function environment(req: FastifyRequest): string {
+export function environment(req: FastifyRequest): string {
try { return req.user?.autonomousEnv ?? parseAutonomousEnvironment(req.headers['x-autonomous-env']) }
catch { throw new ValidationError('Invalid Autonomous environment') }
}
@@ -162,7 +178,7 @@ export async function communityRoutes(app: FastifyInstance): Promise<void> {
})
})
- // What a reader's page refreshes: the publication itself never changes after it is published.
+ // What a reader's page refreshes: the publication itself changes only when its author edits it.
app.get<{ Params: z.infer<typeof params> }>('/api/community/harnesses/:id/social', { preHandler: validateParams(params) }, async (req, reply) => {
const autonomousEnv = environment(req)
const post = await publication(req.params.id, autonomousEnv)
diff --git a/backend/src/routes/communityEdit.ts b/backend/src/routes/communityEdit.ts
new file mode 100644
index 000000000..f4e2cc836
--- /dev/null
+++ b/backend/src/routes/communityEdit.ts
@@ -0,0 +1,36 @@
+/**
+ * PUT /api/community/harnesses/:id SSO access token, the publication's author → { id }
+ *
+ * An author replaces what their publication shows (its output, source, conversation and details) in
+ * place: the same address, likes, comments and forks. Forks already made keep their own copy. Where it
+ * came from (`forkedFrom`, credits) stays as published, and a cover left out keeps the one it has.
+ */
+import type { FastifyInstance } from 'fastify'
+import { z } from 'zod'
+import { prisma } from '../lib/prisma.js'
+import { acceptGzipJson } from '../lib/gzipJson.js'
+import { createWindowLimiter } from '../lib/windowLimiter.js'
+import { validateBody, validateParams } from '../middlewares/validation.js'
+import { sendError, sendSuccess } from '../utils/response.js'
+import { environment, publicationEditSchema } from './community.js'
+
+const params = z.object({ id: z.string().uuid() })
+const limiter = createWindowLimiter(10 * 60_000, 20)
+export const resetEditRateLimits = (): void => limiter.reset()
+
+export async function communityEditRoutes(app: FastifyInstance): Promise<void> {
+ acceptGzipJson(app, 6_100_000)
+ app.put<{ Params: z.infer<typeof params>; Body: z.infer<typeof publicationEditSchema> }>('/api/community/harnesses/:id', { bodyLimit: 6_100_000, preHandler: [validateParams(params), validateBody(publicationEditSchema)] }, async (req, reply) => {
+ const autonomousEnv = environment(req), userId = req.user!.sub
+ const post = await prisma.communityHarness.findFirst({ where: { id: req.params.id, autonomousEnv, deletedAt: null }, select: { authorId: true } })
+ if (!post) return sendError(reply, 'This harness is unavailable.', 'NOT_FOUND', 404)
+ if (post.authorId !== userId) return sendError(reply, 'Only its author can edit this harness.', 'FORBIDDEN', 403)
+ if (!limiter.allows(userId)) return sendError(reply, 'Please wait before saving again.', 'RATE_LIMITED', 429)
+ const { confirmed: _confirmed, license: _license, cover, harnessId, ...snapshot } = req.body
+ await prisma.communityHarness.updateMany({
+ where: { id: req.params.id, autonomousEnv, authorId: userId, deletedAt: null },
+ data: { ...snapshot, harnessId: harnessId ?? null, ...(cover ? { cover } : {}), updatedAt: new Date() },
+ })
+ sendSuccess(reply, { id: req.params.id })
+ })
+}
diff --git a/backend/src/server.ts b/backend/src/server.ts
index 8965ac95b..1eb3ebf6c 100644
--- a/backend/src/server.ts
+++ b/backend/src/server.ts
@@ -13,6 +13,7 @@ import { harnessShareRoutes } from './routes/harnessShares.js'
import { harnessLinkRoutes } from './routes/harnessLinks.js'
import { communityRoutes } from './routes/community.js'
import { communityTranslateRoutes } from './routes/communityTranslate.js'
+import { communityEditRoutes } from './routes/communityEdit.js'
import { deviceKeyRoutes } from './routes/deviceKeys.js'
import { qrSignInRoutes } from './routes/qrSignIn.js'
import { deskRoutes } from './routes/desk.js'
@@ -178,6 +179,7 @@ async function start(): Promise<void> {
await app.register(harnessShareRoutes)
await app.register(harnessLinkRoutes)
await app.register(communityRoutes)
+ await app.register(communityEditRoutes) // an author edits their publication in place
await app.register(communityTranslateRoutes) // a Hub draft's words in English, for its author to review
await app.register(qrSignInRoutes) // sign a computer in by scanning its QR with a signed-in phone
await app.register(deviceKeyRoutes) // the account's device key log: signing in is what trusts a device
diff --git a/website/README.md b/website/README.md
index f96b0f7c2..05a25be3a 100644
--- a/website/README.md
+++ b/website/README.md
@@ -136,7 +136,11 @@ off the draft as a `draft.json.gz` file, `communityRequest` sends every body as
the proxy forwards those bytes unchanged, and the backend unpacks them (bounded) before validating
(`backend/src/lib/gzipJson.ts`). Plain JSON bodies and an older Desktop's text field still work.
-Backend reads are public; likes, comments, following, publication, and unpublication require SSO.
+Backend reads are public; likes, comments, following, publication, editing, and unpublication require SSO.
+An author edits a publication in place (`PUT /api/community/harnesses/:id`): **Edit this harness** on
+its page opens `/hub/publish?edit=<id>`, and a draft arriving from Desktop can choose **Publish as →
+Update "…"**. The address, likes, comments and forks stay; forks keep the version they copied; where it
+came from (`forkedFrom`, credits) and its cover (unless a new one is chosen) stay as published.
Counts are persisted, like/follow writes are idempotent, comment retries have per-user request IDs,
replies retain their parent and display a Creator badge,
and authors can remove their publication and moderate its comments. Reads and writes are isolated
diff --git a/website/public/open-harnesses/harness-keynote/index.html b/website/public/open-harnesses/harness-keynote/index.html
index edf4f17fb..d58e078af 100644
--- a/website/public/open-harnesses/harness-keynote/index.html
+++ b/website/public/open-harnesses/harness-keynote/index.html
@@ -1,6 +1,5 @@
<!doctype html><html><head><style>div.marpit > svg > foreignObject > section{width:1280px;height:720px;box-sizing:border-box;overflow:hidden;position:relative;scroll-snap-align:center center;-webkit-text-size-adjust:100%;text-size-adjust:100%}div.marpit > svg > foreignObject > section::after{bottom:0;content:attr(data-marpit-pagination);padding:inherit;pointer-events:none;position:absolute;right:0}div.marpit > svg > foreignObject > section:not([data-marpit-pagination])::after{display:none}div.marpit > svg > foreignObject > section :where(:is(h1, marp-h1)){font-size:2em;margin-block:0.67em}div.marpit > svg > foreignObject > section section:where(:is(h1, marp-h1)){--marpit-root-font-size: 2em;}div.marpit > svg > foreignObject > section video::-webkit-media-controls{will-change:transform}@page {size:1280px 720px;margin:0}@media print{html, body{background-color:#fff;margin:0;page-break-inside:avoid;break-inside:avoid-page}div.marpit > svg > foreignObject > section{page-break-before:always;break-before:page}div.marpit > svg > foreignObject > section, div.marpit > svg > foreignObject > section *{-webkit-print-color-adjust:exact!important;animation-delay:0s!important;animation-duration:0s!important;color-adjust:exact!important;print-color-adjust:exact!important;transition:none!important}div.marpit > svg[data-marpit-svg]{display:block;height:100vh;width:100vw}}div.marpit > svg > foreignObject > :where(section){container-type:size}div.marpit > svg > foreignObject > section img[data-marp-twemoji]{background:transparent;height:1em;margin:0 .05em 0 .1em;vertical-align:-.1em;width:1em}div.marpit > svg > foreignObject > section{width:1280px;height:720px;padding:88px 112px;background:#000;color:#f5f5f7;font-family:-apple-system, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;font-size:34px;font-weight:400;line-height:1.3;letter-spacing:-0.01em;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;text-align:left;-webkit-font-smoothing:antialiased}div.marpit > svg > foreignObject > section{--marpit-root-font-size: 34px;}div.marpit > svg > foreignObject > section::after{color:#6e6e73;font-size:15px;font-weight:500;letter-spacing:0;right:40px;bottom:28px}div.marpit > svg > foreignObject > section::after{--marpit-root-font-size: 15px;}div.marpit > svg > foreignObject > section :is(h1, marp-h1), div.marpit > svg > foreignObject > section :is(h2, marp-h2), div.marpit > svg > foreignObject > section :is(h3, marp-h3), div.marpit > svg > foreignObject > section :is(h4, marp-h4){margin:0;font-weight:700;letter-spacing:-0.03em}div.marpit > svg > foreignObject > section :is(h1, marp-h1){font-size:112px;line-height:1.0;margin-bottom:28px}div.marpit > svg > foreignObject > section :is(h2, marp-h2){font-size:68px;line-height:1.05;font-weight:600;letter-spacing:-0.025em;margin-bottom:22px}div.marpit > svg > foreignObject > section :is(h3, marp-h3){font-size:40px;line-height:1.15;font-weight:600;letter-spacing:-0.02em;color:#f5f5f7;margin-bottom:14px}div.marpit > svg > foreignObject > section p{margin:0 0 18px;color:#d2d2d7;max-width:26ch}div.marpit > svg > foreignObject > section strong{color:#fff;font-weight:600}div.marpit > svg > foreignObject > section em{color:#a1a1a6;font-style:normal}div.marpit > svg > foreignObject > section a{color:#2997ff;text-decoration:none}div.marpit > svg > foreignObject > section code{font-family:"SF Mono", Menlo, monospace;font-size:0.85em;background:#1d1d1f;padding:2px 10px;border-radius:8px;color:#f5f5f7}div.marpit > svg > foreignObject > section :is(pre, marp-pre){background:#1d1d1f;border-radius:16px;padding:28px 32px;font-size:24px;line-height:1.4}div.marpit > svg > foreignObject > section :is(pre, marp-pre) code{background:none;padding:0}div.marpit > svg > foreignObject > section img{border-radius:18px}div.marpit > svg > foreignObject > section ul, div.marpit > svg > foreignObject > section ol{margin:8px 0 0;padding:0;list-style:none}div.marpit > svg > foreignObject > section li{font-size:40px;font-weight:500;color:#f5f5f7;letter-spacing:-0.02em;line-height:1.2;padding:14px 0;border-top:1px solid #2a2a2e}div.marpit > svg > foreignObject > section li:first-child{border-top:none}div.marpit > svg > foreignObject > section li::marker{content:""}div.marpit > svg > foreignObject > section blockquote{margin:0;padding:0;border:none}div.marpit > svg > foreignObject > section hr{display:none}div.marpit > svg > foreignObject > section table{border-collapse:collapse;font-size:28px}div.marpit > svg > foreignObject > section th, div.marpit > svg > foreignObject > section td{padding:14px 28px 14px 0;border-bottom:1px solid #2a2a2e;text-align:left}div.marpit > svg > foreignObject > section th{color:#a1a1a6;font-weight:500}div.marpit > svg > foreignObject > section :is(h4, marp-h4){font-size:20px;font-weight:600;letter-spacing:0.12em;text-transform:uppercase;color:#a1a1a6;margin-bottom:26px}div.marpit > svg > foreignObject > section.hero{align-items:center;text-align:center}div.marpit > svg > foreignObject > section.hero :is(h1, marp-h1){font-size:132px;text-shadow:0 4px 40px rgba(0, 0, 0, 0.35)}div.marpit > svg > foreignObject > section.hero p{max-width:34ch;font-size:40px;color:rgba(245, 245, 247, 0.82);margin-top:8px;text-shadow:0 2px 24px rgba(0, 0, 0, 0.35)}div.marpit > svg > foreignObject > section.hero::after{display:none}div.marpit > svg > foreignObject > section.statement :is(h1, marp-h1), div.marpit > svg > foreignObject > section.statement :is(h2, marp-h2){font-size:92px;line-height:1.02;letter-spacing:-0.035em;max-width:14ch}div.marpit > svg > foreignObject > section.statement p{font-size:40px;color:#a1a1a6;max-width:30ch}div.marpit > svg > foreignObject > section.number{align-items:center;text-align:center}div.marpit > svg > foreignObject > section.number :is(h1, marp-h1){font-size:300px;line-height:0.95;letter-spacing:-0.06em;font-weight:700;background:linear-gradient(135deg, #f5f5f7 0%, #a1a1a6 100%);-webkit-background-clip:text;background-clip:text;color:transparent;margin-bottom:20px}div.marpit > svg > foreignObject > section.number p{font-size:44px;color:#f5f5f7;max-width:30ch}div.marpit > svg > foreignObject > section.quote blockquote p{font-size:60px;font-weight:500;line-height:1.12;letter-spacing:-0.025em;color:#f5f5f7;max-width:22ch}div.marpit > svg > foreignObject > section.quote blockquote p::before{content:"\201C";color:#6e6e73}div.marpit > svg > foreignObject > section.quote blockquote p::after{content:"\201D";color:#6e6e73}div.marpit > svg > foreignObject > section.quote p:last-child:not(blockquote p){font-size:26px;color:#a1a1a6}div.marpit > svg > foreignObject > section.pillars{justify-content:center}div.marpit > svg > foreignObject > section.pillars :is(h1, marp-h1), div.marpit > svg > foreignObject > section.pillars :is(h2, marp-h2):first-of-type{margin-bottom:44px}div.marpit > svg > foreignObject > section.pillars .columns{display:grid;grid-template-columns:repeat(3, 1fr);gap:56px;width:100%}div.marpit > svg > foreignObject > section.pillars .columns :is(h3, marp-h3){font-size:44px;margin-bottom:10px}div.marpit > svg > foreignObject > section.pillars .columns p{font-size:30px;line-height:1.3;color:#a1a1a6;max-width:none}div.marpit > svg > foreignObject > section.section{justify-content:center}div.marpit > svg > foreignObject > section.section :is(h1, marp-h1){font-size:104px}div.marpit > svg > foreignObject > section.image{padding:0;justify-content:flex-end}div.marpit > svg > foreignObject > section.image img{width:100%;height:100%;object-fit:cover;border-radius:0}div.marpit > svg > foreignObject > section.image p{position:absolute;left:64px;bottom:48px;font-size:24px;color:#f5f5f7;max-width:40ch;text-shadow:0 2px 24px rgba(0,0,0,.6)}div.marpit > svg > foreignObject > section.image::after{display:none}div.marpit > svg > foreignObject > section.closing, div.marpit > svg > foreignObject > section.omt{align-items:center;text-align:center}div.marpit > svg > foreignObject > section.closing :is(h1, marp-h1){font-size:96px}div.marpit > svg > foreignObject > section.omt :is(h1, marp-h1){font-size:120px;font-weight:600;letter-spacing:-0.04em}div.marpit > svg > foreignObject > section.omt::after, div.marpit > svg > foreignObject > section.closing::after{display:none}div.marpit > svg > foreignObject > section.chart{text-align:center}div.marpit > svg > foreignObject > section.chart :is(h2, marp-h2){font-size:48px;margin-bottom:24px}div.marpit > svg > foreignObject > section.chart img{width:100%;max-height:480px;object-fit:contain}div.marpit > svg > foreignObject > section.chart p{max-width:none}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"]{columns:initial!important;display:block!important;padding:0!important}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"]::before, div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"]::after, div.marpit > svg > foreignObject > section[data-marpit-advanced-background="content"]::before, div.marpit > svg > foreignObject > section[data-marpit-advanced-background="content"]::after{display:none!important}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction="vertical"]{flex-direction:column}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"][data-marpit-advanced-background-split] > div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split, 50%)}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"][data-marpit-advanced-background-split="right"] > div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container] > figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="background"] > div[data-marpit-advanced-background-container] > figure > figcaption{position:absolute;border:0;clip:rect(0, 0, 0, 0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="content"], div.marpit > svg > foreignObject > section[data-marpit-advanced-background="pseudo"]{background:transparent!important}div.marpit > svg > foreignObject > section[data-marpit-advanced-background="pseudo"], div.marpit > svg[data-marpit-svg] > foreignObject[data-marpit-advanced-background="pseudo"]{pointer-events:none!important}div.marpit > svg > foreignObject > section[data-marpit-advanced-background-split]{width:100%;height:100%}
- body{margin:0;background:#090909}svg[data-marpit-svg]{display:none;width:100%;height:calc(100vh - 62px)}svg[data-marpit-svg].active{display:block}nav{height:62px;display:flex;align-items:center;justify-content:center;gap:30px;color:#aaa;font:12px Arial}button{border:0;background:transparent;color:#eee;cursor:pointer;padding:14px}</style></head><body><div class="marpit"><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="1" data-paginate="true" data-class="hero" data-theme="keynote-dark" class="hero" data-marpit-pagination="1" style="--paginate:true;--class:hero;--theme:keynote-dark;" data-marpit-pagination-total="7">
-<p>![bg](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIHZpZXdCb3g9IjAgMCAxOTIwIDEwODAiPgo8ZGVmcz4KICA8ZmlsdGVyIGlkPSJibHVyIiB4PSItMzAlIiB5PSItMzAlIiB3aWR0aD0iMTYwJSIgaGVpZ2h0PSIxNjAlIj48ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIxMTkiLz48L2ZpbHRlcj4KICA8cmFkaWFsR3JhZGllbnQgaWQ9InZpZyIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzIlIj48c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzAwMCIgc3RvcC1vcGFjaXR5PSIwIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMDAwIiBzdG9wLW9wYWNpdHk9IjAuODUiLz48L3JhZGlhbEdyYWRpZW50PgogIDxmaWx0ZXIgaWQ9ImdyYWluIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC45IiBudW1PY3RhdmVzPSIyIiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjxmZUNvbXBvbmVudFRyYW5zZmVyPjxmZU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1vcGFjaXR5PSIwLjU4IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzkgODkzIDIwMSkiLz48L2c+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbGw9InVybCgjdmlnKSIvPgo8cmVjdCB3aWR0aD0iMTkyMCIgaGVpZ2h0PSIxMDgwIiBmaWx0ZXI9InVybCgjZ3JhaW4pIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+Cg==)</p>
+ body{margin:0;background:#090909}svg[data-marpit-svg]{display:none;width:100%;height:calc(100vh - 62px)}svg[data-marpit-svg].active{display:block}nav{height:62px;display:flex;align-items:center;justify-content:center;gap:30px;color:#aaa;font:12px Arial}button{border:0;background:transparent;color:#eee;cursor:pointer;padding:14px}</style></head><body><div class="marpit"><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="1" data-paginate="true" data-class="hero" data-theme="keynote-dark" class="hero" data-marpit-pagination="1" style="--paginate:true;--class:hero;--theme:keynote-dark;background-image:url(&quot;data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIHZpZXdCb3g9IjAgMCAxOTIwIDEwODAiPgo8ZGVmcz4KICA8ZmlsdGVyIGlkPSJibHVyIiB4PSItMzAlIiB5PSItMzAlIiB3aWR0aD0iMTYwJSIgaGVpZ2h0PSIxNjAlIj48ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIxMTkiLz48L2ZpbHRlcj4KICA8cmFkaWFsR3JhZGllbnQgaWQ9InZpZyIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzIlIj48c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzAwMCIgc3RvcC1vcGFjaXR5PSIwIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMDAwIiBzdG9w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RyYW5zZm9ybT0icm90YXRlKDE3IDkyMCA4NDQpIi8+PGVsbGlwc2UgY3g9IjE0NzMiIGN5PSI0MTciIHJ4PSI0MjEiIHJ5PSI1MzQiIGZpbGw9IiMwYTg0ZmYiIGZpbGwtb3BhY2l0eT0iMC42OSIgdHJhbnNmb3JtPSJyb3RhdGUoMjIgMTQ3MyA0MTcpIi8+PGVsbGlwc2UgY3g9Ijg5MyIgY3k9IjIwMSIgcng9IjM5NCIgcnk9IjQyNiIgZmlsbD0iI2JmNWFmMiIgZmlsbC1vcGFjaXR5PSIwLjU4IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzkgODkzIDIwMSkiLz48L2c+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbGw9InVybCgjdmlnKSIvPgo8cmVjdCB3aWR0aD0iMTkyMCIgaGVpZ2h0PSIxMDgwIiBmaWx0ZXI9InVybCgjZ3JhaW4pIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+Cg==&quot;);background-position:center;background-repeat:no-repeat;background-size:cover;" data-marpit-pagination-total="7">
<h1 id="the-harness-store">The Harness Store.</h1>
<p>A studio for anything you can describe.</p>
</section>
@@ -8,8 +7,7 @@
<h1 id="every-new-project-starts-in-an-empty-folder">Every new project starts in an empty folder.</h1>
<p>Then an afternoon of setup.</p>
</section>
-</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="3" data-paginate="true" data-class="section" data-theme="keynote-dark" class="section" data-marpit-pagination="3" style="--paginate:true;--class:section;--theme:keynote-dark;" data-marpit-pagination-total="7">
-<p>![bg](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIHZpZXdCb3g9IjAgMCAxOTIwIDEwODAiPgo8ZGVmcz4KICA8ZmlsdGVyIGlkPSJibHVyIiB4PSItMzAlIiB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5PSIwLjcwIiB0cmFuc2Zvcm09InJvdGF0ZSg0MiA1ODggNzIzKSIvPjxlbGxpcHNlIGN4PSIzMTciIGN5PSI3NzkiIHJ4PSI0NTUiIHJ5PSIzMDkiIGZpbGw9IiNmZmQ2MGEiIGZpbGwtb3BhY2l0eT0iMC43NSIgdHJhbnNmb3JtPSJyb3RhdGUoNDEgMzE3IDc3OSkiLz48ZWxsaXBzZSBjeD0iNTc4IiBjeT0iMTQzIiByeD0iNTIzIiByeT0iMzg1IiBmaWxsPSIjMzBkMTU4IiBmaWxsLW9wYWNpdHk9IjAuODIiIHRyYW5zZm9ybT0icm90YXRlKDE0NyA1NzggMTQzKSIvPjxlbGxpcHNlIGN4PSIxMjg2IiBjeT0iNDc3IiByeD0iNjcwIiByeT0iMzE1IiBmaWxsPSIjMGE4NGZmIiBmaWxsLW9wYWNpdHk9IjAuNjUiIHRyYW5zZm9ybT0icm90YXRlKDE0IDEyODYgNDc3KSIvPjxlbGxpcHNlIGN4PSIxNTEwIiBjeT0iNjE4IiByeD0iNTY4IiByeT0iMzM2IiBmaWxsPSIjYmY1YWYyIiBmaWxsLW9wYWNpdHk9IjAuODAiIHRyYW5zZm9ybT0icm90YXRlKDI0IDE1MTAgNjE4KSIvPjwvZz4KPHJlY3Qgd2lkdGg9IjE5MjAiIGhlaWdodD0iMTA4MCIgZmlsbD0idXJsKCN2aWcpIi8+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbHRlcj0idXJsKCNncmFpbikiIG9wYWNpdHk9IjAuNSIvPgo8L3N2Zz4K)</p>
+</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="3" data-paginate="true" data-class="section" data-theme="keynote-dark" class="section" data-marpit-pagination="3" style="--paginate:true;--class:section;--theme:keynote-dark;background-image:url(&quot;data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZ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4IDU2OCA0MjMpIi8+PGVsbGlwc2UgY3g9IjU4OCIgY3k9IjcyMyIgcng9IjQzNCIgcnk9IjUxMSIgZmlsbD0iI2ZmOWYwYSIgZmlsbC1vcGFjaXR5PSIwLjcwIiB0cmFuc2Zvcm09InJvdGF0ZSg0MiA1ODggNzIzKSIvPjxlbGxpcHNlIGN4PSIzMTciIGN5PSI3NzkiIHJ4PSI0NTUiIHJ5PSIzMDkiIGZpbGw9IiNmZmQ2MGEiIGZpbGwtb3BhY2l0eT0iMC43NSIgdHJhbnNmb3JtPSJyb3RhdGUoNDEgMzE3IDc3OSkiLz48ZWxsaXBzZSBjeD0iNTc4IiBjeT0iMTQzIiByeD0iNTIzIiByeT0iMzg1IiBmaWxsPSIjMzBkMTU4IiBmaWxsLW9wYWNpdHk9IjAuODIiIHRyYW5zZm9ybT0icm90YXRlKDE0NyA1NzggMTQzKSIvPjxlbGxpcHNlIGN4PSIxMjg2IiBjeT0iNDc3IiByeD0iNjcwIiByeT0iMzE1IiBmaWxsPSIjMGE4NGZmIiBmaWxsLW9wYWNpdHk9IjAuNjUiIHRyYW5zZm9ybT0icm90YXRlKDE0IDEyODYgNDc3KSIvPjxlbGxpcHNlIGN4PSIxNTEwIiBjeT0iNjE4IiByeD0iNTY4IiByeT0iMzM2IiBmaWxsPSIjYmY1YWYyIiBmaWxsLW9wYWNpdHk9IjAuODAiIHRyYW5zZm9ybT0icm90YXRlKDI0IDE1MTAgNjE4KSIvPjwvZz4KPHJlY3Qgd2lkdGg9IjE5MjAiIGhlaWdodD0iMTA4MCIgZmlsbD0idXJsKCN2aWcpIi8+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbHRlcj0idXJsKCNncmFpbikiIG9wYWNpdHk9IjAuNSIvPgo8L3N2Zz4K&quot;);background-position:center;background-repeat:no-repeat;background-size:cover;" data-marpit-pagination-total="7">
<h1 id="start-where-the-experts-left-off">Start where the experts left off.</h1>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="4" data-paginate="true" data-class="statement" data-theme="keynote-dark" class="statement" data-marpit-pagination="4" style="--paginate:true;--class:statement;--theme:keynote-dark;" data-marpit-pagination-total="7">
@@ -38,8 +36,7 @@
</div>
</div>
</section>
-</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="7" data-class="hero" data-theme="keynote-dark" class="hero" style="--class:hero;--theme:keynote-dark;">
-<p>![bg](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIHZpZXdCb3g9IjAgMCAxOTIwIDEwODAiPgo8ZGVmcz4KICA8ZmlsdGVyIGlkPSJibHVyIiB4PSItMzAlIiB5PSItMzAlIiB3aWR0aD0iMTYwJSIgaGVpZ2h0PSIxNjAlIj48ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIxMTkiLz48L2ZpbHRlcj4KICA8cmFkaWFsR3JhZGllbnQgaWQ9InZpZyIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzIlIj48c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzAwMCIgc3RvcC1vcGFjaXR5PSIwIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMDAwIiBzdG9wLW9wYWNpdHk9IjAuODUiLz48L3JhZGlhbEdyYWRpZW50PgogIDxmaWx0ZXIgaWQ9ImdyYWluIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC45IiBudW1PY3RhdmVzPSIyIiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjxmZUNvbXBvbmVudFRyY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WFmMiIgZmlsbC1vcGFjaXR5PSIwLjU4IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzkgODkzIDIwMSkiLz48L2c+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbGw9InVybCgjdmlnKSIvPgo8cmVjdCB3aWR0aD0iMTkyMCIgaGVpZ2h0PSIxMDgwIiBmaWx0ZXI9InVybCgjZ3JhaW4pIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+Cg==)</p>
+</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="7" data-class="hero" data-theme="keynote-dark" class="hero" style="--class:hero;--theme:keynote-dark;background-image:url(&quot;data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIHZpZXdCb3g9IjAgMCAxOTIwIDEwODAiPgo8ZGVmcz4KICA8ZmlsdGVyIGlkPSJibHVyIiB4PSItMzAlIiB5PSItMzAlIiB3aWR0aD0iMTYwJSIgaGVpZ2h0PSIxNjAlIj48ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIxMTkiLz48L2ZpbHRlcj4KICA8cmFkaWFsR3JhZGllbnQgaWQ9InZpZyIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzIlIj48c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzAwMCIgc3RvcC1vcGFjaXR5PSIwIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMDAwIiBzdG9wLW9wYWNpdHk9IjAuODUiLz48L3JhZGlhbEdyYWRpZW50PgogIDxmaWx0ZXIgaWQ9ImdyYWluIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC45IiBudW1PY3RhdmVzPSIyIiBzdGl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3RhdGUoMjIgMTQ3MyA0MTcpIi8+PGVsbGlwc2UgY3g9Ijg5MyIgY3k9IjIwMSIgcng9IjM5NCIgcnk9IjQyNiIgZmlsbD0iI2JmNWFmMiIgZmlsbC1vcGFjaXR5PSIwLjU4IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzkgODkzIDIwMSkiLz48L2c+CjxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjEwODAiIGZpbGw9InVybCgjdmlnKSIvPgo8cmVjdCB3aWR0aD0iMTkyMCIgaGVpZ2h0PSIxMDgwIiBmaWx0ZXI9InVybCgjZ3JhaW4pIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+Cg==&quot;);background-position:center;background-repeat:no-repeat;background-size:cover;">
<h1 id="go-make-something">Go make something.</h1>
<p>The Harness Store.</p>
</section>
diff --git a/website/src/app/hub/community.module.css b/website/src/app/hub/community.module.css
index ea4ab650b..69fb25b89 100644
--- a/website/src/app/hub/community.module.css
+++ b/website/src/app/hub/community.module.css
@@ -114,8 +114,8 @@
.check{display:flex;gap:11px;align-items:flex-start;color:#777;font-size:13px;line-height:1.7;margin:25px 0}
.check input{margin-top:5px;accent-color:#242424}
.loading{padding:70px 0;color:#777}
-.manage{margin-top:38px;font-size:12px;color:#777}
-.manage button{text-decoration:underline;text-underline-offset:3px}
+.manage{margin-top:38px;font-size:12px;color:#777;display:flex;gap:20px;flex-wrap:wrap}
+.manage button,.manage a{text-decoration:underline;text-underline-offset:3px}
@media(min-width:1900px){.viewer iframe{height:780px}}
@media(max-width:1100px){.wrap{width:90%}.nav{gap:20px}.barActions{gap:18px}.chat{padding-left:22px}.actions{gap:13px}.identity h1{font-size:22px}.viewer iframe{height:640px}}
@media(max-width:760px){.wrap{width:92%}.feed{padding-top:22px}.grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:44px 14px}.split{grid-template-columns:1fr;gap:28px;min-height:0}.chat{padding:0}.detail{padding-top:16px;padding-bottom:50px}.back{margin-bottom:14px}.detailHead{flex-wrap:wrap;gap:16px;margin-bottom:22px}.actions{margin-left:auto}.viewer iframe{height:590px}.forkColumns,.publishForm{grid-template-columns:1fr;gap:25px}.fork h1,.publish h1{font-size:32px}.page input,.page textarea,.page select{font-size:16px}}
diff --git a/website/src/app/hub/components/Detail.tsx b/website/src/app/hub/components/Detail.tsx
index 9f9713134..390a0046d 100644
--- a/website/src/app/hub/components/Detail.tsx
+++ b/website/src/app/hub/components/Detail.tsx
@@ -28,6 +28,6 @@ export default function Detail({ id, initial, initialComments = false }: { id: s
onClose={() => setPanel('log')} onRetry={() => void page.load()} onRemove={comment => void page.removeComment(comment)} onPost={page.postComment} />
</div>
{!!social.forks && <Forks id={id} count={social.forks} />}
- {social.mine && <div className={styles.manage}><button disabled={busy} onClick={unpublish}>Unpublish this harness</button></div>}
+ {social.mine && <div className={styles.manage}><Link href={`/hub/publish?edit=${id}`}>Edit this harness</Link><button disabled={busy} onClick={unpublish}>Unpublish this harness</button></div>}
</main></>;
}
diff --git a/website/src/app/hub/components/community.spec.tsx b/website/src/app/hub/components/community.spec.tsx
index 370b1b72d..69a6930a4 100644
--- a/website/src/app/hub/components/community.spec.tsx
+++ b/website/src/app/hub/components/community.spec.tsx
@@ -108,6 +108,18 @@ describe('community navigation', () => {
fireEvent.click(screen.getByRole('button', { name: 'Back to chat log' }));
expect(screen.getByText('Make an orbit.')).toBeInTheDocument();
});
+ it('offers its author Edit beside Unpublish, and a reader neither', async () => {
+ const id = '0f8fad5b-d9cb-469f-a165-70867728950e';
+ request.mockResolvedValueOnce({ harness: { ...sample, id }, social: { ...emptySocial, signedIn: true, mine: true } });
+ const { unmount } = render(<Detail id={id} initial={null} />);
+ expect(await screen.findByRole('link', { name: 'Edit this harness' })).toHaveAttribute('href', `/hub/publish?edit=${id}`);
+ expect(screen.getByRole('button', { name: 'Unpublish this harness' })).toBeInTheDocument();
+ unmount();
+ request.mockResolvedValueOnce({ harness: { ...sample, id }, social: { ...emptySocial, signedIn: true } });
+ render(<Detail id={id} initial={null} />);
+ await screen.findByTitle('Orbit output');
+ expect(screen.queryByRole('link', { name: 'Edit this harness' })).not.toBeInTheDocument();
+ });
it('reads a publication once, then refreshes only its social state', async () => {
const id = '0f8fad5b-d9cb-469f-a165-70867728950e';
request.mockResolvedValueOnce({ harness: { ...sample, id }, social: emptySocial }).mockResolvedValue({ social: { ...emptySocial, likes: 3 } });
diff --git a/website/src/app/hub/publish/components/PublishTarget.tsx b/website/src/app/hub/publish/components/PublishTarget.tsx
new file mode 100644
index 000000000..4e47f1dbb
--- /dev/null
+++ b/website/src/app/hub/publish/components/PublishTarget.tsx
@@ -0,0 +1,23 @@
+'use client';
+import { useEffect, useState } from 'react';
+import { myPublications } from '../publication';
+import styles from '../../community.module.css';
+
+type Props = { signedIn: boolean | null; updateId?: string; onChange: (updateId: string | undefined) => void };
+
+/** Publish a new harness, or save this draft over one of yours: same address, likes and comments. */
+export function PublishTarget({ signedIn, updateId, onChange }: Props) {
+ const [mine, setMine] = useState<{ id: string; title: string }[]>([]);
+ useEffect(() => {
+ if (!signedIn) return;
+ let live = true;
+ void myPublications().then(list => { if (live) setMine(list); }, () => { /* Publishing new still works. */ });
+ return () => { live = false; };
+ }, [signedIn]);
+ if (!mine.length && !updateId) return null;
+ return <label className={styles.field}>Publish as<select value={updateId || ''} onChange={event => onChange(event.target.value || undefined)}>
+ <option value="">A new harness</option>
+ {mine.map(({ id, title }) => <option key={id} value={id}>Update “{title}”</option>)}
+ {updateId && !mine.some(({ id }) => id === updateId) && <option value={updateId}>Update this harness</option>}
+ </select></label>;
+}
diff --git a/website/src/app/hub/publish/page.spec.tsx b/website/src/app/hub/publish/page.spec.tsx
index 1e0275010..a93b7d436 100644
--- a/website/src/app/hub/publish/page.spec.tsx
+++ b/website/src/app/hub/publish/page.spec.tsx
@@ -8,9 +8,13 @@ const mocks = vi.hoisted(() => ({ request: vi.fn(), push: vi.fn(), headers: vi.f
vi.mock('next/navigation', () => ({ useRouter: () => ({ push: mocks.push }) }));
vi.mock('@/lib/community/client', () => ({ communityRequest: mocks.request, sessionHeaders: mocks.headers }));
const project = { version: 1, title: 'My orbit', description: 'A new perspective', category: 'Experiments', engine: 'Codex', viewerPath: 'index.html', files: [{ path: 'index.html', content: '<h1>My orbit</h1>' }], conversation: [{ role: 'user', text: 'Change the orbit.' }], forkedFrom: 'starter-orbit' };
-/** The Hub as it answers by default: a draft already in English, and a publication's id. */
-const hub = (english?: object) => async (path: string, options?: { body?: unknown }) =>
- path === 'translate' ? (english ? { ...english, translated: true } : { ...options?.body as object, translated: false }) : { id: 'published-fixture' };
+/** The Hub as it answers by default: a draft already in English, your publications (none), and a publication's id. */
+const hub = (english?: object, mine: object[] = []) => async (path: string, options?: { body?: unknown }) =>
+ path === 'translate' ? (english ? { ...english, translated: true } : { ...options?.body as object, translated: false })
+ : path === 'harnesses?mine=true' ? { harnesses: mine } : { id: 'published-fixture' };
+const tankId = '11111111-2222-4333-8444-555555555555';
+const tank = { id: tankId, title: 'TANK 1987', description: 'A tank game', category: 'Experiments', engine: 'Codex', viewerPath: 'tank/index.html', files: [{ path: 'tank/index.html', content: '<canvas></canvas><script>go()</script>' }], conversation: [{ role: 'user', text: 'Make a tank game.' }], cover: `/api/community/harnesses/${tankId}/cover?v=1` };
+const saved = (id: string) => mocks.request.mock.calls.find(([path, options]) => path === `harnesses/${id}` && options?.method === 'PUT');
const published = () => mocks.request.mock.calls.filter(([path]) => path === 'harnesses');
const translations = () => mocks.request.mock.calls.filter(([path]) => path === 'translate');
const bundleFile = (bundle: object) => Object.assign(new File([JSON.stringify(bundle)], 'OPEN-HARNESS.json', { type: 'application/json' }), { text: async () => JSON.stringify(bundle) });
@@ -93,6 +97,39 @@ describe('explicit publication', () => {
expect(screen.queryByText(/The Hub shows what a session made/)).not.toBeInTheDocument();
expect(screen.queryByText(/Your output loads/)).not.toBeInTheDocument();
});
+ it('opens one of your publications to edit and saves it over the same address', async () => {
+ window.history.replaceState(null, '', `/hub/publish?edit=${tankId}`);
+ const answer = hub(undefined, [{ id: tankId, title: tank.title }]);
+ mocks.request.mockImplementation(async (path: string, options?: { body?: unknown }) => path === `harnesses/${tankId}` && !options ? { harness: tank, social: {} } : answer(path, options));
+ render(<PublishPage />);
+ expect(await screen.findByDisplayValue('TANK 1987')).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: 'Update your harness.' })).toBeInTheDocument();
+ fireEvent.change(screen.getByLabelText('Title'), { target: { value: 'TANK 1987 II' } });
+ fireEvent.click(screen.getByRole('checkbox', { name: /I have permission/ }));
+ fireEvent.click(screen.getByRole('button', { name: 'Save changes' }));
+ await waitFor(() => expect(mocks.push).toHaveBeenCalledWith(`/hub/${tankId}`));
+ expect(saved(tankId)![1].body).toMatchObject({ title: 'TANK 1987 II', viewerPath: 'tank/index.html', files: tank.files, confirmed: true, license: 'MIT' });
+ // The cover stays as it is: its address is not an image to send back.
+ expect(saved(tankId)![1].body).not.toHaveProperty('cover');
+ expect(published()).toHaveLength(0);
+ expect(translations()).toHaveLength(0);
+ window.history.replaceState(null, '', '/');
+ });
+ it('saves an arriving draft over one of your publications when you choose it', async () => {
+ mocks.request.mockImplementation(hub(undefined, [{ id: tankId, title: tank.title }]));
+ render(<PublishPage />);
+ fireEvent.change(screen.getByLabelText('Import fork bundle'), { target: { files: [bundleFile(project)] } });
+ await screen.findByDisplayValue('My orbit');
+ fireEvent.change(screen.getByLabelText('Upload HTML output'), { target: { files: [Object.assign(new File(['<h1>v2</h1>'], 'index.html'), { text: async () => '<h1>v2</h1>' })] } });
+ await waitFor(() => expect(screen.queryByText(/still the original/)).not.toBeInTheDocument());
+ fireEvent.change(await screen.findByLabelText('Publish as'), { target: { value: tankId } });
+ fireEvent.click(screen.getByRole('checkbox', { name: /I have permission/ }));
+ fireEvent.click(screen.getByRole('button', { name: 'Save changes' }));
+ await waitFor(() => expect(mocks.push).toHaveBeenCalledWith(`/hub/${tankId}`));
+ // Where a publication came from is not an edit's to change.
+ expect(saved(tankId)![1].body).not.toHaveProperty('forkedFrom');
+ expect(published()).toHaveLength(0);
+ });
it('translates an arriving draft into English and keeps the original to switch back to', async () => {
const original = { ...project, title: 'Quỹ đạo của tôi', description: 'Một góc nhìn mới', conversation: [{ role: 'user', text: 'Đổi quỹ đạo.' }, { role: 'tool', text: 'ok' }] };
mocks.request.mockImplementation(hub({ title: 'My orbit', description: 'A new perspective', conversation: [{ role: 'user', text: 'Change the orbit.' }, { role: 'tool', text: 'ok' }] }));
@@ -116,7 +153,11 @@ describe('explicit publication', () => {
fireEvent.change(screen.getByLabelText('Import fork bundle'), { target: { files: [bundleFile({ ...project, title: 'Quỹ đạo' })] } });
await screen.findByDisplayValue('Quỹ đạo');
expect(translations()).toHaveLength(0);
- mocks.request.mockRejectedValueOnce(new Error('The translation failed. Try again.'));
+ const answer = hub();
+ mocks.request.mockImplementation(async (path: string, options?: { body?: unknown }) => {
+ if (path === 'translate') throw new Error('The translation failed. Try again.');
+ return answer(path, options);
+ });
mocks.headers.mockReturnValue({ Authorization: 'Bearer fixture' }); fireEvent.focus(window);
expect(await screen.findByText(/Could not translate into English/)).toBeInTheDocument();
expect(screen.getByDisplayValue('Quỹ đạo')).toBeInTheDocument();
diff --git a/website/src/app/hub/publish/page.tsx b/website/src/app/hub/publish/page.tsx
index 69bbdfb37..f85c4d0e9 100644
--- a/website/src/app/hub/publish/page.tsx
+++ b/website/src/app/hub/publish/page.tsx
@@ -1,7 +1,6 @@
'use client';
import { useMemo, useState, type FormEvent } from 'react';
import { useRouter } from 'next/navigation';
-import { communityRequest } from '@/lib/community/client';
import { communityLimits, missingMarker } from '@/lib/community/contract';
import { validateDraft } from '@/lib/community/drafts';
import { previewDocument } from '@/lib/community/preview';
@@ -15,8 +14,10 @@ import { DetailsFields } from './components/DetailsFields';
import { FilesReview } from './components/FilesReview';
import { OutputInputs, SourceInputs } from './components/ProjectInputs';
import { PublishChecks } from './components/PublishChecks';
+import { PublishTarget } from './components/PublishTarget';
import { originalOutput, readCover, readProjectFolder } from './projectFiles';
-import { toSnapshot, usePublishDraft, type PublishDraft } from './usePublishDraft';
+import { submitPublication } from './publication';
+import { usePublishDraft, type PublishDraft } from './usePublishDraft';
import { useEnglishDraft } from './useEnglishDraft';
import styles from '../community.module.css';
@@ -24,7 +25,7 @@ const reviewInputs = ['confirmation', 'secrets'];
export default function PublishPage() {
const router = useRouter(), signedIn = useSignedIn();
- const { draft, update, applyBundle, saveError, publishOnce } = usePublishDraft();
+ const { draft, update, applyBundle, saveError, loadError, publishOnce } = usePublishDraft();
const english = useEnglishDraft(draft, update, signedIn);
const [confirmed, setConfirmed] = useState(false), [checkedSecrets, setCheckedSecrets] = useState(''), [busy, setBusy] = useState(false), [error, setError] = useState('');
const findings = useMemo(() => findSecrets(draft.files, draft.conversation), [draft.files, draft.conversation]);
@@ -62,19 +63,21 @@ export default function PublishPage() {
event.preventDefault();
if (!ready || busy) return;
setBusy(true); setError('');
- void publishOnce(async clientId => {
- const result = await communityRequest<{ id: string }>('harnesses', { method: 'POST', body: { ...toSnapshot(draft), confirmed, license: 'MIT', clientId } });
- router.push(`/hub/${result.id}`);
- }).catch(e => setError(e instanceof Error ? e.message : 'Publication failed. Your draft is still here.')).finally(() => setBusy(false));
+ void publishOnce(async clientId => { router.push(`/hub/${await submitPublication(draft, clientId)}`); })
+ .catch(e => setError(e instanceof Error ? e.message : 'Publication failed. Your draft is still here.')).finally(() => setBusy(false));
}
+ const updating = !!draft.updateId;
return <><Header /><main className={`${styles.wrap} ${styles.publish}`}>
- <h1>Give someone a place to begin.</h1><p className={styles.forkIntro}>Publish one session: the working output, its source, and the conversation that got you there. People can inspect it and make their own version.</p>
+ {updating
+ ? <><h1>Update your harness.</h1><p className={styles.forkIntro}>Save new output, source or conversation over your publication. Its address, likes and comments stay; forks keep the version they copied.</p></>
+ : <><h1>Give someone a place to begin.</h1><p className={styles.forkIntro}>Publish one session: the working output, its source, and the conversation that got you there. People can inspect it and make their own version.</p></>}
{signedIn === false && <SignIn action="publish your harness" />}
<form onChange={event => { if (!(event.target instanceof HTMLInputElement && reviewInputs.includes(event.target.name))) setConfirmed(false); }} onSubmit={publish}>
<div className={styles.importActions}><strong>Bring your harness here.</strong><p>In the desktop app, open Share → Publish to Hub. Your current files and conversation arrive here for review.</p><p>You can also choose a project folder below. Include a self-contained HTML preview so everyone can see the result.</p></div>
<EnglishNotice english={draft.english} signedIn={signedIn} {...english} />
<div className={styles.publishForm}>
+ <PublishTarget signedIn={signedIn} updateId={draft.updateId} onChange={updateId => update({ updateId })} />
<SourceInputs onFolder={files => void importFolder(files)} onBundle={file => void importBundle(file)} />
<DetailsFields draft={draft} update={update} />
<OutputInputs onOutput={file => void importOutput(file)} onCover={file => void importCover(file)} />
@@ -86,8 +89,8 @@ export default function PublishPage() {
{draft.forkedFrom && <p className={styles.notice}>The original harness will stay credited on your publication.</p>}
<PublishChecks noOutput={!!draft.files.length && html === undefined} unchanged={unchanged ? draft.viewerPath : null} outside={outside} missingMarker={marker} findings={findings} acknowledged={secretsChecked} onAcknowledge={value => setCheckedSecrets(value ? findingsKey : '')} />
<label className={styles.check}><input required type="checkbox" name="confirmation" checked={confirmed} onChange={event => setConfirmed(event.target.checked)} /><span>I have permission to publish these files and this conversation under the MIT license. I have reviewed them for private information.</span></label>
- {(error || saveError) && <p className={styles.error} role="alert">{error || saveError}</p>}
- <button className={styles.primary} disabled={busy || !ready}>{busy ? 'Publishing…' : 'Publish harness'}</button>
+ {(error || loadError || saveError) && <p className={styles.error} role="alert">{error || loadError || saveError}</p>}
+ <button className={styles.primary} disabled={busy || !ready}>{updating ? (busy ? 'Saving…' : 'Save changes') : (busy ? 'Publishing…' : 'Publish harness')}</button>
</form>
</main></>;
}
diff --git a/website/src/app/hub/publish/publication.ts b/website/src/app/hub/publish/publication.ts
new file mode 100644
index 000000000..d92dd4d7a
--- /dev/null
+++ b/website/src/app/hub/publish/publication.ts
@@ -0,0 +1,38 @@
+import { communityRequest } from '@/lib/community/client';
+import { noEnglish } from '@/lib/community/translation';
+import type { HarnessSnapshot, OpenHarness } from '@/lib/community/types';
+import type { PublishDraft } from './usePublishDraft';
+
+const review = { confirmed: true, license: 'MIT' } as const;
+
+/** What the Hub stores: the draft without the note that was only for the person reviewing it. */
+export function toSnapshot(draft: PublishDraft): HarnessSnapshot {
+ const { title, description, category, engine, harnessId, files, viewerPath, conversation, cover, forkedFrom } = draft;
+ return { title, description, category, engine, ...(harnessId ? { harnessId } : {}), files, viewerPath, conversation, ...(cover ? { cover } : {}), ...(forkedFrom ? { forkedFrom } : {}) };
+}
+
+/** One of your publications as a draft to edit: what it shows now, saved back to the same address. */
+export async function editDraft(id: string): Promise<PublishDraft> {
+ const { harness } = await communityRequest<{ harness: OpenHarness | null }>(`harnesses/${id}`);
+ if (!harness) throw new Error('This harness is unavailable.');
+ const { title, description, category, engine, harnessId, files, viewerPath, conversation, forkedFrom } = harness;
+ // The cover stays as it is unless a new one is chosen: what a reader gets is its address, not its bytes.
+ return { title, description, category, engine, harnessId, files, viewerPath, conversation, forkedFrom, contextNote: '', english: noEnglish, updateId: id };
+}
+
+/**
+ * Publishes the draft, or saves it over the publication it updates, and returns the publication's id.
+ * An update keeps where the publication came from, and its cover unless a new one was chosen.
+ */
+export async function submitPublication(draft: PublishDraft, clientId: string | undefined): Promise<string> {
+ if (!draft.updateId) return (await communityRequest<{ id: string }>('harnesses', { method: 'POST', body: { ...toSnapshot(draft), ...review, clientId } })).id;
+ const { forkedFrom: _forkedFrom, cover, ...edit } = toSnapshot(draft);
+ await communityRequest(`harnesses/${draft.updateId}`, { method: 'PUT', body: { ...edit, ...(cover?.startsWith('data:') ? { cover } : {}), ...review } });
+ return draft.updateId;
+}
+
+/** Your own publications, to choose one a draft updates. */
+export async function myPublications(): Promise<{ id: string; title: string }[]> {
+ const { harnesses } = await communityRequest<{ harnesses: { id: string; title: string }[] }>('harnesses?mine=true');
+ return harnesses.map(({ id, title }) => ({ id, title }));
+}
diff --git a/website/src/app/hub/publish/usePublishDraft.ts b/website/src/app/hub/publish/usePublishDraft.ts
index 70d2dfc03..909620602 100644
--- a/website/src/app/hub/publish/usePublishDraft.ts
+++ b/website/src/app/hub/publish/usePublishDraft.ts
@@ -4,12 +4,16 @@ import { readDraft, saveDraft, type HubDraft } from '@/lib/community/drafts';
import { communityCategories, communityEngines } from '@/lib/community/contract';
import { arrivedEnglish, noEnglish, type EnglishState } from '@/lib/community/translation';
import type { HarnessSnapshot } from '@/lib/community/types';
+import { editDraft } from './publication';
/**
* `originalOutput` is the fork's output as it arrived: kept here to compare against, never published.
* `english` is where the draft stands with its translation, never published either.
+ * `updateId` is your publication this draft is saved over, instead of publishing a new one.
*/
-export type PublishDraft = Omit<HarnessSnapshot, 'harnessName' | 'credits'> & { contextNote: string; originalOutput?: string; english: EnglishState };
+export type PublishDraft = Omit<HarnessSnapshot, 'harnessName' | 'credits'> & { contextNote: string; originalOutput?: string; english: EnglishState; updateId?: string };
+
+const uuid = /^[a-f0-9-]{36}$/;
const fresh: PublishDraft = { title: '', description: '', category: 'Apps', engine: 'Codex', files: [], viewerPath: 'preview.html', conversation: [{ role: 'user', text: '' }], contextNote: '', english: noEnglish };
@@ -23,21 +27,16 @@ function fromBundle(bundle: HubDraft): PublishDraft {
conversation: bundle.conversation?.length ? bundle.conversation : fresh.conversation,
forkedFrom: bundle.forkedFrom, cover: bundle.cover, contextNote: bundle.contextNote || '', originalOutput: bundle.originalOutput,
english: arrivedEnglish(bundle.english),
+ updateId: bundle.updateId && uuid.test(bundle.updateId) ? bundle.updateId : undefined,
};
}
-/** What the Hub stores: the draft without the note that was only for the person reviewing it. */
-export function toSnapshot(draft: PublishDraft): HarnessSnapshot {
- const { title, description, category, engine, harnessId, files, viewerPath, conversation, cover, forkedFrom } = draft;
- return { title, description, category, engine, ...(harnessId ? { harnessId } : {}), files, viewerPath, conversation, ...(cover ? { cover } : {}), ...(forkedFrom ? { forkedFrom } : {}) };
-}
-
/**
* The publish form's draft, kept in this browser under `?draft=<id>` so a reload or a sign-in keeps
* it. `publicationId` makes a retried Publish return the same publication instead of a second one.
*/
export function usePublishDraft() {
- const [draft, setDraft] = useState(fresh), [ready, setReady] = useState(false), [saveError, setSaveError] = useState('');
+ const [draft, setDraft] = useState(fresh), [ready, setReady] = useState(false), [saveError, setSaveError] = useState(''), [loadError, setLoadError] = useState('');
const draftId = useRef<string | null>(null), publicationId = useRef<string | null>(null), submitting = useRef(false);
const update = useCallback((patch: Partial<PublishDraft>) => setDraft(value => ({ ...value, ...patch })), []);
const applyBundle = useCallback((bundle: HubDraft) => {
@@ -47,11 +46,18 @@ export function usePublishDraft() {
useEffect(() => {
let disposed = false;
- const query = new URLSearchParams(window.location.search).get('draft');
- const id = query && /^[a-f0-9-]{36}$/.test(query) ? query : crypto.randomUUID();
+ const params = new URLSearchParams(window.location.search), query = params.get('draft'), edit = params.get('edit');
+ const id = query && uuid.test(query) ? query : crypto.randomUUID(), editId = edit && uuid.test(edit) ? edit : null;
draftId.current = id; publicationId.current = crypto.randomUUID();
- if (!query) window.history.replaceState(null, '', `/hub/publish?draft=${id}`);
- void readDraft(id).then(saved => { if (!disposed && saved) applyBundle(saved); }).catch(() => { /* A fresh draft can still be composed. */ }).finally(() => { if (!disposed) setReady(true); });
+ if (!query) window.history.replaceState(null, '', `/hub/publish?draft=${id}${editId ? `&edit=${editId}` : ''}`);
+ // A saved draft wins; `?edit=<id>` otherwise opens that publication as it is now.
+ void readDraft(id).catch(() => undefined).then(async saved => {
+ if (disposed) return;
+ if (saved) return applyBundle(saved);
+ if (!editId) return;
+ try { const opened = await editDraft(editId); if (!disposed) setDraft(opened); }
+ catch (e) { if (!disposed) setLoadError(e instanceof Error ? e.message : 'This harness could not be opened for editing.'); }
+ }).finally(() => { if (!disposed) setReady(true); });
return () => { disposed = true; };
}, [applyBundle]);
@@ -74,5 +80,5 @@ export function usePublishDraft() {
if (draftId.current) await saveDraft(draftId.current, null).catch(() => {});
} finally { submitting.current = false; }
}, []);
- return { draft, update, applyBundle, saveError, publishOnce };
+ return { draft, update, applyBundle, saveError, loadError, publishOnce };
}
diff --git a/website/src/lib/community/drafts.ts b/website/src/lib/community/drafts.ts
index f91174a7f..7006e07eb 100644
--- a/website/src/lib/community/drafts.ts
+++ b/website/src/lib/community/drafts.ts
@@ -4,9 +4,10 @@ import type { HarnessSnapshot } from './types';
/**
* `originalOutput` is kept only by the review page, to tell a fork's new output from the one it arrived with;
- * `english`, where the draft stands with its English translation.
+ * `english`, where the draft stands with its English translation; `updateId`, the author's publication
+ * it is saved over.
*/
-export type HubDraft = Partial<HarnessSnapshot> & { version?: number; clientId?: string; contextNote?: string; originalOutput?: string; english?: EnglishState };
+export type HubDraft = Partial<HarnessSnapshot> & { version?: number; clientId?: string; contextNote?: string; originalOutput?: string; english?: EnglishState; updateId?: string };
export const draftDatabase = 'harness.hub.drafts';
export function validateDraft(value: unknown): HubDraft {