@gobing-ai/spur 0.3.44 → 0.3.45
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/.claude-plugin/marketplace.json +1 -1
- package/config/rules/README.md +12 -4
- package/config/rules/recommended-pre-check.yaml +4 -4
- package/config/rules/strict-check.yaml +7 -4
- package/package.json +9 -9
- package/plugins/sp/commands/dev-find-next.md +20 -12
- package/plugins/sp/plugin.json +1 -1
- package/plugins/sp/skills/next-feature/SKILL.md +17 -13
- package/plugins/sp/skills/next-feature/references/handoff-routing.md +12 -7
- package/plugins/sp/skills/next-feature/references/signal-derivation.md +39 -2
- package/plugins/sp/skills/spur-dev/references/flag-glossary.md +5 -4
- package/spur.js +1720 -478
- package/web/_astro/BoardApp.Ce6zJYAH.js +1 -0
- package/web/_astro/BoardApp.DKyrGxdo.js +179 -0
- package/web/_astro/{TaskDetail.B6yiT-U7.js → TaskDetail.6-27_LMa.js} +1 -1
- package/web/_astro/{arc.PbmgYm3_.js → arc.Df-9AQvS.js} +1 -1
- package/web/_astro/{architectureDiagram-3BPJPVTR.BkOMSdmD.js → architectureDiagram-3BPJPVTR.VAI_-paS.js} +1 -1
- package/web/_astro/{blockDiagram-GPEHLZMM.BtomoUdy.js → blockDiagram-GPEHLZMM.DFpUY1ue.js} +1 -1
- package/web/_astro/{c4Diagram-AAUBKEIU.UzrYwJnF.js → c4Diagram-AAUBKEIU.CF8doOpg.js} +1 -1
- package/web/_astro/channel.Uhm9O3UV.js +1 -0
- package/web/_astro/{chunk-2J33WTMH.nNChLHkw.js → chunk-2J33WTMH.BnjK3fjt.js} +1 -1
- package/web/_astro/{chunk-4BX2VUAB.DLYAecPo.js → chunk-4BX2VUAB.x6ZDnJKq.js} +1 -1
- package/web/_astro/{chunk-55IACEB6.t5bzuj1J.js → chunk-55IACEB6.zY-0uu7w.js} +1 -1
- package/web/_astro/{chunk-727SXJPM.DBV62bIy.js → chunk-727SXJPM.BZxKg_Vi.js} +1 -1
- package/web/_astro/{chunk-AQP2D5EJ.BdaPhTPs.js → chunk-AQP2D5EJ.Cpi9G9Td.js} +1 -1
- package/web/_astro/{chunk-FMBD7UC4.eoZ88KMf.js → chunk-FMBD7UC4.DWTB-Pif.js} +1 -1
- package/web/_astro/{chunk-ND2GUHAM.QdNDyeSh.js → chunk-ND2GUHAM.BPDQbiOG.js} +1 -1
- package/web/_astro/{chunk-QZHKN3VN.DPaToLfx.js → chunk-QZHKN3VN.BRWIcuoM.js} +1 -1
- package/web/_astro/{classDiagram-4FO5ZUOK.By9BMe7b.js → classDiagram-4FO5ZUOK.mGTCZsDO.js} +1 -1
- package/web/_astro/{classDiagram-v2-Q7XG4LA2.By9BMe7b.js → classDiagram-v2-Q7XG4LA2.mGTCZsDO.js} +1 -1
- package/web/_astro/{cose-bilkent-S5V4N54A.DMypl6q_.js → cose-bilkent-S5V4N54A.D1GEut-z.js} +1 -1
- package/web/_astro/{dagre-BM42HDAG.p26m9grg.js → dagre-BM42HDAG.BV0XG9Do.js} +1 -1
- package/web/_astro/{diagram-2AECGRRQ.C6m3oTIu.js → diagram-2AECGRRQ.DzpYxsjo.js} +1 -1
- package/web/_astro/{diagram-5GNKFQAL.JCxivn2z.js → diagram-5GNKFQAL.Cm9YzJh4.js} +1 -1
- package/web/_astro/{diagram-KO2AKTUF.DifbEd3P.js → diagram-KO2AKTUF.BjhottUj.js} +1 -1
- package/web/_astro/{diagram-LMA3HP47.Bffga-cf.js → diagram-LMA3HP47.BFsQW5kb.js} +1 -1
- package/web/_astro/{diagram-OG6HWLK6.CUKx5_Cx.js → diagram-OG6HWLK6.8pdpzSWO.js} +1 -1
- package/web/_astro/{erDiagram-TEJ5UH35.DaJ9KZR0.js → erDiagram-TEJ5UH35.Bd7KUJmJ.js} +1 -1
- package/web/_astro/{flowDiagram-I6XJVG4X.Do6l5pzg.js → flowDiagram-I6XJVG4X.7LWffkaE.js} +1 -1
- package/web/_astro/{ganttDiagram-6RSMTGT7.DqBKgB-3.js → ganttDiagram-6RSMTGT7.BeDcO5tI.js} +1 -1
- package/web/_astro/{gitGraphDiagram-PVQCEYII.B3VLSQ22.js → gitGraphDiagram-PVQCEYII.Ca4n730A.js} +1 -1
- package/web/_astro/{index.QfZ9SC3X.css → index.Dbvuw6d4.css} +1 -1
- package/web/_astro/{infoDiagram-5YYISTIA.hK8ZC1oa.js → infoDiagram-5YYISTIA.B0OakQYb.js} +1 -1
- package/web/_astro/{ishikawaDiagram-YF4QCWOH.C8DXwh9Z.js → ishikawaDiagram-YF4QCWOH.DSmNQe-1.js} +1 -1
- package/web/_astro/{journeyDiagram-JHISSGLW.mj5aHQDb.js → journeyDiagram-JHISSGLW.Cy5ruEUu.js} +1 -1
- package/web/_astro/{kanban-definition-UN3LZRKU.Dwlhi49r.js → kanban-definition-UN3LZRKU.CUJXub0p.js} +1 -1
- package/web/_astro/{linear.7zBHdlwl.js → linear.DC1jCCXn.js} +1 -1
- package/web/_astro/{mermaid.core.AYdA0EJr.js → mermaid.core.DxVP99Ab.js} +4 -4
- package/web/_astro/{mindmap-definition-RKZ34NQL.BSnniHEq.js → mindmap-definition-RKZ34NQL.D0MaV6sJ.js} +1 -1
- package/web/_astro/{pieDiagram-4H26LBE5.B7EVpA3J.js → pieDiagram-4H26LBE5.DCC6_q32.js} +1 -1
- package/web/_astro/{quadrantDiagram-W4KKPZXB.rg4i8YOY.js → quadrantDiagram-W4KKPZXB.BeUOAM7C.js} +1 -1
- package/web/_astro/{requirementDiagram-4Y6WPE33.C4pr792x.js → requirementDiagram-4Y6WPE33.Dbl4MASO.js} +1 -1
- package/web/_astro/{sankeyDiagram-5OEKKPKP.DTXU996O.js → sankeyDiagram-5OEKKPKP.HsLg0VS4.js} +1 -1
- package/web/_astro/{sequenceDiagram-3UESZ5HK.D73DOjzi.js → sequenceDiagram-3UESZ5HK.DT7DJTnZ.js} +1 -1
- package/web/_astro/{stateDiagram-AJRCARHV.CVkeSaEH.js → stateDiagram-AJRCARHV.d_ju1Vr1.js} +1 -1
- package/web/_astro/{stateDiagram-v2-BHNVJYJU.DkBGwoN5.js → stateDiagram-v2-BHNVJYJU.DMCAjMJ4.js} +1 -1
- package/web/_astro/{timeline-definition-PNZ67QCA.DnJ9Yh7G.js → timeline-definition-PNZ67QCA.DNOHr62_.js} +1 -1
- package/web/_astro/{vennDiagram-CIIHVFJN.DN1tvR4Y.js → vennDiagram-CIIHVFJN.B7dUy-1W.js} +1 -1
- package/web/_astro/{wardley-L42UT6IY.D54jJ-7-.js → wardley-L42UT6IY.DEqOXvBh.js} +1 -1
- package/web/_astro/{wardleyDiagram-YWT4CUSO.C2grUBbE.js → wardleyDiagram-YWT4CUSO.BCRb2p6x.js} +1 -1
- package/web/_astro/{xychartDiagram-2RQKCTM6.D05okBnV.js → xychartDiagram-2RQKCTM6.NxVQLdBh.js} +1 -1
- package/web/index.html +2 -2
- package/web/_astro/BoardApp.BnhkWEOG.js +0 -179
- package/web/_astro/BoardApp.CxOS4HSo.js +0 -1
- package/web/_astro/channel.DRRsElzO.js +0 -1
package/spur.js
CHANGED
|
@@ -47,7 +47,7 @@ var __export = (target, all) => {
|
|
|
47
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
48
48
|
var __require = import.meta.require;
|
|
49
49
|
|
|
50
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
50
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
51
51
|
var ErrorCode;
|
|
52
52
|
var init_errors = __esm(() => {
|
|
53
53
|
ErrorCode = {
|
|
@@ -58,7 +58,7 @@ var init_errors = __esm(() => {
|
|
|
58
58
|
};
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
61
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
62
62
|
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
63
63
|
var init_api_response = __esm(() => {
|
|
64
64
|
init_errors();
|
|
@@ -81,10 +81,13 @@ var init_api_response = __esm(() => {
|
|
|
81
81
|
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
84
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
85
85
|
var init_cursor = () => {};
|
|
86
86
|
|
|
87
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
87
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
|
|
88
|
+
var init_event_severity = () => {};
|
|
89
|
+
|
|
90
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/object.js
|
|
88
91
|
function isPlainObject(value) {
|
|
89
92
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90
93
|
}
|
|
@@ -102,7 +105,7 @@ function deepMerge(target, source) {
|
|
|
102
105
|
return result;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
108
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
106
109
|
function processStream(name) {
|
|
107
110
|
const proc = globalThis.process;
|
|
108
111
|
const stream = proc?.[name];
|
|
@@ -123,11 +126,12 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
|
|
|
123
126
|
}
|
|
124
127
|
var defaultStdoutTarget, defaultStderrTarget;
|
|
125
128
|
|
|
126
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.
|
|
129
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.30/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
127
130
|
var init_dist = __esm(() => {
|
|
128
131
|
init_api_response();
|
|
129
132
|
init_cursor();
|
|
130
133
|
init_errors();
|
|
134
|
+
init_event_severity();
|
|
131
135
|
});
|
|
132
136
|
|
|
133
137
|
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
@@ -21745,7 +21749,7 @@ var init_zod = __esm(() => {
|
|
|
21745
21749
|
init_external();
|
|
21746
21750
|
});
|
|
21747
21751
|
|
|
21748
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
21752
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
21749
21753
|
function getProcessEnv() {
|
|
21750
21754
|
return process.env;
|
|
21751
21755
|
}
|
|
@@ -21823,7 +21827,7 @@ var init_config = __esm(() => {
|
|
|
21823
21827
|
};
|
|
21824
21828
|
});
|
|
21825
21829
|
|
|
21826
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
21830
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
21827
21831
|
import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
21828
21832
|
import { dirname, resolve as resolvePath } from "path";
|
|
21829
21833
|
function createNodeFileSystem(root, paths) {
|
|
@@ -21910,7 +21914,7 @@ function findProjectRoot(startDir) {
|
|
|
21910
21914
|
}
|
|
21911
21915
|
var init_file_system_node = () => {};
|
|
21912
21916
|
|
|
21913
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
21917
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
|
|
21914
21918
|
var DbModuleNotInstalledError;
|
|
21915
21919
|
var init_db_errors = __esm(() => {
|
|
21916
21920
|
DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
|
|
@@ -29121,8 +29125,27 @@ var init_execa = __esm(() => {
|
|
|
29121
29125
|
} = getIpcExport());
|
|
29122
29126
|
});
|
|
29123
29127
|
|
|
29124
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29128
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
|
|
29125
29129
|
import { isatty } from "tty";
|
|
29130
|
+
function processEventSeverity(reason, exitCode) {
|
|
29131
|
+
if (reason === "error")
|
|
29132
|
+
return "error";
|
|
29133
|
+
if (reason === "timeout")
|
|
29134
|
+
return "warning";
|
|
29135
|
+
if (exitCode !== null && exitCode !== 0)
|
|
29136
|
+
return "warning";
|
|
29137
|
+
return "info";
|
|
29138
|
+
}
|
|
29139
|
+
function resolveChildEnv(env, envMode) {
|
|
29140
|
+
if (envMode === "replace")
|
|
29141
|
+
return env;
|
|
29142
|
+
const merged = {};
|
|
29143
|
+
for (const [key, value] of Object.entries(getProcessEnv())) {
|
|
29144
|
+
if (value !== undefined)
|
|
29145
|
+
merged[key] = value;
|
|
29146
|
+
}
|
|
29147
|
+
return { ...merged, ...env };
|
|
29148
|
+
}
|
|
29126
29149
|
|
|
29127
29150
|
class NodeProcessExecutor {
|
|
29128
29151
|
config;
|
|
@@ -29160,6 +29183,7 @@ class NodeProcessExecutor {
|
|
|
29160
29183
|
durationMs: 0,
|
|
29161
29184
|
reason: "exit",
|
|
29162
29185
|
timestamp: startedIso,
|
|
29186
|
+
severity: "info",
|
|
29163
29187
|
...options.label !== undefined ? { label: options.label } : {}
|
|
29164
29188
|
});
|
|
29165
29189
|
try {
|
|
@@ -29230,6 +29254,7 @@ class NodeProcessExecutor {
|
|
|
29230
29254
|
durationMs: 0,
|
|
29231
29255
|
reason: "exit",
|
|
29232
29256
|
timestamp: startedIso,
|
|
29257
|
+
severity: "info",
|
|
29233
29258
|
...options.label !== undefined ? { label: options.label } : {}
|
|
29234
29259
|
});
|
|
29235
29260
|
const subprocess = Bun.spawn({
|
|
@@ -29238,7 +29263,7 @@ class NodeProcessExecutor {
|
|
|
29238
29263
|
stdout: "pipe",
|
|
29239
29264
|
stderr: "pipe",
|
|
29240
29265
|
...options.cwd !== undefined ? { cwd: options.cwd } : {},
|
|
29241
|
-
...options.env !== undefined ? { env: options.env } : {}
|
|
29266
|
+
...options.env !== undefined ? { env: resolveChildEnv(options.env, options.envMode) } : {}
|
|
29242
29267
|
});
|
|
29243
29268
|
const pipe2 = new BunPipeProcess(subprocess);
|
|
29244
29269
|
if (pipe2.pid !== null) {
|
|
@@ -29261,6 +29286,7 @@ class NodeProcessExecutor {
|
|
|
29261
29286
|
durationMs: 0,
|
|
29262
29287
|
reason: "error",
|
|
29263
29288
|
timestamp: new Date().toISOString(),
|
|
29289
|
+
severity: processEventSeverity("error", null),
|
|
29264
29290
|
...options.label !== undefined ? { label: options.label } : {},
|
|
29265
29291
|
error: errorMessage(error51)
|
|
29266
29292
|
});
|
|
@@ -29304,6 +29330,7 @@ class NodeProcessExecutor {
|
|
|
29304
29330
|
durationMs: result.durationMs,
|
|
29305
29331
|
reason,
|
|
29306
29332
|
timestamp: new Date().toISOString(),
|
|
29333
|
+
severity: processEventSeverity(reason, result.exitCode),
|
|
29307
29334
|
...options.label !== undefined ? { label: options.label } : {},
|
|
29308
29335
|
...error51 !== undefined ? { error: errorMessage(error51) } : {}
|
|
29309
29336
|
});
|
|
@@ -29334,6 +29361,7 @@ class ObservedPipeProcess {
|
|
|
29334
29361
|
durationMs: Date.now() - context.startedAt,
|
|
29335
29362
|
reason: this.killedWith !== undefined ? "signal" : "exit",
|
|
29336
29363
|
timestamp: new Date().toISOString(),
|
|
29364
|
+
severity: processEventSeverity(this.killedWith !== undefined ? "signal" : "exit", exitCode),
|
|
29337
29365
|
...context.label !== undefined ? { label: context.label } : {}
|
|
29338
29366
|
});
|
|
29339
29367
|
return exitCode;
|
|
@@ -29458,9 +29486,10 @@ function errorMessage(error51) {
|
|
|
29458
29486
|
}
|
|
29459
29487
|
var init_process_executor = __esm(() => {
|
|
29460
29488
|
init_execa();
|
|
29489
|
+
init_config();
|
|
29461
29490
|
});
|
|
29462
29491
|
|
|
29463
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29492
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
|
|
29464
29493
|
function getNodeFileSystem() {
|
|
29465
29494
|
if (!_nodeFileSystem)
|
|
29466
29495
|
_nodeFileSystem = createNodeFileSystem();
|
|
@@ -29520,7 +29549,7 @@ var init_runtime_node_bun = __esm(() => {
|
|
|
29520
29549
|
};
|
|
29521
29550
|
});
|
|
29522
29551
|
|
|
29523
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29552
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
29524
29553
|
class RuntimeContext {
|
|
29525
29554
|
scope;
|
|
29526
29555
|
runtimeName;
|
|
@@ -29590,7 +29619,7 @@ var init_context = __esm(() => {
|
|
|
29590
29619
|
init_runtime_node_bun();
|
|
29591
29620
|
});
|
|
29592
29621
|
|
|
29593
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29622
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
29594
29623
|
function normalizeSeparators(path6) {
|
|
29595
29624
|
return path6.replaceAll("\\", "/");
|
|
29596
29625
|
}
|
|
@@ -29651,17 +29680,17 @@ var init_path = __esm(() => {
|
|
|
29651
29680
|
SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
29652
29681
|
});
|
|
29653
29682
|
|
|
29654
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29683
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
29655
29684
|
var REMOTE_SCHEMA_MAX_BYTES;
|
|
29656
29685
|
var init_schema_validation = __esm(() => {
|
|
29657
29686
|
init_dist2();
|
|
29658
29687
|
REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
|
|
29659
29688
|
});
|
|
29660
29689
|
|
|
29661
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29690
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
29662
29691
|
var init_types = () => {};
|
|
29663
29692
|
|
|
29664
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29693
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
29665
29694
|
var init_dist3 = __esm(() => {
|
|
29666
29695
|
init_config();
|
|
29667
29696
|
init_context();
|
|
@@ -29670,7 +29699,7 @@ var init_dist3 = __esm(() => {
|
|
|
29670
29699
|
init_types();
|
|
29671
29700
|
});
|
|
29672
29701
|
|
|
29673
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
29702
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+54fc8d7a745e138a/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
|
|
29674
29703
|
import { Database } from "bun:sqlite";
|
|
29675
29704
|
var init_bun_sqlite = () => {};
|
|
29676
29705
|
|
|
@@ -33862,7 +33891,7 @@ var init_bun_sqlite2 = __esm(() => {
|
|
|
33862
33891
|
init_session2();
|
|
33863
33892
|
});
|
|
33864
33893
|
|
|
33865
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
33894
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
|
|
33866
33895
|
var inboxMessages;
|
|
33867
33896
|
var init_inbox_messages = __esm(() => {
|
|
33868
33897
|
init_sqlite_core();
|
|
@@ -33881,7 +33910,7 @@ var init_inbox_messages = __esm(() => {
|
|
|
33881
33910
|
}, (table2) => [index("idx_inbox_messages_to_status").on(table2.toId, table2.status)]);
|
|
33882
33911
|
});
|
|
33883
33912
|
|
|
33884
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
33913
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/common.js
|
|
33885
33914
|
function nowTimestamp() {
|
|
33886
33915
|
return Date.now();
|
|
33887
33916
|
}
|
|
@@ -33910,7 +33939,7 @@ var init_common3 = __esm(() => {
|
|
|
33910
33939
|
appendOnlyColumns = buildAppendOnlyColumns();
|
|
33911
33940
|
});
|
|
33912
33941
|
|
|
33913
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
33942
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
|
|
33914
33943
|
var queueJobs;
|
|
33915
33944
|
var init_queue_jobs = __esm(() => {
|
|
33916
33945
|
init_sqlite_core();
|
|
@@ -33930,7 +33959,7 @@ var init_queue_jobs = __esm(() => {
|
|
|
33930
33959
|
}, (table2) => [index("queue_jobs_ready_idx").on(table2.status, table2.nextRetryAt, table2.createdAt)]);
|
|
33931
33960
|
});
|
|
33932
33961
|
|
|
33933
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
33962
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
|
|
33934
33963
|
var exports_runtime = {};
|
|
33935
33964
|
__export(exports_runtime, {
|
|
33936
33965
|
queueJobs: () => queueJobs,
|
|
@@ -33941,7 +33970,7 @@ var init_runtime = __esm(() => {
|
|
|
33941
33970
|
init_queue_jobs();
|
|
33942
33971
|
});
|
|
33943
33972
|
|
|
33944
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
33973
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
|
|
33945
33974
|
var exports_bun_sqlite = {};
|
|
33946
33975
|
__export(exports_bun_sqlite, {
|
|
33947
33976
|
BunSqliteAdapter: () => BunSqliteAdapter
|
|
@@ -34232,7 +34261,7 @@ var init_d1 = __esm(() => {
|
|
|
34232
34261
|
init_session3();
|
|
34233
34262
|
});
|
|
34234
34263
|
|
|
34235
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34264
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
|
|
34236
34265
|
var exports_d1 = {};
|
|
34237
34266
|
__export(exports_d1, {
|
|
34238
34267
|
D1Adapter: () => D1Adapter
|
|
@@ -34296,7 +34325,7 @@ var init_d12 = __esm(() => {
|
|
|
34296
34325
|
init_runtime();
|
|
34297
34326
|
});
|
|
34298
34327
|
|
|
34299
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34328
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/adapter.js
|
|
34300
34329
|
async function createDbAdapter(config3) {
|
|
34301
34330
|
switch (config3.driver) {
|
|
34302
34331
|
case "bun-sqlite": {
|
|
@@ -34336,7 +34365,7 @@ var init_drizzle_orm = __esm(() => {
|
|
|
34336
34365
|
init_view_common();
|
|
34337
34366
|
});
|
|
34338
34367
|
|
|
34339
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34368
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/query-spec.js
|
|
34340
34369
|
function compilePredicate(predicate) {
|
|
34341
34370
|
if ("and" in predicate) {
|
|
34342
34371
|
const parts = predicate.and.map(compilePredicate).filter((p) => p !== undefined);
|
|
@@ -34374,7 +34403,7 @@ var init_query_spec = __esm(() => {
|
|
|
34374
34403
|
};
|
|
34375
34404
|
});
|
|
34376
34405
|
|
|
34377
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34406
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/base-dao.js
|
|
34378
34407
|
function asSelectQuery(query) {
|
|
34379
34408
|
return query;
|
|
34380
34409
|
}
|
|
@@ -34416,7 +34445,7 @@ var init_base_dao = __esm(() => {
|
|
|
34416
34445
|
init_query_spec();
|
|
34417
34446
|
});
|
|
34418
34447
|
|
|
34419
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34448
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
|
|
34420
34449
|
var embeddedMigrations;
|
|
34421
34450
|
var init_embedded_migrations = __esm(() => {
|
|
34422
34451
|
embeddedMigrations = [
|
|
@@ -34448,7 +34477,7 @@ var init_embedded_migrations = __esm(() => {
|
|
|
34448
34477
|
];
|
|
34449
34478
|
});
|
|
34450
34479
|
|
|
34451
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34480
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
|
|
34452
34481
|
var EntityDao;
|
|
34453
34482
|
var init_entity_dao = __esm(() => {
|
|
34454
34483
|
init_drizzle_orm();
|
|
@@ -34610,7 +34639,7 @@ var init_entity_dao = __esm(() => {
|
|
|
34610
34639
|
};
|
|
34611
34640
|
});
|
|
34612
34641
|
|
|
34613
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34642
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
|
|
34614
34643
|
function isPromiseLike(value) {
|
|
34615
34644
|
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
34616
34645
|
}
|
|
@@ -34648,7 +34677,11 @@ var init_inbox_message_dao = __esm(() => {
|
|
|
34648
34677
|
});
|
|
34649
34678
|
return id;
|
|
34650
34679
|
}
|
|
34651
|
-
async drainPending(toId) {
|
|
34680
|
+
async drainPending(toId, options) {
|
|
34681
|
+
const limit = options?.limit ?? 100;
|
|
34682
|
+
if (!Number.isInteger(limit) || limit <= 0) {
|
|
34683
|
+
throw new RangeError(`drainPending limit must be a positive integer; received ${limit}`);
|
|
34684
|
+
}
|
|
34652
34685
|
const now = this.now();
|
|
34653
34686
|
const rows = await this.db.update(inboxMessages).set({
|
|
34654
34687
|
status: "injected",
|
|
@@ -34660,6 +34693,7 @@ var init_inbox_message_dao = __esm(() => {
|
|
|
34660
34693
|
WHERE to_id = ${toId}
|
|
34661
34694
|
AND status = 'queued'
|
|
34662
34695
|
ORDER BY created_at
|
|
34696
|
+
LIMIT ${limit}
|
|
34663
34697
|
)
|
|
34664
34698
|
AND ${inboxMessages.status} = 'queued'`).returning();
|
|
34665
34699
|
for (const row of rows) {
|
|
@@ -34783,7 +34817,7 @@ var init_migrator2 = __esm(() => {
|
|
|
34783
34817
|
init_migrator();
|
|
34784
34818
|
});
|
|
34785
34819
|
|
|
34786
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34820
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/migrate.js
|
|
34787
34821
|
async function ensureJournalTable(adapter, table3) {
|
|
34788
34822
|
await adapter.exec(`CREATE TABLE IF NOT EXISTS "${table3}" (` + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "hash text NOT NULL, " + "created_at numeric" + ")");
|
|
34789
34823
|
}
|
|
@@ -34858,7 +34892,7 @@ var init_migrate = __esm(() => {
|
|
|
34858
34892
|
init_embedded_migrations();
|
|
34859
34893
|
});
|
|
34860
34894
|
|
|
34861
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
34895
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
|
|
34862
34896
|
var QueueJobDao;
|
|
34863
34897
|
var init_queue_job_dao = __esm(() => {
|
|
34864
34898
|
init_drizzle_orm();
|
|
@@ -34999,7 +35033,7 @@ var init_queue_job_dao = __esm(() => {
|
|
|
34999
35033
|
};
|
|
35000
35034
|
});
|
|
35001
35035
|
|
|
35002
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
35036
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/index.js
|
|
35003
35037
|
var exports_dist = {};
|
|
35004
35038
|
__export(exports_dist, {
|
|
35005
35039
|
embeddedMigrations: () => embeddedMigrations,
|
|
@@ -35010,11 +35044,9 @@ __export(exports_dist, {
|
|
|
35010
35044
|
QueueJobDao: () => QueueJobDao,
|
|
35011
35045
|
InboxMessageDao: () => InboxMessageDao,
|
|
35012
35046
|
EntityDao: () => EntityDao,
|
|
35013
|
-
D1Adapter: () => D1Adapter,
|
|
35014
35047
|
BaseDao: () => BaseDao
|
|
35015
35048
|
});
|
|
35016
35049
|
var init_dist4 = __esm(() => {
|
|
35017
|
-
init_d12();
|
|
35018
35050
|
init_base_dao();
|
|
35019
35051
|
init_embedded_migrations();
|
|
35020
35052
|
init_entity_dao();
|
|
@@ -37487,7 +37519,7 @@ var init_src = __esm(() => {
|
|
|
37487
37519
|
});
|
|
37488
37520
|
});
|
|
37489
37521
|
|
|
37490
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37522
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
37491
37523
|
function parseYamlObject(text3) {
|
|
37492
37524
|
let parsed;
|
|
37493
37525
|
try {
|
|
@@ -37614,7 +37646,7 @@ var init_config2 = __esm(() => {
|
|
|
37614
37646
|
};
|
|
37615
37647
|
});
|
|
37616
37648
|
|
|
37617
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37649
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
37618
37650
|
import { appendFileSync as appendFileSync3, cpSync as cpSync2, createReadStream as createReadStream3, createWriteStream as createWriteStream3, existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, realpathSync as realpathSync2, renameSync as renameSync2, rmSync as rmSync2, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
37619
37651
|
import { dirname as dirname2, resolve as resolvePath3 } from "path";
|
|
37620
37652
|
function createNodeFileSystem3(root, paths) {
|
|
@@ -37701,7 +37733,7 @@ function findProjectRoot3(startDir) {
|
|
|
37701
37733
|
}
|
|
37702
37734
|
var init_file_system_node2 = () => {};
|
|
37703
37735
|
|
|
37704
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37736
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
|
|
37705
37737
|
var D1NotConfiguredError2, DbModuleNotInstalledError3;
|
|
37706
37738
|
var init_db_errors2 = __esm(() => {
|
|
37707
37739
|
D1NotConfiguredError2 = class D1NotConfiguredError2 extends Error {
|
|
@@ -37718,7 +37750,7 @@ var init_db_errors2 = __esm(() => {
|
|
|
37718
37750
|
};
|
|
37719
37751
|
});
|
|
37720
37752
|
|
|
37721
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37753
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
|
|
37722
37754
|
function createCfFileSystem2() {
|
|
37723
37755
|
return {
|
|
37724
37756
|
getProjectRoot: () => "/bundle",
|
|
@@ -37757,7 +37789,7 @@ function createCfFileSystem2() {
|
|
|
37757
37789
|
}
|
|
37758
37790
|
var UNSUPPORTED = "FileSystem is not available on Cloudflare Workers. Use D1, KV, or R2 for persistent storage.";
|
|
37759
37791
|
|
|
37760
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37792
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
|
|
37761
37793
|
var exports_runtime_cf = {};
|
|
37762
37794
|
__export(exports_runtime_cf, {
|
|
37763
37795
|
cloudflareWorkersFactory: () => cloudflareWorkersFactory2
|
|
@@ -37795,8 +37827,27 @@ var init_runtime_cf = __esm(() => {
|
|
|
37795
37827
|
};
|
|
37796
37828
|
});
|
|
37797
37829
|
|
|
37798
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
37830
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
|
|
37799
37831
|
import { isatty as isatty2 } from "tty";
|
|
37832
|
+
function processEventSeverity2(reason, exitCode) {
|
|
37833
|
+
if (reason === "error")
|
|
37834
|
+
return "error";
|
|
37835
|
+
if (reason === "timeout")
|
|
37836
|
+
return "warning";
|
|
37837
|
+
if (exitCode !== null && exitCode !== 0)
|
|
37838
|
+
return "warning";
|
|
37839
|
+
return "info";
|
|
37840
|
+
}
|
|
37841
|
+
function resolveChildEnv2(env, envMode) {
|
|
37842
|
+
if (envMode === "replace")
|
|
37843
|
+
return env;
|
|
37844
|
+
const merged = {};
|
|
37845
|
+
for (const [key, value] of Object.entries(getProcessEnv2())) {
|
|
37846
|
+
if (value !== undefined)
|
|
37847
|
+
merged[key] = value;
|
|
37848
|
+
}
|
|
37849
|
+
return { ...merged, ...env };
|
|
37850
|
+
}
|
|
37800
37851
|
|
|
37801
37852
|
class NodeProcessExecutor3 {
|
|
37802
37853
|
config;
|
|
@@ -37834,6 +37885,7 @@ class NodeProcessExecutor3 {
|
|
|
37834
37885
|
durationMs: 0,
|
|
37835
37886
|
reason: "exit",
|
|
37836
37887
|
timestamp: startedIso,
|
|
37888
|
+
severity: "info",
|
|
37837
37889
|
...options.label !== undefined ? { label: options.label } : {}
|
|
37838
37890
|
});
|
|
37839
37891
|
try {
|
|
@@ -37904,6 +37956,7 @@ class NodeProcessExecutor3 {
|
|
|
37904
37956
|
durationMs: 0,
|
|
37905
37957
|
reason: "exit",
|
|
37906
37958
|
timestamp: startedIso,
|
|
37959
|
+
severity: "info",
|
|
37907
37960
|
...options.label !== undefined ? { label: options.label } : {}
|
|
37908
37961
|
});
|
|
37909
37962
|
const subprocess = Bun.spawn({
|
|
@@ -37912,7 +37965,7 @@ class NodeProcessExecutor3 {
|
|
|
37912
37965
|
stdout: "pipe",
|
|
37913
37966
|
stderr: "pipe",
|
|
37914
37967
|
...options.cwd !== undefined ? { cwd: options.cwd } : {},
|
|
37915
|
-
...options.env !== undefined ? { env: options.env } : {}
|
|
37968
|
+
...options.env !== undefined ? { env: resolveChildEnv2(options.env, options.envMode) } : {}
|
|
37916
37969
|
});
|
|
37917
37970
|
const pipe2 = new BunPipeProcess2(subprocess);
|
|
37918
37971
|
if (pipe2.pid !== null) {
|
|
@@ -37935,6 +37988,7 @@ class NodeProcessExecutor3 {
|
|
|
37935
37988
|
durationMs: 0,
|
|
37936
37989
|
reason: "error",
|
|
37937
37990
|
timestamp: new Date().toISOString(),
|
|
37991
|
+
severity: processEventSeverity2("error", null),
|
|
37938
37992
|
...options.label !== undefined ? { label: options.label } : {},
|
|
37939
37993
|
error: errorMessage2(error51)
|
|
37940
37994
|
});
|
|
@@ -37978,6 +38032,7 @@ class NodeProcessExecutor3 {
|
|
|
37978
38032
|
durationMs: result.durationMs,
|
|
37979
38033
|
reason,
|
|
37980
38034
|
timestamp: new Date().toISOString(),
|
|
38035
|
+
severity: processEventSeverity2(reason, result.exitCode),
|
|
37981
38036
|
...options.label !== undefined ? { label: options.label } : {},
|
|
37982
38037
|
...error51 !== undefined ? { error: errorMessage2(error51) } : {}
|
|
37983
38038
|
});
|
|
@@ -38008,6 +38063,7 @@ class ObservedPipeProcess2 {
|
|
|
38008
38063
|
durationMs: Date.now() - context2.startedAt,
|
|
38009
38064
|
reason: this.killedWith !== undefined ? "signal" : "exit",
|
|
38010
38065
|
timestamp: new Date().toISOString(),
|
|
38066
|
+
severity: processEventSeverity2(this.killedWith !== undefined ? "signal" : "exit", exitCode),
|
|
38011
38067
|
...context2.label !== undefined ? { label: context2.label } : {}
|
|
38012
38068
|
});
|
|
38013
38069
|
return exitCode;
|
|
@@ -38178,10 +38234,11 @@ function errorMessage2(error51) {
|
|
|
38178
38234
|
var ProcessExecutor2;
|
|
38179
38235
|
var init_process_executor2 = __esm(() => {
|
|
38180
38236
|
init_execa();
|
|
38237
|
+
init_config2();
|
|
38181
38238
|
ProcessExecutor2 = NodeProcessExecutor3;
|
|
38182
38239
|
});
|
|
38183
38240
|
|
|
38184
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38241
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
|
|
38185
38242
|
var exports_runtime_node_bun = {};
|
|
38186
38243
|
__export(exports_runtime_node_bun, {
|
|
38187
38244
|
nodeBunFactory: () => nodeBunFactory3,
|
|
@@ -38249,7 +38306,7 @@ var init_runtime_node_bun2 = __esm(() => {
|
|
|
38249
38306
|
};
|
|
38250
38307
|
});
|
|
38251
38308
|
|
|
38252
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38309
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/platform.js
|
|
38253
38310
|
function isCloudflareWorkerRuntime2() {
|
|
38254
38311
|
return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") ?? false;
|
|
38255
38312
|
}
|
|
@@ -38279,7 +38336,7 @@ function _resetRuntimeFactory2() {
|
|
|
38279
38336
|
}
|
|
38280
38337
|
var _factory, _runtimeName;
|
|
38281
38338
|
|
|
38282
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38339
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
38283
38340
|
class RuntimeContext2 {
|
|
38284
38341
|
scope;
|
|
38285
38342
|
runtimeName;
|
|
@@ -38369,7 +38426,7 @@ var init_context2 = __esm(() => {
|
|
|
38369
38426
|
init_runtime_node_bun2();
|
|
38370
38427
|
});
|
|
38371
38428
|
|
|
38372
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38429
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
38373
38430
|
function normalizeSeparators2(path7) {
|
|
38374
38431
|
return path7.replaceAll("\\", "/");
|
|
38375
38432
|
}
|
|
@@ -38492,7 +38549,7 @@ var init_path2 = __esm(() => {
|
|
|
38492
38549
|
SEP2 = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
38493
38550
|
});
|
|
38494
38551
|
|
|
38495
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38552
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/fs.js
|
|
38496
38553
|
async function ensureDirForFile2(path7, fs2 = createNodeFileSystem3()) {
|
|
38497
38554
|
await fs2.ensureDir(dirnamePath(path7));
|
|
38498
38555
|
}
|
|
@@ -38507,27 +38564,44 @@ async function atomicWriteJson2(path7, value, fs2 = createNodeFileSystem3()) {
|
|
|
38507
38564
|
`, fs2);
|
|
38508
38565
|
}
|
|
38509
38566
|
async function readJsonFile2(path7, fs2 = createNodeFileSystem3()) {
|
|
38510
|
-
|
|
38567
|
+
const content = await fs2.readFile(path7);
|
|
38568
|
+
try {
|
|
38569
|
+
return JSON.parse(content);
|
|
38570
|
+
} catch (error51) {
|
|
38571
|
+
throw new Error(`Failed to parse JSON file "${path7}": ${error51.message}`);
|
|
38572
|
+
}
|
|
38511
38573
|
}
|
|
38512
38574
|
async function writeJsonFile2(path7, value, fs2 = createNodeFileSystem3()) {
|
|
38513
38575
|
await fs2.writeFile(path7, `${JSON.stringify(value, null, 2)}
|
|
38514
38576
|
`);
|
|
38515
38577
|
}
|
|
38516
38578
|
async function walkDir2(path7, fs2 = createNodeFileSystem3(), exclude) {
|
|
38517
|
-
const
|
|
38579
|
+
const startReal = fs2.realPath?.(path7) ?? path7;
|
|
38580
|
+
const visited = new Set([startReal]);
|
|
38518
38581
|
const result = [];
|
|
38582
|
+
await walkDirInto(path7, fs2, exclude, startReal, visited, result);
|
|
38583
|
+
return result;
|
|
38584
|
+
}
|
|
38585
|
+
async function walkDirInto(path7, fs2, exclude, startReal, visited, result) {
|
|
38586
|
+
const entries = (await fs2.readDir(path7)).sort();
|
|
38519
38587
|
for (const entry of entries) {
|
|
38520
38588
|
if (exclude?.has(entry))
|
|
38521
38589
|
continue;
|
|
38522
38590
|
const fullPath = joinPath2(path7, entry);
|
|
38523
38591
|
const entryStat = await fs2.stat(fullPath);
|
|
38524
38592
|
if (entryStat?.isDirectory()) {
|
|
38525
|
-
|
|
38593
|
+
const entryReal = fs2.realPath?.(fullPath) ?? fullPath;
|
|
38594
|
+
if (visited.has(entryReal))
|
|
38595
|
+
continue;
|
|
38596
|
+
if (fs2.realPath !== undefined && entryReal !== startReal && !entryReal.startsWith(`${startReal}/`) && !entryReal.startsWith(`${startReal}\\`)) {
|
|
38597
|
+
continue;
|
|
38598
|
+
}
|
|
38599
|
+
visited.add(entryReal);
|
|
38600
|
+
await walkDirInto(fullPath, fs2, exclude, startReal, visited, result);
|
|
38526
38601
|
} else if (entryStat?.isFile()) {
|
|
38527
38602
|
result.push(fullPath);
|
|
38528
38603
|
}
|
|
38529
38604
|
}
|
|
38530
|
-
return result;
|
|
38531
38605
|
}
|
|
38532
38606
|
function createLogStream2(path7, fs2 = createNodeFileSystem3()) {
|
|
38533
38607
|
return fs2.createWriteStream(path7);
|
|
@@ -38543,7 +38617,7 @@ var init_fs = __esm(() => {
|
|
|
38543
38617
|
init_path2();
|
|
38544
38618
|
});
|
|
38545
38619
|
|
|
38546
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38620
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
|
|
38547
38621
|
function allocateId() {
|
|
38548
38622
|
nextIdSeq += 1;
|
|
38549
38623
|
return `pe_${Date.now().toString(36)}_${nextIdSeq.toString(36)}`;
|
|
@@ -38667,7 +38741,7 @@ function createInMemoryProcessRegistry2(options) {
|
|
|
38667
38741
|
}
|
|
38668
38742
|
var nextIdSeq = 0;
|
|
38669
38743
|
|
|
38670
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38744
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/runtime-paths.js
|
|
38671
38745
|
function ambientRuntimePaths2() {
|
|
38672
38746
|
const cwd = getProcessCwd2();
|
|
38673
38747
|
return { cwd, home: getHomeDir() ?? cwd };
|
|
@@ -38677,18 +38751,25 @@ var init_runtime_paths = __esm(() => {
|
|
|
38677
38751
|
init_path2();
|
|
38678
38752
|
});
|
|
38679
38753
|
|
|
38680
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
38754
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
38681
38755
|
async function loadStructuredConfig(path7, options = {}) {
|
|
38682
38756
|
const content = await (options.fileSystem ?? createNodeFileSystem3()).readFile(path7);
|
|
38683
38757
|
return await parseStructuredConfig(content, path7, options);
|
|
38684
38758
|
}
|
|
38685
38759
|
async function parseStructuredConfig(content, source, options = {}) {
|
|
38686
|
-
const parsed = source.endsWith(".json") ?
|
|
38760
|
+
const parsed = source.endsWith(".json") ? parseJsonContent(content, source) : $parse(content);
|
|
38687
38761
|
if (options.validateSchema !== false) {
|
|
38688
38762
|
await validateDeclaredJsonSchema(parsed, source, options);
|
|
38689
38763
|
}
|
|
38690
38764
|
return parsed;
|
|
38691
38765
|
}
|
|
38766
|
+
function parseJsonContent(content, source) {
|
|
38767
|
+
try {
|
|
38768
|
+
return JSON.parse(content);
|
|
38769
|
+
} catch (error51) {
|
|
38770
|
+
throw new StructuredConfigSchemaError(`Failed to parse JSON config "${source}": ${error51.message}`);
|
|
38771
|
+
}
|
|
38772
|
+
}
|
|
38692
38773
|
async function validateDeclaredJsonSchema(value, source, options = {}) {
|
|
38693
38774
|
if (!isObject3(value))
|
|
38694
38775
|
return;
|
|
@@ -38848,11 +38929,10 @@ function splitPackageSpecifier(specifier) {
|
|
|
38848
38929
|
}
|
|
38849
38930
|
async function readSchema(schemaLocation, options) {
|
|
38850
38931
|
if (isRemoteRef(schemaLocation)) {
|
|
38851
|
-
|
|
38852
|
-
|
|
38853
|
-
throw new StructuredConfigSchemaError(`Refusing to fetch remote JSON schema "${schemaLocation}": pass a fetch implementation to opt in`);
|
|
38932
|
+
if (options.allowRemote !== true || options.fetch === undefined) {
|
|
38933
|
+
throw new StructuredConfigSchemaError(`Refusing to fetch remote JSON schema "${schemaLocation}": pass both allowRemote: true and a fetch implementation to opt in`);
|
|
38854
38934
|
}
|
|
38855
|
-
const response = await
|
|
38935
|
+
const response = await options.fetch(schemaLocation);
|
|
38856
38936
|
if (!response.ok) {
|
|
38857
38937
|
throw new StructuredConfigSchemaError(`Failed to fetch JSON schema "${schemaLocation}": HTTP ${response.status}`);
|
|
38858
38938
|
}
|
|
@@ -38954,10 +39034,10 @@ var init_schema_validation2 = __esm(() => {
|
|
|
38954
39034
|
defaultResolve = typeof Bun !== "undefined" ? (specifier, from) => Bun.resolveSync(specifier, from) : undefined;
|
|
38955
39035
|
});
|
|
38956
39036
|
|
|
38957
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
39037
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
38958
39038
|
var init_types2 = () => {};
|
|
38959
39039
|
|
|
38960
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
39040
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
38961
39041
|
var exports_dist2 = {};
|
|
38962
39042
|
__export(exports_dist2, {
|
|
38963
39043
|
writeJsonFile: () => writeJsonFile2,
|
|
@@ -41108,7 +41188,7 @@ var init_mod = __esm(() => {
|
|
|
41108
41188
|
init_config3();
|
|
41109
41189
|
});
|
|
41110
41190
|
|
|
41111
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
41191
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/logger.js
|
|
41112
41192
|
function toLogTapeLevel(level) {
|
|
41113
41193
|
return level === "warn" ? "warning" : level;
|
|
41114
41194
|
}
|
|
@@ -42661,7 +42741,7 @@ var require_src = __commonJS((exports) => {
|
|
|
42661
42741
|
};
|
|
42662
42742
|
});
|
|
42663
42743
|
|
|
42664
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
42744
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
|
|
42665
42745
|
function getTelemetryConfig(configPartial = {}) {
|
|
42666
42746
|
return {
|
|
42667
42747
|
enabled: configPartial.enabled ?? CONFIG_DEFAULTS.enabled,
|
|
@@ -42697,7 +42777,7 @@ var init_sdk = __esm(() => {
|
|
|
42697
42777
|
resolvedConfig = getTelemetryConfig();
|
|
42698
42778
|
});
|
|
42699
42779
|
|
|
42700
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
42780
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
|
|
42701
42781
|
function isSuppressed(tracer2) {
|
|
42702
42782
|
return tracer2 === undefined && !getResolvedConfig().enabled;
|
|
42703
42783
|
}
|
|
@@ -42737,7 +42817,7 @@ var init_tracing2 = __esm(() => {
|
|
|
42737
42817
|
import_api2 = __toESM(require_src(), 1);
|
|
42738
42818
|
});
|
|
42739
42819
|
|
|
42740
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
42820
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
|
|
42741
42821
|
function getMeter() {
|
|
42742
42822
|
return import_api3.metrics.getMeter(METER_NAME, METER_VERSION);
|
|
42743
42823
|
}
|
|
@@ -42834,7 +42914,7 @@ var init_metrics = __esm(() => {
|
|
|
42834
42914
|
instruments = {};
|
|
42835
42915
|
});
|
|
42836
42916
|
|
|
42837
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
42917
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
|
|
42838
42918
|
function busLogger() {
|
|
42839
42919
|
if (!_busLogger)
|
|
42840
42920
|
_busLogger = getLogger2("event-bus");
|
|
@@ -42969,7 +43049,15 @@ class EventBus {
|
|
|
42969
43049
|
getEventbusEmitsTotal().add(1, { event: eventName });
|
|
42970
43050
|
if (errors6 > 0)
|
|
42971
43051
|
getEventbusErrorsTotal().add(errors6, { event: eventName });
|
|
42972
|
-
this.publishEmitDone({
|
|
43052
|
+
this.publishEmitDone({
|
|
43053
|
+
event: eventName,
|
|
43054
|
+
syncCount,
|
|
43055
|
+
asyncCount,
|
|
43056
|
+
emitDurationMs: durationMs,
|
|
43057
|
+
errors: errors6,
|
|
43058
|
+
detail,
|
|
43059
|
+
severity: errors6 > 0 ? "warning" : "info"
|
|
43060
|
+
});
|
|
42973
43061
|
if (syncCount === 0 && asyncCount === 0) {
|
|
42974
43062
|
busLogger().debug("emit with zero handlers", { event: eventName });
|
|
42975
43063
|
this.publishEmitNoop(eventName);
|
|
@@ -43052,13 +43140,13 @@ class EventBus {
|
|
|
43052
43140
|
publishEmitNoop(event) {
|
|
43053
43141
|
if (this.lifecycleBus) {
|
|
43054
43142
|
try {
|
|
43055
|
-
this.lifecycleBus.emit("bus.emit.noop", { event });
|
|
43143
|
+
this.lifecycleBus.emit("bus.emit.noop", { event, severity: "info" });
|
|
43056
43144
|
} catch {}
|
|
43057
43145
|
}
|
|
43058
43146
|
}
|
|
43059
43147
|
publishHandlerError(event, mode, error51) {
|
|
43060
43148
|
if (this.lifecycleBus) {
|
|
43061
|
-
const detail = { event, mode, error: error51 };
|
|
43149
|
+
const detail = { event, mode, error: error51, severity: "error" };
|
|
43062
43150
|
try {
|
|
43063
43151
|
this.lifecycleBus.emit("bus.handler.error", detail);
|
|
43064
43152
|
} catch {}
|
|
@@ -43066,7 +43154,7 @@ class EventBus {
|
|
|
43066
43154
|
}
|
|
43067
43155
|
publishAsyncEnqueued(event, jobId, handlerCount) {
|
|
43068
43156
|
if (this.lifecycleBus) {
|
|
43069
|
-
const detail = { event, jobId, handlerCount };
|
|
43157
|
+
const detail = { event, jobId, handlerCount, severity: "info" };
|
|
43070
43158
|
try {
|
|
43071
43159
|
this.lifecycleBus.emit("bus.handler.async.enqueued", detail);
|
|
43072
43160
|
} catch {}
|
|
@@ -43079,7 +43167,7 @@ var init_event_bus = __esm(() => {
|
|
|
43079
43167
|
init_metrics();
|
|
43080
43168
|
});
|
|
43081
43169
|
|
|
43082
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
43170
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
|
|
43083
43171
|
function obsLogger() {
|
|
43084
43172
|
if (!_obsLogger)
|
|
43085
43173
|
_obsLogger = getLogger2("event-bus.observers");
|
|
@@ -43143,7 +43231,7 @@ var init_default_observers = __esm(() => {
|
|
|
43143
43231
|
init_event_bus();
|
|
43144
43232
|
});
|
|
43145
43233
|
|
|
43146
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
43234
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
|
|
43147
43235
|
function parentDir(filePath) {
|
|
43148
43236
|
const idx = filePath.lastIndexOf("/");
|
|
43149
43237
|
return idx <= 0 ? "." : filePath.slice(0, idx);
|
|
@@ -43241,7 +43329,7 @@ var init_file_observer = __esm(() => {
|
|
|
43241
43329
|
init_logger3();
|
|
43242
43330
|
});
|
|
43243
43331
|
|
|
43244
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
43332
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/internals/drain.js
|
|
43245
43333
|
function settleWithin(promise2, deadline) {
|
|
43246
43334
|
const remaining = deadline - Date.now();
|
|
43247
43335
|
if (remaining <= 0)
|
|
@@ -43256,7 +43344,7 @@ function settleWithin(promise2, deadline) {
|
|
|
43256
43344
|
return settled;
|
|
43257
43345
|
}
|
|
43258
43346
|
|
|
43259
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
43347
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
|
|
43260
43348
|
function parseInterval(cron) {
|
|
43261
43349
|
const trimmed = cron.trim();
|
|
43262
43350
|
const num = Number(trimmed);
|
|
@@ -43265,16 +43353,17 @@ function parseInterval(cron) {
|
|
|
43265
43353
|
return num;
|
|
43266
43354
|
} else {
|
|
43267
43355
|
const parts = trimmed.split(/\s+/);
|
|
43268
|
-
|
|
43356
|
+
const restWild = parts.length === 5 && parts[1] === "*" && parts[2] === "*" && parts[3] === "*" && parts[4] === "*";
|
|
43357
|
+
if (restWild && parts[0] === "*") {
|
|
43269
43358
|
return 60000;
|
|
43270
43359
|
}
|
|
43271
|
-
const
|
|
43360
|
+
const nField = restWild ? parts[0] : parts.length === 1 ? parts[0] : undefined;
|
|
43361
|
+
const match = nField?.match(/^\*\/(\d+)$/);
|
|
43272
43362
|
if (match && Number(match[1]) > 0) {
|
|
43273
43363
|
return Number(match[1]) * 60000;
|
|
43274
43364
|
}
|
|
43275
43365
|
}
|
|
43276
|
-
|
|
43277
|
-
return 60000;
|
|
43366
|
+
throw new RangeError(`Unsupported cron expression: "${cron}" \u2014 supported forms are a positive millisecond number, "* * * * *", or "*/N * * * *" with N > 0`);
|
|
43278
43367
|
}
|
|
43279
43368
|
|
|
43280
43369
|
class NodeSchedulerAdapter {
|
|
@@ -43290,6 +43379,7 @@ class NodeSchedulerAdapter {
|
|
|
43290
43379
|
this.drainTimeoutMs = drainTimeoutMs ?? 30000;
|
|
43291
43380
|
}
|
|
43292
43381
|
register(cron, action) {
|
|
43382
|
+
parseInterval(cron);
|
|
43293
43383
|
this.entries.push({ cron, action });
|
|
43294
43384
|
if (this.running) {
|
|
43295
43385
|
const last = this.entries[this.entries.length - 1];
|
|
@@ -43345,11 +43435,10 @@ class NodeSchedulerAdapter {
|
|
|
43345
43435
|
}
|
|
43346
43436
|
}
|
|
43347
43437
|
var init_node3 = __esm(() => {
|
|
43348
|
-
init_logger3();
|
|
43349
43438
|
init_metrics();
|
|
43350
43439
|
});
|
|
43351
43440
|
|
|
43352
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
43441
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/scheduler-node.js
|
|
43353
43442
|
var exports_scheduler_node = {};
|
|
43354
43443
|
__export(exports_scheduler_node, {
|
|
43355
43444
|
NodeSchedulerAdapter: () => NodeSchedulerAdapter
|
|
@@ -49606,6 +49695,18 @@ var init_errors5 = __esm(() => {
|
|
|
49606
49695
|
});
|
|
49607
49696
|
|
|
49608
49697
|
// ../../packages/app/src/observability/agent-execution.ts
|
|
49698
|
+
function executionSeverity(detail) {
|
|
49699
|
+
if (detail.kind === "dropped")
|
|
49700
|
+
return "warning";
|
|
49701
|
+
if (detail.kind === "finished") {
|
|
49702
|
+
if (detail.outcome === "failed")
|
|
49703
|
+
return "error";
|
|
49704
|
+
if (detail.outcome === "cancelled")
|
|
49705
|
+
return "warning";
|
|
49706
|
+
}
|
|
49707
|
+
return "info";
|
|
49708
|
+
}
|
|
49709
|
+
|
|
49609
49710
|
class AgentExecutionLifecycle {
|
|
49610
49711
|
observer;
|
|
49611
49712
|
secrets;
|
|
@@ -49732,6 +49833,7 @@ class AgentExecutionLifecycle {
|
|
|
49732
49833
|
sequence: this.sequence,
|
|
49733
49834
|
runId: this.correlation.runId,
|
|
49734
49835
|
executionId: this.correlation.executionId,
|
|
49836
|
+
severity: executionSeverity(detail),
|
|
49735
49837
|
...this.correlation.actionId !== undefined ? { actionId: this.correlation.actionId } : {},
|
|
49736
49838
|
...this.pid !== undefined ? { pid: this.pid } : {},
|
|
49737
49839
|
at: new Date().toISOString()
|
|
@@ -49840,7 +49942,11 @@ class ObservableWorkflowAdapter {
|
|
|
49840
49942
|
}
|
|
49841
49943
|
async finalizeRun(runId, status, completedAt) {
|
|
49842
49944
|
await this.inner.finalizeRun(runId, status, completedAt);
|
|
49843
|
-
await this.bus.emit("workflow.run.finalized", {
|
|
49945
|
+
await this.bus.emit("workflow.run.finalized", {
|
|
49946
|
+
...this.envelope(runId, completedAt),
|
|
49947
|
+
status,
|
|
49948
|
+
severity: status === "failed" ? "error" : status === "paused" ? "warning" : "info"
|
|
49949
|
+
});
|
|
49844
49950
|
}
|
|
49845
49951
|
async savePhase(runId, phase, status) {
|
|
49846
49952
|
await this.inner.savePhase(runId, phase, status);
|
|
@@ -49874,8 +49980,8 @@ class ObservableWorkflowAdapter {
|
|
|
49874
49980
|
});
|
|
49875
49981
|
return actionId;
|
|
49876
49982
|
}
|
|
49877
|
-
async saveActionFinalize(actionId, status, durationMs, ok, result, redactor) {
|
|
49878
|
-
await this.inner.saveActionFinalize(actionId, status, durationMs, ok, result, redactor);
|
|
49983
|
+
async saveActionFinalize(actionId, status, durationMs, ok, kind, result, redactor) {
|
|
49984
|
+
await this.inner.saveActionFinalize(actionId, status, durationMs, ok, kind, result, redactor);
|
|
49879
49985
|
const action = this.actions.get(actionId);
|
|
49880
49986
|
if (action === undefined) {
|
|
49881
49987
|
return;
|
|
@@ -49890,7 +49996,8 @@ class ObservableWorkflowAdapter {
|
|
|
49890
49996
|
ok,
|
|
49891
49997
|
node: action.node,
|
|
49892
49998
|
kind: action.kind,
|
|
49893
|
-
...projected !== undefined ? { result: projected } : {}
|
|
49999
|
+
...projected !== undefined ? { result: projected } : {},
|
|
50000
|
+
severity: ok ? "info" : "error"
|
|
49894
50001
|
});
|
|
49895
50002
|
}
|
|
49896
50003
|
envelope(runId, at = now()) {
|
|
@@ -49903,7 +50010,8 @@ class ObservableWorkflowAdapter {
|
|
|
49903
50010
|
sequence,
|
|
49904
50011
|
runId,
|
|
49905
50012
|
...workflowName !== undefined ? { workflowName } : {},
|
|
49906
|
-
at
|
|
50013
|
+
at,
|
|
50014
|
+
severity: "info"
|
|
49907
50015
|
};
|
|
49908
50016
|
}
|
|
49909
50017
|
saveWorkflowState(runId, state, data) {
|
|
@@ -51801,7 +51909,7 @@ var init_drizzle_zod = __esm(() => {
|
|
|
51801
51909
|
};
|
|
51802
51910
|
});
|
|
51803
51911
|
|
|
51804
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
51912
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
|
|
51805
51913
|
function sqlExpressionToText(value) {
|
|
51806
51914
|
if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
|
|
51807
51915
|
return;
|
|
@@ -51824,7 +51932,7 @@ function getDrizzleTableName(table3) {
|
|
|
51824
51932
|
return String(table3[nameSym]);
|
|
51825
51933
|
}
|
|
51826
51934
|
|
|
51827
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
51935
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
|
|
51828
51936
|
function quoteIdent(name) {
|
|
51829
51937
|
return `"${name.replace(/"/g, '""')}"`;
|
|
51830
51938
|
}
|
|
@@ -51918,7 +52026,7 @@ var init_ddl = __esm(() => {
|
|
|
51918
52026
|
init_sqlite_core();
|
|
51919
52027
|
});
|
|
51920
52028
|
|
|
51921
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
52029
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
|
|
51922
52030
|
function defineTable(name, columns2) {
|
|
51923
52031
|
const table3 = sqliteTable(name, columns2);
|
|
51924
52032
|
let insert2;
|
|
@@ -51952,7 +52060,7 @@ var init_define_table = __esm(() => {
|
|
|
51952
52060
|
init_ddl();
|
|
51953
52061
|
});
|
|
51954
52062
|
|
|
51955
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.
|
|
52063
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.4.30+5312b088c68fcacf/node_modules/@gobing-ai/ts-db/dist/schema/index.js
|
|
51956
52064
|
var init_schema = __esm(() => {
|
|
51957
52065
|
init_sqlite_core();
|
|
51958
52066
|
init_define_table();
|
|
@@ -52577,7 +52685,7 @@ var init_dao = __esm(() => {
|
|
|
52577
52685
|
init_workspace_dao();
|
|
52578
52686
|
});
|
|
52579
52687
|
|
|
52580
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
52688
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
|
|
52581
52689
|
var WorkflowValidationError, FSMError, RunCollisionError, WorkflowResumeError;
|
|
52582
52690
|
var init_errors6 = __esm(() => {
|
|
52583
52691
|
WorkflowValidationError = class WorkflowValidationError extends Error {
|
|
@@ -52612,12 +52720,12 @@ var init_errors6 = __esm(() => {
|
|
|
52612
52720
|
};
|
|
52613
52721
|
});
|
|
52614
52722
|
|
|
52615
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
52723
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
|
|
52616
52724
|
var init_event_bus2 = __esm(() => {
|
|
52617
52725
|
init_event_bus();
|
|
52618
52726
|
});
|
|
52619
52727
|
|
|
52620
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
52728
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/api-client.js
|
|
52621
52729
|
function sanitizeUrlForObservability(url2) {
|
|
52622
52730
|
try {
|
|
52623
52731
|
const parsed = new URL(url2);
|
|
@@ -52689,7 +52797,8 @@ class APIClient {
|
|
|
52689
52797
|
url: url2,
|
|
52690
52798
|
method,
|
|
52691
52799
|
...status !== undefined ? { status } : {},
|
|
52692
|
-
error: error51
|
|
52800
|
+
error: error51,
|
|
52801
|
+
severity: "error"
|
|
52693
52802
|
});
|
|
52694
52803
|
}
|
|
52695
52804
|
async runRequest(method, url2, headers, body, opts, redirect, consume) {
|
|
@@ -52847,12 +52956,12 @@ var init_api_client = __esm(() => {
|
|
|
52847
52956
|
};
|
|
52848
52957
|
});
|
|
52849
52958
|
|
|
52850
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
52959
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
|
|
52851
52960
|
var init_telemetry = __esm(() => {
|
|
52852
52961
|
init_tracing2();
|
|
52853
52962
|
});
|
|
52854
52963
|
|
|
52855
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
52964
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/index.js
|
|
52856
52965
|
var init_dist6 = __esm(() => {
|
|
52857
52966
|
init_api_client();
|
|
52858
52967
|
init_event_bus2();
|
|
@@ -52860,7 +52969,7 @@ var init_dist6 = __esm(() => {
|
|
|
52860
52969
|
init_telemetry();
|
|
52861
52970
|
});
|
|
52862
52971
|
|
|
52863
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
52972
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
|
|
52864
52973
|
function runtimeBuiltins(workflowName, stateOrNodeId, runId, transitionsTaken, mode) {
|
|
52865
52974
|
return {
|
|
52866
52975
|
workflow: workflowName,
|
|
@@ -52921,7 +53030,8 @@ class RunLifecycle {
|
|
|
52921
53030
|
mode,
|
|
52922
53031
|
runId: lifecycle.runId,
|
|
52923
53032
|
dryRun: options.dryRun ?? false,
|
|
52924
|
-
externalKey: extKey
|
|
53033
|
+
externalKey: extKey,
|
|
53034
|
+
severity: "info"
|
|
52925
53035
|
});
|
|
52926
53036
|
return await loop(lifecycle);
|
|
52927
53037
|
}, { attributes: { "workflow.name": workflowName, "workflow.mode": mode } });
|
|
@@ -52949,7 +53059,8 @@ class RunLifecycle {
|
|
|
52949
53059
|
this.events?.emit("workflow.node.enter", {
|
|
52950
53060
|
runId: this.runId,
|
|
52951
53061
|
node: stateOrNodeId,
|
|
52952
|
-
transitionsTaken
|
|
53062
|
+
transitionsTaken,
|
|
53063
|
+
severity: "info"
|
|
52953
53064
|
});
|
|
52954
53065
|
}
|
|
52955
53066
|
async commitHop(from, to, trigger, transitionsTaken, phase, vars) {
|
|
@@ -52968,7 +53079,8 @@ class RunLifecycle {
|
|
|
52968
53079
|
from,
|
|
52969
53080
|
to,
|
|
52970
53081
|
trigger,
|
|
52971
|
-
externalKey: this.externalKey
|
|
53082
|
+
externalKey: this.externalKey,
|
|
53083
|
+
severity: "info"
|
|
52972
53084
|
});
|
|
52973
53085
|
}
|
|
52974
53086
|
async recordTransition(from, to, trigger) {
|
|
@@ -52984,7 +53096,8 @@ class RunLifecycle {
|
|
|
52984
53096
|
from,
|
|
52985
53097
|
to,
|
|
52986
53098
|
trigger,
|
|
52987
|
-
externalKey: this.externalKey
|
|
53099
|
+
externalKey: this.externalKey,
|
|
53100
|
+
severity: "info"
|
|
52988
53101
|
});
|
|
52989
53102
|
}
|
|
52990
53103
|
async done(finalState, transitionsTaken) {
|
|
@@ -52996,7 +53109,8 @@ class RunLifecycle {
|
|
|
52996
53109
|
runId: this.runId,
|
|
52997
53110
|
finalState,
|
|
52998
53111
|
transitionsTaken,
|
|
52999
|
-
externalKey: this.externalKey
|
|
53112
|
+
externalKey: this.externalKey,
|
|
53113
|
+
severity: "info"
|
|
53000
53114
|
});
|
|
53001
53115
|
return this.result("done", finalState, transitionsTaken);
|
|
53002
53116
|
}
|
|
@@ -53008,7 +53122,8 @@ class RunLifecycle {
|
|
|
53008
53122
|
runId: this.runId,
|
|
53009
53123
|
finalState,
|
|
53010
53124
|
reason,
|
|
53011
|
-
externalKey: this.externalKey
|
|
53125
|
+
externalKey: this.externalKey,
|
|
53126
|
+
severity: "error"
|
|
53012
53127
|
});
|
|
53013
53128
|
this.logger.warn("workflow run failed", { finalState, transitionsTaken, reason });
|
|
53014
53129
|
return this.result("failed", finalState, transitionsTaken, reason);
|
|
@@ -53026,17 +53141,28 @@ class RunLifecycle {
|
|
|
53026
53141
|
runId: this.runId,
|
|
53027
53142
|
node: stateOrNodeId,
|
|
53028
53143
|
transitionsTaken,
|
|
53029
|
-
externalKey: this.externalKey
|
|
53144
|
+
externalKey: this.externalKey,
|
|
53145
|
+
severity: "warning"
|
|
53030
53146
|
});
|
|
53031
53147
|
return this.result("paused", stateOrNodeId, transitionsTaken);
|
|
53032
53148
|
}
|
|
53033
53149
|
emitResumed(node) {
|
|
53034
53150
|
addSpanEvent("workflow.run.resumed", { runId: this.runId, node });
|
|
53035
|
-
this.events?.emit("workflow.run.resumed", {
|
|
53151
|
+
this.events?.emit("workflow.run.resumed", {
|
|
53152
|
+
runId: this.runId,
|
|
53153
|
+
node,
|
|
53154
|
+
externalKey: this.externalKey,
|
|
53155
|
+
severity: "info"
|
|
53156
|
+
});
|
|
53036
53157
|
}
|
|
53037
53158
|
actionStart(stateOrNodeId, kind) {
|
|
53038
53159
|
addSpanEvent("workflow.action.start", { runId: this.runId, node: stateOrNodeId, kind });
|
|
53039
|
-
this.events?.emit("workflow.action.start", {
|
|
53160
|
+
this.events?.emit("workflow.action.start", {
|
|
53161
|
+
runId: this.runId,
|
|
53162
|
+
node: stateOrNodeId,
|
|
53163
|
+
kind,
|
|
53164
|
+
severity: "info"
|
|
53165
|
+
});
|
|
53040
53166
|
}
|
|
53041
53167
|
actionDone(stateOrNodeId, kind, durationMs, ok) {
|
|
53042
53168
|
addSpanEvent("workflow.action.done", { runId: this.runId, node: stateOrNodeId, kind, durationMs, ok });
|
|
@@ -53045,7 +53171,8 @@ class RunLifecycle {
|
|
|
53045
53171
|
node: stateOrNodeId,
|
|
53046
53172
|
kind,
|
|
53047
53173
|
durationMs,
|
|
53048
|
-
ok
|
|
53174
|
+
ok,
|
|
53175
|
+
severity: ok ? "info" : "error"
|
|
53049
53176
|
});
|
|
53050
53177
|
}
|
|
53051
53178
|
warnActionFailed(stateOrNodeId, transitionsTaken, error51) {
|
|
@@ -53059,7 +53186,8 @@ class RunLifecycle {
|
|
|
53059
53186
|
runId: this.runId,
|
|
53060
53187
|
node: stateOrNodeId,
|
|
53061
53188
|
transitionsTaken,
|
|
53062
|
-
...error51 === undefined ? {} : { error: error51 }
|
|
53189
|
+
...error51 === undefined ? {} : { error: error51 },
|
|
53190
|
+
severity: "warning"
|
|
53063
53191
|
});
|
|
53064
53192
|
this.logger.warn("action failed (continuing)", { node: stateOrNodeId, transitionsTaken, error: error51 });
|
|
53065
53193
|
}
|
|
@@ -53070,14 +53198,20 @@ class RunLifecycle {
|
|
|
53070
53198
|
to,
|
|
53071
53199
|
kind,
|
|
53072
53200
|
passed,
|
|
53073
|
-
externalKey: this.externalKey
|
|
53201
|
+
externalKey: this.externalKey,
|
|
53202
|
+
severity: passed ? "info" : "warning"
|
|
53074
53203
|
});
|
|
53075
53204
|
}
|
|
53076
53205
|
hitlAsk(node, kind, message) {
|
|
53077
|
-
this.events?.emit("workflow.hitl.ask", { runId: this.runId, node, kind, message });
|
|
53206
|
+
this.events?.emit("workflow.hitl.ask", { runId: this.runId, node, kind, message, severity: "info" });
|
|
53078
53207
|
}
|
|
53079
53208
|
hitlResponse(node, ok) {
|
|
53080
|
-
this.events?.emit("workflow.hitl.response", {
|
|
53209
|
+
this.events?.emit("workflow.hitl.response", {
|
|
53210
|
+
runId: this.runId,
|
|
53211
|
+
node,
|
|
53212
|
+
ok,
|
|
53213
|
+
severity: ok ? "info" : "warning"
|
|
53214
|
+
});
|
|
53081
53215
|
}
|
|
53082
53216
|
result(status, finalState, transitionsTaken, reason) {
|
|
53083
53217
|
return {
|
|
@@ -53119,7 +53253,7 @@ var init_run_lifecycle = __esm(() => {
|
|
|
53119
53253
|
];
|
|
53120
53254
|
});
|
|
53121
53255
|
|
|
53122
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
53256
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
|
|
53123
53257
|
var RESERVED_VAR_NAMES, IDENTIFIER, VarsSchema, EnvSchema, ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema;
|
|
53124
53258
|
var init_schema2 = __esm(() => {
|
|
53125
53259
|
init_zod();
|
|
@@ -53204,7 +53338,7 @@ var init_schema2 = __esm(() => {
|
|
|
53204
53338
|
WorkflowDefSchema = exports_external.union([StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema]);
|
|
53205
53339
|
});
|
|
53206
53340
|
|
|
53207
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
53341
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
|
|
53208
53342
|
async function loadWorkflowDef(path9, options = {}) {
|
|
53209
53343
|
return parseWorkflowDef(await loadStructuredConfig(path9, options), path9);
|
|
53210
53344
|
}
|
|
@@ -53371,7 +53505,7 @@ var init_config4 = __esm(() => {
|
|
|
53371
53505
|
RUNTIME_TEMPLATE_NAMESPACES = new Set(RUNTIME_BUILTIN_KEYS);
|
|
53372
53506
|
});
|
|
53373
53507
|
|
|
53374
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
53508
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
|
|
53375
53509
|
class CapabilityRegistry {
|
|
53376
53510
|
kind;
|
|
53377
53511
|
capabilities = new Map;
|
|
@@ -53402,7 +53536,7 @@ class CapabilityRegistry {
|
|
|
53402
53536
|
}
|
|
53403
53537
|
}
|
|
53404
53538
|
|
|
53405
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
53539
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
|
|
53406
53540
|
function assertRelativeExtensionPath(path9, options = {}) {
|
|
53407
53541
|
const where = options.sourceName !== undefined ? ` declared by "${options.sourceName}"` : "";
|
|
53408
53542
|
if (/^([/\\]|[A-Za-z]:[/\\])/.test(path9)) {
|
|
@@ -53413,20 +53547,20 @@ function assertRelativeExtensionPath(path9, options = {}) {
|
|
|
53413
53547
|
}
|
|
53414
53548
|
}
|
|
53415
53549
|
|
|
53416
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
53550
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
|
|
53417
53551
|
var init_extension_loader = () => {};
|
|
53418
53552
|
|
|
53419
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
53553
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
|
|
53420
53554
|
var init_extension = __esm(() => {
|
|
53421
53555
|
init_extension_loader();
|
|
53422
53556
|
});
|
|
53423
53557
|
|
|
53424
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
53558
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.30+396850f04496a471/node_modules/@gobing-ai/ts-runtime/dist/extension.js
|
|
53425
53559
|
var init_extension2 = __esm(() => {
|
|
53426
53560
|
init_extension();
|
|
53427
53561
|
});
|
|
53428
53562
|
|
|
53429
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
53563
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
|
|
53430
53564
|
class WorkflowEngineHost {
|
|
53431
53565
|
lifecycleBus;
|
|
53432
53566
|
actions = new CapabilityRegistry("workflow action");
|
|
@@ -53497,7 +53631,8 @@ class NoteActionRunner {
|
|
|
53497
53631
|
context4?.events?.emit("workflow.hitl.note", {
|
|
53498
53632
|
runId: context4.runId,
|
|
53499
53633
|
node: context4.stateOrNodeId,
|
|
53500
|
-
message
|
|
53634
|
+
message,
|
|
53635
|
+
severity: "info"
|
|
53501
53636
|
});
|
|
53502
53637
|
return { ok: true, data: { message } };
|
|
53503
53638
|
}
|
|
@@ -53510,7 +53645,7 @@ class EventEmitActionRunner {
|
|
|
53510
53645
|
if (!name)
|
|
53511
53646
|
return { ok: false, error: 'event.emit requires a non-empty "name" option' };
|
|
53512
53647
|
const payload = options.payload ?? {};
|
|
53513
|
-
context4?.events?.emit("workflow.custom", { name, payload });
|
|
53648
|
+
context4?.events?.emit("workflow.custom", { name, payload, severity: "info" });
|
|
53514
53649
|
return { ok: true, data: { name, payload } };
|
|
53515
53650
|
}
|
|
53516
53651
|
}
|
|
@@ -53595,7 +53730,7 @@ var init_host = __esm(() => {
|
|
|
53595
53730
|
init_errors6();
|
|
53596
53731
|
});
|
|
53597
53732
|
|
|
53598
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
53733
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
|
|
53599
53734
|
var WORKFLOW_ENGINE_SCHEMA_SQL;
|
|
53600
53735
|
var init_schema_sql = __esm(() => {
|
|
53601
53736
|
WORKFLOW_ENGINE_SCHEMA_SQL = `
|
|
@@ -53668,7 +53803,7 @@ CREATE TABLE IF NOT EXISTS action_runs (
|
|
|
53668
53803
|
`.trim();
|
|
53669
53804
|
});
|
|
53670
53805
|
|
|
53671
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
53806
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
|
|
53672
53807
|
async function applyWorkflowEngineSchema(db2) {
|
|
53673
53808
|
for (const statement of WORKFLOW_ENGINE_SCHEMA_SQL.split(";")) {
|
|
53674
53809
|
const sql4 = statement.trim();
|
|
@@ -53676,6 +53811,25 @@ async function applyWorkflowEngineSchema(db2) {
|
|
|
53676
53811
|
await db2.exec(sql4);
|
|
53677
53812
|
}
|
|
53678
53813
|
}
|
|
53814
|
+
function isRecord(value) {
|
|
53815
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53816
|
+
}
|
|
53817
|
+
function defaultActionRedactor(kind, payload) {
|
|
53818
|
+
if (kind !== "shell")
|
|
53819
|
+
return payload;
|
|
53820
|
+
const data = isRecord(payload.data) ? { ...payload.data } : payload.data;
|
|
53821
|
+
if (isRecord(data)) {
|
|
53822
|
+
if ("stdout" in data)
|
|
53823
|
+
data.stdout = "[redacted]";
|
|
53824
|
+
if ("stderr" in data)
|
|
53825
|
+
data.stderr = "[redacted]";
|
|
53826
|
+
}
|
|
53827
|
+
return { ...payload, data };
|
|
53828
|
+
}
|
|
53829
|
+
function applyRedactor(redactor, kind, result) {
|
|
53830
|
+
const payload = isRecord(result) ? result : { value: result };
|
|
53831
|
+
return redactor !== undefined ? redactor(kind, payload) : defaultActionRedactor(kind, payload);
|
|
53832
|
+
}
|
|
53679
53833
|
|
|
53680
53834
|
class DbWorkflowPersistenceAdapter {
|
|
53681
53835
|
db;
|
|
@@ -53768,11 +53922,11 @@ class DbWorkflowPersistenceAdapter {
|
|
|
53768
53922
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, id, runId, node, kind, "running", new Date(now2).toISOString(), now2, now2);
|
|
53769
53923
|
return id;
|
|
53770
53924
|
}
|
|
53771
|
-
async saveActionFinalize(actionId, status, durationMs, ok, result,
|
|
53925
|
+
async saveActionFinalize(actionId, status, durationMs, ok, kind, result, redactor) {
|
|
53772
53926
|
const now2 = Date.now();
|
|
53773
53927
|
await this.db.run(`UPDATE action_runs
|
|
53774
53928
|
SET status = ?, duration_ms = ?, ok = ?, result_json = ?, completed_at = ?, updated_at = ?
|
|
53775
|
-
WHERE id = ?`, status, durationMs, ok ? 1 : 0, result !== undefined ? JSON.stringify(result) : null, new Date(now2).toISOString(), now2, actionId);
|
|
53929
|
+
WHERE id = ?`, status, durationMs, ok ? 1 : 0, result !== undefined ? JSON.stringify(applyRedactor(redactor, kind, result)) : null, new Date(now2).toISOString(), now2, actionId);
|
|
53776
53930
|
}
|
|
53777
53931
|
async loadRun(runId) {
|
|
53778
53932
|
await this.ensureSchema();
|
|
@@ -53808,11 +53962,15 @@ class DbWorkflowPersistenceAdapter {
|
|
|
53808
53962
|
return { ...record2 };
|
|
53809
53963
|
}
|
|
53810
53964
|
async reseedRun(runId, newState) {
|
|
53811
|
-
const now2 = Date.now();
|
|
53812
53965
|
await this.ensureSchema();
|
|
53813
|
-
const previous = await this.
|
|
53814
|
-
|
|
53815
|
-
|
|
53966
|
+
const previous = await this.loadLatestStateSnapshot(runId);
|
|
53967
|
+
const now2 = Date.now();
|
|
53968
|
+
const data = {
|
|
53969
|
+
...previous?.data ?? {},
|
|
53970
|
+
reseeded: true,
|
|
53971
|
+
reseededAt: new Date(now2).toISOString()
|
|
53972
|
+
};
|
|
53973
|
+
await this.commitTransition(runId, previous?.state ?? "", newState, "__reseed__", newState, data);
|
|
53816
53974
|
return { fromState: previous?.state ?? null, toState: newState };
|
|
53817
53975
|
}
|
|
53818
53976
|
async loadCurrentState(runId) {
|
|
@@ -53880,14 +54038,14 @@ class MemoryWorkflowPersistenceAdapter {
|
|
|
53880
54038
|
});
|
|
53881
54039
|
return id;
|
|
53882
54040
|
}
|
|
53883
|
-
async saveActionFinalize(actionId, status, durationMs, ok, result,
|
|
54041
|
+
async saveActionFinalize(actionId, status, durationMs, ok, kind, result, redactor) {
|
|
53884
54042
|
const row = this.actionRuns.find((a2) => a2.id === actionId);
|
|
53885
54043
|
if (row === undefined)
|
|
53886
54044
|
return;
|
|
53887
54045
|
row.status = status;
|
|
53888
54046
|
row.durationMs = durationMs;
|
|
53889
54047
|
row.ok = ok ? 1 : 0;
|
|
53890
|
-
row.resultJson = result !== undefined ? JSON.stringify(result) : null;
|
|
54048
|
+
row.resultJson = result !== undefined ? JSON.stringify(applyRedactor(redactor, kind, result)) : null;
|
|
53891
54049
|
}
|
|
53892
54050
|
async savePhase(runId, phase, status) {
|
|
53893
54051
|
this.phases.push({ runId, phase, status });
|
|
@@ -53928,9 +54086,13 @@ class MemoryWorkflowPersistenceAdapter {
|
|
|
53928
54086
|
return { ...record2 };
|
|
53929
54087
|
}
|
|
53930
54088
|
async reseedRun(runId, newState) {
|
|
53931
|
-
const previous = this.
|
|
53932
|
-
|
|
53933
|
-
|
|
54089
|
+
const previous = await this.loadLatestStateSnapshot(runId);
|
|
54090
|
+
const data = {
|
|
54091
|
+
...previous?.data ?? {},
|
|
54092
|
+
reseeded: true,
|
|
54093
|
+
reseededAt: new Date().toISOString()
|
|
54094
|
+
};
|
|
54095
|
+
await this.commitTransition(runId, previous?.state ?? "", newState, "__reseed__", newState, data);
|
|
53934
54096
|
return { fromState: previous?.state ?? null, toState: newState };
|
|
53935
54097
|
}
|
|
53936
54098
|
async loadCurrentState(runId) {
|
|
@@ -53957,7 +54119,7 @@ var init_persistence = __esm(() => {
|
|
|
53957
54119
|
init_schema_sql();
|
|
53958
54120
|
});
|
|
53959
54121
|
|
|
53960
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54122
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
|
|
53961
54123
|
function mergeVars(workflowVars = {}, overrideVars = {}) {
|
|
53962
54124
|
return { ...workflowVars, ...overrideVars };
|
|
53963
54125
|
}
|
|
@@ -54017,7 +54179,7 @@ var init_variables = __esm(() => {
|
|
|
54017
54179
|
TEMPLATE_REF = /\$\{([^}]+)\}/g;
|
|
54018
54180
|
});
|
|
54019
54181
|
|
|
54020
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54182
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
|
|
54021
54183
|
async function runActionStep(action, vars, deps) {
|
|
54022
54184
|
const { host, persistence, lifecycle, stateOrNodeId, runId } = deps;
|
|
54023
54185
|
const resolved = resolveTemplates(action.options ?? {}, {
|
|
@@ -54043,7 +54205,7 @@ async function runActionStep(action, vars, deps) {
|
|
|
54043
54205
|
} finally {
|
|
54044
54206
|
const durationMs = Date.now() - actionStartMs;
|
|
54045
54207
|
lifecycle.actionDone(stateOrNodeId, action.kind, durationMs, result?.ok ?? false);
|
|
54046
|
-
persistence.saveActionFinalize(actionId, result?.ok !== false ? "done" : "failed", durationMs, result?.ok ?? false, result).catch(() => {
|
|
54208
|
+
persistence.saveActionFinalize(actionId, result?.ok !== false ? "done" : "failed", durationMs, result?.ok ?? false, action.kind, result, deps.options.redactor ?? defaultActionRedactor).catch(() => {
|
|
54047
54209
|
return;
|
|
54048
54210
|
});
|
|
54049
54211
|
}
|
|
@@ -54071,11 +54233,12 @@ async function runActionSequence(actions, vars, deps) {
|
|
|
54071
54233
|
return { outcome: "completed", result: last };
|
|
54072
54234
|
}
|
|
54073
54235
|
var init_action_step = __esm(() => {
|
|
54236
|
+
init_persistence();
|
|
54074
54237
|
init_run_lifecycle();
|
|
54075
54238
|
init_variables();
|
|
54076
54239
|
});
|
|
54077
54240
|
|
|
54078
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54241
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
|
|
54079
54242
|
class StateMachineDriver {
|
|
54080
54243
|
options;
|
|
54081
54244
|
constructor(options) {
|
|
@@ -54211,7 +54374,7 @@ var init_state_machine = __esm(() => {
|
|
|
54211
54374
|
EMPTY_OUTCOME = { outcome: "completed", result: undefined };
|
|
54212
54375
|
});
|
|
54213
54376
|
|
|
54214
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54377
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
|
|
54215
54378
|
class TransitionFlowDriver {
|
|
54216
54379
|
options;
|
|
54217
54380
|
constructor(options) {
|
|
@@ -54330,7 +54493,7 @@ var init_transition_flow = __esm(() => {
|
|
|
54330
54493
|
init_variables();
|
|
54331
54494
|
});
|
|
54332
54495
|
|
|
54333
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54496
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
|
|
54334
54497
|
class WorkflowService {
|
|
54335
54498
|
host;
|
|
54336
54499
|
persistence;
|
|
@@ -54405,7 +54568,8 @@ class WorkflowService {
|
|
|
54405
54568
|
runId,
|
|
54406
54569
|
fromState: result.fromState ?? "",
|
|
54407
54570
|
toState: result.toState,
|
|
54408
|
-
externalKey: extKey
|
|
54571
|
+
externalKey: extKey,
|
|
54572
|
+
severity: "warning"
|
|
54409
54573
|
});
|
|
54410
54574
|
}
|
|
54411
54575
|
async resumeRun(workflow, runId, options) {
|
|
@@ -54427,7 +54591,12 @@ class WorkflowService {
|
|
|
54427
54591
|
const extKey = run.external_key ?? undefined;
|
|
54428
54592
|
await this.persistence.finalizeRun(runId, "running", "");
|
|
54429
54593
|
const events = this.resolveEvents(mergedOptions.events);
|
|
54430
|
-
events?.emit("workflow.run.resumed", {
|
|
54594
|
+
events?.emit("workflow.run.resumed", {
|
|
54595
|
+
runId,
|
|
54596
|
+
node: currentState,
|
|
54597
|
+
externalKey: extKey,
|
|
54598
|
+
severity: "info"
|
|
54599
|
+
});
|
|
54431
54600
|
if (workflow.kind === "transition-flow") {
|
|
54432
54601
|
return await new TransitionFlowDriver({
|
|
54433
54602
|
host: this.host,
|
|
@@ -54507,7 +54676,8 @@ class WorkflowService {
|
|
|
54507
54676
|
from: currentState,
|
|
54508
54677
|
to: toState,
|
|
54509
54678
|
trigger,
|
|
54510
|
-
externalKey: extKey
|
|
54679
|
+
externalKey: extKey,
|
|
54680
|
+
severity: "info"
|
|
54511
54681
|
});
|
|
54512
54682
|
return { allowed: true, fromState: currentState, toState };
|
|
54513
54683
|
}
|
|
@@ -54517,7 +54687,8 @@ class WorkflowService {
|
|
|
54517
54687
|
from,
|
|
54518
54688
|
to,
|
|
54519
54689
|
reason: denial.reason,
|
|
54520
|
-
externalKey
|
|
54690
|
+
externalKey,
|
|
54691
|
+
severity: "error"
|
|
54521
54692
|
});
|
|
54522
54693
|
return { allowed: false, ...denial };
|
|
54523
54694
|
}
|
|
@@ -54547,7 +54718,7 @@ var init_service = __esm(() => {
|
|
|
54547
54718
|
init_variables();
|
|
54548
54719
|
});
|
|
54549
54720
|
|
|
54550
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.
|
|
54721
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
|
|
54551
54722
|
var init_dist7 = __esm(() => {
|
|
54552
54723
|
init_config4();
|
|
54553
54724
|
init_host();
|
|
@@ -54556,7 +54727,7 @@ var init_dist7 = __esm(() => {
|
|
|
54556
54727
|
init_service();
|
|
54557
54728
|
});
|
|
54558
54729
|
|
|
54559
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
54730
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
|
|
54560
54731
|
import { createHash as createHash2 } from "crypto";
|
|
54561
54732
|
function stableJson(value) {
|
|
54562
54733
|
if (Array.isArray(value)) {
|
|
@@ -54573,7 +54744,7 @@ function sha256(value) {
|
|
|
54573
54744
|
}
|
|
54574
54745
|
var init_hash = () => {};
|
|
54575
54746
|
|
|
54576
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
54747
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
|
|
54577
54748
|
var HistoryImportError;
|
|
54578
54749
|
var init_errors7 = __esm(() => {
|
|
54579
54750
|
HistoryImportError = class HistoryImportError extends Error {
|
|
@@ -54586,7 +54757,7 @@ var init_errors7 = __esm(() => {
|
|
|
54586
54757
|
};
|
|
54587
54758
|
});
|
|
54588
54759
|
|
|
54589
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
54760
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
|
|
54590
54761
|
var HISTORY_IMPORT_SCHEMA_SQL;
|
|
54591
54762
|
var init_schema_sql2 = __esm(() => {
|
|
54592
54763
|
HISTORY_IMPORT_SCHEMA_SQL = `
|
|
@@ -54608,69 +54779,6 @@ CREATE TABLE IF NOT EXISTS history_import_ledger (
|
|
|
54608
54779
|
imported_at TEXT NOT NULL
|
|
54609
54780
|
);
|
|
54610
54781
|
|
|
54611
|
-
CREATE TABLE IF NOT EXISTS history_etl_pi (
|
|
54612
|
-
record_hash TEXT PRIMARY KEY,
|
|
54613
|
-
source_file TEXT NOT NULL,
|
|
54614
|
-
source_line INTEGER NOT NULL,
|
|
54615
|
-
split_index INTEGER NOT NULL,
|
|
54616
|
-
payload_json TEXT NOT NULL,
|
|
54617
|
-
imported_at TEXT NOT NULL
|
|
54618
|
-
);
|
|
54619
|
-
|
|
54620
|
-
CREATE TABLE IF NOT EXISTS history_etl_claude (
|
|
54621
|
-
record_hash TEXT PRIMARY KEY,
|
|
54622
|
-
source_file TEXT NOT NULL,
|
|
54623
|
-
source_line INTEGER NOT NULL,
|
|
54624
|
-
split_index INTEGER NOT NULL,
|
|
54625
|
-
payload_json TEXT NOT NULL,
|
|
54626
|
-
imported_at TEXT NOT NULL
|
|
54627
|
-
);
|
|
54628
|
-
|
|
54629
|
-
CREATE TABLE IF NOT EXISTS history_etl_codex (
|
|
54630
|
-
record_hash TEXT PRIMARY KEY,
|
|
54631
|
-
source_file TEXT NOT NULL,
|
|
54632
|
-
source_line INTEGER NOT NULL,
|
|
54633
|
-
split_index INTEGER NOT NULL,
|
|
54634
|
-
payload_json TEXT NOT NULL,
|
|
54635
|
-
imported_at TEXT NOT NULL
|
|
54636
|
-
);
|
|
54637
|
-
|
|
54638
|
-
CREATE TABLE IF NOT EXISTS history_etl_gemini (
|
|
54639
|
-
record_hash TEXT PRIMARY KEY,
|
|
54640
|
-
source_file TEXT NOT NULL,
|
|
54641
|
-
source_line INTEGER NOT NULL,
|
|
54642
|
-
split_index INTEGER NOT NULL,
|
|
54643
|
-
payload_json TEXT NOT NULL,
|
|
54644
|
-
imported_at TEXT NOT NULL
|
|
54645
|
-
);
|
|
54646
|
-
|
|
54647
|
-
CREATE TABLE IF NOT EXISTS history_etl_opencode (
|
|
54648
|
-
record_hash TEXT PRIMARY KEY,
|
|
54649
|
-
source_file TEXT NOT NULL,
|
|
54650
|
-
source_line INTEGER NOT NULL,
|
|
54651
|
-
split_index INTEGER NOT NULL,
|
|
54652
|
-
payload_json TEXT NOT NULL,
|
|
54653
|
-
imported_at TEXT NOT NULL
|
|
54654
|
-
);
|
|
54655
|
-
|
|
54656
|
-
CREATE TABLE IF NOT EXISTS history_etl_antigravity (
|
|
54657
|
-
record_hash TEXT PRIMARY KEY,
|
|
54658
|
-
source_file TEXT NOT NULL,
|
|
54659
|
-
source_line INTEGER NOT NULL,
|
|
54660
|
-
split_index INTEGER NOT NULL,
|
|
54661
|
-
payload_json TEXT NOT NULL,
|
|
54662
|
-
imported_at TEXT NOT NULL
|
|
54663
|
-
);
|
|
54664
|
-
|
|
54665
|
-
CREATE TABLE IF NOT EXISTS history_etl_openclaw (
|
|
54666
|
-
record_hash TEXT PRIMARY KEY,
|
|
54667
|
-
source_file TEXT NOT NULL,
|
|
54668
|
-
source_line INTEGER NOT NULL,
|
|
54669
|
-
split_index INTEGER NOT NULL,
|
|
54670
|
-
payload_json TEXT NOT NULL,
|
|
54671
|
-
imported_at TEXT NOT NULL
|
|
54672
|
-
);
|
|
54673
|
-
|
|
54674
54782
|
CREATE TABLE IF NOT EXISTS history_message (
|
|
54675
54783
|
record_hash TEXT PRIMARY KEY,
|
|
54676
54784
|
source TEXT NOT NULL,
|
|
@@ -54730,7 +54838,7 @@ CREATE INDEX IF NOT EXISTS idx_history_tool_call_message_hash
|
|
|
54730
54838
|
`.trim();
|
|
54731
54839
|
});
|
|
54732
54840
|
|
|
54733
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
54841
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/mappers.js
|
|
54734
54842
|
function identityFieldMap(keys) {
|
|
54735
54843
|
const map2 = {};
|
|
54736
54844
|
for (const key of keys) {
|
|
@@ -55794,7 +55902,7 @@ var init_mappers = __esm(() => {
|
|
|
55794
55902
|
GEMINI_SCHEMA = passthroughSchema;
|
|
55795
55903
|
});
|
|
55796
55904
|
|
|
55797
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
55905
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
|
|
55798
55906
|
function firstString(...values) {
|
|
55799
55907
|
for (const value of values) {
|
|
55800
55908
|
if (typeof value === "string" && value.length > 0)
|
|
@@ -55948,7 +56056,7 @@ var init_sources = __esm(() => {
|
|
|
55948
56056
|
};
|
|
55949
56057
|
});
|
|
55950
56058
|
|
|
55951
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
56059
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/jsonl-importer-dao.js
|
|
55952
56060
|
function targetTableFor(table3) {
|
|
55953
56061
|
if (!VALID_TABLE_NAME.test(table3)) {
|
|
55954
56062
|
throw new HistoryImportError(`Invalid history ETL target table: ${table3}`, { table: table3 });
|
|
@@ -55975,6 +56083,9 @@ async function applyHistoryImportSchema(db2) {
|
|
|
55975
56083
|
await db2.exec(sql4);
|
|
55976
56084
|
}
|
|
55977
56085
|
}
|
|
56086
|
+
for (const definition of Object.values(SOURCE_DEFINITIONS)) {
|
|
56087
|
+
await ensureTargetTables(db2, definition);
|
|
56088
|
+
}
|
|
55978
56089
|
}
|
|
55979
56090
|
async function ensureTargetTables(db2, definition) {
|
|
55980
56091
|
const tables = new Set([targetTableFor(definition.targetTable)]);
|
|
@@ -55996,18 +56107,7 @@ async function resetCheckpoints(db2, source, files) {
|
|
|
55996
56107
|
await db2.run("DELETE FROM history_import_checkpoint WHERE source = ? AND source_file = ?", source, file2);
|
|
55997
56108
|
}
|
|
55998
56109
|
}
|
|
55999
|
-
|
|
56000
|
-
await db2.run(`INSERT INTO history_import_checkpoint (source, source_file, last_imported_line, updated_at)
|
|
56001
|
-
VALUES (?, ?, ?, ?)
|
|
56002
|
-
ON CONFLICT(source, source_file) DO UPDATE SET
|
|
56003
|
-
last_imported_line = excluded.last_imported_line,
|
|
56004
|
-
updated_at = excluded.updated_at`, source, sourceFile, line, timestamp(now2));
|
|
56005
|
-
}
|
|
56006
|
-
async function ledgerExists(db2, recordHash) {
|
|
56007
|
-
const row = await db2.queryFirst("SELECT record_hash FROM history_import_ledger WHERE record_hash = ?", recordHash);
|
|
56008
|
-
return row !== undefined && row !== null;
|
|
56009
|
-
}
|
|
56010
|
-
async function insertRecord(db2, targetTable, recordHash, sourceFile, sourceLine, splitIndex, payload, now2) {
|
|
56110
|
+
function recordInsertOp(targetTable, recordHash, sourceFile, sourceLine, splitIndex, payload, now2) {
|
|
56011
56111
|
const table3 = targetTableFor(targetTable);
|
|
56012
56112
|
const typedColumns = TYPED_TABLE_COLUMNS[table3];
|
|
56013
56113
|
if (typedColumns !== undefined) {
|
|
@@ -56024,25 +56124,47 @@ async function insertRecord(db2, targetTable, recordHash, sourceFile, sourceLine
|
|
|
56024
56124
|
const v = payload[col];
|
|
56025
56125
|
return v === undefined ? null : v;
|
|
56026
56126
|
});
|
|
56027
|
-
|
|
56028
|
-
|
|
56029
|
-
|
|
56030
|
-
|
|
56031
|
-
|
|
56032
|
-
|
|
56033
|
-
} else {
|
|
56034
|
-
if (!_ensuredTables.has(table3)) {
|
|
56035
|
-
await db2.exec(ETL_TABLE_DDL(table3));
|
|
56036
|
-
_ensuredTables.add(table3);
|
|
56037
|
-
}
|
|
56038
|
-
await db2.run(`INSERT INTO ${table3} (record_hash, source_file, source_line, split_index, payload_json, imported_at)
|
|
56039
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
56040
|
-
ON CONFLICT(record_hash) DO NOTHING`, recordHash, sourceFile, sourceLine, splitIndex, JSON.stringify(payload), timestamp(now2));
|
|
56127
|
+
return {
|
|
56128
|
+
sql: `INSERT INTO ${table3} (${typedColumns.join(", ")})
|
|
56129
|
+
VALUES (${typedColumns.map(() => "?").join(", ")})
|
|
56130
|
+
ON CONFLICT(record_hash) DO NOTHING`,
|
|
56131
|
+
params: values
|
|
56132
|
+
};
|
|
56041
56133
|
}
|
|
56134
|
+
return {
|
|
56135
|
+
sql: `INSERT INTO ${table3} (record_hash, source_file, source_line, split_index, payload_json, imported_at)
|
|
56136
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
56137
|
+
ON CONFLICT(record_hash) DO NOTHING`,
|
|
56138
|
+
params: [recordHash, sourceFile, sourceLine, splitIndex, JSON.stringify(payload), timestamp(now2)]
|
|
56139
|
+
};
|
|
56042
56140
|
}
|
|
56043
|
-
|
|
56044
|
-
|
|
56045
|
-
|
|
56141
|
+
function ledgerInsertOp(recordHash, source, sourceFile, sourceLine, splitIndex, targetTable, now2) {
|
|
56142
|
+
return {
|
|
56143
|
+
sql: `INSERT INTO history_import_ledger (record_hash, source, source_file, source_line, split_index, target_table, imported_at)
|
|
56144
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
56145
|
+
params: [recordHash, source, sourceFile, sourceLine, splitIndex, targetTable, timestamp(now2)]
|
|
56146
|
+
};
|
|
56147
|
+
}
|
|
56148
|
+
function checkpointUpsertOp(source, sourceFile, line, now2) {
|
|
56149
|
+
return {
|
|
56150
|
+
sql: `INSERT INTO history_import_checkpoint (source, source_file, last_imported_line, updated_at)
|
|
56151
|
+
VALUES (?, ?, ?, ?)
|
|
56152
|
+
ON CONFLICT(source, source_file) DO UPDATE SET
|
|
56153
|
+
last_imported_line = excluded.last_imported_line,
|
|
56154
|
+
updated_at = excluded.updated_at`,
|
|
56155
|
+
params: [source, sourceFile, line, timestamp(now2)]
|
|
56156
|
+
};
|
|
56157
|
+
}
|
|
56158
|
+
async function ledgerExistingHashes(db2, hashes) {
|
|
56159
|
+
const existing = new Set;
|
|
56160
|
+
for (let i2 = 0;i2 < hashes.length; i2 += 200) {
|
|
56161
|
+
const chunk = hashes.slice(i2, i2 + 200);
|
|
56162
|
+
const placeholders = chunk.map(() => "?").join(", ");
|
|
56163
|
+
const rows = await db2.queryAll(`SELECT record_hash FROM history_import_ledger WHERE record_hash IN (${placeholders})`, ...chunk);
|
|
56164
|
+
for (const row of rows)
|
|
56165
|
+
existing.add(row.record_hash);
|
|
56166
|
+
}
|
|
56167
|
+
return existing;
|
|
56046
56168
|
}
|
|
56047
56169
|
async function reconcileFullImport(db2, source, desiredHashes, discoveredFiles, dryRun) {
|
|
56048
56170
|
const ledgerRows = await db2.queryAll("SELECT record_hash, target_table FROM history_import_ledger WHERE source = ?", source);
|
|
@@ -56176,7 +56298,7 @@ function openCodeBulkWriteOperations(entries, checkpointFiles, now2) {
|
|
|
56176
56298
|
}
|
|
56177
56299
|
return operations2;
|
|
56178
56300
|
}
|
|
56179
|
-
var TYPED_TABLE_COLUMNS, TYPED_IGNORED_KEYS,
|
|
56301
|
+
var TYPED_TABLE_COLUMNS, TYPED_IGNORED_KEYS, OPENCODE_SOURCE = "opencode";
|
|
56180
56302
|
var init_jsonl_importer_dao = __esm(() => {
|
|
56181
56303
|
init_errors7();
|
|
56182
56304
|
init_schema_sql2();
|
|
@@ -56228,10 +56350,9 @@ var init_jsonl_importer_dao = __esm(() => {
|
|
|
56228
56350
|
]
|
|
56229
56351
|
};
|
|
56230
56352
|
TYPED_IGNORED_KEYS = new Set(["_meta", "split_index"]);
|
|
56231
|
-
_ensuredTables = new Set;
|
|
56232
56353
|
});
|
|
56233
56354
|
|
|
56234
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
56355
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
|
|
56235
56356
|
function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
|
|
56236
56357
|
if (typeof value === "string") {
|
|
56237
56358
|
return rules.reduce((current, rule) => current.replace(rule.pattern, rule.replacement), value);
|
|
@@ -56264,11 +56385,26 @@ var init_redaction = __esm(() => {
|
|
|
56264
56385
|
name: "email",
|
|
56265
56386
|
pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,
|
|
56266
56387
|
replacement: "[REDACTED:email]"
|
|
56388
|
+
},
|
|
56389
|
+
{
|
|
56390
|
+
name: "xai-key",
|
|
56391
|
+
pattern: /\bxai-[A-Za-z0-9_-]{12,}\b/g,
|
|
56392
|
+
replacement: "[REDACTED:token]"
|
|
56393
|
+
},
|
|
56394
|
+
{
|
|
56395
|
+
name: "aws-access-key-id",
|
|
56396
|
+
pattern: /\bAKIA[0-9A-Z]{16}\b/g,
|
|
56397
|
+
replacement: "[REDACTED:aws-key]"
|
|
56398
|
+
},
|
|
56399
|
+
{
|
|
56400
|
+
name: "bearer-token",
|
|
56401
|
+
pattern: /\bBearer\s+[A-Za-z0-9._\-=]+\b/g,
|
|
56402
|
+
replacement: "[REDACTED:bearer]"
|
|
56267
56403
|
}
|
|
56268
56404
|
];
|
|
56269
56405
|
});
|
|
56270
56406
|
|
|
56271
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
56407
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
|
|
56272
56408
|
async function runJsonlImport(source, options) {
|
|
56273
56409
|
const definition = resolveSourceDefinition(source);
|
|
56274
56410
|
const resolvedSource = definition.source;
|
|
@@ -56339,16 +56475,21 @@ async function runJsonlImport(source, options) {
|
|
|
56339
56475
|
record: redacted
|
|
56340
56476
|
});
|
|
56341
56477
|
desiredHashes.add(recordHash);
|
|
56342
|
-
if (await ledgerExists(options.db, recordHash)) {
|
|
56343
|
-
skippedDuplicates += 1;
|
|
56344
|
-
continue;
|
|
56345
|
-
}
|
|
56346
56478
|
prepared.push({ split, splitIndex, normalized: redacted, recordHash });
|
|
56347
56479
|
}
|
|
56348
56480
|
if (lineRejected)
|
|
56349
56481
|
continue;
|
|
56482
|
+
const existing = await ledgerExistingHashes(options.db, prepared.map((e) => e.recordHash));
|
|
56483
|
+
const accepted = prepared.filter((entry) => {
|
|
56484
|
+
if (existing.has(entry.recordHash)) {
|
|
56485
|
+
skippedDuplicates += 1;
|
|
56486
|
+
return false;
|
|
56487
|
+
}
|
|
56488
|
+
return true;
|
|
56489
|
+
});
|
|
56350
56490
|
const recordHashBySplitIndex = new Map(prepared.map((e) => [e.splitIndex, e.recordHash]));
|
|
56351
|
-
|
|
56491
|
+
const ops = [];
|
|
56492
|
+
for (const entry of accepted) {
|
|
56352
56493
|
const { split, splitIndex, normalized, recordHash } = entry;
|
|
56353
56494
|
if (normalized.disposition === "unknown") {
|
|
56354
56495
|
unknownRecords += 1;
|
|
@@ -56362,14 +56503,17 @@ async function runJsonlImport(source, options) {
|
|
|
56362
56503
|
}
|
|
56363
56504
|
}
|
|
56364
56505
|
if (!options.dryRun) {
|
|
56365
|
-
|
|
56366
|
-
|
|
56506
|
+
ops.push(recordInsertOp(split.targetTable, recordHash, file2, lineNumber, splitIndex, normalized, options.now));
|
|
56507
|
+
ops.push(ledgerInsertOp(recordHash, resolvedSource, file2, lineNumber, splitIndex, split.targetTable, options.now));
|
|
56367
56508
|
}
|
|
56368
56509
|
importedRecords += 1;
|
|
56369
56510
|
}
|
|
56370
|
-
if (
|
|
56371
|
-
|
|
56372
|
-
|
|
56511
|
+
if (!options.dryRun && lineSucceeded) {
|
|
56512
|
+
ops.push(checkpointUpsertOp(resolvedSource, file2, lineNumber, options.now));
|
|
56513
|
+
if (ops.length > 0) {
|
|
56514
|
+
await options.db.batch(ops);
|
|
56515
|
+
checkpointUpdates += 1;
|
|
56516
|
+
}
|
|
56373
56517
|
}
|
|
56374
56518
|
}
|
|
56375
56519
|
}
|
|
@@ -56506,7 +56650,7 @@ var init_importer = __esm(() => {
|
|
|
56506
56650
|
init_sources();
|
|
56507
56651
|
});
|
|
56508
56652
|
|
|
56509
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
56653
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
|
|
56510
56654
|
async function runOpenCodeImport(options) {
|
|
56511
56655
|
const paths = options.paths ?? ambientRuntimePaths2();
|
|
56512
56656
|
const sourceDatabase = options.sourceDatabase ?? joinPath2(paths.home, ".local/share/opencode/opencode.db");
|
|
@@ -56757,30 +56901,28 @@ var init_opencode_importer = __esm(() => {
|
|
|
56757
56901
|
init_redaction();
|
|
56758
56902
|
});
|
|
56759
56903
|
|
|
56760
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.
|
|
56904
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.30+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
|
|
56761
56905
|
var init_dist8 = __esm(() => {
|
|
56762
56906
|
init_importer();
|
|
56763
56907
|
init_opencode_importer();
|
|
56764
56908
|
init_schema_sql2();
|
|
56765
56909
|
});
|
|
56766
56910
|
|
|
56767
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
56911
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
|
|
56768
56912
|
function collectExtensions(sourceName, sourceDir, extensions) {
|
|
56769
56913
|
if (extensions === undefined)
|
|
56770
56914
|
return [];
|
|
56771
56915
|
const refs = [];
|
|
56772
56916
|
for (const kind of ["resolvers", "evaluators", "fixers", "formatters"]) {
|
|
56773
56917
|
for (const path9 of extensions[kind] ?? []) {
|
|
56774
|
-
refs.push({ kind,
|
|
56918
|
+
refs.push({ kind, sourceName, path: path9, baseDir: sourceDir });
|
|
56775
56919
|
}
|
|
56776
56920
|
}
|
|
56777
56921
|
return refs;
|
|
56778
56922
|
}
|
|
56779
|
-
var init_extensions =
|
|
56780
|
-
init_dist5();
|
|
56781
|
-
});
|
|
56923
|
+
var init_extensions = () => {};
|
|
56782
56924
|
|
|
56783
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
56925
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
|
|
56784
56926
|
function createFinding(rule, message, filePath, extras = {}) {
|
|
56785
56927
|
return {
|
|
56786
56928
|
ruleId: rule.id,
|
|
@@ -56851,7 +56993,7 @@ var init_types3 = __esm(() => {
|
|
|
56851
56993
|
});
|
|
56852
56994
|
});
|
|
56853
56995
|
|
|
56854
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
56996
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
|
|
56855
56997
|
async function loadPreset(name, options) {
|
|
56856
56998
|
const merged = await buildMergedRoots(options.roots.map((root) => resolvePath4(root)), options.fileSystem);
|
|
56857
56999
|
const presetPath = findMergedPreset(merged, name);
|
|
@@ -57066,7 +57208,7 @@ var init_loader2 = __esm(() => {
|
|
|
57066
57208
|
FIX_MODE_AUTHORITY = { none: 0, suggest: 1, auto: 2 };
|
|
57067
57209
|
});
|
|
57068
57210
|
|
|
57069
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
57211
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
|
|
57070
57212
|
function normalizeFindingPath(filePath) {
|
|
57071
57213
|
if (!filePath || isAbsolutePath2(filePath))
|
|
57072
57214
|
return null;
|
|
@@ -57131,7 +57273,7 @@ var init_test_stub_fixer = __esm(() => {
|
|
|
57131
57273
|
realFileSystem = createNodeFileSystem3();
|
|
57132
57274
|
});
|
|
57133
57275
|
|
|
57134
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
57276
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
|
|
57135
57277
|
function registerBuiltinFixers(host, exec) {
|
|
57136
57278
|
const regexFixer = new RegexFixerProvider;
|
|
57137
57279
|
const pathFixer = new PathFixerProvider;
|
|
@@ -57334,7 +57476,7 @@ var init_fixers = __esm(() => {
|
|
|
57334
57476
|
};
|
|
57335
57477
|
});
|
|
57336
57478
|
|
|
57337
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
57479
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
|
|
57338
57480
|
function getAgentSessionCapability(agent) {
|
|
57339
57481
|
return AGENT_SESSION_CAPABILITY[agent];
|
|
57340
57482
|
}
|
|
@@ -57626,7 +57768,7 @@ var init_shims = __esm(() => {
|
|
|
57626
57768
|
ALIAS_TO_CANONICAL = Object.fromEntries(Object.values(AGENT_SHIMS).flatMap((shim) => (shim.aliases ?? []).map((alias3) => [alias3, shim.name])));
|
|
57627
57769
|
});
|
|
57628
57770
|
|
|
57629
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
57771
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
|
|
57630
57772
|
function buildIdentityPreamble(ctx) {
|
|
57631
57773
|
const sections = [
|
|
57632
57774
|
`You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
|
|
@@ -57666,17 +57808,33 @@ function buildIdentityPreamble(ctx) {
|
|
|
57666
57808
|
`)}
|
|
57667
57809
|
`;
|
|
57668
57810
|
}
|
|
57669
|
-
function getGitContext(workspacePath, executor =
|
|
57670
|
-
const branch = runGit(executor, ["-C", workspacePath, "branch", "--show-current"]);
|
|
57811
|
+
async function getGitContext(workspacePath, executor = nodeBunFactory3.createProcessExecutor()) {
|
|
57812
|
+
const branch = await runGit(executor, ["-C", workspacePath, "branch", "--show-current"]);
|
|
57671
57813
|
if (branch === null || branch === "")
|
|
57672
57814
|
return null;
|
|
57673
|
-
const status = runGit(executor, ["-C", workspacePath, "status", "--porcelain"]);
|
|
57815
|
+
const status = await runGit(executor, ["-C", workspacePath, "status", "--porcelain"]);
|
|
57674
57816
|
const dirtyCount = status === null || status === "" ? 0 : status.split(`
|
|
57675
57817
|
`).filter(Boolean).length;
|
|
57676
57818
|
return ["Git context:", `branch: ${branch}`, `dirty: ${dirtyCount === 0 ? "false" : `${dirtyCount} files`}`].join(`
|
|
57677
57819
|
`);
|
|
57678
57820
|
}
|
|
57679
|
-
function
|
|
57821
|
+
function getGitContextSync(workspacePath, executor = new BunSyncProcessExecutor2) {
|
|
57822
|
+
const branch = runGitSync(executor, ["-C", workspacePath, "branch", "--show-current"]);
|
|
57823
|
+
if (branch === null || branch === "")
|
|
57824
|
+
return null;
|
|
57825
|
+
const status = runGitSync(executor, ["-C", workspacePath, "status", "--porcelain"]);
|
|
57826
|
+
const dirtyCount = status === null || status === "" ? 0 : status.split(`
|
|
57827
|
+
`).filter(Boolean).length;
|
|
57828
|
+
return ["Git context:", `branch: ${branch}`, `dirty: ${dirtyCount === 0 ? "false" : `${dirtyCount} files`}`].join(`
|
|
57829
|
+
`);
|
|
57830
|
+
}
|
|
57831
|
+
async function runGit(executor, args) {
|
|
57832
|
+
const result = await executor.run({ command: "git", args, rejectOnError: false, forceBuffered: true });
|
|
57833
|
+
if (result.exitCode !== 0)
|
|
57834
|
+
return null;
|
|
57835
|
+
return result.stdout.trim();
|
|
57836
|
+
}
|
|
57837
|
+
function runGitSync(executor, args) {
|
|
57680
57838
|
const result = executor.runSync({ command: "git", args, rejectOnError: false, forceBuffered: true });
|
|
57681
57839
|
if (result.exitCode !== 0)
|
|
57682
57840
|
return null;
|
|
@@ -57686,7 +57844,7 @@ var init_identity = __esm(() => {
|
|
|
57686
57844
|
init_dist5();
|
|
57687
57845
|
});
|
|
57688
57846
|
|
|
57689
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
57847
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
|
|
57690
57848
|
function isClaudeStyleSlashCommand(input) {
|
|
57691
57849
|
return SLASH_COMMAND_RE.test(input);
|
|
57692
57850
|
}
|
|
@@ -57714,7 +57872,7 @@ var init_slash_command = __esm(() => {
|
|
|
57714
57872
|
SLASH_COMMAND_RE = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
|
|
57715
57873
|
});
|
|
57716
57874
|
|
|
57717
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
57875
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
|
|
57718
57876
|
function buildCorrelationEnv(correlation) {
|
|
57719
57877
|
return {
|
|
57720
57878
|
[AGENT_RUN_ID_ENV]: correlation.runId,
|
|
@@ -57779,7 +57937,8 @@ class AiRunner {
|
|
|
57779
57937
|
agent,
|
|
57780
57938
|
operation,
|
|
57781
57939
|
label,
|
|
57782
|
-
...options.correlation !== undefined ? { correlation: options.correlation } : {}
|
|
57940
|
+
...options.correlation !== undefined ? { correlation: options.correlation } : {},
|
|
57941
|
+
severity: "info"
|
|
57783
57942
|
});
|
|
57784
57943
|
const correlationEnv = options.correlation === undefined ? undefined : buildCorrelationEnv(options.correlation);
|
|
57785
57944
|
const result = await this.processExecutor.run({
|
|
@@ -57808,7 +57967,8 @@ class AiRunner {
|
|
|
57808
57967
|
exitCode: result.exitCode,
|
|
57809
57968
|
...result.signal !== undefined ? { signal: result.signal } : {},
|
|
57810
57969
|
durationMs: result.durationMs,
|
|
57811
|
-
...options.correlation !== undefined ? { correlation: options.correlation } : {}
|
|
57970
|
+
...options.correlation !== undefined ? { correlation: options.correlation } : {},
|
|
57971
|
+
severity: result.exitCode === 0 || result.exitCode === null ? "info" : "error"
|
|
57812
57972
|
});
|
|
57813
57973
|
return {
|
|
57814
57974
|
exitCode: result.exitCode,
|
|
@@ -57850,7 +58010,7 @@ var init_ai_runner = __esm(() => {
|
|
|
57850
58010
|
init_slash_command();
|
|
57851
58011
|
});
|
|
57852
58012
|
|
|
57853
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58013
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
|
|
57854
58014
|
class AgentDetector {
|
|
57855
58015
|
runner;
|
|
57856
58016
|
timeout;
|
|
@@ -57926,7 +58086,7 @@ var init_agent_detector = __esm(() => {
|
|
|
57926
58086
|
VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
|
|
57927
58087
|
});
|
|
57928
58088
|
|
|
57929
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58089
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
|
|
57930
58090
|
function validateAgentId(id) {
|
|
57931
58091
|
if (!/^[a-z][a-z0-9_-]{1,63}$/.test(id)) {
|
|
57932
58092
|
throw new ValueError(`Invalid agent id "${id}": expected 2-64 chars, lowercase alphanumeric, "_" or "-"`);
|
|
@@ -58023,7 +58183,7 @@ var init_agent_spec = __esm(() => {
|
|
|
58023
58183
|
};
|
|
58024
58184
|
});
|
|
58025
58185
|
|
|
58026
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58186
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
|
|
58027
58187
|
function isNonEmpty(value) {
|
|
58028
58188
|
return value !== undefined && value.trim().length > 0;
|
|
58029
58189
|
}
|
|
@@ -58058,12 +58218,32 @@ async function checkGrokAuth(fs3, home, env) {
|
|
|
58058
58218
|
return "unknown";
|
|
58059
58219
|
}
|
|
58060
58220
|
async function geminiSettingsContainCredentials(fs3, home) {
|
|
58221
|
+
let content;
|
|
58061
58222
|
try {
|
|
58062
|
-
|
|
58063
|
-
return /auth|token|key/i.test(content) ? "authenticated" : "unauthenticated";
|
|
58223
|
+
content = await fs3.readFile(joinPath2(home, ".gemini", "settings.json"));
|
|
58064
58224
|
} catch {
|
|
58065
58225
|
return "unknown";
|
|
58066
58226
|
}
|
|
58227
|
+
let settings;
|
|
58228
|
+
try {
|
|
58229
|
+
settings = JSON.parse(content);
|
|
58230
|
+
} catch {
|
|
58231
|
+
return "unauthenticated";
|
|
58232
|
+
}
|
|
58233
|
+
if (typeof settings !== "object" || settings === null)
|
|
58234
|
+
return "unauthenticated";
|
|
58235
|
+
const record2 = settings;
|
|
58236
|
+
if (typeof record2.apiKey === "string" && record2.apiKey.length > 0)
|
|
58237
|
+
return "authenticated";
|
|
58238
|
+
if (typeof record2.accessToken === "string" && record2.accessToken.length > 0)
|
|
58239
|
+
return "authenticated";
|
|
58240
|
+
const tokens = record2.tokens;
|
|
58241
|
+
if (tokens !== null && typeof tokens === "object") {
|
|
58242
|
+
const accessToken = tokens.access_token;
|
|
58243
|
+
if (typeof accessToken === "string" && accessToken.length > 0)
|
|
58244
|
+
return "authenticated";
|
|
58245
|
+
}
|
|
58246
|
+
return "unauthenticated";
|
|
58067
58247
|
}
|
|
58068
58248
|
async function probeAuthOutput(runner, agent, timeout) {
|
|
58069
58249
|
const options = { timeout };
|
|
@@ -58128,7 +58308,7 @@ var init_auth_shims = __esm(() => {
|
|
|
58128
58308
|
};
|
|
58129
58309
|
});
|
|
58130
58310
|
|
|
58131
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58311
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
|
|
58132
58312
|
class ModelHealthProbeRegistry {
|
|
58133
58313
|
probes = new Map;
|
|
58134
58314
|
register(providerPrefix, probe) {
|
|
@@ -58236,7 +58416,7 @@ var init_model_health_probe = __esm(() => {
|
|
|
58236
58416
|
};
|
|
58237
58417
|
});
|
|
58238
58418
|
|
|
58239
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58419
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
|
|
58240
58420
|
class DoctorRunner {
|
|
58241
58421
|
detector;
|
|
58242
58422
|
runner;
|
|
@@ -58373,15 +58553,15 @@ var init_doctor_runner = __esm(() => {
|
|
|
58373
58553
|
init_model_health_probe();
|
|
58374
58554
|
});
|
|
58375
58555
|
|
|
58376
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58556
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
|
|
58377
58557
|
var init_events = () => {};
|
|
58378
58558
|
|
|
58379
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58559
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
|
|
58380
58560
|
function formatMessage(msg) {
|
|
58381
58561
|
return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
|
|
58382
58562
|
}
|
|
58383
58563
|
|
|
58384
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58564
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
|
|
58385
58565
|
import { Buffer as Buffer5 } from "buffer";
|
|
58386
58566
|
|
|
58387
58567
|
class TeamAgentProcess {
|
|
@@ -58515,7 +58695,7 @@ var init_team_agent_process = __esm(() => {
|
|
|
58515
58695
|
init_dist5();
|
|
58516
58696
|
});
|
|
58517
58697
|
|
|
58518
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58698
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
|
|
58519
58699
|
class TeamOrchestrator {
|
|
58520
58700
|
configDir;
|
|
58521
58701
|
inbox;
|
|
@@ -58562,7 +58742,8 @@ class TeamOrchestrator {
|
|
|
58562
58742
|
this.events.emit("agent.started", {
|
|
58563
58743
|
agentId: spec.id,
|
|
58564
58744
|
agentType: spec.type,
|
|
58565
|
-
pid: process11.getPid()
|
|
58745
|
+
pid: process11.getPid(),
|
|
58746
|
+
severity: "info"
|
|
58566
58747
|
});
|
|
58567
58748
|
return process11;
|
|
58568
58749
|
}
|
|
@@ -58572,7 +58753,12 @@ class TeamOrchestrator {
|
|
|
58572
58753
|
return;
|
|
58573
58754
|
await process11.stop();
|
|
58574
58755
|
this.running.delete(id);
|
|
58575
|
-
|
|
58756
|
+
const exitCode = process11.getExitCode();
|
|
58757
|
+
this.events.emit("agent.stopped", {
|
|
58758
|
+
agentId: id,
|
|
58759
|
+
exitCode,
|
|
58760
|
+
severity: exitCode === 0 || exitCode === null ? "info" : "warning"
|
|
58761
|
+
});
|
|
58576
58762
|
}
|
|
58577
58763
|
async restartAgent(id) {
|
|
58578
58764
|
await this.stopAgent(id);
|
|
@@ -58582,7 +58768,7 @@ class TeamOrchestrator {
|
|
|
58582
58768
|
const msgId = await this.inbox.enqueue(fromId, toId, body, inReplyTo);
|
|
58583
58769
|
const process11 = this.running.get(toId);
|
|
58584
58770
|
const ok = process11 !== undefined ? await this.flushInbox(process11, "live stdin injection failed") : false;
|
|
58585
|
-
this.events.emit("agent.message.sent", { agentId: toId, ok });
|
|
58771
|
+
this.events.emit("agent.message.sent", { agentId: toId, ok, severity: ok ? "info" : "warning" });
|
|
58586
58772
|
return msgId;
|
|
58587
58773
|
}
|
|
58588
58774
|
getRunningAgents() {
|
|
@@ -58622,16 +58808,22 @@ class TeamOrchestrator {
|
|
|
58622
58808
|
return this.flushInbox(process11, "startup stdin injection failed");
|
|
58623
58809
|
}
|
|
58624
58810
|
async flushInbox(process11, failLabel) {
|
|
58625
|
-
const messages = await this.inbox.drainPending(process11.agentId);
|
|
58626
58811
|
let ok = true;
|
|
58627
|
-
for (
|
|
58628
|
-
const
|
|
58629
|
-
if (
|
|
58630
|
-
|
|
58631
|
-
|
|
58632
|
-
|
|
58633
|
-
|
|
58812
|
+
for (;; ) {
|
|
58813
|
+
const messages = await this.inbox.drainPending(process11.agentId);
|
|
58814
|
+
if (messages.length === 0)
|
|
58815
|
+
break;
|
|
58816
|
+
for (const message of messages) {
|
|
58817
|
+
const result = await process11.send(formatMessage(message));
|
|
58818
|
+
if (result.ok)
|
|
58819
|
+
await this.inbox.markDelivered(message.id);
|
|
58820
|
+
else {
|
|
58821
|
+
ok = false;
|
|
58822
|
+
await this.inbox.markFailed(message.id, failLabel);
|
|
58823
|
+
}
|
|
58634
58824
|
}
|
|
58825
|
+
if (messages.length < 100)
|
|
58826
|
+
break;
|
|
58635
58827
|
}
|
|
58636
58828
|
return ok;
|
|
58637
58829
|
}
|
|
@@ -58644,7 +58836,7 @@ var init_team_orchestrator = __esm(() => {
|
|
|
58644
58836
|
init_team_agent_process();
|
|
58645
58837
|
});
|
|
58646
58838
|
|
|
58647
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.
|
|
58839
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.30+5440cf4f2ea6f0ec/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
|
|
58648
58840
|
var exports_dist3 = {};
|
|
58649
58841
|
__export(exports_dist3, {
|
|
58650
58842
|
validateAgentId: () => validateAgentId,
|
|
@@ -58655,6 +58847,7 @@ __export(exports_dist3, {
|
|
|
58655
58847
|
isClaudeStyleSlashCommand: () => isClaudeStyleSlashCommand,
|
|
58656
58848
|
isAuthenticated: () => isAuthenticated,
|
|
58657
58849
|
isAgentName: () => isAgentName,
|
|
58850
|
+
getGitContextSync: () => getGitContextSync,
|
|
58658
58851
|
getGitContext: () => getGitContext,
|
|
58659
58852
|
getAgentShim: () => getAgentShim,
|
|
58660
58853
|
getAgentSessionCapability: () => getAgentSessionCapability,
|
|
@@ -58696,7 +58889,7 @@ var init_dist9 = __esm(() => {
|
|
|
58696
58889
|
init_team_orchestrator();
|
|
58697
58890
|
});
|
|
58698
58891
|
|
|
58699
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
58892
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
|
|
58700
58893
|
function stringArray(value) {
|
|
58701
58894
|
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : undefined;
|
|
58702
58895
|
}
|
|
@@ -58734,7 +58927,7 @@ function parseInlineFlags(source) {
|
|
|
58734
58927
|
return { flags, rest: source.slice(match[0].length) };
|
|
58735
58928
|
}
|
|
58736
58929
|
|
|
58737
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
58930
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
|
|
58738
58931
|
function matchesAny(path9, patterns) {
|
|
58739
58932
|
if (patterns === undefined || patterns.length === 0)
|
|
58740
58933
|
return true;
|
|
@@ -58782,7 +58975,7 @@ function escapeRegExp(value) {
|
|
|
58782
58975
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
58783
58976
|
}
|
|
58784
58977
|
|
|
58785
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
58978
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
|
|
58786
58979
|
async function discoverFiles2(options) {
|
|
58787
58980
|
const fs3 = options.fs ?? createNodeFileSystem3();
|
|
58788
58981
|
const allFiles = await walkDir2(options.workdir, fs3, DEFAULT_EXCLUDES);
|
|
@@ -58796,6 +58989,9 @@ async function scanFiles(options) {
|
|
|
58796
58989
|
const files = options.matchMode === "loose" ? await discoverFiles2({ workdir: options.workdir, include: options.include, exclude: options.exclude, fs: fs3 }) : await discoverFilesByGlob(options.workdir, options.include, options.exclude, fs3);
|
|
58797
58990
|
const scanned = [];
|
|
58798
58991
|
for (const file2 of files) {
|
|
58992
|
+
const stat = await fs3.stat(resolvePath4(options.workdir, file2));
|
|
58993
|
+
if (stat !== null && stat.size > MAX_SCANNED_FILE_BYTES)
|
|
58994
|
+
continue;
|
|
58799
58995
|
scanned.push({ file: file2, content: await readWorkdirFile(options.workdir, file2, fs3) });
|
|
58800
58996
|
}
|
|
58801
58997
|
return scanned;
|
|
@@ -58804,18 +59000,18 @@ async function discoverFilesByGlob(workdir, include, exclude, fs3) {
|
|
|
58804
59000
|
const all = await discoverFiles2({ workdir, fs: fs3 });
|
|
58805
59001
|
return all.filter((file2) => include === undefined || include.length === 0 || include.some((g) => matchesGlob(file2, g))).filter((file2) => exclude === undefined || !exclude.some((g) => matchesGlob(file2, g)));
|
|
58806
59002
|
}
|
|
58807
|
-
var DEFAULT_EXCLUDES;
|
|
59003
|
+
var DEFAULT_EXCLUDES, MAX_SCANNED_FILE_BYTES = 2000000;
|
|
58808
59004
|
var init_file_discovery = __esm(() => {
|
|
58809
59005
|
init_dist5();
|
|
58810
59006
|
DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
|
|
58811
59007
|
});
|
|
58812
59008
|
|
|
58813
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59009
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
|
|
58814
59010
|
var init_file_utils = __esm(() => {
|
|
58815
59011
|
init_file_discovery();
|
|
58816
59012
|
});
|
|
58817
59013
|
|
|
58818
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59014
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
|
|
58819
59015
|
class AgentDetectionEvaluator {
|
|
58820
59016
|
detector;
|
|
58821
59017
|
constructor(detector = new AgentDetector) {
|
|
@@ -58843,7 +59039,7 @@ var init_agent_detection_evaluator = __esm(() => {
|
|
|
58843
59039
|
init_file_utils();
|
|
58844
59040
|
});
|
|
58845
59041
|
|
|
58846
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59042
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
|
|
58847
59043
|
class CoverageGateEvaluator {
|
|
58848
59044
|
constructor() {}
|
|
58849
59045
|
async evaluate(rule, context4) {
|
|
@@ -58927,7 +59123,7 @@ var init_coverage_gate_evaluator = __esm(() => {
|
|
|
58927
59123
|
init_file_utils();
|
|
58928
59124
|
});
|
|
58929
59125
|
|
|
58930
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59126
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
|
|
58931
59127
|
class ExitCodeEvaluator {
|
|
58932
59128
|
executor;
|
|
58933
59129
|
constructor(executor = nodeBunFactory3.createProcessExecutor()) {
|
|
@@ -58963,7 +59159,7 @@ var init_exit_code_evaluator = __esm(() => {
|
|
|
58963
59159
|
init_file_utils();
|
|
58964
59160
|
});
|
|
58965
59161
|
|
|
58966
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59162
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
|
|
58967
59163
|
class ForbiddenImportEvaluator {
|
|
58968
59164
|
constructor() {}
|
|
58969
59165
|
async evaluate(rule, context4) {
|
|
@@ -59044,7 +59240,7 @@ var init_forbidden_import_evaluator = __esm(() => {
|
|
|
59044
59240
|
init_file_utils();
|
|
59045
59241
|
});
|
|
59046
59242
|
|
|
59047
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59243
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
|
|
59048
59244
|
class ImportBoundaryEvaluator {
|
|
59049
59245
|
async evaluate(rule, context4) {
|
|
59050
59246
|
const config4 = rule.evaluator.config ?? {};
|
|
@@ -59079,7 +59275,7 @@ class ImportBoundaryEvaluator {
|
|
|
59079
59275
|
}
|
|
59080
59276
|
}
|
|
59081
59277
|
function compileBoundary(decl, index2) {
|
|
59082
|
-
if (!
|
|
59278
|
+
if (!isRecord2(decl)) {
|
|
59083
59279
|
throw new Error(`import-boundary evaluator requires object config "boundaries[${index2}]"`);
|
|
59084
59280
|
}
|
|
59085
59281
|
const scope = decl.scope;
|
|
@@ -59109,7 +59305,7 @@ function compileEntry2(entry, boundaryIndex, entryIndex) {
|
|
|
59109
59305
|
importOnly: true
|
|
59110
59306
|
};
|
|
59111
59307
|
}
|
|
59112
|
-
if (!
|
|
59308
|
+
if (!isRecord2(entry) || typeof entry.pattern !== "string" || entry.pattern.length === 0) {
|
|
59113
59309
|
throw new Error(`import-boundary evaluator requires string config "boundaries[${boundaryIndex}].forbidden[${entryIndex}].pattern"`);
|
|
59114
59310
|
}
|
|
59115
59311
|
if (entry.mode !== undefined && entry.mode !== "import" && entry.mode !== "usage") {
|
|
@@ -59125,7 +59321,7 @@ function compileEntry2(entry, boundaryIndex, entryIndex) {
|
|
|
59125
59321
|
function isImportLine(line) {
|
|
59126
59322
|
return /(?:^\s*import\b|^\s*export\b.*\bfrom\b|(?:from|require|import)\s*\(?\s*['"])/.test(line);
|
|
59127
59323
|
}
|
|
59128
|
-
function
|
|
59324
|
+
function isRecord2(value) {
|
|
59129
59325
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59130
59326
|
}
|
|
59131
59327
|
function isStringArray(value) {
|
|
@@ -59137,7 +59333,7 @@ var init_import_boundary_evaluator = __esm(() => {
|
|
|
59137
59333
|
init_file_utils();
|
|
59138
59334
|
});
|
|
59139
59335
|
|
|
59140
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59336
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
|
|
59141
59337
|
class PathEvaluator {
|
|
59142
59338
|
constructor() {}
|
|
59143
59339
|
async evaluate(rule, context4) {
|
|
@@ -59198,7 +59394,7 @@ var init_path_evaluator = __esm(() => {
|
|
|
59198
59394
|
init_file_utils();
|
|
59199
59395
|
});
|
|
59200
59396
|
|
|
59201
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59397
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
|
|
59202
59398
|
class RegexEvaluator {
|
|
59203
59399
|
constructor() {}
|
|
59204
59400
|
async evaluate(rule, context4) {
|
|
@@ -59276,7 +59472,7 @@ var init_regex_evaluator = __esm(() => {
|
|
|
59276
59472
|
init_file_utils();
|
|
59277
59473
|
});
|
|
59278
59474
|
|
|
59279
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59475
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
|
|
59280
59476
|
class RipgrepEvaluator {
|
|
59281
59477
|
executor;
|
|
59282
59478
|
constructor(executor = nodeBunFactory3.createProcessExecutor()) {
|
|
@@ -59369,7 +59565,7 @@ var init_ripgrep_evaluator = __esm(() => {
|
|
|
59369
59565
|
init_file_utils();
|
|
59370
59566
|
});
|
|
59371
59567
|
|
|
59372
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59568
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
|
|
59373
59569
|
class SchemaArtifactEvaluator {
|
|
59374
59570
|
constructor() {}
|
|
59375
59571
|
async evaluate(rule, context4) {
|
|
@@ -59447,7 +59643,7 @@ var init_schema_artifact_evaluator = __esm(() => {
|
|
|
59447
59643
|
init_file_utils();
|
|
59448
59644
|
});
|
|
59449
59645
|
|
|
59450
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59646
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
|
|
59451
59647
|
class SecretsScannerEvaluator {
|
|
59452
59648
|
constructor() {}
|
|
59453
59649
|
async evaluate(rule, context4) {
|
|
@@ -59515,7 +59711,7 @@ var init_secrets_scanner_evaluator = __esm(() => {
|
|
|
59515
59711
|
ALL_CATEGORIES = Object.keys(BUILTIN_PATTERNS);
|
|
59516
59712
|
});
|
|
59517
59713
|
|
|
59518
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59714
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
|
|
59519
59715
|
class SgEvaluator {
|
|
59520
59716
|
executor;
|
|
59521
59717
|
constructor(executor = nodeBunFactory3.createProcessExecutor()) {
|
|
@@ -59612,7 +59808,7 @@ var init_sg_evaluator = __esm(() => {
|
|
|
59612
59808
|
init_file_utils();
|
|
59613
59809
|
});
|
|
59614
59810
|
|
|
59615
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59811
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
|
|
59616
59812
|
class TypeScriptTestPathResolver {
|
|
59617
59813
|
name = "typescript";
|
|
59618
59814
|
constructor() {}
|
|
@@ -59695,7 +59891,7 @@ function testify(rel) {
|
|
|
59695
59891
|
return `${dir}test_${base2}`;
|
|
59696
59892
|
}
|
|
59697
59893
|
|
|
59698
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59894
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
|
|
59699
59895
|
class TestLocationEvaluator {
|
|
59700
59896
|
resolvers;
|
|
59701
59897
|
constructor(resolvers) {
|
|
@@ -59770,7 +59966,7 @@ var init_test_location_evaluator = __esm(() => {
|
|
|
59770
59966
|
TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
|
|
59771
59967
|
});
|
|
59772
59968
|
|
|
59773
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
59969
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
|
|
59774
59970
|
class TsdocExportEvaluator {
|
|
59775
59971
|
constructor() {}
|
|
59776
59972
|
async evaluate(rule, context4) {
|
|
@@ -59855,7 +60051,7 @@ var init_tsdoc_export_evaluator = __esm(() => {
|
|
|
59855
60051
|
};
|
|
59856
60052
|
});
|
|
59857
60053
|
|
|
59858
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60054
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
|
|
59859
60055
|
class JsonFormatter {
|
|
59860
60056
|
constructor() {}
|
|
59861
60057
|
format(result) {
|
|
@@ -59863,7 +60059,7 @@ class JsonFormatter {
|
|
|
59863
60059
|
}
|
|
59864
60060
|
}
|
|
59865
60061
|
|
|
59866
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60062
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
|
|
59867
60063
|
class TextFormatter {
|
|
59868
60064
|
constructor() {}
|
|
59869
60065
|
format(result) {
|
|
@@ -59877,7 +60073,7 @@ class TextFormatter {
|
|
|
59877
60073
|
}
|
|
59878
60074
|
}
|
|
59879
60075
|
|
|
59880
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60076
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
|
|
59881
60077
|
function registerBuiltins(host, executor) {
|
|
59882
60078
|
const path9 = new PathEvaluator;
|
|
59883
60079
|
host.evaluators.register("regex", new RegexEvaluator, "builtin");
|
|
@@ -59917,7 +60113,7 @@ var init_builtins = __esm(() => {
|
|
|
59917
60113
|
init_tsdoc_export_evaluator();
|
|
59918
60114
|
});
|
|
59919
60115
|
|
|
59920
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60116
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
|
|
59921
60117
|
class RuleEngineHost {
|
|
59922
60118
|
evaluators;
|
|
59923
60119
|
formatters;
|
|
@@ -59934,7 +60130,7 @@ var init_rule_engine_host = __esm(() => {
|
|
|
59934
60130
|
init_extension2();
|
|
59935
60131
|
});
|
|
59936
60132
|
|
|
59937
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60133
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
|
|
59938
60134
|
class RuleEngine {
|
|
59939
60135
|
host;
|
|
59940
60136
|
events;
|
|
@@ -59979,7 +60175,11 @@ class RuleEngine {
|
|
|
59979
60175
|
return await traceAsync("rule.run", async () => {
|
|
59980
60176
|
this.logger.info("rule run started", { enabled: enabledRules.length, total: rules.length });
|
|
59981
60177
|
addSpanEvent("rule.run.start", { rules: enabledRules.length, total: rules.length });
|
|
59982
|
-
this.events?.emit("rule.run.start", {
|
|
60178
|
+
this.events?.emit("rule.run.start", {
|
|
60179
|
+
rules: enabledRules.length,
|
|
60180
|
+
total: rules.length,
|
|
60181
|
+
severity: "info"
|
|
60182
|
+
});
|
|
59983
60183
|
const findings = [];
|
|
59984
60184
|
const fixes = [];
|
|
59985
60185
|
let index2 = 0;
|
|
@@ -59998,7 +60198,12 @@ class RuleEngine {
|
|
|
59998
60198
|
const evalStartMs = Date.now();
|
|
59999
60199
|
this.logger.debug("eval start", { ruleId: rule.id, index: index2, total: enabledRules.length });
|
|
60000
60200
|
addSpanEvent("rule.eval.start", { ruleId: rule.id, index: index2, total: enabledRules.length });
|
|
60001
|
-
this.events?.emit("rule.eval.start", {
|
|
60201
|
+
this.events?.emit("rule.eval.start", {
|
|
60202
|
+
ruleId: rule.id,
|
|
60203
|
+
index: index2,
|
|
60204
|
+
total: enabledRules.length,
|
|
60205
|
+
severity: "info"
|
|
60206
|
+
});
|
|
60002
60207
|
let ruleFindings = [];
|
|
60003
60208
|
let ruleEvalFixes = [];
|
|
60004
60209
|
let evalError;
|
|
@@ -60015,7 +60220,11 @@ class RuleEngine {
|
|
|
60015
60220
|
})
|
|
60016
60221
|
];
|
|
60017
60222
|
addSpanEvent("rule.eval.error", { ruleId: rule.id, error: evalError });
|
|
60018
|
-
this.events?.emit("rule.eval.error", {
|
|
60223
|
+
this.events?.emit("rule.eval.error", {
|
|
60224
|
+
ruleId: rule.id,
|
|
60225
|
+
error: evalError,
|
|
60226
|
+
severity: "error"
|
|
60227
|
+
});
|
|
60019
60228
|
}
|
|
60020
60229
|
const durationMs = Date.now() - evalStartMs;
|
|
60021
60230
|
addSpanEvent("rule.eval.done", {
|
|
@@ -60027,7 +60236,8 @@ class RuleEngine {
|
|
|
60027
60236
|
ruleId: rule.id,
|
|
60028
60237
|
findings: ruleFindings.length,
|
|
60029
60238
|
durationMs,
|
|
60030
|
-
details: ruleFindings
|
|
60239
|
+
details: ruleFindings,
|
|
60240
|
+
severity: "info"
|
|
60031
60241
|
});
|
|
60032
60242
|
await this.persistence?.updateEvalRun({
|
|
60033
60243
|
runId: this.runId,
|
|
@@ -60081,7 +60291,8 @@ class RuleEngine {
|
|
|
60081
60291
|
rules: enabledRules.length,
|
|
60082
60292
|
findings: findings.length,
|
|
60083
60293
|
durationMs: runDurationMs,
|
|
60084
|
-
stoppedEarly: stoppedEarlyLocal
|
|
60294
|
+
stoppedEarly: stoppedEarlyLocal,
|
|
60295
|
+
severity: "info"
|
|
60085
60296
|
});
|
|
60086
60297
|
await this.persistence?.updateRunStatus(this.runId, "done", findings.length, fixes.length, 0, runDurationMs);
|
|
60087
60298
|
return { findings, fixes };
|
|
@@ -60105,7 +60316,7 @@ var init_engine = __esm(() => {
|
|
|
60105
60316
|
init_types3();
|
|
60106
60317
|
});
|
|
60107
60318
|
|
|
60108
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60319
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
|
|
60109
60320
|
async function bundledRulesRoot() {
|
|
60110
60321
|
if (cachedRoot2 !== undefined)
|
|
60111
60322
|
return cachedRoot2;
|
|
@@ -60156,7 +60367,7 @@ var init_bundled_rules = __esm(() => {
|
|
|
60156
60367
|
init_dist5();
|
|
60157
60368
|
});
|
|
60158
60369
|
|
|
60159
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60370
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
|
|
60160
60371
|
class DbRulePersistenceAdapter {
|
|
60161
60372
|
db;
|
|
60162
60373
|
constructor(db2) {
|
|
@@ -60190,7 +60401,7 @@ class DbRulePersistenceAdapter {
|
|
|
60190
60401
|
}
|
|
60191
60402
|
}
|
|
60192
60403
|
|
|
60193
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60404
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
|
|
60194
60405
|
var RULE_ENGINE_SCHEMA_SQL = `
|
|
60195
60406
|
CREATE TABLE IF NOT EXISTS rule_runs (
|
|
60196
60407
|
id TEXT PRIMARY KEY,
|
|
@@ -60236,10 +60447,10 @@ CREATE TABLE IF NOT EXISTS rule_eval_runs (
|
|
|
60236
60447
|
CREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);
|
|
60237
60448
|
`;
|
|
60238
60449
|
|
|
60239
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60450
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
|
|
60240
60451
|
var init_persistence2 = () => {};
|
|
60241
60452
|
|
|
60242
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.
|
|
60453
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.30+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
|
|
60243
60454
|
var init_dist10 = __esm(() => {
|
|
60244
60455
|
init_extensions();
|
|
60245
60456
|
init_loader2();
|
|
@@ -60471,7 +60682,7 @@ ${SYSTEM_EVENTS_SCHEMA_SQL}
|
|
|
60471
60682
|
];
|
|
60472
60683
|
});
|
|
60473
60684
|
|
|
60474
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
60685
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
|
|
60475
60686
|
function queueLogger() {
|
|
60476
60687
|
if (!_queueLogger)
|
|
60477
60688
|
_queueLogger = getLogger2("job-queue");
|
|
@@ -60507,7 +60718,7 @@ class DBJobQueue {
|
|
|
60507
60718
|
}
|
|
60508
60719
|
}
|
|
60509
60720
|
function enqueuedDetail(jobId, type, options) {
|
|
60510
|
-
const detail = { jobId, type, enqueuedAt: Date.now() };
|
|
60721
|
+
const detail = { jobId, type, enqueuedAt: Date.now(), severity: "info" };
|
|
60511
60722
|
if (options && options.maxRetries !== undefined)
|
|
60512
60723
|
detail.maxRetries = options.maxRetries;
|
|
60513
60724
|
if (options && options.delay !== undefined)
|
|
@@ -60556,7 +60767,8 @@ class DBQueueConsumer {
|
|
|
60556
60767
|
pollInterval: this.pollInterval,
|
|
60557
60768
|
batchSize: this.batchSize,
|
|
60558
60769
|
maxConcurrency: this.maxConcurrency,
|
|
60559
|
-
visibilityTimeout: this.visibilityTimeout
|
|
60770
|
+
visibilityTimeout: this.visibilityTimeout,
|
|
60771
|
+
severity: "info"
|
|
60560
60772
|
});
|
|
60561
60773
|
}
|
|
60562
60774
|
async stop() {
|
|
@@ -60575,11 +60787,13 @@ class DBQueueConsumer {
|
|
|
60575
60787
|
await sleep(10);
|
|
60576
60788
|
}
|
|
60577
60789
|
if (wasRunning) {
|
|
60790
|
+
const drained = this.inFlight === 0;
|
|
60578
60791
|
const detail = {
|
|
60579
60792
|
stoppedAt: Date.now(),
|
|
60580
60793
|
drainTimeoutMs: this.drainTimeoutMs,
|
|
60581
60794
|
inFlightAtStop: this.inFlight,
|
|
60582
|
-
drained
|
|
60795
|
+
drained,
|
|
60796
|
+
severity: drained ? "info" : "warning"
|
|
60583
60797
|
};
|
|
60584
60798
|
await this.events?.emit("queue.consumer.stopped", detail);
|
|
60585
60799
|
}
|
|
@@ -60662,7 +60876,8 @@ class DBQueueConsumer {
|
|
|
60662
60876
|
jobId: job.id,
|
|
60663
60877
|
type: job.type,
|
|
60664
60878
|
durationMs: Number.isFinite(durationMs) ? durationMs : 0,
|
|
60665
|
-
attempt: job.attempts
|
|
60879
|
+
attempt: job.attempts,
|
|
60880
|
+
severity: "info"
|
|
60666
60881
|
};
|
|
60667
60882
|
await this.events?.emit("queue.job.completed", completed);
|
|
60668
60883
|
} catch (error51) {
|
|
@@ -60684,7 +60899,8 @@ class DBQueueConsumer {
|
|
|
60684
60899
|
error: message,
|
|
60685
60900
|
attempt: attempts,
|
|
60686
60901
|
maxRetries: job.maxRetries,
|
|
60687
|
-
durationMs
|
|
60902
|
+
durationMs,
|
|
60903
|
+
severity: "error"
|
|
60688
60904
|
};
|
|
60689
60905
|
await this.events?.emit("queue.job.failed", failed);
|
|
60690
60906
|
return;
|
|
@@ -60698,7 +60914,8 @@ class DBQueueConsumer {
|
|
|
60698
60914
|
attempt: attempts,
|
|
60699
60915
|
maxRetries: job.maxRetries,
|
|
60700
60916
|
nextRetryAt,
|
|
60701
|
-
error: message
|
|
60917
|
+
error: message,
|
|
60918
|
+
severity: "warning"
|
|
60702
60919
|
};
|
|
60703
60920
|
await this.events?.emit("queue.job.retrying", retrying);
|
|
60704
60921
|
}
|
|
@@ -60748,7 +60965,7 @@ var init_db_job_queue = __esm(() => {
|
|
|
60748
60965
|
init_tracing2();
|
|
60749
60966
|
});
|
|
60750
60967
|
|
|
60751
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
60968
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
|
|
60752
60969
|
var exports_job_queue_db = {};
|
|
60753
60970
|
__export(exports_job_queue_db, {
|
|
60754
60971
|
DBQueueConsumer: () => DBQueueConsumer,
|
|
@@ -66340,8 +66557,466 @@ var init_corpus_migrator = __esm(() => {
|
|
|
66340
66557
|
ISO_TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}:\d{2})$/;
|
|
66341
66558
|
});
|
|
66342
66559
|
|
|
66560
|
+
// ../../packages/app/src/services/system-event-envelope.ts
|
|
66561
|
+
function systemEventProjectContext(root, name) {
|
|
66562
|
+
const safeRoot = typeof root === "string" ? root : "";
|
|
66563
|
+
const normalized = safeRoot.replace(/[\\/]+$/, "");
|
|
66564
|
+
const inferredName = normalized.split(/[\\/]/).at(-1) || "unknown";
|
|
66565
|
+
return { name: name && name.length > 0 ? name : inferredName, root: safeRoot };
|
|
66566
|
+
}
|
|
66567
|
+
function isSystemEventEnvelopeV2(value) {
|
|
66568
|
+
try {
|
|
66569
|
+
return validateSystemEventEnvelopeV2(value);
|
|
66570
|
+
} catch {
|
|
66571
|
+
return false;
|
|
66572
|
+
}
|
|
66573
|
+
}
|
|
66574
|
+
function validateSystemEventEnvelopeV2(value) {
|
|
66575
|
+
if (!isRecord3(value) || value.schemaVersion !== SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION)
|
|
66576
|
+
return false;
|
|
66577
|
+
if (!hasOnlyKeys(value, new Set(["schemaVersion", "data", "context", "presentation"])))
|
|
66578
|
+
return false;
|
|
66579
|
+
if (!isRecord3(value.context) || !isRecord3(value.presentation))
|
|
66580
|
+
return false;
|
|
66581
|
+
if (!isRecord3(value.context.project) || !isRecord3(value.context.producer) || !isRecord3(value.context.correlation)) {
|
|
66582
|
+
return false;
|
|
66583
|
+
}
|
|
66584
|
+
if (!hasOnlyKeys(value.context, new Set(["project", "producer", "correlation"])))
|
|
66585
|
+
return false;
|
|
66586
|
+
if (!hasOnlyKeys(value.context.project, new Set(["name", "root"])))
|
|
66587
|
+
return false;
|
|
66588
|
+
if (!hasOnlyKeys(value.context.producer, new Set(["package", "subsystem"])))
|
|
66589
|
+
return false;
|
|
66590
|
+
if (!hasOnlyKeys(value.context.correlation, CORRELATION_KEYS))
|
|
66591
|
+
return false;
|
|
66592
|
+
if (!hasOnlyKeys(value.presentation, PRESENTATION_KEYS))
|
|
66593
|
+
return false;
|
|
66594
|
+
if (!isBoundedString(value.context.project.name, 129) || !isBoundedString(value.context.project.root))
|
|
66595
|
+
return false;
|
|
66596
|
+
if (!PRODUCER_PACKAGES.has(value.context.producer.package))
|
|
66597
|
+
return false;
|
|
66598
|
+
if (!isBoundedString(value.context.producer.subsystem, 128))
|
|
66599
|
+
return false;
|
|
66600
|
+
if (!isValidCorrelation(value.context.correlation))
|
|
66601
|
+
return false;
|
|
66602
|
+
if (!isValidPresentation(value.presentation))
|
|
66603
|
+
return false;
|
|
66604
|
+
return value.data === null || isRecord3(value.data) && isBoundedProjectedValue(value.data);
|
|
66605
|
+
}
|
|
66606
|
+
function buildSystemEventEnvelope(entry, eventPayload, project, secretValues = []) {
|
|
66607
|
+
try {
|
|
66608
|
+
const data = projectSystemEventData(entry, eventPayload, secretValues);
|
|
66609
|
+
const correlation = extractEnvelopeCorrelation(eventPayload, secretValues);
|
|
66610
|
+
const severity = extractSeverity(eventPayload) ?? entry?.severity ?? "warning";
|
|
66611
|
+
const outcome = firstBoundedString(eventPayload, ["outcome", "status", "reason"], secretValues);
|
|
66612
|
+
const presentation = {
|
|
66613
|
+
severity,
|
|
66614
|
+
summary: buildSummary(entry, correlation, outcome),
|
|
66615
|
+
description: entry?.description ?? "Unknown system event with bounded metadata.",
|
|
66616
|
+
fields: buildPresentationFields(entry, data),
|
|
66617
|
+
...outcome !== undefined ? { outcome } : {},
|
|
66618
|
+
...buildAction(entry, correlation)
|
|
66619
|
+
};
|
|
66620
|
+
return {
|
|
66621
|
+
schemaVersion: SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION,
|
|
66622
|
+
data,
|
|
66623
|
+
context: {
|
|
66624
|
+
project: boundedProjectContext(project, secretValues),
|
|
66625
|
+
producer: {
|
|
66626
|
+
package: entry?.producerPackage ?? "spur",
|
|
66627
|
+
subsystem: entry?.subsystem ?? "unknown"
|
|
66628
|
+
},
|
|
66629
|
+
correlation
|
|
66630
|
+
},
|
|
66631
|
+
presentation
|
|
66632
|
+
};
|
|
66633
|
+
} catch {
|
|
66634
|
+
return genericEnvelope(project, secretValues);
|
|
66635
|
+
}
|
|
66636
|
+
}
|
|
66637
|
+
function projectStoredSystemEventEnvelope(entry, storedPayload, project, secretValues = []) {
|
|
66638
|
+
try {
|
|
66639
|
+
if (isSystemEventEnvelopeV2(storedPayload))
|
|
66640
|
+
return storedPayload;
|
|
66641
|
+
if (!isRecord3(storedPayload) || storedPayload.schemaVersion !== SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION) {
|
|
66642
|
+
return buildSystemEventEnvelope(entry, storedPayload, project, secretValues);
|
|
66643
|
+
}
|
|
66644
|
+
return genericEnvelope(project, secretValues);
|
|
66645
|
+
} catch {
|
|
66646
|
+
return genericEnvelope(project, secretValues);
|
|
66647
|
+
}
|
|
66648
|
+
}
|
|
66649
|
+
function projectSystemEventData(entry, eventPayload, secretValues = []) {
|
|
66650
|
+
if (eventPayload === null || eventPayload === undefined)
|
|
66651
|
+
return null;
|
|
66652
|
+
const state = { nodes: 0, seen: new WeakSet, secretValues };
|
|
66653
|
+
if (!isRecord3(eventPayload)) {
|
|
66654
|
+
const value = projectValue(eventPayload, state, 0);
|
|
66655
|
+
return value === undefined ? null : { value };
|
|
66656
|
+
}
|
|
66657
|
+
if (!entry)
|
|
66658
|
+
return null;
|
|
66659
|
+
if (entry.payloadPolicy !== "raw-safe")
|
|
66660
|
+
return projectAllowedMetadata(entry, eventPayload, state);
|
|
66661
|
+
const result = {};
|
|
66662
|
+
for (const [key2, value] of safeEntries(eventPayload).slice(0, MAX_OBJECT_FIELDS)) {
|
|
66663
|
+
const projected = projectKeyValue(key2, value, state, 0);
|
|
66664
|
+
if (projected !== undefined)
|
|
66665
|
+
result[boundedKey(key2)] = projected;
|
|
66666
|
+
}
|
|
66667
|
+
return result;
|
|
66668
|
+
}
|
|
66669
|
+
function projectAllowedMetadata(entry, eventPayload, state) {
|
|
66670
|
+
const result = {};
|
|
66671
|
+
const paths = new Set([...CORE_METADATA_PATHS, ...entry.metadataFields.map((field) => field.path)]);
|
|
66672
|
+
for (const path9 of paths) {
|
|
66673
|
+
const value = getPath(eventPayload, path9);
|
|
66674
|
+
if (value === undefined)
|
|
66675
|
+
continue;
|
|
66676
|
+
const key2 = path9.split(".").at(-1) ?? path9;
|
|
66677
|
+
const projected = projectKeyValue(key2, value, state, path9.split(".").length - 1);
|
|
66678
|
+
if (projected !== undefined)
|
|
66679
|
+
setPath(result, path9, projected);
|
|
66680
|
+
}
|
|
66681
|
+
return result;
|
|
66682
|
+
}
|
|
66683
|
+
function projectKeyValue(key2, value, state, depth) {
|
|
66684
|
+
if (isOmittedKey(key2))
|
|
66685
|
+
return;
|
|
66686
|
+
if ((key2 === "findings" || key2 === "finding") && typeof value === "object")
|
|
66687
|
+
return;
|
|
66688
|
+
if (SECRET_KEY.test(key2))
|
|
66689
|
+
return "[REDACTED]";
|
|
66690
|
+
return projectValue(value, state, depth);
|
|
66691
|
+
}
|
|
66692
|
+
function projectValue(value, state, depth) {
|
|
66693
|
+
if (state.nodes >= MAX_TOTAL_NODES || depth > MAX_DEPTH)
|
|
66694
|
+
return "[truncated]";
|
|
66695
|
+
state.nodes += 1;
|
|
66696
|
+
if (value === null || typeof value === "boolean")
|
|
66697
|
+
return value;
|
|
66698
|
+
if (typeof value === "number")
|
|
66699
|
+
return Number.isFinite(value) ? value : undefined;
|
|
66700
|
+
if (typeof value === "string")
|
|
66701
|
+
return redactAndBound(value, state.secretValues, MAX_STRING_LENGTH);
|
|
66702
|
+
if (typeof value === "bigint")
|
|
66703
|
+
return redactAndBound(String(value), state.secretValues, MAX_STRING_LENGTH);
|
|
66704
|
+
if (typeof value !== "object")
|
|
66705
|
+
return;
|
|
66706
|
+
if (state.seen.has(value))
|
|
66707
|
+
return "[circular]";
|
|
66708
|
+
state.seen.add(value);
|
|
66709
|
+
if (Array.isArray(value)) {
|
|
66710
|
+
const result2 = [];
|
|
66711
|
+
for (const item of value.slice(0, MAX_ARRAY_ITEMS)) {
|
|
66712
|
+
const projected = projectValue(item, state, depth + 1);
|
|
66713
|
+
if (projected !== undefined)
|
|
66714
|
+
result2.push(projected);
|
|
66715
|
+
}
|
|
66716
|
+
if (value.length > MAX_ARRAY_ITEMS)
|
|
66717
|
+
result2.push("[truncated]");
|
|
66718
|
+
return result2;
|
|
66719
|
+
}
|
|
66720
|
+
const result = {};
|
|
66721
|
+
for (const [key2, item] of safeEntries(value).slice(0, MAX_OBJECT_FIELDS)) {
|
|
66722
|
+
const projected = projectKeyValue(key2, item, state, depth + 1);
|
|
66723
|
+
if (projected !== undefined)
|
|
66724
|
+
result[boundedKey(key2)] = projected;
|
|
66725
|
+
}
|
|
66726
|
+
return result;
|
|
66727
|
+
}
|
|
66728
|
+
function extractEnvelopeCorrelation(eventPayload, secretValues) {
|
|
66729
|
+
if (!isRecord3(eventPayload))
|
|
66730
|
+
return {};
|
|
66731
|
+
const nested = isRecord3(eventPayload.correlation) ? eventPayload.correlation : {};
|
|
66732
|
+
const entity2 = isRecord3(eventPayload.entity) ? eventPayload.entity : {};
|
|
66733
|
+
const result = {};
|
|
66734
|
+
assignString(result, "runId", eventPayload.runId ?? eventPayload.run_id ?? nested.runId, secretValues);
|
|
66735
|
+
assignString(result, "executionId", eventPayload.executionId ?? nested.executionId, secretValues);
|
|
66736
|
+
assignString(result, "actionId", eventPayload.actionId ?? nested.actionId, secretValues);
|
|
66737
|
+
assignString(result, "entityKind", eventPayload.entityKind ?? entity2.kind, secretValues);
|
|
66738
|
+
assignString(result, "entityId", eventPayload.entityId ?? entity2.id, secretValues);
|
|
66739
|
+
assignString(result, "jobId", eventPayload.jobId, secretValues);
|
|
66740
|
+
const sequence = eventPayload.sequence;
|
|
66741
|
+
if (typeof sequence === "number" && Number.isFinite(sequence))
|
|
66742
|
+
result.sequence = sequence;
|
|
66743
|
+
return result;
|
|
66744
|
+
}
|
|
66745
|
+
function assignString(target, key2, value, secretValues) {
|
|
66746
|
+
if (typeof value !== "string" || value.length === 0)
|
|
66747
|
+
return;
|
|
66748
|
+
target[key2] = redactAndBound(value, secretValues, 128);
|
|
66749
|
+
}
|
|
66750
|
+
function buildPresentationFields(entry, data) {
|
|
66751
|
+
if (!entry || !data)
|
|
66752
|
+
return [];
|
|
66753
|
+
const fields = [];
|
|
66754
|
+
for (const field of entry.metadataFields.slice(0, 8)) {
|
|
66755
|
+
const value = getPath(data, field.path);
|
|
66756
|
+
const rendered = renderFieldValue(value);
|
|
66757
|
+
if (rendered !== undefined)
|
|
66758
|
+
fields.push({ label: field.label, value: rendered });
|
|
66759
|
+
}
|
|
66760
|
+
return fields;
|
|
66761
|
+
}
|
|
66762
|
+
function buildSummary(entry, correlation, outcome) {
|
|
66763
|
+
const label = entry ? humanizeEventName(entry.name) : "Unknown system event";
|
|
66764
|
+
const identity6 = correlation.entityId ?? correlation.runId ?? correlation.jobId;
|
|
66765
|
+
return [label, identity6, outcome].filter((part) => Boolean(part)).join(" \xB7 ");
|
|
66766
|
+
}
|
|
66767
|
+
function buildAction(entry, correlation) {
|
|
66768
|
+
if (!entry)
|
|
66769
|
+
return {};
|
|
66770
|
+
if (entry.remediationKind === "workflow-trace" && isSafeIdentifier(correlation.runId)) {
|
|
66771
|
+
return {
|
|
66772
|
+
action: {
|
|
66773
|
+
label: "Trace workflow run",
|
|
66774
|
+
kind: "command",
|
|
66775
|
+
value: `spur workflow trace ${correlation.runId}`
|
|
66776
|
+
}
|
|
66777
|
+
};
|
|
66778
|
+
}
|
|
66779
|
+
if (entry.remediationKind === "rule-trace" && isSafeIdentifier(correlation.runId)) {
|
|
66780
|
+
return {
|
|
66781
|
+
action: {
|
|
66782
|
+
label: "Trace rule run",
|
|
66783
|
+
kind: "command",
|
|
66784
|
+
value: `spur rule trace ${correlation.runId}`
|
|
66785
|
+
}
|
|
66786
|
+
};
|
|
66787
|
+
}
|
|
66788
|
+
if (entry.remediationKind === "prefix-filter") {
|
|
66789
|
+
return {
|
|
66790
|
+
action: { label: `Filter ${entry.prefix} events`, kind: "filter", value: `prefix=${entry.prefix}` }
|
|
66791
|
+
};
|
|
66792
|
+
}
|
|
66793
|
+
return {};
|
|
66794
|
+
}
|
|
66795
|
+
function extractSeverity(eventPayload) {
|
|
66796
|
+
if (!isRecord3(eventPayload))
|
|
66797
|
+
return;
|
|
66798
|
+
return eventPayload.severity === "info" || eventPayload.severity === "warning" || eventPayload.severity === "error" ? eventPayload.severity : undefined;
|
|
66799
|
+
}
|
|
66800
|
+
function firstBoundedString(eventPayload, keys, secretValues) {
|
|
66801
|
+
if (!isRecord3(eventPayload))
|
|
66802
|
+
return;
|
|
66803
|
+
for (const key2 of keys) {
|
|
66804
|
+
const value = eventPayload[key2];
|
|
66805
|
+
if (typeof value === "string" && value.length > 0)
|
|
66806
|
+
return redactAndBound(value, secretValues, 128);
|
|
66807
|
+
if (typeof value === "boolean" || typeof value === "number")
|
|
66808
|
+
return String(value);
|
|
66809
|
+
}
|
|
66810
|
+
return;
|
|
66811
|
+
}
|
|
66812
|
+
function boundedProjectContext(project, secretValues) {
|
|
66813
|
+
return {
|
|
66814
|
+
name: redactAndBound(project.name || "unknown", secretValues, 128),
|
|
66815
|
+
root: redactAndBound(project.root || "", secretValues, MAX_STRING_LENGTH)
|
|
66816
|
+
};
|
|
66817
|
+
}
|
|
66818
|
+
function genericEnvelope(project, secretValues) {
|
|
66819
|
+
return {
|
|
66820
|
+
schemaVersion: SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION,
|
|
66821
|
+
data: null,
|
|
66822
|
+
context: {
|
|
66823
|
+
project: boundedProjectContext(project, secretValues),
|
|
66824
|
+
producer: { package: "spur", subsystem: "unknown" },
|
|
66825
|
+
correlation: {}
|
|
66826
|
+
},
|
|
66827
|
+
presentation: {
|
|
66828
|
+
severity: "warning",
|
|
66829
|
+
summary: "Unknown system event",
|
|
66830
|
+
description: "Unknown system event with bounded metadata.",
|
|
66831
|
+
fields: []
|
|
66832
|
+
}
|
|
66833
|
+
};
|
|
66834
|
+
}
|
|
66835
|
+
function getPath(value, path9) {
|
|
66836
|
+
let current = value;
|
|
66837
|
+
for (const segment of path9.split(".")) {
|
|
66838
|
+
if (!isRecord3(current))
|
|
66839
|
+
return;
|
|
66840
|
+
current = current[segment];
|
|
66841
|
+
}
|
|
66842
|
+
return current;
|
|
66843
|
+
}
|
|
66844
|
+
function renderFieldValue(value) {
|
|
66845
|
+
if (typeof value === "string")
|
|
66846
|
+
return value;
|
|
66847
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
66848
|
+
return String(value);
|
|
66849
|
+
if (typeof value === "boolean")
|
|
66850
|
+
return String(value);
|
|
66851
|
+
return;
|
|
66852
|
+
}
|
|
66853
|
+
function humanizeEventName(name) {
|
|
66854
|
+
const words = name.replaceAll(".", " ").replaceAll("_", " ");
|
|
66855
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
66856
|
+
}
|
|
66857
|
+
function isSafeIdentifier(value) {
|
|
66858
|
+
return typeof value === "string" && SAFE_IDENTIFIER.test(value);
|
|
66859
|
+
}
|
|
66860
|
+
function isOmittedKey(key2) {
|
|
66861
|
+
const normalized = key2.replaceAll(/[^A-Za-z0-9]/g, "").toLowerCase();
|
|
66862
|
+
return OMITTED_KEY.test(normalized);
|
|
66863
|
+
}
|
|
66864
|
+
function setPath(target, path9, value) {
|
|
66865
|
+
const segments = path9.split(".");
|
|
66866
|
+
let current = target;
|
|
66867
|
+
for (const segment of segments.slice(0, -1)) {
|
|
66868
|
+
const existing = current[segment];
|
|
66869
|
+
if (isRecord3(existing)) {
|
|
66870
|
+
current = existing;
|
|
66871
|
+
continue;
|
|
66872
|
+
}
|
|
66873
|
+
const nested = {};
|
|
66874
|
+
current[segment] = nested;
|
|
66875
|
+
current = nested;
|
|
66876
|
+
}
|
|
66877
|
+
const finalSegment = segments.at(-1);
|
|
66878
|
+
if (finalSegment)
|
|
66879
|
+
current[finalSegment] = value;
|
|
66880
|
+
}
|
|
66881
|
+
function hasOnlyKeys(value, allowed) {
|
|
66882
|
+
return safeEntries(value).every(([key2]) => allowed.has(key2));
|
|
66883
|
+
}
|
|
66884
|
+
function isBoundedString(value, maxLength = MAX_STRING_LENGTH + 1) {
|
|
66885
|
+
return typeof value === "string" && value.length <= maxLength;
|
|
66886
|
+
}
|
|
66887
|
+
function isValidCorrelation(value) {
|
|
66888
|
+
for (const [key2, item] of safeEntries(value)) {
|
|
66889
|
+
if (key2 === "sequence") {
|
|
66890
|
+
if (typeof item !== "number" || !Number.isFinite(item))
|
|
66891
|
+
return false;
|
|
66892
|
+
} else if (!isBoundedString(item, 129)) {
|
|
66893
|
+
return false;
|
|
66894
|
+
}
|
|
66895
|
+
}
|
|
66896
|
+
return true;
|
|
66897
|
+
}
|
|
66898
|
+
function isValidPresentation(value) {
|
|
66899
|
+
if (value.severity !== "info" && value.severity !== "warning" && value.severity !== "error")
|
|
66900
|
+
return false;
|
|
66901
|
+
if (!isBoundedString(value.summary, 512) || !isBoundedString(value.description, 512))
|
|
66902
|
+
return false;
|
|
66903
|
+
if (!Array.isArray(value.fields) || value.fields.length > 8)
|
|
66904
|
+
return false;
|
|
66905
|
+
for (const field of value.fields) {
|
|
66906
|
+
if (!isRecord3(field) || !hasOnlyKeys(field, new Set(["label", "value"])))
|
|
66907
|
+
return false;
|
|
66908
|
+
if (!isBoundedString(field.label, 128) || !isBoundedString(field.value))
|
|
66909
|
+
return false;
|
|
66910
|
+
}
|
|
66911
|
+
if (value.outcome !== undefined && !isBoundedString(value.outcome, 129))
|
|
66912
|
+
return false;
|
|
66913
|
+
if (value.action !== undefined && !isValidAction(value.action))
|
|
66914
|
+
return false;
|
|
66915
|
+
return true;
|
|
66916
|
+
}
|
|
66917
|
+
function isValidAction(value) {
|
|
66918
|
+
if (!isRecord3(value) || !hasOnlyKeys(value, new Set(["label", "kind", "value"])))
|
|
66919
|
+
return false;
|
|
66920
|
+
if (!isBoundedString(value.label, 128) || !isBoundedString(value.value))
|
|
66921
|
+
return false;
|
|
66922
|
+
if (value.kind !== "command" && value.kind !== "filter" && value.kind !== "path")
|
|
66923
|
+
return false;
|
|
66924
|
+
if (value.kind === "command")
|
|
66925
|
+
return /^spur (?:rule|workflow) trace [A-Za-z0-9._:-]+$/.test(value.value);
|
|
66926
|
+
if (value.kind === "filter")
|
|
66927
|
+
return /^prefix=[A-Za-z0-9._:-]+$/.test(value.value);
|
|
66928
|
+
return !/[\r\n\0]/.test(value.value);
|
|
66929
|
+
}
|
|
66930
|
+
function isBoundedProjectedValue(value) {
|
|
66931
|
+
const state = { nodes: 0, seen: new WeakSet };
|
|
66932
|
+
return validateProjectedValue(value, state, 0);
|
|
66933
|
+
}
|
|
66934
|
+
function validateProjectedValue(value, state, depth) {
|
|
66935
|
+
if (depth > MAX_DEPTH && value !== "[truncated]")
|
|
66936
|
+
return false;
|
|
66937
|
+
if (state.nodes >= MAX_TOTAL_NODES + MAX_OBJECT_FIELDS * MAX_DEPTH)
|
|
66938
|
+
return false;
|
|
66939
|
+
state.nodes += 1;
|
|
66940
|
+
if (value === null || typeof value === "boolean")
|
|
66941
|
+
return true;
|
|
66942
|
+
if (typeof value === "number")
|
|
66943
|
+
return Number.isFinite(value);
|
|
66944
|
+
if (typeof value === "string")
|
|
66945
|
+
return value.length <= MAX_STRING_LENGTH + 1;
|
|
66946
|
+
if (typeof value !== "object" || state.seen.has(value))
|
|
66947
|
+
return false;
|
|
66948
|
+
state.seen.add(value);
|
|
66949
|
+
if (Array.isArray(value)) {
|
|
66950
|
+
return value.length <= MAX_ARRAY_ITEMS + 1 && value.every((item) => validateProjectedValue(item, state, depth + 1));
|
|
66951
|
+
}
|
|
66952
|
+
const entries = safeEntries(value);
|
|
66953
|
+
if (entries.length > MAX_OBJECT_FIELDS)
|
|
66954
|
+
return false;
|
|
66955
|
+
return entries.every(([key2, item]) => key2.length <= MAX_FIELD_KEY_LENGTH && (!isOmittedKey(key2) || key2 === "value" && typeof item !== "object") && !SECRET_KEY.test(key2) && validateProjectedValue(item, state, depth + 1));
|
|
66956
|
+
}
|
|
66957
|
+
function boundedKey(key2) {
|
|
66958
|
+
return key2.length <= MAX_FIELD_KEY_LENGTH ? key2 : `${key2.slice(0, MAX_FIELD_KEY_LENGTH - 1)}\u2026`;
|
|
66959
|
+
}
|
|
66960
|
+
function isRecord3(value) {
|
|
66961
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
66962
|
+
}
|
|
66963
|
+
function safeEntries(value) {
|
|
66964
|
+
try {
|
|
66965
|
+
return Object.entries(value);
|
|
66966
|
+
} catch {
|
|
66967
|
+
return [];
|
|
66968
|
+
}
|
|
66969
|
+
}
|
|
66970
|
+
var SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION = 2, MAX_STRING_LENGTH = 256, MAX_DEPTH = 4, MAX_ARRAY_ITEMS = 16, MAX_OBJECT_FIELDS = 32, MAX_TOTAL_NODES = 128, MAX_FIELD_KEY_LENGTH = 64, CORE_METADATA_PATHS, OMITTED_KEY, SECRET_KEY, PRODUCER_PACKAGES, CORRELATION_KEYS, PRESENTATION_KEYS, SAFE_IDENTIFIER;
|
|
66971
|
+
var init_system_event_envelope = __esm(() => {
|
|
66972
|
+
init_agent_execution();
|
|
66973
|
+
CORE_METADATA_PATHS = [
|
|
66974
|
+
"schemaVersion",
|
|
66975
|
+
"eventId",
|
|
66976
|
+
"event",
|
|
66977
|
+
"at",
|
|
66978
|
+
"timestamp",
|
|
66979
|
+
"actor",
|
|
66980
|
+
"runId",
|
|
66981
|
+
"executionId",
|
|
66982
|
+
"actionId",
|
|
66983
|
+
"commandId",
|
|
66984
|
+
"sequence",
|
|
66985
|
+
"correlation.runId",
|
|
66986
|
+
"correlation.executionId",
|
|
66987
|
+
"correlation.actionId",
|
|
66988
|
+
"entity.kind",
|
|
66989
|
+
"entity.id",
|
|
66990
|
+
"entityKind",
|
|
66991
|
+
"entityId",
|
|
66992
|
+
"jobId",
|
|
66993
|
+
"kind",
|
|
66994
|
+
"status",
|
|
66995
|
+
"outcome",
|
|
66996
|
+
"severity",
|
|
66997
|
+
"reason",
|
|
66998
|
+
"durationMs",
|
|
66999
|
+
"usage",
|
|
67000
|
+
"metadata.correlationId"
|
|
67001
|
+
];
|
|
67002
|
+
OMITTED_KEY = /^(?:args?|argv|body|command|commandline|content|details|env|environment|message|output|payload|prompt|query|response|stderr|stdin|stdout)$/;
|
|
67003
|
+
SECRET_KEY = /(?:api[-_]?key|authorization|cookie|credential|password|secret|token)/i;
|
|
67004
|
+
PRODUCER_PACKAGES = new Set([
|
|
67005
|
+
"spur",
|
|
67006
|
+
"@gobing-ai/ts-infra",
|
|
67007
|
+
"@gobing-ai/ts-runtime",
|
|
67008
|
+
"@gobing-ai/ts-ai-runner",
|
|
67009
|
+
"@gobing-ai/ts-rule-engine",
|
|
67010
|
+
"@gobing-ai/ts-dual-workflow-engine"
|
|
67011
|
+
]);
|
|
67012
|
+
CORRELATION_KEYS = new Set(["runId", "executionId", "actionId", "entityKind", "entityId", "jobId", "sequence"]);
|
|
67013
|
+
PRESENTATION_KEYS = new Set(["severity", "summary", "description", "fields", "outcome", "action"]);
|
|
67014
|
+
SAFE_IDENTIFIER = /^[A-Za-z0-9._:-]+$/;
|
|
67015
|
+
});
|
|
67016
|
+
|
|
66343
67017
|
// ../../packages/app/src/services/event-names.ts
|
|
66344
67018
|
function event(name, source, renderer, payloadPolicy = "metadata-only", tier = "default") {
|
|
67019
|
+
const profile = SOURCE_PROFILES[source];
|
|
66345
67020
|
return {
|
|
66346
67021
|
name,
|
|
66347
67022
|
prefix: name.split(".")[0] ?? name,
|
|
@@ -66350,48 +67025,187 @@ function event(name, source, renderer, payloadPolicy = "metadata-only", tier = "
|
|
|
66350
67025
|
persisted: true,
|
|
66351
67026
|
streamed: true,
|
|
66352
67027
|
payloadPolicy,
|
|
66353
|
-
renderer
|
|
67028
|
+
renderer,
|
|
67029
|
+
...profile,
|
|
67030
|
+
severity: inferSeverity(name),
|
|
67031
|
+
description: describeEvent(name)
|
|
66354
67032
|
};
|
|
66355
67033
|
}
|
|
67034
|
+
function inferSeverity(name) {
|
|
67035
|
+
if (/(?:failed|error|denied)$/.test(name))
|
|
67036
|
+
return "error";
|
|
67037
|
+
if (/(?:retrying|paused|dropped)$/.test(name))
|
|
67038
|
+
return "warning";
|
|
67039
|
+
return "info";
|
|
67040
|
+
}
|
|
67041
|
+
function describeEvent(name) {
|
|
67042
|
+
const words = name.replaceAll(".", " ").replaceAll("_", " ");
|
|
67043
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)} lifecycle event.`;
|
|
67044
|
+
}
|
|
66356
67045
|
function systemEventCatalogEntry(name) {
|
|
66357
67046
|
return SYSTEM_EVENT_CATALOG.find((entry) => entry.name === name);
|
|
66358
67047
|
}
|
|
66359
67048
|
function normalizeSystemEventPayload(entry, eventPayload, secretValues = []) {
|
|
66360
|
-
|
|
66361
|
-
return null;
|
|
66362
|
-
if (typeof eventPayload !== "object") {
|
|
66363
|
-
return { value: redactSecretValue(eventPayload, secretValues) };
|
|
66364
|
-
}
|
|
66365
|
-
const source = eventPayload;
|
|
66366
|
-
if (entry.payloadPolicy === "raw-safe")
|
|
66367
|
-
return redactSecretValues({ ...source }, secretValues);
|
|
66368
|
-
const redacted = { ...source };
|
|
66369
|
-
for (const key2 of ["body", "content", "message", "prompt", "query", "response", "value"]) {
|
|
66370
|
-
if (key2 in redacted) {
|
|
66371
|
-
redacted[key2] = "[redacted]";
|
|
66372
|
-
}
|
|
66373
|
-
}
|
|
66374
|
-
return redactSecretValues(redacted, secretValues);
|
|
67049
|
+
return projectSystemEventData(entry, eventPayload, secretValues);
|
|
66375
67050
|
}
|
|
66376
|
-
|
|
66377
|
-
if (typeof value === "string")
|
|
66378
|
-
return redactAndBound(value, secretValues, MAX_FIELD_LENGTH2);
|
|
66379
|
-
if (Array.isArray(value))
|
|
66380
|
-
return value.map((item) => redactSecretValue(item, secretValues));
|
|
66381
|
-
if (value !== null && typeof value === "object") {
|
|
66382
|
-
return redactSecretValues({ ...value }, secretValues);
|
|
66383
|
-
}
|
|
66384
|
-
return value;
|
|
66385
|
-
}
|
|
66386
|
-
function redactSecretValues(payload, secretValues) {
|
|
66387
|
-
for (const key2 of Object.keys(payload)) {
|
|
66388
|
-
payload[key2] = redactSecretValue(payload[key2], secretValues);
|
|
66389
|
-
}
|
|
66390
|
-
return payload;
|
|
66391
|
-
}
|
|
66392
|
-
var SYSTEM_EVENT_CATALOG, SYSTEM_EVENT_NAMES, SYSTEM_EVENT_PERSISTED_NAMES, SYSTEM_EVENT_STREAMED_NAMES, SYSTEM_EVENT_PREFIXES, SYSTEM_EVENT_DEFAULT_NAMES, SYSTEM_EVENT_DIAGNOSTIC_NAMES, PLANNING_EVENT_NAMES, SYSTEM_EVENT_CATALOG_METADATA, MAX_FIELD_LENGTH2 = 256;
|
|
67051
|
+
var field = (path9, label) => ({ path: path9, label }), SOURCE_PROFILES, SYSTEM_EVENT_CATALOG, SYSTEM_EVENT_NAMES, SYSTEM_EVENT_PERSISTED_NAMES, SYSTEM_EVENT_STREAMED_NAMES, SYSTEM_EVENT_PREFIXES, SYSTEM_EVENT_DEFAULT_NAMES, SYSTEM_EVENT_DIAGNOSTIC_NAMES, PLANNING_EVENT_NAMES, SYSTEM_EVENT_CATALOG_METADATA;
|
|
66393
67052
|
var init_event_names = __esm(() => {
|
|
66394
|
-
|
|
67053
|
+
init_system_event_envelope();
|
|
67054
|
+
init_system_event_envelope();
|
|
67055
|
+
SOURCE_PROFILES = {
|
|
67056
|
+
planning: {
|
|
67057
|
+
producerPackage: "spur",
|
|
67058
|
+
subsystem: "planning",
|
|
67059
|
+
metadataFields: [
|
|
67060
|
+
field("entity.kind", "Entity kind"),
|
|
67061
|
+
field("entity.id", "Entity"),
|
|
67062
|
+
field("field", "Field"),
|
|
67063
|
+
field("from", "From"),
|
|
67064
|
+
field("to", "To")
|
|
67065
|
+
],
|
|
67066
|
+
remediationKind: "prefix-filter"
|
|
67067
|
+
},
|
|
67068
|
+
queue: {
|
|
67069
|
+
producerPackage: "@gobing-ai/ts-infra",
|
|
67070
|
+
subsystem: "job-queue",
|
|
67071
|
+
metadataFields: [
|
|
67072
|
+
field("jobId", "Job"),
|
|
67073
|
+
field("type", "Type"),
|
|
67074
|
+
field("attempt", "Attempt"),
|
|
67075
|
+
field("maxRetries", "Max retries"),
|
|
67076
|
+
field("durationMs", "Duration (ms)"),
|
|
67077
|
+
field("error", "Error")
|
|
67078
|
+
],
|
|
67079
|
+
remediationKind: "prefix-filter"
|
|
67080
|
+
},
|
|
67081
|
+
scheduler: {
|
|
67082
|
+
producerPackage: "@gobing-ai/ts-infra",
|
|
67083
|
+
subsystem: "scheduler",
|
|
67084
|
+
metadataFields: [field("name", "Job"), field("durationMs", "Duration (ms)"), field("error", "Error")],
|
|
67085
|
+
remediationKind: "prefix-filter"
|
|
67086
|
+
},
|
|
67087
|
+
message: {
|
|
67088
|
+
producerPackage: "spur",
|
|
67089
|
+
subsystem: "team-messaging",
|
|
67090
|
+
metadataFields: [
|
|
67091
|
+
field("msgId", "Message"),
|
|
67092
|
+
field("fromId", "From"),
|
|
67093
|
+
field("toId", "To"),
|
|
67094
|
+
field("threadId", "Thread"),
|
|
67095
|
+
field("createdAt", "Created")
|
|
67096
|
+
],
|
|
67097
|
+
remediationKind: "prefix-filter"
|
|
67098
|
+
},
|
|
67099
|
+
process: {
|
|
67100
|
+
producerPackage: "@gobing-ai/ts-runtime",
|
|
67101
|
+
subsystem: "process-executor",
|
|
67102
|
+
metadataFields: [
|
|
67103
|
+
field("label", "Label"),
|
|
67104
|
+
field("pid", "PID"),
|
|
67105
|
+
field("exitCode", "Exit code"),
|
|
67106
|
+
field("signal", "Signal"),
|
|
67107
|
+
field("durationMs", "Duration (ms)"),
|
|
67108
|
+
field("reason", "Reason")
|
|
67109
|
+
],
|
|
67110
|
+
remediationKind: "prefix-filter"
|
|
67111
|
+
},
|
|
67112
|
+
workflow: {
|
|
67113
|
+
producerPackage: "@gobing-ai/ts-dual-workflow-engine",
|
|
67114
|
+
subsystem: "workflow",
|
|
67115
|
+
metadataFields: [
|
|
67116
|
+
field("runId", "Run"),
|
|
67117
|
+
field("workflowName", "Workflow"),
|
|
67118
|
+
field("phase", "Phase"),
|
|
67119
|
+
field("node", "Node"),
|
|
67120
|
+
field("from", "From"),
|
|
67121
|
+
field("to", "To"),
|
|
67122
|
+
field("kind", "Kind"),
|
|
67123
|
+
field("durationMs", "Duration (ms)"),
|
|
67124
|
+
field("reason", "Reason")
|
|
67125
|
+
],
|
|
67126
|
+
remediationKind: "workflow-trace"
|
|
67127
|
+
},
|
|
67128
|
+
rule: {
|
|
67129
|
+
producerPackage: "@gobing-ai/ts-rule-engine",
|
|
67130
|
+
subsystem: "rule-engine",
|
|
67131
|
+
metadataFields: [
|
|
67132
|
+
field("runId", "Run"),
|
|
67133
|
+
field("ruleId", "Rule"),
|
|
67134
|
+
field("severity", "Severity"),
|
|
67135
|
+
field("evaluator", "Evaluator"),
|
|
67136
|
+
field("findings", "Findings"),
|
|
67137
|
+
field("durationMs", "Duration (ms)"),
|
|
67138
|
+
field("error", "Error")
|
|
67139
|
+
],
|
|
67140
|
+
remediationKind: "rule-trace"
|
|
67141
|
+
},
|
|
67142
|
+
agent: {
|
|
67143
|
+
producerPackage: "@gobing-ai/ts-ai-runner",
|
|
67144
|
+
subsystem: "agent-runner",
|
|
67145
|
+
metadataFields: [
|
|
67146
|
+
field("agentId", "Agent"),
|
|
67147
|
+
field("agentType", "Agent type"),
|
|
67148
|
+
field("agent", "Agent"),
|
|
67149
|
+
field("operation", "Operation"),
|
|
67150
|
+
field("label", "Label"),
|
|
67151
|
+
field("exitCode", "Exit code"),
|
|
67152
|
+
field("durationMs", "Duration (ms)")
|
|
67153
|
+
],
|
|
67154
|
+
remediationKind: "prefix-filter"
|
|
67155
|
+
},
|
|
67156
|
+
team: {
|
|
67157
|
+
producerPackage: "spur",
|
|
67158
|
+
subsystem: "team",
|
|
67159
|
+
metadataFields: [
|
|
67160
|
+
field("teamId", "Team"),
|
|
67161
|
+
field("memberId", "Member"),
|
|
67162
|
+
field("agentType", "Agent type"),
|
|
67163
|
+
field("memberCount", "Members"),
|
|
67164
|
+
field("taskId", "Task"),
|
|
67165
|
+
field("outcome", "Outcome")
|
|
67166
|
+
],
|
|
67167
|
+
remediationKind: "prefix-filter"
|
|
67168
|
+
},
|
|
67169
|
+
history: {
|
|
67170
|
+
producerPackage: "spur",
|
|
67171
|
+
subsystem: "history",
|
|
67172
|
+
metadataFields: [
|
|
67173
|
+
field("source", "Source"),
|
|
67174
|
+
field("sources", "Sources"),
|
|
67175
|
+
field("files", "Files"),
|
|
67176
|
+
field("messages", "Messages"),
|
|
67177
|
+
field("durationMs", "Duration (ms)"),
|
|
67178
|
+
field("exitCode", "Exit code"),
|
|
67179
|
+
field("detail", "Detail"),
|
|
67180
|
+
field("cwd", "Project root"),
|
|
67181
|
+
field("artifactPath", "Artifact")
|
|
67182
|
+
],
|
|
67183
|
+
remediationKind: "prefix-filter"
|
|
67184
|
+
},
|
|
67185
|
+
bus: {
|
|
67186
|
+
producerPackage: "@gobing-ai/ts-infra",
|
|
67187
|
+
subsystem: "event-bus",
|
|
67188
|
+
metadataFields: [
|
|
67189
|
+
field("event", "Event"),
|
|
67190
|
+
field("handlers", "Handlers"),
|
|
67191
|
+
field("durationMs", "Duration (ms)"),
|
|
67192
|
+
field("error", "Error")
|
|
67193
|
+
],
|
|
67194
|
+
remediationKind: "prefix-filter"
|
|
67195
|
+
},
|
|
67196
|
+
api: {
|
|
67197
|
+
producerPackage: "spur",
|
|
67198
|
+
subsystem: "http-api",
|
|
67199
|
+
metadataFields: [
|
|
67200
|
+
field("method", "Method"),
|
|
67201
|
+
field("path", "Path"),
|
|
67202
|
+
field("status", "Status"),
|
|
67203
|
+
field("code", "Code"),
|
|
67204
|
+
field("requestId", "Request")
|
|
67205
|
+
],
|
|
67206
|
+
remediationKind: "prefix-filter"
|
|
67207
|
+
}
|
|
67208
|
+
};
|
|
66395
67209
|
SYSTEM_EVENT_CATALOG = [
|
|
66396
67210
|
event("task.created", "planning", "planning"),
|
|
66397
67211
|
event("task.updated", "planning", "planning"),
|
|
@@ -66469,7 +67283,31 @@ var init_event_names = __esm(() => {
|
|
|
66469
67283
|
SYSTEM_EVENT_DEFAULT_NAMES = SYSTEM_EVENT_CATALOG.filter((entry) => entry.tier === "default").map((entry) => entry.name);
|
|
66470
67284
|
SYSTEM_EVENT_DIAGNOSTIC_NAMES = SYSTEM_EVENT_CATALOG.filter((entry) => entry.tier === "diagnostic").map((entry) => entry.name);
|
|
66471
67285
|
PLANNING_EVENT_NAMES = SYSTEM_EVENT_NAMES;
|
|
66472
|
-
SYSTEM_EVENT_CATALOG_METADATA = SYSTEM_EVENT_CATALOG.map(({
|
|
67286
|
+
SYSTEM_EVENT_CATALOG_METADATA = SYSTEM_EVENT_CATALOG.map(({
|
|
67287
|
+
name,
|
|
67288
|
+
prefix,
|
|
67289
|
+
source,
|
|
67290
|
+
tier,
|
|
67291
|
+
renderer,
|
|
67292
|
+
producerPackage,
|
|
67293
|
+
subsystem,
|
|
67294
|
+
severity,
|
|
67295
|
+
description,
|
|
67296
|
+
metadataFields,
|
|
67297
|
+
remediationKind
|
|
67298
|
+
}) => ({
|
|
67299
|
+
name,
|
|
67300
|
+
prefix,
|
|
67301
|
+
source,
|
|
67302
|
+
tier,
|
|
67303
|
+
renderer,
|
|
67304
|
+
producerPackage,
|
|
67305
|
+
subsystem,
|
|
67306
|
+
severity,
|
|
67307
|
+
description,
|
|
67308
|
+
metadataFields,
|
|
67309
|
+
remediationKind
|
|
67310
|
+
}));
|
|
66473
67311
|
});
|
|
66474
67312
|
|
|
66475
67313
|
// ../../packages/app/src/services/feature-service.ts
|
|
@@ -67772,7 +68610,7 @@ class BusPlanningEventEmitter {
|
|
|
67772
68610
|
payload: event2.data ? JSON.stringify(event2.data) : null,
|
|
67773
68611
|
created_at: event2.at
|
|
67774
68612
|
});
|
|
67775
|
-
this.bus.emit(event2.event, event2);
|
|
68613
|
+
this.bus.emit(event2.event, { ...event2, severity: "info" });
|
|
67776
68614
|
}
|
|
67777
68615
|
}
|
|
67778
68616
|
var init_planning_events = __esm(() => {
|
|
@@ -68646,17 +69484,19 @@ class RuleService {
|
|
|
68646
69484
|
dryRun,
|
|
68647
69485
|
metadataJson: JSON.stringify(selectedRule === undefined ? { cwd: this.context.cwd } : { cwd: this.context.cwd, rule: selectedRule })
|
|
68648
69486
|
};
|
|
69487
|
+
const ruleEvents = new EventBus;
|
|
69488
|
+
this.forwardRuleEvents(ruleEvents, runId, filteredRules);
|
|
68649
69489
|
const engineOptions = {
|
|
68650
69490
|
persistence: persistence2,
|
|
68651
69491
|
runId,
|
|
68652
69492
|
runMeta,
|
|
68653
69493
|
fileSystem: this.context.fs,
|
|
68654
|
-
|
|
69494
|
+
events: ruleEvents
|
|
68655
69495
|
};
|
|
68656
69496
|
const engine2 = new RuleEngine(engineOptions);
|
|
68657
69497
|
let result;
|
|
68658
69498
|
if (verbose && !json3) {
|
|
68659
|
-
const [engineResult, enabled] = await this.evaluateVerbose(engineOptions, filteredRules, color, stopOnFirst, fixMode);
|
|
69499
|
+
const [engineResult, enabled] = await this.evaluateVerbose(engineOptions, filteredRules, color, stopOnFirst, fixMode, ruleEvents);
|
|
68660
69500
|
result = engineResult;
|
|
68661
69501
|
enabledCount = enabled;
|
|
68662
69502
|
} else if (fixMode !== "none") {
|
|
@@ -68764,7 +69604,8 @@ ${ruleIds.join(`
|
|
|
68764
69604
|
return { runs: [] };
|
|
68765
69605
|
const dao2 = new RuleRunDao(db2);
|
|
68766
69606
|
const runs2 = await dao2.list(filter);
|
|
68767
|
-
|
|
69607
|
+
const secretValues = configuredSecretValues(this.context.env);
|
|
69608
|
+
return { runs: runs2.map((run) => projectRuleTraceRun(run, this.context.cwd, secretValues)) };
|
|
68768
69609
|
}
|
|
68769
69610
|
async traceDetail(runId) {
|
|
68770
69611
|
const db2 = await this.context.getDb?.();
|
|
@@ -68776,7 +69617,11 @@ ${ruleIds.join(`
|
|
|
68776
69617
|
if (!run)
|
|
68777
69618
|
throw new Error("Run not found");
|
|
68778
69619
|
const evaluations = await evalDao.byRunId(runId);
|
|
68779
|
-
|
|
69620
|
+
const secretValues = configuredSecretValues(this.context.env);
|
|
69621
|
+
return {
|
|
69622
|
+
run: projectRuleTraceRun(run, this.context.cwd, secretValues),
|
|
69623
|
+
evaluations: evaluations.map((evaluation) => projectRuleTraceEvaluation(evaluation, secretValues))
|
|
69624
|
+
};
|
|
68780
69625
|
}
|
|
68781
69626
|
async ruleRoots() {
|
|
68782
69627
|
const layers = await this.ruleSourceLayers({ includeBundled: true });
|
|
@@ -68812,26 +69657,65 @@ ${ruleIds.join(`
|
|
|
68812
69657
|
}
|
|
68813
69658
|
return layers;
|
|
68814
69659
|
}
|
|
68815
|
-
|
|
69660
|
+
forwardRuleEvents(localBus, runId, rules) {
|
|
69661
|
+
const serverBus = this.context.events;
|
|
69662
|
+
if (!serverBus)
|
|
69663
|
+
return;
|
|
69664
|
+
const byId = new Map(rules.map((rule) => [rule.id, rule]));
|
|
69665
|
+
const at = () => new Date().toISOString();
|
|
69666
|
+
const evaluationContext = (ruleId) => {
|
|
69667
|
+
const rule = byId.get(ruleId);
|
|
69668
|
+
return { severity: rule?.severity ?? "warning", evaluator: rule?.evaluator.type ?? "unknown" };
|
|
69669
|
+
};
|
|
69670
|
+
localBus.on("rule.run.start", (detail) => {
|
|
69671
|
+
serverBus.emit("rule.run.start", {
|
|
69672
|
+
...detail,
|
|
69673
|
+
runId,
|
|
69674
|
+
at: at(),
|
|
69675
|
+
severity: "info",
|
|
69676
|
+
evaluator: "rule-engine"
|
|
69677
|
+
});
|
|
69678
|
+
});
|
|
69679
|
+
localBus.on("rule.eval.start", (detail) => {
|
|
69680
|
+
serverBus.emit("rule.eval.start", {
|
|
69681
|
+
...detail,
|
|
69682
|
+
...evaluationContext(detail.ruleId),
|
|
69683
|
+
runId,
|
|
69684
|
+
at: at()
|
|
69685
|
+
});
|
|
69686
|
+
});
|
|
69687
|
+
localBus.on("rule.eval.done", ({ details: _details, ...detail }) => {
|
|
69688
|
+
serverBus.emit("rule.eval.done", {
|
|
69689
|
+
...detail,
|
|
69690
|
+
...evaluationContext(detail.ruleId),
|
|
69691
|
+
runId,
|
|
69692
|
+
at: at()
|
|
69693
|
+
});
|
|
69694
|
+
});
|
|
69695
|
+
localBus.on("rule.eval.error", (detail) => {
|
|
69696
|
+
serverBus.emit("rule.eval.error", {
|
|
69697
|
+
...detail,
|
|
69698
|
+
...evaluationContext(detail.ruleId),
|
|
69699
|
+
severity: "error",
|
|
69700
|
+
runId,
|
|
69701
|
+
at: at()
|
|
69702
|
+
});
|
|
69703
|
+
});
|
|
69704
|
+
localBus.on("rule.run.done", (detail) => {
|
|
69705
|
+
serverBus.emit("rule.run.done", {
|
|
69706
|
+
...detail,
|
|
69707
|
+
runId,
|
|
69708
|
+
at: at(),
|
|
69709
|
+
severity: detail.findings > 0 ? highestRuleSeverity(rules) : "info",
|
|
69710
|
+
evaluator: "rule-engine"
|
|
69711
|
+
});
|
|
69712
|
+
});
|
|
69713
|
+
}
|
|
69714
|
+
async evaluateVerbose(engineOptions, rules, color, stopOnFirst, fixMode = "none", localBus = new EventBus) {
|
|
68816
69715
|
const enabledRules = rules.filter((r) => r.enabled !== false);
|
|
68817
69716
|
const disabledRules = rules.filter((r) => r.enabled === false);
|
|
68818
69717
|
const enabledCount = enabledRules.length;
|
|
68819
69718
|
const totalCount = rules.length;
|
|
68820
|
-
const localBus = new EventBus;
|
|
68821
|
-
if (this.context.events !== undefined) {
|
|
68822
|
-
const serverBus = this.context.events;
|
|
68823
|
-
for (const eventName of [
|
|
68824
|
-
"rule.run.start",
|
|
68825
|
-
"rule.eval.start",
|
|
68826
|
-
"rule.eval.done",
|
|
68827
|
-
"rule.eval.error",
|
|
68828
|
-
"rule.run.done"
|
|
68829
|
-
]) {
|
|
68830
|
-
localBus.on(eventName, (detail) => {
|
|
68831
|
-
serverBus.emit(eventName, detail);
|
|
68832
|
-
});
|
|
68833
|
-
}
|
|
68834
|
-
}
|
|
68835
69719
|
const engine2 = new RuleEngine({ ...engineOptions, events: localBus, fileSystem: this.context.fs });
|
|
68836
69720
|
const noun = totalCount === 1 ? "rule" : "rules";
|
|
68837
69721
|
const suffix = disabledRules.length > 0 ? color.dim(` (${disabledRules.length} disabled)`) : "";
|
|
@@ -69133,15 +70017,124 @@ ${ruleIds.join(`
|
|
|
69133
70017
|
return separatorIndex > 0 ? normalized.slice(0, separatorIndex) : null;
|
|
69134
70018
|
}
|
|
69135
70019
|
}
|
|
70020
|
+
function projectRuleTraceRun(run, cwd, secretValues) {
|
|
70021
|
+
const sourceValue = traceSourceValue(run, secretValues);
|
|
70022
|
+
const nextAction = ruleTraceNextAction(run.source_kind, sourceValue);
|
|
70023
|
+
const startedAt = ruleTraceTimestamp(run.started_at);
|
|
70024
|
+
const completedAt = run.completed_at === null ? null : ruleTraceTimestamp(run.completed_at);
|
|
70025
|
+
return {
|
|
70026
|
+
...run,
|
|
70027
|
+
started_at: startedAt,
|
|
70028
|
+
completed_at: completedAt,
|
|
70029
|
+
metadata_json: safeRuleMetadata(run.metadata_json, secretValues),
|
|
70030
|
+
project: systemEventProjectContext(cwd),
|
|
70031
|
+
source: { kind: boundedTraceText(run.source_kind, secretValues), value: sourceValue },
|
|
70032
|
+
timing: { startedAt, completedAt, durationMs: run.duration_ms },
|
|
70033
|
+
policy: {
|
|
70034
|
+
failOn: run.fail_on ?? "unavailable",
|
|
70035
|
+
stopOnFirst: run.stop_on_first ?? "none",
|
|
70036
|
+
fixMode: run.fix_mode,
|
|
70037
|
+
dryRun: run.dry_run === 1
|
|
70038
|
+
},
|
|
70039
|
+
outcome: run.status === "done" ? "success" : run.status === "failed" ? "failure" : "unavailable",
|
|
70040
|
+
...nextAction !== undefined ? { nextAction } : {}
|
|
70041
|
+
};
|
|
70042
|
+
}
|
|
70043
|
+
function projectRuleTraceEvaluation(evaluation, secretValues) {
|
|
70044
|
+
const startedAt = ruleTraceTimestamp(evaluation.started_at);
|
|
70045
|
+
const completedAt = evaluation.completed_at === null ? null : ruleTraceTimestamp(evaluation.completed_at);
|
|
70046
|
+
return {
|
|
70047
|
+
...evaluation,
|
|
70048
|
+
started_at: startedAt,
|
|
70049
|
+
completed_at: completedAt,
|
|
70050
|
+
error: evaluation.error === null ? null : redactAndBound(evaluation.error, secretValues, 512),
|
|
70051
|
+
findings_json: safeRuleArrayJson(evaluation.findings_json, "finding", secretValues),
|
|
70052
|
+
fixes_json: safeRuleArrayJson(evaluation.fixes_json, "fix", secretValues),
|
|
70053
|
+
timing: {
|
|
70054
|
+
startedAt,
|
|
70055
|
+
completedAt,
|
|
70056
|
+
durationMs: evaluation.duration_ms
|
|
70057
|
+
},
|
|
70058
|
+
findings: evaluation.finding_count,
|
|
70059
|
+
fixes: evaluation.fix_count
|
|
70060
|
+
};
|
|
70061
|
+
}
|
|
70062
|
+
function traceSourceValue(run, secretValues) {
|
|
70063
|
+
const value = run.source_value ?? run.preset;
|
|
70064
|
+
return typeof value === "string" && value.length > 0 ? boundedTraceText(value, secretValues, 512) : "unavailable";
|
|
70065
|
+
}
|
|
70066
|
+
function ruleTraceNextAction(sourceKind, sourceValue) {
|
|
70067
|
+
if (sourceKind === "preset" && TRACE_PRESET.test(sourceValue)) {
|
|
70068
|
+
return { label: "Run preset", kind: "command", value: `spur rule run --preset ${sourceValue}` };
|
|
70069
|
+
}
|
|
70070
|
+
if (sourceKind === "file" && sourceValue !== "unavailable" && !/[\0\r\n]/.test(sourceValue)) {
|
|
70071
|
+
return { label: "Inspect rule source", kind: "path", value: sourceValue };
|
|
70072
|
+
}
|
|
70073
|
+
return;
|
|
70074
|
+
}
|
|
70075
|
+
function safeRuleMetadata(metadataJson, secretValues) {
|
|
70076
|
+
try {
|
|
70077
|
+
const parsed = JSON.parse(metadataJson);
|
|
70078
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
70079
|
+
return "{}";
|
|
70080
|
+
const source = parsed;
|
|
70081
|
+
const projected = {};
|
|
70082
|
+
for (const field2 of ["cwd", "rule"]) {
|
|
70083
|
+
if (typeof source[field2] === "string")
|
|
70084
|
+
projected[field2] = boundedTraceText(source[field2], secretValues, 512);
|
|
70085
|
+
}
|
|
70086
|
+
return JSON.stringify(projected);
|
|
70087
|
+
} catch {
|
|
70088
|
+
return "{}";
|
|
70089
|
+
}
|
|
70090
|
+
}
|
|
70091
|
+
function safeRuleArrayJson(json3, kind, secretValues) {
|
|
70092
|
+
if (!json3)
|
|
70093
|
+
return null;
|
|
70094
|
+
try {
|
|
70095
|
+
const parsed = JSON.parse(json3);
|
|
70096
|
+
if (!Array.isArray(parsed))
|
|
70097
|
+
return null;
|
|
70098
|
+
const fields = kind === "finding" ? ["ruleId", "severity", "filePath", "line", "column", "code", "kind"] : ["ruleId", "filePath", "start", "end", "mode"];
|
|
70099
|
+
const projected = parsed.slice(0, 100).map((item) => {
|
|
70100
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
70101
|
+
return {};
|
|
70102
|
+
const source = item;
|
|
70103
|
+
const out = {};
|
|
70104
|
+
for (const field2 of fields) {
|
|
70105
|
+
const value = source[field2];
|
|
70106
|
+
if (typeof value === "string")
|
|
70107
|
+
out[field2] = boundedTraceText(value, secretValues, 512);
|
|
70108
|
+
else if (typeof value === "number" || typeof value === "boolean" || value === null)
|
|
70109
|
+
out[field2] = value;
|
|
70110
|
+
}
|
|
70111
|
+
return out;
|
|
70112
|
+
});
|
|
70113
|
+
return JSON.stringify(projected);
|
|
70114
|
+
} catch {
|
|
70115
|
+
return null;
|
|
70116
|
+
}
|
|
70117
|
+
}
|
|
70118
|
+
function boundedTraceText(value, secretValues, limit = 256) {
|
|
70119
|
+
return redactAndBound(value.replace(/[\r\n]+/g, " "), secretValues, limit);
|
|
70120
|
+
}
|
|
70121
|
+
function ruleTraceTimestamp(value) {
|
|
70122
|
+
return Number.isFinite(Date.parse(value)) ? value : "unavailable";
|
|
70123
|
+
}
|
|
69136
70124
|
function compareRuleEntries(left, right) {
|
|
69137
70125
|
return left.file.localeCompare(right.file) || left.id.localeCompare(right.id);
|
|
69138
70126
|
}
|
|
69139
|
-
|
|
70127
|
+
function highestRuleSeverity(rules) {
|
|
70128
|
+
return rules.reduce((highest, rule) => SEVERITY_RANK2[rule.severity] > SEVERITY_RANK2[highest] ? rule.severity : highest, "info");
|
|
70129
|
+
}
|
|
70130
|
+
var LOCAL_RULES_DIR, GLOBAL_RULES_DIR, SEVERITY_RANK2, TRACE_PRESET;
|
|
69140
70131
|
var init_rule_service = __esm(() => {
|
|
69141
70132
|
init_loader();
|
|
69142
70133
|
init_src2();
|
|
69143
70134
|
init_dist6();
|
|
69144
70135
|
init_dist10();
|
|
70136
|
+
init_agent_execution();
|
|
70137
|
+
init_system_event_envelope();
|
|
69145
70138
|
LOCAL_RULES_DIR = join14(".spur", "rules");
|
|
69146
70139
|
GLOBAL_RULES_DIR = join14(".config", "spur", "rules");
|
|
69147
70140
|
SEVERITY_RANK2 = {
|
|
@@ -69149,6 +70142,7 @@ var init_rule_service = __esm(() => {
|
|
|
69149
70142
|
warning: 1,
|
|
69150
70143
|
error: 2
|
|
69151
70144
|
};
|
|
70145
|
+
TRACE_PRESET = /^[A-Za-z0-9._-]+$/;
|
|
69152
70146
|
});
|
|
69153
70147
|
|
|
69154
70148
|
// ../../packages/app/src/services/run-store-service.ts
|
|
@@ -69211,7 +70205,7 @@ function summarizeActionResult(resultJson, secretValues = []) {
|
|
|
69211
70205
|
return redactValue3(parsed, secretValues);
|
|
69212
70206
|
}
|
|
69213
70207
|
function redactString(value, secretValues) {
|
|
69214
|
-
return redactAndBound(value, secretValues,
|
|
70208
|
+
return redactAndBound(value, secretValues, MAX_FIELD_LENGTH2);
|
|
69215
70209
|
}
|
|
69216
70210
|
function redactValue3(value, secretValues) {
|
|
69217
70211
|
if (value === null || value === undefined)
|
|
@@ -69334,7 +70328,7 @@ class RunStoreService {
|
|
|
69334
70328
|
return { wbs, links, count: links.length };
|
|
69335
70329
|
}
|
|
69336
70330
|
}
|
|
69337
|
-
var RUN_STORE_LIST_DEFAULT_LIMIT = 50, RUN_STORE_LIST_MAX_LIMIT = 200, RUN_STORE_WBS_DEFAULT_LIMIT = 50, RUN_STORE_WBS_MAX_LIMIT = 200,
|
|
70331
|
+
var RUN_STORE_LIST_DEFAULT_LIMIT = 50, RUN_STORE_LIST_MAX_LIMIT = 200, RUN_STORE_WBS_DEFAULT_LIMIT = 50, RUN_STORE_WBS_MAX_LIMIT = 200, MAX_FIELD_LENGTH2 = 256, SENSITIVE_KEYS, RunStoreNotFoundError, RunStoreBadCursorError;
|
|
69338
70332
|
var init_run_store_service = __esm(() => {
|
|
69339
70333
|
init_src2();
|
|
69340
70334
|
init_agent_execution();
|
|
@@ -69609,12 +70603,14 @@ class SupervisorService {
|
|
|
69609
70603
|
}
|
|
69610
70604
|
emit(name, payload) {
|
|
69611
70605
|
try {
|
|
69612
|
-
|
|
70606
|
+
const exitCode = payload.exitCode;
|
|
70607
|
+
const severity = name === "process.exited" && exitCode !== undefined && exitCode !== null && exitCode !== 0 ? "warning" : "info";
|
|
70608
|
+
this.eventBus.emit(name, { ...payload, severity });
|
|
69613
70609
|
} catch {}
|
|
69614
70610
|
}
|
|
69615
70611
|
emitTeamMember(name, payload) {
|
|
69616
70612
|
try {
|
|
69617
|
-
this.eventBus.emit(name, payload);
|
|
70613
|
+
this.eventBus.emit(name, { ...payload, severity: "info" });
|
|
69618
70614
|
} catch {}
|
|
69619
70615
|
}
|
|
69620
70616
|
}
|
|
@@ -69652,7 +70648,7 @@ function registerSystemEventTap(bus, dao2, logger3, options = {}) {
|
|
|
69652
70648
|
event_name: entry.name,
|
|
69653
70649
|
occurred_at: new Date().toISOString(),
|
|
69654
70650
|
actor: extractSystemEventActor(event2),
|
|
69655
|
-
payload_json: safeStringify(
|
|
70651
|
+
payload_json: safeStringify(buildSystemEventEnvelope(entry, event2, options.projectContext ?? systemEventProjectContext(""), options.secretValues)),
|
|
69656
70652
|
...extractSystemEventCorrelation(event2)
|
|
69657
70653
|
}, quotas, logger3);
|
|
69658
70654
|
inFlight.add(p);
|
|
@@ -69710,8 +70706,10 @@ function extractSystemEventCorrelation(event2) {
|
|
|
69710
70706
|
if (!event2 || typeof event2 !== "object")
|
|
69711
70707
|
return correlation;
|
|
69712
70708
|
const obj = event2;
|
|
69713
|
-
|
|
69714
|
-
|
|
70709
|
+
const nested = obj.correlation && typeof obj.correlation === "object" ? obj.correlation : {};
|
|
70710
|
+
const runId = obj.runId ?? obj.run_id ?? nested.runId;
|
|
70711
|
+
if (typeof runId === "string" && runId.length > 0)
|
|
70712
|
+
correlation.run_id = runId;
|
|
69715
70713
|
if (typeof obj.sequence === "number" && Number.isFinite(obj.sequence))
|
|
69716
70714
|
correlation.sequence = obj.sequence;
|
|
69717
70715
|
const entity2 = obj.entity;
|
|
@@ -69722,6 +70720,10 @@ function extractSystemEventCorrelation(event2) {
|
|
|
69722
70720
|
if (typeof id === "string" && id.length > 0)
|
|
69723
70721
|
correlation.entity_id = id;
|
|
69724
70722
|
}
|
|
70723
|
+
if (typeof obj.entityKind === "string" && obj.entityKind.length > 0)
|
|
70724
|
+
correlation.entity_kind = obj.entityKind;
|
|
70725
|
+
if (typeof obj.entityId === "string" && obj.entityId.length > 0)
|
|
70726
|
+
correlation.entity_id = obj.entityId;
|
|
69725
70727
|
return correlation;
|
|
69726
70728
|
}
|
|
69727
70729
|
function stringifyError(error51) {
|
|
@@ -69732,6 +70734,7 @@ function stringifyError(error51) {
|
|
|
69732
70734
|
var init_system_event_tap = __esm(() => {
|
|
69733
70735
|
init_src2();
|
|
69734
70736
|
init_event_names();
|
|
70737
|
+
init_system_event_envelope();
|
|
69735
70738
|
init_system_event_retention();
|
|
69736
70739
|
});
|
|
69737
70740
|
|
|
@@ -69740,11 +70743,13 @@ class SystemEventEmitter {
|
|
|
69740
70743
|
dao;
|
|
69741
70744
|
logger;
|
|
69742
70745
|
secretValues;
|
|
70746
|
+
projectContext;
|
|
69743
70747
|
quotas;
|
|
69744
|
-
constructor(dao2, logger3, retention = {}, secretValues = []) {
|
|
70748
|
+
constructor(dao2, logger3, retention = {}, secretValues = [], projectContext = systemEventProjectContext("")) {
|
|
69745
70749
|
this.dao = dao2;
|
|
69746
70750
|
this.logger = logger3;
|
|
69747
70751
|
this.secretValues = secretValues;
|
|
70752
|
+
this.projectContext = projectContext;
|
|
69748
70753
|
this.quotas = resolveRetentionQuotas(retention);
|
|
69749
70754
|
}
|
|
69750
70755
|
async emit(event2) {
|
|
@@ -69757,7 +70762,7 @@ class SystemEventEmitter {
|
|
|
69757
70762
|
event_name: entry.name,
|
|
69758
70763
|
occurred_at: event2.at,
|
|
69759
70764
|
actor: extractSystemEventActor(event2),
|
|
69760
|
-
payload_json: safeStringify(
|
|
70765
|
+
payload_json: safeStringify(buildSystemEventEnvelope(entry, event2, this.projectContext, this.secretValues)),
|
|
69761
70766
|
...extractSystemEventCorrelation(event2)
|
|
69762
70767
|
});
|
|
69763
70768
|
await this.dao.pruneQuotas(this.quotas, entry.prefix);
|
|
@@ -69772,6 +70777,7 @@ class SystemEventEmitter {
|
|
|
69772
70777
|
var init_system_event_emitter = __esm(() => {
|
|
69773
70778
|
init_src2();
|
|
69774
70779
|
init_event_names();
|
|
70780
|
+
init_system_event_envelope();
|
|
69775
70781
|
init_system_event_retention();
|
|
69776
70782
|
init_system_event_tap();
|
|
69777
70783
|
});
|
|
@@ -71688,7 +72694,7 @@ class TeamService {
|
|
|
71688
72694
|
if (!bus)
|
|
71689
72695
|
return;
|
|
71690
72696
|
try {
|
|
71691
|
-
bus.emit(name, payload);
|
|
72697
|
+
bus.emit(name, { ...payload, severity: "info" });
|
|
71692
72698
|
} catch {}
|
|
71693
72699
|
}
|
|
71694
72700
|
emitTeamLifecycleEvent(name, payload) {
|
|
@@ -71696,7 +72702,7 @@ class TeamService {
|
|
|
71696
72702
|
if (!bus)
|
|
71697
72703
|
return;
|
|
71698
72704
|
try {
|
|
71699
|
-
bus.emit(name, payload);
|
|
72705
|
+
bus.emit(name, { ...payload, severity: "info" });
|
|
71700
72706
|
} catch {}
|
|
71701
72707
|
}
|
|
71702
72708
|
emitTeamMemberEvent(name, payload) {
|
|
@@ -71704,7 +72710,7 @@ class TeamService {
|
|
|
71704
72710
|
if (!bus)
|
|
71705
72711
|
return;
|
|
71706
72712
|
try {
|
|
71707
|
-
bus.emit(name, payload);
|
|
72713
|
+
bus.emit(name, { ...payload, severity: "info" });
|
|
71708
72714
|
} catch {}
|
|
71709
72715
|
}
|
|
71710
72716
|
async resolveMemberIdentity(agentId) {
|
|
@@ -72274,7 +73280,7 @@ class WorkflowSteeringController {
|
|
|
72274
73280
|
});
|
|
72275
73281
|
}
|
|
72276
73282
|
publish(ack) {
|
|
72277
|
-
this.onAck?.(ack);
|
|
73283
|
+
this.onAck?.({ ...ack, severity: ack.accepted ? "info" : "warning" });
|
|
72278
73284
|
return ack;
|
|
72279
73285
|
}
|
|
72280
73286
|
requireActive() {
|
|
@@ -73028,7 +74034,8 @@ class HitlConfirmActionRunner {
|
|
|
73028
74034
|
runId: context4.runId,
|
|
73029
74035
|
node: context4.stateOrNodeId,
|
|
73030
74036
|
kind: "confirm",
|
|
73031
|
-
message: prompt
|
|
74037
|
+
message: prompt,
|
|
74038
|
+
severity: "info"
|
|
73032
74039
|
});
|
|
73033
74040
|
const answer = await this.responder.respond({
|
|
73034
74041
|
kind: "confirm",
|
|
@@ -73039,7 +74046,8 @@ class HitlConfirmActionRunner {
|
|
|
73039
74046
|
context4.events?.emit("workflow.hitl.response", {
|
|
73040
74047
|
runId: context4.runId,
|
|
73041
74048
|
node: context4.stateOrNodeId,
|
|
73042
|
-
ok: !(answer.cancelled || answer.value === "cancel")
|
|
74049
|
+
ok: !(answer.cancelled || answer.value === "cancel"),
|
|
74050
|
+
severity: "info"
|
|
73043
74051
|
});
|
|
73044
74052
|
return {
|
|
73045
74053
|
ok: true,
|
|
@@ -73072,7 +74080,8 @@ class HitlInputActionRunner {
|
|
|
73072
74080
|
runId: context4.runId,
|
|
73073
74081
|
node: context4.stateOrNodeId,
|
|
73074
74082
|
kind: "input",
|
|
73075
|
-
message: prompt
|
|
74083
|
+
message: prompt,
|
|
74084
|
+
severity: "info"
|
|
73076
74085
|
});
|
|
73077
74086
|
const answer = await this.responder.respond({
|
|
73078
74087
|
kind: "input",
|
|
@@ -73083,7 +74092,8 @@ class HitlInputActionRunner {
|
|
|
73083
74092
|
context4.events?.emit("workflow.hitl.response", {
|
|
73084
74093
|
runId: context4.runId,
|
|
73085
74094
|
node: context4.stateOrNodeId,
|
|
73086
|
-
ok: !answer.cancelled
|
|
74095
|
+
ok: !answer.cancelled,
|
|
74096
|
+
severity: "info"
|
|
73087
74097
|
});
|
|
73088
74098
|
if (answer.cancelled) {
|
|
73089
74099
|
return { ok: false, error: "hitl.input cancelled" };
|
|
@@ -73123,7 +74133,8 @@ class HitlSelectActionRunner {
|
|
|
73123
74133
|
runId: context4.runId,
|
|
73124
74134
|
node: context4.stateOrNodeId,
|
|
73125
74135
|
kind: "select",
|
|
73126
|
-
message: prompt
|
|
74136
|
+
message: prompt,
|
|
74137
|
+
severity: "info"
|
|
73127
74138
|
});
|
|
73128
74139
|
const answer = await this.responder.respond({
|
|
73129
74140
|
kind: "select",
|
|
@@ -73135,7 +74146,8 @@ class HitlSelectActionRunner {
|
|
|
73135
74146
|
context4.events?.emit("workflow.hitl.response", {
|
|
73136
74147
|
runId: context4.runId,
|
|
73137
74148
|
node: context4.stateOrNodeId,
|
|
73138
|
-
ok: !answer.cancelled
|
|
74149
|
+
ok: !answer.cancelled,
|
|
74150
|
+
severity: "info"
|
|
73139
74151
|
});
|
|
73140
74152
|
if (answer.cancelled) {
|
|
73141
74153
|
return { ok: false, error: "hitl.select cancelled" };
|
|
@@ -73487,7 +74499,8 @@ class StreamingShellActionRunner {
|
|
|
73487
74499
|
kind: KIND11,
|
|
73488
74500
|
node: context4.stateOrNodeId,
|
|
73489
74501
|
stream,
|
|
73490
|
-
chunk: bounded(chunk)
|
|
74502
|
+
chunk: bounded(chunk),
|
|
74503
|
+
severity: "info"
|
|
73491
74504
|
};
|
|
73492
74505
|
this.observabilityBus.emit("workflow.action.output", event2);
|
|
73493
74506
|
}
|
|
@@ -73508,7 +74521,8 @@ class StreamingShellActionRunner {
|
|
|
73508
74521
|
kind: KIND11,
|
|
73509
74522
|
node: context4.stateOrNodeId,
|
|
73510
74523
|
stream,
|
|
73511
|
-
chunk: bounded(tail2)
|
|
74524
|
+
chunk: bounded(tail2),
|
|
74525
|
+
severity: "info"
|
|
73512
74526
|
});
|
|
73513
74527
|
}
|
|
73514
74528
|
}
|
|
@@ -73956,7 +74970,7 @@ class WorkflowAppService {
|
|
|
73956
74970
|
limit: filter.last ?? 20
|
|
73957
74971
|
});
|
|
73958
74972
|
return {
|
|
73959
|
-
entries: rows.map(rowToTraceEntry),
|
|
74973
|
+
entries: rows.map((row) => rowToTraceEntry(row, this.ctx.cwd)),
|
|
73960
74974
|
total: rows.length
|
|
73961
74975
|
};
|
|
73962
74976
|
}
|
|
@@ -73965,7 +74979,7 @@ class WorkflowAppService {
|
|
|
73965
74979
|
const row = await runDao.traceRowById(runId);
|
|
73966
74980
|
if (!row)
|
|
73967
74981
|
throw new Error(`Run not found: ${runId}`);
|
|
73968
|
-
const run = rowToTraceEntry(row);
|
|
74982
|
+
const run = rowToTraceEntry(row, this.ctx.cwd);
|
|
73969
74983
|
const phaseRows = await new PhaseRunDao(db2).phaseRowsByRunId(runId);
|
|
73970
74984
|
const transitionRows = await new TransitionRunDao(db2).transitionRowsByRunId(runId);
|
|
73971
74985
|
const actionRows = await new ActionRunDao(db2).actionRowsByRunId(runId);
|
|
@@ -74001,11 +75015,21 @@ class WorkflowAppService {
|
|
|
74001
75015
|
});
|
|
74002
75016
|
} else if (tCreated <= aCreated) {
|
|
74003
75017
|
const t = transitionRows[ti++];
|
|
74004
|
-
events2.push({
|
|
75018
|
+
events2.push({
|
|
75019
|
+
kind: "transition",
|
|
75020
|
+
from: t.from_state,
|
|
75021
|
+
to: t.to_state,
|
|
75022
|
+
trigger: t.trigger,
|
|
75023
|
+
at: persistedTimestamp(t.created_at)
|
|
75024
|
+
});
|
|
74005
75025
|
} else {
|
|
74006
75026
|
const a2 = actionRows[ai++];
|
|
74007
75027
|
const duration3 = a2.duration_ms !== null ? `${a2.duration_ms}ms` : "";
|
|
74008
|
-
const
|
|
75028
|
+
const ok = a2.ok === null ? null : a2.ok === 1;
|
|
75029
|
+
const label = a2.status === "running" ? " (in-flight)" : ok === true ? " \u2713" : " \u2717";
|
|
75030
|
+
const result = projectActionTraceResult(a2.result_json, this.ctx.secretValues);
|
|
75031
|
+
const partialArtifact = await partialArtifactForAction(this.ctx.cwd, runId, a2.node, ok);
|
|
75032
|
+
const artifacts2 = partialArtifact === undefined ? [] : [partialArtifact];
|
|
74009
75033
|
events2.push({
|
|
74010
75034
|
kind: "action",
|
|
74011
75035
|
actionId: a2.id,
|
|
@@ -74013,13 +75037,23 @@ class WorkflowAppService {
|
|
|
74013
75037
|
actionKind: a2.kind,
|
|
74014
75038
|
status: a2.status,
|
|
74015
75039
|
duration: duration3,
|
|
74016
|
-
|
|
75040
|
+
durationMs: a2.duration_ms,
|
|
75041
|
+
startedAt: a2.started_at === null ? null : traceTimestamp(a2.started_at),
|
|
75042
|
+
completedAt: a2.completed_at === null ? null : traceTimestamp(a2.completed_at),
|
|
75043
|
+
ok,
|
|
75044
|
+
outcome: actionOutcome(a2.status, ok),
|
|
75045
|
+
result: result.result,
|
|
75046
|
+
invocation: result.invocation,
|
|
75047
|
+
error: result.error,
|
|
75048
|
+
artifacts: artifacts2,
|
|
75049
|
+
...partialArtifact !== undefined ? { nextAction: { label: "Inspect partial work", kind: "path", value: partialArtifact } } : {},
|
|
74017
75050
|
label,
|
|
74018
75051
|
cost: costByActionId.get(a2.id)
|
|
74019
75052
|
});
|
|
74020
75053
|
}
|
|
74021
75054
|
}
|
|
74022
75055
|
const outputArtifact = await outputArtifactForRun(this.ctx.cwd, runId);
|
|
75056
|
+
run.nextAction = traceNextAction(run, outputArtifact);
|
|
74023
75057
|
return {
|
|
74024
75058
|
run,
|
|
74025
75059
|
events: events2,
|
|
@@ -74230,7 +75264,7 @@ async function extractWorkflowMeta(filePath) {
|
|
|
74230
75264
|
};
|
|
74231
75265
|
}
|
|
74232
75266
|
}
|
|
74233
|
-
function rowToTraceEntry(row) {
|
|
75267
|
+
function rowToTraceEntry(row, cwd) {
|
|
74234
75268
|
let isDryRun = false;
|
|
74235
75269
|
let failureReason;
|
|
74236
75270
|
try {
|
|
@@ -74240,26 +75274,143 @@ function rowToTraceEntry(row) {
|
|
|
74240
75274
|
failureReason = meta3.failureReason;
|
|
74241
75275
|
}
|
|
74242
75276
|
} catch {}
|
|
74243
|
-
|
|
75277
|
+
const entry = {
|
|
74244
75278
|
runId: row.id,
|
|
74245
75279
|
workflowName: row.workflow_name,
|
|
74246
75280
|
mode: row.mode,
|
|
74247
75281
|
status: row.status,
|
|
74248
|
-
startedAt: row.started_at,
|
|
74249
|
-
completedAt: row.completed_at,
|
|
75282
|
+
startedAt: traceTimestamp(row.started_at),
|
|
75283
|
+
completedAt: row.completed_at === null ? null : traceTimestamp(row.completed_at),
|
|
74250
75284
|
isDryRun,
|
|
75285
|
+
project: systemEventProjectContext(cwd),
|
|
75286
|
+
durationMs: durationBetween(row.started_at, row.completed_at),
|
|
75287
|
+
outcome: traceOutcome(row.status),
|
|
74251
75288
|
...failureReason !== undefined ? { failureReason } : {}
|
|
74252
75289
|
};
|
|
75290
|
+
const nextAction = traceNextAction(entry);
|
|
75291
|
+
if (nextAction !== undefined)
|
|
75292
|
+
entry.nextAction = nextAction;
|
|
75293
|
+
return entry;
|
|
75294
|
+
}
|
|
75295
|
+
function durationBetween(startedAt, completedAt) {
|
|
75296
|
+
if (completedAt === null)
|
|
75297
|
+
return null;
|
|
75298
|
+
const start = Date.parse(startedAt);
|
|
75299
|
+
const end = Date.parse(completedAt);
|
|
75300
|
+
return Number.isFinite(start) && Number.isFinite(end) && end >= start ? end - start : null;
|
|
75301
|
+
}
|
|
75302
|
+
function traceTimestamp(value) {
|
|
75303
|
+
return Number.isFinite(Date.parse(value)) ? value : "unavailable";
|
|
75304
|
+
}
|
|
75305
|
+
function persistedTimestamp(value) {
|
|
75306
|
+
const date6 = new Date(value);
|
|
75307
|
+
return Number.isNaN(date6.getTime()) ? "unavailable" : date6.toISOString();
|
|
75308
|
+
}
|
|
75309
|
+
function traceOutcome(status) {
|
|
75310
|
+
if (status === "done")
|
|
75311
|
+
return "success";
|
|
75312
|
+
if (status === "failed")
|
|
75313
|
+
return "failure";
|
|
75314
|
+
if (status === "running" || status === "pending" || status === "paused")
|
|
75315
|
+
return status;
|
|
75316
|
+
return "unavailable";
|
|
75317
|
+
}
|
|
75318
|
+
function actionOutcome(status, ok) {
|
|
75319
|
+
if (status === "running" || status === "pending")
|
|
75320
|
+
return status;
|
|
75321
|
+
if (ok === true)
|
|
75322
|
+
return "success";
|
|
75323
|
+
if (ok === false)
|
|
75324
|
+
return "failure";
|
|
75325
|
+
return "unavailable";
|
|
75326
|
+
}
|
|
75327
|
+
function traceNextAction(run, outputArtifact) {
|
|
75328
|
+
if (!TRACE_IDENTIFIER.test(run.runId))
|
|
75329
|
+
return;
|
|
75330
|
+
if (run.status === "running" || run.status === "pending") {
|
|
75331
|
+
return { label: "Follow run", kind: "command", value: `spur workflow trace ${run.runId} --follow` };
|
|
75332
|
+
}
|
|
75333
|
+
if (run.status === "paused") {
|
|
75334
|
+
return { label: "Continue run", kind: "command", value: `spur workflow continue ${run.runId}` };
|
|
75335
|
+
}
|
|
75336
|
+
if (run.status === "failed" && outputArtifact !== undefined) {
|
|
75337
|
+
return { label: "Inspect run log", kind: "path", value: outputArtifact };
|
|
75338
|
+
}
|
|
75339
|
+
return;
|
|
75340
|
+
}
|
|
75341
|
+
function projectActionTraceResult(resultJson, secretValues = []) {
|
|
75342
|
+
if (!resultJson)
|
|
75343
|
+
return { result: null, invocation: null, error: null };
|
|
75344
|
+
let parsed;
|
|
75345
|
+
try {
|
|
75346
|
+
parsed = JSON.parse(resultJson);
|
|
75347
|
+
} catch {
|
|
75348
|
+
return { result: null, invocation: null, error: null };
|
|
75349
|
+
}
|
|
75350
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
75351
|
+
return { result: null, invocation: null, error: null };
|
|
75352
|
+
}
|
|
75353
|
+
const result = parsed;
|
|
75354
|
+
const data = result.data && typeof result.data === "object" && !Array.isArray(result.data) ? result.data : {};
|
|
75355
|
+
const invocationSource = data.invocation && typeof data.invocation === "object" && !Array.isArray(data.invocation) ? data.invocation : undefined;
|
|
75356
|
+
const resultFields = {};
|
|
75357
|
+
for (const field2 of TRACE_RESULT_FIELDS) {
|
|
75358
|
+
const value = data[field2];
|
|
75359
|
+
if (typeof value === "string")
|
|
75360
|
+
resultFields[field2] = redactAndBound(value, secretValues, 256);
|
|
75361
|
+
else if (typeof value === "number" || typeof value === "boolean")
|
|
75362
|
+
resultFields[field2] = value;
|
|
75363
|
+
}
|
|
75364
|
+
const invocation = {};
|
|
75365
|
+
if (invocationSource !== undefined) {
|
|
75366
|
+
for (const field2 of TRACE_INVOCATION_FIELDS) {
|
|
75367
|
+
const value = invocationSource[field2];
|
|
75368
|
+
if (typeof value === "string")
|
|
75369
|
+
invocation[field2] = redactAndBound(value, secretValues, 256);
|
|
75370
|
+
else if (typeof value === "number" || typeof value === "boolean")
|
|
75371
|
+
invocation[field2] = value;
|
|
75372
|
+
}
|
|
75373
|
+
}
|
|
75374
|
+
const error51 = typeof result.error === "string" ? redactAndBound(result.error, secretValues, 512) : null;
|
|
75375
|
+
return {
|
|
75376
|
+
result: Object.keys(resultFields).length === 0 ? null : resultFields,
|
|
75377
|
+
invocation: Object.keys(invocation).length === 0 ? null : invocation,
|
|
75378
|
+
error: error51
|
|
75379
|
+
};
|
|
74253
75380
|
}
|
|
74254
|
-
|
|
75381
|
+
async function partialArtifactForAction(cwd, runId, node, ok) {
|
|
75382
|
+
if (ok !== false || !TRACE_IDENTIFIER.test(runId) || !TRACE_IDENTIFIER.test(node))
|
|
75383
|
+
return;
|
|
75384
|
+
const relativePath2 = join19(".spur", "run", `${runId}-${node}-partial.md`);
|
|
75385
|
+
return await fileExists(resolve7(cwd, relativePath2)) ? relativePath2 : undefined;
|
|
75386
|
+
}
|
|
75387
|
+
var TASK_PIPELINE_WORKFLOW = "task-pipeline", EMBEDDED_SCHEMA_PREFIX = "\x00embedded-spur", SPUR_SCHEMA_MANIFEST = "@gobing-ai/spur/package.json", PIPELINE_LINK_KIND = "pipeline", TRACE_IDENTIFIER, TRACE_RESULT_FIELDS, TRACE_INVOCATION_FIELDS;
|
|
74255
75388
|
var init_workflow_service = __esm(() => {
|
|
74256
75389
|
init_loader();
|
|
74257
75390
|
init_src2();
|
|
74258
75391
|
init_dist9();
|
|
74259
75392
|
init_dist7();
|
|
74260
75393
|
init_dist5();
|
|
75394
|
+
init_agent_execution();
|
|
74261
75395
|
init_builtins2();
|
|
74262
75396
|
init_observability();
|
|
75397
|
+
init_system_event_envelope();
|
|
75398
|
+
TRACE_IDENTIFIER = /^[A-Za-z0-9._:-]+$/;
|
|
75399
|
+
TRACE_RESULT_FIELDS = ["agent", "exitCode"];
|
|
75400
|
+
TRACE_INVOCATION_FIELDS = [
|
|
75401
|
+
"agent",
|
|
75402
|
+
"source",
|
|
75403
|
+
"command",
|
|
75404
|
+
"cwd",
|
|
75405
|
+
"mode",
|
|
75406
|
+
"outputMode",
|
|
75407
|
+
"timeoutMs",
|
|
75408
|
+
"continue",
|
|
75409
|
+
"stdinInteractive",
|
|
75410
|
+
"model",
|
|
75411
|
+
"translatedFrom",
|
|
75412
|
+
"sessionId"
|
|
75413
|
+
];
|
|
74263
75414
|
});
|
|
74264
75415
|
|
|
74265
75416
|
// ../../packages/app/src/workflow/lifecycle-adapter.ts
|
|
@@ -74456,6 +75607,7 @@ var init_trace_writer = __esm(() => {
|
|
|
74456
75607
|
var exports_src2 = {};
|
|
74457
75608
|
__export(exports_src2, {
|
|
74458
75609
|
tailTokenLedgerFile: () => tailTokenLedgerFile,
|
|
75610
|
+
systemEventProjectContext: () => systemEventProjectContext,
|
|
74459
75611
|
systemEventCatalogEntry: () => systemEventCatalogEntry,
|
|
74460
75612
|
summarizeActionResult: () => summarizeActionResult,
|
|
74461
75613
|
startRegisteredProject: () => startRegisteredProject,
|
|
@@ -74482,6 +75634,7 @@ __export(exports_src2, {
|
|
|
74482
75634
|
readVerdictArtifact: () => readVerdictArtifact,
|
|
74483
75635
|
readVerdict: () => readVerdict,
|
|
74484
75636
|
pruneReports: () => pruneReports,
|
|
75637
|
+
projectStoredSystemEventEnvelope: () => projectStoredSystemEventEnvelope,
|
|
74485
75638
|
parseVerdict: () => parseVerdict,
|
|
74486
75639
|
parseSteeringPolicy: () => parseSteeringPolicy,
|
|
74487
75640
|
parsePsOutput: () => parsePsOutput,
|
|
@@ -74489,6 +75642,7 @@ __export(exports_src2, {
|
|
|
74489
75642
|
parseEtimeToSeconds: () => parseEtimeToSeconds,
|
|
74490
75643
|
normalizeSystemEventPayload: () => normalizeSystemEventPayload,
|
|
74491
75644
|
normalizeProjectPath: () => normalizeProjectPath,
|
|
75645
|
+
isSystemEventEnvelopeV2: () => isSystemEventEnvelopeV2,
|
|
74492
75646
|
isPortLive: () => isPortLive,
|
|
74493
75647
|
isPortAvailable: () => isPortAvailable,
|
|
74494
75648
|
isFindingCode: () => isFindingCode,
|
|
@@ -74515,6 +75669,7 @@ __export(exports_src2, {
|
|
|
74515
75669
|
classifyDispatch: () => classifyDispatch,
|
|
74516
75670
|
clampToolUseLimit: () => clampToolUseLimit,
|
|
74517
75671
|
clampRunStoreLimit: () => clampRunStoreLimit,
|
|
75672
|
+
buildSystemEventEnvelope: () => buildSystemEventEnvelope,
|
|
74518
75673
|
bridgeEventBus: () => bridgeEventBus,
|
|
74519
75674
|
aggregateBatchVerdicts: () => aggregateBatchVerdicts,
|
|
74520
75675
|
WorkflowTraceWriter: () => WorkflowTraceWriter,
|
|
@@ -74543,6 +75698,7 @@ __export(exports_src2, {
|
|
|
74543
75698
|
SYSTEM_EVENT_PREFIXES: () => SYSTEM_EVENT_PREFIXES,
|
|
74544
75699
|
SYSTEM_EVENT_PERSISTED_NAMES: () => SYSTEM_EVENT_PERSISTED_NAMES,
|
|
74545
75700
|
SYSTEM_EVENT_NAMES: () => SYSTEM_EVENT_NAMES,
|
|
75701
|
+
SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION: () => SYSTEM_EVENT_ENVELOPE_SCHEMA_VERSION,
|
|
74546
75702
|
SYSTEM_EVENT_CATALOG_METADATA: () => SYSTEM_EVENT_CATALOG_METADATA,
|
|
74547
75703
|
SYSTEM_EVENT_CATALOG: () => SYSTEM_EVENT_CATALOG,
|
|
74548
75704
|
RunStoreService: () => RunStoreService,
|
|
@@ -74718,19 +75874,19 @@ var {
|
|
|
74718
75874
|
init_src();
|
|
74719
75875
|
init_loader();
|
|
74720
75876
|
|
|
74721
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
75877
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
74722
75878
|
init_dist4();
|
|
74723
75879
|
init_dist5();
|
|
74724
75880
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
|
|
74725
75881
|
import { dirname as dirname5 } from "path";
|
|
74726
75882
|
|
|
74727
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
75883
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application/index.js
|
|
74728
75884
|
init_default_observers();
|
|
74729
75885
|
init_event_bus();
|
|
74730
75886
|
init_file_observer();
|
|
74731
75887
|
init_logger3();
|
|
74732
75888
|
|
|
74733
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
75889
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
|
|
74734
75890
|
class NoopSchedulerAdapter {
|
|
74735
75891
|
constructor() {}
|
|
74736
75892
|
register(_cron, _action) {}
|
|
@@ -74738,7 +75894,7 @@ class NoopSchedulerAdapter {
|
|
|
74738
75894
|
async stop() {}
|
|
74739
75895
|
}
|
|
74740
75896
|
|
|
74741
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
75897
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
|
|
74742
75898
|
function initScheduler(adapter, cronEntries) {
|
|
74743
75899
|
const resolved = adapter ?? new NoopSchedulerAdapter;
|
|
74744
75900
|
if (cronEntries) {
|
|
@@ -74749,7 +75905,7 @@ function initScheduler(adapter, cronEntries) {
|
|
|
74749
75905
|
return resolved;
|
|
74750
75906
|
}
|
|
74751
75907
|
|
|
74752
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
75908
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
|
|
74753
75909
|
init_logger3();
|
|
74754
75910
|
init_metrics();
|
|
74755
75911
|
init_sdk();
|
|
@@ -74842,7 +75998,7 @@ function dbPlugin(db2) {
|
|
|
74842
75998
|
};
|
|
74843
75999
|
}
|
|
74844
76000
|
|
|
74845
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
76001
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
|
|
74846
76002
|
init_logger3();
|
|
74847
76003
|
|
|
74848
76004
|
class PluginHost {
|
|
@@ -74930,7 +76086,7 @@ class PluginHost {
|
|
|
74930
76086
|
}
|
|
74931
76087
|
}
|
|
74932
76088
|
|
|
74933
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
76089
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application/index.js
|
|
74934
76090
|
async function performShutdown(state, reason) {
|
|
74935
76091
|
if (state.stopped)
|
|
74936
76092
|
return;
|
|
@@ -75041,10 +76197,10 @@ async function runApplication(options) {
|
|
|
75041
76197
|
}
|
|
75042
76198
|
}
|
|
75043
76199
|
|
|
75044
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
76200
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
75045
76201
|
init_scheduler_node();
|
|
75046
76202
|
|
|
75047
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
76203
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
|
|
75048
76204
|
var import_api14 = __toESM(require_src(), 1);
|
|
75049
76205
|
|
|
75050
76206
|
// ../../node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.218.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/OTLPMetricExporterBase.js
|
|
@@ -78060,7 +79216,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
|
|
|
78060
79216
|
}), JsonTraceSerializer));
|
|
78061
79217
|
}
|
|
78062
79218
|
}
|
|
78063
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
79219
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
|
|
78064
79220
|
var import_resources2 = __toESM(require_src4(), 1);
|
|
78065
79221
|
var import_sdk_trace_node = __toESM(require_src8(), 1);
|
|
78066
79222
|
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
@@ -78111,7 +79267,7 @@ async function shutdownNodeTelemetry() {
|
|
|
78111
79267
|
await Promise.all(pending);
|
|
78112
79268
|
}
|
|
78113
79269
|
|
|
78114
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
79270
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.30+fbd4d7afac6bdd9f/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
78115
79271
|
class ConfigValidationError extends Error {
|
|
78116
79272
|
constructor(message) {
|
|
78117
79273
|
super(message);
|
|
@@ -81936,7 +83092,8 @@ async function attachSystemEventLedger(bus, context4, options = {}) {
|
|
|
81936
83092
|
const dao2 = new SystemEventDao(await context4.getDb());
|
|
81937
83093
|
tap = registerSystemEventTap(bus, dao2, logger3, {
|
|
81938
83094
|
diagnosticEnabled: options.diagnosticEnabled === true,
|
|
81939
|
-
secretValues: configuredSecretValues(context4.env ?? {})
|
|
83095
|
+
secretValues: configuredSecretValues(context4.env ?? {}),
|
|
83096
|
+
projectContext: systemEventProjectContext(context4.cwd)
|
|
81940
83097
|
});
|
|
81941
83098
|
} catch (error51) {
|
|
81942
83099
|
context4.output.error(`system_events ledger attach: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
@@ -82244,7 +83401,7 @@ function makePlanningEmitter(context4) {
|
|
|
82244
83401
|
return {
|
|
82245
83402
|
async emit(event2) {
|
|
82246
83403
|
try {
|
|
82247
|
-
cached2 ??= new SystemEventEmitter(new SystemEventDao(await context4.getDb()), logger3, {}, configuredSecretValues(context4.env ?? {}));
|
|
83404
|
+
cached2 ??= new SystemEventEmitter(new SystemEventDao(await context4.getDb()), logger3, {}, configuredSecretValues(context4.env ?? {}), systemEventProjectContext(context4.cwd));
|
|
82248
83405
|
await cached2.emit(event2);
|
|
82249
83406
|
} catch (error51) {
|
|
82250
83407
|
context4.output.error(`system_events emitter: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
@@ -82685,7 +83842,7 @@ import { createRequire } from "module";
|
|
|
82685
83842
|
var CLI_CONFIG = {
|
|
82686
83843
|
binaryName: "spur",
|
|
82687
83844
|
binaryLabel: "spur",
|
|
82688
|
-
binaryVersion: "0.3.
|
|
83845
|
+
binaryVersion: "0.3.45",
|
|
82689
83846
|
configDir: ".spur",
|
|
82690
83847
|
configFile: ".spur/config.yaml",
|
|
82691
83848
|
databaseFile: ".spur/spur.db"
|
|
@@ -82830,7 +83987,8 @@ ${formatFanOutResult(fanOut)}`);
|
|
|
82830
83987
|
renderer: "history-daily",
|
|
82831
83988
|
detail: failure.detail,
|
|
82832
83989
|
exitCode: failure.exitCode,
|
|
82833
|
-
durationMs
|
|
83990
|
+
durationMs,
|
|
83991
|
+
severity: "error"
|
|
82834
83992
|
});
|
|
82835
83993
|
context4.setExitCode(1);
|
|
82836
83994
|
} else if (result !== null) {
|
|
@@ -82857,13 +84015,15 @@ ${formatFanOutResult(fanOut)}`);
|
|
|
82857
84015
|
files,
|
|
82858
84016
|
messages: messages2,
|
|
82859
84017
|
durationMs,
|
|
82860
|
-
artifactPath
|
|
84018
|
+
artifactPath,
|
|
84019
|
+
severity: "info"
|
|
82861
84020
|
});
|
|
82862
84021
|
await bus.emit("history.analyze.completed", {
|
|
82863
84022
|
source: "history",
|
|
82864
84023
|
renderer: "history-analyze",
|
|
82865
84024
|
artifactPath,
|
|
82866
|
-
totals: result.artifact.totals
|
|
84025
|
+
totals: result.artifact.totals,
|
|
84026
|
+
severity: "info"
|
|
82867
84027
|
});
|
|
82868
84028
|
} else {
|
|
82869
84029
|
const failing = entries.filter((e) => e.status === "failed");
|
|
@@ -82878,7 +84038,8 @@ ${formatFanOutResult(fanOut)}`);
|
|
|
82878
84038
|
failedSources,
|
|
82879
84039
|
detail: problems.length > 0 ? problems.map((e) => `${e.source}: ${e.status} (${e.parseErrors + e.validationErrors} ` + "parse/validation errors)").join("; ") : "daily fan-out reported non-zero exit with no failing or degraded source",
|
|
82880
84040
|
durationMs,
|
|
82881
|
-
artifactPath
|
|
84041
|
+
artifactPath,
|
|
84042
|
+
severity: "error"
|
|
82882
84043
|
});
|
|
82883
84044
|
}
|
|
82884
84045
|
context4.setExitCode(exitCode);
|
|
@@ -83725,15 +84886,33 @@ function parseFixMode(value) {
|
|
|
83725
84886
|
throw new Error(`Invalid --fix-mode value "${value}". Expected none, suggest, or auto.`);
|
|
83726
84887
|
}
|
|
83727
84888
|
function formatTraceList(runs2) {
|
|
83728
|
-
const header = [
|
|
84889
|
+
const header = [
|
|
84890
|
+
"RUN ID",
|
|
84891
|
+
"PROJECT",
|
|
84892
|
+
"SOURCE",
|
|
84893
|
+
"STATUS",
|
|
84894
|
+
"RULES",
|
|
84895
|
+
"FINDINGS",
|
|
84896
|
+
"FIXES/APPLIED",
|
|
84897
|
+
"STARTED",
|
|
84898
|
+
"COMPLETED",
|
|
84899
|
+
"DURATION",
|
|
84900
|
+
"OUTCOME",
|
|
84901
|
+
"NEXT"
|
|
84902
|
+
];
|
|
83729
84903
|
const rows = runs2.map((r) => [
|
|
83730
84904
|
r.id.slice(0, 12),
|
|
83731
|
-
r.
|
|
84905
|
+
"project" in r ? r.project.name : "unavailable",
|
|
84906
|
+
"source" in r ? `${r.source.kind}:${r.source.value}` : `${r.source_kind}:${r.source_value ?? r.preset ?? "unavailable"}`,
|
|
83732
84907
|
r.status,
|
|
83733
84908
|
String(r.rule_count),
|
|
83734
84909
|
String(r.finding_count),
|
|
83735
|
-
|
|
83736
|
-
r.started_at
|
|
84910
|
+
`${r.fix_count}/${r.applied_fix_count}`,
|
|
84911
|
+
r.started_at || "unavailable",
|
|
84912
|
+
r.completed_at ?? "unavailable",
|
|
84913
|
+
r.duration_ms === null ? "unavailable" : `${r.duration_ms}ms`,
|
|
84914
|
+
"outcome" in r ? r.outcome : "unavailable",
|
|
84915
|
+
"nextAction" in r && r.nextAction !== undefined ? r.nextAction.value : "-"
|
|
83737
84916
|
]);
|
|
83738
84917
|
return [header.join("\t"), ...rows.map((row) => row.join("\t"))].join(`
|
|
83739
84918
|
`);
|
|
@@ -83742,17 +84921,21 @@ function formatTraceDetail(detail) {
|
|
|
83742
84921
|
const r = detail.run;
|
|
83743
84922
|
const lines = [];
|
|
83744
84923
|
lines.push(`Run: ${r.id} \u2014 ${r.preset ?? "-"} \u2014 ${r.status}`);
|
|
83745
|
-
lines.push(`
|
|
84924
|
+
lines.push(`Project: ${"project" in r ? `${r.project.name} (${r.project.root})` : "unavailable"} Source: ${"source" in r ? `${r.source.kind}:${r.source.value}` : `${r.source_kind}:${r.source_value ?? r.preset ?? "unavailable"}`}`);
|
|
84925
|
+
lines.push(`Started: ${r.started_at || "unavailable"} Completed: ${r.completed_at ?? "unavailable"} Duration: ${r.duration_ms != null ? `${(r.duration_ms / 1000).toFixed(2)}s` : "unavailable"}`);
|
|
84926
|
+
lines.push(`Rules: ${r.rule_count} Findings: ${r.finding_count} Fixes: ${r.fix_count} Applied: ${r.applied_fix_count}`);
|
|
83746
84927
|
const stopOn = r.stop_on_first ?? "none";
|
|
83747
|
-
lines.push(`Fail-on: ${r.fail_on ?? "
|
|
84928
|
+
lines.push(`Fail-on: ${r.fail_on ?? "unavailable"} Stop-on-first: ${stopOn} Fix-mode: ${r.fix_mode} Dry-run: ${r.dry_run === 1 ? "yes" : "no"} Outcome: ${"outcome" in r ? r.outcome : "unavailable"}`);
|
|
84929
|
+
if ("nextAction" in r && r.nextAction !== undefined) {
|
|
84930
|
+
lines.push(`Next: ${r.nextAction.label} \u2014 ${r.nextAction.value}`);
|
|
84931
|
+
}
|
|
83748
84932
|
lines.push("");
|
|
83749
84933
|
for (const ev of detail.evaluations) {
|
|
83750
84934
|
const icon = ev.status === "failed" ? "\u2717" : ev.status === "done" && ev.finding_count > 0 ? "!" : "\u2713";
|
|
83751
|
-
const dur = ev.duration_ms != null ? `${ev.duration_ms}ms` : "
|
|
83752
|
-
lines.push(` ${icon} ${ev.rule_id.
|
|
83753
|
-
|
|
83754
|
-
|
|
83755
|
-
}
|
|
84935
|
+
const dur = ev.duration_ms != null ? `${ev.duration_ms}ms` : "unavailable";
|
|
84936
|
+
lines.push(` ${icon} ${ev.rule_id} severity=${ev.severity} evaluator=${ev.evaluator} status=${ev.status} findings=${ev.finding_count} fixes=${ev.fix_count} duration=${dur}`);
|
|
84937
|
+
lines.push(` started=${ev.started_at || "unavailable"} completed=${ev.completed_at ?? "unavailable"}`);
|
|
84938
|
+
lines.push(` error: ${ev.error ?? "unavailable"}`);
|
|
83756
84939
|
}
|
|
83757
84940
|
return lines.join(`
|
|
83758
84941
|
`);
|
|
@@ -87037,7 +88220,7 @@ var tryDecode = (str, decoder) => {
|
|
|
87037
88220
|
}
|
|
87038
88221
|
};
|
|
87039
88222
|
var tryDecodeURI = (str) => tryDecode(str, decodeURI);
|
|
87040
|
-
var
|
|
88223
|
+
var getPath2 = (request) => {
|
|
87041
88224
|
const url2 = request.url;
|
|
87042
88225
|
const start = url2.indexOf("/", url2.indexOf(":") + 4);
|
|
87043
88226
|
let i2 = start;
|
|
@@ -87056,7 +88239,7 @@ var getPath = (request) => {
|
|
|
87056
88239
|
return url2.slice(start, i2);
|
|
87057
88240
|
};
|
|
87058
88241
|
var getPathNoStrict = (request) => {
|
|
87059
|
-
const result =
|
|
88242
|
+
const result = getPath2(request);
|
|
87060
88243
|
return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result;
|
|
87061
88244
|
};
|
|
87062
88245
|
var mergePath = (base2, sub, ...rest) => {
|
|
@@ -87567,7 +88750,7 @@ var Hono = class _Hono {
|
|
|
87567
88750
|
};
|
|
87568
88751
|
const { strict, ...optionsWithoutStrict } = options;
|
|
87569
88752
|
Object.assign(this, optionsWithoutStrict);
|
|
87570
|
-
this.getPath = strict ?? true ? options.getPath ??
|
|
88753
|
+
this.getPath = strict ?? true ? options.getPath ?? getPath2 : getPathNoStrict;
|
|
87571
88754
|
}
|
|
87572
88755
|
#clone() {
|
|
87573
88756
|
const clone3 = new _Hono({
|
|
@@ -89109,10 +90292,13 @@ var globalErrorHandler2 = (err, c3) => {
|
|
|
89109
90292
|
ctx.eventBus()?.emit("api.request.error", {
|
|
89110
90293
|
method: c3.req.method,
|
|
89111
90294
|
path: c3.req.path,
|
|
90295
|
+
url: c3.req.path,
|
|
89112
90296
|
status: resolved.status,
|
|
89113
90297
|
route: c3.req.routePath,
|
|
89114
90298
|
code: resolved.apiCode,
|
|
89115
|
-
requestId: requestId ?? null
|
|
90299
|
+
requestId: requestId ?? null,
|
|
90300
|
+
error: resolved.message,
|
|
90301
|
+
severity: "error"
|
|
89116
90302
|
});
|
|
89117
90303
|
}
|
|
89118
90304
|
return c3.json(errorEnvelope(resolved.apiCode, resolved.message, resolved.details), resolved.status);
|
|
@@ -89262,6 +90448,8 @@ var eventsModule = {
|
|
|
89262
90448
|
mount(app, ctx) {
|
|
89263
90449
|
if (!ctx)
|
|
89264
90450
|
return;
|
|
90451
|
+
const projectContext = typeof ctx.systemEventProjectContext === "function" ? ctx.systemEventProjectContext() : systemEventProjectContext(ctx.cwd ?? "");
|
|
90452
|
+
const secretValues = typeof ctx.systemEventSecretValues === "function" ? ctx.systemEventSecretValues() : [];
|
|
89265
90453
|
const baseNames = SYSTEM_EVENT_STREAMED_NAMES;
|
|
89266
90454
|
const diagnosticEnabled = typeof ctx.bootConfig === "function" && ctx.bootConfig().events.diagnostic === true;
|
|
89267
90455
|
const diagnosticNames = diagnosticEnabled ? SYSTEM_EVENT_CATALOG.filter((entry) => entry.tier === "diagnostic" && entry.streamed).map((entry) => entry.name) : [];
|
|
@@ -89310,7 +90498,7 @@ var eventsModule = {
|
|
|
89310
90498
|
actor: extractSystemEventActor2(event2),
|
|
89311
90499
|
prefix: entry?.prefix ?? name.split(".")[0],
|
|
89312
90500
|
renderer: entry?.renderer ?? "generic",
|
|
89313
|
-
payload:
|
|
90501
|
+
payload: buildSystemEventEnvelope(entry, event2, projectContext, secretValues)
|
|
89314
90502
|
};
|
|
89315
90503
|
try {
|
|
89316
90504
|
controller.enqueue(encoder.encode(`data: ${JSON.stringify(envelope2)}
|
|
@@ -89391,7 +90579,7 @@ var eventsModule = {
|
|
|
89391
90579
|
actor: row.actor,
|
|
89392
90580
|
prefix: systemEventCatalogEntry(row.event_name)?.prefix ?? row.event_name.split(".")[0],
|
|
89393
90581
|
renderer: systemEventCatalogEntry(row.event_name)?.renderer ?? "generic",
|
|
89394
|
-
payload: row.
|
|
90582
|
+
payload: projectStoredSystemEventEnvelope(systemEventCatalogEntry(row.event_name), parseStoredPayload(row.payload_json), projectContext, secretValues),
|
|
89395
90583
|
runId: row.run_id,
|
|
89396
90584
|
entityKind: row.entity_kind,
|
|
89397
90585
|
entityId: row.entity_id,
|
|
@@ -89407,6 +90595,15 @@ var eventsModule = {
|
|
|
89407
90595
|
});
|
|
89408
90596
|
}
|
|
89409
90597
|
};
|
|
90598
|
+
function parseStoredPayload(payloadJson) {
|
|
90599
|
+
if (payloadJson === null)
|
|
90600
|
+
return null;
|
|
90601
|
+
try {
|
|
90602
|
+
return JSON.parse(payloadJson);
|
|
90603
|
+
} catch {
|
|
90604
|
+
return null;
|
|
90605
|
+
}
|
|
90606
|
+
}
|
|
89410
90607
|
|
|
89411
90608
|
// ../../packages/contracts/src/index.ts
|
|
89412
90609
|
init_zod();
|
|
@@ -92745,6 +93942,8 @@ function createServerContext(appRt, options) {
|
|
|
92745
93942
|
const dbUrl = options.dbUrl ?? join25(cwd, DEFAULT_DATABASE_URL);
|
|
92746
93943
|
const eventsBus = options.eventsBus ?? appRt.events;
|
|
92747
93944
|
const jobQueueEnabled = options.jobQueueEnabled ?? false;
|
|
93945
|
+
const eventProjectContext = systemEventProjectContext(cwd);
|
|
93946
|
+
const eventSecretValues = configuredSecretValues(options.env ?? process.env);
|
|
92748
93947
|
const folders = options.folders ?? DEFAULT_PLANNING_FOLDERS;
|
|
92749
93948
|
const bootConfig = options.bootConfig ?? {
|
|
92750
93949
|
logging: { enabled: false, level: "info", console: false },
|
|
@@ -92909,10 +94108,16 @@ function createServerContext(appRt, options) {
|
|
|
92909
94108
|
systemEventDaoPromise ??= this.getDb().then((db2) => new SystemEventDao(db2));
|
|
92910
94109
|
return systemEventDaoPromise;
|
|
92911
94110
|
},
|
|
94111
|
+
systemEventProjectContext() {
|
|
94112
|
+
return eventProjectContext;
|
|
94113
|
+
},
|
|
94114
|
+
systemEventSecretValues() {
|
|
94115
|
+
return eventSecretValues;
|
|
94116
|
+
},
|
|
92912
94117
|
runStoreService() {
|
|
92913
94118
|
runStoreSvc ??= new RunStoreService({
|
|
92914
94119
|
getDb: this.getDb.bind(this),
|
|
92915
|
-
secretValues:
|
|
94120
|
+
secretValues: eventSecretValues
|
|
92916
94121
|
});
|
|
92917
94122
|
return runStoreSvc;
|
|
92918
94123
|
},
|
|
@@ -93006,7 +94211,8 @@ function registerSchedulerEntries(scheduler3, ctx) {
|
|
|
93006
94211
|
ctx.eventBus().emit("scheduler.job.executed", {
|
|
93007
94212
|
name,
|
|
93008
94213
|
durationMs: Date.now() - startedAt2,
|
|
93009
|
-
...error51 !== undefined && { error: String(error51) }
|
|
94214
|
+
...error51 !== undefined && { error: String(error51) },
|
|
94215
|
+
severity: error51 !== undefined ? "error" : "info"
|
|
93010
94216
|
});
|
|
93011
94217
|
}
|
|
93012
94218
|
});
|
|
@@ -93170,7 +94376,8 @@ async function startServer(options, deps = defaultDeps) {
|
|
|
93170
94376
|
registerSystemEventTap(ctx.eventBus(), dao2, appRt.logger, {
|
|
93171
94377
|
diagnosticEnabled: bootConfig.events.diagnostic === true,
|
|
93172
94378
|
retention: bootConfig.events.retention,
|
|
93173
|
-
secretValues: configuredSecretValues(env)
|
|
94379
|
+
secretValues: configuredSecretValues(env),
|
|
94380
|
+
projectContext: ctx.systemEventProjectContext()
|
|
93174
94381
|
});
|
|
93175
94382
|
appRt.logger.debug("system_events tap registered", {
|
|
93176
94383
|
diagnostic: bootConfig.events.diagnostic === true
|
|
@@ -95679,10 +96886,14 @@ function formatTraceList2(result) {
|
|
|
95679
96886
|
if (result.entries.length === 0) {
|
|
95680
96887
|
return "No workflow runs.";
|
|
95681
96888
|
}
|
|
95682
|
-
const lines = [
|
|
96889
|
+
const lines = [
|
|
96890
|
+
"RUN ID PROJECT WORKFLOW MODE STATUS STARTED COMPLETED DURATION OUTCOME NEXT"
|
|
96891
|
+
];
|
|
95683
96892
|
for (const entry of result.entries) {
|
|
95684
96893
|
const dryLabel = entry.isDryRun ? " [dry]" : "";
|
|
95685
|
-
|
|
96894
|
+
const duration3 = entry.durationMs === null ? "unavailable" : `${entry.durationMs}ms`;
|
|
96895
|
+
const next = entry.nextAction?.value ?? "-";
|
|
96896
|
+
lines.push(`${entry.runId.padEnd(10)} ${entry.project.name.padEnd(20)} ${entry.workflowName.padEnd(22)} ${entry.mode.padEnd(15)} ${entry.status.padEnd(8)} ${entry.startedAt.padEnd(23)} ${(entry.completedAt ?? "unavailable").padEnd(23)} ${duration3.padEnd(11)} ${entry.outcome.padEnd(12)} ${next}${dryLabel}`);
|
|
95686
96897
|
}
|
|
95687
96898
|
return lines.join(`
|
|
95688
96899
|
`);
|
|
@@ -95693,9 +96904,13 @@ function formatTraceTimeline(result) {
|
|
|
95693
96904
|
const reasonLabel = run.failureReason ? ` \u2014 ${run.failureReason}` : "";
|
|
95694
96905
|
const lines = [
|
|
95695
96906
|
`Run: ${run.runId} \u2014 ${run.workflowName} (${run.mode}) \u2014 ${run.status}${dryLabel}${reasonLabel}`,
|
|
95696
|
-
`
|
|
96907
|
+
`Project: ${run.project.name} (${run.project.root})`,
|
|
96908
|
+
`Started: ${run.startedAt} Completed: ${run.completedAt ?? "unavailable"} Duration: ${run.durationMs === null ? "unavailable" : `${run.durationMs}ms`}`,
|
|
96909
|
+
`Outcome: ${run.outcome} Events: ${events2.length}`,
|
|
95697
96910
|
""
|
|
95698
96911
|
];
|
|
96912
|
+
if (run.nextAction !== undefined)
|
|
96913
|
+
lines.splice(4, 0, `Next: ${run.nextAction.label} \u2014 ${run.nextAction.value}`);
|
|
95699
96914
|
if (result.outputArtifact !== undefined) {
|
|
95700
96915
|
lines.push(`Run log: ${result.outputArtifact} (tail -f for live view)`);
|
|
95701
96916
|
lines.push("");
|
|
@@ -95717,10 +96932,33 @@ function formatTimelineEvent(event2) {
|
|
|
95717
96932
|
}
|
|
95718
96933
|
if (event2.kind === "transition") {
|
|
95719
96934
|
const guard2 = event2.trigger ? ` [${event2.trigger}]` : "";
|
|
95720
|
-
return ` \u2192 ${event2.to}${guard2}`;
|
|
96935
|
+
return ` \u2192 ${event2.from} \u2192 ${event2.to}${guard2} ${event2.at}`;
|
|
95721
96936
|
}
|
|
95722
96937
|
const costSuffix = formatActionCost(event2);
|
|
95723
|
-
|
|
96938
|
+
const lines = [
|
|
96939
|
+
` \u26A1 ${event2.actionId} ${event2.node}/${event2.actionKind} ${event2.status} ${event2.duration || "unavailable"}${event2.label}${costSuffix}`,
|
|
96940
|
+
` started=${event2.startedAt ?? "unavailable"} completed=${event2.completedAt ?? "unavailable"} outcome=${event2.outcome}`
|
|
96941
|
+
];
|
|
96942
|
+
if (event2.result !== null) {
|
|
96943
|
+
lines.push(` result=${Object.entries(event2.result).map(([key2, value2]) => `${key2}=${String(value2)}`).join(" ")}`);
|
|
96944
|
+
} else {
|
|
96945
|
+
lines.push(" result=unavailable");
|
|
96946
|
+
}
|
|
96947
|
+
if (event2.invocation !== null) {
|
|
96948
|
+
lines.push(` invocation=${Object.entries(event2.invocation).map(([key2, value2]) => `${key2}=${String(value2)}`).join(" ")}`);
|
|
96949
|
+
} else {
|
|
96950
|
+
lines.push(" invocation=unavailable");
|
|
96951
|
+
}
|
|
96952
|
+
lines.push(` error=${event2.error ?? "unavailable"}`);
|
|
96953
|
+
if (event2.artifacts.length === 0)
|
|
96954
|
+
lines.push(" artifact=unavailable");
|
|
96955
|
+
else
|
|
96956
|
+
for (const artifact of event2.artifacts)
|
|
96957
|
+
lines.push(` artifact=${artifact}`);
|
|
96958
|
+
if (event2.nextAction !== undefined)
|
|
96959
|
+
lines.push(` Next: ${event2.nextAction.label} \u2014 ${event2.nextAction.value}`);
|
|
96960
|
+
return lines.join(`
|
|
96961
|
+
`);
|
|
95724
96962
|
}
|
|
95725
96963
|
async function followTrace(service, runId, pollMs, write, wait = (ms) => sleep3(ms)) {
|
|
95726
96964
|
let missingAttempts = 0;
|
|
@@ -95752,7 +96990,11 @@ async function followTrace(service, runId, pollMs, write, wait = (ms) => sleep3(
|
|
|
95752
96990
|
}
|
|
95753
96991
|
if (isTerminalTraceStatus(next.run.status)) {
|
|
95754
96992
|
const reason = next.run.failureReason ? ` \u2014 ${next.run.failureReason}` : "";
|
|
95755
|
-
|
|
96993
|
+
const duration3 = next.run.durationMs === null ? "unavailable" : `${next.run.durationMs}ms`;
|
|
96994
|
+
write(`Run finalized: ${next.run.status}${reason} \u2014 outcome=${next.run.outcome} duration=${duration3}`);
|
|
96995
|
+
if (next.run.nextAction !== undefined) {
|
|
96996
|
+
write(`Next: ${next.run.nextAction.label} \u2014 ${next.run.nextAction.value}`);
|
|
96997
|
+
}
|
|
95756
96998
|
return;
|
|
95757
96999
|
}
|
|
95758
97000
|
}
|