codingbuddy 5.1.2 → 5.1.3
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/src/cli/run-tui.js +16 -0
- package/dist/src/cli/run-tui.js.map +1 -1
- package/dist/src/shared/version.d.ts +1 -1
- package/dist/src/shared/version.js +1 -1
- package/dist/src/tui/events/hud-file-bridge.d.ts +21 -0
- package/dist/src/tui/events/hud-file-bridge.js +112 -0
- package/dist/src/tui/events/hud-file-bridge.js.map +1 -0
- package/dist/src/tui/events/index.d.ts +1 -0
- package/dist/src/tui/events/index.js +3 -1
- package/dist/src/tui/events/index.js.map +1 -1
- package/dist/src/tui-bundle.mjs +37 -33
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/src/cli/run-tui.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runTui = runTui;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const os = require("node:os");
|
|
4
6
|
const ipc_types_1 = require("../tui/ipc/ipc.types");
|
|
5
7
|
const instance_registry_1 = require("../tui/ipc/instance-registry");
|
|
6
8
|
const restart_tui_1 = require("./restart-tui");
|
|
@@ -39,6 +41,19 @@ async function runTui(options = {}) {
|
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
43
|
manager.startPolling();
|
|
44
|
+
let hudBridge = null;
|
|
45
|
+
try {
|
|
46
|
+
const { HudFileBridge } = await Promise.resolve().then(() => require('../tui/events'));
|
|
47
|
+
const sessions = manager.getSessions();
|
|
48
|
+
if (sessions.length > 0) {
|
|
49
|
+
const hudStatePath = path.join(process.env.CODINGBUDDY_HUD_STATE_DIR ?? path.join(os.homedir(), '.codingbuddy'), 'hud-state.json');
|
|
50
|
+
const bridge = new HudFileBridge(sessions[0].eventBus, hudStatePath);
|
|
51
|
+
bridge.start();
|
|
52
|
+
hudBridge = bridge;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
}
|
|
42
57
|
let tuiInstance = null;
|
|
43
58
|
let shuttingDown = false;
|
|
44
59
|
const shutdown = () => {
|
|
@@ -50,6 +65,7 @@ async function runTui(options = {}) {
|
|
|
50
65
|
process.exit(0);
|
|
51
66
|
}, CLIENT_SHUTDOWN_TIMEOUT_MS);
|
|
52
67
|
timeout.unref();
|
|
68
|
+
hudBridge?.stop();
|
|
53
69
|
void manager.disconnectAll();
|
|
54
70
|
tuiInstance?.unmount();
|
|
55
71
|
process.exitCode = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tui.js","sourceRoot":"","sources":["../../../src/cli/run-tui.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"run-tui.js","sourceRoot":"","sources":["../../../src/cli/run-tui.ts"],"names":[],"mappings":";;AAeA,wBAwGC;AAvHD,kCAAkC;AAClC,8BAA8B;AAC9B,oDAA4D;AAC5D,oEAAgE;AAChE,+CAA2C;AAG3C,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAQjC,KAAK,UAAU,MAAM,CAAC,UAAiC,EAAE;IAC9D,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAU,GAAE,CAAC;QAClC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,MAAM,CAAC,GAAG,IAAI,SAAS,MAAM,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YAClE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,oCAAgB,CAAC,IAAA,gCAAoB,G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AAE,CAAC;YACvD,WAAW,GAAG,SAAS,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kCAAkC,GAAG,IAAI,GAAG,gDAAgD,CAC7F,CAAC;QACF,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC;QAC7B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "5.1.
|
|
1
|
+
export declare const VERSION = "5.1.3";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TuiEventBus } from './event-bus';
|
|
2
|
+
export interface HudFileBridgeOptions {
|
|
3
|
+
debounceMs?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class HudFileBridge {
|
|
6
|
+
private readonly eventBus;
|
|
7
|
+
private readonly filePath;
|
|
8
|
+
private readonly debounceMs;
|
|
9
|
+
private watcher;
|
|
10
|
+
private debounceTimer;
|
|
11
|
+
private pollInterval;
|
|
12
|
+
private prev;
|
|
13
|
+
private stopped;
|
|
14
|
+
constructor(eventBus: TuiEventBus, filePath: string, options?: HudFileBridgeOptions);
|
|
15
|
+
start(): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
private scheduleProcess;
|
|
18
|
+
private processChange;
|
|
19
|
+
private readState;
|
|
20
|
+
private pollUntilExists;
|
|
21
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HudFileBridge = void 0;
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const VALID_MODES = new Set(['PLAN', 'ACT', 'EVAL', 'AUTO']);
|
|
8
|
+
class HudFileBridge {
|
|
9
|
+
constructor(eventBus, filePath, options) {
|
|
10
|
+
this.watcher = null;
|
|
11
|
+
this.debounceTimer = null;
|
|
12
|
+
this.pollInterval = null;
|
|
13
|
+
this.prev = { currentMode: null, activeAgent: null };
|
|
14
|
+
this.stopped = false;
|
|
15
|
+
this.eventBus = eventBus;
|
|
16
|
+
this.filePath = filePath;
|
|
17
|
+
this.debounceMs = options?.debounceMs ?? 150;
|
|
18
|
+
}
|
|
19
|
+
start() {
|
|
20
|
+
this.stopped = false;
|
|
21
|
+
this.prev = this.readState();
|
|
22
|
+
const dir = path.dirname(this.filePath);
|
|
23
|
+
const basename = path.basename(this.filePath);
|
|
24
|
+
try {
|
|
25
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
26
|
+
this.watcher = fs.watch(dir, { persistent: false }, (_event, filename) => {
|
|
27
|
+
if (!filename || filename === basename)
|
|
28
|
+
this.scheduleProcess();
|
|
29
|
+
});
|
|
30
|
+
this.watcher.on('error', () => {
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
this.pollUntilExists();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
stop() {
|
|
38
|
+
this.stopped = true;
|
|
39
|
+
if (this.debounceTimer) {
|
|
40
|
+
clearTimeout(this.debounceTimer);
|
|
41
|
+
this.debounceTimer = null;
|
|
42
|
+
}
|
|
43
|
+
if (this.pollInterval) {
|
|
44
|
+
clearInterval(this.pollInterval);
|
|
45
|
+
this.pollInterval = null;
|
|
46
|
+
}
|
|
47
|
+
if (this.watcher) {
|
|
48
|
+
this.watcher.close();
|
|
49
|
+
this.watcher = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
scheduleProcess() {
|
|
53
|
+
if (this.stopped)
|
|
54
|
+
return;
|
|
55
|
+
if (this.debounceTimer)
|
|
56
|
+
clearTimeout(this.debounceTimer);
|
|
57
|
+
this.debounceTimer = setTimeout(() => this.processChange(), this.debounceMs);
|
|
58
|
+
}
|
|
59
|
+
processChange() {
|
|
60
|
+
if (this.stopped)
|
|
61
|
+
return;
|
|
62
|
+
const next = this.readState();
|
|
63
|
+
if (next.currentMode &&
|
|
64
|
+
VALID_MODES.has(next.currentMode) &&
|
|
65
|
+
next.currentMode !== this.prev.currentMode) {
|
|
66
|
+
this.eventBus.emit(types_1.TUI_EVENTS.MODE_CHANGED, {
|
|
67
|
+
from: this.prev.currentMode ?? null,
|
|
68
|
+
to: next.currentMode,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (next.activeAgent && next.activeAgent !== this.prev.activeAgent) {
|
|
72
|
+
this.eventBus.emit(types_1.TUI_EVENTS.AGENT_ACTIVATED, {
|
|
73
|
+
agentId: `primary:${next.activeAgent}`,
|
|
74
|
+
name: next.activeAgent,
|
|
75
|
+
role: 'primary',
|
|
76
|
+
isPrimary: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
this.prev = next;
|
|
80
|
+
}
|
|
81
|
+
readState() {
|
|
82
|
+
try {
|
|
83
|
+
const raw = fs.readFileSync(this.filePath, 'utf-8');
|
|
84
|
+
const parsed = JSON.parse(raw);
|
|
85
|
+
return {
|
|
86
|
+
currentMode: typeof parsed.currentMode === 'string' ? parsed.currentMode : null,
|
|
87
|
+
activeAgent: typeof parsed.activeAgent === 'string' ? parsed.activeAgent : null,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return { currentMode: null, activeAgent: null };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
pollUntilExists() {
|
|
95
|
+
if (this.stopped)
|
|
96
|
+
return;
|
|
97
|
+
this.pollInterval = setInterval(() => {
|
|
98
|
+
if (this.stopped) {
|
|
99
|
+
clearInterval(this.pollInterval);
|
|
100
|
+
this.pollInterval = null;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (fs.existsSync(this.filePath)) {
|
|
104
|
+
clearInterval(this.pollInterval);
|
|
105
|
+
this.pollInterval = null;
|
|
106
|
+
this.start();
|
|
107
|
+
}
|
|
108
|
+
}, 2000);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.HudFileBridge = HudFileBridge;
|
|
112
|
+
//# sourceMappingURL=hud-file-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hud-file-bridge.js","sourceRoot":"","sources":["../../../../src/tui/events/hud-file-bridge.ts"],"names":[],"mappings":";;;AAOA,8BAA8B;AAC9B,kCAAkC;AAElC,mCAAqC;AAErC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAY7D,MAAa,aAAa;IAWxB,YAAY,QAAqB,EAAE,QAAgB,EAAE,OAA8B;QAN3E,YAAO,GAAwB,IAAI,CAAC;QACpC,kBAAa,GAAyC,IAAI,CAAC;QAC3D,iBAAY,GAA0C,IAAI,CAAC;QAC3D,SAAI,GAAa,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC1D,YAAO,GAAG,KAAK,CAAC;QAGtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC;IAC/C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAK7B,MAAM,GAAG,GAAG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AA4B,CAAC;YAC1D,OAAO;gBACL,WAAW,EAAE,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;gBAC/E,WAAW,EAAE,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;aAChF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClD,CAAC;IACH,CAAC;IAEO,eAAe;QACrB,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,aAAa,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;gBAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBACzB,OAAO;YACT,CAAC;YACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,aAAa,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;gBAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBACzB,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC;CACF;AAxHD,sCAwHC"}
|
|
@@ -5,3 +5,4 @@ export { AgentMetadataService } from './agent-metadata.service';
|
|
|
5
5
|
export { TuiEventsModule } from './events.module';
|
|
6
6
|
export { TUI_EVENTS, type TuiEventName, type TuiEventMap, type AgentActivatedEvent, type AgentDeactivatedEvent, type ModeChangedEvent, type SkillRecommendedEvent, type ParallelStartedEvent, type ParallelCompletedEvent, type AgentsLoadedEvent, type AgentRelationshipEvent, type TaskSyncedEvent, type ToolInvokedEvent, type ObjectiveSetEvent, type SessionResetEvent, type ContextUpdatedEvent, type DiscussionRoundAddedEvent, type TddPhaseChangedEvent, type TddStepUpdatedEvent, type ReviewResultAddedEvent, type ConnectionStatusChangedEvent, } from './types';
|
|
7
7
|
export { type AgentMetadata, type AgentCategory, AGENT_CATEGORY_MAP, AGENT_ICONS, } from './agent-metadata.types';
|
|
8
|
+
export { HudFileBridge, type HudFileBridgeOptions } from './hud-file-bridge';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AGENT_ICONS = exports.AGENT_CATEGORY_MAP = exports.TUI_EVENTS = exports.TuiEventsModule = exports.AgentMetadataService = exports.parseAgentFromToolName = exports.TuiInterceptor = exports.TuiEventBus = void 0;
|
|
3
|
+
exports.HudFileBridge = exports.AGENT_ICONS = exports.AGENT_CATEGORY_MAP = exports.TUI_EVENTS = exports.TuiEventsModule = exports.AgentMetadataService = exports.parseAgentFromToolName = exports.TuiInterceptor = exports.TuiEventBus = void 0;
|
|
4
4
|
var event_bus_1 = require("./event-bus");
|
|
5
5
|
Object.defineProperty(exports, "TuiEventBus", { enumerable: true, get: function () { return event_bus_1.TuiEventBus; } });
|
|
6
6
|
var tui_interceptor_1 = require("./tui-interceptor");
|
|
@@ -16,4 +16,6 @@ Object.defineProperty(exports, "TUI_EVENTS", { enumerable: true, get: function (
|
|
|
16
16
|
var agent_metadata_types_1 = require("./agent-metadata.types");
|
|
17
17
|
Object.defineProperty(exports, "AGENT_CATEGORY_MAP", { enumerable: true, get: function () { return agent_metadata_types_1.AGENT_CATEGORY_MAP; } });
|
|
18
18
|
Object.defineProperty(exports, "AGENT_ICONS", { enumerable: true, get: function () { return agent_metadata_types_1.AGENT_ICONS; } });
|
|
19
|
+
var hud_file_bridge_1 = require("./hud-file-bridge");
|
|
20
|
+
Object.defineProperty(exports, "HudFileBridge", { enumerable: true, get: function () { return hud_file_bridge_1.HudFileBridge; } });
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tui/events/index.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAAjC,wGAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAC7B,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,iCAsBiB;AArBf,mGAAA,UAAU,OAAA;AAsBZ,+DAKgC;AAF9B,0HAAA,kBAAkB,OAAA;AAClB,mHAAA,WAAW,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tui/events/index.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAAjC,wGAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,6CAAuD;AAA9C,qHAAA,sBAAsB,OAAA;AAC/B,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAC7B,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,iCAsBiB;AArBf,mGAAA,UAAU,OAAA;AAsBZ,+DAKgC;AAF9B,0HAAA,kBAAkB,OAAA;AAClB,mHAAA,WAAW,OAAA;AAEb,qDAA6E;AAApE,gHAAA,aAAa,OAAA"}
|
package/dist/src/tui-bundle.mjs
CHANGED
|
@@ -595,21 +595,21 @@ var require_eventemitter2 = __commonJS({
|
|
|
595
595
|
function collectTreeEvents(tree, events, root, asArray) {
|
|
596
596
|
var branches = ownKeys(tree);
|
|
597
597
|
var i = branches.length;
|
|
598
|
-
var branch, branchName,
|
|
598
|
+
var branch, branchName, path10;
|
|
599
599
|
var hasListeners = tree["_listeners"];
|
|
600
600
|
var isArrayPath;
|
|
601
601
|
while (i-- > 0) {
|
|
602
602
|
branchName = branches[i];
|
|
603
603
|
branch = tree[branchName];
|
|
604
604
|
if (branchName === "_listeners") {
|
|
605
|
-
|
|
605
|
+
path10 = root;
|
|
606
606
|
} else {
|
|
607
|
-
|
|
607
|
+
path10 = root ? root.concat(branchName) : [branchName];
|
|
608
608
|
}
|
|
609
609
|
isArrayPath = asArray || typeof branchName === "symbol";
|
|
610
|
-
hasListeners && events.push(isArrayPath ?
|
|
610
|
+
hasListeners && events.push(isArrayPath ? path10 : path10.join(this.delimiter));
|
|
611
611
|
if (typeof branch === "object") {
|
|
612
|
-
collectTreeEvents.call(this, branch, events,
|
|
612
|
+
collectTreeEvents.call(this, branch, events, path10, isArrayPath);
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
return events;
|
|
@@ -2366,7 +2366,7 @@ function getReadFile(deps) {
|
|
|
2366
2366
|
function getReaddir(deps) {
|
|
2367
2367
|
return deps?.readdir ?? defaultReaddir;
|
|
2368
2368
|
}
|
|
2369
|
-
function resolveRulesDir(
|
|
2369
|
+
function resolveRulesDir(dirname3, options) {
|
|
2370
2370
|
if (options?.envRulesDir) {
|
|
2371
2371
|
return options.envRulesDir;
|
|
2372
2372
|
}
|
|
@@ -2374,15 +2374,15 @@ function resolveRulesDir(dirname2, options) {
|
|
|
2374
2374
|
return options.packageRulesPath;
|
|
2375
2375
|
}
|
|
2376
2376
|
const candidates = [
|
|
2377
|
-
path2.resolve(
|
|
2378
|
-
path2.resolve(
|
|
2379
|
-
path2.resolve(
|
|
2380
|
-
path2.resolve(
|
|
2377
|
+
path2.resolve(dirname3, "../../../../packages/rules/.ai-rules"),
|
|
2378
|
+
path2.resolve(dirname3, "../../../packages/rules/.ai-rules"),
|
|
2379
|
+
path2.resolve(dirname3, "../../../../.ai-rules"),
|
|
2380
|
+
path2.resolve(dirname3, "../../../.ai-rules")
|
|
2381
2381
|
];
|
|
2382
|
-
const
|
|
2383
|
-
if (
|
|
2382
|
+
const existsSync7 = options?.existsSync;
|
|
2383
|
+
if (existsSync7) {
|
|
2384
2384
|
for (const candidate of candidates) {
|
|
2385
|
-
if (
|
|
2385
|
+
if (existsSync7(candidate)) {
|
|
2386
2386
|
return candidate;
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
@@ -4141,6 +4141,10 @@ TuiEventsModule = __decorateClass([
|
|
|
4141
4141
|
})
|
|
4142
4142
|
], TuiEventsModule);
|
|
4143
4143
|
|
|
4144
|
+
// src/tui/events/hud-file-bridge.ts
|
|
4145
|
+
import * as fs4 from "node:fs";
|
|
4146
|
+
import * as path8 from "node:path";
|
|
4147
|
+
|
|
4144
4148
|
// src/tui/hooks/use-focus-agent.ts
|
|
4145
4149
|
function selectFocusedAgent(agents, currentFocusId) {
|
|
4146
4150
|
if (agents.size === 0) return null;
|
|
@@ -5429,57 +5433,57 @@ var ColorBuffer = class {
|
|
|
5429
5433
|
|
|
5430
5434
|
// src/tui/utils/edge-router.ts
|
|
5431
5435
|
function computeEdgePath(from, to) {
|
|
5432
|
-
const
|
|
5436
|
+
const path10 = [];
|
|
5433
5437
|
const midX = Math.floor((from.x + to.x) / 2);
|
|
5434
5438
|
if (from.y === to.y) {
|
|
5435
5439
|
const dir = to.x > from.x ? 1 : -1;
|
|
5436
5440
|
for (let x = from.x; x !== to.x; x += dir) {
|
|
5437
|
-
|
|
5441
|
+
path10.push({ x, y: from.y, char: "\u2500" });
|
|
5438
5442
|
}
|
|
5439
|
-
|
|
5443
|
+
path10.push({ x: to.x, y: to.y, char: dir > 0 ? "\u25B8" : "\u25C2" });
|
|
5440
5444
|
} else if (from.x === to.x) {
|
|
5441
5445
|
const dir = to.y > from.y ? 1 : -1;
|
|
5442
5446
|
for (let y = from.y; y !== to.y; y += dir) {
|
|
5443
|
-
|
|
5447
|
+
path10.push({ x: from.x, y, char: "\u2502" });
|
|
5444
5448
|
}
|
|
5445
|
-
|
|
5449
|
+
path10.push({ x: to.x, y: to.y, char: dir > 0 ? "\u25BE" : "\u25B4" });
|
|
5446
5450
|
} else {
|
|
5447
5451
|
const dirX = midX > from.x ? 1 : midX < from.x ? -1 : 0;
|
|
5448
5452
|
if (dirX !== 0) {
|
|
5449
5453
|
for (let x = from.x; x !== midX; x += dirX) {
|
|
5450
|
-
|
|
5454
|
+
path10.push({ x, y: from.y, char: "\u2500" });
|
|
5451
5455
|
}
|
|
5452
5456
|
}
|
|
5453
5457
|
const dirY = to.y > from.y ? 1 : -1;
|
|
5454
|
-
|
|
5458
|
+
path10.push({
|
|
5455
5459
|
x: midX,
|
|
5456
5460
|
y: from.y,
|
|
5457
5461
|
char: dirX >= 0 ? dirY > 0 ? "\u256E" : "\u256F" : dirY > 0 ? "\u256D" : "\u2570"
|
|
5458
5462
|
});
|
|
5459
5463
|
for (let y = from.y + dirY; y !== to.y; y += dirY) {
|
|
5460
|
-
|
|
5464
|
+
path10.push({ x: midX, y, char: "\u2502" });
|
|
5461
5465
|
}
|
|
5462
5466
|
const dirX2 = to.x > midX ? 1 : to.x < midX ? -1 : 0;
|
|
5463
|
-
|
|
5467
|
+
path10.push({
|
|
5464
5468
|
x: midX,
|
|
5465
5469
|
y: to.y,
|
|
5466
5470
|
char: dirY > 0 ? dirX2 >= 0 ? "\u2570" : "\u256F" : dirX2 >= 0 ? "\u256D" : "\u256E"
|
|
5467
5471
|
});
|
|
5468
5472
|
if (dirX2 !== 0) {
|
|
5469
5473
|
for (let x = midX + dirX2; x !== to.x; x += dirX2) {
|
|
5470
|
-
|
|
5474
|
+
path10.push({ x, y: to.y, char: "\u2500" });
|
|
5471
5475
|
}
|
|
5472
5476
|
}
|
|
5473
5477
|
if (to.x !== midX) {
|
|
5474
|
-
|
|
5478
|
+
path10.push({ x: to.x, y: to.y, char: dirX2 >= 0 ? "\u25B8" : "\u25C2" });
|
|
5475
5479
|
} else {
|
|
5476
|
-
|
|
5480
|
+
path10[path10.length - 1].char = dirY > 0 ? "\u25BE" : "\u25B4";
|
|
5477
5481
|
}
|
|
5478
5482
|
}
|
|
5479
|
-
return
|
|
5483
|
+
return path10;
|
|
5480
5484
|
}
|
|
5481
|
-
function computeLabelPosition(
|
|
5482
|
-
const hSegments =
|
|
5485
|
+
function computeLabelPosition(path10, label) {
|
|
5486
|
+
const hSegments = path10.filter((p) => p.char === "\u2500");
|
|
5483
5487
|
if (hSegments.length < label.length + 2) return null;
|
|
5484
5488
|
const startIdx = Math.floor((hSegments.length - label.length) / 2);
|
|
5485
5489
|
return { x: hSegments[startIdx].x, y: hSegments[startIdx].y };
|
|
@@ -5750,14 +5754,14 @@ function renderFlowMap(agents, edges, width, height, activeStage = null) {
|
|
|
5750
5754
|
x: toPos.x - 1,
|
|
5751
5755
|
y: toPos.y + Math.floor(toPos.height / 2)
|
|
5752
5756
|
};
|
|
5753
|
-
const
|
|
5757
|
+
const path10 = computeEdgePath(fromPoint, toPoint);
|
|
5754
5758
|
const edgeDimmed = inactiveIds.has(edge.from) && inactiveIds.has(edge.to);
|
|
5755
|
-
for (const seg of
|
|
5759
|
+
for (const seg of path10) {
|
|
5756
5760
|
const isArrow = seg.char === "\u25B8" || seg.char === "\u25C2" || seg.char === "\u25BE" || seg.char === "\u25B4";
|
|
5757
5761
|
const segStyle = edgeDimmed ? DIMMED_STYLE : isArrow ? EDGE_STYLES.arrow : EDGE_STYLES.path;
|
|
5758
5762
|
buf.setChar(seg.x, seg.y, seg.char, segStyle);
|
|
5759
5763
|
}
|
|
5760
|
-
const labelPos = computeLabelPosition(
|
|
5764
|
+
const labelPos = computeLabelPosition(path10, edge.label);
|
|
5761
5765
|
if (labelPos) {
|
|
5762
5766
|
buf.writeText(
|
|
5763
5767
|
labelPos.x,
|
|
@@ -6747,7 +6751,7 @@ function DashboardApp({
|
|
|
6747
6751
|
// src/tui/multi-session-app.tsx
|
|
6748
6752
|
import React15, { useMemo as useMemo8, useCallback as useCallback2 } from "react";
|
|
6749
6753
|
import { Box as Box15, useInput } from "ink";
|
|
6750
|
-
import * as
|
|
6754
|
+
import * as path9 from "path";
|
|
6751
6755
|
|
|
6752
6756
|
// src/tui/hooks/use-multi-session-state.ts
|
|
6753
6757
|
import { useState as useState3, useCallback, useEffect as useEffect4, useRef } from "react";
|
|
@@ -6972,7 +6976,7 @@ function MultiSessionApp({ manager }) {
|
|
|
6972
6976
|
result.push({
|
|
6973
6977
|
pid,
|
|
6974
6978
|
index,
|
|
6975
|
-
projectName:
|
|
6979
|
+
projectName: path9.basename(sessionState.projectRoot),
|
|
6976
6980
|
globalState: sessionState.dashboardState.globalState,
|
|
6977
6981
|
isActive: pid === activeSessionPid
|
|
6978
6982
|
});
|