@conveno/cli 0.2.0-rc.4 → 0.2.0-rc.5
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 +15 -8
- package/dist/{acp-Bs2yS0Qg.js → acp-BD7Oaerg.js} +3 -3
- package/dist/{args-DEYV4Ran.js → args-BRB8QEQM.js} +44 -7
- package/dist/bin.js +2 -2
- package/dist/daemon.js +228 -12
- package/dist/{dist-CuStS_nO.js → dist-BPPOKmbH.js} +3 -3
- package/dist/{dist-CfwMkSGH.js → dist-C8JRuLiZ.js} +1 -1
- package/dist/{dist-CiE50AoI.js → dist-CEJ2-wxh.js} +1 -1
- package/dist/{dist-BmpWfYuM.js → dist-E3XvoT1Q.js} +1 -1
- package/dist/{dist-DUqXHTRg.js → dist-TrWRppjR.js} +25 -6
- package/dist/{doctor-Bckon1ju.js → doctor-CzIGTeNT.js} +3 -3
- package/dist/{hook-DUMp43Xn.js → hook-CLB_muZS.js} +1 -1
- package/dist/{hook-entry-C-HTnddc.js → hook-entry-BlvSoNMm.js} +4 -4
- package/dist/hook-entry-CRDh36pe.js +1 -0
- package/dist/{main-ByyF0srt.js → main-CsCsyq2G.js} +218 -21
- package/dist/{run-BEhIahUS.js → run-CYH0CRbp.js} +39 -7
- package/dist/{runtime-BS-SUGVR.js → runtime-B1Pb9Qqg.js} +47 -20
- package/package.json +15 -15
- package/dist/hook-entry-DP6eq6qr.js +0 -1
|
@@ -5839,13 +5839,18 @@ const SessionStatus = _enum([
|
|
|
5839
5839
|
const SESSION_NAME_PATTERN = /^[a-z0-9][a-z0-9._@-]{0,63}$/;
|
|
5840
5840
|
/** Literal recipient meaning "whoever currently holds the orchestrator role". */
|
|
5841
5841
|
const ORCHESTRATOR_ALIAS = "orchestrator";
|
|
5842
|
+
/** Literal recipient, the same as `orchestrator`: whoever currently holds the lead role. */
|
|
5843
|
+
const LEAD_ALIAS = "lead";
|
|
5844
|
+
/** True for either name of the lead role. */
|
|
5845
|
+
const isLeadAlias = (to) => to === "lead" || to === "orchestrator";
|
|
5842
5846
|
/**
|
|
5843
|
-
* Names no session may take. `orchestrator` and `you` are recipient aliases; the others are the
|
|
5847
|
+
* Names no session may take. `orchestrator`, `lead` and `you` are recipient aliases; the others are the
|
|
5844
5848
|
* senders the daemon uses for its own messages, so a session must not pose as them.
|
|
5845
5849
|
*/
|
|
5846
5850
|
const RESERVED_SESSION_NAMES = [
|
|
5847
5851
|
"conveno",
|
|
5848
5852
|
ORCHESTRATOR_ALIAS,
|
|
5853
|
+
LEAD_ALIAS,
|
|
5849
5854
|
"you",
|
|
5850
5855
|
"system",
|
|
5851
5856
|
"user"
|
|
@@ -5875,9 +5880,10 @@ const Sha256Hex = string().regex(/^[0-9a-f]{64}$/, "expected lowercase hex sha-2
|
|
|
5875
5880
|
const Base64 = string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, "invalid base64");
|
|
5876
5881
|
const TEXT_MAX_BYTES = 65536;
|
|
5877
5882
|
const boundedText = (maxBytes) => string().refine((s) => utf8ByteLength(s) <= maxBytes, { message: `exceeds ${maxBytes} bytes` });
|
|
5878
|
-
/** A message recipient: a session id, a session name, `orchestrator
|
|
5883
|
+
/** A message recipient: a session id, a session name, `lead` (or `orchestrator`), or `you` (the owner). */
|
|
5879
5884
|
const Recipient = union([
|
|
5880
5885
|
literal(ORCHESTRATOR_ALIAS),
|
|
5886
|
+
literal(LEAD_ALIAS),
|
|
5881
5887
|
literal("you"),
|
|
5882
5888
|
SessionId,
|
|
5883
5889
|
SessionName,
|
|
@@ -9234,12 +9240,12 @@ function createWmiWalker(opts) {
|
|
|
9234
9240
|
};
|
|
9235
9241
|
}
|
|
9236
9242
|
/**
|
|
9237
|
-
* Resolve a recipient (`orchestrator`, session id or session name) to a session.
|
|
9243
|
+
* Resolve a recipient (`lead`, `orchestrator`, session id or session name) to a session.
|
|
9238
9244
|
* Names resolve among non-offline sessions only; an id may also name an offline session
|
|
9239
9245
|
* so a sender gets a clear error rather than "unknown".
|
|
9240
9246
|
*/
|
|
9241
9247
|
function resolveRecipient(to, sessions, holder) {
|
|
9242
|
-
if (to
|
|
9248
|
+
if (isLeadAlias(to)) {
|
|
9243
9249
|
const h = effectiveHolder(holder, sessions);
|
|
9244
9250
|
if (!h) throw new ConvenoError(RpcErrorCode.NotFound, NO_ORCHESTRATOR_MESSAGE);
|
|
9245
9251
|
return h;
|
|
@@ -9280,13 +9286,26 @@ async function detectRepo(cwd, fs) {
|
|
|
9280
9286
|
basename: baseName(cwd)
|
|
9281
9287
|
};
|
|
9282
9288
|
}
|
|
9289
|
+
/** `CONVENO_NOTIFY=0` (or `off`, `false`, `no`) switches desktop notifications off whatever was saved. */
|
|
9290
|
+
function notifyForcedOff(env) {
|
|
9291
|
+
const v = env.CONVENO_NOTIFY?.trim().toLowerCase();
|
|
9292
|
+
return v === "0" || v === "off" || v === "false" || v === "no";
|
|
9293
|
+
}
|
|
9294
|
+
/** Whether desktop notifications are wanted: on unless forced off or saved as off. */
|
|
9295
|
+
function notifyDesktopWanted(path, env) {
|
|
9296
|
+
if (notifyForcedOff(env)) return false;
|
|
9297
|
+
return readSettings(path).notifyDesktop !== false;
|
|
9298
|
+
}
|
|
9283
9299
|
/** Read the settings. A missing, unreadable or malformed file gives no settings. */
|
|
9284
9300
|
function readSettings(path) {
|
|
9285
9301
|
try {
|
|
9286
9302
|
const v = JSON.parse(readFileSync(path, "utf8"));
|
|
9287
9303
|
if (typeof v !== "object" || v === null) return {};
|
|
9288
9304
|
const o = v;
|
|
9289
|
-
return
|
|
9305
|
+
return {
|
|
9306
|
+
...typeof o.acpAdapterNpx === "boolean" ? { acpAdapterNpx: o.acpAdapterNpx } : {},
|
|
9307
|
+
...typeof o.notifyDesktop === "boolean" ? { notifyDesktop: o.notifyDesktop } : {}
|
|
9308
|
+
};
|
|
9290
9309
|
} catch {
|
|
9291
9310
|
return {};
|
|
9292
9311
|
}
|
|
@@ -10556,4 +10575,4 @@ async function waitForRegistration(deps, w) {
|
|
|
10556
10575
|
await deps.sleep(250);
|
|
10557
10576
|
}
|
|
10558
10577
|
}
|
|
10559
|
-
export { isAllowed as $,
|
|
10578
|
+
export { isAllowed as $, literal as $n, toIso as $t, currentAccessToken as A, TicketId as An, readHeadLine as At, effectiveHolder as B, newDeviceId as Bn, resolveRecipient as Bt, claimOrchestrator as C, RpcResponse as Cn, planSpawn as Ct, compatStatus as D, SessionNamePattern as Dn, readAccountTokens as Dt, clientProof as E, SessionNameInput as En, putInList as Et, defaultProcessIo as F, isLeadAlias as Fn, realSpawnDeps as Ft, fetchAccountStatus as G, parseRelayFrame as Gn, spawnRecordPath as Gt, entriesNewestFirst as H, newSessionId as Hn, runLaunchFile as Ht, describeToolCall as I, isSocketPathTooLong as In, recordCliInfo as It, formatInbox as J, socketPathTooLongMessage as Jn, statusAfterLiveness as Jt, findOnPath as K, safeParse as Kn, spawnSession as Kt, detectRepo as L, makeError as Ln, relayPermission as Lt, dataDir as M, defaultSocketPath as Mn, readSettings as Mt, dataPaths as N, encodeFrame as Nn, readSpawnRecord as Nt, completeLogin as O, TICKET_STATUSES as On, readAncestry as Ot, decideAutoContinue as P, ipcMethods as Pn, readTailLines as Pt, holderAfterDeparture as Q, discriminatedUnion as Qn, takeWithinBytes as Qt, dropFromList as R, makeEventNotification as Rn, requestDeviceCode as Rt, bindAccountDevice as S, RpcErrorCode as Sn, pinnedAdapter as St, classifyPermission as T, SessionName as Tn, proofsMatch as Tt, evaluateLiveness as U, newTicketId as Un, sameJson as Ut, endTurnContinuation as V, newMessageId as Vn, resolveWindowsCommand as Vt, existedBefore as W, parseIpcRequest as Wn, samePath as Wt, formatPermissionDecision as X, array as Xn, tailJsonl as Xt, formatPeek as Y, _enum as Yn, subdirsNewestFirst as Yt, generateSessionName as Z, boolean as Zn, takeAcpLaunchFile as Zt, asString as _, ORCHESTRATOR_ALIAS as _n, parsePs1ShimTarget as _t, NOT_FROM_USER_NOTICE as a, waitForWork as an, jwtClaim as at, autoLimitsFromEnv as b, PROTOCOL_VERSION as bn, pendingHookContext as bt, SPAWN_CLIS as c, CLI_KINDS as cn, markDelivered as ct, ackEntries as d, EVENT_NAMES as dn, notFound as dt, tooManyUnreadMessage as en, number as er, isObject as et, acpOverrideVar as f, EVENT_NOTIFICATION_METHOD as fn, notifyDesktopWanted as ft, adapterNpxCommand as g, MessageId as gn, parseCmdShimTarget as gt, adapterInstallCommand as h, Message as hn, parseCliVersion as ht, HEARTBEAT_INTERVAL_MS as i, validateRename as in, isTranscriptPath as it, daemonProof as j, createLineDecoder as jn, readInbox as jt, createWmiWalker as k, Ticket as kn, readCommandLine as kt, SPAWN_TABLE as l, CliKind as ln, nameMatchesPattern as lt, acpTurnsPath as m, HUMAN_ANSWERER as mn, parseAllowPatterns as mt, AccountError as n, unsupportedTranscript as nn, string as nr, isPermissionHook as nt, PERMISSION_HOOK_BUDGET_MS as o, writeSettings as on, loadJson as ot, acpTranscript as p, EventPayload as pn, notifyForcedOff as pt, formatContinuation as q, sanitizeLine as qn, startTurnContext as qt, ConvenoError as r, updateSpawnRecord as rn, isRecord as rt, RESPONSE_BUDGET_BYTES as s, AUTO_LIMIT_MAX as sn, logoutAccount as st, ACCOUNT_API as t, turnHops as tn, object as tr, isOnline as tt, SpawnError as u, DeviceId as un, newAuthNonce as ut, attachAcpSession as v, OWNER_SESSION_ID as vn, pauseLabel as vt, claimSpawnRecord as w, SessionId as wn, pollDeviceCode as wt, baseName as x, RelayPayload as xn, pickNewestSince as xt, autoCandidates as y, PERMISSION_ANSWERS as yn, pendingForInjection as yt, editJson as z, makeResult as zn, resolveAcpProgram as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ClientError } from "./dist-
|
|
3
|
-
import { a as closest, c as errorBlock, d as plainError, f as plural, h as warnBlock, i as parseFlags, l as fail, m as tilde, o as cmd, p as seconds, s as columns, t as COMMANDS, u as localStamp } from "./args-
|
|
1
|
+
import { D as compatStatus, Dt as readAccountTokens, G as fetchAccountStatus, K as findOnPath, Mt as readSettings, N as dataPaths, O as completeLogin, Rt as requestDeviceCode, St as pinnedAdapter, cn as CLI_KINDS, f as acpOverrideVar, g as adapterNpxCommand, h as adapterInstallCommand, l as SPAWN_TABLE, n as AccountError, on as writeSettings, st as logoutAccount, wt as pollDeviceCode, zt as resolveAcpProgram } from "./dist-TrWRppjR.js";
|
|
2
|
+
import { t as ClientError } from "./dist-CEJ2-wxh.js";
|
|
3
|
+
import { a as closest, c as errorBlock, d as plainError, f as plural, h as warnBlock, i as parseFlags, l as fail, m as tilde, o as cmd, p as seconds, s as columns, t as COMMANDS, u as localStamp } from "./args-BRB8QEQM.js";
|
|
4
4
|
import { n as connectOpts, t as adapterEnv } from "./ctx-CDLE-2f2.js";
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
6
6
|
import { chmod, mkdir, open, readFile, readdir, realpath, rename as rename$1, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { Et as
|
|
4
|
-
import { a as Za, n as opencodeAdapter, o as cs, r as codexAdapter, s as claudeAdapter } from "./dist-
|
|
3
|
+
import { Et as putInList, M as dataDir, Ot as readAncestry, R as dropFromList, Ut as sameJson, V as endTurnContinuation, W as existedBefore, bt as pendingHookContext, et as isObject, ht as parseCliVersion, ot as loadJson, qt as startTurnContext, z as editJson } from "./dist-TrWRppjR.js";
|
|
4
|
+
import { a as Za, n as opencodeAdapter, o as cs, r as codexAdapter, s as claudeAdapter } from "./dist-C8JRuLiZ.js";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
|
-
import { n as connect } from "./dist-
|
|
7
|
-
import { t as runHook } from "./hook-
|
|
6
|
+
import { n as connect } from "./dist-CEJ2-wxh.js";
|
|
7
|
+
import { t as runHook } from "./hook-CLB_muZS.js";
|
|
8
8
|
// ../adapters/antigravity/dist/index.js
|
|
9
9
|
const SERVER_NAME$3 = "conveno";
|
|
10
10
|
/** The name of our entry in hooks.json. Antigravity keys hooks by an arbitrary name. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as runHookEntry } from "./hook-entry-BlvSoNMm.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as runLogout, S as runLogin, _ as runDevices, a as detectAll, c as staleFailure, d as listManifests, f as markRestored, i as confirmAndApply, l as StaleError, m as restoreEntry, n as runDoctor, o as reportFailures, p as previewRestore, r as collectPlans, s as runInit, u as applyChanges, v as runRelay, x as runAccount, y as daemonProblem } from "./doctor-
|
|
3
|
-
import { a as closest, d as plainError, f as plural, h as warnBlock, i as parseFlags, l as fail, m as tilde, n as COMMAND_NAMES, o as cmd, p as seconds, r as commandHelp, s as columns, t as COMMANDS, u as localStamp } from "./args-
|
|
1
|
+
import { An as TicketId, Dn as SessionNamePattern, En as SessionNameInput, Ft as realSpawnDeps, Ht as runLaunchFile, Kt as spawnSession, N as dataPaths, Sn as RpcErrorCode, Tn as SessionName, c as SPAWN_CLIS, cn as CLI_KINDS, l as SPAWN_TABLE, qn as sanitizeLine, r as ConvenoError, sn as AUTO_LIMIT_MAX, u as SpawnError, vt as pauseLabel, wn as SessionId } from "./dist-TrWRppjR.js";
|
|
2
|
+
import { C as runLogout, S as runLogin, _ as runDevices, a as detectAll, c as staleFailure, d as listManifests, f as markRestored, i as confirmAndApply, l as StaleError, m as restoreEntry, n as runDoctor, o as reportFailures, p as previewRestore, r as collectPlans, s as runInit, u as applyChanges, v as runRelay, x as runAccount, y as daemonProblem } from "./doctor-CzIGTeNT.js";
|
|
3
|
+
import { a as closest, d as plainError, f as plural, h as warnBlock, i as parseFlags, l as fail, m as tilde, n as COMMAND_NAMES, o as cmd, p as seconds, r as commandHelp, s as columns, t as COMMANDS, u as localStamp } from "./args-BRB8QEQM.js";
|
|
4
4
|
import { n as connectOpts, t as adapterEnv } from "./ctx-CDLE-2f2.js";
|
|
5
5
|
import { access, chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
6
6
|
import { join, resolve } from "node:path";
|
|
7
|
-
import { t as runHook } from "./hook-
|
|
7
|
+
import { t as runHook } from "./hook-CLB_muZS.js";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
// src/status.ts
|
|
10
10
|
const CLI_SHORT = {
|
|
@@ -453,7 +453,7 @@ async function runDaemon(ctx, argv) {
|
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
// src/version.ts
|
|
456
|
-
const VERSION = "0.2.0-rc.
|
|
456
|
+
const VERSION = "0.2.0-rc.5";
|
|
457
457
|
// src/errorLog.ts
|
|
458
458
|
/** The message of an unexpected error, as it is. Not the softened text `plainError` gives. */
|
|
459
459
|
function rawMessage(e) {
|
|
@@ -613,6 +613,75 @@ async function runForget(ctx, argv) {
|
|
|
613
613
|
await client.close().catch(() => void 0);
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
+
// src/pick.ts
|
|
617
|
+
/**
|
|
618
|
+
* The session a name or id means. A name means the online session that has it; with none online
|
|
619
|
+
* it falls back to the newest offline one. Returns undefined when nothing matches.
|
|
620
|
+
*/
|
|
621
|
+
async function findSession(client, text) {
|
|
622
|
+
const { sessions } = await client["session.list"]({ includeOffline: true });
|
|
623
|
+
if (SessionId.safeParse(text).success) return sessions.find((s) => s.id === text);
|
|
624
|
+
const named = sessions.filter((s) => s.name === text);
|
|
625
|
+
return named.find((s) => s.status !== "offline") ?? named[0];
|
|
626
|
+
}
|
|
627
|
+
// src/lead.ts
|
|
628
|
+
/** `conveno lead <session>`: make that session the lead. */
|
|
629
|
+
async function runLead(ctx, argv) {
|
|
630
|
+
const t = ctx.theme;
|
|
631
|
+
const spec = COMMANDS.find((c) => c.name === "lead");
|
|
632
|
+
if (!spec) return 2;
|
|
633
|
+
const parsed = parseFlags(ctx, spec, argv);
|
|
634
|
+
if (typeof parsed === "number") return parsed;
|
|
635
|
+
const [session, ...extra] = parsed.positionals;
|
|
636
|
+
if (!session || extra.length > 0) return fail(ctx, {
|
|
637
|
+
what: "conveno lead needs one session",
|
|
638
|
+
fix: `For example ${cmd(t, "conveno lead planner")}. ${cmd(t, "conveno status")} lists the names.`,
|
|
639
|
+
exit: 2,
|
|
640
|
+
ref: "e_usage"
|
|
641
|
+
});
|
|
642
|
+
let client;
|
|
643
|
+
try {
|
|
644
|
+
client = await ctx.connect(connectOpts(ctx, false));
|
|
645
|
+
} catch (e) {
|
|
646
|
+
const problem = daemonProblem(t, e);
|
|
647
|
+
return fail(ctx, {
|
|
648
|
+
what: problem.notRunning ? "The Conveno daemon is not running" : "The Conveno daemon cannot be reached",
|
|
649
|
+
detail: [problem.notRunning ? "There are no sessions to pick from." : problem.why],
|
|
650
|
+
fix: problem.notRunning ? `Run ${cmd(t, "conveno daemon start")}.` : problem.fix,
|
|
651
|
+
exit: 1,
|
|
652
|
+
ref: "e_daemon"
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
try {
|
|
656
|
+
const found = await findSession(client, session);
|
|
657
|
+
if (!found) return fail(ctx, {
|
|
658
|
+
what: `No session "${session}"`,
|
|
659
|
+
fix: `Run ${cmd(t, "conveno status")} to see the names.`,
|
|
660
|
+
exit: 1,
|
|
661
|
+
ref: "e_session"
|
|
662
|
+
});
|
|
663
|
+
if (found.status === "offline") return fail(ctx, {
|
|
664
|
+
what: `${found.name} is offline`,
|
|
665
|
+
detail: ["Only a session that is online can be the lead."],
|
|
666
|
+
fix: `Run ${cmd(t, "conveno status")} to see who is online.`,
|
|
667
|
+
exit: 1,
|
|
668
|
+
ref: "e_session"
|
|
669
|
+
});
|
|
670
|
+
await client["orchestrator.claim"]({ sessionId: found.id });
|
|
671
|
+
ctx.out(`${t.status("ok")} ${t.bold(found.name)} is the lead now.\n`);
|
|
672
|
+
return 0;
|
|
673
|
+
} catch (e) {
|
|
674
|
+
return fail(ctx, {
|
|
675
|
+
what: "The lead was not changed",
|
|
676
|
+
detail: [plainError(e)],
|
|
677
|
+
fix: `Run ${cmd(t, "conveno status")} to see the sessions.`,
|
|
678
|
+
exit: 1,
|
|
679
|
+
ref: "e_lead"
|
|
680
|
+
});
|
|
681
|
+
} finally {
|
|
682
|
+
await client.close().catch(() => void 0);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
616
685
|
// src/peek.ts
|
|
617
686
|
async function connectOrFail(ctx) {
|
|
618
687
|
const t = ctx.theme;
|
|
@@ -761,12 +830,12 @@ const oneLine = (text, max) => {
|
|
|
761
830
|
const headline = (t) => oneLine(t.question.split("\n")[0] ?? "", 70);
|
|
762
831
|
async function runTickets(ctx, argv) {
|
|
763
832
|
const t = ctx.theme;
|
|
764
|
-
const spec = COMMANDS.find((c) => c.name === "
|
|
833
|
+
const spec = COMMANDS.find((c) => c.name === "questions");
|
|
765
834
|
if (!spec) return 2;
|
|
766
835
|
const parsed = parseFlags(ctx, spec, argv);
|
|
767
836
|
if (typeof parsed === "number") return parsed;
|
|
768
837
|
const openOnly = parsed.values.open === true;
|
|
769
|
-
const client = await connectRunning(ctx, "
|
|
838
|
+
const client = await connectRunning(ctx, "Questions live in the daemon, so there are none to list.");
|
|
770
839
|
if ("exit" in client) return client.exit;
|
|
771
840
|
try {
|
|
772
841
|
const res = await client["ticket.list"]({
|
|
@@ -776,7 +845,7 @@ async function runTickets(ctx, argv) {
|
|
|
776
845
|
const names = new Map((await client["session.list"]({ includeOffline: true })).sessions.map((s) => [s.id, s.name]));
|
|
777
846
|
const who = (id) => names.get(id) ?? id.slice(-6);
|
|
778
847
|
if (res.tickets.length === 0) {
|
|
779
|
-
ctx.out(`${t.status("info")} ${openOnly ? "No open
|
|
848
|
+
ctx.out(`${t.status("info")} ${openOnly ? "No open questions." : "No questions yet."} ${t.paint("quiet", "Workers ask with the ask tool.")}\n`);
|
|
780
849
|
return 0;
|
|
781
850
|
}
|
|
782
851
|
const q = (w) => t.paint("quiet", w);
|
|
@@ -797,7 +866,7 @@ async function runTickets(ctx, argv) {
|
|
|
797
866
|
])];
|
|
798
867
|
ctx.out(`${columns(rows).join("\n")}\n\n`);
|
|
799
868
|
const hint = res.openCount > 0 ? ` Answer with ${cmd(t, "conveno answer <ticket> <text>")}.` : "";
|
|
800
|
-
ctx.out(`${plural(res.openCount, "open
|
|
869
|
+
ctx.out(`${plural(res.openCount, "open question")}.${hint}\n`);
|
|
801
870
|
return 0;
|
|
802
871
|
} finally {
|
|
803
872
|
await client.close().catch(() => void 0);
|
|
@@ -822,7 +891,7 @@ async function runAnswer(ctx, argv) {
|
|
|
822
891
|
const response = words.join(" ").trim();
|
|
823
892
|
if (!id || response === "") return fail(ctx, {
|
|
824
893
|
what: "conveno answer needs a ticket and an answer",
|
|
825
|
-
fix: `For example ${cmd(t, "conveno answer 01J8ABCD \"Use sqlite\"")}. ${cmd(t, "conveno
|
|
894
|
+
fix: `For example ${cmd(t, "conveno answer 01J8ABCD \"Use sqlite\"")}. ${cmd(t, "conveno questions --open")} lists the open questions.`,
|
|
826
895
|
exit: 2,
|
|
827
896
|
ref: "e_usage"
|
|
828
897
|
});
|
|
@@ -833,7 +902,7 @@ async function runAnswer(ctx, argv) {
|
|
|
833
902
|
const picked = pickTicket(tickets, id);
|
|
834
903
|
if (typeof picked === "string") return fail(ctx, {
|
|
835
904
|
what: picked,
|
|
836
|
-
fix: `Run ${cmd(t, "conveno
|
|
905
|
+
fix: `Run ${cmd(t, "conveno questions --open")} to see the open questions.`,
|
|
837
906
|
exit: 1,
|
|
838
907
|
ref: "e_ticket"
|
|
839
908
|
});
|
|
@@ -848,7 +917,7 @@ async function runAnswer(ctx, argv) {
|
|
|
848
917
|
return fail(ctx, {
|
|
849
918
|
what: "The ticket could not be answered",
|
|
850
919
|
detail: [e instanceof Error ? e.message : String(e)],
|
|
851
|
-
fix: `Run ${cmd(t, "conveno
|
|
920
|
+
fix: `Run ${cmd(t, "conveno questions")} to see its state.`,
|
|
852
921
|
exit: 1,
|
|
853
922
|
ref: "e_ticket"
|
|
854
923
|
});
|
|
@@ -997,6 +1066,117 @@ async function runPermissions(ctx, argv) {
|
|
|
997
1066
|
await client.close().catch(() => void 0);
|
|
998
1067
|
}
|
|
999
1068
|
}
|
|
1069
|
+
// src/rename.ts
|
|
1070
|
+
/** `conveno rename <session> <new-name>`. */
|
|
1071
|
+
async function runRename(ctx, argv) {
|
|
1072
|
+
const t = ctx.theme;
|
|
1073
|
+
const spec = COMMANDS.find((c) => c.name === "rename");
|
|
1074
|
+
if (!spec) return 2;
|
|
1075
|
+
const parsed = parseFlags(ctx, spec, argv);
|
|
1076
|
+
if (typeof parsed === "number") return parsed;
|
|
1077
|
+
const [session, name, ...extra] = parsed.positionals;
|
|
1078
|
+
if (!session || !name || extra.length > 0) return fail(ctx, {
|
|
1079
|
+
what: "conveno rename needs a session and a new name",
|
|
1080
|
+
fix: `For example ${cmd(t, "conveno rename claude@app-1 planner")}.`,
|
|
1081
|
+
exit: 2,
|
|
1082
|
+
ref: "e_usage"
|
|
1083
|
+
});
|
|
1084
|
+
let client;
|
|
1085
|
+
try {
|
|
1086
|
+
client = await ctx.connect(connectOpts(ctx, false));
|
|
1087
|
+
} catch (e) {
|
|
1088
|
+
const problem = daemonProblem(t, e);
|
|
1089
|
+
return fail(ctx, {
|
|
1090
|
+
what: problem.notRunning ? "The Conveno daemon is not running" : "The Conveno daemon cannot be reached",
|
|
1091
|
+
detail: [problem.notRunning ? "There are no sessions to rename." : problem.why],
|
|
1092
|
+
fix: problem.notRunning ? `Run ${cmd(t, "conveno daemon start")}.` : problem.fix,
|
|
1093
|
+
exit: 1,
|
|
1094
|
+
ref: "e_daemon"
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
try {
|
|
1098
|
+
const found = await findSession(client, session);
|
|
1099
|
+
if (!found) return fail(ctx, {
|
|
1100
|
+
what: `No session "${session}"`,
|
|
1101
|
+
fix: `Run ${cmd(t, "conveno status")} to see the names.`,
|
|
1102
|
+
exit: 1,
|
|
1103
|
+
ref: "e_session"
|
|
1104
|
+
});
|
|
1105
|
+
if (found.status === "offline") return fail(ctx, {
|
|
1106
|
+
what: `${found.name} is offline`,
|
|
1107
|
+
detail: ["Only a session that is online can be renamed."],
|
|
1108
|
+
fix: `Run ${cmd(t, "conveno status")} to see who is online.`,
|
|
1109
|
+
exit: 1,
|
|
1110
|
+
ref: "e_session"
|
|
1111
|
+
});
|
|
1112
|
+
const res = await client["session.rename"]({
|
|
1113
|
+
sessionId: found.id,
|
|
1114
|
+
name
|
|
1115
|
+
});
|
|
1116
|
+
ctx.out(`${t.status("ok")} ${t.bold(found.name)} is now ${t.bold(res.session.name)}.\n`);
|
|
1117
|
+
return 0;
|
|
1118
|
+
} catch (e) {
|
|
1119
|
+
return fail(ctx, {
|
|
1120
|
+
what: "The session was not renamed",
|
|
1121
|
+
detail: [plainError(e)],
|
|
1122
|
+
fix: `Pick another name, or run ${cmd(t, "conveno status")} to see the names in use.`,
|
|
1123
|
+
exit: 1,
|
|
1124
|
+
ref: "e_rename"
|
|
1125
|
+
});
|
|
1126
|
+
} finally {
|
|
1127
|
+
await client.close().catch(() => void 0);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
// src/send.ts
|
|
1131
|
+
/** `conveno send <to> <text...>`: send a message as you, the owner. */
|
|
1132
|
+
async function runSend(ctx, argv) {
|
|
1133
|
+
const t = ctx.theme;
|
|
1134
|
+
const spec = COMMANDS.find((c) => c.name === "send");
|
|
1135
|
+
if (!spec) return 2;
|
|
1136
|
+
const parsed = parseFlags(ctx, spec, argv);
|
|
1137
|
+
if (typeof parsed === "number") return parsed;
|
|
1138
|
+
const [to, ...words] = parsed.positionals;
|
|
1139
|
+
let text = words.join(" ");
|
|
1140
|
+
if (words.length === 1 && words[0] === "-") text = (await ctx.readStdin()).replace(/\s+$/, "");
|
|
1141
|
+
if (!to || text.trim() === "") return fail(ctx, {
|
|
1142
|
+
what: "conveno send needs a recipient and a text",
|
|
1143
|
+
fix: `For example ${cmd(t, "conveno send lead \"Please start with the tests\"")}, or ${cmd(t, "conveno send worker -")} to read the text from standard input.`,
|
|
1144
|
+
exit: 2,
|
|
1145
|
+
ref: "e_usage"
|
|
1146
|
+
});
|
|
1147
|
+
let client;
|
|
1148
|
+
try {
|
|
1149
|
+
client = await ctx.connect(connectOpts(ctx, false));
|
|
1150
|
+
} catch (e) {
|
|
1151
|
+
const problem = daemonProblem(t, e);
|
|
1152
|
+
return fail(ctx, {
|
|
1153
|
+
what: problem.notRunning ? "The Conveno daemon is not running" : "The Conveno daemon cannot be reached",
|
|
1154
|
+
detail: [problem.notRunning ? "Nobody can get the message." : problem.why],
|
|
1155
|
+
fix: problem.notRunning ? `Run ${cmd(t, "conveno daemon start")}.` : problem.fix,
|
|
1156
|
+
exit: 1,
|
|
1157
|
+
ref: "e_daemon"
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
try {
|
|
1161
|
+
const res = await client["owner.send"]({
|
|
1162
|
+
to,
|
|
1163
|
+
text,
|
|
1164
|
+
urgent: parsed.values.urgent === true
|
|
1165
|
+
});
|
|
1166
|
+
ctx.out(`${t.status("ok")} Sent to ${t.bold(res.deliveredTo.name)}.\n`);
|
|
1167
|
+
return 0;
|
|
1168
|
+
} catch (e) {
|
|
1169
|
+
return fail(ctx, {
|
|
1170
|
+
what: "The message was not sent",
|
|
1171
|
+
detail: [plainError(e)],
|
|
1172
|
+
fix: `Run ${cmd(t, "conveno status")} to see the session names.`,
|
|
1173
|
+
exit: 1,
|
|
1174
|
+
ref: "e_send"
|
|
1175
|
+
});
|
|
1176
|
+
} finally {
|
|
1177
|
+
await client.close().catch(() => void 0);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1000
1180
|
// src/spawn.ts
|
|
1001
1181
|
/** Read the task from `--task-file`. Returns the text or the failure's exit code. */
|
|
1002
1182
|
function readTaskFile(ctx, path) {
|
|
@@ -1053,15 +1233,27 @@ async function runSpawn(ctx, argv) {
|
|
|
1053
1233
|
if (typeof text === "number") return text;
|
|
1054
1234
|
task = text;
|
|
1055
1235
|
}
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1236
|
+
const mode = str("mode");
|
|
1237
|
+
if (mode !== void 0 && ![
|
|
1238
|
+
"window",
|
|
1239
|
+
"background",
|
|
1240
|
+
"once"
|
|
1241
|
+
].includes(mode)) return fail(ctx, {
|
|
1242
|
+
what: `"${mode}" is not a spawn mode`,
|
|
1243
|
+
detail: ["Modes: window (a terminal you can watch), background, once (one task, then it ends)."],
|
|
1244
|
+
fix: help,
|
|
1245
|
+
exit: 2,
|
|
1246
|
+
ref: "e_usage"
|
|
1247
|
+
});
|
|
1248
|
+
const acpFlag = mode === void 0 ? parsed.values.acp === true : mode === "background";
|
|
1249
|
+
const oneShot = mode === void 0 ? parsed.values["one-shot"] === true : mode === "once";
|
|
1058
1250
|
if (acpFlag && oneShot) return fail(ctx, {
|
|
1059
1251
|
what: "Use --acp or --one-shot, not both",
|
|
1060
1252
|
fix: help,
|
|
1061
1253
|
exit: 2,
|
|
1062
1254
|
ref: "e_usage"
|
|
1063
1255
|
});
|
|
1064
|
-
const headless = parsed.values.headless === true || acpFlag || oneShot;
|
|
1256
|
+
const headless = mode === void 0 ? parsed.values.headless === true || acpFlag || oneShot : mode !== "window";
|
|
1065
1257
|
const acp = acpFlag ? "require" : headless && !oneShot ? "prefer" : void 0;
|
|
1066
1258
|
const allowFlag = str("allow");
|
|
1067
1259
|
const allow = allowFlag === void 0 ? void 0 : [allowFlag];
|
|
@@ -1354,7 +1546,9 @@ async function runMcp(ctx, argv) {
|
|
|
1354
1546
|
});
|
|
1355
1547
|
}
|
|
1356
1548
|
}
|
|
1357
|
-
async function dispatch(
|
|
1549
|
+
async function dispatch(name, rest, ctx) {
|
|
1550
|
+
let command = name;
|
|
1551
|
+
if (command === "tickets") command = "questions";
|
|
1358
1552
|
const spec = COMMANDS.find((c) => c.name === command);
|
|
1359
1553
|
if (spec && (rest.includes("--help") || rest.includes("-h")) && command !== "hook") {
|
|
1360
1554
|
ctx.out(commandHelp(ctx, spec));
|
|
@@ -1364,14 +1558,17 @@ async function dispatch(command, rest, ctx) {
|
|
|
1364
1558
|
case "init": return runInit(ctx, rest);
|
|
1365
1559
|
case "uninstall": return runUninstall(ctx, rest);
|
|
1366
1560
|
case "status": return runStatus(ctx, rest);
|
|
1367
|
-
case "
|
|
1561
|
+
case "questions": return runTickets(ctx, rest);
|
|
1562
|
+
case "send": return runSend(ctx, rest);
|
|
1563
|
+
case "rename": return runRename(ctx, rest);
|
|
1564
|
+
case "lead": return runLead(ctx, rest);
|
|
1368
1565
|
case "answer": return runAnswer(ctx, rest);
|
|
1369
1566
|
case "permissions": return runPermissions(ctx, rest);
|
|
1370
1567
|
case "forget": return runForget(ctx, rest);
|
|
1371
1568
|
case "spawn": return runSpawn(ctx, rest);
|
|
1372
|
-
case "acp-host": return (await import("./acp-
|
|
1373
|
-
case "stop": return (await import("./acp-
|
|
1374
|
-
case "attach": return (await import("./acp-
|
|
1569
|
+
case "acp-host": return (await import("./acp-BD7Oaerg.js")).runAcpHostCmd(ctx, rest);
|
|
1570
|
+
case "stop": return (await import("./acp-BD7Oaerg.js")).runStop(ctx, rest);
|
|
1571
|
+
case "attach": return (await import("./acp-BD7Oaerg.js")).runAttach(ctx, rest);
|
|
1375
1572
|
case "spawn-run": return runSpawnRun(ctx, rest);
|
|
1376
1573
|
case "auto": return runAuto(ctx, rest);
|
|
1377
1574
|
case "peek": return runPeek(ctx, rest);
|
|
@@ -1413,7 +1610,7 @@ function opensApp(env, tty = {
|
|
|
1413
1610
|
async function main(argv, ctx) {
|
|
1414
1611
|
const [command, ...rest] = argv;
|
|
1415
1612
|
if (command === void 0 && opensApp(ctx.env)) try {
|
|
1416
|
-
return await (await import("./run-
|
|
1613
|
+
return await (await import("./run-CYH0CRbp.js")).runTui(ctx);
|
|
1417
1614
|
} catch (e) {
|
|
1418
1615
|
ctx.err(`The app could not start (${rawMessage(e)}). Showing the help instead.\n`);
|
|
1419
1616
|
ctx.out(helpText(ctx));
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Box, Text, render, useApp, useInput, useStdin, useWindowSize } from "ink";
|
|
2
2
|
import { n as connectOpts, t as adapterEnv } from "./ctx-CDLE-2f2.js";
|
|
3
|
-
import { b as openInBrowser, g as PAIR_TIMEOUT_MS, h as unifiedDiff, l as StaleError, r as collectPlans, t as inspect, u as applyChanges, y as daemonProblem } from "./doctor-
|
|
4
|
-
import { d as plainError, l as fail, m as tilde, o as cmd } from "./args-
|
|
3
|
+
import { b as openInBrowser, g as PAIR_TIMEOUT_MS, h as unifiedDiff, l as StaleError, r as collectPlans, t as inspect, u as applyChanges, y as daemonProblem } from "./doctor-CzIGTeNT.js";
|
|
4
|
+
import { d as plainError, l as fail, m as tilde, o as cmd } from "./args-BRB8QEQM.js";
|
|
5
5
|
import { createContext, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
|
-
import {
|
|
8
|
+
import { D as compatStatus, Dt as readAccountTokens, Fn as isLeadAlias, Ft as realSpawnDeps, G as fetchAccountStatus, Gt as spawnRecordPath, Kt as spawnSession, Mt as readSettings, N as dataPaths, Nt as readSpawnRecord, l as SPAWN_TABLE, on as writeSettings, pt as notifyForcedOff, vn as OWNER_SESSION_ID, yn as PERMISSION_ANSWERS } from "./dist-TrWRppjR.js";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
10
|
import { i as tokens, n as detectColorLevel, r as detectUnicode } from "./dist-BRjg9CLd.js";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { basename, join, resolve } from "node:path";
|
|
13
|
-
import { i as stopRequestPath, t as killProcessTree } from "./dist-
|
|
13
|
+
import { i as stopRequestPath, t as killProcessTree } from "./dist-BPPOKmbH.js";
|
|
14
14
|
// \0rolldown/runtime.js
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
16
16
|
var __exportAll = (all, flags) => {
|
|
@@ -3592,7 +3592,7 @@ function SetupScreen(props) {
|
|
|
3592
3592
|
const mouse = useMouseControl();
|
|
3593
3593
|
const mouseOn = mouse.enabled;
|
|
3594
3594
|
const asked = useRef(false);
|
|
3595
|
-
const total = clis.length +
|
|
3595
|
+
const total = clis.length + 4;
|
|
3596
3596
|
const at = Math.min(cursor, Math.max(0, total - 1));
|
|
3597
3597
|
const onCli = at < clis.length ? clis[at] : void 0;
|
|
3598
3598
|
const extraRow = at >= clis.length ? at - clis.length : -1;
|
|
@@ -3665,6 +3665,21 @@ function SetupScreen(props) {
|
|
|
3665
3665
|
toast(next ? "Mouse is on." : "Mouse is off.", "ok");
|
|
3666
3666
|
return;
|
|
3667
3667
|
}
|
|
3668
|
+
if (row === 3) {
|
|
3669
|
+
if (extras.notifyForcedOff) {
|
|
3670
|
+
toast("Desktop alerts are off because CONVENO_NOTIFY=0 is set.", "warn");
|
|
3671
|
+
return;
|
|
3672
|
+
}
|
|
3673
|
+
const next = extras.notifyDesktop === false;
|
|
3674
|
+
actions.setNotify(next).then(() => {
|
|
3675
|
+
setExtras({
|
|
3676
|
+
...extras,
|
|
3677
|
+
notifyDesktop: next
|
|
3678
|
+
});
|
|
3679
|
+
toast(next ? "I'll tell you on the desktop." : "No desktop alerts.", "ok");
|
|
3680
|
+
}, () => toast("Couldn't change that. Try again.", "error"));
|
|
3681
|
+
return;
|
|
3682
|
+
}
|
|
3668
3683
|
if (row === 0) {
|
|
3669
3684
|
const next = !extras.helpers;
|
|
3670
3685
|
actions.setHelpers(next).then(() => {
|
|
@@ -4008,6 +4023,14 @@ function SetupScreen(props) {
|
|
|
4008
4023
|
isActive: active,
|
|
4009
4024
|
children: /* @__PURE__ */ jsx(Text, { children: `${cursorMark(extraRow === 2)} ${box(mouseOn)} Click and scroll with the mouse` })
|
|
4010
4025
|
}),
|
|
4026
|
+
/* @__PURE__ */ jsx(Hit, {
|
|
4027
|
+
onClick: () => {
|
|
4028
|
+
setCursor(clis.length + 3);
|
|
4029
|
+
setUp({ extra: 3 });
|
|
4030
|
+
},
|
|
4031
|
+
isActive: active,
|
|
4032
|
+
children: /* @__PURE__ */ jsx(Text, { children: `${cursorMark(extraRow === 3)} ${box(extras.notifyDesktop !== false && !extras.notifyForcedOff)} Tell me on the desktop when something needs me` })
|
|
4033
|
+
}),
|
|
4011
4034
|
!wide && health.length > 0 && rows >= 22 ? /* @__PURE__ */ jsxs(Box, {
|
|
4012
4035
|
flexDirection: "column",
|
|
4013
4036
|
marginTop: 1,
|
|
@@ -5334,13 +5357,19 @@ async function getExtras(ctx) {
|
|
|
5334
5357
|
}
|
|
5335
5358
|
return {
|
|
5336
5359
|
helpers,
|
|
5337
|
-
askBeforeRisky: any && all
|
|
5360
|
+
askBeforeRisky: any && all,
|
|
5361
|
+
notifyDesktop: readSettings(dataPaths(ctx.platform, ctx.dataDir).settings).notifyDesktop !== false,
|
|
5362
|
+
notifyForcedOff: notifyForcedOff(ctx.env)
|
|
5338
5363
|
};
|
|
5339
5364
|
}
|
|
5340
5365
|
/** Same answer as `conveno init --acp-adapters` / `--no-acp-adapters`. */
|
|
5341
5366
|
function setHelpers(ctx, on) {
|
|
5342
5367
|
writeSettings(dataPaths(ctx.platform, ctx.dataDir).settings, { acpAdapterNpx: on });
|
|
5343
5368
|
}
|
|
5369
|
+
/** Save the desktop notification choice. The daemon reads it on its next notification. */
|
|
5370
|
+
function setNotify(ctx, on) {
|
|
5371
|
+
writeSettings(dataPaths(ctx.platform, ctx.dataDir).settings, { notifyDesktop: on });
|
|
5372
|
+
}
|
|
5344
5373
|
// src/tui/store.ts
|
|
5345
5374
|
/**
|
|
5346
5375
|
* The app's data layer: one daemon connection, the state the screens read, and every action they
|
|
@@ -5410,7 +5439,7 @@ async function createStore(ctx, opts = {}) {
|
|
|
5410
5439
|
const keys = /* @__PURE__ */ new Set();
|
|
5411
5440
|
if (m.from !== OWNER_SESSION_ID) keys.add(m.from);
|
|
5412
5441
|
const to = m.to;
|
|
5413
|
-
const target = to
|
|
5442
|
+
const target = isLeadAlias(to) ? state.sessions.find((s) => s.isOrchestrator) : state.sessions.find((s) => s.id === to || s.name === to);
|
|
5414
5443
|
if (target) keys.add(target.id);
|
|
5415
5444
|
return [...keys];
|
|
5416
5445
|
}
|
|
@@ -5725,6 +5754,9 @@ async function createStore(ctx, opts = {}) {
|
|
|
5725
5754
|
async setHelpers(on) {
|
|
5726
5755
|
setHelpers(ctx, on);
|
|
5727
5756
|
},
|
|
5757
|
+
async setNotify(on) {
|
|
5758
|
+
setNotify(ctx, on);
|
|
5759
|
+
},
|
|
5728
5760
|
pair: async () => {
|
|
5729
5761
|
const r = await startPair(live());
|
|
5730
5762
|
return {
|