agent-rulebook 0.2.0 → 0.3.0
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 +58 -4
- package/dist/commands/dashboard.d.ts +7 -0
- package/dist/commands/dashboard.js +42 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/diagnostics.d.ts +2 -0
- package/dist/commands/diagnostics.js +38 -0
- package/dist/commands/diagnostics.js.map +1 -0
- package/dist/commands/home.d.ts +2 -0
- package/dist/commands/home.js +59 -0
- package/dist/commands/home.js.map +1 -0
- package/dist/commands/import.d.ts +2 -0
- package/dist/commands/import.js +34 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/pending.d.ts +2 -0
- package/dist/commands/pending.js +27 -0
- package/dist/commands/pending.js.map +1 -0
- package/dist/commands/resolution.js +25 -11
- package/dist/commands/resolution.js.map +1 -1
- package/dist/commands/stats-renderer.d.ts +3 -0
- package/dist/commands/stats-renderer.js +76 -0
- package/dist/commands/stats-renderer.js.map +1 -0
- package/dist/commands/stats.d.ts +4 -0
- package/dist/commands/stats.js +107 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +17 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.js +1 -1
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/usage.d.ts +2 -0
- package/dist/commands/usage.js +25 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/core/codex-call-parser.d.ts +10 -0
- package/dist/core/codex-call-parser.js +97 -0
- package/dist/core/codex-call-parser.js.map +1 -0
- package/dist/core/codex-usage-import.d.ts +24 -0
- package/dist/core/codex-usage-import.js +259 -0
- package/dist/core/codex-usage-import.js.map +1 -0
- package/dist/core/diagnostic-cluster.d.ts +37 -0
- package/dist/core/diagnostic-cluster.js +20 -0
- package/dist/core/diagnostic-cluster.js.map +1 -0
- package/dist/core/environment-normalization.d.ts +21 -0
- package/dist/core/environment-normalization.js +42 -0
- package/dist/core/environment-normalization.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/invocation-diagnostics.d.ts +40 -0
- package/dist/core/invocation-diagnostics.js +91 -0
- package/dist/core/invocation-diagnostics.js.map +1 -0
- package/dist/core/legacy-candidate.d.ts +159 -0
- package/dist/core/legacy-candidate.js +73 -0
- package/dist/core/legacy-candidate.js.map +1 -0
- package/dist/core/legacy-import-apply.d.ts +215 -0
- package/dist/core/legacy-import-apply.js +172 -0
- package/dist/core/legacy-import-apply.js.map +1 -0
- package/dist/core/legacy-import-manifest.d.ts +197 -0
- package/dist/core/legacy-import-manifest.js +63 -0
- package/dist/core/legacy-import-manifest.js.map +1 -0
- package/dist/core/legacy-scan.d.ts +71 -0
- package/dist/core/legacy-scan.js +99 -0
- package/dist/core/legacy-scan.js.map +1 -0
- package/dist/core/pending-replay.d.ts +4 -0
- package/dist/core/pending-replay.js +96 -0
- package/dist/core/pending-replay.js.map +1 -0
- package/dist/core/resolution-applicability.d.ts +1 -0
- package/dist/core/resolution-applicability.js +28 -11
- package/dist/core/resolution-applicability.js.map +1 -1
- package/dist/core/resolution-ranker.js +9 -2
- package/dist/core/resolution-ranker.js.map +1 -1
- package/dist/core/resolution-search-types.d.ts +9 -0
- package/dist/core/statistics-data.d.ts +98 -0
- package/dist/core/statistics-data.js +53 -0
- package/dist/core/statistics-data.js.map +1 -0
- package/dist/core/statistics-pages.d.ts +3 -0
- package/dist/core/statistics-pages.js +107 -0
- package/dist/core/statistics-pages.js.map +1 -0
- package/dist/core/statistics-query.d.ts +86 -0
- package/dist/core/statistics-query.js +51 -0
- package/dist/core/statistics-query.js.map +1 -0
- package/dist/core/statistics-types.d.ts +286 -0
- package/dist/core/statistics-types.js +2 -0
- package/dist/core/statistics-types.js.map +1 -0
- package/dist/core/statistics.d.ts +5 -0
- package/dist/core/statistics.js +101 -0
- package/dist/core/statistics.js.map +1 -0
- package/dist/core/sync-status.d.ts +53 -0
- package/dist/core/sync-status.js +85 -0
- package/dist/core/sync-status.js.map +1 -0
- package/dist/core/usage-context.d.ts +15 -0
- package/dist/core/usage-context.js +22 -0
- package/dist/core/usage-context.js.map +1 -0
- package/dist/core/usage-observer.d.ts +36 -0
- package/dist/core/usage-observer.js +112 -0
- package/dist/core/usage-observer.js.map +1 -0
- package/dist/core/usage-schema.d.ts +113 -0
- package/dist/core/usage-schema.js +33 -0
- package/dist/core/usage-schema.js.map +1 -0
- package/dist/dashboard/public/api.js +41 -0
- package/dist/dashboard/public/app.js +111 -0
- package/dist/dashboard/public/components/detail-panel.js +21 -0
- package/dist/dashboard/public/components/index.js +216 -0
- package/dist/dashboard/public/components/input-diff.js +15 -0
- package/dist/dashboard/public/diagnostic-detail.js +25 -0
- package/dist/dashboard/public/diagnostics.js +46 -0
- package/dist/dashboard/public/index.html +28 -0
- package/dist/dashboard/public/knowledge.js +57 -0
- package/dist/dashboard/public/overview.js +101 -0
- package/dist/dashboard/public/solution-detail.js +42 -0
- package/dist/dashboard/public/styles.css +205 -0
- package/dist/dashboard/server.d.ts +10 -0
- package/dist/dashboard/server.js +133 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/observed-transport.d.ts +20 -0
- package/dist/mcp/observed-transport.js +99 -0
- package/dist/mcp/observed-transport.js.map +1 -0
- package/dist/mcp/resolution-change.d.ts +1 -1
- package/dist/mcp/resolution-change.js +24 -9
- package/dist/mcp/resolution-change.js.map +1 -1
- package/dist/mcp/resolutions-commit-change-tool.d.ts +5 -0
- package/dist/mcp/resolutions-commit-change-tool.js +22 -4
- package/dist/mcp/resolutions-commit-change-tool.js.map +1 -1
- package/dist/mcp/resolutions-find-tool.d.ts +1 -2
- package/dist/mcp/resolutions-find-tool.js +43 -8
- package/dist/mcp/resolutions-find-tool.js.map +1 -1
- package/dist/mcp/resolutions-list-facets-tool.d.ts +1 -1
- package/dist/mcp/resolutions-list-facets-tool.js +16 -2
- package/dist/mcp/resolutions-list-facets-tool.js.map +1 -1
- package/dist/mcp/resolutions-report-attempt-tool.d.ts +1 -0
- package/dist/mcp/resolutions-report-attempt-tool.js +44 -55
- package/dist/mcp/resolutions-report-attempt-tool.js.map +1 -1
- package/dist/mcp/schemas.d.ts +299 -14
- package/dist/mcp/schemas.js +31 -10
- package/dist/mcp/schemas.js.map +1 -1
- package/dist/mcp/server.js +20 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stats-get-tool.d.ts +99 -0
- package/dist/mcp/stats-get-tool.js +17 -0
- package/dist/mcp/stats-get-tool.js.map +1 -0
- package/dist/mcp/tool-call.d.ts +99 -0
- package/dist/mcp/tool-call.js +20 -0
- package/dist/mcp/tool-call.js.map +1 -0
- package/dist/mcp/tool-output.d.ts +9 -0
- package/dist/mcp/tool-output.js +22 -0
- package/dist/mcp/tool-output.js.map +1 -1
- package/dist/mcp/tools.d.ts +182 -27
- package/dist/mcp/tools.js +9 -2
- package/dist/mcp/tools.js.map +1 -1
- package/dist/program.js +16 -0
- package/dist/program.js.map +1 -1
- package/dist/storage/canonical-write-lock.d.ts +2 -0
- package/dist/storage/canonical-write-lock.js +32 -0
- package/dist/storage/canonical-write-lock.js.map +1 -0
- package/dist/storage/diagnostic-store.d.ts +21 -0
- package/dist/storage/diagnostic-store.js +50 -0
- package/dist/storage/diagnostic-store.js.map +1 -0
- package/dist/storage/import-manifest.d.ts +6 -0
- package/dist/storage/import-manifest.js +41 -0
- package/dist/storage/import-manifest.js.map +1 -0
- package/dist/storage/pending-store.d.ts +329 -0
- package/dist/storage/pending-store.js +164 -0
- package/dist/storage/pending-store.js.map +1 -0
- package/dist/storage/resolution-candidate-service.js +2 -1
- package/dist/storage/resolution-candidate-service.js.map +1 -1
- package/dist/storage/resolution-change-transaction.d.ts +41 -3
- package/dist/storage/resolution-change-transaction.js +101 -12
- package/dist/storage/resolution-change-transaction.js.map +1 -1
- package/dist/storage/resolution-home.d.ts +2 -1
- package/dist/storage/resolution-home.js +5 -2
- package/dist/storage/resolution-home.js.map +1 -1
- package/dist/storage/resolution-index-check.js +3 -2
- package/dist/storage/resolution-index-check.js.map +1 -1
- package/dist/storage/resolution-indexer.js +3 -1
- package/dist/storage/resolution-indexer.js.map +1 -1
- package/dist/storage/usage-store.d.ts +80 -0
- package/dist/storage/usage-store.js +239 -0
- package/dist/storage/usage-store.js.map +1 -0
- package/package.json +11 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
2
|
+
import { mkdir } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { setTimeout } from 'node:timers/promises';
|
|
5
|
+
/** SQLite releases this machine-local exclusive writer lock even after process death. */
|
|
6
|
+
export async function withCanonicalWriteLock(home, operation) {
|
|
7
|
+
await mkdir(join(home, '.state'), { recursive: true });
|
|
8
|
+
const database = new Database(join(home, '.state/canonical-writer.sqlite'), { timeout: 0 });
|
|
9
|
+
const deadline = Date.now() + 5000;
|
|
10
|
+
try {
|
|
11
|
+
while (true) {
|
|
12
|
+
try {
|
|
13
|
+
database.exec('BEGIN EXCLUSIVE');
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error.code !== 'SQLITE_BUSY')
|
|
18
|
+
throw error;
|
|
19
|
+
if (Date.now() >= deadline)
|
|
20
|
+
throw Object.assign(new Error('Canonical writer is busy; retry later.'), { code: 'canonical_writer_busy' });
|
|
21
|
+
await setTimeout(20);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return await operation();
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
if (database.inTransaction)
|
|
28
|
+
database.exec('ROLLBACK');
|
|
29
|
+
database.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=canonical-write-lock.js.map
|
|
@@ -0,0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,CAAC,aAAa;YAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DiagnosticIssueInput, type InvocationDiagnostic } from '../core/invocation-diagnostics.js';
|
|
2
|
+
import type { UsageEvent } from '../core/usage-schema.js';
|
|
3
|
+
export type DiagnosticRecord = {
|
|
4
|
+
diagnostic_id: string;
|
|
5
|
+
invocation_id: string;
|
|
6
|
+
created_at: string;
|
|
7
|
+
tool: string;
|
|
8
|
+
schema_digest: string;
|
|
9
|
+
cluster_key: string;
|
|
10
|
+
diagnostic: InvocationDiagnostic;
|
|
11
|
+
};
|
|
12
|
+
export declare function recordInvocationDiagnostic(home: string, invocationId: string, input: unknown, issues: readonly DiagnosticIssueInput[], safeEnums?: Record<string, readonly string[]>): {
|
|
13
|
+
diagnostic_id: null;
|
|
14
|
+
status: "recorded" | "already_recorded" | "degraded" | "disabled";
|
|
15
|
+
invocation_id?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function readDiagnostics(home: string): {
|
|
18
|
+
status: string;
|
|
19
|
+
diagnostics: DiagnosticRecord[];
|
|
20
|
+
events: UsageEvent[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { createInvocationDiagnostic, diagnosticClusterKey } from '../core/invocation-diagnostics.js';
|
|
3
|
+
import { guardUsageWrite, openUsageDatabase, readUsageStore } from './usage-store.js';
|
|
4
|
+
export function recordInvocationDiagnostic(home, invocationId, input, issues, safeEnums = {}) {
|
|
5
|
+
let diagnosticId = null;
|
|
6
|
+
const saved = guardUsageWrite(home, undefined, () => {
|
|
7
|
+
const database = openUsageDatabase(home);
|
|
8
|
+
try {
|
|
9
|
+
return database.transaction(() => {
|
|
10
|
+
const row = database.prepare('SELECT event_json FROM invocations WHERE invocation_id=?').get(invocationId);
|
|
11
|
+
if (!row)
|
|
12
|
+
throw new Error('diagnostic_invocation_missing');
|
|
13
|
+
const event = JSON.parse(row.event_json);
|
|
14
|
+
const existing = database.prepare('SELECT diagnostic_id FROM diagnostics WHERE invocation_id=?').get(invocationId);
|
|
15
|
+
if (existing) {
|
|
16
|
+
diagnosticId = existing.diagnostic_id;
|
|
17
|
+
return { status: 'already_recorded' };
|
|
18
|
+
}
|
|
19
|
+
const diagnostic = createInvocationDiagnostic(input, issues, safeEnums);
|
|
20
|
+
const record = { diagnostic_id: randomUUID(), invocation_id: invocationId, created_at: event.started_at, tool: event.tool, schema_digest: event.schema_digest, cluster_key: diagnosticClusterKey(event.tool, event.schema_digest, diagnostic), diagnostic };
|
|
21
|
+
database.prepare('INSERT INTO diagnostics VALUES (?,?,?,?,?,?,?)').run(record.diagnostic_id, invocationId, record.created_at, record.tool, record.schema_digest, record.cluster_key, JSON.stringify(record));
|
|
22
|
+
database.prepare('UPDATE invocations SET event_json=? WHERE invocation_id=?').run(JSON.stringify({ ...event, diagnostic_ref: record.diagnostic_id }), invocationId);
|
|
23
|
+
diagnosticId = record.diagnostic_id;
|
|
24
|
+
return { status: 'recorded' };
|
|
25
|
+
}).immediate();
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
database.close();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return { ...saved, diagnostic_id: diagnosticId };
|
|
32
|
+
}
|
|
33
|
+
export function readDiagnostics(home) {
|
|
34
|
+
const snapshot = readUsageStore(home);
|
|
35
|
+
if (!snapshot.events?.length)
|
|
36
|
+
return { status: snapshot.status, diagnostics: [], events: snapshot.events ?? [] };
|
|
37
|
+
let database;
|
|
38
|
+
try {
|
|
39
|
+
database = openUsageDatabase(home, true);
|
|
40
|
+
const table = database.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='diagnostics'").get();
|
|
41
|
+
return { status: snapshot.status, diagnostics: table ? database.prepare('SELECT diagnostic_json FROM diagnostics ORDER BY created_at,diagnostic_id').all().map(({ diagnostic_json }) => JSON.parse(diagnostic_json)) : [], events: snapshot.events };
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return { status: 'degraded', diagnostics: [], events: snapshot.events };
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
database?.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=diagnostic-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostic-store.js","sourceRoot":"","sources":["../../src/storage/diagnostic-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAwD,MAAM,mCAAmC,CAAC;AAC3J,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAItF,MAAM,UAAU,0BAA0B,CAAC,IAAY,EAAE,YAAoB,EAAE,KAAc,EAAE,MAAuC,EAAE,YAA+C,EAAE;IACvL,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE;QAClD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC;YAAC,OAAO,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE;gBACrC,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,0DAA0D,CAAC,CAAC,GAAG,CAAC,YAAY,CAAuC,CAAC;gBACjJ,IAAI,CAAC,GAAG;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAe,CAAC;gBACvD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,6DAA6D,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|
3
|
+
export declare function assertImportPath(path: string, home: string): Promise<string>;
|
|
4
|
+
export declare function writeImportManifest(path: string, home: string, manifest: LegacyManifest): Promise<void>;
|
|
5
|
+
export declare function readImportManifest(path: string): Promise<LegacyManifest>;
|
|
6
|
+
export declare function withImportManifestLock<T>(path: string, home: string, operation: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mkdir, realpath, readFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, relative, resolve, sep } from 'node:path';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { replaceFileAtomically } from './atomic-file.js';
|
|
5
|
+
import { importHash } from '../core/legacy-scan.js';
|
|
6
|
+
import { withCanonicalWriteLock } from './canonical-write-lock.js';
|
|
7
|
+
/** Confine local import artifacts to imports/ or an explicitly selected temporary path. */
|
|
8
|
+
export async function assertImportPath(path, home) {
|
|
9
|
+
const target = await physicalPath(resolve(path));
|
|
10
|
+
const roots = await Promise.all([physicalPath(resolve(home, 'imports')), physicalPath(tmpdir())]);
|
|
11
|
+
if (!roots.some((root) => { const rel = relative(root, target); return rel !== '' && !rel.startsWith(`..${sep}`) && rel !== '..' && !rel.startsWith(sep); }))
|
|
12
|
+
throw new Error('import_output_must_be_local_or_temporary');
|
|
13
|
+
return target;
|
|
14
|
+
}
|
|
15
|
+
async function physicalPath(path) {
|
|
16
|
+
try {
|
|
17
|
+
return await realpath(path);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error.code !== 'ENOENT')
|
|
21
|
+
throw error;
|
|
22
|
+
const parent = dirname(path);
|
|
23
|
+
if (parent === path)
|
|
24
|
+
throw error;
|
|
25
|
+
return resolve(await physicalPath(parent), relative(parent, path));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function writeImportManifest(path, home, manifest) {
|
|
29
|
+
const target = await assertImportPath(path, home);
|
|
30
|
+
await mkdir(dirname(target), { recursive: true });
|
|
31
|
+
await replaceFileAtomically(target, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
32
|
+
}
|
|
33
|
+
export async function readImportManifest(path) {
|
|
34
|
+
const { validateLegacyManifest } = await import('../core/legacy-import-manifest.js');
|
|
35
|
+
return validateLegacyManifest(JSON.parse(await readFile(path, 'utf8')));
|
|
36
|
+
}
|
|
37
|
+
export async function withImportManifestLock(path, home, operation) {
|
|
38
|
+
const target = await assertImportPath(path, home);
|
|
39
|
+
return withCanonicalWriteLock(resolve(dirname(target), '.import-locks', importHash(target).slice(7)), operation);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=import-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-manifest.js","sourceRoot":"","sources":["../../src/storage/import-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAY;IAC/D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,CAAC,KAAK,CAAC,IAAI,C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AAU,kBAAkB,CAAC,IAAY;IACnD,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;IACrF,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAI,IAAY,EAAE,IAAY,EAAE,SAA2B;IACrG,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClD,OAAO,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACnH,CAAC"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const PendingInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"change">;
|
|
4
|
+
request: z.ZodObject<{
|
|
5
|
+
usage_context: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
investigation_id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
invocation_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
retry_of: z.ZodOptional<z.ZodUUID>;
|
|
9
|
+
project_key: z.ZodOptional<z.ZodString>;
|
|
10
|
+
supplied_agent: z.ZodOptional<z.ZodString>;
|
|
11
|
+
supplied_model: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strict>>;
|
|
13
|
+
payload: z.ZodObject<{
|
|
14
|
+
problem: z.ZodObject<{
|
|
15
|
+
schema_version: z.ZodLiteral<3>;
|
|
16
|
+
kind: z.ZodLiteral<"problem">;
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
title: z.ZodString;
|
|
19
|
+
observations: z.ZodObject<{
|
|
20
|
+
symptoms: z.ZodArray<z.ZodString>;
|
|
21
|
+
error_signatures: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
22
|
+
symbols: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
23
|
+
operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
24
|
+
expected: z.ZodString;
|
|
25
|
+
observed: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
hypotheses: z.ZodObject<{
|
|
28
|
+
suspected_causes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
29
|
+
components: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
environment: z.ZodObject<{
|
|
32
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
35
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
created_at: z.ZodISODateTime;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
solution: z.ZodObject<{
|
|
40
|
+
schema_version: z.ZodLiteral<3>;
|
|
41
|
+
kind: z.ZodLiteral<"solution">;
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
problem_id: z.ZodString;
|
|
44
|
+
revision: z.ZodNumber;
|
|
45
|
+
title: z.ZodString;
|
|
46
|
+
cause: z.ZodString;
|
|
47
|
+
applicable_if: z.ZodArray<z.ZodString>;
|
|
48
|
+
reject_if: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
+
inspections: z.ZodArray<z.ZodString>;
|
|
50
|
+
actions: z.ZodArray<z.ZodString>;
|
|
51
|
+
verification: z.ZodArray<z.ZodString>;
|
|
52
|
+
safety: z.ZodArray<z.ZodString>;
|
|
53
|
+
source_evidence: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
project_key: z.ZodString;
|
|
56
|
+
repository_fingerprint: z.ZodString;
|
|
57
|
+
revision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"git_commit">;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"working_tree_hash">;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
}, z.core.$strict>], "kind">;
|
|
64
|
+
relative_path: z.ZodString;
|
|
65
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
66
|
+
content_hash: z.ZodString;
|
|
67
|
+
tests: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
68
|
+
}, z.core.$strict>>>;
|
|
69
|
+
prior_solution: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
revision: z.ZodNumber;
|
|
72
|
+
relation: z.ZodEnum<{
|
|
73
|
+
refines: "refines";
|
|
74
|
+
supersedes: "supersedes";
|
|
75
|
+
}>;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
created_at: z.ZodISODateTime;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
problem_fingerprint: z.ZodString;
|
|
80
|
+
project_key: z.ZodOptional<z.ZodString>;
|
|
81
|
+
target_solution_handle: z.ZodOptional<z.ZodString>;
|
|
82
|
+
verification: z.ZodObject<{
|
|
83
|
+
recurrence_risk: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
unknown: "unknown";
|
|
85
|
+
low: "low";
|
|
86
|
+
high: "high";
|
|
87
|
+
medium: "medium";
|
|
88
|
+
}>>;
|
|
89
|
+
value: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
unknown: "unknown";
|
|
91
|
+
low: "low";
|
|
92
|
+
high: "high";
|
|
93
|
+
medium: "medium";
|
|
94
|
+
}>>;
|
|
95
|
+
verified_at: z.ZodISODateTime;
|
|
96
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
97
|
+
kind: z.ZodEnum<{
|
|
98
|
+
focused_test: "focused_test";
|
|
99
|
+
integration_test: "integration_test";
|
|
100
|
+
manual_verification: "manual_verification";
|
|
101
|
+
observation: "observation";
|
|
102
|
+
}>;
|
|
103
|
+
handle: z.ZodString;
|
|
104
|
+
summary: z.ZodString;
|
|
105
|
+
}, z.core.$strict>>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
relation_evidence: z.ZodObject<{
|
|
108
|
+
replacement_verified: z.ZodBoolean;
|
|
109
|
+
conflict: z.ZodArray<z.ZodString>;
|
|
110
|
+
analogous: z.ZodArray<z.ZodString>;
|
|
111
|
+
weak_text_overlap: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
payload_hash: z.ZodString;
|
|
115
|
+
state_hash: z.ZodString;
|
|
116
|
+
relation: z.ZodEnum<{
|
|
117
|
+
exact_solution: "exact_solution";
|
|
118
|
+
same_problem_alternative: "same_problem_alternative";
|
|
119
|
+
refines_solution: "refines_solution";
|
|
120
|
+
supersedes_solution: "supersedes_solution";
|
|
121
|
+
contradicts_solution: "contradicts_solution";
|
|
122
|
+
analogous_pattern: "analogous_pattern";
|
|
123
|
+
weak_overlap: "weak_overlap";
|
|
124
|
+
new_problem: "new_problem";
|
|
125
|
+
}>;
|
|
126
|
+
pending_verification: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
environment: z.ZodObject<{
|
|
128
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
129
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
130
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
131
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
132
|
+
}, z.core.$strict>;
|
|
133
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
134
|
+
role: z.ZodEnum<{
|
|
135
|
+
code: "code";
|
|
136
|
+
environment: "environment";
|
|
137
|
+
test: "test";
|
|
138
|
+
}>;
|
|
139
|
+
locator: z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
project_key: z.ZodString;
|
|
142
|
+
repository_fingerprint: z.ZodString;
|
|
143
|
+
revision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
144
|
+
kind: z.ZodLiteral<"git_commit">;
|
|
145
|
+
value: z.ZodString;
|
|
146
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
147
|
+
kind: z.ZodLiteral<"working_tree_hash">;
|
|
148
|
+
value: z.ZodString;
|
|
149
|
+
}, z.core.$strict>], "kind">;
|
|
150
|
+
relative_path: z.ZodString;
|
|
151
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
152
|
+
content_hash: z.ZodString;
|
|
153
|
+
tests: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
154
|
+
}, z.core.$strict>;
|
|
155
|
+
}, z.core.$strict>>;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
verification: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
environment: z.ZodObject<{
|
|
160
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
161
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
162
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
163
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
166
|
+
role: z.ZodEnum<{
|
|
167
|
+
code: "code";
|
|
168
|
+
environment: "environment";
|
|
169
|
+
test: "test";
|
|
170
|
+
}>;
|
|
171
|
+
locator: z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
project_key: z.ZodString;
|
|
174
|
+
repository_fingerprint: z.ZodString;
|
|
175
|
+
revision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
|
+
kind: z.ZodLiteral<"git_commit">;
|
|
177
|
+
value: z.ZodString;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
kind: z.ZodLiteral<"working_tree_hash">;
|
|
180
|
+
value: z.ZodString;
|
|
181
|
+
}, z.core.$strict>], "kind">;
|
|
182
|
+
relative_path: z.ZodString;
|
|
183
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
184
|
+
content_hash: z.ZodString;
|
|
185
|
+
tests: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
}, z.core.$strict>>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
190
|
+
kind: z.ZodLiteral<"attempt">;
|
|
191
|
+
request: z.ZodObject<{
|
|
192
|
+
usage_context: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
investigation_id: z.ZodOptional<z.ZodString>;
|
|
194
|
+
invocation_id: z.ZodOptional<z.ZodString>;
|
|
195
|
+
retry_of: z.ZodOptional<z.ZodUUID>;
|
|
196
|
+
project_key: z.ZodOptional<z.ZodString>;
|
|
197
|
+
supplied_agent: z.ZodOptional<z.ZodString>;
|
|
198
|
+
supplied_model: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$strict>>;
|
|
200
|
+
solution_handle: z.ZodString;
|
|
201
|
+
result: z.ZodEnum<{
|
|
202
|
+
solved: "solved";
|
|
203
|
+
failed: "failed";
|
|
204
|
+
inapplicable: "inapplicable";
|
|
205
|
+
inconclusive: "inconclusive";
|
|
206
|
+
regressed: "regressed";
|
|
207
|
+
}>;
|
|
208
|
+
problem_fingerprint: z.ZodString;
|
|
209
|
+
project_key: z.ZodOptional<z.ZodString>;
|
|
210
|
+
environment: z.ZodObject<{
|
|
211
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
212
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
213
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
214
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
215
|
+
}, z.core.$strict>;
|
|
216
|
+
reason_code: z.ZodOptional<z.ZodString>;
|
|
217
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
218
|
+
kind: z.ZodEnum<{
|
|
219
|
+
focused_test: "focused_test";
|
|
220
|
+
integration_test: "integration_test";
|
|
221
|
+
manual_verification: "manual_verification";
|
|
222
|
+
observation: "observation";
|
|
223
|
+
}>;
|
|
224
|
+
handle: z.ZodString;
|
|
225
|
+
summary: z.ZodString;
|
|
226
|
+
}, z.core.$strict>>;
|
|
227
|
+
pending_verification: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
environment: z.ZodObject<{
|
|
229
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
230
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
231
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
232
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
235
|
+
role: z.ZodEnum<{
|
|
236
|
+
code: "code";
|
|
237
|
+
environment: "environment";
|
|
238
|
+
test: "test";
|
|
239
|
+
}>;
|
|
240
|
+
locator: z.ZodObject<{
|
|
241
|
+
id: z.ZodString;
|
|
242
|
+
project_key: z.ZodString;
|
|
243
|
+
repository_fingerprint: z.ZodString;
|
|
244
|
+
revision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
245
|
+
kind: z.ZodLiteral<"git_commit">;
|
|
246
|
+
value: z.ZodString;
|
|
247
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
248
|
+
kind: z.ZodLiteral<"working_tree_hash">;
|
|
249
|
+
value: z.ZodString;
|
|
250
|
+
}, z.core.$strict>], "kind">;
|
|
251
|
+
relative_path: z.ZodString;
|
|
252
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
253
|
+
content_hash: z.ZodString;
|
|
254
|
+
tests: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
255
|
+
}, z.core.$strict>;
|
|
256
|
+
}, z.core.$strict>>;
|
|
257
|
+
}, z.core.$strict>>;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
verification: z.ZodOptional<z.ZodObject<{
|
|
260
|
+
environment: z.ZodObject<{
|
|
261
|
+
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
262
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
263
|
+
runtimes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
264
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
265
|
+
}, z.core.$strict>;
|
|
266
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
267
|
+
role: z.ZodEnum<{
|
|
268
|
+
code: "code";
|
|
269
|
+
environment: "environment";
|
|
270
|
+
test: "test";
|
|
271
|
+
}>;
|
|
272
|
+
locator: z.ZodObject<{
|
|
273
|
+
id: z.ZodString;
|
|
274
|
+
project_key: z.ZodString;
|
|
275
|
+
repository_fingerprint: z.ZodString;
|
|
276
|
+
revision: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
277
|
+
kind: z.ZodLiteral<"git_commit">;
|
|
278
|
+
value: z.ZodString;
|
|
279
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
280
|
+
kind: z.ZodLiteral<"working_tree_hash">;
|
|
281
|
+
value: z.ZodString;
|
|
282
|
+
}, z.core.$strict>], "kind">;
|
|
283
|
+
relative_path: z.ZodString;
|
|
284
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
285
|
+
content_hash: z.ZodString;
|
|
286
|
+
tests: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
287
|
+
}, z.core.$strict>;
|
|
288
|
+
}, z.core.$strict>>;
|
|
289
|
+
}, z.core.$strict>>;
|
|
290
|
+
}, z.core.$strict>], "kind">;
|
|
291
|
+
export type PendingInput = z.infer<typeof PendingInputSchema>;
|
|
292
|
+
export type PendingRecord = {
|
|
293
|
+
schema_version: 1;
|
|
294
|
+
pending_id: string;
|
|
295
|
+
content_hash: string;
|
|
296
|
+
input: PendingInput;
|
|
297
|
+
status: 'queued' | 'retrying' | 'retryable_error' | 'needs_review' | 'completed' | 'discarded';
|
|
298
|
+
created_at: string;
|
|
299
|
+
updated_at: string;
|
|
300
|
+
retries: number;
|
|
301
|
+
failure: {
|
|
302
|
+
stage: string;
|
|
303
|
+
code: string;
|
|
304
|
+
};
|
|
305
|
+
receipt?: Record<string, unknown>;
|
|
306
|
+
};
|
|
307
|
+
export declare function validatePendingInput(value: unknown): PendingInput;
|
|
308
|
+
export declare function pendingContentHash(input: PendingInput): string;
|
|
309
|
+
export declare function enqueuePending(home: string, value: unknown, failure?: {
|
|
310
|
+
stage: string;
|
|
311
|
+
code: string;
|
|
312
|
+
}): Promise<PendingRecord>;
|
|
313
|
+
export declare function listPending(home: string): Promise<PendingRecord[]>;
|
|
314
|
+
export declare function readPending(home: string, id: string): Promise<PendingRecord | undefined>;
|
|
315
|
+
export declare function writePending(home: string, record: PendingRecord): Promise<void>;
|
|
316
|
+
export declare function discardPending(home: string, id: string): Promise<PendingRecord>;
|
|
317
|
+
export declare function withPendingLock<T>(home: string, id: string, action: () => Promise<T>): Promise<T>;
|
|
318
|
+
/** Only transient, validated write failures enter the queue; diagnostic input errors do not. */
|
|
319
|
+
export declare function deferPendingWrite(home: string, input: PendingInput, error: unknown): Promise<{
|
|
320
|
+
status: string;
|
|
321
|
+
code: string;
|
|
322
|
+
persisted: boolean;
|
|
323
|
+
pending_id: string;
|
|
324
|
+
} | {
|
|
325
|
+
status: string;
|
|
326
|
+
code: string;
|
|
327
|
+
persisted: boolean;
|
|
328
|
+
pending_id?: undefined;
|
|
329
|
+
}>;
|