@conveno/cli 0.2.0-rc.13 → 0.2.0-rc.15
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/README.md +1 -1
- package/dist/{acp-Bs6XS61j.js → acp-DZf0zyNC.js} +3 -3
- package/dist/{agy-relay-BJLRYbFp.js → agy-relay-DSRJtMz3.js} +3 -2
- package/dist/{args-C4rVCVXx.js → args-CpAvszNY.js} +13 -6
- package/dist/bin.js +2 -2
- package/dist/daemon.js +120 -12
- package/dist/{daemonError-CjxG2yUl.js → daemonError-Bj22X-4V.js} +1 -1
- package/dist/{dist-D4sb5RQD.js → dist-Bv1bmmme.js} +1 -1
- package/dist/{dist-CoRBNycn.js → dist-Bx22a5AV.js} +1 -1
- package/dist/{dist-B14ldKRS.js → dist-C4KljaIP.js} +1 -1
- package/dist/{dist-Ca3P7aN-.js → dist-C59LTq60.js} +9 -5
- package/dist/{dist-C9Z1EMlM.js → dist-DDzIkwf9.js} +1 -1
- package/dist/{dist-DnNuDzEA.js → dist-ZL7d4_97.js} +187 -75
- package/dist/{dist-BkhKEexU.js → dist-fI_XSoCQ.js} +192 -24
- package/dist/{hook-C60hXJdg.js → hook-BFZTvd7M.js} +1 -1
- package/dist/hook-entry-CmuvppGf.js +1 -0
- package/dist/{hook-entry-WlJSM5aD.js → hook-entry-CvzyjOo4.js} +6 -6
- package/dist/{main-I2RMN7XN.js → main-1QSm5UjR.js} +34 -60
- package/dist/{pick-Colav8Wm.js → pick-DaCRjuyz.js} +1 -1
- package/dist/{run-BuDbmxx_.js → run-CKiYjNqx.js} +276 -19
- package/dist/{runtime-CPmrhPFJ.js → runtime-CeFKWoIL.js} +37 -12
- package/dist/{uninstall-812XZDTG.js → uninstall-DK25hyWX.js} +80 -8
- package/dist/{watch-DXbOOc20.js → watch-De3wbdQL.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-jOfjq-0A.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Box, Text, render, useApp, useInput, useStdin, useStdout } from "ink";
|
|
2
2
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
3
|
-
import { D as
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
3
|
+
import { C as saveChoice, D as warmAcpAdapters, E as unifiedDiff, F as openInBrowser, N as stopDaemonIfRunning, O as PAIR_TIMEOUT_MS, S as connectedTools, T as applyChanges, _ as readWorkerAccess, a as applyOptions, c as collectPlans, d as refreshManifest, f as renewedApprovals, g as UNANSWERED_TEXT, h as ACCESS_TEXT, j as replaceStaleDaemon, l as detectAll, n as inspect, o as approvalWrites, r as partState, s as approvedBySetup, t as runUninstall, u as pendingOptions, v as saveWorkerAccess, w as StaleError, x as chosenTools, y as waitText, z as showCode$1 } from "./uninstall-DK25hyWX.js";
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-Bj22X-4V.js";
|
|
5
5
|
import { a as fail, n as cmd, s as plainError, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
6
6
|
import { createContext, useContext, useEffect, useImperativeHandle, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Bt as readAccountTokens, F as compatStatus, Gt as readSettings, I as completeLogin, It as planSpawn, Kt as readSpawnRecord, Ln as SESSION_NAME_PATTERN, Lt as pollDeviceCode, Q as findOnPath, Sn as writeSettings, U as defaultProcessIo, V as dataPaths, Wt as readProcessList, Yt as requestDeviceCode, Z as fetchAccountStatus, an as spawnRecordPath, h as WORKER_UNANSWERED, m as WORKER_ASK_TIMEOUT_CHOICES, n as AccountError, on as spawnSession, p as WORKER_ACCESS, qt as realSpawnDeps, yt as logoutAccount } from "./dist-ZL7d4_97.js";
|
|
8
8
|
import { i as tokens, n as detectColorLevel, r as detectUnicode } from "./dist-BRjg9CLd.js";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { readFileSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -12,7 +12,7 @@ import { Readable } from "node:stream";
|
|
|
12
12
|
import { basename, posix, win32 } from "node:path";
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
|
-
import { r as stopRequestPath, t as killProcessTree } from "./dist-
|
|
15
|
+
import { r as stopRequestPath, t as killProcessTree } from "./dist-fI_XSoCQ.js";
|
|
16
16
|
// src/tui/home/deps.ts
|
|
17
17
|
/**
|
|
18
18
|
* What home does outside the store: sign in and out, and take Conveno away. Real in the app, fake
|
|
@@ -269,7 +269,6 @@ function ScrollView({ lines, height, stickToBottom = false, isActive = true, onA
|
|
|
269
269
|
* so the shell shows a hint instead of quitting.
|
|
270
270
|
*/
|
|
271
271
|
const DraftContext = createContext({ cleared: () => void 0 });
|
|
272
|
-
DraftContext.Provider;
|
|
273
272
|
/** A small input. Enter sends; Shift+Enter (or Ctrl+J) adds a line when `multiline`. */
|
|
274
273
|
function TextBox({ value, onChange, onSubmit, placeholder, focus, multiline, onCancel, onFocusRequest }) {
|
|
275
274
|
const { c, ascii } = useTheme();
|
|
@@ -1173,6 +1172,134 @@ function sessionLabel(s, all) {
|
|
|
1173
1172
|
const tool = sessionTool(s);
|
|
1174
1173
|
return all.some((o) => o.id !== s.id && o.cli === s.cli) ? `${tool} (${shortName(s.name)})` : tool;
|
|
1175
1174
|
}
|
|
1175
|
+
// src/tui/home/access.tsx
|
|
1176
|
+
/** "Worker access": what background workers may do, how long a question waits, and what then. */
|
|
1177
|
+
/** One question: a list that starts on `current`, tracks its own focus, and answers on enter. */
|
|
1178
|
+
function Pick({ items, current, onPick }) {
|
|
1179
|
+
const [value, setValue] = useState(current);
|
|
1180
|
+
const [focus, setFocus] = useState(Math.max(0, items.findIndex((i) => i.id === current)));
|
|
1181
|
+
const known = (v) => items.find((i) => i.id === v)?.id ?? value;
|
|
1182
|
+
return /* @__PURE__ */ jsx(Choices, {
|
|
1183
|
+
items,
|
|
1184
|
+
value: [value],
|
|
1185
|
+
onChange: (v) => setValue(known(v[0])),
|
|
1186
|
+
onSubmit: (v) => onPick(known(v[0])),
|
|
1187
|
+
focusIndex: focus,
|
|
1188
|
+
onFocusChange: setFocus
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
const KEYS = [
|
|
1192
|
+
{
|
|
1193
|
+
k: "↑↓",
|
|
1194
|
+
label: "move"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
k: "enter",
|
|
1198
|
+
label: "choose"
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
k: "esc",
|
|
1202
|
+
label: "back"
|
|
1203
|
+
}
|
|
1204
|
+
];
|
|
1205
|
+
function WorkerAccessScreen({ actions, onBack, onSaved, onFailed }) {
|
|
1206
|
+
const k = useKit();
|
|
1207
|
+
const [phase, setPhase] = useState("access");
|
|
1208
|
+
const [access, setAccess] = useState("edit");
|
|
1209
|
+
const [waitSec, setWaitSec] = useState(120);
|
|
1210
|
+
const [unanswered, setUnanswered] = useState("deny");
|
|
1211
|
+
const [loaded, setLoaded] = useState(false);
|
|
1212
|
+
useEffect(() => {
|
|
1213
|
+
let live = true;
|
|
1214
|
+
actions.getWorkerAccess().then((c) => {
|
|
1215
|
+
if (!live) return;
|
|
1216
|
+
setAccess(c.access);
|
|
1217
|
+
setWaitSec(c.waitSec);
|
|
1218
|
+
setUnanswered(c.unanswered);
|
|
1219
|
+
}).catch(() => void 0).finally(() => {
|
|
1220
|
+
if (live) setLoaded(true);
|
|
1221
|
+
});
|
|
1222
|
+
return () => {
|
|
1223
|
+
live = false;
|
|
1224
|
+
};
|
|
1225
|
+
}, [actions]);
|
|
1226
|
+
useInput((_input, key) => {
|
|
1227
|
+
if (!key.escape) return;
|
|
1228
|
+
if (phase === "unanswered") setPhase("wait");
|
|
1229
|
+
else if (phase === "wait") setPhase("access");
|
|
1230
|
+
else onBack();
|
|
1231
|
+
});
|
|
1232
|
+
const save = (choice) => {
|
|
1233
|
+
actions.setWorkerAccess(choice).then(() => onSaved(choice), onFailed);
|
|
1234
|
+
};
|
|
1235
|
+
if (!loaded) return /* @__PURE__ */ jsx(Frame, {
|
|
1236
|
+
keys: [{
|
|
1237
|
+
k: "esc",
|
|
1238
|
+
label: "back"
|
|
1239
|
+
}],
|
|
1240
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1241
|
+
...k.quiet,
|
|
1242
|
+
children: "Reading your choice…"
|
|
1243
|
+
})
|
|
1244
|
+
});
|
|
1245
|
+
if (phase === "access") return /* @__PURE__ */ jsx(Frame, {
|
|
1246
|
+
title: "What may background workers do?",
|
|
1247
|
+
keys: KEYS,
|
|
1248
|
+
children: /* @__PURE__ */ jsx(Pick, {
|
|
1249
|
+
items: WORKER_ACCESS.map((id) => ({
|
|
1250
|
+
id,
|
|
1251
|
+
label: ACCESS_TEXT[id].label,
|
|
1252
|
+
hint: ACCESS_TEXT[id].hint
|
|
1253
|
+
})),
|
|
1254
|
+
current: access,
|
|
1255
|
+
onPick: (next) => {
|
|
1256
|
+
setAccess(next);
|
|
1257
|
+
if (next === "full") save({
|
|
1258
|
+
access: next,
|
|
1259
|
+
unanswered,
|
|
1260
|
+
waitSec
|
|
1261
|
+
});
|
|
1262
|
+
else setPhase("wait");
|
|
1263
|
+
}
|
|
1264
|
+
}, "access")
|
|
1265
|
+
});
|
|
1266
|
+
if (phase === "wait") return /* @__PURE__ */ jsx(Frame, {
|
|
1267
|
+
title: "Wait for an answer",
|
|
1268
|
+
subtitle: "Asked requests go to the session that started the worker.",
|
|
1269
|
+
keys: KEYS,
|
|
1270
|
+
children: /* @__PURE__ */ jsx(Pick, {
|
|
1271
|
+
items: WORKER_ASK_TIMEOUT_CHOICES.map((sec) => ({
|
|
1272
|
+
id: String(sec),
|
|
1273
|
+
label: waitText(sec)
|
|
1274
|
+
})),
|
|
1275
|
+
current: String(waitSec),
|
|
1276
|
+
onPick: (id) => {
|
|
1277
|
+
setWaitSec(WORKER_ASK_TIMEOUT_CHOICES.find((s) => String(s) === id) ?? waitSec);
|
|
1278
|
+
setPhase("unanswered");
|
|
1279
|
+
}
|
|
1280
|
+
}, "wait")
|
|
1281
|
+
});
|
|
1282
|
+
return /* @__PURE__ */ jsx(Frame, {
|
|
1283
|
+
title: `If nobody answers in ${waitText(waitSec)}`,
|
|
1284
|
+
keys: KEYS,
|
|
1285
|
+
children: /* @__PURE__ */ jsx(Pick, {
|
|
1286
|
+
items: WORKER_UNANSWERED.map((id) => ({
|
|
1287
|
+
id,
|
|
1288
|
+
label: UNANSWERED_TEXT[id].label,
|
|
1289
|
+
hint: UNANSWERED_TEXT[id].hint
|
|
1290
|
+
})),
|
|
1291
|
+
current: unanswered,
|
|
1292
|
+
onPick: (next) => {
|
|
1293
|
+
setUnanswered(next);
|
|
1294
|
+
save({
|
|
1295
|
+
access,
|
|
1296
|
+
unanswered: next,
|
|
1297
|
+
waitSec
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}, "unanswered")
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1176
1303
|
// src/tui/home/hooks.ts
|
|
1177
1304
|
/** The store's state, re-read whenever it changes. */
|
|
1178
1305
|
function useStoreState(store) {
|
|
@@ -2130,6 +2257,10 @@ const MENU_ITEMS = [
|
|
|
2130
2257
|
id: "setup",
|
|
2131
2258
|
label: "Set up tools"
|
|
2132
2259
|
},
|
|
2260
|
+
{
|
|
2261
|
+
id: "workers",
|
|
2262
|
+
label: "Worker access"
|
|
2263
|
+
},
|
|
2133
2264
|
{
|
|
2134
2265
|
id: "computers",
|
|
2135
2266
|
label: "Other computers"
|
|
@@ -2459,12 +2590,25 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2459
2590
|
say(reasonOf(e, "That did not send."), "error");
|
|
2460
2591
|
}
|
|
2461
2592
|
};
|
|
2462
|
-
const
|
|
2593
|
+
const startLead = () => {
|
|
2463
2594
|
const who = target();
|
|
2464
2595
|
if (!who) return;
|
|
2465
2596
|
const label = sessionLabel(who, state.sessions);
|
|
2466
|
-
if (who.isOrchestrator)
|
|
2467
|
-
|
|
2597
|
+
if (who.isOrchestrator) {
|
|
2598
|
+
say(`${label} is already in charge.`, "info");
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
if (who.remote) {
|
|
2602
|
+
say("That one's on another computer. Pick one here.", "warn");
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
setMode("lead");
|
|
2606
|
+
};
|
|
2607
|
+
const makeLead = async () => {
|
|
2608
|
+
const who = sel;
|
|
2609
|
+
setMode("board");
|
|
2610
|
+
if (!who) return;
|
|
2611
|
+
const label = sessionLabel(who, state.sessions);
|
|
2468
2612
|
try {
|
|
2469
2613
|
await actions.setLead(who.id);
|
|
2470
2614
|
say(`${label} is in charge now.`);
|
|
@@ -2529,11 +2673,11 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2529
2673
|
const pick = (id) => {
|
|
2530
2674
|
setMode("board");
|
|
2531
2675
|
if (id === "send") startMessage();
|
|
2532
|
-
else if (id === "lead")
|
|
2676
|
+
else if (id === "lead") startLead();
|
|
2533
2677
|
else if (id === "rename") startRename();
|
|
2534
2678
|
else if (id === "remove") startRemove();
|
|
2535
2679
|
else if (id === "setup") onSetup();
|
|
2536
|
-
else if (id === "computers" || id === "account" || id === "uninstall") setMode(id);
|
|
2680
|
+
else if (id === "computers" || id === "account" || id === "uninstall" || id === "workers") setMode(id);
|
|
2537
2681
|
else if (id === "quit") onQuit();
|
|
2538
2682
|
};
|
|
2539
2683
|
const move = (to) => {
|
|
@@ -2557,7 +2701,7 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2557
2701
|
return lead && first ? setSelId(first.id) : void 0;
|
|
2558
2702
|
}
|
|
2559
2703
|
if (key.return || input === "m") return startMessage();
|
|
2560
|
-
if (input === "l") return
|
|
2704
|
+
if (input === "l") return startLead();
|
|
2561
2705
|
if (input === "r") return startRename();
|
|
2562
2706
|
if (input === "x") return startRemove();
|
|
2563
2707
|
if (input === "f") return startFix();
|
|
@@ -2569,6 +2713,10 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2569
2713
|
if (input === "y" || input === "Y") remove();
|
|
2570
2714
|
else if (input === "n" || input === "N" || key.escape || key.return) setMode("board");
|
|
2571
2715
|
}, { isActive: mode === "remove" });
|
|
2716
|
+
useInput((input, key) => {
|
|
2717
|
+
if (input === "y" || input === "Y") makeLead();
|
|
2718
|
+
else if (input === "n" || input === "N" || key.escape || key.return) setMode("board");
|
|
2719
|
+
}, { isActive: mode === "lead" });
|
|
2572
2720
|
useWheel(boardRef, (d) => move(selIdx + d), { isActive: mode === "board" });
|
|
2573
2721
|
const back = () => setMode("board");
|
|
2574
2722
|
if (mode === "menu") return /* @__PURE__ */ jsx(Menu, {
|
|
@@ -2586,6 +2734,18 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2586
2734
|
deps,
|
|
2587
2735
|
onBack: back
|
|
2588
2736
|
});
|
|
2737
|
+
if (mode === "workers") return /* @__PURE__ */ jsx(WorkerAccessScreen, {
|
|
2738
|
+
actions,
|
|
2739
|
+
onBack: back,
|
|
2740
|
+
onSaved: (c) => {
|
|
2741
|
+
back();
|
|
2742
|
+
say(`Workers now get ${c.access} access.`);
|
|
2743
|
+
},
|
|
2744
|
+
onFailed: (e) => {
|
|
2745
|
+
back();
|
|
2746
|
+
say(reasonOf(e, "That did not save."), "error");
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2589
2749
|
if (mode === "fix") return /* @__PURE__ */ jsx(FixScreen, {
|
|
2590
2750
|
problems: fixing,
|
|
2591
2751
|
actions,
|
|
@@ -2611,7 +2771,7 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2611
2771
|
const hint = !lead && !empty;
|
|
2612
2772
|
const entries = state.activity;
|
|
2613
2773
|
let act = Math.min(ACTIVITY_LINES, Math.max(1, entries.length));
|
|
2614
|
-
const asking = mode === "remove";
|
|
2774
|
+
const asking = mode === "remove" || mode === "lead";
|
|
2615
2775
|
const fixed = 2 + (problems.length > 0 ? 2 : 0) + 1 + (typing || asking ? 1 : 0) + 1 + 1 + (hint ? 1 : 0);
|
|
2616
2776
|
const need = lead && modeFor(columns) === "compact" ? 11 : 5;
|
|
2617
2777
|
while (act > 1 && rows - fixed - act < need) act -= 1;
|
|
@@ -2671,6 +2831,10 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2671
2831
|
k: "r",
|
|
2672
2832
|
label: "rename"
|
|
2673
2833
|
},
|
|
2834
|
+
{
|
|
2835
|
+
k: "x",
|
|
2836
|
+
label: "remove"
|
|
2837
|
+
},
|
|
2674
2838
|
...problems.length > 0 ? [{
|
|
2675
2839
|
k: "f",
|
|
2676
2840
|
label: "fix"
|
|
@@ -2762,6 +2926,11 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2762
2926
|
...tint(k.c.warn),
|
|
2763
2927
|
children: cut(`Remove ${sel.name} from the list? Its unread messages go too. y/n`, width, k.ascii)
|
|
2764
2928
|
}) : null,
|
|
2929
|
+
mode === "lead" && sel ? /* @__PURE__ */ jsx(Text, {
|
|
2930
|
+
wrap: "truncate",
|
|
2931
|
+
...tint(k.c.warn),
|
|
2932
|
+
children: cut(`Make ${sessionLabel(sel, state.sessions)} the lead? y/n`, width, k.ascii)
|
|
2933
|
+
}) : null,
|
|
2765
2934
|
typing && sel ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
2766
2935
|
/* @__PURE__ */ jsx(Text, {
|
|
2767
2936
|
wrap: "truncate",
|
|
@@ -4009,6 +4178,10 @@ function createOnboardingDeps(ctx) {
|
|
|
4009
4178
|
saveChoice: async (tools, lead) => {
|
|
4010
4179
|
saveChoice(ctx, tools, lead);
|
|
4011
4180
|
},
|
|
4181
|
+
workerAccess: async () => readWorkerAccess(ctx).access,
|
|
4182
|
+
saveWorkerAccess: async (access) => {
|
|
4183
|
+
saveWorkerAccess(ctx, { access });
|
|
4184
|
+
},
|
|
4012
4185
|
signedIn: async () => await readAccountTokens(tokenFile(ctx)).catch(() => null) !== null,
|
|
4013
4186
|
signIn: async ({ signal, onCode }) => {
|
|
4014
4187
|
const io = accountIo(ctx);
|
|
@@ -4058,6 +4231,7 @@ const initialState = (start) => ({
|
|
|
4058
4231
|
tools: null,
|
|
4059
4232
|
signedIn: false,
|
|
4060
4233
|
picked: [],
|
|
4234
|
+
access: "full",
|
|
4061
4235
|
dropped: [],
|
|
4062
4236
|
questions: [],
|
|
4063
4237
|
qIndex: 0,
|
|
@@ -4161,8 +4335,21 @@ function buildRows(s) {
|
|
|
4161
4335
|
});
|
|
4162
4336
|
return rows;
|
|
4163
4337
|
}
|
|
4164
|
-
/** Leave the questions:
|
|
4338
|
+
/** Leave the questions: ask what workers may do, or send the person back when nothing is left. */
|
|
4165
4339
|
function startWorking(s) {
|
|
4340
|
+
if (buildRows(s).length === 0) return {
|
|
4341
|
+
...s,
|
|
4342
|
+
step: "tools",
|
|
4343
|
+
notice: "Pick a tool to go on."
|
|
4344
|
+
};
|
|
4345
|
+
const { notice: _n, ...rest } = s;
|
|
4346
|
+
return {
|
|
4347
|
+
...rest,
|
|
4348
|
+
step: "access"
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
/** Set up the rows. */
|
|
4352
|
+
function runRows(s) {
|
|
4166
4353
|
const active = activeTools(s);
|
|
4167
4354
|
const lead = s.lead && active.some((t) => t.cli === s.lead) ? s.lead : s.lead && active[0]?.cli;
|
|
4168
4355
|
const next = {
|
|
@@ -4228,9 +4415,14 @@ function reduce(s, a) {
|
|
|
4228
4415
|
...s,
|
|
4229
4416
|
tools: a.tools,
|
|
4230
4417
|
signedIn: a.signedIn,
|
|
4231
|
-
picked: a.chosen.filter((c) => known.has(c))
|
|
4418
|
+
picked: a.chosen.filter((c) => known.has(c)),
|
|
4419
|
+
...a.access ? { access: a.access } : {}
|
|
4232
4420
|
};
|
|
4233
4421
|
}
|
|
4422
|
+
case "chooseAccess": return s.step === "access" ? runRows({
|
|
4423
|
+
...s,
|
|
4424
|
+
access: a.access
|
|
4425
|
+
}) : s;
|
|
4234
4426
|
case "begin": return s.step === "welcome" && s.tools ? {
|
|
4235
4427
|
...s,
|
|
4236
4428
|
step: "tools"
|
|
@@ -4319,6 +4511,15 @@ function reduce(s, a) {
|
|
|
4319
4511
|
...rest,
|
|
4320
4512
|
step: "tools"
|
|
4321
4513
|
};
|
|
4514
|
+
case "access":
|
|
4515
|
+
if (s.questions.length > 0) return toQuestionsAt(rest, s.questions.length - 1);
|
|
4516
|
+
return activeTools(rest).length >= 2 ? {
|
|
4517
|
+
...rest,
|
|
4518
|
+
step: "lead"
|
|
4519
|
+
} : {
|
|
4520
|
+
...rest,
|
|
4521
|
+
step: "tools"
|
|
4522
|
+
};
|
|
4322
4523
|
default: return s;
|
|
4323
4524
|
}
|
|
4324
4525
|
}
|
|
@@ -4677,6 +4878,45 @@ function LeadStep({ s, dispatch }) {
|
|
|
4677
4878
|
})
|
|
4678
4879
|
});
|
|
4679
4880
|
}
|
|
4881
|
+
function AccessStep({ s, dispatch }) {
|
|
4882
|
+
const [pick, setPick] = useState([s.access]);
|
|
4883
|
+
const [focus, setFocus] = useState(WORKER_ACCESS.indexOf(s.access));
|
|
4884
|
+
return /* @__PURE__ */ jsx(Frame, {
|
|
4885
|
+
title: "What may background workers do?",
|
|
4886
|
+
subtitle: "Workers are sessions Conveno starts for you. You can change this later.",
|
|
4887
|
+
keys: [
|
|
4888
|
+
{
|
|
4889
|
+
k: "↑↓",
|
|
4890
|
+
label: "move"
|
|
4891
|
+
},
|
|
4892
|
+
{
|
|
4893
|
+
k: "enter",
|
|
4894
|
+
label: "choose"
|
|
4895
|
+
},
|
|
4896
|
+
{
|
|
4897
|
+
k: "esc",
|
|
4898
|
+
label: "back"
|
|
4899
|
+
}
|
|
4900
|
+
],
|
|
4901
|
+
children: /* @__PURE__ */ jsx(Choices, {
|
|
4902
|
+
items: WORKER_ACCESS.map((id) => ({
|
|
4903
|
+
id,
|
|
4904
|
+
label: ACCESS_TEXT[id].label,
|
|
4905
|
+
hint: ACCESS_TEXT[id].hint
|
|
4906
|
+
})),
|
|
4907
|
+
value: pick,
|
|
4908
|
+
onChange: setPick,
|
|
4909
|
+
onSubmit: (ids) => {
|
|
4910
|
+
dispatch({
|
|
4911
|
+
type: "chooseAccess",
|
|
4912
|
+
access: WORKER_ACCESS.find((a) => a === (ids[0] ?? s.access)) ?? s.access
|
|
4913
|
+
});
|
|
4914
|
+
},
|
|
4915
|
+
focusIndex: focus,
|
|
4916
|
+
onFocusChange: setFocus
|
|
4917
|
+
})
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4680
4920
|
function QuestionStep({ s, dispatch }) {
|
|
4681
4921
|
const q = s.questions[s.qIndex];
|
|
4682
4922
|
const [choice, setChoice] = useState(q?.defaultYes ? "yes" : "no");
|
|
@@ -4918,13 +5158,15 @@ function Onboarding({ deps, start, onDone }) {
|
|
|
4918
5158
|
Promise.all([
|
|
4919
5159
|
d.detect(),
|
|
4920
5160
|
d.signedIn().catch(() => false),
|
|
4921
|
-
d.chosen().catch(() => [])
|
|
4922
|
-
|
|
5161
|
+
d.chosen().catch(() => []),
|
|
5162
|
+
d.workerAccess().catch(() => void 0)
|
|
5163
|
+
]).then(([tools, signedIn, chosen, access]) => {
|
|
4923
5164
|
if (live.current) dispatch({
|
|
4924
5165
|
type: "loaded",
|
|
4925
5166
|
tools,
|
|
4926
5167
|
signedIn,
|
|
4927
|
-
chosen
|
|
5168
|
+
chosen,
|
|
5169
|
+
...access ? { access } : {}
|
|
4928
5170
|
});
|
|
4929
5171
|
});
|
|
4930
5172
|
}, []);
|
|
@@ -4932,6 +5174,7 @@ function Onboarding({ deps, start, onDone }) {
|
|
|
4932
5174
|
if (s.step !== "account" && s.step !== "finish") return;
|
|
4933
5175
|
if (led.current) return;
|
|
4934
5176
|
led.current = true;
|
|
5177
|
+
depsRef.current.saveWorkerAccess(s.access).catch(() => {});
|
|
4935
5178
|
const tools = connectedRows(s).map((r) => r.cli);
|
|
4936
5179
|
if (tools.length === 0) return;
|
|
4937
5180
|
const lead = s.lead && tools.includes(s.lead) ? s.lead : void 0;
|
|
@@ -5073,7 +5316,8 @@ function Onboarding({ deps, start, onDone }) {
|
|
|
5073
5316
|
"tools",
|
|
5074
5317
|
"remove",
|
|
5075
5318
|
"lead",
|
|
5076
|
-
"question"
|
|
5319
|
+
"question",
|
|
5320
|
+
"access"
|
|
5077
5321
|
].includes(s.step)) dispatch({ type: "back" });
|
|
5078
5322
|
return;
|
|
5079
5323
|
}
|
|
@@ -5119,6 +5363,10 @@ function OnboardingView({ s, dispatch, signIn }) {
|
|
|
5119
5363
|
s,
|
|
5120
5364
|
dispatch
|
|
5121
5365
|
});
|
|
5366
|
+
case "access": return /* @__PURE__ */ jsx(AccessStep, {
|
|
5367
|
+
s,
|
|
5368
|
+
dispatch
|
|
5369
|
+
});
|
|
5122
5370
|
case "working": return /* @__PURE__ */ jsx(WorkingStep, { s });
|
|
5123
5371
|
case "account": return /* @__PURE__ */ jsx(AccountStep, {
|
|
5124
5372
|
s,
|
|
@@ -5521,7 +5769,10 @@ async function createStore(ctx, opts = {}) {
|
|
|
5521
5769
|
});
|
|
5522
5770
|
},
|
|
5523
5771
|
async setLead(sessionId) {
|
|
5524
|
-
await live()["orchestrator.claim"]({
|
|
5772
|
+
await live()["orchestrator.claim"]({
|
|
5773
|
+
sessionId,
|
|
5774
|
+
via: "home"
|
|
5775
|
+
});
|
|
5525
5776
|
set({ sessions: state.sessions.map((s) => ({
|
|
5526
5777
|
...s,
|
|
5527
5778
|
isOrchestrator: s.id === sessionId
|
|
@@ -5615,6 +5866,12 @@ async function createStore(ctx, opts = {}) {
|
|
|
5615
5866
|
await live()["devices.revoke"]({ device: deviceId });
|
|
5616
5867
|
await pollRelay(live());
|
|
5617
5868
|
},
|
|
5869
|
+
async getWorkerAccess() {
|
|
5870
|
+
return readWorkerAccess(ctx);
|
|
5871
|
+
},
|
|
5872
|
+
async setWorkerAccess(choice) {
|
|
5873
|
+
saveWorkerAccess(ctx, choice);
|
|
5874
|
+
},
|
|
5618
5875
|
async openAccountPage() {
|
|
5619
5876
|
const base = ctx.env.CONVENO_API_URL || "https://api.conveno.dev";
|
|
5620
5877
|
openInBrowser(ctx.platform, `${base}/account`);
|
|
@@ -4,18 +4,18 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { delimiter, join, win32 } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { n as antigravityAdapter } from "./dist-
|
|
8
|
-
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-
|
|
9
|
-
import { t as codexAdapter } from "./dist-
|
|
10
|
-
import { t as grokAdapter } from "./dist-
|
|
7
|
+
import { n as antigravityAdapter } from "./dist-Bv1bmmme.js";
|
|
8
|
+
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-CvzyjOo4.js";
|
|
9
|
+
import { t as codexAdapter } from "./dist-DDzIkwf9.js";
|
|
10
|
+
import { t as grokAdapter } from "./dist-C4KljaIP.js";
|
|
11
11
|
import { t as createTheme } from "./dist-BRjg9CLd.js";
|
|
12
|
-
import { n as connect$1 } from "./dist-
|
|
13
|
-
import {
|
|
14
|
-
import "./dist-
|
|
12
|
+
import { n as connect$1 } from "./dist-C59LTq60.js";
|
|
13
|
+
import { An as MessageId, B as dataDir, Cn as CLI_KINDS, Dt as parsePs1ShimTarget, Et as parseCmdShimTarget, Ht as readCommandLine, It as planSpawn, Mt as pidAlive, O as baseName, Pn as RpcErrorCode, Rn as SessionId, T as attachAcpSession, Vt as readAncestry, W as detectRepo, cr as string, ct as isAntigravityApp, en as resolveWindowsCommand, f as SpawnError, gn as validateRename, ht as launcherText, i as ConvenoError, j as claimSpawnRecord, jn as OWNER_SESSION_ID, jt as pendingTurn, mt as launcherPath, nr as array, o as HEARTBEAT_INTERVAL_MS, on as spawnSession, or as number, qt as realSpawnDeps, rr as boolean, s as NOT_FROM_USER_NOTICE, tr as _enum, tt as formatInbox, u as SPAWN_CLIS, xt as needsQuoting } from "./dist-ZL7d4_97.js";
|
|
14
|
+
import "./dist-Bx22a5AV.js";
|
|
15
15
|
import { access } from "node:fs/promises";
|
|
16
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
// ../daemon/dist/server-
|
|
18
|
+
// ../daemon/dist/server-D8I5bfil.js
|
|
19
19
|
/** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
|
|
20
20
|
function defaultIsAlive(pid) {
|
|
21
21
|
try {
|
|
@@ -28,7 +28,7 @@ function defaultIsAlive(pid) {
|
|
|
28
28
|
`${OWNER_SESSION_ID}`;
|
|
29
29
|
SessionId.parse("0".repeat(26));
|
|
30
30
|
// ../mcp/dist/index.js
|
|
31
|
-
const SERVER_VERSION = "0.2.0-rc.
|
|
31
|
+
const SERVER_VERSION = "0.2.0-rc.15";
|
|
32
32
|
const ok = (text) => ({ content: [{
|
|
33
33
|
type: "text",
|
|
34
34
|
text
|
|
@@ -391,6 +391,24 @@ function createServer(opts) {
|
|
|
391
391
|
const plural = (n, one, many) => n === 1 ? one : many;
|
|
392
392
|
return [`Acknowledged ${res.acked} ${plural(res.acked, "message", "messages")}.`, unknown > 0 ? `${unknown} ${plural(unknown, "id was", "ids were")} not found.` : ""].filter(Boolean).join(" ");
|
|
393
393
|
}));
|
|
394
|
+
mcp.registerTool("answer_permission", {
|
|
395
|
+
description: "Answer a worker's permission request (sent to you as a 'wants to run' notice).",
|
|
396
|
+
inputSchema: {
|
|
397
|
+
request: string().min(1).max(64).describe("The request id from the notice."),
|
|
398
|
+
answer: _enum([
|
|
399
|
+
"allow",
|
|
400
|
+
"always",
|
|
401
|
+
"deny"
|
|
402
|
+
]).describe("allow: this once. always: also for the same call later. deny.")
|
|
403
|
+
}
|
|
404
|
+
}, tool(async (me, a) => {
|
|
405
|
+
await client["permission.answer"]({
|
|
406
|
+
sessionId: me.id,
|
|
407
|
+
requestId: a.request,
|
|
408
|
+
answer: a.answer === "allow" ? "allow_once" : a.answer === "always" ? "allow_always" : "deny"
|
|
409
|
+
});
|
|
410
|
+
return `Answered request ${a.request}: ${a.answer}.`;
|
|
411
|
+
}));
|
|
394
412
|
mcp.registerTool("rename", {
|
|
395
413
|
description: "Change this session's name. Use it when the user wants a name others can remember, such as `api-worker`.",
|
|
396
414
|
inputSchema: { name: string().min(1).describe("New name: 1 to 64 characters of lowercase letters, digits, '.', '_', '@' or '-'.") }
|
|
@@ -417,7 +435,10 @@ function createServer(opts) {
|
|
|
417
435
|
return a.text === "" ? "Status cleared." : "Status set.";
|
|
418
436
|
}));
|
|
419
437
|
const becomeLead = tool(async (me) => {
|
|
420
|
-
const res = await client["orchestrator.claim"]({
|
|
438
|
+
const res = await client["orchestrator.claim"]({
|
|
439
|
+
sessionId: me.id,
|
|
440
|
+
via: "tool"
|
|
441
|
+
});
|
|
421
442
|
if (!res.previous) return "You are now the lead. There was no previous holder.";
|
|
422
443
|
const { sessions } = await client["session.list"]({ includeOffline: true });
|
|
423
444
|
return `You are now the lead. Previous holder: ${sessions.find((s) => s.id === res.previous)?.name ?? res.previous}.`;
|
|
@@ -458,7 +479,11 @@ function createServer(opts) {
|
|
|
458
479
|
name: string().min(1).optional().describe("Session name: lowercase letters, digits, '.', '_', '@' or '-'."),
|
|
459
480
|
task: string().min(1).optional().describe("The first task for the new session."),
|
|
460
481
|
window: boolean().optional().describe("Open it in a visible terminal window instead of the background."),
|
|
461
|
-
|
|
482
|
+
access: _enum([
|
|
483
|
+
"read",
|
|
484
|
+
"edit",
|
|
485
|
+
"full"
|
|
486
|
+
]).optional().describe("Optional. What the worker may do without asking: read (look only), edit (also change files) or full (everything; the default unless the user changed it). Not for window workers.")
|
|
462
487
|
}
|
|
463
488
|
}, tool(async (me, a) => {
|
|
464
489
|
const deps = opts.spawnDeps ?? realSpawnDeps({
|
|
@@ -477,7 +502,7 @@ function createServer(opts) {
|
|
|
477
502
|
name: a.name,
|
|
478
503
|
task: a.task,
|
|
479
504
|
window: a.window ?? false,
|
|
480
|
-
|
|
505
|
+
access: a.access,
|
|
481
506
|
requester: me,
|
|
482
507
|
confineToHome: true,
|
|
483
508
|
timeoutMs: 45e3
|