@saadnvd1/agent-os 0.3.853 → 0.3.859

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 (123) hide show
  1. package/app/api/leads/adopt/route.ts +35 -0
  2. package/app/api/leads/proposals/route.ts +52 -0
  3. package/app/api/leads/route.test.ts +95 -0
  4. package/app/api/leads/route.ts +60 -0
  5. package/app/api/sessions/[id]/fresh/route.ts +2 -1
  6. package/app/api/sessions/[id]/route.ts +9 -1
  7. package/app/api/tmux/kill-all/route.ts +2 -1
  8. package/app/api/workspaces/[id]/orchestrator/tools/route.test.ts +43 -0
  9. package/app/api/workspaces/[id]/orchestrator/tools/route.ts +14 -11
  10. package/components/Analyst/pair.ts +2 -1
  11. package/components/Chat/ChatPanel.tsx +1 -0
  12. package/components/Orchestrator/AskCard.tsx +6 -0
  13. package/components/Orchestrator/NeedsYouStrip.tsx +7 -2
  14. package/components/Pane/index.tsx +5 -7
  15. package/components/Schedules/ScheduleForm.tsx +2 -1
  16. package/components/SessionList/RowSubtitle.tsx +2 -1
  17. package/components/SessionList/SessionRow.tsx +2 -1
  18. package/components/SessionList/useSidebarData.ts +8 -3
  19. package/content/whats-new.json +16 -0
  20. package/hooks/useNeedsYou.ts +10 -4
  21. package/hooks/useOrchestratorHeader.ts +2 -1
  22. package/lib/analyst/createLink.ts +3 -1
  23. package/lib/away/report.ts +2 -1
  24. package/lib/bus/format.ts +4 -1
  25. package/lib/bus/index.ts +9 -2
  26. package/lib/bus/read-scope.ts +4 -3
  27. package/lib/bus/resolve.ts +4 -1
  28. package/lib/bus/role-alias.ts +2 -1
  29. package/lib/bus/targets.ts +8 -3
  30. package/lib/bus/waits/tick.ts +2 -1
  31. package/lib/chat/compact-context.ts +2 -1
  32. package/lib/chat/mention-roots.ts +2 -1
  33. package/lib/chat/runner.ts +3 -2
  34. package/lib/chat/settings.ts +3 -2
  35. package/lib/chat/worker/extras.ts +4 -1
  36. package/lib/chat/worker/host.ts +6 -5
  37. package/lib/db/migrations/20261102T1944_leads.ts +142 -0
  38. package/lib/db/migrations/20261102T2300_needs_you_chat_per_session.ts +24 -0
  39. package/lib/db/session-parts/columns.ts +2 -0
  40. package/lib/db/types.ts +10 -2
  41. package/lib/done/archive.ts +3 -2
  42. package/lib/done/auto-archive.ts +2 -1
  43. package/lib/done/bulk.ts +4 -3
  44. package/lib/done/index.ts +3 -2
  45. package/lib/done/plan.ts +5 -2
  46. package/lib/experiments/registry.ts +11 -0
  47. package/lib/experiments/view.ts +3 -1
  48. package/lib/fork/brief.ts +2 -2
  49. package/lib/fork/extras.ts +4 -2
  50. package/lib/fork/guard.ts +4 -2
  51. package/lib/fork/scratch.ts +102 -12
  52. package/lib/fork/settle.ts +31 -7
  53. package/lib/fork/start.ts +5 -4
  54. package/lib/fork/tick.ts +19 -0
  55. package/lib/fork/worktree.ts +7 -3
  56. package/lib/health/env/sendFixNotes.ts +3 -2
  57. package/lib/hosts/peer-actions.ts +2 -1
  58. package/lib/hosts/peer-sessions.ts +3 -1
  59. package/lib/leads/actor.ts +16 -0
  60. package/lib/leads/adopt.ts +150 -0
  61. package/lib/leads/area.ts +77 -0
  62. package/lib/leads/brief-common.ts +122 -0
  63. package/lib/leads/brief.ts +155 -0
  64. package/lib/leads/charters.ts +99 -0
  65. package/lib/leads/deliver.ts +24 -0
  66. package/lib/leads/digest.ts +166 -0
  67. package/lib/leads/direction.ts +202 -0
  68. package/lib/leads/home.ts +196 -0
  69. package/lib/leads/index.ts +8 -0
  70. package/lib/leads/memos.ts +70 -0
  71. package/lib/leads/messages.ts +112 -0
  72. package/lib/leads/profiles.ts +83 -0
  73. package/lib/leads/roles.ts +114 -0
  74. package/lib/leads/settings.ts +55 -0
  75. package/lib/leads/templates.ts +51 -0
  76. package/lib/leads/tools.ts +159 -0
  77. package/lib/leads/types.ts +88 -0
  78. package/lib/leads/usage.ts +46 -0
  79. package/lib/learning-cards/input.ts +2 -1
  80. package/lib/live/drive.ts +2 -1
  81. package/lib/models/launch.ts +2 -1
  82. package/lib/models/session-role.ts +2 -1
  83. package/lib/needs-you.ts +12 -6
  84. package/lib/notify/index.ts +2 -1
  85. package/lib/orchestrator/act.ts +3 -1
  86. package/lib/orchestrator/ask-tool.ts +10 -0
  87. package/lib/orchestrator/ask-view.ts +2 -0
  88. package/lib/orchestrator/asks.ts +48 -8
  89. package/lib/orchestrator/brief.ts +32 -67
  90. package/lib/orchestrator/digest.ts +3 -2
  91. package/lib/orchestrator/facts.ts +2 -1
  92. package/lib/orchestrator/full-access.ts +2 -1
  93. package/lib/orchestrator/home.ts +8 -7
  94. package/lib/orchestrator/mcp-servers.ts +7 -6
  95. package/lib/orchestrator/notes.ts +15 -4
  96. package/lib/orchestrator/overview.ts +3 -1
  97. package/lib/orchestrator/recipe-tools.ts +2 -1
  98. package/lib/orchestrator/reminders.ts +2 -1
  99. package/lib/orchestrator/tools.ts +43 -13
  100. package/lib/orchestrator/worker.ts +45 -13
  101. package/lib/orchestrator/write-guard.ts +2 -2
  102. package/lib/projects.ts +3 -2
  103. package/lib/resurrect/find.ts +2 -1
  104. package/lib/resurrect/index.ts +3 -2
  105. package/lib/schedules/index.ts +3 -2
  106. package/lib/schedules/start.ts +2 -1
  107. package/lib/schedules/store.ts +3 -2
  108. package/lib/session-audit/sources.ts +4 -3
  109. package/lib/session-groups/workspace.ts +2 -1
  110. package/lib/sessions/launch.ts +2 -1
  111. package/lib/sidebar/machines.ts +2 -1
  112. package/lib/sidebar/row-actions.ts +2 -1
  113. package/lib/sidebar/row-badge.ts +3 -1
  114. package/lib/sidebar/row-menu.ts +6 -3
  115. package/lib/sidebar/shelves.ts +3 -3
  116. package/lib/status/collect.ts +4 -3
  117. package/lib/tasks/held-replies.ts +2 -1
  118. package/lib/tasks/move-targets.ts +2 -1
  119. package/lib/tasks/pause.ts +2 -1
  120. package/lib/tasks/starter.ts +3 -2
  121. package/lib/workspaces.ts +4 -3
  122. package/lib/worktree-sweep/findSettled.ts +2 -1
  123. package/package.json +1 -1
