@probelabs/visor 0.1.147 → 0.1.148
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/frontends/github-frontend.d.ts +2 -1
- package/dist/frontends/github-frontend.d.ts.map +1 -1
- package/dist/index.js +726 -113
- package/dist/output/traces/{run-2026-02-27T11-27-22-261Z.ndjson → run-2026-03-02T18-32-11-359Z.ndjson} +84 -84
- package/dist/{traces/run-2026-02-27T11-28-08-546Z.ndjson → output/traces/run-2026-03-02T18-32-55-702Z.ndjson} +1171 -1171
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/dist/scheduler/schedule-tool.d.ts.map +1 -1
- package/dist/scheduler/scheduler.d.ts +5 -0
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/sdk/{check-provider-registry-CTZA3EVE.mjs → check-provider-registry-35BPTY4W.mjs} +5 -6
- package/dist/sdk/{check-provider-registry-SCPM6DIT.mjs → check-provider-registry-DVQDGTOE.mjs} +5 -6
- package/dist/sdk/{check-provider-registry-CDL5AJSI.mjs → check-provider-registry-KHPY6LB4.mjs} +5 -6
- package/dist/sdk/{chunk-4F5UVWAN.mjs → chunk-62TNF5PJ.mjs} +2 -2
- package/dist/sdk/{chunk-4F5UVWAN.mjs.map → chunk-62TNF5PJ.mjs.map} +1 -1
- package/dist/sdk/{chunk-H23T7J6Y.mjs → chunk-6N6JRWCW.mjs} +2742 -276
- package/dist/sdk/chunk-6N6JRWCW.mjs.map +1 -0
- package/dist/sdk/{chunk-JKWLGLDR.mjs → chunk-AYQE4JCU.mjs} +3 -3
- package/dist/sdk/{chunk-FBJ7MC7R.mjs → chunk-CISJ6DJW.mjs} +3 -3
- package/dist/sdk/{chunk-YQZW3D2V.mjs → chunk-EGUHXVWS.mjs} +3 -3
- package/dist/sdk/{chunk-YQZW3D2V.mjs.map → chunk-EGUHXVWS.mjs.map} +1 -1
- package/dist/sdk/{chunk-EWGX7LI7.mjs → chunk-H4AYMOAT.mjs} +2742 -276
- package/dist/sdk/chunk-H4AYMOAT.mjs.map +1 -0
- package/dist/sdk/{chunk-R77LN3OE.mjs → chunk-IF2UD2KS.mjs} +2742 -276
- package/dist/sdk/chunk-IF2UD2KS.mjs.map +1 -0
- package/dist/sdk/{chunk-2NFKN6CY.mjs → chunk-RJLJUTSU.mjs} +2 -2
- package/dist/sdk/{chunk-V2QW6ECX.mjs → chunk-S2YO4ZE3.mjs} +2 -2
- package/dist/sdk/{failure-condition-evaluator-FHNZL2US.mjs → failure-condition-evaluator-I6QWFKV3.mjs} +3 -3
- package/dist/sdk/{failure-condition-evaluator-2B5WY7QN.mjs → failure-condition-evaluator-IVCTD4BZ.mjs} +3 -3
- package/dist/sdk/{github-frontend-V3WUHL6E.mjs → github-frontend-2MC77L7F.mjs} +16 -4
- package/dist/sdk/github-frontend-2MC77L7F.mjs.map +1 -0
- package/dist/sdk/{github-frontend-47EU2HBY.mjs → github-frontend-DFT5G32K.mjs} +16 -4
- package/dist/sdk/github-frontend-DFT5G32K.mjs.map +1 -0
- package/dist/sdk/{host-GVR4UGZ3.mjs → host-4F6I3ZXN.mjs} +2 -2
- package/dist/sdk/{host-UQUQIYFG.mjs → host-H7IX4GBK.mjs} +2 -2
- package/dist/sdk/{routing-CZ36LVVS.mjs → routing-LU5PAREW.mjs} +4 -4
- package/dist/sdk/{routing-THIWDEYY.mjs → routing-UT3BXBXH.mjs} +4 -4
- package/dist/sdk/schedule-tool-CONR4VW3.mjs +35 -0
- package/dist/sdk/schedule-tool-K3GQXCBN.mjs +35 -0
- package/dist/sdk/schedule-tool-SBXAEBDD.mjs +35 -0
- package/dist/sdk/{schedule-tool-handler-KFYNV7HL.mjs → schedule-tool-handler-GFQCJAVZ.mjs} +5 -6
- package/dist/sdk/{schedule-tool-handler-QUMAF2DJ.mjs → schedule-tool-handler-R7PG3VMR.mjs} +5 -6
- package/dist/sdk/{schedule-tool-handler-GEH62OUM.mjs → schedule-tool-handler-YUC6CAXX.mjs} +5 -6
- package/dist/sdk/sdk.js +1551 -349
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +4 -5
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk/{trace-helpers-W7TF5ZKF.mjs → trace-helpers-6ROJR7N3.mjs} +2 -2
- package/dist/sdk/{trace-helpers-EHDZ42HH.mjs → trace-helpers-J463EU4B.mjs} +2 -2
- package/dist/sdk/{workflow-check-provider-5453TW65.mjs → workflow-check-provider-DYSO3PML.mjs} +5 -6
- package/dist/sdk/{workflow-check-provider-HMABCGB5.mjs → workflow-check-provider-FIFFQDQU.mjs} +5 -6
- package/dist/sdk/workflow-check-provider-FIFFQDQU.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-3K7732MW.mjs → workflow-check-provider-GJNGTS3F.mjs} +5 -6
- package/dist/sdk/workflow-check-provider-GJNGTS3F.mjs.map +1 -0
- package/dist/state-machine/context/build-engine-context.d.ts.map +1 -1
- package/dist/traces/{run-2026-02-27T11-27-22-261Z.ndjson → run-2026-03-02T18-32-11-359Z.ndjson} +84 -84
- package/dist/{output/traces/run-2026-02-27T11-28-08-546Z.ndjson → traces/run-2026-03-02T18-32-55-702Z.ndjson} +1171 -1171
- package/dist/utils/tool-resolver.d.ts.map +1 -1
- package/dist/utils/workspace-manager.d.ts +31 -8
- package/dist/utils/workspace-manager.d.ts.map +1 -1
- package/dist/utils/worktree-manager.d.ts +6 -0
- package/dist/utils/worktree-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/sdk/chunk-EWGX7LI7.mjs.map +0 -1
- package/dist/sdk/chunk-H23T7J6Y.mjs.map +0 -1
- package/dist/sdk/chunk-R77LN3OE.mjs.map +0 -1
- package/dist/sdk/chunk-XKCER23W.mjs +0 -1490
- package/dist/sdk/chunk-XKCER23W.mjs.map +0 -1
- package/dist/sdk/github-frontend-47EU2HBY.mjs.map +0 -1
- package/dist/sdk/github-frontend-V3WUHL6E.mjs.map +0 -1
- package/dist/sdk/schedule-tool-2COUUTF7.mjs +0 -18
- /package/dist/sdk/{check-provider-registry-CDL5AJSI.mjs.map → check-provider-registry-35BPTY4W.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-CTZA3EVE.mjs.map → check-provider-registry-DVQDGTOE.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-SCPM6DIT.mjs.map → check-provider-registry-KHPY6LB4.mjs.map} +0 -0
- /package/dist/sdk/{chunk-FBJ7MC7R.mjs.map → chunk-AYQE4JCU.mjs.map} +0 -0
- /package/dist/sdk/{chunk-JKWLGLDR.mjs.map → chunk-CISJ6DJW.mjs.map} +0 -0
- /package/dist/sdk/{chunk-2NFKN6CY.mjs.map → chunk-RJLJUTSU.mjs.map} +0 -0
- /package/dist/sdk/{chunk-V2QW6ECX.mjs.map → chunk-S2YO4ZE3.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-2B5WY7QN.mjs.map → failure-condition-evaluator-I6QWFKV3.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-FHNZL2US.mjs.map → failure-condition-evaluator-IVCTD4BZ.mjs.map} +0 -0
- /package/dist/sdk/{host-GVR4UGZ3.mjs.map → host-4F6I3ZXN.mjs.map} +0 -0
- /package/dist/sdk/{host-UQUQIYFG.mjs.map → host-H7IX4GBK.mjs.map} +0 -0
- /package/dist/sdk/{routing-CZ36LVVS.mjs.map → routing-LU5PAREW.mjs.map} +0 -0
- /package/dist/sdk/{routing-THIWDEYY.mjs.map → routing-UT3BXBXH.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-2COUUTF7.mjs.map → schedule-tool-CONR4VW3.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-GEH62OUM.mjs.map → schedule-tool-K3GQXCBN.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-KFYNV7HL.mjs.map → schedule-tool-SBXAEBDD.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-QUMAF2DJ.mjs.map → schedule-tool-handler-GFQCJAVZ.mjs.map} +0 -0
- /package/dist/sdk/{trace-helpers-EHDZ42HH.mjs.map → schedule-tool-handler-R7PG3VMR.mjs.map} +0 -0
- /package/dist/sdk/{trace-helpers-W7TF5ZKF.mjs.map → schedule-tool-handler-YUC6CAXX.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-3K7732MW.mjs.map → trace-helpers-6ROJR7N3.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-5453TW65.mjs.map → trace-helpers-J463EU4B.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-HMABCGB5.mjs.map → workflow-check-provider-DYSO3PML.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.148';
|
|
3
|
+
process.env.PROBE_VERSION = '0.6.0-rc264';
|
|
4
|
+
process.env.VISOR_COMMIT_SHA = '8d09da19e112d8649810da46458aa77d3f034fc6';
|
|
5
|
+
process.env.VISOR_COMMIT_SHORT = '8d09da19';
|
|
6
6
|
/******/ (() => { // webpackBootstrap
|
|
7
7
|
/******/ var __webpack_modules__ = ({
|
|
8
8
|
|
|
@@ -167903,6 +167903,7 @@ class GitHubFrontend {
|
|
|
167903
167903
|
minUpdateDelayMs = 1000; // Minimum delay between updates (public for testing)
|
|
167904
167904
|
// Cache of created GitHub comment IDs per group to handle API eventual consistency
|
|
167905
167905
|
createdCommentGithubIds = new Map();
|
|
167906
|
+
_stopped = false;
|
|
167906
167907
|
start(ctx) {
|
|
167907
167908
|
const log = ctx.logger;
|
|
167908
167909
|
const bus = ctx.eventBus;
|
|
@@ -168030,10 +168031,23 @@ class GitHubFrontend {
|
|
|
168030
168031
|
}
|
|
168031
168032
|
}));
|
|
168032
168033
|
}
|
|
168033
|
-
stop() {
|
|
168034
|
+
async stop() {
|
|
168035
|
+
this._stopped = true;
|
|
168034
168036
|
for (const s of this.subs)
|
|
168035
168037
|
s.unsubscribe();
|
|
168036
168038
|
this.subs = [];
|
|
168039
|
+
if (this._timer) {
|
|
168040
|
+
clearTimeout(this._timer);
|
|
168041
|
+
this._timer = null;
|
|
168042
|
+
}
|
|
168043
|
+
this._pendingIds.clear();
|
|
168044
|
+
// Drain any in-flight updateGroupedComment operations so callers that
|
|
168045
|
+
// await stop() (e.g. FrontendsHost.stopAll) are guaranteed no async
|
|
168046
|
+
// work leaks after stop resolves.
|
|
168047
|
+
const pending = Array.from(this.updateLocks.values());
|
|
168048
|
+
if (pending.length > 0) {
|
|
168049
|
+
await Promise.allSettled(pending);
|
|
168050
|
+
}
|
|
168037
168051
|
}
|
|
168038
168052
|
async buildFullBody(ctx, group) {
|
|
168039
168053
|
const header = this.renderThreadHeader(ctx, group);
|
|
@@ -168124,6 +168138,8 @@ ${end}`);
|
|
|
168124
168138
|
*/
|
|
168125
168139
|
async performGroupedCommentUpdate(ctx, comments, group, changedIds) {
|
|
168126
168140
|
try {
|
|
168141
|
+
if (this._stopped)
|
|
168142
|
+
return;
|
|
168127
168143
|
if (!ctx.run.repo || !ctx.run.pr)
|
|
168128
168144
|
return;
|
|
168129
168145
|
// Check if PR comments are enabled (default to true if not specified)
|
|
@@ -179474,12 +179490,53 @@ class AICheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
179474
179490
|
if (Object.keys(dynamicServers).length > 0) {
|
|
179475
179491
|
Object.assign(mcpServers, dynamicServers);
|
|
179476
179492
|
}
|
|
179493
|
+
// Emit telemetry for tool setup diagnostics
|
|
179494
|
+
try {
|
|
179495
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179496
|
+
if (span) {
|
|
179497
|
+
span.addEvent('tool_setup.mcp_servers_js', {
|
|
179498
|
+
'tool_setup.server_count': Object.keys(dynamicServers).length,
|
|
179499
|
+
'tool_setup.server_names': Object.keys(dynamicServers).join(','),
|
|
179500
|
+
'tool_setup.workflow_entries': Object.entries(dynamicServers)
|
|
179501
|
+
.filter(([, cfg]) => cfg?.workflow)
|
|
179502
|
+
.map(([name, cfg]) => `${name}→${cfg.workflow}`)
|
|
179503
|
+
.join(','),
|
|
179504
|
+
});
|
|
179505
|
+
}
|
|
179506
|
+
}
|
|
179507
|
+
catch { }
|
|
179477
179508
|
}
|
|
179478
179509
|
catch (error) {
|
|
179479
|
-
|
|
179510
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
179511
|
+
logger_1.logger.error(`[AICheckProvider] Failed to evaluate ai_mcp_servers_js: ${errMsg}`);
|
|
179512
|
+
// Emit telemetry for the failure
|
|
179513
|
+
try {
|
|
179514
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179515
|
+
if (span) {
|
|
179516
|
+
span.addEvent('tool_setup.mcp_servers_js_error', {
|
|
179517
|
+
'tool_setup.error': errMsg,
|
|
179518
|
+
});
|
|
179519
|
+
}
|
|
179520
|
+
}
|
|
179521
|
+
catch { }
|
|
179480
179522
|
// Continue without dynamic servers
|
|
179481
179523
|
}
|
|
179482
179524
|
}
|
|
179525
|
+
else if (mcpServersJsExpr && !_dependencyResults) {
|
|
179526
|
+
// Expression exists but no dependency results — this means the check has no dependencies
|
|
179527
|
+
// or the dependency results map was empty/undefined
|
|
179528
|
+
try {
|
|
179529
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179530
|
+
if (span) {
|
|
179531
|
+
span.addEvent('tool_setup.mcp_servers_js_skipped', {
|
|
179532
|
+
'tool_setup.reason': 'no_dependency_results',
|
|
179533
|
+
'tool_setup.has_expr': true,
|
|
179534
|
+
'tool_setup.has_deps': false,
|
|
179535
|
+
});
|
|
179536
|
+
}
|
|
179537
|
+
}
|
|
179538
|
+
catch { }
|
|
179539
|
+
}
|
|
179483
179540
|
// 5. Resolve environment variable placeholders in MCP server env configs
|
|
179484
179541
|
// Supports ${VAR} and ${{ env.VAR }} syntax
|
|
179485
179542
|
for (const serverConfig of Object.values(mcpServers)) {
|
|
@@ -179632,6 +179689,28 @@ class AICheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
179632
179689
|
try {
|
|
179633
179690
|
// Load custom tools from global config (supports workflows and custom tools)
|
|
179634
179691
|
const customTools = this.loadCustomTools(customToolsToLoad, config);
|
|
179692
|
+
// Emit telemetry for tool resolution results
|
|
179693
|
+
try {
|
|
179694
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179695
|
+
if (span) {
|
|
179696
|
+
const requestedNames = customToolsToLoad.map(item => typeof item === 'string'
|
|
179697
|
+
? item
|
|
179698
|
+
: `${item.name || item.workflow}(wf:${item.workflow})`);
|
|
179699
|
+
span.addEvent('tool_setup.resolution', {
|
|
179700
|
+
'tool_setup.requested_count': customToolsToLoad.length,
|
|
179701
|
+
'tool_setup.requested_names': requestedNames.join(','),
|
|
179702
|
+
'tool_setup.resolved_count': customTools.size,
|
|
179703
|
+
'tool_setup.resolved_names': Array.from(customTools.keys()).join(','),
|
|
179704
|
+
'tool_setup.missing_count': customToolsToLoad.length - customTools.size,
|
|
179705
|
+
});
|
|
179706
|
+
}
|
|
179707
|
+
}
|
|
179708
|
+
catch { }
|
|
179709
|
+
if (customToolsToLoad.length > 0 && customTools.size === 0) {
|
|
179710
|
+
logger_1.logger.warn(`[AICheckProvider] All ${customToolsToLoad.length} custom tools failed to resolve! ` +
|
|
179711
|
+
`Requested: ${customToolsToLoad.map(item => (typeof item === 'string' ? item : item.workflow)).join(', ')}. ` +
|
|
179712
|
+
`AI will have no workflow tools available.`);
|
|
179713
|
+
}
|
|
179635
179714
|
// Add schedule tool if enabled (via ai_mcp_servers { tool: 'schedule' } or enable_scheduler)
|
|
179636
179715
|
if (scheduleToolEnabled) {
|
|
179637
179716
|
const scheduleTool = (0, schedule_tool_1.getScheduleToolDefinition)();
|
|
@@ -179669,10 +179748,36 @@ class AICheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
179669
179748
|
}
|
|
179670
179749
|
}
|
|
179671
179750
|
catch (error) {
|
|
179672
|
-
|
|
179751
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
179752
|
+
logger_1.logger.error(`[AICheckProvider] Failed to start custom tools SSE server '${customToolsServerName}': ${errMsg}`);
|
|
179753
|
+
// Emit telemetry for SSE server failure
|
|
179754
|
+
try {
|
|
179755
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179756
|
+
if (span) {
|
|
179757
|
+
span.addEvent('tool_setup.sse_server_error', {
|
|
179758
|
+
'tool_setup.error': errMsg,
|
|
179759
|
+
'tool_setup.server_name': customToolsServerName || '',
|
|
179760
|
+
});
|
|
179761
|
+
}
|
|
179762
|
+
}
|
|
179763
|
+
catch { }
|
|
179673
179764
|
// Continue without custom tools
|
|
179674
179765
|
}
|
|
179675
179766
|
}
|
|
179767
|
+
// Emit final tool setup summary telemetry
|
|
179768
|
+
try {
|
|
179769
|
+
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
|
179770
|
+
if (span) {
|
|
179771
|
+
const finalServerNames = Object.keys(mcpServers);
|
|
179772
|
+
span.addEvent('tool_setup.final', {
|
|
179773
|
+
'tool_setup.final_server_count': finalServerNames.length,
|
|
179774
|
+
'tool_setup.final_server_names': finalServerNames.join(','),
|
|
179775
|
+
'tool_setup.has_custom_tools_server': !!customToolsServer,
|
|
179776
|
+
'tool_setup.tools_disabled': !!config.ai?.disableTools,
|
|
179777
|
+
});
|
|
179778
|
+
}
|
|
179779
|
+
}
|
|
179780
|
+
catch { }
|
|
179676
179781
|
// Pass MCP server config directly to AI service (unless tools are disabled)
|
|
179677
179782
|
if (Object.keys(mcpServers).length > 0 && !config.ai?.disableTools) {
|
|
179678
179783
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -192219,6 +192324,11 @@ async function handleCancel(positional, flags) {
|
|
|
192219
192324
|
process.exit(1);
|
|
192220
192325
|
}
|
|
192221
192326
|
await store.deleteAsync(schedule.id);
|
|
192327
|
+
// Also cancel the in-memory job (cron or timeout) so it doesn't fire
|
|
192328
|
+
const scheduler = (0, scheduler_1.getScheduler)();
|
|
192329
|
+
if (scheduler) {
|
|
192330
|
+
scheduler.cancelSchedule(schedule.id);
|
|
192331
|
+
}
|
|
192222
192332
|
console.log('Schedule cancelled successfully!');
|
|
192223
192333
|
console.log();
|
|
192224
192334
|
console.log(` ID: ${schedule.id.substring(0, 8)}`);
|
|
@@ -193126,6 +193236,7 @@ exports.isScheduleTool = isScheduleTool;
|
|
|
193126
193236
|
exports.buildScheduleToolContext = buildScheduleToolContext;
|
|
193127
193237
|
const schedule_store_1 = __nccwpck_require__(27336);
|
|
193128
193238
|
const schedule_parser_1 = __nccwpck_require__(48478);
|
|
193239
|
+
const scheduler_1 = __nccwpck_require__(28404);
|
|
193129
193240
|
const logger_1 = __nccwpck_require__(86999);
|
|
193130
193241
|
/**
|
|
193131
193242
|
* Simple glob-style pattern matching for workflow names
|
|
@@ -193546,8 +193657,13 @@ async function handleCancel(args, context, store) {
|
|
|
193546
193657
|
error: 'You can only cancel your own schedules.',
|
|
193547
193658
|
};
|
|
193548
193659
|
}
|
|
193549
|
-
// Delete the schedule
|
|
193660
|
+
// Delete the schedule from DB
|
|
193550
193661
|
await store.deleteAsync(schedule.id);
|
|
193662
|
+
// Also cancel the in-memory job (cron or timeout) so it doesn't fire
|
|
193663
|
+
const scheduler = (0, scheduler_1.getScheduler)();
|
|
193664
|
+
if (scheduler) {
|
|
193665
|
+
scheduler.cancelSchedule(schedule.id);
|
|
193666
|
+
}
|
|
193551
193667
|
logger_1.logger.info(`[ScheduleTool] Cancelled schedule ${schedule.id} for user ${context.userId}`);
|
|
193552
193668
|
return {
|
|
193553
193669
|
success: true,
|
|
@@ -194005,6 +194121,27 @@ class Scheduler {
|
|
|
194005
194121
|
getStore() {
|
|
194006
194122
|
return this.store;
|
|
194007
194123
|
}
|
|
194124
|
+
/**
|
|
194125
|
+
* Cancel a schedule's in-memory job (cron or timeout).
|
|
194126
|
+
* Called after deleting from DB to ensure the job doesn't fire again.
|
|
194127
|
+
*/
|
|
194128
|
+
cancelSchedule(scheduleId) {
|
|
194129
|
+
// Stop cron job if it exists
|
|
194130
|
+
const cronJob = this.cronJobs.get(scheduleId);
|
|
194131
|
+
if (cronJob) {
|
|
194132
|
+
cronJob.stop();
|
|
194133
|
+
this.cronJobs.delete(scheduleId);
|
|
194134
|
+
logger_1.logger.debug(`[Scheduler] Cancelled cron job for schedule ${scheduleId}`);
|
|
194135
|
+
return;
|
|
194136
|
+
}
|
|
194137
|
+
// Clear timeout if it exists
|
|
194138
|
+
const timeout = this.oneTimeTimeouts.get(scheduleId);
|
|
194139
|
+
if (timeout) {
|
|
194140
|
+
clearTimeout(timeout);
|
|
194141
|
+
this.oneTimeTimeouts.delete(scheduleId);
|
|
194142
|
+
logger_1.logger.debug(`[Scheduler] Cancelled timeout for schedule ${scheduleId}`);
|
|
194143
|
+
}
|
|
194144
|
+
}
|
|
194008
194145
|
/**
|
|
194009
194146
|
* Start the scheduler
|
|
194010
194147
|
*/
|
|
@@ -194385,6 +194522,26 @@ class Scheduler {
|
|
|
194385
194522
|
* Execute a scheduled workflow
|
|
194386
194523
|
*/
|
|
194387
194524
|
async executeSchedule(schedule) {
|
|
194525
|
+
// DB freshness check: verify the schedule still exists and is active.
|
|
194526
|
+
// This prevents execution of cancelled or paused schedules when the
|
|
194527
|
+
// in-memory job fires after a DB-only cancellation.
|
|
194528
|
+
// Note: This is a single indexed primary-key lookup (<1ms for SQLite),
|
|
194529
|
+
// and only runs for user-created schedules (static cron jobs use
|
|
194530
|
+
// executeStaticCronJob instead), so the overhead is negligible
|
|
194531
|
+
// compared to the workflow execution that follows.
|
|
194532
|
+
try {
|
|
194533
|
+
const fresh = await this.store.getAsync(schedule.id);
|
|
194534
|
+
if (!fresh || fresh.status !== 'active') {
|
|
194535
|
+
logger_1.logger.info(`[Scheduler] Schedule ${schedule.id} is no longer active (${fresh ? fresh.status : 'deleted'}), skipping execution`);
|
|
194536
|
+
// Clean up the in-memory job since the schedule is gone/inactive
|
|
194537
|
+
this.cancelSchedule(schedule.id);
|
|
194538
|
+
return;
|
|
194539
|
+
}
|
|
194540
|
+
}
|
|
194541
|
+
catch {
|
|
194542
|
+
// If we can't check the DB, log and proceed (don't block execution on DB errors)
|
|
194543
|
+
logger_1.logger.warn(`[Scheduler] Could not verify schedule ${schedule.id} freshness, proceeding with execution`);
|
|
194544
|
+
}
|
|
194388
194545
|
const description = schedule.workflow || 'reminder';
|
|
194389
194546
|
logger_1.logger.info(`[Scheduler] Executing schedule ${schedule.id}: ${description}`);
|
|
194390
194547
|
const startTime = Date.now();
|
|
@@ -199617,6 +199774,13 @@ async function initializeWorkspace(context) {
|
|
|
199617
199774
|
process.env.VISOR_WORKSPACE_MAIN_PROJECT = info.mainProjectPath;
|
|
199618
199775
|
process.env.VISOR_WORKSPACE_MAIN_PROJECT_NAME = info.mainProjectName;
|
|
199619
199776
|
process.env.VISOR_ORIGINAL_WORKDIR = originalPath;
|
|
199777
|
+
// Prevent git from walking above the workspace base path.
|
|
199778
|
+
// Without this, git commands in workspace subdirectories can discover
|
|
199779
|
+
// a rogue .git in a parent directory (e.g. /tmp/.git) and leak
|
|
199780
|
+
// operations across all workspaces.
|
|
199781
|
+
const basePath = workspaceConfig?.base_path || process.env.VISOR_WORKSPACE_PATH || '/tmp/visor-workspaces';
|
|
199782
|
+
const existing = process.env.GIT_CEILING_DIRECTORIES;
|
|
199783
|
+
process.env.GIT_CEILING_DIRECTORIES = existing ? `${existing}:${basePath}` : basePath;
|
|
199620
199784
|
}
|
|
199621
199785
|
catch { }
|
|
199622
199786
|
logger_1.logger.info(`[Workspace] Initialized workspace: ${info.workspacePath}`);
|
|
@@ -220622,6 +220786,7 @@ function buildProviderTemplateContext(prInfo, dependencyResults, memoryStore, ou
|
|
|
220622
220786
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
220623
220787
|
exports.resolveTools = resolveTools;
|
|
220624
220788
|
const workflow_tool_executor_1 = __nccwpck_require__(30236);
|
|
220789
|
+
const workflow_registry_1 = __nccwpck_require__(82824);
|
|
220625
220790
|
const logger_1 = __nccwpck_require__(86999);
|
|
220626
220791
|
/**
|
|
220627
220792
|
* Resolve tool items to CustomToolDefinition instances.
|
|
@@ -220632,6 +220797,13 @@ const logger_1 = __nccwpck_require__(86999);
|
|
|
220632
220797
|
*/
|
|
220633
220798
|
function resolveTools(toolItems, globalTools, logPrefix = '[ToolResolver]') {
|
|
220634
220799
|
const tools = new Map();
|
|
220800
|
+
// Log registry state once for debugging workflow resolution failures
|
|
220801
|
+
const registry = workflow_registry_1.WorkflowRegistry.getInstance();
|
|
220802
|
+
const registeredWorkflows = registry.list().map(w => w.id);
|
|
220803
|
+
if (toolItems.some(item => typeof item !== 'string' && (0, workflow_tool_executor_1.isWorkflowToolReference)(item))) {
|
|
220804
|
+
logger_1.logger.info(`${logPrefix} Resolving ${toolItems.length} tool items. ` +
|
|
220805
|
+
`WorkflowRegistry has ${registeredWorkflows.length} workflows: [${registeredWorkflows.join(', ')}]`);
|
|
220806
|
+
}
|
|
220635
220807
|
for (const item of toolItems) {
|
|
220636
220808
|
// First, try to resolve as a workflow tool
|
|
220637
220809
|
const workflowTool = (0, workflow_tool_executor_1.resolveWorkflowToolFromItem)(item);
|
|
@@ -220651,7 +220823,8 @@ function resolveTools(toolItems, globalTools, logPrefix = '[ToolResolver]') {
|
|
|
220651
220823
|
logger_1.logger.warn(`${logPrefix} Tool '${item}' not found in global tools or workflow registry`);
|
|
220652
220824
|
}
|
|
220653
220825
|
else if ((0, workflow_tool_executor_1.isWorkflowToolReference)(item)) {
|
|
220654
|
-
logger_1.logger.warn(`${logPrefix} Workflow '${item.workflow}' referenced but not found in registry`
|
|
220826
|
+
logger_1.logger.warn(`${logPrefix} Workflow '${item.workflow}' referenced but not found in registry. ` +
|
|
220827
|
+
`Available: [${registeredWorkflows.join(', ')}]`);
|
|
220655
220828
|
}
|
|
220656
220829
|
}
|
|
220657
220830
|
if (tools.size === 0 && toolItems.length > 0 && !globalTools) {
|
|
@@ -221028,6 +221201,10 @@ class WorkspaceManager {
|
|
|
221028
221201
|
catch { }
|
|
221029
221202
|
await this.createMainProjectWorktree(mainProjectPath);
|
|
221030
221203
|
}
|
|
221204
|
+
else {
|
|
221205
|
+
// Worktree exists and is valid — update to latest upstream and clean
|
|
221206
|
+
await this.refreshWorktreeToUpstream(mainProjectPath);
|
|
221207
|
+
}
|
|
221031
221208
|
}
|
|
221032
221209
|
else {
|
|
221033
221210
|
await this.createMainProjectWorktree(mainProjectPath);
|
|
@@ -221243,32 +221420,129 @@ class WorkspaceManager {
|
|
|
221243
221420
|
return cleaned;
|
|
221244
221421
|
}
|
|
221245
221422
|
/**
|
|
221246
|
-
*
|
|
221247
|
-
*
|
|
221248
|
-
*
|
|
221249
|
-
*
|
|
221250
|
-
*
|
|
221251
|
-
*
|
|
221252
|
-
*
|
|
221253
|
-
* full clone/bare-repo/fetch/worktree pipeline.
|
|
221423
|
+
* visor-disable: architecture - The helpers below (resolveUpstreamRef,
|
|
221424
|
+
* fetchAndResolveUpstream, resetAndCleanWorktree, refreshWorktreeToUpstream)
|
|
221425
|
+
* are NOT duplicates of WorktreeManager's fetchRef/getCommitShaForRef/cleanWorktree.
|
|
221426
|
+
* WorktreeManager operates on BARE repo caches cloned from remote URLs, while
|
|
221427
|
+
* WorkspaceManager operates on the LOCAL working repo the user already has checked out.
|
|
221428
|
+
* The git commands differ (e.g. `fetch origin --prune` vs `fetch origin <ref>:<ref>`)
|
|
221429
|
+
* and sharing code would require adding a "local mode" to WorktreeManager for no benefit.
|
|
221254
221430
|
*/
|
|
221255
|
-
|
|
221256
|
-
|
|
221257
|
-
|
|
221258
|
-
|
|
221259
|
-
|
|
221260
|
-
|
|
221431
|
+
/**
|
|
221432
|
+
* Resolve the upstream default branch ref.
|
|
221433
|
+
* Tries origin/HEAD (symbolic), then origin/main, then origin/master.
|
|
221434
|
+
* Falls back to local HEAD if no remote is configured.
|
|
221435
|
+
*/
|
|
221436
|
+
async resolveUpstreamRef() {
|
|
221437
|
+
const esc = shellEscape(this.originalPath);
|
|
221438
|
+
// First, try to resolve origin/HEAD (follows the remote's default branch)
|
|
221439
|
+
const symbolicResult = await command_executor_1.commandExecutor.execute(`git -C ${esc} symbolic-ref refs/remotes/origin/HEAD 2>/dev/null`, { timeout: 10000 });
|
|
221440
|
+
if (symbolicResult.exitCode === 0 && symbolicResult.stdout.trim()) {
|
|
221441
|
+
// Returns something like "refs/remotes/origin/main"
|
|
221442
|
+
const ref = symbolicResult.stdout.trim().replace('refs/remotes/', '');
|
|
221443
|
+
logger_1.logger.debug(`[Workspace] Resolved upstream default branch via origin/HEAD: ${ref}`);
|
|
221444
|
+
return ref;
|
|
221445
|
+
}
|
|
221446
|
+
// Try origin/main
|
|
221447
|
+
const mainResult = await command_executor_1.commandExecutor.execute(`git -C ${esc} rev-parse --verify origin/main 2>/dev/null`, { timeout: 10000 });
|
|
221448
|
+
if (mainResult.exitCode === 0) {
|
|
221449
|
+
logger_1.logger.debug(`[Workspace] Using origin/main as upstream ref`);
|
|
221450
|
+
return 'origin/main';
|
|
221451
|
+
}
|
|
221452
|
+
// Try origin/master
|
|
221453
|
+
const masterResult = await command_executor_1.commandExecutor.execute(`git -C ${esc} rev-parse --verify origin/master 2>/dev/null`, { timeout: 10000 });
|
|
221454
|
+
if (masterResult.exitCode === 0) {
|
|
221455
|
+
logger_1.logger.debug(`[Workspace] Using origin/master as upstream ref`);
|
|
221456
|
+
return 'origin/master';
|
|
221457
|
+
}
|
|
221458
|
+
// Fallback: no remote configured, use local HEAD
|
|
221459
|
+
logger_1.logger.warn(`[Workspace] No upstream remote found, falling back to local HEAD`);
|
|
221460
|
+
return 'HEAD';
|
|
221461
|
+
}
|
|
221462
|
+
/**
|
|
221463
|
+
* Fetch latest from origin, resolve the upstream default branch, and return
|
|
221464
|
+
* both the ref name and the resolved commit SHA.
|
|
221465
|
+
*/
|
|
221466
|
+
async fetchAndResolveUpstream() {
|
|
221467
|
+
// Fetch latest from origin
|
|
221468
|
+
logger_1.logger.debug(`[Workspace] Fetching latest from origin`);
|
|
221469
|
+
const fetchResult = await command_executor_1.commandExecutor.execute(`git -C ${shellEscape(this.originalPath)} fetch origin --prune 2>&1`, { timeout: 120000 });
|
|
221470
|
+
if (fetchResult.exitCode !== 0) {
|
|
221471
|
+
logger_1.logger.warn(`[Workspace] fetch origin failed (will use cached refs): ${fetchResult.stderr}`);
|
|
221472
|
+
}
|
|
221473
|
+
// Resolve the upstream ref
|
|
221474
|
+
const upstreamRef = await this.resolveUpstreamRef();
|
|
221475
|
+
// Get the commit SHA for the upstream ref
|
|
221476
|
+
const shaResult = await command_executor_1.commandExecutor.execute(`git -C ${shellEscape(this.originalPath)} rev-parse ${shellEscape(upstreamRef)}`, { timeout: 10000 });
|
|
221477
|
+
if (shaResult.exitCode === 0) {
|
|
221478
|
+
return { upstreamRef, targetSha: shaResult.stdout.trim() };
|
|
221479
|
+
}
|
|
221480
|
+
// Upstream ref unresolvable — fall back to local HEAD
|
|
221481
|
+
logger_1.logger.warn(`[Workspace] Could not resolve ${upstreamRef} (${shaResult.stderr.trim()}), falling back to HEAD`);
|
|
221482
|
+
const headResult = await command_executor_1.commandExecutor.execute(`git -C ${shellEscape(this.originalPath)} rev-parse HEAD`, { timeout: 10000 });
|
|
221261
221483
|
if (headResult.exitCode !== 0) {
|
|
221262
|
-
throw new Error(`
|
|
221484
|
+
throw new Error(`Repository has no commits — cannot create worktree: ${headResult.stderr}`);
|
|
221485
|
+
}
|
|
221486
|
+
return { upstreamRef: 'HEAD', targetSha: headResult.stdout.trim() };
|
|
221487
|
+
}
|
|
221488
|
+
/**
|
|
221489
|
+
* Reset a worktree to a specific commit and clean all modifications.
|
|
221490
|
+
*/
|
|
221491
|
+
async resetAndCleanWorktree(worktreePath, targetSha) {
|
|
221492
|
+
const escapedPath = shellEscape(worktreePath);
|
|
221493
|
+
const escapedSha = shellEscape(targetSha);
|
|
221494
|
+
const resetResult = await command_executor_1.commandExecutor.execute(`git -C ${escapedPath} reset --hard ${escapedSha}`, { timeout: 10000 });
|
|
221495
|
+
if (resetResult.exitCode !== 0) {
|
|
221496
|
+
logger_1.logger.warn(`[Workspace] reset --hard failed: ${resetResult.stderr}`);
|
|
221497
|
+
}
|
|
221498
|
+
const cleanResult = await command_executor_1.commandExecutor.execute(`git -C ${escapedPath} clean -fdx`, {
|
|
221499
|
+
timeout: 30000,
|
|
221500
|
+
});
|
|
221501
|
+
if (cleanResult.exitCode !== 0) {
|
|
221502
|
+
logger_1.logger.warn(`[Workspace] clean -fdx failed: ${cleanResult.stderr}`);
|
|
221503
|
+
}
|
|
221504
|
+
}
|
|
221505
|
+
/**
|
|
221506
|
+
* Refresh an existing worktree to the latest upstream default branch
|
|
221507
|
+
* and ensure it has no modified or untracked files.
|
|
221508
|
+
*/
|
|
221509
|
+
async refreshWorktreeToUpstream(worktreePath) {
|
|
221510
|
+
logger_1.logger.info(`[Workspace] Refreshing worktree to latest upstream: ${worktreePath}`);
|
|
221511
|
+
try {
|
|
221512
|
+
const { upstreamRef, targetSha } = await this.fetchAndResolveUpstream();
|
|
221513
|
+
// Point worktree to the upstream commit
|
|
221514
|
+
const checkoutResult = await command_executor_1.commandExecutor.execute(`git -C ${shellEscape(worktreePath)} checkout --detach ${shellEscape(targetSha)}`, { timeout: 30000 });
|
|
221515
|
+
if (checkoutResult.exitCode !== 0) {
|
|
221516
|
+
logger_1.logger.warn(`[Workspace] checkout --detach failed (worktree stays at current commit): ${checkoutResult.stderr}`);
|
|
221517
|
+
// Still clean even if checkout failed — the worktree is valid, just at old commit
|
|
221518
|
+
await this.resetAndCleanWorktree(worktreePath, 'HEAD');
|
|
221519
|
+
return;
|
|
221520
|
+
}
|
|
221521
|
+
// Reset and clean
|
|
221522
|
+
await this.resetAndCleanWorktree(worktreePath, targetSha);
|
|
221523
|
+
logger_1.logger.info(`[Workspace] Worktree updated to ${upstreamRef} (${targetSha.slice(0, 8)})`);
|
|
221263
221524
|
}
|
|
221264
|
-
|
|
221265
|
-
|
|
221266
|
-
|
|
221525
|
+
catch (error) {
|
|
221526
|
+
// Best-effort: a stale worktree is better than failing initialization entirely
|
|
221527
|
+
logger_1.logger.warn(`[Workspace] Failed to refresh worktree (continuing with stale state): ${error}`);
|
|
221528
|
+
}
|
|
221529
|
+
}
|
|
221530
|
+
/**
|
|
221531
|
+
* Create worktree for the main project.
|
|
221532
|
+
* See visor-disable comment above resolveUpstreamRef for why this doesn't use WorktreeManager.
|
|
221533
|
+
*/
|
|
221534
|
+
async createMainProjectWorktree(targetPath) {
|
|
221535
|
+
logger_1.logger.debug(`Creating main project worktree: ${targetPath}`);
|
|
221536
|
+
const { upstreamRef, targetSha } = await this.fetchAndResolveUpstream();
|
|
221537
|
+
// Create worktree using detached HEAD at the upstream commit
|
|
221538
|
+
const createCmd = `git -C ${shellEscape(this.originalPath)} worktree add --detach ${shellEscape(targetPath)} ${shellEscape(targetSha)}`;
|
|
221267
221539
|
const result = await command_executor_1.commandExecutor.execute(createCmd, { timeout: 60000 });
|
|
221268
221540
|
if (result.exitCode !== 0) {
|
|
221269
221541
|
throw new Error(`Failed to create main project worktree: ${result.stderr}`);
|
|
221270
221542
|
}
|
|
221271
|
-
|
|
221543
|
+
// Clean (shouldn't be needed in a fresh worktree, but defense in depth)
|
|
221544
|
+
await this.resetAndCleanWorktree(targetPath, targetSha);
|
|
221545
|
+
logger_1.logger.info(`Created main project worktree at ${targetPath} (${upstreamRef} -> ${targetSha.slice(0, 8)})`);
|
|
221272
221546
|
}
|
|
221273
221547
|
/**
|
|
221274
221548
|
* Remove main project worktree
|
|
@@ -221950,27 +222224,52 @@ class WorktreeManager {
|
|
|
221950
222224
|
fs.rmSync(worktree_path, { recursive: true, force: true });
|
|
221951
222225
|
}
|
|
221952
222226
|
}
|
|
222227
|
+
// Clean up sibling metadata file
|
|
222228
|
+
const metadataPath = this.getMetadataPath(worktree_path);
|
|
222229
|
+
try {
|
|
222230
|
+
if (fs.existsSync(metadataPath)) {
|
|
222231
|
+
fs.unlinkSync(metadataPath);
|
|
222232
|
+
}
|
|
222233
|
+
}
|
|
222234
|
+
catch {
|
|
222235
|
+
// best-effort cleanup
|
|
222236
|
+
}
|
|
221953
222237
|
// Remove from active list
|
|
221954
222238
|
this.activeWorktrees.delete(worktreeId);
|
|
221955
222239
|
logger_1.logger.info(`Successfully removed worktree: ${worktreeId}`);
|
|
221956
222240
|
}
|
|
222241
|
+
/**
|
|
222242
|
+
* Get the metadata file path for a worktree.
|
|
222243
|
+
* Stored as a sibling file OUTSIDE the worktree to avoid being committed
|
|
222244
|
+
* when agents run `git add .` inside the checked-out repo.
|
|
222245
|
+
*/
|
|
222246
|
+
getMetadataPath(worktreePath) {
|
|
222247
|
+
return worktreePath.replace(/\/?$/, '') + '.metadata.json';
|
|
222248
|
+
}
|
|
221957
222249
|
/**
|
|
221958
222250
|
* Save worktree metadata
|
|
221959
222251
|
*/
|
|
221960
222252
|
async saveMetadata(worktreePath, metadata) {
|
|
221961
|
-
const metadataPath =
|
|
222253
|
+
const metadataPath = this.getMetadataPath(worktreePath);
|
|
221962
222254
|
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2), 'utf8');
|
|
221963
222255
|
}
|
|
221964
222256
|
/**
|
|
221965
222257
|
* Load worktree metadata
|
|
221966
222258
|
*/
|
|
221967
222259
|
async loadMetadata(worktreePath) {
|
|
221968
|
-
const metadataPath =
|
|
221969
|
-
|
|
222260
|
+
const metadataPath = this.getMetadataPath(worktreePath);
|
|
222261
|
+
// Also check legacy location (inside worktree) for backwards compatibility
|
|
222262
|
+
const legacyPath = path.join(worktreePath, '.visor-metadata.json');
|
|
222263
|
+
const pathToRead = fs.existsSync(metadataPath)
|
|
222264
|
+
? metadataPath
|
|
222265
|
+
: fs.existsSync(legacyPath)
|
|
222266
|
+
? legacyPath
|
|
222267
|
+
: null;
|
|
222268
|
+
if (!pathToRead) {
|
|
221970
222269
|
return null;
|
|
221971
222270
|
}
|
|
221972
222271
|
try {
|
|
221973
|
-
const content = fs.readFileSync(
|
|
222272
|
+
const content = fs.readFileSync(pathToRead, 'utf8');
|
|
221974
222273
|
return JSON.parse(content);
|
|
221975
222274
|
}
|
|
221976
222275
|
catch (error) {
|
|
@@ -264729,7 +265028,7 @@ var require_package2 = __commonJS({
|
|
|
264729
265028
|
module2.exports = {
|
|
264730
265029
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
264731
265030
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
264732
|
-
version: "3.
|
|
265031
|
+
version: "3.1000.0",
|
|
264733
265032
|
scripts: {
|
|
264734
265033
|
build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
264735
265034
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -264740,7 +265039,11 @@ var require_package2 = __commonJS({
|
|
|
264740
265039
|
clean: "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
264741
265040
|
"extract:docs": "api-extractor run --local",
|
|
264742
265041
|
"generate:client": "node ../../scripts/generate-clients/single-service --solo bedrock-runtime",
|
|
264743
|
-
|
|
265042
|
+
test: "yarn g:vitest run --passWithNoTests",
|
|
265043
|
+
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs",
|
|
265044
|
+
"test:integration": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
|
|
265045
|
+
"test:integration:watch": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
|
|
265046
|
+
"test:watch": "yarn g:vitest watch --passWithNoTests"
|
|
264744
265047
|
},
|
|
264745
265048
|
main: "./dist-cjs/index.js",
|
|
264746
265049
|
types: "./dist-types/index.d.ts",
|
|
@@ -264759,7 +265062,7 @@ var require_package2 = __commonJS({
|
|
|
264759
265062
|
"@aws-sdk/middleware-user-agent": "^3.972.15",
|
|
264760
265063
|
"@aws-sdk/middleware-websocket": "^3.972.10",
|
|
264761
265064
|
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
264762
|
-
"@aws-sdk/token-providers": "3.
|
|
265065
|
+
"@aws-sdk/token-providers": "3.1000.0",
|
|
264763
265066
|
"@aws-sdk/types": "^3.973.4",
|
|
264764
265067
|
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
264765
265068
|
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
@@ -264796,12 +265099,14 @@ var require_package2 = __commonJS({
|
|
|
264796
265099
|
tslib: "^2.6.2"
|
|
264797
265100
|
},
|
|
264798
265101
|
devDependencies: {
|
|
265102
|
+
"@smithy/snapshot-testing": "^1.0.7",
|
|
264799
265103
|
"@tsconfig/node20": "20.1.8",
|
|
264800
265104
|
"@types/node": "^20.14.8",
|
|
264801
265105
|
concurrently: "7.0.0",
|
|
264802
265106
|
"downlevel-dts": "0.10.1",
|
|
264803
265107
|
premove: "4.0.0",
|
|
264804
|
-
typescript: "~5.8.3"
|
|
265108
|
+
typescript: "~5.8.3",
|
|
265109
|
+
vitest: "^4.0.17"
|
|
264805
265110
|
},
|
|
264806
265111
|
engines: {
|
|
264807
265112
|
node: ">=20.0.0"
|
|
@@ -266803,9 +267108,9 @@ var init_sso_oidc = __esm({
|
|
|
266803
267108
|
}
|
|
266804
267109
|
});
|
|
266805
267110
|
|
|
266806
|
-
// node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
267111
|
+
// node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
266807
267112
|
var require_dist_cjs56 = __commonJS({
|
|
266808
|
-
"node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
267113
|
+
"node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
266809
267114
|
"use strict";
|
|
266810
267115
|
var client = (init_client(), __toCommonJS(client_exports));
|
|
266811
267116
|
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
@@ -270638,8 +270943,155 @@ var require_dist_cjs63 = __commonJS({
|
|
|
270638
270943
|
}
|
|
270639
270944
|
});
|
|
270640
270945
|
|
|
270641
|
-
// node_modules/@
|
|
270946
|
+
// node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
270642
270947
|
var require_dist_cjs64 = __commonJS({
|
|
270948
|
+
"node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
270949
|
+
"use strict";
|
|
270950
|
+
var client = (init_client(), __toCommonJS(client_exports));
|
|
270951
|
+
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
270952
|
+
var propertyProvider = require_dist_cjs24();
|
|
270953
|
+
var sharedIniFileLoader = require_dist_cjs42();
|
|
270954
|
+
var node_fs = __nccwpck_require__(73024);
|
|
270955
|
+
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
270956
|
+
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
270957
|
+
if (!signingName) {
|
|
270958
|
+
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger2 });
|
|
270959
|
+
}
|
|
270960
|
+
const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
|
|
270961
|
+
if (!(bearerTokenKey in process.env)) {
|
|
270962
|
+
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger2 });
|
|
270963
|
+
}
|
|
270964
|
+
const token = { token: process.env[bearerTokenKey] };
|
|
270965
|
+
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
270966
|
+
return token;
|
|
270967
|
+
};
|
|
270968
|
+
var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
|
|
270969
|
+
var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
270970
|
+
var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
|
|
270971
|
+
const { SSOOIDCClient: SSOOIDCClient2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
|
|
270972
|
+
const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
|
|
270973
|
+
const ssoOidcClient = new SSOOIDCClient2(Object.assign({}, init.clientConfig ?? {}, {
|
|
270974
|
+
region: ssoRegion ?? init.clientConfig?.region,
|
|
270975
|
+
logger: coalesce("logger"),
|
|
270976
|
+
userAgentAppId: coalesce("userAgentAppId")
|
|
270977
|
+
}));
|
|
270978
|
+
return ssoOidcClient;
|
|
270979
|
+
};
|
|
270980
|
+
var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
|
|
270981
|
+
const { CreateTokenCommand: CreateTokenCommand2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
|
|
270982
|
+
const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
|
|
270983
|
+
return ssoOidcClient.send(new CreateTokenCommand2({
|
|
270984
|
+
clientId: ssoToken.clientId,
|
|
270985
|
+
clientSecret: ssoToken.clientSecret,
|
|
270986
|
+
refreshToken: ssoToken.refreshToken,
|
|
270987
|
+
grantType: "refresh_token"
|
|
270988
|
+
}));
|
|
270989
|
+
};
|
|
270990
|
+
var validateTokenExpiry = (token) => {
|
|
270991
|
+
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
270992
|
+
throw new propertyProvider.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
270993
|
+
}
|
|
270994
|
+
};
|
|
270995
|
+
var validateTokenKey = (key, value, forRefresh = false) => {
|
|
270996
|
+
if (typeof value === "undefined") {
|
|
270997
|
+
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
270998
|
+
}
|
|
270999
|
+
};
|
|
271000
|
+
var { writeFile: writeFile2 } = node_fs.promises;
|
|
271001
|
+
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
271002
|
+
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
271003
|
+
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
271004
|
+
return writeFile2(tokenFilepath, tokenString);
|
|
271005
|
+
};
|
|
271006
|
+
var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
|
|
271007
|
+
var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
271008
|
+
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
271009
|
+
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
|
271010
|
+
const profileName = sharedIniFileLoader.getProfileName({
|
|
271011
|
+
profile: init.profile ?? callerClientConfig?.profile
|
|
271012
|
+
});
|
|
271013
|
+
const profile = profiles[profileName];
|
|
271014
|
+
if (!profile) {
|
|
271015
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
271016
|
+
} else if (!profile["sso_session"]) {
|
|
271017
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
271018
|
+
}
|
|
271019
|
+
const ssoSessionName = profile["sso_session"];
|
|
271020
|
+
const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
|
|
271021
|
+
const ssoSession = ssoSessions[ssoSessionName];
|
|
271022
|
+
if (!ssoSession) {
|
|
271023
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
271024
|
+
}
|
|
271025
|
+
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
271026
|
+
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
271027
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
271028
|
+
}
|
|
271029
|
+
}
|
|
271030
|
+
ssoSession["sso_start_url"];
|
|
271031
|
+
const ssoRegion = ssoSession["sso_region"];
|
|
271032
|
+
let ssoToken;
|
|
271033
|
+
try {
|
|
271034
|
+
ssoToken = await sharedIniFileLoader.getSSOTokenFromFile(ssoSessionName);
|
|
271035
|
+
} catch (e5) {
|
|
271036
|
+
throw new propertyProvider.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
271037
|
+
}
|
|
271038
|
+
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
271039
|
+
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
271040
|
+
const { accessToken, expiresAt } = ssoToken;
|
|
271041
|
+
const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
|
|
271042
|
+
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
271043
|
+
return existingToken;
|
|
271044
|
+
}
|
|
271045
|
+
if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
|
|
271046
|
+
validateTokenExpiry(existingToken);
|
|
271047
|
+
return existingToken;
|
|
271048
|
+
}
|
|
271049
|
+
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
271050
|
+
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
271051
|
+
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
271052
|
+
try {
|
|
271053
|
+
lastRefreshAttemptTime.setTime(Date.now());
|
|
271054
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
271055
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
271056
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
271057
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
|
|
271058
|
+
try {
|
|
271059
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
271060
|
+
...ssoToken,
|
|
271061
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
271062
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
271063
|
+
refreshToken: newSsoOidcToken.refreshToken
|
|
271064
|
+
});
|
|
271065
|
+
} catch (error2) {
|
|
271066
|
+
}
|
|
271067
|
+
return {
|
|
271068
|
+
token: newSsoOidcToken.accessToken,
|
|
271069
|
+
expiration: newTokenExpiration
|
|
271070
|
+
};
|
|
271071
|
+
} catch (error2) {
|
|
271072
|
+
validateTokenExpiry(existingToken);
|
|
271073
|
+
return existingToken;
|
|
271074
|
+
}
|
|
271075
|
+
};
|
|
271076
|
+
var fromStatic = ({ token, logger: logger2 }) => async () => {
|
|
271077
|
+
logger2?.debug("@aws-sdk/token-providers - fromStatic");
|
|
271078
|
+
if (!token || !token.token) {
|
|
271079
|
+
throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
271080
|
+
}
|
|
271081
|
+
return token;
|
|
271082
|
+
};
|
|
271083
|
+
var nodeProvider = (init = {}) => propertyProvider.memoize(propertyProvider.chain(fromSso(init), async () => {
|
|
271084
|
+
throw new propertyProvider.TokenProviderError("Could not load token from any providers", false);
|
|
271085
|
+
}), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0);
|
|
271086
|
+
exports2.fromEnvSigningName = fromEnvSigningName;
|
|
271087
|
+
exports2.fromSso = fromSso;
|
|
271088
|
+
exports2.fromStatic = fromStatic;
|
|
271089
|
+
exports2.nodeProvider = nodeProvider;
|
|
271090
|
+
}
|
|
271091
|
+
});
|
|
271092
|
+
|
|
271093
|
+
// node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js
|
|
271094
|
+
var require_dist_cjs65 = __commonJS({
|
|
270643
271095
|
"node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js"(exports2) {
|
|
270644
271096
|
"use strict";
|
|
270645
271097
|
var eventstreamSerdeUniversal = require_dist_cjs35();
|
|
@@ -273321,11 +273773,11 @@ var require_runtimeConfig = __commonJS({
|
|
|
273321
273773
|
var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
|
|
273322
273774
|
var credential_provider_node_1 = require_dist_cjs62();
|
|
273323
273775
|
var eventstream_handler_node_1 = require_dist_cjs63();
|
|
273324
|
-
var token_providers_1 =
|
|
273776
|
+
var token_providers_1 = require_dist_cjs64();
|
|
273325
273777
|
var util_user_agent_node_1 = require_dist_cjs51();
|
|
273326
273778
|
var config_resolver_1 = require_dist_cjs39();
|
|
273327
273779
|
var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports));
|
|
273328
|
-
var eventstream_serde_node_1 =
|
|
273780
|
+
var eventstream_serde_node_1 = require_dist_cjs65();
|
|
273329
273781
|
var hash_node_1 = require_dist_cjs52();
|
|
273330
273782
|
var middleware_retry_1 = require_dist_cjs47();
|
|
273331
273783
|
var node_config_provider_1 = require_dist_cjs43();
|
|
@@ -273397,7 +273849,7 @@ var require_runtimeConfig = __commonJS({
|
|
|
273397
273849
|
});
|
|
273398
273850
|
|
|
273399
273851
|
// node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js
|
|
273400
|
-
var
|
|
273852
|
+
var require_dist_cjs66 = __commonJS({
|
|
273401
273853
|
"node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js"(exports2) {
|
|
273402
273854
|
"use strict";
|
|
273403
273855
|
var middlewareEventstream = require_dist_cjs3();
|
|
@@ -274242,13 +274694,13 @@ var import_client_bedrock_runtime, import_client_bedrock_runtime2, import_client
|
|
|
274242
274694
|
var init_dist3 = __esm({
|
|
274243
274695
|
"node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
|
|
274244
274696
|
init_dist2();
|
|
274245
|
-
import_client_bedrock_runtime = __toESM(
|
|
274697
|
+
import_client_bedrock_runtime = __toESM(require_dist_cjs66(), 1);
|
|
274246
274698
|
init_dist();
|
|
274247
|
-
import_client_bedrock_runtime2 = __toESM(
|
|
274699
|
+
import_client_bedrock_runtime2 = __toESM(require_dist_cjs66(), 1);
|
|
274248
274700
|
init_dist();
|
|
274249
274701
|
init_dist();
|
|
274250
274702
|
init_dist2();
|
|
274251
|
-
import_client_bedrock_runtime3 = __toESM(
|
|
274703
|
+
import_client_bedrock_runtime3 = __toESM(require_dist_cjs66(), 1);
|
|
274252
274704
|
generateFileId = createIdGenerator({ prefix: "file", size: 16 });
|
|
274253
274705
|
BedrockChatLanguageModel = class {
|
|
274254
274706
|
constructor(modelId, settings, config) {
|
|
@@ -297416,7 +297868,6 @@ var init_reg_exp = __esm({
|
|
|
297416
297868
|
// node_modules/chevrotain/lib/src/scan/lexer.js
|
|
297417
297869
|
function analyzeTokenTypes(tokenTypes, options) {
|
|
297418
297870
|
options = defaults_default(options, {
|
|
297419
|
-
useSticky: SUPPORT_STICKY,
|
|
297420
297871
|
debug: false,
|
|
297421
297872
|
safeMode: false,
|
|
297422
297873
|
positionTracking: "full",
|
|
@@ -297465,7 +297916,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
297465
297916
|
], regExpSource[1])) {
|
|
297466
297917
|
return regExpSource[1];
|
|
297467
297918
|
} else {
|
|
297468
|
-
return
|
|
297919
|
+
return addStickyFlag(currPattern);
|
|
297469
297920
|
}
|
|
297470
297921
|
} else if (isFunction_default(currPattern)) {
|
|
297471
297922
|
hasCustom = true;
|
|
@@ -297479,7 +297930,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
297479
297930
|
} else {
|
|
297480
297931
|
const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
297481
297932
|
const wrappedRegExp = new RegExp(escapedRegExpString);
|
|
297482
|
-
return
|
|
297933
|
+
return addStickyFlag(wrappedRegExp);
|
|
297483
297934
|
}
|
|
297484
297935
|
} else {
|
|
297485
297936
|
throw Error("non exhaustive match");
|
|
@@ -297883,10 +298334,6 @@ function noMetaChar(regExp) {
|
|
|
297883
298334
|
function usesLookAheadOrBehind(regExp) {
|
|
297884
298335
|
return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(regExp.source);
|
|
297885
298336
|
}
|
|
297886
|
-
function addStartOfInput(pattern) {
|
|
297887
|
-
const flags = pattern.ignoreCase ? "i" : "";
|
|
297888
|
-
return new RegExp(`^(?:${pattern.source})`, flags);
|
|
297889
|
-
}
|
|
297890
298337
|
function addStickyFlag(pattern) {
|
|
297891
298338
|
const flags = pattern.ignoreCase ? "iy" : "y";
|
|
297892
298339
|
return new RegExp(`${pattern.source}`, flags);
|
|
@@ -298075,7 +298522,7 @@ function initCharCodeToOptimizedIndexMap() {
|
|
|
298075
298522
|
}
|
|
298076
298523
|
}
|
|
298077
298524
|
}
|
|
298078
|
-
var PATTERN, DEFAULT_MODE, MODES,
|
|
298525
|
+
var PATTERN, DEFAULT_MODE, MODES, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap;
|
|
298079
298526
|
var init_lexer = __esm({
|
|
298080
298527
|
"node_modules/chevrotain/lib/src/scan/lexer.js"() {
|
|
298081
298528
|
init_api3();
|
|
@@ -298087,7 +298534,6 @@ var init_lexer = __esm({
|
|
|
298087
298534
|
PATTERN = "PATTERN";
|
|
298088
298535
|
DEFAULT_MODE = "defaultMode";
|
|
298089
298536
|
MODES = "modes";
|
|
298090
|
-
SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
|
|
298091
298537
|
end_of_input = /[^\\][$]/;
|
|
298092
298538
|
start_of_input = /[^\\[][\^]|^\^/;
|
|
298093
298539
|
LineTerminatorOptimizedTester = {
|
|
@@ -298403,13 +298849,6 @@ var init_lexer_public = __esm({
|
|
|
298403
298849
|
PRINT_WARNING(warningDescriptor.message);
|
|
298404
298850
|
});
|
|
298405
298851
|
this.TRACE_INIT("Choosing sub-methods implementations", () => {
|
|
298406
|
-
if (SUPPORT_STICKY) {
|
|
298407
|
-
this.chopInput = identity_default;
|
|
298408
|
-
this.match = this.matchWithTest;
|
|
298409
|
-
} else {
|
|
298410
|
-
this.updateLastIndex = noop_default;
|
|
298411
|
-
this.match = this.matchWithExec;
|
|
298412
|
-
}
|
|
298413
298852
|
if (hasOnlySingleMode) {
|
|
298414
298853
|
this.handleModes = noop_default;
|
|
298415
298854
|
}
|
|
@@ -298472,7 +298911,7 @@ var init_lexer_public = __esm({
|
|
|
298472
298911
|
// this method also used quite a bit of `!` none null assertions because it is too optimized
|
|
298473
298912
|
// for `tsc` to always understand it is "safe"
|
|
298474
298913
|
tokenizeInternal(text, initialMode) {
|
|
298475
|
-
let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength,
|
|
298914
|
+
let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength, msg, match2;
|
|
298476
298915
|
const orgText = text;
|
|
298477
298916
|
const orgLength = orgText.length;
|
|
298478
298917
|
let offset2 = 0;
|
|
@@ -298491,19 +298930,7 @@ var init_lexer_public = __esm({
|
|
|
298491
298930
|
const modeStack = [];
|
|
298492
298931
|
const emptyArray = [];
|
|
298493
298932
|
Object.freeze(emptyArray);
|
|
298494
|
-
let
|
|
298495
|
-
function getPossiblePatternsSlow() {
|
|
298496
|
-
return patternIdxToConfig;
|
|
298497
|
-
}
|
|
298498
|
-
function getPossiblePatternsOptimized(charCode) {
|
|
298499
|
-
const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
|
|
298500
|
-
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
298501
|
-
if (possiblePatterns === void 0) {
|
|
298502
|
-
return emptyArray;
|
|
298503
|
-
} else {
|
|
298504
|
-
return possiblePatterns;
|
|
298505
|
-
}
|
|
298506
|
-
}
|
|
298933
|
+
let isOptimizedMode = false;
|
|
298507
298934
|
const pop_mode = (popToken) => {
|
|
298508
298935
|
if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
|
|
298509
298936
|
// So no error should occur.
|
|
@@ -298524,9 +298951,9 @@ var init_lexer_public = __esm({
|
|
|
298524
298951
|
currModePatternsLength = patternIdxToConfig.length;
|
|
298525
298952
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
298526
298953
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
298527
|
-
|
|
298954
|
+
isOptimizedMode = true;
|
|
298528
298955
|
} else {
|
|
298529
|
-
|
|
298956
|
+
isOptimizedMode = false;
|
|
298530
298957
|
}
|
|
298531
298958
|
}
|
|
298532
298959
|
};
|
|
@@ -298538,9 +298965,9 @@ var init_lexer_public = __esm({
|
|
|
298538
298965
|
currModePatternsLength = patternIdxToConfig.length;
|
|
298539
298966
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
298540
298967
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
298541
|
-
|
|
298968
|
+
isOptimizedMode = true;
|
|
298542
298969
|
} else {
|
|
298543
|
-
|
|
298970
|
+
isOptimizedMode = false;
|
|
298544
298971
|
}
|
|
298545
298972
|
}
|
|
298546
298973
|
push_mode.call(this, initialMode);
|
|
@@ -298548,8 +298975,16 @@ var init_lexer_public = __esm({
|
|
|
298548
298975
|
const recoveryEnabled = this.config.recoveryEnabled;
|
|
298549
298976
|
while (offset2 < orgLength) {
|
|
298550
298977
|
matchedImage = null;
|
|
298978
|
+
imageLength = -1;
|
|
298551
298979
|
const nextCharCode = orgText.charCodeAt(offset2);
|
|
298552
|
-
|
|
298980
|
+
let chosenPatternIdxToConfig;
|
|
298981
|
+
if (isOptimizedMode) {
|
|
298982
|
+
const optimizedCharIdx = charCodeToOptimizedIndex(nextCharCode);
|
|
298983
|
+
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
298984
|
+
chosenPatternIdxToConfig = possiblePatterns !== void 0 ? possiblePatterns : emptyArray;
|
|
298985
|
+
} else {
|
|
298986
|
+
chosenPatternIdxToConfig = patternIdxToConfig;
|
|
298987
|
+
}
|
|
298553
298988
|
const chosenPatternsLength = chosenPatternIdxToConfig.length;
|
|
298554
298989
|
for (i5 = 0; i5 < chosenPatternsLength; i5++) {
|
|
298555
298990
|
currConfig = chosenPatternIdxToConfig[i5];
|
|
@@ -298558,12 +298993,14 @@ var init_lexer_public = __esm({
|
|
|
298558
298993
|
const singleCharCode = currConfig.short;
|
|
298559
298994
|
if (singleCharCode !== false) {
|
|
298560
298995
|
if (nextCharCode === singleCharCode) {
|
|
298996
|
+
imageLength = 1;
|
|
298561
298997
|
matchedImage = currPattern;
|
|
298562
298998
|
}
|
|
298563
298999
|
} else if (currConfig.isCustom === true) {
|
|
298564
299000
|
match2 = currPattern.exec(orgText, offset2, matchedTokens, groups);
|
|
298565
299001
|
if (match2 !== null) {
|
|
298566
299002
|
matchedImage = match2[0];
|
|
299003
|
+
imageLength = matchedImage.length;
|
|
298567
299004
|
if (match2.payload !== void 0) {
|
|
298568
299005
|
payload2 = match2.payload;
|
|
298569
299006
|
}
|
|
@@ -298571,12 +299008,13 @@ var init_lexer_public = __esm({
|
|
|
298571
299008
|
matchedImage = null;
|
|
298572
299009
|
}
|
|
298573
299010
|
} else {
|
|
298574
|
-
|
|
298575
|
-
|
|
299011
|
+
currPattern.lastIndex = offset2;
|
|
299012
|
+
imageLength = this.matchLength(currPattern, text, offset2);
|
|
298576
299013
|
}
|
|
298577
|
-
if (
|
|
299014
|
+
if (imageLength !== -1) {
|
|
298578
299015
|
longerAlt = currConfig.longerAlt;
|
|
298579
299016
|
if (longerAlt !== void 0) {
|
|
299017
|
+
matchedImage = text.substring(offset2, offset2 + imageLength);
|
|
298580
299018
|
const longerAltLength = longerAlt.length;
|
|
298581
299019
|
for (k5 = 0; k5 < longerAltLength; k5++) {
|
|
298582
299020
|
const longerAltConfig = patternIdxToConfig[longerAlt[k5]];
|
|
@@ -298593,11 +299031,12 @@ var init_lexer_public = __esm({
|
|
|
298593
299031
|
matchAltImage = null;
|
|
298594
299032
|
}
|
|
298595
299033
|
} else {
|
|
298596
|
-
|
|
299034
|
+
longerAltPattern.lastIndex = offset2;
|
|
298597
299035
|
matchAltImage = this.match(longerAltPattern, text, offset2);
|
|
298598
299036
|
}
|
|
298599
299037
|
if (matchAltImage && matchAltImage.length > matchedImage.length) {
|
|
298600
299038
|
matchedImage = matchAltImage;
|
|
299039
|
+
imageLength = matchAltImage.length;
|
|
298601
299040
|
payload2 = altPayload;
|
|
298602
299041
|
currConfig = longerAltConfig;
|
|
298603
299042
|
break;
|
|
@@ -298607,10 +299046,10 @@ var init_lexer_public = __esm({
|
|
|
298607
299046
|
break;
|
|
298608
299047
|
}
|
|
298609
299048
|
}
|
|
298610
|
-
if (
|
|
298611
|
-
imageLength = matchedImage.length;
|
|
299049
|
+
if (imageLength !== -1) {
|
|
298612
299050
|
group = currConfig.group;
|
|
298613
299051
|
if (group !== void 0) {
|
|
299052
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
|
|
298614
299053
|
tokType = currConfig.tokenTypeIdx;
|
|
298615
299054
|
newToken = this.createTokenInstance(matchedImage, offset2, tokType, currConfig.tokenType, line, column, imageLength);
|
|
298616
299055
|
this.handlePayload(newToken, payload2);
|
|
@@ -298620,15 +299059,13 @@ var init_lexer_public = __esm({
|
|
|
298620
299059
|
groups[group].push(newToken);
|
|
298621
299060
|
}
|
|
298622
299061
|
}
|
|
298623
|
-
text = this.chopInput(text, imageLength);
|
|
298624
|
-
offset2 = offset2 + imageLength;
|
|
298625
|
-
column = this.computeNewColumn(column, imageLength);
|
|
298626
299062
|
if (trackLines === true && currConfig.canLineTerminator === true) {
|
|
298627
299063
|
let numOfLTsInMatch = 0;
|
|
298628
299064
|
let foundTerminator;
|
|
298629
299065
|
let lastLTEndOffset;
|
|
298630
299066
|
lineTerminatorPattern.lastIndex = 0;
|
|
298631
299067
|
do {
|
|
299068
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
|
|
298632
299069
|
foundTerminator = lineTerminatorPattern.test(matchedImage);
|
|
298633
299070
|
if (foundTerminator === true) {
|
|
298634
299071
|
lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
|
|
@@ -298639,8 +299076,13 @@ var init_lexer_public = __esm({
|
|
|
298639
299076
|
line = line + numOfLTsInMatch;
|
|
298640
299077
|
column = imageLength - lastLTEndOffset;
|
|
298641
299078
|
this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);
|
|
299079
|
+
} else {
|
|
299080
|
+
column = this.computeNewColumn(column, imageLength);
|
|
298642
299081
|
}
|
|
299082
|
+
} else {
|
|
299083
|
+
column = this.computeNewColumn(column, imageLength);
|
|
298643
299084
|
}
|
|
299085
|
+
offset2 = offset2 + imageLength;
|
|
298644
299086
|
this.handleModes(currConfig, pop_mode, push_mode, newToken);
|
|
298645
299087
|
} else {
|
|
298646
299088
|
const errorStartOffset = offset2;
|
|
@@ -298648,7 +299090,6 @@ var init_lexer_public = __esm({
|
|
|
298648
299090
|
const errorColumn = column;
|
|
298649
299091
|
let foundResyncPoint = recoveryEnabled === false;
|
|
298650
299092
|
while (foundResyncPoint === false && offset2 < orgLength) {
|
|
298651
|
-
text = this.chopInput(text, 1);
|
|
298652
299093
|
offset2++;
|
|
298653
299094
|
for (j5 = 0; j5 < currModePatternsLength; j5++) {
|
|
298654
299095
|
const currConfig2 = patternIdxToConfig[j5];
|
|
@@ -298661,7 +299102,7 @@ var init_lexer_public = __esm({
|
|
|
298661
299102
|
} else if (currConfig2.isCustom === true) {
|
|
298662
299103
|
foundResyncPoint = currPattern.exec(orgText, offset2, matchedTokens, groups) !== null;
|
|
298663
299104
|
} else {
|
|
298664
|
-
|
|
299105
|
+
currPattern.lastIndex = offset2;
|
|
298665
299106
|
foundResyncPoint = currPattern.exec(text) !== null;
|
|
298666
299107
|
}
|
|
298667
299108
|
if (foundResyncPoint === true) {
|
|
@@ -298704,12 +299145,6 @@ var init_lexer_public = __esm({
|
|
|
298704
299145
|
push_mode.call(this, config.push);
|
|
298705
299146
|
}
|
|
298706
299147
|
}
|
|
298707
|
-
chopInput(text, length) {
|
|
298708
|
-
return text.substring(length);
|
|
298709
|
-
}
|
|
298710
|
-
updateLastIndex(regExp, newLastIndex) {
|
|
298711
|
-
regExp.lastIndex = newLastIndex;
|
|
298712
|
-
}
|
|
298713
299148
|
// TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
|
|
298714
299149
|
updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {
|
|
298715
299150
|
let lastCharIsLT, fixForEndingInLT;
|
|
@@ -298772,16 +299207,19 @@ var init_lexer_public = __esm({
|
|
|
298772
299207
|
token.payload = payload2;
|
|
298773
299208
|
}
|
|
298774
299209
|
}
|
|
298775
|
-
|
|
299210
|
+
match(pattern, text, offset2) {
|
|
298776
299211
|
const found = pattern.test(text);
|
|
298777
299212
|
if (found === true) {
|
|
298778
299213
|
return text.substring(offset2, pattern.lastIndex);
|
|
298779
299214
|
}
|
|
298780
299215
|
return null;
|
|
298781
299216
|
}
|
|
298782
|
-
|
|
298783
|
-
const
|
|
298784
|
-
|
|
299217
|
+
matchLength(pattern, text, offset2) {
|
|
299218
|
+
const found = pattern.test(text);
|
|
299219
|
+
if (found === true) {
|
|
299220
|
+
return pattern.lastIndex - offset2;
|
|
299221
|
+
}
|
|
299222
|
+
return -1;
|
|
298785
299223
|
}
|
|
298786
299224
|
};
|
|
298787
299225
|
Lexer.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
|
|
@@ -298973,12 +299411,20 @@ For Further details.`;
|
|
|
298973
299411
|
return errMsg;
|
|
298974
299412
|
},
|
|
298975
299413
|
buildAlternationAmbiguityError(options) {
|
|
298976
|
-
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
298977
299414
|
const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
|
|
299415
|
+
const isEmptyPath = options.prefixPath.length === 0;
|
|
298978
299416
|
let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,
|
|
298979
|
-
<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
298980
299417
|
`;
|
|
298981
|
-
|
|
299418
|
+
if (isEmptyPath) {
|
|
299419
|
+
currMessage += `These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
299420
|
+
Only the last alternative may be empty.
|
|
299421
|
+
`;
|
|
299422
|
+
} else {
|
|
299423
|
+
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
299424
|
+
currMessage += `<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
299425
|
+
`;
|
|
299426
|
+
}
|
|
299427
|
+
currMessage += `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
298982
299428
|
For Further details.`;
|
|
298983
299429
|
return currMessage;
|
|
298984
299430
|
},
|
|
@@ -328217,12 +328663,31 @@ function cleanSchemaResponse(response) {
|
|
|
328217
328663
|
const closeChar = openChar === "{" ? "}" : "]";
|
|
328218
328664
|
let bracketCount = 1;
|
|
328219
328665
|
let endIndex = startIndex + 1;
|
|
328666
|
+
let inString = false;
|
|
328667
|
+
let escapeNext = false;
|
|
328220
328668
|
while (endIndex < trimmed.length && bracketCount > 0) {
|
|
328221
328669
|
const char = trimmed[endIndex];
|
|
328222
|
-
if (
|
|
328223
|
-
|
|
328224
|
-
|
|
328225
|
-
|
|
328670
|
+
if (escapeNext) {
|
|
328671
|
+
escapeNext = false;
|
|
328672
|
+
endIndex++;
|
|
328673
|
+
continue;
|
|
328674
|
+
}
|
|
328675
|
+
if (char === "\\" && inString) {
|
|
328676
|
+
escapeNext = true;
|
|
328677
|
+
endIndex++;
|
|
328678
|
+
continue;
|
|
328679
|
+
}
|
|
328680
|
+
if (char === '"') {
|
|
328681
|
+
inString = !inString;
|
|
328682
|
+
endIndex++;
|
|
328683
|
+
continue;
|
|
328684
|
+
}
|
|
328685
|
+
if (!inString) {
|
|
328686
|
+
if (char === openChar) {
|
|
328687
|
+
bracketCount++;
|
|
328688
|
+
} else if (char === closeChar) {
|
|
328689
|
+
bracketCount--;
|
|
328690
|
+
}
|
|
328226
328691
|
}
|
|
328227
328692
|
endIndex++;
|
|
328228
328693
|
}
|
|
@@ -350603,6 +351068,122 @@ var init_bashPermissions = __esm({
|
|
|
350603
351068
|
});
|
|
350604
351069
|
|
|
350605
351070
|
// src/agent/bashExecutor.js
|
|
351071
|
+
function splitCommandComponents(command) {
|
|
351072
|
+
const parts = [];
|
|
351073
|
+
let current2 = "";
|
|
351074
|
+
let inQuote = false;
|
|
351075
|
+
let quoteChar = "";
|
|
351076
|
+
for (let i5 = 0; i5 < command.length; i5++) {
|
|
351077
|
+
const c5 = command[i5];
|
|
351078
|
+
const next = command[i5 + 1] || "";
|
|
351079
|
+
if (c5 === "\\" && !inQuote) {
|
|
351080
|
+
current2 += c5 + next;
|
|
351081
|
+
i5++;
|
|
351082
|
+
continue;
|
|
351083
|
+
}
|
|
351084
|
+
if (inQuote && quoteChar === '"' && c5 === "\\" && next) {
|
|
351085
|
+
current2 += c5 + next;
|
|
351086
|
+
i5++;
|
|
351087
|
+
continue;
|
|
351088
|
+
}
|
|
351089
|
+
if (!inQuote && (c5 === '"' || c5 === "'")) {
|
|
351090
|
+
inQuote = true;
|
|
351091
|
+
quoteChar = c5;
|
|
351092
|
+
current2 += c5;
|
|
351093
|
+
continue;
|
|
351094
|
+
}
|
|
351095
|
+
if (inQuote && c5 === quoteChar) {
|
|
351096
|
+
inQuote = false;
|
|
351097
|
+
current2 += c5;
|
|
351098
|
+
continue;
|
|
351099
|
+
}
|
|
351100
|
+
if (!inQuote) {
|
|
351101
|
+
if (c5 === "&" && next === "&" || c5 === "|" && next === "|") {
|
|
351102
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
351103
|
+
current2 = "";
|
|
351104
|
+
i5++;
|
|
351105
|
+
continue;
|
|
351106
|
+
}
|
|
351107
|
+
if (c5 === "|" || c5 === ";") {
|
|
351108
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
351109
|
+
current2 = "";
|
|
351110
|
+
continue;
|
|
351111
|
+
}
|
|
351112
|
+
}
|
|
351113
|
+
current2 += c5;
|
|
351114
|
+
}
|
|
351115
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
351116
|
+
return parts;
|
|
351117
|
+
}
|
|
351118
|
+
function checkSingleCommandInteractive(command) {
|
|
351119
|
+
let effective = command.trim();
|
|
351120
|
+
while (/^\w+=\S*\s/.test(effective)) {
|
|
351121
|
+
effective = effective.replace(/^\w+=\S*\s+/, "");
|
|
351122
|
+
}
|
|
351123
|
+
const parts = effective.split(/\s+/);
|
|
351124
|
+
const base2 = parts[0];
|
|
351125
|
+
const args = parts.slice(1);
|
|
351126
|
+
if (["vi", "vim", "nvim", "nano", "emacs", "pico", "joe", "mcedit"].includes(base2)) {
|
|
351127
|
+
return `'${base2}' is an interactive editor and cannot run without a terminal. Use non-interactive file manipulation commands instead.`;
|
|
351128
|
+
}
|
|
351129
|
+
if (["less", "more"].includes(base2)) {
|
|
351130
|
+
return `'${base2}' is an interactive pager. Use 'cat', 'head', or 'tail' instead.`;
|
|
351131
|
+
}
|
|
351132
|
+
if (base2 === "git") {
|
|
351133
|
+
const sub = args[0];
|
|
351134
|
+
if (sub === "commit") {
|
|
351135
|
+
const hasNonInteractiveFlag = args.some(
|
|
351136
|
+
(a5) => a5 === "-m" || a5.startsWith("--message") || a5 === "-C" || a5 === "-c" || a5.startsWith("--fixup") || a5.startsWith("--squash") || a5 === "--allow-empty-message" || a5 === "--no-edit"
|
|
351137
|
+
);
|
|
351138
|
+
if (!hasNonInteractiveFlag) {
|
|
351139
|
+
return `Interactive command: 'git commit' opens an editor for the commit message. Use 'git commit -m "your message"' instead.`;
|
|
351140
|
+
}
|
|
351141
|
+
}
|
|
351142
|
+
if (sub === "rebase" && (args.includes("--continue") || args.includes("--skip"))) {
|
|
351143
|
+
return "Interactive command: 'git rebase --continue' opens an editor. Set environment variable GIT_EDITOR=true to accept default messages, e.g. pass env: {GIT_EDITOR: 'true'} or prepend GIT_EDITOR=true to the command.";
|
|
351144
|
+
}
|
|
351145
|
+
if (sub === "rebase" && (args.includes("-i") || args.includes("--interactive"))) {
|
|
351146
|
+
return "Interactive command: 'git rebase -i' requires an interactive editor. Interactive rebase cannot run without a terminal.";
|
|
351147
|
+
}
|
|
351148
|
+
if (sub === "merge" && !args.includes("--no-edit") && !args.includes("--no-commit") && !args.includes("--ff-only")) {
|
|
351149
|
+
return "Interactive command: 'git merge' may open an editor for the merge commit message. Add '--no-edit' to accept the default message.";
|
|
351150
|
+
}
|
|
351151
|
+
if (sub === "cherry-pick" && !args.includes("--no-edit")) {
|
|
351152
|
+
return "Interactive command: 'git cherry-pick' may open an editor. Add '--no-edit' to accept the default message.";
|
|
351153
|
+
}
|
|
351154
|
+
if (sub === "revert" && !args.includes("--no-edit")) {
|
|
351155
|
+
return "Interactive command: 'git revert' opens an editor. Add '--no-edit' to accept the default message.";
|
|
351156
|
+
}
|
|
351157
|
+
if (sub === "tag" && args.includes("-a") && !args.some((a5) => a5 === "-m" || a5.startsWith("--message"))) {
|
|
351158
|
+
return `Interactive command: 'git tag -a' opens an editor for the tag message. Use 'git tag -a <name> -m "message"' instead.`;
|
|
351159
|
+
}
|
|
351160
|
+
if (sub === "add" && (args.includes("-i") || args.includes("--interactive") || args.includes("-p") || args.includes("--patch"))) {
|
|
351161
|
+
return "Interactive command: 'git add -i/-p' requires interactive input. Use 'git add <files>' to stage specific files instead.";
|
|
351162
|
+
}
|
|
351163
|
+
}
|
|
351164
|
+
if (["python", "python3", "node", "irb", "ghci", "lua", "R", "ruby"].includes(base2) && args.length === 0) {
|
|
351165
|
+
return `Interactive command: '${base2}' without arguments starts an interactive REPL. Provide a script file or use '-c'/'--eval' for inline code.`;
|
|
351166
|
+
}
|
|
351167
|
+
if (base2 === "mysql" && !args.some((a5) => a5 === "-e" || a5.startsWith("--execute"))) {
|
|
351168
|
+
return `Interactive command: 'mysql' without -e flag starts an interactive session. Use 'mysql -e "SQL QUERY"' instead.`;
|
|
351169
|
+
}
|
|
351170
|
+
if (base2 === "psql" && !args.some((a5) => a5 === "-c" || a5.startsWith("--command") || a5 === "-f" || a5.startsWith("--file"))) {
|
|
351171
|
+
return `Interactive command: 'psql' without -c flag starts an interactive session. Use 'psql -c "SQL QUERY"' instead.`;
|
|
351172
|
+
}
|
|
351173
|
+
if (["top", "htop", "btop", "nmon"].includes(base2)) {
|
|
351174
|
+
return `Interactive command: '${base2}' is an interactive TUI tool. Use 'ps aux' or 'top -b -n 1' for non-interactive process listing.`;
|
|
351175
|
+
}
|
|
351176
|
+
return null;
|
|
351177
|
+
}
|
|
351178
|
+
function checkInteractiveCommand(command) {
|
|
351179
|
+
if (!command || typeof command !== "string") return null;
|
|
351180
|
+
const components = splitCommandComponents(command.trim());
|
|
351181
|
+
for (const component of components) {
|
|
351182
|
+
const result = checkSingleCommandInteractive(component);
|
|
351183
|
+
if (result) return result;
|
|
351184
|
+
}
|
|
351185
|
+
return null;
|
|
351186
|
+
}
|
|
350606
351187
|
async function executeBashCommand(command, options = {}) {
|
|
350607
351188
|
const {
|
|
350608
351189
|
workingDirectory = process.cwd(),
|
|
@@ -350632,6 +351213,24 @@ async function executeBashCommand(command, options = {}) {
|
|
|
350632
351213
|
};
|
|
350633
351214
|
}
|
|
350634
351215
|
const startTime = Date.now();
|
|
351216
|
+
const interactiveError = checkInteractiveCommand(command);
|
|
351217
|
+
if (interactiveError) {
|
|
351218
|
+
if (debug) {
|
|
351219
|
+
console.log(`[BashExecutor] Blocked interactive command: "${command}"`);
|
|
351220
|
+
console.log(`[BashExecutor] Reason: ${interactiveError}`);
|
|
351221
|
+
}
|
|
351222
|
+
return {
|
|
351223
|
+
success: false,
|
|
351224
|
+
error: interactiveError,
|
|
351225
|
+
stdout: "",
|
|
351226
|
+
stderr: interactiveError,
|
|
351227
|
+
exitCode: 1,
|
|
351228
|
+
command,
|
|
351229
|
+
workingDirectory: cwd,
|
|
351230
|
+
duration: 0,
|
|
351231
|
+
interactive: true
|
|
351232
|
+
};
|
|
351233
|
+
}
|
|
350635
351234
|
if (debug) {
|
|
350636
351235
|
console.log(`[BashExecutor] Executing command: "${command}"`);
|
|
350637
351236
|
console.log(`[BashExecutor] Working directory: "${cwd}"`);
|
|
@@ -350642,6 +351241,8 @@ async function executeBashCommand(command, options = {}) {
|
|
|
350642
351241
|
...process.env,
|
|
350643
351242
|
...env
|
|
350644
351243
|
};
|
|
351244
|
+
if (!processEnv.GIT_EDITOR) processEnv.GIT_EDITOR = "true";
|
|
351245
|
+
if (!processEnv.GIT_TERMINAL_PROMPT) processEnv.GIT_TERMINAL_PROMPT = "0";
|
|
350645
351246
|
const isComplex = isComplexCommand(command);
|
|
350646
351247
|
let cmd, cmdArgs, useShell;
|
|
350647
351248
|
if (isComplex) {
|
|
@@ -350676,20 +351277,32 @@ async function executeBashCommand(command, options = {}) {
|
|
|
350676
351277
|
// stdin ignored, capture stdout/stderr
|
|
350677
351278
|
shell: useShell,
|
|
350678
351279
|
// false for security
|
|
351280
|
+
detached: true,
|
|
351281
|
+
// new session — no controlling terminal
|
|
350679
351282
|
windowsHide: true
|
|
350680
351283
|
});
|
|
350681
351284
|
let stdout = "";
|
|
350682
351285
|
let stderr = "";
|
|
350683
351286
|
let killed = false;
|
|
350684
351287
|
let timeoutHandle;
|
|
351288
|
+
const killProcessGroup = (signal) => {
|
|
351289
|
+
try {
|
|
351290
|
+
if (child.pid) process.kill(-child.pid, signal);
|
|
351291
|
+
} catch {
|
|
351292
|
+
try {
|
|
351293
|
+
child.kill(signal);
|
|
351294
|
+
} catch {
|
|
351295
|
+
}
|
|
351296
|
+
}
|
|
351297
|
+
};
|
|
350685
351298
|
if (timeout > 0) {
|
|
350686
351299
|
timeoutHandle = setTimeout(() => {
|
|
350687
351300
|
if (!killed) {
|
|
350688
351301
|
killed = true;
|
|
350689
|
-
|
|
351302
|
+
killProcessGroup("SIGTERM");
|
|
350690
351303
|
setTimeout(() => {
|
|
350691
351304
|
if (child.exitCode === null) {
|
|
350692
|
-
|
|
351305
|
+
killProcessGroup("SIGKILL");
|
|
350693
351306
|
}
|
|
350694
351307
|
}, 5e3);
|
|
350695
351308
|
}
|
|
@@ -350702,7 +351315,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
350702
351315
|
} else {
|
|
350703
351316
|
if (!killed) {
|
|
350704
351317
|
killed = true;
|
|
350705
|
-
|
|
351318
|
+
killProcessGroup("SIGTERM");
|
|
350706
351319
|
}
|
|
350707
351320
|
}
|
|
350708
351321
|
});
|
|
@@ -350713,7 +351326,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
350713
351326
|
} else {
|
|
350714
351327
|
if (!killed) {
|
|
350715
351328
|
killed = true;
|
|
350716
|
-
|
|
351329
|
+
killProcessGroup("SIGTERM");
|
|
350717
351330
|
}
|
|
350718
351331
|
}
|
|
350719
351332
|
});
|
|
@@ -395253,7 +395866,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Pro
|
|
|
395253
395866
|
/***/ ((module) => {
|
|
395254
395867
|
|
|
395255
395868
|
"use strict";
|
|
395256
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.
|
|
395869
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.148","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-rc264","@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"]}}');
|
|
395257
395870
|
|
|
395258
395871
|
/***/ })
|
|
395259
395872
|
|