@intutic/gate 2.9.0 → 3.0.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.
Files changed (95) hide show
  1. package/dist/actions.d.ts +39 -0
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js +139 -0
  4. package/dist/actions.js.map +1 -1
  5. package/dist/client.d.ts +10 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +19 -0
  8. package/dist/client.js.map +1 -1
  9. package/dist/decide.d.ts +269 -0
  10. package/dist/decide.d.ts.map +1 -0
  11. package/dist/decide.js +757 -0
  12. package/dist/decide.js.map +1 -0
  13. package/dist/decideApi.d.ts +24 -0
  14. package/dist/decideApi.d.ts.map +1 -0
  15. package/dist/decideApi.js +32 -0
  16. package/dist/decideApi.js.map +1 -0
  17. package/dist/decideEngine.d.ts +195 -0
  18. package/dist/decideEngine.d.ts.map +1 -0
  19. package/dist/decideEngine.js +707 -0
  20. package/dist/decideEngine.js.map +1 -0
  21. package/dist/decideEvaluate.d.ts +250 -0
  22. package/dist/decideEvaluate.d.ts.map +1 -0
  23. package/dist/decideEvaluate.js +504 -0
  24. package/dist/decideEvaluate.js.map +1 -0
  25. package/dist/decideHostGuard.d.ts +56 -0
  26. package/dist/decideHostGuard.d.ts.map +1 -0
  27. package/dist/decideHostGuard.js +194 -0
  28. package/dist/decideHostGuard.js.map +1 -0
  29. package/dist/decideLog.d.ts +287 -0
  30. package/dist/decideLog.d.ts.map +1 -0
  31. package/dist/decideLog.js +521 -0
  32. package/dist/decideLog.js.map +1 -0
  33. package/dist/decideLogRedaction.d.ts +17 -0
  34. package/dist/decideLogRedaction.d.ts.map +1 -0
  35. package/dist/decideLogRedaction.js +33 -0
  36. package/dist/decideLogRedaction.js.map +1 -0
  37. package/dist/decideRecord.d.ts +128 -0
  38. package/dist/decideRecord.d.ts.map +1 -0
  39. package/dist/decideRecord.js +254 -0
  40. package/dist/decideRecord.js.map +1 -0
  41. package/dist/decideSdk.d.ts +86 -0
  42. package/dist/decideSdk.d.ts.map +1 -0
  43. package/dist/decideSdk.js +146 -0
  44. package/dist/decideSdk.js.map +1 -0
  45. package/dist/dsh.d.ts.map +1 -1
  46. package/dist/dsh.js +6 -1
  47. package/dist/dsh.js.map +1 -1
  48. package/dist/errors.d.ts +26 -2
  49. package/dist/errors.d.ts.map +1 -1
  50. package/dist/errors.js +38 -1
  51. package/dist/errors.js.map +1 -1
  52. package/dist/gate.d.ts +85 -1
  53. package/dist/gate.d.ts.map +1 -1
  54. package/dist/gate.js +314 -18
  55. package/dist/gate.js.map +1 -1
  56. package/dist/gateRuleRecord.d.ts +244 -0
  57. package/dist/gateRuleRecord.d.ts.map +1 -0
  58. package/dist/gateRuleRecord.js +459 -0
  59. package/dist/gateRuleRecord.js.map +1 -0
  60. package/dist/harness.d.ts.map +1 -1
  61. package/dist/harness.js +22 -10
  62. package/dist/harness.js.map +1 -1
  63. package/dist/index.d.ts +14 -5
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +5 -3
  66. package/dist/index.js.map +1 -1
  67. package/dist/lanes.d.ts +94 -0
  68. package/dist/lanes.d.ts.map +1 -0
  69. package/dist/lanes.js +150 -0
  70. package/dist/lanes.js.map +1 -0
  71. package/dist/limits.d.ts +6 -0
  72. package/dist/limits.d.ts.map +1 -1
  73. package/dist/limits.js +6 -0
  74. package/dist/limits.js.map +1 -1
  75. package/dist/refusalDetail.d.ts +58 -0
  76. package/dist/refusalDetail.d.ts.map +1 -0
  77. package/dist/refusalDetail.js +121 -0
  78. package/dist/refusalDetail.js.map +1 -0
  79. package/dist/scopeMatch.d.ts +156 -0
  80. package/dist/scopeMatch.d.ts.map +1 -0
  81. package/dist/scopeMatch.js +438 -0
  82. package/dist/scopeMatch.js.map +1 -0
  83. package/dist/snapshot.d.ts +51 -3
  84. package/dist/snapshot.d.ts.map +1 -1
  85. package/dist/snapshot.js +86 -13
  86. package/dist/snapshot.js.map +1 -1
  87. package/dist/testOutcome.d.ts +164 -0
  88. package/dist/testOutcome.d.ts.map +1 -0
  89. package/dist/testOutcome.js +439 -0
  90. package/dist/testOutcome.js.map +1 -0
  91. package/dist/wrapTools.d.ts +7 -1
  92. package/dist/wrapTools.d.ts.map +1 -1
  93. package/dist/wrapTools.js +30 -2
  94. package/dist/wrapTools.js.map +1 -1
  95. package/package.json +2 -2
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Scope and plan semantics, ported from the proxy so every surface answers
3
+ * "is this change inside the scope?" and "is this run on its plan?" the same
4
+ * way.
5
+ *
6
+ * | Function | Port of |
7
+ * |---|---|
8
+ * | {@link isWithinScope} | `is_within_scope`, `plugins/anomaly/detectors.rs` |
9
+ * | {@link collectScopePaths} | `collect_scope_paths`, `sops.rs`, the org ceiling included |
10
+ * | {@link planOffSteps} | `PlanAdherenceDetector`, `detectors.rs`, with {@link PLAN_DEVIATION_TOLERANCE} |
11
+ * | {@link changeTargets} | `manifest_from_invocations`, `manifest.rs`: the mutation entries of one call |
12
+ * | {@link diffChangedPaths} | (new) the paths a unified or git diff changes |
13
+ *
14
+ * Beside them, what only the gates need: {@link scopeRelativePath} makes a
15
+ * gate's target relative to its workspace root (a path outside the root is
16
+ * out of scope), {@link isPlanExemptTool} names the calls `plan_approval:`
17
+ * never refuses, and {@link isFileWriteCall} says whether a call changed files,
18
+ * which makes an earlier passing test run stale (Q1).
19
+ *
20
+ * Self-contained but for `./phrases.ts`, so `@intutic/gate` keeps a
21
+ * byte-identical copy and the JavaScript hook gates embed
22
+ * {@link SCOPE_MATCH_JS_SOURCE} beside the phrase matcher's source. The
23
+ * Python port is `intutic_clawde/gate/scope_match.py`; the proxy's Rust runs
24
+ * the same `fixtures/scope-plan-vectors.json`. `manifestParity.test.ts`
25
+ * holds the tool and key lists to `manifest.rs` and `actions.rs`.
26
+ *
27
+ * @module
28
+ */
29
+ /** The share of off-plan steps a plan forgives under `plan_steps_mode: advise` (`PLAN_DEVIATION_TOLERANCE` in detectors.rs). */
30
+ export declare const PLAN_DEVIATION_TOLERANCE = 0.4;
31
+ /** What an org ceiling disjoint from the workspace list leaves (`NARROWED_TO_NOTHING`, sops.rs): no path is inside it. */
32
+ export declare const NARROWED_TO_NOTHING = "<none: workspace list disjoint from org ceiling>";
33
+ /** `WRITE_TOOLS`, manifest.rs. */
34
+ export declare const SCOPE_WRITE_TOOLS: readonly string[];
35
+ /** `EDIT_TOOLS`, manifest.rs. */
36
+ export declare const SCOPE_EDIT_TOOLS: readonly string[];
37
+ /** `DELETE_TOOLS`, manifest.rs. */
38
+ export declare const SCOPE_DELETE_TOOLS: readonly string[];
39
+ /** `MOVE_TOOLS`, manifest.rs. */
40
+ export declare const SCOPE_MOVE_TOOLS: readonly string[];
41
+ /** `EDITOR_TOOLS`, actions.rs: the text editor, whose `command` decides whether it writes. */
42
+ export declare const SCOPE_EDITOR_TOOLS: readonly string[];
43
+ /** `PATH_KEYS`, manifest.rs. */
44
+ export declare const SCOPE_PATH_KEYS: readonly string[];
45
+ /** `COMMAND_KEYS`, manifest.rs. */
46
+ export declare const SCOPE_COMMAND_KEYS: readonly string[];
47
+ /** `SHELL_TOOLS`, actions.rs. */
48
+ export declare const SCOPE_SHELL_TOOLS: readonly string[];
49
+ /** `READ_TOOLS`, actions.rs. */
50
+ export declare const SCOPE_READ_TOOLS: readonly string[];
51
+ /** A move's source and destination keys, manifest.rs. */
52
+ export declare const SCOPE_MOVE_FROM_KEYS: readonly string[];
53
+ export declare const SCOPE_MOVE_TO_KEYS: readonly string[];
54
+ /** A target is cut to this many bytes, and marked with `…` when it was (`TARGET_MAX`, manifest.rs). */
55
+ export declare const SCOPE_TARGET_MAX_BYTES = 512;
56
+ /**
57
+ * Tools `plan_approval:` never refuses: the read tools and the search and
58
+ * listing tools an agent needs to write a plan in the first place.
59
+ */
60
+ export declare const PLAN_EXEMPT_TOOLS: readonly string[];
61
+ /**
62
+ * Shell phrases that change files in the working tree. With the mutation
63
+ * tools ({@link changeTargets}), a call matching one makes an earlier passing
64
+ * test run stale ({@link isFileWriteCall}).
65
+ */
66
+ export declare const FILE_WRITE_SHELL_PHRASES: readonly string[];
67
+ /** A mutation one call makes: what it does and the path it names. */
68
+ export interface ChangeTarget {
69
+ op: 'write' | 'edit' | 'delete' | 'move';
70
+ target: string;
71
+ }
72
+ /**
73
+ * Is `target` inside any of `scopes`? Segment-prefix match: `packages/proxy`
74
+ * covers `packages/proxy/src/main.rs`, not `packages/proxy-extras/x.rs`.
75
+ * Leading `./` and `/` and trailing `/` are dropped, and the comparison
76
+ * ignores ASCII case. An empty scope covers everything.
77
+ */
78
+ export declare function isWithinScope(target: string, scopes: readonly string[]): boolean;
79
+ /** A SOP as {@link collectScopePaths} reads it. `roles` are lower case, as the parser keeps them. */
80
+ export interface ScopeSop {
81
+ scope: 'workspace' | 'org';
82
+ roles: readonly string[];
83
+ scopePaths: readonly string[];
84
+ }
85
+ /** `applies_to`, sops.rs: an unscoped SOP applies to everyone; a scoped one only to its roles, and never to a caller with no role. */
86
+ export declare function sopAppliesToRole(roles: readonly string[], role: string): boolean;
87
+ /**
88
+ * The path scope in force for `role` (`collect_scope_paths`): the workspace
89
+ * SOPs' scopes, narrowed by the org SOPs' (a workspace scope survives when it
90
+ * is inside an org one; none surviving is {@link NARROWED_TO_NOTHING}; no
91
+ * workspace scope takes the org's), sorted and deduplicated. Empty means
92
+ * unrestricted.
93
+ */
94
+ export declare function collectScopePaths(sops: readonly ScopeSop[], role: string): string[];
95
+ /** A SOP as {@link collectPlanSteps} reads it. */
96
+ export interface PlanSop {
97
+ scope: 'workspace' | 'org';
98
+ roles: readonly string[];
99
+ planSteps: readonly string[];
100
+ }
101
+ /**
102
+ * The plan in force for `role` (`collect_plan_steps`, sops.rs): the
103
+ * workspace SOPs' steps in order, not deduplicated (a plan is a sequence),
104
+ * narrowed by the org SOPs' steps by membership ignoring ASCII case (none
105
+ * surviving is {@link NARROWED_TO_NOTHING}; no workspace plan takes the
106
+ * org's). Empty means no plan.
107
+ */
108
+ export declare function collectPlanSteps(sops: readonly PlanSop[], role: string): string[];
109
+ /**
110
+ * The off-plan steps of `sequence` against `planSteps` (`PlanAdherenceDetector`):
111
+ * empty when there is no plan or no sequence, or when the off-plan share is
112
+ * at most `tolerance`; otherwise the off-plan names, sorted and deduplicated,
113
+ * with the share. Names compare ignoring ASCII case.
114
+ */
115
+ export declare function planOffSteps(sequence: readonly string[], planSteps: readonly string[], tolerance: number): {
116
+ offPlan: string[];
117
+ ratio: number;
118
+ };
119
+ /**
120
+ * The mutations one tool call makes, as the proxy's change manifest records
121
+ * them: a move's source and destination; a text-editor call unless it is a
122
+ * `view`; a write, edit or delete tool's path. Only path targets that are not
123
+ * empty, each clipped as the manifest clips it. A shell command is never a
124
+ * path, so a shell call has none.
125
+ */
126
+ export declare function changeTargets(tool: string, input: unknown): ChangeTarget[];
127
+ /**
128
+ * The paths a diff changes, in the order first seen, each once: from
129
+ * `diff --git a/X b/Y` (both, when it splits unambiguously), `--- a/X`,
130
+ * `+++ b/Y`, `rename from X` and `rename to Y`. `/dev/null` is not a path.
131
+ */
132
+ export declare function diffChangedPaths(diff: string): string[];
133
+ /**
134
+ * `target` relative to the workspace `root` (both resolved against `cwd`
135
+ * when relative), or null when it is outside the root, names a home
136
+ * directory (`~`), or either path is not absolute after resolving. A gate
137
+ * checks the result with {@link isWithinScope}; null is out of scope.
138
+ */
139
+ export declare function scopeRelativePath(target: string, cwd: string, root: string): string | null;
140
+ /** Whether `plan_approval:` lets `tool` run before the plan is approved: one of {@link PLAN_EXEMPT_TOOLS}, ignoring case, bare or as an MCP tool (`mcp__<server>__grep`). */
141
+ export declare function isPlanExemptTool(tool: string): boolean;
142
+ /**
143
+ * Whether the call changed files: a mutation ({@link changeTargets}) or a
144
+ * shell command with one of {@link FILE_WRITE_SHELL_PHRASES} (`sed -i`,
145
+ * `git checkout`, …). An earlier passing test run is stale after one.
146
+ */
147
+ export declare function isFileWriteCall(tool: string, input: unknown): boolean;
148
+ /**
149
+ * The functions above as JavaScript source, for the hook gates to embed
150
+ * after the phrase matcher's source (`PHRASES_JS_SOURCE`), which
151
+ * {@link isFileWriteCall} calls. The lists the functions read are written
152
+ * into them, so the source needs nothing else; `scopeMatch.test.ts` holds
153
+ * those copies to the exported lists.
154
+ */
155
+ export declare const SCOPE_MATCH_JS_SOURCE: string;
156
+ //# sourceMappingURL=scopeMatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeMatch.d.ts","sourceRoot":"","sources":["../src/scopeMatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,gIAAgI;AAChI,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,0HAA0H;AAC1H,eAAO,MAAM,mBAAmB,qDAAqD,CAAA;AAErF,kCAAkC;AAClC,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAsE,CAAA;AACrH,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAiG,CAAA;AAC/I,mCAAmC;AACnC,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAA4D,CAAA;AAC5G,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAuD,CAAA;AACrG,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAuF,CAAA;AACvI,gCAAgC;AAChC,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAkF,CAAA;AAC/H,mCAAmC;AACnC,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAiC,CAAA;AACjF,iCAAiC;AACjC,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAA0H,CAAA;AACzK,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAqD,CAAA;AACnG,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAkD,CAAA;AACpG,eAAO,MAAM,k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gB,YAAY,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQ/I;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,CAwB1E;AAoBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CA2BvD;AAaD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO1F;AAED,6KAA6K;AAC7K,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAUrE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QA0ByC,CAAA"}
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Scope and plan semantics, ported from the proxy so every surface answers
3
+ * "is this change inside the scope?" and "is this run on its plan?" the same
4
+ * way.
5
+ *
6
+ * | Function | Port of |
7
+ * |---|---|
8
+ * | {@link isWithinScope} | `is_within_scope`, `plugins/anomaly/detectors.rs` |
9
+ * | {@link collectScopePaths} | `collect_scope_paths`, `sops.rs`, the org ceiling included |
10
+ * | {@link planOffSteps} | `PlanAdherenceDetector`, `detectors.rs`, with {@link PLAN_DEVIATION_TOLERANCE} |
11
+ * | {@link changeTargets} | `manifest_from_invocations`, `manifest.rs`: the mutation entries of one call |
12
+ * | {@link diffChangedPaths} | (new) the paths a unified or git diff changes |
13
+ *
14
+ * Beside them, what only the gates need: {@link scopeRelativePath} makes a
15
+ * gate's target relative to its workspace root (a path outside the root is
16
+ * out of scope), {@link isPlanExemptTool} names the calls `plan_approval:`
17
+ * never refuses, and {@link isFileWriteCall} says whether a call changed files,
18
+ * which makes an earlier passing test run stale (Q1).
19
+ *
20
+ * Self-contained but for `./phrases.ts`, so `@intutic/gate` keeps a
21
+ * byte-identical copy and the JavaScript hook gates embed
22
+ * {@link SCOPE_MATCH_JS_SOURCE} beside the phrase matcher's source. The
23
+ * Python port is `intutic_clawde/gate/scope_match.py`; the proxy's Rust runs
24
+ * the same `fixtures/scope-plan-vectors.json`. `manifestParity.test.ts`
25
+ * holds the tool and key lists to `manifest.rs` and `actions.rs`.
26
+ *
27
+ * @module
28
+ */
29
+ import { hasPhrase, phraseText } from './phrases.js';
30
+ /** The share of off-plan steps a plan forgives under `plan_steps_mode: advise` (`PLAN_DEVIATION_TOLERANCE` in detectors.rs). */
31
+ export const PLAN_DEVIATION_TOLERANCE = 0.4;
32
+ /** What an org ceiling disjoint from the workspace list leaves (`NARROWED_TO_NOTHING`, sops.rs): no path is inside it. */
33
+ export const NARROWED_TO_NOTHING = '<none: workspace list disjoint from org ceiling>';
34
+ /** `WRITE_TOOLS`, manifest.rs. */
35
+ export const SCOPE_WRITE_TOOLS = ['write', 'write_file', 'writefile', 'create_file', 'createfile'];
36
+ /** `EDIT_TOOLS`, manifest.rs. */
37
+ export const SCOPE_EDIT_TOOLS = ['edit', 'edit_file', 'editfile', 'multiedit', 'apply_patch', 'str_replace', 'notebookedit'];
38
+ /** `DELETE_TOOLS`, manifest.rs. */
39
+ export const SCOPE_DELETE_TOOLS = ['delete_file', 'deletefile', 'remove_file', 'rm_file'];
40
+ /** `MOVE_TOOLS`, manifest.rs. */
41
+ export const SCOPE_MOVE_TOOLS = ['move_file', 'movefile', 'rename_file', 'rename'];
42
+ /** `EDITOR_TOOLS`, actions.rs: the text editor, whose `command` decides whether it writes. */
43
+ export const SCOPE_EDITOR_TOOLS = ['str_replace_editor', 'text_editor', 'texteditor', 'str_replace_based_edit_tool'];
44
+ /** `PATH_KEYS`, manifest.rs. */
45
+ export const SCOPE_PATH_KEYS = ['file_path', 'filepath', 'path', 'filename', 'target_file', 'notebook_path'];
46
+ /** `COMMAND_KEYS`, manifest.rs. */
47
+ export const SCOPE_COMMAND_KEYS = ['command', 'cmd', 'script'];
48
+ /** `SHELL_TOOLS`, actions.rs. */
49
+ export const SCOPE_SHELL_TOOLS = ['bash', 'shell', 'run_command', 'runcommand', 'execute_command', 'run_shell_command', 'terminal', 'execute', 'exec'];
50
+ /** `READ_TOOLS`, actions.rs. */
51
+ export const SCOPE_READ_TOOLS = ['read', 'readfile', 'view', 'cat', 'open_file'];
52
+ /** A move's source and destination keys, manifest.rs. */
53
+ export const SCOPE_MOVE_FROM_KEYS = ['source', 'source_path', 'from', 'old_path'];
54
+ export const SCOPE_MOVE_TO_KEYS = ['destination', 'destination_path', 'to', 'new_path'];
55
+ /** A target is cut to this many bytes, and marked with `…` when it was (`TARGET_MAX`, manifest.rs). */
56
+ export const SCOPE_TARGET_MAX_BYTES = 512;
57
+ /**
58
+ * Tools `plan_approval:` never refuses: the read tools and the search and
59
+ * listing tools an agent needs to write a plan in the first place.
60
+ */
61
+ export const PLAN_EXEMPT_TOOLS = ['read', 'readfile', 'view', 'cat', 'open_file', 'glob', 'grep', 'ls', 'list_dir', 'search', 'todowrite'];
62
+ /**
63
+ * Shell phrases that change files in the working tree. With the mutation
64
+ * tools ({@link changeTargets}), a call matching one makes an earlier passing
65
+ * test run stale ({@link isFileWriteCall}).
66
+ */
67
+ export const FILE_WRITE_SHELL_PHRASES = [
68
+ 'sed -i',
69
+ 'perl -i',
70
+ 'perl -pi',
71
+ 'git apply',
72
+ 'git am',
73
+ 'git checkout',
74
+ 'git switch',
75
+ 'git restore',
76
+ 'git reset',
77
+ 'git merge',
78
+ 'git pull',
79
+ 'git rebase',
80
+ 'git cherry-pick',
81
+ 'git revert',
82
+ 'git stash pop',
83
+ 'git stash apply',
84
+ 'patch -p',
85
+ ];
86
+ /** ASCII lower case, as Rust's `to_ascii_lowercase`. */
87
+ function scopeAsciiLower(s) {
88
+ return s.replace(/[A-Z]+/g, (m) => m.toLowerCase());
89
+ }
90
+ /** `tool_is`, actions.rs: the name, lower-cased, is one of `group` or ends with one. */
91
+ function scopeToolIs(name, group) {
92
+ const lower = name.toLowerCase();
93
+ for (const t of group)
94
+ if (lower === t || lower.slice(-t.length) === t)
95
+ return true;
96
+ return false;
97
+ }
98
+ /** The first of `keys` whose value in `input` is a non-empty string. */
99
+ function scopeKeyed(input, keys) {
100
+ if (input === null || typeof input !== 'object' || Array.isArray(input))
101
+ return null;
102
+ const o = input;
103
+ for (const k of keys) {
104
+ const v = o[k];
105
+ if (typeof v === 'string' && v !== '')
106
+ return v;
107
+ }
108
+ return null;
109
+ }
110
+ /** `clip`, manifest.rs: the first {@link SCOPE_TARGET_MAX_BYTES} bytes, and `…` when cut. */
111
+ function scopeClip(s) {
112
+ let bytes = 0;
113
+ let i = 0;
114
+ while (i < s.length) {
115
+ const c = s.charCodeAt(i);
116
+ let n = 3;
117
+ let w = 1;
118
+ if (c < 0x80)
119
+ n = 1;
120
+ else if (c < 0x800)
121
+ n = 2;
122
+ else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length) {
123
+ const l = s.charCodeAt(i + 1);
124
+ if (l >= 0xdc00 && l <= 0xdfff) {
125
+ n = 4;
126
+ w = 2;
127
+ }
128
+ }
129
+ if (bytes + n > 512)
130
+ return s.slice(0, i) + '…';
131
+ bytes += n;
132
+ i += w;
133
+ }
134
+ return s;
135
+ }
136
+ /**
137
+ * Is `target` inside any of `scopes`? Segment-prefix match: `packages/proxy`
138
+ * covers `packages/proxy/src/main.rs`, not `packages/proxy-extras/x.rs`.
139
+ * Leading `./` and `/` and trailing `/` are dropped, and the comparison
140
+ * ignores ASCII case. An empty scope covers everything.
141
+ */
142
+ export function isWithinScope(target, scopes) {
143
+ const norm = (s) => {
144
+ let t = s;
145
+ while (t.slice(0, 2) === './')
146
+ t = t.slice(2);
147
+ let a = 0;
148
+ while (a < t.length && t.charAt(a) === '/')
149
+ a++;
150
+ t = t.slice(a);
151
+ let b = t.length;
152
+ while (b > 0 && t.charAt(b - 1) === '/')
153
+ b--;
154
+ return scopeAsciiLower(t.slice(0, b));
155
+ };
156
+ const t = norm(target);
157
+ for (const raw of scopes) {
158
+ const s = norm(raw);
159
+ if (s === '' || t === s || t.slice(0, s.length + 1) === s + '/')
160
+ return true;
161
+ }
162
+ return false;
163
+ }
164
+ /** `applies_to`, sops.rs: an unscoped SOP applies to everyone; a scoped one only to its roles, and never to a caller with no role. */
165
+ export function sopAppliesToRole(roles, role) {
166
+ if (roles.length === 0)
167
+ return true;
168
+ if (role === '')
169
+ return false;
170
+ return roles.indexOf(scopeAsciiLower(role)) !== -1;
171
+ }
172
+ /**
173
+ * The path scope in force for `role` (`collect_scope_paths`): the workspace
174
+ * SOPs' scopes, narrowed by the org SOPs' (a workspace scope survives when it
175
+ * is inside an org one; none surviving is {@link NARROWED_TO_NOTHING}; no
176
+ * workspace scope takes the org's), sorted and deduplicated. Empty means
177
+ * unrestricted.
178
+ */
179
+ export function collectScopePaths(sops, role) {
180
+ const workspace = [];
181
+ const org = [];
182
+ for (const s of sops) {
183
+ if (!sopAppliesToRole(s.roles, role))
184
+ continue;
185
+ for (const p of s.scopePaths)
186
+ (s.scope === 'org' ? org : workspace).push(p);
187
+ }
188
+ let out;
189
+ if (org.length === 0)
190
+ out = workspace;
191
+ else if (workspace.length === 0)
192
+ out = org;
193
+ else {
194
+ out = workspace.filter((w) => isWithinScope(w, org));
195
+ if (out.length === 0)
196
+ out = [NARROWED_TO_NOTHING];
197
+ }
198
+ return out.slice().sort().filter((p, i, all) => i === 0 || all[i - 1] !== p);
199
+ }
200
+ /**
201
+ * The plan in force for `role` (`collect_plan_steps`, sops.rs): the
202
+ * workspace SOPs' steps in order, not deduplicated (a plan is a sequence),
203
+ * narrowed by the org SOPs' steps by membership ignoring ASCII case (none
204
+ * surviving is {@link NARROWED_TO_NOTHING}; no workspace plan takes the
205
+ * org's). Empty means no plan.
206
+ */
207
+ export function collectPlanSteps(sops, role) {
208
+ const workspace = [];
209
+ const org = [];
210
+ for (const s of sops) {
211
+ if (!sopAppliesToRole(s.roles, role))
212
+ continue;
213
+ for (const p of s.planSteps)
214
+ (s.scope === 'org' ? org : workspace).push(p);
215
+ }
216
+ if (org.length === 0)
217
+ return workspace;
218
+ if (workspace.length === 0)
219
+ return org;
220
+ const allowed = org.map(scopeAsciiLower);
221
+ const out = workspace.filter((w) => allowed.indexOf(scopeAsciiLower(w)) !== -1);
222
+ return out.length > 0 ? out : [NARROWED_TO_NOTHING];
223
+ }
224
+ /**
225
+ * The off-plan steps of `sequence` against `planSteps` (`PlanAdherenceDetector`):
226
+ * empty when there is no plan or no sequence, or when the off-plan share is
227
+ * at most `tolerance`; otherwise the off-plan names, sorted and deduplicated,
228
+ * with the share. Names compare ignoring ASCII case.
229
+ */
230
+ export function planOffSteps(sequence, planSteps, tolerance) {
231
+ if (planSteps.length === 0 || sequence.length === 0)
232
+ return { offPlan: [], ratio: 0 };
233
+ const plan = planSteps.map(scopeAsciiLower);
234
+ const off = sequence.filter((t) => plan.indexOf(scopeAsciiLower(t)) === -1);
235
+ if (off.length === 0)
236
+ return { offPlan: [], ratio: 0 };
237
+ const ratio = off.length / sequence.length;
238
+ if (ratio <= tolerance)
239
+ return { offPlan: [], ratio };
240
+ return { offPlan: off.slice().sort().filter((p, i, all) => i === 0 || all[i - 1] !== p), ratio: Math.min(1, ratio) };
241
+ }
242
+ /**
243
+ * The mutations one tool call makes, as the proxy's change manifest records
244
+ * them: a move's source and destination; a text-editor call unless it is a
245
+ * `view`; a write, edit or delete tool's path. Only path targets that are not
246
+ * empty, each clipped as the manifest clips it. A shell command is never a
247
+ * path, so a shell call has none.
248
+ */
249
+ export function changeTargets(tool, input) {
250
+ if (scopeToolIs(tool, ['move_file', 'movefile', 'rename_file', 'rename'])) {
251
+ const from = scopeKeyed(input, ['source', 'source_path', 'from', 'old_path']);
252
+ const to = scopeKeyed(input, ['destination', 'destination_path', 'to', 'new_path']);
253
+ if (from !== null || to !== null) {
254
+ const out = [];
255
+ if (from !== null)
256
+ out.push({ op: 'move', target: scopeClip(from) });
257
+ if (to !== null)
258
+ out.push({ op: 'move', target: scopeClip(to) });
259
+ return out;
260
+ }
261
+ }
262
+ const keys = ['file_path', 'filepath', 'path', 'filename', 'target_file', 'notebook_path'];
263
+ let op = null;
264
+ if (scopeToolIs(tool, ['str_replace_editor', 'text_editor', 'texteditor', 'str_replace_based_edit_tool'])) {
265
+ const o = input !== null && typeof input === 'object' && !Array.isArray(input) ? input : {};
266
+ const command = typeof o.command === 'string' ? scopeAsciiLower(o.command) : '';
267
+ op = command === 'view' ? null : command === 'create' ? 'write' : 'edit';
268
+ if (op === null)
269
+ return [];
270
+ }
271
+ else if (scopeToolIs(tool, ['write', 'write_file', 'writefile', 'create_file', 'createfile']))
272
+ op = 'write';
273
+ else if (scopeToolIs(tool, ['edit', 'edit_file', 'editfile', 'multiedit', 'apply_patch', 'str_replace', 'notebookedit']))
274
+ op = 'edit';
275
+ else if (scopeToolIs(tool, ['delete_file', 'deletefile', 'remove_file', 'rm_file']))
276
+ op = 'delete';
277
+ if (op === null)
278
+ return [];
279
+ const target = scopeKeyed(input, keys);
280
+ return target === null ? [] : [{ op, target: scopeClip(target) }];
281
+ }
282
+ /** One path from a diff header, or null: quotes dropped, a `a/` or `b/` prefix dropped, `/dev/null` and empty refused, anything after a tab cut. */
283
+ function scopeDiffPath(raw, prefix) {
284
+ let p = raw;
285
+ const tab = p.indexOf('\t');
286
+ if (tab !== -1)
287
+ p = p.slice(0, tab);
288
+ // Spaces only (not tabs), trimmed by index: a `/[ ]+$/` backtracks
289
+ // quadratically on a long run of spaces that is not at the end.
290
+ let start = 0;
291
+ let end = p.length;
292
+ while (start < end && p.charCodeAt(start) === 32)
293
+ start++;
294
+ while (end > start && p.charCodeAt(end - 1) === 32)
295
+ end--;
296
+ p = p.slice(start, end);
297
+ if (p.length >= 2 && p.charAt(0) === '"' && p.charAt(p.length - 1) === '"')
298
+ p = p.slice(1, -1);
299
+ if (p === '/dev/null' || p === '')
300
+ return null;
301
+ if (prefix !== '' && p.slice(0, prefix.length) === prefix)
302
+ p = p.slice(prefix.length);
303
+ return p === '' ? null : p;
304
+ }
305
+ /**
306
+ * The paths a diff changes, in the order first seen, each once: from
307
+ * `diff --git a/X b/Y` (both, when it splits unambiguously), `--- a/X`,
308
+ * `+++ b/Y`, `rename from X` and `rename to Y`. `/dev/null` is not a path.
309
+ */
310
+ export function diffChangedPaths(diff) {
311
+ const out = [];
312
+ const add = (p) => {
313
+ if (p !== null && out.indexOf(p) === -1)
314
+ out.push(p);
315
+ };
316
+ for (const raw of diff.split('\n')) {
317
+ const line = raw.replace(/\r$/, '');
318
+ if (line.slice(0, 11) === 'diff --git ') {
319
+ const rest = line.slice(11);
320
+ if (rest.slice(0, 2) !== 'a/')
321
+ continue;
322
+ const first = rest.indexOf(' b/');
323
+ if (first === -1)
324
+ continue;
325
+ if (rest.indexOf(' b/', first + 1) === -1) {
326
+ add(scopeDiffPath(rest.slice(0, first), 'a/'));
327
+ add(scopeDiffPath(rest.slice(first + 1), 'b/'));
328
+ }
329
+ else if ((rest.length - 5) % 2 === 0) {
330
+ // `a/P b/P` with ` b/` inside P: the split that names one path twice.
331
+ const n = (rest.length - 5) / 2;
332
+ const a = rest.slice(2, 2 + n);
333
+ if (rest.slice(2 + n, 5 + n) === ' b/' && rest.slice(5 + n) === a)
334
+ add(scopeDiffPath(a, ''));
335
+ }
336
+ }
337
+ else if (line.slice(0, 4) === '--- ')
338
+ add(scopeDiffPath(line.slice(4), 'a/'));
339
+ else if (line.slice(0, 4) === '+++ ')
340
+ add(scopeDiffPath(line.slice(4), 'b/'));
341
+ else if (line.slice(0, 12) === 'rename from ')
342
+ add(scopeDiffPath(line.slice(12), ''));
343
+ else if (line.slice(0, 10) === 'rename to ')
344
+ add(scopeDiffPath(line.slice(10), ''));
345
+ }
346
+ return out;
347
+ }
348
+ /** A POSIX path with `.` and `..` resolved and slashes collapsed; `..` never climbs above `/`. */
349
+ function scopeNormalisePath(p) {
350
+ const parts = [];
351
+ for (const seg of p.split('/')) {
352
+ if (seg === '' || seg === '.')
353
+ continue;
354
+ if (seg === '..')
355
+ parts.pop();
356
+ else
357
+ parts.push(seg);
358
+ }
359
+ return '/' + parts.join('/');
360
+ }
361
+ /**
362
+ * `target` relative to the workspace `root` (both resolved against `cwd`
363
+ * when relative), or null when it is outside the root, names a home
364
+ * directory (`~`), or either path is not absolute after resolving. A gate
365
+ * checks the result with {@link isWithinScope}; null is out of scope.
366
+ */
367
+ export function scopeRelativePath(target, cwd, root) {
368
+ if (target === '' || target.charAt(0) === '~' || cwd.charAt(0) !== '/' || root.charAt(0) !== '/')
369
+ return null;
370
+ const abs = scopeNormalisePath(target.charAt(0) === '/' ? target : cwd + '/' + target);
371
+ const base = scopeNormalisePath(root);
372
+ if (abs === base)
373
+ return '';
374
+ const head = base === '/' ? '/' : base + '/';
375
+ return abs.slice(0, head.length) === head ? abs.slice(head.length) : null;
376
+ }
377
+ /** Whether `plan_approval:` lets `tool` run before the plan is approved: one of {@link PLAN_EXEMPT_TOOLS}, ignoring case, bare or as an MCP tool (`mcp__<server>__grep`). */
378
+ export function isPlanExemptTool(tool) {
379
+ const lower = tool.toLowerCase();
380
+ for (const t of ['read', 'readfile', 'view', 'cat', 'open_file', 'glob', 'grep', 'ls', 'list_dir', 'search', 'todowrite']) {
381
+ if (lower === t || lower.slice(-(t.length + 2)) === '__' + t)
382
+ return true;
383
+ }
384
+ return false;
385
+ }
386
+ /**
387
+ * Whether the call changed files: a mutation ({@link changeTargets}) or a
388
+ * shell command with one of {@link FILE_WRITE_SHELL_PHRASES} (`sed -i`,
389
+ * `git checkout`, …). An earlier passing test run is stale after one.
390
+ */
391
+ export function isFileWriteCall(tool, input) {
392
+ if (changeTargets(tool, input).length > 0)
393
+ return true;
394
+ if (!scopeToolIs(tool, ['bash', 'shell', 'run_command', 'runcommand', 'execute_command', 'run_shell_command', 'terminal', 'execute', 'exec']))
395
+ return false;
396
+ const command = scopeKeyed(input, ['command', 'cmd', 'script']);
397
+ if (command === null)
398
+ return false;
399
+ const words = phraseText(command);
400
+ for (const p of ['sed -i', 'perl -i', 'perl -pi', 'git apply', 'git am', 'git checkout', 'git switch', 'git restore', 'git reset', 'git merge', 'git pull', 'git rebase', 'git cherry-pick', 'git revert', 'git stash pop', 'git stash apply', 'patch -p']) {
401
+ if (hasPhrase(words, p))
402
+ return true;
403
+ }
404
+ return false;
405
+ }
406
+ /**
407
+ * The functions above as JavaScript source, for the hook gates to embed
408
+ * after the phrase matcher's source (`PHRASES_JS_SOURCE`), which
409
+ * {@link isFileWriteCall} calls. The lists the functions read are written
410
+ * into them, so the source needs nothing else; `scopeMatch.test.ts` holds
411
+ * those copies to the exported lists.
412
+ */
413
+ export const SCOPE_MATCH_JS_SOURCE = [
414
+ scopeAsciiLower,
415
+ scopeToolIs,
416
+ scopeKeyed,
417
+ scopeClip,
418
+ isWithinScope,
419
+ sopAppliesToRole,
420
+ collectScopePaths,
421
+ collectPlanSteps,
422
+ planOffSteps,
423
+ changeTargets,
424
+ scopeDiffPath,
425
+ diffChangedPaths,
426
+ scopeNormalisePath,
427
+ scopeRelativePath,
428
+ isPlanExemptTool,
429
+ isFileWriteCall,
430
+ ]
431
+ .map((fn) => fn
432
+ .toString()
433
+ .replace(/\(0,\s*(?:[\w$]+_js_\d+|__vite_ssr_import_\d+__)\.([\w$]+)\)/g, '$1')
434
+ .replace(/\b(?:[\w$]+_js_\d+|__vite_ssr_import_\d+__)\.([\w$]+)/g, '$1')
435
+ .replace(/\bexports\./g, ''))
436
+ .join('\n')
437
+ .replace(/\bNARROWED_TO_NOTHING\b/g, JSON.stringify(NARROWED_TO_NOTHING));
438
+ //# sourceMappingURL=scopeMatch.js.map
@@ -0,0 +1 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