@conveno/cli 0.2.0-rc.17 → 0.2.0-rc.18
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/{acp-C-o3rtAB.js → acp-CFIh624o.js} +3 -3
- package/dist/{agy-relay-D17zTd_Z.js → agy-relay-BZ3d_-FS.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/daemon.js +4 -3633
- package/dist/{daemonError-BwdtKOCy.js → daemonError-CDgEtvy7.js} +1 -1
- package/dist/{dist-hyKfBSdF.js → dist-B7liMhCw.js} +3 -3
- package/dist/{dist-Bb2opAjB.js → dist-CFsDqevs.js} +1 -1
- package/dist/{dist-Dc50_P_f.js → dist-CSSvrcKr.js} +489 -249
- package/dist/{dist-CTw3arJP.js → dist-D6Xoip5W.js} +1 -1
- package/dist/{dist-BgAfkqeX.js → dist-DAVtixeC.js} +1 -1
- package/dist/{dist-CvKAege3.js → dist-DTMnNySx.js} +1 -1
- package/dist/dist-DV9DhvJC.js +4509 -0
- package/dist/{hook-BLSrNkFF.js → hook-BA-tI6Oc.js} +1 -1
- package/dist/{hook-entry-DYXjVztc.js → hook-entry-BwzBtAnd.js} +27 -24
- package/dist/hook-entry-Cgt5ZH1s.js +1 -0
- package/dist/{main-CQx2xc_w.js → main-BlS8BhhS.js} +10 -10
- package/dist/{pick-iuG24FX9.js → pick-BsMvXuDo.js} +1 -1
- package/dist/{run-B01nDeos.js → run-BtYGSOMi.js} +27 -72
- package/dist/{runtime-hZwjrEPc.js → runtime-CddqMa5-.js} +11 -32
- package/dist/{uninstall-B-deU_wY.js → uninstall-01_NStQ4.js} +4 -4
- package/dist/{watch-CPZ2X-yt.js → watch-BIepRTXJ.js} +4 -4
- package/package.json +13 -13
- package/dist/dist-B1pfP_d5.js +0 -793
- package/dist/hook-entry-B1Yt2cwr.js +0 -1
|
@@ -5,129 +5,6 @@ import { accessSync, appendFileSync, chmodSync, closeSync, constants, existsSync
|
|
|
5
5
|
import { mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import crypto, { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { applyEdits, findNodeAtLocation, modify, parse as parse$1, parseTree, printParseErrorCode } from "jsonc-parser";
|
|
8
|
-
// ../../node_modules/.pnpm/ulid@3.0.2/node_modules/ulid/dist/node/index.js
|
|
9
|
-
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
10
|
-
const ENCODING_LEN = 32;
|
|
11
|
-
const RANDOM_LEN = 16;
|
|
12
|
-
const TIME_MAX = 0xffffffffffff;
|
|
13
|
-
var ULIDErrorCode;
|
|
14
|
-
(function(ULIDErrorCode) {
|
|
15
|
-
ULIDErrorCode["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
|
|
16
|
-
ULIDErrorCode["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
|
|
17
|
-
ULIDErrorCode["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
|
|
18
|
-
ULIDErrorCode["EncodeTimeNegative"] = "ENC_TIME_NEG";
|
|
19
|
-
ULIDErrorCode["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
|
|
20
|
-
ULIDErrorCode["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
|
|
21
|
-
ULIDErrorCode["PRNGDetectFailure"] = "PRNG_DETECT";
|
|
22
|
-
ULIDErrorCode["ULIDInvalid"] = "ULID_INVALID";
|
|
23
|
-
ULIDErrorCode["Unexpected"] = "UNEXPECTED";
|
|
24
|
-
ULIDErrorCode["UUIDInvalid"] = "UUID_INVALID";
|
|
25
|
-
})(ULIDErrorCode || (ULIDErrorCode = {}));
|
|
26
|
-
var ULIDError = class extends Error {
|
|
27
|
-
constructor(errorCode, message) {
|
|
28
|
-
super(`${message} (${errorCode})`);
|
|
29
|
-
this.name = "ULIDError";
|
|
30
|
-
this.code = errorCode;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
function randomChar(prng) {
|
|
34
|
-
const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
|
|
35
|
-
return ENCODING.charAt(randomPosition);
|
|
36
|
-
}
|
|
37
|
-
function replaceCharAt(str, index, char) {
|
|
38
|
-
if (index > str.length - 1) return str;
|
|
39
|
-
return str.substr(0, index) + char + str.substr(index + 1);
|
|
40
|
-
}
|
|
41
|
-
function incrementBase32(str) {
|
|
42
|
-
let done = void 0, index = str.length, char, charIndex, output = str;
|
|
43
|
-
const maxCharIndex = 31;
|
|
44
|
-
while (!done && index-- >= 0) {
|
|
45
|
-
char = output[index];
|
|
46
|
-
charIndex = ENCODING.indexOf(char);
|
|
47
|
-
if (charIndex === -1) throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
|
|
48
|
-
if (charIndex === maxCharIndex) {
|
|
49
|
-
output = replaceCharAt(output, index, ENCODING[0]);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
done = replaceCharAt(output, index, ENCODING[charIndex + 1]);
|
|
53
|
-
}
|
|
54
|
-
if (typeof done === "string") return done;
|
|
55
|
-
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Detect the best PRNG (pseudo-random number generator)
|
|
59
|
-
* @param root The root to check from (global/window)
|
|
60
|
-
* @returns The PRNG function
|
|
61
|
-
*/
|
|
62
|
-
function detectPRNG(root) {
|
|
63
|
-
const rootLookup = detectRoot();
|
|
64
|
-
const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof crypto !== "undefined" ? crypto : null);
|
|
65
|
-
if (typeof globalCrypto?.getRandomValues === "function") return () => {
|
|
66
|
-
const buffer = /* @__PURE__ */ new Uint8Array(1);
|
|
67
|
-
globalCrypto.getRandomValues(buffer);
|
|
68
|
-
return buffer[0] / 256;
|
|
69
|
-
};
|
|
70
|
-
else if (typeof globalCrypto?.randomBytes === "function") return () => globalCrypto.randomBytes(1).readUInt8() / 256;
|
|
71
|
-
else if (crypto?.randomBytes) return () => crypto.randomBytes(1).readUInt8() / 256;
|
|
72
|
-
throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
73
|
-
}
|
|
74
|
-
function detectRoot() {
|
|
75
|
-
if (inWebWorker()) return self;
|
|
76
|
-
if (typeof window !== "undefined") return window;
|
|
77
|
-
if (typeof global !== "undefined") return global;
|
|
78
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
function encodeRandom(len, prng) {
|
|
82
|
-
let str = "";
|
|
83
|
-
for (; len > 0; len--) str = randomChar(prng) + str;
|
|
84
|
-
return str;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Encode the time portion of a ULID
|
|
88
|
-
* @param now The current timestamp
|
|
89
|
-
* @param len Length to generate
|
|
90
|
-
* @returns The encoded time
|
|
91
|
-
*/
|
|
92
|
-
function encodeTime(now, len = 10) {
|
|
93
|
-
if (isNaN(now)) throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now}`);
|
|
94
|
-
else if (now > 0xffffffffffff) throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
|
|
95
|
-
else if (now < 0) throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now}`);
|
|
96
|
-
else if (Number.isInteger(now) === false) throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now}`);
|
|
97
|
-
let mod, str = "";
|
|
98
|
-
for (let currentLen = len; currentLen > 0; currentLen--) {
|
|
99
|
-
mod = now % ENCODING_LEN;
|
|
100
|
-
str = ENCODING.charAt(mod) + str;
|
|
101
|
-
now = (now - mod) / ENCODING_LEN;
|
|
102
|
-
}
|
|
103
|
-
return str;
|
|
104
|
-
}
|
|
105
|
-
function inWebWorker() {
|
|
106
|
-
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Create a ULID factory to generate monotonically-increasing
|
|
110
|
-
* ULIDs
|
|
111
|
-
* @param prng The PRNG to use
|
|
112
|
-
* @returns A ulid factory
|
|
113
|
-
* @example
|
|
114
|
-
* const ulid = monotonicFactory();
|
|
115
|
-
* ulid(); // "01HNZXD07M5CEN5XA66EMZSRZW"
|
|
116
|
-
*/
|
|
117
|
-
function monotonicFactory(prng) {
|
|
118
|
-
const currentPRNG = prng || detectPRNG();
|
|
119
|
-
let lastTime = 0, lastRandom;
|
|
120
|
-
return function _ulid(seedTime) {
|
|
121
|
-
const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
|
|
122
|
-
if (seed <= lastTime) {
|
|
123
|
-
const incrementedRandom = lastRandom = incrementBase32(lastRandom);
|
|
124
|
-
return encodeTime(lastTime, 10) + incrementedRandom;
|
|
125
|
-
}
|
|
126
|
-
lastTime = seed;
|
|
127
|
-
const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
|
|
128
|
-
return encodeTime(seed, 10) + newRandom;
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
8
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
|
|
132
9
|
function getEnumValues(entries) {
|
|
133
10
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
@@ -5690,6 +5567,258 @@ function superRefine(fn, params) {
|
|
|
5690
5567
|
function datetime(params) {
|
|
5691
5568
|
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
5692
5569
|
}
|
|
5570
|
+
// ../protocol/dist/account-api.js
|
|
5571
|
+
/**
|
|
5572
|
+
* The HTTP contract between the open client (`@conveno/core`, `conveno login`) and the account
|
|
5573
|
+
* server (api.conveno.dev). PROTOCOL.md section 8 describes it; the JSON files under
|
|
5574
|
+
* `fixtures/account-api/` pin it. The client replays every fixture through its own code, and the
|
|
5575
|
+
* account server's tests check that the real Worker answers the same way.
|
|
5576
|
+
*
|
|
5577
|
+
* Response schemas are lenient (unknown fields are ignored) so a newer server does not break an
|
|
5578
|
+
* older client. The server-side tests additionally refuse fields a schema does not list.
|
|
5579
|
+
*/
|
|
5580
|
+
/** The `client_id` of the device authorization grant. The server accepts only this one. */
|
|
5581
|
+
const ACCOUNT_DEVICE_CLIENT_ID = "conveno-cli";
|
|
5582
|
+
/** The `grant_type` of a device token poll (RFC 8628 section 3.4). */
|
|
5583
|
+
const DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
5584
|
+
/** The `aud` claim of every access token. */
|
|
5585
|
+
const ACCESS_TOKEN_AUDIENCE = "conveno";
|
|
5586
|
+
const AccountPlan = _enum(["free", "pro"]);
|
|
5587
|
+
/** A relay device id: a ULID. */
|
|
5588
|
+
const DeviceIdString = string().regex(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/);
|
|
5589
|
+
/** The claims of an access token. No email, no name: nothing else is ever present. */
|
|
5590
|
+
const AccessTokenClaims = object({
|
|
5591
|
+
/** The user id, an opaque string: the account id. */
|
|
5592
|
+
sub: string().min(1),
|
|
5593
|
+
plan: AccountPlan,
|
|
5594
|
+
/** The relay device id the login is bound to. Absent before `POST /api/device/bind`. */
|
|
5595
|
+
did: DeviceIdString.optional(),
|
|
5596
|
+
/** The account's relay epoch: how many times the owner reset the devices. */
|
|
5597
|
+
rep: number().int().nonnegative(),
|
|
5598
|
+
/** Seconds since the epoch. */
|
|
5599
|
+
iat: number().int(),
|
|
5600
|
+
/** `iat` plus 15 minutes. */
|
|
5601
|
+
exp: number().int(),
|
|
5602
|
+
iss: string().min(1),
|
|
5603
|
+
aud: literal(ACCESS_TOKEN_AUDIENCE)
|
|
5604
|
+
});
|
|
5605
|
+
/** The error body of the account server's own routes. */
|
|
5606
|
+
const ApiError = object({ error: string().min(1) });
|
|
5607
|
+
/** The error body of the Better Auth routes (`/api/auth/token`, `/api/auth/sign-out`). */
|
|
5608
|
+
const BetterAuthError = object({
|
|
5609
|
+
message: string().min(1),
|
|
5610
|
+
code: string().optional()
|
|
5611
|
+
});
|
|
5612
|
+
const AuthTokenResponse = object({ token: string().min(1) });
|
|
5613
|
+
object({ deviceId: string() });
|
|
5614
|
+
const DeviceBindResponse = object({
|
|
5615
|
+
ok: literal(true),
|
|
5616
|
+
deviceId: DeviceIdString
|
|
5617
|
+
});
|
|
5618
|
+
const AccountMeResponse = object({
|
|
5619
|
+
user: object({
|
|
5620
|
+
id: string(),
|
|
5621
|
+
name: string()
|
|
5622
|
+
}),
|
|
5623
|
+
plan: AccountPlan,
|
|
5624
|
+
/** Stripe's subscription status, or null when the user never subscribed. */
|
|
5625
|
+
status: string().nullable(),
|
|
5626
|
+
/** Unix seconds, set while a trial runs. */
|
|
5627
|
+
trialEnd: number().nullable(),
|
|
5628
|
+
trialDaysLeft: number().nullable(),
|
|
5629
|
+
currentPeriodEnd: number().nullable(),
|
|
5630
|
+
cancelAtPeriodEnd: boolean(),
|
|
5631
|
+
paymentFailed: boolean()
|
|
5632
|
+
});
|
|
5633
|
+
object({ client_id: string() });
|
|
5634
|
+
const DeviceCodeResponse = object({
|
|
5635
|
+
device_code: string().min(1),
|
|
5636
|
+
user_code: string().min(1),
|
|
5637
|
+
verification_uri: string().min(1),
|
|
5638
|
+
verification_uri_complete: string().optional(),
|
|
5639
|
+
/** Seconds between polls. */
|
|
5640
|
+
interval: number().optional(),
|
|
5641
|
+
/** Seconds until the code stops working. */
|
|
5642
|
+
expires_in: number().optional()
|
|
5643
|
+
});
|
|
5644
|
+
object({
|
|
5645
|
+
grant_type: literal(DEVICE_GRANT_TYPE),
|
|
5646
|
+
device_code: string(),
|
|
5647
|
+
client_id: string()
|
|
5648
|
+
});
|
|
5649
|
+
/** `access_token` is the session token, which the client keeps as its refresh token. */
|
|
5650
|
+
const DeviceTokenSuccess = object({
|
|
5651
|
+
access_token: string().min(1),
|
|
5652
|
+
token_type: string().optional(),
|
|
5653
|
+
expires_in: number().optional(),
|
|
5654
|
+
scope: string().optional()
|
|
5655
|
+
});
|
|
5656
|
+
const DeviceTokenError = object({
|
|
5657
|
+
/** RFC 8628 section 3.5. A client treats a code it does not know as a server failure. */
|
|
5658
|
+
error: string().min(1),
|
|
5659
|
+
error_description: string().optional()
|
|
5660
|
+
});
|
|
5661
|
+
const ACCOUNT_API_SCHEMA_NAMES = Object.keys({
|
|
5662
|
+
AccessTokenClaims,
|
|
5663
|
+
AccountMeResponse,
|
|
5664
|
+
ApiError,
|
|
5665
|
+
AuthTokenResponse,
|
|
5666
|
+
BetterAuthError,
|
|
5667
|
+
DeviceBindResponse,
|
|
5668
|
+
DeviceCodeResponse,
|
|
5669
|
+
DeviceTokenError,
|
|
5670
|
+
DeviceTokenSuccess
|
|
5671
|
+
});
|
|
5672
|
+
/**
|
|
5673
|
+
* One request and the answer the account server gives. `setup` names the server state the case
|
|
5674
|
+
* needs (the account server's tests build it); the client ignores it. `schema` is the
|
|
5675
|
+
* {@link accountApiSchemas} entry the response body satisfies. `exact` means the body is
|
|
5676
|
+
* deterministic, so a server must answer it verbatim. Headers may use `{{refreshToken}}`.
|
|
5677
|
+
*/
|
|
5678
|
+
const AccountFixtureCase = object({
|
|
5679
|
+
name: string().min(1),
|
|
5680
|
+
description: string().min(1),
|
|
5681
|
+
setup: string().min(1),
|
|
5682
|
+
request: object({
|
|
5683
|
+
method: _enum(["GET", "POST"]),
|
|
5684
|
+
path: string().startsWith("/"),
|
|
5685
|
+
headers: record(string(), string()).optional(),
|
|
5686
|
+
body: unknown().optional()
|
|
5687
|
+
}),
|
|
5688
|
+
response: object({
|
|
5689
|
+
status: number().int(),
|
|
5690
|
+
schema: _enum(ACCOUNT_API_SCHEMA_NAMES),
|
|
5691
|
+
exact: boolean().optional(),
|
|
5692
|
+
body: unknown()
|
|
5693
|
+
})
|
|
5694
|
+
});
|
|
5695
|
+
object({
|
|
5696
|
+
endpoint: string().min(1),
|
|
5697
|
+
cases: array(AccountFixtureCase).min(1)
|
|
5698
|
+
});
|
|
5699
|
+
// ../../node_modules/.pnpm/ulid@3.0.2/node_modules/ulid/dist/node/index.js
|
|
5700
|
+
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
5701
|
+
const ENCODING_LEN = 32;
|
|
5702
|
+
const RANDOM_LEN = 16;
|
|
5703
|
+
const TIME_MAX = 0xffffffffffff;
|
|
5704
|
+
var ULIDErrorCode;
|
|
5705
|
+
(function(ULIDErrorCode) {
|
|
5706
|
+
ULIDErrorCode["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
|
|
5707
|
+
ULIDErrorCode["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
|
|
5708
|
+
ULIDErrorCode["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
|
|
5709
|
+
ULIDErrorCode["EncodeTimeNegative"] = "ENC_TIME_NEG";
|
|
5710
|
+
ULIDErrorCode["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
|
|
5711
|
+
ULIDErrorCode["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
|
|
5712
|
+
ULIDErrorCode["PRNGDetectFailure"] = "PRNG_DETECT";
|
|
5713
|
+
ULIDErrorCode["ULIDInvalid"] = "ULID_INVALID";
|
|
5714
|
+
ULIDErrorCode["Unexpected"] = "UNEXPECTED";
|
|
5715
|
+
ULIDErrorCode["UUIDInvalid"] = "UUID_INVALID";
|
|
5716
|
+
})(ULIDErrorCode || (ULIDErrorCode = {}));
|
|
5717
|
+
var ULIDError = class extends Error {
|
|
5718
|
+
constructor(errorCode, message) {
|
|
5719
|
+
super(`${message} (${errorCode})`);
|
|
5720
|
+
this.name = "ULIDError";
|
|
5721
|
+
this.code = errorCode;
|
|
5722
|
+
}
|
|
5723
|
+
};
|
|
5724
|
+
function randomChar(prng) {
|
|
5725
|
+
const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
|
|
5726
|
+
return ENCODING.charAt(randomPosition);
|
|
5727
|
+
}
|
|
5728
|
+
function replaceCharAt(str, index, char) {
|
|
5729
|
+
if (index > str.length - 1) return str;
|
|
5730
|
+
return str.substr(0, index) + char + str.substr(index + 1);
|
|
5731
|
+
}
|
|
5732
|
+
function incrementBase32(str) {
|
|
5733
|
+
let done = void 0, index = str.length, char, charIndex, output = str;
|
|
5734
|
+
const maxCharIndex = 31;
|
|
5735
|
+
while (!done && index-- >= 0) {
|
|
5736
|
+
char = output[index];
|
|
5737
|
+
charIndex = ENCODING.indexOf(char);
|
|
5738
|
+
if (charIndex === -1) throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
|
|
5739
|
+
if (charIndex === maxCharIndex) {
|
|
5740
|
+
output = replaceCharAt(output, index, ENCODING[0]);
|
|
5741
|
+
continue;
|
|
5742
|
+
}
|
|
5743
|
+
done = replaceCharAt(output, index, ENCODING[charIndex + 1]);
|
|
5744
|
+
}
|
|
5745
|
+
if (typeof done === "string") return done;
|
|
5746
|
+
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
|
|
5747
|
+
}
|
|
5748
|
+
/**
|
|
5749
|
+
* Detect the best PRNG (pseudo-random number generator)
|
|
5750
|
+
* @param root The root to check from (global/window)
|
|
5751
|
+
* @returns The PRNG function
|
|
5752
|
+
*/
|
|
5753
|
+
function detectPRNG(root) {
|
|
5754
|
+
const rootLookup = detectRoot();
|
|
5755
|
+
const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof crypto !== "undefined" ? crypto : null);
|
|
5756
|
+
if (typeof globalCrypto?.getRandomValues === "function") return () => {
|
|
5757
|
+
const buffer = /* @__PURE__ */ new Uint8Array(1);
|
|
5758
|
+
globalCrypto.getRandomValues(buffer);
|
|
5759
|
+
return buffer[0] / 256;
|
|
5760
|
+
};
|
|
5761
|
+
else if (typeof globalCrypto?.randomBytes === "function") return () => globalCrypto.randomBytes(1).readUInt8() / 256;
|
|
5762
|
+
else if (crypto?.randomBytes) return () => crypto.randomBytes(1).readUInt8() / 256;
|
|
5763
|
+
throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
5764
|
+
}
|
|
5765
|
+
function detectRoot() {
|
|
5766
|
+
if (inWebWorker()) return self;
|
|
5767
|
+
if (typeof window !== "undefined") return window;
|
|
5768
|
+
if (typeof global !== "undefined") return global;
|
|
5769
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
5770
|
+
return null;
|
|
5771
|
+
}
|
|
5772
|
+
function encodeRandom(len, prng) {
|
|
5773
|
+
let str = "";
|
|
5774
|
+
for (; len > 0; len--) str = randomChar(prng) + str;
|
|
5775
|
+
return str;
|
|
5776
|
+
}
|
|
5777
|
+
/**
|
|
5778
|
+
* Encode the time portion of a ULID
|
|
5779
|
+
* @param now The current timestamp
|
|
5780
|
+
* @param len Length to generate
|
|
5781
|
+
* @returns The encoded time
|
|
5782
|
+
*/
|
|
5783
|
+
function encodeTime(now, len = 10) {
|
|
5784
|
+
if (isNaN(now)) throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now}`);
|
|
5785
|
+
else if (now > 0xffffffffffff) throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
|
|
5786
|
+
else if (now < 0) throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now}`);
|
|
5787
|
+
else if (Number.isInteger(now) === false) throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now}`);
|
|
5788
|
+
let mod, str = "";
|
|
5789
|
+
for (let currentLen = len; currentLen > 0; currentLen--) {
|
|
5790
|
+
mod = now % ENCODING_LEN;
|
|
5791
|
+
str = ENCODING.charAt(mod) + str;
|
|
5792
|
+
now = (now - mod) / ENCODING_LEN;
|
|
5793
|
+
}
|
|
5794
|
+
return str;
|
|
5795
|
+
}
|
|
5796
|
+
function inWebWorker() {
|
|
5797
|
+
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
|
|
5798
|
+
}
|
|
5799
|
+
/**
|
|
5800
|
+
* Create a ULID factory to generate monotonically-increasing
|
|
5801
|
+
* ULIDs
|
|
5802
|
+
* @param prng The PRNG to use
|
|
5803
|
+
* @returns A ulid factory
|
|
5804
|
+
* @example
|
|
5805
|
+
* const ulid = monotonicFactory();
|
|
5806
|
+
* ulid(); // "01HNZXD07M5CEN5XA66EMZSRZW"
|
|
5807
|
+
*/
|
|
5808
|
+
function monotonicFactory(prng) {
|
|
5809
|
+
const currentPRNG = prng || detectPRNG();
|
|
5810
|
+
let lastTime = 0, lastRandom;
|
|
5811
|
+
return function _ulid(seedTime) {
|
|
5812
|
+
const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
|
|
5813
|
+
if (seed <= lastTime) {
|
|
5814
|
+
const incrementedRandom = lastRandom = incrementBase32(lastRandom);
|
|
5815
|
+
return encodeTime(lastTime, 10) + incrementedRandom;
|
|
5816
|
+
}
|
|
5817
|
+
lastTime = seed;
|
|
5818
|
+
const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
|
|
5819
|
+
return encodeTime(seed, 10) + newRandom;
|
|
5820
|
+
};
|
|
5821
|
+
}
|
|
5693
5822
|
// ../protocol/dist/index.js
|
|
5694
5823
|
const encoder = new TextEncoder();
|
|
5695
5824
|
/** Number of bytes `s` occupies when encoded as UTF-8. */
|
|
@@ -7119,7 +7248,7 @@ function writePrivateFileSync(path, body, o = {}) {
|
|
|
7119
7248
|
}
|
|
7120
7249
|
}
|
|
7121
7250
|
/** The `client_id` of the device authorization grant. The server accepts only this one. */
|
|
7122
|
-
const DEVICE_CLIENT_ID =
|
|
7251
|
+
const DEVICE_CLIENT_ID = ACCOUNT_DEVICE_CLIENT_ID;
|
|
7123
7252
|
/** Renew an access token this long before it expires, so a request never carries a dead one. */
|
|
7124
7253
|
const REFRESH_SKEW_MS = 6e4;
|
|
7125
7254
|
var AccountError = class extends Error {
|
|
@@ -7223,11 +7352,11 @@ async function requestAccessToken(refreshToken, io = {}) {
|
|
|
7223
7352
|
}
|
|
7224
7353
|
if (res.status === 401 || res.status === 403) throw new AccountError("session_expired", "The login has expired or was revoked.");
|
|
7225
7354
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
7226
|
-
const body = await res.json().catch(() => null);
|
|
7227
|
-
if (
|
|
7228
|
-
const expiresAt = jwtExpiry(body.token) ?? clock(io) + 9e5;
|
|
7355
|
+
const body = AuthTokenResponse.safeParse(await res.json().catch(() => null));
|
|
7356
|
+
if (!body.success) throw new AccountError("server", "The account server sent no access token.");
|
|
7357
|
+
const expiresAt = jwtExpiry(body.data.token) ?? clock(io) + 9e5;
|
|
7229
7358
|
return {
|
|
7230
|
-
accessToken: body.token,
|
|
7359
|
+
accessToken: body.data.token,
|
|
7231
7360
|
expiresAt
|
|
7232
7361
|
};
|
|
7233
7362
|
}
|
|
@@ -7312,7 +7441,9 @@ async function fetchAccountStatus(refreshToken, io = {}) {
|
|
|
7312
7441
|
}
|
|
7313
7442
|
if (res.status === 401) throw new AccountError("session_expired", "The login has expired or was revoked.");
|
|
7314
7443
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
7315
|
-
|
|
7444
|
+
const body = AccountMeResponse.safeParse(await res.json().catch(() => null));
|
|
7445
|
+
if (!body.success) throw new AccountError("server", "The account server sent an unexpected account status.");
|
|
7446
|
+
return body.data;
|
|
7316
7447
|
}
|
|
7317
7448
|
const json = (body) => ({
|
|
7318
7449
|
method: "POST",
|
|
@@ -7331,15 +7462,16 @@ async function requestDeviceCode(io = {}) {
|
|
|
7331
7462
|
throw new AccountError("network", "Could not reach the Conveno account server.");
|
|
7332
7463
|
}
|
|
7333
7464
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
7334
|
-
const
|
|
7335
|
-
if (!
|
|
7465
|
+
const parsed = DeviceCodeResponse.safeParse(await res.json().catch(() => null));
|
|
7466
|
+
if (!parsed.success) throw new AccountError("server", "The account server sent an unexpected device code.");
|
|
7467
|
+
const b = parsed.data;
|
|
7336
7468
|
return {
|
|
7337
7469
|
deviceCode: b.device_code,
|
|
7338
7470
|
userCode: b.user_code,
|
|
7339
7471
|
verificationUri: b.verification_uri,
|
|
7340
|
-
verificationUriComplete:
|
|
7341
|
-
interval:
|
|
7342
|
-
expiresIn:
|
|
7472
|
+
verificationUriComplete: b.verification_uri_complete ?? b.verification_uri,
|
|
7473
|
+
interval: b.interval !== void 0 && b.interval > 0 ? b.interval : 5,
|
|
7474
|
+
expiresIn: b.expires_in !== void 0 && b.expires_in > 0 ? b.expires_in : 900
|
|
7343
7475
|
};
|
|
7344
7476
|
}
|
|
7345
7477
|
const realSleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -7359,16 +7491,18 @@ async function pollDeviceCode(code, o = {}) {
|
|
|
7359
7491
|
let res;
|
|
7360
7492
|
try {
|
|
7361
7493
|
res = await doFetch(o)(`${base(o)}/api/auth/device/token`, json({
|
|
7362
|
-
grant_type:
|
|
7494
|
+
grant_type: DEVICE_GRANT_TYPE,
|
|
7363
7495
|
device_code: code.deviceCode,
|
|
7364
7496
|
client_id: DEVICE_CLIENT_ID
|
|
7365
7497
|
}));
|
|
7366
7498
|
} catch {
|
|
7367
7499
|
continue;
|
|
7368
7500
|
}
|
|
7369
|
-
const
|
|
7370
|
-
|
|
7371
|
-
|
|
7501
|
+
const raw = await res.json().catch(() => null);
|
|
7502
|
+
const granted = DeviceTokenSuccess.safeParse(raw);
|
|
7503
|
+
if (res.ok && granted.success) return granted.data.access_token;
|
|
7504
|
+
const failed = DeviceTokenError.safeParse(raw);
|
|
7505
|
+
switch (failed.success ? failed.data.error : void 0) {
|
|
7372
7506
|
case "authorization_pending": continue;
|
|
7373
7507
|
case "slow_down":
|
|
7374
7508
|
interval += 5;
|
|
@@ -7422,19 +7556,205 @@ async function logoutAccount(path, io = {}) {
|
|
|
7422
7556
|
};
|
|
7423
7557
|
}
|
|
7424
7558
|
/**
|
|
7425
|
-
*
|
|
7426
|
-
*
|
|
7427
|
-
* instead of making a row. Codex runs every thread's MCP under one app-server process that several
|
|
7428
|
-
* windows may share, so only the thread id tells its windows apart.
|
|
7559
|
+
* Every supported CLI's descriptor, in the order lists show them (onboarding, spawn). Adding a CLI
|
|
7560
|
+
* means a file in this folder and an entry here; the compiler flags a `CliKind` that is missing.
|
|
7429
7561
|
*/
|
|
7430
|
-
const
|
|
7431
|
-
claude:
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7562
|
+
const CLIS = {
|
|
7563
|
+
claude: {
|
|
7564
|
+
id: "claude",
|
|
7565
|
+
name: "Claude Code",
|
|
7566
|
+
shortName: "claude",
|
|
7567
|
+
binaries: ["claude"],
|
|
7568
|
+
install: {
|
|
7569
|
+
route: {
|
|
7570
|
+
kind: "script",
|
|
7571
|
+
sh: "https://claude.ai/install.sh",
|
|
7572
|
+
ps: "https://claude.ai/install.ps1"
|
|
7573
|
+
},
|
|
7574
|
+
dirs: [{
|
|
7575
|
+
from: "home",
|
|
7576
|
+
path: [".local", "bin"]
|
|
7577
|
+
}]
|
|
7578
|
+
},
|
|
7579
|
+
spawn: {
|
|
7580
|
+
interactive: (task) => task === void 0 ? [] : [task],
|
|
7581
|
+
modelArgs: (c) => [...c.model ? ["--model", c.model] : [], ...c.effort ? ["--effort", c.effort] : []],
|
|
7582
|
+
interactivePrompt: true,
|
|
7583
|
+
docs: ["https://code.claude.com/docs/en/cli-reference (claude \"query\")"],
|
|
7584
|
+
acp: {
|
|
7585
|
+
binaries: ["claude-agent-acp"],
|
|
7586
|
+
args: [],
|
|
7587
|
+
adapterPackage: "@agentclientprotocol/claude-agent-acp",
|
|
7588
|
+
modes: {
|
|
7589
|
+
read: "plan",
|
|
7590
|
+
edit: "acceptEdits",
|
|
7591
|
+
full: "bypassPermissions"
|
|
7592
|
+
},
|
|
7593
|
+
note: "Claude Code has no ACP server of its own. The ACP project's npm package @agentclientprotocol/claude-agent-acp provides one and uses the Claude Code sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
7594
|
+
docs: ["https://github.com/agentclientprotocol/claude-agent-acp (Apache-2.0, maintained by the ACP project)", "https://www.npmjs.com/package/@agentclientprotocol/claude-agent-acp (bin claude-agent-acp)"]
|
|
7595
|
+
}
|
|
7596
|
+
},
|
|
7597
|
+
oneWindowPerHost: true,
|
|
7598
|
+
deliveryTier: "next_turn"
|
|
7599
|
+
},
|
|
7600
|
+
codex: {
|
|
7601
|
+
id: "codex",
|
|
7602
|
+
name: "Codex",
|
|
7603
|
+
shortName: "codex",
|
|
7604
|
+
binaries: ["codex"],
|
|
7605
|
+
install: {
|
|
7606
|
+
route: {
|
|
7607
|
+
kind: "npm",
|
|
7608
|
+
package: "@openai/codex"
|
|
7609
|
+
},
|
|
7610
|
+
dirs: [{ from: "npmPrefix" }]
|
|
7611
|
+
},
|
|
7612
|
+
spawn: {
|
|
7613
|
+
interactive: (task) => task === void 0 ? [] : [task],
|
|
7614
|
+
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["-c", `model_reasoning_effort=${c.effort}`] : []],
|
|
7615
|
+
interactivePrompt: true,
|
|
7616
|
+
docs: ["https://developers.openai.com/codex/cli/reference (codex [PROMPT])", "reference/src/codex/codex-rs/tui/src/cli.rs (the optional PROMPT argument)"],
|
|
7617
|
+
acp: {
|
|
7618
|
+
binaries: ["codex-acp"],
|
|
7619
|
+
args: [],
|
|
7620
|
+
adapterPackage: "@agentclientprotocol/codex-acp",
|
|
7621
|
+
modes: {
|
|
7622
|
+
read: "read-only",
|
|
7623
|
+
edit: "workspace-write",
|
|
7624
|
+
full: "agent-full-access"
|
|
7625
|
+
},
|
|
7626
|
+
note: "Codex has no ACP server of its own. The ACP project's npm package @agentclientprotocol/codex-acp provides one and uses the Codex sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
7627
|
+
docs: [
|
|
7628
|
+
"https://github.com/agentclientprotocol/codex-acp (Apache-2.0, built on the Codex app server)",
|
|
7629
|
+
"https://www.npmjs.com/package/@agentclientprotocol/codex-acp (bin codex-acp)",
|
|
7630
|
+
"reference/src/codex/codex-rs/app-server (the app server it drives)"
|
|
7631
|
+
]
|
|
7632
|
+
}
|
|
7633
|
+
},
|
|
7634
|
+
oneWindowPerHost: false,
|
|
7635
|
+
deliveryTier: "next_turn",
|
|
7636
|
+
conversationMetaKey: "threadId"
|
|
7637
|
+
},
|
|
7638
|
+
opencode: {
|
|
7639
|
+
id: "opencode",
|
|
7640
|
+
name: "OpenCode",
|
|
7641
|
+
shortName: "opencode",
|
|
7642
|
+
binaries: ["opencode"],
|
|
7643
|
+
install: {
|
|
7644
|
+
route: {
|
|
7645
|
+
kind: "npm",
|
|
7646
|
+
package: "@opencode/cli"
|
|
7647
|
+
},
|
|
7648
|
+
dirs: [{ from: "npmPrefix" }]
|
|
7649
|
+
},
|
|
7650
|
+
spawn: {
|
|
7651
|
+
interactive: (task) => task === void 0 ? [] : ["--prompt", task],
|
|
7652
|
+
modelArgs: (c) => c.model ? ["-m", c.model] : [],
|
|
7653
|
+
interactivePrompt: true,
|
|
7654
|
+
docs: ["https://opencode.ai/docs/cli/ (the TUI --prompt flag)", "reference/src/opencode/packages/cli/src/commands/commands.ts at v2.4.3 (--prompt)"],
|
|
7655
|
+
acp: {
|
|
7656
|
+
binaries: ["opencode"],
|
|
7657
|
+
args: ["acp"],
|
|
7658
|
+
modes: {
|
|
7659
|
+
read: "plan",
|
|
7660
|
+
edit: "build",
|
|
7661
|
+
full: "build"
|
|
7662
|
+
},
|
|
7663
|
+
note: "",
|
|
7664
|
+
docs: ["https://opencode.ai/docs/cli/acp/ (opencode acp, stdio, protocol version 1)", "reference/src/opencode/packages/opencode/src/cli/cmd/acp.ts"]
|
|
7665
|
+
}
|
|
7666
|
+
},
|
|
7667
|
+
oneWindowPerHost: true,
|
|
7668
|
+
deliveryTier: "inbox",
|
|
7669
|
+
conversationMetaKey: "ai.opencode/sessionID"
|
|
7670
|
+
},
|
|
7671
|
+
antigravity: {
|
|
7672
|
+
id: "antigravity",
|
|
7673
|
+
name: "Antigravity",
|
|
7674
|
+
shortName: "antigravity",
|
|
7675
|
+
binaries: ["agy"],
|
|
7676
|
+
install: {
|
|
7677
|
+
route: {
|
|
7678
|
+
kind: "script",
|
|
7679
|
+
sh: "https://antigravity.google/cli/install.sh",
|
|
7680
|
+
ps: "https://antigravity.google/cli/install.ps1"
|
|
7681
|
+
},
|
|
7682
|
+
dirs: [{
|
|
7683
|
+
from: "localAppData",
|
|
7684
|
+
path: ["agy", "bin"],
|
|
7685
|
+
only: "win32"
|
|
7686
|
+
}, {
|
|
7687
|
+
from: "home",
|
|
7688
|
+
path: [".local", "bin"],
|
|
7689
|
+
only: "posix"
|
|
7690
|
+
}]
|
|
7691
|
+
},
|
|
7692
|
+
spawn: {
|
|
7693
|
+
interactive: () => [],
|
|
7694
|
+
modelArgs: (c) => [...c.model ? ["--model", c.model] : [], ...c.effort ? ["--effort", c.effort] : []],
|
|
7695
|
+
interactivePrompt: false,
|
|
7696
|
+
docs: ["https://antigravity.google/docs/cli/acp (agy)"],
|
|
7697
|
+
acp: {
|
|
7698
|
+
binaries: ["agy"],
|
|
7699
|
+
args: ["acp"],
|
|
7700
|
+
modes: {
|
|
7701
|
+
read: "plan",
|
|
7702
|
+
edit: "accept-edits",
|
|
7703
|
+
full: "default"
|
|
7704
|
+
},
|
|
7705
|
+
note: "Uses the sign-in cached by an interactive `agy`.",
|
|
7706
|
+
docs: ["https://antigravity.google/docs/cli/acp (agy acp, stdio)"]
|
|
7707
|
+
}
|
|
7708
|
+
},
|
|
7709
|
+
oneWindowPerHost: true,
|
|
7710
|
+
deliveryTier: "next_turn",
|
|
7711
|
+
launcher: { winCmdShim: true },
|
|
7712
|
+
conversationMetaKey: "antigravity.google/root_conversation_id"
|
|
7713
|
+
},
|
|
7714
|
+
grok: {
|
|
7715
|
+
id: "grok",
|
|
7716
|
+
name: "Grok Build",
|
|
7717
|
+
shortName: "grok",
|
|
7718
|
+
binaries: ["grok"],
|
|
7719
|
+
install: {
|
|
7720
|
+
route: {
|
|
7721
|
+
kind: "script",
|
|
7722
|
+
sh: "https://x.ai/cli/install.sh",
|
|
7723
|
+
ps: "https://x.ai/cli/install.ps1"
|
|
7724
|
+
},
|
|
7725
|
+
dirs: [{
|
|
7726
|
+
from: "home",
|
|
7727
|
+
path: [".grok", "bin"]
|
|
7728
|
+
}]
|
|
7729
|
+
},
|
|
7730
|
+
spawn: {
|
|
7731
|
+
interactive: (task) => task === void 0 ? [] : [task],
|
|
7732
|
+
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["--reasoning-effort", c.effort] : []],
|
|
7733
|
+
interactivePrompt: true,
|
|
7734
|
+
docs: ["reference/src/grok-build/crates/codegen/xai-grok-pager/src/app/cli.rs (prompt)"],
|
|
7735
|
+
acp: {
|
|
7736
|
+
binaries: ["grok"],
|
|
7737
|
+
args: ["agent", "stdio"],
|
|
7738
|
+
note: "",
|
|
7739
|
+
docs: ["reference/src/grok-build/crates/codegen/xai-grok-pager/src/app/cli.rs (grok agent stdio)", "reference/src/grok-build/crates/codegen/xai-grok-pager/docs/user-guide/15-agent-mode.md"]
|
|
7740
|
+
}
|
|
7741
|
+
},
|
|
7742
|
+
oneWindowPerHost: true,
|
|
7743
|
+
deliveryTier: "inbox",
|
|
7744
|
+
launcher: { winCmdShim: false }
|
|
7745
|
+
}
|
|
7436
7746
|
};
|
|
7437
|
-
|
|
7747
|
+
/** The descriptors in display order. */
|
|
7748
|
+
const CLI_DESCRIPTORS = Object.values(CLIS);
|
|
7749
|
+
/** The descriptor of `cli`, or undefined for an id that is not a supported CLI. */
|
|
7750
|
+
const cliDescriptor = (cli) => Object.hasOwn(CLIS, cli) ? CLIS[cli] : void 0;
|
|
7751
|
+
/**
|
|
7752
|
+
* Is the CLI's window one host process, so a second MCP server under it belongs to the window's
|
|
7753
|
+
* session (see `CliDescriptor.oneWindowPerHost`).
|
|
7754
|
+
*/
|
|
7755
|
+
const oneWindowPerHost = (cli) => CLIS[cli].oneWindowPerHost;
|
|
7756
|
+
/** The delivery tier of a CLI's own (non-ACP) sessions; an unknown CLI gets `inbox`. */
|
|
7757
|
+
const cliDeliveryTier = (cli) => cliDescriptor(cli)?.deliveryTier ?? "inbox";
|
|
7438
7758
|
const pathApi$2 = (platform) => platform === "win32" ? win32 : posix;
|
|
7439
7759
|
/**
|
|
7440
7760
|
* Conveno data directory. Pure: platform, environment and home directory are arguments.
|
|
@@ -7481,7 +7801,11 @@ function dataPaths(platform, dir) {
|
|
|
7481
7801
|
/** Choices the user made, such as whether ACP adapters may be fetched with npx. See settings.ts. */
|
|
7482
7802
|
settings: p.join(dir, "settings.json"),
|
|
7483
7803
|
/** The models and effort levels each CLI offered its last worker. See worker-models.ts. */
|
|
7484
|
-
workerModels: p.join(dir, "worker-models.json")
|
|
7804
|
+
workerModels: p.join(dir, "worker-models.json"),
|
|
7805
|
+
/** The relay client's device keys, mode 0600. See daemon/src/relay/state.ts. */
|
|
7806
|
+
relayIdentity: p.join(dir, "device-key.json"),
|
|
7807
|
+
/** The relay client's device list, device name and seen envelope ids, mode 0600. */
|
|
7808
|
+
relayDatabase: p.join(dir, "relay.db")
|
|
7485
7809
|
};
|
|
7486
7810
|
}
|
|
7487
7811
|
/** Best effort: deletes the markers in `dir` not touched for `ASKED_MAX_AGE_MS`. */
|
|
@@ -8671,15 +8995,16 @@ const fallback = (env) => {
|
|
|
8671
8995
|
};
|
|
8672
8996
|
/**
|
|
8673
8997
|
* The command an agent runs for a Conveno helper of `cli`, as words (not yet quoted). Grok keeps a
|
|
8674
|
-
* plain `conveno` when the PATH one is this install.
|
|
8675
|
-
* `conveno.cmd
|
|
8676
|
-
* is known.
|
|
8998
|
+
* plain `conveno` when the PATH one is this install. A CLI with `launcher.winCmdShim`
|
|
8999
|
+
* (Antigravity) prefers the PATH `conveno.cmd` on Windows. In every other case it is the launcher,
|
|
9000
|
+
* or the configured command when no launcher is known.
|
|
8677
9001
|
*/
|
|
8678
9002
|
function agentCommand(env, cli) {
|
|
8679
9003
|
const l = env.conveno.launcher;
|
|
8680
9004
|
if (!l) return env.conveno.command;
|
|
8681
|
-
|
|
8682
|
-
if (l.onPath &&
|
|
9005
|
+
const cmdShim = CLIS[cli].launcher.winCmdShim && env.platform === "win32";
|
|
9006
|
+
if (cmdShim && l.onPath && l.cmdShim) return ["conveno.cmd"];
|
|
9007
|
+
if (l.onPath && !cmdShim) return ["conveno"];
|
|
8683
9008
|
if (l.spaced) return fallback(env);
|
|
8684
9009
|
return [slashed(l.path, env.platform)];
|
|
8685
9010
|
}
|
|
@@ -10206,99 +10531,14 @@ function realSpawnDeps(opts) {
|
|
|
10206
10531
|
})
|
|
10207
10532
|
};
|
|
10208
10533
|
}
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
binaries: ["claude-agent-acp"],
|
|
10218
|
-
args: [],
|
|
10219
|
-
adapterPackage: "@agentclientprotocol/claude-agent-acp",
|
|
10220
|
-
modes: {
|
|
10221
|
-
read: "plan",
|
|
10222
|
-
edit: "acceptEdits",
|
|
10223
|
-
full: "bypassPermissions"
|
|
10224
|
-
},
|
|
10225
|
-
note: "Claude Code has no ACP server of its own. The ACP project's npm package @agentclientprotocol/claude-agent-acp provides one and uses the Claude Code sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
10226
|
-
docs: ["https://github.com/agentclientprotocol/claude-agent-acp (Apache-2.0, maintained by the ACP project)", "https://www.npmjs.com/package/@agentclientprotocol/claude-agent-acp (bin claude-agent-acp)"]
|
|
10227
|
-
}
|
|
10228
|
-
},
|
|
10229
|
-
codex: {
|
|
10230
|
-
binaries: ["codex"],
|
|
10231
|
-
interactive: (task) => task === void 0 ? [] : [task],
|
|
10232
|
-
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["-c", `model_reasoning_effort=${c.effort}`] : []],
|
|
10233
|
-
interactivePrompt: true,
|
|
10234
|
-
docs: ["https://developers.openai.com/codex/cli/reference (codex [PROMPT])", "reference/src/codex/codex-rs/tui/src/cli.rs (the optional PROMPT argument)"],
|
|
10235
|
-
acp: {
|
|
10236
|
-
binaries: ["codex-acp"],
|
|
10237
|
-
args: [],
|
|
10238
|
-
adapterPackage: "@agentclientprotocol/codex-acp",
|
|
10239
|
-
modes: {
|
|
10240
|
-
read: "read-only",
|
|
10241
|
-
edit: "workspace-write",
|
|
10242
|
-
full: "agent-full-access"
|
|
10243
|
-
},
|
|
10244
|
-
note: "Codex has no ACP server of its own. The ACP project's npm package @agentclientprotocol/codex-acp provides one and uses the Codex sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
10245
|
-
docs: [
|
|
10246
|
-
"https://github.com/agentclientprotocol/codex-acp (Apache-2.0, built on the Codex app server)",
|
|
10247
|
-
"https://www.npmjs.com/package/@agentclientprotocol/codex-acp (bin codex-acp)",
|
|
10248
|
-
"reference/src/codex/codex-rs/app-server (the app server it drives)"
|
|
10249
|
-
]
|
|
10250
|
-
}
|
|
10251
|
-
},
|
|
10252
|
-
opencode: {
|
|
10253
|
-
binaries: ["opencode"],
|
|
10254
|
-
interactive: (task) => task === void 0 ? [] : ["--prompt", task],
|
|
10255
|
-
modelArgs: (c) => c.model ? ["-m", c.model] : [],
|
|
10256
|
-
interactivePrompt: true,
|
|
10257
|
-
docs: ["https://opencode.ai/docs/cli/ (the TUI --prompt flag)", "reference/src/opencode/packages/cli/src/commands/commands.ts at v2.4.3 (--prompt)"],
|
|
10258
|
-
acp: {
|
|
10259
|
-
binaries: ["opencode"],
|
|
10260
|
-
args: ["acp"],
|
|
10261
|
-
modes: {
|
|
10262
|
-
read: "plan",
|
|
10263
|
-
edit: "build",
|
|
10264
|
-
full: "build"
|
|
10265
|
-
},
|
|
10266
|
-
note: "",
|
|
10267
|
-
docs: ["https://opencode.ai/docs/cli/acp/ (opencode acp, stdio, protocol version 1)", "reference/src/opencode/packages/opencode/src/cli/cmd/acp.ts"]
|
|
10268
|
-
}
|
|
10269
|
-
},
|
|
10270
|
-
antigravity: {
|
|
10271
|
-
binaries: ["agy"],
|
|
10272
|
-
interactive: () => [],
|
|
10273
|
-
modelArgs: (c) => [...c.model ? ["--model", c.model] : [], ...c.effort ? ["--effort", c.effort] : []],
|
|
10274
|
-
interactivePrompt: false,
|
|
10275
|
-
docs: ["https://antigravity.google/docs/cli/acp (agy)"],
|
|
10276
|
-
acp: {
|
|
10277
|
-
binaries: ["agy"],
|
|
10278
|
-
args: ["acp"],
|
|
10279
|
-
modes: {
|
|
10280
|
-
read: "plan",
|
|
10281
|
-
edit: "accept-edits",
|
|
10282
|
-
full: "default"
|
|
10283
|
-
},
|
|
10284
|
-
note: "Uses the sign-in cached by an interactive `agy`.",
|
|
10285
|
-
docs: ["https://antigravity.google/docs/cli/acp (agy acp, stdio)"]
|
|
10286
|
-
}
|
|
10287
|
-
},
|
|
10288
|
-
grok: {
|
|
10289
|
-
binaries: ["grok"],
|
|
10290
|
-
interactive: (task) => task === void 0 ? [] : [task],
|
|
10291
|
-
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["--reasoning-effort", c.effort] : []],
|
|
10292
|
-
interactivePrompt: true,
|
|
10293
|
-
docs: ["reference/src/grok-build/crates/codegen/xai-grok-pager/src/app/cli.rs (prompt)"],
|
|
10294
|
-
acp: {
|
|
10295
|
-
binaries: ["grok"],
|
|
10296
|
-
args: ["agent", "stdio"],
|
|
10297
|
-
note: "",
|
|
10298
|
-
docs: ["reference/src/grok-build/crates/codegen/xai-grok-pager/src/app/cli.rs (grok agent stdio)", "reference/src/grok-build/crates/codegen/xai-grok-pager/docs/user-guide/15-agent-mode.md"]
|
|
10299
|
-
}
|
|
10300
|
-
}
|
|
10301
|
-
};
|
|
10534
|
+
/**
|
|
10535
|
+
* What `conveno spawn` runs for each CLI, from the descriptors in `clis/`. Every flag there comes
|
|
10536
|
+
* from the CLI's own documentation or source; `docs` names where.
|
|
10537
|
+
*/
|
|
10538
|
+
const SPAWN_TABLE = Object.fromEntries(CLI_DESCRIPTORS.map((d) => [d.id, {
|
|
10539
|
+
binaries: d.binaries,
|
|
10540
|
+
...d.spawn
|
|
10541
|
+
}]));
|
|
10302
10542
|
const SPAWN_CLIS = Object.keys(SPAWN_TABLE);
|
|
10303
10543
|
const isSpawnCli = (cli) => Object.hasOwn(SPAWN_TABLE, cli);
|
|
10304
10544
|
/** The CLIs that have an ACP server Conveno can drive. */
|
|
@@ -10758,4 +10998,4 @@ async function waitForRegistration(deps, w) {
|
|
|
10758
10998
|
await deps.sleep(250);
|
|
10759
10999
|
}
|
|
10760
11000
|
}
|
|
10761
|
-
export {
|
|
11001
|
+
export { endTurnContinuation as $, SESSION_ENDED_TEXT as $n, readModelMenus as $t, baseName as A, validateRename as An, needsQuoting as At, compatStatus as B, CliKind as Bn, pendingTurn as Bt, agentCommand as C, takeAcpLaunchFile as Cn, number as Cr, leadLogPath as Ct, attachAcpSession as D, turnHops as Dn, markDelivered as Dt, askedMarker as E, tooManyUnreadMessage as En, logoutAccount as Et, clearOrchestrator as F, workerUnansweredOf as Fn, parseCmdShimTarget as Ft, dataDir as G, Message as Gn, planSpawn as Gt, createWmiWalker as H, EVENT_NAMES as Hn, pinnedAdapter as Ht, cliDeliveryTier as I, writeModelMenu as In, parsePs1ShimTarget as It, defaultProcessIo as J, PROTOCOL_VERSION as Jn, putInList as Jt, dataPaths as K, MessageId as Kn, pollDeviceCode as Kt, cliDescriptor as L, writePrivateFileSync as Ln, parseWorkerAccess as Lt, claimOrchestrator as M, waitForWorkBatch as Mn, oneWindowPerHost as Mt, claimSpawnRecord as N, workerAccessOf as Nn, ownSession as Nt, autoCandidates as O, uninstallLauncher as On, menuFromConfigOptions as Ot, cleanModelName as P, workerAskTimeoutOf as Pn, parseCliVersion as Pt, effectiveHolder as Q, RpcResponse as Qn, readInbox as Qt, clientProof as R, writeSettings as Rn, pendingForInjection as Rt, adapterNpxCommand as S, statusAfterLiveness as Sn, literal as Sr, leadLogLine as St, askedKey as T, takeWithinChars as Tn, string as Tr, loginAccountApi as Tt, currentAccessToken as U, EVENT_NOTIFICATION_METHOD as Un, planLauncher as Ut, completeLogin as V, DeviceId as Vn, pidAlive as Vt, daemonProof as W, EventPayload as Wn, planProgram as Wt, dropFromList as X, RelayPayload as Xn, readAncestry as Xt, detectRepo as Y, RELAY_CLIENT_NAME as Yn, readAccountTokens as Yt, editJson as Z, RpcErrorCode as Zn, readCommandLine as Zt, WORKER_UNANSWERED as _, signedInAccountApi as _n, socketPathTooLongMessage as _r, isOnline as _t, ConvenoError as a, renderBody as an, ipcMethods as ar, formatContinuation as at, acpOverrideVar as b, spawnSession as bn, boolean as br, launcherPath as bt, NOT_FROM_USER_NOTICE as c, requeueMessages as cn, makeEventNotification as cr, generateSessionName as ct, RESPONSE_BUDGET_BYTES as d, resolveWindowsCommand as dn, newMessageId as dr, hookLogPath as dt, readProcessList as en, SESSION_NAME_PATTERN as er, evaluateLiveness as et, SPAWN_CLIS as f, restrictToUser as fn, newSessionId as fr, hostAlive as ft, WORKER_ASK_TIMEOUT_CHOICES as g, senderOf as gn, sanitizeLine as gr, isObject as gt, WORKER_ACCESS as h, sameJson as hn, safeParse as hr, isFromOwner as ht, CLI_DESCRIPTORS as i, relayUrl as in, encodeFrame as ir, findOnPath as it, bindAccountDevice as j, waitForWork as jn, newAuthNonce as jt, autoLimitsFromEnv as k, updateSpawnRecord as kn, modelLabel as kt, NPX_SETUP_TIMEOUT_MS as l, resolveAcpProgram as ln, makeResult as lr, holderAfterDeparture as lt, SpawnError as m, runWaker as mn, parseRelayFrame as mr, isAntigravityApp as mt, CLAUDE_PENDING_TURN_FOLDER as n, readSpawnRecord as nn, createLineDecoder as nr, fetchAccountStatus as nt, FROM_USER_NOTICE as o, requestDeviceCode as on, isSocketPathTooLong as or, formatHookContext as ot, SPAWN_TABLE as p, runLaunchFile as pn, parseIpcRequest as pr, hostPidOf as pt, decideAutoContinue as q, OWNER_SESSION_ID as qn, proofsMatch as qt, CLIS as r, realSpawnDeps as rn, defaultSocketPath as rr, findModelOption as rt, HEARTBEAT_INTERVAL_MS as s, requeueEntries as sn, makeError as sr, formatInbox as st, AccountError as t, readSettings as tn, SessionId as tr, existedBefore as tt, ORCHESTRATOR_TASK_NOTICE as u, resolveRecipient as un, newDeviceId as ur, hookLogLine as ut, accessAllows as v, spawnRecordOfSession as vn, _enum as vr, jwtClaim as vt, appendHookLog as w, takeWithinBytes as wn, object as wr, loadJson as wt, adapterInstallCommand as x, startTurnContext as xn, discriminatedUnion as xr, launcherText as xt, ackEntries as y, spawnRecordPath as yn, array as yr, late as yt, compareVersions as z, CLI_KINDS as zn, pendingHookContext as zt };
|