mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 12:32:02 +00:00
fix(doctor): add probeRoots for seven filesystem-silent providers (#899)
Close forge/mux/open-design/openclaw/zcode/zed/zerostack filesystem gaps. Vercel remains the network-only exception. OpenClaw SQLite/JSONL accounting stays in the following #1259 commit; this commit only adds OpenClaw probeRoots so empty-root diagnostics can see an agents path. Source-DIFF: 00ebf26c (1259-899-sqlite-discovery) / carried in d91b6a71 Lane: local core-wave 2026-09-07
This commit is contained in:
parent
0b1cf56fd9
commit
a7eea1855e
8 changed files with 78 additions and 7 deletions
|
|
@ -5,7 +5,7 @@ import { join } from 'path'
|
|||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import { calculateCost } from '../models.js'
|
||||
import { getSqliteLoadError, isSqliteAvailable, openDatabase, type SqliteDatabase } from '../sqlite.js'
|
||||
import type { ParsedProviderCall, Provider, SessionParser, SessionSource } from './types.js'
|
||||
import type { ParsedProviderCall, ProbeRoot, Provider, SessionParser, SessionSource } from './types.js'
|
||||
|
||||
type ConversationRow = {
|
||||
conversation_id: string
|
||||
|
|
@ -270,6 +270,10 @@ export function createForgeProvider(dbPath = DEFAULT_DB_PATH): Provider {
|
|||
return rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: dbPath, label: 'db' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
if (!isSqliteAvailable()) return []
|
||||
return discoverFromDb(dbPath)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { homedir } from 'os'
|
|||
import { readSessionLines } from '../fs-utils.js'
|
||||
import { calculateCost, getShortModelName } from '../models.js'
|
||||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall, ProbeRoot } from './types.js'
|
||||
import { safeNumber } from '../parser.js'
|
||||
|
||||
const toolNameMap: Record<string, string> = {
|
||||
|
|
@ -269,6 +269,10 @@ export function createMuxProvider(muxRoot?: string): Provider {
|
|||
return toolNameMap[rawTool] ?? rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: root, label: 'root' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
return discoverSessions(root)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { homedir, platform } from 'os'
|
|||
|
||||
import { readSessionLines } from '../fs-utils.js'
|
||||
import { calculateCost } from '../models.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall, ProbeRoot } from './types.js'
|
||||
|
||||
const PROVIDER_NAME = 'open-design'
|
||||
const ENV_DIR = 'CODEBURN_OPEN_DESIGN_DIR'
|
||||
|
|
@ -246,6 +246,10 @@ export function createOpenDesignProvider(overrideDir?: string): Provider {
|
|||
return rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: overrideDir ?? getOpenDesignDir(), label: 'sessions' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
return discoverOpenDesignSessions(overrideDir ?? getOpenDesignDir())
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { homedir } from 'os'
|
|||
import { readSessionFile } from '../fs-utils.js'
|
||||
import { calculateCost } from '../models.js'
|
||||
import { extractBashCommands } from '../bash-utils.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall, ProbeRoot } from './types.js'
|
||||
|
||||
const toolNameMap: Record<string, string> = {
|
||||
bash: 'Bash',
|
||||
|
|
@ -263,6 +263,12 @@ export function createOpenClawProvider(overrideDir?: string): Provider {
|
|||
return toolNameMap[rawTool] ?? rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
// #899: empty agents root that exists must be distinguishable from missing install.
|
||||
const roots = overrideDir ? [overrideDir] : getOpenClawDirs()
|
||||
return roots.map(path => ({ path, label: 'agents' }))
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
if (overrideDir) return discoverInDir(overrideDir)
|
||||
const all: SessionSource[] = []
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { homedir } from 'os'
|
|||
|
||||
import { calculateCost } from '../models.js'
|
||||
import { isSqliteAvailable, getSqliteLoadError, openDatabase, type SqliteDatabase } from '../sqlite.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall, ProbeRoot } from './types.js'
|
||||
|
||||
/// ZCode (CLI v0.14.x) records usage in a single SQLite database at
|
||||
/// ~/.zcode/cli/db/db.sqlite. We read it because the other on-disk sources are
|
||||
|
|
@ -213,6 +213,10 @@ export function createZcodeProvider(dbPathOverride?: string): Provider {
|
|||
return rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: dbPath, label: 'db' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
if (!isSqliteAvailable()) return []
|
||||
return discover(dbPath)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import zlib from 'zlib'
|
|||
|
||||
import { calculateCost } from '../models.js'
|
||||
import { getSqliteLoadError, isSqliteAvailable, openDatabase, type SqliteDatabase } from '../sqlite.js'
|
||||
import type { ParsedProviderCall, Provider, SessionParser, SessionSource } from './types.js'
|
||||
import type { ParsedProviderCall, ProbeRoot, Provider, SessionParser, SessionSource } from './types.js'
|
||||
|
||||
// Zed's built-in agent stores one row per thread in a single SQLite database;
|
||||
// the `data` blob is zstd-compressed JSON carrying `request_token_usage`
|
||||
|
|
@ -213,6 +213,10 @@ export function createZedProvider(dbPathOverride?: string): Provider {
|
|||
return rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: dbPathOverride ?? getZedThreadsDbPath(), label: 'threads.db' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
if (!isSqliteAvailable()) return []
|
||||
const dbPath = dbPathOverride ?? getZedThreadsDbPath()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { homedir, platform } from 'os'
|
|||
|
||||
import { readSessionFile } from '../fs-utils.js'
|
||||
import { calculateCost, getShortModelName } from '../models.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js'
|
||||
import type { Provider, SessionSource, SessionParser, ParsedProviderCall, ProbeRoot } from './types.js'
|
||||
|
||||
// zerostack (https://github.com/gi-dellav/zerostack) is a minimal Rust coding
|
||||
// agent. Each session is a single JSON file under <dataDir>/zerostack/sessions/.
|
||||
|
|
@ -133,6 +133,10 @@ export function createZerostackProvider(sessionsDir?: string): Provider {
|
|||
return toolNameMap[rawTool] ?? rawTool
|
||||
},
|
||||
|
||||
async probeRoots(): Promise<ProbeRoot[]> {
|
||||
return [{ path: dir, label: 'sessions' }]
|
||||
},
|
||||
|
||||
async discoverSessions(): Promise<SessionSource[]> {
|
||||
let files: string[]
|
||||
try {
|
||||
|
|
|
|||
41
tests/providers/probe-roots-899-census.test.ts
Normal file
41
tests/providers/probe-roots-899-census.test.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { describe, it, expect } from 'vitest'
|
||||
import { getAllProviders } from '../../src/providers/index.js'
|
||||
|
||||
/**
|
||||
* #899 exact-main residual census (Codex REVIEW-2026-09-06-2306):
|
||||
* seven filesystem gaps + one intentional Vercel network exception.
|
||||
* Method presence is necessary but not sufficient for OpenClaw empty-root
|
||||
* semantics — see openclaw.test.ts doctor fixture.
|
||||
*/
|
||||
const FILESYSTEM_GAP_NAMES = [
|
||||
'forge',
|
||||
'mux',
|
||||
'open-design',
|
||||
'openclaw',
|
||||
'zcode',
|
||||
'zed',
|
||||
'zerostack',
|
||||
] as const
|
||||
|
||||
describe('#899 probeRoots census', () => {
|
||||
it('closes the seven filesystem gaps; Vercel remains network exception', async () => {
|
||||
const providers = await getAllProviders()
|
||||
const byName = new Map(providers.map(p => [p.name, p]))
|
||||
|
||||
for (const name of FILESYSTEM_GAP_NAMES) {
|
||||
const p = byName.get(name)
|
||||
expect(p, `provider ${name} should be loaded`).toBeTruthy()
|
||||
expect(p!.probeRoots, `${name} must implement probeRoots`).toBeTypeOf('function')
|
||||
const roots = await p!.probeRoots!()
|
||||
expect(roots.length, `${name} probeRoots must return ≥1 root`).toBeGreaterThanOrEqual(1)
|
||||
}
|
||||
|
||||
const vercel = byName.get('vercel-gateway')
|
||||
expect(vercel).toBeTruthy()
|
||||
expect(vercel!.network).toBe(true)
|
||||
expect(vercel!.probeRoots, 'Vercel is intentional network exception — no probeRoots').toBeUndefined()
|
||||
|
||||
const missingFilesystem = providers.filter(p => !p.network && !p.probeRoots).map(p => p.name)
|
||||
expect(missingFilesystem).toEqual([])
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue