@tnunamak/dalan 0.9.3 → 0.9.5
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/CHANGELOG.md +13 -0
- package/CONTRIBUTING.md +2 -0
- package/bin/dot-acp-agent.mjs +6 -26
- package/bin/dot-worker.mjs +3 -3
- package/docs/examples/dalan-requester.toml +14 -0
- package/docs/local-agent-mcp.md +25 -0
- package/docs/operations.md +4 -0
- package/docs/test-suite-isolation.md +30 -2
- package/docs/usage.md +1 -1
- package/integrations/t3/acp-kit/src/capability.mjs +1 -25
- package/package.json +4 -3
- package/src/acp-bridge.mjs +66 -8
- package/src/acp-context.mjs +4 -3
- package/src/cli-help.mjs +1 -1
- package/src/live-claim-questions.mjs +7 -0
- package/src/mcp-stdio.mjs +89 -35
- package/src/mcp-tasks.mjs +164 -0
- package/src/owner-capability.mjs +25 -0
- package/src/patch-apply.mjs +7 -6
- package/src/paths.mjs +3 -0
- package/src/server.mjs +21 -4
- package/src/store.mjs +45 -13
- package/src/submission-policy.mjs +5 -3
- package/src/tool-registry.mjs +9 -2
- package/src/workspace.mjs +8 -4
|
@@ -482,7 +482,7 @@ export function validateSubmission(assignment,{sensitiveScopeOverride=null,scanI
|
|
|
482
482
|
// Shared facts keep the directory exclusion policy and the explicit path refusal aligned.
|
|
483
483
|
const hardSensitive=file=>hardName(file)||(hasRouterSyntax(file)&&hardName(file.replace(/\[[^\]/]*\]\]?|\([^)/]*\)/g,'')));
|
|
484
484
|
const policyEntry=file=>p.sensitive_paths.find(x=>file===x||file.startsWith(`${x}/`));
|
|
485
|
-
const sensitiveReason=file=>hardSensitive(file)?'hard sensitive path (credential, key or signing material)':policyEntry(file)?'listed in the submission policy sensitive_paths':'
|
|
485
|
+
const sensitiveReason=file=>hardSensitive(file)?'hard sensitive path (credential, key or signing material)':policyEntry(file)?'listed in the submission policy sensitive_paths':'refused: soft sensitive name';
|
|
486
486
|
const sensitiveRefusal=file=>{
|
|
487
487
|
const entry=policyEntry(file), base=file.split('/').at(-1);
|
|
488
488
|
const rule=entry?'owner sensitive_paths entry '+entry:'soft sensitive name: '+(/auth/i.test(base)?'auth':/secret/i.test(base)?'secret':/credential/i.test(base)?'credential':/(?:^|[_.-])sign(?:ing|ature)?(?=[_.-]|$)/i.test(base)?'signing':'credential-style token name');
|
|
@@ -720,10 +720,10 @@ export function validateSubmission(assignment,{sensitiveScopeOverride=null,scanI
|
|
|
720
720
|
for(const file of scan.files.filter(f=>within(f,scope)&&!scope.includes(f))) {
|
|
721
721
|
if(priorOmittedPaths.has(file)) continue;
|
|
722
722
|
if(withholdImplementation&&withheldRepoPath(file,p.sensitive_paths)) {
|
|
723
|
-
dropped.push({path:file,reason:isSensitiveRepoPath(file,p.sensitive_paths)?sensitiveReason(file):'sensitive ancestor directory
|
|
723
|
+
dropped.push({path:file,reason:isSensitiveRepoPath(file,p.sensitive_paths)?sensitiveReason(file):'refused: sensitive ancestor directory'});continue;
|
|
724
724
|
}
|
|
725
725
|
if(rendered.execution_scope!=='implementation'&&softName(file)&&!hardSensitive(file)&&!policyEntry(file)&&file!==exception?.path) {
|
|
726
|
-
dropped.push({path:file,reason:'soft sensitive name
|
|
726
|
+
dropped.push({path:file,reason:'refused: soft sensitive name'});continue;
|
|
727
727
|
}
|
|
728
728
|
try { inspectPath(file); }
|
|
729
729
|
catch(error) {
|
|
@@ -744,6 +744,8 @@ export function validateSubmission(assignment,{sensitiveScopeOverride=null,scanI
|
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
746
|
if(dropped.length) {
|
|
747
|
+
const refused=dropped.filter(({reason})=>reason.startsWith('refused:'));
|
|
748
|
+
if(refused.length) warn(`Sharing refused for ${refused.slice(0,5).map(({path,reason})=>`${path} (${reason.slice('refused: '.length)})`).join(', ')}${refused.length>5?', and '+(refused.length-5)+' more':''}`);
|
|
747
749
|
try {
|
|
748
750
|
narrowedScope=withholdImplementation?scope:narrowScope(scope,[...new Set([...scan.files,...scan.diffFiles])],dropped.map(d=>d.path));
|
|
749
751
|
} catch(error) {
|
package/src/tool-registry.mjs
CHANGED
|
@@ -401,9 +401,9 @@ export function createToolRegistry({ store, now = store.nowMs, handlers = {}, au
|
|
|
401
401
|
inProgress(current);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
let result;
|
|
404
|
+
let result, recordRead;
|
|
405
405
|
try {
|
|
406
|
-
result = await impl.run(call);
|
|
406
|
+
result = await impl.run({ ...call, recordOnRead: fn => { recordRead = fn; } });
|
|
407
407
|
} catch (error) {
|
|
408
408
|
if (error instanceof RegistryError) {
|
|
409
409
|
// The handler refused before doing anything, so the key is free to use again.
|
|
@@ -417,6 +417,13 @@ export function createToolRegistry({ store, now = store.nowMs, handlers = {}, au
|
|
|
417
417
|
// Replies containing current private data may not outlive the grant that permitted the read.
|
|
418
418
|
if (impl?.requireCurrentRead) deny(latestAuthority());
|
|
419
419
|
const capped = capResult(result);
|
|
420
|
+
// Record delivery evidence only after the final authority check and with the exact reply intact.
|
|
421
|
+
if (impl?.requireCurrentRead && recordRead) {
|
|
422
|
+
if (JSON.stringify(capped) !== JSON.stringify(result)) {
|
|
423
|
+
done('handler_failed', new RegistryError('handler_failed', 'live read reply was altered'));
|
|
424
|
+
}
|
|
425
|
+
recordRead();
|
|
426
|
+
}
|
|
420
427
|
settle({ ok: true, result: capped });
|
|
421
428
|
done('ok');
|
|
422
429
|
return { ok: true, result: capped };
|
package/src/workspace.mjs
CHANGED
|
@@ -522,7 +522,7 @@ export function pinnedScopedSource(mirror,assignment) {
|
|
|
522
522
|
const tree=readGit(['ls-tree','-rlz','--full-tree',pin],16*1024*1024);
|
|
523
523
|
if(tree.error||tree.status!==0) throw new Error('pinned source tree unavailable');
|
|
524
524
|
const decoder=new TextDecoder('utf-8',{fatal:true,ignoreBOM:true});
|
|
525
|
-
const entries=[],spellings=new Map();
|
|
525
|
+
const entries=[],spellings=new Map(),refusedPaths=[];
|
|
526
526
|
let total=0,offset=0;
|
|
527
527
|
while(offset<tree.stdout.length) {
|
|
528
528
|
const end=tree.stdout.indexOf(0,offset);
|
|
@@ -536,7 +536,11 @@ export function pinnedScopedSource(mirror,assignment) {
|
|
|
536
536
|
let file;
|
|
537
537
|
try { file=relative(decoder.decode(entry.subarray(tab+1))); } catch { continue; }
|
|
538
538
|
if(file.split('/').some(part=>/[:]|[. ]$/.test(part))||canonicalPath(file).split('/').some(part=>part==='.git'||part==='.gitmodules')||!inScope(file,scope)||
|
|
539
|
-
|
|
539
|
+
secretContent.test(file)) continue;
|
|
540
|
+
if(withheldRepoPath(file,policy.paths)) {
|
|
541
|
+
if(scope?.paths?.includes(file)) refusedPaths.push({path:file,reason:'refused by scoped input file policy'});
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
540
544
|
const parts=file.split('/');
|
|
541
545
|
for(let i=1;i<=parts.length;i++) {
|
|
542
546
|
const spelling=parts.slice(0,i).join('/'),key=canonicalPath(spelling);
|
|
@@ -550,7 +554,7 @@ export function pinnedScopedSource(mirror,assignment) {
|
|
|
550
554
|
}
|
|
551
555
|
const files=[],blobs=new Map();
|
|
552
556
|
const manifest={schema_version:1,pin,scope_complete:false,files};
|
|
553
|
-
if(!entries.length) return {manifest,blobs};
|
|
557
|
+
if(!entries.length) return {manifest,blobs,refusedPaths};
|
|
554
558
|
const batch=readGit(['cat-file','--batch'],total+entries.length*96,entries.map(entry=>entry.oid).join('\n')+'\n');
|
|
555
559
|
if(batch.error||batch.status!==0) throw new Error('pinned source blob unavailable');
|
|
556
560
|
let cursor=0;
|
|
@@ -572,7 +576,7 @@ export function pinnedScopedSource(mirror,assignment) {
|
|
|
572
576
|
// Claim completeness only for an exact file list. Directory scopes always
|
|
573
577
|
// describe the approved subset without disclosing whether paths were withheld.
|
|
574
578
|
manifest.scope_complete=Boolean(scope?.paths?.length&&!scope.excluded.size&&scope.paths.every(file=>blobs.has(file)));
|
|
575
|
-
return {manifest,blobs};
|
|
579
|
+
return {manifest,blobs,refusedPaths};
|
|
576
580
|
}
|
|
577
581
|
|
|
578
582
|
// A list shown in the receipt: the first `shown` names, the true total, and a flag when the preview is shorter than the total.
|