@kubitnodes/stellaris 0.3.14 → 0.3.16

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.
Files changed (58) hide show
  1. package/dist/cli/index.js +47 -18
  2. package/dist/server/index.js +66 -18
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-B5n6YQVF.js +1 -0
  5. package/web/dist/assets/{ChannelForms-b6eKogvP.js → ChannelForms-mdOuU6eZ.js} +1 -1
  6. package/web/dist/assets/ChannelView-CeoMScnt.js +2 -0
  7. package/web/dist/assets/CitizenView-B_AL8Fnt.js +2 -0
  8. package/web/dist/assets/{CitizensView-Dbo47F82.js → CitizensView--LjujB8k.js} +1 -1
  9. package/web/dist/assets/{CliIcon-DxDvRRcX.js → CliIcon-Cyv7ef-2.js} +1 -1
  10. package/web/dist/assets/CronsView-DGGDT8e-.js +1 -0
  11. package/web/dist/assets/{KnowledgeView-BXLj85OH.js → KnowledgeView-CMYgeq6t.js} +1 -1
  12. package/web/dist/assets/Markdown-CI8CWgHq.js +32 -0
  13. package/web/dist/assets/{MessageItem-DnfMDxDB.js → MessageItem-Dtpufq_V.js} +1 -1
  14. package/web/dist/assets/MetricsView-CDtVttH_.js +1 -0
  15. package/web/dist/assets/NeedsYouView-DuVBOLn4.js +1 -0
  16. package/web/dist/assets/Overview-BMatmD0p.js +1 -0
  17. package/web/dist/assets/{Pane-CODhA5zE.js → Pane-L4GJKBiw.js} +1 -1
  18. package/web/dist/assets/Picker-h6akABv6.js +1 -0
  19. package/web/dist/assets/{ProjectView-CScK4F7F.js → ProjectView-t3cOK3AT.js} +1 -1
  20. package/web/dist/assets/ProposalView-BRr85RPY.js +1 -0
  21. package/web/dist/assets/{ProposalsView-DSi2u6qO.js → ProposalsView-ffQA37Wa.js} +1 -1
  22. package/web/dist/assets/{RunnersView-9E2qUSO5.js → RunnersView-BD0XRmGY.js} +1 -1
  23. package/web/dist/assets/{SocietyView-DEeUo4wb.js → SocietyView-CsbeXgkb.js} +1 -1
  24. package/web/dist/assets/{SubjectThread-DhGB5RPc.js → SubjectThread-DnQJDgcK.js} +1 -1
  25. package/web/dist/assets/TaskFileView-uJ9xM8Y0.js +4 -0
  26. package/web/dist/assets/TaskView-CkMhrkxY.js +3 -0
  27. package/web/dist/assets/{TasksView-CJbJt5dM.js → TasksView-BuAqdPIa.js} +1 -1
  28. package/web/dist/assets/ThreadCard-CkqMOMDh.js +1 -0
  29. package/web/dist/assets/{ThreadForms-RnrV7V5X.js → ThreadForms-Bciw71n3.js} +1 -1
  30. package/web/dist/assets/{ThreadView-CMwiVZFq.js → ThreadView-CpdtYhHa.js} +1 -1
  31. package/web/dist/assets/citizen-Cyd1haJO.js +1 -0
  32. package/web/dist/assets/{compose-D7DOz6kC.js → compose-BCqmtrsZ.js} +1 -1
  33. package/web/dist/assets/{format-BORdp4w-.js → format-qPQgH1PF.js} +1 -1
  34. package/web/dist/assets/{governance-WrDQawLN.js → governance-D5tD2NOI.js} +1 -1
  35. package/web/dist/assets/index-BfZnvrmA.js +23 -0
  36. package/web/dist/assets/index-BoTts74M.css +2 -0
  37. package/web/dist/assets/link-DF__7B1f.js +1 -0
  38. package/web/dist/assets/{tasks-C-9dAYQV.js → tasks-DcovWYAU.js} +1 -1
  39. package/web/dist/assets/useMatch-AToHy-wD.js +1 -0
  40. package/web/dist/assets/{useStickyScroll-CE7dyz0Q.js → useStickyScroll-BFNyJYps.js} +1 -1
  41. package/web/dist/index.html +9 -9
  42. package/web/dist/assets/BackLink-giAdtos8.js +0 -1
  43. package/web/dist/assets/ChannelView-DXoJ5w3z.js +0 -1
  44. package/web/dist/assets/CitizenView-yOnQtNz4.js +0 -2
  45. package/web/dist/assets/CronsView-DYx7dQcr.js +0 -1
  46. package/web/dist/assets/Markdown-Dw04_ImA.js +0 -31
  47. package/web/dist/assets/MetricsView-_h2TWeo8.js +0 -1
  48. package/web/dist/assets/NeedsYouView-BI1-_bYI.js +0 -1
  49. package/web/dist/assets/Overview-BdZiHglw.js +0 -1
  50. package/web/dist/assets/ProposalView-BQ1rflqo.js +0 -1
  51. package/web/dist/assets/TaskFileView-DQC_ZUdY.js +0 -4
  52. package/web/dist/assets/TaskView-yVpUG83f.js +0 -3
  53. package/web/dist/assets/ThreadCard-DVAx3gGc.js +0 -1
  54. package/web/dist/assets/citizen-aLkZ4owL.js +0 -1
  55. package/web/dist/assets/index-7uInG5D9.js +0 -23
  56. package/web/dist/assets/index-D02Wgo_C.css +0 -2
  57. package/web/dist/assets/link-1v5lugnf.js +0 -1
  58. package/web/dist/assets/useMatch-CyeFfbcR.js +0 -1
package/dist/cli/index.js CHANGED
@@ -396,6 +396,13 @@ var MessageStepSchema = z4.union([TaskStepSchema, ProposalStepSchema]);
396
396
  function isTaskStep(step) {
397
397
  return "stage" in step;
398
398
  }
