@probelabs/visor 0.1.183-ee → 0.1.184-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/agent-protocol/task-live-update-slack.d.ts +24 -0
- package/dist/agent-protocol/task-live-update-slack.d.ts.map +1 -0
- package/dist/agent-protocol/task-live-update-teams.d.ts +25 -0
- package/dist/agent-protocol/task-live-update-teams.d.ts.map +1 -0
- package/dist/agent-protocol/task-live-update-telegram.d.ts +25 -0
- package/dist/agent-protocol/task-live-update-telegram.d.ts.map +1 -0
- package/dist/agent-protocol/task-live-updates.d.ts +102 -0
- package/dist/agent-protocol/task-live-updates.d.ts.map +1 -0
- package/dist/agent-protocol/task-progress-tool.d.ts.map +1 -1
- package/dist/agent-protocol/task-trace-resolution.d.ts +11 -0
- package/dist/agent-protocol/task-trace-resolution.d.ts.map +1 -0
- package/dist/agent-protocol/trace-serializer.d.ts.map +1 -1
- package/dist/agent-protocol/track-execution.d.ts +8 -0
- package/dist/agent-protocol/track-execution.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/frontends/slack-frontend.d.ts +2 -0
- package/dist/frontends/slack-frontend.d.ts.map +1 -1
- package/dist/frontends/teams-frontend.d.ts.map +1 -1
- package/dist/frontends/telegram-frontend.d.ts.map +1 -1
- package/dist/generated/config-schema.d.ts +110 -6
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/index.js +2239 -261
- package/dist/logger.d.ts +4 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/mcp-job-manager.d.ts +70 -0
- package/dist/mcp-job-manager.d.ts.map +1 -0
- package/dist/mcp-server.d.ts +6 -0
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/runners/mcp-server-runner.d.ts +4 -0
- package/dist/runners/mcp-server-runner.d.ts.map +1 -1
- package/dist/runners/runner-factory.d.ts.map +1 -1
- package/dist/sdk/{a2a-frontend-5YDHFQXD.mjs → a2a-frontend-OI4OVSKC.mjs} +4 -4
- package/dist/sdk/check-provider-registry-RITJW67U.mjs +32 -0
- package/dist/sdk/check-provider-registry-ZZ6N4GDP.mjs +32 -0
- package/dist/sdk/{chunk-4BN2XI4X.mjs → chunk-4HIWZA6M.mjs} +2 -2
- package/dist/sdk/{chunk-RI4ONH5X.mjs → chunk-4MHHELVZ.mjs} +2 -2
- package/dist/sdk/{chunk-J27D43HS.mjs → chunk-4ZLYHSN4.mjs} +2 -2
- package/dist/sdk/{chunk-ZPYODGYA.mjs → chunk-6E625R3C.mjs} +19 -4
- package/dist/sdk/chunk-6E625R3C.mjs.map +1 -0
- package/dist/sdk/{chunk-GA2TYKSR.mjs → chunk-7XKHFRPN.mjs} +4 -4
- package/dist/sdk/{chunk-6C3R6E42.mjs → chunk-IY5PQ5EN.mjs} +30 -6
- package/dist/sdk/chunk-IY5PQ5EN.mjs.map +1 -0
- package/dist/sdk/{chunk-MFXPJUUE.mjs → chunk-PUHU6UY6.mjs} +4 -3
- package/dist/sdk/chunk-PUHU6UY6.mjs.map +1 -0
- package/dist/sdk/{chunk-XOAEKFKB.mjs → chunk-QLT42TX7.mjs} +2 -2
- package/dist/sdk/chunk-SRU5TFNY.mjs +620 -0
- package/dist/sdk/chunk-SRU5TFNY.mjs.map +1 -0
- package/dist/sdk/{chunk-P2K4VOMU.mjs → chunk-TSX3YS3F.mjs} +3 -3
- package/dist/sdk/{chunk-WKLJ57WF.mjs → chunk-UM7LGO2P.mjs} +6 -6
- package/dist/sdk/{chunk-7VTZDC2X.mjs → chunk-VPPBOKBQ.mjs} +2 -2
- package/dist/sdk/chunk-WZQMTD7W.mjs +33 -0
- package/dist/sdk/chunk-WZQMTD7W.mjs.map +1 -0
- package/dist/sdk/{chunk-ZOF5QT6U.mjs → chunk-YBXNG75V.mjs} +118 -10
- package/dist/sdk/chunk-YBXNG75V.mjs.map +1 -0
- package/dist/sdk/{chunk-UXB4XWEE.mjs → chunk-YYFSAAD6.mjs} +53 -51
- package/dist/sdk/chunk-YYFSAAD6.mjs.map +1 -0
- package/dist/sdk/{chunk-RHKPFJLG.mjs → chunk-ZNKL6ESZ.mjs} +2 -2
- package/dist/sdk/{chunk-IDL3AA3G.mjs → chunk-ZYDRR6PZ.mjs} +1150 -403
- package/dist/sdk/chunk-ZYDRR6PZ.mjs.map +1 -0
- package/dist/sdk/{command-executor-YNJOS77A.mjs → command-executor-LHUW77GR.mjs} +3 -3
- package/dist/sdk/{config-PCP6O6Y6.mjs → config-TVU5RWR5.mjs} +3 -3
- package/dist/sdk/{dist-3UGGEZB3.mjs → dist-PN5UHL6A.mjs} +429 -429
- package/dist/sdk/dist-PN5UHL6A.mjs.map +1 -0
- package/dist/sdk/{email-frontend-WSNADJPI.mjs → email-frontend-ECHQCFTR.mjs} +2 -2
- package/dist/sdk/{failure-condition-evaluator-IRFKTYZD.mjs → failure-condition-evaluator-USY3ISVA.mjs} +6 -6
- package/dist/sdk/{github-auth-BJQBLK2V.mjs → github-auth-UO4DMNCC.mjs} +2 -2
- package/dist/sdk/{github-frontend-DECYOBRN.mjs → github-frontend-2T5PWYD5.mjs} +6 -6
- package/dist/sdk/{host-CFM2ASDI.mjs → host-OJSMCLKK.mjs} +6 -6
- package/dist/sdk/{host-T4LNVU2H.mjs → host-RM6UJEPP.mjs} +7 -7
- package/dist/sdk/{knex-store-OEWSZEBY.mjs → knex-store-KCMFAMH5.mjs} +2 -2
- package/dist/sdk/{liquid-extensions-E3AKRX7P.mjs → liquid-extensions-KZIRR4OY.mjs} +4 -4
- package/dist/sdk/{loader-WRGI244P.mjs → loader-35YWX5UQ.mjs} +4 -4
- package/dist/sdk/{memory-store-OHUIXCWJ.mjs → memory-store-3JONK7AF.mjs} +3 -3
- package/dist/sdk/{opa-policy-engine-IVMCGVNA.mjs → opa-policy-engine-FY5D45YS.mjs} +2 -2
- package/dist/sdk/{prompt-state-LN57DQF3.mjs → prompt-state-VVJMONT3.mjs} +3 -3
- package/dist/sdk/{renderer-schema-BT2IXMLW.mjs → renderer-schema-JZRRU5CW.mjs} +2 -2
- package/dist/sdk/{routing-H2PQ57OA.mjs → routing-NNQQSLWA.mjs} +8 -8
- package/dist/sdk/{schedule-tool-2DPNSU63.mjs → schedule-tool-ADZ2ON4I.mjs} +15 -14
- package/dist/sdk/schedule-tool-EMNF3FPQ.mjs +38 -0
- package/dist/sdk/{schedule-tool-handler-NBEO46RV.mjs → schedule-tool-handler-3R3IC6VA.mjs} +15 -14
- package/dist/sdk/{schedule-tool-handler-KLHE2SOW.mjs → schedule-tool-handler-F76ZD2WU.mjs} +17 -16
- package/dist/sdk/sdk.d.mts +40 -0
- package/dist/sdk/sdk.d.ts +40 -0
- package/dist/sdk/sdk.js +1154 -176
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +14 -13
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk/{slack-frontend-DF5VL4OF.mjs → slack-frontend-K3TPGERM.mjs} +65 -9
- package/dist/sdk/slack-frontend-K3TPGERM.mjs.map +1 -0
- package/dist/sdk/{task-evaluator-OVMG7S56.mjs → task-evaluator-H3BXC7SE.mjs} +3 -3
- package/dist/sdk/{teams-frontend-DNW5GZP3.mjs → teams-frontend-6RRW533K.mjs} +54 -1
- package/dist/sdk/teams-frontend-6RRW533K.mjs.map +1 -0
- package/dist/sdk/{telegram-frontend-GA7OLADB.mjs → telegram-frontend-5UA77YAT.mjs} +48 -1
- package/dist/sdk/telegram-frontend-5UA77YAT.mjs.map +1 -0
- package/dist/sdk/{trace-helpers-26ZCAE2V.mjs → trace-helpers-OMF4C24T.mjs} +3 -3
- package/dist/sdk/{trace-serializer-KKBJHM7J.mjs → trace-serializer-EBHTHZYT.mjs} +3 -3
- package/dist/sdk/track-execution-3CHMGEPH.mjs +249 -0
- package/dist/sdk/track-execution-3CHMGEPH.mjs.map +1 -0
- package/dist/sdk/{utcp-check-provider-WI3QZ3W6.mjs → utcp-check-provider-Q4PD5EP2.mjs} +5 -5
- package/dist/sdk/workflow-check-provider-TC2G33WF.mjs +32 -0
- package/dist/sdk/workflow-check-provider-U4UXZ5YS.mjs +32 -0
- package/dist/sdk/{workflow-registry-YCZ3FCJC.mjs → workflow-registry-K56UTX36.mjs} +3 -3
- package/dist/slack/client.d.ts +14 -0
- package/dist/slack/client.d.ts.map +1 -1
- package/dist/slack/socket-runner.d.ts.map +1 -1
- package/dist/teams/client.d.ts +16 -0
- package/dist/teams/client.d.ts.map +1 -1
- package/dist/teams/webhook-runner.d.ts.map +1 -1
- package/dist/telegram/client.d.ts +17 -0
- package/dist/telegram/client.d.ts.map +1 -1
- package/dist/telegram/polling-runner.d.ts.map +1 -1
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +40 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/generated/config-schema.json +0 -4027
- package/dist/sdk/a2a-frontend-6LWBIPMS.mjs +0 -1734
- package/dist/sdk/a2a-frontend-6LWBIPMS.mjs.map +0 -1
- package/dist/sdk/check-provider-registry-WSEVHJEV.mjs +0 -31
- package/dist/sdk/check-provider-registry-YRADEEQY.mjs +0 -31
- package/dist/sdk/chunk-34QX63WK.mjs +0 -244
- package/dist/sdk/chunk-34QX63WK.mjs.map +0 -1
- package/dist/sdk/chunk-54KOAC4W.mjs +0 -665
- package/dist/sdk/chunk-6C3R6E42.mjs.map +0 -1
- package/dist/sdk/chunk-7W5QCO4Y.mjs +0 -5943
- package/dist/sdk/chunk-7W5QCO4Y.mjs.map +0 -1
- package/dist/sdk/chunk-7XRSCOKE.mjs +0 -825
- package/dist/sdk/chunk-FT3I25QV.mjs +0 -251
- package/dist/sdk/chunk-FT3I25QV.mjs.map +0 -1
- package/dist/sdk/chunk-G7GSN3SK.mjs +0 -390
- package/dist/sdk/chunk-G7GSN3SK.mjs.map +0 -1
- package/dist/sdk/chunk-IDL3AA3G.mjs.map +0 -1
- package/dist/sdk/chunk-J27D43HS.mjs.map +0 -1
- package/dist/sdk/chunk-MEB2TTIE.mjs +0 -157
- package/dist/sdk/chunk-MEB2TTIE.mjs.map +0 -1
- package/dist/sdk/chunk-MFXPJUUE.mjs.map +0 -1
- package/dist/sdk/chunk-NPSLGKXB.mjs +0 -1502
- package/dist/sdk/chunk-P2K4VOMU.mjs.map +0 -1
- package/dist/sdk/chunk-PQWZ6NFL.mjs +0 -459
- package/dist/sdk/chunk-PQWZ6NFL.mjs.map +0 -1
- package/dist/sdk/chunk-S5FSRHMY.mjs +0 -139
- package/dist/sdk/chunk-S5FSRHMY.mjs.map +0 -1
- package/dist/sdk/chunk-TFUQ2D5L.mjs +0 -307
- package/dist/sdk/chunk-TFUQ2D5L.mjs.map +0 -1
- package/dist/sdk/chunk-UCMJJ3IM.mjs +0 -227
- package/dist/sdk/chunk-UCMJJ3IM.mjs.map +0 -1
- package/dist/sdk/chunk-UFHOIB3R.mjs +0 -482
- package/dist/sdk/chunk-UFHOIB3R.mjs.map +0 -1
- package/dist/sdk/chunk-UXB4XWEE.mjs.map +0 -1
- package/dist/sdk/chunk-V45TITKX.mjs +0 -739
- package/dist/sdk/chunk-V45TITKX.mjs.map +0 -1
- package/dist/sdk/chunk-WKLJ57WF.mjs.map +0 -1
- package/dist/sdk/chunk-ZOF5QT6U.mjs.map +0 -1
- package/dist/sdk/chunk-ZPYODGYA.mjs.map +0 -1
- package/dist/sdk/command-executor-3AHGIYQG.mjs +0 -14
- package/dist/sdk/config-JE4HKTWW.mjs +0 -16
- package/dist/sdk/dist-3UGGEZB3.mjs.map +0 -1
- package/dist/sdk/failure-condition-evaluator-H3PBFBYT.mjs +0 -18
- package/dist/sdk/github-auth-27SZGPEC.mjs +0 -196
- package/dist/sdk/github-auth-BJQBLK2V.mjs.map +0 -1
- package/dist/sdk/github-frontend-TZRBOQCN.mjs +0 -1394
- package/dist/sdk/github-frontend-TZRBOQCN.mjs.map +0 -1
- package/dist/sdk/lazy-otel-5NH4ZJJM.mjs +0 -24
- package/dist/sdk/liquid-extensions-P6KDYILF.mjs +0 -25
- package/dist/sdk/memory-store-K5N7MC7U.mjs +0 -12
- package/dist/sdk/metrics-JTOG2HNO.mjs +0 -41
- package/dist/sdk/prompt-state-YPICX7PI.mjs +0 -16
- package/dist/sdk/renderer-schema-KOIH75RZ.mjs +0 -51
- package/dist/sdk/renderer-schema-KOIH75RZ.mjs.map +0 -1
- package/dist/sdk/routing-JMZ7HDCC.mjs +0 -26
- package/dist/sdk/schedule-tool-4M45RK3E.mjs +0 -37
- package/dist/sdk/schedule-tool-4M45RK3E.mjs.map +0 -1
- package/dist/sdk/schedule-tool-handler-KLHE2SOW.mjs.map +0 -1
- package/dist/sdk/schedule-tool-handler-NBEO46RV.mjs.map +0 -1
- package/dist/sdk/slack-frontend-BPWXNIHE.mjs +0 -929
- package/dist/sdk/slack-frontend-BPWXNIHE.mjs.map +0 -1
- package/dist/sdk/slack-frontend-DF5VL4OF.mjs.map +0 -1
- package/dist/sdk/task-evaluator-GQYDOSGT.mjs +0 -1392
- package/dist/sdk/task-evaluator-GQYDOSGT.mjs.map +0 -1
- package/dist/sdk/teams-frontend-DNW5GZP3.mjs.map +0 -1
- package/dist/sdk/telegram-frontend-GA7OLADB.mjs.map +0 -1
- package/dist/sdk/trace-helpers-26ZCAE2V.mjs.map +0 -1
- package/dist/sdk/trace-helpers-XV5GAX5L.mjs +0 -29
- package/dist/sdk/trace-helpers-XV5GAX5L.mjs.map +0 -1
- package/dist/sdk/trace-serializer-KKBJHM7J.mjs.map +0 -1
- package/dist/sdk/track-execution-3EC24C2X.mjs +0 -163
- package/dist/sdk/track-execution-3EC24C2X.mjs.map +0 -1
- package/dist/sdk/track-execution-66RLL6QT.mjs +0 -143
- package/dist/sdk/track-execution-66RLL6QT.mjs.map +0 -1
- package/dist/sdk/utcp-check-provider-JLIYF5HH.mjs +0 -16
- package/dist/sdk/utcp-check-provider-JLIYF5HH.mjs.map +0 -1
- package/dist/sdk/utcp-check-provider-WI3QZ3W6.mjs.map +0 -1
- package/dist/sdk/workflow-check-provider-X2UREEH7.mjs +0 -31
- package/dist/sdk/workflow-check-provider-X2UREEH7.mjs.map +0 -1
- package/dist/sdk/workflow-check-provider-YXALZNAQ.mjs +0 -31
- package/dist/sdk/workflow-check-provider-YXALZNAQ.mjs.map +0 -1
- package/dist/sdk/workflow-registry-X2IPY35M.mjs +0 -12
- package/dist/sdk/workflow-registry-X2IPY35M.mjs.map +0 -1
- package/dist/sdk/workflow-registry-YCZ3FCJC.mjs.map +0 -1
- /package/dist/sdk/{a2a-frontend-5YDHFQXD.mjs.map → a2a-frontend-OI4OVSKC.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-WSEVHJEV.mjs.map → check-provider-registry-RITJW67U.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-YRADEEQY.mjs.map → check-provider-registry-ZZ6N4GDP.mjs.map} +0 -0
- /package/dist/sdk/{chunk-4BN2XI4X.mjs.map → chunk-4HIWZA6M.mjs.map} +0 -0
- /package/dist/sdk/{chunk-RI4ONH5X.mjs.map → chunk-4MHHELVZ.mjs.map} +0 -0
- /package/dist/sdk/{chunk-54KOAC4W.mjs.map → chunk-4ZLYHSN4.mjs.map} +0 -0
- /package/dist/sdk/{chunk-GA2TYKSR.mjs.map → chunk-7XKHFRPN.mjs.map} +0 -0
- /package/dist/sdk/{chunk-XOAEKFKB.mjs.map → chunk-QLT42TX7.mjs.map} +0 -0
- /package/dist/sdk/{chunk-7XRSCOKE.mjs.map → chunk-TSX3YS3F.mjs.map} +0 -0
- /package/dist/sdk/{chunk-NPSLGKXB.mjs.map → chunk-UM7LGO2P.mjs.map} +0 -0
- /package/dist/sdk/{chunk-7VTZDC2X.mjs.map → chunk-VPPBOKBQ.mjs.map} +0 -0
- /package/dist/sdk/{chunk-RHKPFJLG.mjs.map → chunk-ZNKL6ESZ.mjs.map} +0 -0
- /package/dist/sdk/{command-executor-3AHGIYQG.mjs.map → command-executor-LHUW77GR.mjs.map} +0 -0
- /package/dist/sdk/{command-executor-YNJOS77A.mjs.map → config-TVU5RWR5.mjs.map} +0 -0
- /package/dist/sdk/{email-frontend-WSNADJPI.mjs.map → email-frontend-ECHQCFTR.mjs.map} +0 -0
- /package/dist/sdk/{config-JE4HKTWW.mjs.map → failure-condition-evaluator-USY3ISVA.mjs.map} +0 -0
- /package/dist/sdk/{github-auth-27SZGPEC.mjs.map → github-auth-UO4DMNCC.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-DECYOBRN.mjs.map → github-frontend-2T5PWYD5.mjs.map} +0 -0
- /package/dist/sdk/{host-CFM2ASDI.mjs.map → host-OJSMCLKK.mjs.map} +0 -0
- /package/dist/sdk/{host-T4LNVU2H.mjs.map → host-RM6UJEPP.mjs.map} +0 -0
- /package/dist/sdk/{knex-store-OEWSZEBY.mjs.map → knex-store-KCMFAMH5.mjs.map} +0 -0
- /package/dist/sdk/{config-PCP6O6Y6.mjs.map → liquid-extensions-KZIRR4OY.mjs.map} +0 -0
- /package/dist/sdk/{loader-WRGI244P.mjs.map → loader-35YWX5UQ.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-H3PBFBYT.mjs.map → memory-store-3JONK7AF.mjs.map} +0 -0
- /package/dist/sdk/{opa-policy-engine-IVMCGVNA.mjs.map → opa-policy-engine-FY5D45YS.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-IRFKTYZD.mjs.map → prompt-state-VVJMONT3.mjs.map} +0 -0
- /package/dist/sdk/{renderer-schema-BT2IXMLW.mjs.map → renderer-schema-JZRRU5CW.mjs.map} +0 -0
- /package/dist/sdk/{lazy-otel-5NH4ZJJM.mjs.map → routing-NNQQSLWA.mjs.map} +0 -0
- /package/dist/sdk/{liquid-extensions-E3AKRX7P.mjs.map → schedule-tool-ADZ2ON4I.mjs.map} +0 -0
- /package/dist/sdk/{liquid-extensions-P6KDYILF.mjs.map → schedule-tool-EMNF3FPQ.mjs.map} +0 -0
- /package/dist/sdk/{memory-store-K5N7MC7U.mjs.map → schedule-tool-handler-3R3IC6VA.mjs.map} +0 -0
- /package/dist/sdk/{memory-store-OHUIXCWJ.mjs.map → schedule-tool-handler-F76ZD2WU.mjs.map} +0 -0
- /package/dist/sdk/{task-evaluator-OVMG7S56.mjs.map → task-evaluator-H3BXC7SE.mjs.map} +0 -0
- /package/dist/sdk/{metrics-JTOG2HNO.mjs.map → trace-helpers-OMF4C24T.mjs.map} +0 -0
- /package/dist/sdk/{prompt-state-LN57DQF3.mjs.map → trace-serializer-EBHTHZYT.mjs.map} +0 -0
- /package/dist/sdk/{prompt-state-YPICX7PI.mjs.map → utcp-check-provider-Q4PD5EP2.mjs.map} +0 -0
- /package/dist/sdk/{routing-H2PQ57OA.mjs.map → workflow-check-provider-TC2G33WF.mjs.map} +0 -0
- /package/dist/sdk/{routing-JMZ7HDCC.mjs.map → workflow-check-provider-U4UXZ5YS.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-2DPNSU63.mjs.map → workflow-registry-K56UTX36.mjs.map} +0 -0
package/dist/sdk/sdk.js
CHANGED
|
@@ -426,10 +426,11 @@ function configureLoggerFromCli(options) {
|
|
|
426
426
|
} catch {
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
var OTEL_SEVERITY, Logger, logger;
|
|
429
|
+
var import_node_async_hooks, OTEL_SEVERITY, Logger, logger;
|
|
430
430
|
var init_logger = __esm({
|
|
431
431
|
"src/logger.ts"() {
|
|
432
432
|
"use strict";
|
|
433
|
+
import_node_async_hooks = require("async_hooks");
|
|
433
434
|
init_lazy_otel();
|
|
434
435
|
OTEL_SEVERITY = {
|
|
435
436
|
silent: 0,
|
|
@@ -445,6 +446,7 @@ var init_logger = __esm({
|
|
|
445
446
|
// DEBUG
|
|
446
447
|
};
|
|
447
448
|
Logger = class {
|
|
449
|
+
taskContextStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
448
450
|
level = "info";
|
|
449
451
|
isJsonLike = false;
|
|
450
452
|
isTTY = typeof process !== "undefined" ? !!process.stderr.isTTY : false;
|
|
@@ -491,9 +493,20 @@ var init_logger = __esm({
|
|
|
491
493
|
}
|
|
492
494
|
return true;
|
|
493
495
|
}
|
|
494
|
-
|
|
496
|
+
withTaskContext(taskId, fn) {
|
|
497
|
+
const current = this.taskContextStorage.getStore() || {};
|
|
498
|
+
return this.taskContextStorage.run({ ...current, taskId }, fn);
|
|
499
|
+
}
|
|
500
|
+
getCurrentTaskId() {
|
|
501
|
+
return this.taskContextStorage.getStore()?.taskId;
|
|
502
|
+
}
|
|
503
|
+
getContextSuffix(msg) {
|
|
495
504
|
if (!msg) return "";
|
|
496
|
-
if (msg.includes("
|
|
505
|
+
if (msg.includes("task_id=") || msg.includes("task_id:") || msg.includes("trace_id=") || msg.includes("trace_id:")) {
|
|
506
|
+
return "";
|
|
507
|
+
}
|
|
508
|
+
const taskId = this.getCurrentTaskId();
|
|
509
|
+
if (taskId) return ` [task_id=${taskId}]`;
|
|
497
510
|
try {
|
|
498
511
|
const span = trace.getSpan(context.active()) || trace.getActiveSpan();
|
|
499
512
|
const ctx = span?.spanContext?.();
|
|
@@ -518,12 +531,14 @@ var init_logger = __esm({
|
|
|
518
531
|
if (!this.otelLogger) return;
|
|
519
532
|
const span = trace.getSpan(context.active()) || trace.getActiveSpan();
|
|
520
533
|
const spanCtx = span?.spanContext?.();
|
|
534
|
+
const taskId = this.getCurrentTaskId();
|
|
521
535
|
this.otelLogger.emit({
|
|
522
536
|
severityNumber: OTEL_SEVERITY[level] || 9,
|
|
523
537
|
severityText: level.toUpperCase(),
|
|
524
538
|
body: msg,
|
|
525
539
|
attributes: {
|
|
526
540
|
"visor.logger": true,
|
|
541
|
+
...taskId ? { task_id: taskId } : {},
|
|
527
542
|
...spanCtx?.traceId ? { trace_id: spanCtx.traceId, span_id: spanCtx.spanId } : {}
|
|
528
543
|
}
|
|
529
544
|
});
|
|
@@ -531,7 +546,7 @@ var init_logger = __esm({
|
|
|
531
546
|
}
|
|
532
547
|
}
|
|
533
548
|
write(msg, level) {
|
|
534
|
-
const suffix = this.
|
|
549
|
+
const suffix = this.getContextSuffix(msg);
|
|
535
550
|
const decoratedMsg = suffix ? `${msg}${suffix}` : msg;
|
|
536
551
|
const lvl = level || "info";
|
|
537
552
|
this.emitOtelLog(msg, lvl);
|
|
@@ -1547,7 +1562,8 @@ var require_package = __commonJS({
|
|
|
1547
1562
|
scripts: {
|
|
1548
1563
|
"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",
|
|
1549
1564
|
"build:sdk": "tsup src/sdk.ts --dts --sourcemap --format esm,cjs --out-dir dist/sdk",
|
|
1550
|
-
build: "
|
|
1565
|
+
build: "npm run build:oss",
|
|
1566
|
+
"build:oss": "./scripts/build-oss.sh",
|
|
1551
1567
|
"build:ee": "npm run build:cli && npm run build:sdk",
|
|
1552
1568
|
test: "jest && npm run test:yaml",
|
|
1553
1569
|
"test:unit": "jest",
|
|
@@ -1633,7 +1649,7 @@ var require_package = __commonJS({
|
|
|
1633
1649
|
"@opentelemetry/sdk-node": "^0.203.0",
|
|
1634
1650
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
1635
1651
|
"@opentelemetry/semantic-conventions": "^1.30.1",
|
|
1636
|
-
"@probelabs/probe": "^0.6.0-
|
|
1652
|
+
"@probelabs/probe": "^0.6.0-rc311",
|
|
1637
1653
|
"@types/commander": "^2.12.0",
|
|
1638
1654
|
"@types/uuid": "^10.0.0",
|
|
1639
1655
|
"@utcp/file": "^1.1.0",
|
|
@@ -15738,6 +15754,17 @@ var init_config_schema = __esm({
|
|
|
15738
15754
|
}
|
|
15739
15755
|
],
|
|
15740
15756
|
description: "Automatically evaluate completed tasks using an LLM judge. Requires task_tracking to be enabled. Runs asynchronously after task completion. Set to `true` for defaults, or provide an object to configure."
|
|
15757
|
+
},
|
|
15758
|
+
task_live_updates: {
|
|
15759
|
+
anyOf: [
|
|
15760
|
+
{
|
|
15761
|
+
type: "boolean"
|
|
15762
|
+
},
|
|
15763
|
+
{
|
|
15764
|
+
$ref: "#/definitions/TaskLiveUpdatesConfig"
|
|
15765
|
+
}
|
|
15766
|
+
],
|
|
15767
|
+
description: "Live progress updates for long-running tracked tasks on supported frontends."
|
|
15741
15768
|
}
|
|
15742
15769
|
},
|
|
15743
15770
|
required: ["version"],
|
|
@@ -16610,7 +16637,7 @@ var init_config_schema = __esm({
|
|
|
16610
16637
|
description: "Arguments/inputs for the workflow"
|
|
16611
16638
|
},
|
|
16612
16639
|
overrides: {
|
|
16613
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
16640
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422%3E%3E",
|
|
16614
16641
|
description: "Override specific step configurations in the workflow"
|
|
16615
16642
|
},
|
|
16616
16643
|
output_mapping: {
|
|
@@ -16626,7 +16653,7 @@ var init_config_schema = __esm({
|
|
|
16626
16653
|
description: "Config file path - alternative to workflow ID (loads a Visor config file as workflow)"
|
|
16627
16654
|
},
|
|
16628
16655
|
workflow_overrides: {
|
|
16629
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
16656
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422%3E%3E",
|
|
16630
16657
|
description: "Alias for overrides - workflow step overrides (backward compatibility)"
|
|
16631
16658
|
},
|
|
16632
16659
|
ref: {
|
|
@@ -17354,7 +17381,7 @@ var init_config_schema = __esm({
|
|
|
17354
17381
|
description: "Custom output name (defaults to workflow name)"
|
|
17355
17382
|
},
|
|
17356
17383
|
overrides: {
|
|
17357
|
-
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
17384
|
+
$ref: "#/definitions/Record%3Cstring%2CPartial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422%3E%3E",
|
|
17358
17385
|
description: "Step overrides"
|
|
17359
17386
|
},
|
|
17360
17387
|
output_mapping: {
|
|
@@ -17369,13 +17396,13 @@ var init_config_schema = __esm({
|
|
|
17369
17396
|
"^x-": {}
|
|
17370
17397
|
}
|
|
17371
17398
|
},
|
|
17372
|
-
"Record<string,Partial<interface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
17399
|
+
"Record<string,Partial<interface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422>>": {
|
|
17373
17400
|
type: "object",
|
|
17374
17401
|
additionalProperties: {
|
|
17375
|
-
$ref: "#/definitions/Partial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
17402
|
+
$ref: "#/definitions/Partial%3Cinterface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422%3E"
|
|
17376
17403
|
}
|
|
17377
17404
|
},
|
|
17378
|
-
"Partial<interface-src_types_config.ts-15521-30601-src_types_config.ts-0-
|
|
17405
|
+
"Partial<interface-src_types_config.ts-15521-30601-src_types_config.ts-0-62422>": {
|
|
17379
17406
|
type: "object",
|
|
17380
17407
|
additionalProperties: false
|
|
17381
17408
|
},
|
|
@@ -19307,6 +19334,102 @@ var init_config_schema = __esm({
|
|
|
19307
19334
|
patternProperties: {
|
|
19308
19335
|
"^x-": {}
|
|
19309
19336
|
}
|
|
19337
|
+
},
|
|
19338
|
+
TaskLiveUpdatesConfig: {
|
|
19339
|
+
type: "object",
|
|
19340
|
+
properties: {
|
|
19341
|
+
enabled: {
|
|
19342
|
+
type: "boolean",
|
|
19343
|
+
description: "Enable live task progress updates (default: true when config object is present)"
|
|
19344
|
+
},
|
|
19345
|
+
interval_seconds: {
|
|
19346
|
+
type: "number",
|
|
19347
|
+
description: "Update interval in seconds (default: 10)"
|
|
19348
|
+
},
|
|
19349
|
+
model: {
|
|
19350
|
+
type: "string",
|
|
19351
|
+
description: "LLM model to use for progress summarization"
|
|
19352
|
+
},
|
|
19353
|
+
provider: {
|
|
19354
|
+
type: "string",
|
|
19355
|
+
description: "AI provider to use for progress summarization"
|
|
19356
|
+
},
|
|
19357
|
+
prompt: {
|
|
19358
|
+
type: "string",
|
|
19359
|
+
description: "Custom system prompt for the progress summarizer"
|
|
19360
|
+
},
|
|
19361
|
+
initial_message: {
|
|
19362
|
+
type: "string",
|
|
19363
|
+
description: "Immediate placeholder text posted before the first summary is generated"
|
|
19364
|
+
},
|
|
19365
|
+
max_trace_chars: {
|
|
19366
|
+
type: "number",
|
|
19367
|
+
description: "Maximum serialized trace characters passed into the summarizer (default: 12000)"
|
|
19368
|
+
},
|
|
19369
|
+
frontends: {
|
|
19370
|
+
type: "object",
|
|
19371
|
+
properties: {
|
|
19372
|
+
slack: {
|
|
19373
|
+
type: "object",
|
|
19374
|
+
properties: {
|
|
19375
|
+
enabled: {
|
|
19376
|
+
type: "boolean"
|
|
19377
|
+
}
|
|
19378
|
+
},
|
|
19379
|
+
additionalProperties: false,
|
|
19380
|
+
patternProperties: {
|
|
19381
|
+
"^x-": {}
|
|
19382
|
+
}
|
|
19383
|
+
},
|
|
19384
|
+
telegram: {
|
|
19385
|
+
type: "object",
|
|
19386
|
+
properties: {
|
|
19387
|
+
enabled: {
|
|
19388
|
+
type: "boolean"
|
|
19389
|
+
}
|
|
19390
|
+
},
|
|
19391
|
+
additionalProperties: false,
|
|
19392
|
+
patternProperties: {
|
|
19393
|
+
"^x-": {}
|
|
19394
|
+
}
|
|
19395
|
+
},
|
|
19396
|
+
teams: {
|
|
19397
|
+
type: "object",
|
|
19398
|
+
properties: {
|
|
19399
|
+
enabled: {
|
|
19400
|
+
type: "boolean"
|
|
19401
|
+
}
|
|
19402
|
+
},
|
|
19403
|
+
additionalProperties: false,
|
|
19404
|
+
patternProperties: {
|
|
19405
|
+
"^x-": {}
|
|
19406
|
+
}
|
|
19407
|
+
},
|
|
19408
|
+
whatsapp: {
|
|
19409
|
+
type: "object",
|
|
19410
|
+
properties: {
|
|
19411
|
+
enabled: {
|
|
19412
|
+
type: "boolean"
|
|
19413
|
+
}
|
|
19414
|
+
},
|
|
19415
|
+
additionalProperties: false,
|
|
19416
|
+
patternProperties: {
|
|
19417
|
+
"^x-": {}
|
|
19418
|
+
}
|
|
19419
|
+
}
|
|
19420
|
+
},
|
|
19421
|
+
additionalProperties: false,
|
|
19422
|
+
description: "Per-frontend enablement overrides",
|
|
19423
|
+
patternProperties: {
|
|
19424
|
+
"^x-": {}
|
|
19425
|
+
}
|
|
19426
|
+
}
|
|
19427
|
+
},
|
|
19428
|
+
additionalProperties: false,
|
|
19429
|
+
description: 'Live task progress updates for supported interactive frontends.\n\nWhen enabled, Visor posts a "working on it" placeholder and periodically updates the same message using a cheap internal LLM summary of the current execution trace. The final answer replaces that same message.',
|
|
19430
|
+
patternProperties: {
|
|
19431
|
+
"^x-": {}
|
|
19432
|
+
}
|
|
19310
19433
|
}
|
|
19311
19434
|
}
|
|
19312
19435
|
};
|
|
@@ -20784,6 +20907,7 @@ ${errors}`);
|
|
|
20784
20907
|
"sandbox",
|
|
20785
20908
|
"sandbox_defaults",
|
|
20786
20909
|
"policy",
|
|
20910
|
+
"task_live_updates",
|
|
20787
20911
|
// Workflow metadata fields used when configs are imported as reusable workflows
|
|
20788
20912
|
"id",
|
|
20789
20913
|
"name",
|
|
@@ -21764,10 +21888,10 @@ var init_workflow_check_provider = __esm({
|
|
|
21764
21888
|
}
|
|
21765
21889
|
}
|
|
21766
21890
|
const outputKeys = Object.keys(outputs);
|
|
21767
|
-
const
|
|
21768
|
-
if (
|
|
21891
|
+
const undefinedOutputs = outputKeys.filter((k) => outputs[k] === void 0);
|
|
21892
|
+
if (undefinedOutputs.length > 0) {
|
|
21769
21893
|
logger.warn(
|
|
21770
|
-
`[WorkflowProvider] Workflow '${workflow.id}' has
|
|
21894
|
+
`[WorkflowProvider] Workflow '${workflow.id}' has undefined outputs: [${undefinedOutputs.join(", ")}]. This may indicate value_js expressions are not finding expected data.`
|
|
21771
21895
|
);
|
|
21772
21896
|
}
|
|
21773
21897
|
if (!outputs._rawOutput) {
|
|
@@ -24100,13 +24224,19 @@ async function serializeTraceForPrompt(traceIdOrPath, maxChars, backendConfig, t
|
|
|
24100
24224
|
const localTracePath = isFilePath ? traceIdOrPath : void 0;
|
|
24101
24225
|
const remoteTraceId = fallbackTraceId || (!isFilePath ? traceIdOrPath : await readTraceIdFromFile(traceIdOrPath) || void 0);
|
|
24102
24226
|
const preferLocalFirst = backendOrder[0] === "file";
|
|
24227
|
+
logger.debug(
|
|
24228
|
+
`[TraceSerializer] serializeTraceForPrompt ref=${traceIdOrPath} remoteTraceId=${remoteTraceId || "-"} backendOrder=${backendOrder.join(">")}`
|
|
24229
|
+
);
|
|
24103
24230
|
if (preferLocalFirst && localTracePath) {
|
|
24231
|
+
logger.debug(`[TraceSerializer] Trying local trace file first: ${localTracePath}`);
|
|
24104
24232
|
spans = await fetchTraceSpans(localTracePath, { ...cfg, type: "file" });
|
|
24105
24233
|
}
|
|
24106
24234
|
if (spans.length === 0 && remoteTraceId) {
|
|
24235
|
+
logger.debug(`[TraceSerializer] Trying remote trace backends for trace_id=${remoteTraceId}`);
|
|
24107
24236
|
spans = await fetchTraceSpans(remoteTraceId, cfg);
|
|
24108
24237
|
}
|
|
24109
24238
|
if (spans.length === 0 && localTracePath) {
|
|
24239
|
+
logger.debug(`[TraceSerializer] Falling back to local trace file: ${localTracePath}`);
|
|
24110
24240
|
spans = await fetchTraceSpans(localTracePath, { ...cfg, type: "file" });
|
|
24111
24241
|
}
|
|
24112
24242
|
if (spans.length === 0) {
|
|
@@ -24196,6 +24326,19 @@ function renderSpanYaml(tree, allSpans, opts) {
|
|
|
24196
24326
|
}
|
|
24197
24327
|
function renderYamlNode(node, indent, lines, dedup, renderContext, fallbackIntent, fullOutput, maxLen, parentSpan) {
|
|
24198
24328
|
if (shouldSkipLifecycleSpan(node.span, renderContext)) {
|
|
24329
|
+
for (const child of node.children) {
|
|
24330
|
+
renderYamlNode(
|
|
24331
|
+
child,
|
|
24332
|
+
indent,
|
|
24333
|
+
lines,
|
|
24334
|
+
dedup,
|
|
24335
|
+
renderContext,
|
|
24336
|
+
fallbackIntent,
|
|
24337
|
+
fullOutput,
|
|
24338
|
+
maxLen,
|
|
24339
|
+
parentSpan
|
|
24340
|
+
);
|
|
24341
|
+
}
|
|
24199
24342
|
return;
|
|
24200
24343
|
}
|
|
24201
24344
|
const pad = " ".repeat(indent);
|
|
@@ -24474,7 +24617,7 @@ function renderYamlOutput(rawOutput, pad, label, spanName, dedup, lines, fullOut
|
|
|
24474
24617
|
if (obj === null || obj === void 0 || typeof obj !== "object") return;
|
|
24475
24618
|
if (typeof obj === "object" && !Array.isArray(obj)) {
|
|
24476
24619
|
const keys = Object.keys(obj);
|
|
24477
|
-
if (keys.length === 1 && typeof obj[keys[0]] === "object" && obj[keys[0]] !== null) {
|
|
24620
|
+
if (keys.length === 1 && typeof obj[keys[0]] === "object" && obj[keys[0]] !== null && !Array.isArray(obj[keys[0]])) {
|
|
24478
24621
|
obj = obj[keys[0]];
|
|
24479
24622
|
}
|
|
24480
24623
|
const objKeys = Object.keys(obj);
|
|
@@ -25008,7 +25151,7 @@ function formatJsonPreview(obj, maxLen) {
|
|
|
25008
25151
|
const parts = [];
|
|
25009
25152
|
let len = 2;
|
|
25010
25153
|
for (const [key, val] of Object.entries(obj)) {
|
|
25011
|
-
if (key === "raw" || key === "
|
|
25154
|
+
if (key === "raw" || key === "tags") continue;
|
|
25012
25155
|
let valStr;
|
|
25013
25156
|
if (val === null || val === void 0) continue;
|
|
25014
25157
|
if (typeof val === "boolean") valStr = String(val);
|
|
@@ -25017,8 +25160,13 @@ function formatJsonPreview(obj, maxLen) {
|
|
|
25017
25160
|
if (val.startsWith("{") || val.startsWith("[")) continue;
|
|
25018
25161
|
const clean = val.replace(/\*\*/g, "").replace(/^#+\s*/gm, "").replace(/`/g, "").trim();
|
|
25019
25162
|
valStr = `"${truncate(clean.split("\n")[0], Math.min(80, maxLen / 3))}"`;
|
|
25020
|
-
} else if (Array.isArray(val))
|
|
25021
|
-
|
|
25163
|
+
} else if (Array.isArray(val)) {
|
|
25164
|
+
if (val.every((item) => typeof item === "string") && val.join(", ").length < Math.min(120, maxLen / 2)) {
|
|
25165
|
+
valStr = `[${val.join(", ")}]`;
|
|
25166
|
+
} else {
|
|
25167
|
+
valStr = `[${val.length}]`;
|
|
25168
|
+
}
|
|
25169
|
+
} else if (typeof val === "object") valStr = `{${Object.keys(val).length} keys}`;
|
|
25022
25170
|
else valStr = "...";
|
|
25023
25171
|
const part = `${key}: ${valStr}`;
|
|
25024
25172
|
if (len + part.length + 2 > maxLen) {
|
|
@@ -25264,6 +25412,629 @@ var init_trace_serializer = __esm({
|
|
|
25264
25412
|
}
|
|
25265
25413
|
});
|
|
25266
25414
|
|
|
25415
|
+
// src/agent-protocol/task-live-updates.ts
|
|
25416
|
+
function resolveTaskLiveUpdatesConfig(config) {
|
|
25417
|
+
if (!config) return null;
|
|
25418
|
+
if (config === true) {
|
|
25419
|
+
return {
|
|
25420
|
+
enabled: true,
|
|
25421
|
+
intervalSeconds: DEFAULT_TASK_LIVE_UPDATE_INTERVAL_SECONDS,
|
|
25422
|
+
model: DEFAULT_TASK_LIVE_UPDATE_MODEL,
|
|
25423
|
+
prompt: DEFAULT_TASK_LIVE_UPDATE_PROMPT,
|
|
25424
|
+
initialMessage: "",
|
|
25425
|
+
maxTraceChars: DEFAULT_TASK_LIVE_UPDATE_MAX_TRACE_CHARS
|
|
25426
|
+
};
|
|
25427
|
+
}
|
|
25428
|
+
if (config.enabled === false) return null;
|
|
25429
|
+
return {
|
|
25430
|
+
enabled: true,
|
|
25431
|
+
intervalSeconds: Math.max(
|
|
25432
|
+
1,
|
|
25433
|
+
Math.floor(config.interval_seconds || DEFAULT_TASK_LIVE_UPDATE_INTERVAL_SECONDS)
|
|
25434
|
+
),
|
|
25435
|
+
model: config.model || DEFAULT_TASK_LIVE_UPDATE_MODEL,
|
|
25436
|
+
provider: config.provider,
|
|
25437
|
+
prompt: config.prompt || DEFAULT_TASK_LIVE_UPDATE_PROMPT,
|
|
25438
|
+
initialMessage: config.initial_message || "",
|
|
25439
|
+
maxTraceChars: Math.max(
|
|
25440
|
+
1e3,
|
|
25441
|
+
Math.floor(config.max_trace_chars || DEFAULT_TASK_LIVE_UPDATE_MAX_TRACE_CHARS)
|
|
25442
|
+
)
|
|
25443
|
+
};
|
|
25444
|
+
}
|
|
25445
|
+
function isFrontendLiveUpdatesEnabled(config, frontend) {
|
|
25446
|
+
if (!config) return false;
|
|
25447
|
+
if (config === true) return true;
|
|
25448
|
+
if (config.enabled === false) return false;
|
|
25449
|
+
const frontendCfg = config.frontends?.[frontend];
|
|
25450
|
+
if (frontendCfg?.enabled === false) return false;
|
|
25451
|
+
return true;
|
|
25452
|
+
}
|
|
25453
|
+
async function defaultSerializeTrace(traceRef, maxChars, traceId) {
|
|
25454
|
+
logger.debug(
|
|
25455
|
+
`[TaskLiveUpdates] Serializing trace for progress update (traceRef=${traceRef}, traceId=${traceId || "-"}, sink=${process.env.VISOR_TELEMETRY_SINK || "auto"})`
|
|
25456
|
+
);
|
|
25457
|
+
return serializeTraceForPrompt(traceRef, maxChars, void 0, void 0, traceId);
|
|
25458
|
+
}
|
|
25459
|
+
async function summarizeTaskProgress(input) {
|
|
25460
|
+
const { ProbeAgent: ProbeAgent2 } = require("@probelabs/probe");
|
|
25461
|
+
const agentOptions = {
|
|
25462
|
+
sessionId: `visor-task-progress-${Date.now()}-${import_crypto5.default.randomUUID().slice(0, 8)}`,
|
|
25463
|
+
systemPrompt: input.config.prompt,
|
|
25464
|
+
maxIterations: 1,
|
|
25465
|
+
disableTools: true
|
|
25466
|
+
};
|
|
25467
|
+
if (input.config.model) agentOptions.model = input.config.model;
|
|
25468
|
+
if (input.config.provider) agentOptions.provider = input.config.provider;
|
|
25469
|
+
const agent = new ProbeAgent2(agentOptions);
|
|
25470
|
+
if (typeof agent.initialize === "function") {
|
|
25471
|
+
await agent.initialize();
|
|
25472
|
+
}
|
|
25473
|
+
const userPrompt = [
|
|
25474
|
+
`<user_request>
|
|
25475
|
+
${input.requestText}
|
|
25476
|
+
</user_request>`,
|
|
25477
|
+
input.previousUpdate ? `<previous_update>
|
|
25478
|
+
${input.previousUpdate}
|
|
25479
|
+
</previous_update>` : "<previous_update>(none)</previous_update>",
|
|
25480
|
+
`<timing>
|
|
25481
|
+
started_at: ${input.startedAt.toISOString()}
|
|
25482
|
+
now: ${input.now.toISOString()}
|
|
25483
|
+
elapsed: ${formatDuration(input.elapsedSeconds)}
|
|
25484
|
+
last_update_at: ${input.previousUpdateAt ? input.previousUpdateAt.toISOString() : "(none)"}
|
|
25485
|
+
time_since_last_update: ${input.previousUpdateAt ? formatDuration(input.secondsSincePreviousUpdate || 0) : "(none)"}
|
|
25486
|
+
</timing>`,
|
|
25487
|
+
`<execution_trace>
|
|
25488
|
+
${input.traceSnapshot}
|
|
25489
|
+
</execution_trace>`
|
|
25490
|
+
].join("\n\n");
|
|
25491
|
+
const response = await agent.answer(userPrompt);
|
|
25492
|
+
const cleaned = response.replace(/^```(?:markdown|md|text)?\s*\n?/i, "").replace(/\n?```\s*$/m, "").trim();
|
|
25493
|
+
return cleaned || null;
|
|
25494
|
+
}
|
|
25495
|
+
function formatDuration(totalSeconds) {
|
|
25496
|
+
const seconds = Math.max(0, Math.floor(totalSeconds));
|
|
25497
|
+
const hours = Math.floor(seconds / 3600);
|
|
25498
|
+
const minutes = Math.floor(seconds % 3600 / 60);
|
|
25499
|
+
const remainingSeconds = seconds % 60;
|
|
25500
|
+
const parts = [];
|
|
25501
|
+
if (hours > 0) parts.push(`${hours}h`);
|
|
25502
|
+
if (minutes > 0) parts.push(`${minutes}m`);
|
|
25503
|
+
if (remainingSeconds > 0 || parts.length === 0) parts.push(`${remainingSeconds}s`);
|
|
25504
|
+
return parts.join(" ");
|
|
25505
|
+
}
|
|
25506
|
+
function normalizeProgressSummary(text) {
|
|
25507
|
+
const wantedLabels = ["Progress", "Last done", "Now", "Waiting on"];
|
|
25508
|
+
const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
25509
|
+
const matched = /* @__PURE__ */ new Map();
|
|
25510
|
+
for (const line of lines) {
|
|
25511
|
+
const match = line.match(/^-?\s*(Progress|Last done|Now|Waiting on|Timing)\s*:\s*(.+)$/i);
|
|
25512
|
+
if (!match) continue;
|
|
25513
|
+
const label = match[1].toLowerCase();
|
|
25514
|
+
if (label === "timing") continue;
|
|
25515
|
+
const canonical = wantedLabels.find((item) => item.toLowerCase() === label);
|
|
25516
|
+
if (canonical && !matched.has(canonical)) {
|
|
25517
|
+
matched.set(canonical, match[2].trim());
|
|
25518
|
+
}
|
|
25519
|
+
}
|
|
25520
|
+
if (matched.size === wantedLabels.length) {
|
|
25521
|
+
return wantedLabels.map((label) => `- ${label}: ${matched.get(label)}`).join("\n");
|
|
25522
|
+
}
|
|
25523
|
+
const withoutTiming = lines.filter((line) => !/^-?\s*(Timing|Metadata|Trace)\s*:/i.test(line));
|
|
25524
|
+
return withoutTiming.join("\n");
|
|
25525
|
+
}
|
|
25526
|
+
function formatProgressMetadata(timing) {
|
|
25527
|
+
const parts = [`elapsed ${formatDuration(timing.elapsedSeconds)}`];
|
|
25528
|
+
if (timing.previousUpdateAt) {
|
|
25529
|
+
parts.push(`previous update ${formatDuration(timing.secondsSincePreviousUpdate || 0)} ago`);
|
|
25530
|
+
parts.push(`at ${timing.previousUpdateAt.toISOString()}`);
|
|
25531
|
+
} else {
|
|
25532
|
+
parts.push("first live update");
|
|
25533
|
+
}
|
|
25534
|
+
if (timing.activatedSkills && timing.activatedSkills.length > 0) {
|
|
25535
|
+
parts.push(`activated skills ${formatSkillList(timing.activatedSkills)}`);
|
|
25536
|
+
}
|
|
25537
|
+
return `_Metadata: ${parts.join(" | ")}_`;
|
|
25538
|
+
}
|
|
25539
|
+
function formatSkillList(skills) {
|
|
25540
|
+
const normalized = dedupeStrings(skills);
|
|
25541
|
+
if (normalized.length <= 4) return normalized.join(", ");
|
|
25542
|
+
return `${normalized.slice(0, 4).join(", ")} +${normalized.length - 4} more`;
|
|
25543
|
+
}
|
|
25544
|
+
function dedupeStrings(values) {
|
|
25545
|
+
if (!Array.isArray(values)) return [];
|
|
25546
|
+
return [...new Set(values.map((value) => String(value || "").trim()).filter(Boolean))];
|
|
25547
|
+
}
|
|
25548
|
+
async function extractTraceSkillMetadata(traceRef, traceId) {
|
|
25549
|
+
if (!traceRef && !traceId) return void 0;
|
|
25550
|
+
try {
|
|
25551
|
+
const spans = await fetchTraceSpans(traceId || traceRef);
|
|
25552
|
+
if (!spans.length) return void 0;
|
|
25553
|
+
const routeIntentSpan = spans.find(
|
|
25554
|
+
(span) => span.attributes["visor.check.id"] === "route-intent"
|
|
25555
|
+
);
|
|
25556
|
+
const buildConfigSpan = spans.find(
|
|
25557
|
+
(span) => span.attributes["visor.check.id"] === "build-config"
|
|
25558
|
+
);
|
|
25559
|
+
const classifySpan = spans.find((span) => span.attributes["visor.check.id"] === "classify");
|
|
25560
|
+
const routeIntentOutput = parseJsonAttribute(routeIntentSpan?.attributes["visor.check.output"]);
|
|
25561
|
+
const classifyOutput = parseJsonAttribute(classifySpan?.attributes["visor.check.output"]);
|
|
25562
|
+
const buildConfigOutput = parseJsonAttribute(buildConfigSpan?.attributes["visor.check.output"]);
|
|
25563
|
+
const activatedSkills = dedupeStrings(
|
|
25564
|
+
Array.isArray(buildConfigOutput?.activated_skills) ? buildConfigOutput.activated_skills : void 0
|
|
25565
|
+
);
|
|
25566
|
+
const fallbackActivatedSkills = dedupeStrings(
|
|
25567
|
+
(Array.isArray(routeIntentOutput?.skills) ? routeIntentOutput.skills : void 0) || (Array.isArray(classifyOutput?.skills) ? classifyOutput.skills : void 0)
|
|
25568
|
+
);
|
|
25569
|
+
const finalActivatedSkills = activatedSkills.length > 0 ? activatedSkills : fallbackActivatedSkills;
|
|
25570
|
+
if (!finalActivatedSkills.length) return void 0;
|
|
25571
|
+
return { activatedSkills: finalActivatedSkills };
|
|
25572
|
+
} catch (err) {
|
|
25573
|
+
logger.debug(
|
|
25574
|
+
`[TaskLiveUpdates] Failed to extract skill metadata from trace: ${err instanceof Error ? err.message : String(err)}`
|
|
25575
|
+
);
|
|
25576
|
+
return void 0;
|
|
25577
|
+
}
|
|
25578
|
+
}
|
|
25579
|
+
function parseJsonAttribute(value) {
|
|
25580
|
+
if (typeof value !== "string" || !value.trim()) return void 0;
|
|
25581
|
+
try {
|
|
25582
|
+
const parsed = JSON.parse(value);
|
|
25583
|
+
return parsed && typeof parsed === "object" ? parsed : void 0;
|
|
25584
|
+
} catch {
|
|
25585
|
+
return void 0;
|
|
25586
|
+
}
|
|
25587
|
+
}
|
|
25588
|
+
function buildStallFallbackSummary(traceSnapshot, previousUpdate) {
|
|
25589
|
+
const lastDone = extractProgressField(previousUpdate, "Last done") || "continuing from the last completed analysis step";
|
|
25590
|
+
const lower = traceSnapshot.toLowerCase();
|
|
25591
|
+
let now = "waiting for the current analysis step to finish";
|
|
25592
|
+
let waitingOn = "the current analysis step to complete";
|
|
25593
|
+
if (lower.includes("search.delegate") || lower.includes("tool: search") || lower.includes("search(")) {
|
|
25594
|
+
now = "running or waiting on the current code search step";
|
|
25595
|
+
waitingOn = "search results and downstream analysis to finish";
|
|
25596
|
+
} else if (lower.includes("extract(") || lower.includes("tool: extract")) {
|
|
25597
|
+
now = "extracting the relevant code or documentation context";
|
|
25598
|
+
waitingOn = "the extract step to finish and be interpreted";
|
|
25599
|
+
} else if (lower.includes("engineer-task") || lower.includes("engineer")) {
|
|
25600
|
+
now = "waiting on the current implementation or validation step";
|
|
25601
|
+
waitingOn = "the engineer workflow to finish the current step";
|
|
25602
|
+
} else if (lower.includes("ai.request") || lower.includes("gemini") || lower.includes("claude") || lower.includes("openai")) {
|
|
25603
|
+
now = "waiting on the current model analysis step";
|
|
25604
|
+
waitingOn = "the active model response to finish";
|
|
25605
|
+
} else if (lower.includes("bash(") || lower.includes("go test") || lower.includes("npm test")) {
|
|
25606
|
+
now = "running or waiting on command-based validation";
|
|
25607
|
+
waitingOn = "the current command or test run to finish";
|
|
25608
|
+
} else if (lower.includes("setup-projects") || lower.includes("build-config")) {
|
|
25609
|
+
now = "preparing the workspace and loading the required context";
|
|
25610
|
+
waitingOn = "workspace setup and context loading to finish";
|
|
25611
|
+
}
|
|
25612
|
+
return [
|
|
25613
|
+
"- Progress: still working through the same step; no new completed action yet",
|
|
25614
|
+
`- Last done: ${lastDone}`,
|
|
25615
|
+
`- Now: ${now}`,
|
|
25616
|
+
`- Waiting on: ${waitingOn}`
|
|
25617
|
+
].join("\n");
|
|
25618
|
+
}
|
|
25619
|
+
function extractProgressField(text, label) {
|
|
25620
|
+
if (!text) return void 0;
|
|
25621
|
+
const match = text.match(new RegExp(`(?:^|\\n)-?\\s*${escapeRegExp(label)}\\s*:\\s*(.+)$`, "im"));
|
|
25622
|
+
return match?.[1]?.trim() || void 0;
|
|
25623
|
+
}
|
|
25624
|
+
function escapeRegExp(value) {
|
|
25625
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25626
|
+
}
|
|
25627
|
+
var import_crypto5, DEFAULT_TASK_LIVE_UPDATE_INTERVAL_SECONDS, DEFAULT_TASK_LIVE_UPDATE_MAX_TRACE_CHARS, DEFAULT_TASK_LIVE_UPDATE_FIRST_UPDATE_DELAY_SECONDS, DEFAULT_TASK_LIVE_UPDATE_METADATA_REFRESH_SECONDS, DEFAULT_TASK_LIVE_UPDATE_STALL_FALLBACK_SECONDS, DEFAULT_TASK_LIVE_UPDATE_MODEL, DEFAULT_TASK_LIVE_UPDATE_STALL_NOTICE, DEFAULT_TASK_LIVE_UPDATE_PROMPT, TaskLiveUpdateManager;
|
|
25628
|
+
var init_task_live_updates = __esm({
|
|
25629
|
+
"src/agent-protocol/task-live-updates.ts"() {
|
|
25630
|
+
"use strict";
|
|
25631
|
+
import_crypto5 = __toESM(require("crypto"));
|
|
25632
|
+
init_logger();
|
|
25633
|
+
init_trace_serializer();
|
|
25634
|
+
DEFAULT_TASK_LIVE_UPDATE_INTERVAL_SECONDS = 10;
|
|
25635
|
+
DEFAULT_TASK_LIVE_UPDATE_MAX_TRACE_CHARS = 12e3;
|
|
25636
|
+
DEFAULT_TASK_LIVE_UPDATE_FIRST_UPDATE_DELAY_SECONDS = 10;
|
|
25637
|
+
DEFAULT_TASK_LIVE_UPDATE_METADATA_REFRESH_SECONDS = 5;
|
|
25638
|
+
DEFAULT_TASK_LIVE_UPDATE_STALL_FALLBACK_SECONDS = 60;
|
|
25639
|
+
DEFAULT_TASK_LIVE_UPDATE_MODEL = "gemini-3.1-flash-lite-preview";
|
|
25640
|
+
DEFAULT_TASK_LIVE_UPDATE_STALL_NOTICE = "_No new meaningful progress is visible yet. Some steps can stay quiet for up to 5 minutes before there is new news._";
|
|
25641
|
+
DEFAULT_TASK_LIVE_UPDATE_PROMPT = `You are generating a short live progress update for a user while an AI task is still running.
|
|
25642
|
+
|
|
25643
|
+
This is NOT the final answer.
|
|
25644
|
+
Do NOT answer the user's original request.
|
|
25645
|
+
Do NOT write the final solution.
|
|
25646
|
+
Do NOT explain the topic in full.
|
|
25647
|
+
Do NOT provide a root cause, recommendation, summary of findings, or conclusion.
|
|
25648
|
+
Even if you think you already know the answer, do NOT give it here.
|
|
25649
|
+
|
|
25650
|
+
You will receive:
|
|
25651
|
+
- the user's original request
|
|
25652
|
+
- the previous progress update, if any
|
|
25653
|
+
- timing metadata for this run
|
|
25654
|
+
- the latest execution trace snapshot
|
|
25655
|
+
|
|
25656
|
+
Your job is to produce a concise status update that tells the user only:
|
|
25657
|
+
- the overall progress so far
|
|
25658
|
+
- the last meaningful action that finished
|
|
25659
|
+
- what the agent is doing right now
|
|
25660
|
+
- what it is likely waiting on, if anything
|
|
25661
|
+
|
|
25662
|
+
Rules:
|
|
25663
|
+
- This is a STATUS UPDATE, not the final answer
|
|
25664
|
+
- Never answer the user's request directly
|
|
25665
|
+
- Never switch into explanation mode
|
|
25666
|
+
- Never write a complete answer, even partially
|
|
25667
|
+
- Keep it short: exactly 4 short bullet points
|
|
25668
|
+
- Use the exact bullet labels below
|
|
25669
|
+
- Do NOT generate timing metadata lines
|
|
25670
|
+
- Do NOT generate task_id lines
|
|
25671
|
+
- Timing metadata is provided only so you understand task pace and recency
|
|
25672
|
+
- The system will append timing and task metadata separately
|
|
25673
|
+
- Prefer concrete progress over generic wording
|
|
25674
|
+
- Mention the most recent completed action before the current action
|
|
25675
|
+
- Do not claim completion unless the task is actually done
|
|
25676
|
+
- Do not mention internal implementation details unless they help explain the current work
|
|
25677
|
+
- Avoid repeating the previous update verbatim
|
|
25678
|
+
- Do not use code fences
|
|
25679
|
+
- Plain markdown text only
|
|
25680
|
+
|
|
25681
|
+
Required output format:
|
|
25682
|
+
- Progress: <very short overall progress statement, not a final answer>
|
|
25683
|
+
- Last done: <most recent completed action>
|
|
25684
|
+
- Now: <current action in progress>
|
|
25685
|
+
- Waiting on: <tool, search, model, user input, or "nothing blocking right now">
|
|
25686
|
+
|
|
25687
|
+
Trace interpretation rules:
|
|
25688
|
+
- Translate internal trace phases into user-meaningful progress, do not just repeat raw span names
|
|
25689
|
+
- If the trace shows routing or classify work, describe that as understanding the request and choosing the right path
|
|
25690
|
+
- If the trace shows setup-projects, build-config, or loading context, describe that as preparing the workspace or gathering context
|
|
25691
|
+
- If the trace shows search, extract, code-explorer, or file inspection, describe that as investigating the codebase
|
|
25692
|
+
- If the trace shows engineer work, edits, tests, PR creation, or command execution, describe that as implementing or verifying changes
|
|
25693
|
+
- If the trace shows completion prompts, final answer generation, summarization, final validation, or output rendering, describe that as validating findings and preparing the final response
|
|
25694
|
+
- If the trace shows waiting on a long AI request, delegate, tool call, or sandboxed child task, describe that as waiting for analysis or validation to finish
|
|
25695
|
+
|
|
25696
|
+
If you are tempted to answer the user's question, stop and convert that into:
|
|
25697
|
+
- what was learned so far
|
|
25698
|
+
- what was just completed
|
|
25699
|
+
- what is still being checked
|
|
25700
|
+
|
|
25701
|
+
Bad update example:
|
|
25702
|
+
- "API rate limiting works by..."
|
|
25703
|
+
|
|
25704
|
+
Good update example:
|
|
25705
|
+
- "Progress: identified the gateway components involved in rate limiting"
|
|
25706
|
+
- "Last done: found the middleware files and session manager entry points"
|
|
25707
|
+
- "Now: tracing the enforcement path through the gateway"
|
|
25708
|
+
- "Waiting on: search results for the limiter implementation details"`;
|
|
25709
|
+
TaskLiveUpdateManager = class {
|
|
25710
|
+
constructor(ctx, deps) {
|
|
25711
|
+
this.ctx = ctx;
|
|
25712
|
+
this.deps = {
|
|
25713
|
+
summarizeProgress: deps?.summarizeProgress || summarizeTaskProgress,
|
|
25714
|
+
serializeTrace: deps?.serializeTrace || defaultSerializeTrace,
|
|
25715
|
+
extractSkillMetadata: deps?.extractSkillMetadata || extractTraceSkillMetadata
|
|
25716
|
+
};
|
|
25717
|
+
}
|
|
25718
|
+
deps;
|
|
25719
|
+
timer;
|
|
25720
|
+
firstTickTimer;
|
|
25721
|
+
metadataRefreshTimer;
|
|
25722
|
+
running = false;
|
|
25723
|
+
started = false;
|
|
25724
|
+
completed = false;
|
|
25725
|
+
startedAt = /* @__PURE__ */ new Date();
|
|
25726
|
+
lastUpdateText;
|
|
25727
|
+
lastUpdateAt;
|
|
25728
|
+
lastTraceSnapshot;
|
|
25729
|
+
lastPostedMessage;
|
|
25730
|
+
lastStallFallbackAt;
|
|
25731
|
+
lastUpdateKind = "semantic";
|
|
25732
|
+
lastSkillMetadata;
|
|
25733
|
+
async start() {
|
|
25734
|
+
if (this.started) return;
|
|
25735
|
+
this.started = true;
|
|
25736
|
+
try {
|
|
25737
|
+
const started = await this.ctx.sink.start();
|
|
25738
|
+
this.recordSinkRef(started);
|
|
25739
|
+
logger.info(
|
|
25740
|
+
`[TaskLiveUpdates] Started for task ${this.ctx.taskId}; first update in ${DEFAULT_TASK_LIVE_UPDATE_FIRST_UPDATE_DELAY_SECONDS}s, interval=${this.ctx.config.intervalSeconds}s, provider=${this.ctx.config.provider || "default"}, model=${this.ctx.config.model}`
|
|
25741
|
+
);
|
|
25742
|
+
} catch (err) {
|
|
25743
|
+
logger.warn(
|
|
25744
|
+
`[TaskLiveUpdates] Failed to initialize live updates for task ${this.ctx.taskId}: ${err instanceof Error ? err.message : String(err)}`
|
|
25745
|
+
);
|
|
25746
|
+
}
|
|
25747
|
+
this.firstTickTimer = setTimeout(() => {
|
|
25748
|
+
void this.runFirstTick();
|
|
25749
|
+
}, DEFAULT_TASK_LIVE_UPDATE_FIRST_UPDATE_DELAY_SECONDS * 1e3);
|
|
25750
|
+
if (typeof this.firstTickTimer?.unref === "function") {
|
|
25751
|
+
this.firstTickTimer.unref();
|
|
25752
|
+
}
|
|
25753
|
+
}
|
|
25754
|
+
async complete(finalText) {
|
|
25755
|
+
if (this.completed) return;
|
|
25756
|
+
this.completed = true;
|
|
25757
|
+
this.stop();
|
|
25758
|
+
try {
|
|
25759
|
+
logger.info(`[TaskLiveUpdates] Publishing final success update for task ${this.ctx.taskId}`);
|
|
25760
|
+
const result = await this.ctx.sink.complete(this.decorateText(finalText));
|
|
25761
|
+
this.recordSinkRef(result);
|
|
25762
|
+
this.ctx.appendHistory?.(finalText, "completed");
|
|
25763
|
+
} catch (err) {
|
|
25764
|
+
logger.warn(
|
|
25765
|
+
`[TaskLiveUpdates] Failed to publish final update for task ${this.ctx.taskId}: ${err instanceof Error ? err.message : String(err)}`
|
|
25766
|
+
);
|
|
25767
|
+
}
|
|
25768
|
+
}
|
|
25769
|
+
async fail(finalText) {
|
|
25770
|
+
if (this.completed) return;
|
|
25771
|
+
this.completed = true;
|
|
25772
|
+
this.stop();
|
|
25773
|
+
try {
|
|
25774
|
+
logger.info(`[TaskLiveUpdates] Publishing final failure update for task ${this.ctx.taskId}`);
|
|
25775
|
+
const result = await this.ctx.sink.fail(this.decorateText(finalText));
|
|
25776
|
+
this.recordSinkRef(result);
|
|
25777
|
+
this.ctx.appendHistory?.(finalText, "failed");
|
|
25778
|
+
} catch (err) {
|
|
25779
|
+
logger.warn(
|
|
25780
|
+
`[TaskLiveUpdates] Failed to publish failure update for task ${this.ctx.taskId}: ${err instanceof Error ? err.message : String(err)}`
|
|
25781
|
+
);
|
|
25782
|
+
}
|
|
25783
|
+
}
|
|
25784
|
+
stop() {
|
|
25785
|
+
if (this.firstTickTimer) {
|
|
25786
|
+
clearTimeout(this.firstTickTimer);
|
|
25787
|
+
this.firstTickTimer = void 0;
|
|
25788
|
+
}
|
|
25789
|
+
if (this.timer) {
|
|
25790
|
+
clearInterval(this.timer);
|
|
25791
|
+
this.timer = void 0;
|
|
25792
|
+
}
|
|
25793
|
+
if (this.metadataRefreshTimer) {
|
|
25794
|
+
clearInterval(this.metadataRefreshTimer);
|
|
25795
|
+
this.metadataRefreshTimer = void 0;
|
|
25796
|
+
}
|
|
25797
|
+
}
|
|
25798
|
+
async tick() {
|
|
25799
|
+
if (this.completed || this.running) return;
|
|
25800
|
+
const traceState = this.getTraceState();
|
|
25801
|
+
if (!traceState.traceRef && !traceState.traceId) {
|
|
25802
|
+
logger.debug(
|
|
25803
|
+
`[TaskLiveUpdates] Skipping tick for task ${this.ctx.taskId}: no trace reference available yet`
|
|
25804
|
+
);
|
|
25805
|
+
return;
|
|
25806
|
+
}
|
|
25807
|
+
this.running = true;
|
|
25808
|
+
try {
|
|
25809
|
+
const traceRef = traceState.traceRef || traceState.traceId;
|
|
25810
|
+
const traceSnapshot = await this.deps.serializeTrace(
|
|
25811
|
+
traceRef,
|
|
25812
|
+
this.ctx.config.maxTraceChars,
|
|
25813
|
+
traceState.traceId
|
|
25814
|
+
);
|
|
25815
|
+
if (this.completed) {
|
|
25816
|
+
logger.debug(
|
|
25817
|
+
`[TaskLiveUpdates] Aborting in-flight tick for task ${this.ctx.taskId}: task already completed`
|
|
25818
|
+
);
|
|
25819
|
+
return;
|
|
25820
|
+
}
|
|
25821
|
+
if (!traceSnapshot || traceSnapshot === "(no trace data available)") {
|
|
25822
|
+
logger.debug(
|
|
25823
|
+
`[TaskLiveUpdates] Skipping tick for task ${this.ctx.taskId}: no trace data available yet (traceRef=${traceRef})`
|
|
25824
|
+
);
|
|
25825
|
+
return;
|
|
25826
|
+
}
|
|
25827
|
+
if (traceSnapshot === this.lastTraceSnapshot) {
|
|
25828
|
+
await this.maybePublishStallFallback(traceSnapshot, traceState.traceId);
|
|
25829
|
+
logger.debug(
|
|
25830
|
+
`[TaskLiveUpdates] Skipping tick for task ${this.ctx.taskId}: trace snapshot unchanged`
|
|
25831
|
+
);
|
|
25832
|
+
return;
|
|
25833
|
+
}
|
|
25834
|
+
const summary = await this.deps.summarizeProgress({
|
|
25835
|
+
requestText: this.ctx.requestText,
|
|
25836
|
+
previousUpdate: this.lastUpdateText,
|
|
25837
|
+
traceSnapshot,
|
|
25838
|
+
config: this.ctx.config,
|
|
25839
|
+
startedAt: this.startedAt,
|
|
25840
|
+
now: /* @__PURE__ */ new Date(),
|
|
25841
|
+
elapsedSeconds: Math.max(0, Math.floor((Date.now() - this.startedAt.getTime()) / 1e3)),
|
|
25842
|
+
previousUpdateAt: this.lastUpdateAt,
|
|
25843
|
+
secondsSincePreviousUpdate: this.lastUpdateAt ? Math.max(0, Math.floor((Date.now() - this.lastUpdateAt.getTime()) / 1e3)) : void 0
|
|
25844
|
+
});
|
|
25845
|
+
if (this.completed) {
|
|
25846
|
+
logger.debug(
|
|
25847
|
+
`[TaskLiveUpdates] Aborting in-flight tick for task ${this.ctx.taskId}: task already completed after summarization`
|
|
25848
|
+
);
|
|
25849
|
+
return;
|
|
25850
|
+
}
|
|
25851
|
+
const cleaned = summary?.trim();
|
|
25852
|
+
if (!cleaned || cleaned === this.lastUpdateText) {
|
|
25853
|
+
await this.maybePublishStallFallback(traceSnapshot, traceState.traceId);
|
|
25854
|
+
logger.debug(
|
|
25855
|
+
`[TaskLiveUpdates] Skipping tick for task ${this.ctx.taskId}: summary empty or unchanged`
|
|
25856
|
+
);
|
|
25857
|
+
this.lastTraceSnapshot = traceSnapshot;
|
|
25858
|
+
return;
|
|
25859
|
+
}
|
|
25860
|
+
logger.info(
|
|
25861
|
+
`[TaskLiveUpdates] Publishing progress update for task ${this.ctx.taskId}: ${cleaned.slice(0, 160)}`
|
|
25862
|
+
);
|
|
25863
|
+
this.lastSkillMetadata = await this.deps.extractSkillMetadata(traceRef, traceState.traceId);
|
|
25864
|
+
this.lastUpdateKind = "semantic";
|
|
25865
|
+
const message = this.decorateProgressText(
|
|
25866
|
+
cleaned,
|
|
25867
|
+
{
|
|
25868
|
+
elapsedSeconds: Math.max(0, Math.floor((Date.now() - this.startedAt.getTime()) / 1e3)),
|
|
25869
|
+
previousUpdateAt: this.lastUpdateAt,
|
|
25870
|
+
secondsSincePreviousUpdate: this.lastUpdateAt ? Math.max(0, Math.floor((Date.now() - this.lastUpdateAt.getTime()) / 1e3)) : void 0,
|
|
25871
|
+
activatedSkills: this.lastSkillMetadata?.activatedSkills
|
|
25872
|
+
},
|
|
25873
|
+
traceState.traceId
|
|
25874
|
+
);
|
|
25875
|
+
const result = await this.ctx.sink.update(message);
|
|
25876
|
+
this.recordSinkRef(result);
|
|
25877
|
+
this.ctx.appendHistory?.(cleaned, "progress");
|
|
25878
|
+
this.lastUpdateText = cleaned;
|
|
25879
|
+
this.lastUpdateAt = /* @__PURE__ */ new Date();
|
|
25880
|
+
this.lastTraceSnapshot = traceSnapshot;
|
|
25881
|
+
this.lastPostedMessage = message;
|
|
25882
|
+
this.lastStallFallbackAt = void 0;
|
|
25883
|
+
} catch (err) {
|
|
25884
|
+
logger.warn(
|
|
25885
|
+
`[TaskLiveUpdates] Progress update failed for task ${this.ctx.taskId}: ${err instanceof Error ? err.message : String(err)}`
|
|
25886
|
+
);
|
|
25887
|
+
} finally {
|
|
25888
|
+
this.running = false;
|
|
25889
|
+
}
|
|
25890
|
+
}
|
|
25891
|
+
async runFirstTick() {
|
|
25892
|
+
if (this.completed) return;
|
|
25893
|
+
logger.debug(`[TaskLiveUpdates] Running first scheduled tick for task ${this.ctx.taskId}`);
|
|
25894
|
+
await this.tick();
|
|
25895
|
+
if (this.completed) return;
|
|
25896
|
+
this.timer = setInterval(() => {
|
|
25897
|
+
void this.tick();
|
|
25898
|
+
}, this.ctx.config.intervalSeconds * 1e3);
|
|
25899
|
+
if (typeof this.timer?.unref === "function") {
|
|
25900
|
+
this.timer.unref();
|
|
25901
|
+
}
|
|
25902
|
+
this.metadataRefreshTimer = setInterval(() => {
|
|
25903
|
+
void this.refreshProgressMetadata();
|
|
25904
|
+
}, DEFAULT_TASK_LIVE_UPDATE_METADATA_REFRESH_SECONDS * 1e3);
|
|
25905
|
+
if (typeof this.metadataRefreshTimer?.unref === "function") {
|
|
25906
|
+
this.metadataRefreshTimer.unref();
|
|
25907
|
+
}
|
|
25908
|
+
}
|
|
25909
|
+
recordSinkRef(result) {
|
|
25910
|
+
if (result?.ref) this.ctx.onPostedRef?.(result.ref);
|
|
25911
|
+
}
|
|
25912
|
+
getTraceState() {
|
|
25913
|
+
const resolved = this.ctx.resolveTraceState?.();
|
|
25914
|
+
return {
|
|
25915
|
+
traceRef: resolved?.traceRef || this.ctx.traceRef,
|
|
25916
|
+
traceId: resolved?.traceId || this.ctx.traceId
|
|
25917
|
+
};
|
|
25918
|
+
}
|
|
25919
|
+
decorateText(text, _traceId) {
|
|
25920
|
+
if (!this.ctx.includeTraceId) return text;
|
|
25921
|
+
if (text.includes(`task_id: ${this.ctx.taskId}`)) return text;
|
|
25922
|
+
return `${text}
|
|
25923
|
+
|
|
25924
|
+
\`task_id: ${this.ctx.taskId}\``;
|
|
25925
|
+
}
|
|
25926
|
+
decorateProgressText(text, timing, traceId) {
|
|
25927
|
+
const normalized = normalizeProgressSummary(text);
|
|
25928
|
+
const blocks = [
|
|
25929
|
+
"*Live Update*",
|
|
25930
|
+
"_Current task is still running. This message updates in place until the final answer is ready._",
|
|
25931
|
+
this.lastUpdateKind === "stall" ? DEFAULT_TASK_LIVE_UPDATE_STALL_NOTICE : "",
|
|
25932
|
+
normalized,
|
|
25933
|
+
formatProgressMetadata(timing)
|
|
25934
|
+
].filter(Boolean);
|
|
25935
|
+
return this.decorateText(blocks.join("\n\n"), traceId);
|
|
25936
|
+
}
|
|
25937
|
+
async refreshProgressMetadata() {
|
|
25938
|
+
if (this.completed || this.running || !this.lastUpdateText) return;
|
|
25939
|
+
const traceState = this.getTraceState();
|
|
25940
|
+
const message = this.decorateProgressText(
|
|
25941
|
+
this.lastUpdateText,
|
|
25942
|
+
{
|
|
25943
|
+
elapsedSeconds: Math.max(0, Math.floor((Date.now() - this.startedAt.getTime()) / 1e3)),
|
|
25944
|
+
previousUpdateAt: this.lastUpdateAt,
|
|
25945
|
+
secondsSincePreviousUpdate: this.lastUpdateAt ? Math.max(0, Math.floor((Date.now() - this.lastUpdateAt.getTime()) / 1e3)) : void 0,
|
|
25946
|
+
activatedSkills: this.lastSkillMetadata?.activatedSkills
|
|
25947
|
+
},
|
|
25948
|
+
traceState.traceId
|
|
25949
|
+
);
|
|
25950
|
+
if (!message || message === this.lastPostedMessage) return;
|
|
25951
|
+
if (this.completed) return;
|
|
25952
|
+
try {
|
|
25953
|
+
logger.debug(
|
|
25954
|
+
`[TaskLiveUpdates] Refreshing metadata-only live update for task ${this.ctx.taskId}`
|
|
25955
|
+
);
|
|
25956
|
+
const result = await this.ctx.sink.update(message);
|
|
25957
|
+
this.recordSinkRef(result);
|
|
25958
|
+
this.lastPostedMessage = message;
|
|
25959
|
+
} catch (err) {
|
|
25960
|
+
logger.warn(
|
|
25961
|
+
`[TaskLiveUpdates] Metadata refresh failed for task ${this.ctx.taskId}: ${err instanceof Error ? err.message : String(err)}`
|
|
25962
|
+
);
|
|
25963
|
+
}
|
|
25964
|
+
}
|
|
25965
|
+
async maybePublishStallFallback(traceSnapshot, traceId) {
|
|
25966
|
+
if (this.completed) return;
|
|
25967
|
+
const now = /* @__PURE__ */ new Date();
|
|
25968
|
+
if (this.lastStallFallbackAt && now.getTime() - this.lastStallFallbackAt.getTime() < DEFAULT_TASK_LIVE_UPDATE_STALL_FALLBACK_SECONDS * 1e3) {
|
|
25969
|
+
return;
|
|
25970
|
+
}
|
|
25971
|
+
if (this.lastUpdateAt && now.getTime() - this.lastUpdateAt.getTime() < DEFAULT_TASK_LIVE_UPDATE_STALL_FALLBACK_SECONDS * 1e3) {
|
|
25972
|
+
return;
|
|
25973
|
+
}
|
|
25974
|
+
this.lastSkillMetadata = await this.deps.extractSkillMetadata(
|
|
25975
|
+
this.getTraceState().traceRef || traceId || "",
|
|
25976
|
+
traceId
|
|
25977
|
+
);
|
|
25978
|
+
const fallback = buildStallFallbackSummary(traceSnapshot, this.lastUpdateText);
|
|
25979
|
+
const baseText = this.lastUpdateText || fallback;
|
|
25980
|
+
if (!baseText) return;
|
|
25981
|
+
logger.info(
|
|
25982
|
+
`[TaskLiveUpdates] Publishing stall notice for task ${this.ctx.taskId}: ${baseText.slice(0, 160)}`
|
|
25983
|
+
);
|
|
25984
|
+
this.lastUpdateKind = "stall";
|
|
25985
|
+
if (this.completed) return;
|
|
25986
|
+
const message = this.decorateProgressText(
|
|
25987
|
+
baseText,
|
|
25988
|
+
{
|
|
25989
|
+
elapsedSeconds: Math.max(0, Math.floor((Date.now() - this.startedAt.getTime()) / 1e3)),
|
|
25990
|
+
previousUpdateAt: this.lastUpdateAt,
|
|
25991
|
+
secondsSincePreviousUpdate: this.lastUpdateAt ? Math.max(0, Math.floor((Date.now() - this.lastUpdateAt.getTime()) / 1e3)) : void 0,
|
|
25992
|
+
activatedSkills: this.lastSkillMetadata?.activatedSkills
|
|
25993
|
+
},
|
|
25994
|
+
traceId
|
|
25995
|
+
);
|
|
25996
|
+
if (message === this.lastPostedMessage) {
|
|
25997
|
+
this.lastStallFallbackAt = now;
|
|
25998
|
+
return;
|
|
25999
|
+
}
|
|
26000
|
+
const result = await this.ctx.sink.update(message);
|
|
26001
|
+
this.recordSinkRef(result);
|
|
26002
|
+
if (!this.lastUpdateText) {
|
|
26003
|
+
this.ctx.appendHistory?.(baseText, "progress");
|
|
26004
|
+
this.lastUpdateText = baseText;
|
|
26005
|
+
this.lastUpdateAt = now;
|
|
26006
|
+
}
|
|
26007
|
+
this.lastPostedMessage = message;
|
|
26008
|
+
this.lastStallFallbackAt = now;
|
|
26009
|
+
}
|
|
26010
|
+
};
|
|
26011
|
+
}
|
|
26012
|
+
});
|
|
26013
|
+
|
|
26014
|
+
// src/agent-protocol/task-trace-resolution.ts
|
|
26015
|
+
async function resolveTaskTraceReference(metadata) {
|
|
26016
|
+
const traceFile = metadata?.trace_file;
|
|
26017
|
+
let traceId = metadata?.trace_id;
|
|
26018
|
+
if (!traceId && traceFile) {
|
|
26019
|
+
try {
|
|
26020
|
+
const { readTraceIdFromFile: readTraceIdFromFile2 } = await Promise.resolve().then(() => (init_trace_serializer(), trace_serializer_exports));
|
|
26021
|
+
traceId = await readTraceIdFromFile2(traceFile) || void 0;
|
|
26022
|
+
} catch {
|
|
26023
|
+
traceId = void 0;
|
|
26024
|
+
}
|
|
26025
|
+
}
|
|
26026
|
+
return {
|
|
26027
|
+
traceId,
|
|
26028
|
+
traceFile,
|
|
26029
|
+
primaryRef: traceId || traceFile || void 0
|
|
26030
|
+
};
|
|
26031
|
+
}
|
|
26032
|
+
var init_task_trace_resolution = __esm({
|
|
26033
|
+
"src/agent-protocol/task-trace-resolution.ts"() {
|
|
26034
|
+
"use strict";
|
|
26035
|
+
}
|
|
26036
|
+
});
|
|
26037
|
+
|
|
25267
26038
|
// src/agent-protocol/task-evaluator.ts
|
|
25268
26039
|
var task_evaluator_exports = {};
|
|
25269
26040
|
__export(task_evaluator_exports, {
|
|
@@ -25437,18 +26208,18 @@ async function evaluateAndStore(taskId, store, config) {
|
|
|
25437
26208
|
const match = rows.find((r) => r.id === taskId || r.id.startsWith(taskId));
|
|
25438
26209
|
if (match) {
|
|
25439
26210
|
store.addArtifact(match.id, {
|
|
25440
|
-
artifact_id:
|
|
26211
|
+
artifact_id: import_crypto6.default.randomUUID(),
|
|
25441
26212
|
name: "evaluation",
|
|
25442
26213
|
parts: [{ text: JSON.stringify(result), media_type: "application/json" }]
|
|
25443
26214
|
});
|
|
25444
26215
|
}
|
|
25445
26216
|
return result;
|
|
25446
26217
|
}
|
|
25447
|
-
var
|
|
26218
|
+
var import_crypto6, DEFAULT_EVALUATION_PROMPT;
|
|
25448
26219
|
var init_task_evaluator = __esm({
|
|
25449
26220
|
"src/agent-protocol/task-evaluator.ts"() {
|
|
25450
26221
|
"use strict";
|
|
25451
|
-
|
|
26222
|
+
import_crypto6 = __toESM(require("crypto"));
|
|
25452
26223
|
init_logger();
|
|
25453
26224
|
init_trace_serializer();
|
|
25454
26225
|
DEFAULT_EVALUATION_PROMPT = `You are a task response quality evaluator for an AI agent system called Visor.
|
|
@@ -25540,13 +26311,13 @@ async function trackExecution(opts, executor) {
|
|
|
25540
26311
|
const configName = configPath ? import_path12.default.basename(configPath, import_path12.default.extname(configPath)) : void 0;
|
|
25541
26312
|
const workflowId = configName && opts.workflowId ? `${configName}#${opts.workflowId}` : opts.workflowId;
|
|
25542
26313
|
const requestMessage = {
|
|
25543
|
-
message_id:
|
|
26314
|
+
message_id: import_crypto7.default.randomUUID(),
|
|
25544
26315
|
role: "user",
|
|
25545
26316
|
parts: [{ text: messageText }]
|
|
25546
26317
|
};
|
|
25547
26318
|
const traceFile = process.env.VISOR_FALLBACK_TRACE_FILE || void 0;
|
|
25548
26319
|
const task = taskStore.createTask({
|
|
25549
|
-
contextId:
|
|
26320
|
+
contextId: import_crypto7.default.randomUUID(),
|
|
25550
26321
|
requestMessage,
|
|
25551
26322
|
workflowId,
|
|
25552
26323
|
requestMetadata: {
|
|
@@ -25560,105 +26331,181 @@ async function trackExecution(opts, executor) {
|
|
|
25560
26331
|
}
|
|
25561
26332
|
});
|
|
25562
26333
|
const instanceId = getInstanceId();
|
|
25563
|
-
|
|
25564
|
-
|
|
25565
|
-
|
|
25566
|
-
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
|
|
25572
|
-
|
|
26334
|
+
return await logger.withTaskContext(task.id, async () => {
|
|
26335
|
+
taskStore.updateTaskState(task.id, "working");
|
|
26336
|
+
taskStore.claimTask(task.id, instanceId);
|
|
26337
|
+
logger.info(
|
|
26338
|
+
`[TaskTracking] Task ${task.id} started (source=${source}, workflow=${workflowId || "-"}, instance=${instanceId})`
|
|
26339
|
+
);
|
|
26340
|
+
const liveUpdateConfig = resolveTaskLiveUpdatesConfig(opts.liveUpdates?.config);
|
|
26341
|
+
const initialTraceId = trace.getActiveSpan()?.spanContext().traceId || task.metadata?.trace_id;
|
|
26342
|
+
if (initialTraceId && !task.metadata?.trace_id) {
|
|
26343
|
+
try {
|
|
26344
|
+
taskStore.updateMetadata(task.id, { trace_id: initialTraceId });
|
|
26345
|
+
} catch {
|
|
26346
|
+
}
|
|
25573
26347
|
}
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
|
|
25578
|
-
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
|
|
26348
|
+
const initialResolvedTrace = await resolveTaskTraceReference({
|
|
26349
|
+
trace_id: initialTraceId || task.metadata?.trace_id,
|
|
26350
|
+
trace_file: task.metadata?.trace_file
|
|
26351
|
+
});
|
|
26352
|
+
const liveUpdateManager = liveUpdateConfig && opts.liveUpdates?.sink ? new TaskLiveUpdateManager({
|
|
26353
|
+
taskId: task.id,
|
|
26354
|
+
requestText: messageText,
|
|
26355
|
+
traceRef: initialResolvedTrace.primaryRef,
|
|
26356
|
+
traceId: initialResolvedTrace.traceId,
|
|
26357
|
+
includeTraceId: opts.liveUpdates?.includeTraceId === true,
|
|
26358
|
+
sink: opts.liveUpdates.sink,
|
|
26359
|
+
config: liveUpdateConfig,
|
|
26360
|
+
resolveTraceState: () => {
|
|
26361
|
+
let current;
|
|
26362
|
+
try {
|
|
26363
|
+
current = taskStore.getTask(task.id);
|
|
26364
|
+
} catch {
|
|
26365
|
+
return {
|
|
26366
|
+
traceRef: initialResolvedTrace.primaryRef,
|
|
26367
|
+
traceId: initialResolvedTrace.traceId
|
|
26368
|
+
};
|
|
26369
|
+
}
|
|
26370
|
+
return {
|
|
26371
|
+
traceRef: current?.metadata?.trace_id || current?.metadata?.trace_file || initialResolvedTrace.primaryRef,
|
|
26372
|
+
traceId: current?.metadata?.trace_id
|
|
26373
|
+
};
|
|
26374
|
+
},
|
|
26375
|
+
onPostedRef: (ref) => {
|
|
26376
|
+
try {
|
|
26377
|
+
taskStore.updateMetadata(task.id, ref);
|
|
26378
|
+
} catch {
|
|
26379
|
+
}
|
|
26380
|
+
},
|
|
26381
|
+
appendHistory: (text, stage) => {
|
|
26382
|
+
try {
|
|
26383
|
+
taskStore.appendHistory(task.id, {
|
|
26384
|
+
message_id: import_crypto7.default.randomUUID(),
|
|
26385
|
+
role: "agent",
|
|
26386
|
+
parts: [{ text }],
|
|
26387
|
+
metadata: { kind: "task_live_update", stage, source }
|
|
26388
|
+
});
|
|
26389
|
+
} catch {
|
|
26390
|
+
}
|
|
25582
26391
|
}
|
|
25583
|
-
}
|
|
26392
|
+
}) : null;
|
|
26393
|
+
if (liveUpdateConfig && !opts.liveUpdates?.sink) {
|
|
26394
|
+
logger.debug(
|
|
26395
|
+
`[TaskTracking] Live updates requested for task ${task.id} but no sink is available for source=${source}`
|
|
26396
|
+
);
|
|
26397
|
+
} else if (liveUpdateManager) {
|
|
26398
|
+
logger.info(`[TaskTracking] Live updates enabled for task ${task.id} (source=${source})`);
|
|
25584
26399
|
}
|
|
25585
|
-
|
|
26400
|
+
const HEARTBEAT_INTERVAL = 6e4;
|
|
26401
|
+
const heartbeatTimer = setInterval(() => {
|
|
26402
|
+
try {
|
|
26403
|
+
taskStore.heartbeat(task.id);
|
|
26404
|
+
} catch {
|
|
26405
|
+
}
|
|
26406
|
+
}, HEARTBEAT_INTERVAL);
|
|
25586
26407
|
try {
|
|
25587
|
-
|
|
25588
|
-
|
|
25589
|
-
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
26408
|
+
if (liveUpdateManager) {
|
|
26409
|
+
await liveUpdateManager.start();
|
|
26410
|
+
}
|
|
26411
|
+
const result = await executor();
|
|
26412
|
+
try {
|
|
26413
|
+
const activeTraceId = trace.getActiveSpan()?.spanContext().traceId;
|
|
26414
|
+
const persistedTraceId = (activeTraceId && activeTraceId !== "" ? activeTraceId : void 0) || await readTraceIdFromFallbackFile(traceFile);
|
|
26415
|
+
if (persistedTraceId && !task.metadata?.trace_id) {
|
|
26416
|
+
taskStore.updateMetadata(task.id, { trace_id: persistedTraceId });
|
|
26417
|
+
}
|
|
26418
|
+
} catch {
|
|
26419
|
+
}
|
|
26420
|
+
let responseText = "Execution completed";
|
|
26421
|
+
try {
|
|
26422
|
+
const history = result?.reviewSummary?.history;
|
|
26423
|
+
if (history) {
|
|
26424
|
+
const entries = Object.values(history);
|
|
26425
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
26426
|
+
const outputs = entries[i];
|
|
26427
|
+
if (!Array.isArray(outputs)) continue;
|
|
26428
|
+
for (let j = outputs.length - 1; j >= 0; j--) {
|
|
26429
|
+
const text = outputs[j]?.text;
|
|
26430
|
+
if (typeof text === "string" && text.trim().length > 0) {
|
|
26431
|
+
responseText = text.trim();
|
|
26432
|
+
break;
|
|
26433
|
+
}
|
|
25598
26434
|
}
|
|
26435
|
+
if (responseText !== "Execution completed") break;
|
|
25599
26436
|
}
|
|
25600
|
-
if (responseText !== "Execution completed") break;
|
|
25601
26437
|
}
|
|
26438
|
+
} catch {
|
|
25602
26439
|
}
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
)
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25630
|
-
|
|
25631
|
-
|
|
25632
|
-
|
|
26440
|
+
const completedMsg = {
|
|
26441
|
+
message_id: import_crypto7.default.randomUUID(),
|
|
26442
|
+
role: "agent",
|
|
26443
|
+
parts: [{ text: responseText }]
|
|
26444
|
+
};
|
|
26445
|
+
try {
|
|
26446
|
+
taskStore.updateTaskState(task.id, "completed", completedMsg);
|
|
26447
|
+
logger.info(`[TaskTracking] Task ${task.id} completed`);
|
|
26448
|
+
} catch (stateErr) {
|
|
26449
|
+
logger.warn(
|
|
26450
|
+
`[TaskTracking] Task ${task.id} completed but state transition failed: ${stateErr instanceof Error ? stateErr.message : stateErr}`
|
|
26451
|
+
);
|
|
26452
|
+
}
|
|
26453
|
+
if (opts.autoEvaluate || process.env.VISOR_TASK_EVALUATE === "true") {
|
|
26454
|
+
scheduleEvaluation(task.id, taskStore);
|
|
26455
|
+
}
|
|
26456
|
+
if (liveUpdateManager) {
|
|
26457
|
+
await liveUpdateManager.complete(responseText);
|
|
26458
|
+
}
|
|
26459
|
+
return { task, result };
|
|
26460
|
+
} catch (err) {
|
|
26461
|
+
const errorText = err instanceof Error ? err.message : String(err);
|
|
26462
|
+
const failMessage = {
|
|
26463
|
+
message_id: import_crypto7.default.randomUUID(),
|
|
26464
|
+
role: "agent",
|
|
26465
|
+
parts: [{ text: errorText }]
|
|
26466
|
+
};
|
|
26467
|
+
try {
|
|
26468
|
+
taskStore.updateTaskState(task.id, "failed", failMessage);
|
|
26469
|
+
logger.info(`[TaskTracking] Task ${task.id} failed: ${errorText}`);
|
|
26470
|
+
} catch {
|
|
26471
|
+
}
|
|
26472
|
+
if (liveUpdateManager) {
|
|
26473
|
+
await liveUpdateManager.fail(`:warning: ${errorText}`);
|
|
26474
|
+
}
|
|
26475
|
+
throw err;
|
|
26476
|
+
} finally {
|
|
26477
|
+
clearInterval(heartbeatTimer);
|
|
26478
|
+
liveUpdateManager?.stop();
|
|
25633
26479
|
}
|
|
25634
|
-
|
|
25635
|
-
} finally {
|
|
25636
|
-
clearInterval(heartbeatTimer);
|
|
25637
|
-
}
|
|
26480
|
+
});
|
|
25638
26481
|
}
|
|
25639
26482
|
function scheduleEvaluation(taskId, taskStore) {
|
|
25640
26483
|
setTimeout(async () => {
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25644
|
-
|
|
25645
|
-
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
|
|
26484
|
+
await logger.withTaskContext(taskId, async () => {
|
|
26485
|
+
try {
|
|
26486
|
+
const { evaluateAndStore: evaluateAndStore2 } = await Promise.resolve().then(() => (init_task_evaluator(), task_evaluator_exports));
|
|
26487
|
+
await evaluateAndStore2(taskId, taskStore);
|
|
26488
|
+
logger.info(`[TaskEvaluator] Auto-evaluation completed for task ${taskId}`);
|
|
26489
|
+
} catch (err) {
|
|
26490
|
+
logger.warn(
|
|
26491
|
+
`[TaskEvaluator] Auto-evaluation failed for task ${taskId}: ${err instanceof Error ? err.message : err}`
|
|
26492
|
+
);
|
|
26493
|
+
}
|
|
26494
|
+
});
|
|
25650
26495
|
}, 5e3);
|
|
25651
26496
|
}
|
|
25652
|
-
var
|
|
26497
|
+
var import_crypto7, import_fs10, import_path12;
|
|
25653
26498
|
var init_track_execution = __esm({
|
|
25654
26499
|
"src/agent-protocol/track-execution.ts"() {
|
|
25655
26500
|
"use strict";
|
|
25656
|
-
|
|
26501
|
+
import_crypto7 = __toESM(require("crypto"));
|
|
25657
26502
|
import_fs10 = __toESM(require("fs"));
|
|
25658
26503
|
import_path12 = __toESM(require("path"));
|
|
25659
26504
|
init_logger();
|
|
25660
26505
|
init_lazy_otel();
|
|
25661
26506
|
init_instance_id();
|
|
26507
|
+
init_task_live_updates();
|
|
26508
|
+
init_task_trace_resolution();
|
|
25662
26509
|
}
|
|
25663
26510
|
});
|
|
25664
26511
|
|
|
@@ -27549,8 +28396,9 @@ async function handleTrace(taskId, taskStore) {
|
|
|
27549
28396
|
if (!task) {
|
|
27550
28397
|
return { success: false, error: `Task not found: ${taskId}` };
|
|
27551
28398
|
}
|
|
27552
|
-
const
|
|
27553
|
-
const
|
|
28399
|
+
const resolvedTrace = await resolveTaskTraceReference(task.metadata);
|
|
28400
|
+
const traceId = resolvedTrace.traceId;
|
|
28401
|
+
const traceFile = resolvedTrace.traceFile;
|
|
27554
28402
|
if (!traceId && !traceFile) {
|
|
27555
28403
|
const trigger2 = task.metadata?.slack_trigger_text || "";
|
|
27556
28404
|
return {
|
|
@@ -27566,19 +28414,15 @@ async function handleTrace(taskId, taskStore) {
|
|
|
27566
28414
|
].filter(Boolean).join("\n")
|
|
27567
28415
|
};
|
|
27568
28416
|
}
|
|
27569
|
-
const { serializeTraceForPrompt: serializeTraceForPrompt2
|
|
27570
|
-
let resolvedTraceId = traceId;
|
|
27571
|
-
if (!resolvedTraceId && traceFile) {
|
|
27572
|
-
resolvedTraceId = await readTraceIdFromFile2(traceFile);
|
|
27573
|
-
}
|
|
28417
|
+
const { serializeTraceForPrompt: serializeTraceForPrompt2 } = await Promise.resolve().then(() => (init_trace_serializer(), trace_serializer_exports));
|
|
27574
28418
|
const taskResponse = task.status?.message?.parts?.[0]?.text;
|
|
27575
28419
|
const traceTree = await serializeTraceForPrompt2(
|
|
27576
|
-
|
|
28420
|
+
resolvedTrace.primaryRef || "",
|
|
27577
28421
|
8e3,
|
|
27578
28422
|
// generous limit so AI gets good context
|
|
27579
28423
|
void 0,
|
|
27580
28424
|
taskResponse,
|
|
27581
|
-
|
|
28425
|
+
traceId || void 0
|
|
27582
28426
|
);
|
|
27583
28427
|
const trigger = task.metadata?.slack_trigger_text || "";
|
|
27584
28428
|
const elapsed = timeSince(task.created_at);
|
|
@@ -27605,6 +28449,7 @@ var init_task_progress_tool = __esm({
|
|
|
27605
28449
|
"src/agent-protocol/task-progress-tool.ts"() {
|
|
27606
28450
|
"use strict";
|
|
27607
28451
|
init_logger();
|
|
28452
|
+
init_task_trace_resolution();
|
|
27608
28453
|
}
|
|
27609
28454
|
});
|
|
27610
28455
|
|
|
@@ -38801,11 +39646,11 @@ var require_util2 = __commonJS({
|
|
|
38801
39646
|
var assert = require("assert");
|
|
38802
39647
|
var { isUint8Array } = require("util/types");
|
|
38803
39648
|
var supportedHashes = [];
|
|
38804
|
-
var
|
|
39649
|
+
var crypto11;
|
|
38805
39650
|
try {
|
|
38806
|
-
|
|
39651
|
+
crypto11 = require("crypto");
|
|
38807
39652
|
const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
|
|
38808
|
-
supportedHashes =
|
|
39653
|
+
supportedHashes = crypto11.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
|
|
38809
39654
|
} catch {
|
|
38810
39655
|
}
|
|
38811
39656
|
function responseURL(response) {
|
|
@@ -39082,7 +39927,7 @@ var require_util2 = __commonJS({
|
|
|
39082
39927
|
}
|
|
39083
39928
|
}
|
|
39084
39929
|
function bytesMatch(bytes, metadataList) {
|
|
39085
|
-
if (
|
|
39930
|
+
if (crypto11 === void 0) {
|
|
39086
39931
|
return true;
|
|
39087
39932
|
}
|
|
39088
39933
|
const parsedMetadata = parseMetadata(metadataList);
|
|
@@ -39097,7 +39942,7 @@ var require_util2 = __commonJS({
|
|
|
39097
39942
|
for (const item of metadata) {
|
|
39098
39943
|
const algorithm = item.algo;
|
|
39099
39944
|
const expectedValue = item.hash;
|
|
39100
|
-
let actualValue =
|
|
39945
|
+
let actualValue = crypto11.createHash(algorithm).update(bytes).digest("base64");
|
|
39101
39946
|
if (actualValue[actualValue.length - 1] === "=") {
|
|
39102
39947
|
if (actualValue[actualValue.length - 2] === "=") {
|
|
39103
39948
|
actualValue = actualValue.slice(0, -2);
|
|
@@ -40444,8 +41289,8 @@ var require_body = __commonJS({
|
|
|
40444
41289
|
var { parseMIMEType, serializeAMimeType } = require_dataURL();
|
|
40445
41290
|
var random;
|
|
40446
41291
|
try {
|
|
40447
|
-
const
|
|
40448
|
-
random = (max) =>
|
|
41292
|
+
const crypto11 = require("crypto");
|
|
41293
|
+
random = (max) => crypto11.randomInt(0, max);
|
|
40449
41294
|
} catch {
|
|
40450
41295
|
random = (max) => Math.floor(Math.random(max));
|
|
40451
41296
|
}
|
|
@@ -51501,9 +52346,9 @@ var require_connection = __commonJS({
|
|
|
51501
52346
|
channels.open = diagnosticsChannel.channel("undici:websocket:open");
|
|
51502
52347
|
channels.close = diagnosticsChannel.channel("undici:websocket:close");
|
|
51503
52348
|
channels.socketError = diagnosticsChannel.channel("undici:websocket:socket_error");
|
|
51504
|
-
var
|
|
52349
|
+
var crypto11;
|
|
51505
52350
|
try {
|
|
51506
|
-
|
|
52351
|
+
crypto11 = require("crypto");
|
|
51507
52352
|
} catch {
|
|
51508
52353
|
}
|
|
51509
52354
|
function establishWebSocketConnection(url, protocols, ws, onEstablish, options) {
|
|
@@ -51522,7 +52367,7 @@ var require_connection = __commonJS({
|
|
|
51522
52367
|
const headersList = new Headers(options.headers)[kHeadersList];
|
|
51523
52368
|
request.headersList = headersList;
|
|
51524
52369
|
}
|
|
51525
|
-
const keyValue =
|
|
52370
|
+
const keyValue = crypto11.randomBytes(16).toString("base64");
|
|
51526
52371
|
request.headersList.append("sec-websocket-key", keyValue);
|
|
51527
52372
|
request.headersList.append("sec-websocket-version", "13");
|
|
51528
52373
|
for (const protocol of protocols) {
|
|
@@ -51551,7 +52396,7 @@ var require_connection = __commonJS({
|
|
|
51551
52396
|
return;
|
|
51552
52397
|
}
|
|
51553
52398
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
51554
|
-
const digest =
|
|
52399
|
+
const digest = crypto11.createHash("sha1").update(keyValue + uid).digest("base64");
|
|
51555
52400
|
if (secWSAccept !== digest) {
|
|
51556
52401
|
failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
51557
52402
|
return;
|
|
@@ -51631,9 +52476,9 @@ var require_frame = __commonJS({
|
|
|
51631
52476
|
"node_modules/undici/lib/websocket/frame.js"(exports2, module2) {
|
|
51632
52477
|
"use strict";
|
|
51633
52478
|
var { maxUnsigned16Bit } = require_constants5();
|
|
51634
|
-
var
|
|
52479
|
+
var crypto11;
|
|
51635
52480
|
try {
|
|
51636
|
-
|
|
52481
|
+
crypto11 = require("crypto");
|
|
51637
52482
|
} catch {
|
|
51638
52483
|
}
|
|
51639
52484
|
var WebsocketFrameSend = class {
|
|
@@ -51642,7 +52487,7 @@ var require_frame = __commonJS({
|
|
|
51642
52487
|
*/
|
|
51643
52488
|
constructor(data) {
|
|
51644
52489
|
this.frameData = data;
|
|
51645
|
-
this.maskKey =
|
|
52490
|
+
this.maskKey = crypto11.randomBytes(4);
|
|
51646
52491
|
}
|
|
51647
52492
|
createFrame(opcode) {
|
|
51648
52493
|
const bodyLength = this.frameData?.byteLength ?? 0;
|
|
@@ -54967,14 +55812,14 @@ var init_script_check_provider = __esm({
|
|
|
54967
55812
|
});
|
|
54968
55813
|
|
|
54969
55814
|
// src/utils/worktree-manager.ts
|
|
54970
|
-
var fs25, fsp, path26,
|
|
55815
|
+
var fs25, fsp, path26, crypto4, WorktreeManager, worktreeManager;
|
|
54971
55816
|
var init_worktree_manager = __esm({
|
|
54972
55817
|
"src/utils/worktree-manager.ts"() {
|
|
54973
55818
|
"use strict";
|
|
54974
55819
|
fs25 = __toESM(require("fs"));
|
|
54975
55820
|
fsp = __toESM(require("fs/promises"));
|
|
54976
55821
|
path26 = __toESM(require("path"));
|
|
54977
|
-
|
|
55822
|
+
crypto4 = __toESM(require("crypto"));
|
|
54978
55823
|
init_command_executor();
|
|
54979
55824
|
init_logger();
|
|
54980
55825
|
WorktreeManager = class _WorktreeManager {
|
|
@@ -55055,7 +55900,7 @@ var init_worktree_manager = __esm({
|
|
|
55055
55900
|
const sanitizedRepo = repository.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
55056
55901
|
const sanitizedRef = ref.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
55057
55902
|
const hashInput = sessionId ? `${repository}:${ref}:${sessionId}` : `${repository}:${ref}`;
|
|
55058
|
-
const hash =
|
|
55903
|
+
const hash = crypto4.createHash("md5").update(hashInput).digest("hex").substring(0, 8);
|
|
55059
55904
|
return `${sanitizedRepo}-${sanitizedRef}-${hash}`;
|
|
55060
55905
|
}
|
|
55061
55906
|
/**
|
|
@@ -63230,11 +64075,11 @@ var validator_exports = {};
|
|
|
63230
64075
|
__export(validator_exports, {
|
|
63231
64076
|
LicenseValidator: () => LicenseValidator
|
|
63232
64077
|
});
|
|
63233
|
-
var
|
|
64078
|
+
var crypto5, fs28, path30, LicenseValidator;
|
|
63234
64079
|
var init_validator = __esm({
|
|
63235
64080
|
"src/enterprise/license/validator.ts"() {
|
|
63236
64081
|
"use strict";
|
|
63237
|
-
|
|
64082
|
+
crypto5 = __toESM(require("crypto"));
|
|
63238
64083
|
fs28 = __toESM(require("fs"));
|
|
63239
64084
|
path30 = __toESM(require("path"));
|
|
63240
64085
|
LicenseValidator = class _LicenseValidator {
|
|
@@ -63332,11 +64177,11 @@ var init_validator = __esm({
|
|
|
63332
64177
|
if (header.alg !== "EdDSA") return null;
|
|
63333
64178
|
const data = `${headerB64}.${payloadB64}`;
|
|
63334
64179
|
const signature = Buffer.from(signatureB64, "base64url");
|
|
63335
|
-
const publicKey =
|
|
64180
|
+
const publicKey = crypto5.createPublicKey(_LicenseValidator.PUBLIC_KEY);
|
|
63336
64181
|
if (publicKey.asymmetricKeyType !== "ed25519") {
|
|
63337
64182
|
return null;
|
|
63338
64183
|
}
|
|
63339
|
-
const isValid =
|
|
64184
|
+
const isValid = crypto5.verify(null, Buffer.from(data), publicKey, signature);
|
|
63340
64185
|
if (!isValid) return null;
|
|
63341
64186
|
const payload = JSON.parse(Buffer.from(payloadB64, "base64url").toString());
|
|
63342
64187
|
if (!payload.org || !Array.isArray(payload.features) || typeof payload.exp !== "number" || typeof payload.iat !== "number" || !payload.sub) {
|
|
@@ -63357,14 +64202,14 @@ var init_validator = __esm({
|
|
|
63357
64202
|
});
|
|
63358
64203
|
|
|
63359
64204
|
// src/enterprise/policy/opa-compiler.ts
|
|
63360
|
-
var fs29, path31, os2,
|
|
64205
|
+
var fs29, path31, os2, crypto6, import_child_process8, OpaCompiler;
|
|
63361
64206
|
var init_opa_compiler = __esm({
|
|
63362
64207
|
"src/enterprise/policy/opa-compiler.ts"() {
|
|
63363
64208
|
"use strict";
|
|
63364
64209
|
fs29 = __toESM(require("fs"));
|
|
63365
64210
|
path31 = __toESM(require("path"));
|
|
63366
64211
|
os2 = __toESM(require("os"));
|
|
63367
|
-
|
|
64212
|
+
crypto6 = __toESM(require("crypto"));
|
|
63368
64213
|
import_child_process8 = require("child_process");
|
|
63369
64214
|
OpaCompiler = class _OpaCompiler {
|
|
63370
64215
|
static CACHE_DIR = path31.join(os2.tmpdir(), "visor-opa-cache");
|
|
@@ -63424,7 +64269,7 @@ var init_opa_compiler = __esm({
|
|
|
63424
64269
|
"OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\nOr pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz " + regoFiles.join(" ")
|
|
63425
64270
|
);
|
|
63426
64271
|
}
|
|
63427
|
-
const hash =
|
|
64272
|
+
const hash = crypto6.createHash("sha256");
|
|
63428
64273
|
for (const f of regoFiles.sort()) {
|
|
63429
64274
|
hash.update(fs29.readFileSync(f));
|
|
63430
64275
|
hash.update(f);
|
|
@@ -66220,6 +67065,29 @@ var init_client = __esm({
|
|
|
66220
67065
|
data: void 0
|
|
66221
67066
|
};
|
|
66222
67067
|
}
|
|
67068
|
+
},
|
|
67069
|
+
delete: async ({ channel, ts }) => {
|
|
67070
|
+
try {
|
|
67071
|
+
const resp = await this.api("chat.delete", { channel, ts });
|
|
67072
|
+
if (!resp || resp.ok !== true) {
|
|
67073
|
+
const err = resp && resp.error || "unknown_error";
|
|
67074
|
+
console.warn(
|
|
67075
|
+
`Slack chat.delete failed (non-fatal): error=${err} channel=${channel} ts=${ts}`
|
|
67076
|
+
);
|
|
67077
|
+
return { ok: false, ts, error: err, data: resp };
|
|
67078
|
+
}
|
|
67079
|
+
return { ok: true, ts: resp.ts || ts, error: void 0, data: resp };
|
|
67080
|
+
} catch (e) {
|
|
67081
|
+
console.warn(
|
|
67082
|
+
`Slack chat.delete threw (non-fatal): channel=${channel} ts=${ts} error=${e instanceof Error ? e.message : String(e)}`
|
|
67083
|
+
);
|
|
67084
|
+
return {
|
|
67085
|
+
ok: false,
|
|
67086
|
+
ts,
|
|
67087
|
+
error: e instanceof Error ? e.message : String(e),
|
|
67088
|
+
data: void 0
|
|
67089
|
+
};
|
|
67090
|
+
}
|
|
66223
67091
|
}
|
|
66224
67092
|
};
|
|
66225
67093
|
async getBotUserId() {
|
|
@@ -66441,6 +67309,8 @@ var init_slack_frontend = __esm({
|
|
|
66441
67309
|
init_client();
|
|
66442
67310
|
init_markdown();
|
|
66443
67311
|
init_lazy_otel();
|
|
67312
|
+
init_task_live_updates();
|
|
67313
|
+
init_logger();
|
|
66444
67314
|
SlackFrontend = class {
|
|
66445
67315
|
name = "slack";
|
|
66446
67316
|
subs = [];
|
|
@@ -66649,7 +67519,16 @@ var init_slack_frontend = __esm({
|
|
|
66649
67519
|
return false;
|
|
66650
67520
|
}
|
|
66651
67521
|
}
|
|
67522
|
+
isLiveTaskUpdatesMode(ctx) {
|
|
67523
|
+
try {
|
|
67524
|
+
if (!this.getInboundSlackPayload(ctx)) return false;
|
|
67525
|
+
return isFrontendLiveUpdatesEnabled(ctx.config?.task_live_updates, "slack");
|
|
67526
|
+
} catch {
|
|
67527
|
+
return false;
|
|
67528
|
+
}
|
|
67529
|
+
}
|
|
66652
67530
|
async maybePostError(ctx, title, message, checkId) {
|
|
67531
|
+
if (this.isLiveTaskUpdatesMode(ctx)) return;
|
|
66653
67532
|
if (this.errorNotified) return;
|
|
66654
67533
|
return this.postErrorToSlack(ctx, title, message, checkId);
|
|
66655
67534
|
}
|
|
@@ -66658,6 +67537,7 @@ var init_slack_frontend = __esm({
|
|
|
66658
67537
|
* Used for fatal/shutdown errors that must always reach the user.
|
|
66659
67538
|
*/
|
|
66660
67539
|
async forcePostError(ctx, title, message, checkId) {
|
|
67540
|
+
if (this.isLiveTaskUpdatesMode(ctx)) return;
|
|
66661
67541
|
return this.postErrorToSlack(ctx, title, message, checkId);
|
|
66662
67542
|
}
|
|
66663
67543
|
async postErrorToSlack(ctx, title, message, checkId) {
|
|
@@ -66682,11 +67562,11 @@ Check: ${checkId}`;
|
|
|
66682
67562
|
if (message) text += `
|
|
66683
67563
|
${message}`;
|
|
66684
67564
|
if (this.isTelemetryEnabled(ctx)) {
|
|
66685
|
-
const
|
|
66686
|
-
if (
|
|
67565
|
+
const suffix = this.getExecutionReferenceSuffix();
|
|
67566
|
+
if (suffix) {
|
|
66687
67567
|
text += `
|
|
66688
67568
|
|
|
66689
|
-
|
|
67569
|
+
${suffix}`;
|
|
66690
67570
|
}
|
|
66691
67571
|
}
|
|
66692
67572
|
const formattedText = formatSlackText(text);
|
|
@@ -66720,6 +67600,7 @@ ${message}`;
|
|
|
66720
67600
|
}
|
|
66721
67601
|
async maybePostExecutionFailure(ctx, checkId, result) {
|
|
66722
67602
|
try {
|
|
67603
|
+
if (this.isLiveTaskUpdatesMode(ctx)) return;
|
|
66723
67604
|
if (this.errorNotified) return;
|
|
66724
67605
|
const cfg = ctx.config || {};
|
|
66725
67606
|
const checkCfg = cfg.checks?.[checkId];
|
|
@@ -66810,6 +67691,7 @@ ${message}`;
|
|
|
66810
67691
|
*/
|
|
66811
67692
|
async maybePostDirectReply(ctx, checkId, result) {
|
|
66812
67693
|
try {
|
|
67694
|
+
if (this.isLiveTaskUpdatesMode(ctx)) return;
|
|
66813
67695
|
const cfg = ctx.config || {};
|
|
66814
67696
|
const checkCfg = cfg.checks?.[checkId];
|
|
66815
67697
|
if (!checkCfg) return;
|
|
@@ -66973,9 +67855,8 @@ ${errorMessages}`;
|
|
|
66973
67855
|
let decoratedText = processedText;
|
|
66974
67856
|
const telemetryEnabled = telemetryCfg === true || telemetryCfg && typeof telemetryCfg === "object" && telemetryCfg.enabled === true;
|
|
66975
67857
|
if (telemetryEnabled) {
|
|
66976
|
-
const
|
|
66977
|
-
if (
|
|
66978
|
-
const suffix = `\`trace_id: ${traceInfo.traceId}\``;
|
|
67858
|
+
const suffix = this.getExecutionReferenceSuffix();
|
|
67859
|
+
if (suffix) {
|
|
66979
67860
|
decoratedText = `${decoratedText}
|
|
66980
67861
|
|
|
66981
67862
|
${suffix}`;
|
|
@@ -67023,6 +67904,17 @@ ${suffix}`;
|
|
|
67023
67904
|
return null;
|
|
67024
67905
|
}
|
|
67025
67906
|
}
|
|
67907
|
+
getExecutionReferenceSuffix() {
|
|
67908
|
+
try {
|
|
67909
|
+
const taskId = logger.getCurrentTaskId();
|
|
67910
|
+
if (taskId) return `\`task_id: ${taskId}\``;
|
|
67911
|
+
const traceInfo = this.getTraceInfo() || this.cachedTraceInfo;
|
|
67912
|
+
if (traceInfo?.traceId) return `\`trace_id: ${traceInfo.traceId}\``;
|
|
67913
|
+
return null;
|
|
67914
|
+
} catch {
|
|
67915
|
+
return null;
|
|
67916
|
+
}
|
|
67917
|
+
}
|
|
67026
67918
|
};
|
|
67027
67919
|
}
|
|
67028
67920
|
});
|
|
@@ -67535,6 +68427,44 @@ var init_client2 = __esm({
|
|
|
67535
68427
|
return { ok: false, error: errMsg };
|
|
67536
68428
|
}
|
|
67537
68429
|
}
|
|
68430
|
+
/**
|
|
68431
|
+
* Edit an existing text message.
|
|
68432
|
+
* Returns ok=false if Telegram rejects the edit (e.g. message too old or unchanged).
|
|
68433
|
+
*/
|
|
68434
|
+
async editMessageText(opts) {
|
|
68435
|
+
try {
|
|
68436
|
+
const params = {
|
|
68437
|
+
link_preview_options: { is_disabled: true }
|
|
68438
|
+
};
|
|
68439
|
+
if (opts.parse_mode) params.parse_mode = opts.parse_mode;
|
|
68440
|
+
const msg = await this.bot.api.editMessageText(
|
|
68441
|
+
opts.chat_id,
|
|
68442
|
+
opts.message_id,
|
|
68443
|
+
opts.text,
|
|
68444
|
+
params
|
|
68445
|
+
);
|
|
68446
|
+
const messageId = msg?.message_id || opts.message_id;
|
|
68447
|
+
return { ok: true, message_id: messageId };
|
|
68448
|
+
} catch (err) {
|
|
68449
|
+
const errMsg = err?.description || err?.message || String(err);
|
|
68450
|
+
console.warn(`Telegram editMessageText failed (non-fatal): ${errMsg}`);
|
|
68451
|
+
return { ok: false, error: errMsg };
|
|
68452
|
+
}
|
|
68453
|
+
}
|
|
68454
|
+
/**
|
|
68455
|
+
* Delete a message.
|
|
68456
|
+
*/
|
|
68457
|
+
async deleteMessage(opts) {
|
|
68458
|
+
try {
|
|
68459
|
+
await this.bot.api.deleteMessage(opts.chat_id, opts.message_id);
|
|
68460
|
+
return true;
|
|
68461
|
+
} catch (err) {
|
|
68462
|
+
console.warn(
|
|
68463
|
+
`Telegram deleteMessage failed (non-fatal): ${err?.description || err?.message || String(err)}`
|
|
68464
|
+
);
|
|
68465
|
+
return false;
|
|
68466
|
+
}
|
|
68467
|
+
}
|
|
67538
68468
|
/**
|
|
67539
68469
|
* Send a document/file.
|
|
67540
68470
|
*/
|
|
@@ -67595,6 +68525,7 @@ var init_telegram_frontend = __esm({
|
|
|
67595
68525
|
"use strict";
|
|
67596
68526
|
init_client2();
|
|
67597
68527
|
init_markdown2();
|
|
68528
|
+
init_task_live_updates();
|
|
67598
68529
|
TelegramFrontend = class {
|
|
67599
68530
|
name = "telegram";
|
|
67600
68531
|
subs = [];
|
|
@@ -67777,6 +68708,7 @@ ${message}`;
|
|
|
67777
68708
|
const isWorkflow = providerType === "workflow";
|
|
67778
68709
|
if (!isAi && !isLogChat && !isWorkflow) return;
|
|
67779
68710
|
if (checkCfg.criticality === "internal") return;
|
|
68711
|
+
if (isFrontendLiveUpdatesEnabled(cfg.task_live_updates, "telegram")) return;
|
|
67780
68712
|
if (isAi) {
|
|
67781
68713
|
const schema = checkCfg.schema;
|
|
67782
68714
|
if (typeof schema === "string") {
|
|
@@ -75797,11 +76729,11 @@ var require_dist2 = __commonJS({
|
|
|
75797
76729
|
});
|
|
75798
76730
|
|
|
75799
76731
|
// src/email/client.ts
|
|
75800
|
-
var
|
|
76732
|
+
var import_crypto8, EmailClient;
|
|
75801
76733
|
var init_client3 = __esm({
|
|
75802
76734
|
"src/email/client.ts"() {
|
|
75803
76735
|
"use strict";
|
|
75804
|
-
|
|
76736
|
+
import_crypto8 = require("crypto");
|
|
75805
76737
|
EmailClient = class {
|
|
75806
76738
|
receiveBackend;
|
|
75807
76739
|
sendBackend;
|
|
@@ -75906,7 +76838,7 @@ var init_client3 = __esm({
|
|
|
75906
76838
|
const messages = [];
|
|
75907
76839
|
for await (const msg of this.imapClient.fetch({ seen: false }, { source: true, uid: true })) {
|
|
75908
76840
|
const parsed = await simpleParser(msg.source);
|
|
75909
|
-
const messageId = parsed.messageId || `<${(0,
|
|
76841
|
+
const messageId = parsed.messageId || `<${(0, import_crypto8.randomUUID)()}@visor>`;
|
|
75910
76842
|
const inReplyTo = typeof parsed.inReplyTo === "string" ? parsed.inReplyTo : void 0;
|
|
75911
76843
|
const references = parsed.references ? Array.isArray(parsed.references) ? parsed.references : [parsed.references] : void 0;
|
|
75912
76844
|
messages.push({
|
|
@@ -76047,7 +76979,7 @@ var init_client3 = __esm({
|
|
|
76047
76979
|
// ─── Send ───
|
|
76048
76980
|
/** Send an email via configured backend (SMTP or Resend) */
|
|
76049
76981
|
async sendEmail(opts) {
|
|
76050
|
-
const messageId = opts.messageId || `<${(0,
|
|
76982
|
+
const messageId = opts.messageId || `<${(0, import_crypto8.randomUUID)()}@visor>`;
|
|
76051
76983
|
if (this.sendBackend === "resend") {
|
|
76052
76984
|
return this.sendViaResend(opts, messageId);
|
|
76053
76985
|
}
|
|
@@ -76130,7 +77062,7 @@ var init_client3 = __esm({
|
|
|
76130
77062
|
}
|
|
76131
77063
|
/** Generate a deterministic thread ID from a Message-ID chain */
|
|
76132
77064
|
static deriveThreadId(rootMessageId) {
|
|
76133
|
-
return (0,
|
|
77065
|
+
return (0, import_crypto8.createHash)("sha256").update(rootMessageId).digest("hex").slice(0, 16);
|
|
76134
77066
|
}
|
|
76135
77067
|
};
|
|
76136
77068
|
}
|
|
@@ -76624,11 +77556,11 @@ var init_markdown4 = __esm({
|
|
|
76624
77556
|
});
|
|
76625
77557
|
|
|
76626
77558
|
// src/whatsapp/client.ts
|
|
76627
|
-
var
|
|
77559
|
+
var import_crypto9, WhatsAppClient;
|
|
76628
77560
|
var init_client4 = __esm({
|
|
76629
77561
|
"src/whatsapp/client.ts"() {
|
|
76630
77562
|
"use strict";
|
|
76631
|
-
|
|
77563
|
+
import_crypto9 = require("crypto");
|
|
76632
77564
|
init_markdown4();
|
|
76633
77565
|
WhatsAppClient = class {
|
|
76634
77566
|
accessToken;
|
|
@@ -76734,7 +77666,7 @@ var init_client4 = __esm({
|
|
|
76734
77666
|
verifyWebhookSignature(rawBody, signatureHeader) {
|
|
76735
77667
|
if (!this.appSecret) return true;
|
|
76736
77668
|
if (!signatureHeader) return false;
|
|
76737
|
-
const expected = "sha256=" + (0,
|
|
77669
|
+
const expected = "sha256=" + (0, import_crypto9.createHmac)("sha256", this.appSecret).update(rawBody).digest("hex");
|
|
76738
77670
|
return signatureHeader === expected;
|
|
76739
77671
|
}
|
|
76740
77672
|
/**
|
|
@@ -77032,6 +77964,50 @@ var init_client5 = __esm({
|
|
|
77032
77964
|
}
|
|
77033
77965
|
return { ok: true, activityId: lastActivityId };
|
|
77034
77966
|
}
|
|
77967
|
+
/**
|
|
77968
|
+
* Update an existing bot message.
|
|
77969
|
+
* For safety, only supports single-activity payloads. Oversized content returns msg_too_long.
|
|
77970
|
+
*/
|
|
77971
|
+
async updateMessage(opts) {
|
|
77972
|
+
const chunks = chunkText3(opts.text, 28e3);
|
|
77973
|
+
if (chunks.length > 1) {
|
|
77974
|
+
return { ok: false, error: "msg_too_long" };
|
|
77975
|
+
}
|
|
77976
|
+
try {
|
|
77977
|
+
await this.adapter.continueConversationAsync(
|
|
77978
|
+
this.appId,
|
|
77979
|
+
opts.conversationReference,
|
|
77980
|
+
async (turnContext) => {
|
|
77981
|
+
const activity = import_botbuilder.MessageFactory.text(chunks[0] || "");
|
|
77982
|
+
activity.id = opts.activityId;
|
|
77983
|
+
await turnContext.updateActivity(activity);
|
|
77984
|
+
}
|
|
77985
|
+
);
|
|
77986
|
+
return { ok: true, activityId: opts.activityId };
|
|
77987
|
+
} catch (err) {
|
|
77988
|
+
return {
|
|
77989
|
+
ok: false,
|
|
77990
|
+
error: err instanceof Error ? err.message : String(err)
|
|
77991
|
+
};
|
|
77992
|
+
}
|
|
77993
|
+
}
|
|
77994
|
+
/**
|
|
77995
|
+
* Delete a previously sent bot message.
|
|
77996
|
+
*/
|
|
77997
|
+
async deleteMessage(opts) {
|
|
77998
|
+
try {
|
|
77999
|
+
await this.adapter.continueConversationAsync(
|
|
78000
|
+
this.appId,
|
|
78001
|
+
opts.conversationReference,
|
|
78002
|
+
async (turnContext) => {
|
|
78003
|
+
await turnContext.deleteActivity(opts.activityId);
|
|
78004
|
+
}
|
|
78005
|
+
);
|
|
78006
|
+
return true;
|
|
78007
|
+
} catch {
|
|
78008
|
+
return false;
|
|
78009
|
+
}
|
|
78010
|
+
}
|
|
77035
78011
|
};
|
|
77036
78012
|
}
|
|
77037
78013
|
});
|
|
@@ -77047,6 +78023,7 @@ var init_teams_frontend = __esm({
|
|
|
77047
78023
|
"use strict";
|
|
77048
78024
|
init_client5();
|
|
77049
78025
|
init_markdown5();
|
|
78026
|
+
init_task_live_updates();
|
|
77050
78027
|
TeamsFrontend = class {
|
|
77051
78028
|
name = "teams";
|
|
77052
78029
|
subs = [];
|
|
@@ -77145,6 +78122,7 @@ ${message}`;
|
|
|
77145
78122
|
const isWorkflow = providerType === "workflow";
|
|
77146
78123
|
if (!isAi && !isLogChat && !isWorkflow) return;
|
|
77147
78124
|
if (checkCfg.criticality === "internal") return;
|
|
78125
|
+
if (isFrontendLiveUpdatesEnabled(cfg.task_live_updates, "teams")) return;
|
|
77148
78126
|
if (isAi) {
|
|
77149
78127
|
const schema = checkCfg.schema;
|
|
77150
78128
|
if (typeof schema === "string") {
|
|
@@ -77238,13 +78216,13 @@ function taskRowToAgentTask(row) {
|
|
|
77238
78216
|
workflow_id: row.workflow_id ?? void 0
|
|
77239
78217
|
};
|
|
77240
78218
|
}
|
|
77241
|
-
var import_path16, import_fs13,
|
|
78219
|
+
var import_path16, import_fs13, import_crypto10, SqliteTaskStore;
|
|
77242
78220
|
var init_task_store = __esm({
|
|
77243
78221
|
"src/agent-protocol/task-store.ts"() {
|
|
77244
78222
|
"use strict";
|
|
77245
78223
|
import_path16 = __toESM(require("path"));
|
|
77246
78224
|
import_fs13 = __toESM(require("fs"));
|
|
77247
|
-
|
|
78225
|
+
import_crypto10 = __toESM(require("crypto"));
|
|
77248
78226
|
init_logger();
|
|
77249
78227
|
init_types();
|
|
77250
78228
|
init_state_transitions();
|
|
@@ -77325,7 +78303,7 @@ var init_task_store = __esm({
|
|
|
77325
78303
|
// -------------------------------------------------------------------------
|
|
77326
78304
|
createTask(params) {
|
|
77327
78305
|
const db = this.getDb();
|
|
77328
|
-
const id =
|
|
78306
|
+
const id = import_crypto10.default.randomUUID();
|
|
77329
78307
|
const now = nowISO();
|
|
77330
78308
|
const contextId = this.resolveContextId(params.requestMessage, params.contextId);
|
|
77331
78309
|
const expiresAt = params.expiresAt ?? null;
|
|
@@ -77577,7 +78555,7 @@ var init_task_store = __esm({
|
|
|
77577
78555
|
const now = nowISO();
|
|
77578
78556
|
const msg = reason || "Process terminated while task was running";
|
|
77579
78557
|
const statusMessage = JSON.stringify({
|
|
77580
|
-
message_id:
|
|
78558
|
+
message_id: import_crypto10.default.randomUUID(),
|
|
77581
78559
|
role: "agent",
|
|
77582
78560
|
parts: [{ text: msg }]
|
|
77583
78561
|
});
|
|
@@ -77602,7 +78580,7 @@ var init_task_store = __esm({
|
|
|
77602
78580
|
const cutoff = new Date(Date.now() - olderThanMs).toISOString();
|
|
77603
78581
|
const msg = reason || "Task exceeded maximum working duration";
|
|
77604
78582
|
const statusMessage = JSON.stringify({
|
|
77605
|
-
message_id:
|
|
78583
|
+
message_id: import_crypto10.default.randomUUID(),
|
|
77606
78584
|
role: "agent",
|
|
77607
78585
|
parts: [{ text: msg }]
|
|
77608
78586
|
});
|
|
@@ -77771,11 +78749,11 @@ var init_task_stream_manager = __esm({
|
|
|
77771
78749
|
});
|
|
77772
78750
|
|
|
77773
78751
|
// src/agent-protocol/push-notification-manager.ts
|
|
77774
|
-
var
|
|
78752
|
+
var import_crypto11, PushNotificationManager;
|
|
77775
78753
|
var init_push_notification_manager = __esm({
|
|
77776
78754
|
"src/agent-protocol/push-notification-manager.ts"() {
|
|
77777
78755
|
"use strict";
|
|
77778
|
-
|
|
78756
|
+
import_crypto11 = __toESM(require("crypto"));
|
|
77779
78757
|
init_logger();
|
|
77780
78758
|
PushNotificationManager = class {
|
|
77781
78759
|
db = null;
|
|
@@ -77820,7 +78798,7 @@ var init_push_notification_manager = __esm({
|
|
|
77820
78798
|
// -------------------------------------------------------------------------
|
|
77821
78799
|
create(config) {
|
|
77822
78800
|
const db = this.getDb();
|
|
77823
|
-
const id = config.id ??
|
|
78801
|
+
const id = config.id ?? import_crypto11.default.randomUUID();
|
|
77824
78802
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
77825
78803
|
db.prepare(
|
|
77826
78804
|
`INSERT INTO agent_push_configs (id, task_id, url, token, auth_scheme, auth_credentials, created_at)
|
|
@@ -77918,11 +78896,11 @@ var init_push_notification_manager = __esm({
|
|
|
77918
78896
|
});
|
|
77919
78897
|
|
|
77920
78898
|
// src/agent-protocol/task-queue.ts
|
|
77921
|
-
var
|
|
78899
|
+
var import_crypto12, DEFAULT_CONFIG, TaskQueue;
|
|
77922
78900
|
var init_task_queue = __esm({
|
|
77923
78901
|
"src/agent-protocol/task-queue.ts"() {
|
|
77924
78902
|
"use strict";
|
|
77925
|
-
|
|
78903
|
+
import_crypto12 = __toESM(require("crypto"));
|
|
77926
78904
|
init_logger();
|
|
77927
78905
|
init_trace_helpers();
|
|
77928
78906
|
DEFAULT_CONFIG = {
|
|
@@ -77935,7 +78913,7 @@ var init_task_queue = __esm({
|
|
|
77935
78913
|
this.taskStore = taskStore;
|
|
77936
78914
|
this.executor = executor;
|
|
77937
78915
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
77938
|
-
this.workerId = workerId ??
|
|
78916
|
+
this.workerId = workerId ?? import_crypto12.default.randomUUID();
|
|
77939
78917
|
}
|
|
77940
78918
|
running = false;
|
|
77941
78919
|
timer = null;
|
|
@@ -78009,7 +78987,7 @@ var init_task_queue = __esm({
|
|
|
78009
78987
|
}
|
|
78010
78988
|
if (result.success) {
|
|
78011
78989
|
const completedMsg = {
|
|
78012
|
-
message_id:
|
|
78990
|
+
message_id: import_crypto12.default.randomUUID(),
|
|
78013
78991
|
role: "agent",
|
|
78014
78992
|
parts: [
|
|
78015
78993
|
{
|
|
@@ -78021,7 +78999,7 @@ var init_task_queue = __esm({
|
|
|
78021
78999
|
this.taskStore.updateTaskState(task.id, "completed", completedMsg);
|
|
78022
79000
|
} else {
|
|
78023
79001
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
78024
|
-
message_id:
|
|
79002
|
+
message_id: import_crypto12.default.randomUUID(),
|
|
78025
79003
|
role: "agent",
|
|
78026
79004
|
parts: [{ text: result.error ?? "Task execution failed" }]
|
|
78027
79005
|
});
|
|
@@ -78032,7 +79010,7 @@ var init_task_queue = __esm({
|
|
|
78032
79010
|
);
|
|
78033
79011
|
try {
|
|
78034
79012
|
this.taskStore.updateTaskState(task.id, "failed", {
|
|
78035
|
-
message_id:
|
|
79013
|
+
message_id: import_crypto12.default.randomUUID(),
|
|
78036
79014
|
role: "agent",
|
|
78037
79015
|
parts: [{ text: err instanceof Error ? err.message : "Unknown error" }]
|
|
78038
79016
|
});
|
|
@@ -78086,7 +79064,7 @@ function timingSafeEqual(a, b) {
|
|
|
78086
79064
|
if (!a || !b) return false;
|
|
78087
79065
|
if (a.length !== b.length) return false;
|
|
78088
79066
|
try {
|
|
78089
|
-
return
|
|
79067
|
+
return import_crypto13.default.timingSafeEqual(Buffer.from(a), Buffer.from(b));
|
|
78090
79068
|
} catch {
|
|
78091
79069
|
return false;
|
|
78092
79070
|
}
|
|
@@ -78160,7 +79138,7 @@ function resultToArtifacts(checkResults) {
|
|
|
78160
79138
|
}
|
|
78161
79139
|
if (parts.length > 0) {
|
|
78162
79140
|
artifacts.push({
|
|
78163
|
-
artifact_id:
|
|
79141
|
+
artifact_id: import_crypto13.default.randomUUID(),
|
|
78164
79142
|
name: checkId,
|
|
78165
79143
|
description: `Output from check: ${checkId}`,
|
|
78166
79144
|
parts
|
|
@@ -78169,14 +79147,14 @@ function resultToArtifacts(checkResults) {
|
|
|
78169
79147
|
}
|
|
78170
79148
|
return artifacts;
|
|
78171
79149
|
}
|
|
78172
|
-
var import_http2, import_https, import_fs14,
|
|
79150
|
+
var import_http2, import_https, import_fs14, import_crypto13, A2AFrontend;
|
|
78173
79151
|
var init_a2a_frontend = __esm({
|
|
78174
79152
|
"src/agent-protocol/a2a-frontend.ts"() {
|
|
78175
79153
|
"use strict";
|
|
78176
79154
|
import_http2 = __toESM(require("http"));
|
|
78177
79155
|
import_https = __toESM(require("https"));
|
|
78178
79156
|
import_fs14 = __toESM(require("fs"));
|
|
78179
|
-
|
|
79157
|
+
import_crypto13 = __toESM(require("crypto"));
|
|
78180
79158
|
init_logger();
|
|
78181
79159
|
init_task_store();
|
|
78182
79160
|
init_types();
|
|
@@ -78270,7 +79248,7 @@ var init_a2a_frontend = __esm({
|
|
|
78270
79248
|
if (!taskId) return;
|
|
78271
79249
|
try {
|
|
78272
79250
|
const statusMessage = {
|
|
78273
|
-
message_id:
|
|
79251
|
+
message_id: import_crypto13.default.randomUUID(),
|
|
78274
79252
|
role: "agent",
|
|
78275
79253
|
parts: [{ text: envelope.payload?.prompt ?? "Agent requires input" }]
|
|
78276
79254
|
};
|
|
@@ -78476,7 +79454,7 @@ var init_a2a_frontend = __esm({
|
|
|
78476
79454
|
const response = await this.handleFollowUpMessage(existingTaskId, body);
|
|
78477
79455
|
return sendJson(res, 200, response);
|
|
78478
79456
|
}
|
|
78479
|
-
const contextId = body.message.context_id ??
|
|
79457
|
+
const contextId = body.message.context_id ?? import_crypto13.default.randomUUID();
|
|
78480
79458
|
const workflowId = resolveWorkflow(body, this.config);
|
|
78481
79459
|
const blocking = body.configuration?.blocking ?? false;
|
|
78482
79460
|
await withActiveSpan(
|
|
@@ -78589,7 +79567,7 @@ var init_a2a_frontend = __esm({
|
|
|
78589
79567
|
if (!body.message?.parts?.length) {
|
|
78590
79568
|
throw new InvalidRequestError("Message must contain at least one part");
|
|
78591
79569
|
}
|
|
78592
|
-
const contextId = body.message.context_id ??
|
|
79570
|
+
const contextId = body.message.context_id ?? import_crypto13.default.randomUUID();
|
|
78593
79571
|
const workflowId = resolveWorkflow(body, this.config);
|
|
78594
79572
|
const task = this.taskStore.createTask({
|
|
78595
79573
|
contextId,
|
|
@@ -78723,7 +79701,7 @@ var init_a2a_frontend = __esm({
|
|
|
78723
79701
|
await this.executeTaskViaEngine(task, message);
|
|
78724
79702
|
} else {
|
|
78725
79703
|
const agentResponse = {
|
|
78726
|
-
message_id:
|
|
79704
|
+
message_id: import_crypto13.default.randomUUID(),
|
|
78727
79705
|
role: "agent",
|
|
78728
79706
|
parts: [{ text: `Task ${task.id} received and processed.`, media_type: "text/markdown" }]
|
|
78729
79707
|
};
|
|
@@ -78735,7 +79713,7 @@ var init_a2a_frontend = __esm({
|
|
|
78735
79713
|
logger.error(`[A2A] Task ${task.id} execution failed: ${errorMsg}`);
|
|
78736
79714
|
try {
|
|
78737
79715
|
const failMessage = {
|
|
78738
|
-
message_id:
|
|
79716
|
+
message_id: import_crypto13.default.randomUUID(),
|
|
78739
79717
|
role: "agent",
|
|
78740
79718
|
parts: [{ text: errorMsg }]
|
|
78741
79719
|
};
|
|
@@ -78778,7 +79756,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
78778
79756
|
}
|
|
78779
79757
|
if (summaryParts.length > 0) {
|
|
78780
79758
|
artifacts.push({
|
|
78781
|
-
artifact_id:
|
|
79759
|
+
artifact_id: import_crypto13.default.randomUUID(),
|
|
78782
79760
|
name: "review-summary",
|
|
78783
79761
|
description: "Review summary with issues found",
|
|
78784
79762
|
parts: summaryParts
|
|
@@ -78798,7 +79776,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
78798
79776
|
}
|
|
78799
79777
|
if (parts.length > 0) {
|
|
78800
79778
|
artifacts.push({
|
|
78801
|
-
artifact_id:
|
|
79779
|
+
artifact_id: import_crypto13.default.randomUUID(),
|
|
78802
79780
|
name: cr.checkName ?? groupName,
|
|
78803
79781
|
description: `Output from check: ${cr.checkName ?? groupName}`,
|
|
78804
79782
|
parts
|
|
@@ -78809,7 +79787,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
78809
79787
|
}
|
|
78810
79788
|
if (artifacts.length === 0) {
|
|
78811
79789
|
artifacts.push({
|
|
78812
|
-
artifact_id:
|
|
79790
|
+
artifact_id: import_crypto13.default.randomUUID(),
|
|
78813
79791
|
name: "result",
|
|
78814
79792
|
description: "Execution result",
|
|
78815
79793
|
parts: [
|
|
@@ -78831,7 +79809,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
78831
79809
|
);
|
|
78832
79810
|
}
|
|
78833
79811
|
const agentResponse = {
|
|
78834
|
-
message_id:
|
|
79812
|
+
message_id: import_crypto13.default.randomUUID(),
|
|
78835
79813
|
role: "agent",
|
|
78836
79814
|
parts: [
|
|
78837
79815
|
{
|
|
@@ -78884,7 +79862,7 @@ ${issueText}`, media_type: "text/markdown" });
|
|
|
78884
79862
|
}
|
|
78885
79863
|
if (parts.length === 0) return null;
|
|
78886
79864
|
return {
|
|
78887
|
-
artifact_id:
|
|
79865
|
+
artifact_id: import_crypto13.default.randomUUID(),
|
|
78888
79866
|
name: p.checkId ?? "check-result",
|
|
78889
79867
|
parts
|
|
78890
79868
|
};
|