@probelabs/visor 0.1.170 → 0.1.171
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/output/traces/{run-2026-03-07T15-43-18-430Z.ndjson → run-2026-03-08T07-55-35-120Z.ndjson} +84 -84
- package/dist/{traces/run-2026-03-07T15-43-56-196Z.ndjson → output/traces/run-2026-03-08T07-56-13-035Z.ndjson} +1807 -1807
- 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-FGJ3UBHX.mjs} +20 -3
- package/dist/sdk/a2a-frontend-FGJ3UBHX.mjs.map +1 -0
- package/dist/sdk/{a2a-frontend-IPLHACI6.mjs → a2a-frontend-GUEGI5SX.mjs} +20 -3
- package/dist/sdk/a2a-frontend-GUEGI5SX.mjs.map +1 -0
- package/dist/sdk/{check-provider-registry-5CMLUEFG.mjs → check-provider-registry-PVTV5G5R.mjs} +7 -7
- package/dist/sdk/{check-provider-registry-STRAOYRJ.mjs → check-provider-registry-YTI4PU5F.mjs} +7 -7
- package/dist/sdk/{check-provider-registry-T5FWS4SW.mjs → check-provider-registry-ZUU7KSKR.mjs} +7 -7
- package/dist/sdk/{chunk-NYQTQYGU.mjs → chunk-2VDUNKIP.mjs} +62 -23
- package/dist/sdk/chunk-2VDUNKIP.mjs.map +1 -0
- package/dist/sdk/{chunk-WNLCRRQO.mjs → chunk-5SBX4KLG.mjs} +2 -2
- package/dist/sdk/{chunk-FTUGQP5L.mjs → chunk-6FDBLSGV.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-47WAHGHK.mjs → chunk-AJK3FAA2.mjs} +3 -3
- 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-ZM7ALGTE.mjs → chunk-O72J3ORS.mjs} +9 -3
- package/dist/sdk/chunk-O72J3ORS.mjs.map +1 -0
- package/dist/sdk/{chunk-LB77GR4Q.mjs → chunk-XUQSI5SR.mjs} +62 -23
- package/dist/sdk/chunk-XUQSI5SR.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/{failure-condition-evaluator-T67YFO2Z.mjs → failure-condition-evaluator-EFMCQVAK.mjs} +4 -3
- package/dist/sdk/{github-frontend-BAPXDLBB.mjs → github-frontend-XG55VJ4R.mjs} +7 -7
- package/dist/sdk/{github-frontend-WPTKI4AY.mjs → github-frontend-ZZRU6P43.mjs} +7 -7
- package/dist/sdk/{host-6HV5FMD7.mjs → host-A4GGQVEN.mjs} +3 -3
- package/dist/sdk/host-A4GGQVEN.mjs.map +1 -0
- package/dist/sdk/{host-K6IZWJG3.mjs → host-A7UNRBQU.mjs} +3 -3
- package/dist/sdk/host-A7UNRBQU.mjs.map +1 -0
- package/dist/sdk/{routing-RWZEXSRZ.mjs → routing-AMRQYI7J.mjs} +5 -4
- package/dist/sdk/{routing-SAGHEUOA.mjs → routing-BVEHVZHK.mjs} +5 -4
- package/dist/sdk/{schedule-tool-JCKV47FU.mjs → schedule-tool-4MTFIHCA.mjs} +7 -7
- package/dist/sdk/{schedule-tool-TGWPINHO.mjs → schedule-tool-DGVJDHJM.mjs} +7 -7
- package/dist/sdk/{schedule-tool-H4G5ITNL.mjs → schedule-tool-PHSF5U2B.mjs} +7 -7
- package/dist/sdk/{schedule-tool-handler-OEBLE5AB.mjs → schedule-tool-handler-EFNCZNS7.mjs} +7 -7
- package/dist/sdk/{schedule-tool-handler-UQWDPFP6.mjs → schedule-tool-handler-LMXQ4BZQ.mjs} +7 -7
- 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 +398 -254
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +6 -6
- package/dist/sdk/{trace-helpers-ZYN23GBG.mjs → trace-helpers-4ZBZWH5W.mjs} +3 -2
- package/dist/sdk/{trace-helpers-M7RVAZQ2.mjs → trace-helpers-P5L4COO4.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-KQNLEQEY.mjs} +7 -7
- package/dist/sdk/{workflow-check-provider-VDSZR7Y5.mjs → workflow-check-provider-WLMTCFRA.mjs} +7 -7
- package/dist/sdk/{workflow-check-provider-FAO4AUGB.mjs → workflow-check-provider-X5EMAJUZ.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/traces/{run-2026-03-07T15-43-18-430Z.ndjson → run-2026-03-08T07-55-35-120Z.ndjson} +84 -84
- package/dist/{output/traces/run-2026-03-07T15-43-56-196Z.ndjson → traces/run-2026-03-08T07-56-13-035Z.ndjson} +1807 -1807
- 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-IPLHACI6.mjs.map +0 -1
- package/dist/sdk/a2a-frontend-YTXQGUDH.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-LB77GR4Q.mjs.map +0 -1
- package/dist/sdk/chunk-NYQTQYGU.mjs.map +0 -1
- package/dist/sdk/chunk-SVBF7Y2R.mjs.map +0 -1
- package/dist/sdk/chunk-ZM7ALGTE.mjs.map +0 -1
- package/dist/sdk/host-6HV5FMD7.mjs.map +0 -1
- package/dist/sdk/host-K6IZWJG3.mjs.map +0 -1
- /package/dist/sdk/{check-provider-registry-5CMLUEFG.mjs.map → check-provider-registry-PVTV5G5R.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-STRAOYRJ.mjs.map → check-provider-registry-YTI4PU5F.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-WNLCRRQO.mjs.map → chunk-6FDBLSGV.mjs.map} +0 -0
- /package/dist/sdk/{chunk-2CNT2EB3.mjs.map → chunk-6FXVWL6M.mjs.map} +0 -0
- /package/dist/sdk/{chunk-47WAHGHK.mjs.map → chunk-AJK3FAA2.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/{failure-condition-evaluator-T67YFO2Z.mjs.map → failure-condition-evaluator-EFMCQVAK.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-BAPXDLBB.mjs.map → github-frontend-XG55VJ4R.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-WPTKI4AY.mjs.map → github-frontend-ZZRU6P43.mjs.map} +0 -0
- /package/dist/sdk/{routing-RWZEXSRZ.mjs.map → routing-AMRQYI7J.mjs.map} +0 -0
- /package/dist/sdk/{routing-SAGHEUOA.mjs.map → routing-BVEHVZHK.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-H4G5ITNL.mjs.map → schedule-tool-4MTFIHCA.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-JCKV47FU.mjs.map → schedule-tool-DGVJDHJM.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-TGWPINHO.mjs.map → schedule-tool-PHSF5U2B.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-OEBLE5AB.mjs.map → schedule-tool-handler-EFNCZNS7.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-UQWDPFP6.mjs.map → schedule-tool-handler-LMXQ4BZQ.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-M7RVAZQ2.mjs.map → trace-helpers-4ZBZWH5W.mjs.map} +0 -0
- /package/dist/sdk/{trace-helpers-ZYN23GBG.mjs.map → trace-helpers-P5L4COO4.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-FAO4AUGB.mjs.map → workflow-check-provider-KQNLEQEY.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-OAOD3A5U.mjs.map → workflow-check-provider-WLMTCFRA.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-VDSZR7Y5.mjs.map → workflow-check-provider-X5EMAJUZ.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, {
|
|
@@ -646,7 +661,7 @@ var require_package = __commonJS({
|
|
|
646
661
|
"package.json"(exports2, module2) {
|
|
647
662
|
module2.exports = {
|
|
648
663
|
name: "@probelabs/visor",
|
|
649
|
-
version: "0.1.
|
|
664
|
+
version: "0.1.171",
|
|
650
665
|
main: "dist/index.js",
|
|
651
666
|
bin: {
|
|
652
667
|
visor: "./dist/index.js"
|
|
@@ -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 path29 = require("path");
|
|
949
965
|
const fs25 = 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 = path29.dirname(__ndjsonPath);
|
|
953
969
|
if (!fs25.existsSync(dir)) fs25.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 || path29.join(process.cwd(), "output", "traces");
|
|
957
973
|
if (!fs25.existsSync(outDir)) fs25.mkdirSync(outDir, { recursive: true });
|
|
958
974
|
if (!__ndjsonPath) {
|
|
959
975
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
960
|
-
__ndjsonPath =
|
|
976
|
+
__ndjsonPath = path29.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 path29 = typeof pathExpr === "string" ? pathExpr : String(pathExpr || "");
|
|
3755
|
+
if (!path29) return obj;
|
|
3756
|
+
const parts = path29.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, path29) => {
|
|
3876
|
+
if (!obj || !path29) return void 0;
|
|
3877
|
+
const parts = path29.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 fs25 = await import("fs/promises");
|
|
6413
|
-
const
|
|
6430
|
+
const path29 = 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 = path29.resolve(process.cwd(), file);
|
|
6422
6439
|
templateContent = await fs25.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
|
+
path29.join(__dirname, "output", sanitized, "template.liquid"),
|
|
6428
6445
|
// bundled: dist/output/
|
|
6429
|
-
|
|
6446
|
+
path29.join(__dirname, "..", "..", "output", sanitized, "template.liquid"),
|
|
6430
6447
|
// source: output/
|
|
6431
|
-
|
|
6448
|
+
path29.join(process.cwd(), "output", sanitized, "template.liquid"),
|
|
6432
6449
|
// fallback: cwd/output/
|
|
6433
|
-
|
|
6450
|
+
path29.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 fs25 = require("fs");
|
|
8160
|
-
const
|
|
8177
|
+
const path29 = 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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8275
8292
|
if (!fs25.existsSync(debugArtifactsDir)) {
|
|
8276
8293
|
fs25.mkdirSync(debugArtifactsDir, { recursive: true });
|
|
8277
8294
|
}
|
|
8278
|
-
const debugFile =
|
|
8295
|
+
const debugFile = path29.join(
|
|
8279
8296
|
debugArtifactsDir,
|
|
8280
8297
|
`prompt-${_checkName || "unknown"}-${timestamp}.json`
|
|
8281
8298
|
);
|
|
8282
8299
|
fs25.writeFileSync(debugFile, debugJson, "utf-8");
|
|
8283
|
-
const readableFile =
|
|
8300
|
+
const readableFile = path29.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 fs25 = require("fs");
|
|
8321
|
-
const
|
|
8338
|
+
const path29 = 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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8350
|
+
const sessionBase = path29.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 fs25 = require("fs");
|
|
8382
|
-
const
|
|
8399
|
+
const path29 = 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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8402
|
+
const responseFile = path29.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 fs25 = require("fs");
|
|
8650
|
-
const
|
|
8667
|
+
const path29 = require("path");
|
|
8651
8668
|
const os2 = 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 = os2.tmpdir();
|
|
8724
|
-
const promptFile =
|
|
8741
|
+
const promptFile = path29.join(tempDir, `visor-prompt-${timestamp}.txt`);
|
|
8725
8742
|
fs25.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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8729
8746
|
try {
|
|
8730
|
-
const base =
|
|
8747
|
+
const base = path29.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 fs25 = require("fs");
|
|
8781
|
-
const
|
|
8798
|
+
const path29 = 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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8810
|
+
const sessionBase = path29.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 fs25 = require("fs");
|
|
8842
|
-
const
|
|
8859
|
+
const path29 = 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 || path29.join(process.cwd(), "debug-artifacts");
|
|
8862
|
+
const responseFile = path29.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 fs25 = require("fs").promises;
|
|
8937
|
-
const
|
|
8954
|
+
const path29 = 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")) && !path29.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 = path29.resolve(process.cwd(), schema);
|
|
8956
8973
|
log(`\u{1F4CB} Loading custom schema from file: ${schemaPath}`);
|
|
8957
8974
|
const schemaContent = await fs25.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
|
+
path29.join(__dirname, "output", sanitizedSchemaName, "schema.json"),
|
|
8972
8989
|
// Historical fallback when src/output was inadvertently bundled as output1/
|
|
8973
|
-
|
|
8990
|
+
path29.join(__dirname, "output1", sanitizedSchemaName, "schema.json"),
|
|
8974
8991
|
// Local dev (repo root)
|
|
8975
|
-
|
|
8992
|
+
path29.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 = path29.join(__dirname, "output", sanitizedSchemaName, "schema.json");
|
|
9002
|
+
const distAltPath = path29.join(__dirname, "output1", sanitizedSchemaName, "schema.json");
|
|
9003
|
+
const cwdPath = path29.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 path29 = require("path");
|
|
17981
18002
|
const fs25 = require("fs");
|
|
17982
18003
|
const yaml5 = require("js-yaml");
|
|
17983
|
-
const resolved =
|
|
18004
|
+
const resolved = path29.isAbsolute(sourcePath) ? sourcePath : path29.resolve(baseDir, sourcePath);
|
|
17984
18005
|
if (!fs25.existsSync(resolved)) {
|
|
17985
18006
|
throw new Error(`Workflow config not found at: ${resolved}`);
|
|
17986
18007
|
}
|
|
17987
18008
|
const rawContent = fs25.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 = path29.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 = path29.basename(resolved).replace(/\.(ya?ml)$/i, "");
|
|
18042
|
+
const name = loaded.name || `Workflow from ${path29.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 fs25 = 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 path29 = 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 (path29 && !path29.startsWith("/")) {
|
|
28529
|
+
path29 = `/${path29}`;
|
|
28402
28530
|
}
|
|
28403
|
-
url = new URL(origin +
|
|
28531
|
+
url = new URL(origin + path29);
|
|
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(path29) {
|
|
30146
|
+
if (typeof path29 !== "string") {
|
|
30019
30147
|
return "";
|
|
30020
30148
|
}
|
|
30021
|
-
for (var i =
|
|
30022
|
-
switch (
|
|
30149
|
+
for (var i = path29.length - 1; i >= 0; --i) {
|
|
30150
|
+
switch (path29.charCodeAt(i)) {
|
|
30023
30151
|
case 47:
|
|
30024
30152
|
// '/'
|
|
30025
30153
|
case 92:
|
|
30026
|
-
|
|
30027
|
-
return
|
|
30154
|
+
path29 = path29.slice(i + 1);
|
|
30155
|
+
return path29 === ".." || path29 === "." ? "" : path29;
|
|
30028
30156
|
}
|
|
30029
30157
|
}
|
|
30030
|
-
return
|
|
30158
|
+
return path29 === ".." || path29 === "." ? "" : path29;
|
|
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 crypto7;
|
|
31035
31163
|
try {
|
|
31036
|
-
|
|
31164
|
+
crypto7 = require("crypto");
|
|
31037
31165
|
const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
|
|
31038
|
-
supportedHashes =
|
|
31166
|
+
supportedHashes = crypto7.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 (crypto7 === 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 = crypto7.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 crypto7 = require("crypto");
|
|
32806
|
+
random = (max) => crypto7.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: path29,
|
|
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 path29 !== "string") {
|
|
33076
33204
|
throw new InvalidArgumentError("path must be a string");
|
|
33077
|
-
} else if (
|
|
33205
|
+
} else if (path29[0] !== "/" && !(path29.startsWith("http://") || path29.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(path29) !== 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(path29, query) : path29;
|
|
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 path29 = 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 = path29;
|
|
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: path29, 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} ${path29} 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: path29, 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] = path29;
|
|
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(path29) {
|
|
37922
|
+
if (typeof path29 !== "string") {
|
|
37923
|
+
return path29;
|
|
37796
37924
|
}
|
|
37797
|
-
const pathSegments =
|
|
37925
|
+
const pathSegments = path29.split("?");
|
|
37798
37926
|
if (pathSegments.length !== 2) {
|
|
37799
|
-
return
|
|
37927
|
+
return path29;
|
|
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: path29, method, body, headers }) {
|
|
37934
|
+
const pathMatch = matchValue(mockDispatch2.path, path29);
|
|
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: path29 }) => matchValue(safeUrl(path29), 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: path29, method, body, headers, query } = opts;
|
|
37862
37990
|
return {
|
|
37863
|
-
path:
|
|
37991
|
+
path: path29,
|
|
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: path29, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
38313
38441
|
Method: method,
|
|
38314
38442
|
Origin: origin,
|
|
38315
|
-
Path:
|
|
38443
|
+
Path: path29,
|
|
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(path29) {
|
|
43065
|
+
for (const char of path29) {
|
|
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 crypto7;
|
|
43735
43863
|
try {
|
|
43736
|
-
|
|
43864
|
+
crypto7 = 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 = crypto7.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 = crypto7.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 crypto7;
|
|
43865
43993
|
try {
|
|
43866
|
-
|
|
43994
|
+
crypto7 = 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 = crypto7.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 path29 = opts.path;
|
|
44618
44746
|
if (!opts.path.startsWith("/")) {
|
|
44619
|
-
|
|
44747
|
+
path29 = `/${path29}`;
|
|
44620
44748
|
}
|
|
44621
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
44749
|
+
url = new URL(util.parseOrigin(url).origin + path29);
|
|
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 fs25 = await import("fs/promises");
|
|
50609
|
-
const
|
|
50737
|
+
const path29 = 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
|
+
path29.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
|
+
path29.join(__dirname, "..", "..", "output", sanitized, "schema.json"),
|
|
50617
50745
|
// When running from a checkout with output/ folder copied to CWD
|
|
50618
|
-
|
|
50746
|
+
path29.join(process.cwd(), "output", sanitized, "schema.json"),
|
|
50619
50747
|
// Fallback: cwd/dist/output/
|
|
50620
|
-
|
|
50748
|
+
path29.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 fs25 = await import("fs/promises");
|
|
53066
|
-
const
|
|
53194
|
+
const path29 = 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 = path29.resolve(process.cwd(), file);
|
|
53076
53204
|
templateContent = await fs25.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
|
+
path29.join(__dirname, "output", sanitized, "template.liquid"),
|
|
53083
53211
|
// bundled: dist/output/
|
|
53084
|
-
|
|
53212
|
+
path29.join(__dirname, "..", "..", "output", sanitized, "template.liquid"),
|
|
53085
53213
|
// source (from state-machine/states)
|
|
53086
|
-
|
|
53214
|
+
path29.join(__dirname, "..", "..", "..", "output", sanitized, "template.liquid"),
|
|
53087
53215
|
// source (alternate)
|
|
53088
|
-
|
|
53216
|
+
path29.join(process.cwd(), "output", sanitized, "template.liquid"),
|
|
53089
53217
|
// fallback: cwd/output/
|
|
53090
|
-
|
|
53218
|
+
path29.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
|
|
@@ -56171,12 +56299,12 @@ var ndjson_sink_exports = {};
|
|
|
56171
56299
|
__export(ndjson_sink_exports, {
|
|
56172
56300
|
NdjsonSink: () => NdjsonSink
|
|
56173
56301
|
});
|
|
56174
|
-
var import_fs9,
|
|
56302
|
+
var import_fs9, import_path14, NdjsonSink;
|
|
56175
56303
|
var init_ndjson_sink = __esm({
|
|
56176
56304
|
"src/frontends/ndjson-sink.ts"() {
|
|
56177
56305
|
"use strict";
|
|
56178
56306
|
import_fs9 = __toESM(require("fs"));
|
|
56179
|
-
|
|
56307
|
+
import_path14 = __toESM(require("path"));
|
|
56180
56308
|
NdjsonSink = class {
|
|
56181
56309
|
name = "ndjson-sink";
|
|
56182
56310
|
cfg;
|
|
@@ -56208,8 +56336,8 @@ var init_ndjson_sink = __esm({
|
|
|
56208
56336
|
this.unsub = void 0;
|
|
56209
56337
|
}
|
|
56210
56338
|
resolveFile(p) {
|
|
56211
|
-
if (
|
|
56212
|
-
return
|
|
56339
|
+
if (import_path14.default.isAbsolute(p)) return p;
|
|
56340
|
+
return import_path14.default.join(process.cwd(), p);
|
|
56213
56341
|
}
|
|
56214
56342
|
};
|
|
56215
56343
|
}
|
|
@@ -58845,13 +58973,13 @@ function taskRowToAgentTask(row) {
|
|
|
58845
58973
|
workflow_id: row.workflow_id ?? void 0
|
|
58846
58974
|
};
|
|
58847
58975
|
}
|
|
58848
|
-
var
|
|
58976
|
+
var import_path15, import_fs10, import_crypto6, SqliteTaskStore;
|
|
58849
58977
|
var init_task_store = __esm({
|
|
58850
58978
|
"src/agent-protocol/task-store.ts"() {
|
|
58851
58979
|
"use strict";
|
|
58852
|
-
|
|
58980
|
+
import_path15 = __toESM(require("path"));
|
|
58853
58981
|
import_fs10 = __toESM(require("fs"));
|
|
58854
|
-
|
|
58982
|
+
import_crypto6 = __toESM(require("crypto"));
|
|
58855
58983
|
init_logger();
|
|
58856
58984
|
init_types();
|
|
58857
58985
|
init_state_transitions();
|
|
@@ -58862,8 +58990,8 @@ var init_task_store = __esm({
|
|
|
58862
58990
|
this.dbPath = filename || ".visor/agent-tasks.db";
|
|
58863
58991
|
}
|
|
58864
58992
|
async initialize() {
|
|
58865
|
-
const resolvedPath =
|
|
58866
|
-
const dir =
|
|
58993
|
+
const resolvedPath = import_path15.default.resolve(process.cwd(), this.dbPath);
|
|
58994
|
+
const dir = import_path15.default.dirname(resolvedPath);
|
|
58867
58995
|
import_fs10.default.mkdirSync(dir, { recursive: true });
|
|
58868
58996
|
const { createRequire } = require("module");
|
|
58869
58997
|
const runtimeRequire = createRequire(__filename);
|
|
@@ -58932,7 +59060,7 @@ var init_task_store = __esm({
|
|
|
58932
59060
|
// -------------------------------------------------------------------------
|
|
58933
59061
|
createTask(params) {
|
|
58934
59062
|
const db = this.getDb();
|
|
58935
|
-
const id =
|
|
59063
|
+
const id = import_crypto6.default.randomUUID();
|
|
58936
59064
|
const now = nowISO();
|
|
58937
59065
|
const contextId = this.resolveContextId(params.requestMessage, params.contextId);
|
|
58938
59066
|
const expiresAt = params.expiresAt ?? null;
|
|
@@ -59019,6 +59147,13 @@ var init_task_store = __esm({
|
|
|
59019
59147
|
messageText = textPart?.text ?? "";
|
|
59020
59148
|
} catch {
|
|
59021
59149
|
}
|
|
59150
|
+
let source = "-";
|
|
59151
|
+
let metadata = {};
|
|
59152
|
+
try {
|
|
59153
|
+
metadata = JSON.parse(r.request_metadata || "{}");
|
|
59154
|
+
source = metadata.source || "-";
|
|
59155
|
+
} catch {
|
|
59156
|
+
}
|
|
59022
59157
|
return {
|
|
59023
59158
|
id: r.id,
|
|
59024
59159
|
context_id: r.context_id,
|
|
@@ -59029,7 +59164,9 @@ var init_task_store = __esm({
|
|
|
59029
59164
|
claimed_at: r.claimed_at,
|
|
59030
59165
|
workflow_id: r.workflow_id,
|
|
59031
59166
|
run_id: r.run_id,
|
|
59032
|
-
request_message: messageText
|
|
59167
|
+
request_message: messageText,
|
|
59168
|
+
source,
|
|
59169
|
+
metadata
|
|
59033
59170
|
};
|
|
59034
59171
|
});
|
|
59035
59172
|
return { rows, total };
|
|
@@ -59049,6 +59186,13 @@ var init_task_store = __esm({
|
|
|
59049
59186
|
WHERE id = ?`
|
|
59050
59187
|
).run(newState, now, statusMessage ? JSON.stringify(statusMessage) : null, taskId);
|
|
59051
59188
|
}
|
|
59189
|
+
claimTask(taskId, workerId) {
|
|
59190
|
+
const db = this.getDb();
|
|
59191
|
+
const now = nowISO();
|
|
59192
|
+
db.prepare(
|
|
59193
|
+
`UPDATE agent_tasks SET claimed_by = ?, claimed_at = ?, updated_at = ? WHERE id = ?`
|
|
59194
|
+
).run(workerId, now, now, taskId);
|
|
59195
|
+
}
|
|
59052
59196
|
addArtifact(taskId, artifact) {
|
|
59053
59197
|
const db = this.getDb();
|
|
59054
59198
|
const row = db.prepare("SELECT artifacts FROM agent_tasks WHERE id = ?").get(taskId);
|
|
@@ -59270,11 +59414,11 @@ var init_task_stream_manager = __esm({
|
|
|
59270
59414
|
});
|
|
59271
59415
|
|
|
59272
59416
|
// src/agent-protocol/push-notification-manager.ts
|
|
59273
|
-
var
|
|
59417
|
+
var import_crypto7, PushNotificationManager;
|
|
59274
59418
|
var init_push_notification_manager = __esm({
|
|
59275
59419
|
"src/agent-protocol/push-notification-manager.ts"() {
|
|
59276
59420
|
"use strict";
|
|
59277
|
-
|
|
59421
|
+
import_crypto7 = __toESM(require("crypto"));
|
|
59278
59422
|
init_logger();
|
|
59279
59423
|
PushNotificationManager = class {
|
|
59280
59424
|
db = null;
|
|
@@ -59319,7 +59463,7 @@ var init_push_notification_manager = __esm({
|
|
|
59319
59463
|
// -------------------------------------------------------------------------
|
|
59320
59464
|
create(config) {
|
|
59321
59465
|
const db = this.getDb();
|
|
59322
|
-
const id = config.id ??
|
|
59466
|
+
const id = config.id ?? import_crypto7.default.randomUUID();
|
|
59323
59467
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
59324
59468
|
db.prepare(
|
|
59325
59469
|
`INSERT INTO agent_push_configs (id, task_id, url, token, auth_scheme, auth_credentials, created_at)
|
|
@@ -59417,11 +59561,11 @@ var init_push_notification_manager = __esm({
|
|
|
59417
59561
|
});
|
|
59418
59562
|
|
|
59419
59563
|
// src/agent-protocol/task-queue.ts
|
|
59420
|
-
var
|
|
59564
|
+
var import_crypto8, DEFAULT_CONFIG, TaskQueue;
|
|
59421
59565
|
var init_task_queue = __esm({
|
|
59422
59566
|
"src/agent-protocol/task-queue.ts"() {
|
|
59423
59567
|
"use strict";
|
|
59424
|
-
|
|
59568
|
+
import_crypto8 = __toESM(require("crypto"));
|
|
59425
59569
|
init_logger();
|
|
59426
59570
|
init_trace_helpers();
|
|
59427
59571
|
DEFAULT_CONFIG = {
|
|
@@ -59434,7 +59578,7 @@ var init_task_queue = __esm({
|
|
|
59434
59578
|
this.taskStore = taskStore;
|
|
59435
59579
|
this.executor = executor;
|
|
59436
59580
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
59437
|
-
this.workerId = workerId ??
|
|
59581
|
+
this.workerId = workerId ?? import_crypto8.default.randomUUID();
|
|
59438
59582
|
}
|
|
59439
59583
|
running = false;
|
|
59440
59584
|
timer = null;
|
|
@@ -59508,7 +59652,7 @@ var init_task_queue = __esm({
|
|
|
59508
59652
|
}
|
|
59509
59653
|
if (result.success) {
|
|
59510
59654
|
const completedMsg = {
|
|
59511
|
-
message_id:
|
|
59655
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
59512
59656
|
role: "agent",
|
|
59513
59657
|
parts: [
|
|
59514
59658
|
{
|
|
@@ -59520,7 +59664,7 @@ var init_task_queue = __esm({
|
|
|
59520
59664
|
this.taskStore.updateTaskState(task.id, "completed", completedMsg);
|
|
59521
59665
|
} else {
|
|
59522
59666
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
59523
|
-
message_id:
|
|
59667
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
59524
59668
|
role: "agent",
|
|
59525
59669
|
parts: [{ text: result.error ?? "Task execution failed" }]
|
|
59526
59670
|
});
|
|
@@ -59531,7 +59675,7 @@ var init_task_queue = __esm({
|
|
|
59531
59675
|
);
|
|
59532
59676
|
try {
|
|
59533
59677
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
59534
|
-
message_id:
|
|
59678
|
+
message_id: import_crypto8.default.randomUUID(),
|
|
59535
59679
|
role: "agent",
|
|
59536
59680
|
parts: [{ text: err instanceof Error ? err.message : "Unknown error" }]
|
|
59537
59681
|
});
|
|
@@ -59585,7 +59729,7 @@ function timingSafeEqual(a, b) {
|
|
|
59585
59729
|
if (!a || !b) return false;
|
|
59586
59730
|
if (a.length !== b.length) return false;
|
|
59587
59731
|
try {
|
|
59588
|
-
return
|
|
59732
|
+
return import_crypto9.default.timingSafeEqual(Buffer.from(a), Buffer.from(b));
|
|
59589
59733
|
} catch {
|
|
59590
59734
|
return false;
|
|
59591
59735
|
}
|
|
@@ -59659,7 +59803,7 @@ function resultToArtifacts(checkResults) {
|
|
|
59659
59803
|
}
|
|
59660
59804
|
if (parts.length > 0) {
|
|
59661
59805
|
artifacts.push({
|
|
59662
|
-
artifact_id:
|
|
59806
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
59663
59807
|
name: checkId,
|
|
59664
59808
|
description: `Output from check: ${checkId}`,
|
|
59665
59809
|
parts
|
|
@@ -59668,14 +59812,14 @@ function resultToArtifacts(checkResults) {
|
|
|
59668
59812
|
}
|
|
59669
59813
|
return artifacts;
|
|
59670
59814
|
}
|
|
59671
|
-
var import_http2, import_https, import_fs11,
|
|
59815
|
+
var import_http2, import_https, import_fs11, import_crypto9, A2AFrontend;
|
|
59672
59816
|
var init_a2a_frontend = __esm({
|
|
59673
59817
|
"src/agent-protocol/a2a-frontend.ts"() {
|
|
59674
59818
|
"use strict";
|
|
59675
59819
|
import_http2 = __toESM(require("http"));
|
|
59676
59820
|
import_https = __toESM(require("https"));
|
|
59677
59821
|
import_fs11 = __toESM(require("fs"));
|
|
59678
|
-
|
|
59822
|
+
import_crypto9 = __toESM(require("crypto"));
|
|
59679
59823
|
init_logger();
|
|
59680
59824
|
init_task_store();
|
|
59681
59825
|
init_types();
|
|
@@ -59769,7 +59913,7 @@ var init_a2a_frontend = __esm({
|
|
|
59769
59913
|
if (!taskId) return;
|
|
59770
59914
|
try {
|
|
59771
59915
|
const statusMessage = {
|
|
59772
|
-
message_id:
|
|
59916
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
59773
59917
|
role: "agent",
|
|
59774
59918
|
parts: [{ text: envelope.payload?.prompt ?? "Agent requires input" }]
|
|
59775
59919
|
};
|
|
@@ -59941,7 +60085,7 @@ var init_a2a_frontend = __esm({
|
|
|
59941
60085
|
const response = await this.handleFollowUpMessage(existingTaskId, body);
|
|
59942
60086
|
return sendJson(res, 200, response);
|
|
59943
60087
|
}
|
|
59944
|
-
const contextId = body.message.context_id ??
|
|
60088
|
+
const contextId = body.message.context_id ?? import_crypto9.default.randomUUID();
|
|
59945
60089
|
const workflowId = resolveWorkflow(body, this.config);
|
|
59946
60090
|
const blocking = body.configuration?.blocking ?? false;
|
|
59947
60091
|
await withActiveSpan(
|
|
@@ -60054,7 +60198,7 @@ var init_a2a_frontend = __esm({
|
|
|
60054
60198
|
if (!body.message?.parts?.length) {
|
|
60055
60199
|
throw new InvalidRequestError("Message must contain at least one part");
|
|
60056
60200
|
}
|
|
60057
|
-
const contextId = body.message.context_id ??
|
|
60201
|
+
const contextId = body.message.context_id ?? import_crypto9.default.randomUUID();
|
|
60058
60202
|
const workflowId = resolveWorkflow(body, this.config);
|
|
60059
60203
|
const task = this.taskStore.createTask({
|
|
60060
60204
|
contextId,
|
|
@@ -60188,7 +60332,7 @@ var init_a2a_frontend = __esm({
|
|
|
60188
60332
|
await this.executeTaskViaEngine(task, message);
|
|
60189
60333
|
} else {
|
|
60190
60334
|
const agentResponse = {
|
|
60191
|
-
message_id:
|
|
60335
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
60192
60336
|
role: "agent",
|
|
60193
60337
|
parts: [{ text: `Task ${task.id} received and processed.`, media_type: "text/markdown" }]
|
|
60194
60338
|
};
|
|
@@ -60200,7 +60344,7 @@ var init_a2a_frontend = __esm({
|
|
|
60200
60344
|
logger.error(`[A2A] Task ${task.id} execution failed: ${errorMsg}`);
|
|
60201
60345
|
try {
|
|
60202
60346
|
const failMessage = {
|
|
60203
|
-
message_id:
|
|
60347
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
60204
60348
|
role: "agent",
|
|
60205
60349
|
parts: [{ text: errorMsg }]
|
|
60206
60350
|
};
|
|
@@ -60243,7 +60387,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
60243
60387
|
}
|
|
60244
60388
|
if (summaryParts.length > 0) {
|
|
60245
60389
|
artifacts.push({
|
|
60246
|
-
artifact_id:
|
|
60390
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
60247
60391
|
name: "review-summary",
|
|
60248
60392
|
description: "Review summary with issues found",
|
|
60249
60393
|
parts: summaryParts
|
|
@@ -60263,7 +60407,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
60263
60407
|
}
|
|
60264
60408
|
if (parts.length > 0) {
|
|
60265
60409
|
artifacts.push({
|
|
60266
|
-
artifact_id:
|
|
60410
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
60267
60411
|
name: cr.checkName ?? groupName,
|
|
60268
60412
|
description: `Output from check: ${cr.checkName ?? groupName}`,
|
|
60269
60413
|
parts
|
|
@@ -60274,7 +60418,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
60274
60418
|
}
|
|
60275
60419
|
if (artifacts.length === 0) {
|
|
60276
60420
|
artifacts.push({
|
|
60277
|
-
artifact_id:
|
|
60421
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
60278
60422
|
name: "result",
|
|
60279
60423
|
description: "Execution result",
|
|
60280
60424
|
parts: [
|
|
@@ -60296,7 +60440,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
60296
60440
|
);
|
|
60297
60441
|
}
|
|
60298
60442
|
const agentResponse = {
|
|
60299
|
-
message_id:
|
|
60443
|
+
message_id: import_crypto9.default.randomUUID(),
|
|
60300
60444
|
role: "agent",
|
|
60301
60445
|
parts: [
|
|
60302
60446
|
{
|
|
@@ -60349,7 +60493,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
60349
60493
|
}
|
|
60350
60494
|
if (parts.length === 0) return null;
|
|
60351
60495
|
return {
|
|
60352
|
-
artifact_id:
|
|
60496
|
+
artifact_id: import_crypto9.default.randomUUID(),
|
|
60353
60497
|
name: p.checkId ?? "check-result",
|
|
60354
60498
|
parts
|
|
60355
60499
|
};
|
|
@@ -60535,14 +60679,14 @@ function serializeRunState(state) {
|
|
|
60535
60679
|
])
|
|
60536
60680
|
};
|
|
60537
60681
|
}
|
|
60538
|
-
var
|
|
60682
|
+
var path28, fs24, StateMachineExecutionEngine;
|
|
60539
60683
|
var init_state_machine_execution_engine = __esm({
|
|
60540
60684
|
"src/state-machine-execution-engine.ts"() {
|
|
60541
60685
|
"use strict";
|
|
60542
60686
|
init_runner();
|
|
60543
60687
|
init_logger();
|
|
60544
60688
|
init_sandbox_manager();
|
|
60545
|
-
|
|
60689
|
+
path28 = __toESM(require("path"));
|
|
60546
60690
|
fs24 = __toESM(require("fs"));
|
|
60547
60691
|
StateMachineExecutionEngine = class _StateMachineExecutionEngine {
|
|
60548
60692
|
workingDirectory;
|
|
@@ -60930,9 +61074,9 @@ var init_state_machine_execution_engine = __esm({
|
|
|
60930
61074
|
}
|
|
60931
61075
|
const checkId = String(ev?.checkId || "unknown");
|
|
60932
61076
|
const threadKey = ev?.threadKey || (channel && threadTs ? `${channel}:${threadTs}` : "session");
|
|
60933
|
-
const baseDir = process.env.VISOR_SNAPSHOT_DIR ||
|
|
61077
|
+
const baseDir = process.env.VISOR_SNAPSHOT_DIR || path28.resolve(process.cwd(), ".visor", "snapshots");
|
|
60934
61078
|
fs24.mkdirSync(baseDir, { recursive: true });
|
|
60935
|
-
const filePath =
|
|
61079
|
+
const filePath = path28.join(baseDir, `${threadKey}-${checkId}.json`);
|
|
60936
61080
|
await this.saveSnapshotToFile(filePath);
|
|
60937
61081
|
logger.info(`[Snapshot] Saved run snapshot: ${filePath}`);
|
|
60938
61082
|
try {
|