@probelabs/visor 0.1.146 → 0.1.147-ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/github-auth.d.ts +40 -0
- package/dist/github-auth.d.ts.map +1 -1
- package/dist/index.js +2437 -350
- package/dist/sandbox/bubblewrap-sandbox.d.ts +2 -1
- package/dist/sandbox/bubblewrap-sandbox.d.ts.map +1 -1
- package/dist/sandbox/seatbelt-sandbox.d.ts +2 -1
- package/dist/sandbox/seatbelt-sandbox.d.ts.map +1 -1
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/sdk/{check-provider-registry-TSAMMJ7Q.mjs → check-provider-registry-LBYIKFYM.mjs} +7 -7
- package/dist/sdk/{check-provider-registry-WSFL2SVQ.mjs → check-provider-registry-SCPM6DIT.mjs} +7 -7
- package/dist/sdk/{chunk-OM3WYVFI.mjs → chunk-4F5UVWAN.mjs} +2 -2
- package/dist/sdk/{chunk-OM3WYVFI.mjs.map → chunk-4F5UVWAN.mjs.map} +1 -1
- package/dist/sdk/{chunk-74YJMONB.mjs → chunk-EWGX7LI7.mjs} +69 -27
- package/dist/sdk/chunk-EWGX7LI7.mjs.map +1 -0
- package/dist/sdk/{chunk-LVOWWALU.mjs → chunk-FBJ7MC7R.mjs} +3 -3
- package/dist/sdk/{chunk-4SYQL5UQ.mjs → chunk-PNZH3JSI.mjs} +70 -28
- package/dist/sdk/chunk-PNZH3JSI.mjs.map +1 -0
- package/dist/sdk/{chunk-LSCWRTSY.mjs → chunk-V2QW6ECX.mjs} +2 -2
- package/dist/sdk/{chunk-YOKAA4IU.mjs → chunk-XNTBSV6M.mjs} +2 -7
- package/dist/sdk/{chunk-YOKAA4IU.mjs.map → chunk-XNTBSV6M.mjs.map} +1 -1
- package/dist/sdk/{config-AAB2FL22.mjs → config-G5UU4WXT.mjs} +2 -2
- package/dist/sdk/{failure-condition-evaluator-O464EJMD.mjs → failure-condition-evaluator-FHNZL2US.mjs} +3 -3
- package/dist/sdk/github-auth-UPBBBOME.mjs +196 -0
- package/dist/sdk/github-auth-UPBBBOME.mjs.map +1 -0
- package/dist/sdk/{github-frontend-4L5YDHM4.mjs → github-frontend-47EU2HBY.mjs} +3 -3
- package/dist/sdk/{host-5BJ25CUZ.mjs → host-GVR4UGZ3.mjs} +2 -2
- package/dist/sdk/{host-GYZ7XCLI.mjs → host-KGN5OIAM.mjs} +2 -2
- package/dist/sdk/knex-store-HPXJILBL.mjs +411 -0
- package/dist/sdk/knex-store-HPXJILBL.mjs.map +1 -0
- package/dist/sdk/loader-YSRMVXC3.mjs +89 -0
- package/dist/sdk/loader-YSRMVXC3.mjs.map +1 -0
- package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs +655 -0
- package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs.map +1 -0
- package/dist/sdk/{routing-CQDKRPTO.mjs → routing-CZ36LVVS.mjs} +4 -4
- package/dist/sdk/{schedule-tool-handler-4YUM6Z5F.mjs → schedule-tool-handler-E7XHMU5G.mjs} +7 -7
- package/dist/sdk/{schedule-tool-handler-62K3NGH6.mjs → schedule-tool-handler-KFYNV7HL.mjs} +7 -7
- package/dist/sdk/sdk.js +1568 -273
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +6 -6
- package/dist/sdk/{trace-helpers-QQSTZGDT.mjs → trace-helpers-EHDZ42HH.mjs} +2 -2
- package/dist/sdk/validator-XTZJZZJH.mjs +134 -0
- package/dist/sdk/validator-XTZJZZJH.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-OM62QYHF.mjs → workflow-check-provider-5453TW65.mjs} +7 -7
- package/dist/sdk/{workflow-check-provider-XC7E5OFH.mjs → workflow-check-provider-BSUSPFOF.mjs} +7 -7
- package/dist/slack/socket-runner.d.ts.map +1 -1
- package/dist/test-runner/core/flow-stage.d.ts +2 -1
- package/dist/test-runner/core/flow-stage.d.ts.map +1 -1
- package/dist/test-runner/index.d.ts.map +1 -1
- package/dist/test-runner/validator.d.ts.map +1 -1
- package/dist/utils/worktree-manager.d.ts +11 -1
- package/dist/utils/worktree-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/output/traces/run-2026-02-26T07-50-40-741Z.ndjson +0 -138
- package/dist/output/traces/run-2026-02-26T07-51-32-586Z.ndjson +0 -1442
- package/dist/sdk/check-provider-registry-HK6M4PDQ.mjs +0 -30
- package/dist/sdk/chunk-4SYQL5UQ.mjs.map +0 -1
- package/dist/sdk/chunk-74YJMONB.mjs.map +0 -1
- package/dist/sdk/chunk-E6SMU2Z4.mjs +0 -40651
- package/dist/sdk/chunk-E6SMU2Z4.mjs.map +0 -1
- package/dist/sdk/chunk-I42ZCVA5.mjs +0 -1502
- package/dist/sdk/chunk-L3XPYQ6I.mjs +0 -739
- package/dist/sdk/chunk-LSCWRTSY.mjs.map +0 -1
- package/dist/sdk/chunk-LVOWWALU.mjs.map +0 -1
- package/dist/sdk/chunk-Y4DBNDLQ.mjs +0 -443
- package/dist/sdk/chunk-Y4DBNDLQ.mjs.map +0 -1
- package/dist/sdk/failure-condition-evaluator-SMOVMMES.mjs +0 -17
- package/dist/sdk/github-frontend-MSX6Q2WL.mjs +0 -1356
- package/dist/sdk/github-frontend-MSX6Q2WL.mjs.map +0 -1
- package/dist/sdk/routing-RIHVCEIU.mjs +0 -25
- package/dist/sdk/schedule-tool-handler-4O2VKNG2.mjs +0 -40
- package/dist/sdk/schedule-tool-handler-62K3NGH6.mjs.map +0 -1
- package/dist/sdk/trace-helpers-AWCFW5KG.mjs +0 -25
- package/dist/sdk/trace-helpers-AWCFW5KG.mjs.map +0 -1
- package/dist/sdk/trace-helpers-QQSTZGDT.mjs.map +0 -1
- package/dist/sdk/workflow-check-provider-3N7HDIN6.mjs +0 -30
- package/dist/sdk/workflow-check-provider-3N7HDIN6.mjs.map +0 -1
- package/dist/sdk/workflow-check-provider-OM62QYHF.mjs.map +0 -1
- package/dist/sdk/workflow-check-provider-XC7E5OFH.mjs.map +0 -1
- package/dist/traces/run-2026-02-26T07-50-40-741Z.ndjson +0 -138
- package/dist/traces/run-2026-02-26T07-51-32-586Z.ndjson +0 -1442
- /package/dist/sdk/{check-provider-registry-HK6M4PDQ.mjs.map → check-provider-registry-LBYIKFYM.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-TSAMMJ7Q.mjs.map → check-provider-registry-SCPM6DIT.mjs.map} +0 -0
- /package/dist/sdk/{chunk-I42ZCVA5.mjs.map → chunk-FBJ7MC7R.mjs.map} +0 -0
- /package/dist/sdk/{chunk-L3XPYQ6I.mjs.map → chunk-V2QW6ECX.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-WSFL2SVQ.mjs.map → config-G5UU4WXT.mjs.map} +0 -0
- /package/dist/sdk/{config-AAB2FL22.mjs.map → failure-condition-evaluator-FHNZL2US.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-4L5YDHM4.mjs.map → github-frontend-47EU2HBY.mjs.map} +0 -0
- /package/dist/sdk/{host-5BJ25CUZ.mjs.map → host-GVR4UGZ3.mjs.map} +0 -0
- /package/dist/sdk/{host-GYZ7XCLI.mjs.map → host-KGN5OIAM.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-O464EJMD.mjs.map → routing-CZ36LVVS.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-SMOVMMES.mjs.map → schedule-tool-handler-E7XHMU5G.mjs.map} +0 -0
- /package/dist/sdk/{routing-CQDKRPTO.mjs.map → schedule-tool-handler-KFYNV7HL.mjs.map} +0 -0
- /package/dist/sdk/{routing-RIHVCEIU.mjs.map → trace-helpers-EHDZ42HH.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-4O2VKNG2.mjs.map → workflow-check-provider-5453TW65.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-4YUM6Z5F.mjs.map → workflow-check-provider-BSUSPFOF.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
process.env.VISOR_VERSION = '0.1.
|
|
3
|
-
process.env.PROBE_VERSION = '0.6.0-
|
|
4
|
-
process.env.VISOR_COMMIT_SHA = '
|
|
5
|
-
process.env.VISOR_COMMIT_SHORT = '
|
|
2
|
+
process.env.VISOR_VERSION = '0.1.147';
|
|
3
|
+
process.env.PROBE_VERSION = '0.6.0-rc262';
|
|
4
|
+
process.env.VISOR_COMMIT_SHA = '986bd9df126dcf4c0564d12701994e4bad407897';
|
|
5
|
+
process.env.VISOR_COMMIT_SHORT = '986bd9d';
|
|
6
6
|
/******/ (() => { // webpackBootstrap
|
|
7
7
|
/******/ var __webpack_modules__ = ({
|
|
8
8
|
|
|
@@ -160001,6 +160001,7 @@ ${'='.repeat(60)}
|
|
|
160001
160001
|
if (!systemPrompt && schema !== 'code-review') {
|
|
160002
160002
|
systemPrompt = 'You are general assistant, follow user instructions.';
|
|
160003
160003
|
}
|
|
160004
|
+
log(`🔧 AIReviewService config: allowEdit=${this.config.allowEdit}, allowBash=${this.config.allowBash}, promptType=${this.config.promptType}`);
|
|
160004
160005
|
const options = {
|
|
160005
160006
|
sessionId: sessionId,
|
|
160006
160007
|
// Prefer config promptType, then env override, else fallback to code-review when schema is set
|
|
@@ -160011,7 +160012,7 @@ ${'='.repeat(60)}
|
|
|
160011
160012
|
: schema === 'code-review'
|
|
160012
160013
|
? 'code-review-template'
|
|
160013
160014
|
: undefined,
|
|
160014
|
-
allowEdit: false, //
|
|
160015
|
+
allowEdit: false, // Default: don't allow file modifications
|
|
160015
160016
|
debug: this.config.debug || false,
|
|
160016
160017
|
// Use systemPrompt (native in rc168+) with fallback to customPrompt for backward compat
|
|
160017
160018
|
systemPrompt: systemPrompt || this.config.systemPrompt || this.config.customPrompt,
|
|
@@ -160059,6 +160060,7 @@ ${'='.repeat(60)}
|
|
|
160059
160060
|
options.fallback = this.config.fallback;
|
|
160060
160061
|
}
|
|
160061
160062
|
// Enable Edit and Create tools if configured
|
|
160063
|
+
// Enable Edit and Create tools if configured
|
|
160062
160064
|
if (this.config.allowEdit !== undefined) {
|
|
160063
160065
|
options.allowEdit = this.config.allowEdit;
|
|
160064
160066
|
}
|
|
@@ -160134,6 +160136,7 @@ ${'='.repeat(60)}
|
|
|
160134
160136
|
if (this.config.model) {
|
|
160135
160137
|
options.model = this.config.model;
|
|
160136
160138
|
}
|
|
160139
|
+
log(`🔧 ProbeAgent options: allowEdit=${options.allowEdit}, enableBash=${options.enableBash}, promptType=${options.promptType}`);
|
|
160137
160140
|
const agent = new probe_1.ProbeAgent(options);
|
|
160138
160141
|
// Initialize agent to enable CLI fallback detection (claude-code/codex)
|
|
160139
160142
|
// This must be called before agent.answer() for auto-fallback to work.
|
|
@@ -161190,7 +161193,7 @@ async function handleDumpPolicyInput(checkId, argv) {
|
|
|
161190
161193
|
let PolicyInputBuilder;
|
|
161191
161194
|
try {
|
|
161192
161195
|
// @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
|
|
161193
|
-
const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(
|
|
161196
|
+
const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(17117)));
|
|
161194
161197
|
PolicyInputBuilder = mod.PolicyInputBuilder;
|
|
161195
161198
|
}
|
|
161196
161199
|
catch {
|
|
@@ -161380,6 +161383,15 @@ async function handleTestCommand(argv) {
|
|
|
161380
161383
|
// Respect --debug flag if present, or VISOR_DEBUG from environment
|
|
161381
161384
|
const debugFlag = hasFlag('--debug') || process.env.VISOR_DEBUG === 'true';
|
|
161382
161385
|
(0, logger_1.configureLoggerFromCli)({ output: 'table', debug: debugFlag, verbose: false, quiet: false });
|
|
161386
|
+
// Initialize telemetry for test runs (auto-enabled in --no-mocks mode)
|
|
161387
|
+
const telemetryEnabled = noMocks || process.env.VISOR_TELEMETRY_ENABLED === 'true';
|
|
161388
|
+
if (telemetryEnabled) {
|
|
161389
|
+
await (0, opentelemetry_1.initTelemetry)({
|
|
161390
|
+
enabled: true,
|
|
161391
|
+
sink: process.env.VISOR_TELEMETRY_SINK || 'file',
|
|
161392
|
+
file: { dir: process.env.VISOR_TRACE_DIR },
|
|
161393
|
+
});
|
|
161394
|
+
}
|
|
161383
161395
|
console.log('🧪 Visor Test Runner');
|
|
161384
161396
|
try {
|
|
161385
161397
|
const { discoverAndPrint, validateTestsOnly, VisorTestRunner, discoverSuites, runSuites } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(41585)));
|
|
@@ -161658,9 +161670,21 @@ async function handleTestCommand(argv) {
|
|
|
161658
161670
|
}
|
|
161659
161671
|
}
|
|
161660
161672
|
catch { }
|
|
161673
|
+
if (telemetryEnabled) {
|
|
161674
|
+
try {
|
|
161675
|
+
await (0, opentelemetry_1.shutdownTelemetry)();
|
|
161676
|
+
}
|
|
161677
|
+
catch { }
|
|
161678
|
+
}
|
|
161661
161679
|
process.exit(failures > 0 ? 1 : 0);
|
|
161662
161680
|
}
|
|
161663
161681
|
catch (err) {
|
|
161682
|
+
if (telemetryEnabled) {
|
|
161683
|
+
try {
|
|
161684
|
+
await (0, opentelemetry_1.shutdownTelemetry)();
|
|
161685
|
+
}
|
|
161686
|
+
catch { }
|
|
161687
|
+
}
|
|
161664
161688
|
console.error('❌ test: ' + (err instanceof Error ? err.message : String(err)));
|
|
161665
161689
|
process.exit(1);
|
|
161666
161690
|
}
|
|
@@ -161905,6 +161929,11 @@ async function main() {
|
|
|
161905
161929
|
if (authResult) {
|
|
161906
161930
|
// Inject token + git credentials into process.env for child processes
|
|
161907
161931
|
(0, github_auth_1.injectGitHubCredentials)(authResult.token);
|
|
161932
|
+
// Mark as fresh so long-running modes (Slack, scheduler) don't regenerate immediately
|
|
161933
|
+
if (authResult.authType === 'github-app') {
|
|
161934
|
+
const { markTokenFresh } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
161935
|
+
markTokenFresh();
|
|
161936
|
+
}
|
|
161908
161937
|
// Set Octokit on execution context for in-process API calls
|
|
161909
161938
|
executionContext.octokit = authResult.octokit;
|
|
161910
161939
|
logger_1.logger.info(`🔑 GitHub auth: ${authResult.authType}`);
|
|
@@ -164046,17 +164075,11 @@ class ConfigManager {
|
|
|
164046
164075
|
const { WorkflowRegistry } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(82824)));
|
|
164047
164076
|
const registry = WorkflowRegistry.getInstance();
|
|
164048
164077
|
// Import workflow files
|
|
164078
|
+
// Use override: true so config reloads pick up changes to workflow definitions
|
|
164049
164079
|
for (const source of config.imports) {
|
|
164050
|
-
const results = await registry.import(source, { basePath, validate: true });
|
|
164080
|
+
const results = await registry.import(source, { basePath, validate: true, override: true });
|
|
164051
164081
|
for (const result of results) {
|
|
164052
164082
|
if (!result.valid && result.errors) {
|
|
164053
|
-
// Check if error is just "already exists" - skip silently
|
|
164054
|
-
// This allows multiple workflows to import the same dependency
|
|
164055
|
-
const isAlreadyExists = result.errors.every(e => e.message.includes('already exists'));
|
|
164056
|
-
if (isAlreadyExists) {
|
|
164057
|
-
logger_1.logger.debug(`Workflow from '${source}' already imported, skipping`);
|
|
164058
|
-
continue;
|
|
164059
|
-
}
|
|
164060
164083
|
const errors = result.errors.map(e => ` ${e.path}: ${e.message}`).join('\n');
|
|
164061
164084
|
throw new Error(`Failed to import workflow from '${source}':\n${errors}`);
|
|
164062
164085
|
}
|
|
@@ -167012,6 +167035,1690 @@ class DependencyResolver {
|
|
|
167012
167035
|
exports.DependencyResolver = DependencyResolver;
|
|
167013
167036
|
|
|
167014
167037
|
|
|
167038
|
+
/***/ }),
|
|
167039
|
+
|
|
167040
|
+
/***/ 50069:
|
|
167041
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
167042
|
+
|
|
167043
|
+
"use strict";
|
|
167044
|
+
|
|
167045
|
+
/**
|
|
167046
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167047
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167048
|
+
* in compliance with the Elastic License 2.0.
|
|
167049
|
+
*/
|
|
167050
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
167051
|
+
if (k2 === undefined) k2 = k;
|
|
167052
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
167053
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
167054
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
167055
|
+
}
|
|
167056
|
+
Object.defineProperty(o, k2, desc);
|
|
167057
|
+
}) : (function(o, m, k, k2) {
|
|
167058
|
+
if (k2 === undefined) k2 = k;
|
|
167059
|
+
o[k2] = m[k];
|
|
167060
|
+
}));
|
|
167061
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
167062
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
167063
|
+
}) : function(o, v) {
|
|
167064
|
+
o["default"] = v;
|
|
167065
|
+
});
|
|
167066
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
167067
|
+
var ownKeys = function(o) {
|
|
167068
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
167069
|
+
var ar = [];
|
|
167070
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
167071
|
+
return ar;
|
|
167072
|
+
};
|
|
167073
|
+
return ownKeys(o);
|
|
167074
|
+
};
|
|
167075
|
+
return function (mod) {
|
|
167076
|
+
if (mod && mod.__esModule) return mod;
|
|
167077
|
+
var result = {};
|
|
167078
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
167079
|
+
__setModuleDefault(result, mod);
|
|
167080
|
+
return result;
|
|
167081
|
+
};
|
|
167082
|
+
})();
|
|
167083
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167084
|
+
exports.LicenseValidator = void 0;
|
|
167085
|
+
const crypto = __importStar(__nccwpck_require__(76982));
|
|
167086
|
+
const fs = __importStar(__nccwpck_require__(79896));
|
|
167087
|
+
const path = __importStar(__nccwpck_require__(16928));
|
|
167088
|
+
class LicenseValidator {
|
|
167089
|
+
/** Ed25519 public key for license verification (PEM format). */
|
|
167090
|
+
static PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
|
|
167091
|
+
'MCowBQYDK2VwAyEAI/Zd08EFmgIdrDm/HXd0l3/5GBt7R1PrdvhdmEXhJlU=\n' +
|
|
167092
|
+
'-----END PUBLIC KEY-----\n';
|
|
167093
|
+
cache = null;
|
|
167094
|
+
static CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
|
167095
|
+
static GRACE_PERIOD = 72 * 3600 * 1000; // 72 hours after expiry
|
|
167096
|
+
/**
|
|
167097
|
+
* Load and validate license from environment or file.
|
|
167098
|
+
*
|
|
167099
|
+
* Resolution order:
|
|
167100
|
+
* 1. VISOR_LICENSE env var (JWT string)
|
|
167101
|
+
* 2. VISOR_LICENSE_FILE env var (path to file)
|
|
167102
|
+
* 3. .visor-license in project root (cwd)
|
|
167103
|
+
* 4. .visor-license in ~/.config/visor/
|
|
167104
|
+
*/
|
|
167105
|
+
async loadAndValidate() {
|
|
167106
|
+
// Return cached result if still fresh
|
|
167107
|
+
if (this.cache && Date.now() - this.cache.validatedAt < LicenseValidator.CACHE_TTL) {
|
|
167108
|
+
return this.cache.payload;
|
|
167109
|
+
}
|
|
167110
|
+
const token = this.resolveToken();
|
|
167111
|
+
if (!token)
|
|
167112
|
+
return null;
|
|
167113
|
+
const payload = this.verifyAndDecode(token);
|
|
167114
|
+
if (!payload)
|
|
167115
|
+
return null;
|
|
167116
|
+
this.cache = { payload, validatedAt: Date.now() };
|
|
167117
|
+
return payload;
|
|
167118
|
+
}
|
|
167119
|
+
/** Check if a specific feature is licensed */
|
|
167120
|
+
hasFeature(feature) {
|
|
167121
|
+
if (!this.cache)
|
|
167122
|
+
return false;
|
|
167123
|
+
return this.cache.payload.features.includes(feature);
|
|
167124
|
+
}
|
|
167125
|
+
/** Check if license is valid (with grace period) */
|
|
167126
|
+
isValid() {
|
|
167127
|
+
if (!this.cache)
|
|
167128
|
+
return false;
|
|
167129
|
+
const now = Date.now();
|
|
167130
|
+
const expiryMs = this.cache.payload.exp * 1000;
|
|
167131
|
+
return now < expiryMs + LicenseValidator.GRACE_PERIOD;
|
|
167132
|
+
}
|
|
167133
|
+
/** Check if the license is within its grace period (expired but still valid) */
|
|
167134
|
+
isInGracePeriod() {
|
|
167135
|
+
if (!this.cache)
|
|
167136
|
+
return false;
|
|
167137
|
+
const now = Date.now();
|
|
167138
|
+
const expiryMs = this.cache.payload.exp * 1000;
|
|
167139
|
+
return now >= expiryMs && now < expiryMs + LicenseValidator.GRACE_PERIOD;
|
|
167140
|
+
}
|
|
167141
|
+
resolveToken() {
|
|
167142
|
+
// 1. Direct env var
|
|
167143
|
+
if (process.env.VISOR_LICENSE) {
|
|
167144
|
+
return process.env.VISOR_LICENSE.trim();
|
|
167145
|
+
}
|
|
167146
|
+
// 2. File path from env (validate against path traversal)
|
|
167147
|
+
if (process.env.VISOR_LICENSE_FILE) {
|
|
167148
|
+
// path.resolve() produces an absolute path with all '..' segments resolved,
|
|
167149
|
+
// so a separate resolved.includes('..') check is unnecessary.
|
|
167150
|
+
const resolved = path.resolve(process.env.VISOR_LICENSE_FILE);
|
|
167151
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
167152
|
+
const allowedPrefixes = [path.normalize(process.cwd())];
|
|
167153
|
+
if (home)
|
|
167154
|
+
allowedPrefixes.push(path.normalize(path.join(home, '.config', 'visor')));
|
|
167155
|
+
// Resolve symlinks so an attacker cannot create a symlink inside an
|
|
167156
|
+
// allowed prefix that points to an arbitrary file outside it.
|
|
167157
|
+
let realPath;
|
|
167158
|
+
try {
|
|
167159
|
+
realPath = fs.realpathSync(resolved);
|
|
167160
|
+
}
|
|
167161
|
+
catch {
|
|
167162
|
+
return null; // File doesn't exist or isn't accessible
|
|
167163
|
+
}
|
|
167164
|
+
const isSafe = allowedPrefixes.some(prefix => realPath === prefix || realPath.startsWith(prefix + path.sep));
|
|
167165
|
+
if (!isSafe)
|
|
167166
|
+
return null;
|
|
167167
|
+
return this.readFile(realPath);
|
|
167168
|
+
}
|
|
167169
|
+
// 3. .visor-license in cwd
|
|
167170
|
+
const cwdPath = path.join(process.cwd(), '.visor-license');
|
|
167171
|
+
const cwdToken = this.readFile(cwdPath);
|
|
167172
|
+
if (cwdToken)
|
|
167173
|
+
return cwdToken;
|
|
167174
|
+
// 4. ~/.config/visor/.visor-license
|
|
167175
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
167176
|
+
if (home) {
|
|
167177
|
+
const configPath = path.join(home, '.config', 'visor', '.visor-license');
|
|
167178
|
+
const configToken = this.readFile(configPath);
|
|
167179
|
+
if (configToken)
|
|
167180
|
+
return configToken;
|
|
167181
|
+
}
|
|
167182
|
+
return null;
|
|
167183
|
+
}
|
|
167184
|
+
readFile(filePath) {
|
|
167185
|
+
try {
|
|
167186
|
+
return fs.readFileSync(filePath, 'utf-8').trim();
|
|
167187
|
+
}
|
|
167188
|
+
catch {
|
|
167189
|
+
return null;
|
|
167190
|
+
}
|
|
167191
|
+
}
|
|
167192
|
+
verifyAndDecode(token) {
|
|
167193
|
+
try {
|
|
167194
|
+
const parts = token.split('.');
|
|
167195
|
+
if (parts.length !== 3)
|
|
167196
|
+
return null;
|
|
167197
|
+
const [headerB64, payloadB64, signatureB64] = parts;
|
|
167198
|
+
// Decode header to verify algorithm
|
|
167199
|
+
const header = JSON.parse(Buffer.from(headerB64, 'base64url').toString());
|
|
167200
|
+
if (header.alg !== 'EdDSA')
|
|
167201
|
+
return null;
|
|
167202
|
+
// Verify signature
|
|
167203
|
+
const data = `${headerB64}.${payloadB64}`;
|
|
167204
|
+
const signature = Buffer.from(signatureB64, 'base64url');
|
|
167205
|
+
const publicKey = crypto.createPublicKey(LicenseValidator.PUBLIC_KEY);
|
|
167206
|
+
// Validate that the loaded public key is actually Ed25519 (OID 1.3.101.112).
|
|
167207
|
+
// This prevents algorithm-confusion attacks if the embedded key were ever
|
|
167208
|
+
// swapped to a different type.
|
|
167209
|
+
if (publicKey.asymmetricKeyType !== 'ed25519') {
|
|
167210
|
+
return null;
|
|
167211
|
+
}
|
|
167212
|
+
// Ed25519 verification: algorithm must be null because EdDSA performs its
|
|
167213
|
+
// own internal hashing (SHA-512) — passing a digest algorithm here would
|
|
167214
|
+
// cause Node.js to throw. The key type is validated above.
|
|
167215
|
+
const isValid = crypto.verify(null, Buffer.from(data), publicKey, signature);
|
|
167216
|
+
if (!isValid)
|
|
167217
|
+
return null;
|
|
167218
|
+
// Decode payload
|
|
167219
|
+
const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString());
|
|
167220
|
+
// Validate required fields
|
|
167221
|
+
if (!payload.org ||
|
|
167222
|
+
!Array.isArray(payload.features) ||
|
|
167223
|
+
typeof payload.exp !== 'number' ||
|
|
167224
|
+
typeof payload.iat !== 'number' ||
|
|
167225
|
+
!payload.sub) {
|
|
167226
|
+
return null;
|
|
167227
|
+
}
|
|
167228
|
+
// Check expiry (with grace period)
|
|
167229
|
+
const now = Date.now();
|
|
167230
|
+
const expiryMs = payload.exp * 1000;
|
|
167231
|
+
if (now >= expiryMs + LicenseValidator.GRACE_PERIOD) {
|
|
167232
|
+
return null;
|
|
167233
|
+
}
|
|
167234
|
+
return payload;
|
|
167235
|
+
}
|
|
167236
|
+
catch {
|
|
167237
|
+
return null;
|
|
167238
|
+
}
|
|
167239
|
+
}
|
|
167240
|
+
}
|
|
167241
|
+
exports.LicenseValidator = LicenseValidator;
|
|
167242
|
+
|
|
167243
|
+
|
|
167244
|
+
/***/ }),
|
|
167245
|
+
|
|
167246
|
+
/***/ 87068:
|
|
167247
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
167248
|
+
|
|
167249
|
+
"use strict";
|
|
167250
|
+
|
|
167251
|
+
/**
|
|
167252
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167253
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167254
|
+
* in compliance with the Elastic License 2.0.
|
|
167255
|
+
*/
|
|
167256
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
167257
|
+
if (k2 === undefined) k2 = k;
|
|
167258
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
167259
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
167260
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
167261
|
+
}
|
|
167262
|
+
Object.defineProperty(o, k2, desc);
|
|
167263
|
+
}) : (function(o, m, k, k2) {
|
|
167264
|
+
if (k2 === undefined) k2 = k;
|
|
167265
|
+
o[k2] = m[k];
|
|
167266
|
+
}));
|
|
167267
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
167268
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
167269
|
+
}) : function(o, v) {
|
|
167270
|
+
o["default"] = v;
|
|
167271
|
+
});
|
|
167272
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
167273
|
+
var ownKeys = function(o) {
|
|
167274
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
167275
|
+
var ar = [];
|
|
167276
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
167277
|
+
return ar;
|
|
167278
|
+
};
|
|
167279
|
+
return ownKeys(o);
|
|
167280
|
+
};
|
|
167281
|
+
return function (mod) {
|
|
167282
|
+
if (mod && mod.__esModule) return mod;
|
|
167283
|
+
var result = {};
|
|
167284
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
167285
|
+
__setModuleDefault(result, mod);
|
|
167286
|
+
return result;
|
|
167287
|
+
};
|
|
167288
|
+
})();
|
|
167289
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167290
|
+
exports.loadEnterprisePolicyEngine = loadEnterprisePolicyEngine;
|
|
167291
|
+
exports.loadEnterpriseStoreBackend = loadEnterpriseStoreBackend;
|
|
167292
|
+
const default_engine_1 = __nccwpck_require__(93866);
|
|
167293
|
+
/**
|
|
167294
|
+
* Load the enterprise policy engine if licensed, otherwise return the default no-op engine.
|
|
167295
|
+
*
|
|
167296
|
+
* This is the sole import boundary between OSS and enterprise code. Core code
|
|
167297
|
+
* must only import from this module (via dynamic `await import()`), never from
|
|
167298
|
+
* individual enterprise submodules.
|
|
167299
|
+
*/
|
|
167300
|
+
async function loadEnterprisePolicyEngine(config) {
|
|
167301
|
+
try {
|
|
167302
|
+
const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
|
|
167303
|
+
const validator = new LicenseValidator();
|
|
167304
|
+
const license = await validator.loadAndValidate();
|
|
167305
|
+
if (!license || !validator.hasFeature('policy')) {
|
|
167306
|
+
return new default_engine_1.DefaultPolicyEngine();
|
|
167307
|
+
}
|
|
167308
|
+
if (validator.isInGracePeriod()) {
|
|
167309
|
+
// eslint-disable-next-line no-console
|
|
167310
|
+
console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
|
|
167311
|
+
'Please renew your license.');
|
|
167312
|
+
}
|
|
167313
|
+
const { OpaPolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(39530)));
|
|
167314
|
+
const engine = new OpaPolicyEngine(config);
|
|
167315
|
+
await engine.initialize(config);
|
|
167316
|
+
return engine;
|
|
167317
|
+
}
|
|
167318
|
+
catch (err) {
|
|
167319
|
+
// Enterprise code not available or initialization failed
|
|
167320
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
167321
|
+
try {
|
|
167322
|
+
const { logger } = __nccwpck_require__(86999);
|
|
167323
|
+
logger.warn(`[PolicyEngine] Enterprise policy init failed, falling back to default: ${msg}`);
|
|
167324
|
+
}
|
|
167325
|
+
catch {
|
|
167326
|
+
// silent
|
|
167327
|
+
}
|
|
167328
|
+
return new default_engine_1.DefaultPolicyEngine();
|
|
167329
|
+
}
|
|
167330
|
+
}
|
|
167331
|
+
/**
|
|
167332
|
+
* Load the enterprise schedule store backend if licensed.
|
|
167333
|
+
*
|
|
167334
|
+
* @param driver Database driver ('postgresql', 'mysql', or 'mssql')
|
|
167335
|
+
* @param storageConfig Storage configuration with connection details
|
|
167336
|
+
* @param haConfig Optional HA configuration
|
|
167337
|
+
* @throws Error if enterprise license is not available or missing 'scheduler-sql' feature
|
|
167338
|
+
*/
|
|
167339
|
+
async function loadEnterpriseStoreBackend(driver, storageConfig, haConfig) {
|
|
167340
|
+
const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
|
|
167341
|
+
const validator = new LicenseValidator();
|
|
167342
|
+
const license = await validator.loadAndValidate();
|
|
167343
|
+
if (!license || !validator.hasFeature('scheduler-sql')) {
|
|
167344
|
+
throw new Error(`The ${driver} schedule storage driver requires a Visor Enterprise license ` +
|
|
167345
|
+
`with the 'scheduler-sql' feature. Please upgrade or use driver: 'sqlite' (default).`);
|
|
167346
|
+
}
|
|
167347
|
+
if (validator.isInGracePeriod()) {
|
|
167348
|
+
// eslint-disable-next-line no-console
|
|
167349
|
+
console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
|
|
167350
|
+
'Please renew your license.');
|
|
167351
|
+
}
|
|
167352
|
+
const { KnexStoreBackend } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(63737)));
|
|
167353
|
+
return new KnexStoreBackend(driver, storageConfig, haConfig);
|
|
167354
|
+
}
|
|
167355
|
+
|
|
167356
|
+
|
|
167357
|
+
/***/ }),
|
|
167358
|
+
|
|
167359
|
+
/***/ 628:
|
|
167360
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
167361
|
+
|
|
167362
|
+
"use strict";
|
|
167363
|
+
|
|
167364
|
+
/**
|
|
167365
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167366
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167367
|
+
* in compliance with the Elastic License 2.0.
|
|
167368
|
+
*/
|
|
167369
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
167370
|
+
if (k2 === undefined) k2 = k;
|
|
167371
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
167372
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
167373
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
167374
|
+
}
|
|
167375
|
+
Object.defineProperty(o, k2, desc);
|
|
167376
|
+
}) : (function(o, m, k, k2) {
|
|
167377
|
+
if (k2 === undefined) k2 = k;
|
|
167378
|
+
o[k2] = m[k];
|
|
167379
|
+
}));
|
|
167380
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
167381
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
167382
|
+
}) : function(o, v) {
|
|
167383
|
+
o["default"] = v;
|
|
167384
|
+
});
|
|
167385
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
167386
|
+
var ownKeys = function(o) {
|
|
167387
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
167388
|
+
var ar = [];
|
|
167389
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
167390
|
+
return ar;
|
|
167391
|
+
};
|
|
167392
|
+
return ownKeys(o);
|
|
167393
|
+
};
|
|
167394
|
+
return function (mod) {
|
|
167395
|
+
if (mod && mod.__esModule) return mod;
|
|
167396
|
+
var result = {};
|
|
167397
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
167398
|
+
__setModuleDefault(result, mod);
|
|
167399
|
+
return result;
|
|
167400
|
+
};
|
|
167401
|
+
})();
|
|
167402
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167403
|
+
exports.OpaCompiler = void 0;
|
|
167404
|
+
const fs = __importStar(__nccwpck_require__(79896));
|
|
167405
|
+
const path = __importStar(__nccwpck_require__(16928));
|
|
167406
|
+
const os = __importStar(__nccwpck_require__(70857));
|
|
167407
|
+
const crypto = __importStar(__nccwpck_require__(76982));
|
|
167408
|
+
const child_process_1 = __nccwpck_require__(35317);
|
|
167409
|
+
/**
|
|
167410
|
+
* OPA Rego Compiler - compiles .rego policy files to WASM bundles using the `opa` CLI.
|
|
167411
|
+
*
|
|
167412
|
+
* Handles:
|
|
167413
|
+
* - Resolving input paths to WASM bytes (direct .wasm, directory with policy.wasm, or .rego files)
|
|
167414
|
+
* - Compiling .rego files to WASM via `opa build`
|
|
167415
|
+
* - Caching compiled bundles based on content hashes
|
|
167416
|
+
* - Extracting policy.wasm from OPA tar.gz bundles
|
|
167417
|
+
*
|
|
167418
|
+
* Requires:
|
|
167419
|
+
* - `opa` CLI on PATH (only when auto-compiling .rego files)
|
|
167420
|
+
*/
|
|
167421
|
+
class OpaCompiler {
|
|
167422
|
+
static CACHE_DIR = path.join(os.tmpdir(), 'visor-opa-cache');
|
|
167423
|
+
/**
|
|
167424
|
+
* Resolve the input paths to WASM bytes.
|
|
167425
|
+
*
|
|
167426
|
+
* Strategy:
|
|
167427
|
+
* 1. If any path is a .wasm file, read it directly
|
|
167428
|
+
* 2. If a directory contains policy.wasm, read it
|
|
167429
|
+
* 3. Otherwise, collect all .rego files and auto-compile via `opa build`
|
|
167430
|
+
*/
|
|
167431
|
+
async resolveWasmBytes(paths) {
|
|
167432
|
+
// Collect .rego files and check for existing .wasm
|
|
167433
|
+
const regoFiles = [];
|
|
167434
|
+
for (const p of paths) {
|
|
167435
|
+
const resolved = path.resolve(p);
|
|
167436
|
+
// Reject paths containing '..' after resolution (path traversal)
|
|
167437
|
+
if (path.normalize(resolved).includes('..')) {
|
|
167438
|
+
throw new Error(`Policy path contains traversal sequences: ${p}`);
|
|
167439
|
+
}
|
|
167440
|
+
// Direct .wasm file
|
|
167441
|
+
if (resolved.endsWith('.wasm') && fs.existsSync(resolved)) {
|
|
167442
|
+
return fs.readFileSync(resolved);
|
|
167443
|
+
}
|
|
167444
|
+
if (!fs.existsSync(resolved))
|
|
167445
|
+
continue;
|
|
167446
|
+
const stat = fs.statSync(resolved);
|
|
167447
|
+
if (stat.isDirectory()) {
|
|
167448
|
+
// Check for pre-compiled policy.wasm in directory
|
|
167449
|
+
const wasmCandidate = path.join(resolved, 'policy.wasm');
|
|
167450
|
+
if (fs.existsSync(wasmCandidate)) {
|
|
167451
|
+
return fs.readFileSync(wasmCandidate);
|
|
167452
|
+
}
|
|
167453
|
+
// Collect all .rego files from directory
|
|
167454
|
+
const files = fs.readdirSync(resolved);
|
|
167455
|
+
for (const f of files) {
|
|
167456
|
+
if (f.endsWith('.rego')) {
|
|
167457
|
+
regoFiles.push(path.join(resolved, f));
|
|
167458
|
+
}
|
|
167459
|
+
}
|
|
167460
|
+
}
|
|
167461
|
+
else if (resolved.endsWith('.rego')) {
|
|
167462
|
+
regoFiles.push(resolved);
|
|
167463
|
+
}
|
|
167464
|
+
}
|
|
167465
|
+
if (regoFiles.length === 0) {
|
|
167466
|
+
throw new Error(`OPA WASM evaluator: no .wasm bundle or .rego files found in: ${paths.join(', ')}`);
|
|
167467
|
+
}
|
|
167468
|
+
// Auto-compile .rego -> .wasm
|
|
167469
|
+
return this.compileRego(regoFiles);
|
|
167470
|
+
}
|
|
167471
|
+
/**
|
|
167472
|
+
* Auto-compile .rego files to a WASM bundle using the `opa` CLI.
|
|
167473
|
+
*
|
|
167474
|
+
* Caches the compiled bundle based on a content hash of all input .rego files
|
|
167475
|
+
* so subsequent runs skip compilation if policies haven't changed.
|
|
167476
|
+
*/
|
|
167477
|
+
compileRego(regoFiles) {
|
|
167478
|
+
// Check that `opa` CLI is available
|
|
167479
|
+
try {
|
|
167480
|
+
(0, child_process_1.execFileSync)('opa', ['version'], { stdio: 'pipe' });
|
|
167481
|
+
}
|
|
167482
|
+
catch {
|
|
167483
|
+
throw new Error('OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\n' +
|
|
167484
|
+
'Or pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz ' +
|
|
167485
|
+
regoFiles.join(' '));
|
|
167486
|
+
}
|
|
167487
|
+
// Compute content hash for cache key
|
|
167488
|
+
const hash = crypto.createHash('sha256');
|
|
167489
|
+
for (const f of regoFiles.sort()) {
|
|
167490
|
+
hash.update(fs.readFileSync(f));
|
|
167491
|
+
hash.update(f); // include filename for disambiguation
|
|
167492
|
+
}
|
|
167493
|
+
const cacheKey = hash.digest('hex').slice(0, 16);
|
|
167494
|
+
const cacheDir = OpaCompiler.CACHE_DIR;
|
|
167495
|
+
const cachedWasm = path.join(cacheDir, `${cacheKey}.wasm`);
|
|
167496
|
+
// Return cached bundle if still valid
|
|
167497
|
+
if (fs.existsSync(cachedWasm)) {
|
|
167498
|
+
return fs.readFileSync(cachedWasm);
|
|
167499
|
+
}
|
|
167500
|
+
// Compile to WASM via opa build
|
|
167501
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
167502
|
+
const bundleTar = path.join(cacheDir, `${cacheKey}-bundle.tar.gz`);
|
|
167503
|
+
try {
|
|
167504
|
+
const args = [
|
|
167505
|
+
'build',
|
|
167506
|
+
'-t',
|
|
167507
|
+
'wasm',
|
|
167508
|
+
'-e',
|
|
167509
|
+
'visor', // entrypoint: the visor package tree
|
|
167510
|
+
'-o',
|
|
167511
|
+
bundleTar,
|
|
167512
|
+
...regoFiles,
|
|
167513
|
+
];
|
|
167514
|
+
(0, child_process_1.execFileSync)('opa', args, {
|
|
167515
|
+
stdio: 'pipe',
|
|
167516
|
+
timeout: 30000,
|
|
167517
|
+
});
|
|
167518
|
+
}
|
|
167519
|
+
catch (err) {
|
|
167520
|
+
const stderr = err?.stderr?.toString() || '';
|
|
167521
|
+
throw new Error(`Failed to compile .rego files to WASM:\n${stderr}\n` +
|
|
167522
|
+
'Ensure your .rego files are valid and the `opa` CLI is installed.');
|
|
167523
|
+
}
|
|
167524
|
+
// Extract policy.wasm from the tar.gz bundle
|
|
167525
|
+
// OPA bundles are tar.gz with /policy.wasm inside
|
|
167526
|
+
try {
|
|
167527
|
+
(0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, '/policy.wasm'], {
|
|
167528
|
+
stdio: 'pipe',
|
|
167529
|
+
});
|
|
167530
|
+
const extractedWasm = path.join(cacheDir, 'policy.wasm');
|
|
167531
|
+
if (fs.existsSync(extractedWasm)) {
|
|
167532
|
+
// Move to cache-key named file
|
|
167533
|
+
fs.renameSync(extractedWasm, cachedWasm);
|
|
167534
|
+
}
|
|
167535
|
+
}
|
|
167536
|
+
catch {
|
|
167537
|
+
// Some tar implementations don't like leading /
|
|
167538
|
+
try {
|
|
167539
|
+
(0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, 'policy.wasm'], {
|
|
167540
|
+
stdio: 'pipe',
|
|
167541
|
+
});
|
|
167542
|
+
const extractedWasm = path.join(cacheDir, 'policy.wasm');
|
|
167543
|
+
if (fs.existsSync(extractedWasm)) {
|
|
167544
|
+
fs.renameSync(extractedWasm, cachedWasm);
|
|
167545
|
+
}
|
|
167546
|
+
}
|
|
167547
|
+
catch (err2) {
|
|
167548
|
+
throw new Error(`Failed to extract policy.wasm from OPA bundle: ${err2?.message || err2}`);
|
|
167549
|
+
}
|
|
167550
|
+
}
|
|
167551
|
+
// Clean up tar
|
|
167552
|
+
try {
|
|
167553
|
+
fs.unlinkSync(bundleTar);
|
|
167554
|
+
}
|
|
167555
|
+
catch { }
|
|
167556
|
+
if (!fs.existsSync(cachedWasm)) {
|
|
167557
|
+
throw new Error('OPA build succeeded but policy.wasm was not found in the bundle');
|
|
167558
|
+
}
|
|
167559
|
+
return fs.readFileSync(cachedWasm);
|
|
167560
|
+
}
|
|
167561
|
+
}
|
|
167562
|
+
exports.OpaCompiler = OpaCompiler;
|
|
167563
|
+
|
|
167564
|
+
|
|
167565
|
+
/***/ }),
|
|
167566
|
+
|
|
167567
|
+
/***/ 44693:
|
|
167568
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
167569
|
+
|
|
167570
|
+
"use strict";
|
|
167571
|
+
|
|
167572
|
+
/**
|
|
167573
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167574
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167575
|
+
* in compliance with the Elastic License 2.0.
|
|
167576
|
+
*/
|
|
167577
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167578
|
+
exports.OpaHttpEvaluator = void 0;
|
|
167579
|
+
/**
|
|
167580
|
+
* OPA HTTP Evaluator - evaluates policies via an external OPA server's REST API.
|
|
167581
|
+
*
|
|
167582
|
+
* Uses the built-in `fetch` API (Node 18+), so no extra dependencies are needed.
|
|
167583
|
+
*/
|
|
167584
|
+
class OpaHttpEvaluator {
|
|
167585
|
+
baseUrl;
|
|
167586
|
+
timeout;
|
|
167587
|
+
constructor(baseUrl, timeout = 5000) {
|
|
167588
|
+
// Validate URL format and protocol
|
|
167589
|
+
let parsed;
|
|
167590
|
+
try {
|
|
167591
|
+
parsed = new URL(baseUrl);
|
|
167592
|
+
}
|
|
167593
|
+
catch {
|
|
167594
|
+
throw new Error(`OPA HTTP evaluator: invalid URL: ${baseUrl}`);
|
|
167595
|
+
}
|
|
167596
|
+
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
|
167597
|
+
throw new Error(`OPA HTTP evaluator: url must use http:// or https:// protocol, got: ${baseUrl}`);
|
|
167598
|
+
}
|
|
167599
|
+
// Block cloud metadata, loopback, link-local, and private network addresses
|
|
167600
|
+
const hostname = parsed.hostname;
|
|
167601
|
+
if (this.isBlockedHostname(hostname)) {
|
|
167602
|
+
throw new Error(`OPA HTTP evaluator: url must not point to internal, loopback, or private network addresses`);
|
|
167603
|
+
}
|
|
167604
|
+
// Normalize: strip trailing slash
|
|
167605
|
+
this.baseUrl = baseUrl.replace(/\/+$/, '');
|
|
167606
|
+
this.timeout = timeout;
|
|
167607
|
+
}
|
|
167608
|
+
/**
|
|
167609
|
+
* Check if a hostname is blocked due to SSRF concerns.
|
|
167610
|
+
*
|
|
167611
|
+
* Blocks:
|
|
167612
|
+
* - Loopback addresses (127.x.x.x, localhost, 0.0.0.0, ::1)
|
|
167613
|
+
* - Link-local addresses (169.254.x.x)
|
|
167614
|
+
* - Private networks (10.x.x.x, 172.16-31.x.x, 192.168.x.x)
|
|
167615
|
+
* - IPv6 unique local addresses (fd00::/8)
|
|
167616
|
+
* - Cloud metadata services (*.internal)
|
|
167617
|
+
*/
|
|
167618
|
+
isBlockedHostname(hostname) {
|
|
167619
|
+
if (!hostname)
|
|
167620
|
+
return true; // block empty hostnames
|
|
167621
|
+
// Normalize hostname: lowercase and remove brackets for IPv6
|
|
167622
|
+
const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
|
|
167623
|
+
// Block .internal domains (cloud metadata services)
|
|
167624
|
+
if (normalized === 'metadata.google.internal' || normalized.endsWith('.internal')) {
|
|
167625
|
+
return true;
|
|
167626
|
+
}
|
|
167627
|
+
// Block localhost variants
|
|
167628
|
+
if (normalized === 'localhost' || normalized === 'localhost.localdomain') {
|
|
167629
|
+
return true;
|
|
167630
|
+
}
|
|
167631
|
+
// Block IPv6 loopback
|
|
167632
|
+
if (normalized === '::1' || normalized === '0:0:0:0:0:0:0:1') {
|
|
167633
|
+
return true;
|
|
167634
|
+
}
|
|
167635
|
+
// Check IPv4 patterns
|
|
167636
|
+
const ipv4Pattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
167637
|
+
const ipv4Match = normalized.match(ipv4Pattern);
|
|
167638
|
+
if (ipv4Match) {
|
|
167639
|
+
const octets = ipv4Match.slice(1, 5).map(Number);
|
|
167640
|
+
// Validate octets are in range [0, 255]
|
|
167641
|
+
if (octets.some(octet => octet > 255)) {
|
|
167642
|
+
return false;
|
|
167643
|
+
}
|
|
167644
|
+
const [a, b] = octets;
|
|
167645
|
+
// Block loopback: 127.0.0.0/8
|
|
167646
|
+
if (a === 127) {
|
|
167647
|
+
return true;
|
|
167648
|
+
}
|
|
167649
|
+
// Block 0.0.0.0/8 (this host)
|
|
167650
|
+
if (a === 0) {
|
|
167651
|
+
return true;
|
|
167652
|
+
}
|
|
167653
|
+
// Block link-local: 169.254.0.0/16
|
|
167654
|
+
if (a === 169 && b === 254) {
|
|
167655
|
+
return true;
|
|
167656
|
+
}
|
|
167657
|
+
// Block private networks
|
|
167658
|
+
// 10.0.0.0/8
|
|
167659
|
+
if (a === 10) {
|
|
167660
|
+
return true;
|
|
167661
|
+
}
|
|
167662
|
+
// 172.16.0.0/12 (172.16.x.x through 172.31.x.x)
|
|
167663
|
+
if (a === 172 && b >= 16 && b <= 31) {
|
|
167664
|
+
return true;
|
|
167665
|
+
}
|
|
167666
|
+
// 192.168.0.0/16
|
|
167667
|
+
if (a === 192 && b === 168) {
|
|
167668
|
+
return true;
|
|
167669
|
+
}
|
|
167670
|
+
}
|
|
167671
|
+
// Check IPv6 patterns
|
|
167672
|
+
// Block unique local addresses: fd00::/8
|
|
167673
|
+
if (normalized.startsWith('fd') || normalized.startsWith('fc')) {
|
|
167674
|
+
return true;
|
|
167675
|
+
}
|
|
167676
|
+
// Block link-local: fe80::/10
|
|
167677
|
+
if (normalized.startsWith('fe80:')) {
|
|
167678
|
+
return true;
|
|
167679
|
+
}
|
|
167680
|
+
return false;
|
|
167681
|
+
}
|
|
167682
|
+
/**
|
|
167683
|
+
* Evaluate a policy rule against an input document via OPA REST API.
|
|
167684
|
+
*
|
|
167685
|
+
* @param input - The input document to evaluate
|
|
167686
|
+
* @param rulePath - OPA rule path (e.g., 'visor/check/execute')
|
|
167687
|
+
* @returns The result object from OPA, or undefined on error
|
|
167688
|
+
*/
|
|
167689
|
+
async evaluate(input, rulePath) {
|
|
167690
|
+
// OPA Data API: POST /v1/data/<path>
|
|
167691
|
+
const encodedPath = rulePath
|
|
167692
|
+
.split('/')
|
|
167693
|
+
.map(s => encodeURIComponent(s))
|
|
167694
|
+
.join('/');
|
|
167695
|
+
const url = `${this.baseUrl}/v1/data/${encodedPath}`;
|
|
167696
|
+
const controller = new AbortController();
|
|
167697
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
167698
|
+
try {
|
|
167699
|
+
const response = await fetch(url, {
|
|
167700
|
+
method: 'POST',
|
|
167701
|
+
headers: { 'Content-Type': 'application/json' },
|
|
167702
|
+
body: JSON.stringify({ input }),
|
|
167703
|
+
signal: controller.signal,
|
|
167704
|
+
});
|
|
167705
|
+
if (!response.ok) {
|
|
167706
|
+
throw new Error(`OPA HTTP ${response.status}: ${response.statusText}`);
|
|
167707
|
+
}
|
|
167708
|
+
let body;
|
|
167709
|
+
try {
|
|
167710
|
+
body = await response.json();
|
|
167711
|
+
}
|
|
167712
|
+
catch (jsonErr) {
|
|
167713
|
+
throw new Error(`OPA HTTP evaluator: failed to parse JSON response: ${jsonErr instanceof Error ? jsonErr.message : String(jsonErr)}`);
|
|
167714
|
+
}
|
|
167715
|
+
// OPA returns { result: { ... } }
|
|
167716
|
+
return body?.result;
|
|
167717
|
+
}
|
|
167718
|
+
finally {
|
|
167719
|
+
clearTimeout(timer);
|
|
167720
|
+
}
|
|
167721
|
+
}
|
|
167722
|
+
async shutdown() {
|
|
167723
|
+
// No persistent connections to close
|
|
167724
|
+
}
|
|
167725
|
+
}
|
|
167726
|
+
exports.OpaHttpEvaluator = OpaHttpEvaluator;
|
|
167727
|
+
|
|
167728
|
+
|
|
167729
|
+
/***/ }),
|
|
167730
|
+
|
|
167731
|
+
/***/ 39530:
|
|
167732
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
167733
|
+
|
|
167734
|
+
"use strict";
|
|
167735
|
+
|
|
167736
|
+
/**
|
|
167737
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167738
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167739
|
+
* in compliance with the Elastic License 2.0.
|
|
167740
|
+
*/
|
|
167741
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167742
|
+
exports.OpaPolicyEngine = void 0;
|
|
167743
|
+
const opa_wasm_evaluator_1 = __nccwpck_require__(8613);
|
|
167744
|
+
const opa_http_evaluator_1 = __nccwpck_require__(44693);
|
|
167745
|
+
const policy_input_builder_1 = __nccwpck_require__(17117);
|
|
167746
|
+
/**
|
|
167747
|
+
* Enterprise OPA Policy Engine.
|
|
167748
|
+
*
|
|
167749
|
+
* Wraps both WASM (local) and HTTP (remote) OPA evaluators behind the
|
|
167750
|
+
* OSS PolicyEngine interface. All OPA input building and role resolution
|
|
167751
|
+
* is handled internally — the OSS call sites pass only plain types.
|
|
167752
|
+
*/
|
|
167753
|
+
class OpaPolicyEngine {
|
|
167754
|
+
evaluator = null;
|
|
167755
|
+
fallback;
|
|
167756
|
+
timeout;
|
|
167757
|
+
config;
|
|
167758
|
+
inputBuilder = null;
|
|
167759
|
+
logger = null;
|
|
167760
|
+
constructor(config) {
|
|
167761
|
+
this.config = config;
|
|
167762
|
+
this.fallback = config.fallback || 'deny';
|
|
167763
|
+
this.timeout = config.timeout || 5000;
|
|
167764
|
+
}
|
|
167765
|
+
async initialize(config) {
|
|
167766
|
+
// Resolve logger once at initialization
|
|
167767
|
+
try {
|
|
167768
|
+
this.logger = (__nccwpck_require__(86999).logger);
|
|
167769
|
+
}
|
|
167770
|
+
catch {
|
|
167771
|
+
// logger not available in this context
|
|
167772
|
+
}
|
|
167773
|
+
// Build actor/repo context from environment (available at engine init time)
|
|
167774
|
+
const actor = {
|
|
167775
|
+
authorAssociation: process.env.VISOR_AUTHOR_ASSOCIATION,
|
|
167776
|
+
login: process.env.VISOR_AUTHOR_LOGIN || process.env.GITHUB_ACTOR,
|
|
167777
|
+
isLocalMode: !process.env.GITHUB_ACTIONS,
|
|
167778
|
+
};
|
|
167779
|
+
const repo = {
|
|
167780
|
+
owner: process.env.GITHUB_REPOSITORY_OWNER,
|
|
167781
|
+
name: process.env.GITHUB_REPOSITORY?.split('/')[1],
|
|
167782
|
+
branch: process.env.GITHUB_HEAD_REF,
|
|
167783
|
+
baseBranch: process.env.GITHUB_BASE_REF,
|
|
167784
|
+
event: process.env.GITHUB_EVENT_NAME,
|
|
167785
|
+
};
|
|
167786
|
+
const prNum = process.env.GITHUB_PR_NUMBER
|
|
167787
|
+
? parseInt(process.env.GITHUB_PR_NUMBER, 10)
|
|
167788
|
+
: undefined;
|
|
167789
|
+
const pullRequest = {
|
|
167790
|
+
number: prNum !== undefined && Number.isFinite(prNum) ? prNum : undefined,
|
|
167791
|
+
};
|
|
167792
|
+
this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(config, actor, repo, pullRequest);
|
|
167793
|
+
if (config.engine === 'local') {
|
|
167794
|
+
if (!config.rules) {
|
|
167795
|
+
throw new Error('OPA local mode requires `policy.rules` path to .wasm or .rego files');
|
|
167796
|
+
}
|
|
167797
|
+
const wasm = new opa_wasm_evaluator_1.OpaWasmEvaluator();
|
|
167798
|
+
await wasm.initialize(config.rules);
|
|
167799
|
+
if (config.data) {
|
|
167800
|
+
wasm.loadData(config.data);
|
|
167801
|
+
}
|
|
167802
|
+
this.evaluator = wasm;
|
|
167803
|
+
}
|
|
167804
|
+
else if (config.engine === 'remote') {
|
|
167805
|
+
if (!config.url) {
|
|
167806
|
+
throw new Error('OPA remote mode requires `policy.url` pointing to OPA server');
|
|
167807
|
+
}
|
|
167808
|
+
this.evaluator = new opa_http_evaluator_1.OpaHttpEvaluator(config.url, this.timeout);
|
|
167809
|
+
}
|
|
167810
|
+
else {
|
|
167811
|
+
this.evaluator = null;
|
|
167812
|
+
}
|
|
167813
|
+
}
|
|
167814
|
+
/**
|
|
167815
|
+
* Update actor/repo/PR context (e.g., after PR info becomes available).
|
|
167816
|
+
* Called by the enterprise loader when engine context is enriched.
|
|
167817
|
+
*/
|
|
167818
|
+
setActorContext(actor, repo, pullRequest) {
|
|
167819
|
+
this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(this.config, actor, repo, pullRequest);
|
|
167820
|
+
}
|
|
167821
|
+
async evaluateCheckExecution(checkId, checkConfig) {
|
|
167822
|
+
if (!this.evaluator || !this.inputBuilder)
|
|
167823
|
+
return { allowed: true };
|
|
167824
|
+
const cfg = checkConfig && typeof checkConfig === 'object'
|
|
167825
|
+
? checkConfig
|
|
167826
|
+
: {};
|
|
167827
|
+
const policyOverride = cfg.policy;
|
|
167828
|
+
const input = this.inputBuilder.forCheckExecution({
|
|
167829
|
+
id: checkId,
|
|
167830
|
+
type: cfg.type || 'ai',
|
|
167831
|
+
group: cfg.group,
|
|
167832
|
+
tags: cfg.tags,
|
|
167833
|
+
criticality: cfg.criticality,
|
|
167834
|
+
sandbox: cfg.sandbox,
|
|
167835
|
+
policy: policyOverride,
|
|
167836
|
+
});
|
|
167837
|
+
return this.doEvaluate(input, this.resolveRulePath('check.execute', policyOverride?.rule));
|
|
167838
|
+
}
|
|
167839
|
+
async evaluateToolInvocation(serverName, methodName, transport) {
|
|
167840
|
+
if (!this.evaluator || !this.inputBuilder)
|
|
167841
|
+
return { allowed: true };
|
|
167842
|
+
const input = this.inputBuilder.forToolInvocation(serverName, methodName, transport);
|
|
167843
|
+
return this.doEvaluate(input, 'visor/tool/invoke');
|
|
167844
|
+
}
|
|
167845
|
+
async evaluateCapabilities(checkId, capabilities) {
|
|
167846
|
+
if (!this.evaluator || !this.inputBuilder)
|
|
167847
|
+
return { allowed: true };
|
|
167848
|
+
const input = this.inputBuilder.forCapabilityResolve(checkId, capabilities);
|
|
167849
|
+
return this.doEvaluate(input, 'visor/capability/resolve');
|
|
167850
|
+
}
|
|
167851
|
+
async shutdown() {
|
|
167852
|
+
if (this.evaluator && 'shutdown' in this.evaluator) {
|
|
167853
|
+
await this.evaluator.shutdown();
|
|
167854
|
+
}
|
|
167855
|
+
this.evaluator = null;
|
|
167856
|
+
this.inputBuilder = null;
|
|
167857
|
+
}
|
|
167858
|
+
resolveRulePath(defaultScope, override) {
|
|
167859
|
+
if (override) {
|
|
167860
|
+
return override.startsWith('visor/') ? override : `visor/${override}`;
|
|
167861
|
+
}
|
|
167862
|
+
return `visor/${defaultScope.replace(/\./g, '/')}`;
|
|
167863
|
+
}
|
|
167864
|
+
async doEvaluate(input, rulePath) {
|
|
167865
|
+
try {
|
|
167866
|
+
this.logger?.debug(`[PolicyEngine] Evaluating ${rulePath}`, JSON.stringify(input));
|
|
167867
|
+
let timer;
|
|
167868
|
+
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
167869
|
+
timer = setTimeout(() => reject(new Error('policy evaluation timeout')), this.timeout);
|
|
167870
|
+
});
|
|
167871
|
+
try {
|
|
167872
|
+
const result = await Promise.race([this.rawEvaluate(input, rulePath), timeoutPromise]);
|
|
167873
|
+
const decision = this.parseDecision(result);
|
|
167874
|
+
// In warn mode, override denied decisions to allowed but flag as warn
|
|
167875
|
+
if (!decision.allowed && this.fallback === 'warn') {
|
|
167876
|
+
decision.allowed = true;
|
|
167877
|
+
decision.warn = true;
|
|
167878
|
+
decision.reason = `audit: ${decision.reason || 'policy denied'}`;
|
|
167879
|
+
}
|
|
167880
|
+
this.logger?.debug(`[PolicyEngine] Decision for ${rulePath}: allowed=${decision.allowed}, warn=${decision.warn || false}, reason=${decision.reason || 'none'}`);
|
|
167881
|
+
return decision;
|
|
167882
|
+
}
|
|
167883
|
+
finally {
|
|
167884
|
+
if (timer)
|
|
167885
|
+
clearTimeout(timer);
|
|
167886
|
+
}
|
|
167887
|
+
}
|
|
167888
|
+
catch (err) {
|
|
167889
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
167890
|
+
this.logger?.warn(`[PolicyEngine] Evaluation failed for ${rulePath}: ${msg}`);
|
|
167891
|
+
return {
|
|
167892
|
+
allowed: this.fallback === 'allow' || this.fallback === 'warn',
|
|
167893
|
+
warn: this.fallback === 'warn' ? true : undefined,
|
|
167894
|
+
reason: `policy evaluation failed, fallback=${this.fallback}`,
|
|
167895
|
+
};
|
|
167896
|
+
}
|
|
167897
|
+
}
|
|
167898
|
+
async rawEvaluate(input, rulePath) {
|
|
167899
|
+
if (this.evaluator instanceof opa_wasm_evaluator_1.OpaWasmEvaluator) {
|
|
167900
|
+
const result = await this.evaluator.evaluate(input);
|
|
167901
|
+
// WASM compiled with `-e visor` entrypoint returns the full visor package tree.
|
|
167902
|
+
// Navigate to the specific rule subtree using rulePath segments.
|
|
167903
|
+
// e.g., 'visor/check/execute' → result.check.execute
|
|
167904
|
+
return this.navigateWasmResult(result, rulePath);
|
|
167905
|
+
}
|
|
167906
|
+
return this.evaluator.evaluate(input, rulePath);
|
|
167907
|
+
}
|
|
167908
|
+
/**
|
|
167909
|
+
* Navigate nested OPA WASM result tree to reach the specific rule's output.
|
|
167910
|
+
* The WASM entrypoint `-e visor` means the result root IS the visor package,
|
|
167911
|
+
* so we strip the `visor/` prefix and walk the remaining segments.
|
|
167912
|
+
*/
|
|
167913
|
+
navigateWasmResult(result, rulePath) {
|
|
167914
|
+
if (!result || typeof result !== 'object')
|
|
167915
|
+
return result;
|
|
167916
|
+
// Strip the 'visor/' prefix (matches our compilation entrypoint)
|
|
167917
|
+
const segments = rulePath.replace(/^visor\//, '').split('/');
|
|
167918
|
+
let current = result;
|
|
167919
|
+
for (const seg of segments) {
|
|
167920
|
+
if (current && typeof current === 'object' && seg in current) {
|
|
167921
|
+
current = current[seg];
|
|
167922
|
+
}
|
|
167923
|
+
else {
|
|
167924
|
+
return undefined; // path not found in result tree
|
|
167925
|
+
}
|
|
167926
|
+
}
|
|
167927
|
+
return current;
|
|
167928
|
+
}
|
|
167929
|
+
parseDecision(result) {
|
|
167930
|
+
if (result === undefined || result === null) {
|
|
167931
|
+
return {
|
|
167932
|
+
allowed: this.fallback === 'allow' || this.fallback === 'warn',
|
|
167933
|
+
warn: this.fallback === 'warn' ? true : undefined,
|
|
167934
|
+
reason: this.fallback === 'warn' ? 'audit: no policy result' : 'no policy result',
|
|
167935
|
+
};
|
|
167936
|
+
}
|
|
167937
|
+
const allowed = result.allowed !== false;
|
|
167938
|
+
const decision = {
|
|
167939
|
+
allowed,
|
|
167940
|
+
reason: result.reason,
|
|
167941
|
+
};
|
|
167942
|
+
if (result.capabilities) {
|
|
167943
|
+
decision.capabilities = result.capabilities;
|
|
167944
|
+
}
|
|
167945
|
+
return decision;
|
|
167946
|
+
}
|
|
167947
|
+
}
|
|
167948
|
+
exports.OpaPolicyEngine = OpaPolicyEngine;
|
|
167949
|
+
|
|
167950
|
+
|
|
167951
|
+
/***/ }),
|
|
167952
|
+
|
|
167953
|
+
/***/ 8613:
|
|
167954
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
167955
|
+
|
|
167956
|
+
"use strict";
|
|
167957
|
+
|
|
167958
|
+
/**
|
|
167959
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
167960
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
167961
|
+
* in compliance with the Elastic License 2.0.
|
|
167962
|
+
*/
|
|
167963
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
167964
|
+
if (k2 === undefined) k2 = k;
|
|
167965
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
167966
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
167967
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
167968
|
+
}
|
|
167969
|
+
Object.defineProperty(o, k2, desc);
|
|
167970
|
+
}) : (function(o, m, k, k2) {
|
|
167971
|
+
if (k2 === undefined) k2 = k;
|
|
167972
|
+
o[k2] = m[k];
|
|
167973
|
+
}));
|
|
167974
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
167975
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
167976
|
+
}) : function(o, v) {
|
|
167977
|
+
o["default"] = v;
|
|
167978
|
+
});
|
|
167979
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
167980
|
+
var ownKeys = function(o) {
|
|
167981
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
167982
|
+
var ar = [];
|
|
167983
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
167984
|
+
return ar;
|
|
167985
|
+
};
|
|
167986
|
+
return ownKeys(o);
|
|
167987
|
+
};
|
|
167988
|
+
return function (mod) {
|
|
167989
|
+
if (mod && mod.__esModule) return mod;
|
|
167990
|
+
var result = {};
|
|
167991
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
167992
|
+
__setModuleDefault(result, mod);
|
|
167993
|
+
return result;
|
|
167994
|
+
};
|
|
167995
|
+
})();
|
|
167996
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
167997
|
+
exports.OpaWasmEvaluator = void 0;
|
|
167998
|
+
const fs = __importStar(__nccwpck_require__(79896));
|
|
167999
|
+
const path = __importStar(__nccwpck_require__(16928));
|
|
168000
|
+
const opa_compiler_1 = __nccwpck_require__(628);
|
|
168001
|
+
/**
|
|
168002
|
+
* OPA WASM Evaluator - loads and evaluates OPA policies locally.
|
|
168003
|
+
*
|
|
168004
|
+
* Supports three input formats:
|
|
168005
|
+
* 1. Pre-compiled `.wasm` bundle — loaded directly (fastest startup)
|
|
168006
|
+
* 2. `.rego` files or directory — auto-compiled to WASM via `opa build` CLI
|
|
168007
|
+
* 3. Directory with `policy.wasm` inside — loaded directly
|
|
168008
|
+
*
|
|
168009
|
+
* Compilation and caching of .rego files is delegated to {@link OpaCompiler}.
|
|
168010
|
+
*
|
|
168011
|
+
* Requires:
|
|
168012
|
+
* - `@open-policy-agent/opa-wasm` npm package (optional dep)
|
|
168013
|
+
* - `opa` CLI on PATH (only when auto-compiling .rego files)
|
|
168014
|
+
*/
|
|
168015
|
+
class OpaWasmEvaluator {
|
|
168016
|
+
policy = null;
|
|
168017
|
+
dataDocument = {};
|
|
168018
|
+
compiler = new opa_compiler_1.OpaCompiler();
|
|
168019
|
+
async initialize(rulesPath) {
|
|
168020
|
+
const paths = Array.isArray(rulesPath) ? rulesPath : [rulesPath];
|
|
168021
|
+
const wasmBytes = await this.compiler.resolveWasmBytes(paths);
|
|
168022
|
+
try {
|
|
168023
|
+
// Use createRequire to load the optional dep at runtime without ncc bundling it.
|
|
168024
|
+
// `new Function('id', 'return require(id)')` fails in ncc bundles because
|
|
168025
|
+
// `require` is not in the `new Function` scope. `createRequire` works correctly
|
|
168026
|
+
// because it creates a real Node.js require rooted at the given path.
|
|
168027
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
168028
|
+
const { createRequire } = __nccwpck_require__(73339);
|
|
168029
|
+
const runtimeRequire = createRequire(__filename);
|
|
168030
|
+
const opaWasm = runtimeRequire('@open-policy-agent/opa-wasm');
|
|
168031
|
+
const loadPolicy = opaWasm.loadPolicy || opaWasm.default?.loadPolicy;
|
|
168032
|
+
if (!loadPolicy) {
|
|
168033
|
+
throw new Error('loadPolicy not found in @open-policy-agent/opa-wasm');
|
|
168034
|
+
}
|
|
168035
|
+
this.policy = await loadPolicy(wasmBytes);
|
|
168036
|
+
}
|
|
168037
|
+
catch (err) {
|
|
168038
|
+
if (err?.code === 'MODULE_NOT_FOUND' || err?.code === 'ERR_MODULE_NOT_FOUND') {
|
|
168039
|
+
throw new Error('OPA WASM evaluator requires @open-policy-agent/opa-wasm. ' +
|
|
168040
|
+
'Install it with: npm install @open-policy-agent/opa-wasm');
|
|
168041
|
+
}
|
|
168042
|
+
throw err;
|
|
168043
|
+
}
|
|
168044
|
+
}
|
|
168045
|
+
/**
|
|
168046
|
+
* Load external data from a JSON file to use as the OPA data document.
|
|
168047
|
+
* The loaded data will be passed to `policy.setData()` during evaluation,
|
|
168048
|
+
* making it available in Rego via `data.<key>`.
|
|
168049
|
+
*/
|
|
168050
|
+
loadData(dataPath) {
|
|
168051
|
+
const resolved = path.resolve(dataPath);
|
|
168052
|
+
if (path.normalize(resolved).includes('..')) {
|
|
168053
|
+
throw new Error(`Data path contains traversal sequences: ${dataPath}`);
|
|
168054
|
+
}
|
|
168055
|
+
if (!fs.existsSync(resolved)) {
|
|
168056
|
+
throw new Error(`OPA data file not found: ${resolved}`);
|
|
168057
|
+
}
|
|
168058
|
+
const stat = fs.statSync(resolved);
|
|
168059
|
+
if (stat.size > 10 * 1024 * 1024) {
|
|
168060
|
+
throw new Error(`OPA data file exceeds 10MB limit: ${resolved} (${stat.size} bytes)`);
|
|
168061
|
+
}
|
|
168062
|
+
const raw = fs.readFileSync(resolved, 'utf-8');
|
|
168063
|
+
try {
|
|
168064
|
+
const parsed = JSON.parse(raw);
|
|
168065
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
168066
|
+
throw new Error('OPA data file must contain a JSON object (not an array or primitive)');
|
|
168067
|
+
}
|
|
168068
|
+
this.dataDocument = parsed;
|
|
168069
|
+
}
|
|
168070
|
+
catch (err) {
|
|
168071
|
+
if (err.message.startsWith('OPA data file must')) {
|
|
168072
|
+
throw err;
|
|
168073
|
+
}
|
|
168074
|
+
throw new Error(`Failed to parse OPA data file ${resolved}: ${err.message}`);
|
|
168075
|
+
}
|
|
168076
|
+
}
|
|
168077
|
+
async evaluate(input) {
|
|
168078
|
+
if (!this.policy) {
|
|
168079
|
+
throw new Error('OPA WASM evaluator not initialized');
|
|
168080
|
+
}
|
|
168081
|
+
this.policy.setData(this.dataDocument);
|
|
168082
|
+
const resultSet = this.policy.evaluate(input);
|
|
168083
|
+
if (Array.isArray(resultSet) && resultSet.length > 0) {
|
|
168084
|
+
return resultSet[0].result;
|
|
168085
|
+
}
|
|
168086
|
+
return undefined;
|
|
168087
|
+
}
|
|
168088
|
+
async shutdown() {
|
|
168089
|
+
if (this.policy) {
|
|
168090
|
+
// opa-wasm policy objects may have a close/free method for WASM cleanup
|
|
168091
|
+
if (typeof this.policy.close === 'function') {
|
|
168092
|
+
try {
|
|
168093
|
+
this.policy.close();
|
|
168094
|
+
}
|
|
168095
|
+
catch { }
|
|
168096
|
+
}
|
|
168097
|
+
else if (typeof this.policy.free === 'function') {
|
|
168098
|
+
try {
|
|
168099
|
+
this.policy.free();
|
|
168100
|
+
}
|
|
168101
|
+
catch { }
|
|
168102
|
+
}
|
|
168103
|
+
}
|
|
168104
|
+
this.policy = null;
|
|
168105
|
+
}
|
|
168106
|
+
}
|
|
168107
|
+
exports.OpaWasmEvaluator = OpaWasmEvaluator;
|
|
168108
|
+
|
|
168109
|
+
|
|
168110
|
+
/***/ }),
|
|
168111
|
+
|
|
168112
|
+
/***/ 17117:
|
|
168113
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
168114
|
+
|
|
168115
|
+
"use strict";
|
|
168116
|
+
|
|
168117
|
+
/**
|
|
168118
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
168119
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
168120
|
+
* in compliance with the Elastic License 2.0.
|
|
168121
|
+
*/
|
|
168122
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
168123
|
+
exports.PolicyInputBuilder = void 0;
|
|
168124
|
+
/**
|
|
168125
|
+
* Builds OPA-compatible input documents from engine context.
|
|
168126
|
+
*
|
|
168127
|
+
* Resolves actor roles from the `policy.roles` config section by matching
|
|
168128
|
+
* the actor's authorAssociation and login against role definitions.
|
|
168129
|
+
*/
|
|
168130
|
+
class PolicyInputBuilder {
|
|
168131
|
+
roles;
|
|
168132
|
+
actor;
|
|
168133
|
+
repository;
|
|
168134
|
+
pullRequest;
|
|
168135
|
+
constructor(policyConfig, actor, repository, pullRequest) {
|
|
168136
|
+
this.roles = policyConfig.roles || {};
|
|
168137
|
+
this.actor = actor;
|
|
168138
|
+
this.repository = repository;
|
|
168139
|
+
this.pullRequest = pullRequest;
|
|
168140
|
+
}
|
|
168141
|
+
/** Resolve which roles apply to the current actor. */
|
|
168142
|
+
resolveRoles() {
|
|
168143
|
+
const matched = [];
|
|
168144
|
+
for (const [roleName, roleConfig] of Object.entries(this.roles)) {
|
|
168145
|
+
let identityMatch = false;
|
|
168146
|
+
if (roleConfig.author_association &&
|
|
168147
|
+
this.actor.authorAssociation &&
|
|
168148
|
+
roleConfig.author_association.includes(this.actor.authorAssociation)) {
|
|
168149
|
+
identityMatch = true;
|
|
168150
|
+
}
|
|
168151
|
+
if (!identityMatch &&
|
|
168152
|
+
roleConfig.users &&
|
|
168153
|
+
this.actor.login &&
|
|
168154
|
+
roleConfig.users.includes(this.actor.login)) {
|
|
168155
|
+
identityMatch = true;
|
|
168156
|
+
}
|
|
168157
|
+
// Slack user ID match
|
|
168158
|
+
if (!identityMatch &&
|
|
168159
|
+
roleConfig.slack_users &&
|
|
168160
|
+
this.actor.slack?.userId &&
|
|
168161
|
+
roleConfig.slack_users.includes(this.actor.slack.userId)) {
|
|
168162
|
+
identityMatch = true;
|
|
168163
|
+
}
|
|
168164
|
+
// Email match (case-insensitive)
|
|
168165
|
+
if (!identityMatch && roleConfig.emails && this.actor.slack?.email) {
|
|
168166
|
+
const actorEmail = this.actor.slack.email.toLowerCase();
|
|
168167
|
+
if (roleConfig.emails.some(e => e.toLowerCase() === actorEmail)) {
|
|
168168
|
+
identityMatch = true;
|
|
168169
|
+
}
|
|
168170
|
+
}
|
|
168171
|
+
// Note: teams-based role resolution requires GitHub API access (read:org scope)
|
|
168172
|
+
// and is not yet implemented. If configured, the role will not match via teams.
|
|
168173
|
+
if (!identityMatch)
|
|
168174
|
+
continue;
|
|
168175
|
+
// slack_channels gate: if set, the role only applies when triggered from one of these channels
|
|
168176
|
+
if (roleConfig.slack_channels && roleConfig.slack_channels.length > 0) {
|
|
168177
|
+
if (!this.actor.slack?.channelId ||
|
|
168178
|
+
!roleConfig.slack_channels.includes(this.actor.slack.channelId)) {
|
|
168179
|
+
continue;
|
|
168180
|
+
}
|
|
168181
|
+
}
|
|
168182
|
+
matched.push(roleName);
|
|
168183
|
+
}
|
|
168184
|
+
return matched;
|
|
168185
|
+
}
|
|
168186
|
+
buildActor() {
|
|
168187
|
+
return {
|
|
168188
|
+
authorAssociation: this.actor.authorAssociation,
|
|
168189
|
+
login: this.actor.login,
|
|
168190
|
+
roles: this.resolveRoles(),
|
|
168191
|
+
isLocalMode: this.actor.isLocalMode,
|
|
168192
|
+
...(this.actor.slack && { slack: this.actor.slack }),
|
|
168193
|
+
};
|
|
168194
|
+
}
|
|
168195
|
+
forCheckExecution(check) {
|
|
168196
|
+
return {
|
|
168197
|
+
scope: 'check.execute',
|
|
168198
|
+
check: {
|
|
168199
|
+
id: check.id,
|
|
168200
|
+
type: check.type,
|
|
168201
|
+
group: check.group,
|
|
168202
|
+
tags: check.tags,
|
|
168203
|
+
criticality: check.criticality,
|
|
168204
|
+
sandbox: check.sandbox,
|
|
168205
|
+
policy: check.policy,
|
|
168206
|
+
},
|
|
168207
|
+
actor: this.buildActor(),
|
|
168208
|
+
repository: this.repository,
|
|
168209
|
+
pullRequest: this.pullRequest,
|
|
168210
|
+
};
|
|
168211
|
+
}
|
|
168212
|
+
forToolInvocation(serverName, methodName, transport) {
|
|
168213
|
+
return {
|
|
168214
|
+
scope: 'tool.invoke',
|
|
168215
|
+
tool: { serverName, methodName, transport },
|
|
168216
|
+
actor: this.buildActor(),
|
|
168217
|
+
repository: this.repository,
|
|
168218
|
+
pullRequest: this.pullRequest,
|
|
168219
|
+
};
|
|
168220
|
+
}
|
|
168221
|
+
forCapabilityResolve(checkId, capabilities) {
|
|
168222
|
+
return {
|
|
168223
|
+
scope: 'capability.resolve',
|
|
168224
|
+
check: { id: checkId, type: 'ai' },
|
|
168225
|
+
capability: capabilities,
|
|
168226
|
+
actor: this.buildActor(),
|
|
168227
|
+
repository: this.repository,
|
|
168228
|
+
pullRequest: this.pullRequest,
|
|
168229
|
+
};
|
|
168230
|
+
}
|
|
168231
|
+
}
|
|
168232
|
+
exports.PolicyInputBuilder = PolicyInputBuilder;
|
|
168233
|
+
|
|
168234
|
+
|
|
168235
|
+
/***/ }),
|
|
168236
|
+
|
|
168237
|
+
/***/ 63737:
|
|
168238
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
168239
|
+
|
|
168240
|
+
"use strict";
|
|
168241
|
+
|
|
168242
|
+
/**
|
|
168243
|
+
* Copyright (c) ProbeLabs. All rights reserved.
|
|
168244
|
+
* Licensed under the Elastic License 2.0; you may not use this file except
|
|
168245
|
+
* in compliance with the Elastic License 2.0.
|
|
168246
|
+
*/
|
|
168247
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
168248
|
+
if (k2 === undefined) k2 = k;
|
|
168249
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
168250
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
168251
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
168252
|
+
}
|
|
168253
|
+
Object.defineProperty(o, k2, desc);
|
|
168254
|
+
}) : (function(o, m, k, k2) {
|
|
168255
|
+
if (k2 === undefined) k2 = k;
|
|
168256
|
+
o[k2] = m[k];
|
|
168257
|
+
}));
|
|
168258
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
168259
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
168260
|
+
}) : function(o, v) {
|
|
168261
|
+
o["default"] = v;
|
|
168262
|
+
});
|
|
168263
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
168264
|
+
var ownKeys = function(o) {
|
|
168265
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
168266
|
+
var ar = [];
|
|
168267
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
168268
|
+
return ar;
|
|
168269
|
+
};
|
|
168270
|
+
return ownKeys(o);
|
|
168271
|
+
};
|
|
168272
|
+
return function (mod) {
|
|
168273
|
+
if (mod && mod.__esModule) return mod;
|
|
168274
|
+
var result = {};
|
|
168275
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
168276
|
+
__setModuleDefault(result, mod);
|
|
168277
|
+
return result;
|
|
168278
|
+
};
|
|
168279
|
+
})();
|
|
168280
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
168281
|
+
exports.KnexStoreBackend = void 0;
|
|
168282
|
+
/**
|
|
168283
|
+
* Knex-backed schedule store for PostgreSQL, MySQL, and MSSQL (Enterprise)
|
|
168284
|
+
*
|
|
168285
|
+
* Uses Knex query builder for database-agnostic SQL. Same schema as SQLite backend
|
|
168286
|
+
* but with real distributed locking via row-level claims (claimed_by/claimed_at/lock_token).
|
|
168287
|
+
*/
|
|
168288
|
+
const fs = __importStar(__nccwpck_require__(79896));
|
|
168289
|
+
const path = __importStar(__nccwpck_require__(16928));
|
|
168290
|
+
const uuid_1 = __nccwpck_require__(31914);
|
|
168291
|
+
const logger_1 = __nccwpck_require__(86999);
|
|
168292
|
+
function toNum(val) {
|
|
168293
|
+
if (val === null || val === undefined)
|
|
168294
|
+
return undefined;
|
|
168295
|
+
return typeof val === 'string' ? parseInt(val, 10) : val;
|
|
168296
|
+
}
|
|
168297
|
+
function safeJsonParse(value) {
|
|
168298
|
+
if (!value)
|
|
168299
|
+
return undefined;
|
|
168300
|
+
try {
|
|
168301
|
+
return JSON.parse(value);
|
|
168302
|
+
}
|
|
168303
|
+
catch {
|
|
168304
|
+
return undefined;
|
|
168305
|
+
}
|
|
168306
|
+
}
|
|
168307
|
+
function fromDbRow(row) {
|
|
168308
|
+
return {
|
|
168309
|
+
id: row.id,
|
|
168310
|
+
creatorId: row.creator_id,
|
|
168311
|
+
creatorContext: row.creator_context ?? undefined,
|
|
168312
|
+
creatorName: row.creator_name ?? undefined,
|
|
168313
|
+
timezone: row.timezone,
|
|
168314
|
+
schedule: row.schedule_expr,
|
|
168315
|
+
runAt: toNum(row.run_at),
|
|
168316
|
+
isRecurring: row.is_recurring === true || row.is_recurring === 1,
|
|
168317
|
+
originalExpression: row.original_expression,
|
|
168318
|
+
workflow: row.workflow ?? undefined,
|
|
168319
|
+
workflowInputs: safeJsonParse(row.workflow_inputs),
|
|
168320
|
+
outputContext: safeJsonParse(row.output_context),
|
|
168321
|
+
status: row.status,
|
|
168322
|
+
createdAt: toNum(row.created_at),
|
|
168323
|
+
lastRunAt: toNum(row.last_run_at),
|
|
168324
|
+
nextRunAt: toNum(row.next_run_at),
|
|
168325
|
+
runCount: row.run_count,
|
|
168326
|
+
failureCount: row.failure_count,
|
|
168327
|
+
lastError: row.last_error ?? undefined,
|
|
168328
|
+
previousResponse: row.previous_response ?? undefined,
|
|
168329
|
+
};
|
|
168330
|
+
}
|
|
168331
|
+
function toInsertRow(schedule) {
|
|
168332
|
+
return {
|
|
168333
|
+
id: schedule.id,
|
|
168334
|
+
creator_id: schedule.creatorId,
|
|
168335
|
+
creator_context: schedule.creatorContext ?? null,
|
|
168336
|
+
creator_name: schedule.creatorName ?? null,
|
|
168337
|
+
timezone: schedule.timezone,
|
|
168338
|
+
schedule_expr: schedule.schedule,
|
|
168339
|
+
run_at: schedule.runAt ?? null,
|
|
168340
|
+
is_recurring: schedule.isRecurring,
|
|
168341
|
+
original_expression: schedule.originalExpression,
|
|
168342
|
+
workflow: schedule.workflow ?? null,
|
|
168343
|
+
workflow_inputs: schedule.workflowInputs ? JSON.stringify(schedule.workflowInputs) : null,
|
|
168344
|
+
output_context: schedule.outputContext ? JSON.stringify(schedule.outputContext) : null,
|
|
168345
|
+
status: schedule.status,
|
|
168346
|
+
created_at: schedule.createdAt,
|
|
168347
|
+
last_run_at: schedule.lastRunAt ?? null,
|
|
168348
|
+
next_run_at: schedule.nextRunAt ?? null,
|
|
168349
|
+
run_count: schedule.runCount,
|
|
168350
|
+
failure_count: schedule.failureCount,
|
|
168351
|
+
last_error: schedule.lastError ?? null,
|
|
168352
|
+
previous_response: schedule.previousResponse ?? null,
|
|
168353
|
+
};
|
|
168354
|
+
}
|
|
168355
|
+
/**
|
|
168356
|
+
* Enterprise Knex-backed store for PostgreSQL, MySQL, and MSSQL
|
|
168357
|
+
*/
|
|
168358
|
+
class KnexStoreBackend {
|
|
168359
|
+
knex = null;
|
|
168360
|
+
driver;
|
|
168361
|
+
connection;
|
|
168362
|
+
constructor(driver, storageConfig, _haConfig) {
|
|
168363
|
+
this.driver = driver;
|
|
168364
|
+
this.connection = (storageConfig.connection || {});
|
|
168365
|
+
}
|
|
168366
|
+
async initialize() {
|
|
168367
|
+
// Load knex dynamically
|
|
168368
|
+
const { createRequire } = __nccwpck_require__(73339);
|
|
168369
|
+
const runtimeRequire = createRequire(__filename);
|
|
168370
|
+
let knexFactory;
|
|
168371
|
+
try {
|
|
168372
|
+
knexFactory = runtimeRequire('knex');
|
|
168373
|
+
}
|
|
168374
|
+
catch (err) {
|
|
168375
|
+
const code = err?.code;
|
|
168376
|
+
if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
|
|
168377
|
+
throw new Error('knex is required for PostgreSQL/MySQL/MSSQL schedule storage. ' +
|
|
168378
|
+
'Install it with: npm install knex');
|
|
168379
|
+
}
|
|
168380
|
+
throw err;
|
|
168381
|
+
}
|
|
168382
|
+
const clientMap = {
|
|
168383
|
+
postgresql: 'pg',
|
|
168384
|
+
mysql: 'mysql2',
|
|
168385
|
+
mssql: 'tedious',
|
|
168386
|
+
};
|
|
168387
|
+
const client = clientMap[this.driver];
|
|
168388
|
+
// Build connection config
|
|
168389
|
+
let connection;
|
|
168390
|
+
if (this.connection.connection_string) {
|
|
168391
|
+
connection = this.connection.connection_string;
|
|
168392
|
+
}
|
|
168393
|
+
else if (this.driver === 'mssql') {
|
|
168394
|
+
connection = this.buildMssqlConnection();
|
|
168395
|
+
}
|
|
168396
|
+
else {
|
|
168397
|
+
connection = this.buildStandardConnection();
|
|
168398
|
+
}
|
|
168399
|
+
this.knex = knexFactory({
|
|
168400
|
+
client,
|
|
168401
|
+
connection,
|
|
168402
|
+
pool: {
|
|
168403
|
+
min: this.connection.pool?.min ?? 0,
|
|
168404
|
+
max: this.connection.pool?.max ?? 10,
|
|
168405
|
+
},
|
|
168406
|
+
});
|
|
168407
|
+
// Run schema migration
|
|
168408
|
+
await this.migrateSchema();
|
|
168409
|
+
logger_1.logger.info(`[KnexStore] Initialized (${this.driver})`);
|
|
168410
|
+
}
|
|
168411
|
+
buildStandardConnection() {
|
|
168412
|
+
return {
|
|
168413
|
+
host: this.connection.host || 'localhost',
|
|
168414
|
+
port: this.connection.port,
|
|
168415
|
+
database: this.connection.database || 'visor',
|
|
168416
|
+
user: this.connection.user,
|
|
168417
|
+
password: this.connection.password,
|
|
168418
|
+
ssl: this.resolveSslConfig(),
|
|
168419
|
+
};
|
|
168420
|
+
}
|
|
168421
|
+
buildMssqlConnection() {
|
|
168422
|
+
const ssl = this.connection.ssl;
|
|
168423
|
+
const sslEnabled = ssl === true || (typeof ssl === 'object' && ssl.enabled !== false);
|
|
168424
|
+
return {
|
|
168425
|
+
server: this.connection.host || 'localhost',
|
|
168426
|
+
port: this.connection.port,
|
|
168427
|
+
database: this.connection.database || 'visor',
|
|
168428
|
+
user: this.connection.user,
|
|
168429
|
+
password: this.connection.password,
|
|
168430
|
+
options: {
|
|
168431
|
+
encrypt: sslEnabled,
|
|
168432
|
+
trustServerCertificate: typeof ssl === 'object' ? ssl.reject_unauthorized === false : !sslEnabled,
|
|
168433
|
+
},
|
|
168434
|
+
};
|
|
168435
|
+
}
|
|
168436
|
+
resolveSslConfig() {
|
|
168437
|
+
const ssl = this.connection.ssl;
|
|
168438
|
+
if (ssl === false || ssl === undefined)
|
|
168439
|
+
return false;
|
|
168440
|
+
if (ssl === true)
|
|
168441
|
+
return { rejectUnauthorized: true };
|
|
168442
|
+
// Object config
|
|
168443
|
+
if (ssl.enabled === false)
|
|
168444
|
+
return false;
|
|
168445
|
+
const result = {
|
|
168446
|
+
rejectUnauthorized: ssl.reject_unauthorized !== false,
|
|
168447
|
+
};
|
|
168448
|
+
if (ssl.ca) {
|
|
168449
|
+
const caPath = this.validateSslPath(ssl.ca, 'CA certificate');
|
|
168450
|
+
result.ca = fs.readFileSync(caPath, 'utf8');
|
|
168451
|
+
}
|
|
168452
|
+
if (ssl.cert) {
|
|
168453
|
+
const certPath = this.validateSslPath(ssl.cert, 'client certificate');
|
|
168454
|
+
result.cert = fs.readFileSync(certPath, 'utf8');
|
|
168455
|
+
}
|
|
168456
|
+
if (ssl.key) {
|
|
168457
|
+
const keyPath = this.validateSslPath(ssl.key, 'client key');
|
|
168458
|
+
result.key = fs.readFileSync(keyPath, 'utf8');
|
|
168459
|
+
}
|
|
168460
|
+
return result;
|
|
168461
|
+
}
|
|
168462
|
+
validateSslPath(filePath, label) {
|
|
168463
|
+
const resolved = path.resolve(filePath);
|
|
168464
|
+
if (resolved !== path.normalize(resolved)) {
|
|
168465
|
+
throw new Error(`SSL ${label} path contains invalid sequences: ${filePath}`);
|
|
168466
|
+
}
|
|
168467
|
+
if (!fs.existsSync(resolved)) {
|
|
168468
|
+
throw new Error(`SSL ${label} not found: ${filePath}`);
|
|
168469
|
+
}
|
|
168470
|
+
return resolved;
|
|
168471
|
+
}
|
|
168472
|
+
async shutdown() {
|
|
168473
|
+
if (this.knex) {
|
|
168474
|
+
await this.knex.destroy();
|
|
168475
|
+
this.knex = null;
|
|
168476
|
+
}
|
|
168477
|
+
}
|
|
168478
|
+
async migrateSchema() {
|
|
168479
|
+
const knex = this.getKnex();
|
|
168480
|
+
const exists = await knex.schema.hasTable('schedules');
|
|
168481
|
+
if (!exists) {
|
|
168482
|
+
await knex.schema.createTable('schedules', table => {
|
|
168483
|
+
table.string('id', 36).primary();
|
|
168484
|
+
table.string('creator_id', 255).notNullable().index();
|
|
168485
|
+
table.string('creator_context', 255);
|
|
168486
|
+
table.string('creator_name', 255);
|
|
168487
|
+
table.string('timezone', 64).notNullable().defaultTo('UTC');
|
|
168488
|
+
table.string('schedule_expr', 255);
|
|
168489
|
+
table.bigInteger('run_at');
|
|
168490
|
+
table.boolean('is_recurring').notNullable();
|
|
168491
|
+
table.text('original_expression');
|
|
168492
|
+
table.string('workflow', 255);
|
|
168493
|
+
table.text('workflow_inputs');
|
|
168494
|
+
table.text('output_context');
|
|
168495
|
+
table.string('status', 20).notNullable().index();
|
|
168496
|
+
table.bigInteger('created_at').notNullable();
|
|
168497
|
+
table.bigInteger('last_run_at');
|
|
168498
|
+
table.bigInteger('next_run_at');
|
|
168499
|
+
table.integer('run_count').notNullable().defaultTo(0);
|
|
168500
|
+
table.integer('failure_count').notNullable().defaultTo(0);
|
|
168501
|
+
table.text('last_error');
|
|
168502
|
+
table.text('previous_response');
|
|
168503
|
+
table.index(['status', 'next_run_at']);
|
|
168504
|
+
});
|
|
168505
|
+
}
|
|
168506
|
+
// Create scheduler_locks table for distributed locking
|
|
168507
|
+
const locksExist = await knex.schema.hasTable('scheduler_locks');
|
|
168508
|
+
if (!locksExist) {
|
|
168509
|
+
await knex.schema.createTable('scheduler_locks', table => {
|
|
168510
|
+
table.string('lock_id', 255).primary();
|
|
168511
|
+
table.string('node_id', 255).notNullable();
|
|
168512
|
+
table.string('lock_token', 36).notNullable();
|
|
168513
|
+
table.bigInteger('acquired_at').notNullable();
|
|
168514
|
+
table.bigInteger('expires_at').notNullable();
|
|
168515
|
+
});
|
|
168516
|
+
}
|
|
168517
|
+
}
|
|
168518
|
+
getKnex() {
|
|
168519
|
+
if (!this.knex) {
|
|
168520
|
+
throw new Error('[KnexStore] Not initialized. Call initialize() first.');
|
|
168521
|
+
}
|
|
168522
|
+
return this.knex;
|
|
168523
|
+
}
|
|
168524
|
+
// --- CRUD ---
|
|
168525
|
+
async create(schedule) {
|
|
168526
|
+
const knex = this.getKnex();
|
|
168527
|
+
const newSchedule = {
|
|
168528
|
+
...schedule,
|
|
168529
|
+
id: (0, uuid_1.v4)(),
|
|
168530
|
+
createdAt: Date.now(),
|
|
168531
|
+
runCount: 0,
|
|
168532
|
+
failureCount: 0,
|
|
168533
|
+
status: 'active',
|
|
168534
|
+
};
|
|
168535
|
+
await knex('schedules').insert(toInsertRow(newSchedule));
|
|
168536
|
+
logger_1.logger.info(`[KnexStore] Created schedule ${newSchedule.id} for user ${newSchedule.creatorId}`);
|
|
168537
|
+
return newSchedule;
|
|
168538
|
+
}
|
|
168539
|
+
async importSchedule(schedule) {
|
|
168540
|
+
const knex = this.getKnex();
|
|
168541
|
+
const existing = await knex('schedules').where('id', schedule.id).first();
|
|
168542
|
+
if (existing)
|
|
168543
|
+
return; // Already imported (idempotent)
|
|
168544
|
+
await knex('schedules').insert(toInsertRow(schedule));
|
|
168545
|
+
}
|
|
168546
|
+
async get(id) {
|
|
168547
|
+
const knex = this.getKnex();
|
|
168548
|
+
const row = await knex('schedules').where('id', id).first();
|
|
168549
|
+
return row ? fromDbRow(row) : undefined;
|
|
168550
|
+
}
|
|
168551
|
+
async update(id, patch) {
|
|
168552
|
+
const knex = this.getKnex();
|
|
168553
|
+
const existing = await knex('schedules').where('id', id).first();
|
|
168554
|
+
if (!existing)
|
|
168555
|
+
return undefined;
|
|
168556
|
+
const current = fromDbRow(existing);
|
|
168557
|
+
const updated = { ...current, ...patch, id: current.id };
|
|
168558
|
+
const row = toInsertRow(updated);
|
|
168559
|
+
// Remove id from update (PK cannot change)
|
|
168560
|
+
delete row.id;
|
|
168561
|
+
await knex('schedules').where('id', id).update(row);
|
|
168562
|
+
return updated;
|
|
168563
|
+
}
|
|
168564
|
+
async delete(id) {
|
|
168565
|
+
const knex = this.getKnex();
|
|
168566
|
+
const deleted = await knex('schedules').where('id', id).del();
|
|
168567
|
+
if (deleted > 0) {
|
|
168568
|
+
logger_1.logger.info(`[KnexStore] Deleted schedule ${id}`);
|
|
168569
|
+
return true;
|
|
168570
|
+
}
|
|
168571
|
+
return false;
|
|
168572
|
+
}
|
|
168573
|
+
// --- Queries ---
|
|
168574
|
+
async getByCreator(creatorId) {
|
|
168575
|
+
const knex = this.getKnex();
|
|
168576
|
+
const rows = await knex('schedules').where('creator_id', creatorId);
|
|
168577
|
+
return rows.map((r) => fromDbRow(r));
|
|
168578
|
+
}
|
|
168579
|
+
async getActiveSchedules() {
|
|
168580
|
+
const knex = this.getKnex();
|
|
168581
|
+
const rows = await knex('schedules').where('status', 'active');
|
|
168582
|
+
return rows.map((r) => fromDbRow(r));
|
|
168583
|
+
}
|
|
168584
|
+
async getDueSchedules(now) {
|
|
168585
|
+
const ts = now ?? Date.now();
|
|
168586
|
+
const knex = this.getKnex();
|
|
168587
|
+
// MSSQL uses 1/0 for booleans
|
|
168588
|
+
const bFalse = this.driver === 'mssql' ? 0 : false;
|
|
168589
|
+
const bTrue = this.driver === 'mssql' ? 1 : true;
|
|
168590
|
+
const rows = await knex('schedules')
|
|
168591
|
+
.where('status', 'active')
|
|
168592
|
+
.andWhere(function () {
|
|
168593
|
+
this.where(function () {
|
|
168594
|
+
this.where('is_recurring', bFalse)
|
|
168595
|
+
.whereNotNull('run_at')
|
|
168596
|
+
.where('run_at', '<=', ts);
|
|
168597
|
+
}).orWhere(function () {
|
|
168598
|
+
this.where('is_recurring', bTrue)
|
|
168599
|
+
.whereNotNull('next_run_at')
|
|
168600
|
+
.where('next_run_at', '<=', ts);
|
|
168601
|
+
});
|
|
168602
|
+
});
|
|
168603
|
+
return rows.map((r) => fromDbRow(r));
|
|
168604
|
+
}
|
|
168605
|
+
async findByWorkflow(creatorId, workflowName) {
|
|
168606
|
+
const knex = this.getKnex();
|
|
168607
|
+
const escaped = workflowName.toLowerCase().replace(/[%_\\]/g, '\\$&');
|
|
168608
|
+
const pattern = `%${escaped}%`;
|
|
168609
|
+
const rows = await knex('schedules')
|
|
168610
|
+
.where('creator_id', creatorId)
|
|
168611
|
+
.where('status', 'active')
|
|
168612
|
+
.whereRaw("LOWER(workflow) LIKE ? ESCAPE '\\'", [pattern]);
|
|
168613
|
+
return rows.map((r) => fromDbRow(r));
|
|
168614
|
+
}
|
|
168615
|
+
async getAll() {
|
|
168616
|
+
const knex = this.getKnex();
|
|
168617
|
+
const rows = await knex('schedules');
|
|
168618
|
+
return rows.map((r) => fromDbRow(r));
|
|
168619
|
+
}
|
|
168620
|
+
async getStats() {
|
|
168621
|
+
const knex = this.getKnex();
|
|
168622
|
+
// MSSQL uses 1/0 for booleans; PostgreSQL/MySQL accept both true/1
|
|
168623
|
+
const boolTrue = this.driver === 'mssql' ? '1' : 'true';
|
|
168624
|
+
const boolFalse = this.driver === 'mssql' ? '0' : 'false';
|
|
168625
|
+
const result = await knex('schedules')
|
|
168626
|
+
.select(knex.raw('COUNT(*) as total'), knex.raw("SUM(CASE WHEN status = 'active' THEN 1 ELSE 0 END) as active"), knex.raw("SUM(CASE WHEN status = 'paused' THEN 1 ELSE 0 END) as paused"), knex.raw("SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as completed"), knex.raw("SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failed"), knex.raw(`SUM(CASE WHEN is_recurring = ${boolTrue} THEN 1 ELSE 0 END) as recurring`), knex.raw(`SUM(CASE WHEN is_recurring = ${boolFalse} THEN 1 ELSE 0 END) as one_time`))
|
|
168627
|
+
.first();
|
|
168628
|
+
return {
|
|
168629
|
+
total: Number(result.total) || 0,
|
|
168630
|
+
active: Number(result.active) || 0,
|
|
168631
|
+
paused: Number(result.paused) || 0,
|
|
168632
|
+
completed: Number(result.completed) || 0,
|
|
168633
|
+
failed: Number(result.failed) || 0,
|
|
168634
|
+
recurring: Number(result.recurring) || 0,
|
|
168635
|
+
oneTime: Number(result.one_time) || 0,
|
|
168636
|
+
};
|
|
168637
|
+
}
|
|
168638
|
+
async validateLimits(creatorId, isRecurring, limits) {
|
|
168639
|
+
const knex = this.getKnex();
|
|
168640
|
+
if (limits.maxGlobal) {
|
|
168641
|
+
const result = await knex('schedules').count('* as cnt').first();
|
|
168642
|
+
if (Number(result?.cnt) >= limits.maxGlobal) {
|
|
168643
|
+
throw new Error(`Global schedule limit reached (${limits.maxGlobal})`);
|
|
168644
|
+
}
|
|
168645
|
+
}
|
|
168646
|
+
if (limits.maxPerUser) {
|
|
168647
|
+
const result = await knex('schedules')
|
|
168648
|
+
.where('creator_id', creatorId)
|
|
168649
|
+
.count('* as cnt')
|
|
168650
|
+
.first();
|
|
168651
|
+
if (Number(result?.cnt) >= limits.maxPerUser) {
|
|
168652
|
+
throw new Error(`You have reached the maximum number of schedules (${limits.maxPerUser})`);
|
|
168653
|
+
}
|
|
168654
|
+
}
|
|
168655
|
+
if (isRecurring && limits.maxRecurringPerUser) {
|
|
168656
|
+
const bTrue = this.driver === 'mssql' ? 1 : true;
|
|
168657
|
+
const result = await knex('schedules')
|
|
168658
|
+
.where('creator_id', creatorId)
|
|
168659
|
+
.where('is_recurring', bTrue)
|
|
168660
|
+
.count('* as cnt')
|
|
168661
|
+
.first();
|
|
168662
|
+
if (Number(result?.cnt) >= limits.maxRecurringPerUser) {
|
|
168663
|
+
throw new Error(`You have reached the maximum number of recurring schedules (${limits.maxRecurringPerUser})`);
|
|
168664
|
+
}
|
|
168665
|
+
}
|
|
168666
|
+
}
|
|
168667
|
+
// --- HA Distributed Locking (via scheduler_locks table) ---
|
|
168668
|
+
async tryAcquireLock(lockId, nodeId, ttlSeconds) {
|
|
168669
|
+
const knex = this.getKnex();
|
|
168670
|
+
const now = Date.now();
|
|
168671
|
+
const expiresAt = now + ttlSeconds * 1000;
|
|
168672
|
+
const token = (0, uuid_1.v4)();
|
|
168673
|
+
// Step 1: Try to claim an existing expired lock
|
|
168674
|
+
const updated = await knex('scheduler_locks')
|
|
168675
|
+
.where('lock_id', lockId)
|
|
168676
|
+
.where('expires_at', '<', now)
|
|
168677
|
+
.update({
|
|
168678
|
+
node_id: nodeId,
|
|
168679
|
+
lock_token: token,
|
|
168680
|
+
acquired_at: now,
|
|
168681
|
+
expires_at: expiresAt,
|
|
168682
|
+
});
|
|
168683
|
+
if (updated > 0)
|
|
168684
|
+
return token;
|
|
168685
|
+
// Step 2: Try to INSERT a new lock row
|
|
168686
|
+
try {
|
|
168687
|
+
await knex('scheduler_locks').insert({
|
|
168688
|
+
lock_id: lockId,
|
|
168689
|
+
node_id: nodeId,
|
|
168690
|
+
lock_token: token,
|
|
168691
|
+
acquired_at: now,
|
|
168692
|
+
expires_at: expiresAt,
|
|
168693
|
+
});
|
|
168694
|
+
return token;
|
|
168695
|
+
}
|
|
168696
|
+
catch {
|
|
168697
|
+
// Unique constraint violation — another node holds the lock
|
|
168698
|
+
return null;
|
|
168699
|
+
}
|
|
168700
|
+
}
|
|
168701
|
+
async releaseLock(lockId, lockToken) {
|
|
168702
|
+
const knex = this.getKnex();
|
|
168703
|
+
await knex('scheduler_locks').where('lock_id', lockId).where('lock_token', lockToken).del();
|
|
168704
|
+
}
|
|
168705
|
+
async renewLock(lockId, lockToken, ttlSeconds) {
|
|
168706
|
+
const knex = this.getKnex();
|
|
168707
|
+
const now = Date.now();
|
|
168708
|
+
const expiresAt = now + ttlSeconds * 1000;
|
|
168709
|
+
const updated = await knex('scheduler_locks')
|
|
168710
|
+
.where('lock_id', lockId)
|
|
168711
|
+
.where('lock_token', lockToken)
|
|
168712
|
+
.update({ acquired_at: now, expires_at: expiresAt });
|
|
168713
|
+
return updated > 0;
|
|
168714
|
+
}
|
|
168715
|
+
async flush() {
|
|
168716
|
+
// No-op for server-based backends
|
|
168717
|
+
}
|
|
168718
|
+
}
|
|
168719
|
+
exports.KnexStoreBackend = KnexStoreBackend;
|
|
168720
|
+
|
|
168721
|
+
|
|
167015
168722
|
/***/ }),
|
|
167016
168723
|
|
|
167017
168724
|
/***/ 83864:
|
|
@@ -172580,9 +174287,16 @@ exports.createAuthenticatedOctokit = createAuthenticatedOctokit;
|
|
|
172580
174287
|
exports.resolveAuthFromEnvironment = resolveAuthFromEnvironment;
|
|
172581
174288
|
exports.resolvePrivateKey = resolvePrivateKey;
|
|
172582
174289
|
exports.injectGitHubCredentials = injectGitHubCredentials;
|
|
174290
|
+
exports.markTokenFresh = markTokenFresh;
|
|
174291
|
+
exports.refreshGitHubCredentials = refreshGitHubCredentials;
|
|
174292
|
+
exports.startTokenRefreshTimer = startTokenRefreshTimer;
|
|
174293
|
+
exports.stopTokenRefreshTimer = stopTokenRefreshTimer;
|
|
174294
|
+
exports._testSetCachedToken = _testSetCachedToken;
|
|
174295
|
+
exports._testGetCachedToken = _testGetCachedToken;
|
|
172583
174296
|
const rest_1 = __nccwpck_require__(47432);
|
|
172584
174297
|
const fs = __importStar(__nccwpck_require__(79896));
|
|
172585
174298
|
const path = __importStar(__nccwpck_require__(16928));
|
|
174299
|
+
const logger_1 = __nccwpck_require__(86999);
|
|
172586
174300
|
/**
|
|
172587
174301
|
* Create an authenticated Octokit instance.
|
|
172588
174302
|
* Returns undefined if no credentials are provided (auth is optional in CLI mode).
|
|
@@ -172681,6 +174395,11 @@ function resolvePrivateKey(keyOrPath) {
|
|
|
172681
174395
|
// Return as-is and let the auth library handle errors
|
|
172682
174396
|
return keyOrPath;
|
|
172683
174397
|
}
|
|
174398
|
+
// Track our auth entries position so repeated calls replace instead of stacking.
|
|
174399
|
+
// _authBase: the GIT_CONFIG index where our 2 auth entries start.
|
|
174400
|
+
// _lastWrittenCount: what we last set GIT_CONFIG_COUNT to (detects external changes).
|
|
174401
|
+
let _authBase;
|
|
174402
|
+
let _lastWrittenCount;
|
|
172684
174403
|
/**
|
|
172685
174404
|
* Inject GitHub credentials into process.env for child processes.
|
|
172686
174405
|
*
|
|
@@ -172692,22 +174411,148 @@ function resolvePrivateKey(keyOrPath) {
|
|
|
172692
174411
|
* - No temp files or global config mutation
|
|
172693
174412
|
* - Inherited by all child processes automatically
|
|
172694
174413
|
* - Works regardless of local git configuration
|
|
174414
|
+
*
|
|
174415
|
+
* Safe to call multiple times (e.g. on token refresh) — replaces previous entries.
|
|
172695
174416
|
*/
|
|
172696
174417
|
function injectGitHubCredentials(token) {
|
|
172697
174418
|
// Set for gh CLI and general GitHub API usage
|
|
172698
174419
|
process.env.GITHUB_TOKEN = token;
|
|
172699
174420
|
process.env.GH_TOKEN = token;
|
|
174421
|
+
const currentCount = parseInt(process.env.GIT_CONFIG_COUNT || '0', 10);
|
|
174422
|
+
// Determine where to write our 2 auth entries:
|
|
174423
|
+
// - First call: append after any pre-existing entries
|
|
174424
|
+
// - Subsequent calls with unchanged count: overwrite at same position
|
|
174425
|
+
// - If count changed externally: someone added entries, append after them
|
|
174426
|
+
let base;
|
|
174427
|
+
if (_authBase === undefined) {
|
|
174428
|
+
base = currentCount;
|
|
174429
|
+
}
|
|
174430
|
+
else if (_lastWrittenCount !== undefined && currentCount !== _lastWrittenCount) {
|
|
174431
|
+
base = currentCount;
|
|
174432
|
+
}
|
|
174433
|
+
else {
|
|
174434
|
+
base = _authBase;
|
|
174435
|
+
}
|
|
174436
|
+
_authBase = base;
|
|
172700
174437
|
// Configure git HTTPS auth via url.<base>.insteadOf
|
|
172701
|
-
// This rewrites all github.com URLs to include the access token
|
|
172702
|
-
const existingCount = parseInt(process.env.GIT_CONFIG_COUNT || '0', 10);
|
|
172703
174438
|
const authUrl = `https://x-access-token:${token}@github.com/`;
|
|
172704
174439
|
// Rewrite HTTPS URLs
|
|
172705
|
-
process.env[`GIT_CONFIG_KEY_${
|
|
172706
|
-
process.env[`GIT_CONFIG_VALUE_${
|
|
174440
|
+
process.env[`GIT_CONFIG_KEY_${base}`] = `url.${authUrl}.insteadOf`;
|
|
174441
|
+
process.env[`GIT_CONFIG_VALUE_${base}`] = 'https://github.com/';
|
|
172707
174442
|
// Rewrite SSH-style URLs (git@github.com:org/repo)
|
|
172708
|
-
process.env[`GIT_CONFIG_KEY_${
|
|
172709
|
-
process.env[`GIT_CONFIG_VALUE_${
|
|
172710
|
-
|
|
174443
|
+
process.env[`GIT_CONFIG_KEY_${base + 1}`] = `url.${authUrl}.insteadOf`;
|
|
174444
|
+
process.env[`GIT_CONFIG_VALUE_${base + 1}`] = 'git@github.com:';
|
|
174445
|
+
const newCount = base + 2;
|
|
174446
|
+
process.env.GIT_CONFIG_COUNT = String(newCount);
|
|
174447
|
+
_lastWrittenCount = newCount;
|
|
174448
|
+
}
|
|
174449
|
+
/**
|
|
174450
|
+
* Mark the current token as freshly generated (for use after initial startup auth).
|
|
174451
|
+
* Prevents the first refreshGitHubCredentials() call from unnecessarily regenerating.
|
|
174452
|
+
*/
|
|
174453
|
+
function markTokenFresh() {
|
|
174454
|
+
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
174455
|
+
if (token) {
|
|
174456
|
+
_cachedAppToken = { token, generatedAt: Date.now() };
|
|
174457
|
+
}
|
|
174458
|
+
}
|
|
174459
|
+
// Cached token with generation timestamp for expiry checks
|
|
174460
|
+
let _cachedAppToken;
|
|
174461
|
+
// Installation tokens live 1 hour; refresh after 45 minutes.
|
|
174462
|
+
// Using 45 min (not 50) leaves a 15-minute buffer for long-running tasks
|
|
174463
|
+
// that start right before a refresh cycle.
|
|
174464
|
+
const TOKEN_REFRESH_MS = 45 * 60 * 1000;
|
|
174465
|
+
// Background refresh timer
|
|
174466
|
+
let _refreshTimer;
|
|
174467
|
+
// How often the background timer checks (30 minutes)
|
|
174468
|
+
const TIMER_INTERVAL_MS = 30 * 60 * 1000;
|
|
174469
|
+
/**
|
|
174470
|
+
* Refresh GitHub App installation credentials if they are about to expire.
|
|
174471
|
+
*
|
|
174472
|
+
* No-op when:
|
|
174473
|
+
* - No GitHub App credentials are configured (GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY)
|
|
174474
|
+
* - The current token was generated less than 45 minutes ago
|
|
174475
|
+
*
|
|
174476
|
+
* Call this before each execution in long-running processes (Slack bot, scheduler)
|
|
174477
|
+
* to ensure child processes always have a valid token for git/gh operations.
|
|
174478
|
+
*/
|
|
174479
|
+
async function refreshGitHubCredentials() {
|
|
174480
|
+
// Quick check: do we have App credentials?
|
|
174481
|
+
const appId = process.env.GITHUB_APP_ID;
|
|
174482
|
+
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY;
|
|
174483
|
+
if (!appId || !privateKey)
|
|
174484
|
+
return;
|
|
174485
|
+
// Skip if cached token is still fresh
|
|
174486
|
+
const now = Date.now();
|
|
174487
|
+
if (_cachedAppToken && now - _cachedAppToken.generatedAt < TOKEN_REFRESH_MS) {
|
|
174488
|
+
return;
|
|
174489
|
+
}
|
|
174490
|
+
try {
|
|
174491
|
+
const opts = resolveAuthFromEnvironment();
|
|
174492
|
+
const result = await createAuthenticatedOctokit(opts);
|
|
174493
|
+
if (result && result.authType === 'github-app') {
|
|
174494
|
+
injectGitHubCredentials(result.token);
|
|
174495
|
+
_cachedAppToken = { token: result.token, generatedAt: now };
|
|
174496
|
+
logger_1.logger.debug('[github-auth] Refreshed GitHub App installation token');
|
|
174497
|
+
}
|
|
174498
|
+
}
|
|
174499
|
+
catch (err) {
|
|
174500
|
+
const age = _cachedAppToken
|
|
174501
|
+
? `${Math.round((now - _cachedAppToken.generatedAt) / 60000)}min old`
|
|
174502
|
+
: 'no cached token';
|
|
174503
|
+
logger_1.logger.warn(`[github-auth] Failed to refresh GitHub App token (${age}): ${err instanceof Error ? err.message : String(err)}. ` +
|
|
174504
|
+
'Child processes may fail with authentication errors.');
|
|
174505
|
+
}
|
|
174506
|
+
}
|
|
174507
|
+
/**
|
|
174508
|
+
* Start a background timer that refreshes GitHub App tokens every 30 minutes.
|
|
174509
|
+
*
|
|
174510
|
+
* This ensures tokens stay fresh even during long-running tasks (e.g., an engineer
|
|
174511
|
+
* task that takes 40+ minutes). Without this, a token generated at startup could
|
|
174512
|
+
* expire mid-execution of a child process.
|
|
174513
|
+
*
|
|
174514
|
+
* The timer is unref'd so it doesn't prevent Node from exiting.
|
|
174515
|
+
* Call stopTokenRefreshTimer() on shutdown.
|
|
174516
|
+
*/
|
|
174517
|
+
function startTokenRefreshTimer() {
|
|
174518
|
+
if (_refreshTimer)
|
|
174519
|
+
return; // Already running
|
|
174520
|
+
// Only start if we have App credentials
|
|
174521
|
+
const appId = process.env.GITHUB_APP_ID;
|
|
174522
|
+
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY;
|
|
174523
|
+
if (!appId || !privateKey)
|
|
174524
|
+
return;
|
|
174525
|
+
_refreshTimer = setInterval(() => {
|
|
174526
|
+
refreshGitHubCredentials().catch(err => {
|
|
174527
|
+
logger_1.logger.warn(`[github-auth] Background token refresh failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
174528
|
+
});
|
|
174529
|
+
}, TIMER_INTERVAL_MS);
|
|
174530
|
+
// Don't prevent Node from exiting
|
|
174531
|
+
_refreshTimer.unref();
|
|
174532
|
+
logger_1.logger.debug('[github-auth] Background token refresh timer started (every 30 min)');
|
|
174533
|
+
}
|
|
174534
|
+
/**
|
|
174535
|
+
* Stop the background token refresh timer.
|
|
174536
|
+
*/
|
|
174537
|
+
function stopTokenRefreshTimer() {
|
|
174538
|
+
if (_refreshTimer) {
|
|
174539
|
+
clearInterval(_refreshTimer);
|
|
174540
|
+
_refreshTimer = undefined;
|
|
174541
|
+
logger_1.logger.debug('[github-auth] Background token refresh timer stopped');
|
|
174542
|
+
}
|
|
174543
|
+
}
|
|
174544
|
+
/** Visible for testing: override the cached token state. */
|
|
174545
|
+
function _testSetCachedToken(token, generatedAt) {
|
|
174546
|
+
if (token) {
|
|
174547
|
+
_cachedAppToken = { token, generatedAt: generatedAt ?? Date.now() };
|
|
174548
|
+
}
|
|
174549
|
+
else {
|
|
174550
|
+
_cachedAppToken = undefined;
|
|
174551
|
+
}
|
|
174552
|
+
}
|
|
174553
|
+
/** Visible for testing: get the current cached token info. */
|
|
174554
|
+
function _testGetCachedToken() {
|
|
174555
|
+
return _cachedAppToken;
|
|
172711
174556
|
}
|
|
172712
174557
|
|
|
172713
174558
|
|
|
@@ -177693,6 +179538,35 @@ class OutputFormatters {
|
|
|
177693
179538
|
exports.OutputFormatters = OutputFormatters;
|
|
177694
179539
|
|
|
177695
179540
|
|
|
179541
|
+
/***/ }),
|
|
179542
|
+
|
|
179543
|
+
/***/ 93866:
|
|
179544
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
179545
|
+
|
|
179546
|
+
"use strict";
|
|
179547
|
+
|
|
179548
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
179549
|
+
exports.DefaultPolicyEngine = void 0;
|
|
179550
|
+
/**
|
|
179551
|
+
* Default (no-op) policy engine — always allows everything.
|
|
179552
|
+
* Used when no enterprise license is present or policy is disabled.
|
|
179553
|
+
*/
|
|
179554
|
+
class DefaultPolicyEngine {
|
|
179555
|
+
async initialize(_config) { }
|
|
179556
|
+
async evaluateCheckExecution(_checkId, _checkConfig) {
|
|
179557
|
+
return { allowed: true };
|
|
179558
|
+
}
|
|
179559
|
+
async evaluateToolInvocation(_serverName, _methodName, _transport) {
|
|
179560
|
+
return { allowed: true };
|
|
179561
|
+
}
|
|
179562
|
+
async evaluateCapabilities(_checkId, _capabilities) {
|
|
179563
|
+
return { allowed: true };
|
|
179564
|
+
}
|
|
179565
|
+
async shutdown() { }
|
|
179566
|
+
}
|
|
179567
|
+
exports.DefaultPolicyEngine = DefaultPolicyEngine;
|
|
179568
|
+
|
|
179569
|
+
|
|
177696
179570
|
/***/ }),
|
|
177697
179571
|
|
|
177698
179572
|
/***/ 96611:
|
|
@@ -190216,10 +192090,12 @@ class BubblewrapSandbox {
|
|
|
190216
192090
|
name;
|
|
190217
192091
|
config;
|
|
190218
192092
|
repoPath;
|
|
190219
|
-
|
|
192093
|
+
visorDistPath;
|
|
192094
|
+
constructor(name, config, repoPath, visorDistPath) {
|
|
190220
192095
|
this.name = name;
|
|
190221
192096
|
this.config = config;
|
|
190222
192097
|
this.repoPath = (0, path_1.resolve)(repoPath);
|
|
192098
|
+
this.visorDistPath = (0, path_1.resolve)(visorDistPath);
|
|
190223
192099
|
}
|
|
190224
192100
|
/**
|
|
190225
192101
|
* Check if bwrap binary is available on the system.
|
|
@@ -190308,6 +192184,9 @@ class BubblewrapSandbox {
|
|
|
190308
192184
|
else {
|
|
190309
192185
|
args.push('--bind', this.repoPath, workdir);
|
|
190310
192186
|
}
|
|
192187
|
+
// Visor dist mount (read-only) — required for child visor process
|
|
192188
|
+
const visorPath = this.config.visor_path || '/opt/visor';
|
|
192189
|
+
args.push('--ro-bind', this.visorDistPath, visorPath);
|
|
190311
192190
|
// Working directory inside sandbox
|
|
190312
192191
|
args.push('--chdir', workdir);
|
|
190313
192192
|
// Namespace isolation
|
|
@@ -191229,14 +193108,14 @@ class SandboxManager {
|
|
|
191229
193108
|
// Bubblewrap engine: ephemeral per-exec, no persistent container
|
|
191230
193109
|
if (config.engine === 'bubblewrap') {
|
|
191231
193110
|
const { BubblewrapSandbox } = __nccwpck_require__(11207);
|
|
191232
|
-
const instance = new BubblewrapSandbox(name, config, this.repoPath);
|
|
193111
|
+
const instance = new BubblewrapSandbox(name, config, this.repoPath, this.visorDistPath);
|
|
191233
193112
|
this.instances.set(name, instance);
|
|
191234
193113
|
return instance;
|
|
191235
193114
|
}
|
|
191236
193115
|
// Seatbelt engine: macOS sandbox-exec, ephemeral per-exec
|
|
191237
193116
|
if (config.engine === 'seatbelt') {
|
|
191238
193117
|
const { SeatbeltSandbox } = __nccwpck_require__(46429);
|
|
191239
|
-
const instance = new SeatbeltSandbox(name, config, this.repoPath);
|
|
193118
|
+
const instance = new SeatbeltSandbox(name, config, this.repoPath, this.visorDistPath);
|
|
191240
193119
|
this.instances.set(name, instance);
|
|
191241
193120
|
return instance;
|
|
191242
193121
|
}
|
|
@@ -191395,12 +193274,14 @@ class SeatbeltSandbox {
|
|
|
191395
193274
|
name;
|
|
191396
193275
|
config;
|
|
191397
193276
|
repoPath;
|
|
191398
|
-
|
|
193277
|
+
visorDistPath;
|
|
193278
|
+
constructor(name, config, repoPath, visorDistPath) {
|
|
191399
193279
|
this.name = name;
|
|
191400
193280
|
this.config = config;
|
|
191401
193281
|
// Resolve symlinks — macOS has /var → /private/var, /tmp → /private/tmp etc.
|
|
191402
193282
|
// sandbox-exec operates on real paths, so we must resolve before building profiles.
|
|
191403
193283
|
this.repoPath = (0, fs_1.realpathSync)((0, path_1.resolve)(repoPath));
|
|
193284
|
+
this.visorDistPath = (0, fs_1.realpathSync)((0, path_1.resolve)(visorDistPath));
|
|
191404
193285
|
}
|
|
191405
193286
|
/**
|
|
191406
193287
|
* Check if sandbox-exec binary is available on the system.
|
|
@@ -191513,6 +193394,9 @@ class SeatbeltSandbox {
|
|
|
191513
193394
|
if (!this.config.read_only) {
|
|
191514
193395
|
lines.push(`(allow file-write* (subpath "${repoPath}"))`);
|
|
191515
193396
|
}
|
|
193397
|
+
// Visor dist read access — required for child visor process
|
|
193398
|
+
const visorDistPath = this.escapePath(this.visorDistPath);
|
|
193399
|
+
lines.push(`(allow file-read* (subpath "${visorDistPath}"))`);
|
|
191516
193400
|
// Network access (unless explicitly disabled)
|
|
191517
193401
|
if (this.config.network !== false) {
|
|
191518
193402
|
lines.push('(allow network*)');
|
|
@@ -193714,6 +195598,39 @@ function buildScheduleToolContext(sources, availableWorkflows, permissions, outp
|
|
|
193714
195598
|
|
|
193715
195599
|
"use strict";
|
|
193716
195600
|
|
|
195601
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
195602
|
+
if (k2 === undefined) k2 = k;
|
|
195603
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
195604
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
195605
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
195606
|
+
}
|
|
195607
|
+
Object.defineProperty(o, k2, desc);
|
|
195608
|
+
}) : (function(o, m, k, k2) {
|
|
195609
|
+
if (k2 === undefined) k2 = k;
|
|
195610
|
+
o[k2] = m[k];
|
|
195611
|
+
}));
|
|
195612
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
195613
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
195614
|
+
}) : function(o, v) {
|
|
195615
|
+
o["default"] = v;
|
|
195616
|
+
});
|
|
195617
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
195618
|
+
var ownKeys = function(o) {
|
|
195619
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
195620
|
+
var ar = [];
|
|
195621
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
195622
|
+
return ar;
|
|
195623
|
+
};
|
|
195624
|
+
return ownKeys(o);
|
|
195625
|
+
};
|
|
195626
|
+
return function (mod) {
|
|
195627
|
+
if (mod && mod.__esModule) return mod;
|
|
195628
|
+
var result = {};
|
|
195629
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
195630
|
+
__setModuleDefault(result, mod);
|
|
195631
|
+
return result;
|
|
195632
|
+
};
|
|
195633
|
+
})();
|
|
193717
195634
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
193718
195635
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
193719
195636
|
};
|
|
@@ -194305,6 +196222,12 @@ class Scheduler {
|
|
|
194305
196222
|
const webhookData = new Map();
|
|
194306
196223
|
const endpoint = '/scheduler/trigger';
|
|
194307
196224
|
webhookData.set(endpoint, syntheticPayload);
|
|
196225
|
+
// Refresh GitHub App installation token (no-op if not using App auth or still fresh)
|
|
196226
|
+
try {
|
|
196227
|
+
const { refreshGitHubCredentials } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
196228
|
+
await refreshGitHubCredentials();
|
|
196229
|
+
}
|
|
196230
|
+
catch { }
|
|
194308
196231
|
// Use common preparation helper
|
|
194309
196232
|
const { engine: runEngine, config: cfgForRun } = this.prepareExecution(schedule);
|
|
194310
196233
|
// Execute the workflow
|
|
@@ -194419,6 +196342,12 @@ Please provide an updated response based on the reminder above. You may referenc
|
|
|
194419
196342
|
logger_1.logger.warn(`[Scheduler] Execution preparation failed: ${error instanceof Error ? error.message : error}`);
|
|
194420
196343
|
}
|
|
194421
196344
|
}
|
|
196345
|
+
// Refresh GitHub App installation token (no-op if not using App auth or still fresh)
|
|
196346
|
+
try {
|
|
196347
|
+
const { refreshGitHubCredentials } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
196348
|
+
await refreshGitHubCredentials();
|
|
196349
|
+
}
|
|
196350
|
+
catch { }
|
|
194422
196351
|
// Use common execution helper
|
|
194423
196352
|
const { engine: runEngine, config: cfgForRun, responseRef, } = this.prepareExecution(schedule, reminderText);
|
|
194424
196353
|
try {
|
|
@@ -197230,6 +199159,12 @@ class SlackSocketRunner {
|
|
|
197230
199159
|
catch (e) {
|
|
197231
199160
|
logger_1.logger.warn(`[SlackSocket] Scheduler init failed: ${e instanceof Error ? e.message : e}`);
|
|
197232
199161
|
}
|
|
199162
|
+
// Start background GitHub App token refresh timer (no-op if no App credentials)
|
|
199163
|
+
try {
|
|
199164
|
+
const { startTokenRefreshTimer } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
199165
|
+
startTokenRefreshTimer();
|
|
199166
|
+
}
|
|
199167
|
+
catch { }
|
|
197233
199168
|
const url = await this.openConnection();
|
|
197234
199169
|
await this.connect(url);
|
|
197235
199170
|
// Clean up stale workspace directories from previous runs
|
|
@@ -197559,6 +199494,13 @@ class SlackSocketRunner {
|
|
|
197559
199494
|
mgr.setFirstMessage(ch, rootTs, cleaned);
|
|
197560
199495
|
}
|
|
197561
199496
|
catch { }
|
|
199497
|
+
// Refresh GitHub App installation token before each run.
|
|
199498
|
+
// Installation tokens expire after 1 hour; this is a no-op if still fresh.
|
|
199499
|
+
try {
|
|
199500
|
+
const { refreshGitHubCredentials } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
199501
|
+
await refreshGitHubCredentials();
|
|
199502
|
+
}
|
|
199503
|
+
catch { }
|
|
197562
199504
|
logger_1.logger.info('[SlackSocket] Dispatching engine run for Slack event');
|
|
197563
199505
|
try {
|
|
197564
199506
|
// Rate limiting (optional)
|
|
@@ -197651,6 +199593,12 @@ class SlackSocketRunner {
|
|
|
197651
199593
|
* Stop the socket runner and clean up resources
|
|
197652
199594
|
*/
|
|
197653
199595
|
async stop() {
|
|
199596
|
+
// Stop background GitHub App token refresh
|
|
199597
|
+
try {
|
|
199598
|
+
const { stopTokenRefreshTimer } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(11347)));
|
|
199599
|
+
stopTokenRefreshTimer();
|
|
199600
|
+
}
|
|
199601
|
+
catch { }
|
|
197654
199602
|
// Stop the generic scheduler if active
|
|
197655
199603
|
if (this.genericScheduler) {
|
|
197656
199604
|
try {
|
|
@@ -198286,7 +200234,7 @@ class StateMachineExecutionEngine {
|
|
|
198286
200234
|
try {
|
|
198287
200235
|
logger_1.logger.debug(`[PolicyEngine] Loading enterprise policy engine (engine=${configWithTagFilter.policy.engine})`);
|
|
198288
200236
|
// @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
|
|
198289
|
-
const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(
|
|
200237
|
+
const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(87068)));
|
|
198290
200238
|
context.policyEngine = await loadEnterprisePolicyEngine(configWithTagFilter.policy);
|
|
198291
200239
|
logger_1.logger.debug(`[PolicyEngine] Initialized: ${context.policyEngine?.constructor?.name || 'unknown'}`);
|
|
198292
200240
|
}
|
|
@@ -208550,7 +210498,7 @@ async function initTelemetry(opts = {}) {
|
|
|
208550
210498
|
const path = __nccwpck_require__(16928);
|
|
208551
210499
|
const outDir = opts.file?.dir ||
|
|
208552
210500
|
process.env.VISOR_TRACE_DIR ||
|
|
208553
|
-
|
|
210501
|
+
path.join(process.cwd(), 'output', 'traces');
|
|
208554
210502
|
fs.mkdirSync(outDir, { recursive: true });
|
|
208555
210503
|
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
|
208556
210504
|
process.env.VISOR_FALLBACK_TRACE_FILE = path.join(outDir, `run-${ts}.ndjson`);
|
|
@@ -208755,7 +210703,7 @@ async function shutdownTelemetry() {
|
|
|
208755
210703
|
if (process.env.VISOR_TRACE_REPORT === 'true') {
|
|
208756
210704
|
const fs = __nccwpck_require__(79896);
|
|
208757
210705
|
const path = __nccwpck_require__(16928);
|
|
208758
|
-
const outDir = process.env.VISOR_TRACE_DIR ||
|
|
210706
|
+
const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
|
|
208759
210707
|
if (!fs.existsSync(outDir))
|
|
208760
210708
|
fs.mkdirSync(outDir, { recursive: true });
|
|
208761
210709
|
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
|
@@ -209254,7 +211202,7 @@ function __getOrCreateNdjsonPath() {
|
|
|
209254
211202
|
fs.mkdirSync(dir, { recursive: true });
|
|
209255
211203
|
return __ndjsonPath;
|
|
209256
211204
|
}
|
|
209257
|
-
const outDir = process.env.VISOR_TRACE_DIR ||
|
|
211205
|
+
const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
|
|
209258
211206
|
if (!fs.existsSync(outDir))
|
|
209259
211207
|
fs.mkdirSync(outDir, { recursive: true });
|
|
209260
211208
|
if (!__ndjsonPath) {
|
|
@@ -209831,7 +211779,8 @@ class FlowStage {
|
|
|
209831
211779
|
defaultIncludeTags;
|
|
209832
211780
|
defaultExcludeTags;
|
|
209833
211781
|
defaultFrontends;
|
|
209834
|
-
|
|
211782
|
+
noMocks;
|
|
211783
|
+
constructor(flowName, engine, recorder, cfg, prompts, promptCap, mapEventFromFixtureName, computeChecksToRun, printStageHeader, printSelectedChecks, warnUnmockedProviders, defaultIncludeTags, defaultExcludeTags, defaultFrontends, noMocks) {
|
|
209835
211784
|
this.flowName = flowName;
|
|
209836
211785
|
this.engine = engine;
|
|
209837
211786
|
this.recorder = recorder;
|
|
@@ -209846,6 +211795,7 @@ class FlowStage {
|
|
|
209846
211795
|
this.defaultIncludeTags = defaultIncludeTags;
|
|
209847
211796
|
this.defaultExcludeTags = defaultExcludeTags;
|
|
209848
211797
|
this.defaultFrontends = defaultFrontends;
|
|
211798
|
+
this.noMocks = noMocks;
|
|
209849
211799
|
}
|
|
209850
211800
|
async run(stage, flowCase, strict) {
|
|
209851
211801
|
const fixtureInput = typeof stage.fixture === 'object' && stage.fixture
|
|
@@ -209886,7 +211836,17 @@ class FlowStage {
|
|
|
209886
211836
|
this.prompts[k].push(p);
|
|
209887
211837
|
// prompts are captured for assertions only — no ad-hoc console/file output
|
|
209888
211838
|
},
|
|
209889
|
-
mockForStep: (step) =>
|
|
211839
|
+
mockForStep: (step) => {
|
|
211840
|
+
if (this.noMocks)
|
|
211841
|
+
return undefined;
|
|
211842
|
+
const raw = mockMgr.get(step);
|
|
211843
|
+
// Strip tool_calls from mock value — handled separately for stageHist injection
|
|
211844
|
+
if (raw && typeof raw === 'object' && 'tool_calls' in raw) {
|
|
211845
|
+
const { tool_calls: _unused, ...rest } = raw; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
211846
|
+
return rest;
|
|
211847
|
+
}
|
|
211848
|
+
return raw;
|
|
211849
|
+
},
|
|
209890
211850
|
},
|
|
209891
211851
|
});
|
|
209892
211852
|
// (debug cleanup) removed stage-debug prints
|
|
@@ -210052,6 +212012,26 @@ class FlowStage {
|
|
|
210052
212012
|
for (const [k, arr] of Object.entries(outHistory || {})) {
|
|
210053
212013
|
stageHist[k] = Array.isArray(arr) ? arr : [];
|
|
210054
212014
|
}
|
|
212015
|
+
// Inject synthetic outputHistory entries for tool_calls declared in mocks.
|
|
212016
|
+
// When a mock (e.g. generate-response) declares tool_calls, the AI never runs
|
|
212017
|
+
// and no workflow tools are invoked. This injects entries so the evaluator
|
|
212018
|
+
// counts them as executed steps, enabling at_least assertions in mock mode.
|
|
212019
|
+
if (!this.noMocks) {
|
|
212020
|
+
for (const [, mockVal] of Object.entries(mergedMocks)) {
|
|
212021
|
+
if (mockVal && typeof mockVal === 'object' && 'tool_calls' in mockVal) {
|
|
212022
|
+
const toolCalls = mockVal.tool_calls;
|
|
212023
|
+
if (Array.isArray(toolCalls)) {
|
|
212024
|
+
for (const tc of toolCalls) {
|
|
212025
|
+
if (tc && typeof tc === 'object' && typeof tc.step === 'string') {
|
|
212026
|
+
if (!stageHist[tc.step])
|
|
212027
|
+
stageHist[tc.step] = [];
|
|
212028
|
+
stageHist[tc.step].push(tc.output !== undefined ? tc.output : {});
|
|
212029
|
+
}
|
|
212030
|
+
}
|
|
212031
|
+
}
|
|
212032
|
+
}
|
|
212033
|
+
}
|
|
212034
|
+
}
|
|
210055
212035
|
try {
|
|
210056
212036
|
if (process.env.VISOR_DEBUG === 'true') {
|
|
210057
212037
|
const parts = Object.entries(stageHist)
|
|
@@ -211062,6 +213042,7 @@ exports.runMvp = runMvp;
|
|
|
211062
213042
|
exports.validateTestsOnly = validateTestsOnly;
|
|
211063
213043
|
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
|
211064
213044
|
const path_1 = __importDefault(__nccwpck_require__(16928));
|
|
213045
|
+
const child_process_1 = __nccwpck_require__(35317);
|
|
211065
213046
|
const yaml = __importStar(__nccwpck_require__(74281));
|
|
211066
213047
|
const config_1 = __nccwpck_require__(22973);
|
|
211067
213048
|
const state_machine_execution_engine_1 = __nccwpck_require__(39004);
|
|
@@ -211291,6 +213272,36 @@ async function runSuites(files, options) {
|
|
|
211291
213272
|
function isObject(v) {
|
|
211292
213273
|
return !!v && typeof v === 'object' && !Array.isArray(v);
|
|
211293
213274
|
}
|
|
213275
|
+
function checkRequirements(requires) {
|
|
213276
|
+
if (!requires)
|
|
213277
|
+
return { met: true };
|
|
213278
|
+
const reqs = Array.isArray(requires) ? requires : [requires];
|
|
213279
|
+
for (const req of reqs) {
|
|
213280
|
+
switch (req.toLowerCase()) {
|
|
213281
|
+
case 'linux':
|
|
213282
|
+
if (process.platform !== 'linux')
|
|
213283
|
+
return { met: false, reason: `requires linux (got ${process.platform})` };
|
|
213284
|
+
break;
|
|
213285
|
+
case 'darwin':
|
|
213286
|
+
if (process.platform !== 'darwin')
|
|
213287
|
+
return { met: false, reason: `requires darwin (got ${process.platform})` };
|
|
213288
|
+
break;
|
|
213289
|
+
case 'windows':
|
|
213290
|
+
if (process.platform !== 'win32')
|
|
213291
|
+
return { met: false, reason: `requires windows (got ${process.platform})` };
|
|
213292
|
+
break;
|
|
213293
|
+
default:
|
|
213294
|
+
// Treat as tool name — check availability via `which`
|
|
213295
|
+
try {
|
|
213296
|
+
(0, child_process_1.execFileSync)('which', [req], { timeout: 5000, stdio: 'ignore' });
|
|
213297
|
+
}
|
|
213298
|
+
catch {
|
|
213299
|
+
return { met: false, reason: `'${req}' not found in PATH` };
|
|
213300
|
+
}
|
|
213301
|
+
}
|
|
213302
|
+
}
|
|
213303
|
+
return { met: true };
|
|
213304
|
+
}
|
|
211294
213305
|
class VisorTestRunner {
|
|
211295
213306
|
cwd;
|
|
211296
213307
|
constructor(cwd = process.cwd()) {
|
|
@@ -211807,7 +213818,11 @@ class VisorTestRunner {
|
|
|
211807
213818
|
const defaultIncludeTags = parseTags(defaultsAny?.tags);
|
|
211808
213819
|
const defaultExcludeTags = parseTags(defaultsAny?.exclude_tags);
|
|
211809
213820
|
// Test overrides: force AI provider to 'mock' when requested (default: mock per RFC)
|
|
213821
|
+
// In --no-mocks mode, skip the mock provider override so real AI providers execute.
|
|
211810
213822
|
const cfg = JSON.parse(JSON.stringify(config));
|
|
213823
|
+
const noMocksAll = options.noMocks || false;
|
|
213824
|
+
const noMocksForAi = !noMocksAll && options.noMocksFor ? options.noMocksFor.includes('ai') : false;
|
|
213825
|
+
const skipAiMockOverride = noMocksAll || noMocksForAi;
|
|
211811
213826
|
const allowCtxEnv = String(process.env.VISOR_TEST_ALLOW_CODE_CONTEXT || '').toLowerCase() === 'true';
|
|
211812
213827
|
const forceNoCtxEnv = String(process.env.VISOR_TEST_FORCE_NO_CODE_CONTEXT || '').toLowerCase() === 'true';
|
|
211813
213828
|
for (const name of Object.keys(cfg.checks || {})) {
|
|
@@ -211821,13 +213836,23 @@ class VisorTestRunner {
|
|
|
211821
213836
|
: allowCtxEnv
|
|
211822
213837
|
? false
|
|
211823
213838
|
: prev.skip_code_context;
|
|
211824
|
-
|
|
211825
|
-
|
|
211826
|
-
|
|
211827
|
-
|
|
211828
|
-
|
|
211829
|
-
|
|
211830
|
-
|
|
213839
|
+
if (skipAiMockOverride) {
|
|
213840
|
+
// --no-mocks or --no-mocks-for ai: keep the original provider/timeout/tools,
|
|
213841
|
+
// only apply code-context overrides if requested.
|
|
213842
|
+
chk.ai = {
|
|
213843
|
+
...prev,
|
|
213844
|
+
...(skipCtx === undefined ? {} : { skip_code_context: skipCtx }),
|
|
213845
|
+
};
|
|
213846
|
+
}
|
|
213847
|
+
else {
|
|
213848
|
+
chk.ai = {
|
|
213849
|
+
...prev,
|
|
213850
|
+
provider: aiProviderDefault,
|
|
213851
|
+
...(skipCtx === undefined ? {} : { skip_code_context: skipCtx }),
|
|
213852
|
+
disable_tools: true,
|
|
213853
|
+
timeout: Math.min(15000, prev.timeout || 15000),
|
|
213854
|
+
};
|
|
213855
|
+
}
|
|
211831
213856
|
cfg.checks[name] = chk;
|
|
211832
213857
|
}
|
|
211833
213858
|
}
|
|
@@ -211847,7 +213872,12 @@ class VisorTestRunner {
|
|
|
211847
213872
|
console.log(`Suite: ${__suiteRel}`);
|
|
211848
213873
|
if (noMocksMode) {
|
|
211849
213874
|
console.log(this.color('🔴 NO-MOCKS MODE: Running with real providers (no mock injection)', '33'));
|
|
211850
|
-
console.log(this.gray(' Step outputs will be captured and printed as suggested mocks
|
|
213875
|
+
console.log(this.gray(' Step outputs will be captured and printed as suggested mocks'));
|
|
213876
|
+
if (process.env.VISOR_TELEMETRY_ENABLED === 'true') {
|
|
213877
|
+
const traceDir = process.env.VISOR_TRACE_DIR || 'output/traces';
|
|
213878
|
+
console.log(this.gray(` Tracing enabled → ${traceDir}`));
|
|
213879
|
+
}
|
|
213880
|
+
console.log();
|
|
211851
213881
|
}
|
|
211852
213882
|
else if (noMocksForTypes && noMocksForTypes.length > 0) {
|
|
211853
213883
|
console.log(this.color(`🟡 PARTIAL-MOCK MODE: Real providers for: ${noMocksForTypes.join(', ')}`, '33'));
|
|
@@ -211865,8 +213895,14 @@ class VisorTestRunner {
|
|
|
211865
213895
|
caseResults.push({ name: _case.name, passed: true, /* annotate skip */ errors: [] });
|
|
211866
213896
|
return { name: _case.name, failed: 0 };
|
|
211867
213897
|
}
|
|
213898
|
+
const reqResult = checkRequirements(_case.requires);
|
|
213899
|
+
if (!reqResult.met) {
|
|
213900
|
+
console.log(`⏭ SKIP ${_case.name} (${reqResult.reason})`);
|
|
213901
|
+
caseResults.push({ name: _case.name, passed: true, errors: [] });
|
|
213902
|
+
return { name: _case.name, failed: 0 };
|
|
213903
|
+
}
|
|
211868
213904
|
if (Array.isArray(_case.flow) && _case.flow.length > 0) {
|
|
211869
|
-
const flowRes = await this.runFlowCase(_case, cfg, defaultStrict, options.bail || false, defaultPromptCap, stageFilter);
|
|
213905
|
+
const flowRes = await this.runFlowCase(_case, cfg, defaultStrict, options.bail || false, defaultPromptCap, stageFilter, noMocksMode);
|
|
211870
213906
|
const failed = flowRes.failures;
|
|
211871
213907
|
caseResults.push({ name: _case.name, passed: failed === 0, stages: flowRes.stages });
|
|
211872
213908
|
return { name: _case.name, failed };
|
|
@@ -212259,7 +214295,7 @@ class VisorTestRunner {
|
|
|
212259
214295
|
clearInterval(__keepAlive);
|
|
212260
214296
|
return { failures, results: caseResults };
|
|
212261
214297
|
}
|
|
212262
|
-
async runFlowCase(flowCase, cfg, defaultStrict, bail, promptCap, stageFilter) {
|
|
214298
|
+
async runFlowCase(flowCase, cfg, defaultStrict, bail, promptCap, stageFilter, noMocks) {
|
|
212263
214299
|
const suiteDefaults = this.suiteDefaults || {};
|
|
212264
214300
|
const ghRec = suiteDefaults.github_recorder;
|
|
212265
214301
|
const ghRecCase = typeof flowCase.github_recorder === 'object' && flowCase.github_recorder
|
|
@@ -212319,7 +214355,7 @@ class VisorTestRunner {
|
|
|
212319
214355
|
const suiteDefaults = this.suiteDefaults || {};
|
|
212320
214356
|
const defaultIncludeTags = parseTags(suiteDefaults?.tags);
|
|
212321
214357
|
const defaultExcludeTags = parseTags(suiteDefaults?.exclude_tags);
|
|
212322
|
-
const stageRunner = new flow_stage_1.FlowStage(flowName, engine, recorder, cfg, prompts, promptCap, this.mapEventFromFixtureName.bind(this), this.computeChecksToRun.bind(this), this.printStageHeader.bind(this), this.printSelectedChecks.bind(this), this.warnUnmockedProviders.bind(this), defaultIncludeTags, defaultExcludeTags, (suiteDefaults.frontends || undefined));
|
|
214358
|
+
const stageRunner = new flow_stage_1.FlowStage(flowName, engine, recorder, cfg, prompts, promptCap, this.mapEventFromFixtureName.bind(this), this.computeChecksToRun.bind(this), this.printStageHeader.bind(this), this.printSelectedChecks.bind(this), this.warnUnmockedProviders.bind(this), defaultIncludeTags, defaultExcludeTags, (suiteDefaults.frontends || undefined), noMocks);
|
|
212323
214359
|
const outcome = await stageRunner.run(stage, flowCase, strict);
|
|
212324
214360
|
const expect = stage.expect || {};
|
|
212325
214361
|
if (outcome.stats)
|
|
@@ -212973,6 +215009,8 @@ const schema = {
|
|
|
212973
215009
|
frontends: { type: 'array' },
|
|
212974
215010
|
workspace: { type: 'object' },
|
|
212975
215011
|
scheduler: { type: 'object' },
|
|
215012
|
+
sandboxes: { type: 'object' },
|
|
215013
|
+
sandbox: { type: 'string' },
|
|
212976
215014
|
// Workflow definition fields (for workflow files with co-located tests)
|
|
212977
215015
|
id: { type: 'string' },
|
|
212978
215016
|
name: { type: 'string' },
|
|
@@ -213062,6 +215100,9 @@ const schema = {
|
|
|
213062
215100
|
name: { type: 'string' },
|
|
213063
215101
|
description: { type: 'string' },
|
|
213064
215102
|
skip: { type: 'boolean' },
|
|
215103
|
+
requires: {
|
|
215104
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
215105
|
+
},
|
|
213065
215106
|
strict: { type: 'boolean' },
|
|
213066
215107
|
ai_include_code_context: { type: 'boolean' },
|
|
213067
215108
|
tags: {
|
|
@@ -213354,6 +215395,7 @@ const knownKeys = new Set([
|
|
|
213354
215395
|
'name',
|
|
213355
215396
|
'description',
|
|
213356
215397
|
'skip',
|
|
215398
|
+
'requires',
|
|
213357
215399
|
'strict',
|
|
213358
215400
|
'event',
|
|
213359
215401
|
'fixture',
|
|
@@ -221164,7 +223206,7 @@ class WorktreeManager {
|
|
|
221164
223206
|
/**
|
|
221165
223207
|
* Get or create bare repository
|
|
221166
223208
|
*/
|
|
221167
|
-
async getOrCreateBareRepo(repository, repoUrl,
|
|
223209
|
+
async getOrCreateBareRepo(repository, repoUrl, _token, fetchDepth, cloneTimeoutMs) {
|
|
221168
223210
|
const reposDir = this.getReposDir();
|
|
221169
223211
|
const repoName = repository.replace(/\//g, '-');
|
|
221170
223212
|
const bareRepoPath = path.join(reposDir, `${repoName}.git`);
|
|
@@ -221184,13 +223226,25 @@ class WorktreeManager {
|
|
|
221184
223226
|
// Fall through to clone below
|
|
221185
223227
|
}
|
|
221186
223228
|
else {
|
|
223229
|
+
// Refresh the remote URL with the current token so that fetch/push
|
|
223230
|
+
// use valid credentials. The bare repo may have been cloned with a
|
|
223231
|
+
// token that has since expired (GitHub App installation tokens live
|
|
223232
|
+
// only 1 hour). Without this, git operations inside worktrees
|
|
223233
|
+
// derived from this bare repo will fail with "Authentication failed".
|
|
223234
|
+
// If the bare repo was cloned with a token embedded in the URL,
|
|
223235
|
+
// reset it to the plain URL so git uses GIT_CONFIG insteadOf rules
|
|
223236
|
+
// for auth (which always have the freshest token).
|
|
223237
|
+
await this.resetBareRepoRemoteUrl(bareRepoPath, repoUrl);
|
|
221187
223238
|
// Update remote refs
|
|
221188
223239
|
await this.updateBareRepo(bareRepoPath);
|
|
221189
223240
|
return bareRepoPath;
|
|
221190
223241
|
}
|
|
221191
223242
|
}
|
|
221192
|
-
// Clone as bare repository
|
|
221193
|
-
|
|
223243
|
+
// Clone as bare repository — use the plain URL, not buildAuthenticatedUrl().
|
|
223244
|
+
// Auth is handled by GIT_CONFIG insteadOf rules (set by injectGitHubCredentials),
|
|
223245
|
+
// which keeps the stored origin URL token-free. This prevents stale tokens from
|
|
223246
|
+
// being baked into the bare repo's remote config.
|
|
223247
|
+
const cloneUrl = repoUrl;
|
|
221194
223248
|
const redactedUrl = this.redactUrl(cloneUrl);
|
|
221195
223249
|
logger_1.logger.info(`Cloning bare repository: ${redactedUrl}${fetchDepth ? ` (depth: ${fetchDepth})` : ''}`);
|
|
221196
223250
|
// Build clone command with optional depth
|
|
@@ -221289,6 +223343,33 @@ class WorktreeManager {
|
|
|
221289
223343
|
return false;
|
|
221290
223344
|
}
|
|
221291
223345
|
}
|
|
223346
|
+
/**
|
|
223347
|
+
* Ensure the origin remote URL of a bare repo is a plain URL (no embedded token).
|
|
223348
|
+
*
|
|
223349
|
+
* Older bare repos may have been cloned with a token in the URL
|
|
223350
|
+
* (https://x-access-token:TOKEN@github.com/...). This causes stale-token
|
|
223351
|
+
* failures because GIT_CONFIG insteadOf rules can't rewrite URLs that
|
|
223352
|
+
* already have credentials. Resetting to the plain URL lets insteadOf
|
|
223353
|
+
* handle auth with the freshest token.
|
|
223354
|
+
*/
|
|
223355
|
+
async resetBareRepoRemoteUrl(bareRepoPath, plainRepoUrl) {
|
|
223356
|
+
try {
|
|
223357
|
+
const cmd = `git -C ${this.escapeShellArg(bareRepoPath)} remote set-url origin ${this.escapeShellArg(plainRepoUrl)}`;
|
|
223358
|
+
const result = await this.executeGitCommand(cmd, { timeout: 10000 });
|
|
223359
|
+
if (result.exitCode !== 0) {
|
|
223360
|
+
logger_1.logger.warn(`Failed to reset bare repo remote URL: ${result.stderr}. ` +
|
|
223361
|
+
'Git operations may fail with stale token if the URL has embedded credentials.');
|
|
223362
|
+
}
|
|
223363
|
+
else {
|
|
223364
|
+
logger_1.logger.debug(`Reset bare repo remote URL to plain URL for ${bareRepoPath}`);
|
|
223365
|
+
}
|
|
223366
|
+
}
|
|
223367
|
+
catch (error) {
|
|
223368
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
223369
|
+
logger_1.logger.warn(`Error resetting bare repo remote URL: ${msg}. ` +
|
|
223370
|
+
'Git operations may fail with stale token if the URL has embedded credentials.');
|
|
223371
|
+
}
|
|
223372
|
+
}
|
|
221292
223373
|
/**
|
|
221293
223374
|
* Create a new worktree for the given repository/ref.
|
|
221294
223375
|
*
|
|
@@ -222674,22 +224755,6 @@ class WorkflowRegistry {
|
|
|
222674
224755
|
exports.WorkflowRegistry = WorkflowRegistry;
|
|
222675
224756
|
|
|
222676
224757
|
|
|
222677
|
-
/***/ }),
|
|
222678
|
-
|
|
222679
|
-
/***/ 7065:
|
|
222680
|
-
/***/ ((module) => {
|
|
222681
|
-
|
|
222682
|
-
module.exports = eval("require")("./enterprise/loader");
|
|
222683
|
-
|
|
222684
|
-
|
|
222685
|
-
/***/ }),
|
|
222686
|
-
|
|
222687
|
-
/***/ 71370:
|
|
222688
|
-
/***/ ((module) => {
|
|
222689
|
-
|
|
222690
|
-
module.exports = eval("require")("./enterprise/policy/policy-input-builder");
|
|
222691
|
-
|
|
222692
|
-
|
|
222693
224758
|
/***/ }),
|
|
222694
224759
|
|
|
222695
224760
|
/***/ 18327:
|
|
@@ -245474,7 +247539,7 @@ async function getPackageBinDir() {
|
|
|
245474
247539
|
}
|
|
245475
247540
|
async function findPackageRoot() {
|
|
245476
247541
|
const debug = process.env.DEBUG === "1" || process.env.VERBOSE === "1";
|
|
245477
|
-
let currentDir =
|
|
247542
|
+
let currentDir = __dirname2;
|
|
245478
247543
|
const rootDir = import_path.default.parse(currentDir).root;
|
|
245479
247544
|
if (debug) {
|
|
245480
247545
|
console.log(`DEBUG: Starting package root search from: ${currentDir}`);
|
|
@@ -245548,7 +247613,7 @@ async function canWriteToDirectory(dirPath) {
|
|
|
245548
247613
|
return false;
|
|
245549
247614
|
}
|
|
245550
247615
|
}
|
|
245551
|
-
var import_path, import_os, import_fs_extra, import_url, __filename,
|
|
247616
|
+
var import_path, import_os, import_fs_extra, import_url, __filename, __dirname2;
|
|
245552
247617
|
var init_directory_resolver = __esm({
|
|
245553
247618
|
"src/directory-resolver.js"() {
|
|
245554
247619
|
"use strict";
|
|
@@ -245557,7 +247622,7 @@ var init_directory_resolver = __esm({
|
|
|
245557
247622
|
import_fs_extra = __toESM(__nccwpck_require__(61455), 1);
|
|
245558
247623
|
import_url = __nccwpck_require__(87016);
|
|
245559
247624
|
__filename = (0, import_url.fileURLToPath)("file:///");
|
|
245560
|
-
|
|
247625
|
+
__dirname2 = import_path.default.dirname(__filename);
|
|
245561
247626
|
}
|
|
245562
247627
|
});
|
|
245563
247628
|
|
|
@@ -246180,9 +248245,9 @@ async function saveVersionInfo(version2, binDir) {
|
|
|
246180
248245
|
async function getPackageVersion() {
|
|
246181
248246
|
try {
|
|
246182
248247
|
const possiblePaths = [
|
|
246183
|
-
import_path2.default.resolve(
|
|
248248
|
+
import_path2.default.resolve(__dirname3, "..", "package.json"),
|
|
246184
248249
|
// When installed from npm: src/../package.json
|
|
246185
|
-
import_path2.default.resolve(
|
|
248250
|
+
import_path2.default.resolve(__dirname3, "..", "..", "package.json")
|
|
246186
248251
|
// In development: src/../../package.json
|
|
246187
248252
|
];
|
|
246188
248253
|
for (const packageJsonPath of possiblePaths) {
|
|
@@ -246319,7 +248384,7 @@ async function downloadProbeBinary(version2) {
|
|
|
246319
248384
|
throw sanitizeError(error2);
|
|
246320
248385
|
}
|
|
246321
248386
|
}
|
|
246322
|
-
var import_axios, import_fs_extra2, import_path2, import_crypto, import_util, import_child_process, import_tar, import_os2, import_url2, exec, REPO_OWNER, REPO_NAME, BINARY_NAME, __filename2,
|
|
248387
|
+
var import_axios, import_fs_extra2, import_path2, import_crypto, import_util, import_child_process, import_tar, import_os2, import_url2, exec, REPO_OWNER, REPO_NAME, BINARY_NAME, __filename2, __dirname3, downloadLocks, LOCK_TIMEOUT_MS, LOCK_POLL_INTERVAL_MS, MAX_LOCK_WAIT_MS;
|
|
246323
248388
|
var init_downloader = __esm({
|
|
246324
248389
|
"src/downloader.js"() {
|
|
246325
248390
|
"use strict";
|
|
@@ -246340,7 +248405,7 @@ var init_downloader = __esm({
|
|
|
246340
248405
|
REPO_NAME = "probe";
|
|
246341
248406
|
BINARY_NAME = "probe";
|
|
246342
248407
|
__filename2 = (0, import_url2.fileURLToPath)("file:///");
|
|
246343
|
-
|
|
248408
|
+
__dirname3 = import_path2.default.dirname(__filename2);
|
|
246344
248409
|
downloadLocks = /* @__PURE__ */ new Map();
|
|
246345
248410
|
LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
246346
248411
|
LOCK_POLL_INTERVAL_MS = 1e3;
|
|
@@ -246362,7 +248427,7 @@ async function getBinaryPath(options = {}) {
|
|
|
246362
248427
|
}
|
|
246363
248428
|
const isWindows = process.platform === "win32";
|
|
246364
248429
|
const binaryName = isWindows ? "probe.exe" : "probe-binary";
|
|
246365
|
-
const localPackageBin = import_path3.default.resolve(
|
|
248430
|
+
const localPackageBin = import_path3.default.resolve(__dirname4, "..", "bin");
|
|
246366
248431
|
const localBinaryPath = import_path3.default.join(localPackageBin, binaryName);
|
|
246367
248432
|
if (import_fs_extra3.default.existsSync(localBinaryPath) && !forceDownload) {
|
|
246368
248433
|
probeBinaryPath = localBinaryPath;
|
|
@@ -246411,7 +248476,7 @@ function escapeString(str) {
|
|
|
246411
248476
|
return `'${str.replace(/'/g, "'\\''")}'`;
|
|
246412
248477
|
}
|
|
246413
248478
|
}
|
|
246414
|
-
var import_path3, import_fs_extra3, import_url3, __filename3,
|
|
248479
|
+
var import_path3, import_fs_extra3, import_url3, __filename3, __dirname4, probeBinaryPath;
|
|
246415
248480
|
var init_utils = __esm({
|
|
246416
248481
|
"src/utils.js"() {
|
|
246417
248482
|
"use strict";
|
|
@@ -246421,7 +248486,7 @@ var init_utils = __esm({
|
|
|
246421
248486
|
init_downloader();
|
|
246422
248487
|
init_directory_resolver();
|
|
246423
248488
|
__filename3 = (0, import_url3.fileURLToPath)("file:///");
|
|
246424
|
-
|
|
248489
|
+
__dirname4 = import_path3.default.dirname(__filename3);
|
|
246425
248490
|
probeBinaryPath = "";
|
|
246426
248491
|
}
|
|
246427
248492
|
});
|
|
@@ -264361,7 +266426,7 @@ var require_package2 = __commonJS({
|
|
|
264361
266426
|
module2.exports = {
|
|
264362
266427
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
264363
266428
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
264364
|
-
version: "3.
|
|
266429
|
+
version: "3.999.0",
|
|
264365
266430
|
scripts: {
|
|
264366
266431
|
build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
264367
266432
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -264381,21 +266446,21 @@ var require_package2 = __commonJS({
|
|
|
264381
266446
|
dependencies: {
|
|
264382
266447
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
264383
266448
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
264384
|
-
"@aws-sdk/core": "^3.973.
|
|
264385
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
264386
|
-
"@aws-sdk/eventstream-handler-node": "^3.972.
|
|
264387
|
-
"@aws-sdk/middleware-eventstream": "^3.972.
|
|
264388
|
-
"@aws-sdk/middleware-host-header": "^3.972.
|
|
264389
|
-
"@aws-sdk/middleware-logger": "^3.972.
|
|
264390
|
-
"@aws-sdk/middleware-recursion-detection": "^3.972.
|
|
264391
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
264392
|
-
"@aws-sdk/middleware-websocket": "^3.972.
|
|
264393
|
-
"@aws-sdk/region-config-resolver": "^3.972.
|
|
264394
|
-
"@aws-sdk/token-providers": "3.
|
|
264395
|
-
"@aws-sdk/types": "^3.973.
|
|
264396
|
-
"@aws-sdk/util-endpoints": "^3.996.
|
|
264397
|
-
"@aws-sdk/util-user-agent-browser": "^3.972.
|
|
264398
|
-
"@aws-sdk/util-user-agent-node": "^3.
|
|
266449
|
+
"@aws-sdk/core": "^3.973.15",
|
|
266450
|
+
"@aws-sdk/credential-provider-node": "^3.972.14",
|
|
266451
|
+
"@aws-sdk/eventstream-handler-node": "^3.972.9",
|
|
266452
|
+
"@aws-sdk/middleware-eventstream": "^3.972.6",
|
|
266453
|
+
"@aws-sdk/middleware-host-header": "^3.972.6",
|
|
266454
|
+
"@aws-sdk/middleware-logger": "^3.972.6",
|
|
266455
|
+
"@aws-sdk/middleware-recursion-detection": "^3.972.6",
|
|
266456
|
+
"@aws-sdk/middleware-user-agent": "^3.972.15",
|
|
266457
|
+
"@aws-sdk/middleware-websocket": "^3.972.10",
|
|
266458
|
+
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
266459
|
+
"@aws-sdk/token-providers": "3.999.0",
|
|
266460
|
+
"@aws-sdk/types": "^3.973.4",
|
|
266461
|
+
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
266462
|
+
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
266463
|
+
"@aws-sdk/util-user-agent-node": "^3.973.0",
|
|
264399
266464
|
"@smithy/config-resolver": "^4.4.9",
|
|
264400
266465
|
"@smithy/core": "^3.23.6",
|
|
264401
266466
|
"@smithy/eventstream-serde-browser": "^4.2.10",
|
|
@@ -264989,7 +267054,7 @@ var require_fromHttp = __commonJS({
|
|
|
264989
267054
|
var client_1 = (init_client(), __toCommonJS(client_exports));
|
|
264990
267055
|
var node_http_handler_1 = require_dist_cjs15();
|
|
264991
267056
|
var property_provider_1 = require_dist_cjs24();
|
|
264992
|
-
var promises_1 = tslib_1.__importDefault(__nccwpck_require__(
|
|
267057
|
+
var promises_1 = tslib_1.__importDefault(__nccwpck_require__(73836));
|
|
264993
267058
|
var checkUrl_1 = require_checkUrl();
|
|
264994
267059
|
var requestHelpers_1 = require_requestHelpers();
|
|
264995
267060
|
var retry_wrapper_1 = require_retry_wrapper();
|
|
@@ -265142,7 +267207,7 @@ var init_package = __esm({
|
|
|
265142
267207
|
"node_modules/@aws-sdk/nested-clients/package.json"() {
|
|
265143
267208
|
package_default = {
|
|
265144
267209
|
name: "@aws-sdk/nested-clients",
|
|
265145
|
-
version: "3.996.
|
|
267210
|
+
version: "3.996.3",
|
|
265146
267211
|
description: "Nested clients for AWS SDK packages.",
|
|
265147
267212
|
main: "./dist-cjs/index.js",
|
|
265148
267213
|
module: "./dist-es/index.js",
|
|
@@ -265171,16 +267236,16 @@ var init_package = __esm({
|
|
|
265171
267236
|
dependencies: {
|
|
265172
267237
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
265173
267238
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
265174
|
-
"@aws-sdk/core": "^3.973.
|
|
265175
|
-
"@aws-sdk/middleware-host-header": "^3.972.
|
|
265176
|
-
"@aws-sdk/middleware-logger": "^3.972.
|
|
265177
|
-
"@aws-sdk/middleware-recursion-detection": "^3.972.
|
|
265178
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
265179
|
-
"@aws-sdk/region-config-resolver": "^3.972.
|
|
265180
|
-
"@aws-sdk/types": "^3.973.
|
|
265181
|
-
"@aws-sdk/util-endpoints": "^3.996.
|
|
265182
|
-
"@aws-sdk/util-user-agent-browser": "^3.972.
|
|
265183
|
-
"@aws-sdk/util-user-agent-node": "^3.
|
|
267239
|
+
"@aws-sdk/core": "^3.973.15",
|
|
267240
|
+
"@aws-sdk/middleware-host-header": "^3.972.6",
|
|
267241
|
+
"@aws-sdk/middleware-logger": "^3.972.6",
|
|
267242
|
+
"@aws-sdk/middleware-recursion-detection": "^3.972.6",
|
|
267243
|
+
"@aws-sdk/middleware-user-agent": "^3.972.15",
|
|
267244
|
+
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
267245
|
+
"@aws-sdk/types": "^3.973.4",
|
|
267246
|
+
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
267247
|
+
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
267248
|
+
"@aws-sdk/util-user-agent-node": "^3.973.0",
|
|
265184
267249
|
"@smithy/config-resolver": "^4.4.9",
|
|
265185
267250
|
"@smithy/core": "^3.23.6",
|
|
265186
267251
|
"@smithy/fetch-http-handler": "^5.3.11",
|
|
@@ -265292,17 +267357,51 @@ var init_package = __esm({
|
|
|
265292
267357
|
var require_dist_cjs51 = __commonJS({
|
|
265293
267358
|
"node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"(exports2) {
|
|
265294
267359
|
"use strict";
|
|
265295
|
-
var
|
|
265296
|
-
var
|
|
267360
|
+
var node_os = __nccwpck_require__(48161);
|
|
267361
|
+
var node_process = __nccwpck_require__(1708);
|
|
267362
|
+
var promises = __nccwpck_require__(73836);
|
|
267363
|
+
var node_path = __nccwpck_require__(76760);
|
|
265297
267364
|
var middlewareUserAgent = require_dist_cjs29();
|
|
265298
267365
|
var getRuntimeUserAgentPair = () => {
|
|
265299
267366
|
const runtimesToCheck = ["deno", "bun", "llrt"];
|
|
265300
267367
|
for (const runtime of runtimesToCheck) {
|
|
265301
|
-
if (
|
|
265302
|
-
return [`md/${runtime}`,
|
|
267368
|
+
if (node_process.versions[runtime]) {
|
|
267369
|
+
return [`md/${runtime}`, node_process.versions[runtime]];
|
|
265303
267370
|
}
|
|
265304
267371
|
}
|
|
265305
|
-
return ["md/nodejs",
|
|
267372
|
+
return ["md/nodejs", node_process.versions.node];
|
|
267373
|
+
};
|
|
267374
|
+
var getTypeScriptPackageJsonPath = (dirname6 = "") => {
|
|
267375
|
+
let nodeModulesPath;
|
|
267376
|
+
const normalizedPath = node_path.normalize(dirname6);
|
|
267377
|
+
const parts = normalizedPath.split(node_path.sep);
|
|
267378
|
+
const nodeModulesIndex = parts.indexOf("node_modules");
|
|
267379
|
+
if (nodeModulesIndex !== -1) {
|
|
267380
|
+
nodeModulesPath = parts.slice(0, nodeModulesIndex).join(node_path.sep);
|
|
267381
|
+
} else {
|
|
267382
|
+
nodeModulesPath = dirname6;
|
|
267383
|
+
}
|
|
267384
|
+
return node_path.join(nodeModulesPath, "node_modules", "typescript", "package.json");
|
|
267385
|
+
};
|
|
267386
|
+
var tscVersion;
|
|
267387
|
+
var getTypeScriptUserAgentPair = async () => {
|
|
267388
|
+
if (tscVersion === null) {
|
|
267389
|
+
return void 0;
|
|
267390
|
+
} else if (typeof tscVersion === "string") {
|
|
267391
|
+
return ["md/tsc", tscVersion];
|
|
267392
|
+
}
|
|
267393
|
+
try {
|
|
267394
|
+
const packageJson = await promises.readFile(getTypeScriptPackageJsonPath(__dirname), "utf-8");
|
|
267395
|
+
const { version: version2 } = JSON.parse(packageJson);
|
|
267396
|
+
if (typeof version2 !== "string") {
|
|
267397
|
+
tscVersion = null;
|
|
267398
|
+
return void 0;
|
|
267399
|
+
}
|
|
267400
|
+
tscVersion = version2;
|
|
267401
|
+
return ["md/tsc", tscVersion];
|
|
267402
|
+
} catch {
|
|
267403
|
+
tscVersion = null;
|
|
267404
|
+
}
|
|
265306
267405
|
};
|
|
265307
267406
|
var crtAvailability = {
|
|
265308
267407
|
isCrtAvailable: false
|
|
@@ -265319,10 +267418,14 @@ var require_dist_cjs51 = __commonJS({
|
|
|
265319
267418
|
const sections = [
|
|
265320
267419
|
["aws-sdk-js", clientVersion],
|
|
265321
267420
|
["ua", "2.1"],
|
|
265322
|
-
[`os/${
|
|
267421
|
+
[`os/${node_os.platform()}`, node_os.release()],
|
|
265323
267422
|
["lang/js"],
|
|
265324
267423
|
runtimeUserAgentPair
|
|
265325
267424
|
];
|
|
267425
|
+
const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
|
|
267426
|
+
if (typescriptUserAgentPair) {
|
|
267427
|
+
sections.push(typescriptUserAgentPair);
|
|
267428
|
+
}
|
|
265326
267429
|
const crtAvailable = isCrtAvailable();
|
|
265327
267430
|
if (crtAvailable) {
|
|
265328
267431
|
sections.push(crtAvailable);
|
|
@@ -265330,8 +267433,8 @@ var require_dist_cjs51 = __commonJS({
|
|
|
265330
267433
|
if (serviceId) {
|
|
265331
267434
|
sections.push([`api/${serviceId}`, clientVersion]);
|
|
265332
267435
|
}
|
|
265333
|
-
if (
|
|
265334
|
-
sections.push([`exec-env/${
|
|
267436
|
+
if (node_process.env.AWS_EXECUTION_ENV) {
|
|
267437
|
+
sections.push([`exec-env/${node_process.env.AWS_EXECUTION_ENV}`]);
|
|
265335
267438
|
}
|
|
265336
267439
|
const appId = await config?.userAgentAppId?.();
|
|
265337
267440
|
const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
|
|
@@ -266405,7 +268508,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
266405
268508
|
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
266406
268509
|
var propertyProvider = require_dist_cjs24();
|
|
266407
268510
|
var sharedIniFileLoader = require_dist_cjs42();
|
|
266408
|
-
var
|
|
268511
|
+
var node_fs = __nccwpck_require__(73024);
|
|
266409
268512
|
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
266410
268513
|
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
266411
268514
|
if (!signingName) {
|
|
@@ -266451,7 +268554,7 @@ var require_dist_cjs56 = __commonJS({
|
|
|
266451
268554
|
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
266452
268555
|
}
|
|
266453
268556
|
};
|
|
266454
|
-
var { writeFile: writeFile2 } =
|
|
268557
|
+
var { writeFile: writeFile2 } = node_fs.promises;
|
|
266455
268558
|
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
266456
268559
|
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
266457
268560
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -269573,8 +271676,8 @@ var require_dist_cjs59 = __commonJS({
|
|
|
269573
271676
|
"use strict";
|
|
269574
271677
|
var sharedIniFileLoader = require_dist_cjs42();
|
|
269575
271678
|
var propertyProvider = require_dist_cjs24();
|
|
269576
|
-
var
|
|
269577
|
-
var
|
|
271679
|
+
var node_child_process = __nccwpck_require__(31421);
|
|
271680
|
+
var node_util = __nccwpck_require__(57975);
|
|
269578
271681
|
var client = (init_client(), __toCommonJS(client_exports));
|
|
269579
271682
|
var getValidatedProcessCredentials = (profileName, data3, profiles) => {
|
|
269580
271683
|
if (data3.Version !== 1) {
|
|
@@ -269610,7 +271713,7 @@ var require_dist_cjs59 = __commonJS({
|
|
|
269610
271713
|
if (profiles[profileName]) {
|
|
269611
271714
|
const credentialProcess = profile["credential_process"];
|
|
269612
271715
|
if (credentialProcess !== void 0) {
|
|
269613
|
-
const execPromise =
|
|
271716
|
+
const execPromise = node_util.promisify(sharedIniFileLoader.externalDataInterceptor?.getTokenRecord?.().exec ?? node_child_process.exec);
|
|
269614
271717
|
try {
|
|
269615
271718
|
const { stdout } = await execPromise(credentialProcess);
|
|
269616
271719
|
let data3;
|
|
@@ -269724,7 +271827,7 @@ var require_fromTokenFile = __commonJS({
|
|
|
269724
271827
|
var client_1 = (init_client(), __toCommonJS(client_exports));
|
|
269725
271828
|
var property_provider_1 = require_dist_cjs24();
|
|
269726
271829
|
var shared_ini_file_loader_1 = require_dist_cjs42();
|
|
269727
|
-
var
|
|
271830
|
+
var node_fs_1 = __nccwpck_require__(73024);
|
|
269728
271831
|
var fromWebToken_1 = require_fromWebToken();
|
|
269729
271832
|
var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
269730
271833
|
var ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
@@ -269741,7 +271844,7 @@ var require_fromTokenFile = __commonJS({
|
|
|
269741
271844
|
}
|
|
269742
271845
|
const credentials = await (0, fromWebToken_1.fromWebToken)({
|
|
269743
271846
|
...init,
|
|
269744
|
-
webIdentityToken: shared_ini_file_loader_1.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? (0,
|
|
271847
|
+
webIdentityToken: shared_ini_file_loader_1.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? (0, node_fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }),
|
|
269745
271848
|
roleArn,
|
|
269746
271849
|
roleSessionName
|
|
269747
271850
|
})(awsIdentityProperties);
|
|
@@ -282616,13 +284719,13 @@ Capabilities:
|
|
|
282616
284719
|
});
|
|
282617
284720
|
|
|
282618
284721
|
// src/agent/xmlParsingUtils.js
|
|
282619
|
-
function removeThinkingTags(xmlString) {
|
|
284722
|
+
function removeThinkingTags(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
282620
284723
|
let result = xmlString;
|
|
282621
284724
|
result = result.replace(/<thinking>[\s\S]*?<\/thinking>/g, "");
|
|
282622
284725
|
const thinkingIndex = result.indexOf("<thinking>");
|
|
282623
284726
|
if (thinkingIndex !== -1) {
|
|
282624
284727
|
const afterThinking = result.substring(thinkingIndex + "<thinking>".length);
|
|
282625
|
-
const toolPattern = buildToolTagPattern(
|
|
284728
|
+
const toolPattern = buildToolTagPattern(validTools);
|
|
282626
284729
|
const toolMatch = afterThinking.match(toolPattern);
|
|
282627
284730
|
if (toolMatch) {
|
|
282628
284731
|
const toolStart = thinkingIndex + "<thinking>".length + toolMatch.index;
|
|
@@ -282721,7 +284824,7 @@ function hasOtherToolTags(xmlString, validTools = []) {
|
|
|
282721
284824
|
}
|
|
282722
284825
|
function processXmlWithThinkingAndRecovery(xmlString, validTools = []) {
|
|
282723
284826
|
const thinkingContent = extractThinkingContent(xmlString);
|
|
282724
|
-
const cleanedXmlString = removeThinkingTags(xmlString);
|
|
284827
|
+
const cleanedXmlString = removeThinkingTags(xmlString, validTools.length > 0 ? validTools : void 0);
|
|
282725
284828
|
const recoveryResult = checkAttemptCompleteRecovery(cleanedXmlString, validTools);
|
|
282726
284829
|
if (process.env.DEBUG === "1" && thinkingContent) {
|
|
282727
284830
|
console.log(`[DEBUG] AI Thinking Process:
|
|
@@ -283671,31 +285774,33 @@ var init_fileTracker = __esm({
|
|
|
283671
285774
|
}
|
|
283672
285775
|
});
|
|
283673
285776
|
|
|
283674
|
-
// node_modules/balanced-match/
|
|
283675
|
-
var
|
|
283676
|
-
|
|
283677
|
-
|
|
283678
|
-
|
|
283679
|
-
|
|
283680
|
-
|
|
283681
|
-
|
|
285777
|
+
// node_modules/balanced-match/index.js
|
|
285778
|
+
var require_balanced_match = __commonJS({
|
|
285779
|
+
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
285780
|
+
"use strict";
|
|
285781
|
+
module2.exports = balanced;
|
|
285782
|
+
function balanced(a5, b5, str) {
|
|
285783
|
+
if (a5 instanceof RegExp) a5 = maybeMatch(a5, str);
|
|
285784
|
+
if (b5 instanceof RegExp) b5 = maybeMatch(b5, str);
|
|
285785
|
+
var r5 = range2(a5, b5, str);
|
|
283682
285786
|
return r5 && {
|
|
283683
285787
|
start: r5[0],
|
|
283684
285788
|
end: r5[1],
|
|
283685
285789
|
pre: str.slice(0, r5[0]),
|
|
283686
|
-
body: str.slice(r5[0] +
|
|
283687
|
-
post: str.slice(r5[1] +
|
|
285790
|
+
body: str.slice(r5[0] + a5.length, r5[1]),
|
|
285791
|
+
post: str.slice(r5[1] + b5.length)
|
|
283688
285792
|
};
|
|
283689
|
-
}
|
|
283690
|
-
maybeMatch
|
|
283691
|
-
|
|
285793
|
+
}
|
|
285794
|
+
function maybeMatch(reg, str) {
|
|
285795
|
+
var m5 = str.match(reg);
|
|
283692
285796
|
return m5 ? m5[0] : null;
|
|
283693
|
-
}
|
|
283694
|
-
|
|
283695
|
-
|
|
283696
|
-
|
|
283697
|
-
|
|
283698
|
-
|
|
285797
|
+
}
|
|
285798
|
+
balanced.range = range2;
|
|
285799
|
+
function range2(a5, b5, str) {
|
|
285800
|
+
var begs, beg, left, right, result;
|
|
285801
|
+
var ai = str.indexOf(a5);
|
|
285802
|
+
var bi = str.indexOf(b5, ai + 1);
|
|
285803
|
+
var i5 = ai;
|
|
283699
285804
|
if (ai >= 0 && bi > 0) {
|
|
283700
285805
|
if (a5 === b5) {
|
|
283701
285806
|
return [ai, bi];
|
|
@@ -283703,16 +285808,14 @@ var init_esm = __esm({
|
|
|
283703
285808
|
begs = [];
|
|
283704
285809
|
left = str.length;
|
|
283705
285810
|
while (i5 >= 0 && !result) {
|
|
283706
|
-
if (i5
|
|
285811
|
+
if (i5 == ai) {
|
|
283707
285812
|
begs.push(i5);
|
|
283708
285813
|
ai = str.indexOf(a5, i5 + 1);
|
|
283709
|
-
} else if (begs.length
|
|
283710
|
-
|
|
283711
|
-
if (r5 !== void 0)
|
|
283712
|
-
result = [r5, bi];
|
|
285814
|
+
} else if (begs.length == 1) {
|
|
285815
|
+
result = [begs.pop(), bi];
|
|
283713
285816
|
} else {
|
|
283714
285817
|
beg = begs.pop();
|
|
283715
|
-
if (beg
|
|
285818
|
+
if (beg < left) {
|
|
283716
285819
|
left = beg;
|
|
283717
285820
|
right = bi;
|
|
283718
285821
|
}
|
|
@@ -283720,179 +285823,163 @@ var init_esm = __esm({
|
|
|
283720
285823
|
}
|
|
283721
285824
|
i5 = ai < bi && ai >= 0 ? ai : bi;
|
|
283722
285825
|
}
|
|
283723
|
-
if (begs.length
|
|
285826
|
+
if (begs.length) {
|
|
283724
285827
|
result = [left, right];
|
|
283725
285828
|
}
|
|
283726
285829
|
}
|
|
283727
285830
|
return result;
|
|
283728
|
-
}
|
|
285831
|
+
}
|
|
283729
285832
|
}
|
|
283730
285833
|
});
|
|
283731
285834
|
|
|
283732
|
-
// node_modules/brace-expansion/
|
|
283733
|
-
|
|
283734
|
-
|
|
283735
|
-
|
|
283736
|
-
|
|
283737
|
-
|
|
283738
|
-
|
|
283739
|
-
|
|
283740
|
-
|
|
283741
|
-
|
|
283742
|
-
function
|
|
283743
|
-
|
|
283744
|
-
|
|
283745
|
-
|
|
283746
|
-
|
|
283747
|
-
|
|
283748
|
-
|
|
283749
|
-
|
|
283750
|
-
|
|
283751
|
-
|
|
283752
|
-
|
|
283753
|
-
|
|
283754
|
-
|
|
283755
|
-
|
|
283756
|
-
|
|
283757
|
-
|
|
283758
|
-
|
|
283759
|
-
|
|
283760
|
-
|
|
283761
|
-
|
|
283762
|
-
}
|
|
283763
|
-
|
|
283764
|
-
|
|
283765
|
-
|
|
283766
|
-
|
|
283767
|
-
|
|
283768
|
-
|
|
283769
|
-
|
|
283770
|
-
|
|
283771
|
-
|
|
283772
|
-
|
|
283773
|
-
|
|
283774
|
-
|
|
283775
|
-
}
|
|
283776
|
-
|
|
283777
|
-
|
|
283778
|
-
}
|
|
283779
|
-
function lte(i5, y2) {
|
|
283780
|
-
return i5 <= y2;
|
|
283781
|
-
}
|
|
283782
|
-
function gte(i5, y2) {
|
|
283783
|
-
return i5 >= y2;
|
|
283784
|
-
}
|
|
283785
|
-
function expand_(str, max, isTop) {
|
|
283786
|
-
const expansions = [];
|
|
283787
|
-
const m5 = balanced("{", "}", str);
|
|
283788
|
-
if (!m5)
|
|
283789
|
-
return [str];
|
|
283790
|
-
const pre = m5.pre;
|
|
283791
|
-
const post = m5.post.length ? expand_(m5.post, max, false) : [""];
|
|
283792
|
-
if (/\$$/.test(m5.pre)) {
|
|
283793
|
-
for (let k5 = 0; k5 < post.length && k5 < max; k5++) {
|
|
283794
|
-
const expansion = pre + "{" + m5.body + "}" + post[k5];
|
|
283795
|
-
expansions.push(expansion);
|
|
285835
|
+
// node_modules/brace-expansion/index.js
|
|
285836
|
+
var require_brace_expansion = __commonJS({
|
|
285837
|
+
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
285838
|
+
var balanced = require_balanced_match();
|
|
285839
|
+
module2.exports = expandTop;
|
|
285840
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
285841
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
285842
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
285843
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
285844
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
285845
|
+
function numeric(str) {
|
|
285846
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
285847
|
+
}
|
|
285848
|
+
function escapeBraces(str) {
|
|
285849
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
285850
|
+
}
|
|
285851
|
+
function unescapeBraces(str) {
|
|
285852
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
285853
|
+
}
|
|
285854
|
+
function parseCommaParts(str) {
|
|
285855
|
+
if (!str)
|
|
285856
|
+
return [""];
|
|
285857
|
+
var parts = [];
|
|
285858
|
+
var m5 = balanced("{", "}", str);
|
|
285859
|
+
if (!m5)
|
|
285860
|
+
return str.split(",");
|
|
285861
|
+
var pre = m5.pre;
|
|
285862
|
+
var body = m5.body;
|
|
285863
|
+
var post = m5.post;
|
|
285864
|
+
var p5 = pre.split(",");
|
|
285865
|
+
p5[p5.length - 1] += "{" + body + "}";
|
|
285866
|
+
var postParts = parseCommaParts(post);
|
|
285867
|
+
if (post.length) {
|
|
285868
|
+
p5[p5.length - 1] += postParts.shift();
|
|
285869
|
+
p5.push.apply(p5, postParts);
|
|
285870
|
+
}
|
|
285871
|
+
parts.push.apply(parts, p5);
|
|
285872
|
+
return parts;
|
|
285873
|
+
}
|
|
285874
|
+
function expandTop(str) {
|
|
285875
|
+
if (!str)
|
|
285876
|
+
return [];
|
|
285877
|
+
if (str.substr(0, 2) === "{}") {
|
|
285878
|
+
str = "\\{\\}" + str.substr(2);
|
|
285879
|
+
}
|
|
285880
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
283796
285881
|
}
|
|
283797
|
-
|
|
283798
|
-
|
|
283799
|
-
|
|
283800
|
-
|
|
283801
|
-
|
|
283802
|
-
|
|
283803
|
-
|
|
283804
|
-
|
|
283805
|
-
|
|
283806
|
-
|
|
283807
|
-
return
|
|
283808
|
-
}
|
|
283809
|
-
|
|
283810
|
-
|
|
283811
|
-
|
|
283812
|
-
|
|
283813
|
-
|
|
283814
|
-
|
|
283815
|
-
|
|
283816
|
-
|
|
283817
|
-
|
|
283818
|
-
|
|
283819
|
-
|
|
283820
|
-
|
|
283821
|
-
|
|
283822
|
-
|
|
283823
|
-
|
|
283824
|
-
|
|
283825
|
-
|
|
283826
|
-
|
|
283827
|
-
|
|
283828
|
-
|
|
283829
|
-
if (reverse) {
|
|
283830
|
-
incr *= -1;
|
|
283831
|
-
test = gte;
|
|
283832
|
-
}
|
|
283833
|
-
const pad = n5.some(isPadded);
|
|
283834
|
-
N = [];
|
|
283835
|
-
for (let i5 = x5; test(i5, y2); i5 += incr) {
|
|
283836
|
-
let c5;
|
|
283837
|
-
if (isAlphaSequence) {
|
|
283838
|
-
c5 = String.fromCharCode(i5);
|
|
283839
|
-
if (c5 === "\\") {
|
|
283840
|
-
c5 = "";
|
|
285882
|
+
function embrace(str) {
|
|
285883
|
+
return "{" + str + "}";
|
|
285884
|
+
}
|
|
285885
|
+
function isPadded(el) {
|
|
285886
|
+
return /^-?0\d/.test(el);
|
|
285887
|
+
}
|
|
285888
|
+
function lte(i5, y2) {
|
|
285889
|
+
return i5 <= y2;
|
|
285890
|
+
}
|
|
285891
|
+
function gte(i5, y2) {
|
|
285892
|
+
return i5 >= y2;
|
|
285893
|
+
}
|
|
285894
|
+
function expand2(str, isTop) {
|
|
285895
|
+
var expansions = [];
|
|
285896
|
+
var m5 = balanced("{", "}", str);
|
|
285897
|
+
if (!m5) return [str];
|
|
285898
|
+
var pre = m5.pre;
|
|
285899
|
+
var post = m5.post.length ? expand2(m5.post, false) : [""];
|
|
285900
|
+
if (/\$$/.test(m5.pre)) {
|
|
285901
|
+
for (var k5 = 0; k5 < post.length; k5++) {
|
|
285902
|
+
var expansion = pre + "{" + m5.body + "}" + post[k5];
|
|
285903
|
+
expansions.push(expansion);
|
|
285904
|
+
}
|
|
285905
|
+
} else {
|
|
285906
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m5.body);
|
|
285907
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m5.body);
|
|
285908
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
285909
|
+
var isOptions = m5.body.indexOf(",") >= 0;
|
|
285910
|
+
if (!isSequence && !isOptions) {
|
|
285911
|
+
if (m5.post.match(/,(?!,).*\}/)) {
|
|
285912
|
+
str = m5.pre + "{" + m5.body + escClose + m5.post;
|
|
285913
|
+
return expand2(str);
|
|
283841
285914
|
}
|
|
285915
|
+
return [str];
|
|
285916
|
+
}
|
|
285917
|
+
var n5;
|
|
285918
|
+
if (isSequence) {
|
|
285919
|
+
n5 = m5.body.split(/\.\./);
|
|
283842
285920
|
} else {
|
|
283843
|
-
|
|
283844
|
-
if (
|
|
283845
|
-
|
|
283846
|
-
if (
|
|
283847
|
-
|
|
283848
|
-
|
|
283849
|
-
|
|
283850
|
-
|
|
283851
|
-
|
|
285921
|
+
n5 = parseCommaParts(m5.body);
|
|
285922
|
+
if (n5.length === 1) {
|
|
285923
|
+
n5 = expand2(n5[0], false).map(embrace);
|
|
285924
|
+
if (n5.length === 1) {
|
|
285925
|
+
return post.map(function(p5) {
|
|
285926
|
+
return m5.pre + n5[0] + p5;
|
|
285927
|
+
});
|
|
285928
|
+
}
|
|
285929
|
+
}
|
|
285930
|
+
}
|
|
285931
|
+
var N;
|
|
285932
|
+
if (isSequence) {
|
|
285933
|
+
var x5 = numeric(n5[0]);
|
|
285934
|
+
var y2 = numeric(n5[1]);
|
|
285935
|
+
var width = Math.max(n5[0].length, n5[1].length);
|
|
285936
|
+
var incr = n5.length == 3 ? Math.abs(numeric(n5[2])) : 1;
|
|
285937
|
+
var test = lte;
|
|
285938
|
+
var reverse = y2 < x5;
|
|
285939
|
+
if (reverse) {
|
|
285940
|
+
incr *= -1;
|
|
285941
|
+
test = gte;
|
|
285942
|
+
}
|
|
285943
|
+
var pad = n5.some(isPadded);
|
|
285944
|
+
N = [];
|
|
285945
|
+
for (var i5 = x5; test(i5, y2); i5 += incr) {
|
|
285946
|
+
var c5;
|
|
285947
|
+
if (isAlphaSequence) {
|
|
285948
|
+
c5 = String.fromCharCode(i5);
|
|
285949
|
+
if (c5 === "\\")
|
|
285950
|
+
c5 = "";
|
|
285951
|
+
} else {
|
|
285952
|
+
c5 = String(i5);
|
|
285953
|
+
if (pad) {
|
|
285954
|
+
var need = width - c5.length;
|
|
285955
|
+
if (need > 0) {
|
|
285956
|
+
var z2 = new Array(need + 1).join("0");
|
|
285957
|
+
if (i5 < 0)
|
|
285958
|
+
c5 = "-" + z2 + c5.slice(1);
|
|
285959
|
+
else
|
|
285960
|
+
c5 = z2 + c5;
|
|
285961
|
+
}
|
|
283852
285962
|
}
|
|
283853
285963
|
}
|
|
285964
|
+
N.push(c5);
|
|
285965
|
+
}
|
|
285966
|
+
} else {
|
|
285967
|
+
N = [];
|
|
285968
|
+
for (var j5 = 0; j5 < n5.length; j5++) {
|
|
285969
|
+
N.push.apply(N, expand2(n5[j5], false));
|
|
283854
285970
|
}
|
|
283855
285971
|
}
|
|
283856
|
-
N.
|
|
283857
|
-
|
|
283858
|
-
|
|
283859
|
-
|
|
283860
|
-
|
|
283861
|
-
|
|
283862
|
-
}
|
|
283863
|
-
}
|
|
283864
|
-
for (let j5 = 0; j5 < N.length; j5++) {
|
|
283865
|
-
for (let k5 = 0; k5 < post.length && expansions.length < max; k5++) {
|
|
283866
|
-
const expansion = pre + N[j5] + post[k5];
|
|
283867
|
-
if (!isTop || isSequence || expansion) {
|
|
283868
|
-
expansions.push(expansion);
|
|
285972
|
+
for (var j5 = 0; j5 < N.length; j5++) {
|
|
285973
|
+
for (var k5 = 0; k5 < post.length; k5++) {
|
|
285974
|
+
var expansion = pre + N[j5] + post[k5];
|
|
285975
|
+
if (!isTop || isSequence || expansion)
|
|
285976
|
+
expansions.push(expansion);
|
|
285977
|
+
}
|
|
283869
285978
|
}
|
|
283870
285979
|
}
|
|
285980
|
+
return expansions;
|
|
283871
285981
|
}
|
|
283872
285982
|
}
|
|
283873
|
-
return expansions;
|
|
283874
|
-
}
|
|
283875
|
-
var escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX;
|
|
283876
|
-
var init_esm2 = __esm({
|
|
283877
|
-
"node_modules/brace-expansion/dist/esm/index.js"() {
|
|
283878
|
-
init_esm();
|
|
283879
|
-
escSlash = "\0SLASH" + Math.random() + "\0";
|
|
283880
|
-
escOpen = "\0OPEN" + Math.random() + "\0";
|
|
283881
|
-
escClose = "\0CLOSE" + Math.random() + "\0";
|
|
283882
|
-
escComma = "\0COMMA" + Math.random() + "\0";
|
|
283883
|
-
escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
283884
|
-
escSlashPattern = new RegExp(escSlash, "g");
|
|
283885
|
-
escOpenPattern = new RegExp(escOpen, "g");
|
|
283886
|
-
escClosePattern = new RegExp(escClose, "g");
|
|
283887
|
-
escCommaPattern = new RegExp(escComma, "g");
|
|
283888
|
-
escPeriodPattern = new RegExp(escPeriod, "g");
|
|
283889
|
-
slashPattern = /\\\\/g;
|
|
283890
|
-
openPattern = /\\{/g;
|
|
283891
|
-
closePattern = /\\}/g;
|
|
283892
|
-
commaPattern = /\\,/g;
|
|
283893
|
-
periodPattern = /\\./g;
|
|
283894
|
-
EXPANSION_MAX = 1e5;
|
|
283895
|
-
}
|
|
283896
285983
|
});
|
|
283897
285984
|
|
|
283898
285985
|
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
@@ -284664,10 +286751,10 @@ var init_escape = __esm({
|
|
|
284664
286751
|
});
|
|
284665
286752
|
|
|
284666
286753
|
// node_modules/minimatch/dist/esm/index.js
|
|
284667
|
-
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path5, sep2, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
284668
|
-
var
|
|
286754
|
+
var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path5, sep2, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
286755
|
+
var init_esm = __esm({
|
|
284669
286756
|
"node_modules/minimatch/dist/esm/index.js"() {
|
|
284670
|
-
|
|
286757
|
+
import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
284671
286758
|
init_assert_valid_pattern();
|
|
284672
286759
|
init_ast();
|
|
284673
286760
|
init_escape();
|
|
@@ -284790,7 +286877,7 @@ var init_esm3 = __esm({
|
|
|
284790
286877
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
284791
286878
|
return [pattern];
|
|
284792
286879
|
}
|
|
284793
|
-
return
|
|
286880
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
284794
286881
|
};
|
|
284795
286882
|
minimatch.braceExpand = braceExpand;
|
|
284796
286883
|
makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
@@ -285466,7 +287553,7 @@ var init_esm3 = __esm({
|
|
|
285466
287553
|
|
|
285467
287554
|
// node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js
|
|
285468
287555
|
var perf, warned, PROCESS, emitWarning, AC, AS, shouldWarn, TYPE, isPosInt, getUintArray, ZeroArray, Stack, LRUCache;
|
|
285469
|
-
var
|
|
287556
|
+
var init_esm2 = __esm({
|
|
285470
287557
|
"node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js"() {
|
|
285471
287558
|
perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
285472
287559
|
warned = /* @__PURE__ */ new Set();
|
|
@@ -286840,7 +288927,7 @@ var init_esm4 = __esm({
|
|
|
286840
288927
|
|
|
286841
288928
|
// node_modules/minipass/dist/esm/index.js
|
|
286842
288929
|
var import_node_events, import_node_stream, import_node_string_decoder, proc, isStream, isReadable, isWritable, EOF, MAYBE_EMIT_END, EMITTED_END, EMITTING_END, EMITTED_ERROR, CLOSED, READ, FLUSH, FLUSHCHUNK, ENCODING, DECODER, FLOWING, PAUSED, RESUME, BUFFER, PIPES, BUFFERLENGTH, BUFFERPUSH, BUFFERSHIFT, OBJECTMODE, DESTROYED, ERROR, EMITDATA, EMITEND, EMITEND2, ASYNC, ABORT, ABORTED, SIGNAL, DATALISTENERS, DISCARDED, defer, nodefer, isEndish, isArrayBufferLike, isArrayBufferView, Pipe, PipeProxyErrors, isObjectModeOptions, isEncodingOptions, Minipass;
|
|
286843
|
-
var
|
|
288930
|
+
var init_esm3 = __esm({
|
|
286844
288931
|
"node_modules/minipass/dist/esm/index.js"() {
|
|
286845
288932
|
import_node_events = __nccwpck_require__(78474);
|
|
286846
288933
|
import_node_stream = __toESM(__nccwpck_require__(57075), 1);
|
|
@@ -287727,15 +289814,15 @@ var init_esm5 = __esm({
|
|
|
287727
289814
|
|
|
287728
289815
|
// node_modules/path-scurry/dist/esm/index.js
|
|
287729
289816
|
var import_node_path, import_node_url, import_fs6, actualFS, import_promises, realpathSync2, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
|
|
287730
|
-
var
|
|
289817
|
+
var init_esm4 = __esm({
|
|
287731
289818
|
"node_modules/path-scurry/dist/esm/index.js"() {
|
|
287732
|
-
|
|
289819
|
+
init_esm2();
|
|
287733
289820
|
import_node_path = __nccwpck_require__(76760);
|
|
287734
289821
|
import_node_url = __nccwpck_require__(73136);
|
|
287735
289822
|
import_fs6 = __nccwpck_require__(79896);
|
|
287736
289823
|
actualFS = __toESM(__nccwpck_require__(73024), 1);
|
|
287737
289824
|
import_promises = __nccwpck_require__(73836);
|
|
287738
|
-
|
|
289825
|
+
init_esm3();
|
|
287739
289826
|
realpathSync2 = import_fs6.realpathSync.native;
|
|
287740
289827
|
defaultFS = {
|
|
287741
289828
|
lstatSync: import_fs6.lstatSync,
|
|
@@ -289465,7 +291552,7 @@ var init_esm6 = __esm({
|
|
|
289465
291552
|
var isPatternList, isGlobList, Pattern;
|
|
289466
291553
|
var init_pattern = __esm({
|
|
289467
291554
|
"node_modules/glob/dist/esm/pattern.js"() {
|
|
289468
|
-
|
|
291555
|
+
init_esm();
|
|
289469
291556
|
isPatternList = (pl) => pl.length >= 1;
|
|
289470
291557
|
isGlobList = (gl) => gl.length >= 1;
|
|
289471
291558
|
Pattern = class _Pattern {
|
|
@@ -289636,7 +291723,7 @@ var init_pattern = __esm({
|
|
|
289636
291723
|
var defaultPlatform2, Ignore;
|
|
289637
291724
|
var init_ignore = __esm({
|
|
289638
291725
|
"node_modules/glob/dist/esm/ignore.js"() {
|
|
289639
|
-
|
|
291726
|
+
init_esm();
|
|
289640
291727
|
init_pattern();
|
|
289641
291728
|
defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
289642
291729
|
Ignore = class {
|
|
@@ -289730,7 +291817,7 @@ var init_ignore = __esm({
|
|
|
289730
291817
|
var HasWalkedCache, MatchRecord, SubWalks, Processor;
|
|
289731
291818
|
var init_processor = __esm({
|
|
289732
291819
|
"node_modules/glob/dist/esm/processor.js"() {
|
|
289733
|
-
|
|
291820
|
+
init_esm();
|
|
289734
291821
|
HasWalkedCache = class _HasWalkedCache {
|
|
289735
291822
|
store;
|
|
289736
291823
|
constructor(store = /* @__PURE__ */ new Map()) {
|
|
@@ -289957,7 +292044,7 @@ var init_processor = __esm({
|
|
|
289957
292044
|
var makeIgnore, GlobUtil, GlobWalker, GlobStream;
|
|
289958
292045
|
var init_walker = __esm({
|
|
289959
292046
|
"node_modules/glob/dist/esm/walker.js"() {
|
|
289960
|
-
|
|
292047
|
+
init_esm3();
|
|
289961
292048
|
init_ignore();
|
|
289962
292049
|
init_processor();
|
|
289963
292050
|
makeIgnore = (ignore2, opts) => typeof ignore2 === "string" ? new Ignore([ignore2], opts) : Array.isArray(ignore2) ? new Ignore(ignore2, opts) : ignore2;
|
|
@@ -290292,9 +292379,9 @@ var init_walker = __esm({
|
|
|
290292
292379
|
var import_node_url2, defaultPlatform3, Glob;
|
|
290293
292380
|
var init_glob = __esm({
|
|
290294
292381
|
"node_modules/glob/dist/esm/glob.js"() {
|
|
290295
|
-
|
|
292382
|
+
init_esm();
|
|
290296
292383
|
import_node_url2 = __nccwpck_require__(73136);
|
|
290297
|
-
|
|
292384
|
+
init_esm4();
|
|
290298
292385
|
init_pattern();
|
|
290299
292386
|
init_walker();
|
|
290300
292387
|
defaultPlatform3 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
@@ -290502,7 +292589,7 @@ var init_glob = __esm({
|
|
|
290502
292589
|
var hasMagic;
|
|
290503
292590
|
var init_has_magic = __esm({
|
|
290504
292591
|
"node_modules/glob/dist/esm/has-magic.js"() {
|
|
290505
|
-
|
|
292592
|
+
init_esm();
|
|
290506
292593
|
hasMagic = (pattern, options = {}) => {
|
|
290507
292594
|
if (!Array.isArray(pattern)) {
|
|
290508
292595
|
pattern = [pattern];
|
|
@@ -290536,12 +292623,12 @@ function globIterate(pattern, options = {}) {
|
|
|
290536
292623
|
return new Glob(pattern, options).iterate();
|
|
290537
292624
|
}
|
|
290538
292625
|
var streamSync, stream, iterateSync, iterate, sync, glob;
|
|
290539
|
-
var
|
|
292626
|
+
var init_esm5 = __esm({
|
|
290540
292627
|
"node_modules/glob/dist/esm/index.js"() {
|
|
290541
|
-
|
|
292628
|
+
init_esm();
|
|
290542
292629
|
init_glob();
|
|
290543
292630
|
init_has_magic();
|
|
290544
|
-
|
|
292631
|
+
init_esm();
|
|
290545
292632
|
init_glob();
|
|
290546
292633
|
init_has_magic();
|
|
290547
292634
|
init_ignore();
|
|
@@ -290690,7 +292777,7 @@ var init_probeTool = __esm({
|
|
|
290690
292777
|
import_fs7 = __toESM(__nccwpck_require__(79896), 1);
|
|
290691
292778
|
import_fs8 = __nccwpck_require__(79896);
|
|
290692
292779
|
import_path8 = __toESM(__nccwpck_require__(16928), 1);
|
|
290693
|
-
|
|
292780
|
+
init_esm5();
|
|
290694
292781
|
init_symlink_utils();
|
|
290695
292782
|
toolCallEmitter = new import_events.EventEmitter();
|
|
290696
292783
|
activeToolExecutions = /* @__PURE__ */ new Map();
|
|
@@ -296101,23 +298188,23 @@ var init_regexp_parser = __esm({
|
|
|
296101
298188
|
return ASSERT_NEVER_REACH_HERE();
|
|
296102
298189
|
}
|
|
296103
298190
|
quantifier(isBacktracking = false) {
|
|
296104
|
-
let
|
|
298191
|
+
let range2 = void 0;
|
|
296105
298192
|
const begin = this.idx;
|
|
296106
298193
|
switch (this.popChar()) {
|
|
296107
298194
|
case "*":
|
|
296108
|
-
|
|
298195
|
+
range2 = {
|
|
296109
298196
|
atLeast: 0,
|
|
296110
298197
|
atMost: Infinity
|
|
296111
298198
|
};
|
|
296112
298199
|
break;
|
|
296113
298200
|
case "+":
|
|
296114
|
-
|
|
298201
|
+
range2 = {
|
|
296115
298202
|
atLeast: 1,
|
|
296116
298203
|
atMost: Infinity
|
|
296117
298204
|
};
|
|
296118
298205
|
break;
|
|
296119
298206
|
case "?":
|
|
296120
|
-
|
|
298207
|
+
range2 = {
|
|
296121
298208
|
atLeast: 0,
|
|
296122
298209
|
atMost: 1
|
|
296123
298210
|
};
|
|
@@ -296126,7 +298213,7 @@ var init_regexp_parser = __esm({
|
|
|
296126
298213
|
const atLeast = this.integerIncludingZero();
|
|
296127
298214
|
switch (this.popChar()) {
|
|
296128
298215
|
case "}":
|
|
296129
|
-
|
|
298216
|
+
range2 = {
|
|
296130
298217
|
atLeast,
|
|
296131
298218
|
atMost: atLeast
|
|
296132
298219
|
};
|
|
@@ -296135,12 +298222,12 @@ var init_regexp_parser = __esm({
|
|
|
296135
298222
|
let atMost;
|
|
296136
298223
|
if (this.isDigit()) {
|
|
296137
298224
|
atMost = this.integerIncludingZero();
|
|
296138
|
-
|
|
298225
|
+
range2 = {
|
|
296139
298226
|
atLeast,
|
|
296140
298227
|
atMost
|
|
296141
298228
|
};
|
|
296142
298229
|
} else {
|
|
296143
|
-
|
|
298230
|
+
range2 = {
|
|
296144
298231
|
atLeast,
|
|
296145
298232
|
atMost: Infinity
|
|
296146
298233
|
};
|
|
@@ -296148,25 +298235,25 @@ var init_regexp_parser = __esm({
|
|
|
296148
298235
|
this.consumeChar("}");
|
|
296149
298236
|
break;
|
|
296150
298237
|
}
|
|
296151
|
-
if (isBacktracking === true &&
|
|
298238
|
+
if (isBacktracking === true && range2 === void 0) {
|
|
296152
298239
|
return void 0;
|
|
296153
298240
|
}
|
|
296154
|
-
ASSERT_EXISTS(
|
|
298241
|
+
ASSERT_EXISTS(range2);
|
|
296155
298242
|
break;
|
|
296156
298243
|
}
|
|
296157
|
-
if (isBacktracking === true &&
|
|
298244
|
+
if (isBacktracking === true && range2 === void 0) {
|
|
296158
298245
|
return void 0;
|
|
296159
298246
|
}
|
|
296160
|
-
if (ASSERT_EXISTS(
|
|
298247
|
+
if (ASSERT_EXISTS(range2)) {
|
|
296161
298248
|
if (this.peekChar(0) === "?") {
|
|
296162
298249
|
this.consumeChar("?");
|
|
296163
|
-
|
|
298250
|
+
range2.greedy = false;
|
|
296164
298251
|
} else {
|
|
296165
|
-
|
|
298252
|
+
range2.greedy = true;
|
|
296166
298253
|
}
|
|
296167
|
-
|
|
296168
|
-
|
|
296169
|
-
return
|
|
298254
|
+
range2.type = "Quantifier";
|
|
298255
|
+
range2.loc = this.loc(begin);
|
|
298256
|
+
return range2;
|
|
296170
298257
|
}
|
|
296171
298258
|
}
|
|
296172
298259
|
atom() {
|
|
@@ -296868,18 +298955,18 @@ function firstCharOptimizedIndices(ast, result, ignoreCase) {
|
|
|
296868
298955
|
if (typeof code === "number") {
|
|
296869
298956
|
addOptimizedIdxToResult(code, result, ignoreCase);
|
|
296870
298957
|
} else {
|
|
296871
|
-
const
|
|
298958
|
+
const range2 = code;
|
|
296872
298959
|
if (ignoreCase === true) {
|
|
296873
|
-
for (let rangeCode =
|
|
298960
|
+
for (let rangeCode = range2.from; rangeCode <= range2.to; rangeCode++) {
|
|
296874
298961
|
addOptimizedIdxToResult(rangeCode, result, ignoreCase);
|
|
296875
298962
|
}
|
|
296876
298963
|
} else {
|
|
296877
|
-
for (let rangeCode =
|
|
298964
|
+
for (let rangeCode = range2.from; rangeCode <= range2.to && rangeCode < minOptimizationVal; rangeCode++) {
|
|
296878
298965
|
addOptimizedIdxToResult(rangeCode, result, ignoreCase);
|
|
296879
298966
|
}
|
|
296880
|
-
if (
|
|
296881
|
-
const minUnOptVal =
|
|
296882
|
-
const maxUnOptVal =
|
|
298967
|
+
if (range2.to >= minOptimizationVal) {
|
|
298968
|
+
const minUnOptVal = range2.from >= minOptimizationVal ? range2.from : minOptimizationVal;
|
|
298969
|
+
const maxUnOptVal = range2.to;
|
|
296883
298970
|
const minOptIdx = charCodeToOptimizedIndex(minUnOptVal);
|
|
296884
298971
|
const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal);
|
|
296885
298972
|
for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {
|
|
@@ -296940,8 +299027,8 @@ function findCode(setNode, targetCharCodes) {
|
|
|
296940
299027
|
if (typeof codeOrRange === "number") {
|
|
296941
299028
|
return includes_default(targetCharCodes, codeOrRange);
|
|
296942
299029
|
} else {
|
|
296943
|
-
const
|
|
296944
|
-
return find_default(targetCharCodes, (targetCode) =>
|
|
299030
|
+
const range2 = codeOrRange;
|
|
299031
|
+
return find_default(targetCharCodes, (targetCode) => range2.from <= targetCode && targetCode <= range2.to) !== void 0;
|
|
296945
299032
|
}
|
|
296946
299033
|
});
|
|
296947
299034
|
}
|
|
@@ -314846,8 +316933,8 @@ var require_createRange = __commonJS({
|
|
|
314846
316933
|
var require_range = __commonJS({
|
|
314847
316934
|
"node_modules/lodash/range.js"(exports2, module2) {
|
|
314848
316935
|
var createRange = require_createRange();
|
|
314849
|
-
var
|
|
314850
|
-
module2.exports =
|
|
316936
|
+
var range2 = createRange();
|
|
316937
|
+
module2.exports = range2;
|
|
314851
316938
|
}
|
|
314852
316939
|
});
|
|
314853
316940
|
|
|
@@ -329700,7 +331787,7 @@ function parseEnabledServers(config) {
|
|
|
329700
331787
|
}
|
|
329701
331788
|
return servers;
|
|
329702
331789
|
}
|
|
329703
|
-
var import_fs9, import_path9, import_os3, import_url4, __filename4,
|
|
331790
|
+
var import_fs9, import_path9, import_os3, import_url4, __filename4, __dirname5, DEFAULT_TIMEOUT, MAX_TIMEOUT, DEFAULT_CONFIG;
|
|
329704
331791
|
var init_config = __esm({
|
|
329705
331792
|
"src/agent/mcp/config.js"() {
|
|
329706
331793
|
"use strict";
|
|
@@ -329709,7 +331796,7 @@ var init_config = __esm({
|
|
|
329709
331796
|
import_os3 = __nccwpck_require__(70857);
|
|
329710
331797
|
import_url4 = __nccwpck_require__(87016);
|
|
329711
331798
|
__filename4 = (0, import_url4.fileURLToPath)("file:///");
|
|
329712
|
-
|
|
331799
|
+
__dirname5 = (0, import_path9.dirname)(__filename4);
|
|
329713
331800
|
DEFAULT_TIMEOUT = 3e4;
|
|
329714
331801
|
MAX_TIMEOUT = (() => {
|
|
329715
331802
|
if (process.env.MCP_MAX_TIMEOUT) {
|
|
@@ -329723,7 +331810,7 @@ var init_config = __esm({
|
|
|
329723
331810
|
// Example probe server configuration
|
|
329724
331811
|
"probe-local": {
|
|
329725
331812
|
command: "node",
|
|
329726
|
-
args: [(0, import_path9.join)(
|
|
331813
|
+
args: [(0, import_path9.join)(__dirname5, "../../../examples/chat/mcpServer.js")],
|
|
329727
331814
|
transport: "stdio",
|
|
329728
331815
|
enabled: false
|
|
329729
331816
|
},
|
|
@@ -335307,7 +337394,7 @@ var require_compose_scalar = __commonJS({
|
|
|
335307
337394
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
335308
337395
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
335309
337396
|
function composeScalar(ctx, token, tagToken, onError) {
|
|
335310
|
-
const { value, type, comment, range:
|
|
337397
|
+
const { value, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
|
335311
337398
|
const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
|
|
335312
337399
|
let tag2;
|
|
335313
337400
|
if (ctx.options.stringKeys && ctx.atKey) {
|
|
@@ -335327,7 +337414,7 @@ var require_compose_scalar = __commonJS({
|
|
|
335327
337414
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
335328
337415
|
scalar = new Scalar.Scalar(value);
|
|
335329
337416
|
}
|
|
335330
|
-
scalar.range =
|
|
337417
|
+
scalar.range = range2;
|
|
335331
337418
|
scalar.source = value;
|
|
335332
337419
|
if (type)
|
|
335333
337420
|
scalar.type = type;
|
|
@@ -351581,7 +353668,7 @@ var init_executePlan = __esm({
|
|
|
351581
353668
|
init_query();
|
|
351582
353669
|
init_extract();
|
|
351583
353670
|
init_delegate();
|
|
351584
|
-
|
|
353671
|
+
init_esm5();
|
|
351585
353672
|
init_bash();
|
|
351586
353673
|
RAW_OUTPUT_START = "<<<RAW_OUTPUT>>>";
|
|
351587
353674
|
RAW_OUTPUT_END = "<<<END_RAW_OUTPUT>>>";
|
|
@@ -394863,7 +396950,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Pro
|
|
|
394863
396950
|
/***/ ((module) => {
|
|
394864
396951
|
|
|
394865
396952
|
"use strict";
|
|
394866
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.
|
|
396953
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.42","main":"dist/index.js","bin":{"visor":"./dist/index.js"},"exports":{".":{"require":"./dist/index.js","import":"./dist/index.js"},"./sdk":{"types":"./dist/sdk/sdk.d.ts","import":"./dist/sdk/sdk.mjs","require":"./dist/sdk/sdk.js"},"./cli":{"require":"./dist/index.js"}},"files":["dist/","defaults/","action.yml","README.md","LICENSE"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build:cli":"ncc build src/index.ts -o dist && cp -r defaults dist/ && cp -r output dist/ && cp -r docs dist/ && cp -r examples dist/ && cp -r src/debug-visualizer/ui dist/debug-visualizer/ && node scripts/inject-version.js && echo \'#!/usr/bin/env node\' | cat - dist/index.js > temp && mv temp dist/index.js && chmod +x dist/index.js","build:sdk":"tsup src/sdk.ts --dts --sourcemap --format esm,cjs --out-dir dist/sdk","build":"./scripts/build-oss.sh","build:ee":"npm run build:cli && npm run build:sdk","test":"jest && npm run test:yaml","test:unit":"jest","prepublishOnly":"npm run build","test:watch":"jest --watch","test:coverage":"jest --coverage","test:ee":"jest --testPathPatterns=\'tests/ee\' --testPathIgnorePatterns=\'/node_modules/\' --no-coverage","test:manual:bash":"RUN_MANUAL_TESTS=true jest tests/manual/bash-config-manual.test.ts","lint":"eslint src tests --ext .ts","lint:fix":"eslint src tests --ext .ts --fix","format":"prettier --write src tests","format:check":"prettier --check src tests","clean":"","clean:traces":"node scripts/clean-traces.js","prebuild":"npm run clean && node scripts/generate-config-schema.js","pretest":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","pretest:unit":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","test:with-build":"npm run build:cli && jest","test:yaml":"node dist/index.js test --progress compact","test:yaml:parallel":"node dist/index.js test --progress compact --max-parallel 4","prepare":"husky","pre-commit":"lint-staged","deploy:site":"cd site && npx wrangler pages deploy . --project-name=visor-site --commit-dirty=true","deploy:worker":"npx wrangler deploy","deploy":"npm run deploy:site && npm run deploy:worker","publish:ee":"./scripts/publish-ee.sh","release":"./scripts/release.sh","release:patch":"./scripts/release.sh patch","release:minor":"./scripts/release.sh minor","release:major":"./scripts/release.sh major","release:prerelease":"./scripts/release.sh prerelease","docs:validate":"node scripts/validate-readme-links.js","workshop:setup":"npm install -D reveal-md@6.1.2","workshop:serve":"cd workshop && reveal-md slides.md -w","workshop:export":"reveal-md workshop/slides.md --static workshop/build","workshop:pdf":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter","workshop:pdf:ci":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter --puppeteer-launch-args=\\"--no-sandbox --disable-dev-shm-usage\\"","workshop:pdf:a4":"reveal-md workshop/slides.md --print workshop/Visor-Workshop-A4.pdf --print-size A4","workshop:build":"npm run workshop:export && npm run workshop:pdf","simulate:issue":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issues --action opened --debug","simulate:comment":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issue_comment --action created --debug"},"keywords":["code-review","ai","github-action","cli","pr-review","visor"],"author":"Probe Labs","license":"MIT","description":"AI workflow engine for code review, assistants, and automation — orchestrate checks, MCP tools, and AI providers with YAML-driven pipelines","repository":{"type":"git","url":"git+https://github.com/probelabs/visor.git"},"bugs":{"url":"https://github.com/probelabs/visor/issues"},"homepage":"https://github.com/probelabs/visor#readme","dependencies":{"@actions/core":"^1.11.1","@apidevtools/swagger-parser":"^12.1.0","@modelcontextprotocol/sdk":"^1.25.3","@nyariv/sandboxjs":"github:probelabs/SandboxJS#f1c13b8eee98734a8ea024061eada4aa9a9ff2e9","@octokit/action":"^8.0.2","@octokit/auth-app":"^8.1.0","@octokit/core":"^7.0.3","@octokit/rest":"^22.0.0","@opentelemetry/api":"^1.9.0","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-trace-otlp-grpc":"^0.203.0","@opentelemetry/exporter-trace-otlp-http":"^0.203.0","@opentelemetry/instrumentation":"^0.203.0","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.203.0","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/semantic-conventions":"^1.30.1","@probelabs/probe":"^0.6.0-rc262","@types/commander":"^2.12.0","@types/uuid":"^10.0.0","acorn":"^8.16.0","acorn-walk":"^8.3.5","ajv":"^8.17.1","ajv-formats":"^3.0.1","better-sqlite3":"^11.0.0","blessed":"^0.1.81","cli-table3":"^0.6.5","commander":"^14.0.0","deepmerge":"^4.3.1","dotenv":"^17.2.3","ignore":"^7.0.5","js-yaml":"^4.1.0","jsonpath-plus":"^10.4.0","liquidjs":"^10.21.1","minimatch":"^10.2.2","node-cron":"^3.0.3","open":"^9.1.0","simple-git":"^3.28.0","uuid":"^11.1.0","ws":"^8.18.3"},"optionalDependencies":{"@anthropic/claude-code-sdk":"npm:null@*","@open-policy-agent/opa-wasm":"^1.10.0","knex":"^3.1.0","mysql2":"^3.11.0","pg":"^8.13.0","tedious":"^19.0.0"},"devDependencies":{"@eslint/js":"^9.34.0","@kie/act-js":"^2.6.2","@kie/mock-github":"^2.0.1","@swc/core":"^1.13.2","@swc/jest":"^0.2.37","@types/better-sqlite3":"^7.6.0","@types/blessed":"^0.1.27","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/node":"^24.3.0","@types/node-cron":"^3.0.11","@types/ws":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.42.0","@typescript-eslint/parser":"^8.42.0","@vercel/ncc":"^0.38.4","eslint":"^9.34.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","husky":"^9.1.7","jest":"^30.1.3","lint-staged":"^16.1.6","prettier":"^3.6.2","reveal-md":"^6.1.2","ts-json-schema-generator":"^1.5.1","ts-node":"^10.9.2","tsup":"^8.5.0","typescript":"^5.9.2","wrangler":"^3.0.0"},"peerDependenciesMeta":{"@anthropic/claude-code-sdk":{"optional":true}},"directories":{"test":"tests"},"lint-staged":{"src/**/*.{ts,js}":["eslint --fix","prettier --write"],"tests/**/*.{ts,js}":["eslint --fix","prettier --write"],"*.{json,md,yml,yaml}":["prettier --write"]}}');
|
|
394867
396954
|
|
|
394868
396955
|
/***/ })
|
|
394869
396956
|
|