Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 4 | import { cleanTitle, defaultWhere, threadLink, whereWords, writableSpaces, writeUpAgents, writeUpMessage } from "./write-up.ts"; |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 5 | |
| 6 | test("a thread's link is its conversation with ?thread=", () => { | |
| 7 | assert.equal(threadLink("https://g1t.sh/", "/acme/-/chat/launch", "msg_1"), "https://g1t.sh/acme/-/chat/launch?thread=msg_1"); | |
| 8 | assert.equal(threadLink("https://g1t.sh", "/acme/-/chat/dm/chn_1", "a b"), "https://g1t.sh/acme/-/chat/dm/chn_1?thread=a%20b"); | |
| 9 | }); | |
| 10 | ||
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 11 | const spaces = writableSpaces([ |
| 12 | { id: "s1", name: "Design", viewer_role: "edit", archived_at: null }, | |
| 13 | { id: "s2", name: "Board", viewer_role: "view", archived_at: null }, | |
| 14 | { id: "s3", name: "Old", viewer_role: "manage", archived_at: "2026-01-01T00:00:00Z" }, | |
| 15 | { id: "s4", name: "General", viewer_role: "manage", archived_at: null, is_default: true }, | |
| 16 | { id: "s5", name: "Notes", viewer_role: "comment", archived_at: null }, | |
| 17 | ]); | |
| 18 | ||
| 19 | test("only spaces the person can add to, not archived, General first", () => { | |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 20 | assert.deepEqual(spaces, [ |
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 21 | { id: "s4", name: "General", is_default: true }, |
| 22 | { id: "s1", name: "Design", is_default: false }, | |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 23 | ]); |
| 24 | }); | |
| 25 | ||
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 26 | test("it goes to the conversation in a DM or private channel; to General, else Private, in a public one", () => { |
| 27 | assert.deepEqual(defaultWhere(true, spaces), { kind: "conversation" }); | |
| 28 | assert.deepEqual(defaultWhere(false, spaces), { kind: "space", id: "s4", name: "General" }); | |
| 29 | assert.deepEqual(defaultWhere(false, spaces.filter((s) => !s.is_default)), { kind: "private" }); | |
| 30 | }); | |
| 31 | ||
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 32 | test("@g1t is always offered first, then the conversation's agents, once each", () => { |
| 33 | const agents = writeUpAgents([ | |
| 34 | { kind: "user", name: "ana", display_name: "Ana" }, | |
| 35 | { kind: "agent", name: "Scribe", display_name: "Scribe" }, | |
| 36 | { kind: "agent", name: "g1t", display_name: "g1t" }, | |
| 37 | { kind: "agent", name: "scribe", display_name: "Scribe" }, | |
| 38 | { kind: "agent", name: "qa", display_name: " " }, | |
| 39 | ]); | |
| 40 | assert.deepEqual(agents, [ | |
| 41 | { handle: "g1t", name: "g1t" }, | |
| 42 | { handle: "scribe", name: "Scribe" }, | |
| 43 | { handle: "qa", name: "qa" }, | |
| 44 | ]); | |
| 45 | }); | |
| 46 | ||
| 47 | test("a title is one line without double quotes", () => { | |
| 48 | assert.equal(cleanTitle(' The "launch"\n plan '), "The 'launch' plan"); | |
| 49 | assert.equal(cleanTitle(null), ""); | |
| 50 | assert.equal(cleanTitle("x".repeat(200)).length, 120); | |
| 51 | }); | |
| 52 | ||
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 53 | test("the ask names the agent, the kind, where it goes, the title if any, and the thread to cite", () => { |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 54 | const link = "https://g1t.sh/acme/-/chat/launch?thread=msg_1"; |
| 55 | assert.equal( | |
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 56 | writeUpMessage({ agent: "g1t", where: { kind: "space", id: "s1", name: "Engineering" }, title: "Launch plan", link }), |
| 57 | `@g1t write this thread up as an artifact (a doc) in the Engineering space titled "Launch plan". Link this thread as the source: ${link}`, | |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 58 | ); |
| Artifacts is a mode in the rail, the shell and the phone's tab bar in place of Docs: its home lists everything you can open by day or as cards under All, Yours and Shared with you, with search, filters and tiles to start a doc (slides, designs and dashboards say they are coming soon), and its sidebar holds favorites, spaces, Private, Shared, projects' docs and the trash. | 59 | assert.equal(writeUpMessage({ agent: "@Scribe", where: { kind: "private" }, title: " ", link }), `@scribe write this thread up as an artifact (a doc) privately (just for me). Link this thread as the source: ${link}`); |
| 60 | assert.equal(whereWords({ kind: "conversation" }), "shared with this conversation"); | |
| 61 | assert.equal(whereWords({ kind: "space", id: "s", name: " Product notes " }), "in the Product notes space"); | |
| Write a thread up in Docs from chat; cards' buttons in notifications; a session's card stays at the top of its thread | 62 | }); |