@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.
- package/README.md +27 -5
- package/app/api/bus/spawn/route.ts +15 -0
- package/app/api/tasks/route.ts +5 -0
- package/components/Tasks/TaskRow.tsx +6 -0
- package/components/Usage/CompareView.tsx +15 -3
- package/lib/agents/spawn.ts +21 -9
- package/lib/db/migrations.ts +21 -0
- package/lib/db/types.ts +5 -0
- package/lib/models/plan-step.ts +52 -0
- package/lib/models/roles.ts +4 -1
- package/lib/orchestrator/act.ts +59 -7
- package/lib/orchestrator/approval-carry.ts +48 -0
- package/lib/orchestrator/ask-approvals.ts +20 -1
- package/lib/orchestrator/ask-heads.ts +47 -0
- package/lib/orchestrator/asks.ts +26 -0
- package/lib/orchestrator/brief.ts +10 -2
- package/lib/orchestrator/describe.ts +4 -0
- package/lib/orchestrator/facts.ts +6 -0
- package/lib/orchestrator/held.ts +3 -2
- package/lib/orchestrator/patch.ts +98 -0
- package/lib/orchestrator/rebase.ts +2 -24
- package/lib/orchestrator/serve.ts +2 -0
- package/lib/orchestrator/signoff.ts +16 -2
- package/lib/orchestrator/tool-schemas.ts +14 -2
- package/lib/orchestrator/tools.ts +3 -3
- package/lib/orchestrator/watcher.ts +4 -0
- package/lib/sessions/launch.ts +24 -5
- package/lib/tasks/index.ts +18 -1
- package/lib/tasks/queue.ts +67 -7
- package/lib/usage/compare.ts +31 -2
- package/lib/usage/turns.ts +2 -1
- package/package.json +1 -1
package/lib/usage/compare.ts
CHANGED
|
@@ -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 {
|
|
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,
|
package/lib/usage/turns.ts
CHANGED
|
@@ -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;
|