@kubitnodes/stellaris 0.3.0 → 0.3.2

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 (47) hide show
  1. package/dist/cli/index.js +122 -4
  2. package/dist/server/index.js +488 -30
  3. package/package.json +1 -1
  4. package/web/dist/assets/ChannelView-CX4cPMWM.js +1 -0
  5. package/web/dist/assets/CitizenView-8ZU2hK4D.js +2 -0
  6. package/web/dist/assets/{CitizensView-DB2TlGxn.js → CitizensView-BDenU7WD.js} +1 -1
  7. package/web/dist/assets/KnowledgeView-IUzeK83J.js +1 -0
  8. package/web/dist/assets/Markdown-DH59NuID.js +31 -0
  9. package/web/dist/assets/{MessageItem-BR30twQh.js → MessageItem-BWuFJqdk.js} +1 -1
  10. package/web/dist/assets/MetricsView-RzP1J0EG.js +1 -0
  11. package/web/dist/assets/NeedsYouView-DvnPW0tZ.js +1 -0
  12. package/web/dist/assets/Overview-BYcIErNt.js +1 -0
  13. package/web/dist/assets/{Pane-BXpuXst6.js → Pane-KNrdAxkc.js} +1 -1
  14. package/web/dist/assets/{ProjectView-CxUA5nFw.js → ProjectView-CmoGtfJ4.js} +1 -1
  15. package/web/dist/assets/ProposalView-FjvrD4Fz.js +1 -0
  16. package/web/dist/assets/{ProposalsView-BscIGUTT.js → ProposalsView-DSiFdLGD.js} +1 -1
  17. package/web/dist/assets/{RunnersView-BypVHvzI.js → RunnersView-DfduymeY.js} +1 -1
  18. package/web/dist/assets/{SocietyView-C403e1uR.js → SocietyView-BwfrqQiF.js} +1 -1
  19. package/web/dist/assets/SubjectThread-B-1_FwBN.js +1 -0
  20. package/web/dist/assets/TaskFileView-BNR8mQRk.js +1 -0
  21. package/web/dist/assets/TaskView-qdFvjqvJ.js +1 -0
  22. package/web/dist/assets/{TasksView-CA02-WIW.js → TasksView-QpcbsOzR.js} +1 -1
  23. package/web/dist/assets/ThreadCard-ClSg5-Lj.js +1 -0
  24. package/web/dist/assets/{ThreadForms-Dh9ky_aU.js → ThreadForms-B6Lv_t5p.js} +1 -1
  25. package/web/dist/assets/{ThreadView-CAdCu-y_.js → ThreadView-5PMRCHd4.js} +1 -1
  26. package/web/dist/assets/citizen-B9DadtKn.js +1 -0
  27. package/web/dist/assets/format-DbfHOiKW.js +55 -0
  28. package/web/dist/assets/index-2BnqwsfR.js +23 -0
  29. package/web/dist/assets/index-C3ujZpqY.css +2 -0
  30. package/web/dist/assets/{tasks-DZgkXWwu.js → tasks-Bw07dkQC.js} +1 -1
  31. package/web/dist/assets/{useStickyScroll-CVTdIoKj.js → useStickyScroll-CRgyaBkv.js} +1 -1
  32. package/web/dist/index.html +4 -4
  33. package/web/dist/assets/ChannelView-B4rv0TMD.js +0 -1
  34. package/web/dist/assets/CitizenView-DfBiP1Jw.js +0 -2
  35. package/web/dist/assets/KnowledgeView-l0I_R5Zd.js +0 -1
  36. package/web/dist/assets/Markdown-C6mhAmbQ.js +0 -29
  37. package/web/dist/assets/MetricsView-BZ0WW2Do.js +0 -1
  38. package/web/dist/assets/NeedsYouView-C6CZNnJn.js +0 -1
  39. package/web/dist/assets/Overview-D47FfDDO.js +0 -1
  40. package/web/dist/assets/ProposalView-C0oLBLQD.js +0 -1
  41. package/web/dist/assets/SubjectThread-irSHRJpB.js +0 -1
  42. package/web/dist/assets/TaskView-B-4WGLWK.js +0 -1
  43. package/web/dist/assets/ThreadCard-C4rb-53v.js +0 -1
  44. package/web/dist/assets/citizen-BWGATcew.js +0 -1
  45. package/web/dist/assets/format-DZLzLk7S.js +0 -55
  46. package/web/dist/assets/index-D-wuKd9C.js +0 -21
  47. package/web/dist/assets/index-HwY3AK-1.css +0 -2
