tianshu-harness 3.23.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/LICENSE +189 -0
- package/README.en.md +1066 -0
- package/README.ja.md +1214 -0
- package/README.ko.md +1216 -0
- package/README.md +309 -0
- package/completions/rivet.bash +118 -0
- package/completions/rivet.fish +110 -0
- package/completions/rivet.ps1 +230 -0
- package/completions/rivet.zsh +187 -0
- package/dist/account-OAEKORZE.js +47 -0
- package/dist/account-login-V6FOLHJR.js +65 -0
- package/dist/account-status-KHNPPAFL.js +23 -0
- package/dist/agent/worker-process/child.js +407 -0
- package/dist/browser-cli-FLNY5ZHI.js +19 -0
- package/dist/browser-readiness-LWVGSBD5.js +12 -0
- package/dist/build-backends-5KXKR2S4.js +13 -0
- package/dist/build-options-66Y4ZE7C.js +9 -0
- package/dist/bundled-skills/brainstorming/SKILL.md +139 -0
- package/dist/bundled-skills/visual-acceptance/SKILL.md +64 -0
- package/dist/chain-7MAMFXZ3.js +10 -0
- package/dist/checkpoint-MND4DUIX.js +33 -0
- package/dist/chunk-2E6CK2RC.js +392 -0
- package/dist/chunk-2EBWGAXD.js +51 -0
- package/dist/chunk-2HDP7RMR.js +119 -0
- package/dist/chunk-2HKD2UFM.js +1000 -0
- package/dist/chunk-2VYRLULP.js +51 -0
- package/dist/chunk-2XN7PM4N.js +125 -0
- package/dist/chunk-35H7GVNR.js +66 -0
- package/dist/chunk-3C3R7JXY.js +77 -0
- package/dist/chunk-3VGD2FXB.js +118 -0
- package/dist/chunk-424AP7FM.js +534 -0
- package/dist/chunk-4J5TZGOE.js +3707 -0
- package/dist/chunk-4QJ3Y5JM.js +898 -0
- package/dist/chunk-4U2ET7ZY.js +1326 -0
- package/dist/chunk-4XPFLICE.js +876 -0
- package/dist/chunk-5B2OCU5P.js +31707 -0
- package/dist/chunk-5GGOGLSN.js +73 -0
- package/dist/chunk-5JRZPLI6.js +251 -0
- package/dist/chunk-5TQ3JYBU.js +397 -0
- package/dist/chunk-66JPZSGX.js +55 -0
- package/dist/chunk-6HSVXHCZ.js +764 -0
- package/dist/chunk-6S5FPUS7.js +21 -0
- package/dist/chunk-722LQO64.js +131 -0
- package/dist/chunk-73NJ7IT7.js +354 -0
- package/dist/chunk-7FW3I7WC.js +95 -0
- package/dist/chunk-7KUCBNLB.js +173 -0
- package/dist/chunk-7RDOV3DF.js +201 -0
- package/dist/chunk-A5MNH4ER.js +79 -0
- package/dist/chunk-ADIVZ2D5.js +15 -0
- package/dist/chunk-AE3P3F6W.js +366 -0
- package/dist/chunk-AERM3VGP.js +280 -0
- package/dist/chunk-AEWHC4WM.js +246 -0
- package/dist/chunk-AOVQ7VIF.js +169 -0
- package/dist/chunk-AOYHP3WI.js +12411 -0
- package/dist/chunk-B3YEBABJ.js +7160 -0
- package/dist/chunk-BCQXEZPJ.js +154 -0
- package/dist/chunk-BKTQAYO2.js +418 -0
- package/dist/chunk-BSECIPAQ.js +80 -0
- package/dist/chunk-BUIMGNDD.js +52 -0
- package/dist/chunk-BXHV3GSB.js +10320 -0
- package/dist/chunk-C6ZVZCPP.js +139 -0
- package/dist/chunk-CEZNQVWM.js +82 -0
- package/dist/chunk-CGFZGR7G.js +1492 -0
- package/dist/chunk-CGOADM2X.js +337 -0
- package/dist/chunk-CI4R6P2B.js +24 -0
- package/dist/chunk-D2TCGRSX.js +73 -0
- package/dist/chunk-D4PTYFOG.js +154 -0
- package/dist/chunk-D54ZWG4T.js +717 -0
- package/dist/chunk-DEBI37QB.js +145 -0
- package/dist/chunk-DWROHPXP.js +1051 -0
- package/dist/chunk-DZ6UOJ5D.js +92 -0
- package/dist/chunk-EBJTVRQN.js +81 -0
- package/dist/chunk-EGEI2RQA.js +1167 -0
- package/dist/chunk-EHHUASO5.js +1305 -0
- package/dist/chunk-EPKTIOED.js +41 -0
- package/dist/chunk-ER5JW2QZ.js +5681 -0
- package/dist/chunk-ETHFACAB.js +315 -0
- package/dist/chunk-EXUE5W2F.js +112 -0
- package/dist/chunk-EXXICUIW.js +73 -0
- package/dist/chunk-FFQSZJOO.js +169 -0
- package/dist/chunk-FHFKPGDO.js +85 -0
- package/dist/chunk-FW3QKMFX.js +158 -0
- package/dist/chunk-GD4ZNZ7W.js +30 -0
- package/dist/chunk-GHVMWF2I.js +581 -0
- package/dist/chunk-GMKAXSYQ.js +297 -0
- package/dist/chunk-HBVF6BWO.js +325 -0
- package/dist/chunk-HV4YGVMS.js +379 -0
- package/dist/chunk-ILBCKAV6.js +89 -0
- package/dist/chunk-J4U4AW46.js +440 -0
- package/dist/chunk-J6ESSM47.js +1791 -0
- package/dist/chunk-JBZHIC6T.js +2309 -0
- package/dist/chunk-JCFWOULR.js +245 -0
- package/dist/chunk-JRF5L6OD.js +131 -0
- package/dist/chunk-JSS75KCG.js +2014 -0
- package/dist/chunk-JSXWIWWJ.js +225 -0
- package/dist/chunk-JYV7I2QH.js +98 -0
- package/dist/chunk-KIOXTQQL.js +1596 -0
- package/dist/chunk-KWVTXT5B.js +89 -0
- package/dist/chunk-KX22RD6R.js +33 -0
- package/dist/chunk-LA6IPTGH.js +709 -0
- package/dist/chunk-LH5VCGLB.js +1796 -0
- package/dist/chunk-LQQ6XJ2Y.js +269 -0
- package/dist/chunk-MJQ55WZZ.js +65 -0
- package/dist/chunk-ML3UKMH3.js +40 -0
- package/dist/chunk-MOZPLHSU.js +5526 -0
- package/dist/chunk-NGEWJ4DF.js +89 -0
- package/dist/chunk-NH6VIOAR.js +211 -0
- package/dist/chunk-O5VZQKCB.js +26106 -0
- package/dist/chunk-OHSV42QB.js +748 -0
- package/dist/chunk-OO3TAHO5.js +4070 -0
- package/dist/chunk-OTNHSAGN.js +38282 -0
- package/dist/chunk-OUWAC7AQ.js +442 -0
- package/dist/chunk-OXMIV4WE.js +270 -0
- package/dist/chunk-P5KJURUR.js +229 -0
- package/dist/chunk-P6GJOVO6.js +307 -0
- package/dist/chunk-QARAGUXX.js +23 -0
- package/dist/chunk-R43HJCDX.js +2711 -0
- package/dist/chunk-RAXBAWRN.js +210 -0
- package/dist/chunk-RK3JHWPT.js +39 -0
- package/dist/chunk-RWA23GMM.js +24 -0
- package/dist/chunk-S4K4L6IM.js +179 -0
- package/dist/chunk-SAXK6LVF.js +124 -0
- package/dist/chunk-SEPGEJNK.js +1607 -0
- package/dist/chunk-SUJERP5I.js +285 -0
- package/dist/chunk-T3ED6BY2.js +913 -0
- package/dist/chunk-THKDVSEC.js +90 -0
- package/dist/chunk-TI4GSEL5.js +52 -0
- package/dist/chunk-TPI73L57.js +164 -0
- package/dist/chunk-TVHW77C7.js +338 -0
- package/dist/chunk-TWNHOSDT.js +1073 -0
- package/dist/chunk-UFMN76QD.js +347 -0
- package/dist/chunk-UHGLFRZE.js +205 -0
- package/dist/chunk-UTZYPKBF.js +15231 -0
- package/dist/chunk-UXNLELW6.js +25 -0
- package/dist/chunk-UXXS53EA.js +166 -0
- package/dist/chunk-V5DHFGI7.js +171 -0
- package/dist/chunk-V5YIPMHV.js +2353 -0
- package/dist/chunk-WMUWEO2C.js +754 -0
- package/dist/chunk-WOE3D7JM.js +945 -0
- package/dist/chunk-X2IK5LVR.js +2592 -0
- package/dist/chunk-XU2YXCDL.js +459 -0
- package/dist/chunk-YJG5HIX5.js +203 -0
- package/dist/chunk-Z3QE7TZM.js +72 -0
- package/dist/chunk-Z5Z3JHJY.js +64 -0
- package/dist/chunk-ZDIFBJFT.js +168 -0
- package/dist/chunk-ZGGCEXDC.js +176 -0
- package/dist/chunk-ZMZCZNKU.js +263 -0
- package/dist/chunk-ZNC5T65N.js +17 -0
- package/dist/chunk-ZO3I3A7O.js +308 -0
- package/dist/chunk-ZQKXBUB7.js +217 -0
- package/dist/chunk-ZTRINFM2.js +78 -0
- package/dist/chunk-ZU7JZCVP.js +193 -0
- package/dist/chunk-ZZAWNALS.js +350 -0
- package/dist/cli/entry.js +54 -0
- package/dist/connector-L5QQTR6Y.js +26 -0
- package/dist/context-62DC6EC3.js +31 -0
- package/dist/council-convene-NJWPNBDU.js +46 -0
- package/dist/create-agent-config-ODSQWNVC.js +55 -0
- package/dist/default-registry-2PU3BTAU.js +68 -0
- package/dist/deliver-task-KONV4C4M.js +57 -0
- package/dist/delivery-gate-v2-F2YVMVGK.js +27 -0
- package/dist/domain-knowledge-store-DDZ3F4J7.js +11 -0
- package/dist/fetch-core-ZPPYDSZH.js +14 -0
- package/dist/galaxy-K72BBDQN.js +91 -0
- package/dist/goal-criteria-SCALAU2D.js +141 -0
- package/dist/goal-persist-XWY2GDQX.js +19 -0
- package/dist/goal-tracker-FXMJ2GVK.js +11 -0
- package/dist/headless-LSB6I7PT.js +162 -0
- package/dist/headless-coordinator-VDPDMVUT.js +90 -0
- package/dist/inject-U55SMB6A.js +39 -0
- package/dist/login-flow-CD4ZGXOC.js +59 -0
- package/dist/logs-cli-SQVYFMMN.js +283 -0
- package/dist/loop-ULZYBDA3.js +76 -0
- package/dist/main.js +4064 -0
- package/dist/manager-ROZBCWPA.js +171 -0
- package/dist/manager-Z7XFFUOM.js +10670 -0
- package/dist/meridian-indexer-ZIW363L7.js +21 -0
- package/dist/native-resolver-PN34UIVV.js +13 -0
- package/dist/node_modules/better-sqlite3/lib/database.js +90 -0
- package/dist/node_modules/better-sqlite3/lib/index.js +3 -0
- package/dist/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
- package/dist/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
- package/dist/node_modules/better-sqlite3/lib/methods/function.js +31 -0
- package/dist/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
- package/dist/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
- package/dist/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
- package/dist/node_modules/better-sqlite3/lib/methods/table.js +189 -0
- package/dist/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
- package/dist/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
- package/dist/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
- package/dist/node_modules/better-sqlite3/lib/util.js +12 -0
- package/dist/node_modules/better-sqlite3/package.json +59 -0
- package/dist/ownership-ledger-E3WIEKPL.js +9 -0
- package/dist/package.json +3 -0
- package/dist/path-grants-XRRXHXG7.js +40 -0
- package/dist/paths-LVV5IMQN.js +49 -0
- package/dist/plan-fact-anchors-LMVQZCW5.js +13 -0
- package/dist/plan-store-ODLTTPFB.js +17 -0
- package/dist/plan-templates-5FPFBOL6.js +109 -0
- package/dist/plugin-loader-ZZKX7ZE6.js +22 -0
- package/dist/prefix-budget-62OV5HQC.js +13 -0
- package/dist/project-trust-5WS5MOMU.js +31 -0
- package/dist/provider-cli-ALDQXIT7.js +37 -0
- package/dist/providers-XQYTAVPK.js +11 -0
- package/dist/proxy-resolver-V2Y6534D.js +15 -0
- package/dist/recovery-cli-KPGY6FY3.js +106 -0
- package/dist/review-discipline-MNSYCST5.js +55 -0
- package/dist/review-router-BVQZW3MX.js +18 -0
- package/dist/seed-capsules/seed-capsule-attack-methodology.md +62 -0
- package/dist/seed-capsules/seed-capsule-changgeng.md +31 -0
- package/dist/seed-capsules/seed-capsule-design-aesthetics.md +38 -0
- package/dist/seed-capsules/seed-capsule-diagnostic-ladder.md +54 -0
- package/dist/seed-capsules/seed-capsule-fu.md +39 -0
- package/dist/seed-capsules/seed-capsule-huagai.md +73 -0
- package/dist/seed-capsules/seed-capsule-kaiyang.md +65 -0
- package/dist/seed-capsules/seed-capsule-knowledge-work.md +40 -0
- package/dist/seed-capsules/seed-capsule-tanlang.md +47 -0
- package/dist/seed-capsules/seed-capsule-tianfu.md +23 -0
- package/dist/seed-capsules/seed-capsule-tianliang.md +63 -0
- package/dist/seed-capsules/seed-capsule-tianquan.md +32 -0
- package/dist/seed-capsules/seed-capsule-tianxuan-ccr.md +22 -0
- package/dist/seed-capsules/seed-capsule-tianxuan.md +64 -0
- package/dist/seed-capsules/seed-capsule-yaoguang.md +87 -0
- package/dist/serve-X2R2UTLF.js +170 -0
- package/dist/serve-agent-KHSU6RVV.js +965 -0
- package/dist/session-persist-HUUC772H.js +37 -0
- package/dist/session-registry-6XUD5C4Y.js +15 -0
- package/dist/skill-loader-CK3RMO47.js +48 -0
- package/dist/skills/cli-harness-sop.md +207 -0
- package/dist/spawn-git-4HFU65AH.js +29 -0
- package/dist/sse-EYUTBWUK.js +512 -0
- package/dist/starflow-NOFBMPFU.js +30 -0
- package/dist/streamableHttp-V67CNJMO.js +447 -0
- package/dist/task-contract-6XHBNJQK.js +32 -0
- package/dist/task-ledger-3K4TJIER.js +9 -0
- package/dist/team-orchestrate-S6NHZP7X.js +64 -0
- package/dist/title-extract-QX4XGCYN.js +50 -0
- package/dist/todo-QDXGRZZP.js +31 -0
- package/dist/todo-store-V3TTO5AH.js +12 -0
- package/dist/tool-preset-LU5BYEDZ.js +23 -0
- package/dist/tool-tiers-GD742YBN.js +23 -0
- package/dist/turndown.es-OI55K6C3.js +17373 -0
- package/dist/verification-attribution-EKG4CNUV.js +13 -0
- package/dist/volatile-git-MBTST7RA.js +15 -0
- package/dist/wave-checkpoint-XLIIHXQA.js +30 -0
- package/dist/web-cli-DUG4I35O.js +233 -0
- package/dist/web-search-3IK542AA.js +34 -0
- package/dist/workers/cpu-worker.js +45 -0
- package/dist/workflow-runner-HX7UBAYG.js +297 -0
- package/dist/worktree-baseline-O5NCU6M2.js +9 -0
- package/package.json +122 -0
- package/scripts/check-mobile-env.mjs +76 -0
- package/scripts/fetch-native-sqlite.js +392 -0
- package/scripts/prune-installed-wasms.js +45 -0
- package/scripts/tree-sitter-wasm-keep.js +40 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
|
+
import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
runBackendChain
|
|
5
|
+
} from "./chunk-EBJTVRQN.js";
|
|
6
|
+
import "./chunk-BKTQAYO2.js";
|
|
7
|
+
import "./chunk-5GGOGLSN.js";
|
|
8
|
+
export {
|
|
9
|
+
runBackendChain
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
|
+
import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
addToCheckpointIndex,
|
|
5
|
+
checkpointFileForSession,
|
|
6
|
+
createCheckpoint,
|
|
7
|
+
getRollbackPreview,
|
|
8
|
+
listCheckpoints,
|
|
9
|
+
loadCheckpointIndex,
|
|
10
|
+
makeOwnershipGuard,
|
|
11
|
+
pruneOrphanCheckpoints,
|
|
12
|
+
recordAgentTouchedFile,
|
|
13
|
+
recordBashSideEffects,
|
|
14
|
+
removeFromCheckpointIndex,
|
|
15
|
+
rollbackToCheckpoint
|
|
16
|
+
} from "./chunk-HV4YGVMS.js";
|
|
17
|
+
import "./chunk-A5MNH4ER.js";
|
|
18
|
+
import "./chunk-BCQXEZPJ.js";
|
|
19
|
+
import "./chunk-5GGOGLSN.js";
|
|
20
|
+
export {
|
|
21
|
+
addToCheckpointIndex,
|
|
22
|
+
checkpointFileForSession,
|
|
23
|
+
createCheckpoint,
|
|
24
|
+
getRollbackPreview,
|
|
25
|
+
listCheckpoints,
|
|
26
|
+
loadCheckpointIndex,
|
|
27
|
+
makeOwnershipGuard,
|
|
28
|
+
pruneOrphanCheckpoints,
|
|
29
|
+
recordAgentTouchedFile,
|
|
30
|
+
recordBashSideEffects,
|
|
31
|
+
removeFromCheckpointIndex,
|
|
32
|
+
rollbackToCheckpoint
|
|
33
|
+
};
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
|
+
import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
assessImpactedTestCoverage,
|
|
5
|
+
getEffectiveVerifications
|
|
6
|
+
} from "./chunk-ZO3I3A7O.js";
|
|
7
|
+
import {
|
|
8
|
+
spawnGitSync
|
|
9
|
+
} from "./chunk-THKDVSEC.js";
|
|
10
|
+
import {
|
|
11
|
+
init_esm_shims
|
|
12
|
+
} from "./chunk-5GGOGLSN.js";
|
|
13
|
+
|
|
14
|
+
// src/agent/delivery-gate-v2.ts
|
|
15
|
+
init_esm_shims();
|
|
16
|
+
|
|
17
|
+
// src/agent/ownership-health.ts
|
|
18
|
+
init_esm_shims();
|
|
19
|
+
function summarizeOwnershipHealth(input) {
|
|
20
|
+
const owned = new Set(input.ownedFiles);
|
|
21
|
+
const coOwned = new Set(input.coOwnedFiles);
|
|
22
|
+
const external = new Set(input.externalFiles);
|
|
23
|
+
const dirty = new Set(input.dirtyFiles);
|
|
24
|
+
const untrackedDirtyOwned = input.dirtyFiles.filter((f) => owned.has(f)).sort();
|
|
25
|
+
const dirtyCoOwned = input.dirtyFiles.filter((f) => coOwned.has(f)).sort();
|
|
26
|
+
const dirtyExternal = input.dirtyFiles.filter((f) => external.has(f)).sort();
|
|
27
|
+
const cleanOwned = input.ownedFiles.filter((f) => !dirty.has(f)).sort();
|
|
28
|
+
const warningLines = [];
|
|
29
|
+
const infoLines = [];
|
|
30
|
+
for (const f of input.dirtyFiles) {
|
|
31
|
+
if (!owned.has(f) && !coOwned.has(f) && !external.has(f)) {
|
|
32
|
+
warningLines.push(`Dirty file has no ownership classification: ${f}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (dirtyCoOwned.length > 0) {
|
|
36
|
+
infoLines.push(`${dirtyCoOwned.length} co-owned file(s) present. These files are shared with other sessions and require extra caution when committing.`);
|
|
37
|
+
}
|
|
38
|
+
if (untrackedDirtyOwned.length === 0 && dirtyExternal.length > 0 && warningLines.length === 0 && dirtyCoOwned.length === 0) {
|
|
39
|
+
infoLines.push("No current owned dirty files. External dirty files are present and excluded from delivery scope.");
|
|
40
|
+
}
|
|
41
|
+
return { untrackedDirtyOwned, dirtyCoOwned, dirtyExternal, cleanOwned, warningLines, infoLines };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/agent/delivery-gate-v2.ts
|
|
45
|
+
var JUNK_PATH_PREFIXES = [
|
|
46
|
+
".test-tmp/",
|
|
47
|
+
".rivet/",
|
|
48
|
+
"node_modules/",
|
|
49
|
+
".git/",
|
|
50
|
+
"dist/",
|
|
51
|
+
"build/",
|
|
52
|
+
"coverage/",
|
|
53
|
+
"tmp/"
|
|
54
|
+
];
|
|
55
|
+
function isJunkExternalPath(file) {
|
|
56
|
+
return JUNK_PATH_PREFIXES.some((prefix) => file.startsWith(prefix));
|
|
57
|
+
}
|
|
58
|
+
function gitIgnoredSubset(files, cwd) {
|
|
59
|
+
if (files.length === 0) return /* @__PURE__ */ new Set();
|
|
60
|
+
try {
|
|
61
|
+
const r = spawnGitSync(["check-ignore", "--stdin"], {
|
|
62
|
+
cwd,
|
|
63
|
+
input: files.join("\n"),
|
|
64
|
+
encoding: "utf-8",
|
|
65
|
+
timeout: 5e3
|
|
66
|
+
});
|
|
67
|
+
if (r.status !== 0 && r.status !== 1) return /* @__PURE__ */ new Set();
|
|
68
|
+
return new Set(r.stdout.split("\n").filter(Boolean));
|
|
69
|
+
} catch {
|
|
70
|
+
return /* @__PURE__ */ new Set();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function filterExternalNoise(files, cwd) {
|
|
74
|
+
const prefixKept = files.filter((f) => !isJunkExternalPath(f));
|
|
75
|
+
const ignored = cwd ? gitIgnoredSubset(prefixKept, cwd) : /* @__PURE__ */ new Set();
|
|
76
|
+
const kept = prefixKept.filter((f) => !ignored.has(f));
|
|
77
|
+
return { files: kept, noiseCount: files.length - kept.length };
|
|
78
|
+
}
|
|
79
|
+
function buildGateConvergenceHint(gate, depthLayer) {
|
|
80
|
+
const depthSuffix = depthLayer && depthLayer !== "unit" ? `
|
|
81
|
+
[depth=${depthLayer}] \u9A8C\u8BC1\u5FC5\u987B\u8986\u76D6\u8DE8\u6A21\u5757\u8FB9\u754C\uFF0C\u4E0D\u4EC5\u4EC5\u662F\u5355\u51FD\u6570\u884C\u4E3A\u3002` : "";
|
|
82
|
+
if (gate.state === "GREEN") {
|
|
83
|
+
return "\u4EA4\u4ED8\u95E8\u7981 GREEN\uFF1A\u6240\u6709 owned \u6587\u4EF6\u5DF2\u9A8C\u8BC1\u3002\u8BF7\u8F93\u51FA\u6700\u7EC8\u6458\u8981\u5E76\u7ED3\u675F\u56DE\u5408\uFF0C\u4E0D\u518D\u8C03\u7528\u5DE5\u5177\u3002" + depthSuffix;
|
|
84
|
+
}
|
|
85
|
+
if (gate.state === "RED") {
|
|
86
|
+
const lines = [`\u4EA4\u4ED8\u95E8\u7981 RED\uFF1A${gate.blockingReason ?? gate.reason ?? "owned \u6587\u4EF6\u5B58\u5728\u672A\u9A8C\u8BC1\u6216\u5931\u8D25\u9879\u3002"}`];
|
|
87
|
+
lines.push("\u8BF7\u5148\u89E3\u51B3\u963B\u65AD\u9879\u518D\u7EE7\u7EED\uFF1B\u82E5\u65E0\u6CD5\u89E3\u51B3\uFF0C\u660E\u786E\u62A5\u544A\u963B\u65AD\u539F\u56E0\u540E\u7ED3\u675F\u56DE\u5408\u3002");
|
|
88
|
+
if (gate.shortestNextStep) lines.push(`\u65B9\u5411\uFF1A${gate.shortestNextStep}`);
|
|
89
|
+
return lines.join("\n") + depthSuffix;
|
|
90
|
+
}
|
|
91
|
+
if (gate.attributionClass === "module_unverified") {
|
|
92
|
+
return `\u4EA4\u4ED8\u95E8\u7981 YELLOW\uFF08\u6CE2\u53CA\u9762\u672A\u9A8C\u8BC1\uFF09\uFF1A${gate.reason ?? "\u6539\u52A8\u6CE2\u53CA\u7684\u6D4B\u8BD5\u4ECE\u672A\u88AB\u4EFB\u4F55 passed \u9A8C\u8BC1\u8986\u76D6\u3002"}
|
|
93
|
+
\u5F15\u5165\u56DE\u5F52\u662F\u6700\u5E38\u89C1\u7684\u4EA4\u4ED8\u5931\u8D25\u2014\u2014\u8BF7\u8FD0\u884C\u4E0A\u8FF0\u53D7\u6CE2\u53CA\u6D4B\u8BD5\uFF08\u6216\u4E00\u6B21 full-scope \u9A8C\u8BC1\uFF09\u540E\u518D\u4EA4\u4ED8\uFF1Bcommit=true \u4F1A\u88AB\u786C\u62E6\u3002` + depthSuffix;
|
|
94
|
+
}
|
|
95
|
+
if (gate.attributionClass === "no_test_infra") {
|
|
96
|
+
return `\u4EA4\u4ED8\u95E8\u7981 YELLOW\uFF08\u6D4B\u8BD5\u57FA\u7840\u8BBE\u65BD\u7F3A\u5931\uFF09\uFF1A${gate.reason ?? "\u9879\u76EE\u65E0\u53EF\u81EA\u52A8\u68C0\u6D4B\u7684\u6D4B\u8BD5\u6846\u67B6\u3002"}
|
|
97
|
+
|
|
98
|
+
\u4E0D\u8981\u53CD\u590D\u91CD\u8BD5 run_tests\u2014\u2014\u5B83\u6BCF\u6B21\u90FD\u4F1A\u4EE5\u540C\u6837\u539F\u56E0\u53D7\u963B\u3002\u5E94\u5411\u7528\u6237\u62A5\u544A\u5177\u4F53\u7F3A\u5931\u9879\uFF0C\u5E76\u8BE2\u95EE\u662F\u5426\u9700\u8981\u534F\u52A9\u642D\u5EFA\u6D4B\u8BD5\u6846\u67B6\uFF0C\u6216\u7528 bash \u8FD0\u884C\u66FF\u4EE3\u9A8C\u8BC1\u540E\u4EA4\u4ED8\u3002` + depthSuffix;
|
|
99
|
+
}
|
|
100
|
+
return `\u4EA4\u4ED8\u95E8\u7981 YELLOW\uFF1A${gate.reason ?? "\u5B58\u5728\u5916\u90E8\u963B\u585E\uFF0Cowned \u6587\u4EF6\u5DF2\u9A8C\u8BC1\u3002"}
|
|
101
|
+
\u53EF\u5E26\u6761\u4EF6\u4EA4\u4ED8\uFF1A\u8F93\u51FA\u6700\u7EC8\u6458\u8981\u5E76\u660E\u786E\u6807\u6CE8 caveat\uFF0C\u7136\u540E\u7ED3\u675F\u56DE\u5408\u3002${depthSuffix}`;
|
|
102
|
+
}
|
|
103
|
+
function createDeliveryGateV2(opts) {
|
|
104
|
+
const { taskLedger, ownership, attribution } = opts;
|
|
105
|
+
const emptyDiagnostics = {
|
|
106
|
+
supersededFailures: 0,
|
|
107
|
+
staleFailureCandidates: 0,
|
|
108
|
+
staleSnapshotDropped: 0,
|
|
109
|
+
toolInvocationFailureCandidates: []
|
|
110
|
+
};
|
|
111
|
+
function isToolInvocationFailure(v) {
|
|
112
|
+
return v.failureKind === "tool_invocation_failure" || v.status === "failed" && v.exitCode !== 0 && v.passed === 0 && v.failed === 0 && v.skipped === 0;
|
|
113
|
+
}
|
|
114
|
+
function verificationDiagnostics(verifications, supersededFailures, staleSnapshotDropped) {
|
|
115
|
+
const invocationFailures = verifications.filter(isToolInvocationFailure);
|
|
116
|
+
const shortestNextStep = invocationFailures.map((v) => v.recommendedCommand ?? v.resolvedCommand).find((cmd) => typeof cmd === "string" && cmd.length > 0);
|
|
117
|
+
return {
|
|
118
|
+
supersededFailures,
|
|
119
|
+
staleFailureCandidates: supersededFailures,
|
|
120
|
+
staleSnapshotDropped,
|
|
121
|
+
toolInvocationFailureCandidates: invocationFailures.map((v) => v.command),
|
|
122
|
+
...shortestNextStep ? { shortestNextStep } : {}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function getGateFiles(currentDirtyFiles) {
|
|
126
|
+
const allOwnedFiles = ownership.getOwnedFiles();
|
|
127
|
+
const allCoOwnedFiles = ownership.getCoOwnedFiles();
|
|
128
|
+
const allExternalFiles = ownership.getExternalFiles(currentDirtyFiles);
|
|
129
|
+
if (!currentDirtyFiles) {
|
|
130
|
+
return {
|
|
131
|
+
ownedFilesForGate: allOwnedFiles,
|
|
132
|
+
coOwnedFiles: allCoOwnedFiles,
|
|
133
|
+
historicalOwnedFiles: [],
|
|
134
|
+
externalFiles: allExternalFiles
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const currentDirty = new Set(currentDirtyFiles);
|
|
138
|
+
const ownedFilesForGate = allOwnedFiles.filter((f) => currentDirty.has(f)).sort();
|
|
139
|
+
const coOwnedFiles = allCoOwnedFiles.filter((f) => currentDirty.has(f)).sort();
|
|
140
|
+
const historicalOwnedFiles = allOwnedFiles.filter((f) => !currentDirty.has(f)).sort();
|
|
141
|
+
const externalFiles = allExternalFiles.filter((f) => currentDirty.has(f)).sort();
|
|
142
|
+
return { ownedFilesForGate, coOwnedFiles, historicalOwnedFiles, externalFiles };
|
|
143
|
+
}
|
|
144
|
+
function assess(externalVerifications, currentDirtyFiles, currentSnapshotRef, moduleCoverage) {
|
|
145
|
+
const { ownedFilesForGate: ownedFiles, coOwnedFiles, externalFiles } = getGateFiles(currentDirtyFiles);
|
|
146
|
+
if (currentDirtyFiles) {
|
|
147
|
+
const health = summarizeOwnershipHealth({
|
|
148
|
+
ownedFiles,
|
|
149
|
+
coOwnedFiles,
|
|
150
|
+
externalFiles,
|
|
151
|
+
dirtyFiles: currentDirtyFiles
|
|
152
|
+
});
|
|
153
|
+
if (health.warningLines.length > 0) {
|
|
154
|
+
return {
|
|
155
|
+
state: "YELLOW",
|
|
156
|
+
canDeliver: true,
|
|
157
|
+
isBlocked: false,
|
|
158
|
+
reason: `${health.warningLines.length} dirty file(s) have no ownership classification. Deliverable with caveat.`,
|
|
159
|
+
ownedFileCount: ownedFiles.length,
|
|
160
|
+
externalFileCount: externalFiles.length,
|
|
161
|
+
verificationCount: externalVerifications.length,
|
|
162
|
+
...emptyDiagnostics
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const rawVerifications = taskLedger.getVerifications();
|
|
167
|
+
const { effective: ownedVerifications, supersededFailures, staleSnapshotDropped } = getEffectiveVerifications(rawVerifications, currentSnapshotRef);
|
|
168
|
+
const allVerifications = [
|
|
169
|
+
...ownedVerifications,
|
|
170
|
+
...externalVerifications
|
|
171
|
+
];
|
|
172
|
+
const diagnostics = verificationDiagnostics(allVerifications, supersededFailures, staleSnapshotDropped);
|
|
173
|
+
const _lv = allVerifications.length > 0 ? allVerifications[allVerifications.length - 1] : void 0;
|
|
174
|
+
const latestVerificationTotals = _lv ? { passed: _lv.passed ?? 0, failed: _lv.failed ?? 0, skipped: _lv.skipped ?? 0, command: _lv.command } : void 0;
|
|
175
|
+
if (ownedFiles.length === 0) {
|
|
176
|
+
const hasExternals = externalFiles.length > 0;
|
|
177
|
+
return {
|
|
178
|
+
state: "GREEN",
|
|
179
|
+
canDeliver: true,
|
|
180
|
+
isBlocked: false,
|
|
181
|
+
reason: hasExternals ? `No owned files modified. ${externalFiles.length} external dirty file(s) present but excluded from delivery scope.` : "No file modifications.",
|
|
182
|
+
ownedFileCount: 0,
|
|
183
|
+
externalFileCount: externalFiles.length,
|
|
184
|
+
verificationCount: allVerifications.length,
|
|
185
|
+
...diagnostics,
|
|
186
|
+
latestVerificationTotals
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const aggregate = attribution.getAggregateAttribution(allVerifications);
|
|
190
|
+
switch (aggregate.attribution) {
|
|
191
|
+
case "verified": {
|
|
192
|
+
if (moduleCoverage && moduleCoverage.impactedTests.length > 0) {
|
|
193
|
+
const coverage = assessImpactedTestCoverage(
|
|
194
|
+
moduleCoverage.impactedTests,
|
|
195
|
+
allVerifications,
|
|
196
|
+
moduleCoverage.testExists
|
|
197
|
+
);
|
|
198
|
+
if (coverage.uncovered.length > 0) {
|
|
199
|
+
const sample = coverage.uncovered.slice(0, 5);
|
|
200
|
+
return {
|
|
201
|
+
state: "YELLOW",
|
|
202
|
+
canDeliver: true,
|
|
203
|
+
isBlocked: false,
|
|
204
|
+
reason: `${ownedFiles.length} owned file(s) have passed verifications, but ${coverage.uncovered.length} impacted test file(s) (Meridian blast radius) were never covered by any passed run: ${sample.join(", ")}${coverage.uncovered.length > sample.length ? ` (+${coverage.uncovered.length - sample.length} more)` : ""}. Regression risk \u2014 run these tests or a full-scope verification.`,
|
|
205
|
+
ownedFileCount: ownedFiles.length,
|
|
206
|
+
externalFileCount: externalFiles.length,
|
|
207
|
+
verificationCount: allVerifications.length,
|
|
208
|
+
...diagnostics,
|
|
209
|
+
latestVerificationTotals,
|
|
210
|
+
attributionClass: "module_unverified",
|
|
211
|
+
uncoveredImpactedTests: coverage.uncovered,
|
|
212
|
+
...coverage.uncoverable.length > 0 ? { uncoverableImpactedTests: coverage.uncoverable } : {}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (coverage.uncoverable.length > 0) {
|
|
216
|
+
return {
|
|
217
|
+
state: "GREEN",
|
|
218
|
+
canDeliver: true,
|
|
219
|
+
isBlocked: false,
|
|
220
|
+
reason: `${ownedFiles.length} owned file(s) verified. Ready to deliver. (${coverage.uncoverable.length} impacted test path(s) no longer exist \u2014 deleted/renamed, excluded from coverage check.)`,
|
|
221
|
+
ownedFileCount: ownedFiles.length,
|
|
222
|
+
externalFileCount: externalFiles.length,
|
|
223
|
+
verificationCount: allVerifications.length,
|
|
224
|
+
...diagnostics,
|
|
225
|
+
latestVerificationTotals,
|
|
226
|
+
uncoverableImpactedTests: coverage.uncoverable
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
state: "GREEN",
|
|
232
|
+
canDeliver: true,
|
|
233
|
+
isBlocked: false,
|
|
234
|
+
reason: `${ownedFiles.length} owned file(s) verified. Ready to deliver.`,
|
|
235
|
+
ownedFileCount: ownedFiles.length,
|
|
236
|
+
externalFileCount: externalFiles.length,
|
|
237
|
+
verificationCount: allVerifications.length,
|
|
238
|
+
...diagnostics,
|
|
239
|
+
latestVerificationTotals
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
case "external_blocked":
|
|
243
|
+
return {
|
|
244
|
+
state: "YELLOW",
|
|
245
|
+
canDeliver: true,
|
|
246
|
+
isBlocked: false,
|
|
247
|
+
reason: `${ownedFiles.length} owned file(s) verified, but external verification blocked: ${aggregate.reason}. Deliverable with caveat.`,
|
|
248
|
+
ownedFileCount: ownedFiles.length,
|
|
249
|
+
externalFileCount: externalFiles.length,
|
|
250
|
+
verificationCount: allVerifications.length,
|
|
251
|
+
...diagnostics,
|
|
252
|
+
latestVerificationTotals
|
|
253
|
+
};
|
|
254
|
+
case "no_test_infra":
|
|
255
|
+
return {
|
|
256
|
+
state: "YELLOW",
|
|
257
|
+
canDeliver: true,
|
|
258
|
+
isBlocked: false,
|
|
259
|
+
reason: `\u6D4B\u8BD5\u57FA\u7840\u8BBE\u65BD\u7F3A\u5931\uFF1A${aggregate.reason}
|
|
260
|
+
|
|
261
|
+
\u8BE5\u9879\u76EE\u65E0\u53EF\u81EA\u52A8\u68C0\u6D4B\u7684\u6D4B\u8BD5\u6846\u67B6\u6216\u6D4B\u8BD5\u6587\u4EF6\u3002run_tests \u4E0D\u4F1A\u81EA\u52A8\u751F\u6548\uFF0C\u7EE7\u7EED\u91CD\u8BD5\u4E0D\u4F1A\u6539\u53D8\u7ED3\u679C\u3002\u8BF7\u5411\u7528\u6237\u8BF4\u660E\u5177\u4F53\u7F3A\u5931\u9879\u548C\u4E0B\u4E00\u6B65\u3002`,
|
|
262
|
+
ownedFileCount: ownedFiles.length,
|
|
263
|
+
externalFileCount: externalFiles.length,
|
|
264
|
+
verificationCount: allVerifications.length,
|
|
265
|
+
...diagnostics,
|
|
266
|
+
latestVerificationTotals,
|
|
267
|
+
attributionClass: "no_test_infra"
|
|
268
|
+
};
|
|
269
|
+
case "owned_failure":
|
|
270
|
+
return {
|
|
271
|
+
state: "RED",
|
|
272
|
+
canDeliver: false,
|
|
273
|
+
isBlocked: true,
|
|
274
|
+
reason: aggregate.reason,
|
|
275
|
+
blockingReason: `Owned verification failed. Fix failures before delivery.`,
|
|
276
|
+
ownedFileCount: ownedFiles.length,
|
|
277
|
+
externalFileCount: externalFiles.length,
|
|
278
|
+
verificationCount: allVerifications.length,
|
|
279
|
+
...diagnostics,
|
|
280
|
+
latestVerificationTotals,
|
|
281
|
+
currentBlockingFailure: aggregate.reason,
|
|
282
|
+
attributionClass: "owned_failure"
|
|
283
|
+
};
|
|
284
|
+
case "tool_invocation_failure":
|
|
285
|
+
return {
|
|
286
|
+
state: "YELLOW",
|
|
287
|
+
canDeliver: true,
|
|
288
|
+
isBlocked: false,
|
|
289
|
+
reason: `${aggregate.reason}
|
|
290
|
+
|
|
291
|
+
This is a tool invocation issue (timeout, crash) \u2014 not a code failure. Re-run with the recommended command. You may still deliver if you have independently verified correctness.`,
|
|
292
|
+
ownedFileCount: ownedFiles.length,
|
|
293
|
+
externalFileCount: externalFiles.length,
|
|
294
|
+
verificationCount: allVerifications.length,
|
|
295
|
+
...diagnostics,
|
|
296
|
+
latestVerificationTotals
|
|
297
|
+
};
|
|
298
|
+
case "unattributed_failure":
|
|
299
|
+
return {
|
|
300
|
+
state: "YELLOW",
|
|
301
|
+
canDeliver: true,
|
|
302
|
+
isBlocked: false,
|
|
303
|
+
reason: `${ownedFiles.length} owned file(s) are not directly implicated, but verification has unresolved full-suite failure: ${aggregate.reason}. Deliverable with caveat.`,
|
|
304
|
+
ownedFileCount: ownedFiles.length,
|
|
305
|
+
externalFileCount: externalFiles.length,
|
|
306
|
+
verificationCount: allVerifications.length,
|
|
307
|
+
...diagnostics,
|
|
308
|
+
latestVerificationTotals
|
|
309
|
+
};
|
|
310
|
+
case "integration_conflict":
|
|
311
|
+
return {
|
|
312
|
+
state: "YELLOW",
|
|
313
|
+
canDeliver: true,
|
|
314
|
+
isBlocked: false,
|
|
315
|
+
reason: `${ownedFiles.length} owned file(s) verified in isolation, but integration on current HEAD conflicts: ${aggregate.reason}`,
|
|
316
|
+
ownedFileCount: ownedFiles.length,
|
|
317
|
+
externalFileCount: externalFiles.length,
|
|
318
|
+
verificationCount: allVerifications.length,
|
|
319
|
+
...diagnostics,
|
|
320
|
+
latestVerificationTotals
|
|
321
|
+
};
|
|
322
|
+
case "unverified":
|
|
323
|
+
return {
|
|
324
|
+
state: "RED",
|
|
325
|
+
canDeliver: false,
|
|
326
|
+
isBlocked: true,
|
|
327
|
+
reason: `${ownedFiles.length} owned file(s) modified but unverified.`,
|
|
328
|
+
blockingReason: `Run verification before delivery.`,
|
|
329
|
+
ownedFileCount: ownedFiles.length,
|
|
330
|
+
externalFileCount: externalFiles.length,
|
|
331
|
+
verificationCount: allVerifications.length,
|
|
332
|
+
...diagnostics,
|
|
333
|
+
latestVerificationTotals,
|
|
334
|
+
currentBlockingFailure: `${ownedFiles.length} owned file(s) modified but unverified.`,
|
|
335
|
+
attributionClass: "unverified"
|
|
336
|
+
};
|
|
337
|
+
default:
|
|
338
|
+
return {
|
|
339
|
+
state: "RED",
|
|
340
|
+
canDeliver: false,
|
|
341
|
+
isBlocked: true,
|
|
342
|
+
reason: "Unknown verification state.",
|
|
343
|
+
ownedFileCount: ownedFiles.length,
|
|
344
|
+
externalFileCount: externalFiles.length,
|
|
345
|
+
verificationCount: allVerifications.length,
|
|
346
|
+
...diagnostics,
|
|
347
|
+
latestVerificationTotals,
|
|
348
|
+
currentBlockingFailure: "Unknown verification state.",
|
|
349
|
+
attributionClass: "unverified"
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function getReport(externalVerifications, currentDirtyFiles, currentSnapshotRef, moduleCoverage) {
|
|
354
|
+
const result = assess(externalVerifications, currentDirtyFiles, currentSnapshotRef, moduleCoverage);
|
|
355
|
+
const { ownedFilesForGate, coOwnedFiles, historicalOwnedFiles, externalFiles } = getGateFiles(currentDirtyFiles);
|
|
356
|
+
return {
|
|
357
|
+
taskId: taskLedger.getTaskId(),
|
|
358
|
+
state: result.state,
|
|
359
|
+
canDeliver: result.canDeliver,
|
|
360
|
+
ownedFiles: ownedFilesForGate,
|
|
361
|
+
ownedFileCount: result.ownedFileCount,
|
|
362
|
+
coOwnedFiles,
|
|
363
|
+
coOwnedFileCount: coOwnedFiles.length,
|
|
364
|
+
historicalOwnedFiles,
|
|
365
|
+
historicalOwnedFileCount: historicalOwnedFiles.length,
|
|
366
|
+
externalFiles,
|
|
367
|
+
externalFileCount: result.externalFileCount,
|
|
368
|
+
verificationCount: result.verificationCount,
|
|
369
|
+
supersededFailures: result.supersededFailures,
|
|
370
|
+
staleSnapshotDropped: result.staleSnapshotDropped,
|
|
371
|
+
latestVerificationTotals: result.latestVerificationTotals,
|
|
372
|
+
staleFailureCandidates: result.staleFailureCandidates,
|
|
373
|
+
toolInvocationFailureCandidates: result.toolInvocationFailureCandidates,
|
|
374
|
+
currentBlockingFailure: result.currentBlockingFailure,
|
|
375
|
+
shortestNextStep: result.shortestNextStep,
|
|
376
|
+
blockingReason: result.blockingReason,
|
|
377
|
+
attributionClass: result.attributionClass,
|
|
378
|
+
uncoveredImpactedTests: result.uncoveredImpactedTests,
|
|
379
|
+
uncoverableImpactedTests: result.uncoverableImpactedTests,
|
|
380
|
+
attributionSummary: result.reason ?? "No attribution available."
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
return { assess, getReport };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export {
|
|
387
|
+
summarizeOwnershipHealth,
|
|
388
|
+
isJunkExternalPath,
|
|
389
|
+
filterExternalNoise,
|
|
390
|
+
buildGateConvergenceHint,
|
|
391
|
+
createDeliveryGateV2
|
|
392
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
|
+
import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_esm_shims
|
|
5
|
+
} from "./chunk-5GGOGLSN.js";
|
|
6
|
+
|
|
7
|
+
// src/mcp/oauth/providers.ts
|
|
8
|
+
init_esm_shims();
|
|
9
|
+
var MCP_OAUTH_PROVIDERS = [
|
|
10
|
+
{
|
|
11
|
+
id: "github",
|
|
12
|
+
name: "GitHub",
|
|
13
|
+
authorizeUrl: "https://github.com/login/oauth/authorize",
|
|
14
|
+
tokenEndpoint: "https://github.com/login/oauth/access_token",
|
|
15
|
+
defaultScopes: ["repo", "read:org"],
|
|
16
|
+
clientIdHelp: "GitHub Settings \u2192 Developer settings \u2192 OAuth Apps \u2192 New OAuth App. Redirect URL: http://localhost:1456/auth/callback"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "slack",
|
|
20
|
+
name: "Slack",
|
|
21
|
+
authorizeUrl: "https://slack.com/oauth/v2/authorize",
|
|
22
|
+
tokenEndpoint: "https://slack.com/api/oauth.v2.access",
|
|
23
|
+
defaultScopes: ["channels:read", "chat:write", "channels:history"],
|
|
24
|
+
clientIdHelp: "Slack API \u2192 Your Apps \u2192 Create New App \u2192 OAuth & Permissions. Redirect URL: http://localhost:1456/auth/callback"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "notion",
|
|
28
|
+
name: "Notion",
|
|
29
|
+
authorizeUrl: "https://api.notion.com/v1/oauth/authorize",
|
|
30
|
+
tokenEndpoint: "https://api.notion.com/v1/oauth/token",
|
|
31
|
+
defaultScopes: [],
|
|
32
|
+
clientIdHelp: "Notion Integrations \u2192 View integration \u2192 OAuth Domain & URIs. Redirect URL: http://localhost:1456/auth/callback"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "linear",
|
|
36
|
+
name: "Linear",
|
|
37
|
+
authorizeUrl: "https://linear.app/oauth/authorize",
|
|
38
|
+
tokenEndpoint: "https://api.linear.app/oauth/token",
|
|
39
|
+
defaultScopes: ["read", "write"],
|
|
40
|
+
clientIdHelp: "Linear Settings \u2192 API \u2192 OAuth applications \u2192 Create. Redirect URL: http://localhost:1456/auth/callback"
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
function findMcpOAuthProvider(id) {
|
|
44
|
+
const lower = id.toLowerCase();
|
|
45
|
+
return MCP_OAUTH_PROVIDERS.find((p) => p.id.toLowerCase() === lower);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
MCP_OAUTH_PROVIDERS,
|
|
50
|
+
findMcpOAuthProvider
|
|
51
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
|
+
import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_esm_shims
|
|
5
|
+
} from "./chunk-5GGOGLSN.js";
|
|
6
|
+
|
|
7
|
+
// src/tools/net/proxy-resolver.ts
|
|
8
|
+
init_esm_shims();
|
|
9
|
+
import { execSync } from "child_process";
|
|
10
|
+
function envCaseInsensitive(key) {
|
|
11
|
+
return process.env[key] ?? process.env[key.toLowerCase()];
|
|
12
|
+
}
|
|
13
|
+
function readWindowsSystemProxy() {
|
|
14
|
+
if (process.platform !== "win32") return void 0;
|
|
15
|
+
try {
|
|
16
|
+
const enable = execSync(
|
|
17
|
+
'reg query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable 2>nul',
|
|
18
|
+
{ encoding: "utf8", timeout: 3e3, windowsHide: true }
|
|
19
|
+
);
|
|
20
|
+
if (!/0x1/.test(enable)) return void 0;
|
|
21
|
+
const stdout = execSync(
|
|
22
|
+
'reg query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyServer 2>nul',
|
|
23
|
+
{ encoding: "utf8", timeout: 3e3, windowsHide: true }
|
|
24
|
+
);
|
|
25
|
+
return parseWindowsProxyOutput(enable, stdout);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
function readMacosSystemProxy() {
|
|
31
|
+
if (process.platform !== "darwin") return void 0;
|
|
32
|
+
try {
|
|
33
|
+
const stdout = execSync("scutil --proxy", {
|
|
34
|
+
encoding: "utf8",
|
|
35
|
+
timeout: 3e3,
|
|
36
|
+
windowsHide: true
|
|
37
|
+
});
|
|
38
|
+
return parseScutilProxy(stdout);
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
function parseScutilProxy(stdout) {
|
|
44
|
+
const get = (key) => {
|
|
45
|
+
const m = stdout.match(new RegExp(`^\\s*${key}\\s*:\\s*(\\S+)`, "m"));
|
|
46
|
+
return m?.[1];
|
|
47
|
+
};
|
|
48
|
+
const httpsHost = get("HTTPSProxy");
|
|
49
|
+
const httpsPort = get("HTTPSPort");
|
|
50
|
+
const httpsEnable = get("HTTPSEnable");
|
|
51
|
+
if (httpsEnable === "1" && httpsHost && httpsPort) {
|
|
52
|
+
return `http://${httpsHost}:${httpsPort}`;
|
|
53
|
+
}
|
|
54
|
+
const httpHost = get("HTTPProxy");
|
|
55
|
+
const httpPort = get("HTTPPort");
|
|
56
|
+
const httpEnable = get("HTTPEnable");
|
|
57
|
+
if (httpEnable === "1" && httpHost && httpPort) {
|
|
58
|
+
return `http://${httpHost}:${httpPort}`;
|
|
59
|
+
}
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
62
|
+
function parseWindowsProxyOutput(enableStdout, serverStdout) {
|
|
63
|
+
if (!/0x1/.test(enableStdout)) return void 0;
|
|
64
|
+
const match = serverStdout.match(/REG_SZ\s+(.+)/);
|
|
65
|
+
if (match?.[1]) return normalizeProxyUrl(match[1].trim());
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
function normalizeProxyUrl(raw) {
|
|
69
|
+
if (raw.includes("=")) {
|
|
70
|
+
const parts = raw.split(";");
|
|
71
|
+
for (const want of ["https", "http"]) {
|
|
72
|
+
for (const part of parts) {
|
|
73
|
+
const m = part.match(/^(https?)=(.+)/i);
|
|
74
|
+
if (m && m[1].toLowerCase() === want) return normalizeProxyUrl(m[2].trim());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
if (/^https?:\/\//i.test(raw)) return raw;
|
|
80
|
+
return `http://${raw}`;
|
|
81
|
+
}
|
|
82
|
+
function shouldBypassProxy(hostname, noProxy) {
|
|
83
|
+
const raw = noProxy ?? envCaseInsensitive("NO_PROXY");
|
|
84
|
+
if (!raw) return false;
|
|
85
|
+
const h = hostname.toLowerCase();
|
|
86
|
+
for (const entry of raw.split(",")) {
|
|
87
|
+
const p = entry.trim().toLowerCase();
|
|
88
|
+
if (!p) continue;
|
|
89
|
+
if (p === "*") return true;
|
|
90
|
+
if (h === p) return true;
|
|
91
|
+
if (p.startsWith(".") && (h.endsWith(p) || h === p.slice(1))) return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
function resolveProxyForUrl(url, opts) {
|
|
96
|
+
let parsed;
|
|
97
|
+
try {
|
|
98
|
+
parsed = new URL(url);
|
|
99
|
+
} catch {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
if (shouldBypassProxy(parsed.hostname, opts?.noProxy)) return void 0;
|
|
103
|
+
if (opts?.proxyUrl) return opts.proxyUrl;
|
|
104
|
+
const systemProxy = () => process.env.RIVET_NO_SYSTEM_PROXY === "1" ? void 0 : readWindowsSystemProxy() ?? readMacosSystemProxy();
|
|
105
|
+
if (parsed.protocol === "https:") {
|
|
106
|
+
return envCaseInsensitive("HTTPS_PROXY") ?? envCaseInsensitive("HTTP_PROXY") ?? systemProxy();
|
|
107
|
+
}
|
|
108
|
+
if (parsed.protocol === "http:") {
|
|
109
|
+
return envCaseInsensitive("HTTP_PROXY") ?? envCaseInsensitive("HTTPS_PROXY") ?? systemProxy();
|
|
110
|
+
}
|
|
111
|
+
return systemProxy();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
parseScutilProxy,
|
|
116
|
+
parseWindowsProxyOutput,
|
|
117
|
+
shouldBypassProxy,
|
|
118
|
+
resolveProxyForUrl
|
|
119
|
+
};
|