399
+ var KnowledgeNoticeSchema = z4.object({
400
+ kind: z4.literal("knowledge"),
401
+ action: z4.enum(["written", "updated", "removed"]),
402
+ topic: NameSchema,
403
+ project: NameSchema.nullable()
404
+ });
405
+ var MessageNoticeSchema = z4.discriminatedUnion("kind", [KnowledgeNoticeSchema]);
399
406
  var MessageFrontmatterSchema = z4.object({
400
407
  id: UlidSchema,
401
408
  author: NameSchema,
@@ -407,6 +414,8 @@ var MessageFrontmatterSchema = z4.object({
407
414
  closes: UlidSchema.optional(),
408
415
  /** On a post a task verb made in the task's thread, or a decision in a proposal's: the step it recorded. */
409
416
  step: MessageStepSchema.optional(),
417
+ /** On a post a verb made about its work, such as a knowledge topic's note: what it records. */
418
+ notice: MessageNoticeSchema.optional(),
410
419
  ts: IsoDateTimeSchema,
411
420
  mentions: z4.array(NameSchema)
412
421
  });
@@ -1291,6 +1300,30 @@ var BranchChangesSchema = z7.object({
1291
1300
  files: z7.array(BranchFileChangeSchema),
1292
1301
  total: z7.number().int().nonnegative()
1293
1302
  });
1303
+ var BranchDiffReadSchema = z7.object({
1304
+ repo: ProjectRepoSchema,
1305
+ branch: BranchNameSchema,
1306
+ path: BranchPathSchema.min(1)
1307
+ });
1308
+ var BranchFileDiffSchema = z7.object({
1309
+ head: BranchCommitSchema,
1310
+ path: BranchPathSchema,
1311
+ status: BranchFileChangeSchema.shape.status,
1312
+ patch: z7.string().nullable(),
1313
+ truncated: z7.boolean()
1314
+ });
1315
+ function patchHunks(patch, limit) {
1316
+ if (/^Binary files .* differ$/m.test(patch)) {
1317
+ return { patch: null, truncated: false };
1318
+ }
1319
+ const start = patch.search(/^@@/m);
1320
+ const hunks = start === -1 ? "" : patch.slice(start);
1321
+ if (hunks.length <= limit) {
1322
+ return { patch: hunks, truncated: false };
1323
+ }
1324
+ const cut = hunks.lastIndexOf("\n", limit);
1325
+ return { patch: hunks.slice(0, cut === -1 ? limit : cut), truncated: true };
1326
+ }
1294
1327
  var WorkspaceConversationSchema = z7.discriminatedUnion("kind", [
1295
1328
  z7.object({ kind: z7.literal("thread"), id: UlidSchema }),
1296
1329
  z7.object({ kind: z7.literal("channel"), scope: NameSchema, name: NameSchema })
@@ -1317,6 +1350,8 @@ var RunnerMessageSchema = z7.discriminatedUnion("type", [
1317
1350
  request: z7.string().min(1),
1318
1351
  read: BranchChangesReadSchema
1319
1352
  }),
1353
+ /** Answered with a `BranchFileDiff`, or null when the branch does not exist or left the path alone. */
1354
+ z7.object({ type: z7.literal("diff"), request: z7.string().min(1), read: BranchDiffReadSchema }),
1320
1355
  /** Answered with whether the CLI accepted it; that it took it comes as a `steered` event. */
1321
1356
  z7.object({
1322
1357
  type: z7.literal("steer"),
@@ -1660,7 +1695,7 @@ var RunnerConfigSchema = z11.object({
1660
1695
  });
1661
1696
 
1662
1697
  // packages/shared/dist/version.js
1663
- var STELLARIS_VERSION = "0.3.14";
1698
+ var STELLARIS_VERSION = "0.3.16";
1664
1699
 
1665
1700
  // packages/board-core/dist/errors.js
1666
1701
  var BoardError = class extends Error {
@@ -2015,18 +2050,6 @@ function lineCount(value) {
2015
2050
  function fileStatus(letter) {
2016
2051
  return letter === "A" ? "added" : letter === "D" ? "deleted" : "modified";
2017
2052
  }
2018
- function hunksOf(patch) {
2019
- if (/^Binary files .* differ$/m.test(patch)) {
2020
- return { patch: null, truncated: false };
2021
- }
2022
- const start = patch.search(/^@@/m);
2023
- const hunks = start === -1 ? "" : patch.slice(start);
2024
- if (hunks.length <= PATCH_LIMIT_CHARS) {
2025
- return { patch: hunks, truncated: false };
2026
- }
2027
- const cut = hunks.lastIndexOf("\n", PATCH_LIMIT_CHARS);
2028
- return { patch: hunks.slice(0, cut === -1 ? PATCH_LIMIT_CHARS : cut), truncated: true };
2029
- }
2030
2053
  async function git(args, cwd) {
2031
2054
  const result = await execa("git", [...BOARD_IDENTITY, ...args], {
2032
2055
  cwd,
@@ -2165,7 +2188,8 @@ var HomeRepos = class {
2165
2188
  if (others.length > 0 && (status !== "added" || conflictCopyOf(file) === null)) {
2166
2189
  continue;
2167
2190
  }
2168
- files.push({ path: file, status, ...hunksOf(await read(home, [...range, "--", file])) });
2191
+ const patch = await read(home, [...range, "--", file]);
2192
+ files.push({ path: file, status, ...patchHunks(patch, PATCH_LIMIT_CHARS) });
2169
2193
  }
2170
2194
  return files;
2171
2195
  }
@@ -4456,7 +4480,12 @@ ${task2.body}`;
4456
4480
  replaced
4457
4481
  });
4458
4482
  const where = args.project === null ? "general" : channelRef(args.project, "general");
4459
- await this.appendMessage(actor.name, where, `Knowledge ${replaced ? "updated" : "written"}: ${args.topic}. It is under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`);
4483
+ await this.appendMessage(actor.name, where, `Knowledge ${replaced ? "updated" : "written"}: ${args.topic}. It is under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`, {
4484
+ kind: "knowledge",
4485
+ action: replaced ? "updated" : "written",
4486
+ topic: args.topic,
4487
+ project: args.project
4488
+ });
4460
4489
  return { ...data, body: args.body };
4461
4490
  });
4462
4491
  }
@@ -4489,7 +4518,7 @@ ${task2.body}`;
4489
4518
  project: args.project
4490
4519
  });
4491
4520
  const where = args.project === null ? "general" : channelRef(args.project, "general");
4492
- await this.appendMessage(actor.name, where, `Knowledge removed: ${args.topic}. It is no longer under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`);
4521
+ await this.appendMessage(actor.name, where, `Knowledge removed: ${args.topic}. It is no longer under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`, { kind: "knowledge", action: "removed", topic: args.topic, project: args.project });
4493
4522
  return removed;
4494
4523
  });
4495
4524
  }
@@ -7112,9 +7141,9 @@ ${charter.purpose}
7112
7141
  return { agent: agent2, releasedTasks };
7113
7142
  }
7114
7143
  /** Writes one message and its event. Callers hold the mutex and have authorized the author. */
7115
- async appendMessage(author, channel, body) {
7144
+ async appendMessage(author, channel, body, notice) {
7116
7145
  await this.assertChannelOpen(channel);
7117
- return this.writeMessage(this.paths.channelDir(channel), { author, channel }, body);
7146
+ return this.writeMessage(this.paths.channelDir(channel), { author, channel, ...notice === void 0 ? {} : { notice } }, body);
7118
7147
  }
7119
7148
  /** A thread's message carries the thread's channel; a caller naming another channel is refused. */
7120
7149
  async appendThreadMessage(author, threadId, body, options = {}) {
@@ -411,6 +411,13 @@ var MessageStepSchema = z4.union([TaskStepSchema, ProposalStepSchema]);
411
411
  function isTaskStep(step) {
412
412
  return "stage" in step;
413
413
  }
414
+ var KnowledgeNoticeSchema = z4.object({
415
+ kind: z4.literal("knowledge"),
416
+ action: z4.enum(["written", "updated", "removed"]),
417
+ topic: NameSchema,
418
+ project: NameSchema.nullable()
419
+ });
420
+ var MessageNoticeSchema = z4.discriminatedUnion("kind", [KnowledgeNoticeSchema]);
414
421
  var MessageFrontmatterSchema = z4.object({
415
422
  id: UlidSchema,
416
423
  author: NameSchema,
@@ -422,6 +429,8 @@ var MessageFrontmatterSchema = z4.object({
422
429
  closes: UlidSchema.optional(),
423
430
  /** On a post a task verb made in the task's thread, or a decision in a proposal's: the step it recorded. */
424
431
  step: MessageStepSchema.optional(),
432
+ /** On a post a verb made about its work, such as a knowledge topic's note: what it records. */
433
+ notice: MessageNoticeSchema.optional(),
425
434
  ts: IsoDateTimeSchema,
426
435
  mentions: z4.array(NameSchema)
427
436
  });
@@ -1354,6 +1363,30 @@ var BranchChangesSchema = z7.object({
1354
1363
  files: z7.array(BranchFileChangeSchema),
1355
1364
  total: z7.number().int().nonnegative()
1356
1365
  });
1366
+ var BranchDiffReadSchema = z7.object({
1367
+ repo: ProjectRepoSchema,
1368
+ branch: BranchNameSchema,
1369
+ path: BranchPathSchema.min(1)
1370
+ });
1371
+ var BranchFileDiffSchema = z7.object({
1372
+ head: BranchCommitSchema,
1373
+ path: BranchPathSchema,
1374
+ status: BranchFileChangeSchema.shape.status,
1375
+ patch: z7.string().nullable(),
1376
+ truncated: z7.boolean()
1377
+ });
1378
+ function patchHunks(patch, limit2) {
1379
+ if (/^Binary files .* differ$/m.test(patch)) {
1380
+ return { patch: null, truncated: false };
1381
+ }
1382
+ const start = patch.search(/^@@/m);
1383
+ const hunks = start === -1 ? "" : patch.slice(start);
1384
+ if (hunks.length <= limit2) {
1385
+ return { patch: hunks, truncated: false };
1386
+ }
1387
+ const cut = hunks.lastIndexOf("\n", limit2);
1388
+ return { patch: hunks.slice(0, cut === -1 ? limit2 : cut), truncated: true };
1389
+ }
1357
1390
  var WorkspaceConversationSchema = z7.discriminatedUnion("kind", [
1358
1391
  z7.object({ kind: z7.literal("thread"), id: UlidSchema }),
1359
1392
  z7.object({ kind: z7.literal("channel"), scope: NameSchema, name: NameSchema })
@@ -1386,6 +1419,8 @@ var RunnerMessageSchema = z7.discriminatedUnion("type", [
1386
1419
  request: z7.string().min(1),
1387
1420
  read: BranchChangesReadSchema
1388
1421
  }),
1422
+ /** Answered with a `BranchFileDiff`, or null when the branch does not exist or left the path alone. */
1423
+ z7.object({ type: z7.literal("diff"), request: z7.string().min(1), read: BranchDiffReadSchema }),
1389
1424
  /** Answered with whether the CLI accepted it; that it took it comes as a `steered` event. */
1390
1425
  z7.object({
1391
1426
  type: z7.literal("steer"),
@@ -1787,7 +1822,7 @@ var RunnerConfigSchema = z11.object({
1787
1822
  });
1788
1823
 
1789
1824
  // packages/shared/dist/version.js
1790
- var STELLARIS_VERSION = "0.3.14";
1825
+ var STELLARIS_VERSION = "0.3.16";
1791
1826
 
1792
1827
  // packages/board-core/dist/errors.js
1793
1828
  var BoardError = class extends Error {
@@ -2145,18 +2180,6 @@ function lineCount(value) {
2145
2180
  function fileStatus(letter) {
2146
2181
  return letter === "A" ? "added" : letter === "D" ? "deleted" : "modified";
2147
2182
  }
2148
- function hunksOf(patch) {
2149
- if (/^Binary files .* differ$/m.test(patch)) {
2150
- return { patch: null, truncated: false };
2151
- }
2152
- const start = patch.search(/^@@/m);
2153
- const hunks = start === -1 ? "" : patch.slice(start);
2154
- if (hunks.length <= PATCH_LIMIT_CHARS) {
2155
- return { patch: hunks, truncated: false };
2156
- }
2157
- const cut = hunks.lastIndexOf("\n", PATCH_LIMIT_CHARS);
2158
- return { patch: hunks.slice(0, cut === -1 ? PATCH_LIMIT_CHARS : cut), truncated: true };
2159
- }
2160
2183
  async function git(args, cwd) {
2161
2184
  const result = await execa("git", [...BOARD_IDENTITY, ...args], {
2162
2185
  cwd,
@@ -2295,7 +2318,8 @@ var HomeRepos = class {
2295
2318
  if (others.length > 0 && (status !== "added" || conflictCopyOf(file) === null)) {
2296
2319
  continue;
2297
2320
  }
2298
- files.push({ path: file, status, ...hunksOf(await read(home, [...range, "--", file])) });
2321
+ const patch = await read(home, [...range, "--", file]);
2322
+ files.push({ path: file, status, ...patchHunks(patch, PATCH_LIMIT_CHARS) });
2299
2323
  }
2300
2324
  return files;
2301
2325
  }
@@ -4586,7 +4610,12 @@ ${task.body}`;
4586
4610
  replaced
4587
4611
  });
4588
4612
  const where = args.project === null ? "general" : channelRef(args.project, "general");
4589
- await this.appendMessage(actor.name, where, `Knowledge ${replaced ? "updated" : "written"}: ${args.topic}. It is under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`);
4613
+ await this.appendMessage(actor.name, where, `Knowledge ${replaced ? "updated" : "written"}: ${args.topic}. It is under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`, {
4614
+ kind: "knowledge",
4615
+ action: replaced ? "updated" : "written",
4616
+ topic: args.topic,
4617
+ project: args.project
4618
+ });
4590
4619
  return { ...data, body: args.body };
4591
4620
  });
4592
4621
  }
@@ -4619,7 +4648,7 @@ ${task.body}`;
4619
4648
  project: args.project
4620
4649
  });
4621
4650
  const where = args.project === null ? "general" : channelRef(args.project, "general");
4622
- await this.appendMessage(actor.name, where, `Knowledge removed: ${args.topic}. It is no longer under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`);
4651
+ await this.appendMessage(actor.name, where, `Knowledge removed: ${args.topic}. It is no longer under knowledge/${args.topic}.md${args.project === null ? " of the society" : ""}.`, { kind: "knowledge", action: "removed", topic: args.topic, project: args.project });
4623
4652
  return removed;
4624
4653
  });
4625
4654
  }
@@ -7242,9 +7271,9 @@ ${charter.purpose}
7242
7271
  return { agent, releasedTasks };
7243
7272
  }
7244
7273
  /** Writes one message and its event. Callers hold the mutex and have authorized the author. */
7245
- async appendMessage(author, channel, body) {
7274
+ async appendMessage(author, channel, body, notice) {
7246
7275
  await this.assertChannelOpen(channel);
7247
- return this.writeMessage(this.paths.channelDir(channel), { author, channel }, body);
7276
+ return this.writeMessage(this.paths.channelDir(channel), { author, channel, ...notice === void 0 ? {} : { notice } }, body);
7248
7277
  }
7249
7278
  /** A thread's message carries the thread's channel; a caller naming another channel is refused. */
7250
7279
  async appendThreadMessage(author, threadId, body, options = {}) {
@@ -10747,6 +10776,18 @@ var RunnerHub = class {
10747
10776
  }
10748
10777
  return changes;
10749
10778
  }
10779
+ /**
10780
+ * What a branch of a project's repository did to one file since it left the default branch, read
10781
+ * on the runner the project lives on, with the same refusals as `branchChanges`.
10782
+ */
10783
+ async branchDiff(project, branch, path10) {
10784
+ const { seat, repo } = await this.projectSeat(project, "branchChanges", "list changes");
10785
+ const diff = BranchFileDiffSchema.nullable().parse(await this.request(seat, (request) => ({ type: "diff", request, read: { repo, branch, path: path10 } }), FILE_TIMEOUT_MS));
10786
+ if (diff === null) {
10787
+ throw new BoardError("NOT_FOUND", `${branch} did not change ${path10}`);
10788
+ }
10789
+ return diff;
10790
+ }
10750
10791
  /** The models a CLI offers, asked of a connected runner that has it; none when no runner has it. */
10751
10792
  /**
10752
10793
  * The connected runner a model list for `cli` comes from: the first of `prefer` that has the CLI,
@@ -11681,6 +11722,13 @@ function createApp(deps) {
11681
11722
  }
11682
11723
  return c.json(await deps.runners.branchChanges(task.project, `task/${task.id}`));
11683
11724
  });
11725
+ api.get("/tasks/:id/diff/:path{.+}", async (c) => {
11726
+ const { task } = await board2.findTask(UlidSchema.parse(c.req.param("id")));
11727
+ if (deps.runners === void 0) {
11728
+ throw new BoardError("NOT_FOUND", "this board has no runners to read a task's branch from");
11729
+ }
11730
+ return c.json(await deps.runners.branchDiff(task.project, `task/${task.id}`, BranchPathSchema.parse(c.req.param("path"))));
11731
+ });
11684
11732
  api.get("/tasks/:id/files/:path{.+}", (c) => taskFile(c, c.req.param("path")));
11685
11733
  api.get("/threads", async (c) => c.json(await board2.listThreads()));
11686
11734
  api.get("/requests", async (c) => c.json(await board2.listRequests()));
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "codex",
9
9
  "multi-agent"
10
10
  ],
11
- "version": "0.3.14",
11
+ "version": "0.3.16",
12
12
  "license": "MIT",
13
13
  "homepage": "https://github.com/kr4t0n/stellaris",
14
14
  "repository": {
@@ -0,0 +1 @@
1
+ import{Cn as e,Rt as t,x as n}from"./format-qPQgH1PF.js";import{D as r,n as i,r as a,t as o,v as s}from"./index-BfZnvrmA.js";var c=e(),l=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function u({fallback:e}){let u=t(),d=r({select:e=>e.location.state.__TSR_index}),f=a(),p=s(),m=n(),h=i(f,d);if(h===null)return e;let g=o(h,{entity:e=>p.get(e)?.title,project:e=>m.data?.find(t=>t.slug===e)?.name});return(0,c.jsx)(`button`,{type:`button`,onClick:()=>u.history.back(),"aria-label":`Back to ${g}`,title:`Back to ${g}`,className:l,children:`←`})}export{u as t};
@@ -1 +1 @@
1
- import{Sn as e,Tn as t,bn as n,k as r,t as i,xn as a}from"./format-BORdp4w-.js";import{c as o,l as s,s as c}from"./compose-D7DOz6kC.js";import{t as l}from"./link-1v5lugnf.js";import{n as u,r as d}from"./ThreadForms-RnrV7V5X.js";var f=t(e(),1),p=a();function m({project:e,onDone:t}){let{api:i}=r(),a=n(),l=o(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),v=(0,f.useRef)(null);(0,f.useEffect)(()=>v.current?.focus(),[]);let y=s({mutationFn:()=>i.createChannel({project:e,name:m.trim(),purpose:g.trim()}),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`channels`]}),t(),await l({to:`/c/$`,params:{_splat:e}})}});return(0,p.jsxs)(`form`,{"aria-label":`New channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,p.jsx)(`input`,{ref:v,value:m,maxLength:64,spellCheck:!1,"aria-label":`Channel name`,placeholder:`release-0-4`,onChange:e=>h(e.target.value),className:`${u} font-mono`})}),(0,p.jsx)(`input`,{value:g,"aria-label":`Purpose`,placeholder:`What the channel is for`,onChange:e=>_(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:t,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:y.isPending||m.trim()===``||g.trim()===``,children:y.isPending?`Opening…`:`Open`})]}),(0,p.jsx)(`p`,{className:`text-meta`,children:e===null?`Announced in the society's general, and followed by whoever subscribes to it; you read every channel without following one.`:`Announced in ${e}'s general, where its members choose to follow it; you read every channel without following one. Tasks filed in it hang their threads here, and it is archived once its tasks are done.`}),(0,p.jsx)(d,{error:y.error})]})}function h({channel:e,onDone:t}){let{api:i}=r(),a=n(),[o,l]=(0,f.useState)(``),m=s({mutationFn:()=>i.archiveChannel({channel:e,reason:o.trim()}),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`channels`]}),t()}});return(0,p.jsxs)(`form`,{"aria-label":`Archive the channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`input`,{value:o,"aria-label":`Reason`,placeholder:`Why its work is done`,onChange:e=>l(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:t,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:m.isPending||o.trim()===``,children:m.isPending?`Archiving…`:`Archive channel`})]}),(0,p.jsx)(`p`,{className:`text-meta`,children:`Its open threads close, nobody follows it, and nothing more is posted or filed here; its posts, threads, and tasks stay readable. The board refuses while a task filed here is in play.`}),(0,p.jsx)(d,{error:m.error})]})}function g({channels:e,now:t}){return e.length===0?(0,p.jsx)(`p`,{className:`text-meta`,children:`No channels.`}):(0,p.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(l,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm hover:text-fg-primary ${e.archived===void 0?`text-fg-secondary`:`text-fg-tertiary`}`,children:[`# `,e.name]}),(0,p.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.messages,` messages`,e.archived===void 0?``:` · archived ${i(e.archived.at,t)}`]})]},e.ref))})}export{g as n,m as r,h as t};
1
+ import{Cn as e,Dn as t,Sn as n,k as r,t as i,wn as a}from"./format-qPQgH1PF.js";import{c as o,l as s,s as c}from"./compose-BCqmtrsZ.js";import{t as l}from"./link-DF__7B1f.js";import{n as u,r as d}from"./ThreadForms-Bciw71n3.js";var f=t(a(),1),p=e();function m({project:e,onDone:t}){let{api:i}=r(),a=n(),l=o(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),v=(0,f.useRef)(null);(0,f.useEffect)(()=>v.current?.focus(),[]);let y=s({mutationFn:()=>i.createChannel({project:e,name:m.trim(),purpose:g.trim()}),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`channels`]}),t(),await l({to:`/c/$`,params:{_splat:e}})}});return(0,p.jsxs)(`form`,{"aria-label":`New channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),y.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,p.jsx)(`input`,{ref:v,value:m,maxLength:64,spellCheck:!1,"aria-label":`Channel name`,placeholder:`release-0-4`,onChange:e=>h(e.target.value),className:`${u} font-mono`})}),(0,p.jsx)(`input`,{value:g,"aria-label":`Purpose`,placeholder:`What the channel is for`,onChange:e=>_(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:t,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:y.isPending||m.trim()===``||g.trim()===``,children:y.isPending?`Opening…`:`Open`})]}),(0,p.jsx)(`p`,{className:`text-meta`,children:e===null?`Announced in the society's general, and followed by whoever subscribes to it; you read every channel without following one.`:`Announced in ${e}'s general, where its members choose to follow it; you read every channel without following one. Tasks filed in it hang their threads here, and it is archived once its tasks are done.`}),(0,p.jsx)(d,{error:y.error})]})}function h({channel:e,onDone:t}){let{api:i}=r(),a=n(),[o,l]=(0,f.useState)(``),m=s({mutationFn:()=>i.archiveChannel({channel:e,reason:o.trim()}),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`channels`]}),t()}});return(0,p.jsxs)(`form`,{"aria-label":`Archive the channel`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`input`,{value:o,"aria-label":`Reason`,placeholder:`Why its work is done`,onChange:e=>l(e.target.value),className:`${u} min-w-0 flex-1`}),(0,p.jsx)(c,{onClick:t,children:`Cancel`}),(0,p.jsx)(c,{variant:`primary`,type:`submit`,disabled:m.isPending||o.trim()===``,children:m.isPending?`Archiving…`:`Archive channel`})]}),(0,p.jsx)(`p`,{className:`text-meta`,children:`Its open threads close, nobody follows it, and nothing more is posted or filed here; its posts, threads, and tasks stay readable. The board refuses while a task filed here is in play.`}),(0,p.jsx)(d,{error:m.error})]})}function g({channels:e,now:t}){return e.length===0?(0,p.jsx)(`p`,{className:`text-meta`,children:`No channels.`}):(0,p.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(l,{to:`/c/$`,params:{_splat:e.ref},className:`text-sm hover:text-fg-primary ${e.archived===void 0?`text-fg-secondary`:`text-fg-tertiary`}`,children:[`# `,e.name]}),(0,p.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.messages,` messages`,e.archived===void 0?``:` · archived ${i(e.archived.at,t)}`]})]},e.ref))})}export{g as n,m as r,h as t};
@@ -0,0 +1,2 @@
1
+ import{Cn as e,Dn as t,R as n,V as r,_ as i,b as a,c as o,gt as s,jt as c,k as l,nn as u,st as d,t as f,wn as p,x as m}from"./format-qPQgH1PF.js";import{s as h}from"./compose-BCqmtrsZ.js";import{t as g}from"./link-DF__7B1f.js";import{S as _,i as v,k as y,s as b}from"./index-BfZnvrmA.js";import{i as x}from"./ThreadForms-Bciw71n3.js";import{t as S}from"./ChannelForms-mdOuU6eZ.js";import{t as C}from"./MessageItem-Dtpufq_V.js";import{n as w,t as T}from"./Pane-L4GJKBiw.js";import{n as E}from"./ThreadCard-CkqMOMDh.js";import{t as D}from"./useStickyScroll-BFNyJYps.js";var O=t(p(),1),k=/^Knowledge (written|updated|removed): ([a-z0-9][a-z0-9-]{0,31})\. It is (?:no longer )?under knowledge\/\2\.md( of the society)?\.$/;function A(e){if(e.notice!==void 0)return e.notice;let t=e.thread===void 0?k.exec(e.body.trim()):null;if(t===null)return null;let{project:n,channel:r}=c(e.channel);if(r!==`general`||t[3]!==void 0!=(n===null))return null;let i=d.safeParse({kind:`knowledge`,action:t[1],topic:t[2],project:n});return i.success?i.data:null}function j(e,t){let n=e.notices.at(-1);return n!==void 0&&n.kind===`knowledge`&&t.kind===`knowledge`&&n.action!==`removed`&&t.action===`updated`&&n.topic===t.topic&&n.project===t.project}function M(e,t){let n=[],r=null;for(let i of e){let e=t(i),a=e===void 0?null:A(e);e===void 0||a===null?(n.push({kind:`item`,item:i}),r=null):r!==null&&j(r,a)?(r.messages.push(e),r.notices.push(a)):(r={messages:[e],notices:[a]},n.push({kind:`notices`,run:r}))}return n}function N(e){let[t]=e,n=e.length-1;return t===void 0||t.action===`removed`?{did:`removed`,times:null}:t.action===`written`?{did:`wrote`,times:n===0?null:`then updated it ${n===1?`once`:`${n} times`}`}:{did:`updated`,times:n===0?null:`${e.length} times`}}function P(e){let t=[...new Set(e)];return t.length<=2?t.join(` and `):`${t.slice(0,-1).join(`, `)}, and ${t.at(-1)??``}`}var F=e();function I(){return(0,F.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5`,children:(0,F.jsx)(`path`,{d:`M8 4.2C6.4 3 4.4 2.8 2.2 3.4v9.2c2.2-.6 4.2-.4 5.8.8m0-9.2c1.6-1.2 3.6-1.4 5.8-.8v9.2c-2.2-.6-4.2-.4-5.8.8m0-9.2v9.2`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function L({notices:e}){let[t]=e;if(t===void 0)return null;let{did:n,times:r}=N(e);return(0,F.jsxs)(F.Fragment,{children:[n,` knowledge`,` `,t.action===`removed`?(0,F.jsx)(`span`,{className:`text-fg-secondary`,children:t.topic}):(0,F.jsx)(g,{to:`/knowledge/$scope/$topic`,params:{scope:t.project??`society`,topic:t.topic},className:`text-fg-secondary hover:text-fg-primary`,children:t.topic}),r===null?null:` · ${r}`]})}function R(e){let t=e.notices.filter(e=>e.kind===`knowledge`);return{mark:(0,F.jsx)(I,{}),text:(0,F.jsx)(L,{notices:t})}}function z({run:e,now:t}){let n=b(),r=e.messages.at(-1);if(r===void 0)return null;let{mark:i,text:a}=R(e);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-1 text-meta`,children:[(0,F.jsx)(`span`,{className:`grid w-7 shrink-0 place-items-center text-fg-muted`,children:i}),(0,F.jsxs)(`p`,{className:`min-w-0 flex-1 truncate`,children:[P(e.messages.map(e=>n(e.author))),` `,a]}),(0,F.jsx)(`time`,{dateTime:r.ts,title:e.messages.map(e=>`${n(e.author)} ${e.ts}`).join(`
2
+ `),className:`shrink-0`,children:f(r.ts,t)})]})}function B(){let{_splat:e=`general`}=y({from:`/c/$`});return(0,F.jsx)(V,{channel:e},e)}function V({channel:e}){let{api:t}=l(),c=u({queryKey:[`channel`,e],queryFn:()=>t.channel(e)}),d=n(),p=i(),g=m(),y=o(),b=a(3e4),[k,A]=(0,O.useState)(!1),[j,N]=(0,O.useState)(!1),P=(0,O.useMemo)(()=>{let t=(c.data??[]).map(e=>({kind:`message`,at:e.ts,id:e.id,message:e})),n=(d.data??[]).filter(t=>t.channel===e).map(e=>({kind:`thread`,at:e.openedAt,id:e.id,thread:e}));return[...t,...n].toSorted((e,t)=>e.at.localeCompare(t.at)||e.id.localeCompare(t.id))},[c.data,d.data,e]),I=(0,O.useMemo)(()=>M(P,e=>e.kind===`message`?e.message:void 0),[P]),L=c.data?.at(-1)?.id??null;(0,O.useEffect)(()=>_(e,L),[e,L]);let{ref:R,onScroll:B}=D(),[V,H]=e.split(`/`),U=H??V??e,W=H===void 0?void 0:g.data?.find(e=>e.slug===V),G=H===void 0?`society`:W?.name??V,K=y.data?.find(t=>t.ref===e)?.archived,q=W?.archived!==void 0||K!==void 0,J=!q&&!s(H===void 0?null:V??null,U),Y=P.filter(e=>e.kind===`thread`&&e.thread.state===`open`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(T,{title:`# ${U}`,subtitle:`${G} · ${c.data?.length??0} messages${Y.length>0?` · ${Y.length} open threads`:``}`,trailing:k||j||q?null:(0,F.jsxs)(F.Fragment,{children:[J?(0,F.jsx)(h,{onClick:()=>N(!0),children:`Archive…`}):null,(0,F.jsx)(h,{onClick:()=>A(!0),children:`New thread`})]})}),k?(0,F.jsx)(x,{channel:e,onDone:()=>A(!1)}):null,j?(0,F.jsx)(S,{channel:e,onDone:()=>N(!1)}):null,(0,F.jsx)(`div`,{ref:R,onScroll:B,className:`flex-1 overflow-y-auto py-2`,children:c.error instanceof r&&c.error.status===404?(0,F.jsxs)(w,{children:[`There is no channel `,e,`.`]}):c.data===void 0?(0,F.jsx)(w,{children:`Reading the channel…`}):P.length===0?(0,F.jsx)(w,{children:`Nothing has been said here yet.`}):I.map(e=>{if(e.kind===`notices`){let t=e.run.messages[0]?.id??``;return(0,F.jsx)(z,{run:e.run,now:b},t)}let{item:t}=e;return t.kind===`message`?(0,F.jsx)(C,{message:t.message,members:p.data,now:b},t.id):(0,F.jsx)(E,{thread:t.thread,now:b},t.id)})}),c.data===void 0?null:K===void 0?q?(0,F.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[G,` is archived, so its channels are read-only.`]}):(0,F.jsx)(v,{target:{channel:e},placeholder:`Message #${U}`}):(0,F.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-meta`,children:[`Archived `,f(K.at,b),` by `,K.by,`: `,K.reason,`. Its posts, threads, and tasks stay readable; nothing more is posted or filed here.`]})]})}export{B as ChannelView};
@@ -0,0 +1,2 @@
1
+ import{At as e,B as t,Cn as n,D as r,Dn as i,E as a,G as o,L as s,Sn as c,T as l,V as u,_ as d,a as f,b as p,f as m,k as h,l as g,m as _,mt as v,o as y,p as b,t as x,v as S,wn as C,z as w}from"./format-qPQgH1PF.js";import{l as T,s as E}from"./compose-BCqmtrsZ.js";import{t as D}from"./link-DF__7B1f.js";import{t as ee}from"./CliIcon-Cyv7ef-2.js";import{O,_ as k,c as A,d as j,f as te,h as M,i as ne,k as re,l as N,m as P,p as ie,u as ae,v as oe}from"./index-BfZnvrmA.js";import{n as se,r as F}from"./ThreadForms-Bciw71n3.js";import{t as I}from"./Markdown-CI8CWgHq.js";import{n as L,t as ce}from"./Pane-L4GJKBiw.js";import{t as le}from"./useStickyScroll-BFNyJYps.js";import{a as R,c as ue,i as de,l as fe,n as pe,o as z,s as B,t as me,u as V}from"./citizen-Cyd1haJO.js";import{n as H}from"./Picker-h6akABv6.js";var U=i(C(),1),W=n(),he={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function G(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function K({label:e,tone:t,children:n}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,W.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words ${t}`,children:n})]})}function ge({step:e,open:t}){if(e.kind===`say`)return(0,W.jsx)(`li`,{className:`py-1.5 text-sm`,title:G(e.at),children:(0,W.jsx)(I,{text:e.text})});if(e.kind===`error`)return(0,W.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:G(e.at),children:e.message});if(e.kind===`steer`)return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,W.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,j(e.posts.length)]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:e.from.length===0?``:`from ${e.from.join(`, `)}, delivered mid-turn`}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:G(e.at)})]}),(0,W.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,W.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,W.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,W.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,W.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,W.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:G(e.at)})]}),(0,W.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,W.jsx)(I,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,W.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,W.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,W.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,W.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:te(e.name)}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:G(e.at)})]}),(0,W.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,W.jsx)(K,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,W.jsx)(K,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function q({steps:e}){let[t,n]=(0,U.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,W.jsxs)(W.Fragment,{children:[r===0?null:(0,W.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`rounded-md px-1.5 py-0.5 text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary`,children:t?`Collapse all`:`Expand all`})]}),(0,W.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,W.jsx)(ge,{step:e,open:t},e.seq))})]})}function _e({turn:e,running:t,now:n}){return e.end===null?t?(0,W.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,W.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,x(e.lastAt,n)]}):(0,W.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`}):(0,W.jsxs)(`section`,{className:`mt-3 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,W.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,he[e.end.exitReason],` `,x(e.end.at,n),e.fromStart?` · ${N(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}var J=30,ve={turn:`turn`,board:`board`,merge:`both kept`},ye={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function be(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function xe(e){return e.files.map(e=>`${e.path} ${be(e)}`).join(`, `)}function Se(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function Ce({file:e}){return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,W.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,W.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed`,children:e.patch.split(`
2
+ `).map((e,t)=>(0,W.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${Se(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,W.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}function we({name:e,change:t}){let n=m(e,t.commit,!0);return(0,W.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,W.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[t.kind===`merge`?`Two turns on different runners changed the same lines at once. The file kept one turn's version, and this copy holds the other's until the citizen reconciles them.`:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,W.jsx)(D,{to:`/citizen/$name`,params:{name:e},search:{tab:`turns`,turn:t.turnId},className:`text-fg-secondary underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the turn that made it`}),(0,W.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,G(t.at)]})]}),n.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,W.jsx)(Ce,{file:e},e.path))]})}function Te({name:e,change:t,now:n}){let[r,i]=(0,U.useState)(!1),a=t.files.length===0?t.subject:xe(t);return(0,W.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,W.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,W.jsx)(`summary`,{"aria-label":`${ye[t.kind]} ${x(t.at,n)}: ${a}`,className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:ve[t.kind]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,W.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:x(t.at,n)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,W.jsx)(we,{name:e,change:t}):null]})})}function Ee({name:e}){let[t,n]=(0,U.useState)(J),r=_(e,t),i=p(3e4);if(r.data===void 0)return(0,W.jsx)(L,{children:r.isError?`Could not read the home's history.`:`Reading the history…`});let{changes:a,more:o}=r.data;return a.length===0?(0,W.jsxs)(L,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,W.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,children:[`What `,e,`'s turns changed in its memory, skills, and profile, newest first.`]}),(0,W.jsx)(`ol`,{children:a.map(t=>(0,W.jsx)(Te,{name:e,change:t,now:i},t.commit))}),o?(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(t+J),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function Y({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,W.jsx)(`h3`,{className:`text-section`,children:e}),(0,W.jsx)(`div`,{className:`mt-2`,children:t})]})}function De({member:e,charter:t}){let n=S(e.name),r=y(e.name),i=b(e.name),a=p(3e4);return(0,W.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[i.data===void 0||i.data.length===0?null:(0,W.jsxs)(Y,{title:`Edits to reconcile`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Two turns on different runners changed these files at once. Each file kept one version; the other waits beside it until `,e.name,` merges it in and deletes the copy.`]}),(0,W.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,W.jsxs)(`li`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,W.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,x(e.since,a)]})]},e.path))})]}),(0,W.jsx)(Y,{title:`Profile`,children:e.profile.trim()===``?(0,W.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,W.jsx)(I,{text:V(e.profile,`Profile`)})}),(0,W.jsx)(Y,{title:`Core memory`,children:n.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,W.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,W.jsx)(I,{text:V(n.data.body,`Core memory`)})}),(0,W.jsx)(Y,{title:`Own skills`,children:r.data===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,W.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,W.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,W.jsxs)(`li`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,W.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,W.jsxs)(Y,{title:`Charter of ${t.name}`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,W.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Wakes on mentions, stages, and `,t.wakeTriggers.join(`, `)||`nothing else`,t.resident?` · keeps a warm session`:``,t.reflects?` · reflects`:``]}),(0,W.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,W.jsx)(`span`,{className:`rounded-md bg-surface-2/70 px-1.5 py-px font-mono text-[11px] text-fg-tertiary`,children:e},e))})]})]})}function Oe(e,t){let n=w(e,t?.turnId??null);return{turn:(0,U.useMemo)(()=>t===void 0||n.data===void 0?void 0:ie(n.data,e,t.project,t),[t,n.data,e]),loading:t?.turnId!==void 0&&n.isPending,missing:t!==void 0&&(t.turnId===void 0||n.isError)}}var X=50;function ke({name:e,entry:t,now:n,opened:r}){let[i,a]=(0,U.useState)(r),o=(0,U.useRef)(null);(0,U.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`start`})},[r]);let s=oe(),c=ue(t),l=t.thread===void 0?t.channel===void 0?null:`#${t.channel}`:s.get(t.thread)?.title??`a thread`,u=t.error??t.summary??``,d=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,W.jsx)(`li`,{ref:o,className:`border-b border-line/60 last:border-b-0`,children:(0,W.jsxs)(`details`,{className:`group`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,W.jsxs)(`summary`,{className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[R(t.project),l===null?``:` · ${l}`]}),(0,W.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[me(t),` `,x(t.ts,n)]}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:z(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:B(t.usage)].filter(e=>e!==null).join(` · `)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),u.trim()===``?null:(0,W.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${d}`,children:(0,W.jsx)(k,{text:u,links:!1})})]}),i?(0,W.jsx)(Ae,{name:e,entry:t,text:u,tone:d}):null]})})}function Ae({name:e,entry:t,text:n,tone:r}){let i=Oe(e,t);return(0,W.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,W.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,W.jsx)(k,{text:n})}),(0,W.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,W.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,W.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,W.jsxs)(W.Fragment,{children:[t.startedAt===void 0?null:(0,W.jsxs)(`p`,{className:`text-caps`,children:[`Started `,G(t.startedAt)]}),(0,W.jsx)(q,{steps:i.turn.steps})]})})]})}function je({name:e,opened:n}){let[r,i]=(0,U.useState)(X),a=t(e,r),o=p(3e4);if(a.data===void 0)return(0,W.jsx)(L,{children:`Reading the turns…`});let s=a.data.toReversed();if(s.length===0)return(0,W.jsxs)(L,{children:[e,` has not finished a turn yet.`]});let c=pe(s),l=c.usage===null?``:` · ${B(c.usage)}${c.withUsage<c.turns?` over ${c.withUsage} of them`:``}`;return(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,W.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,title:c.usage===null?void 0:z(c.usage),children:[c.turns===1?`1 turn`:`${c.turns} turns`,c.failed===0?``:`, ${c.failed} not completed`,l]}),n!==null&&!s.some(e=>e.turnId===n)?(0,W.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:a.data.length===r?`The turn this address opens is further back; show earlier turns to reach it.`:`The turn this address opens is not in this citizen's history.`}):null,(0,W.jsx)(`ol`,{children:s.map(t=>(0,W.jsx)(ke,{name:e,entry:t,now:o,opened:n!==null&&t.turnId===n},t.id))}),a.data.length===r?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i(r+X),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,X,` earlier turns`]}):null]})}var Z=``,Q=``;function Me(e,t){return[{value:Z,name:`CLI default`,id:e.find(e=>e.isDefault)?.name??null,description:`Whatever the CLI runs when no model is set.`},...e.map(e=>({value:e.id,name:e.name,id:e.name===e.id?null:e.id,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the CLI's list.`}]]}function Ne(e,t){return[{value:Q,name:`Default`,id:e?.defaultEffort??null,description:`Whatever the model runs unset.`},...(e?.efforts??[]).map(e=>({value:e.id,name:e.id,id:null,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the model's list.`}]]}function Pe({member:e,onDone:t}){let{api:n}=h(),r=c(),i=f(e.name),a=e.model??Z,o=e.effort??Q,[s,l]=(0,U.useState)(a),[d,p]=(0,U.useState)(o),m=T({mutationFn:async()=>{s!==a&&await n.setModel(e.name,s===Z?null:s),d!==o&&await n.setEffort(e.name,d===Q?null:d)},onSettled:()=>void r.invalidateQueries({queryKey:[`members`]}),onSuccess:t}),g=i.data?.models??[],_=e.model!==void 0&&!g.some(t=>t.id===e.model)?e.model:null,v=e=>g.find(t=>e===Z?t.isDefault:t.id===e),y=v(s)?.efforts??[],b=d!==Q&&!y.some(e=>e.id===d)?d:null,x=e=>{l(e);let t=v(e)?.efforts??[];d!==Q&&!t.some(e=>e.id===d)&&p(Q)},S=s!==a||d!==o;return(0,W.jsxs)(`form`,{"aria-label":`Model of ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.isPending?(0,W.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,e.cli,` for its models…`]}):i.error===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(H,{label:`Model`,choices:Me(g,_),value:s,onChange:x}),y.length===0&&b===null?null:(0,W.jsx)(`div`,{className:`flex w-32 shrink-0`,children:(0,W.jsx)(H,{label:`Effort`,choices:Ne(v(s),b),value:d,onChange:p,listClassName:`right-0 w-64`})})]}):(0,W.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[e.cli,` did not list its models:`,` `,i.error instanceof u?i.error.message:`the board server did not answer`]}),(0,W.jsx)(E,{onClick:t,children:`Cancel`}),(0,W.jsx)(E,{variant:`primary`,type:`submit`,disabled:m.isPending||!S||i.error!==null,children:m.isPending?`Saving…`:`Save`})]}),i.data===void 0?null:(0,W.jsxs)(`p`,{className:`text-meta`,children:[`As `,i.data.cli,` on `,i.data.runner,` lists them, where this citizen's turns run.`]}),(0,W.jsx)(F,{error:m.error})]})}var $=``;function Fe(e,t){let n=t.cli;return[e.status,e.clis.length===0?`offers no CLI yet`:e.clis.join(`, `),n!==null&&e.clis.length>0&&!e.clis.includes(n)?`has no ${n}`:``,e.capabilities.length===0?``:e.capabilities.join(`, `)].filter(e=>e!==``).join(` · `)}function Ie(e,t){return[{value:$,name:`Any runner`,id:null,description:`Pinned to the least busy runner on its next turn outside a project.`},...e.map(e=>({value:e.name,name:e.name,id:e.os,description:Fe(e,t)}))]}function Le({member:e,onDone:t}){let{api:n}=h(),r=c(),i=a(),o=e.homeRunner??$,[s,l]=(0,U.useState)(o),u=T({mutationFn:()=>n.setRunner(e.name,s===$?null:s),onSuccess:()=>{r.invalidateQueries({queryKey:[`members`]}),t()}});return(0,W.jsxs)(`form`,{"aria-label":`Runner of ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.data===void 0?(0,W.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,W.jsx)(H,{label:`Runner`,choices:Ie(i.data,e),value:s,onChange:l}),(0,W.jsx)(E,{onClick:t,children:`Cancel`}),(0,W.jsx)(E,{variant:`primary`,type:`submit`,disabled:u.isPending||s===o,children:u.isPending?`Saving…`:`Run here`})]}),(0,W.jsx)(`p`,{className:`text-meta`,children:`Its conversations outside projects start afresh there from its next turn; its memory and skills follow it. Project work runs where each project lives.`}),(0,W.jsx)(F,{error:u.error})]})}function Re(t){if(t.thread!==void 0)return{threadId:t.thread};let n=t.scope===`society`?null:t.scope;return t.channel===void 0?{channel:t.askedIn??e(n,`general`)}:{channel:e(n,t.channel)}}function ze({name:e,turn:t}){let{api:n}=h(),r=c(),[i,a]=(0,U.useState)(!1),o=T({mutationFn:()=>n.stopTurn(t.turnId),onSuccess:()=>{a(!1),r.invalidateQueries({queryKey:[`scheduler`]})}});return(0,W.jsxs)(`div`,{className:`border-t border-line`,children:[(0,W.jsx)(ne,{target:Re(t),initialText:`@${e} `,placeholder:t.steerable?`Message ${e} while it works`:`Message ${e} for its next turn`,className:`px-3 pt-3 pb-2`},t.turnId),t.stoppable?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,W.jsx)(`p`,{className:`min-w-0 flex-1 text-[11px] leading-snug text-fg-muted`,children:i?`Ends the turn now. What it was shown counts as read; its stages stay held.`:t.steerable?`Posts reach the turn at its next step.`:`This runner delivers posts after the turn ends.`}),i?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{onClick:()=>{a(!1),o.reset()},children:`Keep it running`}),(0,W.jsx)(E,{variant:`primary`,disabled:o.isPending,onClick:()=>{o.mutate()},children:o.isPending?`Stopping…`:`Stop the turn`})]}):(0,W.jsx)(E,{onClick:()=>a(!0),children:`Stop…`})]}):null,o.error===null?null:(0,W.jsx)(`div`,{className:`px-3 pb-3`,children:(0,W.jsx)(F,{error:o.error})})]})}function Be({member:e,scopes:t,preferred:n,running:r,paused:i,onDone:a}){let{api:o}=h(),s=c(),[l,u]=(0,U.useState)(`manual`),[d,f]=(0,U.useState)(n!==null&&t.includes(n)?n:t[0]??``),[p,m]=(0,U.useState)(``),g=(0,U.useRef)(null);(0,U.useEffect)(()=>g.current?.focus(),[]);let _=T({mutationFn:()=>o.wake({agent:e.name,project:d,kind:l,...p.trim()===``?{}:{reason:p.trim()}}),onSuccess:()=>{s.invalidateQueries({queryKey:[`scheduler`]}),a()}}),v=R(d),y=l===`reflection`?`Asks ${e.name} to reflect at ${v}: consolidate its memory, skills, and profile, and take no new work. It restarts the reflection clock.`:`Starts a turn for ${e.name} at ${v} as soon as the scheduler takes it.`,b=i?` The society is paused, so it waits until you resume.`:r.includes(d)?` ${e.name} is in a turn there now; this one follows it.`:``;return(0,W.jsxs)(`form`,{"aria-label":`Wake ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,W.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${l===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:l===e,onChange:()=>u(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,W.jsxs)(`div`,{className:`ml-auto flex w-52 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:`at`}),(0,W.jsx)(H,{label:`Where`,choices:de(t),value:d,onChange:f})]})]}),(0,W.jsx)(`textarea`,{ref:g,value:p,rows:2,placeholder:l===`reflection`?`Anything to reflect on in particular? Optional.`:`What should it look at? It reads this as the reason it was woken.`,"aria-label":`Reason`,onChange:e=>m(e.target.value),className:`${se} resize-none`}),(0,W.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,W.jsx)(E,{onClick:a,children:`Cancel`}),(0,W.jsx)(E,{variant:`primary`,type:`submit`,disabled:_.isPending||d===``,children:_.isPending?`Waking…`:l===`reflection`?`Ask for a reflection`:`Wake ${e.name}`})]}),(0,W.jsx)(F,{error:_.error})]})}var Ve={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function He({project:e,name:t}){let n=(s(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,W.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(D,{to:`/task/$taskId`,params:{taskId:e.id},className:`flex items-center gap-2 rounded-md text-xs text-fg-secondary hover:text-fg-primary`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,W.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:v(e)?.name??e.stage})]})},e.id))})}function Ue(){let{name:e}=re({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=O({from:`/citizen/$name`});return(0,W.jsx)(Ge,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var We=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ge({name:e,chosen:t,tab:n,turn:i}){let a=d(),s=l(),c=r(),u=M(),f=g(),[p,m]=(0,U.useState)(null),h=a.data?.find(t=>t.name===e);if(h===void 0)return(0,W.jsx)(L,{children:a.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let _=o(c.data?.running??[]).filter(t=>t.agent===e),v=[...new Set(_.map(e=>e.scope))],y=_.map(e=>ae(e.agent,e.scope,e)),b=o(c.data?.pending??[]).find(t=>t.agent===e),x=v.length>0?`working`:b===void 0?`idle`:`queued`,S=P(u,e)[0],C=S?.model??h.lastModel,w=C??h.model??`CLI default`,T=h.model!==void 0&&h.model!==C?h.model:null,O=s.data?.find(e=>e.name===h.role),k=fe(h),A=h.status===`active`&&h.cli!==null,j=(f.data??[]).filter(t=>t.agent===e&&t.ended===void 0).length;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{leading:h.cli===null?null:(0,W.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,W.jsx)(ee,{cli:h.cli,size:20})}),title:e,subtitle:(0,W.jsxs)(W.Fragment,{children:[h.role,` · `,w,T===null?``:` · set to ${T}`,h.effort===void 0?``:` · ${h.effort} effort`,h.homeRunner===void 0?``:` · on ${h.homeRunner}`,h.status===`retired`?` · retired`:``]}),trailing:(0,W.jsxs)(W.Fragment,{children:[j===0?null:(0,W.jsx)(D,{to:`/crons`,search:{agent:e},className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:j===1?`1 cron`:`${j} crons`}),A&&p===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{onClick:()=>m(`model`),children:`Model…`}),(0,W.jsx)(E,{onClick:()=>m(`runner`),children:`Runner…`}),(0,W.jsx)(E,{onClick:()=>m(`wake`),children:`Wake…`})]}):null,(0,W.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Ve[x]}`,children:x})]})}),p===`wake`?(0,W.jsx)(Be,{member:h,scopes:k,preferred:t?.split(`/`)[0]??S?.scope??null,running:v,paused:c.data?.paused??!1,onDone:()=>m(null)}):p===`model`?(0,W.jsx)(Pe,{member:h,onDone:()=>m(null)}):p===`runner`?(0,W.jsx)(Le,{member:h,onDone:()=>m(null)}):null,(0,W.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:We.map(r=>(0,W.jsx)(D,{to:`/citizen/$name`,params:{name:e},search:{...t===null?{}:{scope:t},...r.tab===`now`?{}:{tab:r.tab}},replace:!0,"aria-current":r.tab===n?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${r.tab===n?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:r.label},r.tab))}),n===`turns`?(0,W.jsx)(je,{name:e,opened:i},i):n===`memory`?(0,W.jsx)(De,{member:h,charter:O}):n===`history`?(0,W.jsx)(Ee,{name:e}):(0,W.jsx)(qe,{name:e,chosen:t,lastTurnAt:h.lastTurnAt,state:x,runningScopes:v,runningKeys:y,runningTurns:(c.data?.turns??[]).filter(t=>t.agent===e),queuedScope:b?.scope??null})]})}function Ke(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function qe({name:e,chosen:n,lastTurnAt:r,state:i,runningScopes:a,runningKeys:o,runningTurns:s,queuedScope:c}){let l=M(),u=p(5e3),{ref:d,onScroll:f}=le(),m=P(l,e),h=t(e,1),g=Oe(e,m.length===0?h.data?.at(-1):void 0),_=oe(),v=e=>e.end===null&&o.includes(ae(e.agent,e.scope,e)),y=n?.split(`/`)[0]??null,b=(n?.includes(`/`)===!0?m.find(e=>A(e)===n):void 0)??Ke(m.filter(e=>e.scope===y&&v(e)))??m.find(e=>A(e)===n)??Ke(m.filter(v))??m[0]??g.turn,S=e=>e.thread===void 0?e.channel===void 0?R(e.scope):`${R(e.scope)} · #${e.channel}`:`${R(e.scope)} · ${_.get(e.thread)?.title??`a thread`}`,C=b!==void 0&&v(b),w=b?.scope??a[0]??c,T=(b===void 0?void 0:s.find(e=>e.scope===b.scope&&e.thread===b.thread&&e.channel===b.channel))??(C?void 0:s[0]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,W.jsx)(`p`,{children:C?`In a turn at ${R(b.scope)} for ${b.fromStart?``:`at least `}${N(b.startedAt,u)}`:a.length>0?`In a turn at ${a.map(R).join(` and `)}`:c===null?r===void 0?`No turns yet`:`Last turn ${x(r,u)}`:`Queued for a turn at ${R(c)}`}),w===null||w===`society`?null:(0,W.jsx)(He,{project:w,name:e})]}),(0,W.jsx)(`div`,{ref:d,onScroll:f,className:`flex-1 overflow-y-auto px-4 py-3`,children:b===void 0?(0,W.jsx)(L,{children:i===`working`?`The turn has not reported a step yet.`:g.loading?`Reading the last turn…`:r===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps; Turns lists every finished one.`}):(0,W.jsxs)(W.Fragment,{children:[m.length>1?(0,W.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:m.toSorted((e,t)=>A(e).localeCompare(A(t))).map(t=>(0,W.jsxs)(D,{to:`/citizen/$name`,params:{name:e},search:{scope:A(t)},replace:!0,"aria-current":t===b?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===b?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[v(t)?(0,W.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,S(t)]},A(t)))}):null,(0,W.jsxs)(`p`,{className:`text-caps`,children:[C?`This turn`:`Last turn`,` · `,S(b),` · started`,` `,b.fromStart?G(b.startedAt):`before the earliest step shown`]}),b.fromStart?null:(0,W.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,C?``:`; Turns has the whole turn`,`.`]}),(0,W.jsx)(q,{steps:b.steps}),(0,W.jsx)(_e,{turn:b,running:C,now:u})]})}),T===void 0?null:(0,W.jsx)(ze,{name:e,turn:T})]})}export{Ue as CitizenView};
@@ -1 +1 @@
1
- import{D as e,W as t,_ as n,x as r,xn as i}from"./format-BORdp4w-.js";import{t as a}from"./link-1v5lugnf.js";import{t as o}from"./CliIcon-DxDvRRcX.js";import{n as s,t as c}from"./Pane-CODhA5zE.js";import{i as l,r as u}from"./citizen-aLkZ4owL.js";var d=i();function f(e){let t=e.lastModel??e.model??`CLI default`,n=e.model!==void 0&&e.model!==t?`${t} · set to ${e.model}`:t;return e.effort===void 0?n:`${n} · ${e.effort}`}function p(e,t){return e.name.localeCompare(t.name)}function m(e,t){return e.role.localeCompare(t.role)||p(e,t)}function h(){let i=n(),h=e(),g=r();if(i.data===void 0)return(0,d.jsx)(s,{children:`Reading the roster…`});let _=i.data.filter(e=>e.cli!==null),v=_.filter(e=>e.status===`active`).toSorted(m),y=_.filter(e=>e.status!==`active`).toSorted(p),b=new Set(v.map(e=>e.role)).size,x=t(h.data?.running??[]),S=t(h.data?.pending??[]),C=new Map((g.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),w=e=>{let t=[...new Set(x.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(l).join(` and `)}`,tone:`text-emerald-300`}:S.some(t=>t.agent===e.name)?{label:`queued`,detail:`queued for a turn`,tone:`text-amber-300`}:{label:`resting`,detail:`resting`,tone:`text-fg-muted`}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{title:`Citizens`,subtitle:`${v.length} active in ${b===1?`1 role`:`${b} roles`}${y.length===0?``:` · ${y.length} retired`}`}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[v.length===0?(0,d.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No citizens yet. Ask the concierge for one.`}):null,(0,d.jsx)(`ul`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_auto_minmax(3rem,1fr)_auto] gap-x-3`,children:v.map(e=>{let t=w(e),n=f(e),r=e.memberships.length===0?`no projects`:e.memberships.join(`, `),i=u(e,C);return(0,d.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,d.jsxs)(a,{to:`/citizen/$name`,params:{name:e.name},className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,d.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e.cli===null?null:(0,d.jsx)(o,{cli:e.cli,size:13})}),(0,d.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,d.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:n,children:n}),(0,d.jsx)(`span`,{className:`text-xs text-fg-muted`,title:i.detail,children:i.label}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,d.jsx)(`span`,{className:`text-right text-xs ${t.tone}`,title:t.detail,children:t.label})]})},e.name)})}),y.length===0?null:(0,d.jsxs)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:[`Retired: `,y.map(e=>`${e.name} (${e.role})`).join(`, `)]})]})]})}export{h as CitizensView};
1
+ import{Cn as e,D as t,G as n,_ as r,x as i}from"./format-qPQgH1PF.js";import{t as a}from"./link-DF__7B1f.js";import{t as o}from"./CliIcon-Cyv7ef-2.js";import{n as s,t as c}from"./Pane-L4GJKBiw.js";import{a as l,r as u}from"./citizen-Cyd1haJO.js";var d=e();function f(e){let t=e.lastModel??e.model??`CLI default`,n=e.model!==void 0&&e.model!==t?`${t} · set to ${e.model}`:t;return e.effort===void 0?n:`${n} · ${e.effort}`}function p(e,t){return e.name.localeCompare(t.name)}function m(e,t){return e.role.localeCompare(t.role)||p(e,t)}function h(){let e=r(),h=t(),g=i();if(e.data===void 0)return(0,d.jsx)(s,{children:`Reading the roster…`});let _=e.data.filter(e=>e.cli!==null),v=_.filter(e=>e.status===`active`).toSorted(m),y=_.filter(e=>e.status!==`active`).toSorted(p),b=new Set(v.map(e=>e.role)).size,x=n(h.data?.running??[]),S=n(h.data?.pending??[]),C=new Map((g.data??[]).flatMap(e=>e.runner===void 0?[]:[[e.slug,e.runner]])),w=e=>{let t=[...new Set(x.filter(t=>t.agent===e.name).map(e=>e.scope))];return t.length>0?{label:`working`,detail:`in a turn at ${t.map(l).join(` and `)}`,tone:`text-emerald-300`}:S.some(t=>t.agent===e.name)?{label:`queued`,detail:`queued for a turn`,tone:`text-amber-300`}:{label:`resting`,detail:`resting`,tone:`text-fg-muted`}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{title:`Citizens`,subtitle:`${v.length} active in ${b===1?`1 role`:`${b} roles`}${y.length===0?``:` · ${y.length} retired`}`}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[v.length===0?(0,d.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No citizens yet. Ask the concierge for one.`}):null,(0,d.jsx)(`ul`,{className:`grid grid-cols-[auto_auto_auto_minmax(0,max-content)_auto_minmax(3rem,1fr)_auto] gap-x-3`,children:v.map(e=>{let t=w(e),n=f(e),r=e.memberships.length===0?`no projects`:e.memberships.join(`, `),i=u(e,C);return(0,d.jsx)(`li`,{className:`col-span-full grid grid-cols-subgrid`,children:(0,d.jsxs)(a,{to:`/citizen/$name`,params:{name:e.name},className:`col-span-full grid grid-cols-subgrid items-center rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-surface-2/50`,children:[(0,d.jsx)(`span`,{className:`grid size-4 place-items-center`,children:e.cli===null?null:(0,d.jsx)(o,{cli:e.cli,size:13})}),(0,d.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,d.jsx)(`span`,{className:`text-fg-secondary`,children:e.role}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:n,children:n}),(0,d.jsx)(`span`,{className:`text-xs text-fg-muted`,title:i.detail,children:i.label}),(0,d.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,title:r,children:r}),(0,d.jsx)(`span`,{className:`text-right text-xs ${t.tone}`,title:t.detail,children:t.label})]})},e.name)})}),y.length===0?null:(0,d.jsxs)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-meta`,children:[`Retired: `,y.map(e=>`${e.name} (${e.role})`).join(`, `)]})]})]})}export{h as CitizensView};
@@ -1 +1 @@
1
- import{xn as e}from"./format-BORdp4w-.js";var t=`M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656`,n={claude:{label:`Claude Code`,path:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`,fill:`#D97757`,accent:`#fb923c`},codex:{label:`Codex`,path:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`,fill:`#f5f5f5`,accent:`#10b981`}},r=e();function i({cli:e,size:t=16}){let i=n[e];return(0,r.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,className:`shrink-0`,children:(0,r.jsx)(`path`,{d:i.path,fill:i.fill,fillRule:`evenodd`,clipRule:`evenodd`})})}export{n,t as r,i as t};
1
+ import{Cn as e}from"./format-qPQgH1PF.js";var t=`M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656`,n={claude:{label:`Claude Code`,path:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`,fill:`#D97757`,accent:`#fb923c`},codex:{label:`Codex`,path:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`,fill:`#f5f5f5`,accent:`#10b981`}},r=e();function i({cli:e,size:t=16}){let i=n[e];return(0,r.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,className:`shrink-0`,children:(0,r.jsx)(`path`,{d:i.path,fill:i.fill,fillRule:`evenodd`,clipRule:`evenodd`})})}export{n,t as r,i as t};
@@ -0,0 +1 @@
1
+ import{Cn as e,Dn as t,M as n,R as r,Sn as i,_ as a,b as o,ft as s,k as c,l,t as u,wn as d,wt as f,x as p}from"./format-qPQgH1PF.js";import{l as m,s as h}from"./compose-BCqmtrsZ.js";import{t as g}from"./link-DF__7B1f.js";import{t as _}from"./CliIcon-Cyv7ef-2.js";import{C as v,E as y,O as b,T as x,w as S}from"./index-BfZnvrmA.js";import{n as C,r as w}from"./ThreadForms-Bciw71n3.js";import{t as T}from"./Markdown-CI8CWgHq.js";import{n as E,t as D}from"./Pane-L4GJKBiw.js";import{a as O,i as k,l as A}from"./citizen-Cyd1haJO.js";import{n as j,r as M,t as N}from"./Picker-h6akABv6.js";var P=t(d(),1),F=e(),I=[`UTC`,...Intl.supportedValuesOf(`timeZone`).filter(e=>e!==`UTC`)],L=50;function R(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).formatToParts(t).find(e=>e.type===`timeZoneName`)?.value??``;return n===`GMT`?`UTC`:n.replace(`GMT`,`UTC`)}function z({value:e,onChange:t,label:n,placeholder:r}){let[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(0),c=(0,P.useRef)(null),l=(0,P.useRef)([]),u=e.trim().toLowerCase(),d=(0,P.useMemo)(()=>(u===``?I:I.filter(e=>e.toLowerCase().includes(u))).slice(0,L),[u]),f=(0,P.useMemo)(()=>new Date,[]);(0,P.useEffect)(()=>{i&&l.current[o]?.scrollIntoView({block:`nearest`})},[i,o]),(0,P.useEffect)(()=>{if(!i)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!0||a(!1)};return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[i]);let p=e=>{t(e),a(!1)};return(0,F.jsxs)(`div`,{ref:c,className:`relative min-w-0 flex-1`,children:[(0,F.jsx)(`input`,{"aria-label":n,value:e,spellCheck:!1,autoComplete:`off`,placeholder:r,onChange:e=>{t(e.target.value),s(0),a(!0)},onClick:()=>a(!0),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!i){a(!0);return}let t=e.key===`ArrowDown`?1:-1;s(e=>(e+t+d.length)%Math.max(d.length,1));return}if(e.key===`Enter`&&i&&d[o]!==void 0){e.preventDefault(),p(d[o]);return}if(e.key===`Tab`){a(!1);return}e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),a(!1))},className:C}),i&&d.length>0&&(d.length!==1||d[0]!==e)?(0,F.jsx)(`div`,{className:`max-h-48 ${N}`,children:d.map((e,t)=>(0,F.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,tabIndex:-1,"aria-current":t===o?`true`:void 0,onPointerDown:e=>e.preventDefault(),onPointerEnter:()=>s(t),onClick:()=>p(e),className:M(t===o),children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-secondary`,children:e}),(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-muted`,children:R(e,f)})]},e))}):null]})}function B({word:e,children:t}){return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-tertiary`,children:e}),t]})}function V(e,t){return f(typeof e==`string`?new Date(e):e,t)}function H({cron:e}){let t=r(),n=S(e);if(n.kind===`thread`){let e=t.data?.find(e=>e.id===n.id)?.title??n.id;return(0,F.jsxs)(g,{to:`/thread/$threadId`,params:{threadId:n.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return n.kind===`channel`?(0,F.jsxs)(g,{to:`/c/$`,params:{_splat:n.ref},className:`hover:text-fg-primary`,children:[`#`,n.ref]}):(0,F.jsxs)(`span`,{children:[`home at `,O(n.scope)]})}function U({cron:e,next:t,member:n,zone:r,now:a,focused:o}){let s=(0,P.useRef)(null);(0,P.useEffect)(()=>{o&&s.current!==null&&(s.current.open=!0,s.current.scrollIntoView({block:`nearest`}))},[o]);let{api:l}=c(),d=i(),[f,p]=(0,P.useState)(!1),[v,y]=(0,P.useState)(``),b=()=>void d.invalidateQueries({queryKey:[`crons`]}),S=m({mutationFn:t=>l.pauseCron(e.id,t),onSuccess:b}),E=m({mutationFn:()=>l.removeCron(e.id,v.trim()),onSuccess:b}),D=`at`in e.schedule?`once, ${V(e.schedule.at,r)}`:`${e.schedule.cron} · ${e.schedule.timezone??r}`,O=e.ended===void 0?e.paused===void 0?t===null?`no time to come`:t.getTime()<=a?`due, waiting for its turn`:u(t.toISOString(),a):`paused`:`ended ${u(e.ended.at,a)}`,k=x(e);return(0,F.jsx)(`li`,{className:`rounded-lg ${o?`bg-surface-2/30`:``}`,children:(0,F.jsxs)(`details`,{ref:s,className:`group`,children:[(0,F.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-lg px-2 py-2 hover:bg-surface-2/40 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[n?.cli===void 0||n.cli===null?null:(0,F.jsx)(_,{cli:n.cli,size:13}),(0,F.jsx)(`span`,{className:`shrink-0 text-fg-secondary`,children:e.agent}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-primary`,children:e.title}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs ${e.paused===void 0?`text-fg-muted`:`text-amber-300`}`,title:t===null?void 0:`${V(t,r)}, ${r}`,children:O})]}),(0,F.jsxs)(`p`,{className:`mt-0.5 flex items-baseline gap-1.5 truncate text-meta`,children:[(0,F.jsx)(`span`,{children:D}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,F.jsx)(H,{cron:e}),e.lastRun===void 0?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,F.jsxs)(`span`,{children:[`last turn `,e.lastRun.outcome,` `,u(e.lastRun.at,a)]})]}),k?(0,F.jsxs)(`span`,{className:`text-amber-300`,children:[`· `,e.failures,` failed in a row`]}):null]})]}),(0,F.jsxs)(`div`,{className:`space-y-3 px-2 pt-1 pb-3`,children:[(0,F.jsx)(`div`,{className:`rounded-lg bg-surface-2/30 px-3 py-2`,children:(0,F.jsx)(T,{text:e.note})}),(0,F.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,u(e.createdAt,a),e.lastFiredAt===void 0?``:` · fired last ${V(e.lastFiredAt,r)}`,e.ended===void 0?``:` · ended by ${e.ended.by}: ${e.ended.reason}`]}),t===null?null:(0,F.jsxs)(`p`,{className:`text-meta`,children:[`Next `,V(t,r),` (`,r,`)`]}),e.lastRun===void 0?null:(0,F.jsx)(g,{to:`/citizen/$name`,params:{name:e.agent},search:{tab:`turns`,turn:e.lastRun.turnId},className:`text-meta underline-offset-2 hover:text-fg-primary hover:underline`,children:`Open its last turn`}),e.ended===void 0?f?(0,F.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),E.mutate()},children:[(0,F.jsx)(`input`,{value:v,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>y(e.target.value),className:C}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsx)(h,{onClick:()=>p(!1),children:`Cancel`}),(0,F.jsx)(h,{variant:`primary`,type:`submit`,disabled:E.isPending||v.trim()===``,children:E.isPending?`Removing…`:`Remove cron`})]}),(0,F.jsx)(w,{error:E.error})]}):(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsx)(h,{onClick:()=>S.mutate(e.paused===void 0),disabled:S.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,F.jsx)(h,{onClick:()=>p(!0),children:`Remove…`}),(0,F.jsx)(w,{error:S.error})]}):null]})]})})}function W({zone:e,onDone:t}){let{api:n}=c(),r=i(),[a,o]=(0,P.useState)(e),s=new Intl.DateTimeFormat().resolvedOptions().timeZone,l=m({mutationFn:()=>n.setTimezone(a.trim()),onSuccess:()=>{r.invalidateQueries({queryKey:[`society`]}),r.invalidateQueries({queryKey:[`crons`]}),t()}});return(0,F.jsxs)(`form`,{"aria-label":`Time zone`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(z,{value:a,onChange:o,label:`Society time zone`}),s===a?null:(0,F.jsxs)(h,{onClick:()=>o(s),children:[`Use `,s]})]}),(0,F.jsx)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:`Crons that name no zone are read in it, so their times move with it, and every turn's prompt tells the time in it.`}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsx)(h,{onClick:t,children:`Cancel`}),(0,F.jsx)(h,{variant:`primary`,type:`submit`,disabled:l.isPending||a.trim()===``||a.trim()===e,children:l.isPending?`Saving…`:`Save`})]}),(0,F.jsx)(w,{error:l.error})]})}function G({members:e,preferred:t,zone:r,onDone:a}){let{api:l}=c(),u=i(),d=p(),f=n(),[g,_]=(0,P.useState)(e.find(e=>e.name===t)?.name??e[0]?.name??``),v=e.find(e=>e.name===g),b=v===void 0?[]:A(v),[x,S]=(0,P.useState)(b[0]??`society`),[T,E]=(0,P.useState)(``),[D,O]=(0,P.useState)(`repeats`),[M,N]=(0,P.useState)(`0 9 * * 1-5`),[I,L]=(0,P.useState)(``),[R,H]=(0,P.useState)(``),[U,W]=(0,P.useState)(``),[G,K]=(0,P.useState)(``),q=(0,P.useRef)(null);(0,P.useEffect)(()=>q.current?.focus(),[]);let J=o(3e4),Y=(x===`society`?f.data?.channels??[]:d.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),X=D===`repeats`?{cron:M,...I.trim()===``?{}:{timezone:I.trim()}}:{at:R===``?``:new Date(R).toISOString()},Z=y(D===`once`&&R===``?{at:`invalid`}:X,r,new Date(J)),Q=D===`repeats`?I.trim()===``?r:I.trim():r,$=m({mutationFn:()=>l.createCron({agent:g,title:U.trim(),note:G.trim(),project:x,...T===``?{}:{channel:T},...X}),onSuccess:()=>{u.invalidateQueries({queryKey:[`crons`]}),a()}});return(0,F.jsxs)(`form`,{"aria-label":`New cron`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),$.mutate()},children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(B,{word:`wakes`,children:(0,F.jsx)(j,{label:`Citizen`,choices:e.map(e=>({value:e.name,name:e.name,id:e.role,description:e.memberships.length===0?`in no project`:`in ${e.memberships.join(`, `)}`})),value:g,onChange:t=>{let n=e.find(e=>e.name===t);_(t),S(n===void 0?s:A(n)[0]??`society`),E(``)}})}),(0,F.jsx)(B,{word:`at`,children:(0,F.jsx)(j,{label:`Where`,choices:k(b),value:x,onChange:e=>{S(e),E(``)}})}),(0,F.jsx)(B,{word:`in`,children:(0,F.jsx)(j,{label:`Conversation`,choices:[{value:``,name:`its home`,id:null,description:`general, and work tied to no other channel`},...Y.map(e=>({value:e,name:`#${e}`,id:null,description:`a workstream's own conversation`}))],value:T,onChange:E})})]}),(0,F.jsx)(`input`,{ref:q,value:U,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>W(e.target.value),className:C}),(0,F.jsx)(`textarea`,{value:G,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires; the citizen reads this in every turn it starts.`,onChange:e=>K(e.target.value),className:`${C} resize-none`}),(0,F.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,F.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,F.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${D===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:D===e,onChange:()=>O(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),D===`repeats`?(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,F.jsx)(`input`,{value:M,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>N(e.target.value),className:C})}),(0,F.jsx)(z,{value:I,onChange:L,label:`Its time zone`,placeholder:`${r}, the society's`})]}):(0,F.jsx)(`input`,{type:`datetime-local`,value:R,"aria-label":`When, in this browser's time`,onChange:e=>H(e.target.value),className:C}),(0,F.jsxs)(`p`,{"aria-live":`polite`,className:`text-[11px] leading-relaxed text-fg-muted`,children:[`error`in Z?(0,F.jsx)(`span`,{className:`text-amber-300`,children:Z.error}):(0,F.jsxs)(F.Fragment,{children:[Z.times.length===1?`Fires `:`Fires next `,Z.times.map(e=>V(e,Q)).join(`, `),` (`,Q,`).`]}),` `,`Each fire is a turn for `,g===``?`the citizen`:g,`, which costs money.`]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsx)(h,{onClick:a,children:`Cancel`}),(0,F.jsx)(h,{variant:`primary`,type:`submit`,disabled:$.isPending||g===``||U.trim()===``||G.trim()===``||`error`in Z,children:$.isPending?`Setting…`:`Set cron`})]}),(0,F.jsx)(w,{error:$.error})]})}function K(){let{agent:e,cron:t}=b({from:`/crons`}),r=l(),i=a(),s=n(),c=o(3e4),[u,d]=(0,P.useState)(null),f=s.data?.timezone??`UTC`,p=(r.data??[]).filter(t=>e===void 0||t.agent===e),m=v(p,f),_=p.filter(x).length,y=(i.data??[]).filter(e=>e.status===`active`&&e.cli!==null),S=e=>i.data?.find(t=>t.name===e);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(D,{title:e===void 0?`Crons`:`Crons of ${e}`,subtitle:[`${m.active.length} running`,...m.paused.length===0?[]:[`${m.paused.length} paused`],..._===0?[]:[`${_} failing`],`times in ${f}`].join(` · `),trailing:u===null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(h,{onClick:()=>d(`zone`),children:`Time zone…`}),(0,F.jsx)(h,{onClick:()=>d(`new`),disabled:y.length===0,children:`New cron…`})]}):null}),u===`new`?(0,F.jsx)(G,{members:y,preferred:e,zone:f,onDone:()=>d(null)}):u===`zone`?(0,F.jsx)(W,{zone:f,onDone:()=>d(null)}):null,(0,F.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,F.jsx)(g,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),r.error!==null&&r.data===void 0?(0,F.jsxs)(E,{children:[`The board server did not list its crons (`,r.error.message,`); one older than this interface has none.`]}):r.data===void 0?(0,F.jsx)(E,{children:`Reading the crons…`}):m.active.length+m.paused.length+m.ended.length===0?(0,F.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No crons yet. A citizen sets one with create_cron when it needs to come back to something later; you can set one for any citizen here.`}):null,m.active.length===0?null:(0,F.jsx)(`ul`,{"aria-label":`Running`,className:`space-y-0.5`,children:m.active.map(({cron:e,next:n})=>(0,F.jsx)(U,{cron:e,next:n,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))}),m.paused.length===0?null:(0,F.jsxs)(`section`,{"aria-label":`Paused`,className:`mt-3`,children:[(0,F.jsx)(`h3`,{className:`px-2 pb-1 text-section`,children:`Paused`}),(0,F.jsx)(`ul`,{className:`space-y-0.5`,children:m.paused.map(e=>(0,F.jsx)(U,{cron:e,next:null,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))})]}),m.ended.length===0?null:(0,F.jsxs)(`details`,{className:`mt-3`,open:m.ended.some(e=>e.id===t),children:[(0,F.jsxs)(`summary`,{className:`cursor-pointer px-2 pb-1 text-section`,children:[`Ended (`,m.ended.length,`)`]}),(0,F.jsx)(`ul`,{"aria-label":`Ended`,className:`space-y-0.5`,children:m.ended.map(e=>(0,F.jsx)(U,{cron:e,next:null,member:S(e.agent),zone:f,now:c,focused:e.id===t},e.id))})]})]})]})}export{K as CronsView};
@@ -1 +1 @@
1
- import{Sn as e,Tn as t,b as n,bn as r,h as i,k as a,t as o,ut as s,x as c,xn as l}from"./format-BORdp4w-.js";import{c as u,l as d,s as f}from"./compose-D7DOz6kC.js";import{t as p}from"./link-1v5lugnf.js";import{k as m}from"./index-7uInG5D9.js";import{r as h}from"./ThreadForms-RnrV7V5X.js";import{t as g}from"./Markdown-Dw04_ImA.js";import{n as _,t as v}from"./Pane-CODhA5zE.js";import{t as y}from"./BackLink-giAdtos8.js";var b=t(e(),1),x=l(),S=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function C(){let{scope:e,topic:t}=m({from:`/knowledge/$scope/$topic`}),{api:l}=a(),C=r(),w=u(),T=i(e),E=c(),D=n(3e4),[O,k]=(0,b.useState)(!1),A=e===s,j=A?`the society`:E.data?.find(t=>t.slug===e)?.name??e,M=T.data?.find(e=>e.topic===t),N=d({mutationFn:()=>l.removeKnowledge({project:A?null:e,topic:t}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,e]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})}}),P=A?(0,x.jsx)(p,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(p,{to:`/p/$slug`,params:{slug:e},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(_,{children:T.data===void 0?`Reading…`:`${j} has no topic ${t}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(v,{leading:(0,x.jsx)(y,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${o(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(f,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 text-meta`,children:[`No turn or search finds `,M.topic,` again, and a note in`,` `,A?`#general`:`#${e}/general`,` says so without waking anyone. The server keeps its text aside.`]}),(0,x.jsx)(f,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(h,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(g,{text:M.body})})]})}export{C as KnowledgeView};
1
+ import{Cn as e,Dn as t,Sn as n,b as r,ft as i,h as a,k as o,t as s,wn as c,x as l}from"./format-qPQgH1PF.js";import{c as u,l as d,s as f}from"./compose-BCqmtrsZ.js";import{t as p}from"./link-DF__7B1f.js";import{k as m}from"./index-BfZnvrmA.js";import{r as h}from"./ThreadForms-Bciw71n3.js";import{t as g}from"./Markdown-CI8CWgHq.js";import{n as _,t as v}from"./Pane-L4GJKBiw.js";import{t as y}from"./BackLink-B5n6YQVF.js";var b=t(c(),1),x=e(),S=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`;function C(){let{scope:e,topic:t}=m({from:`/knowledge/$scope/$topic`}),{api:c}=o(),C=n(),w=u(),T=a(e),E=l(),D=r(3e4),[O,k]=(0,b.useState)(!1),A=e===i,j=A?`the society`:E.data?.find(t=>t.slug===e)?.name??e,M=T.data?.find(e=>e.topic===t),N=d({mutationFn:()=>c.removeKnowledge({project:A?null:e,topic:t}),onSuccess:async()=>{await C.invalidateQueries({queryKey:[`knowledge`,e]}),await w(A?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})}}),P=A?(0,x.jsx)(p,{to:`/society`,"aria-label":`Back to the society`,className:S,children:`←`}):(0,x.jsx)(p,{to:`/p/$slug`,params:{slug:e},"aria-label":`Back to ${j}`,className:S,children:`←`});return M===void 0?(0,x.jsx)(_,{children:T.data===void 0?`Reading…`:`${j} has no topic ${t}.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(v,{leading:(0,x.jsx)(y,{fallback:P}),title:M.topic,subtitle:`Knowledge of ${j} · written by ${M.updatedBy} ${s(M.updatedAt,D)}`,trailing:O?null:(0,x.jsx)(f,{onClick:()=>k(!0),children:`Remove…`})}),O?(0,x.jsxs)(`form`,{"aria-label":`Remove the topic`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),N.mutate()},children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`p`,{className:`min-w-0 flex-1 text-meta`,children:[`No turn or search finds `,M.topic,` again, and a note in`,` `,A?`#general`:`#${e}/general`,` says so without waking anyone. The server keeps its text aside.`]}),(0,x.jsx)(f,{onClick:()=>k(!1),children:`Cancel`}),(0,x.jsx)(f,{variant:`primary`,type:`submit`,disabled:N.isPending,children:N.isPending?`Removing…`:`Remove topic`})]}),(0,x.jsx)(h,{error:N.error})]}):null,(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:(0,x.jsx)(g,{text:M.body})})]})}export{C as KnowledgeView};