opencode-swarm 7.138.2 → 7.138.4
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/.opencode/skills/execute/SKILL.md +11 -2
- package/.opencode/skills/swarm-implement/SKILL.md +1 -1
- package/.opencode/skills/swarm-pr-review/SKILL.md +5 -1
- package/dist/background/pr-review-trigger-contract.d.ts +38 -1
- package/dist/cli/{config-doctor-hzb0bck9.js → config-doctor-31yppse4.js} +2 -2
- package/dist/cli/{core-v6bte964.js → core-65c7rvqf.js} +1 -1
- package/dist/cli/{curation-policy-aj37yvz8.js → curation-policy-hs9pc1rp.js} +2 -2
- package/dist/cli/{curator-jt6dza8y.js → curator-54n1y4j8.js} +16 -15
- package/dist/cli/{curator-llm-factory-m9f4h8t4.js → curator-llm-factory-wm27ra25.js} +16 -15
- package/dist/cli/{evidence-summary-service-6cttrkzw.js → evidence-summary-service-hrxcf29a.js} +1 -1
- package/dist/cli/{guardrail-explain-rks41rpx.js → guardrail-explain-1729nse8.js} +17 -16
- package/dist/cli/{guardrail-log-h39jxftx.js → guardrail-log-yjj5srkw.js} +4 -3
- package/dist/cli/{hive-promoter-34y2x4vt.js → hive-promoter-es2x2b0e.js} +16 -15
- package/dist/cli/{index-49ygvqvm.js → index-1g6xpjk3.js} +4 -4
- package/dist/cli/{index-bakfqtye.js → index-33q2gmgd.js} +1 -1
- package/dist/cli/{index-xm07cqy2.js → index-50mwt8fx.js} +5 -5
- package/dist/cli/index-556ja8an.js +62 -0
- package/dist/cli/{index-r9pn41rj.js → index-57stye65.js} +1 -1
- package/dist/cli/{index-exq36v6w.js → index-5q009kc4.js} +1 -1
- package/dist/cli/{index-89dwrz8n.js → index-a18hk2fw.js} +225 -63
- package/dist/cli/{index-8emf08eb.js → index-a9xny52r.js} +2 -2
- package/dist/cli/{index-yxswbd1t.js → index-c60whfgh.js} +1 -1
- package/dist/cli/{index-gpxg7wx8.js → index-e1kgxchq.js} +30 -68
- package/dist/cli/{index-qt3jjjw9.js → index-gm3pjfhb.js} +271 -94
- package/dist/cli/{index-qg5smxv9.js → index-jbge0dyh.js} +3 -3
- package/dist/cli/{index-s7ac0xrf.js → index-k27a4e5g.js} +18 -17
- package/dist/cli/{index-k6cq9wwh.js → index-m1pwkwfe.js} +1 -1
- package/dist/cli/{index-ze4we97d.js → index-m40ea3zk.js} +1 -1
- package/dist/cli/{index-da98750t.js → index-m8txs2a9.js} +1 -1
- package/dist/cli/{index-y06a43sk.js → index-mycqmsz5.js} +4 -0
- package/dist/cli/index-smsy2p8n.js +1725 -0
- package/dist/cli/{index-d01d4102.js → index-tjwz5tct.js} +2 -2
- package/dist/cli/{index-j0xx9wpj.js → index-y28n2wmq.js} +1 -1
- package/dist/cli/index.js +16 -15
- package/dist/cli/{knowledge-escalator-qmpfh5yz.js → knowledge-escalator-s6z1x65b.js} +3 -3
- package/dist/cli/{knowledge-events-7neg8x0p.js → knowledge-events-nnyn6hst.js} +1 -1
- package/dist/cli/{knowledge-store-a6d4625r.js → knowledge-store-x4yfc7v3.js} +1 -1
- package/dist/cli/{knowledge-validator-q1qrdyvx.js → knowledge-validator-1v047gsa.js} +4 -4
- package/dist/cli/{scan-cursor-3tqshkb2.js → scan-cursor-jxajj6s7.js} +2 -2
- package/dist/cli/{schema-mtyaeh18.js → schema-fj32eyae.js} +1 -1
- package/dist/cli/{scope-persistence-n1bryhzf.js → scope-persistence-w7zen2wz.js} +25 -2
- package/dist/cli/{skill-generator-t3m5qajm.js → skill-generator-rt0jqcsa.js} +5 -5
- package/dist/hooks/guardrails/destructive-command.d.ts +35 -0
- package/dist/hooks/guardrails/file-authority.d.ts +71 -26
- package/dist/hooks/guardrails/index.d.ts +2 -0
- package/dist/hooks/guardrails/tool-before.d.ts +5 -0
- package/dist/hooks/scope-guard.d.ts +3 -1
- package/dist/index.js +408 -396
- package/dist/scope/path-identity.d.ts +27 -0
- package/dist/scope/scope-binding.d.ts +90 -2
- package/dist/scope/scope-lease-renewal.d.ts +28 -0
- package/dist/scope/scope-persistence.d.ts +102 -19
- package/dist/scope/scope-resolution-diagnostic.d.ts +7 -0
- package/dist/tools/declare-scope.d.ts +3 -1
- package/dist/tools/save-plan.d.ts +2 -0
- package/dist/tools/write-pr-review-trigger-eval.d.ts +2 -2
- package/dist/turbo/lean/lane-scope.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cli/index-2y4jy0de.js +0 -642
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
authorizeCuration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-m40ea3zk.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearDuplicate,
|
|
7
7
|
inferTags,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveSwarmKnowledgePath,
|
|
10
10
|
resolveSwarmRejectedPath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-1g6xpjk3.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveKnowledgeStoreDir
|
|
15
15
|
} from "./index-en4fb04r.js";
|
|
@@ -86,7 +86,7 @@ var _internals = {
|
|
|
86
86
|
symlinkSync: fs.symlinkSync
|
|
87
87
|
},
|
|
88
88
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
89
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
89
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-w7zen2wz.js");
|
|
90
90
|
return realWrite(directory, taskId, files);
|
|
91
91
|
},
|
|
92
92
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|
package/dist/cli/index.js
CHANGED
|
@@ -6,49 +6,50 @@ import {
|
|
|
6
6
|
getPluginConfigDir,
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
resolveCommand
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-a18hk2fw.js";
|
|
10
10
|
import"./index-vm4xw9z3.js";
|
|
11
11
|
import"./index-rrxcfxrd.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
12
|
+
import"./index-gm3pjfhb.js";
|
|
13
|
+
import"./index-m8txs2a9.js";
|
|
14
|
+
import"./index-mycqmsz5.js";
|
|
15
15
|
import"./index-ngqxzkqm.js";
|
|
16
16
|
import"./index-y8552snf.js";
|
|
17
17
|
import"./index-4905hd2m.js";
|
|
18
18
|
import"./index-134d35c1.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
19
|
+
import"./index-jbge0dyh.js";
|
|
20
|
+
import"./index-50mwt8fx.js";
|
|
21
|
+
import"./index-c60whfgh.js";
|
|
22
22
|
import"./index-6mjf4vr1.js";
|
|
23
23
|
import"./index-c8s9a3zh.js";
|
|
24
24
|
import"./index-9ss2m4rs.js";
|
|
25
25
|
import"./index-wsdnttf4.js";
|
|
26
26
|
import"./index-39k6y018.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
import"./index-tjwz5tct.js";
|
|
28
|
+
import"./index-m40ea3zk.js";
|
|
29
29
|
import"./index-rtry5xyf.js";
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-
|
|
30
|
+
import"./index-1g6xpjk3.js";
|
|
31
|
+
import"./index-57stye65.js";
|
|
32
32
|
import"./index-ae75rja9.js";
|
|
33
33
|
import"./index-en4fb04r.js";
|
|
34
34
|
import"./index-tqshdzaw.js";
|
|
35
|
-
import"./index-
|
|
35
|
+
import"./index-m1pwkwfe.js";
|
|
36
36
|
import"./index-gprxjmm7.js";
|
|
37
37
|
import"./index-n832052r.js";
|
|
38
38
|
import {
|
|
39
39
|
init_package,
|
|
40
40
|
package_default
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-5q009kc4.js";
|
|
42
42
|
import"./index-bk5tah7q.js";
|
|
43
43
|
import"./index-8fwhhayc.js";
|
|
44
44
|
import"./index-q1exe2b3.js";
|
|
45
45
|
import"./index-z7jgvm9b.js";
|
|
46
|
-
import"./index-
|
|
46
|
+
import"./index-smsy2p8n.js";
|
|
47
|
+
import"./index-556ja8an.js";
|
|
47
48
|
import"./index-4fmztnrq.js";
|
|
48
49
|
import"./index-1kz6da87.js";
|
|
49
50
|
import"./index-x20cgr2q.js";
|
|
50
51
|
import"./index-b8zgtz81.js";
|
|
51
|
-
import"./index-
|
|
52
|
+
import"./index-y28n2wmq.js";
|
|
52
53
|
import"./index-4rhhvd1a.js";
|
|
53
54
|
import {
|
|
54
55
|
DEFAULT_AGENT_CONFIGS,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
maybeEscalateOnViolation,
|
|
9
9
|
maybeQuarantineOnContradiction,
|
|
10
10
|
readRecentEscalations
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-50mwt8fx.js";
|
|
12
|
+
import"./index-1g6xpjk3.js";
|
|
13
|
+
import"./index-57stye65.js";
|
|
14
14
|
import"./index-ae75rja9.js";
|
|
15
15
|
import"./index-en4fb04r.js";
|
|
16
16
|
import"./index-tqshdzaw.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveKnowledgeCounterBaselinePath,
|
|
29
29
|
resolveKnowledgeEventsPath,
|
|
30
30
|
resolveLegacyApplicationLogPath
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-57stye65.js";
|
|
32
32
|
import"./index-ae75rja9.js";
|
|
33
33
|
import"./index-en4fb04r.js";
|
|
34
34
|
import"./index-tqshdzaw.js";
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
validateLesson,
|
|
24
24
|
validateSkillCandidatePath,
|
|
25
25
|
validateSkillPath
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-tjwz5tct.js";
|
|
27
|
+
import"./index-m40ea3zk.js";
|
|
28
28
|
import"./index-rtry5xyf.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-1g6xpjk3.js";
|
|
30
|
+
import"./index-57stye65.js";
|
|
31
31
|
import"./index-ae75rja9.js";
|
|
32
32
|
import"./index-en4fb04r.js";
|
|
33
33
|
import"./index-tqshdzaw.js";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
alreadyCuratedThisGeneration,
|
|
5
5
|
claimNextScanBatch,
|
|
6
6
|
getScanStatus
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-c60whfgh.js";
|
|
8
|
+
import"./index-1g6xpjk3.js";
|
|
9
9
|
import"./index-ae75rja9.js";
|
|
10
10
|
import"./index-en4fb04r.js";
|
|
11
11
|
import"./index-tqshdzaw.js";
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
_scopePersistenceInternals,
|
|
4
|
+
claimScopeBindingForChildDurably,
|
|
3
5
|
clearAllScopes,
|
|
4
6
|
clearScopeBindingFromDisk,
|
|
5
7
|
clearScopeForTask,
|
|
8
|
+
flushScopeBindingMaintenance,
|
|
9
|
+
persistAndRegisterScopeBinding,
|
|
10
|
+
pruneScopeBindingTombstones,
|
|
6
11
|
readPlanScope,
|
|
7
12
|
readScopeBindingFromDisk,
|
|
8
13
|
readScopeFromDisk,
|
|
14
|
+
refreshScopeBindingLease,
|
|
15
|
+
replaceExistingScopeDeclaration,
|
|
9
16
|
resolveAuthorizedPrFeedbackScopeBindingFromDisk,
|
|
10
17
|
resolveAuthorizedScopeBinding,
|
|
18
|
+
resolveAuthorizedScopeBindingDetailed,
|
|
11
19
|
resolveAuthorizedScopeBindingForSession,
|
|
20
|
+
resolveAuthorizedScopeBindingForSessionDetailed,
|
|
21
|
+
resolveScopeBindingFromDisk,
|
|
12
22
|
resolveScopeWithFallbacks,
|
|
23
|
+
tombstoneScopeBinding,
|
|
13
24
|
writeScopeBindingToDisk,
|
|
14
25
|
writeScopeToDisk
|
|
15
|
-
} from "./index-
|
|
26
|
+
} from "./index-smsy2p8n.js";
|
|
27
|
+
import"./index-556ja8an.js";
|
|
16
28
|
import"./index-4fmztnrq.js";
|
|
17
29
|
import"./index-1kz6da87.js";
|
|
18
30
|
import"./index-xybtaph7.js";
|
|
@@ -25,14 +37,25 @@ import"./index-a76rekgs.js";
|
|
|
25
37
|
export {
|
|
26
38
|
writeScopeToDisk,
|
|
27
39
|
writeScopeBindingToDisk,
|
|
40
|
+
tombstoneScopeBinding,
|
|
28
41
|
resolveScopeWithFallbacks,
|
|
42
|
+
resolveScopeBindingFromDisk,
|
|
43
|
+
resolveAuthorizedScopeBindingForSessionDetailed,
|
|
29
44
|
resolveAuthorizedScopeBindingForSession,
|
|
45
|
+
resolveAuthorizedScopeBindingDetailed,
|
|
30
46
|
resolveAuthorizedScopeBinding,
|
|
31
47
|
resolveAuthorizedPrFeedbackScopeBindingFromDisk,
|
|
48
|
+
replaceExistingScopeDeclaration,
|
|
49
|
+
refreshScopeBindingLease,
|
|
32
50
|
readScopeFromDisk,
|
|
33
51
|
readScopeBindingFromDisk,
|
|
34
52
|
readPlanScope,
|
|
53
|
+
pruneScopeBindingTombstones,
|
|
54
|
+
persistAndRegisterScopeBinding,
|
|
55
|
+
flushScopeBindingMaintenance,
|
|
35
56
|
clearScopeForTask,
|
|
36
57
|
clearScopeBindingFromDisk,
|
|
37
|
-
clearAllScopes
|
|
58
|
+
clearAllScopes,
|
|
59
|
+
claimScopeBindingForChildDurably,
|
|
60
|
+
_scopePersistenceInternals
|
|
38
61
|
};
|
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
sanitizeSlug,
|
|
34
34
|
selectCandidateEntries,
|
|
35
35
|
writeEvalStub
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
36
|
+
} from "./index-jbge0dyh.js";
|
|
37
|
+
import"./index-tjwz5tct.js";
|
|
38
|
+
import"./index-m40ea3zk.js";
|
|
39
39
|
import"./index-rtry5xyf.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-
|
|
40
|
+
import"./index-1g6xpjk3.js";
|
|
41
|
+
import"./index-57stye65.js";
|
|
42
42
|
import"./index-ae75rja9.js";
|
|
43
43
|
import"./index-en4fb04r.js";
|
|
44
44
|
import"./index-tqshdzaw.js";
|
|
@@ -58,6 +58,13 @@ export declare function dcUnwrapWrappers(cmd: string): string;
|
|
|
58
58
|
* Returns array of trimmed non-empty segments.
|
|
59
59
|
*/
|
|
60
60
|
export declare function dcSplitSegments(cmd: string): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Extract targets from an `rm` command whose leading option set requests
|
|
63
|
+
* recursive or forced deletion. Accepts stacked short flags and long flags in
|
|
64
|
+
* any leading order. Quoted targets remain one token. Returns null when the
|
|
65
|
+
* segment is not a destructive rm form.
|
|
66
|
+
*/
|
|
67
|
+
export declare function dcExtractRecursiveRmTargets(segment: string): string[] | null;
|
|
61
68
|
/**
|
|
62
69
|
* Returns true if a path string contains unexpanded environment variable
|
|
63
70
|
* references that we cannot resolve at check time.
|
|
@@ -87,6 +94,34 @@ export declare function dcLstatAncestorWalk(targetPath: string, cwd: string): st
|
|
|
87
94
|
* Returns a block reason string or null if targets are acceptable.
|
|
88
95
|
*/
|
|
89
96
|
export declare function dcValidateTargets(targets: string[], cwd: string): string | null;
|
|
97
|
+
export interface DcVerifiedScope {
|
|
98
|
+
bindingId: string;
|
|
99
|
+
generationId: string;
|
|
100
|
+
files: string[];
|
|
101
|
+
}
|
|
102
|
+
export type DcRecursiveDeleteDecision = {
|
|
103
|
+
allowed: true;
|
|
104
|
+
kind: 'bare-safe-artifact' | 'scoped-nested-safe-artifact';
|
|
105
|
+
targets: string[];
|
|
106
|
+
} | {
|
|
107
|
+
allowed: false;
|
|
108
|
+
code: 'DESTRUCTIVE_TARGET_INVALID' | 'DESTRUCTIVE_TARGET_PROTECTED' | 'DESTRUCTIVE_TARGET_OUTSIDE_WORKSPACE' | 'DESTRUCTIVE_TARGET_NOT_SAFE_ARTIFACT' | 'DESTRUCTIVE_TARGET_SCOPE_REQUIRED' | 'DESTRUCTIVE_TARGET_OUT_OF_SCOPE';
|
|
109
|
+
reason: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Evaluate recursive-delete targets as one atomic set.
|
|
113
|
+
*
|
|
114
|
+
* Bare safe artifact names remain statically allowable after common target
|
|
115
|
+
* validation. Nested targets require an allowlisted final component and a
|
|
116
|
+
* resolver-produced active binding identity covering the target. Arbitrary
|
|
117
|
+
* in-scope directories are never exempt, and `.git`/`.swarm` are protected at
|
|
118
|
+
* every depth.
|
|
119
|
+
*/
|
|
120
|
+
export declare function dcEvaluateRecursiveDeleteTargets(input: {
|
|
121
|
+
targets: string[];
|
|
122
|
+
cwd: string;
|
|
123
|
+
verifiedScope?: DcVerifiedScope;
|
|
124
|
+
}): DcRecursiveDeleteDecision;
|
|
90
125
|
/**
|
|
91
126
|
* Detect Windows junction or symlink CREATION commands.
|
|
92
127
|
* Junction creation followed by recursive deletion of the junction is the
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import * as path from 'node:path';
|
|
12
12
|
import { type AuthorityConfig } from '../../config/schema';
|
|
13
13
|
import { type FileZone } from '../../context/zone-classifier';
|
|
14
|
+
import { type PathFlavor } from '../../scope/path-identity';
|
|
14
15
|
/**
|
|
15
16
|
* Hashes tool arguments for repetition detection.
|
|
16
17
|
*
|
|
@@ -106,6 +107,39 @@ export type AgentRule = {
|
|
|
106
107
|
allowedGlobs?: string[];
|
|
107
108
|
allowedCaseSensitiveGlobs?: string[];
|
|
108
109
|
};
|
|
110
|
+
export type AuthorityRoleCapability = 'native' | 'direct-write' | 'read-only' | 'dedicated-tool-only';
|
|
111
|
+
/**
|
|
112
|
+
* Exhaustive classification for every swarm role. Dedicated-tool roles may
|
|
113
|
+
* mutate state only through their purpose-built tools, never raw file writes.
|
|
114
|
+
*/
|
|
115
|
+
export declare const AUTHORITY_ROLE_CAPABILITIES: {
|
|
116
|
+
readonly architect: "direct-write";
|
|
117
|
+
readonly coder: "direct-write";
|
|
118
|
+
readonly reviewer: "direct-write";
|
|
119
|
+
readonly critic: "direct-write";
|
|
120
|
+
readonly critic_oversight: "dedicated-tool-only";
|
|
121
|
+
readonly critic_finding_validator: "dedicated-tool-only";
|
|
122
|
+
readonly explorer: "read-only";
|
|
123
|
+
readonly sme: "read-only";
|
|
124
|
+
readonly researcher: "read-only";
|
|
125
|
+
readonly test_engineer: "direct-write";
|
|
126
|
+
readonly docs: "direct-write";
|
|
127
|
+
readonly docs_design: "direct-write";
|
|
128
|
+
readonly designer: "direct-write";
|
|
129
|
+
readonly critic_sounding_board: "read-only";
|
|
130
|
+
readonly critic_drift_verifier: "read-only";
|
|
131
|
+
readonly critic_hallucination_verifier: "read-only";
|
|
132
|
+
readonly critic_architecture_supervisor: "read-only";
|
|
133
|
+
readonly curator_init: "dedicated-tool-only";
|
|
134
|
+
readonly curator_phase: "dedicated-tool-only";
|
|
135
|
+
readonly curator_postmortem: "dedicated-tool-only";
|
|
136
|
+
readonly curator_consolidation: "dedicated-tool-only";
|
|
137
|
+
readonly council_generalist: "read-only";
|
|
138
|
+
readonly council_skeptic: "read-only";
|
|
139
|
+
readonly council_domain_expert: "read-only";
|
|
140
|
+
readonly skill_improver: "dedicated-tool-only";
|
|
141
|
+
readonly spec_writer: "dedicated-tool-only";
|
|
142
|
+
};
|
|
109
143
|
export declare const DEFAULT_AGENT_AUTHORITY_RULES: Record<string, AgentRule>;
|
|
110
144
|
/**
|
|
111
145
|
* Checks whether a write target path (or any ancestor strictly inside cwd)
|
|
@@ -126,6 +160,13 @@ export declare const DEFAULT_AGENT_AUTHORITY_RULES: Record<string, AgentRule>;
|
|
|
126
160
|
* @returns A block reason string if a symlink is detected, null if all clear.
|
|
127
161
|
*/
|
|
128
162
|
export declare function checkWriteTargetForSymlink(targetPath: string, cwd: string): string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Match configured authority prefixes using normalized lexical-prefix
|
|
165
|
+
* semantics. Thus `.env` covers `.env.local`; resolving both operands against
|
|
166
|
+
* one workspace root prevents sibling-workspace string collisions. Windows
|
|
167
|
+
* comparisons case-fold while POSIX comparisons remain case-sensitive.
|
|
168
|
+
*/
|
|
169
|
+
export declare function matchesAuthorityDenyPrefix(candidate: string, prefix: string, cwd: string, flavor?: PathFlavor): boolean;
|
|
129
170
|
/**
|
|
130
171
|
* Builds the effective rules map by merging user-configured rules with defaults.
|
|
131
172
|
* User overrides take precedence for each field.
|
|
@@ -144,38 +185,42 @@ export declare function buildEffectiveRules(authorityConfig?: AuthorityConfig):
|
|
|
144
185
|
* pass `path.win32` / `path.posix` directly.
|
|
145
186
|
*/
|
|
146
187
|
export declare function isOnDifferentFilesystemRoot(targetAbsolute: string, cwdAbsolute: string, pathLib?: Pick<typeof path, 'parse'>): boolean;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* 3. blockedGlobs - glob pattern matches
|
|
153
|
-
* 4. allowedExact - explicit allow for exact paths
|
|
154
|
-
* 5. blockedZones - zone-based blocking (runs before allowedGlobs so that generated
|
|
155
|
-
* output dirs like dist/ and build/ cannot be bypassed by a glob pattern match)
|
|
156
|
-
* 6. allowedGlobs - explicit allow for glob patterns (overrides blockedPrefix/allowedPrefix
|
|
157
|
-
* but NOT blockedZones, which is already decided in Step 5)
|
|
158
|
-
* 7. blockedPrefix - prefix-based blocking (takes priority over allowedPrefix)
|
|
159
|
-
* 8. allowedPrefix - prefix-based allow (whitelist)
|
|
160
|
-
*/
|
|
161
|
-
export declare function checkFileAuthorityWithRules(agentName: string, filePath: string, cwd: string, effectiveRules: Record<string, AgentRule>, options?: {
|
|
162
|
-
declaredScope?: string[] | null;
|
|
163
|
-
}): {
|
|
188
|
+
export declare const BUILT_IN_VERIFIER_CONFIG_GLOBS: readonly ["**/oxlintrc*", "**/.oxlintrc*", "**/.eslintrc*", "**/eslint.config.*", "**/.prettierrc*", "**/prettier.config.*", "**/biome.json", "**/biome.jsonc", "**/tsconfig*.json", "**/.secretscanignore", "**/.golangci*"];
|
|
189
|
+
export type AuthorityDecisionCode = 'AUTHORITY_INVALID_PATH' | 'AUTHORITY_ROOT_ESCAPE' | 'AUTHORITY_UNIVERSAL_DENY' | 'AUTHORITY_PROTECTED_PATH' | 'AUTHORITY_VERIFIER_CONFIG' | 'AUTHORITY_ROLE_READ_ONLY' | 'AUTHORITY_UNKNOWN_AGENT' | 'AUTHORITY_POLICY_DENY';
|
|
190
|
+
export type AuthorityDecisionLayer = 'path-validation' | 'containment' | 'universal-deny' | 'protected-path' | 'role-capability' | 'declared-scope' | 'role-policy';
|
|
191
|
+
export type AuthorityRecoveryAction = 'declare_scope' | 'save_plan';
|
|
192
|
+
export type AuthorityDecision = {
|
|
164
193
|
allowed: true;
|
|
194
|
+
layer: AuthorityDecisionLayer;
|
|
195
|
+
path: string;
|
|
196
|
+
agent: string;
|
|
165
197
|
} | {
|
|
166
198
|
allowed: false;
|
|
199
|
+
code: AuthorityDecisionCode;
|
|
200
|
+
layer: AuthorityDecisionLayer;
|
|
201
|
+
rule: string;
|
|
202
|
+
path: string;
|
|
203
|
+
agent: string;
|
|
167
204
|
reason: string;
|
|
205
|
+
recovery?: AuthorityRecoveryAction;
|
|
168
206
|
zone?: FileZone;
|
|
169
207
|
};
|
|
208
|
+
export interface AuthorityEvaluationOptions {
|
|
209
|
+
declaredScope?: string[] | null;
|
|
210
|
+
authorityEnabled?: boolean;
|
|
211
|
+
universalDenyPrefixes?: readonly string[];
|
|
212
|
+
verifierConfigPaths?: readonly string[];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Checks file path authority against a pre-computed rules map. Evaluation is
|
|
216
|
+
* staged: safe path + workspace containment; universal and protected denies;
|
|
217
|
+
* immutable role capability; exact declared coder scope; then configurable
|
|
218
|
+
* role policy. Scope can therefore authorize config/generated deliverables but
|
|
219
|
+
* can never authorize `.swarm`, verifier config, universal denies, root escape,
|
|
220
|
+
* or raw writes from read-only/dedicated-tool roles.
|
|
221
|
+
*/
|
|
222
|
+
export declare function checkFileAuthorityWithRules(agentName: string, filePath: string, cwd: string, effectiveRules: Record<string, AgentRule>, options?: AuthorityEvaluationOptions): AuthorityDecision;
|
|
170
223
|
/**
|
|
171
224
|
* Checks whether the given agent is authorised to write to the given file path.
|
|
172
225
|
*/
|
|
173
|
-
export declare function checkFileAuthority(agentName: string, filePath: string, cwd: string, authorityConfig?: AuthorityConfig, options?:
|
|
174
|
-
declaredScope?: string[] | null;
|
|
175
|
-
}): {
|
|
176
|
-
allowed: true;
|
|
177
|
-
} | {
|
|
178
|
-
allowed: false;
|
|
179
|
-
reason: string;
|
|
180
|
-
zone?: FileZone;
|
|
181
|
-
};
|
|
226
|
+
export declare function checkFileAuthority(agentName: string, filePath: string, cwd: string, authorityConfig?: AuthorityConfig, options?: AuthorityEvaluationOptions): AuthorityDecision;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { extractSwarmIdFromAgentName, getSwarmAgents, resolveFallbackModel } from '../../agents/index';
|
|
10
10
|
import { type AuthorityConfig, type GuardrailsConfig } from '../../config/schema';
|
|
11
|
+
import { getExecutor } from '../../sandbox/executor';
|
|
11
12
|
import { dcCheckJunctionCreation } from './destructive-command';
|
|
12
13
|
import { getMostRecentAssistantText, getProviderFailureFingerprint, isTransientProviderFailureText } from './messages-transform';
|
|
13
14
|
export declare const _internals: {
|
|
@@ -19,6 +20,7 @@ export declare const _internals: {
|
|
|
19
20
|
resolveFallbackModel: typeof resolveFallbackModel;
|
|
20
21
|
dcCheckJunctionCreation: typeof dcCheckJunctionCreation;
|
|
21
22
|
extractErrorSignal: typeof extractErrorSignal;
|
|
23
|
+
getSandboxExecutor: typeof getExecutor;
|
|
22
24
|
/**
|
|
23
25
|
* Test/inspection seams for the no-op detector's bounded session state
|
|
24
26
|
* (invariant 8). Production code does not call these; they exist so the
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* target checks, and circuit breaker limits.
|
|
10
10
|
*/
|
|
11
11
|
import { type AuthorityConfig, type GuardrailsConfig } from '../../config/schema';
|
|
12
|
+
import type { ScopeLeaseCandidateInput } from '../../scope/scope-lease-renewal';
|
|
12
13
|
import type { AgentRule } from './file-authority';
|
|
13
14
|
/**
|
|
14
15
|
* Shared context passed from createGuardrailsHooks to the toolBefore factory.
|
|
@@ -37,6 +38,8 @@ export interface ToolBeforeContext {
|
|
|
37
38
|
* trusted roots when exempting `git worktree remove --force` (issue #1708).
|
|
38
39
|
*/
|
|
39
40
|
worktreeBaseDirOverrides?: string[];
|
|
41
|
+
/** Sandbox executor getter seam for tests and platform-specific overrides. */
|
|
42
|
+
getSandboxExecutor: typeof import('../../sandbox/executor').getExecutor;
|
|
40
43
|
/** Hold exact child-write provenance until the matching after-hook succeeds. */
|
|
41
44
|
rememberReviewerScopeWrite?: (input: {
|
|
42
45
|
callID: string;
|
|
@@ -45,6 +48,8 @@ export interface ToolBeforeContext {
|
|
|
45
48
|
coderCallID: string;
|
|
46
49
|
file: string;
|
|
47
50
|
}) => void;
|
|
51
|
+
/** Snapshot an exact authorized write for success-only lease renewal. */
|
|
52
|
+
rememberScopeLeaseCandidate?: (input: ScopeLeaseCandidateInput) => void;
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* Creates a toolBefore handler with the given shared context.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* outside its Task-correlated scope, blocks the call and injects an advisory.
|
|
10
10
|
*/
|
|
11
11
|
import { describeScopeWorkspaceMismatch, getAuthorizedPrFeedbackScopeBinding } from '../scope/scope-binding';
|
|
12
|
-
import { resolveAuthorizedPrFeedbackScopeBindingFromDisk, resolveAuthorizedScopeBinding, resolveAuthorizedScopeBindingForSession } from '../scope/scope-persistence';
|
|
12
|
+
import { resolveAuthorizedPrFeedbackScopeBindingFromDisk, resolveAuthorizedScopeBinding, resolveAuthorizedScopeBindingDetailed, resolveAuthorizedScopeBindingForSession, resolveAuthorizedScopeBindingForSessionDetailed } from '../scope/scope-persistence';
|
|
13
13
|
import { type AgentSessionState, resolveSessionWorkspaceDirectory } from '../state';
|
|
14
14
|
import { validatePrFeedbackScopeBinding } from './pr-workflow-gate';
|
|
15
15
|
import { resolveWriteTargets } from './write-target-resolver';
|
|
@@ -74,6 +74,8 @@ declare function sanitizePath(raw: string): string;
|
|
|
74
74
|
export declare const _internals: {
|
|
75
75
|
sanitizePath: typeof sanitizePath;
|
|
76
76
|
resolveWriteTargets: typeof resolveWriteTargets;
|
|
77
|
+
resolveAuthorizedScopeBindingDetailed: typeof resolveAuthorizedScopeBindingDetailed;
|
|
78
|
+
resolveAuthorizedScopeBindingForSessionDetailed: typeof resolveAuthorizedScopeBindingForSessionDetailed;
|
|
77
79
|
resolveAuthorizedScopeBinding: typeof resolveAuthorizedScopeBinding;
|
|
78
80
|
resolveAuthorizedScopeBindingForSession: typeof resolveAuthorizedScopeBindingForSession;
|
|
79
81
|
getAuthorizedPrFeedbackScopeBinding: typeof getAuthorizedPrFeedbackScopeBinding;
|