package/dist/cli/index.js CHANGED
@@ -678,6 +678,8 @@ var BOARD_EVENT_TYPES = [
678
678
  "paused.changed",
679
679
  "wake.requested",
680
680
  "turn.started",
681
+ "turn.steered",
682
+ "turn.stopped",
681
683
  "turn.completed",
682
684
  "turn.failed",
683
685
  "merge.completed",
@@ -709,7 +711,8 @@ var TurnExitReasonSchema = z5.enum([
709
711
  "timeout",
710
712
  "error",
711
713
  "interrupted",
712
- "blocked"
714
+ "blocked",
715
+ "stopped"
713
716
  ]);
714
717
  var AgentEventSchema = z5.discriminatedUnion("type", [
715
718
  z5.object({
@@ -720,6 +723,16 @@ var AgentEventSchema = z5.discriminatedUnion("type", [
720
723
  /** The model the CLI reports running, when it reports one. */
721
724
  model: z5.string().optional()
722
725
  }),
726
+ /**
727
+ * The CLI took a steer into the running turn. Adapters name the steer; the server adds the
728
+ * messages it delivered and the text the CLI was given.
729
+ */
730
+ z5.object({
731
+ type: z5.literal("steered"),
732
+ steer: z5.string().min(1),
733
+ messages: z5.array(UlidSchema).optional(),
734
+ text: z5.string().optional()
735
+ }),
723
736
  z5.object({ type: z5.literal("text"), delta: z5.string() }),
724
737
  z5.object({ type: z5.literal("tool_call"), name: z5.string(), input: z5.unknown() }),
725
738
  z5.object({
@@ -767,6 +780,12 @@ var RunnerHelloSchema = z6.object({
767
780
  clis: z6.array(CliKindSchema),
768
781
  /** The CLIs whose adapter can keep a session warm between turns. */
769
782
  residentClis: z6.array(CliKindSchema).default([]),
783
+ /** The CLIs whose adapter can take input into a running turn; the server steers only these. */
784
+ steerableClis: z6.array(CliKindSchema).default([]),
785
+ /** The CLIs whose adapter can stop a running turn; the server stops only these. */
786
+ stoppableClis: z6.array(CliKindSchema).default([]),
787
+ /** Whether the runner answers file reads on its projects' branches; one from before never does. */
788
+ branchReads: z6.boolean().default(false),
770
789
  capabilities: z6.array(z6.string()).default([]),
771
790
  /** Turns the runner runs at once, or null for no limit. */
772
791
  slots: z6.number().int().positive().nullable(),
@@ -870,10 +889,54 @@ var LandRequestSchema = z6.object({
870
889
  });
871
890
  var MergeOutcomeSchema = z6.object({ ok: z6.boolean(), detail: z6.string() });
872
891
  var ModelListSchema = z6.array(ModelOptionSchema);
892
+ var BRANCH_FILE_LIMIT_BYTES = 8 * 1024 * 1024;
893
+ var BranchPathSchema = z6.string().max(4096).refine((value) => value === "" || value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== ".." && !segment.includes("\0")), { message: "a path inside the branch, with no empty, `.`, or `..` segment" });
894
+ var BranchNameSchema = z6.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/);
895
+ var BranchReadSchema = z6.object({
896
+ repo: ProjectRepoSchema,
897
+ branch: BranchNameSchema,
898
+ path: BranchPathSchema
899
+ });
900
+ var BranchCommitSchema = z6.object({
901
+ id: z6.string().min(1),
902
+ at: IsoDateTimeSchema,
903
+ author: z6.string()
904
+ });
905
+ var BranchFileSchema = z6.discriminatedUnion("kind", [
906
+ z6.object({
907
+ kind: z6.literal("file"),
908
+ path: BranchPathSchema,
909
+ commit: BranchCommitSchema,
910
+ size: z6.number().int().nonnegative(),
911
+ content: z6.string().nullable()
912
+ }),
913
+ z6.object({
914
+ kind: z6.literal("dir"),
915
+ path: BranchPathSchema,
916
+ commit: BranchCommitSchema,
917
+ entries: z6.array(z6.object({
918
+ name: z6.string().min(1),
919
+ kind: z6.enum(["file", "dir"]),
920
+ size: z6.number().int().nonnegative().nullable()
921
+ }))
922
+ })
923
+ ]);
924
+ var TurnSteerSchema = z6.object({ id: z6.uuid(), text: z6.string().min(1) });
873
925
  var RunnerMessageSchema = z6.discriminatedUnion("type", [
874
926
  z6.object({ type: z6.literal("turn"), job: TurnJobSchema }),
875
927
  z6.object({ type: z6.literal("land"), request: z6.string().min(1), land: LandRequestSchema }),
876
- z6.object({ type: z6.literal("models"), request: z6.string().min(1), cli: CliKindSchema })
928
+ z6.object({ type: z6.literal("models"), request: z6.string().min(1), cli: CliKindSchema }),
929
+ /** Answered with a `BranchFile`, or null when the branch or the path does not exist. */
930
+ z6.object({ type: z6.literal("file"), request: z6.string().min(1), read: BranchReadSchema }),
931
+ /** Answered with whether the CLI accepted it; that it took it comes as a `steered` event. */
932
+ z6.object({
933
+ type: z6.literal("steer"),
934
+ request: z6.string().min(1),
935
+ turnId: UlidSchema,
936
+ steer: TurnSteerSchema
937
+ }),
938
+ /** Answered with whether the turn was there to stop; it ends `stopped`. */
939
+ z6.object({ type: z6.literal("stop"), request: z6.string().min(1), turnId: UlidSchema })
877
940
  ]);
878
941
  var RunnerAnswerSchema = z6.discriminatedUnion("ok", [
879
942
  z6.object({ ok: z6.literal(true), value: z6.unknown() }),
@@ -949,7 +1012,19 @@ var TurnRecordSchema = z7.object({
949
1012
  /** The model the CLI reported for this turn, else the model configured for the agent, else null. */
950
1013
  model: z7.string().nullable().default(null),
951
1014
  /** The task branch the turn left work on, with its commit, as the runner reported it. */
952
- work: TurnWorkSchema.optional()
1015
+ work: TurnWorkSchema.optional(),
1016
+ /** Who stopped the turn, for one that ended `stopped`. */
1017
+ stoppedBy: NameSchema.optional()
1018
+ });
1019
+ var RunningTurnSchema = z7.object({
1020
+ turnId: UlidSchema,
1021
+ agent: NameSchema,
1022
+ scope: NameSchema,
1023
+ thread: UlidSchema.optional(),
1024
+ cli: CliKindSchema,
1025
+ channel: ChannelRefSchema.optional(),
1026
+ steerable: z7.boolean(),
1027
+ stoppable: z7.boolean()
953
1028
  });
954
1029
  var SessionsFileSchema = z7.object({
955
1030
  claude: z7.string().optional(),
@@ -1160,7 +1235,7 @@ var RunnerConfigSchema = z10.object({
1160
1235
  });
1161
1236
 
1162
1237
  // packages/shared/dist/version.js
1163
- var STELLARIS_VERSION = "0.3.0";
1238
+ var STELLARIS_VERSION = "0.3.2";
1164
1239
 
1165
1240
  // packages/board-core/dist/errors.js
1166
1241
  var BoardError = class extends Error {
@@ -1704,10 +1779,12 @@ var TaskPayload = z11.object({
1704
1779
  from: z11.string().optional()
1705
1780
  });
1706
1781
  var MessagePayload = z11.object({
1782
+ id: z11.string().optional(),
1707
1783
  channel: z11.string(),
1708
1784
  thread: z11.string().nullable().optional(),
1709
1785
  mentions: z11.array(z11.string()).default([])
1710
1786
  });
1787
+ var SteeredPayload = z11.object({ messages: z11.array(z11.string()) });
1711
1788
  var SignalPayload = z11.object({
1712
1789
  kind: z11.string(),
1713
1790
  key: z11.string(),
@@ -1814,6 +1891,23 @@ function computeMetrics(input) {
1814
1891
  }
1815
1892
  break;
1816
1893
  }
1894
+ case "turn.steered": {
1895
+ const steered = SteeredPayload.safeParse(event.payload);
1896
+ if (!steered.success) {
1897
+ break;
1898
+ }
1899
+ const delivered = new Set(steered.data.messages);
1900
+ const at = Date.parse(event.ts);
1901
+ const answered = waiting.filter((mention) => mention.agent === event.actor && mention.message !== null && delivered.has(mention.message));
1902
+ if (answered.length > 0) {
1903
+ latencies.set(event.actor, [
1904
+ ...latencies.get(event.actor) ?? [],
1905
+ ...answered.map((mention) => at - mention.at)
1906
+ ]);
1907
+ waiting = waiting.filter((mention) => !answered.includes(mention));
1908
+ }
1909
+ break;
1910
+ }
1817
1911
  case "task.completed": {
1818
1912
  const task2 = TaskPayload.safeParse(event.payload);
1819
1913
  if (counted && task2.success) {
@@ -1878,6 +1972,7 @@ function computeMetrics(input) {
1878
1972
  waiting.push({
1879
1973
  agent: name,
1880
1974
  at: Date.parse(event.ts),
1975
+ message: message.data.id ?? null,
1881
1976
  thread: thread2,
1882
1977
  scopes: [project2, wakeScope(citizen, project2)].filter((scope) => scope !== null)
1883
1978
  });
@@ -4690,6 +4785,21 @@ ${rationale}`}`);
4690
4785
  });
4691
4786
  });
4692
4787
  }
4788
+ /** Where a conversation's digest resumes: the newest message a turn there was shown. */
4789
+ async digestCursor(agent2, scope, thread2) {
4790
+ return this.mutex.run(async () => cursorOf(await this.readCursors(agent2), scope, thread2 ?? null));
4791
+ }
4792
+ /** Records that a running turn took posts delivered into it, which wake latency counts to. */
4793
+ async recordSteered(input) {
4794
+ await this.mutex.run(async () => {
4795
+ await this.events.append("turn.steered", input.agent, {
4796
+ turnId: input.turnId,
4797
+ project: input.project,
4798
+ ...input.thread === void 0 ? {} : { thread: input.thread },
4799
+ messages: [...input.messages]
4800
+ });
4801
+ });
4802
+ }
4693
4803
  /** Where a conversation's session ids and last turn are kept: the scope's home, or a thread's. */
4694
4804
  sessionDir(agent2, scope, thread2) {
4695
4805
  return thread2 === void 0 ? this.paths.agentProject(agent2, scope) : this.paths.agentThread(agent2, scope, thread2);
@@ -4759,6 +4869,14 @@ ${rationale}`}`);
4759
4869
  }
4760
4870
  await this.writeTurnRecord(parsed);
4761
4871
  await this.refreshMember(parsed.agent);
4872
+ if (parsed.exitReason === "stopped") {
4873
+ await this.events.append("turn.stopped", parsed.stoppedBy ?? USER_NAME, {
4874
+ ...parsed.id === void 0 ? {} : { turnId: parsed.id },
4875
+ agent: parsed.agent,
4876
+ project: parsed.project,
4877
+ ...parsed.thread === void 0 ? {} : { thread: parsed.thread }
4878
+ });
4879
+ }
4762
4880
  await this.events.append(failed ? "turn.failed" : "turn.completed", parsed.agent, {
4763
4881
  ...parsed.id === void 0 ? {} : { turnId: parsed.id },
4764
4882
  project: parsed.project,