@@ -6,6 +6,7 @@
6
6
  * machine's own record (started_by), never anything the other machine names.
7
7
  */
8
8
 
9
+ import { sqlStanding } from "../leads/roles";
9
10
  import { db, type Session } from "../db";
10
11
  import { sendMessage } from "../bus";
11
12
  import type { HostLink } from "../hosts/remote-api";
@@ -29,7 +30,7 @@ interface Pulled {
29
30
  }
30
31
 
31
32
  // Held means an orchestrator started it, as isHeldRemote reads it (contract/held-calls.ts).
32
- const HELD_BY = `started_by IN (SELECT id FROM sessions WHERE role = 'orchestrator')`;
33
+ const HELD_BY = `started_by IN (SELECT id FROM sessions WHERE ${sqlStanding()})`;
33
34
 
34
35
  const heldMirror = (hostId: string, id: string) =>
35
36
  db
@@ -74,7 +74,7 @@ export function movableSession(s: {
74
74
  moving: s.task_status === "moving",
75
75
  movedTo: s.moved_to,
76
76
  branch: s.branch_name,
77
- pinnedHere: !!s.lh_card_id || !!s.role,
77
+ pinnedHere: !!s.lh_card_id || isStandingRole(s.role),
78
78
  };
79
79
  }
80
80
 
@@ -95,3 +95,4 @@ export function movableTask(t: {
95
95
  pinnedHere: !!t.cardUrl,
96
96
  };
97
97
  }
