@dv.nghiem/flowdeck 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/hooks/event-log-hook.d.ts +18 -0
- package/dist/hooks/event-log-hook.d.ts.map +1 -1
- package/dist/hooks/notifications.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -117
- package/dist/lib/research-gate.d.ts +6 -2
- package/dist/lib/research-gate.d.ts.map +1 -1
- package/dist/services/event-logger.d.ts +1 -1
- package/dist/services/event-logger.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,e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K,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,eAAe,GAAG,SAAS,CAiH7B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,eAAe,EAAE,CAYhG;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAuB7G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,eAAe,CAIjB;AAGD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,GACtB,CAAC"}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
type AppLog = (msg: string) => void;
|
|
1
2
|
export declare function setStaleThresholdMs(ms: number): void;
|
|
2
3
|
export declare function cleanupStaleToolStartTimes(): void;
|
|
4
|
+
/**
|
|
5
|
+
* Create event log hooks wired to the OpenCode TUI via client.app.log.
|
|
6
|
+
* All tool and session events are persisted to .opencode/flowdeck-events.jsonl
|
|
7
|
+
* AND displayed in the TUI's bounded log panel through the provided appLog fn.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createEventLogHooks(appLog: AppLog): {
|
|
10
|
+
before(ctx: {
|
|
11
|
+
directory: string;
|
|
12
|
+
}, toolInput: any, toolOutput: any): Promise<void>;
|
|
13
|
+
after(ctx: {
|
|
14
|
+
directory: string;
|
|
15
|
+
}, toolInput: any, toolOutput: any): Promise<void>;
|
|
16
|
+
session(ctx: {
|
|
17
|
+
directory: string;
|
|
18
|
+
}, event: any): Promise<void>;
|
|
19
|
+
};
|
|
3
20
|
export declare function eventLogBeforeHook(ctx: {
|
|
4
21
|
directory: string;
|
|
5
22
|
}, toolInput: any, toolOutput: any): Promise<void>;
|
|
@@ -9,4 +26,5 @@ export declare function eventLogAfterHook(ctx: {
|
|
|
9
26
|
export declare function eventLogSessionHook(ctx: {
|
|
10
27
|
directory: string;
|
|
11
28
|
}, event: any): Promise<void>;
|
|
29
|
+
export {};
|
|
12
30
|
//# sourceMappingURL=event-log-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-log-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/event-log-hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-log-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/event-log-hook.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;AASnC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,0BAA0B,IAAI,IAAI,CAOjD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM;gBAE5B;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,aAAa,GAAG,cAAc,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;eA2BvE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,aAAa,GAAG,cAAc,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;iBAsCpE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,SAAS,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;EA+CvE;AAGD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,EAAE,GAAG,EACd,UAAU,EAAE,GAAG,GACd,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,EAAE,GAAG,EACd,UAAU,EAAE,GAAG,GACd,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,KAAK,EAAE,GAAG,GACT,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/hooks/notifications.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,gBAAgB,GAChB,uBAAuB,GACvB,OAAO,CAAA;AAEX;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,WAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/hooks/notifications.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,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/D"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA6GjD,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA6GjD,QAAA,MAAM,MAAM,EAAE,MAsWb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1155,9 +1155,7 @@ function loadFlowDeckConfig(directory) {
|
|
|
1155
1155
|
try {
|
|
1156
1156
|
const content = readFileSync9(configPath, "utf-8");
|
|
1157
1157
|
return JSON.parse(content);
|
|
1158
|
-
} catch {
|
|
1159
|
-
console.warn(`[flowdeck] Failed to load config from ${configPath}`);
|
|
1160
|
-
}
|
|
1158
|
+
} catch {}
|
|
1161
1159
|
}
|
|
1162
1160
|
}
|
|
1163
1161
|
return {};
|
|
@@ -3056,8 +3054,7 @@ async function sessionStartHook(ctx) {
|
|
|
3056
3054
|
result.flowdeck_is_workspace_root = ctx.directory === workspaceRoot;
|
|
3057
3055
|
}
|
|
3058
3056
|
return result;
|
|
3059
|
-
} catch
|
|
3060
|
-
console.warn("[flowdeck] Warning: State file unreadable. Continuing without flowdeck context.");
|
|
3057
|
+
} catch {
|
|
3061
3058
|
const result = {
|
|
3062
3059
|
flowdeck_phase: null,
|
|
3063
3060
|
flowdeck_status: "error",
|
|
@@ -3101,9 +3098,7 @@ function notify(title, body, level = "info") {
|
|
|
3101
3098
|
if (platform === "linux") {
|
|
3102
3099
|
const urgency = level === "critical" ? "critical" : "normal";
|
|
3103
3100
|
const proc = execFile("notify-send", ["--urgency", urgency, "--app-name", "FlowDeck", "--icon", "dialog-information", title, body], { timeout: 3000 });
|
|
3104
|
-
proc.on("error", () => {
|
|
3105
|
-
tryTerminalBell();
|
|
3106
|
-
});
|
|
3101
|
+
proc.on("error", () => {});
|
|
3107
3102
|
} else if (platform === "darwin") {
|
|
3108
3103
|
const script = `display notification "${body.replace(/"/g, "\\\"")}" with title "${title.replace(/"/g, "\\\"")}" subtitle "FlowDeck"`;
|
|
3109
3104
|
const proc = execFile("osascript", ["-e", script], { timeout: 3000 });
|
|
@@ -3121,11 +3116,6 @@ function notify(title, body, level = "info") {
|
|
|
3121
3116
|
}
|
|
3122
3117
|
} catch {}
|
|
3123
3118
|
}
|
|
3124
|
-
function tryTerminalBell() {
|
|
3125
|
-
try {
|
|
3126
|
-
process.stdout.write("\x07");
|
|
3127
|
-
} catch {}
|
|
3128
|
-
}
|
|
3129
3119
|
|
|
3130
3120
|
class NotificationController {
|
|
3131
3121
|
pendingCommand = null;
|
|
@@ -3457,14 +3447,11 @@ function isValidDirectory(directory) {
|
|
|
3457
3447
|
return false;
|
|
3458
3448
|
}
|
|
3459
3449
|
}
|
|
3460
|
-
function logEvent(directory, event) {
|
|
3450
|
+
function logEvent(directory, event, log) {
|
|
3461
3451
|
if (process.env.FLOWDECK_EVENT_LOG === "off")
|
|
3462
3452
|
return;
|
|
3463
|
-
if (!isValidDirectory(directory))
|
|
3464
|
-
process.stderr.write(`[FlowDeck] Invalid log directory: ${directory}
|
|
3465
|
-
`);
|
|
3453
|
+
if (!isValidDirectory(directory))
|
|
3466
3454
|
return;
|
|
3467
|
-
}
|
|
3468
3455
|
const logDir = join24(directory, ".opencode");
|
|
3469
3456
|
const logPath = join24(logDir, "flowdeck-events.jsonl");
|
|
3470
3457
|
try {
|
|
@@ -3474,9 +3461,9 @@ function logEvent(directory, event) {
|
|
|
3474
3461
|
appendFileSync5(logPath, JSON.stringify(event) + `
|
|
3475
3462
|
`, "utf-8");
|
|
3476
3463
|
rotateLogFile(logPath);
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3464
|
+
if (log) {
|
|
3465
|
+
log(formatEventForStderr(event));
|
|
3466
|
+
}
|
|
3480
3467
|
} catch {}
|
|
3481
3468
|
}
|
|
3482
3469
|
function rotateLogFile(logPath) {
|
|
@@ -3585,97 +3572,101 @@ function cleanupStaleToolStartTimes() {
|
|
|
3585
3572
|
}
|
|
3586
3573
|
}
|
|
3587
3574
|
}
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3575
|
+
function createEventLogHooks(appLog) {
|
|
3576
|
+
return {
|
|
3577
|
+
async before(ctx, toolInput, toolOutput) {
|
|
3578
|
+
const toolName = toolInput.tool ?? toolInput.name ?? "unknown";
|
|
3579
|
+
const sessionId = toolInput.sessionID ?? toolInput.sessionId ?? "unknown";
|
|
3580
|
+
const args = toolOutput?.args ?? toolInput?.args ?? {};
|
|
3581
|
+
const startKey = `${sessionId}:${toolName}`;
|
|
3582
|
+
beforeHookCallCount++;
|
|
3583
|
+
if (beforeHookCallCount >= CLEANUP_INTERVAL) {
|
|
3584
|
+
beforeHookCallCount = 0;
|
|
3585
|
+
cleanupStaleToolStartTimes();
|
|
3586
|
+
}
|
|
3587
|
+
toolStartTimes.set(startKey, Date.now());
|
|
3588
|
+
const event = {
|
|
3589
|
+
timestamp: new Date().toISOString(),
|
|
3590
|
+
type: "tool.before",
|
|
3591
|
+
agent: getCurrentAgent() ?? undefined,
|
|
3592
|
+
tool: toolName,
|
|
3593
|
+
args: sanitizeArgs(args),
|
|
3594
|
+
session_id: sessionId
|
|
3595
|
+
};
|
|
3596
|
+
logEvent(ctx.directory, event, appLog);
|
|
3597
|
+
},
|
|
3598
|
+
async after(ctx, toolInput, toolOutput) {
|
|
3599
|
+
const toolName = toolInput.tool ?? toolInput.name ?? "unknown";
|
|
3600
|
+
const sessionId = toolInput.sessionID ?? toolInput.sessionId ?? "unknown";
|
|
3601
|
+
const args = toolOutput?.args ?? toolInput?.args ?? {};
|
|
3602
|
+
const startKey = `${sessionId}:${toolName}`;
|
|
3603
|
+
const startTime = toolStartTimes.get(startKey);
|
|
3604
|
+
const durationMs = startTime ? Date.now() - startTime : undefined;
|
|
3605
|
+
toolStartTimes.delete(startKey);
|
|
3606
|
+
let status = "success";
|
|
3607
|
+
let error;
|
|
3608
|
+
if (toolOutput?.error != null) {
|
|
3609
|
+
status = "error";
|
|
3610
|
+
error = typeof toolOutput.error === "string" ? toolOutput.error : String(toolOutput.error);
|
|
3611
|
+
} else if (toolOutput?.status === "error") {
|
|
3612
|
+
status = "error";
|
|
3613
|
+
error = typeof toolOutput.error === "string" ? toolOutput.error : "Unknown error";
|
|
3614
|
+
} else if (toolOutput?.status === "blocked") {
|
|
3615
|
+
status = "blocked";
|
|
3616
|
+
}
|
|
3617
|
+
const event = {
|
|
3618
|
+
timestamp: new Date().toISOString(),
|
|
3619
|
+
type: "tool.after",
|
|
3620
|
+
agent: getCurrentAgent() ?? undefined,
|
|
3621
|
+
tool: toolName,
|
|
3622
|
+
args: sanitizeArgs(args),
|
|
3623
|
+
duration_ms: durationMs,
|
|
3624
|
+
status,
|
|
3625
|
+
error,
|
|
3626
|
+
session_id: sessionId
|
|
3627
|
+
};
|
|
3628
|
+
logEvent(ctx.directory, event, appLog);
|
|
3629
|
+
},
|
|
3630
|
+
async session(ctx, event) {
|
|
3631
|
+
const type = event?.type ?? "";
|
|
3632
|
+
const props = event?.properties ?? {};
|
|
3633
|
+
if (type === "session.created") {
|
|
3634
|
+
if (props.parentID) {
|
|
3635
|
+
const agentName = extractAgentFromEvent(props);
|
|
3636
|
+
setCurrentAgent(agentName);
|
|
3637
|
+
}
|
|
3638
|
+
const toolEvent = {
|
|
3639
|
+
timestamp: new Date().toISOString(),
|
|
3640
|
+
type: "session.created",
|
|
3641
|
+
session_id: props.id ?? props.sessionId ?? undefined
|
|
3642
|
+
};
|
|
3643
|
+
logEvent(ctx.directory, toolEvent, appLog);
|
|
3644
|
+
} else if (type === "session.idle") {
|
|
3645
|
+
if (props.parentID) {
|
|
3646
|
+
setCurrentAgent(null);
|
|
3647
|
+
}
|
|
3648
|
+
const toolEvent = {
|
|
3649
|
+
timestamp: new Date().toISOString(),
|
|
3650
|
+
type: "session.idle",
|
|
3651
|
+
session_id: props.id ?? props.sessionId ?? undefined
|
|
3652
|
+
};
|
|
3653
|
+
logEvent(ctx.directory, toolEvent, appLog);
|
|
3654
|
+
} else if (type === "session.error") {
|
|
3655
|
+
if (props.parentID) {
|
|
3656
|
+
setCurrentAgent(null);
|
|
3657
|
+
}
|
|
3658
|
+
const err = props.error;
|
|
3659
|
+
const errorMsg = (err && typeof err === "object" && "message" in err ? String(err.message) : undefined) ?? (typeof err === "string" ? err : undefined) ?? undefined;
|
|
3660
|
+
const toolEvent = {
|
|
3661
|
+
timestamp: new Date().toISOString(),
|
|
3662
|
+
type: "session.error",
|
|
3663
|
+
session_id: props.id ?? props.sessionId ?? undefined,
|
|
3664
|
+
error: errorMsg
|
|
3665
|
+
};
|
|
3666
|
+
logEvent(ctx.directory, toolEvent, appLog);
|
|
3667
|
+
}
|
|
3658
3668
|
}
|
|
3659
|
-
|
|
3660
|
-
timestamp: new Date().toISOString(),
|
|
3661
|
-
type: "session.idle",
|
|
3662
|
-
session_id: props.id ?? props.sessionId ?? undefined
|
|
3663
|
-
};
|
|
3664
|
-
logEvent(ctx.directory, toolEvent);
|
|
3665
|
-
} else if (type === "session.error") {
|
|
3666
|
-
if (props.parentID) {
|
|
3667
|
-
setCurrentAgent(null);
|
|
3668
|
-
}
|
|
3669
|
-
const err = props.error;
|
|
3670
|
-
const errorMsg = (err && typeof err === "object" && "message" in err ? String(err.message) : undefined) ?? (typeof err === "string" ? err : undefined) ?? undefined;
|
|
3671
|
-
const toolEvent = {
|
|
3672
|
-
timestamp: new Date().toISOString(),
|
|
3673
|
-
type: "session.error",
|
|
3674
|
-
session_id: props.id ?? props.sessionId ?? undefined,
|
|
3675
|
-
error: errorMsg
|
|
3676
|
-
};
|
|
3677
|
-
logEvent(ctx.directory, toolEvent);
|
|
3678
|
-
}
|
|
3669
|
+
};
|
|
3679
3670
|
}
|
|
3680
3671
|
function extractAgentFromEvent(props) {
|
|
3681
3672
|
if (typeof props.agent === "string")
|
|
@@ -7323,7 +7314,6 @@ function createAgent(name, model, customPrompt, customAppendPrompt) {
|
|
|
7323
7314
|
case "supervisor":
|
|
7324
7315
|
return createSupervisorAgent(model, customPrompt, customAppendPrompt);
|
|
7325
7316
|
default:
|
|
7326
|
-
console.warn(`[flowdeck] Unknown agent: ${name}`);
|
|
7327
7317
|
return;
|
|
7328
7318
|
}
|
|
7329
7319
|
}
|
|
@@ -8013,6 +8003,7 @@ var plugin = async (input, _options) => {
|
|
|
8013
8003
|
const compactionHook = createCompactionHook({ directory }, fileTracker);
|
|
8014
8004
|
const orchestratorGuard = new OrchestratorGuard;
|
|
8015
8005
|
const autoLearnHook = createAutoLearnHook(client, fileTracker, directory, appLog);
|
|
8006
|
+
const eventLog = createEventLogHooks(appLog);
|
|
8016
8007
|
const notifCtrl = new NotificationController(undefined, appLog);
|
|
8017
8008
|
const agentConfigs = getAgentConfigs({});
|
|
8018
8009
|
const mcps = createFlowDeckMcps();
|
|
@@ -8126,7 +8117,7 @@ var plugin = async (input, _options) => {
|
|
|
8126
8117
|
if (type === "session.created" || type === "session.started") {
|
|
8127
8118
|
await sessionStartHook({ directory });
|
|
8128
8119
|
if (type === "session.created") {
|
|
8129
|
-
await
|
|
8120
|
+
await eventLog.session({ directory }, event);
|
|
8130
8121
|
}
|
|
8131
8122
|
}
|
|
8132
8123
|
if (type === "command.executed") {
|
|
@@ -8138,7 +8129,7 @@ var plugin = async (input, _options) => {
|
|
|
8138
8129
|
await contextMonitor.event({ event });
|
|
8139
8130
|
orchestratorGuard.onEvent(event);
|
|
8140
8131
|
if (type === "session.idle") {
|
|
8141
|
-
await
|
|
8132
|
+
await eventLog.session({ directory }, event);
|
|
8142
8133
|
const hasEdits = fileTracker.getEditedPaths().length > 0;
|
|
8143
8134
|
if (lastExecutedCommand) {
|
|
8144
8135
|
lastExecutedCommand = null;
|
|
@@ -8152,7 +8143,7 @@ var plugin = async (input, _options) => {
|
|
|
8152
8143
|
}
|
|
8153
8144
|
}
|
|
8154
8145
|
if (type === "session.error") {
|
|
8155
|
-
await
|
|
8146
|
+
await eventLog.session({ directory }, event);
|
|
8156
8147
|
lastExecutedCommand = null;
|
|
8157
8148
|
const err = event?.properties?.error;
|
|
8158
8149
|
const errorMsg = (err && typeof err === "object" && "message" in err ? String(err.message) : undefined) ?? (typeof err === "string" ? err : undefined) ?? "An unexpected error occurred";
|
|
@@ -8203,10 +8194,10 @@ var plugin = async (input, _options) => {
|
|
|
8203
8194
|
await toolGuardHook({ directory }, toolInput, toolOutput);
|
|
8204
8195
|
await patchTrustHook({ directory }, toolInput, toolOutput);
|
|
8205
8196
|
await decisionTraceHook({ directory }, toolInput, toolOutput);
|
|
8206
|
-
await
|
|
8197
|
+
await eventLog.before({ directory }, toolInput, toolOutput);
|
|
8207
8198
|
},
|
|
8208
8199
|
"tool.execute.after": async (toolInput, toolOutput) => {
|
|
8209
|
-
await
|
|
8200
|
+
await eventLog.after({ directory }, toolInput, toolOutput);
|
|
8210
8201
|
const afterToolName = toolInput.tool ?? toolInput.name ?? "";
|
|
8211
8202
|
if (afterToolName === "delegate" || afterToolName === "run-pipeline") {
|
|
8212
8203
|
try {
|
|
@@ -73,9 +73,11 @@ export declare function loadResearchEvidence(dir: string, scope: ResearchScope):
|
|
|
73
73
|
*/
|
|
74
74
|
export declare function buildResearchDiagnostics(evidence: ResearchEvidence): ResearchDiagnostics;
|
|
75
75
|
/**
|
|
76
|
-
* Log research diagnostics
|
|
76
|
+
* Log research diagnostics via the provided logger (safe for TUI environments).
|
|
77
|
+
* Defaults to a no-op so raw stdout is never written from the plugin runtime.
|
|
78
|
+
* Pass `logger: console.log` only in non-TUI contexts (e.g. standalone scripts).
|
|
77
79
|
*/
|
|
78
|
-
export declare function logResearchDiagnostics(diags: ResearchDiagnostics): void;
|
|
80
|
+
export declare function logResearchDiagnostics(diags: ResearchDiagnostics, logger?: (msg: string) => void): void;
|
|
79
81
|
/**
|
|
80
82
|
* Perform a research pass for a given scope, checking freshness first.
|
|
81
83
|
*
|
|
@@ -85,6 +87,8 @@ export declare function logResearchDiagnostics(diags: ResearchDiagnostics): void
|
|
|
85
87
|
export declare function runResearchGate(dir: string, scope: ResearchScope, options?: {
|
|
86
88
|
forceRefresh?: boolean;
|
|
87
89
|
customEvidence?: Partial<ResearchEvidence>;
|
|
90
|
+
/** Optional logger for diagnostics. Defaults to no-op to avoid corrupting TUI output. */
|
|
91
|
+
logger?: (msg: string) => void;
|
|
88
92
|
}): Promise<ResearchEvidence>;
|
|
89
93
|
/**
|
|
90
94
|
* Check if a stage should proceed or block based on research gate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research-gate.d.ts","sourceRoot":"","sources":["../../src/lib/research-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAA0F,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGxJ,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtE,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,KAAK,EAAE,aAAa,CAAA;IACpB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,0EAA0E;IAC1E,aAAa,EAAE,OAAO,CAAA;IACtB,2EAA2E;IAC3E,kBAAkB,EAAE,OAAO,CAAA;IAC3B,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,KAAK,EAAE,aAAa,CAAA;IACpB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,yBAAyB;IACzB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,yBAAyB;IACzB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,0BAA0B;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,kCAAkC;IAClC,aAAa,EAAE,OAAO,CAAA;IACtB,kDAAkD;IAClD,kBAAkB,EAAE,OAAO,CAAA;CAC5B;AAID;;;;;;GAMG;AACH,wBA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CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAQvG"}
|
|
@@ -13,6 +13,6 @@ export interface ToolEvent {
|
|
|
13
13
|
export declare function getCurrentAgent(): string | null;
|
|
14
14
|
export declare function setCurrentAgent(agent: string | null): void;
|
|
15
15
|
export declare function sanitizeArgs(args: unknown): Record<string, unknown>;
|
|
16
|
-
export declare function logEvent(directory: string, event: ToolEvent): void;
|
|
16
|
+
export declare function logEvent(directory: string, event: ToolEvent, log?: (msg: string) => void): void;
|
|
17
17
|
export declare function formatEventForStderr(event: ToolEvent): string;
|
|
18
18
|
//# sourceMappingURL=event-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../src/services/event-logger.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,iBAAiB,GAAG,cAAc,GAAG,eAAe,GAAG,iBAAiB,CAAA;IAC7G,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAUD,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE1D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBnE;AAoBD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