@probelabs/visor 0.1.190-ee → 0.1.191-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 +6 -0
- package/dist/frontends/slack-frontend.d.ts.map +1 -1
- package/dist/index.js +55 -4
- package/dist/sdk/{check-provider-registry-XFGTGJJY.mjs → check-provider-registry-RWON6HOP.mjs} +2 -2
- package/dist/sdk/{chunk-XMWHW56S.mjs → chunk-QZKRJKD5.mjs} +8 -8
- package/dist/sdk/{host-44KY33ZE.mjs → host-C3FMSKBX.mjs} +2 -2
- package/dist/sdk/{schedule-tool-XOHN4Q2K.mjs → schedule-tool-3XCZR3NC.mjs} +2 -2
- package/dist/sdk/{schedule-tool-handler-4C4NDPYH.mjs → schedule-tool-handler-4ECAAHEH.mjs} +2 -2
- package/dist/sdk/sdk.js +48 -1
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +1 -1
- package/dist/sdk/{slack-frontend-JMX5MUVZ.mjs → slack-frontend-B4VLRGET.mjs} +49 -2
- package/dist/sdk/slack-frontend-B4VLRGET.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-UGCO7RYH.mjs → workflow-check-provider-DNPDEVSQ.mjs} +2 -2
- package/package.json +1 -1
- package/dist/sdk/slack-frontend-JMX5MUVZ.mjs.map +0 -1
- /package/dist/sdk/{check-provider-registry-XFGTGJJY.mjs.map → check-provider-registry-RWON6HOP.mjs.map} +0 -0
- /package/dist/sdk/{chunk-XMWHW56S.mjs.map → chunk-QZKRJKD5.mjs.map} +0 -0
- /package/dist/sdk/{host-44KY33ZE.mjs.map → host-C3FMSKBX.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-XOHN4Q2K.mjs.map → schedule-tool-3XCZR3NC.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-4C4NDPYH.mjs.map → schedule-tool-handler-4ECAAHEH.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-UGCO7RYH.mjs.map → workflow-check-provider-DNPDEVSQ.mjs.map} +0 -0
|
@@ -65,6 +65,12 @@ export declare class SlackFrontend implements Frontend {
|
|
|
65
65
|
* (e.g., AI answers and explicit chat/notify steps).
|
|
66
66
|
*/
|
|
67
67
|
private maybePostDirectReply;
|
|
68
|
+
/**
|
|
69
|
+
* Upload file sections from _rawOutput as Slack file attachments.
|
|
70
|
+
* Called in live-updates mode where the text message is handled by
|
|
71
|
+
* TaskLiveUpdateManager but file uploads still need the Slack API.
|
|
72
|
+
*/
|
|
73
|
+
private uploadRawOutputFiles;
|
|
68
74
|
private getTraceInfo;
|
|
69
75
|
private getExecutionReferenceSuffix;
|
|
70
76
|
}
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAkBxD,KAAK,mBAAmB,GAAG;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,qBAAa,aAAc,YAAW,QAAQ;IAC5C,SAAgB,IAAI,WAAW;IAC/B,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,GAAG,CAAsB;IAEjC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,MAAM,CAAgD;IAC9D,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,eAAe,CAAoD;gBAE/D,MAAM,CAAC,EAAE,mBAAmB;IAIxC,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAyKjC,IAAI,IAAI,IAAI;IAKZ,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,qBAAqB;YASf,cAAc;IAW5B;;;OAGG;YACW,cAAc;YAUd,gBAAgB;IA0D9B,OAAO,CAAC,uBAAuB;YAcjB,yBAAyB;YAkCzB,qBAAqB;YAsCrB,iBAAiB;IA6B/B;;;;OAIG;YACW,oBAAoB;
|
|
1
|
+
{"version":3,"file":"slack-frontend.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/frontends/slack-frontend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAkBxD,KAAK,mBAAmB,GAAG;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,qBAAa,aAAc,YAAW,QAAQ;IAC5C,SAAgB,IAAI,WAAW;IAC/B,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,GAAG,CAAsB;IAEjC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,MAAM,CAAgD;IAC9D,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,eAAe,CAAoD;gBAE/D,MAAM,CAAC,EAAE,mBAAmB;IAIxC,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAyKjC,IAAI,IAAI,IAAI;IAKZ,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,qBAAqB;YASf,cAAc;IAW5B;;;OAGG;YACW,cAAc;YAUd,gBAAgB;IA0D9B,OAAO,CAAC,uBAAuB;YAcjB,yBAAyB;YAkCzB,qBAAqB;YAsCrB,iBAAiB;IA6B/B;;;;OAIG;YACW,oBAAoB;IA6QlC;;;;OAIG;YACW,oBAAoB;IA+ClC,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,2BAA2B;CAWpC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
process.env.VISOR_VERSION = '0.1.
|
|
2
|
+
process.env.VISOR_VERSION = '0.1.191';
|
|
3
3
|
process.env.PROBE_VERSION = '0.6.0-rc334';
|
|
4
|
-
process.env.VISOR_COMMIT_SHA = '
|
|
5
|
-
process.env.VISOR_COMMIT_SHORT = '
|
|
4
|
+
process.env.VISOR_COMMIT_SHA = '057ce9e9d3df6d10fda9c295d7c9cfd9b94065ca';
|
|
5
|
+
process.env.VISOR_COMMIT_SHORT = '057ce9e';
|
|
6
6
|
/******/ (() => { // webpackBootstrap
|
|
7
7
|
/******/ var __webpack_modules__ = ({
|
|
8
8
|
|
|
@@ -315762,8 +315762,16 @@ class SlackFrontend {
|
|
|
315762
315762
|
*/
|
|
315763
315763
|
async maybePostDirectReply(ctx, checkId, result) {
|
|
315764
315764
|
try {
|
|
315765
|
-
|
|
315765
|
+
// In live-updates mode, the text message is handled by TaskLiveUpdateManager.
|
|
315766
|
+
// But if the result carries _rawOutput (from DSL execute_plan output()),
|
|
315767
|
+
// we still need to upload file attachments — live updates can't do that.
|
|
315768
|
+
if (this.isLiveTaskUpdatesMode(ctx)) {
|
|
315769
|
+
const out = result?.output;
|
|
315770
|
+
if (out && typeof out._rawOutput === 'string' && out._rawOutput.trim().length > 0) {
|
|
315771
|
+
await this.uploadRawOutputFiles(ctx, checkId, out._rawOutput);
|
|
315772
|
+
}
|
|
315766
315773
|
return;
|
|
315774
|
+
}
|
|
315767
315775
|
const cfg = ctx.config || {};
|
|
315768
315776
|
const checkCfg = cfg.checks?.[checkId];
|
|
315769
315777
|
if (!checkCfg)
|
|
@@ -315973,6 +315981,49 @@ class SlackFrontend {
|
|
|
315973
315981
|
catch { }
|
|
315974
315982
|
}
|
|
315975
315983
|
}
|
|
315984
|
+
/**
|
|
315985
|
+
* Upload file sections from _rawOutput as Slack file attachments.
|
|
315986
|
+
* Called in live-updates mode where the text message is handled by
|
|
315987
|
+
* TaskLiveUpdateManager but file uploads still need the Slack API.
|
|
315988
|
+
*/
|
|
315989
|
+
async uploadRawOutputFiles(ctx, checkId, rawOutput) {
|
|
315990
|
+
const slack = this.getSlack(ctx);
|
|
315991
|
+
if (!slack)
|
|
315992
|
+
return;
|
|
315993
|
+
const payload = this.getInboundSlackPayload(ctx);
|
|
315994
|
+
const ev = payload?.event;
|
|
315995
|
+
const channel = String(ev?.channel || '');
|
|
315996
|
+
const threadTs = String(ev?.thread_ts || ev?.ts || ev?.event_ts || '');
|
|
315997
|
+
if (!channel || !threadTs)
|
|
315998
|
+
return;
|
|
315999
|
+
// Normalize literal \n escape sequences from DSL output
|
|
316000
|
+
const normalized = rawOutput.replace(/\\n/g, '\n');
|
|
316001
|
+
const fileSections = (0, markdown_1.extractFileSections)(normalized);
|
|
316002
|
+
if (fileSections.length === 0)
|
|
316003
|
+
return;
|
|
316004
|
+
ctx.logger.info(`[slack-frontend] uploading ${fileSections.length} file(s) from _rawOutput for ${checkId} (live-updates mode)`);
|
|
316005
|
+
for (const section of fileSections) {
|
|
316006
|
+
try {
|
|
316007
|
+
const buffer = Buffer.from(section.content, 'utf-8');
|
|
316008
|
+
const uploadResult = await slack.files.uploadV2({
|
|
316009
|
+
content: buffer,
|
|
316010
|
+
filename: section.filename,
|
|
316011
|
+
channel,
|
|
316012
|
+
thread_ts: threadTs,
|
|
316013
|
+
title: section.filename,
|
|
316014
|
+
});
|
|
316015
|
+
if (uploadResult.ok) {
|
|
316016
|
+
ctx.logger.info(`[slack-frontend] uploaded file ${section.filename} to ${channel}`);
|
|
316017
|
+
}
|
|
316018
|
+
else {
|
|
316019
|
+
ctx.logger.warn(`[slack-frontend] upload failed for file ${section.filename}`);
|
|
316020
|
+
}
|
|
316021
|
+
}
|
|
316022
|
+
catch (e) {
|
|
316023
|
+
ctx.logger.warn(`[slack-frontend] failed to upload file ${section.filename}: ${e instanceof Error ? e.message : String(e)}`);
|
|
316024
|
+
}
|
|
316025
|
+
}
|
|
316026
|
+
}
|
|
315976
316027
|
getTraceInfo() {
|
|
315977
316028
|
try {
|
|
315978
316029
|
const span = lazy_otel_1.trace.getSpan(lazy_otel_1.context.active());
|
package/dist/sdk/{check-provider-registry-XFGTGJJY.mjs → check-provider-registry-RWON6HOP.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CheckProviderRegistry,
|
|
3
3
|
init_check_provider_registry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QZKRJKD5.mjs";
|
|
5
5
|
import "./chunk-YSOIR46P.mjs";
|
|
6
6
|
import "./chunk-QT766ZLD.mjs";
|
|
7
7
|
import "./chunk-2LLKENYD.mjs";
|
|
@@ -32,4 +32,4 @@ init_check_provider_registry();
|
|
|
32
32
|
export {
|
|
33
33
|
CheckProviderRegistry
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=check-provider-registry-
|
|
35
|
+
//# sourceMappingURL=check-provider-registry-RWON6HOP.mjs.map
|
|
@@ -4577,7 +4577,7 @@ async function executeWorkflowAsTool(workflowId, args, context2, argsOverrides)
|
|
|
4577
4577
|
...args,
|
|
4578
4578
|
...argsOverrides
|
|
4579
4579
|
};
|
|
4580
|
-
const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-
|
|
4580
|
+
const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-DNPDEVSQ.mjs");
|
|
4581
4581
|
const provider = new WorkflowCheckProvider2();
|
|
4582
4582
|
const checkConfig = {
|
|
4583
4583
|
type: "workflow",
|
|
@@ -14893,7 +14893,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
14893
14893
|
try {
|
|
14894
14894
|
const map = options?.webhookContext?.webhookData;
|
|
14895
14895
|
if (map) {
|
|
14896
|
-
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-
|
|
14896
|
+
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-RWON6HOP.mjs");
|
|
14897
14897
|
const reg = CheckProviderRegistry2.getInstance();
|
|
14898
14898
|
const p = reg.getProvider("http_input");
|
|
14899
14899
|
if (p && typeof p.setWebhookContext === "function") p.setWebhookContext(map);
|
|
@@ -15016,7 +15016,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
15016
15016
|
tag_filter: tagFilter
|
|
15017
15017
|
} : config;
|
|
15018
15018
|
try {
|
|
15019
|
-
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-
|
|
15019
|
+
const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-RWON6HOP.mjs");
|
|
15020
15020
|
const registry = CheckProviderRegistry2.getInstance();
|
|
15021
15021
|
registry.setCustomTools(configWithTagFilter.tools || {});
|
|
15022
15022
|
} catch (error) {
|
|
@@ -15080,7 +15080,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
15080
15080
|
try {
|
|
15081
15081
|
const webhookData = this.executionContext?.webhookContext?.webhookData;
|
|
15082
15082
|
if (webhookData instanceof Map) {
|
|
15083
|
-
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-
|
|
15083
|
+
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-4ECAAHEH.mjs");
|
|
15084
15084
|
const slackCtx = extractSlackContext2(webhookData);
|
|
15085
15085
|
if (slackCtx) {
|
|
15086
15086
|
const payload = Array.from(webhookData.values())[0];
|
|
@@ -15109,7 +15109,7 @@ var init_state_machine_execution_engine = __esm({
|
|
|
15109
15109
|
if (Array.isArray(configWithTagFilter.frontends) && configWithTagFilter.frontends.length > 0) {
|
|
15110
15110
|
try {
|
|
15111
15111
|
const { EventBus } = await import("./event-bus-5K3Y2FCS.mjs");
|
|
15112
|
-
const { FrontendsHost } = await import("./host-
|
|
15112
|
+
const { FrontendsHost } = await import("./host-C3FMSKBX.mjs");
|
|
15113
15113
|
const bus = new EventBus();
|
|
15114
15114
|
context2.eventBus = bus;
|
|
15115
15115
|
frontendsHost = new FrontendsHost(bus, logger);
|
|
@@ -43543,8 +43543,8 @@ function buildBuiltinGlobals(opts) {
|
|
|
43543
43543
|
const asyncFunctionNames = /* @__PURE__ */ new Set();
|
|
43544
43544
|
const scheduleFn = async (args = {}) => {
|
|
43545
43545
|
try {
|
|
43546
|
-
const { handleScheduleAction: handleScheduleAction2, buildScheduleToolContext: buildScheduleToolContext2 } = await import("./schedule-tool-
|
|
43547
|
-
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-
|
|
43546
|
+
const { handleScheduleAction: handleScheduleAction2, buildScheduleToolContext: buildScheduleToolContext2 } = await import("./schedule-tool-3XCZR3NC.mjs");
|
|
43547
|
+
const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-4ECAAHEH.mjs");
|
|
43548
43548
|
const parentCtx = opts.sessionInfo?._parentContext;
|
|
43549
43549
|
const webhookData = parentCtx?.prInfo?.eventContext?.webhookData;
|
|
43550
43550
|
const webhookEventType = parentCtx?.webhookContext?.eventType || parentCtx?.prInfo?.eventContext?.eventType;
|
|
@@ -47380,4 +47380,4 @@ undici/lib/fetch/body.js:
|
|
|
47380
47380
|
undici/lib/websocket/frame.js:
|
|
47381
47381
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
47382
47382
|
*/
|
|
47383
|
-
//# sourceMappingURL=chunk-
|
|
47383
|
+
//# sourceMappingURL=chunk-QZKRJKD5.mjs.map
|
|
@@ -27,7 +27,7 @@ var init_host = __esm({
|
|
|
27
27
|
const { GitHubFrontend } = await import("./github-frontend-TRETPEWZ.mjs");
|
|
28
28
|
this.frontends.push(new GitHubFrontend());
|
|
29
29
|
} else if (spec.name === "slack") {
|
|
30
|
-
const { SlackFrontend } = await import("./slack-frontend-
|
|
30
|
+
const { SlackFrontend } = await import("./slack-frontend-B4VLRGET.mjs");
|
|
31
31
|
this.frontends.push(new SlackFrontend(spec.config));
|
|
32
32
|
} else if (spec.name === "tui") {
|
|
33
33
|
const { TuiFrontend } = await import("./tui-frontend-T56PZB67.mjs");
|
|
@@ -84,4 +84,4 @@ export {
|
|
|
84
84
|
FrontendsHost,
|
|
85
85
|
isActiveFrontend
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=host-
|
|
87
|
+
//# sourceMappingURL=host-C3FMSKBX.mjs.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
handleScheduleAction,
|
|
5
5
|
init_schedule_tool,
|
|
6
6
|
isScheduleTool
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QZKRJKD5.mjs";
|
|
8
8
|
import "./chunk-YSOIR46P.mjs";
|
|
9
9
|
import "./chunk-QT766ZLD.mjs";
|
|
10
10
|
import "./chunk-2LLKENYD.mjs";
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
handleScheduleAction,
|
|
39
39
|
isScheduleTool
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=schedule-tool-
|
|
41
|
+
//# sourceMappingURL=schedule-tool-3XCZR3NC.mjs.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
extractSlackContext,
|
|
7
7
|
init_schedule_tool_handler,
|
|
8
8
|
isScheduleToolCall
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QZKRJKD5.mjs";
|
|
10
10
|
import "./chunk-YSOIR46P.mjs";
|
|
11
11
|
import "./chunk-QT766ZLD.mjs";
|
|
12
12
|
import "./chunk-2LLKENYD.mjs";
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
extractSlackContext,
|
|
43
43
|
isScheduleToolCall
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=schedule-tool-handler-
|
|
45
|
+
//# sourceMappingURL=schedule-tool-handler-4ECAAHEH.mjs.map
|
package/dist/sdk/sdk.js
CHANGED
|
@@ -69013,7 +69013,13 @@ ${suffix}`;
|
|
|
69013
69013
|
*/
|
|
69014
69014
|
async maybePostDirectReply(ctx, checkId, result) {
|
|
69015
69015
|
try {
|
|
69016
|
-
if (this.isLiveTaskUpdatesMode(ctx))
|
|
69016
|
+
if (this.isLiveTaskUpdatesMode(ctx)) {
|
|
69017
|
+
const out2 = result?.output;
|
|
69018
|
+
if (out2 && typeof out2._rawOutput === "string" && out2._rawOutput.trim().length > 0) {
|
|
69019
|
+
await this.uploadRawOutputFiles(ctx, checkId, out2._rawOutput);
|
|
69020
|
+
}
|
|
69021
|
+
return;
|
|
69022
|
+
}
|
|
69017
69023
|
const cfg = ctx.config || {};
|
|
69018
69024
|
const checkCfg = cfg.checks?.[checkId];
|
|
69019
69025
|
if (!checkCfg) return;
|
|
@@ -69211,6 +69217,47 @@ ${suffix}`;
|
|
|
69211
69217
|
}
|
|
69212
69218
|
}
|
|
69213
69219
|
}
|
|
69220
|
+
/**
|
|
69221
|
+
* Upload file sections from _rawOutput as Slack file attachments.
|
|
69222
|
+
* Called in live-updates mode where the text message is handled by
|
|
69223
|
+
* TaskLiveUpdateManager but file uploads still need the Slack API.
|
|
69224
|
+
*/
|
|
69225
|
+
async uploadRawOutputFiles(ctx, checkId, rawOutput) {
|
|
69226
|
+
const slack = this.getSlack(ctx);
|
|
69227
|
+
if (!slack) return;
|
|
69228
|
+
const payload = this.getInboundSlackPayload(ctx);
|
|
69229
|
+
const ev = payload?.event;
|
|
69230
|
+
const channel = String(ev?.channel || "");
|
|
69231
|
+
const threadTs = String(ev?.thread_ts || ev?.ts || ev?.event_ts || "");
|
|
69232
|
+
if (!channel || !threadTs) return;
|
|
69233
|
+
const normalized = rawOutput.replace(/\\n/g, "\n");
|
|
69234
|
+
const fileSections = extractFileSections(normalized);
|
|
69235
|
+
if (fileSections.length === 0) return;
|
|
69236
|
+
ctx.logger.info(
|
|
69237
|
+
`[slack-frontend] uploading ${fileSections.length} file(s) from _rawOutput for ${checkId} (live-updates mode)`
|
|
69238
|
+
);
|
|
69239
|
+
for (const section of fileSections) {
|
|
69240
|
+
try {
|
|
69241
|
+
const buffer = Buffer.from(section.content, "utf-8");
|
|
69242
|
+
const uploadResult = await slack.files.uploadV2({
|
|
69243
|
+
content: buffer,
|
|
69244
|
+
filename: section.filename,
|
|
69245
|
+
channel,
|
|
69246
|
+
thread_ts: threadTs,
|
|
69247
|
+
title: section.filename
|
|
69248
|
+
});
|
|
69249
|
+
if (uploadResult.ok) {
|
|
69250
|
+
ctx.logger.info(`[slack-frontend] uploaded file ${section.filename} to ${channel}`);
|
|
69251
|
+
} else {
|
|
69252
|
+
ctx.logger.warn(`[slack-frontend] upload failed for file ${section.filename}`);
|
|
69253
|
+
}
|
|
69254
|
+
} catch (e) {
|
|
69255
|
+
ctx.logger.warn(
|
|
69256
|
+
`[slack-frontend] failed to upload file ${section.filename}: ${e instanceof Error ? e.message : String(e)}`
|
|
69257
|
+
);
|
|
69258
|
+
}
|
|
69259
|
+
}
|
|
69260
|
+
}
|
|
69214
69261
|
getTraceInfo() {
|
|
69215
69262
|
try {
|
|
69216
69263
|
const span = trace.getSpan(context.active());
|