98
+ import { isStandingRole } from "../leads/roles";
@@ -13,6 +13,7 @@
13
13
  * the sweep re-drives each state after a restart.
14
14
  */
15
15
 
16
+ import { isStandingRole } from "../leads/roles";
16
17
  import { db, type Session, type TaskPause } from "../db";
17
18
  import { toSqliteTime } from "../session-meta";
18
19
  import { endPause, endPauseOnFinish, formatUntil } from "./pause-hold";
@@ -102,7 +103,7 @@ function factsOf(s: Session): PauseFacts {
102
103
  .get(s.id);
103
104
  return {
104
105
  isTask: !!s.task_status,
105
- isOrchestrator: s.role === "orchestrator",
106
+ isOrchestrator: isStandingRole(s.role),
106
107
  isQuickChange: !!s.quick_of,
107
108
  isRemote: isRemoteHost(s.host_id) || !!s.peer_mirror,
108
109
  taskStatus: s.task_status ?? null,
@@ -2,6 +2,7 @@
2
2
  // calling task, chat or orchestrator; null for a person), parent_session_id
3
3
  // the session it came from, started_via how it began.
4
4
 
5
+ import { isStandingRole } from "../leads/roles";
5
6
  import path from "path";
6
7
  import { db } from "../db";
7
8
  import { setPlacement } from "../db/session-parts";
@@ -86,7 +87,7 @@ export function starterOf(
86
87
  return {
87
88
  startedBy: caller.id,
88
89
  parentSessionId: caller.id,
89
- startedVia: caller.role === "orchestrator" ? "orchestrator" : "session",
90
+ startedVia: isStandingRole(caller.role) ? "orchestrator" : "session",
90
91
  };
91
92
  }
92
93
 
@@ -104,7 +105,7 @@ export function orchestratorOf(startedBy: string | null | undefined) {
104
105
  .get(id) as
105
106
  { role: string | null; started_by: string | null } | undefined;
106
107
  if (!row) return null;
107
- if (row.role === "orchestrator") return id;
108
+ if (isStandingRole(row.role)) return id;
108
109
  id = row.started_by;
109
110
  }
110
111
  return null;
package/lib/workspaces.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * presentation only: deleting one leaves its projects ungrouped.
4
4
  */
5
5
 
6
+ import { sqlNoRole, sqlStanding } from "./leads/roles";
6
7
  import { randomUUID } from "crypto";
7
8
  import { db, type Workspace } from "./db";
8
9
  import { clearForeignGroup } from "./session-groups/assignSessions";
@@ -119,11 +120,11 @@ export function deleteWorkspace(id: string): void {
119
120
  // Sessions filed here by being started here go back to "All workspaces".
120
121
  db.prepare(
121
122
  `UPDATE sessions SET workspace_id = NULL
122
- WHERE role IS NULL AND workspace_id = ?`
123
+ WHERE ${sqlNoRole()} AND workspace_id = ?`
123
124
  ).run(id);
124
- // Its orchestrator goes with it; a running worker idles out on its own.
125
+ // Its orchestrator, leads and chief go with it; a running worker idles out on its own.
125
126
  db.prepare(
126
- `DELETE FROM sessions WHERE role = 'orchestrator' AND workspace_id = ?`
127
+ `DELETE FROM sessions WHERE ${sqlStanding()} AND workspace_id = ?`
127
128
  ).run(id);
128
129
  for (const table of [
129
130
  "orchestrator_events",
@@ -4,6 +4,7 @@
4
4
  * Everything else is skipped with the reason.
5
5
  */
6
6
 
7
+ import { isStandingRole, roleLabel } from "../leads/roles";
7
8
  import fs from "fs";
8
9
  import { db, type Session } from "../db";
9
10
  import { fromSqliteTime } from "../session-meta";
@@ -67,7 +68,7 @@ export async function findSettled(
67
68
  if (!isSettled(s) || !isAgentOSWorktree(dir) || !fs.existsSync(dir))
68
69
  continue;
69
70
  const skip = async (): Promise<string | null> => {
70
- if (s.role) return "an orchestrator's";
71
+ if (isStandingRole(s.role)) return `${roleLabel(s.role)}'s`;
71
72
  if (s.pinned) return "pinned";
72
73
  if (s.moved_to)
73
74
  return "its task moved to another machine and may come back";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saadnvd1/agent-os",
3
- "version": "0.3.853",
3
+ "version": "0.3.859",
4
4
  "description": "Self-hosted web UI for managing Claude Code sessions",
5
5
  "bin": {
6
6
  "agent-os": "scripts/agent-os"