@meet-ai/cli 0.0.17 → 0.0.19
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/index.js +2514 -1197
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -519,7 +519,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
519
519
|
});
|
|
520
520
|
|
|
521
521
|
// src/lib/output.ts
|
|
522
|
-
var import_picocolors, ok = (msg) => console.log(import_picocolors.default.green(msg)), err = (msg) => console.error(import_picocolors.default.red(`error: ${msg}`));
|
|
522
|
+
var import_picocolors, ok = (msg) => console.log(import_picocolors.default.green(msg)), err = (msg) => console.error(import_picocolors.default.red(`error: ${msg}`)), info = (msg) => console.log(import_picocolors.default.cyan(msg));
|
|
523
523
|
var init_output = __esm(() => {
|
|
524
524
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
525
525
|
});
|
|
@@ -14737,11 +14737,24 @@ function createClient(baseUrl, apiKey) {
|
|
|
14737
14737
|
const tokenParam = apiKey ? `?token=${apiKey}` : "";
|
|
14738
14738
|
let pingInterval = null;
|
|
14739
14739
|
let reconnectAttempt = 0;
|
|
14740
|
+
let reconnectScheduled = false;
|
|
14741
|
+
const log = options?.silent ? () => {} : wsLog;
|
|
14740
14742
|
function getReconnectDelay() {
|
|
14741
14743
|
const delay = Math.min(1000 * 2 ** Math.min(reconnectAttempt, 4), 15000);
|
|
14742
14744
|
reconnectAttempt++;
|
|
14743
14745
|
return delay + delay * 0.5 * Math.random();
|
|
14744
14746
|
}
|
|
14747
|
+
function scheduleReconnect() {
|
|
14748
|
+
if (reconnectScheduled)
|
|
14749
|
+
return;
|
|
14750
|
+
reconnectScheduled = true;
|
|
14751
|
+
const delay = getReconnectDelay();
|
|
14752
|
+
log({ event: "reconnecting", attempt: reconnectAttempt, delay_ms: Math.round(delay) });
|
|
14753
|
+
setTimeout(() => {
|
|
14754
|
+
reconnectScheduled = false;
|
|
14755
|
+
connect();
|
|
14756
|
+
}, delay);
|
|
14757
|
+
}
|
|
14745
14758
|
function connect() {
|
|
14746
14759
|
const ws = new WebSocket(`${wsUrl}/api/lobby/ws${tokenParam}`);
|
|
14747
14760
|
const connectTimeout = setTimeout(() => {
|
|
@@ -14749,14 +14762,13 @@ function createClient(baseUrl, apiKey) {
|
|
|
14749
14762
|
try {
|
|
14750
14763
|
ws.close(4000, "connect timeout");
|
|
14751
14764
|
} catch {}
|
|
14752
|
-
|
|
14753
|
-
setTimeout(connect, delay);
|
|
14765
|
+
scheduleReconnect();
|
|
14754
14766
|
}
|
|
14755
14767
|
}, 30000);
|
|
14756
14768
|
ws.onopen = () => {
|
|
14757
14769
|
clearTimeout(connectTimeout);
|
|
14758
14770
|
reconnectAttempt = 0;
|
|
14759
|
-
|
|
14771
|
+
log({ event: "lobby_connected" });
|
|
14760
14772
|
if (pingInterval)
|
|
14761
14773
|
clearInterval(pingInterval);
|
|
14762
14774
|
pingInterval = setInterval(() => {
|
|
@@ -14774,6 +14786,9 @@ function createClient(baseUrl, apiKey) {
|
|
|
14774
14786
|
if (data.type === "room_created" && data.id && data.name) {
|
|
14775
14787
|
options?.onRoomCreated?.(data.id, data.name);
|
|
14776
14788
|
}
|
|
14789
|
+
if (data.type === "spawn_request" && data.room_name) {
|
|
14790
|
+
options?.onSpawnRequest?.(data.room_name);
|
|
14791
|
+
}
|
|
14777
14792
|
} catch {}
|
|
14778
14793
|
};
|
|
14779
14794
|
ws.onclose = (event) => {
|
|
@@ -14782,8 +14797,7 @@ function createClient(baseUrl, apiKey) {
|
|
|
14782
14797
|
clearInterval(pingInterval);
|
|
14783
14798
|
if (event.code === 1000)
|
|
14784
14799
|
return;
|
|
14785
|
-
|
|
14786
|
-
setTimeout(connect, delay);
|
|
14800
|
+
scheduleReconnect();
|
|
14787
14801
|
};
|
|
14788
14802
|
ws.onerror = () => {};
|
|
14789
14803
|
return ws;
|
|
@@ -15689,10 +15703,10 @@ var init_command10 = __esm(() => {
|
|
|
15689
15703
|
// ../../node_modules/.bun/react@19.2.4/node_modules/react/cjs/react.development.js
|
|
15690
15704
|
var require_react_development = __commonJS((exports, module) => {
|
|
15691
15705
|
(function() {
|
|
15692
|
-
function defineDeprecationWarning(methodName,
|
|
15706
|
+
function defineDeprecationWarning(methodName, info2) {
|
|
15693
15707
|
Object.defineProperty(Component.prototype, methodName, {
|
|
15694
15708
|
get: function() {
|
|
15695
|
-
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
15709
|
+
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info2[0], info2[1]);
|
|
15696
15710
|
}
|
|
15697
15711
|
});
|
|
15698
15712
|
}
|
|
@@ -20741,15 +20755,15 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
|
|
|
20741
20755
|
}
|
|
20742
20756
|
function getStackByFiberInDevAndProd(workInProgress2) {
|
|
20743
20757
|
try {
|
|
20744
|
-
var
|
|
20758
|
+
var info2 = "", previous = null;
|
|
20745
20759
|
do {
|
|
20746
|
-
|
|
20760
|
+
info2 += describeFiber(workInProgress2, previous);
|
|
20747
20761
|
var debugInfo = workInProgress2._debugInfo;
|
|
20748
20762
|
if (debugInfo)
|
|
20749
20763
|
for (var i = debugInfo.length - 1;0 <= i; i--) {
|
|
20750
20764
|
var entry = debugInfo[i];
|
|
20751
20765
|
if (typeof entry.name === "string") {
|
|
20752
|
-
var JSCompiler_temp_const =
|
|
20766
|
+
var JSCompiler_temp_const = info2;
|
|
20753
20767
|
a: {
|
|
20754
20768
|
var { name, env: env2, debugLocation: location } = entry;
|
|
20755
20769
|
if (location != null) {
|
|
@@ -20763,13 +20777,13 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
|
|
|
20763
20777
|
}
|
|
20764
20778
|
JSCompiler_inline_result = describeBuiltInComponentFrame(name + (env2 ? " [" + env2 + "]" : ""));
|
|
20765
20779
|
}
|
|
20766
|
-
|
|
20780
|
+
info2 = JSCompiler_temp_const + JSCompiler_inline_result;
|
|
20767
20781
|
}
|
|
20768
20782
|
}
|
|
20769
20783
|
previous = workInProgress2;
|
|
20770
20784
|
workInProgress2 = workInProgress2.return;
|
|
20771
20785
|
} while (workInProgress2);
|
|
20772
|
-
return
|
|
20786
|
+
return info2;
|
|
20773
20787
|
} catch (x) {
|
|
20774
20788
|
return `
|
|
20775
20789
|
Error generating stack: ` + x.message + `
|
|
@@ -21137,31 +21151,31 @@ Error generating stack: ` + x.message + `
|
|
|
21137
21151
|
return "";
|
|
21138
21152
|
var workInProgress2 = current;
|
|
21139
21153
|
try {
|
|
21140
|
-
var
|
|
21154
|
+
var info2 = "";
|
|
21141
21155
|
workInProgress2.tag === 6 && (workInProgress2 = workInProgress2.return);
|
|
21142
21156
|
switch (workInProgress2.tag) {
|
|
21143
21157
|
case 26:
|
|
21144
21158
|
case 27:
|
|
21145
21159
|
case 5:
|
|
21146
|
-
|
|
21160
|
+
info2 += describeBuiltInComponentFrame(workInProgress2.type);
|
|
21147
21161
|
break;
|
|
21148
21162
|
case 13:
|
|
21149
|
-
|
|
21163
|
+
info2 += describeBuiltInComponentFrame("Suspense");
|
|
21150
21164
|
break;
|
|
21151
21165
|
case 19:
|
|
21152
|
-
|
|
21166
|
+
info2 += describeBuiltInComponentFrame("SuspenseList");
|
|
21153
21167
|
break;
|
|
21154
21168
|
case 31:
|
|
21155
|
-
|
|
21169
|
+
info2 += describeBuiltInComponentFrame("Activity");
|
|
21156
21170
|
break;
|
|
21157
21171
|
case 30:
|
|
21158
21172
|
case 0:
|
|
21159
21173
|
case 15:
|
|
21160
21174
|
case 1:
|
|
21161
|
-
workInProgress2._debugOwner ||
|
|
21175
|
+
workInProgress2._debugOwner || info2 !== "" || (info2 += describeFunctionComponentFrameWithoutLineNumber(workInProgress2.type));
|
|
21162
21176
|
break;
|
|
21163
21177
|
case 11:
|
|
21164
|
-
workInProgress2._debugOwner ||
|
|
21178
|
+
workInProgress2._debugOwner || info2 !== "" || (info2 += describeFunctionComponentFrameWithoutLineNumber(workInProgress2.type.render));
|
|
21165
21179
|
}
|
|
21166
21180
|
for (;workInProgress2; )
|
|
21167
21181
|
if (typeof workInProgress2.tag === "number") {
|
|
@@ -21170,16 +21184,16 @@ Error generating stack: ` + x.message + `
|
|
|
21170
21184
|
var debugStack = fiber._debugStack;
|
|
21171
21185
|
if (workInProgress2 && debugStack) {
|
|
21172
21186
|
var formattedStack = formatOwnerStack(debugStack);
|
|
21173
|
-
formattedStack !== "" && (
|
|
21187
|
+
formattedStack !== "" && (info2 += `
|
|
21174
21188
|
` + formattedStack);
|
|
21175
21189
|
}
|
|
21176
21190
|
} else if (workInProgress2.debugStack != null) {
|
|
21177
21191
|
var ownerStack = workInProgress2.debugStack;
|
|
21178
|
-
(workInProgress2 = workInProgress2.owner) && ownerStack && (
|
|
21192
|
+
(workInProgress2 = workInProgress2.owner) && ownerStack && (info2 += `
|
|
21179
21193
|
` + formatOwnerStack(ownerStack));
|
|
21180
21194
|
} else
|
|
21181
21195
|
break;
|
|
21182
|
-
var JSCompiler_inline_result =
|
|
21196
|
+
var JSCompiler_inline_result = info2;
|
|
21183
21197
|
} catch (x) {
|
|
21184
21198
|
JSCompiler_inline_result = `
|
|
21185
21199
|
Error generating stack: ` + x.message + `
|
|
@@ -34537,13 +34551,13 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
34537
34551
|
}
|
|
34538
34552
|
}
|
|
34539
34553
|
if (this.options.verifyClient) {
|
|
34540
|
-
const
|
|
34554
|
+
const info2 = {
|
|
34541
34555
|
origin: req.headers[`${version2 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
34542
34556
|
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
34543
34557
|
req
|
|
34544
34558
|
};
|
|
34545
34559
|
if (this.options.verifyClient.length === 2) {
|
|
34546
|
-
this.options.verifyClient(
|
|
34560
|
+
this.options.verifyClient(info2, (verified, code, message, headers) => {
|
|
34547
34561
|
if (!verified) {
|
|
34548
34562
|
return abortHandshake(socket, code || 401, message, headers);
|
|
34549
34563
|
}
|
|
@@ -34551,7 +34565,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
34551
34565
|
});
|
|
34552
34566
|
return;
|
|
34553
34567
|
}
|
|
34554
|
-
if (!this.options.verifyClient(
|
|
34568
|
+
if (!this.options.verifyClient(info2))
|
|
34555
34569
|
return abortHandshake(socket, 401);
|
|
34556
34570
|
}
|
|
34557
34571
|
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
@@ -41525,7 +41539,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
41525
41539
|
}
|
|
41526
41540
|
function getOwnerStackByComponentInfoInDev(componentInfo) {
|
|
41527
41541
|
try {
|
|
41528
|
-
var
|
|
41542
|
+
var info2 = "";
|
|
41529
41543
|
if (!componentInfo.owner && typeof componentInfo.name === "string") {
|
|
41530
41544
|
return describeBuiltInComponentFrame(componentInfo.name);
|
|
41531
41545
|
}
|
|
@@ -41535,14 +41549,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
41535
41549
|
if (ownerStack != null) {
|
|
41536
41550
|
owner = owner.owner;
|
|
41537
41551
|
if (owner) {
|
|
41538
|
-
|
|
41552
|
+
info2 += `
|
|
41539
41553
|
` + formatOwnerStack(ownerStack);
|
|
41540
41554
|
}
|
|
41541
41555
|
} else {
|
|
41542
41556
|
break;
|
|
41543
41557
|
}
|
|
41544
41558
|
}
|
|
41545
|
-
return
|
|
41559
|
+
return info2;
|
|
41546
41560
|
} catch (x) {
|
|
41547
41561
|
return `
|
|
41548
41562
|
Error generating stack: ` + x.message + `
|
|
@@ -41805,22 +41819,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
41805
41819
|
}
|
|
41806
41820
|
function getStackByFiberInDevAndProd(workTagMap, workInProgress, currentDispatcherRef) {
|
|
41807
41821
|
try {
|
|
41808
|
-
var
|
|
41822
|
+
var info2 = "";
|
|
41809
41823
|
var node = workInProgress;
|
|
41810
41824
|
do {
|
|
41811
|
-
|
|
41825
|
+
info2 += describeFiber(workTagMap, node, currentDispatcherRef);
|
|
41812
41826
|
var debugInfo = node._debugInfo;
|
|
41813
41827
|
if (debugInfo) {
|
|
41814
41828
|
for (var i = debugInfo.length - 1;i >= 0; i--) {
|
|
41815
41829
|
var entry = debugInfo[i];
|
|
41816
41830
|
if (typeof entry.name === "string") {
|
|
41817
|
-
|
|
41831
|
+
info2 += describeDebugInfoFrame(entry.name, entry.env);
|
|
41818
41832
|
}
|
|
41819
41833
|
}
|
|
41820
41834
|
}
|
|
41821
41835
|
node = node.return;
|
|
41822
41836
|
} while (node);
|
|
41823
|
-
return
|
|
41837
|
+
return info2;
|
|
41824
41838
|
} catch (x) {
|
|
41825
41839
|
return `
|
|
41826
41840
|
Error generating stack: ` + x.message + `
|
|
@@ -41829,9 +41843,9 @@ Error generating stack: ` + x.message + `
|
|
|
41829
41843
|
}
|
|
41830
41844
|
function getSourceLocationByFiber(workTagMap, fiber, currentDispatcherRef) {
|
|
41831
41845
|
try {
|
|
41832
|
-
var
|
|
41833
|
-
if (
|
|
41834
|
-
return
|
|
41846
|
+
var info2 = describeFiber(workTagMap, fiber, currentDispatcherRef);
|
|
41847
|
+
if (info2 !== "") {
|
|
41848
|
+
return info2.slice(1);
|
|
41835
41849
|
}
|
|
41836
41850
|
} catch (x) {
|
|
41837
41851
|
console.error(x);
|
|
@@ -41847,7 +41861,7 @@ Error generating stack: ` + x.message + `
|
|
|
41847
41861
|
function getOwnerStackByFiberInDev(workTagMap, workInProgress, currentDispatcherRef) {
|
|
41848
41862
|
var { HostHoistable, HostSingleton, HostText, HostComponent, SuspenseComponent, SuspenseListComponent, ViewTransitionComponent, ActivityComponent } = workTagMap;
|
|
41849
41863
|
try {
|
|
41850
|
-
var
|
|
41864
|
+
var info2 = "";
|
|
41851
41865
|
if (workInProgress.tag === HostText) {
|
|
41852
41866
|
workInProgress = workInProgress.return;
|
|
41853
41867
|
}
|
|
@@ -41855,19 +41869,19 @@ Error generating stack: ` + x.message + `
|
|
|
41855
41869
|
case HostHoistable:
|
|
41856
41870
|
case HostSingleton:
|
|
41857
41871
|
case HostComponent:
|
|
41858
|
-
|
|
41872
|
+
info2 += describeBuiltInComponentFrame(workInProgress.type);
|
|
41859
41873
|
break;
|
|
41860
41874
|
case SuspenseComponent:
|
|
41861
|
-
|
|
41875
|
+
info2 += describeBuiltInComponentFrame("Suspense");
|
|
41862
41876
|
break;
|
|
41863
41877
|
case SuspenseListComponent:
|
|
41864
|
-
|
|
41878
|
+
info2 += describeBuiltInComponentFrame("SuspenseList");
|
|
41865
41879
|
break;
|
|
41866
41880
|
case ViewTransitionComponent:
|
|
41867
|
-
|
|
41881
|
+
info2 += describeBuiltInComponentFrame("ViewTransition");
|
|
41868
41882
|
break;
|
|
41869
41883
|
case ActivityComponent:
|
|
41870
|
-
|
|
41884
|
+
info2 += describeBuiltInComponentFrame("Activity");
|
|
41871
41885
|
break;
|
|
41872
41886
|
}
|
|
41873
41887
|
var owner = workInProgress;
|
|
@@ -41881,7 +41895,7 @@ Error generating stack: ` + x.message + `
|
|
|
41881
41895
|
debugStack = formatOwnerStack(debugStack);
|
|
41882
41896
|
}
|
|
41883
41897
|
if (debugStack !== "") {
|
|
41884
|
-
|
|
41898
|
+
info2 += `
|
|
41885
41899
|
` + debugStack;
|
|
41886
41900
|
}
|
|
41887
41901
|
}
|
|
@@ -41889,14 +41903,14 @@ Error generating stack: ` + x.message + `
|
|
|
41889
41903
|
var ownerStack = owner.debugStack;
|
|
41890
41904
|
owner = owner.owner;
|
|
41891
41905
|
if (owner && ownerStack) {
|
|
41892
|
-
|
|
41906
|
+
info2 += `
|
|
41893
41907
|
` + formatOwnerStack(ownerStack);
|
|
41894
41908
|
}
|
|
41895
41909
|
} else {
|
|
41896
41910
|
break;
|
|
41897
41911
|
}
|
|
41898
41912
|
}
|
|
41899
|
-
return
|
|
41913
|
+
return info2;
|
|
41900
41914
|
} catch (x) {
|
|
41901
41915
|
return `
|
|
41902
41916
|
Error generating stack: ` + x.message + `
|
|
@@ -53039,957 +53053,277 @@ var init_build2 = __esm(async () => {
|
|
|
53039
53053
|
]);
|
|
53040
53054
|
});
|
|
53041
53055
|
|
|
53042
|
-
// ../../node_modules/.bun
|
|
53043
|
-
var
|
|
53044
|
-
|
|
53045
|
-
|
|
53046
|
-
|
|
53047
|
-
|
|
53048
|
-
|
|
53049
|
-
|
|
53050
|
-
|
|
53051
|
-
|
|
53052
|
-
|
|
53053
|
-
|
|
53054
|
-
|
|
53055
|
-
|
|
53056
|
-
|
|
53057
|
-
|
|
53058
|
-
|
|
53059
|
-
|
|
53060
|
-
|
|
53061
|
-
|
|
53062
|
-
|
|
53063
|
-
|
|
53064
|
-
|
|
53065
|
-
return
|
|
53066
|
-
|
|
53067
|
-
|
|
53068
|
-
|
|
53069
|
-
|
|
53070
|
-
|
|
53071
|
-
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53079
|
-
|
|
53080
|
-
|
|
53081
|
-
|
|
53082
|
-
|
|
53083
|
-
|
|
53084
|
-
|
|
53085
|
-
|
|
53086
|
-
|
|
53087
|
-
|
|
53056
|
+
// ../../node_modules/.bun/@xterm+headless@6.0.0/node_modules/@xterm/headless/lib-headless/xterm-headless.js
|
|
53057
|
+
var require_xterm_headless = __commonJS((exports) => {
|
|
53058
|
+
(() => {
|
|
53059
|
+
var e = { 5639: (e2, t2, s2) => {
|
|
53060
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.CircularList = undefined;
|
|
53061
|
+
const i2 = s2(7150), r2 = s2(802);
|
|
53062
|
+
|
|
53063
|
+
class n2 extends i2.Disposable {
|
|
53064
|
+
constructor(e3) {
|
|
53065
|
+
super(), this._maxLength = e3, this.onDeleteEmitter = this._register(new r2.Emitter), this.onDelete = this.onDeleteEmitter.event, this.onInsertEmitter = this._register(new r2.Emitter), this.onInsert = this.onInsertEmitter.event, this.onTrimEmitter = this._register(new r2.Emitter), this.onTrim = this.onTrimEmitter.event, this._array = new Array(this._maxLength), this._startIndex = 0, this._length = 0;
|
|
53066
|
+
}
|
|
53067
|
+
get maxLength() {
|
|
53068
|
+
return this._maxLength;
|
|
53069
|
+
}
|
|
53070
|
+
set maxLength(e3) {
|
|
53071
|
+
if (this._maxLength === e3)
|
|
53072
|
+
return;
|
|
53073
|
+
const t3 = new Array(e3);
|
|
53074
|
+
for (let s3 = 0;s3 < Math.min(e3, this.length); s3++)
|
|
53075
|
+
t3[s3] = this._array[this._getCyclicIndex(s3)];
|
|
53076
|
+
this._array = t3, this._maxLength = e3, this._startIndex = 0;
|
|
53077
|
+
}
|
|
53078
|
+
get length() {
|
|
53079
|
+
return this._length;
|
|
53080
|
+
}
|
|
53081
|
+
set length(e3) {
|
|
53082
|
+
if (e3 > this._length)
|
|
53083
|
+
for (let t3 = this._length;t3 < e3; t3++)
|
|
53084
|
+
this._array[t3] = undefined;
|
|
53085
|
+
this._length = e3;
|
|
53086
|
+
}
|
|
53087
|
+
get(e3) {
|
|
53088
|
+
return this._array[this._getCyclicIndex(e3)];
|
|
53089
|
+
}
|
|
53090
|
+
set(e3, t3) {
|
|
53091
|
+
this._array[this._getCyclicIndex(e3)] = t3;
|
|
53092
|
+
}
|
|
53093
|
+
push(e3) {
|
|
53094
|
+
this._array[this._getCyclicIndex(this._length)] = e3, this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1)) : this._length++;
|
|
53095
|
+
}
|
|
53096
|
+
recycle() {
|
|
53097
|
+
if (this._length !== this._maxLength)
|
|
53098
|
+
throw new Error("Can only recycle when the buffer is full");
|
|
53099
|
+
return this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1), this._array[this._getCyclicIndex(this._length - 1)];
|
|
53100
|
+
}
|
|
53101
|
+
get isFull() {
|
|
53102
|
+
return this._length === this._maxLength;
|
|
53103
|
+
}
|
|
53104
|
+
pop() {
|
|
53105
|
+
return this._array[this._getCyclicIndex(this._length-- - 1)];
|
|
53106
|
+
}
|
|
53107
|
+
splice(e3, t3, ...s3) {
|
|
53108
|
+
if (t3) {
|
|
53109
|
+
for (let s4 = e3;s4 < this._length - t3; s4++)
|
|
53110
|
+
this._array[this._getCyclicIndex(s4)] = this._array[this._getCyclicIndex(s4 + t3)];
|
|
53111
|
+
this._length -= t3, this.onDeleteEmitter.fire({ index: e3, amount: t3 });
|
|
53112
|
+
}
|
|
53113
|
+
for (let t4 = this._length - 1;t4 >= e3; t4--)
|
|
53114
|
+
this._array[this._getCyclicIndex(t4 + s3.length)] = this._array[this._getCyclicIndex(t4)];
|
|
53115
|
+
for (let t4 = 0;t4 < s3.length; t4++)
|
|
53116
|
+
this._array[this._getCyclicIndex(e3 + t4)] = s3[t4];
|
|
53117
|
+
if (s3.length && this.onInsertEmitter.fire({ index: e3, amount: s3.length }), this._length + s3.length > this._maxLength) {
|
|
53118
|
+
const e4 = this._length + s3.length - this._maxLength;
|
|
53119
|
+
this._startIndex += e4, this._length = this._maxLength, this.onTrimEmitter.fire(e4);
|
|
53120
|
+
} else
|
|
53121
|
+
this._length += s3.length;
|
|
53122
|
+
}
|
|
53123
|
+
trimStart(e3) {
|
|
53124
|
+
e3 > this._length && (e3 = this._length), this._startIndex += e3, this._length -= e3, this.onTrimEmitter.fire(e3);
|
|
53125
|
+
}
|
|
53126
|
+
shiftElements(e3, t3, s3) {
|
|
53127
|
+
if (!(t3 <= 0)) {
|
|
53128
|
+
if (e3 < 0 || e3 >= this._length)
|
|
53129
|
+
throw new Error("start argument out of range");
|
|
53130
|
+
if (e3 + s3 < 0)
|
|
53131
|
+
throw new Error("Cannot shift elements in list beyond index 0");
|
|
53132
|
+
if (s3 > 0) {
|
|
53133
|
+
for (let i4 = t3 - 1;i4 >= 0; i4--)
|
|
53134
|
+
this.set(e3 + i4 + s3, this.get(e3 + i4));
|
|
53135
|
+
const i3 = e3 + t3 + s3 - this._length;
|
|
53136
|
+
if (i3 > 0)
|
|
53137
|
+
for (this._length += i3;this._length > this._maxLength; )
|
|
53138
|
+
this._length--, this._startIndex++, this.onTrimEmitter.fire(1);
|
|
53139
|
+
} else
|
|
53140
|
+
for (let i3 = 0;i3 < t3; i3++)
|
|
53141
|
+
this.set(e3 + i3 + s3, this.get(e3 + i3));
|
|
53142
|
+
}
|
|
53143
|
+
}
|
|
53144
|
+
_getCyclicIndex(e3) {
|
|
53145
|
+
return (this._startIndex + e3) % this._maxLength;
|
|
53088
53146
|
}
|
|
53089
|
-
return null;
|
|
53090
|
-
}
|
|
53091
|
-
function testStringCoercion(value) {
|
|
53092
|
-
return "" + value;
|
|
53093
|
-
}
|
|
53094
|
-
function checkKeyStringCoercion(value) {
|
|
53095
|
-
try {
|
|
53096
|
-
testStringCoercion(value);
|
|
53097
|
-
var JSCompiler_inline_result = false;
|
|
53098
|
-
} catch (e) {
|
|
53099
|
-
JSCompiler_inline_result = true;
|
|
53100
|
-
}
|
|
53101
|
-
if (JSCompiler_inline_result) {
|
|
53102
|
-
JSCompiler_inline_result = console;
|
|
53103
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
53104
|
-
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
53105
|
-
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
53106
|
-
return testStringCoercion(value);
|
|
53107
|
-
}
|
|
53108
|
-
}
|
|
53109
|
-
function getTaskName(type) {
|
|
53110
|
-
if (type === REACT_FRAGMENT_TYPE)
|
|
53111
|
-
return "<>";
|
|
53112
|
-
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
53113
|
-
return "<...>";
|
|
53114
|
-
try {
|
|
53115
|
-
var name = getComponentNameFromType(type);
|
|
53116
|
-
return name ? "<" + name + ">" : "<...>";
|
|
53117
|
-
} catch (x) {
|
|
53118
|
-
return "<...>";
|
|
53119
|
-
}
|
|
53120
|
-
}
|
|
53121
|
-
function getOwner() {
|
|
53122
|
-
var dispatcher = ReactSharedInternals.A;
|
|
53123
|
-
return dispatcher === null ? null : dispatcher.getOwner();
|
|
53124
|
-
}
|
|
53125
|
-
function UnknownOwner() {
|
|
53126
|
-
return Error("react-stack-top-frame");
|
|
53127
|
-
}
|
|
53128
|
-
function hasValidKey(config2) {
|
|
53129
|
-
if (hasOwnProperty.call(config2, "key")) {
|
|
53130
|
-
var getter = Object.getOwnPropertyDescriptor(config2, "key").get;
|
|
53131
|
-
if (getter && getter.isReactWarning)
|
|
53132
|
-
return false;
|
|
53133
|
-
}
|
|
53134
|
-
return config2.key !== undefined;
|
|
53135
|
-
}
|
|
53136
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
53137
|
-
function warnAboutAccessingKey() {
|
|
53138
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
53139
53147
|
}
|
|
53140
|
-
|
|
53141
|
-
|
|
53142
|
-
|
|
53143
|
-
|
|
53144
|
-
|
|
53145
|
-
|
|
53146
|
-
|
|
53147
|
-
|
|
53148
|
-
|
|
53149
|
-
componentName = this.props.ref;
|
|
53150
|
-
return componentName !== undefined ? componentName : null;
|
|
53151
|
-
}
|
|
53152
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
53153
|
-
var refProp = props.ref;
|
|
53154
|
-
type = {
|
|
53155
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
53156
|
-
type,
|
|
53157
|
-
key,
|
|
53158
|
-
props,
|
|
53159
|
-
_owner: owner
|
|
53148
|
+
t2.CircularList = n2;
|
|
53149
|
+
}, 7453: (e2, t2) => {
|
|
53150
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.clone = function e3(t3, s2 = 5) {
|
|
53151
|
+
if (typeof t3 != "object")
|
|
53152
|
+
return t3;
|
|
53153
|
+
const i2 = Array.isArray(t3) ? [] : {};
|
|
53154
|
+
for (const r2 in t3)
|
|
53155
|
+
i2[r2] = s2 <= 1 ? t3[r2] : t3[r2] && e3(t3[r2], s2 - 1);
|
|
53156
|
+
return i2;
|
|
53160
53157
|
};
|
|
53161
|
-
|
|
53162
|
-
|
|
53163
|
-
|
|
53164
|
-
|
|
53165
|
-
|
|
53166
|
-
|
|
53167
|
-
|
|
53168
|
-
|
|
53169
|
-
|
|
53170
|
-
|
|
53171
|
-
|
|
53172
|
-
|
|
53173
|
-
|
|
53174
|
-
|
|
53175
|
-
|
|
53176
|
-
|
|
53177
|
-
|
|
53178
|
-
|
|
53179
|
-
|
|
53180
|
-
|
|
53181
|
-
|
|
53182
|
-
|
|
53183
|
-
|
|
53184
|
-
|
|
53185
|
-
|
|
53186
|
-
|
|
53187
|
-
|
|
53188
|
-
|
|
53189
|
-
|
|
53190
|
-
|
|
53191
|
-
|
|
53192
|
-
|
|
53193
|
-
|
|
53194
|
-
|
|
53195
|
-
|
|
53196
|
-
|
|
53197
|
-
|
|
53198
|
-
|
|
53199
|
-
|
|
53200
|
-
|
|
53201
|
-
|
|
53202
|
-
|
|
53203
|
-
|
|
53204
|
-
|
|
53205
|
-
|
|
53206
|
-
|
|
53207
|
-
|
|
53208
|
-
|
|
53209
|
-
|
|
53210
|
-
|
|
53211
|
-
|
|
53212
|
-
|
|
53213
|
-
|
|
53214
|
-
|
|
53215
|
-
|
|
53216
|
-
|
|
53158
|
+
}, 5777: (e2, t2, s2) => {
|
|
53159
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = undefined;
|
|
53160
|
+
const i2 = s2(6501), r2 = s2(6025), n2 = s2(7276), o = s2(9640), a = s2(56), h = s2(4071), c = s2(7792), l = s2(6415), u = s2(5746), d = s2(5882), f = s2(2486), _ = s2(3562), p = s2(8811), g = s2(802), v = s2(7150);
|
|
53161
|
+
let m = false;
|
|
53162
|
+
|
|
53163
|
+
class b extends v.Disposable {
|
|
53164
|
+
get onScroll() {
|
|
53165
|
+
return this._onScrollApi || (this._onScrollApi = this._register(new g.Emitter), this._onScroll.event((e3) => {
|
|
53166
|
+
this._onScrollApi?.fire(e3.position);
|
|
53167
|
+
})), this._onScrollApi.event;
|
|
53168
|
+
}
|
|
53169
|
+
get cols() {
|
|
53170
|
+
return this._bufferService.cols;
|
|
53171
|
+
}
|
|
53172
|
+
get rows() {
|
|
53173
|
+
return this._bufferService.rows;
|
|
53174
|
+
}
|
|
53175
|
+
get buffers() {
|
|
53176
|
+
return this._bufferService.buffers;
|
|
53177
|
+
}
|
|
53178
|
+
get options() {
|
|
53179
|
+
return this.optionsService.options;
|
|
53180
|
+
}
|
|
53181
|
+
set options(e3) {
|
|
53182
|
+
for (const t3 in e3)
|
|
53183
|
+
this.optionsService.options[t3] = e3[t3];
|
|
53184
|
+
}
|
|
53185
|
+
constructor(e3) {
|
|
53186
|
+
super(), this._windowsWrappingHeuristics = this._register(new v.MutableDisposable), this._onBinary = this._register(new g.Emitter), this.onBinary = this._onBinary.event, this._onData = this._register(new g.Emitter), this.onData = this._onData.event, this._onLineFeed = this._register(new g.Emitter), this.onLineFeed = this._onLineFeed.event, this._onResize = this._register(new g.Emitter), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new g.Emitter), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new g.Emitter), this._instantiationService = new r2.InstantiationService, this.optionsService = this._register(new a.OptionsService(e3)), this._instantiationService.setService(i2.IOptionsService, this.optionsService), this._bufferService = this._register(this._instantiationService.createInstance(o.BufferService)), this._instantiationService.setService(i2.IBufferService, this._bufferService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(i2.ILogService, this._logService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(i2.ICoreService, this.coreService), this.coreMouseService = this._register(this._instantiationService.createInstance(c.CoreMouseService)), this._instantiationService.setService(i2.ICoreMouseService, this.coreMouseService), this.unicodeService = this._register(this._instantiationService.createInstance(l.UnicodeService)), this._instantiationService.setService(i2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u.CharsetService), this._instantiationService.setService(i2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(p.OscLinkService), this._instantiationService.setService(i2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this._register(g.Event.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(this._inputHandler), this._register(g.Event.forward(this._bufferService.onResize, this._onResize)), this._register(g.Event.forward(this.coreService.onData, this._onData)), this._register(g.Event.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true))), this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this._register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], () => this._handleWindowsPtyOptionChange())), this._register(this._bufferService.onScroll(() => {
|
|
53187
|
+
this._onScroll.fire({ position: this._bufferService.buffer.ydisp }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
|
|
53188
|
+
})), this._writeBuffer = this._register(new _.WriteBuffer((e4, t3) => this._inputHandler.parse(e4, t3))), this._register(g.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
|
|
53189
|
+
}
|
|
53190
|
+
write(e3, t3) {
|
|
53191
|
+
this._writeBuffer.write(e3, t3);
|
|
53192
|
+
}
|
|
53193
|
+
writeSync(e3, t3) {
|
|
53194
|
+
this._logService.logLevel <= i2.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."), m = true), this._writeBuffer.writeSync(e3, t3);
|
|
53195
|
+
}
|
|
53196
|
+
input(e3, t3 = true) {
|
|
53197
|
+
this.coreService.triggerDataEvent(e3, t3);
|
|
53198
|
+
}
|
|
53199
|
+
resize(e3, t3) {
|
|
53200
|
+
isNaN(e3) || isNaN(t3) || (e3 = Math.max(e3, o.MINIMUM_COLS), t3 = Math.max(t3, o.MINIMUM_ROWS), this._bufferService.resize(e3, t3));
|
|
53201
|
+
}
|
|
53202
|
+
scroll(e3, t3 = false) {
|
|
53203
|
+
this._bufferService.scroll(e3, t3);
|
|
53204
|
+
}
|
|
53205
|
+
scrollLines(e3, t3) {
|
|
53206
|
+
this._bufferService.scrollLines(e3, t3);
|
|
53207
|
+
}
|
|
53208
|
+
scrollPages(e3) {
|
|
53209
|
+
this.scrollLines(e3 * (this.rows - 1));
|
|
53210
|
+
}
|
|
53211
|
+
scrollToTop() {
|
|
53212
|
+
this.scrollLines(-this._bufferService.buffer.ydisp);
|
|
53213
|
+
}
|
|
53214
|
+
scrollToBottom(e3) {
|
|
53215
|
+
this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
|
|
53216
|
+
}
|
|
53217
|
+
scrollToLine(e3) {
|
|
53218
|
+
const t3 = e3 - this._bufferService.buffer.ydisp;
|
|
53219
|
+
t3 !== 0 && this.scrollLines(t3);
|
|
53220
|
+
}
|
|
53221
|
+
registerEscHandler(e3, t3) {
|
|
53222
|
+
return this._inputHandler.registerEscHandler(e3, t3);
|
|
53223
|
+
}
|
|
53224
|
+
registerDcsHandler(e3, t3) {
|
|
53225
|
+
return this._inputHandler.registerDcsHandler(e3, t3);
|
|
53226
|
+
}
|
|
53227
|
+
registerCsiHandler(e3, t3) {
|
|
53228
|
+
return this._inputHandler.registerCsiHandler(e3, t3);
|
|
53229
|
+
}
|
|
53230
|
+
registerOscHandler(e3, t3) {
|
|
53231
|
+
return this._inputHandler.registerOscHandler(e3, t3);
|
|
53232
|
+
}
|
|
53233
|
+
_setup() {
|
|
53234
|
+
this._handleWindowsPtyOptionChange();
|
|
53235
|
+
}
|
|
53236
|
+
reset() {
|
|
53237
|
+
this._inputHandler.reset(), this._bufferService.reset(), this._charsetService.reset(), this.coreService.reset(), this.coreMouseService.reset();
|
|
53238
|
+
}
|
|
53239
|
+
_handleWindowsPtyOptionChange() {
|
|
53240
|
+
let e3 = false;
|
|
53241
|
+
const t3 = this.optionsService.rawOptions.windowsPty;
|
|
53242
|
+
t3 && t3.buildNumber !== undefined && t3.buildNumber !== undefined ? e3 = !!(t3.backend === "conpty" && t3.buildNumber < 21376) : this.optionsService.rawOptions.windowsMode && (e3 = true), e3 ? this._enableWindowsWrappingHeuristics() : this._windowsWrappingHeuristics.clear();
|
|
53243
|
+
}
|
|
53244
|
+
_enableWindowsWrappingHeuristics() {
|
|
53245
|
+
if (!this._windowsWrappingHeuristics.value) {
|
|
53246
|
+
const e3 = [];
|
|
53247
|
+
e3.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, () => ((0, d.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, v.toDisposable)(() => {
|
|
53248
|
+
for (const t3 of e3)
|
|
53249
|
+
t3.dispose();
|
|
53250
|
+
});
|
|
53251
|
+
}
|
|
53252
|
+
}
|
|
53217
53253
|
}
|
|
53218
|
-
|
|
53219
|
-
|
|
53220
|
-
|
|
53221
|
-
|
|
53222
|
-
|
|
53223
|
-
|
|
53224
|
-
|
|
53225
|
-
|
|
53226
|
-
|
|
53227
|
-
|
|
53228
|
-
|
|
53229
|
-
|
|
53230
|
-
|
|
53231
|
-
|
|
53232
|
-
|
|
53233
|
-
|
|
53234
|
-
|
|
53235
|
-
|
|
53236
|
-
|
|
53237
|
-
|
|
53238
|
-
|
|
53239
|
-
|
|
53240
|
-
|
|
53241
|
-
|
|
53254
|
+
t2.CoreTerminal = b;
|
|
53255
|
+
}, 2486: function(e2, t2, s2) {
|
|
53256
|
+
var i2 = this && this.__decorate || function(e3, t3, s3, i3) {
|
|
53257
|
+
var r3, n3 = arguments.length, o2 = n3 < 3 ? t3 : i3 === null ? i3 = Object.getOwnPropertyDescriptor(t3, s3) : i3;
|
|
53258
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
53259
|
+
o2 = Reflect.decorate(e3, t3, s3, i3);
|
|
53260
|
+
else
|
|
53261
|
+
for (var a2 = e3.length - 1;a2 >= 0; a2--)
|
|
53262
|
+
(r3 = e3[a2]) && (o2 = (n3 < 3 ? r3(o2) : n3 > 3 ? r3(t3, s3, o2) : r3(t3, s3)) || o2);
|
|
53263
|
+
return n3 > 3 && o2 && Object.defineProperty(t3, s3, o2), o2;
|
|
53264
|
+
}, r2 = this && this.__param || function(e3, t3) {
|
|
53265
|
+
return function(s3, i3) {
|
|
53266
|
+
t3(s3, i3, e3);
|
|
53267
|
+
};
|
|
53268
|
+
};
|
|
53269
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = undefined, t2.isValidColorIndex = k;
|
|
53270
|
+
const n2 = s2(3534), o = s2(6760), a = s2(6717), h = s2(7150), c = s2(726), l = s2(6107), u = s2(8938), d = s2(3055), f = s2(5451), _ = s2(6501), p = s2(6415), g = s2(1346), v = s2(9823), m = s2(8693), b = s2(802), S = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, y = 131072;
|
|
53271
|
+
function C(e3, t3) {
|
|
53272
|
+
if (e3 > 24)
|
|
53273
|
+
return t3.setWinLines || false;
|
|
53274
|
+
switch (e3) {
|
|
53275
|
+
case 1:
|
|
53276
|
+
return !!t3.restoreWin;
|
|
53277
|
+
case 2:
|
|
53278
|
+
return !!t3.minimizeWin;
|
|
53279
|
+
case 3:
|
|
53280
|
+
return !!t3.setWinPosition;
|
|
53281
|
+
case 4:
|
|
53282
|
+
return !!t3.setWinSizePixels;
|
|
53283
|
+
case 5:
|
|
53284
|
+
return !!t3.raiseWin;
|
|
53285
|
+
case 6:
|
|
53286
|
+
return !!t3.lowerWin;
|
|
53287
|
+
case 7:
|
|
53288
|
+
return !!t3.refreshWin;
|
|
53289
|
+
case 8:
|
|
53290
|
+
return !!t3.setWinSizeChars;
|
|
53291
|
+
case 9:
|
|
53292
|
+
return !!t3.maximizeWin;
|
|
53293
|
+
case 10:
|
|
53294
|
+
return !!t3.fullscreenWin;
|
|
53295
|
+
case 11:
|
|
53296
|
+
return !!t3.getWinState;
|
|
53297
|
+
case 13:
|
|
53298
|
+
return !!t3.getWinPosition;
|
|
53299
|
+
case 14:
|
|
53300
|
+
return !!t3.getWinSizePixels;
|
|
53301
|
+
case 15:
|
|
53302
|
+
return !!t3.getScreenSizePixels;
|
|
53303
|
+
case 16:
|
|
53304
|
+
return !!t3.getCellSizePixels;
|
|
53305
|
+
case 18:
|
|
53306
|
+
return !!t3.getWinSizeChars;
|
|
53307
|
+
case 19:
|
|
53308
|
+
return !!t3.getScreenSizeChars;
|
|
53309
|
+
case 20:
|
|
53310
|
+
return !!t3.getIconTitle;
|
|
53311
|
+
case 21:
|
|
53312
|
+
return !!t3.getWinTitle;
|
|
53313
|
+
case 22:
|
|
53314
|
+
return !!t3.pushTitle;
|
|
53315
|
+
case 23:
|
|
53316
|
+
return !!t3.popTitle;
|
|
53317
|
+
case 24:
|
|
53318
|
+
return !!t3.setWinLines;
|
|
53319
|
+
}
|
|
53320
|
+
return false;
|
|
53242
53321
|
}
|
|
53243
|
-
|
|
53244
|
-
|
|
53245
|
-
|
|
53246
|
-
|
|
53247
|
-
|
|
53248
|
-
var didWarnAboutKeySpread = {};
|
|
53249
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
53250
|
-
exports.jsxDEV = function(type, config2, maybeKey, isStaticChildren) {
|
|
53251
|
-
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
53252
|
-
return jsxDEVImpl(type, config2, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
53253
|
-
};
|
|
53254
|
-
})();
|
|
53255
|
-
});
|
|
53256
|
-
|
|
53257
|
-
// ../../node_modules/.bun/react@19.2.4/node_modules/react/jsx-dev-runtime.js
|
|
53258
|
-
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
53259
|
-
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
53260
|
-
if (false) {} else {
|
|
53261
|
-
module.exports = react_jsx_dev_runtime_development;
|
|
53262
|
-
}
|
|
53263
|
-
});
|
|
53264
|
-
|
|
53265
|
-
// src/tui/pane.tsx
|
|
53266
|
-
function Pane({ roomName, status, lines, focused, height }) {
|
|
53267
|
-
const visibleLines = lines.slice(-(height - 2));
|
|
53268
|
-
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
53269
|
-
flexDirection: "column",
|
|
53270
|
-
flexGrow: 1,
|
|
53271
|
-
borderStyle: focused ? "double" : "single",
|
|
53272
|
-
borderColor: focused ? "cyan" : "gray",
|
|
53273
|
-
height,
|
|
53274
|
-
children: [
|
|
53275
|
-
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
53276
|
-
children: [
|
|
53277
|
-
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
53278
|
-
bold: true,
|
|
53279
|
-
color: focused ? "cyan" : "white",
|
|
53280
|
-
children: [
|
|
53281
|
-
" ",
|
|
53282
|
-
roomName,
|
|
53283
|
-
" "
|
|
53284
|
-
]
|
|
53285
|
-
}, undefined, true, undefined, this),
|
|
53286
|
-
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
53287
|
-
dimColor: true,
|
|
53288
|
-
children: STATUS_ICONS[status]
|
|
53289
|
-
}, undefined, false, undefined, this)
|
|
53290
|
-
]
|
|
53291
|
-
}, undefined, true, undefined, this),
|
|
53292
|
-
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
53293
|
-
flexDirection: "column",
|
|
53294
|
-
flexGrow: 1,
|
|
53295
|
-
paddingX: 1,
|
|
53296
|
-
children: visibleLines.map((line, i) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
53297
|
-
wrap: "truncate",
|
|
53298
|
-
children: line
|
|
53299
|
-
}, i, false, undefined, this))
|
|
53300
|
-
}, undefined, false, undefined, this)
|
|
53301
|
-
]
|
|
53302
|
-
}, undefined, true, undefined, this);
|
|
53303
|
-
}
|
|
53304
|
-
var jsx_dev_runtime, STATUS_ICONS;
|
|
53305
|
-
var init_pane = __esm(async () => {
|
|
53306
|
-
await init_build2();
|
|
53307
|
-
jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
53308
|
-
STATUS_ICONS = {
|
|
53309
|
-
starting: "...",
|
|
53310
|
-
running: ">>>",
|
|
53311
|
-
exited: "[done]",
|
|
53312
|
-
error: "[err]"
|
|
53313
|
-
};
|
|
53314
|
-
});
|
|
53315
|
-
|
|
53316
|
-
// src/tui/dashboard.tsx
|
|
53317
|
-
function Dashboard({ teams, focusedIndex, height }) {
|
|
53318
|
-
if (teams.length === 0) {
|
|
53319
|
-
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
53320
|
-
flexGrow: 1,
|
|
53321
|
-
alignItems: "center",
|
|
53322
|
-
justifyContent: "center",
|
|
53323
|
-
children: [
|
|
53324
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
53325
|
-
dimColor: true,
|
|
53326
|
-
children: "No teams running. Press "
|
|
53327
|
-
}, undefined, false, undefined, this),
|
|
53328
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
53329
|
-
bold: true,
|
|
53330
|
-
color: "green",
|
|
53331
|
-
children: "n"
|
|
53332
|
-
}, undefined, false, undefined, this),
|
|
53333
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
53334
|
-
dimColor: true,
|
|
53335
|
-
children: " to spawn a new team."
|
|
53336
|
-
}, undefined, false, undefined, this)
|
|
53337
|
-
]
|
|
53338
|
-
}, undefined, true, undefined, this);
|
|
53339
|
-
}
|
|
53340
|
-
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
53341
|
-
flexGrow: 1,
|
|
53342
|
-
flexDirection: "row",
|
|
53343
|
-
children: teams.map((team, index) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Pane, {
|
|
53344
|
-
roomName: team.roomName,
|
|
53345
|
-
status: team.status,
|
|
53346
|
-
lines: team.lines,
|
|
53347
|
-
focused: index === focusedIndex,
|
|
53348
|
-
height
|
|
53349
|
-
}, team.roomId, false, undefined, this))
|
|
53350
|
-
}, undefined, false, undefined, this);
|
|
53351
|
-
}
|
|
53352
|
-
var jsx_dev_runtime2;
|
|
53353
|
-
var init_dashboard = __esm(async () => {
|
|
53354
|
-
await __promiseAll([
|
|
53355
|
-
init_build2(),
|
|
53356
|
-
init_pane()
|
|
53357
|
-
]);
|
|
53358
|
-
jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53359
|
-
});
|
|
53360
|
-
|
|
53361
|
-
// src/tui/status-bar.tsx
|
|
53362
|
-
function StatusBar({
|
|
53363
|
-
teamCount,
|
|
53364
|
-
focusedRoom,
|
|
53365
|
-
showingSpawnDialog
|
|
53366
|
-
}) {
|
|
53367
|
-
if (showingSpawnDialog) {
|
|
53368
|
-
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
53369
|
-
children: [
|
|
53370
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53371
|
-
dimColor: true,
|
|
53372
|
-
children: "Enter room name and prompt. Press "
|
|
53373
|
-
}, undefined, false, undefined, this),
|
|
53374
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53375
|
-
bold: true,
|
|
53376
|
-
children: "Escape"
|
|
53377
|
-
}, undefined, false, undefined, this),
|
|
53378
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53379
|
-
dimColor: true,
|
|
53380
|
-
children: " to cancel."
|
|
53381
|
-
}, undefined, false, undefined, this)
|
|
53382
|
-
]
|
|
53383
|
-
}, undefined, true, undefined, this);
|
|
53384
|
-
}
|
|
53385
|
-
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
53386
|
-
justifyContent: "space-between",
|
|
53387
|
-
children: [
|
|
53388
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
53389
|
-
gap: 2,
|
|
53390
|
-
children: [
|
|
53391
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53392
|
-
children: [
|
|
53393
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53394
|
-
dimColor: true,
|
|
53395
|
-
children: "["
|
|
53396
|
-
}, undefined, false, undefined, this),
|
|
53397
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53398
|
-
bold: true,
|
|
53399
|
-
color: "green",
|
|
53400
|
-
children: "n"
|
|
53401
|
-
}, undefined, false, undefined, this),
|
|
53402
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53403
|
-
dimColor: true,
|
|
53404
|
-
children: "]ew"
|
|
53405
|
-
}, undefined, false, undefined, this)
|
|
53406
|
-
]
|
|
53407
|
-
}, undefined, true, undefined, this),
|
|
53408
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53409
|
-
children: [
|
|
53410
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53411
|
-
dimColor: true,
|
|
53412
|
-
children: "["
|
|
53413
|
-
}, undefined, false, undefined, this),
|
|
53414
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53415
|
-
bold: true,
|
|
53416
|
-
color: "red",
|
|
53417
|
-
children: "k"
|
|
53418
|
-
}, undefined, false, undefined, this),
|
|
53419
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53420
|
-
dimColor: true,
|
|
53421
|
-
children: "]ill"
|
|
53422
|
-
}, undefined, false, undefined, this)
|
|
53423
|
-
]
|
|
53424
|
-
}, undefined, true, undefined, this),
|
|
53425
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53426
|
-
children: [
|
|
53427
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53428
|
-
dimColor: true,
|
|
53429
|
-
children: "["
|
|
53430
|
-
}, undefined, false, undefined, this),
|
|
53431
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53432
|
-
bold: true,
|
|
53433
|
-
children: "<->"
|
|
53434
|
-
}, undefined, false, undefined, this),
|
|
53435
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53436
|
-
dimColor: true,
|
|
53437
|
-
children: "]focus"
|
|
53438
|
-
}, undefined, false, undefined, this)
|
|
53439
|
-
]
|
|
53440
|
-
}, undefined, true, undefined, this),
|
|
53441
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53442
|
-
children: [
|
|
53443
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53444
|
-
dimColor: true,
|
|
53445
|
-
children: "["
|
|
53446
|
-
}, undefined, false, undefined, this),
|
|
53447
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53448
|
-
bold: true,
|
|
53449
|
-
color: "yellow",
|
|
53450
|
-
children: "q"
|
|
53451
|
-
}, undefined, false, undefined, this),
|
|
53452
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53453
|
-
dimColor: true,
|
|
53454
|
-
children: "]uit"
|
|
53455
|
-
}, undefined, false, undefined, this)
|
|
53456
|
-
]
|
|
53457
|
-
}, undefined, true, undefined, this)
|
|
53458
|
-
]
|
|
53459
|
-
}, undefined, true, undefined, this),
|
|
53460
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
53461
|
-
gap: 2,
|
|
53462
|
-
children: [
|
|
53463
|
-
focusedRoom && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53464
|
-
color: "cyan",
|
|
53465
|
-
children: focusedRoom
|
|
53466
|
-
}, undefined, false, undefined, this),
|
|
53467
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
53468
|
-
dimColor: true,
|
|
53469
|
-
children: [
|
|
53470
|
-
teamCount,
|
|
53471
|
-
" team",
|
|
53472
|
-
teamCount !== 1 ? "s" : ""
|
|
53473
|
-
]
|
|
53474
|
-
}, undefined, true, undefined, this)
|
|
53475
|
-
]
|
|
53476
|
-
}, undefined, true, undefined, this)
|
|
53477
|
-
]
|
|
53478
|
-
}, undefined, true, undefined, this);
|
|
53479
|
-
}
|
|
53480
|
-
var jsx_dev_runtime3;
|
|
53481
|
-
var init_status_bar = __esm(async () => {
|
|
53482
|
-
await init_build2();
|
|
53483
|
-
jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53484
|
-
});
|
|
53485
|
-
|
|
53486
|
-
// src/tui/spawn-dialog.tsx
|
|
53487
|
-
function SpawnDialog({ onSubmit, onCancel }) {
|
|
53488
|
-
const [roomName, setRoomName] = import_react29.useState("");
|
|
53489
|
-
const [cursor, setCursor] = import_react29.useState(0);
|
|
53490
|
-
use_input_default((input, key) => {
|
|
53491
|
-
if (key.escape) {
|
|
53492
|
-
onCancel();
|
|
53493
|
-
return;
|
|
53494
|
-
}
|
|
53495
|
-
if (key.return && roomName.trim()) {
|
|
53496
|
-
onSubmit(roomName.trim());
|
|
53497
|
-
return;
|
|
53498
|
-
}
|
|
53499
|
-
if (key.leftArrow) {
|
|
53500
|
-
setCursor((c) => Math.max(0, c - 1));
|
|
53501
|
-
return;
|
|
53502
|
-
}
|
|
53503
|
-
if (key.rightArrow) {
|
|
53504
|
-
setCursor((c) => Math.min(roomName.length, c + 1));
|
|
53505
|
-
return;
|
|
53506
|
-
}
|
|
53507
|
-
if (key.backspace || key.delete) {
|
|
53508
|
-
if (cursor > 0) {
|
|
53509
|
-
setRoomName((v) => v.slice(0, cursor - 1) + v.slice(cursor));
|
|
53510
|
-
setCursor((c) => c - 1);
|
|
53511
|
-
}
|
|
53512
|
-
return;
|
|
53513
|
-
}
|
|
53514
|
-
if (input && !key.ctrl && !key.meta && !key.upArrow && !key.downArrow) {
|
|
53515
|
-
setRoomName((v) => v.slice(0, cursor) + input + v.slice(cursor));
|
|
53516
|
-
setCursor((c) => c + input.length);
|
|
53517
|
-
}
|
|
53518
|
-
});
|
|
53519
|
-
const before = roomName.slice(0, cursor);
|
|
53520
|
-
const at = roomName[cursor] ?? " ";
|
|
53521
|
-
const after = roomName.slice(cursor + 1);
|
|
53522
|
-
return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
53523
|
-
flexDirection: "column",
|
|
53524
|
-
borderStyle: "round",
|
|
53525
|
-
borderColor: "green",
|
|
53526
|
-
paddingX: 1,
|
|
53527
|
-
children: [
|
|
53528
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
53529
|
-
bold: true,
|
|
53530
|
-
color: "green",
|
|
53531
|
-
children: "New Team"
|
|
53532
|
-
}, undefined, false, undefined, this),
|
|
53533
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
53534
|
-
children: [
|
|
53535
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
53536
|
-
children: "Room name: "
|
|
53537
|
-
}, undefined, false, undefined, this),
|
|
53538
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
53539
|
-
color: "cyan",
|
|
53540
|
-
children: before
|
|
53541
|
-
}, undefined, false, undefined, this),
|
|
53542
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
53543
|
-
backgroundColor: "cyan",
|
|
53544
|
-
color: "black",
|
|
53545
|
-
children: at
|
|
53546
|
-
}, undefined, false, undefined, this),
|
|
53547
|
-
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
53548
|
-
color: "cyan",
|
|
53549
|
-
children: after
|
|
53550
|
-
}, undefined, false, undefined, this)
|
|
53551
|
-
]
|
|
53552
|
-
}, undefined, true, undefined, this)
|
|
53553
|
-
]
|
|
53554
|
-
}, undefined, true, undefined, this);
|
|
53555
|
-
}
|
|
53556
|
-
var import_react29, jsx_dev_runtime4;
|
|
53557
|
-
var init_spawn_dialog = __esm(async () => {
|
|
53558
|
-
await init_build2();
|
|
53559
|
-
import_react29 = __toESM(require_react(), 1);
|
|
53560
|
-
jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53561
|
-
});
|
|
53562
|
-
|
|
53563
|
-
// src/lib/control-room.ts
|
|
53564
|
-
function parseControlMessage(raw) {
|
|
53565
|
-
try {
|
|
53566
|
-
const data = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
53567
|
-
if (!data?.type)
|
|
53568
|
-
return null;
|
|
53569
|
-
if (data.type === "spawn_request") {
|
|
53570
|
-
const result = SpawnRequestSchema.safeParse(data);
|
|
53571
|
-
return result.success ? result.data : null;
|
|
53572
|
-
}
|
|
53573
|
-
if (data.type === "kill_request") {
|
|
53574
|
-
const result = KillRequestSchema.safeParse(data);
|
|
53575
|
-
return result.success ? result.data : null;
|
|
53576
|
-
}
|
|
53577
|
-
return null;
|
|
53578
|
-
} catch {
|
|
53579
|
-
return null;
|
|
53580
|
-
}
|
|
53581
|
-
}
|
|
53582
|
-
var SpawnRequestSchema, KillRequestSchema;
|
|
53583
|
-
var init_control_room = __esm(() => {
|
|
53584
|
-
init_zod();
|
|
53585
|
-
SpawnRequestSchema = exports_external.object({
|
|
53586
|
-
type: exports_external.literal("spawn_request"),
|
|
53587
|
-
room_name: exports_external.string().min(1),
|
|
53588
|
-
prompt: exports_external.string().min(1),
|
|
53589
|
-
model: exports_external.string().optional()
|
|
53590
|
-
});
|
|
53591
|
-
KillRequestSchema = exports_external.object({
|
|
53592
|
-
type: exports_external.literal("kill_request"),
|
|
53593
|
-
room_id: exports_external.string().min(1)
|
|
53594
|
-
});
|
|
53595
|
-
});
|
|
53596
|
-
|
|
53597
|
-
// src/tui/app.tsx
|
|
53598
|
-
function App2({ processManager, client }) {
|
|
53599
|
-
const { exit } = use_app_default();
|
|
53600
|
-
const { stdout } = use_stdout_default();
|
|
53601
|
-
const [teams, setTeams] = import_react30.useState(processManager.list());
|
|
53602
|
-
const [focusedIndex, setFocusedIndex] = import_react30.useState(0);
|
|
53603
|
-
const [showSpawn, setShowSpawn] = import_react30.useState(false);
|
|
53604
|
-
const terminalHeight = stdout?.rows ?? 24;
|
|
53605
|
-
const dashboardHeight = terminalHeight - 2;
|
|
53606
|
-
const refreshTeams = import_react30.useCallback(() => {
|
|
53607
|
-
setTeams([...processManager.list()]);
|
|
53608
|
-
}, [processManager]);
|
|
53609
|
-
const handleSpawnForRoom = import_react30.useCallback((roomId, roomName) => {
|
|
53610
|
-
if (processManager.list().some((t) => t.roomId === roomId))
|
|
53611
|
-
return;
|
|
53612
|
-
processManager.spawn(roomId, roomName);
|
|
53613
|
-
refreshTeams();
|
|
53614
|
-
}, [processManager, refreshTeams]);
|
|
53615
|
-
const handleSpawn = import_react30.useCallback(async (roomName) => {
|
|
53616
|
-
try {
|
|
53617
|
-
const room = await client.createRoom(roomName);
|
|
53618
|
-
processManager.spawn(room.id, roomName);
|
|
53619
|
-
refreshTeams();
|
|
53620
|
-
} catch (error48) {
|
|
53621
|
-
const msg = error48 instanceof Error ? error48.message : String(error48);
|
|
53622
|
-
const errorId = `error-${Date.now()}`;
|
|
53623
|
-
processManager.addError(errorId, roomName, msg);
|
|
53624
|
-
refreshTeams();
|
|
53625
|
-
}
|
|
53626
|
-
}, [client, processManager, refreshTeams]);
|
|
53627
|
-
const handleKillById = import_react30.useCallback((roomId) => {
|
|
53628
|
-
processManager.kill(roomId);
|
|
53629
|
-
refreshTeams();
|
|
53630
|
-
}, [processManager, refreshTeams]);
|
|
53631
|
-
const handleSpawnForRoomRef = import_react30.useRef(handleSpawnForRoom);
|
|
53632
|
-
handleSpawnForRoomRef.current = handleSpawnForRoom;
|
|
53633
|
-
const handleKillByIdRef = import_react30.useRef(handleKillById);
|
|
53634
|
-
handleKillByIdRef.current = handleKillById;
|
|
53635
|
-
import_react30.useEffect(() => {
|
|
53636
|
-
const ws = client.listenLobby({
|
|
53637
|
-
onRoomCreated: async (roomId, _roomName) => {
|
|
53638
|
-
try {
|
|
53639
|
-
const messages = await client.getMessages(roomId);
|
|
53640
|
-
for (const msg of messages) {
|
|
53641
|
-
const cmd = parseControlMessage(msg.content);
|
|
53642
|
-
if (cmd?.type === "spawn_request") {
|
|
53643
|
-
handleSpawnForRoomRef.current(roomId, cmd.room_name);
|
|
53644
|
-
return;
|
|
53645
|
-
}
|
|
53646
|
-
}
|
|
53647
|
-
} catch {}
|
|
53648
|
-
}
|
|
53649
|
-
});
|
|
53650
|
-
return () => {
|
|
53651
|
-
ws.close();
|
|
53652
|
-
};
|
|
53653
|
-
}, [client]);
|
|
53654
|
-
import_react30.useEffect(() => {
|
|
53655
|
-
const interval = setInterval(refreshTeams, 200);
|
|
53656
|
-
return () => clearInterval(interval);
|
|
53657
|
-
}, [refreshTeams]);
|
|
53658
|
-
use_input_default((input, key) => {
|
|
53659
|
-
if (showSpawn)
|
|
53660
|
-
return;
|
|
53661
|
-
if (input === "q") {
|
|
53662
|
-
processManager.killAll();
|
|
53663
|
-
exit();
|
|
53664
|
-
return;
|
|
53665
|
-
}
|
|
53666
|
-
if (input === "n") {
|
|
53667
|
-
setShowSpawn(true);
|
|
53668
|
-
return;
|
|
53669
|
-
}
|
|
53670
|
-
if (input === "k" && teams.length > 0) {
|
|
53671
|
-
const team = teams[focusedIndex];
|
|
53672
|
-
if (team)
|
|
53673
|
-
handleKillById(team.roomId);
|
|
53674
|
-
if (focusedIndex >= teams.length - 1) {
|
|
53675
|
-
setFocusedIndex(Math.max(0, focusedIndex - 1));
|
|
53676
|
-
}
|
|
53677
|
-
return;
|
|
53678
|
-
}
|
|
53679
|
-
if (key.leftArrow) {
|
|
53680
|
-
setFocusedIndex((i) => Math.max(0, i - 1));
|
|
53681
|
-
}
|
|
53682
|
-
if (key.rightArrow) {
|
|
53683
|
-
setFocusedIndex((i) => Math.min(teams.length - 1, i + 1));
|
|
53684
|
-
}
|
|
53685
|
-
});
|
|
53686
|
-
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
53687
|
-
flexDirection: "column",
|
|
53688
|
-
height: terminalHeight,
|
|
53689
|
-
children: [
|
|
53690
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Dashboard, {
|
|
53691
|
-
teams,
|
|
53692
|
-
focusedIndex,
|
|
53693
|
-
height: dashboardHeight
|
|
53694
|
-
}, undefined, false, undefined, this),
|
|
53695
|
-
showSpawn ? /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(SpawnDialog, {
|
|
53696
|
-
onSubmit: (name) => {
|
|
53697
|
-
setShowSpawn(false);
|
|
53698
|
-
handleSpawn(name);
|
|
53699
|
-
},
|
|
53700
|
-
onCancel: () => setShowSpawn(false)
|
|
53701
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(StatusBar, {
|
|
53702
|
-
teamCount: teams.length,
|
|
53703
|
-
focusedRoom: teams[focusedIndex]?.roomName ?? null,
|
|
53704
|
-
showingSpawnDialog: false
|
|
53705
|
-
}, undefined, false, undefined, this)
|
|
53706
|
-
]
|
|
53707
|
-
}, undefined, true, undefined, this);
|
|
53708
|
-
}
|
|
53709
|
-
var import_react30, jsx_dev_runtime5;
|
|
53710
|
-
var init_app = __esm(async () => {
|
|
53711
|
-
init_control_room();
|
|
53712
|
-
await __promiseAll([
|
|
53713
|
-
init_build2(),
|
|
53714
|
-
init_dashboard(),
|
|
53715
|
-
init_status_bar(),
|
|
53716
|
-
init_spawn_dialog()
|
|
53717
|
-
]);
|
|
53718
|
-
import_react30 = __toESM(require_react(), 1);
|
|
53719
|
-
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53720
|
-
});
|
|
53721
|
-
|
|
53722
|
-
// ../../node_modules/.bun/@xterm+headless@6.0.0/node_modules/@xterm/headless/lib-headless/xterm-headless.js
|
|
53723
|
-
var require_xterm_headless = __commonJS((exports) => {
|
|
53724
|
-
(() => {
|
|
53725
|
-
var e = { 5639: (e2, t2, s2) => {
|
|
53726
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.CircularList = undefined;
|
|
53727
|
-
const i2 = s2(7150), r2 = s2(802);
|
|
53728
|
-
|
|
53729
|
-
class n2 extends i2.Disposable {
|
|
53730
|
-
constructor(e3) {
|
|
53731
|
-
super(), this._maxLength = e3, this.onDeleteEmitter = this._register(new r2.Emitter), this.onDelete = this.onDeleteEmitter.event, this.onInsertEmitter = this._register(new r2.Emitter), this.onInsert = this.onInsertEmitter.event, this.onTrimEmitter = this._register(new r2.Emitter), this.onTrim = this.onTrimEmitter.event, this._array = new Array(this._maxLength), this._startIndex = 0, this._length = 0;
|
|
53732
|
-
}
|
|
53733
|
-
get maxLength() {
|
|
53734
|
-
return this._maxLength;
|
|
53735
|
-
}
|
|
53736
|
-
set maxLength(e3) {
|
|
53737
|
-
if (this._maxLength === e3)
|
|
53738
|
-
return;
|
|
53739
|
-
const t3 = new Array(e3);
|
|
53740
|
-
for (let s3 = 0;s3 < Math.min(e3, this.length); s3++)
|
|
53741
|
-
t3[s3] = this._array[this._getCyclicIndex(s3)];
|
|
53742
|
-
this._array = t3, this._maxLength = e3, this._startIndex = 0;
|
|
53743
|
-
}
|
|
53744
|
-
get length() {
|
|
53745
|
-
return this._length;
|
|
53746
|
-
}
|
|
53747
|
-
set length(e3) {
|
|
53748
|
-
if (e3 > this._length)
|
|
53749
|
-
for (let t3 = this._length;t3 < e3; t3++)
|
|
53750
|
-
this._array[t3] = undefined;
|
|
53751
|
-
this._length = e3;
|
|
53752
|
-
}
|
|
53753
|
-
get(e3) {
|
|
53754
|
-
return this._array[this._getCyclicIndex(e3)];
|
|
53755
|
-
}
|
|
53756
|
-
set(e3, t3) {
|
|
53757
|
-
this._array[this._getCyclicIndex(e3)] = t3;
|
|
53758
|
-
}
|
|
53759
|
-
push(e3) {
|
|
53760
|
-
this._array[this._getCyclicIndex(this._length)] = e3, this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1)) : this._length++;
|
|
53761
|
-
}
|
|
53762
|
-
recycle() {
|
|
53763
|
-
if (this._length !== this._maxLength)
|
|
53764
|
-
throw new Error("Can only recycle when the buffer is full");
|
|
53765
|
-
return this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1), this._array[this._getCyclicIndex(this._length - 1)];
|
|
53766
|
-
}
|
|
53767
|
-
get isFull() {
|
|
53768
|
-
return this._length === this._maxLength;
|
|
53769
|
-
}
|
|
53770
|
-
pop() {
|
|
53771
|
-
return this._array[this._getCyclicIndex(this._length-- - 1)];
|
|
53772
|
-
}
|
|
53773
|
-
splice(e3, t3, ...s3) {
|
|
53774
|
-
if (t3) {
|
|
53775
|
-
for (let s4 = e3;s4 < this._length - t3; s4++)
|
|
53776
|
-
this._array[this._getCyclicIndex(s4)] = this._array[this._getCyclicIndex(s4 + t3)];
|
|
53777
|
-
this._length -= t3, this.onDeleteEmitter.fire({ index: e3, amount: t3 });
|
|
53778
|
-
}
|
|
53779
|
-
for (let t4 = this._length - 1;t4 >= e3; t4--)
|
|
53780
|
-
this._array[this._getCyclicIndex(t4 + s3.length)] = this._array[this._getCyclicIndex(t4)];
|
|
53781
|
-
for (let t4 = 0;t4 < s3.length; t4++)
|
|
53782
|
-
this._array[this._getCyclicIndex(e3 + t4)] = s3[t4];
|
|
53783
|
-
if (s3.length && this.onInsertEmitter.fire({ index: e3, amount: s3.length }), this._length + s3.length > this._maxLength) {
|
|
53784
|
-
const e4 = this._length + s3.length - this._maxLength;
|
|
53785
|
-
this._startIndex += e4, this._length = this._maxLength, this.onTrimEmitter.fire(e4);
|
|
53786
|
-
} else
|
|
53787
|
-
this._length += s3.length;
|
|
53788
|
-
}
|
|
53789
|
-
trimStart(e3) {
|
|
53790
|
-
e3 > this._length && (e3 = this._length), this._startIndex += e3, this._length -= e3, this.onTrimEmitter.fire(e3);
|
|
53791
|
-
}
|
|
53792
|
-
shiftElements(e3, t3, s3) {
|
|
53793
|
-
if (!(t3 <= 0)) {
|
|
53794
|
-
if (e3 < 0 || e3 >= this._length)
|
|
53795
|
-
throw new Error("start argument out of range");
|
|
53796
|
-
if (e3 + s3 < 0)
|
|
53797
|
-
throw new Error("Cannot shift elements in list beyond index 0");
|
|
53798
|
-
if (s3 > 0) {
|
|
53799
|
-
for (let i4 = t3 - 1;i4 >= 0; i4--)
|
|
53800
|
-
this.set(e3 + i4 + s3, this.get(e3 + i4));
|
|
53801
|
-
const i3 = e3 + t3 + s3 - this._length;
|
|
53802
|
-
if (i3 > 0)
|
|
53803
|
-
for (this._length += i3;this._length > this._maxLength; )
|
|
53804
|
-
this._length--, this._startIndex++, this.onTrimEmitter.fire(1);
|
|
53805
|
-
} else
|
|
53806
|
-
for (let i3 = 0;i3 < t3; i3++)
|
|
53807
|
-
this.set(e3 + i3 + s3, this.get(e3 + i3));
|
|
53808
|
-
}
|
|
53809
|
-
}
|
|
53810
|
-
_getCyclicIndex(e3) {
|
|
53811
|
-
return (this._startIndex + e3) % this._maxLength;
|
|
53812
|
-
}
|
|
53813
|
-
}
|
|
53814
|
-
t2.CircularList = n2;
|
|
53815
|
-
}, 7453: (e2, t2) => {
|
|
53816
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.clone = function e3(t3, s2 = 5) {
|
|
53817
|
-
if (typeof t3 != "object")
|
|
53818
|
-
return t3;
|
|
53819
|
-
const i2 = Array.isArray(t3) ? [] : {};
|
|
53820
|
-
for (const r2 in t3)
|
|
53821
|
-
i2[r2] = s2 <= 1 ? t3[r2] : t3[r2] && e3(t3[r2], s2 - 1);
|
|
53822
|
-
return i2;
|
|
53823
|
-
};
|
|
53824
|
-
}, 5777: (e2, t2, s2) => {
|
|
53825
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = undefined;
|
|
53826
|
-
const i2 = s2(6501), r2 = s2(6025), n2 = s2(7276), o = s2(9640), a = s2(56), h = s2(4071), c = s2(7792), l = s2(6415), u = s2(5746), d = s2(5882), f = s2(2486), _ = s2(3562), p = s2(8811), g = s2(802), v = s2(7150);
|
|
53827
|
-
let m = false;
|
|
53828
|
-
|
|
53829
|
-
class b extends v.Disposable {
|
|
53830
|
-
get onScroll() {
|
|
53831
|
-
return this._onScrollApi || (this._onScrollApi = this._register(new g.Emitter), this._onScroll.event((e3) => {
|
|
53832
|
-
this._onScrollApi?.fire(e3.position);
|
|
53833
|
-
})), this._onScrollApi.event;
|
|
53834
|
-
}
|
|
53835
|
-
get cols() {
|
|
53836
|
-
return this._bufferService.cols;
|
|
53837
|
-
}
|
|
53838
|
-
get rows() {
|
|
53839
|
-
return this._bufferService.rows;
|
|
53840
|
-
}
|
|
53841
|
-
get buffers() {
|
|
53842
|
-
return this._bufferService.buffers;
|
|
53843
|
-
}
|
|
53844
|
-
get options() {
|
|
53845
|
-
return this.optionsService.options;
|
|
53846
|
-
}
|
|
53847
|
-
set options(e3) {
|
|
53848
|
-
for (const t3 in e3)
|
|
53849
|
-
this.optionsService.options[t3] = e3[t3];
|
|
53850
|
-
}
|
|
53851
|
-
constructor(e3) {
|
|
53852
|
-
super(), this._windowsWrappingHeuristics = this._register(new v.MutableDisposable), this._onBinary = this._register(new g.Emitter), this.onBinary = this._onBinary.event, this._onData = this._register(new g.Emitter), this.onData = this._onData.event, this._onLineFeed = this._register(new g.Emitter), this.onLineFeed = this._onLineFeed.event, this._onResize = this._register(new g.Emitter), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new g.Emitter), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new g.Emitter), this._instantiationService = new r2.InstantiationService, this.optionsService = this._register(new a.OptionsService(e3)), this._instantiationService.setService(i2.IOptionsService, this.optionsService), this._bufferService = this._register(this._instantiationService.createInstance(o.BufferService)), this._instantiationService.setService(i2.IBufferService, this._bufferService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(i2.ILogService, this._logService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(i2.ICoreService, this.coreService), this.coreMouseService = this._register(this._instantiationService.createInstance(c.CoreMouseService)), this._instantiationService.setService(i2.ICoreMouseService, this.coreMouseService), this.unicodeService = this._register(this._instantiationService.createInstance(l.UnicodeService)), this._instantiationService.setService(i2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(u.CharsetService), this._instantiationService.setService(i2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(p.OscLinkService), this._instantiationService.setService(i2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this._register(g.Event.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(this._inputHandler), this._register(g.Event.forward(this._bufferService.onResize, this._onResize)), this._register(g.Event.forward(this.coreService.onData, this._onData)), this._register(g.Event.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true))), this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this._register(this.optionsService.onMultipleOptionChange(["windowsMode", "windowsPty"], () => this._handleWindowsPtyOptionChange())), this._register(this._bufferService.onScroll(() => {
|
|
53853
|
-
this._onScroll.fire({ position: this._bufferService.buffer.ydisp }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
|
|
53854
|
-
})), this._writeBuffer = this._register(new _.WriteBuffer((e4, t3) => this._inputHandler.parse(e4, t3))), this._register(g.Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
|
|
53855
|
-
}
|
|
53856
|
-
write(e3, t3) {
|
|
53857
|
-
this._writeBuffer.write(e3, t3);
|
|
53858
|
-
}
|
|
53859
|
-
writeSync(e3, t3) {
|
|
53860
|
-
this._logService.logLevel <= i2.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."), m = true), this._writeBuffer.writeSync(e3, t3);
|
|
53861
|
-
}
|
|
53862
|
-
input(e3, t3 = true) {
|
|
53863
|
-
this.coreService.triggerDataEvent(e3, t3);
|
|
53864
|
-
}
|
|
53865
|
-
resize(e3, t3) {
|
|
53866
|
-
isNaN(e3) || isNaN(t3) || (e3 = Math.max(e3, o.MINIMUM_COLS), t3 = Math.max(t3, o.MINIMUM_ROWS), this._bufferService.resize(e3, t3));
|
|
53867
|
-
}
|
|
53868
|
-
scroll(e3, t3 = false) {
|
|
53869
|
-
this._bufferService.scroll(e3, t3);
|
|
53870
|
-
}
|
|
53871
|
-
scrollLines(e3, t3) {
|
|
53872
|
-
this._bufferService.scrollLines(e3, t3);
|
|
53873
|
-
}
|
|
53874
|
-
scrollPages(e3) {
|
|
53875
|
-
this.scrollLines(e3 * (this.rows - 1));
|
|
53876
|
-
}
|
|
53877
|
-
scrollToTop() {
|
|
53878
|
-
this.scrollLines(-this._bufferService.buffer.ydisp);
|
|
53879
|
-
}
|
|
53880
|
-
scrollToBottom(e3) {
|
|
53881
|
-
this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
|
|
53882
|
-
}
|
|
53883
|
-
scrollToLine(e3) {
|
|
53884
|
-
const t3 = e3 - this._bufferService.buffer.ydisp;
|
|
53885
|
-
t3 !== 0 && this.scrollLines(t3);
|
|
53886
|
-
}
|
|
53887
|
-
registerEscHandler(e3, t3) {
|
|
53888
|
-
return this._inputHandler.registerEscHandler(e3, t3);
|
|
53889
|
-
}
|
|
53890
|
-
registerDcsHandler(e3, t3) {
|
|
53891
|
-
return this._inputHandler.registerDcsHandler(e3, t3);
|
|
53892
|
-
}
|
|
53893
|
-
registerCsiHandler(e3, t3) {
|
|
53894
|
-
return this._inputHandler.registerCsiHandler(e3, t3);
|
|
53895
|
-
}
|
|
53896
|
-
registerOscHandler(e3, t3) {
|
|
53897
|
-
return this._inputHandler.registerOscHandler(e3, t3);
|
|
53898
|
-
}
|
|
53899
|
-
_setup() {
|
|
53900
|
-
this._handleWindowsPtyOptionChange();
|
|
53901
|
-
}
|
|
53902
|
-
reset() {
|
|
53903
|
-
this._inputHandler.reset(), this._bufferService.reset(), this._charsetService.reset(), this.coreService.reset(), this.coreMouseService.reset();
|
|
53904
|
-
}
|
|
53905
|
-
_handleWindowsPtyOptionChange() {
|
|
53906
|
-
let e3 = false;
|
|
53907
|
-
const t3 = this.optionsService.rawOptions.windowsPty;
|
|
53908
|
-
t3 && t3.buildNumber !== undefined && t3.buildNumber !== undefined ? e3 = !!(t3.backend === "conpty" && t3.buildNumber < 21376) : this.optionsService.rawOptions.windowsMode && (e3 = true), e3 ? this._enableWindowsWrappingHeuristics() : this._windowsWrappingHeuristics.clear();
|
|
53909
|
-
}
|
|
53910
|
-
_enableWindowsWrappingHeuristics() {
|
|
53911
|
-
if (!this._windowsWrappingHeuristics.value) {
|
|
53912
|
-
const e3 = [];
|
|
53913
|
-
e3.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, () => ((0, d.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, v.toDisposable)(() => {
|
|
53914
|
-
for (const t3 of e3)
|
|
53915
|
-
t3.dispose();
|
|
53916
|
-
});
|
|
53917
|
-
}
|
|
53918
|
-
}
|
|
53919
|
-
}
|
|
53920
|
-
t2.CoreTerminal = b;
|
|
53921
|
-
}, 2486: function(e2, t2, s2) {
|
|
53922
|
-
var i2 = this && this.__decorate || function(e3, t3, s3, i3) {
|
|
53923
|
-
var r3, n3 = arguments.length, o2 = n3 < 3 ? t3 : i3 === null ? i3 = Object.getOwnPropertyDescriptor(t3, s3) : i3;
|
|
53924
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
53925
|
-
o2 = Reflect.decorate(e3, t3, s3, i3);
|
|
53926
|
-
else
|
|
53927
|
-
for (var a2 = e3.length - 1;a2 >= 0; a2--)
|
|
53928
|
-
(r3 = e3[a2]) && (o2 = (n3 < 3 ? r3(o2) : n3 > 3 ? r3(t3, s3, o2) : r3(t3, s3)) || o2);
|
|
53929
|
-
return n3 > 3 && o2 && Object.defineProperty(t3, s3, o2), o2;
|
|
53930
|
-
}, r2 = this && this.__param || function(e3, t3) {
|
|
53931
|
-
return function(s3, i3) {
|
|
53932
|
-
t3(s3, i3, e3);
|
|
53933
|
-
};
|
|
53934
|
-
};
|
|
53935
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = undefined, t2.isValidColorIndex = k;
|
|
53936
|
-
const n2 = s2(3534), o = s2(6760), a = s2(6717), h = s2(7150), c = s2(726), l = s2(6107), u = s2(8938), d = s2(3055), f = s2(5451), _ = s2(6501), p = s2(6415), g = s2(1346), v = s2(9823), m = s2(8693), b = s2(802), S = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, y = 131072;
|
|
53937
|
-
function C(e3, t3) {
|
|
53938
|
-
if (e3 > 24)
|
|
53939
|
-
return t3.setWinLines || false;
|
|
53940
|
-
switch (e3) {
|
|
53941
|
-
case 1:
|
|
53942
|
-
return !!t3.restoreWin;
|
|
53943
|
-
case 2:
|
|
53944
|
-
return !!t3.minimizeWin;
|
|
53945
|
-
case 3:
|
|
53946
|
-
return !!t3.setWinPosition;
|
|
53947
|
-
case 4:
|
|
53948
|
-
return !!t3.setWinSizePixels;
|
|
53949
|
-
case 5:
|
|
53950
|
-
return !!t3.raiseWin;
|
|
53951
|
-
case 6:
|
|
53952
|
-
return !!t3.lowerWin;
|
|
53953
|
-
case 7:
|
|
53954
|
-
return !!t3.refreshWin;
|
|
53955
|
-
case 8:
|
|
53956
|
-
return !!t3.setWinSizeChars;
|
|
53957
|
-
case 9:
|
|
53958
|
-
return !!t3.maximizeWin;
|
|
53959
|
-
case 10:
|
|
53960
|
-
return !!t3.fullscreenWin;
|
|
53961
|
-
case 11:
|
|
53962
|
-
return !!t3.getWinState;
|
|
53963
|
-
case 13:
|
|
53964
|
-
return !!t3.getWinPosition;
|
|
53965
|
-
case 14:
|
|
53966
|
-
return !!t3.getWinSizePixels;
|
|
53967
|
-
case 15:
|
|
53968
|
-
return !!t3.getScreenSizePixels;
|
|
53969
|
-
case 16:
|
|
53970
|
-
return !!t3.getCellSizePixels;
|
|
53971
|
-
case 18:
|
|
53972
|
-
return !!t3.getWinSizeChars;
|
|
53973
|
-
case 19:
|
|
53974
|
-
return !!t3.getScreenSizeChars;
|
|
53975
|
-
case 20:
|
|
53976
|
-
return !!t3.getIconTitle;
|
|
53977
|
-
case 21:
|
|
53978
|
-
return !!t3.getWinTitle;
|
|
53979
|
-
case 22:
|
|
53980
|
-
return !!t3.pushTitle;
|
|
53981
|
-
case 23:
|
|
53982
|
-
return !!t3.popTitle;
|
|
53983
|
-
case 24:
|
|
53984
|
-
return !!t3.setWinLines;
|
|
53985
|
-
}
|
|
53986
|
-
return false;
|
|
53987
|
-
}
|
|
53988
|
-
var w;
|
|
53989
|
-
(function(e3) {
|
|
53990
|
-
e3[e3.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e3[e3.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
|
|
53991
|
-
})(w || (t2.WindowsOptionsReportType = w = {}));
|
|
53992
|
-
let E = 0;
|
|
53322
|
+
var w;
|
|
53323
|
+
(function(e3) {
|
|
53324
|
+
e3[e3.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e3[e3.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
|
|
53325
|
+
})(w || (t2.WindowsOptionsReportType = w = {}));
|
|
53326
|
+
let E = 0;
|
|
53993
53327
|
|
|
53994
53328
|
class A extends h.Disposable {
|
|
53995
53329
|
getAttrData() {
|
|
@@ -59366,229 +58700,871 @@ function rowToAnsi(row, cell) {
|
|
|
59366
58700
|
return out;
|
|
59367
58701
|
}
|
|
59368
58702
|
|
|
59369
|
-
class ProcessManager {
|
|
59370
|
-
teams = new Map;
|
|
59371
|
-
terminals = new Map;
|
|
59372
|
-
opts;
|
|
59373
|
-
constructor(opts) {
|
|
59374
|
-
this.opts = opts;
|
|
58703
|
+
class ProcessManager {
|
|
58704
|
+
teams = new Map;
|
|
58705
|
+
terminals = new Map;
|
|
58706
|
+
opts;
|
|
58707
|
+
constructor(opts) {
|
|
58708
|
+
this.opts = opts;
|
|
58709
|
+
}
|
|
58710
|
+
syncLines(team) {
|
|
58711
|
+
const term = this.terminals.get(team.roomId);
|
|
58712
|
+
if (!term)
|
|
58713
|
+
return;
|
|
58714
|
+
const buf = term.buffer.active;
|
|
58715
|
+
const lines = [];
|
|
58716
|
+
const cell = buf.getNullCell();
|
|
58717
|
+
for (let i = 0;i < buf.length; i++) {
|
|
58718
|
+
const row = buf.getLine(i);
|
|
58719
|
+
if (row) {
|
|
58720
|
+
lines.push(rowToAnsi(row, cell));
|
|
58721
|
+
}
|
|
58722
|
+
}
|
|
58723
|
+
while (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
58724
|
+
lines.pop();
|
|
58725
|
+
}
|
|
58726
|
+
team.lines = lines;
|
|
58727
|
+
}
|
|
58728
|
+
spawned = 0;
|
|
58729
|
+
spawn(roomId, roomName) {
|
|
58730
|
+
const team = {
|
|
58731
|
+
roomId,
|
|
58732
|
+
roomName,
|
|
58733
|
+
pid: null,
|
|
58734
|
+
process: null,
|
|
58735
|
+
status: "starting",
|
|
58736
|
+
exitCode: null,
|
|
58737
|
+
lines: []
|
|
58738
|
+
};
|
|
58739
|
+
this.teams.set(roomId, team);
|
|
58740
|
+
if (this.opts.dryRun)
|
|
58741
|
+
return team;
|
|
58742
|
+
const term = new import_headless.Terminal({
|
|
58743
|
+
cols: TERM_COLS,
|
|
58744
|
+
rows: TERM_ROWS,
|
|
58745
|
+
scrollback: 100,
|
|
58746
|
+
allowProposedApi: true
|
|
58747
|
+
});
|
|
58748
|
+
this.terminals.set(roomId, term);
|
|
58749
|
+
const fullPrompt = [
|
|
58750
|
+
`ROOM_ID: ${roomId}`,
|
|
58751
|
+
``,
|
|
58752
|
+
`You are a team lead. IMMEDIATELY:`,
|
|
58753
|
+
`1. Create a team of agents to work on the task`,
|
|
58754
|
+
`2. Connect to the meet-ai room using the /meet-ai skill`
|
|
58755
|
+
].join(`
|
|
58756
|
+
`);
|
|
58757
|
+
const claudeArgs = [
|
|
58758
|
+
"--dangerously-skip-permissions",
|
|
58759
|
+
"--model",
|
|
58760
|
+
this.opts.model ?? "opus",
|
|
58761
|
+
fullPrompt
|
|
58762
|
+
];
|
|
58763
|
+
const { CLAUDECODE: _, ...envWithoutClaude } = process.env;
|
|
58764
|
+
const childEnv = {
|
|
58765
|
+
...envWithoutClaude,
|
|
58766
|
+
...this.opts.env,
|
|
58767
|
+
DISABLE_AUTOUPDATER: "1"
|
|
58768
|
+
};
|
|
58769
|
+
const spawnCmd = "/usr/bin/script";
|
|
58770
|
+
const spawnArgs = ["-q", "/dev/null", this.opts.claudePath, ...claudeArgs];
|
|
58771
|
+
if (this.opts.debug) {
|
|
58772
|
+
team.lines.push(`[debug] CMD: ${this.opts.claudePath} ${claudeArgs.join(" ").slice(0, 200)}`);
|
|
58773
|
+
team.lines.push(`[debug] ENV: ${Object.keys(this.opts.env ?? {}).join(", ") || "(none)"}`);
|
|
58774
|
+
}
|
|
58775
|
+
this.spawned++;
|
|
58776
|
+
const child = spawn(spawnCmd, spawnArgs, {
|
|
58777
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
58778
|
+
env: childEnv,
|
|
58779
|
+
detached: false
|
|
58780
|
+
});
|
|
58781
|
+
team.process = child;
|
|
58782
|
+
team.pid = child.pid ?? null;
|
|
58783
|
+
team.status = "running";
|
|
58784
|
+
this.opts.onStatusChange?.(roomId, "running");
|
|
58785
|
+
child.stdout?.on("data", (chunk) => {
|
|
58786
|
+
term.write(chunk.toString());
|
|
58787
|
+
this.syncLines(team);
|
|
58788
|
+
if (team.status === "starting") {
|
|
58789
|
+
team.status = "running";
|
|
58790
|
+
this.opts.onStatusChange?.(roomId, "running");
|
|
58791
|
+
}
|
|
58792
|
+
});
|
|
58793
|
+
child.stderr?.on("data", (chunk) => {
|
|
58794
|
+
const text = chunk.toString().trim();
|
|
58795
|
+
if (text) {
|
|
58796
|
+
team.lines.push(`[stderr] ${text}`);
|
|
58797
|
+
}
|
|
58798
|
+
});
|
|
58799
|
+
child.on("exit", (code, signal) => {
|
|
58800
|
+
this.syncLines(team);
|
|
58801
|
+
if (this.opts.debug) {
|
|
58802
|
+
team.lines.push(`[debug] exit code=${code} signal=${signal}`);
|
|
58803
|
+
}
|
|
58804
|
+
team.exitCode = code;
|
|
58805
|
+
team.status = code === 0 || code === null ? "exited" : "error";
|
|
58806
|
+
team.process = null;
|
|
58807
|
+
term.dispose();
|
|
58808
|
+
this.terminals.delete(roomId);
|
|
58809
|
+
this.opts.onStatusChange?.(roomId, team.status, code);
|
|
58810
|
+
});
|
|
58811
|
+
child.on("error", (err2) => {
|
|
58812
|
+
team.status = "error";
|
|
58813
|
+
team.lines.push(`[error] ${err2.message}`);
|
|
58814
|
+
team.process = null;
|
|
58815
|
+
term.dispose();
|
|
58816
|
+
this.terminals.delete(roomId);
|
|
58817
|
+
this.opts.onStatusChange?.(roomId, "error");
|
|
58818
|
+
});
|
|
58819
|
+
return team;
|
|
58820
|
+
}
|
|
58821
|
+
addError(roomId, roomName, message) {
|
|
58822
|
+
this.teams.set(roomId, {
|
|
58823
|
+
roomId,
|
|
58824
|
+
roomName,
|
|
58825
|
+
pid: null,
|
|
58826
|
+
process: null,
|
|
58827
|
+
status: "error",
|
|
58828
|
+
exitCode: null,
|
|
58829
|
+
lines: [`[error] ${message}`]
|
|
58830
|
+
});
|
|
58831
|
+
}
|
|
58832
|
+
get(roomId) {
|
|
58833
|
+
return this.teams.get(roomId);
|
|
58834
|
+
}
|
|
58835
|
+
list() {
|
|
58836
|
+
return [...this.teams.values()];
|
|
58837
|
+
}
|
|
58838
|
+
kill(roomId) {
|
|
58839
|
+
const team = this.teams.get(roomId);
|
|
58840
|
+
if (team?.process) {
|
|
58841
|
+
team.process.kill("SIGTERM");
|
|
58842
|
+
const proc = team.process;
|
|
58843
|
+
setTimeout(() => {
|
|
58844
|
+
try {
|
|
58845
|
+
proc.kill("SIGKILL");
|
|
58846
|
+
} catch {}
|
|
58847
|
+
}, 3000);
|
|
58848
|
+
}
|
|
58849
|
+
const term = this.terminals.get(roomId);
|
|
58850
|
+
if (term) {
|
|
58851
|
+
term.dispose();
|
|
58852
|
+
this.terminals.delete(roomId);
|
|
58853
|
+
}
|
|
58854
|
+
this.teams.delete(roomId);
|
|
58855
|
+
}
|
|
58856
|
+
killAll() {
|
|
58857
|
+
for (const roomId of this.teams.keys()) {
|
|
58858
|
+
this.kill(roomId);
|
|
58859
|
+
}
|
|
58860
|
+
}
|
|
58861
|
+
}
|
|
58862
|
+
var import_headless, TERM_COLS = 120, TERM_ROWS = 120, ESC2 = "\x1B[", RESET;
|
|
58863
|
+
var init_process_manager = __esm(() => {
|
|
58864
|
+
import_headless = __toESM(require_xterm_headless(), 1);
|
|
58865
|
+
RESET = `${ESC2}0m`;
|
|
58866
|
+
});
|
|
58867
|
+
|
|
58868
|
+
// src/spawner.ts
|
|
58869
|
+
import { execSync } from "node:child_process";
|
|
58870
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
58871
|
+
import { homedir as homedir2, platform as platform2 } from "node:os";
|
|
58872
|
+
import { join as join2 } from "node:path";
|
|
58873
|
+
function findClaudeCli() {
|
|
58874
|
+
try {
|
|
58875
|
+
const command = platform2() === "win32" ? "where claude" : "which claude";
|
|
58876
|
+
const result = execSync(command, { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
|
|
58877
|
+
const claudePath = result.split(`
|
|
58878
|
+
`)[0].trim();
|
|
58879
|
+
if (claudePath && existsSync3(claudePath)) {
|
|
58880
|
+
return claudePath;
|
|
58881
|
+
}
|
|
58882
|
+
} catch {}
|
|
58883
|
+
const envPath = process.env.MEET_AI_CLAUDE_PATH;
|
|
58884
|
+
if (envPath && existsSync3(envPath)) {
|
|
58885
|
+
return envPath;
|
|
58886
|
+
}
|
|
58887
|
+
const home = homedir2();
|
|
58888
|
+
const commonPaths = [
|
|
58889
|
+
join2(home, ".bun", "bin", "claude"),
|
|
58890
|
+
"/opt/homebrew/bin/claude",
|
|
58891
|
+
"/usr/local/bin/claude",
|
|
58892
|
+
join2(home, ".local", "bin", "claude")
|
|
58893
|
+
];
|
|
58894
|
+
for (const path of commonPaths) {
|
|
58895
|
+
if (existsSync3(path)) {
|
|
58896
|
+
return path;
|
|
58897
|
+
}
|
|
58898
|
+
}
|
|
58899
|
+
throw new Error(`
|
|
58900
|
+
Claude Code is not installed
|
|
58901
|
+
|
|
58902
|
+
Please install Claude Code:
|
|
58903
|
+
bun add -g @anthropic-ai/claude-code
|
|
58904
|
+
|
|
58905
|
+
Or set MEET_AI_CLAUDE_PATH to the Claude Code CLI path.
|
|
58906
|
+
`.trim());
|
|
58907
|
+
}
|
|
58908
|
+
var init_spawner = () => {};
|
|
58909
|
+
|
|
58910
|
+
// ../../node_modules/.bun/react@19.2.4/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
58911
|
+
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
58912
|
+
var React11 = __toESM(require_react());
|
|
58913
|
+
(function() {
|
|
58914
|
+
function getComponentNameFromType(type) {
|
|
58915
|
+
if (type == null)
|
|
58916
|
+
return null;
|
|
58917
|
+
if (typeof type === "function")
|
|
58918
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
58919
|
+
if (typeof type === "string")
|
|
58920
|
+
return type;
|
|
58921
|
+
switch (type) {
|
|
58922
|
+
case REACT_FRAGMENT_TYPE:
|
|
58923
|
+
return "Fragment";
|
|
58924
|
+
case REACT_PROFILER_TYPE:
|
|
58925
|
+
return "Profiler";
|
|
58926
|
+
case REACT_STRICT_MODE_TYPE:
|
|
58927
|
+
return "StrictMode";
|
|
58928
|
+
case REACT_SUSPENSE_TYPE:
|
|
58929
|
+
return "Suspense";
|
|
58930
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
58931
|
+
return "SuspenseList";
|
|
58932
|
+
case REACT_ACTIVITY_TYPE:
|
|
58933
|
+
return "Activity";
|
|
58934
|
+
}
|
|
58935
|
+
if (typeof type === "object")
|
|
58936
|
+
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
58937
|
+
case REACT_PORTAL_TYPE:
|
|
58938
|
+
return "Portal";
|
|
58939
|
+
case REACT_CONTEXT_TYPE:
|
|
58940
|
+
return type.displayName || "Context";
|
|
58941
|
+
case REACT_CONSUMER_TYPE:
|
|
58942
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
58943
|
+
case REACT_FORWARD_REF_TYPE:
|
|
58944
|
+
var innerType = type.render;
|
|
58945
|
+
type = type.displayName;
|
|
58946
|
+
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
58947
|
+
return type;
|
|
58948
|
+
case REACT_MEMO_TYPE:
|
|
58949
|
+
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
58950
|
+
case REACT_LAZY_TYPE:
|
|
58951
|
+
innerType = type._payload;
|
|
58952
|
+
type = type._init;
|
|
58953
|
+
try {
|
|
58954
|
+
return getComponentNameFromType(type(innerType));
|
|
58955
|
+
} catch (x) {}
|
|
58956
|
+
}
|
|
58957
|
+
return null;
|
|
58958
|
+
}
|
|
58959
|
+
function testStringCoercion(value) {
|
|
58960
|
+
return "" + value;
|
|
58961
|
+
}
|
|
58962
|
+
function checkKeyStringCoercion(value) {
|
|
58963
|
+
try {
|
|
58964
|
+
testStringCoercion(value);
|
|
58965
|
+
var JSCompiler_inline_result = false;
|
|
58966
|
+
} catch (e) {
|
|
58967
|
+
JSCompiler_inline_result = true;
|
|
58968
|
+
}
|
|
58969
|
+
if (JSCompiler_inline_result) {
|
|
58970
|
+
JSCompiler_inline_result = console;
|
|
58971
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
58972
|
+
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
58973
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
58974
|
+
return testStringCoercion(value);
|
|
58975
|
+
}
|
|
58976
|
+
}
|
|
58977
|
+
function getTaskName(type) {
|
|
58978
|
+
if (type === REACT_FRAGMENT_TYPE)
|
|
58979
|
+
return "<>";
|
|
58980
|
+
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
58981
|
+
return "<...>";
|
|
58982
|
+
try {
|
|
58983
|
+
var name = getComponentNameFromType(type);
|
|
58984
|
+
return name ? "<" + name + ">" : "<...>";
|
|
58985
|
+
} catch (x) {
|
|
58986
|
+
return "<...>";
|
|
58987
|
+
}
|
|
58988
|
+
}
|
|
58989
|
+
function getOwner() {
|
|
58990
|
+
var dispatcher = ReactSharedInternals.A;
|
|
58991
|
+
return dispatcher === null ? null : dispatcher.getOwner();
|
|
58992
|
+
}
|
|
58993
|
+
function UnknownOwner() {
|
|
58994
|
+
return Error("react-stack-top-frame");
|
|
58995
|
+
}
|
|
58996
|
+
function hasValidKey(config2) {
|
|
58997
|
+
if (hasOwnProperty.call(config2, "key")) {
|
|
58998
|
+
var getter = Object.getOwnPropertyDescriptor(config2, "key").get;
|
|
58999
|
+
if (getter && getter.isReactWarning)
|
|
59000
|
+
return false;
|
|
59001
|
+
}
|
|
59002
|
+
return config2.key !== undefined;
|
|
59003
|
+
}
|
|
59004
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
59005
|
+
function warnAboutAccessingKey() {
|
|
59006
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
59007
|
+
}
|
|
59008
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
59009
|
+
Object.defineProperty(props, "key", {
|
|
59010
|
+
get: warnAboutAccessingKey,
|
|
59011
|
+
configurable: true
|
|
59012
|
+
});
|
|
59013
|
+
}
|
|
59014
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
59015
|
+
var componentName = getComponentNameFromType(this.type);
|
|
59016
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
59017
|
+
componentName = this.props.ref;
|
|
59018
|
+
return componentName !== undefined ? componentName : null;
|
|
59019
|
+
}
|
|
59020
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
59021
|
+
var refProp = props.ref;
|
|
59022
|
+
type = {
|
|
59023
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
59024
|
+
type,
|
|
59025
|
+
key,
|
|
59026
|
+
props,
|
|
59027
|
+
_owner: owner
|
|
59028
|
+
};
|
|
59029
|
+
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
59030
|
+
enumerable: false,
|
|
59031
|
+
get: elementRefGetterWithDeprecationWarning
|
|
59032
|
+
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
59033
|
+
type._store = {};
|
|
59034
|
+
Object.defineProperty(type._store, "validated", {
|
|
59035
|
+
configurable: false,
|
|
59036
|
+
enumerable: false,
|
|
59037
|
+
writable: true,
|
|
59038
|
+
value: 0
|
|
59039
|
+
});
|
|
59040
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
59041
|
+
configurable: false,
|
|
59042
|
+
enumerable: false,
|
|
59043
|
+
writable: true,
|
|
59044
|
+
value: null
|
|
59045
|
+
});
|
|
59046
|
+
Object.defineProperty(type, "_debugStack", {
|
|
59047
|
+
configurable: false,
|
|
59048
|
+
enumerable: false,
|
|
59049
|
+
writable: true,
|
|
59050
|
+
value: debugStack
|
|
59051
|
+
});
|
|
59052
|
+
Object.defineProperty(type, "_debugTask", {
|
|
59053
|
+
configurable: false,
|
|
59054
|
+
enumerable: false,
|
|
59055
|
+
writable: true,
|
|
59056
|
+
value: debugTask
|
|
59057
|
+
});
|
|
59058
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
59059
|
+
return type;
|
|
59060
|
+
}
|
|
59061
|
+
function jsxDEVImpl(type, config2, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
59062
|
+
var children = config2.children;
|
|
59063
|
+
if (children !== undefined)
|
|
59064
|
+
if (isStaticChildren)
|
|
59065
|
+
if (isArrayImpl(children)) {
|
|
59066
|
+
for (isStaticChildren = 0;isStaticChildren < children.length; isStaticChildren++)
|
|
59067
|
+
validateChildKeys(children[isStaticChildren]);
|
|
59068
|
+
Object.freeze && Object.freeze(children);
|
|
59069
|
+
} else
|
|
59070
|
+
console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
59071
|
+
else
|
|
59072
|
+
validateChildKeys(children);
|
|
59073
|
+
if (hasOwnProperty.call(config2, "key")) {
|
|
59074
|
+
children = getComponentNameFromType(type);
|
|
59075
|
+
var keys = Object.keys(config2).filter(function(k) {
|
|
59076
|
+
return k !== "key";
|
|
59077
|
+
});
|
|
59078
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
59079
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
59080
|
+
let props = %s;
|
|
59081
|
+
<%s {...props} />
|
|
59082
|
+
React keys must be passed directly to JSX without using spread:
|
|
59083
|
+
let props = %s;
|
|
59084
|
+
<%s key={someKey} {...props} />`, isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
59085
|
+
}
|
|
59086
|
+
children = null;
|
|
59087
|
+
maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
59088
|
+
hasValidKey(config2) && (checkKeyStringCoercion(config2.key), children = "" + config2.key);
|
|
59089
|
+
if ("key" in config2) {
|
|
59090
|
+
maybeKey = {};
|
|
59091
|
+
for (var propName in config2)
|
|
59092
|
+
propName !== "key" && (maybeKey[propName] = config2[propName]);
|
|
59093
|
+
} else
|
|
59094
|
+
maybeKey = config2;
|
|
59095
|
+
children && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
59096
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
59097
|
+
}
|
|
59098
|
+
function validateChildKeys(node) {
|
|
59099
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
59100
|
+
}
|
|
59101
|
+
function isValidElement(object2) {
|
|
59102
|
+
return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
|
|
59103
|
+
}
|
|
59104
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
59105
|
+
return null;
|
|
59106
|
+
};
|
|
59107
|
+
React11 = {
|
|
59108
|
+
react_stack_bottom_frame: function(callStackForError) {
|
|
59109
|
+
return callStackForError();
|
|
59110
|
+
}
|
|
59111
|
+
};
|
|
59112
|
+
var specialPropKeyWarningShown;
|
|
59113
|
+
var didWarnAboutElementRef = {};
|
|
59114
|
+
var unknownOwnerDebugStack = React11.react_stack_bottom_frame.bind(React11, UnknownOwner)();
|
|
59115
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
59116
|
+
var didWarnAboutKeySpread = {};
|
|
59117
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
59118
|
+
exports.jsxDEV = function(type, config2, maybeKey, isStaticChildren) {
|
|
59119
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
59120
|
+
return jsxDEVImpl(type, config2, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
59121
|
+
};
|
|
59122
|
+
})();
|
|
59123
|
+
});
|
|
59124
|
+
|
|
59125
|
+
// ../../node_modules/.bun/react@19.2.4/node_modules/react/jsx-dev-runtime.js
|
|
59126
|
+
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
59127
|
+
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
59128
|
+
if (false) {} else {
|
|
59129
|
+
module.exports = react_jsx_dev_runtime_development;
|
|
59130
|
+
}
|
|
59131
|
+
});
|
|
59132
|
+
|
|
59133
|
+
// src/tui/pane.tsx
|
|
59134
|
+
function Pane({ roomName, status, lines, focused, height }) {
|
|
59135
|
+
const visibleLines = lines.slice(-(height - 2));
|
|
59136
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
59137
|
+
flexDirection: "column",
|
|
59138
|
+
flexGrow: 1,
|
|
59139
|
+
borderStyle: focused ? "double" : "single",
|
|
59140
|
+
borderColor: focused ? "cyan" : "gray",
|
|
59141
|
+
height,
|
|
59142
|
+
children: [
|
|
59143
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
59144
|
+
children: [
|
|
59145
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
59146
|
+
bold: true,
|
|
59147
|
+
color: focused ? "cyan" : "white",
|
|
59148
|
+
children: [
|
|
59149
|
+
" ",
|
|
59150
|
+
roomName,
|
|
59151
|
+
" "
|
|
59152
|
+
]
|
|
59153
|
+
}, undefined, true, undefined, this),
|
|
59154
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
59155
|
+
dimColor: true,
|
|
59156
|
+
children: STATUS_ICONS[status]
|
|
59157
|
+
}, undefined, false, undefined, this)
|
|
59158
|
+
]
|
|
59159
|
+
}, undefined, true, undefined, this),
|
|
59160
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
59161
|
+
flexDirection: "column",
|
|
59162
|
+
flexGrow: 1,
|
|
59163
|
+
paddingX: 1,
|
|
59164
|
+
children: visibleLines.map((line, i) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
59165
|
+
wrap: "truncate",
|
|
59166
|
+
children: line
|
|
59167
|
+
}, i, false, undefined, this))
|
|
59168
|
+
}, undefined, false, undefined, this)
|
|
59169
|
+
]
|
|
59170
|
+
}, undefined, true, undefined, this);
|
|
59171
|
+
}
|
|
59172
|
+
var jsx_dev_runtime, STATUS_ICONS;
|
|
59173
|
+
var init_pane = __esm(async () => {
|
|
59174
|
+
await init_build2();
|
|
59175
|
+
jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
59176
|
+
STATUS_ICONS = {
|
|
59177
|
+
starting: "...",
|
|
59178
|
+
running: ">>>",
|
|
59179
|
+
exited: "[done]",
|
|
59180
|
+
error: "[err]"
|
|
59181
|
+
};
|
|
59182
|
+
});
|
|
59183
|
+
|
|
59184
|
+
// src/tui/dashboard.tsx
|
|
59185
|
+
function Dashboard({ teams, focusedIndex, height }) {
|
|
59186
|
+
if (teams.length === 0) {
|
|
59187
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
59188
|
+
flexGrow: 1,
|
|
59189
|
+
alignItems: "center",
|
|
59190
|
+
justifyContent: "center",
|
|
59191
|
+
children: [
|
|
59192
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59193
|
+
dimColor: true,
|
|
59194
|
+
children: "No teams running. Press "
|
|
59195
|
+
}, undefined, false, undefined, this),
|
|
59196
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59197
|
+
bold: true,
|
|
59198
|
+
color: "green",
|
|
59199
|
+
children: "n"
|
|
59200
|
+
}, undefined, false, undefined, this),
|
|
59201
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59202
|
+
dimColor: true,
|
|
59203
|
+
children: " to spawn a new team."
|
|
59204
|
+
}, undefined, false, undefined, this)
|
|
59205
|
+
]
|
|
59206
|
+
}, undefined, true, undefined, this);
|
|
59375
59207
|
}
|
|
59376
|
-
|
|
59377
|
-
|
|
59378
|
-
|
|
59208
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
59209
|
+
flexGrow: 1,
|
|
59210
|
+
flexDirection: "row",
|
|
59211
|
+
children: teams.map((team, index) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Pane, {
|
|
59212
|
+
roomName: team.roomName,
|
|
59213
|
+
status: team.status,
|
|
59214
|
+
lines: team.lines,
|
|
59215
|
+
focused: index === focusedIndex,
|
|
59216
|
+
height
|
|
59217
|
+
}, team.roomId, false, undefined, this))
|
|
59218
|
+
}, undefined, false, undefined, this);
|
|
59219
|
+
}
|
|
59220
|
+
var jsx_dev_runtime2;
|
|
59221
|
+
var init_dashboard = __esm(async () => {
|
|
59222
|
+
await __promiseAll([
|
|
59223
|
+
init_build2(),
|
|
59224
|
+
init_pane()
|
|
59225
|
+
]);
|
|
59226
|
+
jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59227
|
+
});
|
|
59228
|
+
|
|
59229
|
+
// src/tui/spawn-dialog.tsx
|
|
59230
|
+
function SpawnDialog({ onSubmit, onCancel }) {
|
|
59231
|
+
const [roomName, setRoomName] = import_react29.useState("");
|
|
59232
|
+
const [cursor, setCursor] = import_react29.useState(0);
|
|
59233
|
+
use_input_default((input, key) => {
|
|
59234
|
+
if (key.escape) {
|
|
59235
|
+
onCancel();
|
|
59379
59236
|
return;
|
|
59380
|
-
const buf = term.buffer.active;
|
|
59381
|
-
const lines = [];
|
|
59382
|
-
const cell = buf.getNullCell();
|
|
59383
|
-
for (let i = 0;i < buf.length; i++) {
|
|
59384
|
-
const row = buf.getLine(i);
|
|
59385
|
-
if (row) {
|
|
59386
|
-
lines.push(rowToAnsi(row, cell));
|
|
59387
|
-
}
|
|
59388
59237
|
}
|
|
59389
|
-
|
|
59390
|
-
|
|
59238
|
+
if (key.return && roomName.trim()) {
|
|
59239
|
+
onSubmit(roomName.trim());
|
|
59240
|
+
return;
|
|
59391
59241
|
}
|
|
59392
|
-
|
|
59393
|
-
|
|
59394
|
-
|
|
59395
|
-
const team = {
|
|
59396
|
-
roomId,
|
|
59397
|
-
roomName,
|
|
59398
|
-
pid: null,
|
|
59399
|
-
process: null,
|
|
59400
|
-
status: "starting",
|
|
59401
|
-
exitCode: null,
|
|
59402
|
-
lines: []
|
|
59403
|
-
};
|
|
59404
|
-
this.teams.set(roomId, team);
|
|
59405
|
-
if (this.opts.dryRun)
|
|
59406
|
-
return team;
|
|
59407
|
-
const term = new import_headless.Terminal({
|
|
59408
|
-
cols: TERM_COLS,
|
|
59409
|
-
rows: TERM_ROWS,
|
|
59410
|
-
scrollback: 500,
|
|
59411
|
-
allowProposedApi: true
|
|
59412
|
-
});
|
|
59413
|
-
this.terminals.set(roomId, term);
|
|
59414
|
-
const fullPrompt = [
|
|
59415
|
-
`MEET_AI_ROOM_ID: ${roomId}`,
|
|
59416
|
-
`MEET_AI_AGENT_NAME: team-lead`,
|
|
59417
|
-
``,
|
|
59418
|
-
`You are a team lead. IMMEDIATELY:`,
|
|
59419
|
-
`1. Create a team of agents to work on the task`,
|
|
59420
|
-
`2. Connect to the meet-ai room using the /meet-ai skill`,
|
|
59421
|
-
`3. Delegate work to your teammates`,
|
|
59422
|
-
``,
|
|
59423
|
-
`Do NOT wait — start the team right away, then use the room for communication.`,
|
|
59424
|
-
``,
|
|
59425
|
-
`Start listening for human messages in the background:`,
|
|
59426
|
-
` meet-ai listen "${roomId}" --sender-type human --team "${roomName}" --inbox team-lead`
|
|
59427
|
-
].join(`
|
|
59428
|
-
`);
|
|
59429
|
-
const claudeArgs = [
|
|
59430
|
-
"--dangerously-skip-permissions",
|
|
59431
|
-
"--model",
|
|
59432
|
-
this.opts.model ?? "opus",
|
|
59433
|
-
fullPrompt
|
|
59434
|
-
];
|
|
59435
|
-
const { CLAUDECODE: _, ...envWithoutClaude } = process.env;
|
|
59436
|
-
const childEnv = {
|
|
59437
|
-
...envWithoutClaude,
|
|
59438
|
-
...this.opts.env,
|
|
59439
|
-
DISABLE_AUTOUPDATER: "1"
|
|
59440
|
-
};
|
|
59441
|
-
const spawnCmd = "/usr/bin/script";
|
|
59442
|
-
const spawnArgs = [
|
|
59443
|
-
"-q",
|
|
59444
|
-
"/dev/null",
|
|
59445
|
-
this.opts.claudePath,
|
|
59446
|
-
...claudeArgs
|
|
59447
|
-
];
|
|
59448
|
-
if (this.opts.debug) {
|
|
59449
|
-
team.lines.push(`[debug] CMD: ${this.opts.claudePath} ${claudeArgs.join(" ").slice(0, 200)}`);
|
|
59450
|
-
team.lines.push(`[debug] ENV: ${Object.keys(this.opts.env ?? {}).join(", ") || "(none)"}`);
|
|
59242
|
+
if (key.leftArrow) {
|
|
59243
|
+
setCursor((c) => Math.max(0, c - 1));
|
|
59244
|
+
return;
|
|
59451
59245
|
}
|
|
59452
|
-
|
|
59453
|
-
|
|
59454
|
-
|
|
59455
|
-
detached: false
|
|
59456
|
-
});
|
|
59457
|
-
team.process = child;
|
|
59458
|
-
team.pid = child.pid ?? null;
|
|
59459
|
-
team.status = "running";
|
|
59460
|
-
this.opts.onStatusChange?.(roomId, "running");
|
|
59461
|
-
child.stdout?.on("data", (chunk) => {
|
|
59462
|
-
term.write(chunk.toString());
|
|
59463
|
-
this.syncLines(team);
|
|
59464
|
-
if (team.status === "starting") {
|
|
59465
|
-
team.status = "running";
|
|
59466
|
-
this.opts.onStatusChange?.(roomId, "running");
|
|
59467
|
-
}
|
|
59468
|
-
});
|
|
59469
|
-
child.stderr?.on("data", (chunk) => {
|
|
59470
|
-
const text = chunk.toString().trim();
|
|
59471
|
-
if (text) {
|
|
59472
|
-
team.lines.push(`[stderr] ${text}`);
|
|
59473
|
-
}
|
|
59474
|
-
});
|
|
59475
|
-
child.on("exit", (code, signal) => {
|
|
59476
|
-
this.syncLines(team);
|
|
59477
|
-
if (this.opts.debug) {
|
|
59478
|
-
team.lines.push(`[debug] exit code=${code} signal=${signal}`);
|
|
59479
|
-
}
|
|
59480
|
-
team.exitCode = code;
|
|
59481
|
-
team.status = code === 0 || code === null ? "exited" : "error";
|
|
59482
|
-
team.process = null;
|
|
59483
|
-
term.dispose();
|
|
59484
|
-
this.terminals.delete(roomId);
|
|
59485
|
-
this.opts.onStatusChange?.(roomId, team.status, code);
|
|
59486
|
-
});
|
|
59487
|
-
child.on("error", (err2) => {
|
|
59488
|
-
team.status = "error";
|
|
59489
|
-
team.lines.push(`[error] ${err2.message}`);
|
|
59490
|
-
team.process = null;
|
|
59491
|
-
term.dispose();
|
|
59492
|
-
this.terminals.delete(roomId);
|
|
59493
|
-
this.opts.onStatusChange?.(roomId, "error");
|
|
59494
|
-
});
|
|
59495
|
-
return team;
|
|
59496
|
-
}
|
|
59497
|
-
addError(roomId, roomName, message) {
|
|
59498
|
-
this.teams.set(roomId, {
|
|
59499
|
-
roomId,
|
|
59500
|
-
roomName,
|
|
59501
|
-
pid: null,
|
|
59502
|
-
process: null,
|
|
59503
|
-
status: "error",
|
|
59504
|
-
exitCode: null,
|
|
59505
|
-
lines: [`[error] ${message}`]
|
|
59506
|
-
});
|
|
59507
|
-
}
|
|
59508
|
-
get(roomId) {
|
|
59509
|
-
return this.teams.get(roomId);
|
|
59510
|
-
}
|
|
59511
|
-
list() {
|
|
59512
|
-
return [...this.teams.values()];
|
|
59513
|
-
}
|
|
59514
|
-
kill(roomId) {
|
|
59515
|
-
const team = this.teams.get(roomId);
|
|
59516
|
-
if (team?.process) {
|
|
59517
|
-
team.process.kill("SIGTERM");
|
|
59518
|
-
const proc = team.process;
|
|
59519
|
-
setTimeout(() => {
|
|
59520
|
-
try {
|
|
59521
|
-
proc.kill("SIGKILL");
|
|
59522
|
-
} catch {}
|
|
59523
|
-
}, 3000);
|
|
59246
|
+
if (key.rightArrow) {
|
|
59247
|
+
setCursor((c) => Math.min(roomName.length, c + 1));
|
|
59248
|
+
return;
|
|
59524
59249
|
}
|
|
59525
|
-
|
|
59526
|
-
|
|
59527
|
-
|
|
59528
|
-
|
|
59250
|
+
if (key.backspace || key.delete) {
|
|
59251
|
+
if (cursor > 0) {
|
|
59252
|
+
setRoomName((v) => v.slice(0, cursor - 1) + v.slice(cursor));
|
|
59253
|
+
setCursor((c) => c - 1);
|
|
59254
|
+
}
|
|
59255
|
+
return;
|
|
59529
59256
|
}
|
|
59530
|
-
|
|
59531
|
-
|
|
59532
|
-
|
|
59533
|
-
for (const roomId of this.teams.keys()) {
|
|
59534
|
-
this.kill(roomId);
|
|
59257
|
+
if (input && !key.ctrl && !key.meta && !key.upArrow && !key.downArrow) {
|
|
59258
|
+
setRoomName((v) => v.slice(0, cursor) + input + v.slice(cursor));
|
|
59259
|
+
setCursor((c) => c + input.length);
|
|
59535
59260
|
}
|
|
59261
|
+
});
|
|
59262
|
+
const before = roomName.slice(0, cursor);
|
|
59263
|
+
const at = roomName[cursor] ?? " ";
|
|
59264
|
+
const after = roomName.slice(cursor + 1);
|
|
59265
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
59266
|
+
flexDirection: "column",
|
|
59267
|
+
borderStyle: "round",
|
|
59268
|
+
borderColor: "green",
|
|
59269
|
+
paddingX: 1,
|
|
59270
|
+
children: [
|
|
59271
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
59272
|
+
bold: true,
|
|
59273
|
+
color: "green",
|
|
59274
|
+
children: "New Team"
|
|
59275
|
+
}, undefined, false, undefined, this),
|
|
59276
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
59277
|
+
children: [
|
|
59278
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
59279
|
+
children: "Room name: "
|
|
59280
|
+
}, undefined, false, undefined, this),
|
|
59281
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
59282
|
+
color: "cyan",
|
|
59283
|
+
children: before
|
|
59284
|
+
}, undefined, false, undefined, this),
|
|
59285
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
59286
|
+
backgroundColor: "cyan",
|
|
59287
|
+
color: "black",
|
|
59288
|
+
children: at
|
|
59289
|
+
}, undefined, false, undefined, this),
|
|
59290
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
59291
|
+
color: "cyan",
|
|
59292
|
+
children: after
|
|
59293
|
+
}, undefined, false, undefined, this)
|
|
59294
|
+
]
|
|
59295
|
+
}, undefined, true, undefined, this)
|
|
59296
|
+
]
|
|
59297
|
+
}, undefined, true, undefined, this);
|
|
59298
|
+
}
|
|
59299
|
+
var import_react29, jsx_dev_runtime3;
|
|
59300
|
+
var init_spawn_dialog = __esm(async () => {
|
|
59301
|
+
await init_build2();
|
|
59302
|
+
import_react29 = __toESM(require_react(), 1);
|
|
59303
|
+
jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59304
|
+
});
|
|
59305
|
+
|
|
59306
|
+
// src/tui/status-bar.tsx
|
|
59307
|
+
function StatusBar({
|
|
59308
|
+
teamCount,
|
|
59309
|
+
focusedRoom,
|
|
59310
|
+
showingSpawnDialog
|
|
59311
|
+
}) {
|
|
59312
|
+
if (showingSpawnDialog) {
|
|
59313
|
+
return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
59314
|
+
children: [
|
|
59315
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59316
|
+
dimColor: true,
|
|
59317
|
+
children: "Enter room name and prompt. Press "
|
|
59318
|
+
}, undefined, false, undefined, this),
|
|
59319
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59320
|
+
bold: true,
|
|
59321
|
+
children: "Escape"
|
|
59322
|
+
}, undefined, false, undefined, this),
|
|
59323
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59324
|
+
dimColor: true,
|
|
59325
|
+
children: " to cancel."
|
|
59326
|
+
}, undefined, false, undefined, this)
|
|
59327
|
+
]
|
|
59328
|
+
}, undefined, true, undefined, this);
|
|
59536
59329
|
}
|
|
59330
|
+
return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
59331
|
+
justifyContent: "space-between",
|
|
59332
|
+
children: [
|
|
59333
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
59334
|
+
gap: 2,
|
|
59335
|
+
children: [
|
|
59336
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59337
|
+
children: [
|
|
59338
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59339
|
+
dimColor: true,
|
|
59340
|
+
children: "["
|
|
59341
|
+
}, undefined, false, undefined, this),
|
|
59342
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59343
|
+
bold: true,
|
|
59344
|
+
color: "green",
|
|
59345
|
+
children: "n"
|
|
59346
|
+
}, undefined, false, undefined, this),
|
|
59347
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59348
|
+
dimColor: true,
|
|
59349
|
+
children: "]ew"
|
|
59350
|
+
}, undefined, false, undefined, this)
|
|
59351
|
+
]
|
|
59352
|
+
}, undefined, true, undefined, this),
|
|
59353
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59354
|
+
children: [
|
|
59355
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59356
|
+
dimColor: true,
|
|
59357
|
+
children: "["
|
|
59358
|
+
}, undefined, false, undefined, this),
|
|
59359
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59360
|
+
bold: true,
|
|
59361
|
+
color: "red",
|
|
59362
|
+
children: "k"
|
|
59363
|
+
}, undefined, false, undefined, this),
|
|
59364
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59365
|
+
dimColor: true,
|
|
59366
|
+
children: "]ill"
|
|
59367
|
+
}, undefined, false, undefined, this)
|
|
59368
|
+
]
|
|
59369
|
+
}, undefined, true, undefined, this),
|
|
59370
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59371
|
+
children: [
|
|
59372
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59373
|
+
dimColor: true,
|
|
59374
|
+
children: "["
|
|
59375
|
+
}, undefined, false, undefined, this),
|
|
59376
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59377
|
+
bold: true,
|
|
59378
|
+
children: "<->"
|
|
59379
|
+
}, undefined, false, undefined, this),
|
|
59380
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59381
|
+
dimColor: true,
|
|
59382
|
+
children: "]focus"
|
|
59383
|
+
}, undefined, false, undefined, this)
|
|
59384
|
+
]
|
|
59385
|
+
}, undefined, true, undefined, this),
|
|
59386
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59387
|
+
children: [
|
|
59388
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59389
|
+
dimColor: true,
|
|
59390
|
+
children: "["
|
|
59391
|
+
}, undefined, false, undefined, this),
|
|
59392
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59393
|
+
bold: true,
|
|
59394
|
+
color: "yellow",
|
|
59395
|
+
children: "q"
|
|
59396
|
+
}, undefined, false, undefined, this),
|
|
59397
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59398
|
+
dimColor: true,
|
|
59399
|
+
children: "]uit"
|
|
59400
|
+
}, undefined, false, undefined, this)
|
|
59401
|
+
]
|
|
59402
|
+
}, undefined, true, undefined, this)
|
|
59403
|
+
]
|
|
59404
|
+
}, undefined, true, undefined, this),
|
|
59405
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
59406
|
+
gap: 2,
|
|
59407
|
+
children: [
|
|
59408
|
+
focusedRoom && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59409
|
+
color: "cyan",
|
|
59410
|
+
children: focusedRoom
|
|
59411
|
+
}, undefined, false, undefined, this),
|
|
59412
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
59413
|
+
dimColor: true,
|
|
59414
|
+
children: [
|
|
59415
|
+
teamCount,
|
|
59416
|
+
" team",
|
|
59417
|
+
teamCount !== 1 ? "s" : ""
|
|
59418
|
+
]
|
|
59419
|
+
}, undefined, true, undefined, this)
|
|
59420
|
+
]
|
|
59421
|
+
}, undefined, true, undefined, this)
|
|
59422
|
+
]
|
|
59423
|
+
}, undefined, true, undefined, this);
|
|
59537
59424
|
}
|
|
59538
|
-
var
|
|
59539
|
-
var
|
|
59540
|
-
|
|
59541
|
-
|
|
59425
|
+
var jsx_dev_runtime4;
|
|
59426
|
+
var init_status_bar = __esm(async () => {
|
|
59427
|
+
await init_build2();
|
|
59428
|
+
jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59542
59429
|
});
|
|
59543
59430
|
|
|
59544
|
-
// src/
|
|
59545
|
-
|
|
59546
|
-
|
|
59547
|
-
|
|
59548
|
-
|
|
59549
|
-
|
|
59550
|
-
|
|
59551
|
-
|
|
59552
|
-
|
|
59553
|
-
|
|
59554
|
-
|
|
59555
|
-
|
|
59556
|
-
|
|
59431
|
+
// src/tui/app.tsx
|
|
59432
|
+
function AppInner({ processManager, client }) {
|
|
59433
|
+
const { exit } = use_app_default();
|
|
59434
|
+
const { stdout } = use_stdout_default();
|
|
59435
|
+
const [teams, setTeams] = import_react30.useState(processManager.list());
|
|
59436
|
+
const [focusedIndex, setFocusedIndex] = import_react30.useState(0);
|
|
59437
|
+
const [showSpawn, setShowSpawn] = import_react30.useState(false);
|
|
59438
|
+
const terminalHeight = stdout?.rows ?? 24;
|
|
59439
|
+
const dashboardHeight = terminalHeight - 2;
|
|
59440
|
+
const refreshTeams = import_react30.useCallback(() => {
|
|
59441
|
+
setTeams([...processManager.list()]);
|
|
59442
|
+
}, [processManager]);
|
|
59443
|
+
const handleSpawn = import_react30.useCallback(async (roomName) => {
|
|
59444
|
+
try {
|
|
59445
|
+
const room = await client.createRoom(roomName);
|
|
59446
|
+
processManager.spawn(room.id, roomName);
|
|
59447
|
+
refreshTeams();
|
|
59448
|
+
} catch (error48) {
|
|
59449
|
+
const msg = error48 instanceof Error ? error48.message : String(error48);
|
|
59450
|
+
const errorId = `error-${Date.now()}`;
|
|
59451
|
+
processManager.addError(errorId, roomName, msg);
|
|
59452
|
+
refreshTeams();
|
|
59557
59453
|
}
|
|
59558
|
-
}
|
|
59559
|
-
const
|
|
59560
|
-
|
|
59561
|
-
|
|
59562
|
-
}
|
|
59563
|
-
|
|
59564
|
-
|
|
59565
|
-
|
|
59566
|
-
|
|
59567
|
-
|
|
59568
|
-
|
|
59569
|
-
|
|
59570
|
-
|
|
59571
|
-
|
|
59572
|
-
|
|
59454
|
+
}, [client, processManager, refreshTeams]);
|
|
59455
|
+
const handleKillById = import_react30.useCallback((roomId) => {
|
|
59456
|
+
processManager.kill(roomId);
|
|
59457
|
+
refreshTeams();
|
|
59458
|
+
}, [processManager, refreshTeams]);
|
|
59459
|
+
import_react30.useEffect(() => {
|
|
59460
|
+
const interval = setInterval(refreshTeams, 200);
|
|
59461
|
+
return () => clearInterval(interval);
|
|
59462
|
+
}, [refreshTeams]);
|
|
59463
|
+
use_input_default((input, key) => {
|
|
59464
|
+
if (showSpawn)
|
|
59465
|
+
return;
|
|
59466
|
+
if (input === "q") {
|
|
59467
|
+
processManager.killAll();
|
|
59468
|
+
exit();
|
|
59469
|
+
return;
|
|
59573
59470
|
}
|
|
59574
|
-
|
|
59575
|
-
|
|
59576
|
-
|
|
59577
|
-
|
|
59578
|
-
|
|
59579
|
-
|
|
59580
|
-
|
|
59581
|
-
|
|
59582
|
-
|
|
59471
|
+
if (input === "n") {
|
|
59472
|
+
setShowSpawn(true);
|
|
59473
|
+
return;
|
|
59474
|
+
}
|
|
59475
|
+
if (input === "k" && teams.length > 0) {
|
|
59476
|
+
const team = teams[focusedIndex];
|
|
59477
|
+
if (team)
|
|
59478
|
+
handleKillById(team.roomId);
|
|
59479
|
+
if (focusedIndex >= teams.length - 1) {
|
|
59480
|
+
setFocusedIndex(Math.max(0, focusedIndex - 1));
|
|
59481
|
+
}
|
|
59482
|
+
return;
|
|
59483
|
+
}
|
|
59484
|
+
if (key.leftArrow) {
|
|
59485
|
+
setFocusedIndex((i) => Math.max(0, i - 1));
|
|
59486
|
+
}
|
|
59487
|
+
if (key.rightArrow) {
|
|
59488
|
+
setFocusedIndex((i) => Math.min(teams.length - 1, i + 1));
|
|
59489
|
+
}
|
|
59490
|
+
});
|
|
59491
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
59492
|
+
flexDirection: "column",
|
|
59493
|
+
height: terminalHeight,
|
|
59494
|
+
children: [
|
|
59495
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Dashboard, {
|
|
59496
|
+
teams,
|
|
59497
|
+
focusedIndex,
|
|
59498
|
+
height: dashboardHeight
|
|
59499
|
+
}, undefined, false, undefined, this),
|
|
59500
|
+
showSpawn ? /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(SpawnDialog, {
|
|
59501
|
+
onSubmit: (name) => {
|
|
59502
|
+
setShowSpawn(false);
|
|
59503
|
+
handleSpawn(name);
|
|
59504
|
+
},
|
|
59505
|
+
onCancel: () => setShowSpawn(false)
|
|
59506
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(StatusBar, {
|
|
59507
|
+
teamCount: teams.length,
|
|
59508
|
+
focusedRoom: teams[focusedIndex]?.roomName ?? null,
|
|
59509
|
+
showingSpawnDialog: false
|
|
59510
|
+
}, undefined, false, undefined, this)
|
|
59511
|
+
]
|
|
59512
|
+
}, undefined, true, undefined, this);
|
|
59583
59513
|
}
|
|
59584
|
-
|
|
59514
|
+
function App2(props) {
|
|
59515
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ErrorBoundary2, {
|
|
59516
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(AppInner, {
|
|
59517
|
+
...props
|
|
59518
|
+
}, undefined, false, undefined, this)
|
|
59519
|
+
}, undefined, false, undefined, this);
|
|
59520
|
+
}
|
|
59521
|
+
var import_react30, jsx_dev_runtime5, ErrorBoundary2;
|
|
59522
|
+
var init_app = __esm(async () => {
|
|
59523
|
+
await __promiseAll([
|
|
59524
|
+
init_build2(),
|
|
59525
|
+
init_dashboard(),
|
|
59526
|
+
init_spawn_dialog(),
|
|
59527
|
+
init_status_bar()
|
|
59528
|
+
]);
|
|
59529
|
+
import_react30 = __toESM(require_react(), 1);
|
|
59530
|
+
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59531
|
+
ErrorBoundary2 = class ErrorBoundary2 extends import_react30.Component {
|
|
59532
|
+
state = { error: null };
|
|
59533
|
+
static getDerivedStateFromError(error48) {
|
|
59534
|
+
return { error: error48 };
|
|
59535
|
+
}
|
|
59536
|
+
render() {
|
|
59537
|
+
if (this.state.error) {
|
|
59538
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
59539
|
+
flexDirection: "column",
|
|
59540
|
+
paddingX: 1,
|
|
59541
|
+
children: [
|
|
59542
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
59543
|
+
color: "red",
|
|
59544
|
+
bold: true,
|
|
59545
|
+
children: [
|
|
59546
|
+
"TUI crashed: ",
|
|
59547
|
+
this.state.error.message
|
|
59548
|
+
]
|
|
59549
|
+
}, undefined, true, undefined, this),
|
|
59550
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
59551
|
+
dimColor: true,
|
|
59552
|
+
children: "Press Ctrl+C to exit"
|
|
59553
|
+
}, undefined, false, undefined, this)
|
|
59554
|
+
]
|
|
59555
|
+
}, undefined, true, undefined, this);
|
|
59556
|
+
}
|
|
59557
|
+
return this.props.children;
|
|
59558
|
+
}
|
|
59559
|
+
};
|
|
59560
|
+
});
|
|
59585
59561
|
|
|
59586
59562
|
// src/commands/dashboard/usecase.ts
|
|
59587
59563
|
var exports_usecase = {};
|
|
59588
59564
|
__export(exports_usecase, {
|
|
59589
59565
|
startDashboard: () => startDashboard
|
|
59590
59566
|
});
|
|
59591
|
-
function startDashboard(client, config2, options) {
|
|
59567
|
+
async function startDashboard(client, config2, options) {
|
|
59592
59568
|
const claudePath = findClaudeCli();
|
|
59593
59569
|
const processManager = new ProcessManager({
|
|
59594
59570
|
claudePath,
|
|
@@ -59598,14 +59574,35 @@ function startDashboard(client, config2, options) {
|
|
|
59598
59574
|
...config2.key ? { MEET_AI_KEY: config2.key } : {}
|
|
59599
59575
|
}
|
|
59600
59576
|
});
|
|
59577
|
+
let lobbyWs = null;
|
|
59578
|
+
const pendingSpawns = new Set;
|
|
59579
|
+
try {
|
|
59580
|
+
lobbyWs = client.listenLobby({
|
|
59581
|
+
silent: true,
|
|
59582
|
+
onSpawnRequest: async (roomName) => {
|
|
59583
|
+
if (pendingSpawns.has(roomName))
|
|
59584
|
+
return;
|
|
59585
|
+
pendingSpawns.add(roomName);
|
|
59586
|
+
try {
|
|
59587
|
+
const room = await client.createRoom(roomName);
|
|
59588
|
+
processManager.spawn(room.id, roomName);
|
|
59589
|
+
} catch {
|
|
59590
|
+
pendingSpawns.delete(roomName);
|
|
59591
|
+
}
|
|
59592
|
+
}
|
|
59593
|
+
});
|
|
59594
|
+
} catch {}
|
|
59601
59595
|
function cleanup() {
|
|
59596
|
+
lobbyWs?.close();
|
|
59602
59597
|
processManager.killAll();
|
|
59603
59598
|
process.exit(0);
|
|
59604
59599
|
}
|
|
59605
59600
|
process.on("SIGINT", cleanup);
|
|
59606
59601
|
process.on("SIGTERM", cleanup);
|
|
59607
59602
|
const element = import_react31.default.createElement(App2, { processManager, client });
|
|
59608
|
-
render_default(element);
|
|
59603
|
+
const instance = render_default(element);
|
|
59604
|
+
await instance.waitUntilExit();
|
|
59605
|
+
cleanup();
|
|
59609
59606
|
}
|
|
59610
59607
|
var import_react31;
|
|
59611
59608
|
var init_usecase10 = __esm(async () => {
|
|
@@ -59655,13 +59652,1328 @@ var init_command11 = __esm(async () => {
|
|
|
59655
59652
|
});
|
|
59656
59653
|
});
|
|
59657
59654
|
|
|
59655
|
+
// src/lib/hooks/find-room.ts
|
|
59656
|
+
import { readdirSync, readFileSync as readFileSync4 } from "node:fs";
|
|
59657
|
+
import { join as join3 } from "node:path";
|
|
59658
|
+
function findRoomId(sessionId, teamsDir) {
|
|
59659
|
+
const dir = teamsDir ?? `${process.env.HOME}/.claude/teams`;
|
|
59660
|
+
let entries;
|
|
59661
|
+
try {
|
|
59662
|
+
entries = readdirSync(dir);
|
|
59663
|
+
} catch {
|
|
59664
|
+
return null;
|
|
59665
|
+
}
|
|
59666
|
+
for (const entry of entries) {
|
|
59667
|
+
const filePath = join3(dir, entry, "meet-ai.json");
|
|
59668
|
+
try {
|
|
59669
|
+
const raw = readFileSync4(filePath, "utf-8");
|
|
59670
|
+
const data = JSON.parse(raw);
|
|
59671
|
+
if (data.session_id === sessionId) {
|
|
59672
|
+
return data.room_id || null;
|
|
59673
|
+
}
|
|
59674
|
+
} catch {
|
|
59675
|
+
continue;
|
|
59676
|
+
}
|
|
59677
|
+
}
|
|
59678
|
+
return null;
|
|
59679
|
+
}
|
|
59680
|
+
var init_find_room = () => {};
|
|
59681
|
+
|
|
59682
|
+
// src/lib/hooks/summarize.ts
|
|
59683
|
+
import { basename } from "node:path";
|
|
59684
|
+
function summarize(toolName, toolInput) {
|
|
59685
|
+
const str = (key) => typeof toolInput[key] === "string" ? toolInput[key] : "";
|
|
59686
|
+
const file2 = (key) => basename(str(key)) || "?";
|
|
59687
|
+
switch (toolName) {
|
|
59688
|
+
case "Edit": {
|
|
59689
|
+
return `Edit: ${file2("file_path")}`;
|
|
59690
|
+
}
|
|
59691
|
+
case "Read": {
|
|
59692
|
+
return `Read: ${file2("file_path")}`;
|
|
59693
|
+
}
|
|
59694
|
+
case "Write": {
|
|
59695
|
+
return `Write: ${file2("file_path")}`;
|
|
59696
|
+
}
|
|
59697
|
+
case "Bash": {
|
|
59698
|
+
return `Bash: ${truncate(str("command"), 60)}`;
|
|
59699
|
+
}
|
|
59700
|
+
case "Grep": {
|
|
59701
|
+
return `Grep: "${str("pattern")}" in ${str("glob") || str("path")}`;
|
|
59702
|
+
}
|
|
59703
|
+
case "Glob": {
|
|
59704
|
+
return `Glob: ${str("pattern")}`;
|
|
59705
|
+
}
|
|
59706
|
+
case "Task": {
|
|
59707
|
+
return `Task: ${truncate(str("description"), 60)}`;
|
|
59708
|
+
}
|
|
59709
|
+
case "WebFetch": {
|
|
59710
|
+
return `WebFetch: ${str("url")}`;
|
|
59711
|
+
}
|
|
59712
|
+
case "WebSearch": {
|
|
59713
|
+
return `WebSearch: ${str("query")}`;
|
|
59714
|
+
}
|
|
59715
|
+
default: {
|
|
59716
|
+
return toolName;
|
|
59717
|
+
}
|
|
59718
|
+
}
|
|
59719
|
+
}
|
|
59720
|
+
var truncate = (s, n) => s.slice(0, n);
|
|
59721
|
+
var init_summarize = () => {};
|
|
59722
|
+
|
|
59723
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/utils/url.js
|
|
59724
|
+
var init_url = () => {};
|
|
59725
|
+
|
|
59726
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/utils/cookie.js
|
|
59727
|
+
var _serialize = (name, value, opt = {}) => {
|
|
59728
|
+
let cookie = `${name}=${value}`;
|
|
59729
|
+
if (name.startsWith("__Secure-") && !opt.secure) {
|
|
59730
|
+
throw new Error("__Secure- Cookie must have Secure attributes");
|
|
59731
|
+
}
|
|
59732
|
+
if (name.startsWith("__Host-")) {
|
|
59733
|
+
if (!opt.secure) {
|
|
59734
|
+
throw new Error("__Host- Cookie must have Secure attributes");
|
|
59735
|
+
}
|
|
59736
|
+
if (opt.path !== "/") {
|
|
59737
|
+
throw new Error('__Host- Cookie must have Path attributes with "/"');
|
|
59738
|
+
}
|
|
59739
|
+
if (opt.domain) {
|
|
59740
|
+
throw new Error("__Host- Cookie must not have Domain attributes");
|
|
59741
|
+
}
|
|
59742
|
+
}
|
|
59743
|
+
if (opt && typeof opt.maxAge === "number" && opt.maxAge >= 0) {
|
|
59744
|
+
if (opt.maxAge > 34560000) {
|
|
59745
|
+
throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");
|
|
59746
|
+
}
|
|
59747
|
+
cookie += `; Max-Age=${opt.maxAge | 0}`;
|
|
59748
|
+
}
|
|
59749
|
+
if (opt.domain && opt.prefix !== "host") {
|
|
59750
|
+
cookie += `; Domain=${opt.domain}`;
|
|
59751
|
+
}
|
|
59752
|
+
if (opt.path) {
|
|
59753
|
+
cookie += `; Path=${opt.path}`;
|
|
59754
|
+
}
|
|
59755
|
+
if (opt.expires) {
|
|
59756
|
+
if (opt.expires.getTime() - Date.now() > 34560000000) {
|
|
59757
|
+
throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");
|
|
59758
|
+
}
|
|
59759
|
+
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
59760
|
+
}
|
|
59761
|
+
if (opt.httpOnly) {
|
|
59762
|
+
cookie += "; HttpOnly";
|
|
59763
|
+
}
|
|
59764
|
+
if (opt.secure) {
|
|
59765
|
+
cookie += "; Secure";
|
|
59766
|
+
}
|
|
59767
|
+
if (opt.sameSite) {
|
|
59768
|
+
cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
59769
|
+
}
|
|
59770
|
+
if (opt.priority) {
|
|
59771
|
+
cookie += `; Priority=${opt.priority.charAt(0).toUpperCase() + opt.priority.slice(1)}`;
|
|
59772
|
+
}
|
|
59773
|
+
if (opt.partitioned) {
|
|
59774
|
+
if (!opt.secure) {
|
|
59775
|
+
throw new Error("Partitioned Cookie must have Secure attributes");
|
|
59776
|
+
}
|
|
59777
|
+
cookie += "; Partitioned";
|
|
59778
|
+
}
|
|
59779
|
+
return cookie;
|
|
59780
|
+
}, serialize = (name, value, opt) => {
|
|
59781
|
+
value = encodeURIComponent(value);
|
|
59782
|
+
return _serialize(name, value, opt);
|
|
59783
|
+
};
|
|
59784
|
+
var init_cookie = __esm(() => {
|
|
59785
|
+
init_url();
|
|
59786
|
+
});
|
|
59787
|
+
|
|
59788
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/client/fetch-result-please.js
|
|
59789
|
+
var init_fetch_result_please = () => {};
|
|
59790
|
+
|
|
59791
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/client/utils.js
|
|
59792
|
+
function isObject2(item) {
|
|
59793
|
+
return typeof item === "object" && item !== null && !Array.isArray(item);
|
|
59794
|
+
}
|
|
59795
|
+
function deepMerge(target, source) {
|
|
59796
|
+
if (!isObject2(target) && !isObject2(source)) {
|
|
59797
|
+
return source;
|
|
59798
|
+
}
|
|
59799
|
+
const merged = { ...target };
|
|
59800
|
+
for (const key in source) {
|
|
59801
|
+
const value = source[key];
|
|
59802
|
+
if (isObject2(merged[key]) && isObject2(value)) {
|
|
59803
|
+
merged[key] = deepMerge(merged[key], value);
|
|
59804
|
+
} else {
|
|
59805
|
+
merged[key] = value;
|
|
59806
|
+
}
|
|
59807
|
+
}
|
|
59808
|
+
return merged;
|
|
59809
|
+
}
|
|
59810
|
+
var mergePath = (base2, path) => {
|
|
59811
|
+
base2 = base2.replace(/\/+$/, "");
|
|
59812
|
+
base2 = base2 + "/";
|
|
59813
|
+
path = path.replace(/^\/+/, "");
|
|
59814
|
+
return base2 + path;
|
|
59815
|
+
}, replaceUrlParam = (urlString, params) => {
|
|
59816
|
+
for (const [k, v] of Object.entries(params)) {
|
|
59817
|
+
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??");
|
|
59818
|
+
urlString = urlString.replace(reg, v ? `/${v}` : "");
|
|
59819
|
+
}
|
|
59820
|
+
return urlString;
|
|
59821
|
+
}, buildSearchParams = (query) => {
|
|
59822
|
+
const searchParams = new URLSearchParams;
|
|
59823
|
+
for (const [k, v] of Object.entries(query)) {
|
|
59824
|
+
if (v === undefined) {
|
|
59825
|
+
continue;
|
|
59826
|
+
}
|
|
59827
|
+
if (Array.isArray(v)) {
|
|
59828
|
+
for (const v2 of v) {
|
|
59829
|
+
searchParams.append(k, v2);
|
|
59830
|
+
}
|
|
59831
|
+
} else {
|
|
59832
|
+
searchParams.set(k, v);
|
|
59833
|
+
}
|
|
59834
|
+
}
|
|
59835
|
+
return searchParams;
|
|
59836
|
+
}, replaceUrlProtocol = (urlString, protocol) => {
|
|
59837
|
+
switch (protocol) {
|
|
59838
|
+
case "ws":
|
|
59839
|
+
return urlString.replace(/^http/, "ws");
|
|
59840
|
+
case "http":
|
|
59841
|
+
return urlString.replace(/^ws/, "http");
|
|
59842
|
+
}
|
|
59843
|
+
}, removeIndexString = (urlString) => {
|
|
59844
|
+
if (/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(urlString)) {
|
|
59845
|
+
return urlString.replace(/\/index(?=\?|$)/, "/");
|
|
59846
|
+
}
|
|
59847
|
+
return urlString.replace(/\/index(?=\?|$)/, "");
|
|
59848
|
+
};
|
|
59849
|
+
var init_utils2 = __esm(() => {
|
|
59850
|
+
init_fetch_result_please();
|
|
59851
|
+
});
|
|
59852
|
+
|
|
59853
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/client/client.js
|
|
59854
|
+
var createProxy = (callback, path) => {
|
|
59855
|
+
const proxy = new Proxy(() => {}, {
|
|
59856
|
+
get(_obj, key) {
|
|
59857
|
+
if (typeof key !== "string" || key === "then") {
|
|
59858
|
+
return;
|
|
59859
|
+
}
|
|
59860
|
+
return createProxy(callback, [...path, key]);
|
|
59861
|
+
},
|
|
59862
|
+
apply(_1, _2, args) {
|
|
59863
|
+
return callback({
|
|
59864
|
+
path,
|
|
59865
|
+
args
|
|
59866
|
+
});
|
|
59867
|
+
}
|
|
59868
|
+
});
|
|
59869
|
+
return proxy;
|
|
59870
|
+
}, ClientRequestImpl = class {
|
|
59871
|
+
url;
|
|
59872
|
+
method;
|
|
59873
|
+
buildSearchParams;
|
|
59874
|
+
queryParams = undefined;
|
|
59875
|
+
pathParams = {};
|
|
59876
|
+
rBody;
|
|
59877
|
+
cType = undefined;
|
|
59878
|
+
constructor(url2, method, options) {
|
|
59879
|
+
this.url = url2;
|
|
59880
|
+
this.method = method;
|
|
59881
|
+
this.buildSearchParams = options.buildSearchParams;
|
|
59882
|
+
}
|
|
59883
|
+
fetch = async (args, opt) => {
|
|
59884
|
+
if (args) {
|
|
59885
|
+
if (args.query) {
|
|
59886
|
+
this.queryParams = this.buildSearchParams(args.query);
|
|
59887
|
+
}
|
|
59888
|
+
if (args.form) {
|
|
59889
|
+
const form = new FormData;
|
|
59890
|
+
for (const [k, v] of Object.entries(args.form)) {
|
|
59891
|
+
if (Array.isArray(v)) {
|
|
59892
|
+
for (const v2 of v) {
|
|
59893
|
+
form.append(k, v2);
|
|
59894
|
+
}
|
|
59895
|
+
} else {
|
|
59896
|
+
form.append(k, v);
|
|
59897
|
+
}
|
|
59898
|
+
}
|
|
59899
|
+
this.rBody = form;
|
|
59900
|
+
}
|
|
59901
|
+
if (args.json) {
|
|
59902
|
+
this.rBody = JSON.stringify(args.json);
|
|
59903
|
+
this.cType = "application/json";
|
|
59904
|
+
}
|
|
59905
|
+
if (args.param) {
|
|
59906
|
+
this.pathParams = args.param;
|
|
59907
|
+
}
|
|
59908
|
+
}
|
|
59909
|
+
let methodUpperCase = this.method.toUpperCase();
|
|
59910
|
+
const headerValues = {
|
|
59911
|
+
...args?.header,
|
|
59912
|
+
...typeof opt?.headers === "function" ? await opt.headers() : opt?.headers
|
|
59913
|
+
};
|
|
59914
|
+
if (args?.cookie) {
|
|
59915
|
+
const cookies = [];
|
|
59916
|
+
for (const [key, value] of Object.entries(args.cookie)) {
|
|
59917
|
+
cookies.push(serialize(key, value, { path: "/" }));
|
|
59918
|
+
}
|
|
59919
|
+
headerValues["Cookie"] = cookies.join(",");
|
|
59920
|
+
}
|
|
59921
|
+
if (this.cType) {
|
|
59922
|
+
headerValues["Content-Type"] = this.cType;
|
|
59923
|
+
}
|
|
59924
|
+
const headers = new Headers(headerValues ?? undefined);
|
|
59925
|
+
let url2 = this.url;
|
|
59926
|
+
url2 = removeIndexString(url2);
|
|
59927
|
+
url2 = replaceUrlParam(url2, this.pathParams);
|
|
59928
|
+
if (this.queryParams) {
|
|
59929
|
+
url2 = url2 + "?" + this.queryParams.toString();
|
|
59930
|
+
}
|
|
59931
|
+
methodUpperCase = this.method.toUpperCase();
|
|
59932
|
+
const setBody = !(methodUpperCase === "GET" || methodUpperCase === "HEAD");
|
|
59933
|
+
return (opt?.fetch || fetch)(url2, {
|
|
59934
|
+
body: setBody ? this.rBody : undefined,
|
|
59935
|
+
method: methodUpperCase,
|
|
59936
|
+
headers,
|
|
59937
|
+
...opt?.init
|
|
59938
|
+
});
|
|
59939
|
+
};
|
|
59940
|
+
}, hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
59941
|
+
const buildSearchParamsOption = options?.buildSearchParams ?? buildSearchParams;
|
|
59942
|
+
const parts = [...opts.path];
|
|
59943
|
+
const lastParts = parts.slice(-3).reverse();
|
|
59944
|
+
if (lastParts[0] === "toString") {
|
|
59945
|
+
if (lastParts[1] === "name") {
|
|
59946
|
+
return lastParts[2] || "";
|
|
59947
|
+
}
|
|
59948
|
+
return proxyCallback.toString();
|
|
59949
|
+
}
|
|
59950
|
+
if (lastParts[0] === "valueOf") {
|
|
59951
|
+
if (lastParts[1] === "name") {
|
|
59952
|
+
return lastParts[2] || "";
|
|
59953
|
+
}
|
|
59954
|
+
return proxyCallback;
|
|
59955
|
+
}
|
|
59956
|
+
let method = "";
|
|
59957
|
+
if (/^\$/.test(lastParts[0])) {
|
|
59958
|
+
const last = parts.pop();
|
|
59959
|
+
if (last) {
|
|
59960
|
+
method = last.replace(/^\$/, "");
|
|
59961
|
+
}
|
|
59962
|
+
}
|
|
59963
|
+
const path = parts.join("/");
|
|
59964
|
+
const url2 = mergePath(baseUrl, path);
|
|
59965
|
+
if (method === "url") {
|
|
59966
|
+
let result = url2;
|
|
59967
|
+
if (opts.args[0]) {
|
|
59968
|
+
if (opts.args[0].param) {
|
|
59969
|
+
result = replaceUrlParam(url2, opts.args[0].param);
|
|
59970
|
+
}
|
|
59971
|
+
if (opts.args[0].query) {
|
|
59972
|
+
result = result + "?" + buildSearchParamsOption(opts.args[0].query).toString();
|
|
59973
|
+
}
|
|
59974
|
+
}
|
|
59975
|
+
result = removeIndexString(result);
|
|
59976
|
+
return new URL(result);
|
|
59977
|
+
}
|
|
59978
|
+
if (method === "ws") {
|
|
59979
|
+
const webSocketUrl = replaceUrlProtocol(opts.args[0] && opts.args[0].param ? replaceUrlParam(url2, opts.args[0].param) : url2, "ws");
|
|
59980
|
+
const targetUrl = new URL(webSocketUrl);
|
|
59981
|
+
const queryParams = opts.args[0]?.query;
|
|
59982
|
+
if (queryParams) {
|
|
59983
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
59984
|
+
if (Array.isArray(value)) {
|
|
59985
|
+
value.forEach((item) => targetUrl.searchParams.append(key, item));
|
|
59986
|
+
} else {
|
|
59987
|
+
targetUrl.searchParams.set(key, value);
|
|
59988
|
+
}
|
|
59989
|
+
});
|
|
59990
|
+
}
|
|
59991
|
+
const establishWebSocket = (...args) => {
|
|
59992
|
+
if (options?.webSocket !== undefined && typeof options.webSocket === "function") {
|
|
59993
|
+
return options.webSocket(...args);
|
|
59994
|
+
}
|
|
59995
|
+
return new WebSocket(...args);
|
|
59996
|
+
};
|
|
59997
|
+
return establishWebSocket(targetUrl.toString());
|
|
59998
|
+
}
|
|
59999
|
+
const req = new ClientRequestImpl(url2, method, {
|
|
60000
|
+
buildSearchParams: buildSearchParamsOption
|
|
60001
|
+
});
|
|
60002
|
+
if (method) {
|
|
60003
|
+
options ??= {};
|
|
60004
|
+
const args = deepMerge(options, { ...opts.args[1] });
|
|
60005
|
+
return req.fetch(opts.args[0], args);
|
|
60006
|
+
}
|
|
60007
|
+
return req;
|
|
60008
|
+
}, []);
|
|
60009
|
+
var init_client2 = __esm(() => {
|
|
60010
|
+
init_cookie();
|
|
60011
|
+
init_utils2();
|
|
60012
|
+
});
|
|
60013
|
+
|
|
60014
|
+
// ../../node_modules/.bun/hono@4.11.8/node_modules/hono/dist/client/index.js
|
|
60015
|
+
var init_client3 = __esm(() => {
|
|
60016
|
+
init_client2();
|
|
60017
|
+
init_utils2();
|
|
60018
|
+
});
|
|
60019
|
+
|
|
60020
|
+
// src/lib/hooks/client.ts
|
|
60021
|
+
function createHookClient(url2, key) {
|
|
60022
|
+
return hc(url2, {
|
|
60023
|
+
headers: {
|
|
60024
|
+
"Content-Type": "application/json",
|
|
60025
|
+
Authorization: `Bearer ${key}`
|
|
60026
|
+
}
|
|
60027
|
+
});
|
|
60028
|
+
}
|
|
60029
|
+
async function sendParentMessage(client, roomId) {
|
|
60030
|
+
try {
|
|
60031
|
+
const res = await client.api.rooms[":id"].messages.$post({
|
|
60032
|
+
param: { id: roomId },
|
|
60033
|
+
json: {
|
|
60034
|
+
sender: HOOK_SENDER,
|
|
60035
|
+
content: "Agent activity",
|
|
60036
|
+
sender_type: "agent",
|
|
60037
|
+
color: HOOK_COLOR
|
|
60038
|
+
}
|
|
60039
|
+
});
|
|
60040
|
+
if (!res.ok)
|
|
60041
|
+
return null;
|
|
60042
|
+
const data = await res.json();
|
|
60043
|
+
return data.id;
|
|
60044
|
+
} catch {
|
|
60045
|
+
return null;
|
|
60046
|
+
}
|
|
60047
|
+
}
|
|
60048
|
+
async function sendLogEntry(client, roomId, summary, messageId) {
|
|
60049
|
+
try {
|
|
60050
|
+
await client.api.rooms[":id"].logs.$post({
|
|
60051
|
+
param: { id: roomId },
|
|
60052
|
+
json: {
|
|
60053
|
+
sender: HOOK_SENDER,
|
|
60054
|
+
content: summary,
|
|
60055
|
+
color: HOOK_COLOR,
|
|
60056
|
+
...messageId ? { message_id: messageId } : {}
|
|
60057
|
+
}
|
|
60058
|
+
});
|
|
60059
|
+
} catch {}
|
|
60060
|
+
}
|
|
60061
|
+
var HOOK_COLOR = "#6b7280", HOOK_SENDER = "hook";
|
|
60062
|
+
var init_client4 = __esm(() => {
|
|
60063
|
+
init_client3();
|
|
60064
|
+
});
|
|
60065
|
+
|
|
60066
|
+
// src/lib/hooks/index.ts
|
|
60067
|
+
var init_hooks = __esm(() => {
|
|
60068
|
+
init_find_room();
|
|
60069
|
+
init_summarize();
|
|
60070
|
+
init_client4();
|
|
60071
|
+
});
|
|
60072
|
+
|
|
60073
|
+
// src/commands/hook/log-tool-use/usecase.ts
|
|
60074
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, statSync as statSync2, rmSync } from "node:fs";
|
|
60075
|
+
function getOrCreateParentId(sessionId) {
|
|
60076
|
+
const path = `/tmp/meet-ai-hook-${sessionId}.msgid`;
|
|
60077
|
+
try {
|
|
60078
|
+
const mtime = statSync2(path).mtimeMs;
|
|
60079
|
+
if (Date.now() - mtime > PARENT_MSG_TTL_SEC * 1000) {
|
|
60080
|
+
rmSync(path, { force: true });
|
|
60081
|
+
return null;
|
|
60082
|
+
}
|
|
60083
|
+
return readFileSync5(path, "utf-8").trim() || null;
|
|
60084
|
+
} catch {
|
|
60085
|
+
return null;
|
|
60086
|
+
}
|
|
60087
|
+
}
|
|
60088
|
+
function saveParentId(sessionId, msgId) {
|
|
60089
|
+
try {
|
|
60090
|
+
writeFileSync2(`/tmp/meet-ai-hook-${sessionId}.msgid`, msgId);
|
|
60091
|
+
} catch {}
|
|
60092
|
+
}
|
|
60093
|
+
async function processHookInput(rawInput, teamsDir) {
|
|
60094
|
+
let input;
|
|
60095
|
+
try {
|
|
60096
|
+
input = JSON.parse(rawInput);
|
|
60097
|
+
} catch {
|
|
60098
|
+
return "skip";
|
|
60099
|
+
}
|
|
60100
|
+
const { session_id: sessionId, tool_name: toolName, tool_input: toolInput = {} } = input;
|
|
60101
|
+
if (!sessionId || !toolName)
|
|
60102
|
+
return "skip";
|
|
60103
|
+
if (toolName === "SendMessage")
|
|
60104
|
+
return "skip";
|
|
60105
|
+
if (toolName === "Bash") {
|
|
60106
|
+
const cmd = typeof toolInput.command === "string" ? toolInput.command : "";
|
|
60107
|
+
if (cmd.startsWith("cd ") || cmd.startsWith("meet-ai "))
|
|
60108
|
+
return "skip";
|
|
60109
|
+
}
|
|
60110
|
+
const roomId = findRoomId(sessionId, teamsDir);
|
|
60111
|
+
if (!roomId)
|
|
60112
|
+
return "skip";
|
|
60113
|
+
const url2 = process.env.MEET_AI_URL;
|
|
60114
|
+
const key = process.env.MEET_AI_KEY;
|
|
60115
|
+
if (!url2 || !key)
|
|
60116
|
+
return "skip";
|
|
60117
|
+
const client = createHookClient(url2, key);
|
|
60118
|
+
const summary = summarize(toolName, toolInput);
|
|
60119
|
+
let parentId = getOrCreateParentId(sessionId);
|
|
60120
|
+
if (!parentId) {
|
|
60121
|
+
parentId = await sendParentMessage(client, roomId);
|
|
60122
|
+
if (parentId)
|
|
60123
|
+
saveParentId(sessionId, parentId);
|
|
60124
|
+
}
|
|
60125
|
+
await sendLogEntry(client, roomId, summary, parentId ?? undefined);
|
|
60126
|
+
return "sent";
|
|
60127
|
+
}
|
|
60128
|
+
var PARENT_MSG_TTL_SEC = 120;
|
|
60129
|
+
var init_usecase11 = __esm(() => {
|
|
60130
|
+
init_hooks();
|
|
60131
|
+
init_hooks();
|
|
60132
|
+
init_hooks();
|
|
60133
|
+
});
|
|
60134
|
+
|
|
60135
|
+
// src/commands/hook/log-tool-use/command.ts
|
|
60136
|
+
var exports_command12 = {};
|
|
60137
|
+
__export(exports_command12, {
|
|
60138
|
+
default: () => command_default12
|
|
60139
|
+
});
|
|
60140
|
+
var command_default12;
|
|
60141
|
+
var init_command12 = __esm(() => {
|
|
60142
|
+
init_dist();
|
|
60143
|
+
init_usecase11();
|
|
60144
|
+
command_default12 = defineCommand({
|
|
60145
|
+
meta: {
|
|
60146
|
+
name: "log-tool-use",
|
|
60147
|
+
description: "Hook: log tool use events to a chat room"
|
|
60148
|
+
},
|
|
60149
|
+
async run() {
|
|
60150
|
+
try {
|
|
60151
|
+
let input = "";
|
|
60152
|
+
for await (const chunk of process.stdin) {
|
|
60153
|
+
input += chunk;
|
|
60154
|
+
}
|
|
60155
|
+
await processHookInput(input);
|
|
60156
|
+
} catch {}
|
|
60157
|
+
process.exit(0);
|
|
60158
|
+
}
|
|
60159
|
+
});
|
|
60160
|
+
});
|
|
60161
|
+
|
|
60162
|
+
// src/commands/hook/plan-review/usecase.ts
|
|
60163
|
+
var exports_usecase2 = {};
|
|
60164
|
+
__export(exports_usecase2, {
|
|
60165
|
+
processPlanReview: () => processPlanReview
|
|
60166
|
+
});
|
|
60167
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
60168
|
+
async function createPlanReview(client, roomId, planContent) {
|
|
60169
|
+
try {
|
|
60170
|
+
const res = await client.api.rooms[":id"]["plan-reviews"].$post({
|
|
60171
|
+
param: { id: roomId },
|
|
60172
|
+
json: { plan_content: planContent }
|
|
60173
|
+
});
|
|
60174
|
+
if (!res.ok) {
|
|
60175
|
+
const text = await res.text();
|
|
60176
|
+
process.stderr.write(`[plan-review] create failed: ${res.status} ${text}
|
|
60177
|
+
`);
|
|
60178
|
+
return null;
|
|
60179
|
+
}
|
|
60180
|
+
return await res.json();
|
|
60181
|
+
} catch (error48) {
|
|
60182
|
+
process.stderr.write(`[plan-review] create error: ${error48}
|
|
60183
|
+
`);
|
|
60184
|
+
return null;
|
|
60185
|
+
}
|
|
60186
|
+
}
|
|
60187
|
+
async function pollForDecision(client, roomId, reviewId) {
|
|
60188
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
60189
|
+
while (Date.now() < deadline) {
|
|
60190
|
+
try {
|
|
60191
|
+
const res = await client.api.rooms[":id"]["plan-reviews"][":reviewId"].$get({
|
|
60192
|
+
param: { id: roomId, reviewId }
|
|
60193
|
+
});
|
|
60194
|
+
if (res.ok) {
|
|
60195
|
+
const data = await res.json();
|
|
60196
|
+
if (data.status !== "pending") {
|
|
60197
|
+
return data;
|
|
60198
|
+
}
|
|
60199
|
+
}
|
|
60200
|
+
} catch (error48) {
|
|
60201
|
+
process.stderr.write(`[plan-review] poll error: ${error48}
|
|
60202
|
+
`);
|
|
60203
|
+
}
|
|
60204
|
+
await delay(POLL_INTERVAL_MS);
|
|
60205
|
+
}
|
|
60206
|
+
return null;
|
|
60207
|
+
}
|
|
60208
|
+
function getPromptsByMode(mode) {
|
|
60209
|
+
switch (mode) {
|
|
60210
|
+
case "acceptEdits": {
|
|
60211
|
+
return [
|
|
60212
|
+
{ tool: "Bash", prompt: "install dependencies" },
|
|
60213
|
+
{ tool: "Bash", prompt: "run tests" },
|
|
60214
|
+
{ tool: "Bash", prompt: "run build" },
|
|
60215
|
+
{ tool: "Bash", prompt: "run typecheck" },
|
|
60216
|
+
{ tool: "Bash", prompt: "run linter" }
|
|
60217
|
+
];
|
|
60218
|
+
}
|
|
60219
|
+
case "bypassPermissions": {
|
|
60220
|
+
return [{ tool: "Bash", prompt: "run any command" }];
|
|
60221
|
+
}
|
|
60222
|
+
default: {
|
|
60223
|
+
return;
|
|
60224
|
+
}
|
|
60225
|
+
}
|
|
60226
|
+
}
|
|
60227
|
+
function buildAllowOutput(permissionMode) {
|
|
60228
|
+
const allowedPrompts = getPromptsByMode(permissionMode);
|
|
60229
|
+
return {
|
|
60230
|
+
hookSpecificOutput: {
|
|
60231
|
+
hookEventName: "PermissionRequest",
|
|
60232
|
+
decision: allowedPrompts ? { behavior: "allow", allowedPrompts } : { behavior: "allow" }
|
|
60233
|
+
}
|
|
60234
|
+
};
|
|
60235
|
+
}
|
|
60236
|
+
function buildDenyOutput(feedback) {
|
|
60237
|
+
return {
|
|
60238
|
+
hookSpecificOutput: {
|
|
60239
|
+
hookEventName: "PermissionRequest",
|
|
60240
|
+
decision: {
|
|
60241
|
+
behavior: "deny",
|
|
60242
|
+
message: feedback
|
|
60243
|
+
}
|
|
60244
|
+
}
|
|
60245
|
+
};
|
|
60246
|
+
}
|
|
60247
|
+
async function expirePlanReview(client, roomId, reviewId) {
|
|
60248
|
+
try {
|
|
60249
|
+
await client.api.rooms[":id"]["plan-reviews"][":reviewId"].expire.$post({
|
|
60250
|
+
param: { id: roomId, reviewId }
|
|
60251
|
+
});
|
|
60252
|
+
} catch {}
|
|
60253
|
+
}
|
|
60254
|
+
async function processPlanReview(rawInput, teamsDir) {
|
|
60255
|
+
let input;
|
|
60256
|
+
try {
|
|
60257
|
+
input = JSON.parse(rawInput);
|
|
60258
|
+
} catch {
|
|
60259
|
+
process.stderr.write(`[plan-review] failed to parse stdin
|
|
60260
|
+
`);
|
|
60261
|
+
return;
|
|
60262
|
+
}
|
|
60263
|
+
const { session_id: sessionId } = input;
|
|
60264
|
+
if (!sessionId) {
|
|
60265
|
+
process.stderr.write(`[plan-review] missing session_id
|
|
60266
|
+
`);
|
|
60267
|
+
return;
|
|
60268
|
+
}
|
|
60269
|
+
const planContent = input.tool_input?.plan || "_Agent requested to exit plan mode without a plan._";
|
|
60270
|
+
const roomId = findRoomId(sessionId, teamsDir);
|
|
60271
|
+
if (!roomId) {
|
|
60272
|
+
process.stderr.write(`[plan-review] no room found for session
|
|
60273
|
+
`);
|
|
60274
|
+
return;
|
|
60275
|
+
}
|
|
60276
|
+
const url2 = process.env.MEET_AI_URL;
|
|
60277
|
+
const key = process.env.MEET_AI_KEY;
|
|
60278
|
+
if (!url2 || !key) {
|
|
60279
|
+
process.stderr.write(`[plan-review] MEET_AI_URL or MEET_AI_KEY not set
|
|
60280
|
+
`);
|
|
60281
|
+
return;
|
|
60282
|
+
}
|
|
60283
|
+
const client = createHookClient(url2, key);
|
|
60284
|
+
process.stderr.write(`[plan-review] sending plan to room ${roomId} via ${url2}
|
|
60285
|
+
`);
|
|
60286
|
+
const review = await createPlanReview(client, roomId, planContent);
|
|
60287
|
+
if (!review)
|
|
60288
|
+
return;
|
|
60289
|
+
process.stderr.write(`[plan-review] plan review created: ${review.id}, polling for decision...
|
|
60290
|
+
`);
|
|
60291
|
+
const decision = await pollForDecision(client, roomId, review.id);
|
|
60292
|
+
if (!decision) {
|
|
60293
|
+
process.stderr.write(`[plan-review] timed out waiting for decision
|
|
60294
|
+
`);
|
|
60295
|
+
await expirePlanReview(client, roomId, review.id);
|
|
60296
|
+
return;
|
|
60297
|
+
}
|
|
60298
|
+
process.stderr.write(`[plan-review] decision: ${decision.status}
|
|
60299
|
+
`);
|
|
60300
|
+
if (decision.status === "approved" || decision.status === "expired") {
|
|
60301
|
+
process.stdout.write(JSON.stringify(buildAllowOutput(decision.permission_mode)));
|
|
60302
|
+
} else if (decision.status === "denied") {
|
|
60303
|
+
const feedback = decision.feedback || "Plan was rejected. Please revise the plan based on the feedback.";
|
|
60304
|
+
process.stdout.write(JSON.stringify(buildDenyOutput(feedback)));
|
|
60305
|
+
}
|
|
60306
|
+
}
|
|
60307
|
+
var POLL_INTERVAL_MS = 2000, POLL_TIMEOUT_MS = 2592000000;
|
|
60308
|
+
var init_usecase12 = __esm(() => {
|
|
60309
|
+
init_client4();
|
|
60310
|
+
init_find_room();
|
|
60311
|
+
});
|
|
60312
|
+
|
|
60313
|
+
// src/commands/hook/plan-review/command.ts
|
|
60314
|
+
var exports_command13 = {};
|
|
60315
|
+
__export(exports_command13, {
|
|
60316
|
+
default: () => command_default13
|
|
60317
|
+
});
|
|
60318
|
+
var command_default13;
|
|
60319
|
+
var init_command13 = __esm(() => {
|
|
60320
|
+
init_dist();
|
|
60321
|
+
command_default13 = defineCommand({
|
|
60322
|
+
meta: {
|
|
60323
|
+
name: "plan-review",
|
|
60324
|
+
description: "Claude Code hook: send plan for review and poll for decision"
|
|
60325
|
+
},
|
|
60326
|
+
async run() {
|
|
60327
|
+
try {
|
|
60328
|
+
let input = "";
|
|
60329
|
+
for await (const chunk of process.stdin) {
|
|
60330
|
+
input += chunk;
|
|
60331
|
+
}
|
|
60332
|
+
const { processPlanReview: processPlanReview2 } = await Promise.resolve().then(() => (init_usecase12(), exports_usecase2));
|
|
60333
|
+
await processPlanReview2(input);
|
|
60334
|
+
} catch (error48) {
|
|
60335
|
+
process.stderr.write(`[plan-review] fatal: ${error48}
|
|
60336
|
+
`);
|
|
60337
|
+
}
|
|
60338
|
+
process.exit(0);
|
|
60339
|
+
}
|
|
60340
|
+
});
|
|
60341
|
+
});
|
|
60342
|
+
|
|
60343
|
+
// src/commands/hook/question-review/usecase.ts
|
|
60344
|
+
function formatQuestions(questions) {
|
|
60345
|
+
return questions.map((q) => {
|
|
60346
|
+
let text = `**${q.question}**
|
|
60347
|
+
`;
|
|
60348
|
+
for (let i = 0;i < q.options.length; i++) {
|
|
60349
|
+
const opt = q.options[i];
|
|
60350
|
+
text += `${i + 1}. **${opt.label}**`;
|
|
60351
|
+
if (opt.description)
|
|
60352
|
+
text += ` — ${opt.description}`;
|
|
60353
|
+
text += `
|
|
60354
|
+
`;
|
|
60355
|
+
}
|
|
60356
|
+
if (q.multiSelect) {
|
|
60357
|
+
text += `
|
|
60358
|
+
_Multiple choices allowed._`;
|
|
60359
|
+
}
|
|
60360
|
+
return text;
|
|
60361
|
+
}).join(`
|
|
60362
|
+
|
|
60363
|
+
`);
|
|
60364
|
+
}
|
|
60365
|
+
async function createQuestionReview(client, roomId, questions, formattedContent) {
|
|
60366
|
+
try {
|
|
60367
|
+
const res = await client.api.rooms[":id"]["question-reviews"].$post({
|
|
60368
|
+
param: { id: roomId },
|
|
60369
|
+
json: {
|
|
60370
|
+
questions_json: JSON.stringify(questions),
|
|
60371
|
+
formatted_content: formattedContent
|
|
60372
|
+
}
|
|
60373
|
+
});
|
|
60374
|
+
if (!res.ok) {
|
|
60375
|
+
const text = await res.text();
|
|
60376
|
+
process.stderr.write(`[question-review] create failed: ${res.status} ${text}
|
|
60377
|
+
`);
|
|
60378
|
+
return null;
|
|
60379
|
+
}
|
|
60380
|
+
return await res.json();
|
|
60381
|
+
} catch (error48) {
|
|
60382
|
+
process.stderr.write(`[question-review] create error: ${error48}
|
|
60383
|
+
`);
|
|
60384
|
+
return null;
|
|
60385
|
+
}
|
|
60386
|
+
}
|
|
60387
|
+
async function pollForAnswer(client, roomId, reviewId, pollInterval = POLL_INTERVAL_MS2, pollTimeout = POLL_TIMEOUT_MS2) {
|
|
60388
|
+
const deadline = Date.now() + pollTimeout;
|
|
60389
|
+
while (Date.now() < deadline) {
|
|
60390
|
+
try {
|
|
60391
|
+
const res = await client.api.rooms[":id"]["question-reviews"][":reviewId"].$get({
|
|
60392
|
+
param: { id: roomId, reviewId }
|
|
60393
|
+
});
|
|
60394
|
+
if (res.ok) {
|
|
60395
|
+
const data = await res.json();
|
|
60396
|
+
if (data.status !== "pending") {
|
|
60397
|
+
return data;
|
|
60398
|
+
}
|
|
60399
|
+
}
|
|
60400
|
+
} catch (error48) {
|
|
60401
|
+
process.stderr.write(`[question-review] poll error: ${error48}
|
|
60402
|
+
`);
|
|
60403
|
+
}
|
|
60404
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
60405
|
+
}
|
|
60406
|
+
return null;
|
|
60407
|
+
}
|
|
60408
|
+
function buildOutput(questions, answers) {
|
|
60409
|
+
return {
|
|
60410
|
+
hookSpecificOutput: {
|
|
60411
|
+
hookEventName: "PermissionRequest",
|
|
60412
|
+
decision: {
|
|
60413
|
+
behavior: "allow",
|
|
60414
|
+
updatedInput: {
|
|
60415
|
+
questions,
|
|
60416
|
+
answers
|
|
60417
|
+
}
|
|
60418
|
+
}
|
|
60419
|
+
}
|
|
60420
|
+
};
|
|
60421
|
+
}
|
|
60422
|
+
async function expireReview(client, roomId, reviewId) {
|
|
60423
|
+
try {
|
|
60424
|
+
await client.api.rooms[":id"]["question-reviews"][":reviewId"].expire.$post({
|
|
60425
|
+
param: { id: roomId, reviewId }
|
|
60426
|
+
});
|
|
60427
|
+
} catch {}
|
|
60428
|
+
}
|
|
60429
|
+
async function sendTimeoutMessage(client, roomId) {
|
|
60430
|
+
try {
|
|
60431
|
+
await client.api.rooms[":id"].messages.$post({
|
|
60432
|
+
param: { id: roomId },
|
|
60433
|
+
json: {
|
|
60434
|
+
sender: "hook",
|
|
60435
|
+
content: "_Question timed out — answer in terminal instead._",
|
|
60436
|
+
sender_type: "agent",
|
|
60437
|
+
color: "#f59e0b"
|
|
60438
|
+
}
|
|
60439
|
+
});
|
|
60440
|
+
} catch {}
|
|
60441
|
+
}
|
|
60442
|
+
async function processQuestionReview(rawInput, teamsDir, opts) {
|
|
60443
|
+
let input;
|
|
60444
|
+
try {
|
|
60445
|
+
input = JSON.parse(rawInput);
|
|
60446
|
+
} catch {
|
|
60447
|
+
process.stderr.write(`[question-review] failed to parse stdin
|
|
60448
|
+
`);
|
|
60449
|
+
return;
|
|
60450
|
+
}
|
|
60451
|
+
const { session_id: sessionId, hook_event_name: hookEventName, tool_input: toolInput } = input;
|
|
60452
|
+
if (!sessionId || !toolInput?.questions?.length) {
|
|
60453
|
+
process.stderr.write(`[question-review] missing session_id or questions
|
|
60454
|
+
`);
|
|
60455
|
+
return;
|
|
60456
|
+
}
|
|
60457
|
+
process.stderr.write(`[question-review] triggered by ${hookEventName} event
|
|
60458
|
+
`);
|
|
60459
|
+
const roomId = findRoomId(sessionId, teamsDir);
|
|
60460
|
+
if (!roomId) {
|
|
60461
|
+
process.stderr.write(`[question-review] no room found for session
|
|
60462
|
+
`);
|
|
60463
|
+
return;
|
|
60464
|
+
}
|
|
60465
|
+
const url2 = process.env.MEET_AI_URL;
|
|
60466
|
+
const key = process.env.MEET_AI_KEY;
|
|
60467
|
+
if (!url2 || !key) {
|
|
60468
|
+
process.stderr.write(`[question-review] MEET_AI_URL or MEET_AI_KEY not set
|
|
60469
|
+
`);
|
|
60470
|
+
return;
|
|
60471
|
+
}
|
|
60472
|
+
const client = createHookClient(url2, key);
|
|
60473
|
+
const formattedContent = formatQuestions(toolInput.questions);
|
|
60474
|
+
process.stderr.write(`[question-review] sending question to room ${roomId} via ${url2}
|
|
60475
|
+
`);
|
|
60476
|
+
const review = await createQuestionReview(client, roomId, toolInput.questions, formattedContent);
|
|
60477
|
+
if (!review)
|
|
60478
|
+
return;
|
|
60479
|
+
process.stderr.write(`[question-review] created: ${review.id}, polling for answer...
|
|
60480
|
+
`);
|
|
60481
|
+
const result = await pollForAnswer(client, roomId, review.id, opts?.pollInterval, opts?.pollTimeout);
|
|
60482
|
+
if (!result) {
|
|
60483
|
+
process.stderr.write(`[question-review] timed out waiting for answer
|
|
60484
|
+
`);
|
|
60485
|
+
await expireReview(client, roomId, review.id);
|
|
60486
|
+
await sendTimeoutMessage(client, roomId);
|
|
60487
|
+
return;
|
|
60488
|
+
}
|
|
60489
|
+
process.stderr.write(`[question-review] answer received: ${result.status}
|
|
60490
|
+
`);
|
|
60491
|
+
if (result.status === "answered" && result.answers_json) {
|
|
60492
|
+
let answers;
|
|
60493
|
+
try {
|
|
60494
|
+
answers = JSON.parse(result.answers_json);
|
|
60495
|
+
} catch (error48) {
|
|
60496
|
+
process.stderr.write(`[question-review] failed to parse answers_json: ${error48}
|
|
60497
|
+
`);
|
|
60498
|
+
return;
|
|
60499
|
+
}
|
|
60500
|
+
process.stdout.write(JSON.stringify(buildOutput(toolInput.questions, answers)));
|
|
60501
|
+
}
|
|
60502
|
+
}
|
|
60503
|
+
var POLL_INTERVAL_MS2 = 2000, POLL_TIMEOUT_MS2 = 1800000;
|
|
60504
|
+
var init_usecase13 = __esm(() => {
|
|
60505
|
+
init_client4();
|
|
60506
|
+
init_find_room();
|
|
60507
|
+
});
|
|
60508
|
+
|
|
60509
|
+
// src/commands/hook/question-review/command.ts
|
|
60510
|
+
var exports_command14 = {};
|
|
60511
|
+
__export(exports_command14, {
|
|
60512
|
+
default: () => command_default14
|
|
60513
|
+
});
|
|
60514
|
+
var command_default14;
|
|
60515
|
+
var init_command14 = __esm(() => {
|
|
60516
|
+
init_dist();
|
|
60517
|
+
init_usecase13();
|
|
60518
|
+
command_default14 = defineCommand({
|
|
60519
|
+
meta: {
|
|
60520
|
+
name: "question-review",
|
|
60521
|
+
description: "Handle Claude Code AskUser permission hook — routes questions to meet-ai room for review"
|
|
60522
|
+
},
|
|
60523
|
+
async run() {
|
|
60524
|
+
try {
|
|
60525
|
+
let input = "";
|
|
60526
|
+
for await (const chunk of process.stdin) {
|
|
60527
|
+
input += chunk;
|
|
60528
|
+
}
|
|
60529
|
+
await processQuestionReview(input);
|
|
60530
|
+
} catch (error48) {
|
|
60531
|
+
process.stderr.write(`[question-review] fatal: ${error48}
|
|
60532
|
+
`);
|
|
60533
|
+
}
|
|
60534
|
+
process.exit(0);
|
|
60535
|
+
}
|
|
60536
|
+
});
|
|
60537
|
+
});
|
|
60538
|
+
|
|
60539
|
+
// src/commands/hook/permission-review/usecase.ts
|
|
60540
|
+
function formatPermissionRequest(toolName, toolInput) {
|
|
60541
|
+
let text = `**Permission request: ${toolName}**
|
|
60542
|
+
`;
|
|
60543
|
+
if (toolInput) {
|
|
60544
|
+
const entries = Object.entries(toolInput);
|
|
60545
|
+
if (entries.length > 0) {
|
|
60546
|
+
for (const [key, value] of entries) {
|
|
60547
|
+
const valueStr = typeof value === "string" ? value : JSON.stringify(value);
|
|
60548
|
+
const truncated = valueStr.length > 200 ? valueStr.slice(0, 200) + "..." : valueStr;
|
|
60549
|
+
text += `
|
|
60550
|
+
**${key}:** \`${truncated}\``;
|
|
60551
|
+
}
|
|
60552
|
+
}
|
|
60553
|
+
}
|
|
60554
|
+
return text;
|
|
60555
|
+
}
|
|
60556
|
+
async function createPermissionReview(client, roomId, toolName, toolInput, formattedContent) {
|
|
60557
|
+
try {
|
|
60558
|
+
const res = await client.api.rooms[":id"]["permission-reviews"].$post({
|
|
60559
|
+
param: { id: roomId },
|
|
60560
|
+
json: {
|
|
60561
|
+
tool_name: toolName,
|
|
60562
|
+
tool_input_json: toolInput ? JSON.stringify(toolInput) : undefined,
|
|
60563
|
+
formatted_content: formattedContent
|
|
60564
|
+
}
|
|
60565
|
+
});
|
|
60566
|
+
if (!res.ok) {
|
|
60567
|
+
const text = await res.text();
|
|
60568
|
+
process.stderr.write(`[permission-review] create failed: ${res.status} ${text}
|
|
60569
|
+
`);
|
|
60570
|
+
return null;
|
|
60571
|
+
}
|
|
60572
|
+
return await res.json();
|
|
60573
|
+
} catch (error48) {
|
|
60574
|
+
process.stderr.write(`[permission-review] create error: ${error48}
|
|
60575
|
+
`);
|
|
60576
|
+
return null;
|
|
60577
|
+
}
|
|
60578
|
+
}
|
|
60579
|
+
async function pollForDecision2(client, roomId, reviewId, pollInterval = POLL_INTERVAL_MS3, pollTimeout = POLL_TIMEOUT_MS3) {
|
|
60580
|
+
const deadline = Date.now() + pollTimeout;
|
|
60581
|
+
while (Date.now() < deadline) {
|
|
60582
|
+
try {
|
|
60583
|
+
const res = await client.api.rooms[":id"]["permission-reviews"][":reviewId"].$get({
|
|
60584
|
+
param: { id: roomId, reviewId }
|
|
60585
|
+
});
|
|
60586
|
+
if (res.ok) {
|
|
60587
|
+
const data = await res.json();
|
|
60588
|
+
if (data.status !== "pending") {
|
|
60589
|
+
return data;
|
|
60590
|
+
}
|
|
60591
|
+
}
|
|
60592
|
+
} catch (error48) {
|
|
60593
|
+
process.stderr.write(`[permission-review] poll error: ${error48}
|
|
60594
|
+
`);
|
|
60595
|
+
}
|
|
60596
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
60597
|
+
}
|
|
60598
|
+
return null;
|
|
60599
|
+
}
|
|
60600
|
+
function buildAllowOutput2() {
|
|
60601
|
+
return {
|
|
60602
|
+
hookSpecificOutput: {
|
|
60603
|
+
hookEventName: "PermissionRequest",
|
|
60604
|
+
decision: { behavior: "allow" }
|
|
60605
|
+
}
|
|
60606
|
+
};
|
|
60607
|
+
}
|
|
60608
|
+
function buildDenyOutput2(message) {
|
|
60609
|
+
return {
|
|
60610
|
+
hookSpecificOutput: {
|
|
60611
|
+
hookEventName: "PermissionRequest",
|
|
60612
|
+
decision: {
|
|
60613
|
+
behavior: "deny",
|
|
60614
|
+
message
|
|
60615
|
+
}
|
|
60616
|
+
}
|
|
60617
|
+
};
|
|
60618
|
+
}
|
|
60619
|
+
async function expireReview2(client, roomId, reviewId) {
|
|
60620
|
+
try {
|
|
60621
|
+
await client.api.rooms[":id"]["permission-reviews"][":reviewId"].expire.$post({
|
|
60622
|
+
param: { id: roomId, reviewId }
|
|
60623
|
+
});
|
|
60624
|
+
} catch {}
|
|
60625
|
+
}
|
|
60626
|
+
async function sendTimeoutMessage2(client, roomId) {
|
|
60627
|
+
try {
|
|
60628
|
+
await client.api.rooms[":id"].messages.$post({
|
|
60629
|
+
param: { id: roomId },
|
|
60630
|
+
json: {
|
|
60631
|
+
sender: "hook",
|
|
60632
|
+
content: "_Permission request timed out — approve in terminal instead._",
|
|
60633
|
+
sender_type: "agent",
|
|
60634
|
+
color: "#f97316"
|
|
60635
|
+
}
|
|
60636
|
+
});
|
|
60637
|
+
} catch {}
|
|
60638
|
+
}
|
|
60639
|
+
async function processPermissionReview(rawInput, teamsDir, opts) {
|
|
60640
|
+
let input;
|
|
60641
|
+
try {
|
|
60642
|
+
input = JSON.parse(rawInput);
|
|
60643
|
+
} catch {
|
|
60644
|
+
process.stderr.write(`[permission-review] failed to parse stdin
|
|
60645
|
+
`);
|
|
60646
|
+
return;
|
|
60647
|
+
}
|
|
60648
|
+
const { session_id: sessionId, hook_event_name: hookEventName, tool_name: toolName, tool_input: toolInput } = input;
|
|
60649
|
+
if (!sessionId || !toolName) {
|
|
60650
|
+
process.stderr.write(`[permission-review] missing session_id or tool_name
|
|
60651
|
+
`);
|
|
60652
|
+
return;
|
|
60653
|
+
}
|
|
60654
|
+
const EXCLUDED_TOOLS = ["ExitPlanMode", "AskUserQuestion"];
|
|
60655
|
+
if (EXCLUDED_TOOLS.includes(toolName)) {
|
|
60656
|
+
process.stderr.write(`[permission-review] skipping ${toolName} — handled by dedicated hook
|
|
60657
|
+
`);
|
|
60658
|
+
return;
|
|
60659
|
+
}
|
|
60660
|
+
process.stderr.write(`[permission-review] triggered by ${hookEventName} for tool ${toolName}
|
|
60661
|
+
`);
|
|
60662
|
+
const roomId = findRoomId(sessionId, teamsDir);
|
|
60663
|
+
if (!roomId) {
|
|
60664
|
+
process.stderr.write(`[permission-review] no room found for session
|
|
60665
|
+
`);
|
|
60666
|
+
return;
|
|
60667
|
+
}
|
|
60668
|
+
const url2 = process.env.MEET_AI_URL;
|
|
60669
|
+
const key = process.env.MEET_AI_KEY;
|
|
60670
|
+
if (!url2 || !key) {
|
|
60671
|
+
process.stderr.write(`[permission-review] MEET_AI_URL or MEET_AI_KEY not set
|
|
60672
|
+
`);
|
|
60673
|
+
return;
|
|
60674
|
+
}
|
|
60675
|
+
const client = createHookClient(url2, key);
|
|
60676
|
+
const formattedContent = formatPermissionRequest(toolName, toolInput);
|
|
60677
|
+
process.stderr.write(`[permission-review] sending permission request to room ${roomId} via ${url2}
|
|
60678
|
+
`);
|
|
60679
|
+
const review = await createPermissionReview(client, roomId, toolName, toolInput, formattedContent);
|
|
60680
|
+
if (!review)
|
|
60681
|
+
return;
|
|
60682
|
+
process.stderr.write(`[permission-review] created: ${review.id}, polling for decision...
|
|
60683
|
+
`);
|
|
60684
|
+
const result = await pollForDecision2(client, roomId, review.id, opts?.pollInterval, opts?.pollTimeout);
|
|
60685
|
+
if (!result) {
|
|
60686
|
+
process.stderr.write(`[permission-review] timed out waiting for decision
|
|
60687
|
+
`);
|
|
60688
|
+
await expireReview2(client, roomId, review.id);
|
|
60689
|
+
await sendTimeoutMessage2(client, roomId);
|
|
60690
|
+
return;
|
|
60691
|
+
}
|
|
60692
|
+
process.stderr.write(`[permission-review] decision received: ${result.status}
|
|
60693
|
+
`);
|
|
60694
|
+
if (result.status === "approved") {
|
|
60695
|
+
process.stdout.write(JSON.stringify(buildAllowOutput2()));
|
|
60696
|
+
} else if (result.status === "denied") {
|
|
60697
|
+
const message = result.feedback || "Permission denied by user.";
|
|
60698
|
+
process.stdout.write(JSON.stringify(buildDenyOutput2(message)));
|
|
60699
|
+
}
|
|
60700
|
+
}
|
|
60701
|
+
var POLL_INTERVAL_MS3 = 2000, POLL_TIMEOUT_MS3 = 1800000;
|
|
60702
|
+
var init_usecase14 = __esm(() => {
|
|
60703
|
+
init_client4();
|
|
60704
|
+
init_find_room();
|
|
60705
|
+
});
|
|
60706
|
+
|
|
60707
|
+
// src/commands/hook/permission-review/command.ts
|
|
60708
|
+
var exports_command15 = {};
|
|
60709
|
+
__export(exports_command15, {
|
|
60710
|
+
default: () => command_default15
|
|
60711
|
+
});
|
|
60712
|
+
var command_default15;
|
|
60713
|
+
var init_command15 = __esm(() => {
|
|
60714
|
+
init_dist();
|
|
60715
|
+
init_usecase14();
|
|
60716
|
+
command_default15 = defineCommand({
|
|
60717
|
+
meta: {
|
|
60718
|
+
name: "permission-review",
|
|
60719
|
+
description: "Handle Claude Code PermissionRequest hook — routes tool permission requests to meet-ai room for review"
|
|
60720
|
+
},
|
|
60721
|
+
async run() {
|
|
60722
|
+
try {
|
|
60723
|
+
let input = "";
|
|
60724
|
+
for await (const chunk of process.stdin) {
|
|
60725
|
+
input += chunk;
|
|
60726
|
+
}
|
|
60727
|
+
await processPermissionReview(input);
|
|
60728
|
+
} catch (error48) {
|
|
60729
|
+
process.stderr.write(`[permission-review] fatal: ${error48}
|
|
60730
|
+
`);
|
|
60731
|
+
}
|
|
60732
|
+
process.exit(0);
|
|
60733
|
+
}
|
|
60734
|
+
});
|
|
60735
|
+
});
|
|
60736
|
+
|
|
60737
|
+
// src/commands/hook/command.ts
|
|
60738
|
+
var exports_command16 = {};
|
|
60739
|
+
__export(exports_command16, {
|
|
60740
|
+
default: () => command_default16
|
|
60741
|
+
});
|
|
60742
|
+
var command_default16;
|
|
60743
|
+
var init_command16 = __esm(() => {
|
|
60744
|
+
init_dist();
|
|
60745
|
+
command_default16 = defineCommand({
|
|
60746
|
+
meta: {
|
|
60747
|
+
name: "hook",
|
|
60748
|
+
description: "Claude Code hook subcommands"
|
|
60749
|
+
},
|
|
60750
|
+
subCommands: {
|
|
60751
|
+
"log-tool-use": () => Promise.resolve().then(() => (init_command12(), exports_command12)).then((m) => m.default),
|
|
60752
|
+
"plan-review": () => Promise.resolve().then(() => (init_command13(), exports_command13)).then((m) => m.default),
|
|
60753
|
+
"question-review": () => Promise.resolve().then(() => (init_command14(), exports_command14)).then((m) => m.default),
|
|
60754
|
+
"permission-review": () => Promise.resolve().then(() => (init_command15(), exports_command15)).then((m) => m.default)
|
|
60755
|
+
}
|
|
60756
|
+
});
|
|
60757
|
+
});
|
|
60758
|
+
|
|
60759
|
+
// src/commands/setup-hooks/usecase.ts
|
|
60760
|
+
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
60761
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
60762
|
+
import { resolve as resolve2, dirname as dirname2 } from "node:path";
|
|
60763
|
+
import { homedir as homedir3 } from "node:os";
|
|
60764
|
+
function isMeetAiHook(entry) {
|
|
60765
|
+
return entry.hooks?.some((h) => typeof h.command === "string" && h.command.startsWith("meet-ai hook ")) ?? false;
|
|
60766
|
+
}
|
|
60767
|
+
function getSettingsPath(project) {
|
|
60768
|
+
if (project) {
|
|
60769
|
+
return resolve2(process.cwd(), ".claude", "settings.json");
|
|
60770
|
+
}
|
|
60771
|
+
return resolve2(homedir3(), ".claude", "settings.json");
|
|
60772
|
+
}
|
|
60773
|
+
async function readSettings(path) {
|
|
60774
|
+
if (!existsSync4(path)) {
|
|
60775
|
+
return {};
|
|
60776
|
+
}
|
|
60777
|
+
const raw = await readFile(path, "utf-8");
|
|
60778
|
+
const trimmed = raw.trim();
|
|
60779
|
+
if (!trimmed)
|
|
60780
|
+
return {};
|
|
60781
|
+
try {
|
|
60782
|
+
return JSON.parse(trimmed);
|
|
60783
|
+
} catch {
|
|
60784
|
+
return {};
|
|
60785
|
+
}
|
|
60786
|
+
}
|
|
60787
|
+
function mergeHooks(existing) {
|
|
60788
|
+
const result = { ...existing };
|
|
60789
|
+
const added = [];
|
|
60790
|
+
for (const [event, matchers] of Object.entries(MEET_AI_HOOKS)) {
|
|
60791
|
+
if (!result[event]) {
|
|
60792
|
+
result[event] = [];
|
|
60793
|
+
}
|
|
60794
|
+
for (const newMatcher of matchers) {
|
|
60795
|
+
const existingIdx = result[event].findIndex((m) => m.matcher === newMatcher.matcher && isMeetAiHook(m));
|
|
60796
|
+
if (existingIdx >= 0) {
|
|
60797
|
+
result[event][existingIdx] = newMatcher;
|
|
60798
|
+
added.push(`updated ${event} [${newMatcher.matcher}]`);
|
|
60799
|
+
} else {
|
|
60800
|
+
result[event].push(newMatcher);
|
|
60801
|
+
added.push(`added ${event} [${newMatcher.matcher}]`);
|
|
60802
|
+
}
|
|
60803
|
+
}
|
|
60804
|
+
}
|
|
60805
|
+
return { merged: result, added };
|
|
60806
|
+
}
|
|
60807
|
+
function removeHooks(existing) {
|
|
60808
|
+
const result = {};
|
|
60809
|
+
const removed = [];
|
|
60810
|
+
for (const [event, matchers] of Object.entries(existing)) {
|
|
60811
|
+
const kept = matchers.filter((m) => {
|
|
60812
|
+
if (isMeetAiHook(m)) {
|
|
60813
|
+
removed.push(`removed ${event} [${m.matcher}]`);
|
|
60814
|
+
return false;
|
|
60815
|
+
}
|
|
60816
|
+
return true;
|
|
60817
|
+
});
|
|
60818
|
+
if (kept.length > 0) {
|
|
60819
|
+
result[event] = kept;
|
|
60820
|
+
}
|
|
60821
|
+
}
|
|
60822
|
+
return { cleaned: result, removed };
|
|
60823
|
+
}
|
|
60824
|
+
async function setupHooks(options) {
|
|
60825
|
+
const settingsPath = options._settingsPath ?? getSettingsPath(options.project);
|
|
60826
|
+
const settings = await readSettings(settingsPath);
|
|
60827
|
+
const existingHooks = settings.hooks ?? {};
|
|
60828
|
+
if (options.remove) {
|
|
60829
|
+
const { cleaned, removed } = removeHooks(existingHooks);
|
|
60830
|
+
if (removed.length === 0) {
|
|
60831
|
+
info("No meet-ai hooks found to remove.");
|
|
60832
|
+
return;
|
|
60833
|
+
}
|
|
60834
|
+
if (options.dryRun) {
|
|
60835
|
+
info(`Dry run — would modify ${settingsPath}:`);
|
|
60836
|
+
for (const r of removed) {
|
|
60837
|
+
console.log(import_picocolors2.default.yellow(` ${r}`));
|
|
60838
|
+
}
|
|
60839
|
+
return;
|
|
60840
|
+
}
|
|
60841
|
+
const updated = { ...settings, hooks: cleaned };
|
|
60842
|
+
if (Object.keys(cleaned).length === 0) {
|
|
60843
|
+
delete updated.hooks;
|
|
60844
|
+
}
|
|
60845
|
+
await mkdir(dirname2(settingsPath), { recursive: true });
|
|
60846
|
+
await writeFile(settingsPath, JSON.stringify(updated, null, 2) + `
|
|
60847
|
+
`);
|
|
60848
|
+
for (const r of removed) {
|
|
60849
|
+
console.log(import_picocolors2.default.yellow(` ${r}`));
|
|
60850
|
+
}
|
|
60851
|
+
ok(`Removed meet-ai hooks from ${settingsPath}`);
|
|
60852
|
+
} else {
|
|
60853
|
+
const { merged, added } = mergeHooks(existingHooks);
|
|
60854
|
+
if (options.dryRun) {
|
|
60855
|
+
info(`Dry run — would modify ${settingsPath}:`);
|
|
60856
|
+
for (const a of added) {
|
|
60857
|
+
console.log(import_picocolors2.default.green(` ${a}`));
|
|
60858
|
+
}
|
|
60859
|
+
return;
|
|
60860
|
+
}
|
|
60861
|
+
const updated = { ...settings, hooks: merged };
|
|
60862
|
+
await mkdir(dirname2(settingsPath), { recursive: true });
|
|
60863
|
+
await writeFile(settingsPath, JSON.stringify(updated, null, 2) + `
|
|
60864
|
+
`);
|
|
60865
|
+
for (const a of added) {
|
|
60866
|
+
console.log(import_picocolors2.default.green(` ${a}`));
|
|
60867
|
+
}
|
|
60868
|
+
ok(`Hooks written to ${settingsPath}`);
|
|
60869
|
+
}
|
|
60870
|
+
}
|
|
60871
|
+
var import_picocolors2, MEET_AI_HOOKS;
|
|
60872
|
+
var init_usecase15 = __esm(() => {
|
|
60873
|
+
init_output();
|
|
60874
|
+
import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
60875
|
+
MEET_AI_HOOKS = {
|
|
60876
|
+
PostToolUse: [
|
|
60877
|
+
{
|
|
60878
|
+
matcher: ".*",
|
|
60879
|
+
hooks: [
|
|
60880
|
+
{
|
|
60881
|
+
type: "command",
|
|
60882
|
+
command: "meet-ai hook log-tool-use",
|
|
60883
|
+
timeout: 10
|
|
60884
|
+
}
|
|
60885
|
+
]
|
|
60886
|
+
}
|
|
60887
|
+
],
|
|
60888
|
+
PermissionRequest: [
|
|
60889
|
+
{
|
|
60890
|
+
matcher: "ExitPlanMode",
|
|
60891
|
+
hooks: [
|
|
60892
|
+
{
|
|
60893
|
+
type: "command",
|
|
60894
|
+
command: "meet-ai hook plan-review",
|
|
60895
|
+
timeout: 2592000
|
|
60896
|
+
}
|
|
60897
|
+
]
|
|
60898
|
+
},
|
|
60899
|
+
{
|
|
60900
|
+
matcher: "AskUserQuestion",
|
|
60901
|
+
hooks: [
|
|
60902
|
+
{
|
|
60903
|
+
type: "command",
|
|
60904
|
+
command: "meet-ai hook question-review",
|
|
60905
|
+
timeout: 1800
|
|
60906
|
+
}
|
|
60907
|
+
]
|
|
60908
|
+
},
|
|
60909
|
+
{
|
|
60910
|
+
matcher: ".*",
|
|
60911
|
+
hooks: [
|
|
60912
|
+
{
|
|
60913
|
+
type: "command",
|
|
60914
|
+
command: "meet-ai hook permission-review",
|
|
60915
|
+
timeout: 1800
|
|
60916
|
+
}
|
|
60917
|
+
]
|
|
60918
|
+
}
|
|
60919
|
+
]
|
|
60920
|
+
};
|
|
60921
|
+
});
|
|
60922
|
+
|
|
60923
|
+
// src/commands/setup-hooks/command.ts
|
|
60924
|
+
var exports_command17 = {};
|
|
60925
|
+
__export(exports_command17, {
|
|
60926
|
+
default: () => command_default17
|
|
60927
|
+
});
|
|
60928
|
+
var command_default17;
|
|
60929
|
+
var init_command17 = __esm(() => {
|
|
60930
|
+
init_dist();
|
|
60931
|
+
init_usecase15();
|
|
60932
|
+
init_output();
|
|
60933
|
+
command_default17 = defineCommand({
|
|
60934
|
+
meta: {
|
|
60935
|
+
name: "setup-hooks",
|
|
60936
|
+
description: "Configure Claude Code hooks for meet-ai in ~/.claude/settings.json"
|
|
60937
|
+
},
|
|
60938
|
+
args: {
|
|
60939
|
+
project: {
|
|
60940
|
+
type: "boolean",
|
|
60941
|
+
description: "Write to ./.claude/settings.json instead of ~/.claude/settings.json",
|
|
60942
|
+
default: false
|
|
60943
|
+
},
|
|
60944
|
+
"dry-run": {
|
|
60945
|
+
type: "boolean",
|
|
60946
|
+
description: "Print what would be written without actually writing",
|
|
60947
|
+
default: false
|
|
60948
|
+
},
|
|
60949
|
+
remove: {
|
|
60950
|
+
type: "boolean",
|
|
60951
|
+
description: "Remove meet-ai hooks from settings instead of adding them",
|
|
60952
|
+
default: false
|
|
60953
|
+
}
|
|
60954
|
+
},
|
|
60955
|
+
async run({ args }) {
|
|
60956
|
+
try {
|
|
60957
|
+
await setupHooks({
|
|
60958
|
+
project: args.project,
|
|
60959
|
+
dryRun: args["dry-run"],
|
|
60960
|
+
remove: args.remove
|
|
60961
|
+
});
|
|
60962
|
+
} catch (error48) {
|
|
60963
|
+
err(error48 instanceof Error ? error48.message : String(error48));
|
|
60964
|
+
process.exit(1);
|
|
60965
|
+
}
|
|
60966
|
+
}
|
|
60967
|
+
});
|
|
60968
|
+
});
|
|
60969
|
+
|
|
59658
60970
|
// src/index.ts
|
|
59659
60971
|
init_dist();
|
|
59660
60972
|
init_output();
|
|
59661
60973
|
var main = defineCommand({
|
|
59662
60974
|
meta: {
|
|
59663
60975
|
name: "meet-ai",
|
|
59664
|
-
version: "0.0.
|
|
60976
|
+
version: "0.0.19",
|
|
59665
60977
|
description: "CLI for meet-ai chat rooms — create rooms, send messages, and stream via WebSocket"
|
|
59666
60978
|
},
|
|
59667
60979
|
args: {
|
|
@@ -59682,16 +60994,21 @@ var main = defineCommand({
|
|
|
59682
60994
|
"send-tasks": () => Promise.resolve().then(() => (init_command8(), exports_command8)).then((m) => m.default),
|
|
59683
60995
|
"download-attachment": () => Promise.resolve().then(() => (init_command9(), exports_command9)).then((m) => m.default),
|
|
59684
60996
|
"generate-key": () => Promise.resolve().then(() => (init_command10(), exports_command10)).then((m) => m.default),
|
|
59685
|
-
dashboard: () => init_command11().then(() => exports_command11).then((m) => m.default)
|
|
60997
|
+
dashboard: () => init_command11().then(() => exports_command11).then((m) => m.default),
|
|
60998
|
+
hook: () => Promise.resolve().then(() => (init_command16(), exports_command16)).then((m) => m.default),
|
|
60999
|
+
"setup-hooks": () => Promise.resolve().then(() => (init_command17(), exports_command17)).then((m) => m.default)
|
|
59686
61000
|
},
|
|
59687
61001
|
async run({ args }) {
|
|
61002
|
+
const hasSubcommand = process.argv.length > 2;
|
|
61003
|
+
if (hasSubcommand)
|
|
61004
|
+
return;
|
|
59688
61005
|
try {
|
|
59689
61006
|
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_client_factory(), exports_client_factory));
|
|
59690
61007
|
const { getMeetAiConfig: getMeetAiConfig2 } = await Promise.resolve().then(() => (init_config(), exports_config));
|
|
59691
61008
|
const { startDashboard: startDashboard2 } = await init_usecase10().then(() => exports_usecase);
|
|
59692
61009
|
const client = getClient2();
|
|
59693
61010
|
const config2 = getMeetAiConfig2();
|
|
59694
|
-
startDashboard2(client, config2, { debug: args.debug });
|
|
61011
|
+
await startDashboard2(client, config2, { debug: args.debug });
|
|
59695
61012
|
} catch (error48) {
|
|
59696
61013
|
err(error48 instanceof Error ? error48.message : String(error48));
|
|
59697
61014
|
process.exit(1);
|