@probelabs/visor 0.1.170-ee → 0.1.171-ee
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/defaults/code-talk.yaml +39 -238
- package/defaults/intent-router.yaml +1 -0
- package/dist/agent-protocol/task-store.d.ts +5 -0
- package/dist/agent-protocol/task-store.d.ts.map +1 -1
- package/dist/agent-protocol/tasks-cli-handler.d.ts.map +1 -1
- package/dist/agent-protocol/track-execution.d.ts +34 -0
- package/dist/agent-protocol/track-execution.d.ts.map +1 -0
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/defaults/code-talk.yaml +39 -238
- package/dist/defaults/intent-router.yaml +1 -0
- package/dist/frontends/host.d.ts +2 -0
- package/dist/frontends/host.d.ts.map +1 -1
- package/dist/generated/config-schema.d.ts +10 -6
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +10 -6
- package/dist/index.js +696 -95
- package/dist/scheduler/scheduler.d.ts +4 -0
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/sdk/{a2a-frontend-YTXQGUDH.mjs → a2a-frontend-GUEGI5SX.mjs} +20 -3
- package/dist/sdk/a2a-frontend-GUEGI5SX.mjs.map +1 -0
- package/dist/sdk/{check-provider-registry-T5FWS4SW.mjs → check-provider-registry-7P2QIKJR.mjs} +8 -8
- package/dist/sdk/{check-provider-registry-Q2OVYSBJ.mjs → check-provider-registry-ZUU7KSKR.mjs} +7 -7
- package/dist/sdk/{chunk-FTUGQP5L.mjs → chunk-5SBX4KLG.mjs} +2 -2
- package/dist/sdk/{chunk-2CNT2EB3.mjs → chunk-6FXVWL6M.mjs} +3 -3
- package/dist/sdk/{chunk-KFKHU6CM.mjs → chunk-6VVXKXTI.mjs} +19 -2
- package/dist/sdk/chunk-6VVXKXTI.mjs.map +1 -0
- package/dist/sdk/{chunk-SVBF7Y2R.mjs → chunk-A2YVTICA.mjs} +11 -7
- package/dist/sdk/chunk-A2YVTICA.mjs.map +1 -0
- package/dist/sdk/{chunk-DLO46M5M.mjs → chunk-CXA3WUOB.mjs} +62 -23
- package/dist/sdk/chunk-CXA3WUOB.mjs.map +1 -0
- package/dist/sdk/{chunk-62PXPI6Q.mjs → chunk-GGNR347O.mjs} +8 -2
- package/dist/sdk/chunk-GGNR347O.mjs.map +1 -0
- package/dist/sdk/{chunk-46P7AYHG.mjs → chunk-YCPJBOJB.mjs} +68 -29
- package/dist/sdk/chunk-YCPJBOJB.mjs.map +1 -0
- package/dist/sdk/{config-IHECYTNT.mjs → config-6GWD673K.mjs} +2 -2
- package/dist/sdk/{failure-condition-evaluator-NJO6DSL4.mjs → failure-condition-evaluator-5HRNHZCC.mjs} +4 -3
- package/dist/sdk/{github-frontend-WPTKI4AY.mjs → github-frontend-ZZRU6P43.mjs} +7 -7
- package/dist/sdk/{host-6HV5FMD7.mjs → host-A7UNRBQU.mjs} +3 -3
- package/dist/sdk/host-A7UNRBQU.mjs.map +1 -0
- package/dist/sdk/{host-RATJKJW5.mjs → host-ECXTIDWG.mjs} +3 -3
- package/dist/sdk/host-ECXTIDWG.mjs.map +1 -0
- package/dist/sdk/{loader-NJCF7DUS.mjs → loader-QMJFFST6.mjs} +1 -1
- package/dist/sdk/{routing-RWZEXSRZ.mjs → routing-AMRQYI7J.mjs} +5 -4
- package/dist/sdk/{schedule-tool-VI5IUMEL.mjs → schedule-tool-DGVJDHJM.mjs} +7 -7
- package/dist/sdk/{schedule-tool-JCKV47FU.mjs → schedule-tool-I6VG3ZVA.mjs} +8 -8
- package/dist/sdk/{schedule-tool-handler-PIXYVVJY.mjs → schedule-tool-handler-DFUC5S55.mjs} +8 -8
- package/dist/sdk/{schedule-tool-handler-ZDAD6SWM.mjs → schedule-tool-handler-XLCSBU3E.mjs} +7 -7
- package/dist/sdk/sdk.d.mts +4 -0
- package/dist/sdk/sdk.d.ts +4 -0
- package/dist/sdk/sdk.js +429 -285
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +7 -7
- package/dist/sdk/{trace-helpers-ZYN23GBG.mjs → trace-helpers-4ZBZWH5W.mjs} +3 -2
- package/dist/sdk/track-execution-VWLQIGY7.mjs +82 -0
- package/dist/sdk/track-execution-VWLQIGY7.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-OAOD3A5U.mjs → workflow-check-provider-AKXDIL2Y.mjs} +8 -8
- package/dist/sdk/{workflow-check-provider-W5FKQU5G.mjs → workflow-check-provider-KQNLEQEY.mjs} +7 -7
- package/dist/slack/socket-runner.d.ts +4 -0
- package/dist/slack/socket-runner.d.ts.map +1 -1
- package/dist/telemetry/trace-helpers.d.ts.map +1 -1
- package/dist/tui/chat-runner.d.ts +4 -0
- package/dist/tui/chat-runner.d.ts.map +1 -1
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +4 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/instance-id.d.ts +9 -0
- package/dist/utils/instance-id.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/sdk/a2a-frontend-YTXQGUDH.mjs.map +0 -1
- package/dist/sdk/chunk-46P7AYHG.mjs.map +0 -1
- package/dist/sdk/chunk-62PXPI6Q.mjs.map +0 -1
- package/dist/sdk/chunk-DLO46M5M.mjs.map +0 -1
- package/dist/sdk/chunk-KFKHU6CM.mjs.map +0 -1
- package/dist/sdk/chunk-SVBF7Y2R.mjs.map +0 -1
- package/dist/sdk/host-6HV5FMD7.mjs.map +0 -1
- package/dist/sdk/host-RATJKJW5.mjs.map +0 -1
- /package/dist/sdk/{check-provider-registry-Q2OVYSBJ.mjs.map → check-provider-registry-7P2QIKJR.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-T5FWS4SW.mjs.map → check-provider-registry-ZUU7KSKR.mjs.map} +0 -0
- /package/dist/sdk/{chunk-FTUGQP5L.mjs.map → chunk-5SBX4KLG.mjs.map} +0 -0
- /package/dist/sdk/{chunk-2CNT2EB3.mjs.map → chunk-6FXVWL6M.mjs.map} +0 -0
- /package/dist/sdk/{config-IHECYTNT.mjs.map → config-6GWD673K.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-NJO6DSL4.mjs.map → failure-condition-evaluator-5HRNHZCC.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-WPTKI4AY.mjs.map → github-frontend-ZZRU6P43.mjs.map} +0 -0
- /package/dist/sdk/{loader-NJCF7DUS.mjs.map → loader-QMJFFST6.mjs.map} +0 -0
- /package/dist/sdk/{routing-RWZEXSRZ.mjs.map → routing-AMRQYI7J.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-JCKV47FU.mjs.map → schedule-tool-DGVJDHJM.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-VI5IUMEL.mjs.map → schedule-tool-I6VG3ZVA.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-PIXYVVJY.mjs.map → schedule-tool-handler-DFUC5S55.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-ZDAD6SWM.mjs.map → schedule-tool-handler-XLCSBU3E.mjs.map} +0 -0
- /package/dist/sdk/{trace-helpers-ZYN23GBG.mjs.map → trace-helpers-4ZBZWH5W.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-OAOD3A5U.mjs.map → workflow-check-provider-AKXDIL2Y.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-W5FKQU5G.mjs.map → workflow-check-provider-KQNLEQEY.mjs.map} +0 -0
package/dist/sdk/sdk.js
CHANGED
|
@@ -570,6 +570,21 @@ var init_logger = __esm({
|
|
|
570
570
|
}
|
|
571
571
|
});
|
|
572
572
|
|
|
573
|
+
// src/utils/instance-id.ts
|
|
574
|
+
function getInstanceId() {
|
|
575
|
+
if (!_instanceId) {
|
|
576
|
+
_instanceId = generateHumanId();
|
|
577
|
+
}
|
|
578
|
+
return _instanceId;
|
|
579
|
+
}
|
|
580
|
+
var _instanceId;
|
|
581
|
+
var init_instance_id = __esm({
|
|
582
|
+
"src/utils/instance-id.ts"() {
|
|
583
|
+
"use strict";
|
|
584
|
+
init_human_id();
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
573
588
|
// src/telemetry/fallback-ndjson.ts
|
|
574
589
|
var fallback_ndjson_exports = {};
|
|
575
590
|
__export(fallback_ndjson_exports, {
|
|
@@ -760,7 +775,7 @@ var require_package = __commonJS({
|
|
|
760
775
|
"@opentelemetry/sdk-node": "^0.203.0",
|
|
761
776
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
762
777
|
"@opentelemetry/semantic-conventions": "^1.30.1",
|
|
763
|
-
"@probelabs/probe": "^0.6.0-
|
|
778
|
+
"@probelabs/probe": "^0.6.0-rc290",
|
|
764
779
|
"@types/commander": "^2.12.0",
|
|
765
780
|
"@types/uuid": "^10.0.0",
|
|
766
781
|
acorn: "^8.16.0",
|
|
@@ -939,25 +954,26 @@ function getVisorRunAttributes() {
|
|
|
939
954
|
if (commitFull) {
|
|
940
955
|
attrs["visor.commit.sha"] = commitFull;
|
|
941
956
|
}
|
|
957
|
+
attrs["visor.instance_id"] = getInstanceId();
|
|
942
958
|
return attrs;
|
|
943
959
|
}
|
|
944
960
|
function __getOrCreateNdjsonPath() {
|
|
945
961
|
try {
|
|
946
962
|
if (process.env.VISOR_TELEMETRY_SINK && process.env.VISOR_TELEMETRY_SINK !== "file")
|
|
947
963
|
return null;
|
|
948
|
-
const
|
|
964
|
+
const path33 = require("path");
|
|
949
965
|
const fs29 = require("fs");
|
|
950
966
|
if (process.env.VISOR_FALLBACK_TRACE_FILE) {
|
|
951
967
|
__ndjsonPath = process.env.VISOR_FALLBACK_TRACE_FILE;
|
|
952
|
-
const dir =
|
|
968
|
+
const dir = path33.dirname(__ndjsonPath);
|
|
953
969
|
if (!fs29.existsSync(dir)) fs29.mkdirSync(dir, { recursive: true });
|
|
954
970
|
return __ndjsonPath;
|
|
955
971
|
}
|
|
956
|
-
const outDir = process.env.VISOR_TRACE_DIR ||
|
|
972
|
+
const outDir = process.env.VISOR_TRACE_DIR || path33.join(process.cwd(), "output", "traces");
|
|
957
973
|
if (!fs29.existsSync(outDir)) fs29.mkdirSync(outDir, { recursive: true });
|
|
958
974
|
if (!__ndjsonPath) {
|
|
959
975
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
960
|
-
__ndjsonPath =
|
|
976
|
+
__ndjsonPath = path33.join(outDir, `${ts}.ndjson`);
|
|
961
977
|
}
|
|
962
978
|
return __ndjsonPath;
|
|
963
979
|
} catch {
|
|
@@ -979,6 +995,7 @@ var init_trace_helpers = __esm({
|
|
|
979
995
|
"src/telemetry/trace-helpers.ts"() {
|
|
980
996
|
"use strict";
|
|
981
997
|
init_lazy_otel();
|
|
998
|
+
init_instance_id();
|
|
982
999
|
__ndjsonPath = null;
|
|
983
1000
|
}
|
|
984
1001
|
});
|
|
@@ -3734,9 +3751,9 @@ function configureLiquidWithExtensions(liquid) {
|
|
|
3734
3751
|
});
|
|
3735
3752
|
liquid.registerFilter("get", (obj, pathExpr) => {
|
|
3736
3753
|
if (obj == null) return void 0;
|
|
3737
|
-
const
|
|
3738
|
-
if (!
|
|
3739
|
-
const parts =
|
|
3754
|
+
const path33 = typeof pathExpr === "string" ? pathExpr : String(pathExpr || "");
|
|
3755
|
+
if (!path33) return obj;
|
|
3756
|
+
const parts = path33.split(".");
|
|
3740
3757
|
let cur = obj;
|
|
3741
3758
|
for (const p of parts) {
|
|
3742
3759
|
if (cur == null) return void 0;
|
|
@@ -3855,9 +3872,9 @@ function configureLiquidWithExtensions(liquid) {
|
|
|
3855
3872
|
}
|
|
3856
3873
|
}
|
|
3857
3874
|
const defaultRole = typeof rolesCfg.default === "string" && rolesCfg.default.trim() ? rolesCfg.default.trim() : void 0;
|
|
3858
|
-
const getNested = (obj,
|
|
3859
|
-
if (!obj || !
|
|
3860
|
-
const parts =
|
|
3875
|
+
const getNested = (obj, path33) => {
|
|
3876
|
+
if (!obj || !path33) return void 0;
|
|
3877
|
+
const parts = path33.split(".");
|
|
3861
3878
|
let cur = obj;
|
|
3862
3879
|
for (const p of parts) {
|
|
3863
3880
|
if (cur == null) return void 0;
|
|
@@ -6410,7 +6427,7 @@ async function renderTemplateContent(checkId, checkConfig, reviewSummary) {
|
|
|
6410
6427
|
try {
|
|
6411
6428
|
const { createExtendedLiquid: createExtendedLiquid2 } = await Promise.resolve().then(() => (init_liquid_extensions(), liquid_extensions_exports));
|
|
6412
6429
|
const fs29 = await import("fs/promises");
|
|
6413
|
-
const
|
|
6430
|
+
const path33 = await import("path");
|
|
6414
6431
|
const schemaRaw = checkConfig.schema || "plain";
|
|
6415
6432
|
const schema = typeof schemaRaw === "string" ? schemaRaw : "code-review";
|
|
6416
6433
|
let templateContent;
|
|
@@ -6418,19 +6435,19 @@ async function renderTemplateContent(checkId, checkConfig, reviewSummary) {
|
|
|
6418
6435
|
templateContent = String(checkConfig.template.content);
|
|
6419
6436
|
} else if (checkConfig.template && checkConfig.template.file) {
|
|
6420
6437
|
const file = String(checkConfig.template.file);
|
|
6421
|
-
const resolved =
|
|
6438
|
+
const resolved = path33.resolve(process.cwd(), file);
|
|
6422
6439
|
templateContent = await fs29.readFile(resolved, "utf-8");
|
|
6423
6440
|
} else if (schema && schema !== "plain") {
|
|
6424
6441
|
const sanitized = String(schema).replace(/[^a-zA-Z0-9-]/g, "");
|
|
6425
6442
|
if (sanitized) {
|
|
6426
6443
|
const candidatePaths = [
|
|
6427
|
-
|
|
6444
|
+
path33.join(__dirname, "output", sanitized, "template.liquid"),
|
|
6428
6445
|
// bundled: dist/output/
|
|
6429
|
-
|
|
6446
|
+
path33.join(__dirname, "..", "..", "output", sanitized, "template.liquid"),
|
|
6430
6447
|
// source: output/
|
|
6431
|
-
|
|
6448
|
+
path33.join(process.cwd(), "output", sanitized, "template.liquid"),
|
|
6432
6449
|
// fallback: cwd/output/
|
|
6433
|
-
|
|
6450
|
+
path33.join(process.cwd(), "dist", "output", sanitized, "template.liquid")
|
|
6434
6451
|
// fallback: cwd/dist/output/
|
|
6435
6452
|
];
|
|
6436
6453
|
for (const p of candidatePaths) {
|
|
@@ -8157,7 +8174,7 @@ ${schemaString}`);
|
|
|
8157
8174
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8158
8175
|
try {
|
|
8159
8176
|
const fs29 = require("fs");
|
|
8160
|
-
const
|
|
8177
|
+
const path33 = require("path");
|
|
8161
8178
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8162
8179
|
const provider = this.config.provider || "auto";
|
|
8163
8180
|
const model = this.config.model || "default";
|
|
@@ -8271,16 +8288,16 @@ ${"=".repeat(60)}
|
|
|
8271
8288
|
`;
|
|
8272
8289
|
readableVersion += `${"=".repeat(60)}
|
|
8273
8290
|
`;
|
|
8274
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8291
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8275
8292
|
if (!fs29.existsSync(debugArtifactsDir)) {
|
|
8276
8293
|
fs29.mkdirSync(debugArtifactsDir, { recursive: true });
|
|
8277
8294
|
}
|
|
8278
|
-
const debugFile =
|
|
8295
|
+
const debugFile = path33.join(
|
|
8279
8296
|
debugArtifactsDir,
|
|
8280
8297
|
`prompt-${_checkName || "unknown"}-${timestamp}.json`
|
|
8281
8298
|
);
|
|
8282
8299
|
fs29.writeFileSync(debugFile, debugJson, "utf-8");
|
|
8283
|
-
const readableFile =
|
|
8300
|
+
const readableFile = path33.join(
|
|
8284
8301
|
debugArtifactsDir,
|
|
8285
8302
|
`prompt-${_checkName || "unknown"}-${timestamp}.txt`
|
|
8286
8303
|
);
|
|
@@ -8318,7 +8335,7 @@ ${"=".repeat(60)}
|
|
|
8318
8335
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8319
8336
|
try {
|
|
8320
8337
|
const fs29 = require("fs");
|
|
8321
|
-
const
|
|
8338
|
+
const path33 = require("path");
|
|
8322
8339
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8323
8340
|
const agentAny2 = agent;
|
|
8324
8341
|
let fullHistory = [];
|
|
@@ -8329,8 +8346,8 @@ ${"=".repeat(60)}
|
|
|
8329
8346
|
} else if (agentAny2._messages) {
|
|
8330
8347
|
fullHistory = agentAny2._messages;
|
|
8331
8348
|
}
|
|
8332
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8333
|
-
const sessionBase =
|
|
8349
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8350
|
+
const sessionBase = path33.join(
|
|
8334
8351
|
debugArtifactsDir,
|
|
8335
8352
|
`session-${_checkName || "unknown"}-${timestamp}`
|
|
8336
8353
|
);
|
|
@@ -8379,10 +8396,10 @@ ${"=".repeat(60)}
|
|
|
8379
8396
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8380
8397
|
try {
|
|
8381
8398
|
const fs29 = require("fs");
|
|
8382
|
-
const
|
|
8399
|
+
const path33 = require("path");
|
|
8383
8400
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8384
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8385
|
-
const responseFile =
|
|
8401
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8402
|
+
const responseFile = path33.join(
|
|
8386
8403
|
debugArtifactsDir,
|
|
8387
8404
|
`response-${_checkName || "unknown"}-${timestamp}.txt`
|
|
8388
8405
|
);
|
|
@@ -8647,7 +8664,7 @@ ${schemaString}`);
|
|
|
8647
8664
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8648
8665
|
try {
|
|
8649
8666
|
const fs29 = require("fs");
|
|
8650
|
-
const
|
|
8667
|
+
const path33 = require("path");
|
|
8651
8668
|
const os3 = require("os");
|
|
8652
8669
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8653
8670
|
const debugData = {
|
|
@@ -8721,13 +8738,13 @@ ${"=".repeat(60)}
|
|
|
8721
8738
|
readableVersion += `${"=".repeat(60)}
|
|
8722
8739
|
`;
|
|
8723
8740
|
const tempDir = os3.tmpdir();
|
|
8724
|
-
const promptFile =
|
|
8741
|
+
const promptFile = path33.join(tempDir, `visor-prompt-${timestamp}.txt`);
|
|
8725
8742
|
fs29.writeFileSync(promptFile, prompt, "utf-8");
|
|
8726
8743
|
log(`
|
|
8727
8744
|
\u{1F4BE} Prompt saved to: ${promptFile}`);
|
|
8728
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8745
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8729
8746
|
try {
|
|
8730
|
-
const base =
|
|
8747
|
+
const base = path33.join(
|
|
8731
8748
|
debugArtifactsDir,
|
|
8732
8749
|
`prompt-${_checkName || "unknown"}-${timestamp}`
|
|
8733
8750
|
);
|
|
@@ -8778,7 +8795,7 @@ $ ${cliCommand}
|
|
|
8778
8795
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8779
8796
|
try {
|
|
8780
8797
|
const fs29 = require("fs");
|
|
8781
|
-
const
|
|
8798
|
+
const path33 = require("path");
|
|
8782
8799
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8783
8800
|
const agentAny = agent;
|
|
8784
8801
|
let fullHistory = [];
|
|
@@ -8789,8 +8806,8 @@ $ ${cliCommand}
|
|
|
8789
8806
|
} else if (agentAny._messages) {
|
|
8790
8807
|
fullHistory = agentAny._messages;
|
|
8791
8808
|
}
|
|
8792
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8793
|
-
const sessionBase =
|
|
8809
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8810
|
+
const sessionBase = path33.join(
|
|
8794
8811
|
debugArtifactsDir,
|
|
8795
8812
|
`session-${_checkName || "unknown"}-${timestamp}`
|
|
8796
8813
|
);
|
|
@@ -8839,10 +8856,10 @@ ${"=".repeat(60)}
|
|
|
8839
8856
|
if (process.env.VISOR_DEBUG_AI_SESSIONS === "true") {
|
|
8840
8857
|
try {
|
|
8841
8858
|
const fs29 = require("fs");
|
|
8842
|
-
const
|
|
8859
|
+
const path33 = require("path");
|
|
8843
8860
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8844
|
-
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS ||
|
|
8845
|
-
const responseFile =
|
|
8861
|
+
const debugArtifactsDir = process.env.VISOR_DEBUG_ARTIFACTS || path33.join(process.cwd(), "debug-artifacts");
|
|
8862
|
+
const responseFile = path33.join(
|
|
8846
8863
|
debugArtifactsDir,
|
|
8847
8864
|
`response-${_checkName || "unknown"}-${timestamp}.txt`
|
|
8848
8865
|
);
|
|
@@ -8934,7 +8951,7 @@ ${"=".repeat(60)}
|
|
|
8934
8951
|
*/
|
|
8935
8952
|
async loadSchemaContent(schema) {
|
|
8936
8953
|
const fs29 = require("fs").promises;
|
|
8937
|
-
const
|
|
8954
|
+
const path33 = require("path");
|
|
8938
8955
|
if (typeof schema === "object" && schema !== null) {
|
|
8939
8956
|
log("\u{1F4CB} Using inline schema object from configuration");
|
|
8940
8957
|
return JSON.stringify(schema);
|
|
@@ -8947,12 +8964,12 @@ ${"=".repeat(60)}
|
|
|
8947
8964
|
}
|
|
8948
8965
|
} catch {
|
|
8949
8966
|
}
|
|
8950
|
-
if ((schema.startsWith("./") || schema.includes(".json")) && !
|
|
8967
|
+
if ((schema.startsWith("./") || schema.includes(".json")) && !path33.isAbsolute(schema)) {
|
|
8951
8968
|
if (schema.includes("..") || schema.includes("\0")) {
|
|
8952
8969
|
throw new Error("Invalid schema path: path traversal not allowed");
|
|
8953
8970
|
}
|
|
8954
8971
|
try {
|
|
8955
|
-
const schemaPath =
|
|
8972
|
+
const schemaPath = path33.resolve(process.cwd(), schema);
|
|
8956
8973
|
log(`\u{1F4CB} Loading custom schema from file: ${schemaPath}`);
|
|
8957
8974
|
const schemaContent = await fs29.readFile(schemaPath, "utf-8");
|
|
8958
8975
|
return schemaContent.trim();
|
|
@@ -8968,11 +8985,11 @@ ${"=".repeat(60)}
|
|
|
8968
8985
|
}
|
|
8969
8986
|
const candidatePaths = [
|
|
8970
8987
|
// GitHub Action bundle location
|
|
8971
|
-
|
|
8988
|
+
path33.join(__dirname, "output", sanitizedSchemaName, "schema.json"),
|
|
8972
8989
|
// Historical fallback when src/output was inadvertently bundled as output1/
|
|
8973
|
-
|
|
8990
|
+
path33.join(__dirname, "output1", sanitizedSchemaName, "schema.json"),
|
|
8974
8991
|
// Local dev (repo root)
|
|
8975
|
-
|
|
8992
|
+
path33.join(process.cwd(), "output", sanitizedSchemaName, "schema.json")
|
|
8976
8993
|
];
|
|
8977
8994
|
for (const schemaPath of candidatePaths) {
|
|
8978
8995
|
try {
|
|
@@ -8981,9 +8998,9 @@ ${"=".repeat(60)}
|
|
|
8981
8998
|
} catch {
|
|
8982
8999
|
}
|
|
8983
9000
|
}
|
|
8984
|
-
const distPath =
|
|
8985
|
-
const distAltPath =
|
|
8986
|
-
const cwdPath =
|
|
9001
|
+
const distPath = path33.join(__dirname, "output", sanitizedSchemaName, "schema.json");
|
|
9002
|
+
const distAltPath = path33.join(__dirname, "output1", sanitizedSchemaName, "schema.json");
|
|
9003
|
+
const cwdPath = path33.join(process.cwd(), "output", sanitizedSchemaName, "schema.json");
|
|
8987
9004
|
throw new Error(
|
|
8988
9005
|
`Failed to load schema '${sanitizedSchemaName}'. Tried: ${distPath}, ${distAltPath}, and ${cwdPath}. Ensure build copies 'output/' into dist (build:cli), or provide a custom schema file/path.`
|
|
8989
9006
|
);
|
|
@@ -12432,6 +12449,10 @@ var init_config_schema = __esm({
|
|
|
12432
12449
|
agent_protocol: {
|
|
12433
12450
|
$ref: "#/definitions/AgentProtocolConfig",
|
|
12434
12451
|
description: "Agent protocol (A2A) server configuration"
|
|
12452
|
+
},
|
|
12453
|
+
task_tracking: {
|
|
12454
|
+
type: "boolean",
|
|
12455
|
+
description: "Enable cross-frontend task tracking (default: false). When true, all workflow executions (CLI, Slack, TUI, Scheduler) are recorded in a shared SQLite TaskStore visible via `visor tasks`."
|
|
12435
12456
|
}
|
|
12436
12457
|
},
|
|
12437
12458
|
required: ["version"],
|
|
@@ -13168,7 +13189,7 @@ var init_config_schema = __esm({
|
|
|
13168
13189
|
description: "Arguments/inputs for the workflow"
|
|
13169
13190
|
},
|
|
13170
13191
|
overrides: {
|
|
13171
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13192
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916%3E%3E",
|
|
13172
13193
|
description: "Override specific step configurations in the workflow"
|
|
13173
13194
|
},
|
|
13174
13195
|
output_mapping: {
|
|
@@ -13184,7 +13205,7 @@ var init_config_schema = __esm({
|
|
|
13184
13205
|
description: "Config file path - alternative to workflow ID (loads a Visor config file as workflow)"
|
|
13185
13206
|
},
|
|
13186
13207
|
workflow_overrides: {
|
|
13187
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13208
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916%3E%3E",
|
|
13188
13209
|
description: "Alias for overrides - workflow step overrides (backward compatibility)"
|
|
13189
13210
|
},
|
|
13190
13211
|
ref: {
|
|
@@ -13882,7 +13903,7 @@ var init_config_schema = __esm({
|
|
|
13882
13903
|
description: "Custom output name (defaults to workflow name)"
|
|
13883
13904
|
},
|
|
13884
13905
|
overrides: {
|
|
13885
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13906
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916%3E%3E",
|
|
13886
13907
|
description: "Step overrides"
|
|
13887
13908
|
},
|
|
13888
13909
|
output_mapping: {
|
|
@@ -13897,13 +13918,13 @@ var init_config_schema = __esm({
|
|
|
13897
13918
|
"^x-": {}
|
|
13898
13919
|
}
|
|
13899
13920
|
},
|
|
13900
|
-
"Record<string,Partial<interface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13921
|
+
"Record<string,Partial<interface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916>>": {
|
|
13901
13922
|
type: "object",
|
|
13902
13923
|
additionalProperties: {
|
|
13903
|
-
$ref: "#/definitions/Partial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13924
|
+
$ref: "#/definitions/Partial%3Cinterface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916%3E"
|
|
13904
13925
|
}
|
|
13905
13926
|
},
|
|
13906
|
-
"Partial<interface-src_types_config.ts-13844-28438-src_types_config.ts-0-
|
|
13927
|
+
"Partial<interface-src_types_config.ts-13844-28438-src_types_config.ts-0-55916>": {
|
|
13907
13928
|
type: "object",
|
|
13908
13929
|
additionalProperties: false
|
|
13909
13930
|
},
|
|
@@ -17977,17 +17998,17 @@ var init_workflow_check_provider = __esm({
|
|
|
17977
17998
|
* so it can be executed by the state machine as a nested workflow.
|
|
17978
17999
|
*/
|
|
17979
18000
|
async loadWorkflowFromConfigPath(sourcePath, baseDir) {
|
|
17980
|
-
const
|
|
18001
|
+
const path33 = require("path");
|
|
17981
18002
|
const fs29 = require("fs");
|
|
17982
18003
|
const yaml5 = require("js-yaml");
|
|
17983
|
-
const resolved =
|
|
18004
|
+
const resolved = path33.isAbsolute(sourcePath) ? sourcePath : path33.resolve(baseDir, sourcePath);
|
|
17984
18005
|
if (!fs29.existsSync(resolved)) {
|
|
17985
18006
|
throw new Error(`Workflow config not found at: ${resolved}`);
|
|
17986
18007
|
}
|
|
17987
18008
|
const rawContent = fs29.readFileSync(resolved, "utf8");
|
|
17988
18009
|
const rawData = yaml5.load(rawContent);
|
|
17989
18010
|
if (rawData.imports && Array.isArray(rawData.imports)) {
|
|
17990
|
-
const configDir =
|
|
18011
|
+
const configDir = path33.dirname(resolved);
|
|
17991
18012
|
for (const source of rawData.imports) {
|
|
17992
18013
|
const results = await this.registry.import(source, {
|
|
17993
18014
|
basePath: configDir,
|
|
@@ -18017,8 +18038,8 @@ ${errors}`);
|
|
|
18017
18038
|
if (!steps || Object.keys(steps).length === 0) {
|
|
18018
18039
|
throw new Error(`Config '${resolved}' does not contain any steps to execute as a workflow`);
|
|
18019
18040
|
}
|
|
18020
|
-
const id =
|
|
18021
|
-
const name = loaded.name || `Workflow from ${
|
|
18041
|
+
const id = path33.basename(resolved).replace(/\.(ya?ml)$/i, "");
|
|
18042
|
+
const name = loaded.name || `Workflow from ${path33.basename(resolved)}`;
|
|
18022
18043
|
const workflowDef = {
|
|
18023
18044
|
id,
|
|
18024
18045
|
name,
|
|
@@ -19431,6 +19452,74 @@ var init_github_auth = __esm({
|
|
|
19431
19452
|
}
|
|
19432
19453
|
});
|
|
19433
19454
|
|
|
19455
|
+
// src/agent-protocol/track-execution.ts
|
|
19456
|
+
var track_execution_exports = {};
|
|
19457
|
+
__export(track_execution_exports, {
|
|
19458
|
+
trackExecution: () => trackExecution
|
|
19459
|
+
});
|
|
19460
|
+
async function trackExecution(opts, executor) {
|
|
19461
|
+
const { taskStore, source, configPath, metadata, messageText } = opts;
|
|
19462
|
+
const configName = configPath ? import_path7.default.basename(configPath, import_path7.default.extname(configPath)) : void 0;
|
|
19463
|
+
const workflowId = configName && opts.workflowId ? `${configName}#${opts.workflowId}` : opts.workflowId;
|
|
19464
|
+
const requestMessage = {
|
|
19465
|
+
message_id: import_crypto2.default.randomUUID(),
|
|
19466
|
+
role: "user",
|
|
19467
|
+
parts: [{ text: messageText }]
|
|
19468
|
+
};
|
|
19469
|
+
const task = taskStore.createTask({
|
|
19470
|
+
contextId: import_crypto2.default.randomUUID(),
|
|
19471
|
+
requestMessage,
|
|
19472
|
+
workflowId,
|
|
19473
|
+
requestMetadata: {
|
|
19474
|
+
source,
|
|
19475
|
+
instance_id: getInstanceId(),
|
|
19476
|
+
trace_id: trace.getActiveSpan()?.spanContext().traceId || void 0,
|
|
19477
|
+
...metadata
|
|
19478
|
+
}
|
|
19479
|
+
});
|
|
19480
|
+
const instanceId = getInstanceId();
|
|
19481
|
+
taskStore.updateTaskState(task.id, "working");
|
|
19482
|
+
taskStore.claimTask(task.id, instanceId);
|
|
19483
|
+
logger.info(
|
|
19484
|
+
`[TaskTracking] Task ${task.id} started (source=${source}, workflow=${workflowId || "-"}, instance=${instanceId})`
|
|
19485
|
+
);
|
|
19486
|
+
try {
|
|
19487
|
+
const result = await executor();
|
|
19488
|
+
const completedMsg = {
|
|
19489
|
+
message_id: import_crypto2.default.randomUUID(),
|
|
19490
|
+
role: "agent",
|
|
19491
|
+
parts: [{ text: "Execution completed" }]
|
|
19492
|
+
};
|
|
19493
|
+
taskStore.updateTaskState(task.id, "completed", completedMsg);
|
|
19494
|
+
logger.info(`[TaskTracking] Task ${task.id} completed`);
|
|
19495
|
+
return { task, result };
|
|
19496
|
+
} catch (err) {
|
|
19497
|
+
const errorText = err instanceof Error ? err.message : String(err);
|
|
19498
|
+
const failMessage = {
|
|
19499
|
+
message_id: import_crypto2.default.randomUUID(),
|
|
19500
|
+
role: "agent",
|
|
19501
|
+
parts: [{ text: errorText }]
|
|
19502
|
+
};
|
|
19503
|
+
try {
|
|
19504
|
+
taskStore.updateTaskState(task.id, "failed", failMessage);
|
|
19505
|
+
logger.info(`[TaskTracking] Task ${task.id} failed: ${errorText}`);
|
|
19506
|
+
} catch {
|
|
19507
|
+
}
|
|
19508
|
+
throw err;
|
|
19509
|
+
}
|
|
19510
|
+
}
|
|
19511
|
+
var import_crypto2, import_path7;
|
|
19512
|
+
var init_track_execution = __esm({
|
|
19513
|
+
"src/agent-protocol/track-execution.ts"() {
|
|
19514
|
+
"use strict";
|
|
19515
|
+
import_crypto2 = __toESM(require("crypto"));
|
|
19516
|
+
import_path7 = __toESM(require("path"));
|
|
19517
|
+
init_logger();
|
|
19518
|
+
init_lazy_otel();
|
|
19519
|
+
init_instance_id();
|
|
19520
|
+
}
|
|
19521
|
+
});
|
|
19522
|
+
|
|
19434
19523
|
// src/scheduler/scheduler.ts
|
|
19435
19524
|
function getScheduler(visorConfig, config) {
|
|
19436
19525
|
if (!schedulerInstance && visorConfig) {
|
|
@@ -19460,6 +19549,8 @@ var init_scheduler = __esm({
|
|
|
19460
19549
|
outputAdapters = /* @__PURE__ */ new Map();
|
|
19461
19550
|
executionContext = {};
|
|
19462
19551
|
contextEnricher;
|
|
19552
|
+
taskStore;
|
|
19553
|
+
configPath;
|
|
19463
19554
|
// HA fields
|
|
19464
19555
|
haConfig;
|
|
19465
19556
|
nodeId;
|
|
@@ -19485,6 +19576,11 @@ var init_scheduler = __esm({
|
|
|
19485
19576
|
setEngine(engine) {
|
|
19486
19577
|
this.engine = engine;
|
|
19487
19578
|
}
|
|
19579
|
+
/** Set shared task store for execution tracking. */
|
|
19580
|
+
setTaskStore(store, configPath) {
|
|
19581
|
+
this.taskStore = store;
|
|
19582
|
+
this.configPath = configPath;
|
|
19583
|
+
}
|
|
19488
19584
|
/**
|
|
19489
19585
|
* Set the execution context (e.g., Slack client) for workflow executions
|
|
19490
19586
|
*/
|
|
@@ -20026,7 +20122,7 @@ var init_scheduler = __esm({
|
|
|
20026
20122
|
} catch {
|
|
20027
20123
|
}
|
|
20028
20124
|
const { engine: runEngine, config: cfgForRun } = this.prepareExecution(schedule);
|
|
20029
|
-
|
|
20125
|
+
const schedExecFn = () => runEngine.executeChecks({
|
|
20030
20126
|
checks: checksToRun,
|
|
20031
20127
|
showDetails: true,
|
|
20032
20128
|
outputFormat: "json",
|
|
@@ -20035,6 +20131,22 @@ var init_scheduler = __esm({
|
|
|
20035
20131
|
debug: process.env.VISOR_DEBUG === "true",
|
|
20036
20132
|
inputs: schedule.workflowInputs
|
|
20037
20133
|
});
|
|
20134
|
+
if (this.taskStore) {
|
|
20135
|
+
const { trackExecution: trackExecution2 } = await Promise.resolve().then(() => (init_track_execution(), track_execution_exports));
|
|
20136
|
+
await trackExecution2(
|
|
20137
|
+
{
|
|
20138
|
+
taskStore: this.taskStore,
|
|
20139
|
+
source: "scheduler",
|
|
20140
|
+
workflowId: schedule.workflow,
|
|
20141
|
+
configPath: this.configPath,
|
|
20142
|
+
messageText: `Scheduled: ${schedule.workflow} (${schedule.id})`,
|
|
20143
|
+
metadata: { schedule_id: schedule.id, is_recurring: schedule.isRecurring }
|
|
20144
|
+
},
|
|
20145
|
+
schedExecFn
|
|
20146
|
+
);
|
|
20147
|
+
} else {
|
|
20148
|
+
await schedExecFn();
|
|
20149
|
+
}
|
|
20038
20150
|
return { message: "Workflow completed", workflow: schedule.workflow };
|
|
20039
20151
|
}
|
|
20040
20152
|
/**
|
|
@@ -20140,7 +20252,7 @@ Please provide an updated response based on the reminder above. You may referenc
|
|
|
20140
20252
|
responseRef
|
|
20141
20253
|
} = this.prepareExecution(schedule, reminderText);
|
|
20142
20254
|
try {
|
|
20143
|
-
|
|
20255
|
+
const reminderExecFn = () => runEngine.executeChecks({
|
|
20144
20256
|
checks: allChecks,
|
|
20145
20257
|
showDetails: true,
|
|
20146
20258
|
outputFormat: "json",
|
|
@@ -20148,6 +20260,22 @@ Please provide an updated response based on the reminder above. You may referenc
|
|
|
20148
20260
|
webhookContext: { webhookData, eventType: "schedule" },
|
|
20149
20261
|
debug: process.env.VISOR_DEBUG === "true"
|
|
20150
20262
|
});
|
|
20263
|
+
if (this.taskStore) {
|
|
20264
|
+
const { trackExecution: trackExecution2 } = await Promise.resolve().then(() => (init_track_execution(), track_execution_exports));
|
|
20265
|
+
await trackExecution2(
|
|
20266
|
+
{
|
|
20267
|
+
taskStore: this.taskStore,
|
|
20268
|
+
source: "scheduler",
|
|
20269
|
+
workflowId: schedule.workflow,
|
|
20270
|
+
configPath: this.configPath,
|
|
20271
|
+
messageText: reminderText || `Reminder: ${schedule.id}`,
|
|
20272
|
+
metadata: { schedule_id: schedule.id, is_recurring: schedule.isRecurring }
|
|
20273
|
+
},
|
|
20274
|
+
reminderExecFn
|
|
20275
|
+
);
|
|
20276
|
+
} else {
|
|
20277
|
+
await reminderExecFn();
|
|
20278
|
+
}
|
|
20151
20279
|
if (schedule.isRecurring && responseRef.captured) {
|
|
20152
20280
|
await this.store.updateAsync(schedule.id, { previousResponse: responseRef.captured });
|
|
20153
20281
|
logger.info(
|
|
@@ -22099,7 +22227,7 @@ var init_tool_resolver = __esm({
|
|
|
22099
22227
|
});
|
|
22100
22228
|
|
|
22101
22229
|
// src/providers/ai-check-provider.ts
|
|
22102
|
-
var import_promises4,
|
|
22230
|
+
var import_promises4, import_path8, AICheckProvider;
|
|
22103
22231
|
var init_ai_check_provider = __esm({
|
|
22104
22232
|
"src/providers/ai-check-provider.ts"() {
|
|
22105
22233
|
"use strict";
|
|
@@ -22109,7 +22237,7 @@ var init_ai_check_provider = __esm({
|
|
|
22109
22237
|
init_issue_filter();
|
|
22110
22238
|
init_liquid_extensions();
|
|
22111
22239
|
import_promises4 = __toESM(require("fs/promises"));
|
|
22112
|
-
|
|
22240
|
+
import_path8 = __toESM(require("path"));
|
|
22113
22241
|
init_lazy_otel();
|
|
22114
22242
|
init_state_capture();
|
|
22115
22243
|
init_mcp_custom_sse_server();
|
|
@@ -22274,7 +22402,7 @@ var init_ai_check_provider = __esm({
|
|
|
22274
22402
|
const hasFileExtension = /\.[a-zA-Z0-9]{1,10}$/i.test(str);
|
|
22275
22403
|
const hasPathSeparators = /[\/\\]/.test(str);
|
|
22276
22404
|
const isRelativePath = /^\.{1,2}\//.test(str);
|
|
22277
|
-
const isAbsolutePath =
|
|
22405
|
+
const isAbsolutePath = import_path8.default.isAbsolute(str);
|
|
22278
22406
|
const hasTypicalFileChars = /^[a-zA-Z0-9._\-\/\\:~]+$/.test(str);
|
|
22279
22407
|
if (!(hasFileExtension || isRelativePath || isAbsolutePath || hasPathSeparators)) {
|
|
22280
22408
|
return false;
|
|
@@ -22284,10 +22412,10 @@ var init_ai_check_provider = __esm({
|
|
|
22284
22412
|
}
|
|
22285
22413
|
try {
|
|
22286
22414
|
let resolvedPath;
|
|
22287
|
-
if (
|
|
22288
|
-
resolvedPath =
|
|
22415
|
+
if (import_path8.default.isAbsolute(str)) {
|
|
22416
|
+
resolvedPath = import_path8.default.normalize(str);
|
|
22289
22417
|
} else {
|
|
22290
|
-
resolvedPath =
|
|
22418
|
+
resolvedPath = import_path8.default.resolve(process.cwd(), str);
|
|
22291
22419
|
}
|
|
22292
22420
|
const fs29 = require("fs").promises;
|
|
22293
22421
|
try {
|
|
@@ -22308,14 +22436,14 @@ var init_ai_check_provider = __esm({
|
|
|
22308
22436
|
throw new Error("Prompt file must have .liquid extension");
|
|
22309
22437
|
}
|
|
22310
22438
|
let resolvedPath;
|
|
22311
|
-
if (
|
|
22439
|
+
if (import_path8.default.isAbsolute(promptPath)) {
|
|
22312
22440
|
resolvedPath = promptPath;
|
|
22313
22441
|
} else {
|
|
22314
|
-
resolvedPath =
|
|
22442
|
+
resolvedPath = import_path8.default.resolve(process.cwd(), promptPath);
|
|
22315
22443
|
}
|
|
22316
|
-
if (!
|
|
22317
|
-
const normalizedPath =
|
|
22318
|
-
const currentDir =
|
|
22444
|
+
if (!import_path8.default.isAbsolute(promptPath)) {
|
|
22445
|
+
const normalizedPath = import_path8.default.normalize(resolvedPath);
|
|
22446
|
+
const currentDir = import_path8.default.resolve(process.cwd());
|
|
22319
22447
|
if (!normalizedPath.startsWith(currentDir)) {
|
|
22320
22448
|
throw new Error("Invalid prompt file path: path traversal detected");
|
|
22321
22449
|
}
|
|
@@ -24494,7 +24622,7 @@ var init_oauth2_token_cache = __esm({
|
|
|
24494
24622
|
});
|
|
24495
24623
|
|
|
24496
24624
|
// src/providers/http-client-provider.ts
|
|
24497
|
-
var fs15,
|
|
24625
|
+
var fs15, path19, HttpClientProvider;
|
|
24498
24626
|
var init_http_client_provider = __esm({
|
|
24499
24627
|
"src/providers/http-client-provider.ts"() {
|
|
24500
24628
|
"use strict";
|
|
@@ -24506,7 +24634,7 @@ var init_http_client_provider = __esm({
|
|
|
24506
24634
|
init_oauth2_token_cache();
|
|
24507
24635
|
init_logger();
|
|
24508
24636
|
fs15 = __toESM(require("fs"));
|
|
24509
|
-
|
|
24637
|
+
path19 = __toESM(require("path"));
|
|
24510
24638
|
HttpClientProvider = class extends CheckProvider {
|
|
24511
24639
|
liquid;
|
|
24512
24640
|
sandbox;
|
|
@@ -24629,8 +24757,8 @@ var init_http_client_provider = __esm({
|
|
|
24629
24757
|
const parentContext = context2?._parentContext;
|
|
24630
24758
|
const workingDirectory = parentContext?.workingDirectory;
|
|
24631
24759
|
const workspaceEnabled = parentContext?.workspace?.isEnabled?.();
|
|
24632
|
-
if (workspaceEnabled && workingDirectory && !
|
|
24633
|
-
resolvedOutputFile =
|
|
24760
|
+
if (workspaceEnabled && workingDirectory && !path19.isAbsolute(resolvedOutputFile)) {
|
|
24761
|
+
resolvedOutputFile = path19.join(workingDirectory, resolvedOutputFile);
|
|
24634
24762
|
logger.debug(
|
|
24635
24763
|
`[http_client] Resolved relative output_file to workspace: ${resolvedOutputFile}`
|
|
24636
24764
|
);
|
|
@@ -24847,7 +24975,7 @@ var init_http_client_provider = __esm({
|
|
|
24847
24975
|
]
|
|
24848
24976
|
};
|
|
24849
24977
|
}
|
|
24850
|
-
const parentDir =
|
|
24978
|
+
const parentDir = path19.dirname(outputFile);
|
|
24851
24979
|
if (parentDir && !fs15.existsSync(parentDir)) {
|
|
24852
24980
|
fs15.mkdirSync(parentDir, { recursive: true });
|
|
24853
24981
|
}
|
|
@@ -25617,7 +25745,7 @@ var init_claude_code_types = __esm({
|
|
|
25617
25745
|
function isClaudeCodeConstructor(value) {
|
|
25618
25746
|
return typeof value === "function";
|
|
25619
25747
|
}
|
|
25620
|
-
var import_promises5,
|
|
25748
|
+
var import_promises5, import_path9, ClaudeCodeSDKNotInstalledError, ClaudeCodeAPIKeyMissingError, ClaudeCodeCheckProvider;
|
|
25621
25749
|
var init_claude_code_check_provider = __esm({
|
|
25622
25750
|
"src/providers/claude-code-check-provider.ts"() {
|
|
25623
25751
|
"use strict";
|
|
@@ -25626,7 +25754,7 @@ var init_claude_code_check_provider = __esm({
|
|
|
25626
25754
|
init_issue_filter();
|
|
25627
25755
|
init_liquid_extensions();
|
|
25628
25756
|
import_promises5 = __toESM(require("fs/promises"));
|
|
25629
|
-
|
|
25757
|
+
import_path9 = __toESM(require("path"));
|
|
25630
25758
|
init_claude_code_types();
|
|
25631
25759
|
ClaudeCodeSDKNotInstalledError = class extends Error {
|
|
25632
25760
|
constructor() {
|
|
@@ -25774,7 +25902,7 @@ var init_claude_code_check_provider = __esm({
|
|
|
25774
25902
|
const hasFileExtension = /\.[a-zA-Z0-9]{1,10}$/i.test(str);
|
|
25775
25903
|
const hasPathSeparators = /[\/\\]/.test(str);
|
|
25776
25904
|
const isRelativePath = /^\.{1,2}\//.test(str);
|
|
25777
|
-
const isAbsolutePath =
|
|
25905
|
+
const isAbsolutePath = import_path9.default.isAbsolute(str);
|
|
25778
25906
|
const hasTypicalFileChars = /^[a-zA-Z0-9._\-\/\\:~]+$/.test(str);
|
|
25779
25907
|
if (!(hasFileExtension || isRelativePath || isAbsolutePath || hasPathSeparators)) {
|
|
25780
25908
|
return false;
|
|
@@ -25784,10 +25912,10 @@ var init_claude_code_check_provider = __esm({
|
|
|
25784
25912
|
}
|
|
25785
25913
|
try {
|
|
25786
25914
|
let resolvedPath;
|
|
25787
|
-
if (
|
|
25788
|
-
resolvedPath =
|
|
25915
|
+
if (import_path9.default.isAbsolute(str)) {
|
|
25916
|
+
resolvedPath = import_path9.default.normalize(str);
|
|
25789
25917
|
} else {
|
|
25790
|
-
resolvedPath =
|
|
25918
|
+
resolvedPath = import_path9.default.resolve(process.cwd(), str);
|
|
25791
25919
|
}
|
|
25792
25920
|
try {
|
|
25793
25921
|
const stat2 = await import_promises5.default.stat(resolvedPath);
|
|
@@ -25807,14 +25935,14 @@ var init_claude_code_check_provider = __esm({
|
|
|
25807
25935
|
throw new Error("Prompt file must have .liquid extension");
|
|
25808
25936
|
}
|
|
25809
25937
|
let resolvedPath;
|
|
25810
|
-
if (
|
|
25938
|
+
if (import_path9.default.isAbsolute(promptPath)) {
|
|
25811
25939
|
resolvedPath = promptPath;
|
|
25812
25940
|
} else {
|
|
25813
|
-
resolvedPath =
|
|
25941
|
+
resolvedPath = import_path9.default.resolve(process.cwd(), promptPath);
|
|
25814
25942
|
}
|
|
25815
|
-
if (!
|
|
25816
|
-
const normalizedPath =
|
|
25817
|
-
const currentDir =
|
|
25943
|
+
if (!import_path9.default.isAbsolute(promptPath)) {
|
|
25944
|
+
const normalizedPath = import_path9.default.normalize(resolvedPath);
|
|
25945
|
+
const currentDir = import_path9.default.resolve(process.cwd());
|
|
25818
25946
|
if (!normalizedPath.startsWith(currentDir)) {
|
|
25819
25947
|
throw new Error("Invalid prompt file path: path traversal detected");
|
|
25820
25948
|
}
|
|
@@ -28393,14 +28521,14 @@ var require_util = __commonJS({
|
|
|
28393
28521
|
}
|
|
28394
28522
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
28395
28523
|
let origin = url.origin != null ? url.origin : `${url.protocol}//${url.hostname}:${port}`;
|
|
28396
|
-
let
|
|
28524
|
+
let path33 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
28397
28525
|
if (origin.endsWith("/")) {
|
|
28398
28526
|
origin = origin.substring(0, origin.length - 1);
|
|
28399
28527
|
}
|
|
28400
|
-
if (
|
|
28401
|
-
|
|
28528
|
+
if (path33 && !path33.startsWith("/")) {
|
|
28529
|
+
path33 = `/${path33}`;
|
|
28402
28530
|
}
|
|
28403
|
-
url = new URL(origin +
|
|
28531
|
+
url = new URL(origin + path33);
|
|
28404
28532
|
}
|
|
28405
28533
|
return url;
|
|
28406
28534
|
}
|
|
@@ -30014,20 +30142,20 @@ var require_parseParams = __commonJS({
|
|
|
30014
30142
|
var require_basename = __commonJS({
|
|
30015
30143
|
"node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) {
|
|
30016
30144
|
"use strict";
|
|
30017
|
-
module2.exports = function basename4(
|
|
30018
|
-
if (typeof
|
|
30145
|
+
module2.exports = function basename4(path33) {
|
|
30146
|
+
if (typeof path33 !== "string") {
|
|
30019
30147
|
return "";
|
|
30020
30148
|
}
|
|
30021
|
-
for (var i =
|
|
30022
|
-
switch (
|
|
30149
|
+
for (var i = path33.length - 1; i >= 0; --i) {
|
|
30150
|
+
switch (path33.charCodeAt(i)) {
|
|
30023
30151
|
case 47:
|
|
30024
30152
|
// '/'
|
|
30025
30153
|
case 92:
|
|
30026
|
-
|
|
30027
|
-
return
|
|
30154
|
+
path33 = path33.slice(i + 1);
|
|
30155
|
+
return path33 === ".." || path33 === "." ? "" : path33;
|
|
30028
30156
|
}
|
|
30029
30157
|
}
|
|
30030
|
-
return
|
|
30158
|
+
return path33 === ".." || path33 === "." ? "" : path33;
|
|
30031
30159
|
};
|
|
30032
30160
|
}
|
|
30033
30161
|
});
|
|
@@ -31031,11 +31159,11 @@ var require_util2 = __commonJS({
|
|
|
31031
31159
|
var assert = require("assert");
|
|
31032
31160
|
var { isUint8Array } = require("util/types");
|
|
31033
31161
|
var supportedHashes = [];
|
|
31034
|
-
var
|
|
31162
|
+
var crypto9;
|
|
31035
31163
|
try {
|
|
31036
|
-
|
|
31164
|
+
crypto9 = require("crypto");
|
|
31037
31165
|
const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
|
|
31038
|
-
supportedHashes =
|
|
31166
|
+
supportedHashes = crypto9.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
|
|
31039
31167
|
} catch {
|
|
31040
31168
|
}
|
|
31041
31169
|
function responseURL(response) {
|
|
@@ -31312,7 +31440,7 @@ var require_util2 = __commonJS({
|
|
|
31312
31440
|
}
|
|
31313
31441
|
}
|
|
31314
31442
|
function bytesMatch(bytes, metadataList) {
|
|
31315
|
-
if (
|
|
31443
|
+
if (crypto9 === void 0) {
|
|
31316
31444
|
return true;
|
|
31317
31445
|
}
|
|
31318
31446
|
const parsedMetadata = parseMetadata(metadataList);
|
|
@@ -31327,7 +31455,7 @@ var require_util2 = __commonJS({
|
|
|
31327
31455
|
for (const item of metadata) {
|
|
31328
31456
|
const algorithm = item.algo;
|
|
31329
31457
|
const expectedValue = item.hash;
|
|
31330
|
-
let actualValue =
|
|
31458
|
+
let actualValue = crypto9.createHash(algorithm).update(bytes).digest("base64");
|
|
31331
31459
|
if (actualValue[actualValue.length - 1] === "=") {
|
|
31332
31460
|
if (actualValue[actualValue.length - 2] === "=") {
|
|
31333
31461
|
actualValue = actualValue.slice(0, -2);
|
|
@@ -32674,8 +32802,8 @@ var require_body = __commonJS({
|
|
|
32674
32802
|
var { parseMIMEType, serializeAMimeType } = require_dataURL();
|
|
32675
32803
|
var random;
|
|
32676
32804
|
try {
|
|
32677
|
-
const
|
|
32678
|
-
random = (max) =>
|
|
32805
|
+
const crypto9 = require("crypto");
|
|
32806
|
+
random = (max) => crypto9.randomInt(0, max);
|
|
32679
32807
|
} catch {
|
|
32680
32808
|
random = (max) => Math.floor(Math.random(max));
|
|
32681
32809
|
}
|
|
@@ -33058,7 +33186,7 @@ var require_request = __commonJS({
|
|
|
33058
33186
|
}
|
|
33059
33187
|
var Request = class _Request {
|
|
33060
33188
|
constructor(origin, {
|
|
33061
|
-
path:
|
|
33189
|
+
path: path33,
|
|
33062
33190
|
method,
|
|
33063
33191
|
body,
|
|
33064
33192
|
headers,
|
|
@@ -33072,11 +33200,11 @@ var require_request = __commonJS({
|
|
|
33072
33200
|
throwOnError,
|
|
33073
33201
|
expectContinue
|
|
33074
33202
|
}, handler) {
|
|
33075
|
-
if (typeof
|
|
33203
|
+
if (typeof path33 !== "string") {
|
|
33076
33204
|
throw new InvalidArgumentError("path must be a string");
|
|
33077
|
-
} else if (
|
|
33205
|
+
} else if (path33[0] !== "/" && !(path33.startsWith("http://") || path33.startsWith("https://")) && method !== "CONNECT") {
|
|
33078
33206
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
33079
|
-
} else if (invalidPathRegex.exec(
|
|
33207
|
+
} else if (invalidPathRegex.exec(path33) !== null) {
|
|
33080
33208
|
throw new InvalidArgumentError("invalid request path");
|
|
33081
33209
|
}
|
|
33082
33210
|
if (typeof method !== "string") {
|
|
@@ -33139,7 +33267,7 @@ var require_request = __commonJS({
|
|
|
33139
33267
|
this.completed = false;
|
|
33140
33268
|
this.aborted = false;
|
|
33141
33269
|
this.upgrade = upgrade || null;
|
|
33142
|
-
this.path = query ? util.buildURL(
|
|
33270
|
+
this.path = query ? util.buildURL(path33, query) : path33;
|
|
33143
33271
|
this.origin = origin;
|
|
33144
33272
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
33145
33273
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -34147,9 +34275,9 @@ var require_RedirectHandler = __commonJS({
|
|
|
34147
34275
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
34148
34276
|
}
|
|
34149
34277
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
34150
|
-
const
|
|
34278
|
+
const path33 = search ? `${pathname}${search}` : pathname;
|
|
34151
34279
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
34152
|
-
this.opts.path =
|
|
34280
|
+
this.opts.path = path33;
|
|
34153
34281
|
this.opts.origin = origin;
|
|
34154
34282
|
this.opts.maxRedirections = 0;
|
|
34155
34283
|
this.opts.query = null;
|
|
@@ -35391,7 +35519,7 @@ var require_client = __commonJS({
|
|
|
35391
35519
|
writeH2(client, client[kHTTP2Session], request);
|
|
35392
35520
|
return;
|
|
35393
35521
|
}
|
|
35394
|
-
const { body, method, path:
|
|
35522
|
+
const { body, method, path: path33, host, upgrade, headers, blocking, reset } = request;
|
|
35395
35523
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
35396
35524
|
if (body && typeof body.read === "function") {
|
|
35397
35525
|
body.read(0);
|
|
@@ -35441,7 +35569,7 @@ var require_client = __commonJS({
|
|
|
35441
35569
|
if (blocking) {
|
|
35442
35570
|
socket[kBlocking] = true;
|
|
35443
35571
|
}
|
|
35444
|
-
let header = `${method} ${
|
|
35572
|
+
let header = `${method} ${path33} HTTP/1.1\r
|
|
35445
35573
|
`;
|
|
35446
35574
|
if (typeof host === "string") {
|
|
35447
35575
|
header += `host: ${host}\r
|
|
@@ -35504,7 +35632,7 @@ upgrade: ${upgrade}\r
|
|
|
35504
35632
|
return true;
|
|
35505
35633
|
}
|
|
35506
35634
|
function writeH2(client, session, request) {
|
|
35507
|
-
const { body, method, path:
|
|
35635
|
+
const { body, method, path: path33, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
35508
35636
|
let headers;
|
|
35509
35637
|
if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim());
|
|
35510
35638
|
else headers = reqHeaders;
|
|
@@ -35547,7 +35675,7 @@ upgrade: ${upgrade}\r
|
|
|
35547
35675
|
});
|
|
35548
35676
|
return true;
|
|
35549
35677
|
}
|
|
35550
|
-
headers[HTTP2_HEADER_PATH] =
|
|
35678
|
+
headers[HTTP2_HEADER_PATH] = path33;
|
|
35551
35679
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
35552
35680
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
35553
35681
|
if (body && typeof body.read === "function") {
|
|
@@ -37790,20 +37918,20 @@ var require_mock_utils = __commonJS({
|
|
|
37790
37918
|
}
|
|
37791
37919
|
return true;
|
|
37792
37920
|
}
|
|
37793
|
-
function safeUrl(
|
|
37794
|
-
if (typeof
|
|
37795
|
-
return
|
|
37921
|
+
function safeUrl(path33) {
|
|
37922
|
+
if (typeof path33 !== "string") {
|
|
37923
|
+
return path33;
|
|
37796
37924
|
}
|
|
37797
|
-
const pathSegments =
|
|
37925
|
+
const pathSegments = path33.split("?");
|
|
37798
37926
|
if (pathSegments.length !== 2) {
|
|
37799
|
-
return
|
|
37927
|
+
return path33;
|
|
37800
37928
|
}
|
|
37801
37929
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
37802
37930
|
qp.sort();
|
|
37803
37931
|
return [...pathSegments, qp.toString()].join("?");
|
|
37804
37932
|
}
|
|
37805
|
-
function matchKey(mockDispatch2, { path:
|
|
37806
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
37933
|
+
function matchKey(mockDispatch2, { path: path33, method, body, headers }) {
|
|
37934
|
+
const pathMatch = matchValue(mockDispatch2.path, path33);
|
|
37807
37935
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
37808
37936
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
37809
37937
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -37821,7 +37949,7 @@ var require_mock_utils = __commonJS({
|
|
|
37821
37949
|
function getMockDispatch(mockDispatches, key) {
|
|
37822
37950
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
37823
37951
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
37824
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
37952
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path33 }) => matchValue(safeUrl(path33), resolvedPath));
|
|
37825
37953
|
if (matchedMockDispatches.length === 0) {
|
|
37826
37954
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
37827
37955
|
}
|
|
@@ -37858,9 +37986,9 @@ var require_mock_utils = __commonJS({
|
|
|
37858
37986
|
}
|
|
37859
37987
|
}
|
|
37860
37988
|
function buildKey(opts) {
|
|
37861
|
-
const { path:
|
|
37989
|
+
const { path: path33, method, body, headers, query } = opts;
|
|
37862
37990
|
return {
|
|
37863
|
-
path:
|
|
37991
|
+
path: path33,
|
|
37864
37992
|
method,
|
|
37865
37993
|
body,
|
|
37866
37994
|
headers,
|
|
@@ -38309,10 +38437,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
38309
38437
|
}
|
|
38310
38438
|
format(pendingInterceptors) {
|
|
38311
38439
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
38312
|
-
({ method, path:
|
|
38440
|
+
({ method, path: path33, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
38313
38441
|
Method: method,
|
|
38314
38442
|
Origin: origin,
|
|
38315
|
-
Path:
|
|
38443
|
+
Path: path33,
|
|
38316
38444
|
"Status code": statusCode,
|
|
38317
38445
|
Persistent: persist ? "\u2705" : "\u274C",
|
|
38318
38446
|
Invocations: timesInvoked,
|
|
@@ -42933,8 +43061,8 @@ var require_util6 = __commonJS({
|
|
|
42933
43061
|
}
|
|
42934
43062
|
}
|
|
42935
43063
|
}
|
|
42936
|
-
function validateCookiePath(
|
|
42937
|
-
for (const char of
|
|
43064
|
+
function validateCookiePath(path33) {
|
|
43065
|
+
for (const char of path33) {
|
|
42938
43066
|
const code = char.charCodeAt(0);
|
|
42939
43067
|
if (code < 33 || char === ";") {
|
|
42940
43068
|
throw new Error("Invalid cookie path");
|
|
@@ -43731,9 +43859,9 @@ var require_connection = __commonJS({
|
|
|
43731
43859
|
channels.open = diagnosticsChannel.channel("undici:websocket:open");
|
|
43732
43860
|
channels.close = diagnosticsChannel.channel("undici:websocket:close");
|
|
43733
43861
|
channels.socketError = diagnosticsChannel.channel("undici:websocket:socket_error");
|
|
43734
|
-
var
|
|
43862
|
+
var crypto9;
|
|
43735
43863
|
try {
|
|
43736
|
-
|
|
43864
|
+
crypto9 = require("crypto");
|
|
43737
43865
|
} catch {
|
|
43738
43866
|
}
|
|
43739
43867
|
function establishWebSocketConnection(url, protocols, ws, onEstablish, options) {
|
|
@@ -43752,7 +43880,7 @@ var require_connection = __commonJS({
|
|
|
43752
43880
|
const headersList = new Headers(options.headers)[kHeadersList];
|
|
43753
43881
|
request.headersList = headersList;
|
|
43754
43882
|
}
|
|
43755
|
-
const keyValue =
|
|
43883
|
+
const keyValue = crypto9.randomBytes(16).toString("base64");
|
|
43756
43884
|
request.headersList.append("sec-websocket-key", keyValue);
|
|
43757
43885
|
request.headersList.append("sec-websocket-version", "13");
|
|
43758
43886
|
for (const protocol of protocols) {
|
|
@@ -43781,7 +43909,7 @@ var require_connection = __commonJS({
|
|
|
43781
43909
|
return;
|
|
43782
43910
|
}
|
|
43783
43911
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
43784
|
-
const digest =
|
|
43912
|
+
const digest = crypto9.createHash("sha1").update(keyValue + uid).digest("base64");
|
|
43785
43913
|
if (secWSAccept !== digest) {
|
|
43786
43914
|
failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
43787
43915
|
return;
|
|
@@ -43861,9 +43989,9 @@ var require_frame = __commonJS({
|
|
|
43861
43989
|
"node_modules/undici/lib/websocket/frame.js"(exports2, module2) {
|
|
43862
43990
|
"use strict";
|
|
43863
43991
|
var { maxUnsigned16Bit } = require_constants5();
|
|
43864
|
-
var
|
|
43992
|
+
var crypto9;
|
|
43865
43993
|
try {
|
|
43866
|
-
|
|
43994
|
+
crypto9 = require("crypto");
|
|
43867
43995
|
} catch {
|
|
43868
43996
|
}
|
|
43869
43997
|
var WebsocketFrameSend = class {
|
|
@@ -43872,7 +44000,7 @@ var require_frame = __commonJS({
|
|
|
43872
44000
|
*/
|
|
43873
44001
|
constructor(data) {
|
|
43874
44002
|
this.frameData = data;
|
|
43875
|
-
this.maskKey =
|
|
44003
|
+
this.maskKey = crypto9.randomBytes(4);
|
|
43876
44004
|
}
|
|
43877
44005
|
createFrame(opcode) {
|
|
43878
44006
|
const bodyLength = this.frameData?.byteLength ?? 0;
|
|
@@ -44614,11 +44742,11 @@ var require_undici = __commonJS({
|
|
|
44614
44742
|
if (typeof opts.path !== "string") {
|
|
44615
44743
|
throw new InvalidArgumentError("invalid opts.path");
|
|
44616
44744
|
}
|
|
44617
|
-
let
|
|
44745
|
+
let path33 = opts.path;
|
|
44618
44746
|
if (!opts.path.startsWith("/")) {
|
|
44619
|
-
|
|
44747
|
+
path33 = `/${path33}`;
|
|
44620
44748
|
}
|
|
44621
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
44749
|
+
url = new URL(util.parseOrigin(url).origin + path33);
|
|
44622
44750
|
} else {
|
|
44623
44751
|
if (!opts) {
|
|
44624
44752
|
opts = typeof url === "object" ? url : {};
|
|
@@ -45944,7 +46072,7 @@ var init_stdin_reader = __esm({
|
|
|
45944
46072
|
});
|
|
45945
46073
|
|
|
45946
46074
|
// src/providers/human-input-check-provider.ts
|
|
45947
|
-
var fs17,
|
|
46075
|
+
var fs17, path21, HumanInputCheckProvider;
|
|
45948
46076
|
var init_human_input_check_provider = __esm({
|
|
45949
46077
|
"src/providers/human-input-check-provider.ts"() {
|
|
45950
46078
|
"use strict";
|
|
@@ -45954,7 +46082,7 @@ var init_human_input_check_provider = __esm({
|
|
|
45954
46082
|
init_liquid_extensions();
|
|
45955
46083
|
init_stdin_reader();
|
|
45956
46084
|
fs17 = __toESM(require("fs"));
|
|
45957
|
-
|
|
46085
|
+
path21 = __toESM(require("path"));
|
|
45958
46086
|
HumanInputCheckProvider = class _HumanInputCheckProvider extends CheckProvider {
|
|
45959
46087
|
liquid;
|
|
45960
46088
|
/**
|
|
@@ -46128,10 +46256,10 @@ var init_human_input_check_provider = __esm({
|
|
|
46128
46256
|
*/
|
|
46129
46257
|
async tryReadFile(filePath) {
|
|
46130
46258
|
try {
|
|
46131
|
-
const absolutePath =
|
|
46132
|
-
const normalizedPath =
|
|
46259
|
+
const absolutePath = path21.isAbsolute(filePath) ? filePath : path21.resolve(process.cwd(), filePath);
|
|
46260
|
+
const normalizedPath = path21.normalize(absolutePath);
|
|
46133
46261
|
const cwd = process.cwd();
|
|
46134
|
-
if (!normalizedPath.startsWith(cwd +
|
|
46262
|
+
if (!normalizedPath.startsWith(cwd + path21.sep) && normalizedPath !== cwd) {
|
|
46135
46263
|
return null;
|
|
46136
46264
|
}
|
|
46137
46265
|
try {
|
|
@@ -47286,14 +47414,14 @@ var init_script_check_provider = __esm({
|
|
|
47286
47414
|
});
|
|
47287
47415
|
|
|
47288
47416
|
// src/utils/worktree-manager.ts
|
|
47289
|
-
var fs18, fsp,
|
|
47417
|
+
var fs18, fsp, path22, crypto2, WorktreeManager, worktreeManager;
|
|
47290
47418
|
var init_worktree_manager = __esm({
|
|
47291
47419
|
"src/utils/worktree-manager.ts"() {
|
|
47292
47420
|
"use strict";
|
|
47293
47421
|
fs18 = __toESM(require("fs"));
|
|
47294
47422
|
fsp = __toESM(require("fs/promises"));
|
|
47295
|
-
|
|
47296
|
-
|
|
47423
|
+
path22 = __toESM(require("path"));
|
|
47424
|
+
crypto2 = __toESM(require("crypto"));
|
|
47297
47425
|
init_command_executor();
|
|
47298
47426
|
init_logger();
|
|
47299
47427
|
WorktreeManager = class _WorktreeManager {
|
|
@@ -47308,7 +47436,7 @@ var init_worktree_manager = __esm({
|
|
|
47308
47436
|
} catch {
|
|
47309
47437
|
cwd = "/tmp";
|
|
47310
47438
|
}
|
|
47311
|
-
const defaultBasePath = process.env.VISOR_WORKTREE_PATH ||
|
|
47439
|
+
const defaultBasePath = process.env.VISOR_WORKTREE_PATH || path22.join(cwd, ".visor", "worktrees");
|
|
47312
47440
|
this.config = {
|
|
47313
47441
|
enabled: true,
|
|
47314
47442
|
base_path: defaultBasePath,
|
|
@@ -47355,10 +47483,10 @@ var init_worktree_manager = __esm({
|
|
|
47355
47483
|
}
|
|
47356
47484
|
}
|
|
47357
47485
|
getReposDir() {
|
|
47358
|
-
return
|
|
47486
|
+
return path22.join(this.config.base_path, "repos");
|
|
47359
47487
|
}
|
|
47360
47488
|
getWorktreesDir() {
|
|
47361
|
-
return
|
|
47489
|
+
return path22.join(this.config.base_path, "worktrees");
|
|
47362
47490
|
}
|
|
47363
47491
|
/**
|
|
47364
47492
|
* Generate a worktree ID based on repository, ref, and session.
|
|
@@ -47374,7 +47502,7 @@ var init_worktree_manager = __esm({
|
|
|
47374
47502
|
const sanitizedRepo = repository.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
47375
47503
|
const sanitizedRef = ref.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
47376
47504
|
const hashInput = sessionId ? `${repository}:${ref}:${sessionId}` : `${repository}:${ref}`;
|
|
47377
|
-
const hash =
|
|
47505
|
+
const hash = crypto2.createHash("md5").update(hashInput).digest("hex").substring(0, 8);
|
|
47378
47506
|
return `${sanitizedRepo}-${sanitizedRef}-${hash}`;
|
|
47379
47507
|
}
|
|
47380
47508
|
/**
|
|
@@ -47383,7 +47511,7 @@ var init_worktree_manager = __esm({
|
|
|
47383
47511
|
async getOrCreateBareRepo(repository, repoUrl, _token, fetchDepth, cloneTimeoutMs) {
|
|
47384
47512
|
const reposDir = this.getReposDir();
|
|
47385
47513
|
const repoName = repository.replace(/\//g, "-");
|
|
47386
|
-
const bareRepoPath =
|
|
47514
|
+
const bareRepoPath = path22.join(reposDir, `${repoName}.git`);
|
|
47387
47515
|
if (fs18.existsSync(bareRepoPath)) {
|
|
47388
47516
|
logger.debug(`Bare repository already exists: ${bareRepoPath}`);
|
|
47389
47517
|
const verifyResult = await this.verifyBareRepoRemote(bareRepoPath, repoUrl);
|
|
@@ -47531,7 +47659,7 @@ var init_worktree_manager = __esm({
|
|
|
47531
47659
|
options.cloneTimeoutMs
|
|
47532
47660
|
);
|
|
47533
47661
|
const worktreeId = this.generateWorktreeId(repository, ref, options.sessionId);
|
|
47534
|
-
let worktreePath = options.workingDirectory ||
|
|
47662
|
+
let worktreePath = options.workingDirectory || path22.join(this.getWorktreesDir(), worktreeId);
|
|
47535
47663
|
if (options.workingDirectory) {
|
|
47536
47664
|
worktreePath = this.validatePath(options.workingDirectory);
|
|
47537
47665
|
}
|
|
@@ -47852,7 +47980,7 @@ var init_worktree_manager = __esm({
|
|
|
47852
47980
|
*/
|
|
47853
47981
|
async loadMetadata(worktreePath) {
|
|
47854
47982
|
const metadataPath = this.getMetadataPath(worktreePath);
|
|
47855
|
-
const legacyPath =
|
|
47983
|
+
const legacyPath = path22.join(worktreePath, ".visor-metadata.json");
|
|
47856
47984
|
const pathToRead = fs18.existsSync(metadataPath) ? metadataPath : fs18.existsSync(legacyPath) ? legacyPath : null;
|
|
47857
47985
|
if (!pathToRead) {
|
|
47858
47986
|
return null;
|
|
@@ -47877,7 +48005,7 @@ var init_worktree_manager = __esm({
|
|
|
47877
48005
|
const worktrees = [];
|
|
47878
48006
|
for (const entry of entries) {
|
|
47879
48007
|
if (!entry.isDirectory()) continue;
|
|
47880
|
-
const worktreePath =
|
|
48008
|
+
const worktreePath = path22.join(worktreesDir, entry.name);
|
|
47881
48009
|
const metadata = await this.loadMetadata(worktreePath);
|
|
47882
48010
|
if (metadata) {
|
|
47883
48011
|
worktrees.push({
|
|
@@ -48009,8 +48137,8 @@ var init_worktree_manager = __esm({
|
|
|
48009
48137
|
* Validate path to prevent directory traversal
|
|
48010
48138
|
*/
|
|
48011
48139
|
validatePath(userPath) {
|
|
48012
|
-
const resolvedPath =
|
|
48013
|
-
if (!
|
|
48140
|
+
const resolvedPath = path22.resolve(userPath);
|
|
48141
|
+
if (!path22.isAbsolute(resolvedPath)) {
|
|
48014
48142
|
throw new Error("Path must be absolute");
|
|
48015
48143
|
}
|
|
48016
48144
|
const sensitivePatterns = [
|
|
@@ -50606,18 +50734,18 @@ __export(renderer_schema_exports, {
|
|
|
50606
50734
|
async function loadRendererSchema(name) {
|
|
50607
50735
|
try {
|
|
50608
50736
|
const fs29 = await import("fs/promises");
|
|
50609
|
-
const
|
|
50737
|
+
const path33 = await import("path");
|
|
50610
50738
|
const sanitized = String(name).replace(/[^a-zA-Z0-9-]/g, "");
|
|
50611
50739
|
if (!sanitized) return void 0;
|
|
50612
50740
|
const candidates = [
|
|
50613
50741
|
// When bundled with ncc, __dirname is dist/ and output/ is at dist/output/
|
|
50614
|
-
|
|
50742
|
+
path33.join(__dirname, "output", sanitized, "schema.json"),
|
|
50615
50743
|
// When running from source, __dirname is src/state-machine/dispatch/ and output/ is at output/
|
|
50616
|
-
|
|
50744
|
+
path33.join(__dirname, "..", "..", "output", sanitized, "schema.json"),
|
|
50617
50745
|
// When running from a checkout with output/ folder copied to CWD
|
|
50618
|
-
|
|
50746
|
+
path33.join(process.cwd(), "output", sanitized, "schema.json"),
|
|
50619
50747
|
// Fallback: cwd/dist/output/
|
|
50620
|
-
|
|
50748
|
+
path33.join(process.cwd(), "dist", "output", sanitized, "schema.json")
|
|
50621
50749
|
];
|
|
50622
50750
|
for (const p of candidates) {
|
|
50623
50751
|
try {
|
|
@@ -53063,7 +53191,7 @@ async function renderTemplateContent2(checkId, checkConfig, reviewSummary) {
|
|
|
53063
53191
|
try {
|
|
53064
53192
|
const { createExtendedLiquid: createExtendedLiquid2 } = await Promise.resolve().then(() => (init_liquid_extensions(), liquid_extensions_exports));
|
|
53065
53193
|
const fs29 = await import("fs/promises");
|
|
53066
|
-
const
|
|
53194
|
+
const path33 = await import("path");
|
|
53067
53195
|
const schemaRaw = checkConfig.schema || "plain";
|
|
53068
53196
|
const schema = typeof schemaRaw === "string" && !schemaRaw.includes("{{") && !schemaRaw.includes("{%") ? schemaRaw : typeof schemaRaw === "object" ? "code-review" : "plain";
|
|
53069
53197
|
let templateContent;
|
|
@@ -53072,22 +53200,22 @@ async function renderTemplateContent2(checkId, checkConfig, reviewSummary) {
|
|
|
53072
53200
|
logger.debug(`[LevelDispatch] Using inline template for ${checkId}`);
|
|
53073
53201
|
} else if (checkConfig.template && checkConfig.template.file) {
|
|
53074
53202
|
const file = String(checkConfig.template.file);
|
|
53075
|
-
const resolved =
|
|
53203
|
+
const resolved = path33.resolve(process.cwd(), file);
|
|
53076
53204
|
templateContent = await fs29.readFile(resolved, "utf-8");
|
|
53077
53205
|
logger.debug(`[LevelDispatch] Using template file for ${checkId}: ${resolved}`);
|
|
53078
53206
|
} else if (schema && schema !== "plain") {
|
|
53079
53207
|
const sanitized = String(schema).replace(/[^a-zA-Z0-9-]/g, "");
|
|
53080
53208
|
if (sanitized) {
|
|
53081
53209
|
const candidatePaths = [
|
|
53082
|
-
|
|
53210
|
+
path33.join(__dirname, "output", sanitized, "template.liquid"),
|
|
53083
53211
|
// bundled: dist/output/
|
|
53084
|
-
|
|
53212
|
+
path33.join(__dirname, "..", "..", "output", sanitized, "template.liquid"),
|
|
53085
53213
|
// source (from state-machine/states)
|
|
53086
|
-
|
|
53214
|
+
path33.join(__dirname, "..", "..", "..", "output", sanitized, "template.liquid"),
|
|
53087
53215
|
// source (alternate)
|
|
53088
|
-
|
|
53216
|
+
path33.join(process.cwd(), "output", sanitized, "template.liquid"),
|
|
53089
53217
|
// fallback: cwd/output/
|
|
53090
|
-
|
|
53218
|
+
path33.join(process.cwd(), "dist", "output", sanitized, "template.liquid")
|
|
53091
53219
|
// fallback: cwd/dist/output/
|
|
53092
53220
|
];
|
|
53093
53221
|
for (const p of candidatePaths) {
|
|
@@ -53699,16 +53827,16 @@ var init_runner = __esm({
|
|
|
53699
53827
|
});
|
|
53700
53828
|
|
|
53701
53829
|
// src/sandbox/docker-image-sandbox.ts
|
|
53702
|
-
var import_util2, import_child_process3, import_fs5,
|
|
53830
|
+
var import_util2, import_child_process3, import_fs5, import_path10, import_os, import_crypto3, execFileAsync, EXEC_MAX_BUFFER, DockerImageSandbox;
|
|
53703
53831
|
var init_docker_image_sandbox = __esm({
|
|
53704
53832
|
"src/sandbox/docker-image-sandbox.ts"() {
|
|
53705
53833
|
"use strict";
|
|
53706
53834
|
import_util2 = require("util");
|
|
53707
53835
|
import_child_process3 = require("child_process");
|
|
53708
53836
|
import_fs5 = require("fs");
|
|
53709
|
-
|
|
53837
|
+
import_path10 = require("path");
|
|
53710
53838
|
import_os = require("os");
|
|
53711
|
-
|
|
53839
|
+
import_crypto3 = require("crypto");
|
|
53712
53840
|
init_logger();
|
|
53713
53841
|
init_sandbox_telemetry();
|
|
53714
53842
|
execFileAsync = (0, import_util2.promisify)(import_child_process3.execFile);
|
|
@@ -53726,7 +53854,7 @@ var init_docker_image_sandbox = __esm({
|
|
|
53726
53854
|
this.config = config;
|
|
53727
53855
|
this.repoPath = repoPath;
|
|
53728
53856
|
this.visorDistPath = visorDistPath;
|
|
53729
|
-
this.containerName = `visor-${name}-${(0,
|
|
53857
|
+
this.containerName = `visor-${name}-${(0, import_crypto3.randomUUID)().slice(0, 8)}`;
|
|
53730
53858
|
this.cacheVolumeMounts = cacheVolumeMounts;
|
|
53731
53859
|
}
|
|
53732
53860
|
/**
|
|
@@ -53751,8 +53879,8 @@ var init_docker_image_sandbox = __esm({
|
|
|
53751
53879
|
`Sandbox '${this.name}' has invalid dockerfile_inline: must contain a FROM instruction`
|
|
53752
53880
|
);
|
|
53753
53881
|
}
|
|
53754
|
-
const tmpDir = (0, import_fs5.mkdtempSync)((0,
|
|
53755
|
-
const dockerfilePath = (0,
|
|
53882
|
+
const tmpDir = (0, import_fs5.mkdtempSync)((0, import_path10.join)((0, import_os.tmpdir)(), "visor-build-"));
|
|
53883
|
+
const dockerfilePath = (0, import_path10.join)(tmpDir, "Dockerfile");
|
|
53756
53884
|
(0, import_fs5.writeFileSync)(dockerfilePath, this.config.dockerfile_inline, "utf8");
|
|
53757
53885
|
try {
|
|
53758
53886
|
logger.info(`Building sandbox image '${imageName}' from inline Dockerfile`);
|
|
@@ -53820,7 +53948,7 @@ var init_docker_image_sandbox = __esm({
|
|
|
53820
53948
|
}
|
|
53821
53949
|
if (this.config.bind_paths) {
|
|
53822
53950
|
for (const bp of this.config.bind_paths) {
|
|
53823
|
-
const hostPath = bp.host.startsWith("~") ? (0,
|
|
53951
|
+
const hostPath = bp.host.startsWith("~") ? (0, import_path10.resolve)((process.env.HOME || "/root") + bp.host.slice(1)) : (0, import_path10.resolve)(bp.host);
|
|
53824
53952
|
const containerPath = bp.container || hostPath;
|
|
53825
53953
|
const readOnly = bp.read_only !== false;
|
|
53826
53954
|
args.push("-v", `${hostPath}:${containerPath}${readOnly ? ":ro" : ""}`);
|
|
@@ -53891,13 +54019,13 @@ var init_docker_image_sandbox = __esm({
|
|
|
53891
54019
|
});
|
|
53892
54020
|
|
|
53893
54021
|
// src/sandbox/docker-compose-sandbox.ts
|
|
53894
|
-
var import_util3, import_child_process4,
|
|
54022
|
+
var import_util3, import_child_process4, import_crypto4, execFileAsync2, EXEC_MAX_BUFFER2, DockerComposeSandbox;
|
|
53895
54023
|
var init_docker_compose_sandbox = __esm({
|
|
53896
54024
|
"src/sandbox/docker-compose-sandbox.ts"() {
|
|
53897
54025
|
"use strict";
|
|
53898
54026
|
import_util3 = require("util");
|
|
53899
54027
|
import_child_process4 = require("child_process");
|
|
53900
|
-
|
|
54028
|
+
import_crypto4 = require("crypto");
|
|
53901
54029
|
init_logger();
|
|
53902
54030
|
execFileAsync2 = (0, import_util3.promisify)(import_child_process4.execFile);
|
|
53903
54031
|
EXEC_MAX_BUFFER2 = 50 * 1024 * 1024;
|
|
@@ -53909,7 +54037,7 @@ var init_docker_compose_sandbox = __esm({
|
|
|
53909
54037
|
constructor(name, config) {
|
|
53910
54038
|
this.name = name;
|
|
53911
54039
|
this.config = config;
|
|
53912
|
-
this.projectName = `visor-${name}-${(0,
|
|
54040
|
+
this.projectName = `visor-${name}-${(0, import_crypto4.randomUUID)().slice(0, 8)}`;
|
|
53913
54041
|
}
|
|
53914
54042
|
/**
|
|
53915
54043
|
* Start the compose services
|
|
@@ -54001,7 +54129,7 @@ var init_docker_compose_sandbox = __esm({
|
|
|
54001
54129
|
|
|
54002
54130
|
// src/sandbox/cache-volume-manager.ts
|
|
54003
54131
|
function pathHash(containerPath) {
|
|
54004
|
-
return (0,
|
|
54132
|
+
return (0, import_crypto5.createHash)("sha256").update(containerPath).digest("hex").slice(0, 8);
|
|
54005
54133
|
}
|
|
54006
54134
|
function parseTtl(ttl) {
|
|
54007
54135
|
let ms = 0;
|
|
@@ -54013,13 +54141,13 @@ function parseTtl(ttl) {
|
|
|
54013
54141
|
if (minMatch) ms += parseInt(minMatch[1], 10) * 6e4;
|
|
54014
54142
|
return ms || 6048e5;
|
|
54015
54143
|
}
|
|
54016
|
-
var import_util4, import_child_process5,
|
|
54144
|
+
var import_util4, import_child_process5, import_crypto5, execFileAsync3, EXEC_MAX_BUFFER3, CacheVolumeManager;
|
|
54017
54145
|
var init_cache_volume_manager = __esm({
|
|
54018
54146
|
"src/sandbox/cache-volume-manager.ts"() {
|
|
54019
54147
|
"use strict";
|
|
54020
54148
|
import_util4 = require("util");
|
|
54021
54149
|
import_child_process5 = require("child_process");
|
|
54022
|
-
|
|
54150
|
+
import_crypto5 = require("crypto");
|
|
54023
54151
|
init_logger();
|
|
54024
54152
|
execFileAsync3 = (0, import_util4.promisify)(import_child_process5.execFile);
|
|
54025
54153
|
EXEC_MAX_BUFFER3 = 10 * 1024 * 1024;
|
|
@@ -54201,14 +54329,14 @@ var bubblewrap_sandbox_exports = {};
|
|
|
54201
54329
|
__export(bubblewrap_sandbox_exports, {
|
|
54202
54330
|
BubblewrapSandbox: () => BubblewrapSandbox
|
|
54203
54331
|
});
|
|
54204
|
-
var import_util5, import_child_process6, import_fs6,
|
|
54332
|
+
var import_util5, import_child_process6, import_fs6, import_path11, execFileAsync4, EXEC_MAX_BUFFER4, BubblewrapSandbox;
|
|
54205
54333
|
var init_bubblewrap_sandbox = __esm({
|
|
54206
54334
|
"src/sandbox/bubblewrap-sandbox.ts"() {
|
|
54207
54335
|
"use strict";
|
|
54208
54336
|
import_util5 = require("util");
|
|
54209
54337
|
import_child_process6 = require("child_process");
|
|
54210
54338
|
import_fs6 = require("fs");
|
|
54211
|
-
|
|
54339
|
+
import_path11 = require("path");
|
|
54212
54340
|
init_logger();
|
|
54213
54341
|
init_sandbox_telemetry();
|
|
54214
54342
|
execFileAsync4 = (0, import_util5.promisify)(import_child_process6.execFile);
|
|
@@ -54221,8 +54349,8 @@ var init_bubblewrap_sandbox = __esm({
|
|
|
54221
54349
|
constructor(name, config, repoPath, visorDistPath) {
|
|
54222
54350
|
this.name = name;
|
|
54223
54351
|
this.config = config;
|
|
54224
|
-
this.repoPath = (0,
|
|
54225
|
-
this.visorDistPath = (0,
|
|
54352
|
+
this.repoPath = (0, import_path11.resolve)(repoPath);
|
|
54353
|
+
this.visorDistPath = (0, import_path11.resolve)(visorDistPath);
|
|
54226
54354
|
}
|
|
54227
54355
|
/**
|
|
54228
54356
|
* Check if bwrap binary is available on the system.
|
|
@@ -54307,7 +54435,7 @@ var init_bubblewrap_sandbox = __esm({
|
|
|
54307
54435
|
args.push("--ro-bind", this.visorDistPath, visorPath);
|
|
54308
54436
|
if (this.config.bind_paths) {
|
|
54309
54437
|
for (const bp of this.config.bind_paths) {
|
|
54310
|
-
const hostPath = bp.host.startsWith("~") ? (0,
|
|
54438
|
+
const hostPath = bp.host.startsWith("~") ? (0, import_path11.resolve)((process.env.HOME || "/root") + bp.host.slice(1)) : (0, import_path11.resolve)(bp.host);
|
|
54311
54439
|
const containerPath = bp.container || hostPath;
|
|
54312
54440
|
const readOnly = bp.read_only !== false;
|
|
54313
54441
|
args.push(readOnly ? "--ro-bind" : "--bind", hostPath, containerPath);
|
|
@@ -54338,13 +54466,13 @@ var seatbelt_sandbox_exports = {};
|
|
|
54338
54466
|
__export(seatbelt_sandbox_exports, {
|
|
54339
54467
|
SeatbeltSandbox: () => SeatbeltSandbox
|
|
54340
54468
|
});
|
|
54341
|
-
var import_util6, import_child_process7,
|
|
54469
|
+
var import_util6, import_child_process7, import_path12, import_fs7, execFileAsync5, EXEC_MAX_BUFFER5, SeatbeltSandbox;
|
|
54342
54470
|
var init_seatbelt_sandbox = __esm({
|
|
54343
54471
|
"src/sandbox/seatbelt-sandbox.ts"() {
|
|
54344
54472
|
"use strict";
|
|
54345
54473
|
import_util6 = require("util");
|
|
54346
54474
|
import_child_process7 = require("child_process");
|
|
54347
|
-
|
|
54475
|
+
import_path12 = require("path");
|
|
54348
54476
|
import_fs7 = require("fs");
|
|
54349
54477
|
init_logger();
|
|
54350
54478
|
init_sandbox_telemetry();
|
|
@@ -54358,8 +54486,8 @@ var init_seatbelt_sandbox = __esm({
|
|
|
54358
54486
|
constructor(name, config, repoPath, visorDistPath) {
|
|
54359
54487
|
this.name = name;
|
|
54360
54488
|
this.config = config;
|
|
54361
|
-
this.repoPath = (0, import_fs7.realpathSync)((0,
|
|
54362
|
-
this.visorDistPath = (0, import_fs7.realpathSync)((0,
|
|
54489
|
+
this.repoPath = (0, import_fs7.realpathSync)((0, import_path12.resolve)(repoPath));
|
|
54490
|
+
this.visorDistPath = (0, import_fs7.realpathSync)((0, import_path12.resolve)(visorDistPath));
|
|
54363
54491
|
}
|
|
54364
54492
|
/**
|
|
54365
54493
|
* Check if sandbox-exec binary is available on the system.
|
|
@@ -54464,7 +54592,7 @@ var init_seatbelt_sandbox = __esm({
|
|
|
54464
54592
|
lines.push(`(allow file-read* (subpath "${visorDistPath}"))`);
|
|
54465
54593
|
if (this.config.bind_paths) {
|
|
54466
54594
|
for (const bp of this.config.bind_paths) {
|
|
54467
|
-
const hostPath = bp.host.startsWith("~") ? (0,
|
|
54595
|
+
const hostPath = bp.host.startsWith("~") ? (0, import_path12.resolve)((process.env.HOME || "/root") + bp.host.slice(1)) : (0, import_path12.resolve)(bp.host);
|
|
54468
54596
|
const escapedPath = this.escapePath(hostPath);
|
|
54469
54597
|
lines.push(`(allow file-read* (subpath "${escapedPath}"))`);
|
|
54470
54598
|
if (bp.read_only === false) {
|
|
@@ -54485,11 +54613,11 @@ var init_seatbelt_sandbox = __esm({
|
|
|
54485
54613
|
});
|
|
54486
54614
|
|
|
54487
54615
|
// src/sandbox/sandbox-manager.ts
|
|
54488
|
-
var
|
|
54616
|
+
var import_path13, import_fs8, SandboxManager;
|
|
54489
54617
|
var init_sandbox_manager = __esm({
|
|
54490
54618
|
"src/sandbox/sandbox-manager.ts"() {
|
|
54491
54619
|
"use strict";
|
|
54492
|
-
|
|
54620
|
+
import_path13 = require("path");
|
|
54493
54621
|
import_fs8 = require("fs");
|
|
54494
54622
|
init_docker_image_sandbox();
|
|
54495
54623
|
init_docker_compose_sandbox();
|
|
@@ -54509,10 +54637,10 @@ var init_sandbox_manager = __esm({
|
|
|
54509
54637
|
}
|
|
54510
54638
|
constructor(sandboxDefs, repoPath, gitBranch) {
|
|
54511
54639
|
this.sandboxDefs = sandboxDefs;
|
|
54512
|
-
this.repoPath = (0,
|
|
54640
|
+
this.repoPath = (0, import_path13.resolve)(repoPath);
|
|
54513
54641
|
this.gitBranch = gitBranch;
|
|
54514
54642
|
this.cacheManager = new CacheVolumeManager();
|
|
54515
|
-
this.visorDistPath = (0, import_fs8.existsSync)((0,
|
|
54643
|
+
this.visorDistPath = (0, import_fs8.existsSync)((0, import_path13.join)(__dirname, "index.js")) ? __dirname : (0, import_path13.resolve)((0, import_path13.dirname)(__dirname));
|
|
54516
54644
|
}
|
|
54517
54645
|
/**
|
|
54518
54646
|
* Resolve which sandbox a check should use.
|
|
@@ -54641,13 +54769,13 @@ var init_sandbox_manager = __esm({
|
|
|
54641
54769
|
});
|
|
54642
54770
|
|
|
54643
54771
|
// src/utils/file-exclusion.ts
|
|
54644
|
-
var import_ignore, fs19,
|
|
54772
|
+
var import_ignore, fs19, path23, DEFAULT_EXCLUSION_PATTERNS, FileExclusionHelper;
|
|
54645
54773
|
var init_file_exclusion = __esm({
|
|
54646
54774
|
"src/utils/file-exclusion.ts"() {
|
|
54647
54775
|
"use strict";
|
|
54648
54776
|
import_ignore = __toESM(require("ignore"));
|
|
54649
54777
|
fs19 = __toESM(require("fs"));
|
|
54650
|
-
|
|
54778
|
+
path23 = __toESM(require("path"));
|
|
54651
54779
|
DEFAULT_EXCLUSION_PATTERNS = [
|
|
54652
54780
|
"dist/",
|
|
54653
54781
|
"build/",
|
|
@@ -54666,7 +54794,7 @@ var init_file_exclusion = __esm({
|
|
|
54666
54794
|
* @param additionalPatterns - Additional patterns to include (optional, defaults to common build artifacts)
|
|
54667
54795
|
*/
|
|
54668
54796
|
constructor(workingDirectory = process.cwd(), additionalPatterns = DEFAULT_EXCLUSION_PATTERNS) {
|
|
54669
|
-
const normalizedPath =
|
|
54797
|
+
const normalizedPath = path23.resolve(workingDirectory);
|
|
54670
54798
|
if (normalizedPath.includes("\0")) {
|
|
54671
54799
|
throw new Error("Invalid workingDirectory: contains null bytes");
|
|
54672
54800
|
}
|
|
@@ -54678,11 +54806,11 @@ var init_file_exclusion = __esm({
|
|
|
54678
54806
|
* @param additionalPatterns - Additional patterns to add to gitignore rules
|
|
54679
54807
|
*/
|
|
54680
54808
|
loadGitignore(additionalPatterns) {
|
|
54681
|
-
const gitignorePath =
|
|
54682
|
-
const resolvedWorkingDir =
|
|
54809
|
+
const gitignorePath = path23.resolve(this.workingDirectory, ".gitignore");
|
|
54810
|
+
const resolvedWorkingDir = path23.resolve(this.workingDirectory);
|
|
54683
54811
|
try {
|
|
54684
|
-
const relativePath =
|
|
54685
|
-
if (relativePath.startsWith("..") ||
|
|
54812
|
+
const relativePath = path23.relative(resolvedWorkingDir, gitignorePath);
|
|
54813
|
+
if (relativePath.startsWith("..") || path23.isAbsolute(relativePath)) {
|
|
54686
54814
|
throw new Error("Invalid gitignore path: path traversal detected");
|
|
54687
54815
|
}
|
|
54688
54816
|
if (relativePath !== ".gitignore") {
|
|
@@ -54725,12 +54853,12 @@ var git_repository_analyzer_exports = {};
|
|
|
54725
54853
|
__export(git_repository_analyzer_exports, {
|
|
54726
54854
|
GitRepositoryAnalyzer: () => GitRepositoryAnalyzer
|
|
54727
54855
|
});
|
|
54728
|
-
var import_simple_git2,
|
|
54856
|
+
var import_simple_git2, path24, fs20, MAX_PATCH_SIZE, GitRepositoryAnalyzer;
|
|
54729
54857
|
var init_git_repository_analyzer = __esm({
|
|
54730
54858
|
"src/git-repository-analyzer.ts"() {
|
|
54731
54859
|
"use strict";
|
|
54732
54860
|
import_simple_git2 = require("simple-git");
|
|
54733
|
-
|
|
54861
|
+
path24 = __toESM(require("path"));
|
|
54734
54862
|
fs20 = __toESM(require("fs"));
|
|
54735
54863
|
init_file_exclusion();
|
|
54736
54864
|
MAX_PATCH_SIZE = 50 * 1024;
|
|
@@ -54920,7 +55048,7 @@ ${file.patch}`).join("\n\n");
|
|
|
54920
55048
|
console.error(`\u23ED\uFE0F Skipping excluded file: ${file}`);
|
|
54921
55049
|
continue;
|
|
54922
55050
|
}
|
|
54923
|
-
const filePath =
|
|
55051
|
+
const filePath = path24.join(this.cwd, file);
|
|
54924
55052
|
const fileChange = await this.analyzeFileChange(file, status2, filePath, includeContext);
|
|
54925
55053
|
changes.push(fileChange);
|
|
54926
55054
|
}
|
|
@@ -55146,12 +55274,12 @@ function shellEscape(str) {
|
|
|
55146
55274
|
function sanitizePathComponent(name) {
|
|
55147
55275
|
return name.replace(/\.\./g, "").replace(/[\/\\]/g, "-").replace(/^\.+/, "").trim() || "unnamed";
|
|
55148
55276
|
}
|
|
55149
|
-
var fsp2,
|
|
55277
|
+
var fsp2, path25, WorkspaceManager;
|
|
55150
55278
|
var init_workspace_manager = __esm({
|
|
55151
55279
|
"src/utils/workspace-manager.ts"() {
|
|
55152
55280
|
"use strict";
|
|
55153
55281
|
fsp2 = __toESM(require("fs/promises"));
|
|
55154
|
-
|
|
55282
|
+
path25 = __toESM(require("path"));
|
|
55155
55283
|
init_command_executor();
|
|
55156
55284
|
init_logger();
|
|
55157
55285
|
WorkspaceManager = class _WorkspaceManager {
|
|
@@ -55185,7 +55313,7 @@ var init_workspace_manager = __esm({
|
|
|
55185
55313
|
};
|
|
55186
55314
|
this.basePath = this.config.basePath;
|
|
55187
55315
|
const workspaceDirName = sanitizePathComponent(this.config.name || this.sessionId);
|
|
55188
|
-
this.workspacePath =
|
|
55316
|
+
this.workspacePath = path25.join(this.basePath, workspaceDirName);
|
|
55189
55317
|
}
|
|
55190
55318
|
/**
|
|
55191
55319
|
* Get or create a WorkspaceManager instance for a session
|
|
@@ -55280,7 +55408,7 @@ var init_workspace_manager = __esm({
|
|
|
55280
55408
|
configuredMainProjectName || this.extractProjectName(this.originalPath)
|
|
55281
55409
|
);
|
|
55282
55410
|
this.usedNames.add(mainProjectName);
|
|
55283
|
-
const mainProjectPath =
|
|
55411
|
+
const mainProjectPath = path25.join(this.workspacePath, mainProjectName);
|
|
55284
55412
|
const isGitRepo = await this.isGitRepository(this.originalPath);
|
|
55285
55413
|
if (isGitRepo) {
|
|
55286
55414
|
const exists = await this.pathExists(mainProjectPath);
|
|
@@ -55366,7 +55494,7 @@ var init_workspace_manager = __esm({
|
|
|
55366
55494
|
let projectName = sanitizePathComponent(description || this.extractRepoName(repository));
|
|
55367
55495
|
projectName = this.getUniqueName(projectName);
|
|
55368
55496
|
this.usedNames.add(projectName);
|
|
55369
|
-
const workspacePath =
|
|
55497
|
+
const workspacePath = path25.join(this.workspacePath, projectName);
|
|
55370
55498
|
await fsp2.rm(workspacePath, { recursive: true, force: true });
|
|
55371
55499
|
try {
|
|
55372
55500
|
await fsp2.symlink(worktreePath, workspacePath);
|
|
@@ -55476,7 +55604,7 @@ var init_workspace_manager = __esm({
|
|
|
55476
55604
|
const now = Date.now();
|
|
55477
55605
|
for (const entry of entries) {
|
|
55478
55606
|
if (!entry.isDirectory()) continue;
|
|
55479
|
-
const dirPath =
|
|
55607
|
+
const dirPath = path25.join(basePath, entry.name);
|
|
55480
55608
|
try {
|
|
55481
55609
|
const stat2 = await fsp2.stat(dirPath);
|
|
55482
55610
|
if (now - stat2.mtimeMs > maxAgeMs) {
|
|
@@ -55484,8 +55612,8 @@ var init_workspace_manager = __esm({
|
|
|
55484
55612
|
const subdirs = await fsp2.readdir(dirPath, { withFileTypes: true });
|
|
55485
55613
|
for (const sub of subdirs) {
|
|
55486
55614
|
if (!sub.isDirectory()) continue;
|
|
55487
|
-
const subPath =
|
|
55488
|
-
const gitFilePath =
|
|
55615
|
+
const subPath = path25.join(dirPath, sub.name);
|
|
55616
|
+
const gitFilePath = path25.join(subPath, ".git");
|
|
55489
55617
|
try {
|
|
55490
55618
|
const gitContent = await fsp2.readFile(gitFilePath, "utf-8");
|
|
55491
55619
|
const match = gitContent.match(/gitdir:\s*(.+)/);
|
|
@@ -55710,7 +55838,7 @@ var init_workspace_manager = __esm({
|
|
|
55710
55838
|
* Extract project name from path
|
|
55711
55839
|
*/
|
|
55712
55840
|
extractProjectName(dirPath) {
|
|
55713
|
-
return
|
|
55841
|
+
return path25.basename(dirPath);
|
|
55714
55842
|
}
|
|
55715
55843
|
/**
|
|
55716
55844
|
* Extract repository name from owner/repo format
|
|
@@ -56154,13 +56282,13 @@ var validator_exports = {};
|
|
|
56154
56282
|
__export(validator_exports, {
|
|
56155
56283
|
LicenseValidator: () => LicenseValidator
|
|
56156
56284
|
});
|
|
56157
|
-
var
|
|
56285
|
+
var crypto3, fs21, path26, LicenseValidator;
|
|
56158
56286
|
var init_validator = __esm({
|
|
56159
56287
|
"src/enterprise/license/validator.ts"() {
|
|
56160
56288
|
"use strict";
|
|
56161
|
-
|
|
56289
|
+
crypto3 = __toESM(require("crypto"));
|
|
56162
56290
|
fs21 = __toESM(require("fs"));
|
|
56163
|
-
|
|
56291
|
+
path26 = __toESM(require("path"));
|
|
56164
56292
|
LicenseValidator = class _LicenseValidator {
|
|
56165
56293
|
/** Ed25519 public key for license verification (PEM format). */
|
|
56166
56294
|
static PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAI/Zd08EFmgIdrDm/HXd0l3/5GBt7R1PrdvhdmEXhJlU=\n-----END PUBLIC KEY-----\n";
|
|
@@ -56213,10 +56341,10 @@ var init_validator = __esm({
|
|
|
56213
56341
|
return process.env.VISOR_LICENSE.trim();
|
|
56214
56342
|
}
|
|
56215
56343
|
if (process.env.VISOR_LICENSE_FILE) {
|
|
56216
|
-
const resolved =
|
|
56344
|
+
const resolved = path26.resolve(process.env.VISOR_LICENSE_FILE);
|
|
56217
56345
|
const home2 = process.env.HOME || process.env.USERPROFILE || "";
|
|
56218
|
-
const allowedPrefixes = [
|
|
56219
|
-
if (home2) allowedPrefixes.push(
|
|
56346
|
+
const allowedPrefixes = [path26.normalize(process.cwd())];
|
|
56347
|
+
if (home2) allowedPrefixes.push(path26.normalize(path26.join(home2, ".config", "visor")));
|
|
56220
56348
|
let realPath;
|
|
56221
56349
|
try {
|
|
56222
56350
|
realPath = fs21.realpathSync(resolved);
|
|
@@ -56224,17 +56352,17 @@ var init_validator = __esm({
|
|
|
56224
56352
|
return null;
|
|
56225
56353
|
}
|
|
56226
56354
|
const isSafe = allowedPrefixes.some(
|
|
56227
|
-
(prefix) => realPath === prefix || realPath.startsWith(prefix +
|
|
56355
|
+
(prefix) => realPath === prefix || realPath.startsWith(prefix + path26.sep)
|
|
56228
56356
|
);
|
|
56229
56357
|
if (!isSafe) return null;
|
|
56230
56358
|
return this.readFile(realPath);
|
|
56231
56359
|
}
|
|
56232
|
-
const cwdPath =
|
|
56360
|
+
const cwdPath = path26.join(process.cwd(), ".visor-license");
|
|
56233
56361
|
const cwdToken = this.readFile(cwdPath);
|
|
56234
56362
|
if (cwdToken) return cwdToken;
|
|
56235
56363
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
56236
56364
|
if (home) {
|
|
56237
|
-
const configPath =
|
|
56365
|
+
const configPath = path26.join(home, ".config", "visor", ".visor-license");
|
|
56238
56366
|
const configToken = this.readFile(configPath);
|
|
56239
56367
|
if (configToken) return configToken;
|
|
56240
56368
|
}
|
|
@@ -56256,11 +56384,11 @@ var init_validator = __esm({
|
|
|
56256
56384
|
if (header.alg !== "EdDSA") return null;
|
|
56257
56385
|
const data = `${headerB64}.${payloadB64}`;
|
|
56258
56386
|
const signature = Buffer.from(signatureB64, "base64url");
|
|
56259
|
-
const publicKey =
|
|
56387
|
+
const publicKey = crypto3.createPublicKey(_LicenseValidator.PUBLIC_KEY);
|
|
56260
56388
|
if (publicKey.asymmetricKeyType !== "ed25519") {
|
|
56261
56389
|
return null;
|
|
56262
56390
|
}
|
|
56263
|
-
const isValid =
|
|
56391
|
+
const isValid = crypto3.verify(null, Buffer.from(data), publicKey, signature);
|
|
56264
56392
|
if (!isValid) return null;
|
|
56265
56393
|
const payload = JSON.parse(Buffer.from(payloadB64, "base64url").toString());
|
|
56266
56394
|
if (!payload.org || !Array.isArray(payload.features) || typeof payload.exp !== "number" || typeof payload.iat !== "number" || !payload.sub) {
|
|
@@ -56281,17 +56409,17 @@ var init_validator = __esm({
|
|
|
56281
56409
|
});
|
|
56282
56410
|
|
|
56283
56411
|
// src/enterprise/policy/opa-compiler.ts
|
|
56284
|
-
var fs22,
|
|
56412
|
+
var fs22, path27, os2, crypto4, import_child_process8, OpaCompiler;
|
|
56285
56413
|
var init_opa_compiler = __esm({
|
|
56286
56414
|
"src/enterprise/policy/opa-compiler.ts"() {
|
|
56287
56415
|
"use strict";
|
|
56288
56416
|
fs22 = __toESM(require("fs"));
|
|
56289
|
-
|
|
56417
|
+
path27 = __toESM(require("path"));
|
|
56290
56418
|
os2 = __toESM(require("os"));
|
|
56291
|
-
|
|
56419
|
+
crypto4 = __toESM(require("crypto"));
|
|
56292
56420
|
import_child_process8 = require("child_process");
|
|
56293
56421
|
OpaCompiler = class _OpaCompiler {
|
|
56294
|
-
static CACHE_DIR =
|
|
56422
|
+
static CACHE_DIR = path27.join(os2.tmpdir(), "visor-opa-cache");
|
|
56295
56423
|
/**
|
|
56296
56424
|
* Resolve the input paths to WASM bytes.
|
|
56297
56425
|
*
|
|
@@ -56303,8 +56431,8 @@ var init_opa_compiler = __esm({
|
|
|
56303
56431
|
async resolveWasmBytes(paths) {
|
|
56304
56432
|
const regoFiles = [];
|
|
56305
56433
|
for (const p of paths) {
|
|
56306
|
-
const resolved =
|
|
56307
|
-
if (
|
|
56434
|
+
const resolved = path27.resolve(p);
|
|
56435
|
+
if (path27.normalize(resolved).includes("..")) {
|
|
56308
56436
|
throw new Error(`Policy path contains traversal sequences: ${p}`);
|
|
56309
56437
|
}
|
|
56310
56438
|
if (resolved.endsWith(".wasm") && fs22.existsSync(resolved)) {
|
|
@@ -56313,14 +56441,14 @@ var init_opa_compiler = __esm({
|
|
|
56313
56441
|
if (!fs22.existsSync(resolved)) continue;
|
|
56314
56442
|
const stat2 = fs22.statSync(resolved);
|
|
56315
56443
|
if (stat2.isDirectory()) {
|
|
56316
|
-
const wasmCandidate =
|
|
56444
|
+
const wasmCandidate = path27.join(resolved, "policy.wasm");
|
|
56317
56445
|
if (fs22.existsSync(wasmCandidate)) {
|
|
56318
56446
|
return fs22.readFileSync(wasmCandidate);
|
|
56319
56447
|
}
|
|
56320
56448
|
const files = fs22.readdirSync(resolved);
|
|
56321
56449
|
for (const f of files) {
|
|
56322
56450
|
if (f.endsWith(".rego")) {
|
|
56323
|
-
regoFiles.push(
|
|
56451
|
+
regoFiles.push(path27.join(resolved, f));
|
|
56324
56452
|
}
|
|
56325
56453
|
}
|
|
56326
56454
|
} else if (resolved.endsWith(".rego")) {
|
|
@@ -56348,19 +56476,19 @@ var init_opa_compiler = __esm({
|
|
|
56348
56476
|
"OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\nOr pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz " + regoFiles.join(" ")
|
|
56349
56477
|
);
|
|
56350
56478
|
}
|
|
56351
|
-
const hash =
|
|
56479
|
+
const hash = crypto4.createHash("sha256");
|
|
56352
56480
|
for (const f of regoFiles.sort()) {
|
|
56353
56481
|
hash.update(fs22.readFileSync(f));
|
|
56354
56482
|
hash.update(f);
|
|
56355
56483
|
}
|
|
56356
56484
|
const cacheKey = hash.digest("hex").slice(0, 16);
|
|
56357
56485
|
const cacheDir = _OpaCompiler.CACHE_DIR;
|
|
56358
|
-
const cachedWasm =
|
|
56486
|
+
const cachedWasm = path27.join(cacheDir, `${cacheKey}.wasm`);
|
|
56359
56487
|
if (fs22.existsSync(cachedWasm)) {
|
|
56360
56488
|
return fs22.readFileSync(cachedWasm);
|
|
56361
56489
|
}
|
|
56362
56490
|
fs22.mkdirSync(cacheDir, { recursive: true });
|
|
56363
|
-
const bundleTar =
|
|
56491
|
+
const bundleTar = path27.join(cacheDir, `${cacheKey}-bundle.tar.gz`);
|
|
56364
56492
|
try {
|
|
56365
56493
|
const args = [
|
|
56366
56494
|
"build",
|
|
@@ -56389,7 +56517,7 @@ Ensure your .rego files are valid and the \`opa\` CLI is installed.`
|
|
|
56389
56517
|
(0, import_child_process8.execFileSync)("tar", ["-xzf", bundleTar, "-C", cacheDir, "/policy.wasm"], {
|
|
56390
56518
|
stdio: "pipe"
|
|
56391
56519
|
});
|
|
56392
|
-
const extractedWasm =
|
|
56520
|
+
const extractedWasm = path27.join(cacheDir, "policy.wasm");
|
|
56393
56521
|
if (fs22.existsSync(extractedWasm)) {
|
|
56394
56522
|
fs22.renameSync(extractedWasm, cachedWasm);
|
|
56395
56523
|
}
|
|
@@ -56398,7 +56526,7 @@ Ensure your .rego files are valid and the \`opa\` CLI is installed.`
|
|
|
56398
56526
|
(0, import_child_process8.execFileSync)("tar", ["-xzf", bundleTar, "-C", cacheDir, "policy.wasm"], {
|
|
56399
56527
|
stdio: "pipe"
|
|
56400
56528
|
});
|
|
56401
|
-
const extractedWasm =
|
|
56529
|
+
const extractedWasm = path27.join(cacheDir, "policy.wasm");
|
|
56402
56530
|
if (fs22.existsSync(extractedWasm)) {
|
|
56403
56531
|
fs22.renameSync(extractedWasm, cachedWasm);
|
|
56404
56532
|
}
|
|
@@ -56420,12 +56548,12 @@ Ensure your .rego files are valid and the \`opa\` CLI is installed.`
|
|
|
56420
56548
|
});
|
|
56421
56549
|
|
|
56422
56550
|
// src/enterprise/policy/opa-wasm-evaluator.ts
|
|
56423
|
-
var fs23,
|
|
56551
|
+
var fs23, path28, OpaWasmEvaluator;
|
|
56424
56552
|
var init_opa_wasm_evaluator = __esm({
|
|
56425
56553
|
"src/enterprise/policy/opa-wasm-evaluator.ts"() {
|
|
56426
56554
|
"use strict";
|
|
56427
56555
|
fs23 = __toESM(require("fs"));
|
|
56428
|
-
|
|
56556
|
+
path28 = __toESM(require("path"));
|
|
56429
56557
|
init_opa_compiler();
|
|
56430
56558
|
OpaWasmEvaluator = class {
|
|
56431
56559
|
policy = null;
|
|
@@ -56458,8 +56586,8 @@ var init_opa_wasm_evaluator = __esm({
|
|
|
56458
56586
|
* making it available in Rego via `data.<key>`.
|
|
56459
56587
|
*/
|
|
56460
56588
|
loadData(dataPath) {
|
|
56461
|
-
const resolved =
|
|
56462
|
-
if (
|
|
56589
|
+
const resolved = path28.resolve(dataPath);
|
|
56590
|
+
if (path28.normalize(resolved).includes("..")) {
|
|
56463
56591
|
throw new Error(`Data path contains traversal sequences: ${dataPath}`);
|
|
56464
56592
|
}
|
|
56465
56593
|
if (!fs23.existsSync(resolved)) {
|
|
@@ -57032,12 +57160,12 @@ function toInsertRow(schedule) {
|
|
|
57032
57160
|
previous_response: schedule.previousResponse ?? null
|
|
57033
57161
|
};
|
|
57034
57162
|
}
|
|
57035
|
-
var fs24,
|
|
57163
|
+
var fs24, path29, import_uuid2, KnexStoreBackend;
|
|
57036
57164
|
var init_knex_store = __esm({
|
|
57037
57165
|
"src/enterprise/scheduler/knex-store.ts"() {
|
|
57038
57166
|
"use strict";
|
|
57039
57167
|
fs24 = __toESM(require("fs"));
|
|
57040
|
-
|
|
57168
|
+
path29 = __toESM(require("path"));
|
|
57041
57169
|
import_uuid2 = require("uuid");
|
|
57042
57170
|
init_logger();
|
|
57043
57171
|
KnexStoreBackend = class {
|
|
@@ -57136,8 +57264,8 @@ var init_knex_store = __esm({
|
|
|
57136
57264
|
return result;
|
|
57137
57265
|
}
|
|
57138
57266
|
validateSslPath(filePath, label) {
|
|
57139
|
-
const resolved =
|
|
57140
|
-
if (resolved !==
|
|
57267
|
+
const resolved = path29.resolve(filePath);
|
|
57268
|
+
if (resolved !== path29.normalize(resolved)) {
|
|
57141
57269
|
throw new Error(`SSL ${label} path contains invalid sequences: ${filePath}`);
|
|
57142
57270
|
}
|
|
57143
57271
|
if (!fs24.existsSync(resolved)) {
|
|
@@ -57545,12 +57673,12 @@ var ndjson_sink_exports = {};
|
|
|
57545
57673
|
__export(ndjson_sink_exports, {
|
|
57546
57674
|
NdjsonSink: () => NdjsonSink
|
|
57547
57675
|
});
|
|
57548
|
-
var import_fs9,
|
|
57676
|
+
var import_fs9, import_path14, NdjsonSink;
|
|
57549
57677
|
var init_ndjson_sink = __esm({
|
|
57550
57678
|
"src/frontends/ndjson-sink.ts"() {
|
|
57551
57679
|
"use strict";
|
|
57552
57680
|
import_fs9 = __toESM(require("fs"));
|
|
57553
|
-
|
|
57681
|
+
import_path14 = __toESM(require("path"));
|
|
57554
57682
|
NdjsonSink = class {
|
|
57555
57683
|
name = "ndjson-sink";
|
|
57556
57684
|
cfg;
|
|
@@ -57582,8 +57710,8 @@ var init_ndjson_sink = __esm({
|
|
|
57582
57710
|
this.unsub = void 0;
|
|
57583
57711
|
}
|
|
57584
57712
|
resolveFile(p) {
|
|
57585
|
-
if (
|
|
57586
|
-
return
|
|
57713
|
+
if (import_path14.default.isAbsolute(p)) return p;
|
|
57714
|
+
return import_path14.default.join(process.cwd(), p);
|
|
57587
57715
|
}
|
|
57588
57716
|
};
|
|
57589
57717
|
}
|
|
@@ -60219,13 +60347,13 @@ function taskRowToAgentTask(row) {
|
|
|
60219
60347
|
workflow_id: row.workflow_id ?? void 0
|
|
60220
60348
|
};
|
|
60221
60349
|
}
|
|
60222
|
-
var
|
|
60350
|
+
var import_path15, import_fs10, import_crypto6, SqliteTaskStore;
|
|
60223
60351
|
var init_task_store = __esm({
|
|
60224
60352
|
"src/agent-protocol/task-store.ts"() {
|
|
60225
60353
|
"use strict";
|
|
60226
|
-
|
|
60354
|
+
import_path15 = __toESM(require("path"));
|
|
60227
60355
|
import_fs10 = __toESM(require("fs"));
|
|
60228
|
-
|
|
60356
|
+
import_crypto6 = __toESM(require("crypto"));
|
|
60229
60357
|
init_logger();
|
|
60230
60358
|
init_types();
|
|
60231
60359
|
init_state_transitions();
|
|
@@ -60236,8 +60364,8 @@ var init_task_store = __esm({
|
|
|
60236
60364
|
this.dbPath = filename || ".visor/agent-tasks.db";
|
|
60237
60365
|
}
|
|
60238
60366
|
async initialize() {
|
|
60239
|
-
const resolvedPath =
|
|
60240
|
-
const dir =
|
|
60367
|
+
const resolvedPath = import_path15.default.resolve(process.cwd(), this.dbPath);
|
|
60368
|
+
const dir = import_path15.default.dirname(resolvedPath);
|
|
60241
60369
|
import_fs10.default.mkdirSync(dir, { recursive: true });
|
|
60242
60370
|
const { createRequire } = require("module");
|
|
60243
60371
|
const runtimeRequire = createRequire(__filename);
|
|
@@ -60306,7 +60434,7 @@ var init_task_store = __esm({
|
|
|
60306
60434
|
// -------------------------------------------------------------------------
|
|
60307
60435
|
createTask(params) {
|
|
60308
60436
|
const db = this.getDb();
|
|
60309
|
-
const id =
|
|
60437
|
+
const id = import_crypto6.default.randomUUID();
|
|
60310
60438
|
const now = nowISO();
|
|
60311
60439
|
const contextId = this.resolveContextId(params.requestMessage, params.contextId);
|
|
60312
60440
|
const expiresAt = params.expiresAt ?? null;
|
|
@@ -60393,6 +60521,13 @@ var init_task_store = __esm({
|
|
|
60393
60521
|
messageText = textPart?.text ?? "";
|
|
60394
60522
|
} catch {
|
|
60395
60523
|
}
|
|
60524
|
+
let source = "-";
|
|
60525
|
+
let metadata = {};
|
|
60526
|
+
try {
|
|
60527
|
+
metadata = JSON.parse(r.request_metadata || "{}");
|
|
60528
|
+
source = metadata.source || "-";
|
|
60529
|
+
} catch {
|
|
60530
|
+
}
|
|
60396
60531
|
return {
|
|
60397
60532
|
id: r.id,
|
|
60398
60533
|
context_id: r.context_id,
|
|
@@ -60403,7 +60538,9 @@ var init_task_store = __esm({
|
|
|
60403
60538
|
claimed_at: r.claimed_at,
|
|
60404
60539
|
workflow_id: r.workflow_id,
|
|
60405
60540
|
run_id: r.run_id,
|
|
60406
|
-
request_message: messageText
|
|
60541
|
+
request_message: messageText,
|
|
60542
|
+
source,
|
|
60543
|
+
metadata
|
|
60407
60544
|
};
|
|
60408
60545
|
});
|
|
60409
60546
|
return { rows, total };
|
|
@@ -60423,6 +60560,13 @@ var init_task_store = __esm({
|
|
|
60423
60560
|
WHERE id = ?`
|
|
60424
60561
|
).run(newState, now, statusMessage ? JSON.stringify(statusMessage) : null, taskId);
|
|
60425
60562
|
}
|
|
60563
|
+
claimTask(taskId, workerId) {
|
|
60564
|
+
const db = this.getDb();
|
|
60565
|
+
const now = nowISO();
|
|
60566
|
+
db.prepare(
|
|
60567
|
+
`UPDATE agent_tasks SET claimed_by = ?, claimed_at = ?, updated_at = ? WHERE id = ?`
|
|
60568
|
+
).run(workerId, now, now, taskId);
|
|
60569
|
+
}
|
|
60426
60570
|
addArtifact(taskId, artifact) {
|
|
60427
60571
|
const db = this.getDb();
|
|
60428
60572
|
const row = db.prepare("SELECT artifacts FROM agent_tasks WHERE id = ?").get(taskId);
|
|
@@ -60644,11 +60788,11 @@ var init_task_stream_manager = __esm({
|
|
|
60644
60788
|
});
|
|
60645
60789
|
|
|
60646
60790
|
// src/agent-protocol/push-notification-manager.ts
|
|
60647
|
-
var
|
|
60791
|
+
var import_crypto7, PushNotificationManager;
|
|
60648
60792
|
var init_push_notification_manager = __esm({
|
|
60649
60793
|
"src/agent-protocol/push-notification-manager.ts"() {
|
|
60650
60794
|
"use strict";
|
|
60651
|
-
|
|
60795
|
+
import_crypto7 = __toESM(require("crypto"));
|
|
60652
60796
|
init_logger();
|
|
60653
60797
|
PushNotificationManager = class {
|
|
60654
60798
|
db = null;
|
|
@@ -60693,7 +60837,7 @@ var init_push_notification_manager = __esm({
|
|
|
60693
60837
|
// -------------------------------------------------------------------------
|
|
60694
60838
|
create(config) {
|
|
60695
60839
|
const db = this.getDb();
|
|
60696
|
-
const id = config.id ??
|
|
60840
|
+
const id = config.id ?? import_crypto7.default.randomUUID();
|
|
60697
60841
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
60698
60842
|
db.prepare(
|
|
60699
60843
|
`INSERT INTO agent_push_configs (id, task_id, url, token, auth_scheme, auth_credentials, created_at)
|
|
@@ -60791,11 +60935,11 @@ var init_push_notification_manager = __esm({
|
|
|
60791
60935
|
});
|
|
60792
60936
|
|
|
60793
60937
|
// src/agent-protocol/task-queue.ts
|
|
60794
|
-
var
|
|
60938
|
+
var import_crypto8, DEFAULT_CONFIG, TaskQueue;
|
|
60795
60939
|
var init_task_queue = __esm({
|
|
60796
60940
|
"src/agent-protocol/task-queue.ts"() {
|
|
60797
60941
|
"use strict";
|
|
60798
|
-
|
|
60942
|
+
import_crypto8 = __toESM(require("crypto"));
|
|
60799
60943
|
init_logger();
|
|
60800
60944
|
init_trace_helpers();
|
|
60801
60945
|
DEFAULT_CONFIG = {
|
|
@@ -60808,7 +60952,7 @@ var init_task_queue = __esm({
|
|
|
60808
60952
|
this.taskStore = taskStore;
|
|
60809
60953
|
this.executor = executor;
|
|
60810
60954
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
60811
|
-
this.workerId = workerId ??
|
|
60955
|
+
this.workerId = workerId ?? import_crypto8.default.randomUUID();
|
|
60812
60956
|
}
|
|
60813
60957
|
running = false;
|
|
60814
60958
|
timer = null;
|
|
@@ -60882,7 +61026,7 @@ var init_task_queue = __esm({
|
|
|
60882
61026
|
}
|
|
60883
61027
|
if (result.success) {
|
|
60884
61028
|
const completedMsg = {
|
|
60885
|
-
message_id:
|
|
61029
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
60886
61030
|
role: "agent",
|
|
60887
61031
|
parts: [
|
|
60888
61032
|
{
|
|
@@ -60894,7 +61038,7 @@ var init_task_queue = __esm({
|
|
|
60894
61038
|
this.taskStore.updateTaskState(task.id, "completed", completedMsg);
|
|
60895
61039
|
} else {
|
|
60896
61040
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
60897
|
-
message_id:
|
|
61041
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
60898
61042
|
role: "agent",
|
|
60899
61043
|
parts: [{ text: result.error ?? "Task execution failed" }]
|
|
60900
61044
|
});
|
|
@@ -60905,7 +61049,7 @@ var init_task_queue = __esm({
|
|
|
60905
61049
|
);
|
|
60906
61050
|
try {
|
|
60907
61051
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
60908
|
-
message_id:
|
|
61052
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
60909
61053
|
role: "agent",
|
|
60910
61054
|
parts: [{ text: err instanceof Error ? err.message : "Unknown error" }]
|
|
60911
61055
|
});
|
|
@@ -60959,7 +61103,7 @@ function timingSafeEqual(a, b) {
|
|
|
60959
61103
|
if (!a || !b) return false;
|
|
60960
61104
|
if (a.length !== b.length) return false;
|
|
60961
61105
|
try {
|
|
60962
|
-
return
|
|
61106
|
+
return import_crypto9.default.timingSafeEqual(Buffer.from(a), Buffer.from(b));
|
|
60963
61107
|
} catch {
|
|
60964
61108
|
return false;
|
|
60965
61109
|
}
|
|
@@ -61033,7 +61177,7 @@ function resultToArtifacts(checkResults) {
|
|
|
61033
61177
|
}
|
|
61034
61178
|
if (parts.length > 0) {
|
|
61035
61179
|
artifacts.push({
|
|
61036
|
-
artifact_id:
|
|
61180
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
61037
61181
|
name: checkId,
|
|
61038
61182
|
description: `Output from check: ${checkId}`,
|
|
61039
61183
|
parts
|
|
@@ -61042,14 +61186,14 @@ function resultToArtifacts(checkResults) {
|
|
|
61042
61186
|
}
|
|
61043
61187
|
return artifacts;
|
|
61044
61188
|
}
|
|
61045
|
-
var import_http2, import_https, import_fs11,
|
|
61189
|
+
var import_http2, import_https, import_fs11, import_crypto9, A2AFrontend;
|
|
61046
61190
|
var init_a2a_frontend = __esm({
|
|
61047
61191
|
"src/agent-protocol/a2a-frontend.ts"() {
|
|
61048
61192
|
"use strict";
|
|
61049
61193
|
import_http2 = __toESM(require("http"));
|
|
61050
61194
|
import_https = __toESM(require("https"));
|
|
61051
61195
|
import_fs11 = __toESM(require("fs"));
|
|
61052
|
-
|
|
61196
|
+
import_crypto9 = __toESM(require("crypto"));
|
|
61053
61197
|
init_logger();
|
|
61054
61198
|
init_task_store();
|
|
61055
61199
|
init_types();
|
|
@@ -61143,7 +61287,7 @@ var init_a2a_frontend = __esm({
|
|
|
61143
61287
|
if (!taskId) return;
|
|
61144
61288
|
try {
|
|
61145
61289
|
const statusMessage = {
|
|
61146
|
-
message_id:
|
|
61290
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
61147
61291
|
role: "agent",
|
|
61148
61292
|
parts: [{ text: envelope.payload?.prompt ?? "Agent requires input" }]
|
|
61149
61293
|
};
|
|
@@ -61315,7 +61459,7 @@ var init_a2a_frontend = __esm({
|
|
|
61315
61459
|
const response = await this.handleFollowUpMessage(existingTaskId, body);
|
|
61316
61460
|
return sendJson(res, 200, response);
|
|
61317
61461
|
}
|
|
61318
|
-
const contextId = body.message.context_id ??
|
|
61462
|
+
const contextId = body.message.context_id ?? import_crypto9.default.randomUUID();
|
|
61319
61463
|
const workflowId = resolveWorkflow(body, this.config);
|
|
61320
61464
|
const blocking = body.configuration?.blocking ?? false;
|
|
61321
61465
|
await withActiveSpan(
|
|
@@ -61428,7 +61572,7 @@ var init_a2a_frontend = __esm({
|
|
|
61428
61572
|
if (!body.message?.parts?.length) {
|
|
61429
61573
|
throw new InvalidRequestError("Message must contain at least one part");
|
|
61430
61574
|
}
|
|
61431
|
-
const contextId = body.message.context_id ??
|
|
61575
|
+
const contextId = body.message.context_id ?? import_crypto9.default.randomUUID();
|
|
61432
61576
|
const workflowId = resolveWorkflow(body, this.config);
|
|
61433
61577
|
const task = this.taskStore.createTask({
|
|
61434
61578
|
contextId,
|
|
@@ -61562,7 +61706,7 @@ var init_a2a_frontend = __esm({
|
|
|
61562
61706
|
await this.executeTaskViaEngine(task, message);
|
|
61563
61707
|
} else {
|
|
61564
61708
|
const agentResponse = {
|
|
61565
|
-
message_id:
|
|
61709
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
61566
61710
|
role: "agent",
|
|
61567
61711
|
parts: [{ text: `Task ${task.id} received and processed.`, media_type: "text/markdown" }]
|
|
61568
61712
|
};
|
|
@@ -61574,7 +61718,7 @@ var init_a2a_frontend = __esm({
|
|
|
61574
61718
|
logger.error(`[A2A] Task ${task.id} execution failed: ${errorMsg}`);
|
|
61575
61719
|
try {
|
|
61576
61720
|
const failMessage = {
|
|
61577
|
-
message_id:
|
|
61721
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
61578
61722
|
role: "agent",
|
|
61579
61723
|
parts: [{ text: errorMsg }]
|
|
61580
61724
|
};
|
|
@@ -61617,7 +61761,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
61617
61761
|
}
|
|
61618
61762
|
if (summaryParts.length > 0) {
|
|
61619
61763
|
artifacts.push({
|
|
61620
|
-
artifact_id:
|
|
61764
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
61621
61765
|
name: "review-summary",
|
|
61622
61766
|
description: "Review summary with issues found",
|
|
61623
61767
|
parts: summaryParts
|
|
@@ -61637,7 +61781,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
61637
61781
|
}
|
|
61638
61782
|
if (parts.length > 0) {
|
|
61639
61783
|
artifacts.push({
|
|
61640
|
-
artifact_id:
|
|
61784
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
61641
61785
|
name: cr.checkName ?? groupName,
|
|
61642
61786
|
description: `Output from check: ${cr.checkName ?? groupName}`,
|
|
61643
61787
|
parts
|
|
@@ -61648,7 +61792,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
61648
61792
|
}
|
|
61649
61793
|
if (artifacts.length === 0) {
|
|
61650
61794
|
artifacts.push({
|
|
61651
|
-
artifact_id:
|
|
61795
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
61652
61796
|
name: "result",
|
|
61653
61797
|
description: "Execution result",
|
|
61654
61798
|
parts: [
|
|
@@ -61670,7 +61814,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
61670
61814
|
);
|
|
61671
61815
|
}
|
|
61672
61816
|
const agentResponse = {
|
|
61673
|
-
message_id:
|
|
61817
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
61674
61818
|
role: "agent",
|
|
61675
61819
|
parts: [
|
|
61676
61820
|
{
|
|
@@ -61723,7 +61867,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
61723
61867
|
}
|
|
61724
61868
|
if (parts.length === 0) return null;
|
|
61725
61869
|
return {
|
|
61726
|
-
artifact_id:
|
|
61870
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
61727
61871
|
name: p.checkId ?? "check-result",
|
|
61728
61872
|
parts
|
|
61729
61873
|
};
|
|
@@ -61909,14 +62053,14 @@ function serializeRunState(state) {
|
|
|
61909
62053
|
])
|
|
61910
62054
|
};
|
|
61911
62055
|
}
|
|
61912
|
-
var
|
|
62056
|
+
var path32, fs28, StateMachineExecutionEngine;
|
|
61913
62057
|
var init_state_machine_execution_engine = __esm({
|
|
61914
62058
|
"src/state-machine-execution-engine.ts"() {
|
|
61915
62059
|
"use strict";
|
|
61916
62060
|
init_runner();
|
|
61917
62061
|
init_logger();
|
|
61918
62062
|
init_sandbox_manager();
|
|
61919
|
-
|
|
62063
|
+
path32 = __toESM(require("path"));
|
|
61920
62064
|
fs28 = __toESM(require("fs"));
|
|
61921
62065
|
StateMachineExecutionEngine = class _StateMachineExecutionEngine {
|
|
61922
62066
|
workingDirectory;
|
|
@@ -62304,9 +62448,9 @@ var init_state_machine_execution_engine = __esm({
|
|
|
62304
62448
|
}
|
|
62305
62449
|
const checkId = String(ev?.checkId || "unknown");
|
|
62306
62450
|
const threadKey = ev?.threadKey || (channel && threadTs ? `${channel}:${threadTs}` : "session");
|
|
62307
|
-
const baseDir = process.env.VISOR_SNAPSHOT_DIR ||
|
|
62451
|
+
const baseDir = process.env.VISOR_SNAPSHOT_DIR || path32.resolve(process.cwd(), ".visor", "snapshots");
|
|
62308
62452
|
fs28.mkdirSync(baseDir, { recursive: true });
|
|
62309
|
-
const filePath =
|
|
62453
|
+
const filePath = path32.join(baseDir, `${threadKey}-${checkId}.json`);
|
|
62310
62454
|
await this.saveSnapshotToFile(filePath);
|
|
62311
62455
|
logger.info(`[Snapshot] Saved run snapshot: ${filePath}`);
|
|
62312
62456
|
try {
|