coding-artifact-evaluation-shell 0.1.0-eidolon.a1b37cbcd7c07 → 0.1.0-eidolon.a3d53b93d02d8
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/capsule.ts +1 -4
- package/package.json +1 -1
- package/resources/evaluate.md +1 -7
- package/support/code-knowledge.ts +0 -73
package/capsule.ts
CHANGED
|
@@ -22,14 +22,12 @@ import {counterReview} from './support/counter-review';
|
|
|
22
22
|
import {assertCodingScope,type CodingScope} from './coding-scope';
|
|
23
23
|
import {projectTargetGroups} from './target-groups';
|
|
24
24
|
import {retainEvaluation,assertRetentionDestination} from './support/retention';
|
|
25
|
-
import {attachCodeKnowledgeEvidence,type CodeEvidenceSelection} from './support/code-knowledge';
|
|
26
|
-
export {attachCodeKnowledgeEvidence,type CodeEvidenceSelection} from './support/code-knowledge';
|
|
27
25
|
export {createCodexRuntime,type AgentRuntime} from './support/agent-runtime';
|
|
28
26
|
export {retainEvaluation,verifyRetainedEvaluation} from './support/retention';
|
|
29
27
|
export type {CodingScope} from './coding-scope';
|
|
30
28
|
|
|
31
29
|
/** Runtime dependencies are trusted caller inputs, never discovered in delivered assets. */
|
|
32
|
-
export interface EvaluationOptions {space?:number;judge?:JudgePort;budget?:Budget;noModel?:boolean;experimentalCounterReview?:boolean;agentRuntime?:AgentRuntime;judgeRuntime?:AgentRuntime;codingScope?:CodingScope;retainTo?:string
|
|
30
|
+
export interface EvaluationOptions {space?:number;judge?:JudgePort;budget?:Budget;noModel?:boolean;experimentalCounterReview?:boolean;agentRuntime?:AgentRuntime;judgeRuntime?:AgentRuntime;codingScope?:CodingScope;retainTo?:string}
|
|
33
31
|
interface ObservationRuntime {
|
|
34
32
|
run:AgentRun;agent:AgentRuntime;state:ProcessState;budget:Budget;invocations:Invocation[];
|
|
35
33
|
review?:JudgePort['review'];onProposal?:(proposal:Proposal)=>void;
|
|
@@ -104,7 +102,6 @@ export async function runEvaluation(manifest:Manifest,output:string,options:Eval
|
|
|
104
102
|
if(options.retainTo)assertRetentionDestination(options.retainTo,[output,fs.realpathSync(manifest.artifact)]);
|
|
105
103
|
if(options.experimentalCounterReview&&(options.noModel||options.judge))throw Error('Experimental counter-review requires the native model runtime');
|
|
106
104
|
const run=prepareExecution(bindRuntime(createEvaluationRun(output,manifest.artifact),manifest.runtime),manifest.execution),agent=options.agentRuntime??resolveAgentRuntime('codex'),judgeAgent=options.judgeRuntime??agent,state={interrupted:false};
|
|
107
|
-
if(options.codeEvidence)manifest=attachCodeKnowledgeEvidence({...manifest,artifact:run.workspace},options.codeEvidence);
|
|
108
105
|
const ceiling=options.noModel?0:(manifest.agentObservation?6:2);
|
|
109
106
|
const budget=options.budget??newBudget(Date.now(),ceiling,1200000);
|
|
110
107
|
const sources=readSources(manifest.targets),artifactDigest=fingerprint(run.workspace),runId=randomUUID();
|
package/package.json
CHANGED
package/resources/evaluate.md
CHANGED
|
@@ -25,10 +25,4 @@ For grouped results, the caller explicitly supplies `{id,label,rootIds}` entries
|
|
|
25
25
|
|
|
26
26
|
For current coding runs, explicit nonempty `codingScope.groups` also asks the same judge to compare every applicable caller-owned leaf, including after an overall FAIL. It does not add a role, scoring protocol, evidence or new requirements. An absent claim is unreviewed, distinct from an explicit indeterminate claim. Historical and ungrouped minimal FAIL decisions retain their original meaning; completeness and semantic correctness still require actual evidence.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Optional code navigation evidence
|
|
31
|
-
|
|
32
|
-
Trusted callers of `runCodingEvaluation` may supply `codeEvidence:{path,sourceRoot}` in options. Both paths are relative to their owned frozen artifact; the evidence JSON must be outside the selected source subtree. This selects the existing file observation channel, not a new judge or execution permission. The runner validates the complete raw-byte snapshot and coverage before a model call, reads the bounded navigation file, and back-reads its bounded UTF-8 candidate source files. With the option omitted, existing behavior is unchanged.
|
|
33
|
-
|
|
34
|
-
The evidence can be produced by depa-knowledge-base.cs `tools/Depa.CodeEvidence`. It includes unsupported/excluded/oversize files, actual parser/resolvers, unresolved calls and omitted graph counts. Inspect these conditions when reasoning; source locations are candidates, missing hits do not prove absence, and paths establish no runtime or historical event. The adapter authenticates source binding and structure, not semantic correctness of a parser or all requirements. Keep the original complete targets and ordinary source/process/browser observations.
|
|
28
|
+
Before collection, describe the caller's intended scope and method/depth in its trusted codingScope description and capability declarations; report the work actually completed. See [Review](review.md) for the shared evidence-depth guidance used by both collection and judgment. The existing claim method/conditions/reasoning/limitations support scope, actual investigation, coverage and gaps; there is no new wire field or depth score. A code-review-only selection cannot certify an original full-delivery requirement left unobserved. Index/search tools are optional, explicitly supplied locators whose version, resolution and coverage must be checked against frozen source; they do not substitute for execution or unavailable historical facts.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import {digest} from './isolation';
|
|
4
|
-
import type {Manifest} from '../contract';
|
|
5
|
-
|
|
6
|
-
/** Caller-selected, optional navigation. No tool process, graph DB or new judge authority. */
|
|
7
|
-
export interface CodeEvidenceSelection {path:string;sourceRoot:string}
|
|
8
|
-
interface ByteIdentity {path:string;sha256:string;bytes:number}
|
|
9
|
-
export function sourceByteInventory(root:string):ByteIdentity[] {
|
|
10
|
-
const result:ByteIdentity[]=[];let bytes=0;
|
|
11
|
-
function visit(dir:string):void {
|
|
12
|
-
if(fs.lstatSync(dir).isSymbolicLink())throw Error('Code evidence cannot follow links');
|
|
13
|
-
for(const name of fs.readdirSync(dir)){
|
|
14
|
-
const file=path.join(dir,name),stat=fs.lstatSync(file);
|
|
15
|
-
if(stat.isSymbolicLink())throw Error('Code evidence cannot follow links');
|
|
16
|
-
if(stat.isDirectory()){visit(file);continue;}
|
|
17
|
-
if(!stat.isFile())throw Error('Code evidence requires regular files');
|
|
18
|
-
const relative=path.relative(root,file).split(path.sep).join('/');
|
|
19
|
-
if(/[\0\r\n\\]/.test(relative))throw Error('Unsupported snapshot path');
|
|
20
|
-
bytes+=stat.size;if(result.length>=10000||bytes>128*1024*1024)throw Error('Code snapshot exceeds inventory bound');
|
|
21
|
-
result.push({path:relative,sha256:digest(fs.readFileSync(file)),bytes:stat.size});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
visit(root);return result.sort((a,b)=>a.path<b.path?-1:a.path>b.path?1:0);
|
|
25
|
-
}
|
|
26
|
-
export function sourceByteDigest(files:ByteIdentity[]):string {
|
|
27
|
-
return digest(files.map(f=>`${f.path}\0${f.sha256}\0${f.bytes}\n`).join(''));
|
|
28
|
-
}
|
|
29
|
-
function owned(root:string,relative:string):string {
|
|
30
|
-
if(!relative||path.isAbsolute(relative)||relative.split(/[\\/]/).some(p=>p==='..'||p==='.'||p===''))throw Error('Code evidence path escapes artifact');
|
|
31
|
-
let current=root;
|
|
32
|
-
for(const part of relative.split('/')){
|
|
33
|
-
current=path.join(current,part);
|
|
34
|
-
if(fs.lstatSync(current).isSymbolicLink())throw Error('Code evidence cannot follow links');
|
|
35
|
-
}
|
|
36
|
-
return current;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Called after native artifact freezing; stale envelopes fail before model invocation.
|
|
40
|
-
* The ordinary file observer reads this envelope plus bounded candidate source files.
|
|
41
|
-
* Unsupported/unreadable sources remain in inventory; no observation is invented. */
|
|
42
|
-
export function attachCodeKnowledgeEvidence(manifest:Manifest,selection:CodeEvidenceSelection):Manifest {
|
|
43
|
-
const root=fs.realpathSync(manifest.artifact),source=owned(root,selection.sourceRoot),file=owned(root,selection.path);
|
|
44
|
-
if(file===source||file.startsWith(source+path.sep))throw Error('Evidence must be outside its source snapshot');
|
|
45
|
-
if(fs.statSync(file).size>1048576)throw Error('Code evidence exceeds file observation bound');
|
|
46
|
-
const evidence=JSON.parse(fs.readFileSync(file,'utf8'));
|
|
47
|
-
if(evidence.format!=='depa-code-navigation-v1')throw Error('Unknown code evidence format');
|
|
48
|
-
const inventory=sourceByteInventory(source),identity=sourceByteDigest(inventory);
|
|
49
|
-
if(evidence.snapshotDigest!==identity||JSON.stringify(evidence.inventory)!==JSON.stringify(inventory))throw Error('Stale or different code evidence snapshot');
|
|
50
|
-
if(!Array.isArray(evidence.coverage)||evidence.coverage.length!==inventory.length)throw Error('Incomplete code evidence coverage');
|
|
51
|
-
const seen=new Set<string>(),fileIds=new Map<string,string>();
|
|
52
|
-
for(const row of evidence.coverage){
|
|
53
|
-
const original=inventory.find(f=>f.path===row.path);
|
|
54
|
-
if(!original||seen.has(row.path)||original.sha256!==row.sha256||original.bytes!==row.bytes||!['document','text-or-regex-fallback','semantic-candidate','over-size-or-excluded','skipped','unsupported-or-excluded'].includes(row.status)||!Array.isArray(row.resolvers))throw Error('Invalid code evidence coverage');
|
|
55
|
-
seen.add(row.path);if(row.fileId)fileIds.set(row.fileId,row.path);
|
|
56
|
-
}
|
|
57
|
-
if(!Array.isArray(evidence.symbols)||!Array.isArray(evidence.edges)||evidence.symbols.length>200||evidence.edges.length>400||!evidence.parser||!evidence.settings||!Array.isArray(evidence.limitations)||!evidence.limitations.length)throw Error('Incomplete bounded code evidence');
|
|
58
|
-
for(const kind of ['symbols','edges'] as const){
|
|
59
|
-
const omitted=kind==='symbols'?'omittedSymbols':'omittedEdges';
|
|
60
|
-
if(!Number.isSafeInteger(evidence.totals?.[kind])||evidence.totals[kind]<evidence[kind].length||evidence.totals[omitted]!==evidence.totals[kind]-evidence[kind].length)throw Error('Invalid code evidence truncation');
|
|
61
|
-
}
|
|
62
|
-
for(const row of [...evidence.symbols,...evidence.edges])if(row.fileId&&!fileIds.has(row.fileId))throw Error('Code location outside frozen inventory');
|
|
63
|
-
const probes=[...(manifest.files??[])];
|
|
64
|
-
const add=(relative:string,conditions:string)=>{if(!probes.some(p=>p.path===relative))probes.push({path:relative,conditions});};
|
|
65
|
-
add(selection.path,'Optional static code navigation from byte-bound frozen source. Inspect coverage, parser/resolvers, unresolved calls and truncation. Missing hits prove no absence; paths prove no execution or past event. Back-read source before using a candidate; original requirements and judge authority are unchanged.');
|
|
66
|
-
for(const relative of new Set<string>(evidence.symbols.map((s:{fileId:string})=>fileIds.get(s.fileId)).filter(Boolean))){
|
|
67
|
-
const content=fs.readFileSync(path.join(source,relative));
|
|
68
|
-
try{if(content.length>1048576)continue;new TextDecoder('utf-8',{fatal:true}).decode(content);}
|
|
69
|
-
catch{continue;}
|
|
70
|
-
add(selection.sourceRoot+'/'+relative,'Actual frozen source read to check optional navigation candidates. Static inspection establishes neither runtime execution nor completeness of unsupported files.');
|
|
71
|
-
}
|
|
72
|
-
return {...manifest,files:probes};
|
|
73
|
-
}
|