@guilz-dev/belay 0.4.0 → 0.7.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 +27 -2
- package/dist/adapters/claude/runtime-entry.js +54 -25
- package/dist/adapters/layouts/scope.js +3 -2
- package/dist/adapters/shared/gate-runtime.d.ts +8 -2
- package/dist/adapters/shared/gate-runtime.js +579 -181
- package/dist/bundle/claude-runtime.mjs +13574 -6334
- package/dist/bundle/codex-runtime.mjs +13108 -5903
- package/dist/bundle/cursor-runtime.mjs +12676 -5476
- package/dist/cli.js +80 -2
- package/dist/commands/approve.js +34 -10
- package/dist/commands/classify-for-report.js +1 -1
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.js +134 -11
- package/dist/commands/doctor.js +87 -1
- package/dist/commands/explain.js +11 -1
- package/dist/commands/judge.js +3 -2
- package/dist/commands/recovery-checkpoints.d.ts +164 -0
- package/dist/commands/recovery-checkpoints.js +347 -0
- package/dist/commands/revoke.js +19 -7
- package/dist/commands/session.d.ts +20 -0
- package/dist/commands/session.js +51 -0
- package/dist/commands/status.js +7 -0
- package/dist/config-io.js +91 -23
- package/dist/conformance/guarantee-posture.d.ts +21 -0
- package/dist/conformance/guarantee-posture.js +46 -0
- package/dist/conformance/guarantee-table.d.ts +1 -0
- package/dist/conformance/guarantee-table.js +20 -9
- package/dist/conformance/types.d.ts +1 -0
- package/dist/core/approval-replay.d.ts +1 -1
- package/dist/core/approval-replay.js +4 -1
- package/dist/core/approval-service.d.ts +6 -1
- package/dist/core/approval-service.js +87 -24
- package/dist/core/approval.d.ts +4 -0
- package/dist/core/approval.js +19 -5
- package/dist/core/audit-types.d.ts +13 -0
- package/dist/core/capability/approval-state-mutation.d.ts +32 -0
- package/dist/core/capability/approval-state-mutation.js +165 -0
- package/dist/core/capability/approval-v3.d.ts +32 -0
- package/dist/core/capability/approval-v3.js +114 -0
- package/dist/core/capability/attestation.d.ts +16 -0
- package/dist/core/capability/attestation.js +62 -0
- package/dist/core/capability/boundary-attestation-sign.d.ts +21 -0
- package/dist/core/capability/boundary-attestation-sign.js +84 -0
- package/dist/core/capability/boundary-driver-container.d.ts +19 -0
- package/dist/core/capability/boundary-driver-container.js +189 -0
- package/dist/core/capability/boundary-driver.d.ts +29 -0
- package/dist/core/capability/boundary-driver.js +44 -0
- package/dist/core/capability/boundary-egress.d.ts +21 -0
- package/dist/core/capability/boundary-egress.js +109 -0
- package/dist/core/capability/boundary-grant-materialize.d.ts +14 -0
- package/dist/core/capability/boundary-grant-materialize.js +93 -0
- package/dist/core/capability/boundary-profile.d.ts +15 -0
- package/dist/core/capability/boundary-profile.js +25 -0
- package/dist/core/capability/boundary-run.d.ts +48 -0
- package/dist/core/capability/boundary-run.js +51 -0
- package/dist/core/capability/boundary-session.d.ts +61 -0
- package/dist/core/capability/boundary-session.js +138 -0
- package/dist/core/capability/boundary-workspace-mount.d.ts +5 -0
- package/dist/core/capability/boundary-workspace-mount.js +68 -0
- package/dist/core/capability/capability-request-hash.d.ts +2 -0
- package/dist/core/capability/capability-request-hash.js +8 -0
- package/dist/core/capability/gate-latency-ratchet.d.ts +7 -0
- package/dist/core/capability/gate-latency-ratchet.js +18 -0
- package/dist/core/capability/gate-policy-shadow.d.ts +25 -0
- package/dist/core/capability/gate-policy-shadow.js +130 -0
- package/dist/core/capability/gate-shadow-audit.d.ts +1 -0
- package/dist/core/capability/gate-shadow-audit.js +1 -0
- package/dist/core/capability/gate-shadow-ratchet.d.ts +14 -0
- package/dist/core/capability/gate-shadow-ratchet.js +81 -0
- package/dist/core/capability/grant-consumption.d.ts +4 -0
- package/dist/core/capability/grant-consumption.js +11 -0
- package/dist/core/capability/grant-lease.d.ts +44 -0
- package/dist/core/capability/grant-lease.js +243 -0
- package/dist/core/capability/grant-loader.d.ts +12 -0
- package/dist/core/capability/grant-loader.js +23 -0
- package/dist/core/capability/grant-match.d.ts +6 -0
- package/dist/core/capability/grant-match.js +96 -0
- package/dist/core/capability/grant.d.ts +16 -0
- package/dist/core/capability/grant.js +16 -0
- package/dist/core/capability/index.d.ts +8 -0
- package/dist/core/capability/index.js +7 -0
- package/dist/core/capability/limits.d.ts +7 -0
- package/dist/core/capability/limits.js +55 -0
- package/dist/core/capability/policy-bridge.d.ts +18 -0
- package/dist/core/capability/policy-bridge.js +51 -0
- package/dist/core/capability/policy-engine.d.ts +77 -0
- package/dist/core/capability/policy-engine.js +663 -0
- package/dist/core/capability/policy-types.d.ts +20 -0
- package/dist/core/capability/policy-types.js +1 -0
- package/dist/core/capability/request.d.ts +48 -0
- package/dist/core/capability/request.js +1 -0
- package/dist/core/capability/resolver.d.ts +4 -0
- package/dist/core/capability/resolver.js +4 -0
- package/dist/core/classify-subagent.d.ts +2 -1
- package/dist/core/classify-subagent.js +38 -2
- package/dist/core/classify-tool.js +126 -62
- package/dist/core/config.d.ts +34 -3
- package/dist/core/config.js +118 -3
- package/dist/core/effect-ir/audit.d.ts +9 -0
- package/dist/core/effect-ir/audit.js +86 -0
- package/dist/core/effect-ir/build.d.ts +31 -0
- package/dist/core/effect-ir/build.js +277 -0
- package/dist/core/effect-ir/index.d.ts +8 -0
- package/dist/core/effect-ir/index.js +7 -0
- package/dist/core/effect-ir/normalize.d.ts +4 -0
- package/dist/core/effect-ir/normalize.js +104 -0
- package/dist/core/effect-ir/package-exec-eval.d.ts +8 -0
- package/dist/core/effect-ir/package-exec-eval.js +152 -0
- package/dist/core/effect-ir/package-exec.d.ts +29 -0
- package/dist/core/effect-ir/package-exec.js +292 -0
- package/dist/core/effect-ir/policy.d.ts +13 -0
- package/dist/core/effect-ir/policy.js +77 -0
- package/dist/core/effect-ir/types.d.ts +55 -0
- package/dist/core/effect-ir/types.js +1 -0
- package/dist/core/egress/allowlist.d.ts +1 -0
- package/dist/core/egress/allowlist.js +8 -0
- package/dist/core/egress-approval.js +45 -51
- package/dist/core/gate-contract.d.ts +5 -0
- package/dist/core/gate-contract.js +5 -0
- package/dist/core/gate-engine.js +30 -8
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +2 -1
- package/dist/core/judge-cloud-consent.js +29 -15
- package/dist/core/judge-doctor.js +39 -14
- package/dist/core/judge-fallback-hints.d.ts +13 -0
- package/dist/core/judge-fallback-hints.js +108 -0
- package/dist/core/network-endpoint.d.ts +10 -0
- package/dist/core/network-endpoint.js +51 -0
- package/dist/core/path-utils.d.ts +1 -0
- package/dist/core/path-utils.js +5 -2
- package/dist/core/process-runner.d.ts +10 -0
- package/dist/core/process-runner.js +124 -0
- package/dist/core/recover-advice.js +2 -1
- package/dist/core/recovery/artifact-store.d.ts +29 -0
- package/dist/core/recovery/artifact-store.js +336 -0
- package/dist/core/recovery/capability.d.ts +3 -0
- package/dist/core/recovery/capability.js +22 -0
- package/dist/core/recovery/checkpoint.d.ts +25 -0
- package/dist/core/recovery/checkpoint.js +260 -0
- package/dist/core/recovery/fail-closed.d.ts +6 -0
- package/dist/core/recovery/fail-closed.js +25 -0
- package/dist/core/recovery/index.d.ts +5 -0
- package/dist/core/recovery/index.js +4 -0
- package/dist/core/recovery/operator-guidance.d.ts +7 -0
- package/dist/core/recovery/operator-guidance.js +39 -0
- package/dist/core/recovery/reconcile.d.ts +3 -0
- package/dist/core/recovery/reconcile.js +48 -0
- package/dist/core/recovery/resource-identity.d.ts +4 -0
- package/dist/core/recovery/resource-identity.js +34 -0
- package/dist/core/recovery/restore.d.ts +13 -0
- package/dist/core/recovery/restore.js +114 -0
- package/dist/core/recovery/snapshot-node.d.ts +27 -0
- package/dist/core/recovery/snapshot-node.js +261 -0
- package/dist/core/recovery/types.d.ts +104 -0
- package/dist/core/recovery/types.js +1 -0
- package/dist/core/standing-allow.js +3 -0
- package/dist/core/transactional/apply-observed-changes.d.ts +13 -0
- package/dist/core/transactional/apply-observed-changes.js +275 -0
- package/dist/core/transactional/backend-selector.d.ts +8 -0
- package/dist/core/transactional/backend-selector.js +118 -0
- package/dist/core/transactional/backend.d.ts +55 -0
- package/dist/core/transactional/backend.js +1 -0
- package/dist/core/transactional/diff-evaluator.js +4 -1
- package/dist/core/transactional/eligibility.js +4 -0
- package/dist/core/transactional/file-checkpoint-backend.d.ts +3 -0
- package/dist/core/transactional/file-checkpoint-backend.js +278 -0
- package/dist/core/transactional/file-checkpoint-git.d.ts +11 -0
- package/dist/core/transactional/file-checkpoint-git.js +217 -0
- package/dist/core/transactional/file-checkpoint-staging.d.ts +13 -0
- package/dist/core/transactional/file-checkpoint-staging.js +54 -0
- package/dist/core/transactional/file-clone.d.ts +15 -0
- package/dist/core/transactional/file-clone.js +139 -0
- package/dist/core/transactional/file-tree-path.d.ts +7 -0
- package/dist/core/transactional/file-tree-path.js +50 -0
- package/dist/core/transactional/file-tree.d.ts +41 -0
- package/dist/core/transactional/file-tree.js +186 -0
- package/dist/core/transactional/git-worktree-backend.d.ts +2 -0
- package/dist/core/transactional/git-worktree-backend.js +50 -0
- package/dist/core/transactional/git-worktree.d.ts +14 -9
- package/dist/core/transactional/git-worktree.js +62 -87
- package/dist/core/transactional/index.d.ts +11 -0
- package/dist/core/transactional/index.js +10 -0
- package/dist/core/transactional/reasons.d.ts +1 -0
- package/dist/core/transactional/reasons.js +5 -0
- package/dist/core/transactional/runner.js +171 -23
- package/dist/core/transactional/snapshot-node.d.ts +26 -0
- package/dist/core/transactional/snapshot-node.js +87 -0
- package/dist/core/transactional/types.d.ts +21 -1
- package/dist/core/types.d.ts +30 -3
- package/dist/core/verdict/adapter.d.ts +3 -4
- package/dist/core/verdict/adapter.js +24 -12
- package/dist/core/verdict/cursor-acp-client.d.ts +67 -0
- package/dist/core/verdict/cursor-acp-client.js +345 -0
- package/dist/core/verdict/egress-classify.d.ts +2 -2
- package/dist/core/verdict/egress-classify.js +2 -2
- package/dist/core/verdict/git-classifier.d.ts +26 -0
- package/dist/core/verdict/git-classifier.js +533 -0
- package/dist/core/verdict/judge-audit.js +1 -0
- package/dist/core/verdict/judge-baseline.d.ts +1 -1
- package/dist/core/verdict/judge-baseline.js +1 -0
- package/dist/core/verdict/judge-broker-service.js +12 -0
- package/dist/core/verdict/judge-catalog.js +1 -0
- package/dist/core/verdict/judge-cli-fingerprint.d.ts +1 -0
- package/dist/core/verdict/judge-cli-fingerprint.js +6 -0
- package/dist/core/verdict/judge-cli.js +5 -3
- package/dist/core/verdict/judge-provider-matrix.js +1 -1
- package/dist/core/verdict/judge-runtime-config.d.ts +2 -0
- package/dist/core/verdict/judge-runtime-config.js +10 -6
- package/dist/core/verdict/judge-session-broker.d.ts +1 -1
- package/dist/core/verdict/judge-session-broker.js +10 -5
- package/dist/core/verdict/judge-transport.d.ts +5 -1
- package/dist/core/verdict/judge-transport.js +24 -14
- package/dist/core/verdict/judge.d.ts +2 -15
- package/dist/core/verdict/judge.js +5 -68
- package/dist/core/verdict/launcher-resolve.d.ts +2 -0
- package/dist/core/verdict/launcher-resolve.js +14 -16
- package/dist/core/verdict/prescan.d.ts +15 -0
- package/dist/core/verdict/prescan.js +68 -0
- package/dist/core/verdict/shell-policy.d.ts +26 -0
- package/dist/core/verdict/shell-policy.js +40 -0
- package/dist/core/verdict/shell-semantics.d.ts +24 -0
- package/dist/core/verdict/shell-semantics.js +225 -0
- package/dist/core/verdict/types.d.ts +18 -1
- package/dist/core/verdict/verdict.js +313 -178
- package/dist/corpus/evaluate.js +3 -7
- package/dist/corpus/gate-latency-budget.d.ts +39 -0
- package/dist/corpus/gate-latency-budget.js +33 -0
- package/dist/corpus/mutators.d.ts +1 -1
- package/dist/corpus/mutators.js +11 -0
- package/dist/corpus/runtime-match.js +1 -3
- package/dist/corpus/standing-allow-catalog.generated.js +29 -9
- package/dist/judge-broker-daemon.js +15 -1
- package/dist/services/sandbox-service.d.ts +4 -0
- package/dist/services/sandbox-service.js +28 -2
- package/dist/types.d.ts +13 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/belay/SKILL.md +8 -3
- package/skills/belay/belay-approve.md +10 -7
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { extractRedirectTargets } from '../shell-tokenizer.js';
|
|
3
|
+
import { classifyGitCommand } from './git-classifier.js';
|
|
4
|
+
const READ_ONLY_KEYS = new Set([
|
|
5
|
+
'cat',
|
|
6
|
+
'cd',
|
|
7
|
+
'echo',
|
|
8
|
+
'head',
|
|
9
|
+
'ls',
|
|
10
|
+
'pwd',
|
|
11
|
+
'rg',
|
|
12
|
+
'sort',
|
|
13
|
+
'tail',
|
|
14
|
+
'wc',
|
|
15
|
+
'which',
|
|
16
|
+
'find',
|
|
17
|
+
'grep',
|
|
18
|
+
'jq',
|
|
19
|
+
'stat',
|
|
20
|
+
'file',
|
|
21
|
+
'du',
|
|
22
|
+
'readlink',
|
|
23
|
+
'realpath',
|
|
24
|
+
'basename',
|
|
25
|
+
'dirname',
|
|
26
|
+
'uname',
|
|
27
|
+
'whoami',
|
|
28
|
+
'id',
|
|
29
|
+
'printenv',
|
|
30
|
+
'test',
|
|
31
|
+
'printf',
|
|
32
|
+
'cut',
|
|
33
|
+
'tr',
|
|
34
|
+
'uniq',
|
|
35
|
+
'cmp',
|
|
36
|
+
'comm',
|
|
37
|
+
'shasum',
|
|
38
|
+
'md5sum',
|
|
39
|
+
]);
|
|
40
|
+
const PURE_READ_ONLY_KEYS = new Set([
|
|
41
|
+
'echo',
|
|
42
|
+
'pwd',
|
|
43
|
+
'which',
|
|
44
|
+
'grep',
|
|
45
|
+
'jq',
|
|
46
|
+
'stat',
|
|
47
|
+
'file',
|
|
48
|
+
'du',
|
|
49
|
+
'readlink',
|
|
50
|
+
'realpath',
|
|
51
|
+
'basename',
|
|
52
|
+
'dirname',
|
|
53
|
+
'uname',
|
|
54
|
+
'whoami',
|
|
55
|
+
'id',
|
|
56
|
+
'printenv',
|
|
57
|
+
'test',
|
|
58
|
+
'printf',
|
|
59
|
+
'cut',
|
|
60
|
+
'tr',
|
|
61
|
+
'uniq',
|
|
62
|
+
'cmp',
|
|
63
|
+
'comm',
|
|
64
|
+
'shasum',
|
|
65
|
+
'md5sum',
|
|
66
|
+
]);
|
|
67
|
+
const LOCAL_MUTATION_KEYS = new Set([
|
|
68
|
+
'chmod',
|
|
69
|
+
'cp',
|
|
70
|
+
'mkdir',
|
|
71
|
+
'mv',
|
|
72
|
+
'rm',
|
|
73
|
+
'sed',
|
|
74
|
+
'tee',
|
|
75
|
+
'touch',
|
|
76
|
+
'truncate',
|
|
77
|
+
]);
|
|
78
|
+
export const LOCAL_ROUTINE_HEADS = new Set([
|
|
79
|
+
'tsc',
|
|
80
|
+
'vitest',
|
|
81
|
+
'vite',
|
|
82
|
+
'webpack',
|
|
83
|
+
'esbuild',
|
|
84
|
+
'rollup',
|
|
85
|
+
'jest',
|
|
86
|
+
'mocha',
|
|
87
|
+
'cargo',
|
|
88
|
+
'go',
|
|
89
|
+
'make',
|
|
90
|
+
'cmake',
|
|
91
|
+
'biome',
|
|
92
|
+
'eslint',
|
|
93
|
+
]);
|
|
94
|
+
function looksLikePathToken(token) {
|
|
95
|
+
if (!token || token.startsWith('-')) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return (token.includes('/') || token.includes('\\') || token.startsWith('.') || token.includes('...'));
|
|
99
|
+
}
|
|
100
|
+
function filterRoutinePathTargets(head, targets) {
|
|
101
|
+
if (!LOCAL_ROUTINE_HEADS.has(head)) {
|
|
102
|
+
return targets;
|
|
103
|
+
}
|
|
104
|
+
return targets.filter((target) => looksLikePathToken(target));
|
|
105
|
+
}
|
|
106
|
+
function extractFilePathOperands(tokens) {
|
|
107
|
+
const redirects = extractRedirectTargets(tokens);
|
|
108
|
+
const args = [...redirects];
|
|
109
|
+
for (let index = 1; index < tokens.length; index += 1) {
|
|
110
|
+
const token = tokens[index];
|
|
111
|
+
if (!token || token.startsWith('-')) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (redirects.includes(token)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
args.push(token);
|
|
118
|
+
}
|
|
119
|
+
return args;
|
|
120
|
+
}
|
|
121
|
+
function isRsyncRemoteOperand(token) {
|
|
122
|
+
if (/^rsync:\/\/.+/.test(token)) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (/^(?:[^@\s/:]+@)?(?:\[[^\]]+\]|[^:/\s]+)::/.test(token)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
if (!/^[A-Za-z]:[\\/]/.test(token) &&
|
|
129
|
+
/^(?:[^@\s/:]+@)?(?:\[[^\]]+\]|[^:/\s]+):[^:].*/.test(token)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (/^\/\/.+\//.test(token)) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
function classifyRsync(tokens) {
|
|
138
|
+
const args = tokens.slice(1);
|
|
139
|
+
const pathTargets = args.filter((token) => token && !token.startsWith('-'));
|
|
140
|
+
const signals = ['rsync'];
|
|
141
|
+
const destructive = args.some((token) => token.startsWith('--delete') ||
|
|
142
|
+
token === '--del' ||
|
|
143
|
+
token === '--remove-source-files' ||
|
|
144
|
+
token.startsWith('--remove-source-files='));
|
|
145
|
+
if (destructive) {
|
|
146
|
+
return {
|
|
147
|
+
effect: 'local_mutation',
|
|
148
|
+
pathTargets,
|
|
149
|
+
signals: [...signals, 'rsync.destructive'],
|
|
150
|
+
requiresAsk: {
|
|
151
|
+
reason: 'rsync_destructive',
|
|
152
|
+
signals: ['rsync.destructive', 'rsync.delete'],
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const remote = pathTargets.some((token) => isRsyncRemoteOperand(token));
|
|
157
|
+
if (remote) {
|
|
158
|
+
return {
|
|
159
|
+
effect: 'remote_mutation',
|
|
160
|
+
pathTargets,
|
|
161
|
+
signals: [...signals, 'rsync.remote'],
|
|
162
|
+
egressClass: 'ambiguous',
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
effect: 'local_mutation',
|
|
167
|
+
pathTargets,
|
|
168
|
+
signals: [...signals, 'rsync.local'],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function isPureReadOnlySemantics(segment, semantics) {
|
|
172
|
+
return (semantics.isReadOnly === true ||
|
|
173
|
+
PURE_READ_ONLY_KEYS.has(segment.head) ||
|
|
174
|
+
PURE_READ_ONLY_KEYS.has(segment.key) ||
|
|
175
|
+
PURE_READ_ONLY_KEYS.has(semantics.normalizedKey ?? ''));
|
|
176
|
+
}
|
|
177
|
+
export function analyzeShellCommandSemantics(tokens, segment, cwd) {
|
|
178
|
+
const head = segment.head;
|
|
179
|
+
const basename = path.basename(tokens[0] ?? head);
|
|
180
|
+
if (basename === 'git') {
|
|
181
|
+
const gitSemantics = classifyGitCommand(tokens, cwd);
|
|
182
|
+
if (gitSemantics) {
|
|
183
|
+
return {
|
|
184
|
+
effect: gitSemantics.effect,
|
|
185
|
+
pathTargets: gitSemantics.pathTargets,
|
|
186
|
+
scopeTargets: gitSemantics.scopeTargets,
|
|
187
|
+
signals: gitSemantics.signals,
|
|
188
|
+
egressClass: gitSemantics.egressClass,
|
|
189
|
+
requiresAsk: gitSemantics.requiresAsk,
|
|
190
|
+
effectiveCwd: gitSemantics.effectiveCwd,
|
|
191
|
+
gitWorkTree: gitSemantics.gitWorkTree,
|
|
192
|
+
normalizedKey: gitSemantics.normalizedKey,
|
|
193
|
+
isReadOnly: gitSemantics.isReadOnly,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (head === 'rsync') {
|
|
198
|
+
return classifyRsync(tokens);
|
|
199
|
+
}
|
|
200
|
+
let effect = 'unknown';
|
|
201
|
+
let pathTargets = extractFilePathOperands(tokens);
|
|
202
|
+
pathTargets = filterRoutinePathTargets(head, pathTargets);
|
|
203
|
+
const signals = [];
|
|
204
|
+
if (READ_ONLY_KEYS.has(segment.key) || READ_ONLY_KEYS.has(head)) {
|
|
205
|
+
effect = 'read_only';
|
|
206
|
+
}
|
|
207
|
+
else if (LOCAL_MUTATION_KEYS.has(segment.key) || LOCAL_MUTATION_KEYS.has(head)) {
|
|
208
|
+
effect = 'local_mutation';
|
|
209
|
+
}
|
|
210
|
+
else if (LOCAL_ROUTINE_HEADS.has(head)) {
|
|
211
|
+
effect = 'local_mutation';
|
|
212
|
+
signals.push('routine_local');
|
|
213
|
+
}
|
|
214
|
+
if (extractRedirectTargets(tokens).length > 0 && effect === 'read_only') {
|
|
215
|
+
effect = 'local_mutation';
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
effect,
|
|
219
|
+
pathTargets,
|
|
220
|
+
signals,
|
|
221
|
+
normalizedKey: segment.key,
|
|
222
|
+
isReadOnly: effect === 'read_only',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export { LOCAL_MUTATION_KEYS, PURE_READ_ONLY_KEYS, READ_ONLY_KEYS };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { PolicyDecision } from '../capability/policy-types.js';
|
|
2
|
+
import type { CapabilityRequestV1 } from '../capability/request.js';
|
|
3
|
+
import type { BelayConfigV4 } from '../config.js';
|
|
4
|
+
import type { EffectPlan } from '../effect-ir/types.js';
|
|
1
5
|
export type VerdictPermission = 'allow' | 'ask';
|
|
2
6
|
export type VerdictLocation = 'repo_local' | 'repo_outside' | 'external' | 'mixed' | 'unknown';
|
|
3
7
|
export type VerdictOpacity = 'transparent' | 'recursive' | 'opaque' | 'unparseable';
|
|
@@ -14,6 +18,10 @@ export interface VerdictResult {
|
|
|
14
18
|
fingerprint: string;
|
|
15
19
|
signals: string[];
|
|
16
20
|
judgeTrace?: JudgeTrace;
|
|
21
|
+
capabilityRequests?: CapabilityRequestV1[];
|
|
22
|
+
authorizationDecision?: PolicyDecision;
|
|
23
|
+
effectPlan?: EffectPlan;
|
|
24
|
+
effectPlanPolicyDecisions?: PolicyDecision[];
|
|
17
25
|
}
|
|
18
26
|
export interface Tier1Verdict {
|
|
19
27
|
/** true = undoable via git/fs snapshot or trivial local revert (ADR-002 local-recoverable). */
|
|
@@ -33,6 +41,7 @@ export interface Tier1EvaluateInput {
|
|
|
33
41
|
};
|
|
34
42
|
innerCode?: string;
|
|
35
43
|
}
|
|
44
|
+
/** @deprecated Sync gate path no longer invokes Tier1 judge. Retained for shadow tooling. */
|
|
36
45
|
export interface Tier1Judge {
|
|
37
46
|
evaluate(input: Tier1EvaluateInput): Promise<Tier1Verdict>;
|
|
38
47
|
}
|
|
@@ -41,6 +50,7 @@ export interface JudgeTrace {
|
|
|
41
50
|
modelRequested: string;
|
|
42
51
|
modelResolved: string;
|
|
43
52
|
latencyMs: number;
|
|
53
|
+
transport?: 'http' | 'ollama-http' | 'codex-cli' | 'cursor-cli' | 'claude-cli' | 'codex-cli-session' | 'cursor-cli-session' | 'claude-cli-session' | 'cursor-acp' | 'unavailable';
|
|
44
54
|
outboundRedacted?: boolean;
|
|
45
55
|
fallbackReason?: string;
|
|
46
56
|
judgeSessionUsed?: boolean;
|
|
@@ -60,17 +70,20 @@ export type VerdictMode = 'enforce' | 'audit';
|
|
|
60
70
|
export interface VerdictContext {
|
|
61
71
|
cwd: string;
|
|
62
72
|
repoRoot: string;
|
|
73
|
+
config: BelayConfigV4;
|
|
63
74
|
trustedCwd: boolean;
|
|
64
75
|
trustedWorkspaceRoots?: string[];
|
|
65
76
|
sensitivePaths: string[];
|
|
66
77
|
protectedArtifactRoots?: string[];
|
|
67
78
|
customAllowCommands?: string[];
|
|
68
79
|
customExternalCommands?: string[];
|
|
69
|
-
judge: Tier1Judge;
|
|
70
80
|
mode: VerdictMode;
|
|
71
81
|
unknownLocalEffect: 'allow_flagged' | 'deny';
|
|
72
82
|
unparseableShell: 'allow_flagged' | 'deny';
|
|
73
83
|
maxRecursionDepth?: number;
|
|
84
|
+
grants?: import('../capability/grant.js').CapabilityGrantV1[];
|
|
85
|
+
attestation?: import('../capability/attestation.js').BoundaryAttestation | null;
|
|
86
|
+
egressProxyActive?: boolean;
|
|
74
87
|
}
|
|
75
88
|
export interface InternalSegmentVerdict {
|
|
76
89
|
permission: VerdictPermission;
|
|
@@ -81,4 +94,8 @@ export interface InternalSegmentVerdict {
|
|
|
81
94
|
reason: string;
|
|
82
95
|
signals: string[];
|
|
83
96
|
judgeTrace?: JudgeTrace;
|
|
97
|
+
capabilityRequests?: CapabilityRequestV1[];
|
|
98
|
+
authorizationDecision?: PolicyDecision;
|
|
99
|
+
effectPlan?: EffectPlan;
|
|
100
|
+
effectPlanPolicyDecisions?: PolicyDecision[];
|
|
84
101
|
}
|