@ossdeveloper/github-compliance 1.0.1 → 1.3.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/ARCHITECTURE.md +150 -60
- package/CHANGELOG.md +28 -1
- package/README.md +64 -15
- package/compliance.ts +22 -37
- package/contracts.ts +137 -0
- package/database.ts +2 -9
- package/dist/plugin.js +295 -156
- package/package.json +1 -1
- package/plugin.ts +249 -68
- package/tools.ts +37 -25
package/dist/plugin.js
CHANGED
|
@@ -16,7 +16,6 @@ var __export = (target, all) => {
|
|
|
16
16
|
|
|
17
17
|
// database.ts
|
|
18
18
|
import Database from "bun:sqlite";
|
|
19
|
-
import { createHash } from "crypto";
|
|
20
19
|
import { mkdir } from "fs";
|
|
21
20
|
import { homedir } from "os";
|
|
22
21
|
|
|
@@ -79,12 +78,32 @@ var RECORD_TTL_MS = 30 * 60 * 1000;
|
|
|
79
78
|
var RECORD_CLEANUP_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
80
79
|
var CONTENT_PREVIEW_MAX_LENGTH = 500;
|
|
81
80
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
// contracts.ts
|
|
82
|
+
import { createHash } from "crypto";
|
|
83
|
+
var TOOL_PREFIX_NORMALIZE = {
|
|
84
|
+
github_issue_write: "issue_write",
|
|
85
|
+
github_issue_update: "issue_update",
|
|
86
|
+
github_pull_request_write: "pull_request_write",
|
|
87
|
+
github_pull_request_update: "pull_request_update",
|
|
88
|
+
github_add_issue_comment: "add_issue_comment",
|
|
89
|
+
github_add_pull_request_comment: "add_pull_request_comment",
|
|
90
|
+
github_pull_request_review: "pull_request_review",
|
|
91
|
+
github_pull_request_review_comment: "pull_request_review_comment",
|
|
92
|
+
github_create_pull_request: "create_pull_request",
|
|
93
|
+
github_update_issue: "update_issue",
|
|
94
|
+
github_update_pull_request: "update_pull_request",
|
|
95
|
+
github_push_files: "push_files",
|
|
96
|
+
github_create_branch: "create_branch",
|
|
97
|
+
github_create_or_update_file: "create_or_update_file",
|
|
98
|
+
github_delete_file: "delete_file",
|
|
99
|
+
github_create_repository: "create_repository",
|
|
100
|
+
github_create_pull_request_with_copilot: "create_pull_request_with_copilot",
|
|
101
|
+
github_update_pull_request_branch: "update_pull_request_branch",
|
|
102
|
+
github_reply_to_pull_request_comment: "reply_to_pull_request_comment",
|
|
103
|
+
github_add_reply_to_pull_request_comment: "add_reply_to_pull_request_comment"
|
|
104
|
+
};
|
|
105
|
+
function normalizeToolName(toolName) {
|
|
106
|
+
return TOOL_PREFIX_NORMALIZE[toolName] || toolName;
|
|
88
107
|
}
|
|
89
108
|
function computeContentHash(title, body) {
|
|
90
109
|
const content = JSON.stringify({
|
|
@@ -93,6 +112,39 @@ function computeContentHash(title, body) {
|
|
|
93
112
|
});
|
|
94
113
|
return "sha256:" + createHash("sha256").update(content).digest("hex");
|
|
95
114
|
}
|
|
115
|
+
function extractRecordFields(toolName, args) {
|
|
116
|
+
const normalizedToolName = normalizeToolName(toolName);
|
|
117
|
+
if (!args || typeof args !== "object") {
|
|
118
|
+
return {
|
|
119
|
+
toolName: normalizedToolName,
|
|
120
|
+
owner: "",
|
|
121
|
+
repo: "",
|
|
122
|
+
title: null,
|
|
123
|
+
body: null,
|
|
124
|
+
contentHash: computeContentHash(null, null)
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const owner = args.owner || "";
|
|
128
|
+
const repo = args.repo || "";
|
|
129
|
+
const title = args.title || null;
|
|
130
|
+
const body = args.body || null;
|
|
131
|
+
return {
|
|
132
|
+
toolName: normalizedToolName,
|
|
133
|
+
owner,
|
|
134
|
+
repo,
|
|
135
|
+
title,
|
|
136
|
+
body,
|
|
137
|
+
contentHash: computeContentHash(title, body)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// database.ts
|
|
142
|
+
var DB_DIR = `${homedir()}/.opencode`;
|
|
143
|
+
var DB_PATH = `${DB_DIR}/github-compliance.db`;
|
|
144
|
+
var db = null;
|
|
145
|
+
function uuid() {
|
|
146
|
+
return crypto.randomUUID();
|
|
147
|
+
}
|
|
96
148
|
async function initDatabase() {
|
|
97
149
|
if (db)
|
|
98
150
|
return;
|
|
@@ -318,7 +370,6 @@ async function logFailedAttempt(entry) {
|
|
|
318
370
|
}
|
|
319
371
|
|
|
320
372
|
// compliance.ts
|
|
321
|
-
import { createHash as createHash2 } from "crypto";
|
|
322
373
|
var GITHUB_WRITE_TOOLS_UNPREFIXED = [
|
|
323
374
|
"issue_write",
|
|
324
375
|
"issue_update",
|
|
@@ -346,27 +397,6 @@ var GITHUB_WRITE_TOOLS = [...GITHUB_WRITE_TOOLS_UNPREFIXED, ...GITHUB_WRITE_TOOL
|
|
|
346
397
|
function isGitHubWriteTool(toolName) {
|
|
347
398
|
return GITHUB_WRITE_TOOLS.includes(toolName);
|
|
348
399
|
}
|
|
349
|
-
function extractToolInfo(toolName, args) {
|
|
350
|
-
const owner = args?.owner || "";
|
|
351
|
-
const repo = args?.repo || "";
|
|
352
|
-
const title = args?.title || null;
|
|
353
|
-
const body = args?.body || null;
|
|
354
|
-
return {
|
|
355
|
-
toolName,
|
|
356
|
-
owner,
|
|
357
|
-
repo,
|
|
358
|
-
title,
|
|
359
|
-
body,
|
|
360
|
-
contentHash: computeContentHash2(title, body)
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
function computeContentHash2(title, body) {
|
|
364
|
-
const content = JSON.stringify({
|
|
365
|
-
title: title || "",
|
|
366
|
-
body: body || ""
|
|
367
|
-
});
|
|
368
|
-
return "sha256:" + createHash2("sha256").update(content).digest("hex");
|
|
369
|
-
}
|
|
370
400
|
function extractGitHubId(result) {
|
|
371
401
|
if (!result || typeof result !== "object")
|
|
372
402
|
return null;
|
|
@@ -474,7 +504,7 @@ ${baseError}
|
|
|
474
504
|
return baseError;
|
|
475
505
|
}
|
|
476
506
|
|
|
477
|
-
// ../../zod/v4/classic/external.js
|
|
507
|
+
// ../../node_modules/zod/v4/classic/external.js
|
|
478
508
|
var exports_external = {};
|
|
479
509
|
__export(exports_external, {
|
|
480
510
|
xid: () => xid2,
|
|
@@ -704,7 +734,7 @@ __export(exports_external, {
|
|
|
704
734
|
$brand: () => $brand
|
|
705
735
|
});
|
|
706
736
|
|
|
707
|
-
// ../../zod/v4/core/index.js
|
|
737
|
+
// ../../node_modules/zod/v4/core/index.js
|
|
708
738
|
var exports_core2 = {};
|
|
709
739
|
__export(exports_core2, {
|
|
710
740
|
version: () => version,
|
|
@@ -968,7 +998,7 @@ __export(exports_core2, {
|
|
|
968
998
|
$ZodAny: () => $ZodAny
|
|
969
999
|
});
|
|
970
1000
|
|
|
971
|
-
// ../../zod/v4/core/core.js
|
|
1001
|
+
// ../../node_modules/zod/v4/core/core.js
|
|
972
1002
|
var NEVER = Object.freeze({
|
|
973
1003
|
status: "aborted"
|
|
974
1004
|
});
|
|
@@ -1035,7 +1065,7 @@ function config(newConfig) {
|
|
|
1035
1065
|
Object.assign(globalConfig, newConfig);
|
|
1036
1066
|
return globalConfig;
|
|
1037
1067
|
}
|
|
1038
|
-
// ../../zod/v4/core/util.js
|
|
1068
|
+
// ../../node_modules/zod/v4/core/util.js
|
|
1039
1069
|
var exports_util = {};
|
|
1040
1070
|
__export(exports_util, {
|
|
1041
1071
|
unwrapMessage: () => unwrapMessage,
|
|
@@ -1664,7 +1694,7 @@ class Class {
|
|
|
1664
1694
|
constructor(..._args) {}
|
|
1665
1695
|
}
|
|
1666
1696
|
|
|
1667
|
-
// ../../zod/v4/core/errors.js
|
|
1697
|
+
// ../../node_modules/zod/v4/core/errors.js
|
|
1668
1698
|
var initializer = (inst, def) => {
|
|
1669
1699
|
inst.name = "$ZodError";
|
|
1670
1700
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -1807,7 +1837,7 @@ function prettifyError(error) {
|
|
|
1807
1837
|
`);
|
|
1808
1838
|
}
|
|
1809
1839
|
|
|
1810
|
-
// ../../zod/v4/core/parse.js
|
|
1840
|
+
// ../../node_modules/zod/v4/core/parse.js
|
|
1811
1841
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1812
1842
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
1813
1843
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -1894,7 +1924,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1894
1924
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1895
1925
|
};
|
|
1896
1926
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
1897
|
-
// ../../zod/v4/core/regexes.js
|
|
1927
|
+
// ../../node_modules/zod/v4/core/regexes.js
|
|
1898
1928
|
var exports_regexes = {};
|
|
1899
1929
|
__export(exports_regexes, {
|
|
1900
1930
|
xid: () => xid,
|
|
@@ -2046,7 +2076,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
|
|
|
2046
2076
|
var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
|
|
2047
2077
|
var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
2048
2078
|
|
|
2049
|
-
// ../../zod/v4/core/checks.js
|
|
2079
|
+
// ../../node_modules/zod/v4/core/checks.js
|
|
2050
2080
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
2051
2081
|
var _a;
|
|
2052
2082
|
inst._zod ?? (inst._zod = {});
|
|
@@ -2587,7 +2617,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
2587
2617
|
};
|
|
2588
2618
|
});
|
|
2589
2619
|
|
|
2590
|
-
// ../../zod/v4/core/doc.js
|
|
2620
|
+
// ../../node_modules/zod/v4/core/doc.js
|
|
2591
2621
|
class Doc {
|
|
2592
2622
|
constructor(args = []) {
|
|
2593
2623
|
this.content = [];
|
|
@@ -2625,14 +2655,14 @@ class Doc {
|
|
|
2625
2655
|
}
|
|
2626
2656
|
}
|
|
2627
2657
|
|
|
2628
|
-
// ../../zod/v4/core/versions.js
|
|
2658
|
+
// ../../node_modules/zod/v4/core/versions.js
|
|
2629
2659
|
var version = {
|
|
2630
2660
|
major: 4,
|
|
2631
2661
|
minor: 1,
|
|
2632
2662
|
patch: 8
|
|
2633
2663
|
};
|
|
2634
2664
|
|
|
2635
|
-
// ../../zod/v4/core/schemas.js
|
|
2665
|
+
// ../../node_modules/zod/v4/core/schemas.js
|
|
2636
2666
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
2637
2667
|
var _a;
|
|
2638
2668
|
inst ?? (inst = {});
|
|
@@ -4455,7 +4485,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
4455
4485
|
payload.issues.push(issue(_iss));
|
|
4456
4486
|
}
|
|
4457
4487
|
}
|
|
4458
|
-
// ../../zod/v4/locales/index.js
|
|
4488
|
+
// ../../node_modules/zod/v4/locales/index.js
|
|
4459
4489
|
var exports_locales = {};
|
|
4460
4490
|
__export(exports_locales, {
|
|
4461
4491
|
zhTW: () => zh_TW_default,
|
|
@@ -4506,7 +4536,7 @@ __export(exports_locales, {
|
|
|
4506
4536
|
ar: () => ar_default
|
|
4507
4537
|
});
|
|
4508
4538
|
|
|
4509
|
-
// ../../zod/v4/locales/ar.js
|
|
4539
|
+
// ../../node_modules/zod/v4/locales/ar.js
|
|
4510
4540
|
var error = () => {
|
|
4511
4541
|
const Sizable = {
|
|
4512
4542
|
string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
|
|
@@ -4622,7 +4652,7 @@ function ar_default() {
|
|
|
4622
4652
|
localeError: error()
|
|
4623
4653
|
};
|
|
4624
4654
|
}
|
|
4625
|
-
// ../../zod/v4/locales/az.js
|
|
4655
|
+
// ../../node_modules/zod/v4/locales/az.js
|
|
4626
4656
|
var error2 = () => {
|
|
4627
4657
|
const Sizable = {
|
|
4628
4658
|
string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
|
|
@@ -4737,7 +4767,7 @@ function az_default() {
|
|
|
4737
4767
|
localeError: error2()
|
|
4738
4768
|
};
|
|
4739
4769
|
}
|
|
4740
|
-
// ../../zod/v4/locales/be.js
|
|
4770
|
+
// ../../node_modules/zod/v4/locales/be.js
|
|
4741
4771
|
function getBelarusianPlural(count, one, few, many) {
|
|
4742
4772
|
const absCount = Math.abs(count);
|
|
4743
4773
|
const lastDigit = absCount % 10;
|
|
@@ -4901,7 +4931,7 @@ function be_default() {
|
|
|
4901
4931
|
localeError: error3()
|
|
4902
4932
|
};
|
|
4903
4933
|
}
|
|
4904
|
-
// ../../zod/v4/locales/ca.js
|
|
4934
|
+
// ../../node_modules/zod/v4/locales/ca.js
|
|
4905
4935
|
var error4 = () => {
|
|
4906
4936
|
const Sizable = {
|
|
4907
4937
|
string: { unit: "car\xE0cters", verb: "contenir" },
|
|
@@ -5018,7 +5048,7 @@ function ca_default() {
|
|
|
5018
5048
|
localeError: error4()
|
|
5019
5049
|
};
|
|
5020
5050
|
}
|
|
5021
|
-
// ../../zod/v4/locales/cs.js
|
|
5051
|
+
// ../../node_modules/zod/v4/locales/cs.js
|
|
5022
5052
|
var error5 = () => {
|
|
5023
5053
|
const Sizable = {
|
|
5024
5054
|
string: { unit: "znak\u016F", verb: "m\xEDt" },
|
|
@@ -5153,7 +5183,7 @@ function cs_default() {
|
|
|
5153
5183
|
localeError: error5()
|
|
5154
5184
|
};
|
|
5155
5185
|
}
|
|
5156
|
-
// ../../zod/v4/locales/da.js
|
|
5186
|
+
// ../../node_modules/zod/v4/locales/da.js
|
|
5157
5187
|
var error6 = () => {
|
|
5158
5188
|
const Sizable = {
|
|
5159
5189
|
string: { unit: "tegn", verb: "havde" },
|
|
@@ -5284,7 +5314,7 @@ function da_default() {
|
|
|
5284
5314
|
localeError: error6()
|
|
5285
5315
|
};
|
|
5286
5316
|
}
|
|
5287
|
-
// ../../zod/v4/locales/de.js
|
|
5317
|
+
// ../../node_modules/zod/v4/locales/de.js
|
|
5288
5318
|
var error7 = () => {
|
|
5289
5319
|
const Sizable = {
|
|
5290
5320
|
string: { unit: "Zeichen", verb: "zu haben" },
|
|
@@ -5400,7 +5430,7 @@ function de_default() {
|
|
|
5400
5430
|
localeError: error7()
|
|
5401
5431
|
};
|
|
5402
5432
|
}
|
|
5403
|
-
// ../../zod/v4/locales/en.js
|
|
5433
|
+
// ../../node_modules/zod/v4/locales/en.js
|
|
5404
5434
|
var parsedType = (data) => {
|
|
5405
5435
|
const t = typeof data;
|
|
5406
5436
|
switch (t) {
|
|
@@ -5517,7 +5547,7 @@ function en_default() {
|
|
|
5517
5547
|
localeError: error8()
|
|
5518
5548
|
};
|
|
5519
5549
|
}
|
|
5520
|
-
// ../../zod/v4/locales/eo.js
|
|
5550
|
+
// ../../node_modules/zod/v4/locales/eo.js
|
|
5521
5551
|
var parsedType2 = (data) => {
|
|
5522
5552
|
const t = typeof data;
|
|
5523
5553
|
switch (t) {
|
|
@@ -5633,7 +5663,7 @@ function eo_default() {
|
|
|
5633
5663
|
localeError: error9()
|
|
5634
5664
|
};
|
|
5635
5665
|
}
|
|
5636
|
-
// ../../zod/v4/locales/es.js
|
|
5666
|
+
// ../../node_modules/zod/v4/locales/es.js
|
|
5637
5667
|
var error10 = () => {
|
|
5638
5668
|
const Sizable = {
|
|
5639
5669
|
string: { unit: "caracteres", verb: "tener" },
|
|
@@ -5781,7 +5811,7 @@ function es_default() {
|
|
|
5781
5811
|
localeError: error10()
|
|
5782
5812
|
};
|
|
5783
5813
|
}
|
|
5784
|
-
// ../../zod/v4/locales/fa.js
|
|
5814
|
+
// ../../node_modules/zod/v4/locales/fa.js
|
|
5785
5815
|
var error11 = () => {
|
|
5786
5816
|
const Sizable = {
|
|
5787
5817
|
string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
|
|
@@ -5903,7 +5933,7 @@ function fa_default() {
|
|
|
5903
5933
|
localeError: error11()
|
|
5904
5934
|
};
|
|
5905
5935
|
}
|
|
5906
|
-
// ../../zod/v4/locales/fi.js
|
|
5936
|
+
// ../../node_modules/zod/v4/locales/fi.js
|
|
5907
5937
|
var error12 = () => {
|
|
5908
5938
|
const Sizable = {
|
|
5909
5939
|
string: { unit: "merkki\xE4", subject: "merkkijonon" },
|
|
@@ -6025,7 +6055,7 @@ function fi_default() {
|
|
|
6025
6055
|
localeError: error12()
|
|
6026
6056
|
};
|
|
6027
6057
|
}
|
|
6028
|
-
// ../../zod/v4/locales/fr.js
|
|
6058
|
+
// ../../node_modules/zod/v4/locales/fr.js
|
|
6029
6059
|
var error13 = () => {
|
|
6030
6060
|
const Sizable = {
|
|
6031
6061
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -6141,7 +6171,7 @@ function fr_default() {
|
|
|
6141
6171
|
localeError: error13()
|
|
6142
6172
|
};
|
|
6143
6173
|
}
|
|
6144
|
-
// ../../zod/v4/locales/fr-CA.js
|
|
6174
|
+
// ../../node_modules/zod/v4/locales/fr-CA.js
|
|
6145
6175
|
var error14 = () => {
|
|
6146
6176
|
const Sizable = {
|
|
6147
6177
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -6258,7 +6288,7 @@ function fr_CA_default() {
|
|
|
6258
6288
|
localeError: error14()
|
|
6259
6289
|
};
|
|
6260
6290
|
}
|
|
6261
|
-
// ../../zod/v4/locales/he.js
|
|
6291
|
+
// ../../node_modules/zod/v4/locales/he.js
|
|
6262
6292
|
var error15 = () => {
|
|
6263
6293
|
const Sizable = {
|
|
6264
6294
|
string: { unit: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" },
|
|
@@ -6374,7 +6404,7 @@ function he_default() {
|
|
|
6374
6404
|
localeError: error15()
|
|
6375
6405
|
};
|
|
6376
6406
|
}
|
|
6377
|
-
// ../../zod/v4/locales/hu.js
|
|
6407
|
+
// ../../node_modules/zod/v4/locales/hu.js
|
|
6378
6408
|
var error16 = () => {
|
|
6379
6409
|
const Sizable = {
|
|
6380
6410
|
string: { unit: "karakter", verb: "legyen" },
|
|
@@ -6490,7 +6520,7 @@ function hu_default() {
|
|
|
6490
6520
|
localeError: error16()
|
|
6491
6521
|
};
|
|
6492
6522
|
}
|
|
6493
|
-
// ../../zod/v4/locales/id.js
|
|
6523
|
+
// ../../node_modules/zod/v4/locales/id.js
|
|
6494
6524
|
var error17 = () => {
|
|
6495
6525
|
const Sizable = {
|
|
6496
6526
|
string: { unit: "karakter", verb: "memiliki" },
|
|
@@ -6606,7 +6636,7 @@ function id_default() {
|
|
|
6606
6636
|
localeError: error17()
|
|
6607
6637
|
};
|
|
6608
6638
|
}
|
|
6609
|
-
// ../../zod/v4/locales/is.js
|
|
6639
|
+
// ../../node_modules/zod/v4/locales/is.js
|
|
6610
6640
|
var parsedType3 = (data) => {
|
|
6611
6641
|
const t = typeof data;
|
|
6612
6642
|
switch (t) {
|
|
@@ -6723,7 +6753,7 @@ function is_default() {
|
|
|
6723
6753
|
localeError: error18()
|
|
6724
6754
|
};
|
|
6725
6755
|
}
|
|
6726
|
-
// ../../zod/v4/locales/it.js
|
|
6756
|
+
// ../../node_modules/zod/v4/locales/it.js
|
|
6727
6757
|
var error19 = () => {
|
|
6728
6758
|
const Sizable = {
|
|
6729
6759
|
string: { unit: "caratteri", verb: "avere" },
|
|
@@ -6839,7 +6869,7 @@ function it_default() {
|
|
|
6839
6869
|
localeError: error19()
|
|
6840
6870
|
};
|
|
6841
6871
|
}
|
|
6842
|
-
// ../../zod/v4/locales/ja.js
|
|
6872
|
+
// ../../node_modules/zod/v4/locales/ja.js
|
|
6843
6873
|
var error20 = () => {
|
|
6844
6874
|
const Sizable = {
|
|
6845
6875
|
string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
|
|
@@ -6954,7 +6984,7 @@ function ja_default() {
|
|
|
6954
6984
|
localeError: error20()
|
|
6955
6985
|
};
|
|
6956
6986
|
}
|
|
6957
|
-
// ../../zod/v4/locales/ka.js
|
|
6987
|
+
// ../../node_modules/zod/v4/locales/ka.js
|
|
6958
6988
|
var parsedType4 = (data) => {
|
|
6959
6989
|
const t = typeof data;
|
|
6960
6990
|
switch (t) {
|
|
@@ -7079,7 +7109,7 @@ function ka_default() {
|
|
|
7079
7109
|
localeError: error21()
|
|
7080
7110
|
};
|
|
7081
7111
|
}
|
|
7082
|
-
// ../../zod/v4/locales/km.js
|
|
7112
|
+
// ../../node_modules/zod/v4/locales/km.js
|
|
7083
7113
|
var error22 = () => {
|
|
7084
7114
|
const Sizable = {
|
|
7085
7115
|
string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
|
|
@@ -7197,11 +7227,11 @@ function km_default() {
|
|
|
7197
7227
|
};
|
|
7198
7228
|
}
|
|
7199
7229
|
|
|
7200
|
-
// ../../zod/v4/locales/kh.js
|
|
7230
|
+
// ../../node_modules/zod/v4/locales/kh.js
|
|
7201
7231
|
function kh_default() {
|
|
7202
7232
|
return km_default();
|
|
7203
7233
|
}
|
|
7204
|
-
// ../../zod/v4/locales/ko.js
|
|
7234
|
+
// ../../node_modules/zod/v4/locales/ko.js
|
|
7205
7235
|
var error23 = () => {
|
|
7206
7236
|
const Sizable = {
|
|
7207
7237
|
string: { unit: "\uBB38\uC790", verb: "to have" },
|
|
@@ -7322,7 +7352,7 @@ function ko_default() {
|
|
|
7322
7352
|
localeError: error23()
|
|
7323
7353
|
};
|
|
7324
7354
|
}
|
|
7325
|
-
// ../../zod/v4/locales/lt.js
|
|
7355
|
+
// ../../node_modules/zod/v4/locales/lt.js
|
|
7326
7356
|
var parsedType5 = (data) => {
|
|
7327
7357
|
const t = typeof data;
|
|
7328
7358
|
return parsedTypeFromType(t, data);
|
|
@@ -7551,7 +7581,7 @@ function lt_default() {
|
|
|
7551
7581
|
localeError: error24()
|
|
7552
7582
|
};
|
|
7553
7583
|
}
|
|
7554
|
-
// ../../zod/v4/locales/mk.js
|
|
7584
|
+
// ../../node_modules/zod/v4/locales/mk.js
|
|
7555
7585
|
var error25 = () => {
|
|
7556
7586
|
const Sizable = {
|
|
7557
7587
|
string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
|
|
@@ -7668,7 +7698,7 @@ function mk_default() {
|
|
|
7668
7698
|
localeError: error25()
|
|
7669
7699
|
};
|
|
7670
7700
|
}
|
|
7671
|
-
// ../../zod/v4/locales/ms.js
|
|
7701
|
+
// ../../node_modules/zod/v4/locales/ms.js
|
|
7672
7702
|
var error26 = () => {
|
|
7673
7703
|
const Sizable = {
|
|
7674
7704
|
string: { unit: "aksara", verb: "mempunyai" },
|
|
@@ -7784,7 +7814,7 @@ function ms_default() {
|
|
|
7784
7814
|
localeError: error26()
|
|
7785
7815
|
};
|
|
7786
7816
|
}
|
|
7787
|
-
// ../../zod/v4/locales/nl.js
|
|
7817
|
+
// ../../node_modules/zod/v4/locales/nl.js
|
|
7788
7818
|
var error27 = () => {
|
|
7789
7819
|
const Sizable = {
|
|
7790
7820
|
string: { unit: "tekens" },
|
|
@@ -7901,7 +7931,7 @@ function nl_default() {
|
|
|
7901
7931
|
localeError: error27()
|
|
7902
7932
|
};
|
|
7903
7933
|
}
|
|
7904
|
-
// ../../zod/v4/locales/no.js
|
|
7934
|
+
// ../../node_modules/zod/v4/locales/no.js
|
|
7905
7935
|
var error28 = () => {
|
|
7906
7936
|
const Sizable = {
|
|
7907
7937
|
string: { unit: "tegn", verb: "\xE5 ha" },
|
|
@@ -8017,7 +8047,7 @@ function no_default() {
|
|
|
8017
8047
|
localeError: error28()
|
|
8018
8048
|
};
|
|
8019
8049
|
}
|
|
8020
|
-
// ../../zod/v4/locales/ota.js
|
|
8050
|
+
// ../../node_modules/zod/v4/locales/ota.js
|
|
8021
8051
|
var error29 = () => {
|
|
8022
8052
|
const Sizable = {
|
|
8023
8053
|
string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
|
|
@@ -8133,7 +8163,7 @@ function ota_default() {
|
|
|
8133
8163
|
localeError: error29()
|
|
8134
8164
|
};
|
|
8135
8165
|
}
|
|
8136
|
-
// ../../zod/v4/locales/ps.js
|
|
8166
|
+
// ../../node_modules/zod/v4/locales/ps.js
|
|
8137
8167
|
var error30 = () => {
|
|
8138
8168
|
const Sizable = {
|
|
8139
8169
|
string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
|
|
@@ -8255,7 +8285,7 @@ function ps_default() {
|
|
|
8255
8285
|
localeError: error30()
|
|
8256
8286
|
};
|
|
8257
8287
|
}
|
|
8258
|
-
// ../../zod/v4/locales/pl.js
|
|
8288
|
+
// ../../node_modules/zod/v4/locales/pl.js
|
|
8259
8289
|
var error31 = () => {
|
|
8260
8290
|
const Sizable = {
|
|
8261
8291
|
string: { unit: "znak\xF3w", verb: "mie\u0107" },
|
|
@@ -8372,7 +8402,7 @@ function pl_default() {
|
|
|
8372
8402
|
localeError: error31()
|
|
8373
8403
|
};
|
|
8374
8404
|
}
|
|
8375
|
-
// ../../zod/v4/locales/pt.js
|
|
8405
|
+
// ../../node_modules/zod/v4/locales/pt.js
|
|
8376
8406
|
var error32 = () => {
|
|
8377
8407
|
const Sizable = {
|
|
8378
8408
|
string: { unit: "caracteres", verb: "ter" },
|
|
@@ -8488,7 +8518,7 @@ function pt_default() {
|
|
|
8488
8518
|
localeError: error32()
|
|
8489
8519
|
};
|
|
8490
8520
|
}
|
|
8491
|
-
// ../../zod/v4/locales/ru.js
|
|
8521
|
+
// ../../node_modules/zod/v4/locales/ru.js
|
|
8492
8522
|
function getRussianPlural(count, one, few, many) {
|
|
8493
8523
|
const absCount = Math.abs(count);
|
|
8494
8524
|
const lastDigit = absCount % 10;
|
|
@@ -8652,7 +8682,7 @@ function ru_default() {
|
|
|
8652
8682
|
localeError: error33()
|
|
8653
8683
|
};
|
|
8654
8684
|
}
|
|
8655
|
-
// ../../zod/v4/locales/sl.js
|
|
8685
|
+
// ../../node_modules/zod/v4/locales/sl.js
|
|
8656
8686
|
var error34 = () => {
|
|
8657
8687
|
const Sizable = {
|
|
8658
8688
|
string: { unit: "znakov", verb: "imeti" },
|
|
@@ -8769,7 +8799,7 @@ function sl_default() {
|
|
|
8769
8799
|
localeError: error34()
|
|
8770
8800
|
};
|
|
8771
8801
|
}
|
|
8772
|
-
// ../../zod/v4/locales/sv.js
|
|
8802
|
+
// ../../node_modules/zod/v4/locales/sv.js
|
|
8773
8803
|
var error35 = () => {
|
|
8774
8804
|
const Sizable = {
|
|
8775
8805
|
string: { unit: "tecken", verb: "att ha" },
|
|
@@ -8887,7 +8917,7 @@ function sv_default() {
|
|
|
8887
8917
|
localeError: error35()
|
|
8888
8918
|
};
|
|
8889
8919
|
}
|
|
8890
|
-
// ../../zod/v4/locales/ta.js
|
|
8920
|
+
// ../../node_modules/zod/v4/locales/ta.js
|
|
8891
8921
|
var error36 = () => {
|
|
8892
8922
|
const Sizable = {
|
|
8893
8923
|
string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
|
|
@@ -9004,7 +9034,7 @@ function ta_default() {
|
|
|
9004
9034
|
localeError: error36()
|
|
9005
9035
|
};
|
|
9006
9036
|
}
|
|
9007
|
-
// ../../zod/v4/locales/th.js
|
|
9037
|
+
// ../../node_modules/zod/v4/locales/th.js
|
|
9008
9038
|
var error37 = () => {
|
|
9009
9039
|
const Sizable = {
|
|
9010
9040
|
string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
|
|
@@ -9121,7 +9151,7 @@ function th_default() {
|
|
|
9121
9151
|
localeError: error37()
|
|
9122
9152
|
};
|
|
9123
9153
|
}
|
|
9124
|
-
// ../../zod/v4/locales/tr.js
|
|
9154
|
+
// ../../node_modules/zod/v4/locales/tr.js
|
|
9125
9155
|
var parsedType6 = (data) => {
|
|
9126
9156
|
const t = typeof data;
|
|
9127
9157
|
switch (t) {
|
|
@@ -9236,7 +9266,7 @@ function tr_default() {
|
|
|
9236
9266
|
localeError: error38()
|
|
9237
9267
|
};
|
|
9238
9268
|
}
|
|
9239
|
-
// ../../zod/v4/locales/uk.js
|
|
9269
|
+
// ../../node_modules/zod/v4/locales/uk.js
|
|
9240
9270
|
var error39 = () => {
|
|
9241
9271
|
const Sizable = {
|
|
9242
9272
|
string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
|
|
@@ -9353,11 +9383,11 @@ function uk_default() {
|
|
|
9353
9383
|
};
|
|
9354
9384
|
}
|
|
9355
9385
|
|
|
9356
|
-
// ../../zod/v4/locales/ua.js
|
|
9386
|
+
// ../../node_modules/zod/v4/locales/ua.js
|
|
9357
9387
|
function ua_default() {
|
|
9358
9388
|
return uk_default();
|
|
9359
9389
|
}
|
|
9360
|
-
// ../../zod/v4/locales/ur.js
|
|
9390
|
+
// ../../node_modules/zod/v4/locales/ur.js
|
|
9361
9391
|
var error40 = () => {
|
|
9362
9392
|
const Sizable = {
|
|
9363
9393
|
string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
|
|
@@ -9474,7 +9504,7 @@ function ur_default() {
|
|
|
9474
9504
|
localeError: error40()
|
|
9475
9505
|
};
|
|
9476
9506
|
}
|
|
9477
|
-
// ../../zod/v4/locales/vi.js
|
|
9507
|
+
// ../../node_modules/zod/v4/locales/vi.js
|
|
9478
9508
|
var error41 = () => {
|
|
9479
9509
|
const Sizable = {
|
|
9480
9510
|
string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
|
|
@@ -9590,7 +9620,7 @@ function vi_default() {
|
|
|
9590
9620
|
localeError: error41()
|
|
9591
9621
|
};
|
|
9592
9622
|
}
|
|
9593
|
-
// ../../zod/v4/locales/zh-CN.js
|
|
9623
|
+
// ../../node_modules/zod/v4/locales/zh-CN.js
|
|
9594
9624
|
var error42 = () => {
|
|
9595
9625
|
const Sizable = {
|
|
9596
9626
|
string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
|
|
@@ -9706,7 +9736,7 @@ function zh_CN_default() {
|
|
|
9706
9736
|
localeError: error42()
|
|
9707
9737
|
};
|
|
9708
9738
|
}
|
|
9709
|
-
// ../../zod/v4/locales/zh-TW.js
|
|
9739
|
+
// ../../node_modules/zod/v4/locales/zh-TW.js
|
|
9710
9740
|
var error43 = () => {
|
|
9711
9741
|
const Sizable = {
|
|
9712
9742
|
string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
|
|
@@ -9823,7 +9853,7 @@ function zh_TW_default() {
|
|
|
9823
9853
|
localeError: error43()
|
|
9824
9854
|
};
|
|
9825
9855
|
}
|
|
9826
|
-
// ../../zod/v4/locales/yo.js
|
|
9856
|
+
// ../../node_modules/zod/v4/locales/yo.js
|
|
9827
9857
|
var error44 = () => {
|
|
9828
9858
|
const Sizable = {
|
|
9829
9859
|
string: { unit: "\xE0mi", verb: "n\xED" },
|
|
@@ -9938,7 +9968,7 @@ function yo_default() {
|
|
|
9938
9968
|
localeError: error44()
|
|
9939
9969
|
};
|
|
9940
9970
|
}
|
|
9941
|
-
// ../../zod/v4/core/registries.js
|
|
9971
|
+
// ../../node_modules/zod/v4/core/registries.js
|
|
9942
9972
|
var $output = Symbol("ZodOutput");
|
|
9943
9973
|
var $input = Symbol("ZodInput");
|
|
9944
9974
|
|
|
@@ -9989,7 +10019,7 @@ function registry() {
|
|
|
9989
10019
|
return new $ZodRegistry;
|
|
9990
10020
|
}
|
|
9991
10021
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
9992
|
-
// ../../zod/v4/core/api.js
|
|
10022
|
+
// ../../node_modules/zod/v4/core/api.js
|
|
9993
10023
|
function _string(Class2, params) {
|
|
9994
10024
|
return new Class2({
|
|
9995
10025
|
type: "string",
|
|
@@ -10867,7 +10897,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
10867
10897
|
const inst = new Class2(def);
|
|
10868
10898
|
return inst;
|
|
10869
10899
|
}
|
|
10870
|
-
// ../../zod/v4/core/to-json-schema.js
|
|
10900
|
+
// ../../node_modules/zod/v4/core/to-json-schema.js
|
|
10871
10901
|
class JSONSchemaGenerator {
|
|
10872
10902
|
constructor(params) {
|
|
10873
10903
|
this.counter = 0;
|
|
@@ -11671,9 +11701,9 @@ function isTransforming(_schema, _ctx) {
|
|
|
11671
11701
|
}
|
|
11672
11702
|
throw new Error(`Unknown schema type: ${def.type}`);
|
|
11673
11703
|
}
|
|
11674
|
-
// ../../zod/v4/core/json-schema.js
|
|
11704
|
+
// ../../node_modules/zod/v4/core/json-schema.js
|
|
11675
11705
|
var exports_json_schema = {};
|
|
11676
|
-
// ../../zod/v4/classic/iso.js
|
|
11706
|
+
// ../../node_modules/zod/v4/classic/iso.js
|
|
11677
11707
|
var exports_iso = {};
|
|
11678
11708
|
__export(exports_iso, {
|
|
11679
11709
|
time: () => time2,
|
|
@@ -11714,7 +11744,7 @@ function duration2(params) {
|
|
|
11714
11744
|
return _isoDuration(ZodISODuration, params);
|
|
11715
11745
|
}
|
|
11716
11746
|
|
|
11717
|
-
// ../../zod/v4/classic/errors.js
|
|
11747
|
+
// ../../node_modules/zod/v4/classic/errors.js
|
|
11718
11748
|
var initializer2 = (inst, issues) => {
|
|
11719
11749
|
$ZodError.init(inst, issues);
|
|
11720
11750
|
inst.name = "ZodError";
|
|
@@ -11749,7 +11779,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
11749
11779
|
Parent: Error
|
|
11750
11780
|
});
|
|
11751
11781
|
|
|
11752
|
-
// ../../zod/v4/classic/parse.js
|
|
11782
|
+
// ../../node_modules/zod/v4/classic/parse.js
|
|
11753
11783
|
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
11754
11784
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
11755
11785
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -11763,7 +11793,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
11763
11793
|
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
11764
11794
|
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
11765
11795
|
|
|
11766
|
-
// ../../zod/v4/classic/schemas.js
|
|
11796
|
+
// ../../node_modules/zod/v4/classic/schemas.js
|
|
11767
11797
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
11768
11798
|
$ZodType.init(inst, def);
|
|
11769
11799
|
inst.def = def;
|
|
@@ -12738,7 +12768,7 @@ function json(params) {
|
|
|
12738
12768
|
function preprocess(fn, schema) {
|
|
12739
12769
|
return pipe(transform(fn), schema);
|
|
12740
12770
|
}
|
|
12741
|
-
// ../../zod/v4/classic/compat.js
|
|
12771
|
+
// ../../node_modules/zod/v4/classic/compat.js
|
|
12742
12772
|
var ZodIssueCode = {
|
|
12743
12773
|
invalid_type: "invalid_type",
|
|
12744
12774
|
too_big: "too_big",
|
|
@@ -12762,7 +12792,7 @@ function getErrorMap() {
|
|
|
12762
12792
|
}
|
|
12763
12793
|
var ZodFirstPartyTypeKind;
|
|
12764
12794
|
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
12765
|
-
// ../../zod/v4/classic/coerce.js
|
|
12795
|
+
// ../../node_modules/zod/v4/classic/coerce.js
|
|
12766
12796
|
var exports_coerce = {};
|
|
12767
12797
|
__export(exports_coerce, {
|
|
12768
12798
|
string: () => string3,
|
|
@@ -12787,61 +12817,67 @@ function date4(params) {
|
|
|
12787
12817
|
return _coercedDate(ZodDate, params);
|
|
12788
12818
|
}
|
|
12789
12819
|
|
|
12790
|
-
// ../../zod/v4/classic/external.js
|
|
12820
|
+
// ../../node_modules/zod/v4/classic/external.js
|
|
12791
12821
|
config(en_default());
|
|
12792
|
-
//
|
|
12822
|
+
// ../../node_modules/@opencode-ai/plugin/dist/tool.js
|
|
12793
12823
|
function tool(input) {
|
|
12794
12824
|
return input;
|
|
12795
12825
|
}
|
|
12796
12826
|
tool.schema = exports_external;
|
|
12797
12827
|
// tools.ts
|
|
12798
12828
|
var createComplianceRecordTool = tool({
|
|
12799
|
-
description: "Create
|
|
12829
|
+
description: "Create compliance record",
|
|
12800
12830
|
args: {
|
|
12801
|
-
tool_name:
|
|
12802
|
-
owner:
|
|
12803
|
-
repo:
|
|
12804
|
-
title:
|
|
12805
|
-
body:
|
|
12806
|
-
github_username:
|
|
12807
|
-
approved_at:
|
|
12808
|
-
checks:
|
|
12809
|
-
check_type: tool.schema.string({ description: "Type of check performed" }),
|
|
12810
|
-
passed: tool.schema.boolean({ description: "Whether check passed" }),
|
|
12811
|
-
details: tool.schema.record(tool.schema.string(), tool.schema.any()).optional({ description: "Additional details" })
|
|
12812
|
-
})).optional({ description: "List of compliance checks performed" })
|
|
12831
|
+
tool_name: exports_external.string(),
|
|
12832
|
+
owner: exports_external.string(),
|
|
12833
|
+
repo: exports_external.string(),
|
|
12834
|
+
title: exports_external.string().optional(),
|
|
12835
|
+
body: exports_external.string(),
|
|
12836
|
+
github_username: exports_external.string(),
|
|
12837
|
+
approved_at: exports_external.string(),
|
|
12838
|
+
checks: exports_external.string().optional()
|
|
12813
12839
|
},
|
|
12814
12840
|
async execute(args, _context) {
|
|
12841
|
+
let checks3 = [];
|
|
12842
|
+
if (args.checks) {
|
|
12843
|
+
try {
|
|
12844
|
+
checks3 = JSON.parse(args.checks);
|
|
12845
|
+
} catch {
|
|
12846
|
+
checks3 = [];
|
|
12847
|
+
}
|
|
12848
|
+
}
|
|
12849
|
+
const body = Buffer.from(args.body, "base64").toString("utf-8");
|
|
12850
|
+
const title = args.title ? Buffer.from(args.title, "base64").toString("utf-8") : null;
|
|
12815
12851
|
const input = {
|
|
12816
12852
|
tool_name: args.tool_name,
|
|
12817
12853
|
owner: args.owner,
|
|
12818
12854
|
repo: args.repo,
|
|
12819
|
-
title
|
|
12820
|
-
body
|
|
12855
|
+
title,
|
|
12856
|
+
body,
|
|
12821
12857
|
github_username: args.github_username,
|
|
12822
12858
|
approved_at: args.approved_at,
|
|
12823
|
-
checks:
|
|
12859
|
+
checks: checks3
|
|
12824
12860
|
};
|
|
12825
12861
|
const recordId = await createComplianceRecord(input);
|
|
12826
|
-
return {
|
|
12862
|
+
return JSON.stringify({
|
|
12827
12863
|
success: true,
|
|
12828
12864
|
record_id: recordId,
|
|
12829
|
-
message: "Compliance record created
|
|
12865
|
+
message: "Compliance record created",
|
|
12830
12866
|
expires_at: new Date(Date.now() + 30 * 60 * 1000).toISOString()
|
|
12831
|
-
};
|
|
12867
|
+
});
|
|
12832
12868
|
}
|
|
12833
12869
|
});
|
|
12834
12870
|
var getComplianceStatusTool = tool({
|
|
12835
|
-
description: "Check
|
|
12871
|
+
description: "Check compliance status",
|
|
12836
12872
|
args: {
|
|
12837
|
-
tool_name:
|
|
12838
|
-
owner:
|
|
12839
|
-
repo:
|
|
12840
|
-
content_hash:
|
|
12873
|
+
tool_name: exports_external.string(),
|
|
12874
|
+
owner: exports_external.string(),
|
|
12875
|
+
repo: exports_external.string(),
|
|
12876
|
+
content_hash: exports_external.string()
|
|
12841
12877
|
},
|
|
12842
12878
|
async execute(args, _context) {
|
|
12843
12879
|
const status = await getComplianceStatus(args.tool_name, args.owner, args.repo, args.content_hash);
|
|
12844
|
-
return status;
|
|
12880
|
+
return JSON.stringify(status);
|
|
12845
12881
|
}
|
|
12846
12882
|
});
|
|
12847
12883
|
var tools = {
|
|
@@ -12850,6 +12886,77 @@ var tools = {
|
|
|
12850
12886
|
};
|
|
12851
12887
|
|
|
12852
12888
|
// plugin.ts
|
|
12889
|
+
function isMcpTool(toolName) {
|
|
12890
|
+
return toolName.startsWith("github_");
|
|
12891
|
+
}
|
|
12892
|
+
function extractToolInfoFromArgs(toolName, args) {
|
|
12893
|
+
const fields = extractRecordFields(toolName, args);
|
|
12894
|
+
return {
|
|
12895
|
+
toolName: fields.toolName,
|
|
12896
|
+
owner: fields.owner,
|
|
12897
|
+
repo: fields.repo,
|
|
12898
|
+
title: fields.title,
|
|
12899
|
+
body: fields.body,
|
|
12900
|
+
contentHash: fields.contentHash
|
|
12901
|
+
};
|
|
12902
|
+
}
|
|
12903
|
+
function extractArgs(input, output) {
|
|
12904
|
+
if (output.args && typeof output.args === "object") {
|
|
12905
|
+
return output.args;
|
|
12906
|
+
}
|
|
12907
|
+
if (input.arguments && typeof input.arguments === "object") {
|
|
12908
|
+
return input.arguments;
|
|
12909
|
+
}
|
|
12910
|
+
if (input.args && typeof input.args === "object") {
|
|
12911
|
+
return input.args;
|
|
12912
|
+
}
|
|
12913
|
+
if (typeof input.arguments === "string") {
|
|
12914
|
+
try {
|
|
12915
|
+
return JSON.parse(input.arguments);
|
|
12916
|
+
} catch {}
|
|
12917
|
+
}
|
|
12918
|
+
return null;
|
|
12919
|
+
}
|
|
12920
|
+
async function validateAndProcess(toolName, owner, repo, contentHash, toolInfo) {
|
|
12921
|
+
const record2 = await getComplianceRecord(toolName, owner, repo, contentHash);
|
|
12922
|
+
const validation = await validateCompliance(record2, {
|
|
12923
|
+
toolName,
|
|
12924
|
+
owner,
|
|
12925
|
+
repo,
|
|
12926
|
+
contentHash
|
|
12927
|
+
});
|
|
12928
|
+
if (!validation.valid) {
|
|
12929
|
+
await logFailedAttempt({
|
|
12930
|
+
tool_name: toolName,
|
|
12931
|
+
owner,
|
|
12932
|
+
repo,
|
|
12933
|
+
reason: validation.reason,
|
|
12934
|
+
content_hash: contentHash,
|
|
12935
|
+
provided_record_id: record2?.id || null,
|
|
12936
|
+
error_details: validation.message
|
|
12937
|
+
});
|
|
12938
|
+
return { allowed: false, record: record2, validation };
|
|
12939
|
+
}
|
|
12940
|
+
await markRecordUsed(record2.id);
|
|
12941
|
+
return { allowed: true, record: record2, validation };
|
|
12942
|
+
}
|
|
12943
|
+
async function logSuccess(toolInfo, record2, result) {
|
|
12944
|
+
const githubUrl = extractGitHubUrl(result);
|
|
12945
|
+
const githubId = extractGitHubId(result);
|
|
12946
|
+
await logAudit({
|
|
12947
|
+
compliance_record_id: record2.id,
|
|
12948
|
+
tool_name: toolInfo.toolName,
|
|
12949
|
+
owner: toolInfo.owner,
|
|
12950
|
+
repo: toolInfo.repo,
|
|
12951
|
+
github_username: record2.github_username,
|
|
12952
|
+
status: "success",
|
|
12953
|
+
error_message: null,
|
|
12954
|
+
github_url: githubUrl,
|
|
12955
|
+
github_id: githubId,
|
|
12956
|
+
executed_at: new Date().toISOString(),
|
|
12957
|
+
content_preview: toolInfo.body ? toolInfo.body.substring(0, 500) : null
|
|
12958
|
+
});
|
|
12959
|
+
}
|
|
12853
12960
|
var GitHubCompliancePlugin = async (_ctx) => {
|
|
12854
12961
|
await initDatabase();
|
|
12855
12962
|
return {
|
|
@@ -12858,10 +12965,16 @@ var GitHubCompliancePlugin = async (_ctx) => {
|
|
|
12858
12965
|
if (!isGitHubWriteTool(input.tool)) {
|
|
12859
12966
|
return;
|
|
12860
12967
|
}
|
|
12968
|
+
const isMcp = isMcpTool(input.tool);
|
|
12969
|
+
if (isMcp) {
|
|
12970
|
+
output.__needsMcpValidation = true;
|
|
12971
|
+
output.__mcpToolName = input.tool;
|
|
12972
|
+
return;
|
|
12973
|
+
}
|
|
12861
12974
|
let toolInfo;
|
|
12862
|
-
let record2 = null;
|
|
12863
12975
|
try {
|
|
12864
|
-
|
|
12976
|
+
const args = extractArgs(input, output);
|
|
12977
|
+
toolInfo = extractToolInfoFromArgs(input.tool, args);
|
|
12865
12978
|
} catch (error45) {
|
|
12866
12979
|
await logFailedAttempt({
|
|
12867
12980
|
tool_name: input.tool,
|
|
@@ -12878,21 +12991,10 @@ var GitHubCompliancePlugin = async (_ctx) => {
|
|
|
12878
12991
|
}));
|
|
12879
12992
|
}
|
|
12880
12993
|
try {
|
|
12881
|
-
record2 = await
|
|
12882
|
-
|
|
12883
|
-
if (!validation.valid) {
|
|
12884
|
-
await logFailedAttempt({
|
|
12885
|
-
tool_name: toolInfo.toolName,
|
|
12886
|
-
owner: toolInfo.owner,
|
|
12887
|
-
repo: toolInfo.repo,
|
|
12888
|
-
reason: validation.reason,
|
|
12889
|
-
content_hash: toolInfo.contentHash,
|
|
12890
|
-
provided_record_id: record2?.id || null,
|
|
12891
|
-
error_details: validation.message
|
|
12892
|
-
});
|
|
12994
|
+
const { allowed, record: record2, validation } = await validateAndProcess(toolInfo.toolName, toolInfo.owner, toolInfo.repo, toolInfo.contentHash, toolInfo);
|
|
12995
|
+
if (!allowed) {
|
|
12893
12996
|
throw new Error(buildBlockedError(validation));
|
|
12894
12997
|
}
|
|
12895
|
-
await markRecordUsed(record2.id);
|
|
12896
12998
|
output.__complianceRecordId = record2.id;
|
|
12897
12999
|
output.__toolInfo = toolInfo;
|
|
12898
13000
|
} catch (error45) {
|
|
@@ -12902,10 +13004,10 @@ var GitHubCompliancePlugin = async (_ctx) => {
|
|
|
12902
13004
|
await logFailedAttempt({
|
|
12903
13005
|
tool_name: toolInfo.toolName,
|
|
12904
13006
|
owner: toolInfo.owner,
|
|
12905
|
-
|
|
13007
|
+
toolInfo: toolInfo.repo,
|
|
12906
13008
|
reason: ERROR_REASONS.UNEXPECTED_ERROR,
|
|
12907
13009
|
content_hash: toolInfo.contentHash,
|
|
12908
|
-
provided_record_id:
|
|
13010
|
+
provided_record_id: null,
|
|
12909
13011
|
error_details: error45 instanceof Error ? error45.message : String(error45)
|
|
12910
13012
|
});
|
|
12911
13013
|
throw new Error(buildBlockedError({
|
|
@@ -12919,26 +13021,63 @@ var GitHubCompliancePlugin = async (_ctx) => {
|
|
|
12919
13021
|
if (!isGitHubWriteTool(input.tool)) {
|
|
12920
13022
|
return;
|
|
12921
13023
|
}
|
|
13024
|
+
const isMcp = isMcpTool(input.tool);
|
|
13025
|
+
const needsMcpValidation = output.__needsMcpValidation === true;
|
|
13026
|
+
if (isMcp && needsMcpValidation) {
|
|
13027
|
+
let toolInfo2;
|
|
13028
|
+
try {
|
|
13029
|
+
const args = input.args;
|
|
13030
|
+
toolInfo2 = extractToolInfoFromArgs(input.tool, args || null);
|
|
13031
|
+
} catch (error45) {
|
|
13032
|
+
await logFailedAttempt({
|
|
13033
|
+
tool_name: input.tool,
|
|
13034
|
+
owner: "unknown",
|
|
13035
|
+
repo: "unknown",
|
|
13036
|
+
reason: ERROR_REASONS.EXTRACTION_ERROR,
|
|
13037
|
+
content_hash: null,
|
|
13038
|
+
error_details: `Failed to extract MCP tool info in after hook: ${error45 instanceof Error ? error45.message : String(error45)}`
|
|
13039
|
+
});
|
|
13040
|
+
return;
|
|
13041
|
+
}
|
|
13042
|
+
try {
|
|
13043
|
+
const { allowed, record: record3, validation } = await validateAndProcess(toolInfo2.toolName, toolInfo2.owner, toolInfo2.repo, toolInfo2.contentHash, toolInfo2);
|
|
13044
|
+
if (!allowed) {
|
|
13045
|
+
await logFailedAttempt({
|
|
13046
|
+
tool_name: toolInfo2.toolName,
|
|
13047
|
+
owner: toolInfo2.owner,
|
|
13048
|
+
repo: toolInfo2.repo,
|
|
13049
|
+
reason: validation.reason,
|
|
13050
|
+
content_hash: toolInfo2.contentHash,
|
|
13051
|
+
provided_record_id: record3?.id || null,
|
|
13052
|
+
error_details: "MCP tool executed without valid compliance record"
|
|
13053
|
+
});
|
|
13054
|
+
return;
|
|
13055
|
+
}
|
|
13056
|
+
if (record3) {
|
|
13057
|
+
await logSuccess(toolInfo2, record3, output.result);
|
|
13058
|
+
}
|
|
13059
|
+
} catch (error45) {
|
|
13060
|
+
await logFailedAttempt({
|
|
13061
|
+
tool_name: toolInfo2.toolName,
|
|
13062
|
+
owner: toolInfo2.owner,
|
|
13063
|
+
repo: toolInfo2.repo,
|
|
13064
|
+
reason: ERROR_REASONS.UNEXPECTED_ERROR,
|
|
13065
|
+
content_hash: toolInfo2.contentHash,
|
|
13066
|
+
provided_record_id: null,
|
|
13067
|
+
error_details: error45 instanceof Error ? error45.message : String(error45)
|
|
13068
|
+
});
|
|
13069
|
+
}
|
|
13070
|
+
return;
|
|
13071
|
+
}
|
|
12922
13072
|
const complianceRecordId = output.__complianceRecordId;
|
|
12923
13073
|
const toolInfo = output.__toolInfo;
|
|
12924
13074
|
if (!complianceRecordId || !toolInfo) {
|
|
12925
13075
|
return;
|
|
12926
13076
|
}
|
|
12927
|
-
const
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
tool_name: toolInfo.toolName,
|
|
12932
|
-
owner: toolInfo.owner,
|
|
12933
|
-
repo: toolInfo.repo,
|
|
12934
|
-
github_username: "unknown",
|
|
12935
|
-
status: "success",
|
|
12936
|
-
error_message: null,
|
|
12937
|
-
github_url: githubUrl,
|
|
12938
|
-
github_id: githubId,
|
|
12939
|
-
executed_at: new Date().toISOString(),
|
|
12940
|
-
content_preview: toolInfo.body ? toolInfo.body.substring(0, 500) : null
|
|
12941
|
-
});
|
|
13077
|
+
const record2 = await getComplianceRecord(toolInfo.toolName, toolInfo.owner, toolInfo.repo, toolInfo.contentHash);
|
|
13078
|
+
if (record2) {
|
|
13079
|
+
await logSuccess(toolInfo, record2, output.result);
|
|
13080
|
+
}
|
|
12942
13081
|
}
|
|
12943
13082
|
};
|
|
12944
13083
|
};
|