@saadnvd1/agent-os 0.3.485 → 0.3.487

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.
@@ -35,6 +35,8 @@ export interface CompareTurn extends ModelTurnRow {
35
35
  export interface TaskOutcome {
36
36
  id: string;
37
37
  status: string | null;
38
+ // The decision on a plan step: null when none was recorded.
39
+ planned: boolean | null;
38
40
  // The first finished CI run, and review, on its PR: passed or not; null
39
41
  // when it never had one (no PR, or not under an orchestrator).
40
42
  ciFirstGreen: boolean | null;
@@ -74,11 +76,19 @@ export interface RoleModelRow extends TokenSpend {
74
76
  wallMs: number;
75
77
  }
76
78
 
79
+ // Tasks split by whether the orchestrator chose a plan step for them.
80
+ export interface PlanSplitRow {
81
+ key: "planned" | "unplanned" | "unstated";
82
+ tasks: number;
83
+ spend: TokenSpend;
84
+ }
85
+
77
86
  export interface Comparison {
78
87
  from: number;
79
88
  to: number;
80
89
  cohorts: Cohort[];
81
90
  roles: RoleModelRow[];
91
+ plans: PlanSplitRow[];
82
92
  }
83
93
 
84
94
  const rate = (): Rate => ({ yes: 0, of: 0 });
@@ -154,6 +164,17 @@ export function compareRuns(
154
164
  }
155
165
  for (const c of cohorts.values()) c.smallSample = c.tasks < SMALL_SAMPLE;
156
166
 
167
+ const plans = new Map<PlanSplitRow["key"], PlanSplitRow>();
168
+ for (const [id, ts] of byTask) {
169
+ const planned = outcomes.get(id)!.planned;
170
+ const key =
171
+ planned === null ? "unstated" : planned ? "planned" : "unplanned";
172
+ let r = plans.get(key);
173
+ if (!r) plans.set(key, (r = { key, tasks: 0, spend: emptySpend() }));
174
+ r.tasks += 1;
175
+ for (const t of ts) addRow(r.spend, t, prices);
176
+ }
177
+
157
178
  const roles = new Map<string, RoleModelRow>();
158
179
  for (const t of inRange) {
159
180
  const { provider, model } = rowModel(t);
@@ -179,6 +200,9 @@ export function compareRuns(
179
200
  roles: [...roles.values()].sort(
180
201
  (a, b) => a.role.localeCompare(b.role) || b.costUsd - a.costUsd
181
202
  ),
203
+ plans: (["planned", "unplanned", "unstated"] as const)
204
+ .map((k) => plans.get(k))
205
+ .filter((r): r is PlanSplitRow => !!r),
182
206
  };
183
207
  }
184
208
 
@@ -201,10 +225,14 @@ export function taskOutcomes(ids: string[]): Map<string, TaskOutcome> {
201
225
  const marks = ids.map(() => "?").join(",");
202
226
  const tasks = db
203
227
  .prepare(
204
- `SELECT id, task_status FROM sessions
228
+ `SELECT id, task_status, plan_decided FROM sessions
205
229
  WHERE id IN (${marks}) AND task_status IS NOT NULL`
206
230
  )
207
- .all(...ids) as { id: string; task_status: string }[];
231
+ .all(...ids) as {
232
+ id: string;
233
+ task_status: string;
234
+ plan_decided: number | null;
235
+ }[];
208
236
  const checks = db
209
237
  .prepare(
210
238
  `SELECT id, session_id, sha, kind, status FROM orchestrator_checks
@@ -227,6 +255,7 @@ export function taskOutcomes(ids: string[]): Map<string, TaskOutcome> {
227
255
  out.set(t.id, {
228
256
  id: t.id,
229
257
  status: t.task_status,
258
+ planned: t.plan_decided === null ? null : t.plan_decided === 1,
230
259
  ciFirstGreen: null,
231
260
  reviewFirstPass: null,
232
261
  gateFailures: 0,
@@ -60,7 +60,7 @@ export function recordTurn(
60
60
  const current = db
61
61
  .prepare(
62
62
  `SELECT name, workspace_id, model, model_provider, role, task_status,
63
- plan_phase FROM sessions WHERE id = ?`
63
+ plan_phase, started_by FROM sessions WHERE id = ?`
64
64
  )
65
65
  .get(session.id) as
66
66
  | Pick<
@@ -72,6 +72,7 @@ export function recordTurn(
72
72
  | "role"
73
73
  | "task_status"
74
74
  | "plan_phase"
75
+ | "started_by"
75
76
  >
76
77
  | undefined;
77
78
  const provider = current?.model_provider ?? ANTHROPIC;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saadnvd1/agent-os",
3
- "version": "0.3.485",
3
+ "version": "0.3.487",
4
4
  "description": "Self-hosted web UI for managing Claude Code sessions",
5
5
  "bin": {
6
6
  "agent-os": "scripts/agent-os"