@probelabs/visor 0.1.157-ee → 0.1.158-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/frontends/slack-frontend.d.ts.map +1 -1
- package/dist/index.js +28 -15
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/sdk/{check-provider-registry-3O2PAJPF.mjs → check-provider-registry-BOW56JUJ.mjs} +3 -3
- package/dist/sdk/{check-provider-registry-OBUYAPPC.mjs → check-provider-registry-LVXLROAJ.mjs} +3 -3
- package/dist/sdk/{chunk-M3BYMES6.mjs → chunk-AVMMKGLQ.mjs} +1 -16
- package/dist/sdk/{chunk-M3BYMES6.mjs.map → chunk-AVMMKGLQ.mjs.map} +1 -1
- package/dist/sdk/{chunk-PLMM6W3K.mjs → chunk-FRTHLKIG.mjs} +20 -14
- package/dist/sdk/chunk-FRTHLKIG.mjs.map +1 -0
- package/dist/sdk/{chunk-2XSKH755.mjs → chunk-XEVC3I2T.mjs} +20 -14
- package/dist/sdk/chunk-XEVC3I2T.mjs.map +1 -0
- package/dist/sdk/{host-4ONWAJ6Q.mjs → host-IQYTGAJA.mjs} +2 -2
- package/dist/sdk/{host-MIHKJ63G.mjs → host-YKTAWW33.mjs} +2 -2
- package/dist/sdk/{schedule-tool-EZVQOF55.mjs → schedule-tool-526VUPMF.mjs} +3 -3
- package/dist/sdk/{schedule-tool-M2H7O5WL.mjs → schedule-tool-J3ICFSSR.mjs} +3 -3
- package/dist/sdk/{schedule-tool-handler-J3CJWB6A.mjs → schedule-tool-handler-FQO752PR.mjs} +3 -3
- package/dist/sdk/{schedule-tool-handler-O7T66M3I.mjs → schedule-tool-handler-Z5VWUB76.mjs} +3 -3
- package/dist/sdk/sdk.js +12 -20
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +2 -2
- package/dist/sdk/{slack-frontend-6KDUMDDI.mjs → slack-frontend-QO7LW5BH.mjs} +3 -4
- package/dist/sdk/slack-frontend-QO7LW5BH.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-4DC4KOHI.mjs → workflow-check-provider-5G6BGZEX.mjs} +3 -3
- package/dist/sdk/{workflow-check-provider-7RLM3T2I.mjs → workflow-check-provider-7KJD2JXX.mjs} +3 -3
- package/dist/slack/socket-runner.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/sdk/chunk-2XSKH755.mjs.map +0 -1
- package/dist/sdk/chunk-PLMM6W3K.mjs.map +0 -1
- package/dist/sdk/slack-frontend-6KDUMDDI.mjs.map +0 -1
- /package/dist/sdk/{check-provider-registry-3O2PAJPF.mjs.map → check-provider-registry-BOW56JUJ.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-OBUYAPPC.mjs.map → check-provider-registry-LVXLROAJ.mjs.map} +0 -0
- /package/dist/sdk/{host-4ONWAJ6Q.mjs.map → host-IQYTGAJA.mjs.map} +0 -0
- /package/dist/sdk/{host-MIHKJ63G.mjs.map → host-YKTAWW33.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-EZVQOF55.mjs.map → schedule-tool-526VUPMF.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-M2H7O5WL.mjs.map → schedule-tool-J3ICFSSR.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-J3CJWB6A.mjs.map → schedule-tool-handler-FQO752PR.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-O7T66M3I.mjs.map → schedule-tool-handler-Z5VWUB76.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-4DC4KOHI.mjs.map → workflow-check-provider-5G6BGZEX.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-7RLM3T2I.mjs.map → workflow-check-provider-7KJD2JXX.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-frontend.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/frontends/slack-frontend.ts"],"names":[],"mappings":"AAAA;;;;;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ERSION = '0.6.0-rc271';
|
|
4
|
-
process.env.VISOR_COMMIT_SHA = '
|
|
5
|
-
process.env.VISOR_COMMIT_SHORT = '
|
|
4
|
+
process.env.VISOR_COMMIT_SHA = '1e3454d9f5650edec0c5c1cb982653fb1e3ae7c5';
|
|
5
|
+
process.env.VISOR_COMMIT_SHORT = '1e3454d';
|
|
6
6
|
/******/ (() => { // webpackBootstrap
|
|
7
7
|
/******/ var __webpack_modules__ = ({
|
|
8
8
|
|
|
@@ -170943,8 +170943,10 @@ class SlackFrontend {
|
|
|
170943
170943
|
ctx.logger.info(`[slack-frontend] skip posting AI reply for ${checkId}: no renderable text in check output`);
|
|
170944
170944
|
return;
|
|
170945
170945
|
}
|
|
170946
|
-
//
|
|
170947
|
-
|
|
170946
|
+
// Mermaid rendering is temporarily disabled — mmdc/puppeteer is too
|
|
170947
|
+
// heavy for the current deployment and frequently times out.
|
|
170948
|
+
// TODO: re-enable once a lighter renderer (e.g. kroki) is available.
|
|
170949
|
+
const diagrams = []; // was: extractMermaidDiagrams(text);
|
|
170948
170950
|
let processedText = text;
|
|
170949
170951
|
if (diagrams.length > 0) {
|
|
170950
170952
|
try {
|
|
@@ -196759,10 +196761,12 @@ class Scheduler {
|
|
|
196759
196761
|
if (!node_cron_1.default.validate(job.schedule)) {
|
|
196760
196762
|
throw new Error(`Invalid cron expression: ${job.schedule}`);
|
|
196761
196763
|
}
|
|
196762
|
-
// Check if workflow exists
|
|
196763
|
-
|
|
196764
|
-
|
|
196765
|
-
|
|
196764
|
+
// Check if workflow exists ("default" is a special alias for "run all checks")
|
|
196765
|
+
if (job.workflow !== 'default') {
|
|
196766
|
+
const allChecks = Object.keys(this.visorConfig.checks || {});
|
|
196767
|
+
if (!allChecks.includes(job.workflow)) {
|
|
196768
|
+
throw new Error(`Workflow "${job.workflow}" not found in configuration`);
|
|
196769
|
+
}
|
|
196766
196770
|
}
|
|
196767
196771
|
// Use a special ID prefix to distinguish static jobs from dynamic ones
|
|
196768
196772
|
const internalId = `__static_cron__:${jobId}`;
|
|
@@ -197183,9 +197187,13 @@ class Scheduler {
|
|
|
197183
197187
|
logger_1.logger.warn('[Scheduler] No execution engine set, skipping workflow execution');
|
|
197184
197188
|
return { message: 'No execution engine configured' };
|
|
197185
197189
|
}
|
|
197186
|
-
//
|
|
197190
|
+
// Resolve workflow: "default" means run all checks
|
|
197187
197191
|
const allChecks = Object.keys(this.visorConfig.checks || {});
|
|
197188
|
-
|
|
197192
|
+
const checksToRun = schedule.workflow === 'default' ? allChecks : [schedule.workflow];
|
|
197193
|
+
if (checksToRun.length === 0) {
|
|
197194
|
+
throw new Error('No checks configured');
|
|
197195
|
+
}
|
|
197196
|
+
if (schedule.workflow !== 'default' && !allChecks.includes(schedule.workflow)) {
|
|
197189
197197
|
throw new Error(`Workflow "${schedule.workflow}" not found in configuration`);
|
|
197190
197198
|
}
|
|
197191
197199
|
// Build synthetic webhook context for the schedule
|
|
@@ -197220,7 +197228,7 @@ class Scheduler {
|
|
|
197220
197228
|
const { engine: runEngine, config: cfgForRun } = this.prepareExecution(schedule);
|
|
197221
197229
|
// Execute the workflow
|
|
197222
197230
|
await runEngine.executeChecks({
|
|
197223
|
-
checks:
|
|
197231
|
+
checks: checksToRun,
|
|
197224
197232
|
showDetails: true,
|
|
197225
197233
|
outputFormat: 'json',
|
|
197226
197234
|
config: cfgForRun,
|
|
@@ -200895,9 +200903,14 @@ class SlackSocketRunner {
|
|
|
200895
200903
|
const threadKey = channel && replyTs ? this.trackThread(channel, replyTs) : '';
|
|
200896
200904
|
logger_1.logger.info(`[SlackSocket] Message trigger '${id}' matched → workflow="${trigger.workflow}" channel=${channel} ts=${ts}`);
|
|
200897
200905
|
try {
|
|
200898
|
-
//
|
|
200906
|
+
// Resolve workflow: "default" means run all checks (same as normal message flow)
|
|
200899
200907
|
const allChecks = Object.keys(this.cfg.checks || {});
|
|
200900
|
-
|
|
200908
|
+
const checksToRun = trigger.workflow === 'default' ? allChecks : [trigger.workflow];
|
|
200909
|
+
if (checksToRun.length === 0) {
|
|
200910
|
+
logger_1.logger.error(`[SlackSocket] Message trigger '${id}': no checks configured`);
|
|
200911
|
+
return;
|
|
200912
|
+
}
|
|
200913
|
+
if (trigger.workflow !== 'default' && !allChecks.includes(trigger.workflow)) {
|
|
200901
200914
|
logger_1.logger.error(`[SlackSocket] Message trigger '${id}': workflow "${trigger.workflow}" not found in configuration`);
|
|
200902
200915
|
return;
|
|
200903
200916
|
}
|
|
@@ -200994,7 +201007,7 @@ class SlackSocketRunner {
|
|
|
200994
201007
|
'slack.user_id': user,
|
|
200995
201008
|
}, async () => {
|
|
200996
201009
|
await runEngine.executeChecks({
|
|
200997
|
-
checks:
|
|
201010
|
+
checks: checksToRun,
|
|
200998
201011
|
showDetails: true,
|
|
200999
201012
|
outputFormat: 'json',
|
|
201000
201013
|
config: cfgForRun,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/scheduler/scheduler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAGhG,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEjF;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,aAAa,CAAC,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;QAC1C,cAAc,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC7C,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W,qBAAqB;IA4CnC;;OAEG;YACW,oBAAoB;IAyBlC;;OAEG;YACW,sBAAsB;IAyDpC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4C3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;YACW,gBAAgB;IAiB9B;;OAEG;YACW,iBAAiB;IAQ/B;;OAEG;YACW,iBAAiB;IAuD/B;;OAEG;YACW,eAAe;IAiC7B;;OAEG;YACW,iBAAiB;IA+B/B;;OAEG;YACW,eAAe;IAuF7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA2CxB;;OAEG;YACW,eAAe;IAqE7B;;;OAGG;YACW,qBAAqB;IAqKnC;;OAEG;YACW,qBAAqB;IA2BnC;;OAEG;YACW,UAAU;IAuBxB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,uBAAuB,EAAE,MAAM,CAAC;QAChC,UAAU,EAAE,kBAAkB,CAAC;KAChC,CAAC;CAQH;AAKD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,WAAW,CAAC,EAAE,WAAW,EACzB,MAAM,CAAC,EAAE,eAAe,GACvB,SAAS,GAAG,SAAS,CAKvB;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC"}
|
package/dist/sdk/{check-provider-registry-3O2PAJPF.mjs → check-provider-registry-BOW56JUJ.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CheckProviderRegistry,
|
|
3
3
|
init_check_provider_registry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XEVC3I2T.mjs";
|
|
5
5
|
import "./chunk-KFKHU6CM.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-AVMMKGLQ.mjs";
|
|
7
7
|
import "./chunk-LG4AUKHB.mjs";
|
|
8
8
|
import "./chunk-B7BVQM5K.mjs";
|
|
9
9
|
import "./chunk-XXAEN5KU.mjs";
|
|
@@ -26,4 +26,4 @@ init_check_provider_registry();
|
|
|
26
26
|
export {
|
|
27
27
|
CheckProviderRegistry
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=check-provider-registry-
|
|
29
|
+
//# sourceMappingURL=check-provider-registry-BOW56JUJ.mjs.map
|
package/dist/sdk/{check-provider-registry-OBUYAPPC.mjs → check-provider-registry-LVXLROAJ.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CheckProviderRegistry,
|
|
3
3
|
init_check_provider_registry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FRTHLKIG.mjs";
|
|
5
5
|
import "./chunk-KFKHU6CM.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-AVMMKGLQ.mjs";
|
|
7
7
|
import "./chunk-LG4AUKHB.mjs";
|
|
8
8
|
import "./chunk-B7BVQM5K.mjs";
|
|
9
9
|
import "./chunk-XXAEN5KU.mjs";
|
|
@@ -26,4 +26,4 @@ init_check_provider_registry();
|
|
|
26
26
|
export {
|
|
27
27
|
CheckProviderRegistry
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=check-provider-registry-
|
|
29
|
+
//# sourceMappingURL=check-provider-registry-LVXLROAJ.mjs.map
|
|
@@ -7,20 +7,6 @@ import { spawn } from "child_process";
|
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
import * as os from "os";
|
|
10
|
-
function extractMermaidDiagrams(text) {
|
|
11
|
-
const diagrams = [];
|
|
12
|
-
const regex = /```mermaid\s*\n([\s\S]*?)```/g;
|
|
13
|
-
let match;
|
|
14
|
-
while ((match = regex.exec(text)) !== null) {
|
|
15
|
-
diagrams.push({
|
|
16
|
-
fullMatch: match[0],
|
|
17
|
-
code: match[1].trim(),
|
|
18
|
-
startIndex: match.index,
|
|
19
|
-
endIndex: match.index + match[0].length
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return diagrams;
|
|
23
|
-
}
|
|
24
10
|
async function renderMermaidToPng(mermaidCode) {
|
|
25
11
|
const tmpDir = os.tmpdir();
|
|
26
12
|
const inputFile = path.join(
|
|
@@ -217,7 +203,6 @@ var init_markdown = __esm({
|
|
|
217
203
|
});
|
|
218
204
|
|
|
219
205
|
export {
|
|
220
|
-
extractMermaidDiagrams,
|
|
221
206
|
renderMermaidToPng,
|
|
222
207
|
replaceMermaidBlocks,
|
|
223
208
|
extractFileSections,
|
|
@@ -225,4 +210,4 @@ export {
|
|
|
225
210
|
formatSlackText,
|
|
226
211
|
init_markdown
|
|
227
212
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
213
|
+
//# sourceMappingURL=chunk-AVMMKGLQ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/slack/markdown.ts"],"sourcesContent":["// Lightweight Markdown → Slack mrkdwn formatter.\n// The goal is to make common Markdown output from AI steps look natural in Slack\n// without pulling in a full Markdown parser.\n//\n// Supported conversions:\n// - # Header / ## Header → *Header* (bold with visual separation)\n// - **bold** / __bold__ → *bold*\n// - [label](url) → <url|label>\n// -  → <url|alt>\n// - *italic* (inline) → _italic_\n// - ```mermaid blocks → rendered to PNG and uploaded to Slack\n//\n// Everything else is passed through unchanged; Slack will still render many\n// Markdown-like constructs (lists, code fences, etc.) natively.\n\nimport { spawn } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\n\n/**\n * Represents an extracted mermaid diagram\n */\nexport interface MermaidDiagram {\n /** The full match including ```mermaid and ``` */\n fullMatch: string;\n /** The mermaid code content */\n code: string;\n /** Start index in the original text */\n startIndex: number;\n /** End index in the original text */\n endIndex: number;\n}\n\n/**\n * Extract all mermaid code blocks from text\n */\nexport function extractMermaidDiagrams(text: string): MermaidDiagram[] {\n const diagrams: MermaidDiagram[] = [];\n // Match ```mermaid followed by newline, content, and closing ```\n const regex = /```mermaid\\s*\\n([\\s\\S]*?)```/g;\n let match;\n while ((match = regex.exec(text)) !== null) {\n diagrams.push({\n fullMatch: match[0],\n code: match[1].trim(),\n startIndex: match.index,\n endIndex: match.index + match[0].length,\n });\n }\n return diagrams;\n}\n\n/**\n * Render a mermaid diagram to PNG using mmdc CLI (@mermaid-js/mermaid-cli).\n *\n * Requirements:\n * - Node.js and npx must be available in PATH\n * - Network access on first run (npx downloads the package)\n * - Puppeteer/Chromium dependencies (mermaid-cli uses headless browser)\n *\n * On Linux, you may need to install chromium dependencies:\n * apt-get install -y chromium-browser libatk-bridge2.0-0 libgtk-3-0\n *\n * On Docker/CI, consider using a base image with puppeteer support or\n * pre-installing @mermaid-js/mermaid-cli globally.\n *\n * @param mermaidCode The mermaid diagram code\n * @returns Buffer containing PNG data, or null if rendering failed\n */\nexport async function renderMermaidToPng(mermaidCode: string): Promise<Buffer | null> {\n // Create temp files for input and output\n const tmpDir = os.tmpdir();\n const inputFile = path.join(\n tmpDir,\n `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}.mmd`\n );\n const outputFile = path.join(\n tmpDir,\n `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}.png`\n );\n\n try {\n // Write mermaid code to temp file\n fs.writeFileSync(inputFile, mermaidCode, 'utf-8');\n\n // Detect system chromium for puppeteer (mermaid-cli dependency)\n // Without this, puppeteer may hang trying to download its own chromium\n const chromiumPaths = [\n '/usr/bin/chromium',\n '/usr/bin/chromium-browser',\n '/usr/bin/google-chrome',\n '/usr/bin/chrome',\n ];\n let chromiumPath: string | undefined;\n for (const p of chromiumPaths) {\n if (fs.existsSync(p)) {\n chromiumPath = p;\n break;\n }\n }\n\n // Build environment with chromium path if found\n const env = { ...process.env };\n if (chromiumPath) {\n env.PUPPETEER_EXECUTABLE_PATH = chromiumPath;\n }\n\n // Run mmdc to render PNG\n const result = await new Promise<{ success: boolean; error?: string }>(resolve => {\n const proc = spawn(\n 'npx',\n [\n '--yes',\n '@mermaid-js/mermaid-cli',\n '-i',\n inputFile,\n '-o',\n outputFile,\n '-e',\n 'png',\n '-b',\n 'white',\n '-w',\n '1200',\n ],\n {\n timeout: 60000, // 60 second timeout (first run may download packages)\n stdio: ['pipe', 'pipe', 'pipe'],\n env,\n }\n );\n\n let stderr = '';\n proc.stderr?.on('data', data => {\n stderr += data.toString();\n });\n\n proc.on('close', code => {\n if (code === 0) {\n resolve({ success: true });\n } else {\n resolve({ success: false, error: stderr || `Exit code ${code}` });\n }\n });\n\n proc.on('error', err => {\n resolve({ success: false, error: err.message });\n });\n });\n\n if (!result.success) {\n console.warn(`Mermaid rendering failed: ${result.error}`);\n return null;\n }\n\n // Read the output PNG\n if (!fs.existsSync(outputFile)) {\n console.warn('Mermaid output file not created');\n return null;\n }\n\n const pngBuffer = fs.readFileSync(outputFile);\n return pngBuffer;\n } catch (e) {\n console.warn(`Mermaid rendering error: ${e instanceof Error ? e.message : String(e)}`);\n return null;\n } finally {\n // Cleanup temp files\n try {\n if (fs.existsSync(inputFile)) fs.unlinkSync(inputFile);\n if (fs.existsSync(outputFile)) fs.unlinkSync(outputFile);\n } catch {\n // Ignore cleanup errors\n }\n }\n}\n\n/**\n * Replace mermaid blocks in text with a placeholder message\n * @param text Original text\n * @param diagrams Extracted diagrams\n * @param replacement Text to replace each diagram with (or a function that returns replacement for each index)\n */\nexport function replaceMermaidBlocks(\n text: string,\n diagrams: MermaidDiagram[],\n replacement: string | ((index: number) => string) = '_(See diagram above)_'\n): string {\n if (diagrams.length === 0) return text;\n\n // Sort by start index descending to replace from end to start (preserves indices)\n const sorted = [...diagrams].sort((a, b) => b.startIndex - a.startIndex);\n\n let result = text;\n sorted.forEach((diagram, sortedIndex) => {\n // Calculate original index (since we sorted in reverse)\n const originalIndex = diagrams.length - 1 - sortedIndex;\n const rep = typeof replacement === 'function' ? replacement(originalIndex) : replacement;\n result = result.slice(0, diagram.startIndex) + rep + result.slice(diagram.endIndex);\n });\n\n return result;\n}\n\nexport function markdownToSlack(text: string): string {\n if (!text || typeof text !== 'string') return '';\n\n let out = text;\n\n // Images:  → <url|alt>\n // We intentionally keep only the URL + alt text; Slack will usually unfurl.\n out = out.replace(\n /!\\[([^\\]]*)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g,\n (_m, alt: string, url: string) => `<${url}|${alt || 'image'}>`\n );\n\n // Links: [label](url) → <url|label>\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g,\n (_m, label: string, url: string) => `<${url}|${label}>`\n );\n\n // Bold: **text** or __text__ → *text*\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, (_m, inner: string) => `*${inner}*`);\n out = out.replace(/__([^_]+)__/g, (_m, inner: string) => `*${inner}*`);\n\n // Process lines for headers and bullet lists.\n // Slack's mrkdwn handles \"•\" bullets more naturally than raw \"-\" Markdown.\n const lines = out.split(/\\r?\\n/);\n let inCodeBlock = false;\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const trimmed = line.trimStart();\n // Track fenced code blocks and avoid rewriting inside them\n if (/^```/.test(trimmed)) {\n inCodeBlock = !inCodeBlock;\n continue;\n }\n if (inCodeBlock) continue;\n\n // Headers: # Header → *Header* (Slack doesn't have native headers)\n // Match 1-6 # at start of line, followed by space and text\n const headerMatch = /^(#{1,6})\\s+(.+)$/.exec(trimmed);\n if (headerMatch) {\n const [, hashes, headerText] = headerMatch;\n // For h1/h2, add extra emphasis with newline before (if not first line\n // and previous line is not empty/header/code-fence)\n const prevLine = i > 0 ? lines[i - 1].trim() : '';\n const prevIsHeaderOrFence =\n /^#{1,6}\\s+/.test(prevLine) || /^\\*[^*]+\\*$/.test(prevLine) || /^```/.test(prevLine);\n if (hashes.length <= 2 && i > 0 && prevLine !== '' && !prevIsHeaderOrFence) {\n lines[i] = `\\n*${headerText.trim()}*`;\n } else {\n lines[i] = `*${headerText.trim()}*`;\n }\n continue;\n }\n\n // Bullet lists: \"- item\" or \"* item\" → \"• item\" (preserve indentation)\n const bulletMatch = /^(\\s*)([-*])\\s+(.+)$/.exec(line);\n if (bulletMatch) {\n const [, indent, , rest] = bulletMatch;\n lines[i] = `${indent}• ${rest}`;\n }\n }\n out = lines.join('\\n');\n\n return out;\n}\n\n/**\n * Represents an extracted file section delimited by --- filename.ext ---\n */\nexport interface FileSection {\n /** Full match including delimiter(s) and content */\n fullMatch: string;\n /** Extracted filename (e.g., \"report.csv\") */\n filename: string;\n /** Content after the opening delimiter (trimmed) */\n content: string;\n /** Start index in the original text */\n startIndex: number;\n /** End index in the original text */\n endIndex: number;\n}\n\n/**\n * Extract all file sections delimited by --- filename.ext --- from text.\n *\n * A section starts at a `--- filename.ext ---` line. It ends at:\n * 1. A closing delimiter with the same filename (optional, backward-compatible)\n * 2. The next `--- other.ext ---` delimiter (starts a new section)\n * 3. End of text\n */\nexport function extractFileSections(text: string): FileSection[] {\n const sections: FileSection[] = [];\n\n // Find all --- filename.ext --- delimiter lines\n const delimRegex = /^--- ([\\w][\\w.\\-]*\\.\\w+) ---$/gm;\n const delimiters: { filename: string; start: number; end: number }[] = [];\n let m;\n while ((m = delimRegex.exec(text)) !== null) {\n delimiters.push({\n filename: m[1],\n start: m.index,\n end: m.index + m[0].length,\n });\n }\n\n if (delimiters.length === 0) return sections;\n\n for (let i = 0; i < delimiters.length; i++) {\n const open = delimiters[i];\n\n // Content starts after the newline following the opening delimiter\n const contentStart =\n open.end < text.length && text[open.end] === '\\n' ? open.end + 1 : open.end;\n\n // Section extends to the next delimiter or end of text\n const sectionEnd = i + 1 < delimiters.length ? delimiters[i + 1].start : text.length;\n const content = text.substring(contentStart, sectionEnd).trim();\n if (content.length > 0) {\n sections.push({\n fullMatch: text.substring(open.start, sectionEnd),\n filename: open.filename,\n content,\n startIndex: open.start,\n endIndex: sectionEnd,\n });\n }\n }\n\n return sections;\n}\n\n/**\n * Replace file sections in text with placeholder messages.\n * Uses back-to-front replacement to preserve indices (same as replaceMermaidBlocks).\n */\nexport function replaceFileSections(\n text: string,\n sections: FileSection[],\n replacement: string | ((index: number) => string) = idx =>\n `_(See file: ${sections[idx].filename} above)_`\n): string {\n if (sections.length === 0) return text;\n\n const sorted = [...sections].sort((a, b) => b.startIndex - a.startIndex);\n\n let result = text;\n sorted.forEach((section, sortedIndex) => {\n const originalIndex = sections.length - 1 - sortedIndex;\n const rep = typeof replacement === 'function' ? replacement(originalIndex) : replacement;\n result = result.slice(0, section.startIndex) + rep + result.slice(section.endIndex);\n });\n\n return result;\n}\n\nexport function formatSlackText(text: string): string {\n return markdownToSlack(text);\n}\n"],"mappings":";;;;;AAeA,SAAS,aAAa;AACtB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,QAAQ;AAmBb,SAAS,uBAAuB,MAAgC;AACrE,QAAM,WAA6B,CAAC;AAEpC,QAAM,QAAQ;AACd,MAAI;AACJ,UAAQ,QAAQ,MAAM,KAAK,IAAI,OAAO,MAAM;AAC1C,aAAS,KAAK;AAAA,MACZ,WAAW,MAAM,CAAC;AAAA,MAClB,MAAM,MAAM,CAAC,EAAE,KAAK;AAAA,MACpB,YAAY,MAAM;AAAA,MAClB,UAAU,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,IACnC,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAmBA,eAAsB,mBAAmB,aAA6C;AAEpF,QAAM,SAAY,UAAO;AACzB,QAAM,YAAiB;AAAA,IACrB;AAAA,IACA,WAAW,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAAA,EAC9D;AACA,QAAM,aAAkB;AAAA,IACtB;AAAA,IACA,WAAW,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAAA,E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
1
|
+
{"version":3,"sources":["../../src/slack/markdown.ts"],"sourcesContent":["// Lightweight Markdown → Slack mrkdwn formatter.\n// The goal is to make common Markdown output from AI steps look natural in Slack\n// without pulling in a full Markdown parser.\n//\n// Supported conversions:\n// - # Header / ## Header → *Header* (bold with visual separation)\n// - **bold** / __bold__ → *bold*\n// - [label](url) → <url|label>\n// -  → <url|alt>\n// - *italic* (inline) → _italic_\n// - ```mermaid blocks → rendered to PNG and uploaded to Slack\n//\n// Everything else is passed through unchanged; Slack will still render many\n// Markdown-like constructs (lists, code fences, etc.) natively.\n\nimport { spawn } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\n\n/**\n * Represents an extracted mermaid diagram\n */\nexport interface MermaidDiagram {\n /** The full match including ```mermaid and ``` */\n fullMatch: string;\n /** The mermaid code content */\n code: string;\n /** Start index in the original text */\n startIndex: number;\n /** End index in the original text */\n endIndex: number;\n}\n\n/**\n * Extract all mermaid code blocks from text\n */\nexport function extractMermaidDiagrams(text: string): MermaidDiagram[] {\n const diagrams: MermaidDiagram[] = [];\n // Match ```mermaid followed by newline, content, and closing ```\n const regex = /```mermaid\\s*\\n([\\s\\S]*?)```/g;\n let match;\n while ((match = regex.exec(text)) !== null) {\n diagrams.push({\n fullMatch: match[0],\n code: match[1].trim(),\n startIndex: match.index,\n endIndex: match.index + match[0].length,\n });\n }\n return diagrams;\n}\n\n/**\n * Render a mermaid diagram to PNG using mmdc CLI (@mermaid-js/mermaid-cli).\n *\n * Requirements:\n * - Node.js and npx must be available in PATH\n * - Network access on first run (npx downloads the package)\n * - Puppeteer/Chromium dependencies (mermaid-cli uses headless browser)\n *\n * On Linux, you may need to install chromium dependencies:\n * apt-get install -y chromium-browser libatk-bridge2.0-0 libgtk-3-0\n *\n * On Docker/CI, consider using a base image with puppeteer support or\n * pre-installing @mermaid-js/mermaid-cli globally.\n *\n * @param mermaidCode The mermaid diagram code\n * @returns Buffer containing PNG data, or null if rendering failed\n */\nexport async function renderMermaidToPng(mermaidCode: string): Promise<Buffer | null> {\n // Create temp files for input and output\n const tmpDir = os.tmpdir();\n const inputFile = path.join(\n tmpDir,\n `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}.mmd`\n );\n const outputFile = path.join(\n tmpDir,\n `mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}.png`\n );\n\n try {\n // Write mermaid code to temp file\n fs.writeFileSync(inputFile, mermaidCode, 'utf-8');\n\n // Detect system chromium for puppeteer (mermaid-cli dependency)\n // Without this, puppeteer may hang trying to download its own chromium\n const chromiumPaths = [\n '/usr/bin/chromium',\n '/usr/bin/chromium-browser',\n '/usr/bin/google-chrome',\n '/usr/bin/chrome',\n ];\n let chromiumPath: string | undefined;\n for (const p of chromiumPaths) {\n if (fs.existsSync(p)) {\n chromiumPath = p;\n break;\n }\n }\n\n // Build environment with chromium path if found\n const env = { ...process.env };\n if (chromiumPath) {\n env.PUPPETEER_EXECUTABLE_PATH = chromiumPath;\n }\n\n // Run mmdc to render PNG\n const result = await new Promise<{ success: boolean; error?: string }>(resolve => {\n const proc = spawn(\n 'npx',\n [\n '--yes',\n '@mermaid-js/mermaid-cli',\n '-i',\n inputFile,\n '-o',\n outputFile,\n '-e',\n 'png',\n '-b',\n 'white',\n '-w',\n '1200',\n ],\n {\n timeout: 60000, // 60 second timeout (first run may download packages)\n stdio: ['pipe', 'pipe', 'pipe'],\n env,\n }\n );\n\n let stderr = '';\n proc.stderr?.on('data', data => {\n stderr += data.toString();\n });\n\n proc.on('close', code => {\n if (code === 0) {\n resolve({ success: true });\n } else {\n resolve({ success: false, error: stderr || `Exit code ${code}` });\n }\n });\n\n proc.on('error', err => {\n resolve({ success: false, error: err.message });\n });\n });\n\n if (!result.success) {\n console.warn(`Mermaid rendering failed: ${result.error}`);\n return null;\n }\n\n // Read the output PNG\n if (!fs.existsSync(outputFile)) {\n console.warn('Mermaid output file not created');\n return null;\n }\n\n const pngBuffer = fs.readFileSync(outputFile);\n return pngBuffer;\n } catch (e) {\n console.warn(`Mermaid rendering error: ${e instanceof Error ? e.message : String(e)}`);\n return null;\n } finally {\n // Cleanup temp files\n try {\n if (fs.existsSync(inputFile)) fs.unlinkSync(inputFile);\n if (fs.existsSync(outputFile)) fs.unlinkSync(outputFile);\n } catch {\n // Ignore cleanup errors\n }\n }\n}\n\n/**\n * Replace mermaid blocks in text with a placeholder message\n * @param text Original text\n * @param diagrams Extracted diagrams\n * @param replacement Text to replace each diagram with (or a function that returns replacement for each index)\n */\nexport function replaceMermaidBlocks(\n text: string,\n diagrams: MermaidDiagram[],\n replacement: string | ((index: number) => string) = '_(See diagram above)_'\n): string {\n if (diagrams.length === 0) return text;\n\n // Sort by start index descending to replace from end to start (preserves indices)\n const sorted = [...diagrams].sort((a, b) => b.startIndex - a.startIndex);\n\n let result = text;\n sorted.forEach((diagram, sortedIndex) => {\n // Calculate original index (since we sorted in reverse)\n const originalIndex = diagrams.length - 1 - sortedIndex;\n const rep = typeof replacement === 'function' ? replacement(originalIndex) : replacement;\n result = result.slice(0, diagram.startIndex) + rep + result.slice(diagram.endIndex);\n });\n\n return result;\n}\n\nexport function markdownToSlack(text: string): string {\n if (!text || typeof text !== 'string') return '';\n\n let out = text;\n\n // Images:  → <url|alt>\n // We intentionally keep only the URL + alt text; Slack will usually unfurl.\n out = out.replace(\n /!\\[([^\\]]*)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g,\n (_m, alt: string, url: string) => `<${url}|${alt || 'image'}>`\n );\n\n // Links: [label](url) → <url|label>\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g,\n (_m, label: string, url: string) => `<${url}|${label}>`\n );\n\n // Bold: **text** or __text__ → *text*\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, (_m, inner: string) => `*${inner}*`);\n out = out.replace(/__([^_]+)__/g, (_m, inner: string) => `*${inner}*`);\n\n // Process lines for headers and bullet lists.\n // Slack's mrkdwn handles \"•\" bullets more naturally than raw \"-\" Markdown.\n const lines = out.split(/\\r?\\n/);\n let inCodeBlock = false;\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const trimmed = line.trimStart();\n // Track fenced code blocks and avoid rewriting inside them\n if (/^```/.test(trimmed)) {\n inCodeBlock = !inCodeBlock;\n continue;\n }\n if (inCodeBlock) continue;\n\n // Headers: # Header → *Header* (Slack doesn't have native headers)\n // Match 1-6 # at start of line, followed by space and text\n const headerMatch = /^(#{1,6})\\s+(.+)$/.exec(trimmed);\n if (headerMatch) {\n const [, hashes, headerText] = headerMatch;\n // For h1/h2, add extra emphasis with newline before (if not first line\n // and previous line is not empty/header/code-fence)\n const prevLine = i > 0 ? lines[i - 1].trim() : '';\n const prevIsHeaderOrFence =\n /^#{1,6}\\s+/.test(prevLine) || /^\\*[^*]+\\*$/.test(prevLine) || /^```/.test(prevLine);\n if (hashes.length <= 2 && i > 0 && prevLine !== '' && !prevIsHeaderOrFence) {\n lines[i] = `\\n*${headerText.trim()}*`;\n } else {\n lines[i] = `*${headerText.trim()}*`;\n }\n continue;\n }\n\n // Bullet lists: \"- item\" or \"* item\" → \"• item\" (preserve indentation)\n const bulletMatch = /^(\\s*)([-*])\\s+(.+)$/.exec(line);\n if (bulletMatch) {\n const [, indent, , rest] = bulletMatch;\n lines[i] = `${indent}• ${rest}`;\n }\n }\n out = lines.join('\\n');\n\n return out;\n}\n\n/**\n * Represents an extracted file section delimited by --- filename.ext ---\n */\nexport interface FileSection {\n /** Full match including delimiter(s) and content */\n fullMatch: string;\n /** Extracted filename (e.g., \"report.csv\") */\n filename: string;\n /** Content after the opening delimiter (trimmed) */\n content: string;\n /** Start index in the original text */\n startIndex: number;\n /** End index in the original text */\n endIndex: number;\n}\n\n/**\n * Extract all file sections delimited by --- filename.ext --- from text.\n *\n * A section starts at a `--- filename.ext ---` line. It ends at:\n * 1. A closing delimiter with the same filename (optional, backward-compatible)\n * 2. The next `--- other.ext ---` delimiter (starts a new section)\n * 3. End of text\n */\nexport function extractFileSections(text: string): FileSection[] {\n const sections: FileSection[] = [];\n\n // Find all --- filename.ext --- delimiter lines\n const delimRegex = /^--- ([\\w][\\w.\\-]*\\.\\w+) ---$/gm;\n const delimiters: { filename: string; start: number; end: number }[] = [];\n let m;\n while ((m = delimRegex.exec(text)) !== null) {\n delimiters.push({\n filename: m[1],\n start: m.index,\n end: m.index + m[0].length,\n });\n }\n\n if (delimiters.length === 0) return sections;\n\n for (let i = 0; i < delimiters.length; i++) {\n const open = delimiters[i];\n\n // Content starts after the newline following the opening delimiter\n const contentStart =\n open.end < text.length && text[open.end] === '\\n' ? open.end + 1 : open.end;\n\n // Section extends to the next delimiter or end of text\n const sectionEnd = i + 1 < delimiters.length ? delimiters[i + 1].start : text.length;\n const content = text.substring(contentStart, sectionEnd).trim();\n if (content.length > 0) {\n sections.push({\n fullMatch: text.substring(open.start, sectionEnd),\n filename: open.filename,\n content,\n startIndex: open.start,\n endIndex: sectionEnd,\n });\n }\n }\n\n return sections;\n}\n\n/**\n * Replace file sections in text with placeholder messages.\n * Uses back-to-front replacement to preserve indices (same as replaceMermaidBlocks).\n */\nexport function replaceFileSections(\n text: string,\n sections: FileSection[],\n replacement: string | ((index: number) => string) = idx =>\n `_(See file: ${sections[idx].filename} above)_`\n): string {\n if (sections.length === 0) return text;\n\n const sorted = [...sections].sort((a, b) => b.startIndex - a.startIndex);\n\n let result = text;\n sorted.forEach((section, sortedIndex) => {\n const originalIndex = sections.length - 1 - sortedIndex;\n const rep = typeof replacement === 'function' ? replacement(originalIndex) : replacement;\n result = result.slice(0, section.startIndex) + rep + result.slice(section.endIndex);\n });\n\n return result;\n}\n\nexport function formatSlackText(text: string): string {\n return markdownToSlack(text);\n}\n"],"mappings":";;;;;AAeA,SAAS,aAAa;AACtB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,QAAQ;AAoDpB,eAAsB,mBAAmB,aAA6C;AAEpF,QAAM,SAAY,UAAO;AACzB,QAAM,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OAAO,gBAAgB,aAAa,YAAY,aAAa,IAAI;AAC7E,aAAS,OAAO,MAAM,GAAG,QAAQ,UAAU,IAAI,MAAM,OAAO,MAAM,QAAQ,QAAQ;AAAA,EACpF,CAAC;AAED,SAAO;AACT;AAEO,SAAS,gBAAgB,MAAsB;AACpD,SAAO,gBAAgB,IAAI;AAC7B;AA1WA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
extractFileSections,
|
|
7
7
|
init_markdown,
|
|
8
8
|
replaceFileSections
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AVMMKGLQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
getPromptStateManager,
|
|
12
12
|
init_prompt_state
|
|
@@ -3959,7 +3959,7 @@ async function executeWorkflowAsTool(workflowId, args, context2, argsOverrides)
|
|
|
3959
3959
|
...args,
|
|
3960
3960
|
...argsOverrides
|
|
3961
3961
|
};
|
|
3962
|
-
const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-
|
|
3962
|
+
const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-5G6BGZEX.mjs");
|
|
3963
3963
|
const provider = new WorkflowCheckProvider2();
|
|
3964
3964
|
const checkConfig = {
|
|
3965
3965
|
type: "workflow",
|
|
@@ -13027,7 +13027,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
13027
13027
|
try {
|
|
13028
13028
|
const map = options?.webhookContext?.webhookData;
|
|
13029
13029
|
if (map) {
|
|
13030
|
-
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-
|
|
13030
|
+
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-LVXLROAJ.mjs");
|
|
13031
13031
|
const reg = CheckProviderRegistry2.getInstance();
|
|
13032
13032
|
const p = reg.getProvider("http_input");
|
|
13033
13033
|
if (p && typeof p.setWebhookContext === "function") p.setWebhookContext(map);
|
|
@@ -13150,7 +13150,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
13150
13150
|
tag_filter: tagFilter
|
|
13151
13151
|
} : config;
|
|
13152
13152
|
try {
|
|
13153
|
-
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-
|
|
13153
|
+
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-LVXLROAJ.mjs");
|
|
13154
13154
|
const registry = CheckProviderRegistry2.getInstance();
|
|
13155
13155
|
registry.setCustomTools(configWithTagFilter.tools || {});
|
|
13156
13156
|
} catch (error) {
|
|
@@ -13214,7 +13214,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
13214
13214
|
try {
|
|
13215
13215
|
const webhookData = this.executionContext?.webhookContext?.webhookData;
|
|
13216
13216
|
if (webhookData instanceof Map) {
|
|
13217
|
-
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-
|
|
13217
|
+
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-Z5VWUB76.mjs");
|
|
13218
13218
|
const slackCtx = extractSlackContext2(webhookData);
|
|
13219
13219
|
if (slackCtx) {
|
|
13220
13220
|
const payload = Array.from(webhookData.values())[0];
|
|
@@ -13243,7 +13243,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
13243
13243
|
if (Array.isArray(configWithTagFilter.frontends) && configWithTagFilter.frontends.length > 0) {
|
|
13244
13244
|
try {
|
|
13245
13245
|
const { EventBus } = await import("./event-bus-5K3Y2FCS.mjs");
|
|
13246
|
-
const { FrontendsHost } = await import("./host-
|
|
13246
|
+
const { FrontendsHost } = await import("./host-YKTAWW33.mjs");
|
|
13247
13247
|
const bus = new EventBus();
|
|
13248
13248
|
context2.eventBus = bus;
|
|
13249
13249
|
frontendsHost = new FrontendsHost(bus, logger);
|
|
@@ -13991,9 +13991,11 @@ var init_scheduler = __esm({
|
|
|
13991
13991
|
if (!cron.validate(job.schedule)) {
|
|
13992
13992
|
throw new Error(`Invalid cron expression: ${job.schedule}`);
|
|
13993
13993
|
}
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13994
|
+
if (job.workflow !== "default") {
|
|
13995
|
+
const allChecks = Object.keys(this.visorConfig.checks || {});
|
|
13996
|
+
if (!allChecks.includes(job.workflow)) {
|
|
13997
|
+
throw new Error(`Workflow "${job.workflow}" not found in configuration`);
|
|
13998
|
+
}
|
|
13997
13999
|
}
|
|
13998
14000
|
const internalId = `__static_cron__:${jobId}`;
|
|
13999
14001
|
const cronJob = cron.schedule(
|
|
@@ -14379,7 +14381,11 @@ var init_scheduler = __esm({
|
|
|
14379
14381
|
return { message: "No execution engine configured" };
|
|
14380
14382
|
}
|
|
14381
14383
|
const allChecks = Object.keys(this.visorConfig.checks || {});
|
|
14382
|
-
|
|
14384
|
+
const checksToRun = schedule.workflow === "default" ? allChecks : [schedule.workflow];
|
|
14385
|
+
if (checksToRun.length === 0) {
|
|
14386
|
+
throw new Error("No checks configured");
|
|
14387
|
+
}
|
|
14388
|
+
if (schedule.workflow !== "default" && !allChecks.includes(schedule.workflow)) {
|
|
14383
14389
|
throw new Error(`Workflow "${schedule.workflow}" not found in configuration`);
|
|
14384
14390
|
}
|
|
14385
14391
|
const syntheticPayload = {
|
|
@@ -14409,7 +14415,7 @@ var init_scheduler = __esm({
|
|
|
14409
14415
|
}
|
|
14410
14416
|
const { engine: runEngine, config: cfgForRun } = this.prepareExecution(schedule);
|
|
14411
14417
|
await runEngine.executeChecks({
|
|
14412
|
-
checks:
|
|
14418
|
+
checks: checksToRun,
|
|
14413
14419
|
showDetails: true,
|
|
14414
14420
|
outputFormat: "json",
|
|
14415
14421
|
config: cfgForRun,
|
|
@@ -40722,8 +40728,8 @@ function buildBuiltinGlobals(opts) {
|
|
|
40722
40728
|
const asyncFunctionNames = /* @__PURE__ */ new Set();
|
|
40723
40729
|
const scheduleFn = async (args = {}) => {
|
|
40724
40730
|
try {
|
|
40725
|
-
const { handleScheduleAction: handleScheduleAction2, buildScheduleToolContext: buildScheduleToolContext2 } = await import("./schedule-tool-
|
|
40726
|
-
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-
|
|
40731
|
+
const { handleScheduleAction: handleScheduleAction2, buildScheduleToolContext: buildScheduleToolContext2 } = await import("./schedule-tool-526VUPMF.mjs");
|
|
40732
|
+
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-Z5VWUB76.mjs");
|
|
40727
40733
|
const parentCtx = opts.sessionInfo?._parentContext;
|
|
40728
40734
|
const webhookData = parentCtx?.prInfo?.eventContext?.webhookData;
|
|
40729
40735
|
const visorCfg = parentCtx?.config;
|
|
@@ -43771,4 +43777,4 @@ undici/lib/fetch/body.js:
|
|
|
43771
43777
|
undici/lib/websocket/frame.js:
|
|
43772
43778
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
43773
43779
|
*/
|
|
43774
|
-
//# sourceMappingURL=chunk-
|
|
43780
|
+
//# sourceMappingURL=chunk-FRTHLKIG.mjs.map
|