@saadnvd1/agent-os 0.3.470 → 0.3.471
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 +39 -36
- package/app/api/fresh-start/route.ts +9 -5
- package/app/api/usage/route.ts +4 -2
- package/components/Chat/ChatPanel.tsx +5 -5
- package/components/Chat/StaleChip.tsx +7 -6
- package/components/Usage/UsageDialog.tsx +31 -2
- package/components/Workspaces/FreshStartForm.tsx +13 -13
- package/data/usage/index.ts +2 -0
- package/lib/agents/launch.ts +2 -0
- package/lib/chat/refresh.ts +31 -13
- package/lib/chat/stale.ts +25 -16
- package/lib/chat/worker/host.ts +57 -22
- package/lib/db/migrations.ts +42 -0
- package/lib/orchestrator/armed.ts +1 -2
- package/lib/orchestrator/brief.ts +3 -3
- package/lib/orchestrator/claude-cli.ts +5 -0
- package/lib/orchestrator/diff.ts +1 -1
- package/lib/orchestrator/external-gates.ts +8 -43
- package/lib/orchestrator/gates.ts +10 -10
- package/lib/orchestrator/pr-wake.ts +2 -2
- package/lib/orchestrator/rebase.ts +6 -45
- package/lib/orchestrator/review.ts +18 -5
- package/lib/orchestrator/scope.ts +9 -0
- package/lib/orchestrator/signoff.ts +13 -8
- package/lib/session-audit/render.ts +1 -1
- package/lib/stacks/land.ts +23 -16
- package/lib/tasks/brief.ts +3 -14
- package/lib/tasks/code-review.ts +69 -107
- package/lib/tasks/gh.ts +3 -2
- package/lib/tasks/index.ts +1 -1
- package/lib/tasks/state.ts +4 -4
- package/lib/usage/check-runs.ts +167 -0
- package/lib/usage/report.ts +25 -0
- package/lib/usage/turns.ts +28 -0
- package/package.json +1 -1
- package/scripts/check-code-review.ts +0 -21
package/lib/usage/turns.ts
CHANGED
|
@@ -68,3 +68,31 @@ export function recordTurn(
|
|
|
68
68
|
})();
|
|
69
69
|
return totals;
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
// Records one compaction: who ran it ("auto" is the agent's own, at its
|
|
73
|
+
// auto-compact window; "threshold" and "stale" are AgentOS's before a
|
|
74
|
+
// message; "manual" is a /compact someone typed), and the context before
|
|
75
|
+
// and after when the agent said.
|
|
76
|
+
export function recordCompaction(
|
|
77
|
+
session: Pick<Session, "id" | "name" | "workspace_id">,
|
|
78
|
+
c: { trigger: string; before?: number; after?: number },
|
|
79
|
+
at = Date.now()
|
|
80
|
+
): void {
|
|
81
|
+
const current = db
|
|
82
|
+
.prepare(`SELECT name, workspace_id FROM sessions WHERE id = ?`)
|
|
83
|
+
.get(session.id) as
|
|
84
|
+
| { name: string; workspace_id: string | null }
|
|
85
|
+
| undefined;
|
|
86
|
+
db.prepare(
|
|
87
|
+
`INSERT INTO chat_compactions (session_id, session_name, workspace_id, at, trigger, before_tokens, after_tokens)
|
|
88
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`
|
|
89
|
+
).run(
|
|
90
|
+
session.id,
|
|
91
|
+
current?.name ?? session.name,
|
|
92
|
+
current?.workspace_id ?? session.workspace_id,
|
|
93
|
+
at,
|
|
94
|
+
c.trigger,
|
|
95
|
+
c.before ?? null,
|
|
96
|
+
c.after ?? null
|
|
97
|
+
);
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// CI: fail a pull request whose body has no Code review section for its
|
|
2
|
-
// head commit (the same rule the orchestrator's sign_off and stacks' land
|
|
3
|
-
// apply). Reads PR_BODY and HEAD_SHA from the environment.
|
|
4
|
-
import { codeReviewRefusal, parseCodeReview } from "../lib/tasks/code-review";
|
|
5
|
-
|
|
6
|
-
// A head AgentOS rebased itself is covered by the review of the head it
|
|
7
|
-
// rebased, as its gates allow.
|
|
8
|
-
const section = parseCodeReview(process.env.PR_BODY ?? "");
|
|
9
|
-
const refusal = codeReviewRefusal(
|
|
10
|
-
section,
|
|
11
|
-
process.env.HEAD_SHA || undefined,
|
|
12
|
-
section?.restacked
|
|
13
|
-
);
|
|
14
|
-
if (refusal) {
|
|
15
|
-
console.error(`✗ ${refusal}.`);
|
|
16
|
-
console.error(
|
|
17
|
-
"Run /do-code-review on the branch, then put its section in the PR body:\n\n## Code review\nReviewed: <head sha>\nAgents: ...\nFixed: ...\nDeferred: ..."
|
|
18
|
-
);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
console.log(`✓ the Code review section covers ${process.env.HEAD_SHA}`);
|