lazyopencode-core 0.0.2 → 0.0.3
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/dist/hooks/runtime.d.ts +5 -0
- package/dist/hooks/runtime.js +15 -1
- package/package.json +1 -1
package/dist/hooks/runtime.d.ts
CHANGED
|
@@ -92,12 +92,16 @@ export interface ContextStats {
|
|
|
92
92
|
totalPruned: number;
|
|
93
93
|
}
|
|
94
94
|
export type CloseEvidenceKind = "behavior" | "test" | "verification" | "risk" | "deletion";
|
|
95
|
+
export type EvidenceSource = "auto" | "manual";
|
|
95
96
|
export interface CloseReportState {
|
|
96
97
|
behaviorChanges: string[];
|
|
97
98
|
testRuns: Array<{
|
|
98
99
|
command: string;
|
|
99
100
|
result: "pass" | "fail" | "unknown";
|
|
101
|
+
source?: EvidenceSource;
|
|
100
102
|
}>;
|
|
103
|
+
lastTestCommand?: string;
|
|
104
|
+
lastVerifyCommand?: string;
|
|
101
105
|
verificationResult?: "pass" | "fail" | "pending";
|
|
102
106
|
remainingRisks: string[];
|
|
103
107
|
deletions: string[];
|
|
@@ -111,6 +115,7 @@ export interface OpenCodeSnapshot {
|
|
|
111
115
|
sessionStatus: string;
|
|
112
116
|
capabilities: string[];
|
|
113
117
|
lastUpdatedAt?: number;
|
|
118
|
+
errors?: string[];
|
|
114
119
|
}
|
|
115
120
|
export interface DoctorState {
|
|
116
121
|
v2Registration: boolean;
|
package/dist/hooks/runtime.js
CHANGED
|
@@ -200,10 +200,13 @@ export function createLazyRuntime(ctx = {}) {
|
|
|
200
200
|
closeReport.testRuns = appendLimited(closeReport.testRuns, {
|
|
201
201
|
command,
|
|
202
202
|
result: looksLikeFailure(text) ? "fail" : "pass",
|
|
203
|
+
source: "auto",
|
|
203
204
|
}, max);
|
|
205
|
+
closeReport.lastTestCommand = command;
|
|
204
206
|
}
|
|
205
207
|
if (/npm run verify|deno task verify|pnpm verify|yarn verify/.test(command)) {
|
|
206
208
|
closeReport.verificationResult = looksLikeFailure(text) ? "fail" : "pass";
|
|
209
|
+
closeReport.lastVerifyCommand = command;
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
if (/edit|write|patch/i.test(toolName)) {
|
|
@@ -241,6 +244,7 @@ export function createLazyRuntime(ctx = {}) {
|
|
|
241
244
|
closeReport.testRuns = appendLimited(closeReport.testRuns, {
|
|
242
245
|
command: text,
|
|
243
246
|
result: "unknown",
|
|
247
|
+
source: "manual",
|
|
244
248
|
}, max);
|
|
245
249
|
}
|
|
246
250
|
closeReport.updatedAt = Date.now();
|
|
@@ -325,6 +329,8 @@ export function createLazyRuntime(ctx = {}) {
|
|
|
325
329
|
"Tests run",
|
|
326
330
|
...formatTestRuns(closeReport.testRuns),
|
|
327
331
|
`Verification result: ${closeReport.verificationResult ?? "pending"}`,
|
|
332
|
+
...(closeReport.lastTestCommand ? [`Last test: ${closeReport.lastTestCommand}`] : []),
|
|
333
|
+
...(closeReport.lastVerifyCommand ? [`Last verify: ${closeReport.lastVerifyCommand}`] : []),
|
|
328
334
|
`Terminal jobs reconciled: ${terminal.length === 0 ? "yes" : "no"}`,
|
|
329
335
|
"Remaining risks",
|
|
330
336
|
...formatStringList(closeReport.remainingRisks),
|
|
@@ -593,14 +599,22 @@ function formatTokenControl(stats) {
|
|
|
593
599
|
].join("\n");
|
|
594
600
|
}
|
|
595
601
|
function formatOpenCodeSnapshot(snapshot) {
|
|
602
|
+
const age = snapshot.lastUpdatedAt ? Date.now() - snapshot.lastUpdatedAt : Infinity;
|
|
603
|
+
const freshness = age < 120_000 ? "fresh" : age < 600_000 ? "stale" : "aged";
|
|
604
|
+
const time = snapshot.lastUpdatedAt
|
|
605
|
+
? new Date(snapshot.lastUpdatedAt).toLocaleTimeString()
|
|
606
|
+
: "never";
|
|
607
|
+
const hasCapabilities = snapshot.capabilities.length > 0;
|
|
608
|
+
const degraded = hasCapabilities && snapshot.capabilities.includes("degraded");
|
|
596
609
|
return [
|
|
597
610
|
"OpenCode",
|
|
611
|
+
`- snapshot: ${freshness} @ ${time}`,
|
|
598
612
|
`- session: ${snapshot.sessionStatus}`,
|
|
599
613
|
`- pending permissions: ${snapshot.pendingPermissions}`,
|
|
600
614
|
`- todos: ${snapshot.todos}`,
|
|
601
615
|
`- diff: ${snapshot.diffSummary}`,
|
|
602
616
|
`- worktree: ${snapshot.worktree}`,
|
|
603
|
-
`- capabilities: ${
|
|
617
|
+
`- capabilities: ${hasCapabilities ? degraded ? "⚠ degraded" : snapshot.capabilities.join(", ") : "not collected"}`,
|
|
604
618
|
].join("\n");
|
|
605
619
|
}
|
|
606
620
|
function findUp(filename, startDir) {
|