thumbgate 1.39.1 → 1.40.1

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 (160) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.well-known/llms.txt +2 -2
  3. package/.well-known/mcp/server-card.json +1 -1
  4. package/README.md +5 -4
  5. package/adapters/claude/.mcp.json +6 -2
  6. package/adapters/codex/config.toml +5 -0
  7. package/adapters/forge/forge.yaml +4 -4
  8. package/adapters/future-agi/.mcp.json +1 -1
  9. package/adapters/future-agi/config.toml +1 -1
  10. package/adapters/future-agi/opencode.json +1 -1
  11. package/adapters/herdr/herdr-plugin.toml +2 -2
  12. package/adapters/mcp/server-stdio.js +82 -7
  13. package/adapters/opencode/opencode.json +1 -1
  14. package/bin/cli.js +128 -15
  15. package/config/brand-standards.json +131 -0
  16. package/config/gates/default.json +18 -1
  17. package/config/github-about.json +1 -1
  18. package/config/mcp-allowlists.json +16 -3
  19. package/config/merge-quality-checks.json +1 -0
  20. package/config/post-deploy-marketing-pages.json +3 -3
  21. package/config/schemas/task-outcome-receipt.schema.json +9 -0
  22. package/openapi/openapi.yaml +7 -3
  23. package/package.json +62 -28
  24. package/public/about.html +2 -2
  25. package/public/admin.html +771 -0
  26. package/public/agent-manager.html +3 -3
  27. package/public/agents-cost-savings.html +1 -1
  28. package/public/ai-malpractice-prevention.html +12 -12
  29. package/public/architecture.html +0 -1
  30. package/public/assets/diagrams/decision.svg +3 -3
  31. package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +1 -1
  32. package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +1 -1
  33. package/public/blog/git-at-agent-scale.html +2 -2
  34. package/public/blog/inside-your-boundary.html +1 -1
  35. package/public/blog/process-over-outcome-gates.html +1 -1
  36. package/public/case-studies.html +1 -2
  37. package/public/codex-enterprise.html +1 -1
  38. package/public/codex-plugin.html +1 -1
  39. package/public/dashboard.html +773 -481
  40. package/public/diagnostic.html +8 -3
  41. package/public/enterprise-governance.html +26 -174
  42. package/public/eval-scorecard.html +3 -4
  43. package/public/eval-scorecard.json +2 -2
  44. package/public/evaluations.html +0 -1
  45. package/public/founders.html +3 -3
  46. package/public/gaming-playbook.html +4 -4
  47. package/public/guide.html +3 -5
  48. package/public/index.html +159 -69
  49. package/public/install.html +12 -11
  50. package/public/js/buyer-intent.js +49 -8
  51. package/public/lessons.html +103 -46
  52. package/public/numbers.html +32 -33
  53. package/public/operator-framework.html +44 -72
  54. package/public/peter.html +3 -3
  55. package/public/platform-partners.html +1 -1
  56. package/public/pricing.html +75 -60
  57. package/public/pro.html +3 -1
  58. package/public/project-switcher.js +76 -0
  59. package/public/whitepaper.html +1 -2
  60. package/scripts/activation-quickstart.js +15 -3
  61. package/scripts/activation-tracker.js +280 -3
  62. package/scripts/agent-action-inventory.js +235 -143
  63. package/scripts/agent-operations-planner.js +1 -1
  64. package/scripts/agent-readiness.js +36 -6
  65. package/scripts/agentic-prompt-pipelines.js +901 -0
  66. package/scripts/analytics-window.js +7 -1
  67. package/scripts/async-job-runner.js +66 -11
  68. package/scripts/audit-trail.js +37 -24
  69. package/scripts/auto-promote-gates.js +37 -27
  70. package/scripts/backfill-lesson-scopes.js +122 -0
  71. package/scripts/billing.js +889 -132
  72. package/scripts/bot-detection.js +112 -0
  73. package/scripts/brand-standards-gate.js +571 -0
  74. package/scripts/chatgpt-ads-readiness-pack.js +1 -1
  75. package/scripts/cli-schema.js +1 -1
  76. package/scripts/commercial-offer.js +2 -2
  77. package/scripts/contextfs.js +9 -3
  78. package/scripts/cross-encoder-reranker.js +4 -0
  79. package/scripts/dashboard-chat.js +11 -0
  80. package/scripts/dashboard.js +574 -167
  81. package/scripts/decision-journal.js +7 -4
  82. package/scripts/docker-sandbox-planner.js +3 -3
  83. package/scripts/export-dpo-pairs.js +12 -7
  84. package/scripts/feedback-aggregate.js +4 -0
  85. package/scripts/feedback-attribution.js +6 -4
  86. package/scripts/feedback-history-distiller.js +18 -6
  87. package/scripts/feedback-loop.js +255 -89
  88. package/scripts/feedback-paths.js +8 -1
  89. package/scripts/feedback-sanitizer.js +5 -0
  90. package/scripts/feedback-scope.js +106 -0
  91. package/scripts/feedback-session.js +8 -2
  92. package/scripts/filesystem-search.js +13 -8
  93. package/scripts/financial-control-plane.js +707 -45
  94. package/scripts/gate-stats.js +8 -2
  95. package/scripts/gates-engine.js +694 -230
  96. package/scripts/generate-eval-scorecard.js +0 -1
  97. package/scripts/harness-tool-names.js +31 -5
  98. package/scripts/hybrid-feedback-context.js +5 -2
  99. package/scripts/intervention-policy.js +2 -1
  100. package/scripts/lesson-canonical.js +2 -2
  101. package/scripts/lesson-db.js +55 -14
  102. package/scripts/lesson-graph.js +2 -1
  103. package/scripts/lesson-retrieval.js +95 -9
  104. package/scripts/lesson-search.js +86 -22
  105. package/scripts/lesson-synthesis.js +21 -5
  106. package/scripts/mailer/index.js +17 -1
  107. package/scripts/mailer/resend-mailer.js +213 -179
  108. package/scripts/migrate-project-scope.js +209 -0
  109. package/scripts/operational-integrity.js +436 -3
  110. package/scripts/override-audit.js +2 -0
  111. package/scripts/owner-admin.js +338 -0
  112. package/scripts/pr-manager.js +194 -1
  113. package/scripts/progressive-signoff.js +260 -0
  114. package/scripts/project-catalog.js +243 -0
  115. package/scripts/project-dashboard.js +61 -0
  116. package/scripts/project-evidence.js +172 -0
  117. package/scripts/project-identity.js +182 -0
  118. package/scripts/project-scope.js +381 -0
  119. package/scripts/prompt-guard.js +446 -52
  120. package/scripts/proof-report.js +232 -0
  121. package/scripts/provider-action-normalizer.js +14 -6
  122. package/scripts/rate-limiter.js +41 -0
  123. package/scripts/secret-redaction.js +171 -25
  124. package/scripts/secret-scanner.js +101 -42
  125. package/scripts/self-protection.js +2 -2
  126. package/scripts/seo-gsd.js +14 -14
  127. package/scripts/session-context-dedupe.js +66 -0
  128. package/scripts/settings-hierarchy.js +4 -2
  129. package/scripts/statusline-meta.js +34 -23
  130. package/scripts/task-outcomes.js +29 -2
  131. package/scripts/telemetry-analytics.js +238 -13
  132. package/scripts/thumbgate-search.js +23 -9
  133. package/scripts/tool-kpi-tracker.js +5 -2
  134. package/scripts/tool-registry.js +42 -1
  135. package/scripts/triage-savings-calculator.js +1 -1
  136. package/scripts/vector-store.js +4 -1
  137. package/scripts/verified-lessons.js +270 -0
  138. package/scripts/verify-marketing-pages-deployed.js +2 -2
  139. package/scripts/workflow-sentinel.js +29 -10
  140. package/server.json +2 -2
  141. package/src/api/server.js +2371 -451
  142. package/src/feedback.js +21 -0
  143. package/src/hermes-sync-plane.js +2 -1
  144. package/src/index.js +2 -0
  145. package/src/lesson-search.js +9 -0
  146. package/src/mckinsey-top-company-ai-coding.js +493 -0
  147. package/src/mcp/server.js +3 -0
  148. package/src/mcp-writeguard.js +772 -11
  149. package/src/openshell-lovable-engine.js +1475 -0
  150. package/src/task-outcome.js +3 -0
  151. package/config/evals/agent-safety-eval.json +0 -447
  152. package/config/evals/retrieval-ranking-golden.json +0 -522
  153. package/config/progressive/01-wire-only.json +0 -11
  154. package/config/progressive/02-dashboard-empty-ok.json +0 -10
  155. package/config/progressive/03-one-lesson.json +0 -10
  156. package/config/progressive/04-warn-fires.json +0 -11
  157. package/config/progressive/05-strict-optional.json +0 -11
  158. package/config/progressive/README.md +0 -15
  159. package/public/assets/diagrams/agent-integration.png +0 -0
  160. package/public/assets/diagrams/thumbgate-architecture.png +0 -0
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const crypto = require('node:crypto');
7
+ const { projectForRecord, resolveProjectEvidence, isGeneratedGate } = require('./project-identity');
8
+ const { SIGNAL_FILES, signalPaths, accountDirectories, accountAttribution, attributionForFile } = require('./project-catalog');
9
+
10
+ function digest(file) {
11
+ const hash = crypto.createHash('sha256');
12
+ const fd = fs.openSync(file, 'r');
13
+ const buffer = Buffer.alloc(64 * 1024);
14
+ try { let n; while ((n = fs.readSync(fd, buffer, 0, buffer.length, null))) hash.update(buffer.subarray(0, n)); } finally { fs.closeSync(fd); }
15
+ return hash.digest('hex');
16
+ }
17
+ function fingerprint(file) {
18
+ const stat = fs.statSync(file, { bigint: true });
19
+ return { ino: String(stat.ino), size: String(stat.size), mtime: String(stat.mtimeNs), checksum: digest(file) };
20
+ }
21
+ function sameFingerprint(a, b) { return JSON.stringify(a) === JSON.stringify(b); }
22
+ function *lines(file) {
23
+ const fd = fs.openSync(file, 'r');
24
+ const buffer = Buffer.alloc(64 * 1024);
25
+ const decoder = new (require('node:string_decoder').StringDecoder)('utf8');
26
+ let pending = '';
27
+ try {
28
+ let n;
29
+ while ((n = fs.readSync(fd, buffer, 0, buffer.length, null))) {
30
+ pending += decoder.write(buffer.subarray(0, n));
31
+ let end;
32
+ while ((end = pending.indexOf('\n')) !== -1) { yield pending.slice(0, end + 1); pending = pending.slice(end + 1); }
33
+ }
34
+ pending += decoder.end();
35
+ if (pending) yield pending;
36
+ } finally { fs.closeSync(fd); }
37
+ }
38
+ function atomicJson(file, value) {
39
+ const temporary = `${file}.${crypto.randomUUID()}.tmp`;
40
+ const fd = fs.openSync(temporary, 'wx', 0o600);
41
+ try { fs.writeFileSync(fd, JSON.stringify(value, null, 2) + '\n'); fs.fsyncSync(fd); } finally { fs.closeSync(fd); }
42
+ fs.renameSync(temporary, file);
43
+ const dir = fs.openSync(path.dirname(file), 'r');
44
+ try { fs.fsyncSync(dir); } finally { fs.closeSync(dir); }
45
+ }
46
+ function copyDatabaseForInspection(file) {
47
+ const directory = fs.mkdtempSync(path.join(require('node:os').tmpdir(), 'thumbgate-migration-'));
48
+ fs.chmodSync(directory, 0o700);
49
+ const files = [file, file + '-wal', file + '-shm'].filter((candidate) => fs.existsSync(candidate));
50
+ const before = files.map((candidate) => fingerprint(candidate));
51
+ try {
52
+ for (const source of files) {
53
+ const target = path.join(directory, path.basename(source));
54
+ fs.copyFileSync(source, target);
55
+ fs.chmodSync(target, 0o600);
56
+ }
57
+ const current = [file, file + '-wal', file + '-shm'].filter((candidate) => fs.existsSync(candidate));
58
+ if (JSON.stringify(current) !== JSON.stringify(files) || files.some((candidate, i) => !sameFingerprint(before[i], fingerprint(candidate)))) throw new Error('Database changed during inspection');
59
+ return { file: path.join(directory, path.basename(file)), cleanup: () => fs.rmSync(directory, { recursive: true, force: true }) };
60
+ } catch (error) { fs.rmSync(directory, { recursive: true, force: true }); throw error; }
61
+ }
62
+ function migrateAccount(root, options, counts) {
63
+ const attribution = accountAttribution(root, options);
64
+ const manifestPath = path.join(root, 'project-scope-migration.json');
65
+ let manifest = { version: 1, files: {}, databases: {} };
66
+ if (fs.existsSync(manifestPath)) manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
67
+ const save = () => atomicJson(manifestPath, manifest);
68
+ const replace = (file, render) => {
69
+ counts.files++;
70
+ const relative = path.relative(root, file);
71
+ const previous = manifest.files[relative];
72
+ const original = fingerprint(file);
73
+ if (previous) {
74
+ if (previous.replacementChecksum === original.checksum) { counts.skipped++; return; }
75
+ if (!sameFingerprint(previous.original, original)) throw new Error('Migration source changed; refusing replacement');
76
+ }
77
+ if (!options.apply) { render(null); return; }
78
+ const temporary = `${file}.${crypto.randomUUID()}.tmp`;
79
+ const backup = previous?.backup || `${file}.project-scope-${crypto.randomUUID()}.bak`;
80
+ const fd = fs.openSync(temporary, 'wx', 0o600);
81
+ try { render(fd); fs.fsyncSync(fd); } catch (error) { fs.closeSync(fd); fs.unlinkSync(temporary); throw error; }
82
+ fs.closeSync(fd);
83
+ try {
84
+ options.beforeReplace?.(file);
85
+ if (!sameFingerprint(original, fingerprint(file))) throw new Error('Concurrent source modification; migration stopped');
86
+ if (!previous) {
87
+ fs.copyFileSync(file, backup, fs.constants.COPYFILE_EXCL);
88
+ const backupFd = fs.openSync(backup, 'r'); try { fs.fsyncSync(backupFd); } finally { fs.closeSync(backupFd); }
89
+ }
90
+ manifest.files[relative] = { original, backup, replacementChecksum: digest(temporary), complete: false };
91
+ save();
92
+ if (!sameFingerprint(original, fingerprint(file))) throw new Error('Concurrent source modification; migration stopped');
93
+ fs.renameSync(temporary, file);
94
+ const directory = fs.openSync(path.dirname(file), 'r'); try { fs.fsyncSync(directory); } finally { fs.closeSync(directory); }
95
+ manifest.files[relative].complete = true;
96
+ save();
97
+ } finally { if (fs.existsSync(temporary)) fs.unlinkSync(temporary); }
98
+ };
99
+ for (const filename of SIGNAL_FILES) {
100
+ for (const file of signalPaths(root, filename)) {
101
+ replace(file, (fd) => {
102
+ for (const line of lines(file)) {
103
+ let output = line;
104
+ try {
105
+ const row = JSON.parse(line);
106
+ if (!row || typeof row !== 'object' || Array.isArray(row)) throw new Error('Not a record');
107
+ counts.rows++;
108
+ const result = resolveProjectEvidence(row, attributionForFile(attribution, file));
109
+ const project = result.descriptor;
110
+ counts.evidence[result.evidence] = (counts.evidence[result.evidence] || 0) + 1;
111
+ if (result.reason) counts.reasons[result.reason] = (counts.reasons[result.reason] || 0) + 1;
112
+ if (result.anchorEvidence) counts.anchorEvidence[result.anchorEvidence] = (counts.anchorEvidence[result.anchorEvidence] || 0) + 1;
113
+ if (project.projectKey === 'unassigned') { counts.unassigned++; counts.unassignedReasons[result.reason] = (counts.unassignedReasons[result.reason] || 0) + 1; }
114
+ else { counts.attributed++; if (project.projectKey.startsWith('legacy_')) counts.legacyAttributed++; else if (project.projectKey.startsWith('repo_')) counts.canonicalAttributed++; else counts.localAttributed++; }
115
+ const newline = line.endsWith('\r\n') ? '\r\n' : line.endsWith('\n') ? '\n' : '';
116
+ output = JSON.stringify({ ...row, ...project }) + newline;
117
+ } catch { if (line.trim()) counts.malformed++; }
118
+ if (fd !== null) fs.writeSync(fd, output);
119
+ }
120
+ });
121
+ }
122
+ }
123
+ for (const dir of accountDirectories(root)) {
124
+ for (const name of ['auto-promoted-gates.json', 'custom-gates.json', 'dashboard-review-state.json']) {
125
+ const file = path.join(dir, name);
126
+ if (!fs.existsSync(file)) continue;
127
+ if (fs.lstatSync(file).isSymbolicLink()) throw new Error('Symlink migration file refused');
128
+ replace(file, (fd) => {
129
+ const original = JSON.parse(fs.readFileSync(file, 'utf8'));
130
+ let updated;
131
+ if (name === 'dashboard-review-state.json') updated = original.version === 2 ? original : { version: 2, byProject: { all: original } };
132
+ else {
133
+ const items = (Array.isArray(original) ? original : original.gates || []).map((item) => {
134
+ if (item.scope === 'global' && !isGeneratedGate(item)) return item;
135
+ const generated = name === 'auto-promoted-gates.json' || isGeneratedGate(item);
136
+ if (!generated && !item.projectKey) return { ...item, scope: 'global' };
137
+ const descriptor = projectForRecord(item, attributionForFile(attribution, file));
138
+ if (descriptor.projectKey === 'unassigned') { counts.legacyUnscopedGates++; return { ...item, scope: 'project', projectKey: 'unassigned', legacyUnscoped: true }; }
139
+ return { ...item, ...descriptor, scope: 'project' };
140
+ });
141
+ updated = Array.isArray(original) ? items : { ...original, gates: items };
142
+ }
143
+ if (fd !== null) fs.writeSync(fd, JSON.stringify(updated, null, 2) + '\n');
144
+ });
145
+ }
146
+ const file = path.join(dir, 'lessons.sqlite');
147
+ if (!fs.existsSync(file)) continue;
148
+ if (fs.lstatSync(file).isSymbolicLink()) throw new Error('Symlink database refused');
149
+ const Database = require('better-sqlite3');
150
+ const inspection = options.apply ? null : copyDatabaseForInspection(file);
151
+ let db;
152
+ try { db = new Database(inspection?.file || file, { readonly: !options.apply, fileMustExist: true }); } catch (error) { inspection?.cleanup(); throw error; }
153
+ try {
154
+ if (!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'lessons'").get()) { counts.uninitializedDatabases++; continue; }
155
+ const rows = db.prepare('SELECT * FROM lessons').all();
156
+ counts.dbRows += rows.length;
157
+ if (options.apply) {
158
+ options.beforeDatabase?.();
159
+ db.transaction(() => {
160
+ require('./lesson-db').upgradeProjectColumns(db);
161
+ options.afterDatabaseSchema?.(db);
162
+ const update = db.prepare('UPDATE lessons SET projectKey = ?, projectName = ? WHERE id = ?');
163
+ for (const row of rows) {
164
+ // A newly added default is not historical evidence.
165
+ const recorded = row.projectKey === 'unassigned' ? { ...row, projectKey: undefined } : row;
166
+ const project = projectForRecord(recorded, attributionForFile(attribution, file));
167
+ update.run(project.projectKey, project.projectName, row.id);
168
+ options.afterDatabaseRow?.(db, row);
169
+ }
170
+ }).immediate();
171
+ manifest.databases[path.relative(root, file)] = { complete: true, rows: rows.length };
172
+ save();
173
+ }
174
+ } finally { db.close(); inspection?.cleanup(); }
175
+ }
176
+ const report = attribution.pathEvidence.report();
177
+ for (const key of ['probes', 'cachedCandidates', 'metadataBytes']) counts.pathProbe[key] += report[key];
178
+ }
179
+ function migrateProjectScope(root, options = {}) {
180
+ const counts = { files: 0, rows: 0, attributed: 0, unassigned: 0, legacyUnscopedGates: 0, malformed: 0, dbRows: 0, skipped: 0, uninitializedDatabases: 0, canonicalAttributed: 0, legacyAttributed: 0, localAttributed: 0, evidence: {}, reasons: {}, unassignedReasons: {}, anchorEvidence: {}, pathProbe: { probes: 0, cachedCandidates: 0, metadataBytes: 0 } };
181
+ if (!root || !fs.existsSync(root)) return counts;
182
+ if (fs.lstatSync(root).isSymbolicLink()) throw new Error('Symlink account root refused');
183
+ if (options.apply && !options.offline) throw new Error('Apply requires offline: true after stopping all writers');
184
+ const lockPath = path.join(root, '.project-scope-migration.lock');
185
+ let lock;
186
+ if (options.apply) { lock = fs.openSync(lockPath, 'wx', 0o600); fs.writeFileSync(lock, String(process.pid)); }
187
+ try {
188
+ migrateAccount(path.resolve(root), options, counts);
189
+ const tenants = path.join(root, 'tenants');
190
+ if (fs.existsSync(tenants)) {
191
+ if (fs.lstatSync(tenants).isSymbolicLink()) throw new Error('Symlink tenant directory refused');
192
+ for (const tenant of fs.readdirSync(tenants, { withFileTypes: true })) {
193
+ if (tenant.isSymbolicLink()) throw new Error('Symlink tenant refused');
194
+ if (tenant.isDirectory()) migrateAccount(path.join(tenants, tenant.name), { ...options, localPathEvidence: undefined }, counts);
195
+ }
196
+ }
197
+ return counts;
198
+ } finally { if (lock !== undefined) { fs.closeSync(lock); fs.unlinkSync(lockPath); } }
199
+ }
200
+ module.exports = { migrateProjectScope, fingerprint };
201
+ if (require.main === module) {
202
+ const args = process.argv.slice(2);
203
+ const rootIndex = args.indexOf('--feedback-dir');
204
+ if (rootIndex === -1 || !args[rootIndex + 1]) { console.error('Usage: migrate-project-scope --feedback-dir <account-root> [--apply --offline]'); process.exitCode = 1; }
205
+ else {
206
+ try { console.log(JSON.stringify(migrateProjectScope(args[rootIndex + 1], { apply: args.includes('--apply'), offline: args.includes('--offline') }))); }
207
+ catch { console.error('Project migration failed. Source files and backup manifest are preserved.'); process.exitCode = 1; }
208
+ }
209
+ }
@@ -4,6 +4,7 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const { execFileSync, spawnSync } = require('child_process');
7
+ const { normalizeCommandValue } = require('./harness-tool-names');
7
8
 
8
9
  const DEFAULT_BASE_BRANCH = 'main';
9
10
  const FIXED_GIT_BIN_CANDIDATES = [
@@ -653,10 +654,440 @@ function findOpenPrForBranch({ branchName, runner = runGh, env = process.env } =
653
654
  }
654
655
  }
655
656
 
657
+ const WRAPPERS = new Set('sudo doas env command builtin exec nohup time nice ionice setsid stdbuf xargs'.split(' '));
658
+ const WRAPPER_FLAGS = new Map([
659
+ ['sudo', new Set(['-u', '-g', '-h', '-p', '-r', '-t', '-C'])], ['doas', new Set(['-u'])],
660
+ ['env', new Set(['-u', '-C', '-S'])], ['nice', new Set(['-n'])], ['ionice', new Set(['-c', '-n', '-p'])],
661
+ ['xargs', new Set(['-n', '-P', '-I', '-L', '-s', '-d'])], ['stdbuf', new Set(['-i', '-o', '-e'])],
662
+ ]);
663
+ const CTRL_KW = new Set('then else elif do while until if { ('.split(' '));
664
+ const ASSIGN_KW = new Set(['export', 'local', 'declare', 'typeset']);
665
+ const UNSET_KW = new Set(['unset', 'remove-variable', 'rv']);
666
+ const READ_FLAGS = new Set(['-p', '-d', '-n', '-N', '-t', '-u']);
667
+ const SH_BINS = new Set(['bash', 'sh', 'zsh', 'dash', 'ksh']);
668
+ const PWSH_BINS = new Set(['powershell', 'pwsh']);
669
+ const PWSH_FLAGS = new Set('-executionpolicy -ep -windowstyle -w -inputformat -if -outputformat -of -configurationname'.split(' '));
670
+ const FIND_ARG_FLAGS = new Set('-name -iname -path -ipath -wholename -iwholename -regex -iregex -lname -ilname -samefile -type -xtype -maxdepth -mindepth -perm -links -user -group -uid -gid -size -inum -amin -atime -cmin -ctime -mmin -mtime -newer -anewer -cnewer -printf -fprintf -fprint -fls'.split(' '));
671
+ const RI_VAL_FLAGS = new Set(['-include', '-exclude', '-filter', '-stream', '-credential']);
672
+ const RI_PATH_FLAGS = new Set(['-path', '-literalpath', '-lp']);
673
+ const GIT_ARG_FLAGS = new Set(['-c', '-C', '--git-dir', '--work-tree', '--namespace', '--exec-path', '--super-prefix']);
674
+ const DEL_EXEC_BINS = new Set('rm unlink shred rmdir rd del erase remove-item ri'.split(' '));
675
+ const DIR_DEL_BINS = new Set(['rmdir', 'rd', 'del', 'erase']);
676
+ const WIN_SW_RE = /^(?:\/(?:s|q|f|p|a(?::?[a-z-]+)?))+$/i;
677
+ const WIN_S_RE = /\/s(?:$|\/|:)/i;
678
+ const PWSH_REC_RE = /^-(?:r|rec|recur|recurs|recurse)(?::\$?true)?$/i;
679
+ const VAR_ONLY_RE = /^(?:\$\{([A-Za-z_]\w*)(?::-)?\}|\$(?:env:)?([A-Za-z_]\w*)|%([A-Za-z_]\w*)%)([/\\*]*)$/i;
680
+ const VAR_HEAD_RE = /^(?:\$\{([A-Za-z_]\w*)\}|\$([A-Za-z_]\w*)|%([A-Za-z_]\w*)%)[/\\]/;
681
+
682
+ function fmtInput(cmd, max = 20000) {
683
+ return (Array.isArray(cmd) ? String(normalizeCommandValue(cmd)) : String(cmd || '')).slice(0, max).trim();
684
+ }
685
+
686
+ function isEscSlash(s, i) { return s[i] === '\\' && s[i + 1] === '\\'; }
687
+ function isWinQuotedSpan(s, qs) { return qs >= 0 && /^(?:[A-Za-z]:\\|\\\\)/.test(s.slice(qs + 1, qs + 5)); }
688
+ function isEscQuote(s, i, qs) {
689
+ return s[i] === '\\' && s[i + 1] === '"' && !isWinQuotedSpan(s, qs) && s.indexOf('"', i + 2) !== -1;
690
+ }
691
+ function isWinPathBefore(s, i) {
692
+ let k = i - 1;
693
+ while (k >= 0 && !/[\s;|&"']/.test(s[k])) {
694
+ if (s[k] === '\\' || (s[k] === ':' && k > 0 && /[A-Za-z]/.test(s[k - 1]))) return true;
695
+ k -= 1;
696
+ }
697
+ return false;
698
+ }
699
+
700
+ function isEscUnquoted(s, i) {
701
+ return s[i] === '\\' && i + 1 < s.length && /[;&|"' ]/.test(s[i + 1]) && !isWinPathBefore(s, i);
702
+ }
703
+
704
+ function stepQuotedSeg(s, i, q, qs) {
705
+ if (q === '"' && (isEscSlash(s, i) || isEscQuote(s, i, qs))) return { n: i + 1, q, qs };
706
+ return s[i] === q ? { n: i, q: null, qs: -1 } : { n: i, q, qs };
707
+ }
708
+
709
+ function delimLen(s, i) {
710
+ const c = s[i];
711
+ if (c === '\r' || c === '\n' || c === ';') return 1;
712
+ if (c === '&' || c === '|') return s[i + 1] === c ? 2 : 1;
713
+ return 0;
714
+ }
715
+
716
+ function splitSegs(cmd) {
717
+ const s = String(cmd || '');
718
+ const out = [];
719
+ let start = 0;
720
+ let q = null;
721
+ let qs = -1;
722
+ for (let i = 0; i < s.length; i += 1) {
723
+ if (q) { const st = stepQuotedSeg(s, i, q, qs); i = st.n; q = st.q; qs = st.qs; continue; }
724
+ if (isEscUnquoted(s, i)) { i += 1; continue; }
725
+ if (s[i] === '"' || s[i] === '\'') { q = s[i]; qs = i; continue; }
726
+ const dl = delimLen(s, i);
727
+ if (dl > 0) { out.push(s.slice(start, i)); i += dl - 1; start = i + 1; }
728
+ }
729
+ out.push(s.slice(start));
730
+ return out.map((x) => x.trim()).filter(Boolean);
731
+ }
732
+
733
+ function stepQuotedTok(s, i, b) {
734
+ if (b.q === '"' && isEscSlash(s, i)) { b.v += '\\'; return i + 1; }
735
+ if (b.q === '"' && isEscQuote(s, i, b.qs)) { b.v += '"'; return i + 1; }
736
+ if (s[i] === b.q) { b.q = null; b.qs = -1; return i; }
737
+ b.v += s[i];
738
+ return i;
739
+ }
740
+
741
+ function stepUnquotedTok(s, i, b) {
742
+ const c = s[i];
743
+ if (c === '"' || c === '\'') { b.q = c; b.qs = i; b.hq = true; if (c !== '\'') b.sq = false; return i; }
744
+ b.sq = false;
745
+ if (isEscUnquoted(s, i)) { b.v += s[i + 1]; return i + 1; }
746
+ b.v += c;
747
+ return i;
748
+ }
749
+
750
+ function flushTok(s, end, b, out) {
751
+ if (b.rs === -1) return;
752
+ out.push({ raw: s.slice(b.rs, end), value: b.v, hasQuotes: b.hq, singleQuoted: b.hq && b.sq });
753
+ b.rs = -1; b.v = ''; b.hq = false; b.sq = true;
754
+ }
755
+
756
+ function tokenize(seg) {
757
+ const s = String(seg || '').trim();
758
+ const out = [];
759
+ const b = { rs: -1, v: '', q: null, qs: -1, hq: false, sq: true };
760
+ for (let i = 0; i < s.length; i += 1) {
761
+ if (b.q) { i = stepQuotedTok(s, i, b); continue; }
762
+ if (/\s/.test(s[i])) { flushTok(s, i, b, out); continue; }
763
+ if (b.rs === -1) b.rs = i;
764
+ i = stepUnquotedTok(s, i, b);
765
+ }
766
+ flushTok(s, s.length, b, out);
767
+ return out;
768
+ }
769
+
770
+ function readSubAt(s, i) {
771
+ if (s[i] === '$' && s[i + 1] === '(') {
772
+ let d = 1;
773
+ let c = i + 2;
774
+ while (c < s.length && d > 0) { if (s[c] === '(') d += 1; else if (s[c] === ')') d -= 1; c += 1; }
775
+ return d === 0 ? { inner: s.slice(i + 2, c - 1).trim(), n: i + 1 } : null;
776
+ }
777
+ if (s[i] === '`') {
778
+ const end = s.indexOf('`', i + 1);
779
+ if (end !== -1) return { inner: s.slice(i + 1, end).trim(), n: end };
780
+ }
781
+ return null;
782
+ }
783
+
784
+ function stepSubQuote(c, i, q, qs) {
785
+ if (q === '\'') return c === '\'' ? { q: null, qs: -1 } : { q, qs };
786
+ if (c === '\'' && !q) return { q: '\'', qs: i };
787
+ if (c === '"') return q === '"' ? { q: null, qs: -1 } : { q: '"', qs: i };
788
+ return { q, qs };
789
+ }
790
+
791
+ function extractSubs(cmd) {
792
+ const s = String(cmd || '');
793
+ const out = [];
794
+ let q = null;
795
+ let qs = -1;
796
+ for (let i = 0; i < s.length; i += 1) {
797
+ if (q === '"' && (isEscSlash(s, i) || isEscQuote(s, i, qs))) { i += 1; continue; }
798
+ const wasSq = q === '\'';
799
+ const nxt = stepSubQuote(s[i], i, q, qs);
800
+ q = nxt.q;
801
+ qs = nxt.qs;
802
+ if (wasSq || q === '\'') continue;
803
+ const sub = readSubAt(s, i);
804
+ if (sub) { if (sub.inner) out.push(sub.inner); i = sub.n; }
805
+ }
806
+ return out;
807
+ }
808
+
809
+ function normBin(v) {
810
+ return (String(v || '').replace(/^\\/, '').trim().split(/[/\\]/).pop() || '').toLowerCase().replace(/\.exe$/i, '');
811
+ }
812
+
813
+ function bindVar(name, rhs, st) {
814
+ const k = name.toLowerCase();
815
+ const t = String(rhs || '').trim().replace(/^(['"])(.*)\1$/, '$2');
816
+ if (!t || t.toLowerCase() === '$null') { st.empty.add(k); st.bound.delete(k); } else { st.bound.add(k); st.empty.delete(k); }
817
+ }
818
+
819
+ function recAssign(txt, st) {
820
+ const eq = txt.indexOf('=');
821
+ if (eq <= 0) return false;
822
+ const name = txt.slice(0, eq).trim().replace(/^\$(?:env:)?/i, '');
823
+ if (!/^[A-Za-z_]\w*$/.test(name)) return false;
824
+ bindVar(name, txt.slice(eq + 1), st);
825
+ return true;
826
+ }
827
+
828
+ function recPwshAssign(toks, st) {
829
+ if (toks.length < 2 || toks[1].value !== '=') return false;
830
+ const name = toks[0].value.replace(/^\$(?:env:)?/i, '');
831
+ if (!/^[A-Za-z_]\w*$/.test(name)) return false;
832
+ bindVar(name, toks[2]?.raw || '', st);
833
+ return true;
834
+ }
835
+
836
+ function bindRead(toks, st) {
837
+ let any = false;
838
+ for (let i = 1; i < toks.length; i += 1) {
839
+ const v = toks[i].value;
840
+ if (READ_FLAGS.has(v)) { i += 1; continue; }
841
+ let target = '';
842
+ if (v === '-a') target = toks[++i]?.value || '';
843
+ else if (!v.startsWith('-')) target = v;
844
+ if (target && /^[A-Za-z_]\w*$/.test(target)) { bindVar(target, '1', st); any = true; }
845
+ }
846
+ if (!any) bindVar('reply', '1', st);
847
+ }
848
+
849
+ function bindUnset(toks, st) {
850
+ for (const t of toks.slice(1)) {
851
+ if (!t.value.startsWith('-')) bindVar(t.value.replace(/^\$(?:env:)?/i, ''), '', st);
852
+ }
853
+ }
854
+
855
+ function updateBuiltinState(toks, st) {
856
+ if (toks.length === 0 || recPwshAssign(toks, st)) return true;
857
+ const h = toks[0].value.toLowerCase();
858
+ if (h === 'for' && toks[1] && /^[A-Za-z_]\w*$/.test(toks[1].value)) { bindVar(toks[1].value, '1', st); return true; }
859
+ if (h === 'read') { bindRead(toks, st); return true; }
860
+ if (ASSIGN_KW.has(h)) { for (const t of toks.slice(1)) recAssign(t.value, st); return true; }
861
+ if (h === 'set' && toks[1] && recAssign(toks[1].value, st)) return true;
862
+ if (UNSET_KW.has(h)) { bindUnset(toks, st); return true; }
863
+ return false;
864
+ }
865
+
866
+ function stepEnvOpt(toks, c, st) {
867
+ const cur = toks[c].value;
868
+ if (recAssign(cur, st)) return c + 1;
869
+ if (cur === '-u' && c + 1 < toks.length) { bindVar(toks[c + 1].value, '', st); return c + 2; }
870
+ return -1;
871
+ }
872
+
873
+ function skipWrapperOpts(bin, toks, start, st) {
874
+ const twoArg = WRAPPER_FLAGS.get(bin);
875
+ let c = start;
876
+ while (c < toks.length) {
877
+ const cur = toks[c].value;
878
+ if (cur === '--') return c + 1;
879
+ if (bin === 'env') { const nxt = stepEnvOpt(toks, c, st); if (nxt !== -1) { c = nxt; continue; } }
880
+ if (!cur.startsWith('-')) break;
881
+ c += twoArg?.has(cur) && c + 1 < toks.length ? 2 : 1;
882
+ }
883
+ return c;
884
+ }
885
+
886
+ function stripPrefixes(toks, st) {
887
+ let i = 0;
888
+ while (i < toks.length) {
889
+ const w = toks[i].value;
890
+ if (CTRL_KW.has(w.toLowerCase()) || (/^\$?(?:env:)?[A-Za-z_]\w*=/i.test(toks[i].raw) && recAssign(w, st))) { i += 1; continue; }
891
+ const bin = normBin(w);
892
+ if (!WRAPPERS.has(bin)) break;
893
+ i = skipWrapperOpts(bin, toks, i + 1, st);
894
+ }
895
+ return toks.slice(i);
896
+ }
897
+
898
+ function joinPayload(args) {
899
+ if (args.length === 0) return '';
900
+ return args.length === 1 ? args[0].value.trim() : args.map((t) => t.raw).join(' ').trim();
901
+ }
902
+
903
+ function unwrapCmd(args) {
904
+ for (let i = 0; i < args.length; i += 1) {
905
+ const raw = args[i].value;
906
+ const lo = raw.toLowerCase();
907
+ if (/^\/[abd-jl-z]*[ck]+$/i.test(lo)) return joinPayload(args.slice(i + 1));
908
+ const m = /^\/[abd-jl-z]*[ck]+:?([\s\S]+)$/i.exec(raw);
909
+ if (m && !/^[a-z]+$/i.test(m[1])) { const t = joinPayload(args.slice(i + 1)); return t ? `${m[1]} ${t}` : m[1].trim(); }
910
+ if (!lo.startsWith('/')) break;
911
+ }
912
+ return null;
913
+ }
914
+
915
+ function unwrapPwsh(args) {
916
+ for (let i = 0; i < args.length; i += 1) {
917
+ const lo = args[i].value.toLowerCase();
918
+ if (lo === '-command' || lo === '-c') return joinPayload(args.slice(i + 1));
919
+ if (lo === '-file' || lo === '-f' || lo.startsWith('-enc')) return null;
920
+ if (PWSH_FLAGS.has(lo)) { i += 1; continue; }
921
+ if (!lo.startsWith('-')) return joinPayload(args.slice(i));
922
+ }
923
+ return null;
924
+ }
925
+
926
+ function unwrapSh(args) {
927
+ for (let i = 0; i < args.length; i += 1) {
928
+ const v = args[i].value;
929
+ if ((v === '-o' || v === '+o') && i + 1 < args.length) { i += 1; continue; }
930
+ if (/^-[A-ABD-Za-bd-z]*c[A-Za-z]*$/.test(v) && i + 1 < args.length) return args[i + 1].value.trim();
931
+ if (!v.startsWith('-') && !v.startsWith('+')) break;
932
+ }
933
+ return null;
934
+ }
935
+
936
+ function unwrapShell(bin, args) {
937
+ if (bin === 'cmd') return unwrapCmd(args);
938
+ if (PWSH_BINS.has(bin)) return unwrapPwsh(args);
939
+ return SH_BINS.has(bin) ? unwrapSh(args) : null;
940
+ }
941
+
942
+ function isBadTarget(tok, st) {
943
+ if (!tok) return false;
944
+ if (tok.hasQuotes && /^[/\\]*$/.test(tok.value)) return true;
945
+ if (tok.singleQuoted) return false;
946
+ const m1 = VAR_ONLY_RE.exec(tok.value);
947
+ if (m1) { const k = (m1[1] || m1[2] || m1[3] || '').toLowerCase(); return Boolean(k) && (!st.bound.has(k) || st.empty.has(k)); }
948
+ const m2 = VAR_HEAD_RE.exec(tok.value);
949
+ if (m2) { const k = (m2[1] || m2[2] || m2[3] || '').toLowerCase(); return Boolean(k) && st.empty.has(k); }
950
+ return false;
951
+ }
952
+
953
+ function applyRmFlag(v, f) {
954
+ if (v === '--recursive') f.r = true;
955
+ else if (v === '--force') f.f = true;
956
+ else if (!v.startsWith('--')) { if (/[rR]/.test(v)) f.r = true; if (/f/.test(v)) f.f = true; }
957
+ }
958
+
959
+ function checkRm(args, st) {
960
+ const f = { r: false, f: false };
961
+ let dd = false;
962
+ for (const t of args) {
963
+ const v = t.value;
964
+ if (!dd && v === '--') { dd = true; continue; }
965
+ if (!dd && /^-(?:recurse)(?::\$?true)?$/i.test(v)) return true;
966
+ if (!dd && v.startsWith('-') && v.length > 1 && !v.startsWith('-$')) { applyRmFlag(v, f); continue; }
967
+ if (isBadTarget(t, st)) return true;
968
+ }
969
+ return f.r && f.f;
970
+ }
971
+
972
+ function checkFindExec(slice, depth, st) {
973
+ const s = stripPrefixes(slice, st);
974
+ if (s.length === 0) return false;
975
+ const bin = normBin(s[0].value);
976
+ if (DEL_EXEC_BINS.has(bin)) return true;
977
+ const nested = unwrapShell(bin, s.slice(1));
978
+ return Boolean(nested && depth < 4 && evalCmd(nested, depth + 1, st));
979
+ }
980
+
981
+ function findExecEnd(args, start) {
982
+ let end = start;
983
+ while (end < args.length && args[end].value !== ';' && args[end].value !== '+') end += 1;
984
+ return end;
985
+ }
986
+
987
+ function checkFind(args, depth, st) {
988
+ for (let i = 0; i < args.length; i += 1) {
989
+ const lo = args[i].value.toLowerCase();
990
+ if (FIND_ARG_FLAGS.has(lo)) { i += 1; continue; }
991
+ if (lo === '-delete') return true;
992
+ if (lo === '-exec' || lo === '-execdir' || lo === '-ok' || lo === '-okdir') {
993
+ const end = findExecEnd(args, i + 1);
994
+ if (checkFindExec(args.slice(i + 1, end), depth, st)) return true;
995
+ i = end;
996
+ }
997
+ }
998
+ return false;
999
+ }
1000
+
1001
+ function checkDirDel(args, st) {
1002
+ for (const t of args) {
1003
+ const v = t.value;
1004
+ const sw = WIN_SW_RE.test(v);
1005
+ if ((sw && WIN_S_RE.test(v)) || PWSH_REC_RE.test(v)) return true;
1006
+ if (!v.startsWith('-') && !sw && isBadTarget(t, st)) return true;
1007
+ }
1008
+ return false;
1009
+ }
1010
+
1011
+ function checkRemoveItem(args, st) {
1012
+ for (let i = 0; i < args.length; i += 1) {
1013
+ const v = args[i].value;
1014
+ const lo = v.toLowerCase();
1015
+ if (PWSH_REC_RE.test(v)) return true;
1016
+ if (RI_VAL_FLAGS.has(lo)) { i += 1; continue; }
1017
+ if (RI_PATH_FLAGS.has(lo)) { if (isBadTarget(args[++i], st)) return true; continue; }
1018
+ if (!v.startsWith('-') && isBadTarget(args[i], st)) return true;
1019
+ }
1020
+ return false;
1021
+ }
1022
+
1023
+ function applyGitFlag(v, f) {
1024
+ if (v === '--force') f.f = true;
1025
+ else if (v === '--dry-run') f.n = true;
1026
+ else if (!v.startsWith('--')) { if (/f/.test(v)) f.f = true; if (/n/.test(v)) f.n = true; }
1027
+ }
1028
+
1029
+ function checkGitClean(tail, st) {
1030
+ const f = { f: false, n: false };
1031
+ let dd = false;
1032
+ for (let i = 0; i < tail.length; i += 1) {
1033
+ const v = tail[i].value;
1034
+ if (!dd && v === '--') { dd = true; continue; }
1035
+ if (!dd && (v === '-e' || v === '--exclude')) { i += 1; continue; }
1036
+ if (!dd && v.startsWith('-')) { applyGitFlag(v, f); continue; }
1037
+ if (isBadTarget(tail[i], st)) return true;
1038
+ }
1039
+ return f.f && !f.n;
1040
+ }
1041
+
1042
+ function checkGit(args, st) {
1043
+ for (let i = 0; i < args.length; i += 1) {
1044
+ if (GIT_ARG_FLAGS.has(args[i].value)) { i += 1; continue; }
1045
+ if (!args[i].value.startsWith('-')) {
1046
+ return args[i].value.toLowerCase() === 'clean' && checkGitClean(args.slice(i + 1), st);
1047
+ }
1048
+ }
1049
+ return false;
1050
+ }
1051
+
1052
+ function evalBin(bin, args, depth, st) {
1053
+ if (bin === 'rm') return checkRm(args, st);
1054
+ if (bin === 'find') return checkFind(args, depth, st);
1055
+ if (DIR_DEL_BINS.has(bin)) return checkDirDel(args, st);
1056
+ if (bin === 'remove-item' || bin === 'ri') return checkRemoveItem(args, st);
1057
+ if (bin === 'git') return checkGit(args, st);
1058
+ return (bin === 'unlink' || bin === 'shred') && args.some((t) => !t.value.startsWith('-') && isBadTarget(t, st));
1059
+ }
1060
+
1061
+ function evalSeg(seg, depth, st) {
1062
+ const raw = tokenize(seg);
1063
+ if (raw.length === 0 || updateBuiltinState(raw, st)) return false;
1064
+ const toks = stripPrefixes(raw, st);
1065
+ if (toks.length === 0 || updateBuiltinState(toks, st)) return false;
1066
+ const bin = normBin(toks[0].value);
1067
+ const args = toks.slice(1);
1068
+ const nested = unwrapShell(bin, args);
1069
+ if (nested !== null && depth < 4) return evalCmd(nested, depth + 1, st);
1070
+ return evalBin(bin, args, depth, st);
1071
+ }
1072
+
1073
+ function evalCmd(cmd, depth, parent) {
1074
+ const raw = fmtInput(cmd, 20000);
1075
+ if (!raw) return false;
1076
+ const st = { bound: new Set(parent?.bound || []), empty: new Set(parent?.empty || []) };
1077
+ for (const seg of splitSegs(raw)) {
1078
+ if (evalSeg(seg, depth, st)) return true;
1079
+ }
1080
+ return depth < 4 && extractSubs(raw).some((sub) => evalCmd(sub, depth + 1, st));
1081
+ }
1082
+
1083
+ function isDestructiveDeleteCommand(command) {
1084
+ return evalCmd(command, 0, null);
1085
+ }
1086
+
656
1087
  function classifyCommand(command) {
657
- const text = String(command || '').trim();
658
- const workflowRunMatch = text.match(/\bgh\s+workflow\s+run\s+([^\s]+)/i);
659
- const refMatch = text.match(/(?:--ref|-r)\s+([^\s]+)/i);
1088
+ const text = fmtInput(command, 100000);
1089
+ const workflowRunMatch = /\bgh\s+workflow\s+run\s+([^\s]+)/i.exec(text);
1090
+ const refMatch = /(?:--ref|-r)\s+([^\s]+)/i.exec(text);
660
1091
  const fieldArgs = [...text.matchAll(/(?:--field|-f)\s+([A-Za-z0-9_.-]+)=([^\s]+)/gi)]
661
1092
  .map((match) => ({ name: match[1], value: match[2] }));
662
1093
  return {
@@ -670,6 +1101,7 @@ function classifyCommand(command) {
670
1101
  isPublish: /\b(?:npm|yarn|pnpm)\s+publish\b/i.test(text),
671
1102
  isReleaseCreate: /\bgh\s+release\s+create\b/i.test(text),
672
1103
  isTagCreate: /\bgit\s+tag\b/i.test(text),
1104
+ isDestructiveDelete: isDestructiveDeleteCommand(command),
673
1105
  };
674
1106
  }
675
1107
 
@@ -991,6 +1423,7 @@ module.exports = {
991
1423
  assertSafeGitObjectId,
992
1424
  gitVerifyRef,
993
1425
  isSafeBranchName,
1426
+ isDestructiveDeleteCommand,
994
1427
  isSafeGitObjectId,
995
1428
  isSafeGitRevision,
996
1429
  isHeadReachableFrom,
@@ -89,6 +89,8 @@ function recordOverride(params = {}) {
89
89
 
90
90
  try {
91
91
  return recordAuditEvent({
92
+ ...require('./project-identity').projectForRecord(params),
93
+ feedbackDir: params.feedbackDir,
92
94
  toolName: OVERRIDE_TOOL_NAME,
93
95
  toolInput: { gateId, source: override.source },
94
96
  decision: OVERRIDE_DECISION,