@conveno/cli 0.2.0-rc.16 → 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-BtwJHwcr.js → acp-CFIh624o.js} +3 -3
- package/dist/{agy-relay-KS1DbLqD.js → agy-relay-BZ3d_-FS.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/daemon.js +4 -3627
- package/dist/{daemonError-DUP5zkiR.js → daemonError-CDgEtvy7.js} +1 -1
- package/dist/{dist-DVLAWfDg.js → dist-B7liMhCw.js} +10 -5
- package/dist/{dist-CkqMgCGl.js → dist-BOwFdixw.js} +8 -46
- package/dist/{dist-BqfYxlVP.js → dist-CFsDqevs.js} +3 -3
- package/dist/{dist-DnWOZkAu.js → dist-CSSvrcKr.js} +874 -458
- package/dist/{dist-XoKXwG-y.js → dist-D6Xoip5W.js} +5 -5
- package/dist/{dist-Ch3ohbIk.js → dist-DAVtixeC.js} +1 -1
- package/dist/{dist-X1bpJWck.js → dist-DTMnNySx.js} +1 -1
- package/dist/dist-DV9DhvJC.js +4509 -0
- package/dist/{hook-DHMu72Vf.js → hook-BA-tI6Oc.js} +2 -2
- package/dist/{hook-entry-CLAuy_HJ.js → hook-entry-BwzBtAnd.js} +29 -26
- package/dist/hook-entry-Cgt5ZH1s.js +1 -0
- package/dist/{main-DVIyOy85.js → main-BlS8BhhS.js} +15 -10
- package/dist/{pick-UDFASnAn.js → pick-BsMvXuDo.js} +1 -1
- package/dist/{run-B-UMVEQs.js → run-BtYGSOMi.js} +95 -98
- package/dist/{runtime-CU-5JQvj.js → runtime-CddqMa5-.js} +13 -36
- package/dist/{uninstall-jwneyeJm.js → uninstall-01_NStQ4.js} +32 -18
- package/dist/{watch-Cpp4Uwsd.js → watch-BIepRTXJ.js} +4 -4
- package/package.json +13 -13
- package/dist/dist-fwpPA9AY.js +0 -793
- package/dist/hook-entry-DY-CMxKE.js +0 -1
|
@@ -1,133 +1,10 @@
|
|
|
1
|
-
import { homedir, tmpdir } from "node:os";
|
|
1
|
+
import { homedir, tmpdir, userInfo } from "node:os";
|
|
2
2
|
import { dirname, join, posix, win32 } from "node:path";
|
|
3
|
-
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
3
|
+
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { accessSync, appendFileSync, chmodSync, closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
-
import {
|
|
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,76 +5567,328 @@ function superRefine(fn, params) {
|
|
|
5690
5567
|
function datetime(params) {
|
|
5691
5568
|
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
5692
5569
|
}
|
|
5693
|
-
// ../protocol/dist/
|
|
5694
|
-
const encoder = new TextEncoder();
|
|
5695
|
-
/** Number of bytes `s` occupies when encoded as UTF-8. */
|
|
5696
|
-
function utf8ByteLength(s) {
|
|
5697
|
-
return encoder.encode(s).length;
|
|
5698
|
-
}
|
|
5570
|
+
// ../protocol/dist/account-api.js
|
|
5699
5571
|
/**
|
|
5700
|
-
*
|
|
5701
|
-
*
|
|
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.
|
|
5702
5579
|
*/
|
|
5703
|
-
|
|
5704
|
-
|
|
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);
|
|
5705
5727
|
}
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
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");
|
|
5714
5747
|
}
|
|
5715
5748
|
/**
|
|
5716
|
-
*
|
|
5717
|
-
*
|
|
5718
|
-
*
|
|
5719
|
-
* next newline. Malformed JSON yields `invalid_json` for that line only.
|
|
5749
|
+
* Detect the best PRNG (pseudo-random number generator)
|
|
5750
|
+
* @param root The root to check from (global/window)
|
|
5751
|
+
* @returns The PRNG function
|
|
5720
5752
|
*/
|
|
5721
|
-
function
|
|
5722
|
-
const
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
error: {
|
|
5729
|
-
code: "line_too_long",
|
|
5730
|
-
message: `line exceeds ${maxLineBytes} bytes`
|
|
5731
|
-
}
|
|
5732
|
-
});
|
|
5733
|
-
const parseLine = (raw) => {
|
|
5734
|
-
const line = raw.endsWith("\r") ? raw.slice(0, -1) : raw;
|
|
5735
|
-
if (line.trim() === "") return [];
|
|
5736
|
-
try {
|
|
5737
|
-
return [{
|
|
5738
|
-
ok: true,
|
|
5739
|
-
value: JSON.parse(line)
|
|
5740
|
-
}];
|
|
5741
|
-
} catch (e) {
|
|
5742
|
-
return [{
|
|
5743
|
-
ok: false,
|
|
5744
|
-
error: {
|
|
5745
|
-
code: "invalid_json",
|
|
5746
|
-
message: e.message
|
|
5747
|
-
}
|
|
5748
|
-
}];
|
|
5749
|
-
}
|
|
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;
|
|
5750
5760
|
};
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
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
|
+
}
|
|
5822
|
+
// ../protocol/dist/index.js
|
|
5823
|
+
const encoder = new TextEncoder();
|
|
5824
|
+
/** Number of bytes `s` occupies when encoded as UTF-8. */
|
|
5825
|
+
function utf8ByteLength(s) {
|
|
5826
|
+
return encoder.encode(s).length;
|
|
5827
|
+
}
|
|
5828
|
+
/**
|
|
5829
|
+
* Make free text safe for a one-line display: control characters (newlines and tabs included)
|
|
5830
|
+
* become spaces, runs of whitespace collapse to one space, and the ends are trimmed.
|
|
5831
|
+
*/
|
|
5832
|
+
function sanitizeLine(s) {
|
|
5833
|
+
return s.replace(/[\p{Cc}\u2028\u2029]/gu, " ").replace(/\s+/g, " ").trim();
|
|
5834
|
+
}
|
|
5835
|
+
/** Maximum size of one NDJSON line, excluding the terminating newline. */
|
|
5836
|
+
const MAX_LINE_BYTES = 1048576;
|
|
5837
|
+
/** Serialise `obj` as one NDJSON line (JSON + `\n`). Throws if the line would exceed `maxLineBytes`. */
|
|
5838
|
+
function encodeFrame(obj, maxLineBytes = MAX_LINE_BYTES) {
|
|
5839
|
+
const json = JSON.stringify(obj);
|
|
5840
|
+
if (json === void 0) throw new TypeError("value is not JSON-serialisable");
|
|
5841
|
+
if (utf8ByteLength(json) > maxLineBytes) throw new RangeError(`frame exceeds ${maxLineBytes} bytes`);
|
|
5842
|
+
return `${json}\n`;
|
|
5843
|
+
}
|
|
5844
|
+
/**
|
|
5845
|
+
* Incremental NDJSON decoder. Handles lines split across chunks (including mid-UTF-8-sequence),
|
|
5846
|
+
* several lines in one chunk, CRLF, and blank lines (skipped). A line longer than `maxLineBytes`
|
|
5847
|
+
* yields one `line_too_long` error; the rest of that line is discarded so decoding resyncs at the
|
|
5848
|
+
* next newline. Malformed JSON yields `invalid_json` for that line only.
|
|
5849
|
+
*/
|
|
5850
|
+
function createLineDecoder(maxLineBytes = MAX_LINE_BYTES) {
|
|
5851
|
+
const utf8 = new TextDecoder("utf-8");
|
|
5852
|
+
let pending = "";
|
|
5853
|
+
let pendingBytes = 0;
|
|
5854
|
+
let discarding = false;
|
|
5855
|
+
const tooLong = () => ({
|
|
5856
|
+
ok: false,
|
|
5857
|
+
error: {
|
|
5858
|
+
code: "line_too_long",
|
|
5859
|
+
message: `line exceeds ${maxLineBytes} bytes`
|
|
5860
|
+
}
|
|
5861
|
+
});
|
|
5862
|
+
const parseLine = (raw) => {
|
|
5863
|
+
const line = raw.endsWith("\r") ? raw.slice(0, -1) : raw;
|
|
5864
|
+
if (line.trim() === "") return [];
|
|
5865
|
+
try {
|
|
5866
|
+
return [{
|
|
5867
|
+
ok: true,
|
|
5868
|
+
value: JSON.parse(line)
|
|
5869
|
+
}];
|
|
5870
|
+
} catch (e) {
|
|
5871
|
+
return [{
|
|
5872
|
+
ok: false,
|
|
5873
|
+
error: {
|
|
5874
|
+
code: "invalid_json",
|
|
5875
|
+
message: e.message
|
|
5876
|
+
}
|
|
5877
|
+
}];
|
|
5878
|
+
}
|
|
5879
|
+
};
|
|
5880
|
+
const decode = (chunk, last) => typeof chunk === "string" ? chunk : utf8.decode(chunk, { stream: !last });
|
|
5881
|
+
const consume = (text) => {
|
|
5882
|
+
const out = [];
|
|
5883
|
+
let start = 0;
|
|
5884
|
+
for (;;) {
|
|
5885
|
+
const nl = text.indexOf("\n", start);
|
|
5886
|
+
if (nl === -1) break;
|
|
5887
|
+
const segment = text.slice(start, nl);
|
|
5888
|
+
start = nl + 1;
|
|
5889
|
+
if (discarding) discarding = false;
|
|
5890
|
+
else if (pendingBytes + utf8ByteLength(segment) > maxLineBytes) out.push(tooLong());
|
|
5891
|
+
else out.push(...parseLine(pending + segment));
|
|
5763
5892
|
pending = "";
|
|
5764
5893
|
pendingBytes = 0;
|
|
5765
5894
|
}
|
|
@@ -5937,7 +6066,8 @@ const RelayState = _enum([
|
|
|
5937
6066
|
"connecting",
|
|
5938
6067
|
"connected",
|
|
5939
6068
|
"disconnected",
|
|
5940
|
-
"revoked"
|
|
6069
|
+
"revoked",
|
|
6070
|
+
"upgrade_required"
|
|
5941
6071
|
]);
|
|
5942
6072
|
const DeviceName = string().min(1).max(64);
|
|
5943
6073
|
const Fingerprint = string().min(1).max(64);
|
|
@@ -6218,6 +6348,8 @@ const Session = object({
|
|
|
6218
6348
|
});
|
|
6219
6349
|
/** Wire protocol identifier. Bumped only on breaking changes. */
|
|
6220
6350
|
const PROTOCOL_VERSION = "conveno/1";
|
|
6351
|
+
/** What a device's daemon calls itself in a relay `hello` (`client.name`). */
|
|
6352
|
+
const RELAY_CLIENT_NAME = "conveno-cli";
|
|
6221
6353
|
const ClientKind = _enum([
|
|
6222
6354
|
"mcp",
|
|
6223
6355
|
"cli",
|
|
@@ -6267,7 +6399,7 @@ const RegisterParams = object({
|
|
|
6267
6399
|
spawned: boolean().default(false),
|
|
6268
6400
|
/**
|
|
6269
6401
|
* A `conveno acp-host` registers the session it drives over the Agent Client Protocol: the
|
|
6270
|
-
* session's delivery tier is `acp`, and its host prompts it with waiting messages (section
|
|
6402
|
+
* session's delivery tier is `acp`, and its host prompts it with waiting messages (section 5.8).
|
|
6271
6403
|
*/
|
|
6272
6404
|
acp: boolean().default(false)
|
|
6273
6405
|
});
|
|
@@ -6718,20 +6850,30 @@ const b64Bytes = (n) => {
|
|
|
6718
6850
|
const RelayKey32 = b64Bytes(32);
|
|
6719
6851
|
/** A 64-byte Ed25519 signature, base64. */
|
|
6720
6852
|
const RelaySig = b64Bytes(64);
|
|
6853
|
+
/** Relay to device, first frame: a fresh nonce the device signs in `hello`. */
|
|
6854
|
+
const RelayChallenge = object({
|
|
6855
|
+
t: literal("challenge"),
|
|
6856
|
+
v,
|
|
6857
|
+
nonce: b64Bytes(32)
|
|
6858
|
+
});
|
|
6859
|
+
/** What sent a `hello`: the program and its version. Not signed; the relay only reads it. */
|
|
6860
|
+
const RelayClientInfo = object({
|
|
6861
|
+
name: string().min(1).max(64),
|
|
6862
|
+
version: string().min(1).max(64)
|
|
6863
|
+
});
|
|
6721
6864
|
const RelayFrame = discriminatedUnion("t", [
|
|
6722
|
-
|
|
6723
|
-
t: literal("challenge"),
|
|
6724
|
-
v,
|
|
6725
|
-
nonce: b64Bytes(32)
|
|
6726
|
-
}),
|
|
6865
|
+
RelayChallenge,
|
|
6727
6866
|
object({
|
|
6728
6867
|
t: literal("hello"),
|
|
6729
6868
|
v,
|
|
6730
6869
|
deviceId: DeviceId,
|
|
6731
6870
|
/** Ed25519 public key, base64. */
|
|
6732
6871
|
signingKey: RelayKey32,
|
|
6733
|
-
/** Ed25519 signature over the canonical hello bytes (PROTOCOL.md section
|
|
6734
|
-
sig: RelaySig
|
|
6872
|
+
/** Ed25519 signature over the canonical hello bytes (PROTOCOL.md section 6.2). */
|
|
6873
|
+
sig: RelaySig,
|
|
6874
|
+
client: RelayClientInfo.optional(),
|
|
6875
|
+
/** Optional protocol features the device supports, for the relay to branch on later. */
|
|
6876
|
+
features: array(string().min(1).max(64)).max(32).optional()
|
|
6735
6877
|
}),
|
|
6736
6878
|
object({
|
|
6737
6879
|
t: literal("ready"),
|
|
@@ -6780,7 +6922,9 @@ const RelayFrame = discriminatedUnion("t", [
|
|
|
6780
6922
|
object({
|
|
6781
6923
|
t: literal("error"),
|
|
6782
6924
|
code: string().min(1).max(64),
|
|
6783
|
-
message: string().max(1e3)
|
|
6925
|
+
message: string().max(1e3),
|
|
6926
|
+
/** With `upgrade_required`: the oldest client version the relay accepts. */
|
|
6927
|
+
minVersion: string().min(1).max(64).optional()
|
|
6784
6928
|
})
|
|
6785
6929
|
]);
|
|
6786
6930
|
/** A session as published to the owner's other devices. Process ids stay on their machine. */
|
|
@@ -6864,17 +7008,247 @@ function socketPathTooLongMessage(path, platform) {
|
|
|
6864
7008
|
return `The Conveno socket path is too long for this system (${utf8ByteLength(path)} bytes, the limit is ${max}): ${path}. Set XDG_RUNTIME_DIR to a shorter directory and try again.`;
|
|
6865
7009
|
}
|
|
6866
7010
|
// ../core/dist/index.js
|
|
7011
|
+
const defaultIsFile = (path) => {
|
|
7012
|
+
try {
|
|
7013
|
+
return statSync(path).isFile();
|
|
7014
|
+
} catch {
|
|
7015
|
+
return false;
|
|
7016
|
+
}
|
|
7017
|
+
};
|
|
7018
|
+
/** Environment variable lookup that ignores case, as Windows does (`Path`, `PATH`, `PathExt`). */
|
|
7019
|
+
function envGet(env, name) {
|
|
7020
|
+
const want = name.toLowerCase();
|
|
7021
|
+
for (const [k, v] of Object.entries(env)) if (k.toLowerCase() === want && v !== void 0) return v;
|
|
7022
|
+
}
|
|
7023
|
+
const DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
7024
|
+
/** Only these can be started safely: other PATHEXT entries (.JS, .VBS) open Windows Script Host. */
|
|
7025
|
+
const LAUNCHABLE = /* @__PURE__ */ new Set([
|
|
7026
|
+
".com",
|
|
7027
|
+
".exe",
|
|
7028
|
+
".bat",
|
|
7029
|
+
".cmd"
|
|
7030
|
+
]);
|
|
6867
7031
|
/**
|
|
6868
|
-
*
|
|
6869
|
-
*
|
|
6870
|
-
*
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
7032
|
+
* Find `command` the way cmd.exe does: each PATH directory in order, each PATHEXT extension in
|
|
7033
|
+
* order. A name that already ends in a launchable extension is tried as written first. Returns
|
|
7034
|
+
* undefined when nothing matches.
|
|
7035
|
+
*/
|
|
7036
|
+
function resolveWindowsCommand(command, env, isFile = defaultIsFile) {
|
|
7037
|
+
const exts = (envGet(env, "PATHEXT") ?? DEFAULT_PATHEXT).split(";").map((e) => e.trim()).filter((e) => LAUNCHABLE.has(e.toLowerCase()));
|
|
7038
|
+
const own = win32.extname(command).toLowerCase();
|
|
7039
|
+
const candidatesIn = (base) => [...LAUNCHABLE.has(own) ? [base] : [], ...exts.map((e) => base + e)];
|
|
7040
|
+
const dirs = /[\\/]/.test(command) || win32.isAbsolute(command) ? [""] : (envGet(env, "PATH") ?? "").split(";").map((d) => d.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean);
|
|
7041
|
+
for (const dir of dirs) for (const candidate of candidatesIn(dir === "" ? command : win32.join(dir, command))) if (isFile(candidate)) return candidate;
|
|
7042
|
+
}
|
|
7043
|
+
/** Characters cmd.exe treats specially, plus the ones cross-spawn escapes defensively. */
|
|
7044
|
+
const CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
7045
|
+
/** The program name part of a cmd.exe command line: escape only, never wrap in quotes. */
|
|
7046
|
+
function escapeCmdCommand(command) {
|
|
7047
|
+
return command.replace(CMD_META, "^$1");
|
|
7048
|
+
}
|
|
7049
|
+
/**
|
|
7050
|
+
* Quote one argument for a `cmd.exe /d /s /c "..."` command line, the way cross-spawn does:
|
|
7051
|
+
* make it safe for the program's own parser (backslashes before a quote are doubled, the quote
|
|
7052
|
+
* is backslash-escaped, the whole thing is wrapped in quotes), then caret-escape every
|
|
7053
|
+
* character cmd.exe would act on, including the quotes themselves.
|
|
7054
|
+
*/
|
|
7055
|
+
function escapeCmdArg(arg) {
|
|
7056
|
+
let a = `${arg}`;
|
|
7057
|
+
a = a.replace(/(\\*)"/g, "$1$1\\\"");
|
|
7058
|
+
a = a.replace(/(\\*)$/, "$1$1");
|
|
7059
|
+
a = `"${a}"`;
|
|
7060
|
+
return a.replace(CMD_META, "^$1");
|
|
7061
|
+
}
|
|
7062
|
+
/** `cmd.exe /d /s /c "<command line>"` for a .cmd or .bat file. */
|
|
7063
|
+
function cmdShimPlan(file, args, env) {
|
|
7064
|
+
const line = [escapeCmdCommand(file), ...args.map(escapeCmdArg)].join(" ");
|
|
7065
|
+
return {
|
|
7066
|
+
file: envGet(env, "ComSpec") || "cmd.exe",
|
|
7067
|
+
args: [
|
|
7068
|
+
"/d",
|
|
7069
|
+
"/s",
|
|
7070
|
+
"/c",
|
|
7071
|
+
`"${line}"`
|
|
7072
|
+
],
|
|
7073
|
+
windowsVerbatimArguments: true
|
|
7074
|
+
};
|
|
7075
|
+
}
|
|
7076
|
+
/**
|
|
7077
|
+
* What to spawn for `command args...`. On Windows the command is resolved on PATH: .exe and .com
|
|
7078
|
+
* run directly, .cmd and .bat (npm shims) go through cmd.exe with one quoted command line. Never
|
|
7079
|
+
* uses a shell option with an args array. Elsewhere, and when nothing is found, the command is
|
|
7080
|
+
* returned unchanged so the caller sees the normal ENOENT.
|
|
7081
|
+
*/
|
|
7082
|
+
function planSpawn(command, args, opts = {}) {
|
|
7083
|
+
if ((opts.platform ?? process.platform) !== "win32") return {
|
|
7084
|
+
file: command,
|
|
7085
|
+
args
|
|
7086
|
+
};
|
|
7087
|
+
const env = opts.env ?? process.env;
|
|
7088
|
+
const found = resolveWindowsCommand(command, env, opts.isFile);
|
|
7089
|
+
if (!found) return {
|
|
7090
|
+
file: command,
|
|
7091
|
+
args
|
|
7092
|
+
};
|
|
7093
|
+
const ext = win32.extname(found).toLowerCase();
|
|
7094
|
+
if (ext === ".cmd" || ext === ".bat") return cmdShimPlan(found, args, env);
|
|
7095
|
+
return {
|
|
7096
|
+
file: found,
|
|
7097
|
+
args
|
|
7098
|
+
};
|
|
7099
|
+
}
|
|
7100
|
+
/**
|
|
7101
|
+
* Files only the current user may read: account tokens, device keys, the daemon token. POSIX
|
|
7102
|
+
* gets mode 0600; Windows ignores the mode, so there the file gets a user-only ACL from icacls.
|
|
7103
|
+
*/
|
|
7104
|
+
/**
|
|
7105
|
+
* The icacls command that leaves only the current user with access to `path`: inherited entries
|
|
7106
|
+
* removed (`/inheritance:r`), full control granted to the user, replacing any earlier grant
|
|
7107
|
+
* (`/grant:r`). For a directory, `inherit` makes the grant apply to files and folders created in
|
|
7108
|
+
* it (`(OI)(CI)`), so they are user-only from the moment they exist.
|
|
7109
|
+
* See https://learn.microsoft.com/windows-server/administration/windows-commands/icacls.
|
|
7110
|
+
* icacls is run from System32 by absolute path, never looked up on PATH.
|
|
7111
|
+
*/
|
|
7112
|
+
function userOnlyAclPlan(path, env, user, isFile, inherit = false) {
|
|
7113
|
+
const systemRoot = env.SystemRoot ?? env.SYSTEMROOT ?? "C:\\Windows";
|
|
7114
|
+
const icacls = win32.join(systemRoot, "System32", "icacls.exe");
|
|
7115
|
+
const domain = env.USERDOMAIN;
|
|
7116
|
+
return planSpawn(icacls, [
|
|
7117
|
+
path,
|
|
7118
|
+
"/inheritance:r",
|
|
7119
|
+
"/grant:r",
|
|
7120
|
+
`${domain ? `${domain}\\${user}` : user}:${inherit ? "(OI)(CI)" : ""}F`
|
|
7121
|
+
], {
|
|
7122
|
+
platform: "win32",
|
|
7123
|
+
env,
|
|
7124
|
+
...isFile ? { isFile } : {}
|
|
7125
|
+
});
|
|
7126
|
+
}
|
|
7127
|
+
const runPlan = (plan) => {
|
|
7128
|
+
execFileSync(plan.file, plan.args, {
|
|
7129
|
+
stdio: "ignore",
|
|
7130
|
+
windowsHide: true,
|
|
7131
|
+
...plan.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
7132
|
+
});
|
|
7133
|
+
};
|
|
7134
|
+
/**
|
|
7135
|
+
* Make a file readable by the current user only: mode 0600 on POSIX, a user-only ACL on Windows
|
|
7136
|
+
* (where the mode is ignored). A directory gets 0700, or an ACL its new entries inherit.
|
|
7137
|
+
*/
|
|
7138
|
+
function restrictToUser(path, platform = process.platform, directory = false, run = runPlan, sid = currentUserSid) {
|
|
7139
|
+
if (platform !== "win32") {
|
|
7140
|
+
chmodSync(path, directory ? 448 : 384);
|
|
7141
|
+
return;
|
|
7142
|
+
}
|
|
7143
|
+
const id = sid();
|
|
7144
|
+
const env = {
|
|
7145
|
+
...process.env,
|
|
7146
|
+
USERDOMAIN: void 0
|
|
7147
|
+
};
|
|
7148
|
+
const principals = id ? [`*${id}`, userInfo().username] : [userInfo().username];
|
|
7149
|
+
for (const principal of principals) try {
|
|
7150
|
+
run(userOnlyAclPlan(path, env, principal, void 0, directory));
|
|
7151
|
+
return;
|
|
7152
|
+
} catch {}
|
|
7153
|
+
}
|
|
7154
|
+
let sidCache = null;
|
|
7155
|
+
/** The current user's SID from `whoami /user`, or undefined. Read once per process. */
|
|
7156
|
+
function currentUserSid() {
|
|
7157
|
+
if (sidCache !== null) return sidCache;
|
|
7158
|
+
sidCache = void 0;
|
|
7159
|
+
try {
|
|
7160
|
+
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
7161
|
+
const out = execFileSync(win32.join(systemRoot, "System32", "whoami.exe"), [
|
|
7162
|
+
"/user",
|
|
7163
|
+
"/fo",
|
|
7164
|
+
"csv",
|
|
7165
|
+
"/nh"
|
|
7166
|
+
], {
|
|
7167
|
+
encoding: "utf8",
|
|
7168
|
+
windowsHide: true,
|
|
7169
|
+
stdio: [
|
|
7170
|
+
"ignore",
|
|
7171
|
+
"pipe",
|
|
7172
|
+
"ignore"
|
|
7173
|
+
]
|
|
7174
|
+
});
|
|
7175
|
+
sidCache = /"(S-1-[0-9-]+)"/.exec(out)?.[1];
|
|
7176
|
+
} catch {}
|
|
7177
|
+
return sidCache;
|
|
7178
|
+
}
|
|
7179
|
+
const tmpName = (path) => `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
7180
|
+
const busy = (e) => {
|
|
7181
|
+
const code = e.code;
|
|
7182
|
+
return code === "EPERM" || code === "EACCES" || code === "EBUSY";
|
|
7183
|
+
};
|
|
7184
|
+
/**
|
|
7185
|
+
* Write `body` to `path`, readable by this user only. The file is written next to its final
|
|
7186
|
+
* place, restricted, then renamed over it, so a reader never sees a half-written file or one with
|
|
7187
|
+
* looser permissions (a rename on one volume keeps the ACL). On Windows the temporary file is
|
|
7188
|
+
* restricted while still empty, before the secret is written into it.
|
|
6874
7189
|
*/
|
|
6875
|
-
|
|
7190
|
+
async function writePrivateFile(path, body, o = {}) {
|
|
7191
|
+
const platform = o.platform ?? process.platform;
|
|
7192
|
+
const restrict = o.restrict ?? ((f) => restrictToUser(f, platform));
|
|
7193
|
+
await mkdir(dirname(path), { recursive: true });
|
|
7194
|
+
const tmp = tmpName(path);
|
|
7195
|
+
try {
|
|
7196
|
+
if (platform === "win32") {
|
|
7197
|
+
await writeFile(tmp, "", { flag: "wx" });
|
|
7198
|
+
restrict(tmp);
|
|
7199
|
+
await writeFile(tmp, body);
|
|
7200
|
+
} else {
|
|
7201
|
+
await writeFile(tmp, body, {
|
|
7202
|
+
mode: 384,
|
|
7203
|
+
flag: "wx"
|
|
7204
|
+
});
|
|
7205
|
+
restrict(tmp);
|
|
7206
|
+
}
|
|
7207
|
+
for (let attempt = 0;; attempt++) try {
|
|
7208
|
+
await rename(tmp, path);
|
|
7209
|
+
break;
|
|
7210
|
+
} catch (e) {
|
|
7211
|
+
if (platform !== "win32" || attempt >= 20 || !busy(e)) throw e;
|
|
7212
|
+
await new Promise((r) => setTimeout(r, Math.min(25 * (attempt + 1), 200)));
|
|
7213
|
+
}
|
|
7214
|
+
} catch (e) {
|
|
7215
|
+
await rm(tmp, { force: true });
|
|
7216
|
+
throw e;
|
|
7217
|
+
}
|
|
7218
|
+
}
|
|
7219
|
+
/** {@link writePrivateFile}, synchronously. */
|
|
7220
|
+
function writePrivateFileSync(path, body, o = {}) {
|
|
7221
|
+
const platform = o.platform ?? process.platform;
|
|
7222
|
+
const restrict = o.restrict ?? ((f) => restrictToUser(f, platform));
|
|
7223
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
7224
|
+
const tmp = tmpName(path);
|
|
7225
|
+
try {
|
|
7226
|
+
if (platform === "win32") {
|
|
7227
|
+
writeFileSync(tmp, "", { flag: "wx" });
|
|
7228
|
+
restrict(tmp);
|
|
7229
|
+
writeFileSync(tmp, body);
|
|
7230
|
+
} else {
|
|
7231
|
+
writeFileSync(tmp, body, {
|
|
7232
|
+
mode: 384,
|
|
7233
|
+
flag: "wx"
|
|
7234
|
+
});
|
|
7235
|
+
restrict(tmp);
|
|
7236
|
+
}
|
|
7237
|
+
const wait = new Int32Array(new SharedArrayBuffer(4));
|
|
7238
|
+
for (let attempt = 0;; attempt++) try {
|
|
7239
|
+
renameSync(tmp, path);
|
|
7240
|
+
break;
|
|
7241
|
+
} catch (e) {
|
|
7242
|
+
if (platform !== "win32" || attempt >= 20 || !busy(e)) throw e;
|
|
7243
|
+
Atomics.wait(wait, 0, 0, Math.min(25 * (attempt + 1), 200));
|
|
7244
|
+
}
|
|
7245
|
+
} catch (e) {
|
|
7246
|
+
rmSync(tmp, { force: true });
|
|
7247
|
+
throw e;
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
6876
7250
|
/** The `client_id` of the device authorization grant. The server accepts only this one. */
|
|
6877
|
-
const DEVICE_CLIENT_ID =
|
|
7251
|
+
const DEVICE_CLIENT_ID = ACCOUNT_DEVICE_CLIENT_ID;
|
|
6878
7252
|
/** Renew an access token this long before it expires, so a request never carries a dead one. */
|
|
6879
7253
|
const REFRESH_SKEW_MS = 6e4;
|
|
6880
7254
|
var AccountError = class extends Error {
|
|
@@ -6885,14 +7259,36 @@ var AccountError = class extends Error {
|
|
|
6885
7259
|
this.name = "AccountError";
|
|
6886
7260
|
}
|
|
6887
7261
|
};
|
|
6888
|
-
const
|
|
7262
|
+
const trimBase = (url) => url.replace(/\/+$/, "");
|
|
7263
|
+
const base = (io) => trimBase(io.apiBase ?? "https://api.conveno.dev");
|
|
7264
|
+
/** Where requests carrying these tokens go: the server that issued them, never another one. */
|
|
7265
|
+
const baseFor = (t, io) => t.apiBase ? trimBase(t.apiBase) : base(io);
|
|
6889
7266
|
const doFetch = (io) => io.fetch ?? fetch;
|
|
6890
7267
|
const clock = (io) => (io.now ?? Date.now)();
|
|
6891
7268
|
function isTokens(v) {
|
|
6892
7269
|
if (!v || typeof v !== "object") return false;
|
|
6893
7270
|
const t = v;
|
|
6894
|
-
return typeof t.accessToken === "string" && typeof t.refreshToken === "string" && t.refreshToken.length > 0 && typeof t.expiresAt === "number" && Number.isFinite(t.expiresAt);
|
|
7271
|
+
return typeof t.accessToken === "string" && typeof t.refreshToken === "string" && t.refreshToken.length > 0 && typeof t.expiresAt === "number" && Number.isFinite(t.expiresAt) && (t.apiBase === void 0 || typeof t.apiBase === "string" && t.apiBase.length > 0);
|
|
6895
7272
|
}
|
|
7273
|
+
/**
|
|
7274
|
+
* The account server for a new login: `CONVENO_API_URL`, else {@link ACCOUNT_API}. Every other
|
|
7275
|
+
* request uses {@link signedInAccountApi}.
|
|
7276
|
+
*/
|
|
7277
|
+
const loginAccountApi = (env = process.env) => trimBase(env.CONVENO_API_URL || "https://api.conveno.dev");
|
|
7278
|
+
/**
|
|
7279
|
+
* The account server of the saved login: the one saved in `account.json`, else
|
|
7280
|
+
* `CONVENO_API_URL`, else {@link ACCOUNT_API}. Also the server whose `/account` page the user
|
|
7281
|
+
* should visit.
|
|
7282
|
+
*/
|
|
7283
|
+
function signedInAccountApi(path, env = process.env) {
|
|
7284
|
+
try {
|
|
7285
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
7286
|
+
if (isTokens(parsed) && parsed.apiBase) return trimBase(parsed.apiBase);
|
|
7287
|
+
} catch {}
|
|
7288
|
+
return loginAccountApi(env);
|
|
7289
|
+
}
|
|
7290
|
+
/** The relay the daemon connects to: `CONVENO_RELAY_URL`, else {@link RELAY_URL}. */
|
|
7291
|
+
const relayUrl = (env = process.env) => env.CONVENO_RELAY_URL || "wss://relay.conveno.dev/v1/connect";
|
|
6896
7292
|
/** The saved tokens, or null when the user is not logged in or the file is unreadable. */
|
|
6897
7293
|
async function readAccountTokens(path) {
|
|
6898
7294
|
let text;
|
|
@@ -6908,27 +7304,14 @@ async function readAccountTokens(path) {
|
|
|
6908
7304
|
return null;
|
|
6909
7305
|
}
|
|
6910
7306
|
}
|
|
6911
|
-
/**
|
|
6912
|
-
* Save the tokens, readable by this user only. The file is written next to its final place with
|
|
6913
|
-
* the mode set at creation, then renamed over it, so a reader never sees a half-written file or
|
|
6914
|
-
* one with looser permissions.
|
|
6915
|
-
*/
|
|
7307
|
+
/** Save the tokens, readable by this user only. See {@link writePrivateFile}. */
|
|
6916
7308
|
async function writeAccountTokens(path, tokens) {
|
|
6917
|
-
await
|
|
6918
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
6919
|
-
const body = `${JSON.stringify({
|
|
7309
|
+
await writePrivateFile(path, `${JSON.stringify({
|
|
6920
7310
|
accessToken: tokens.accessToken,
|
|
6921
7311
|
refreshToken: tokens.refreshToken,
|
|
6922
|
-
expiresAt: tokens.expiresAt
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
await writeFile(tmp, body, { mode: 384 });
|
|
6926
|
-
await chmod(tmp, 384);
|
|
6927
|
-
await rename(tmp, path);
|
|
6928
|
-
} catch (e) {
|
|
6929
|
-
await rm(tmp, { force: true });
|
|
6930
|
-
throw e;
|
|
6931
|
-
}
|
|
7312
|
+
expiresAt: tokens.expiresAt,
|
|
7313
|
+
...tokens.apiBase ? { apiBase: tokens.apiBase } : {}
|
|
7314
|
+
}, null, 2)}\n`);
|
|
6932
7315
|
}
|
|
6933
7316
|
/** Delete the saved tokens. Returns whether there was a file. */
|
|
6934
7317
|
async function clearAccountTokens(path) {
|
|
@@ -6969,11 +7352,11 @@ async function requestAccessToken(refreshToken, io = {}) {
|
|
|
6969
7352
|
}
|
|
6970
7353
|
if (res.status === 401 || res.status === 403) throw new AccountError("session_expired", "The login has expired or was revoked.");
|
|
6971
7354
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
6972
|
-
const body = await res.json().catch(() => null);
|
|
6973
|
-
if (
|
|
6974
|
-
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;
|
|
6975
7358
|
return {
|
|
6976
|
-
accessToken: body.token,
|
|
7359
|
+
accessToken: body.data.token,
|
|
6977
7360
|
expiresAt
|
|
6978
7361
|
};
|
|
6979
7362
|
}
|
|
@@ -6982,8 +7365,12 @@ async function refreshAccountTokens(path, io = {}) {
|
|
|
6982
7365
|
const current = await readAccountTokens(path);
|
|
6983
7366
|
if (!current) throw new AccountError("not_logged_in", "Not logged in. Run conveno login.");
|
|
6984
7367
|
const next = {
|
|
6985
|
-
...await requestAccessToken(current.refreshToken,
|
|
6986
|
-
|
|
7368
|
+
...await requestAccessToken(current.refreshToken, {
|
|
7369
|
+
...io,
|
|
7370
|
+
apiBase: baseFor(current, io)
|
|
7371
|
+
}),
|
|
7372
|
+
refreshToken: current.refreshToken,
|
|
7373
|
+
...current.apiBase ? { apiBase: current.apiBase } : {}
|
|
6987
7374
|
};
|
|
6988
7375
|
await writeAccountTokens(path, next);
|
|
6989
7376
|
return next;
|
|
@@ -7014,7 +7401,7 @@ async function devicePost(path, route, deviceId, io) {
|
|
|
7014
7401
|
const tokens = await readAccountTokens(path);
|
|
7015
7402
|
if (!tokens) throw new AccountError("not_logged_in", "Not logged in. Run conveno login.");
|
|
7016
7403
|
try {
|
|
7017
|
-
return await doFetch(io)(`${
|
|
7404
|
+
return await doFetch(io)(`${baseFor(tokens, io)}/api/device/${route}`, {
|
|
7018
7405
|
method: "POST",
|
|
7019
7406
|
headers: {
|
|
7020
7407
|
authorization: `Bearer ${tokens.refreshToken}`,
|
|
@@ -7054,7 +7441,9 @@ async function fetchAccountStatus(refreshToken, io = {}) {
|
|
|
7054
7441
|
}
|
|
7055
7442
|
if (res.status === 401) throw new AccountError("session_expired", "The login has expired or was revoked.");
|
|
7056
7443
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
7057
|
-
|
|
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;
|
|
7058
7447
|
}
|
|
7059
7448
|
const json = (body) => ({
|
|
7060
7449
|
method: "POST",
|
|
@@ -7073,15 +7462,16 @@ async function requestDeviceCode(io = {}) {
|
|
|
7073
7462
|
throw new AccountError("network", "Could not reach the Conveno account server.");
|
|
7074
7463
|
}
|
|
7075
7464
|
if (!res.ok) throw new AccountError("server", `The account server answered ${res.status}.`);
|
|
7076
|
-
const
|
|
7077
|
-
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;
|
|
7078
7468
|
return {
|
|
7079
7469
|
deviceCode: b.device_code,
|
|
7080
7470
|
userCode: b.user_code,
|
|
7081
7471
|
verificationUri: b.verification_uri,
|
|
7082
|
-
verificationUriComplete:
|
|
7083
|
-
interval:
|
|
7084
|
-
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
|
|
7085
7475
|
};
|
|
7086
7476
|
}
|
|
7087
7477
|
const realSleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -7101,16 +7491,18 @@ async function pollDeviceCode(code, o = {}) {
|
|
|
7101
7491
|
let res;
|
|
7102
7492
|
try {
|
|
7103
7493
|
res = await doFetch(o)(`${base(o)}/api/auth/device/token`, json({
|
|
7104
|
-
grant_type:
|
|
7494
|
+
grant_type: DEVICE_GRANT_TYPE,
|
|
7105
7495
|
device_code: code.deviceCode,
|
|
7106
7496
|
client_id: DEVICE_CLIENT_ID
|
|
7107
7497
|
}));
|
|
7108
7498
|
} catch {
|
|
7109
7499
|
continue;
|
|
7110
7500
|
}
|
|
7111
|
-
const
|
|
7112
|
-
|
|
7113
|
-
|
|
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) {
|
|
7114
7506
|
case "authorization_pending": continue;
|
|
7115
7507
|
case "slow_down":
|
|
7116
7508
|
interval += 5;
|
|
@@ -7121,11 +7513,15 @@ async function pollDeviceCode(code, o = {}) {
|
|
|
7121
7513
|
}
|
|
7122
7514
|
}
|
|
7123
7515
|
}
|
|
7124
|
-
/**
|
|
7516
|
+
/**
|
|
7517
|
+
* After approval: keep the session token as the refresh token and get a first access token. The
|
|
7518
|
+
* account server is saved with them, so later requests go back to it.
|
|
7519
|
+
*/
|
|
7125
7520
|
async function completeLogin(path, sessionToken, io = {}) {
|
|
7126
7521
|
const tokens = {
|
|
7127
7522
|
...await requestAccessToken(sessionToken, io),
|
|
7128
|
-
refreshToken: sessionToken
|
|
7523
|
+
refreshToken: sessionToken,
|
|
7524
|
+
apiBase: base(io)
|
|
7129
7525
|
};
|
|
7130
7526
|
await writeAccountTokens(path, tokens);
|
|
7131
7527
|
return tokens;
|
|
@@ -7137,18 +7533,21 @@ async function completeLogin(path, sessionToken, io = {}) {
|
|
|
7137
7533
|
async function logoutAccount(path, io = {}) {
|
|
7138
7534
|
const tokens = await readAccountTokens(path);
|
|
7139
7535
|
let revoked = false;
|
|
7140
|
-
if (tokens)
|
|
7141
|
-
const
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7536
|
+
if (tokens) {
|
|
7537
|
+
const server = baseFor(tokens, io);
|
|
7538
|
+
try {
|
|
7539
|
+
const res = await doFetch(io)(`${server}/api/auth/sign-out`, {
|
|
7540
|
+
...json({}),
|
|
7541
|
+
headers: {
|
|
7542
|
+
"content-type": "application/json",
|
|
7543
|
+
authorization: `Bearer ${tokens.refreshToken}`,
|
|
7544
|
+
origin: server
|
|
7545
|
+
}
|
|
7546
|
+
});
|
|
7547
|
+
revoked = res.ok || res.status === 401;
|
|
7548
|
+
} catch {
|
|
7549
|
+
revoked = false;
|
|
7550
|
+
}
|
|
7152
7551
|
}
|
|
7153
7552
|
const removed = await clearAccountTokens(path);
|
|
7154
7553
|
return {
|
|
@@ -7157,19 +7556,205 @@ async function logoutAccount(path, io = {}) {
|
|
|
7157
7556
|
};
|
|
7158
7557
|
}
|
|
7159
7558
|
/**
|
|
7160
|
-
*
|
|
7161
|
-
*
|
|
7162
|
-
* instead of making a row. Codex runs every thread's MCP under one app-server process that several
|
|
7163
|
-
* 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.
|
|
7164
7561
|
*/
|
|
7165
|
-
const
|
|
7166
|
-
claude:
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
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
|
+
}
|
|
7171
7746
|
};
|
|
7172
|
-
|
|
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";
|
|
7173
7758
|
const pathApi$2 = (platform) => platform === "win32" ? win32 : posix;
|
|
7174
7759
|
/**
|
|
7175
7760
|
* Conveno data directory. Pure: platform, environment and home directory are arguments.
|
|
@@ -7216,7 +7801,11 @@ function dataPaths(platform, dir) {
|
|
|
7216
7801
|
/** Choices the user made, such as whether ACP adapters may be fetched with npx. See settings.ts. */
|
|
7217
7802
|
settings: p.join(dir, "settings.json"),
|
|
7218
7803
|
/** The models and effort levels each CLI offered its last worker. See worker-models.ts. */
|
|
7219
|
-
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")
|
|
7220
7809
|
};
|
|
7221
7810
|
}
|
|
7222
7811
|
/** Best effort: deletes the markers in `dir` not touched for `ASKED_MAX_AGE_MS`. */
|
|
@@ -8406,15 +8995,16 @@ const fallback = (env) => {
|
|
|
8406
8995
|
};
|
|
8407
8996
|
/**
|
|
8408
8997
|
* The command an agent runs for a Conveno helper of `cli`, as words (not yet quoted). Grok keeps a
|
|
8409
|
-
* plain `conveno` when the PATH one is this install.
|
|
8410
|
-
* `conveno.cmd
|
|
8411
|
-
* 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.
|
|
8412
9001
|
*/
|
|
8413
9002
|
function agentCommand(env, cli) {
|
|
8414
9003
|
const l = env.conveno.launcher;
|
|
8415
9004
|
if (!l) return env.conveno.command;
|
|
8416
|
-
|
|
8417
|
-
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"];
|
|
8418
9008
|
if (l.spaced) return fallback(env);
|
|
8419
9009
|
return [slashed(l.path, env.platform)];
|
|
8420
9010
|
}
|
|
@@ -8618,95 +9208,6 @@ function pendingTurn(dir, folder) {
|
|
|
8618
9208
|
}
|
|
8619
9209
|
};
|
|
8620
9210
|
}
|
|
8621
|
-
const defaultIsFile = (path) => {
|
|
8622
|
-
try {
|
|
8623
|
-
return statSync(path).isFile();
|
|
8624
|
-
} catch {
|
|
8625
|
-
return false;
|
|
8626
|
-
}
|
|
8627
|
-
};
|
|
8628
|
-
/** Environment variable lookup that ignores case, as Windows does (`Path`, `PATH`, `PathExt`). */
|
|
8629
|
-
function envGet(env, name) {
|
|
8630
|
-
const want = name.toLowerCase();
|
|
8631
|
-
for (const [k, v] of Object.entries(env)) if (k.toLowerCase() === want && v !== void 0) return v;
|
|
8632
|
-
}
|
|
8633
|
-
const DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
8634
|
-
/** Only these can be started safely: other PATHEXT entries (.JS, .VBS) open Windows Script Host. */
|
|
8635
|
-
const LAUNCHABLE = /* @__PURE__ */ new Set([
|
|
8636
|
-
".com",
|
|
8637
|
-
".exe",
|
|
8638
|
-
".bat",
|
|
8639
|
-
".cmd"
|
|
8640
|
-
]);
|
|
8641
|
-
/**
|
|
8642
|
-
* Find `command` the way cmd.exe does: each PATH directory in order, each PATHEXT extension in
|
|
8643
|
-
* order. A name that already ends in a launchable extension is tried as written first. Returns
|
|
8644
|
-
* undefined when nothing matches.
|
|
8645
|
-
*/
|
|
8646
|
-
function resolveWindowsCommand(command, env, isFile = defaultIsFile) {
|
|
8647
|
-
const exts = (envGet(env, "PATHEXT") ?? DEFAULT_PATHEXT).split(";").map((e) => e.trim()).filter((e) => LAUNCHABLE.has(e.toLowerCase()));
|
|
8648
|
-
const own = win32.extname(command).toLowerCase();
|
|
8649
|
-
const candidatesIn = (base) => [...LAUNCHABLE.has(own) ? [base] : [], ...exts.map((e) => base + e)];
|
|
8650
|
-
const dirs = /[\\/]/.test(command) || win32.isAbsolute(command) ? [""] : (envGet(env, "PATH") ?? "").split(";").map((d) => d.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean);
|
|
8651
|
-
for (const dir of dirs) for (const candidate of candidatesIn(dir === "" ? command : win32.join(dir, command))) if (isFile(candidate)) return candidate;
|
|
8652
|
-
}
|
|
8653
|
-
/** Characters cmd.exe treats specially, plus the ones cross-spawn escapes defensively. */
|
|
8654
|
-
const CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
8655
|
-
/** The program name part of a cmd.exe command line: escape only, never wrap in quotes. */
|
|
8656
|
-
function escapeCmdCommand(command) {
|
|
8657
|
-
return command.replace(CMD_META, "^$1");
|
|
8658
|
-
}
|
|
8659
|
-
/**
|
|
8660
|
-
* Quote one argument for a `cmd.exe /d /s /c "..."` command line, the way cross-spawn does:
|
|
8661
|
-
* make it safe for the program's own parser (backslashes before a quote are doubled, the quote
|
|
8662
|
-
* is backslash-escaped, the whole thing is wrapped in quotes), then caret-escape every
|
|
8663
|
-
* character cmd.exe would act on, including the quotes themselves.
|
|
8664
|
-
*/
|
|
8665
|
-
function escapeCmdArg(arg) {
|
|
8666
|
-
let a = `${arg}`;
|
|
8667
|
-
a = a.replace(/(\\*)"/g, "$1$1\\\"");
|
|
8668
|
-
a = a.replace(/(\\*)$/, "$1$1");
|
|
8669
|
-
a = `"${a}"`;
|
|
8670
|
-
return a.replace(CMD_META, "^$1");
|
|
8671
|
-
}
|
|
8672
|
-
/** `cmd.exe /d /s /c "<command line>"` for a .cmd or .bat file. */
|
|
8673
|
-
function cmdShimPlan(file, args, env) {
|
|
8674
|
-
const line = [escapeCmdCommand(file), ...args.map(escapeCmdArg)].join(" ");
|
|
8675
|
-
return {
|
|
8676
|
-
file: envGet(env, "ComSpec") || "cmd.exe",
|
|
8677
|
-
args: [
|
|
8678
|
-
"/d",
|
|
8679
|
-
"/s",
|
|
8680
|
-
"/c",
|
|
8681
|
-
`"${line}"`
|
|
8682
|
-
],
|
|
8683
|
-
windowsVerbatimArguments: true
|
|
8684
|
-
};
|
|
8685
|
-
}
|
|
8686
|
-
/**
|
|
8687
|
-
* What to spawn for `command args...`. On Windows the command is resolved on PATH: .exe and .com
|
|
8688
|
-
* run directly, .cmd and .bat (npm shims) go through cmd.exe with one quoted command line. Never
|
|
8689
|
-
* uses a shell option with an args array. Elsewhere, and when nothing is found, the command is
|
|
8690
|
-
* returned unchanged so the caller sees the normal ENOENT.
|
|
8691
|
-
*/
|
|
8692
|
-
function planSpawn(command, args, opts = {}) {
|
|
8693
|
-
if ((opts.platform ?? process.platform) !== "win32") return {
|
|
8694
|
-
file: command,
|
|
8695
|
-
args
|
|
8696
|
-
};
|
|
8697
|
-
const env = opts.env ?? process.env;
|
|
8698
|
-
const found = resolveWindowsCommand(command, env, opts.isFile);
|
|
8699
|
-
if (!found) return {
|
|
8700
|
-
file: command,
|
|
8701
|
-
args
|
|
8702
|
-
};
|
|
8703
|
-
const ext = win32.extname(found).toLowerCase();
|
|
8704
|
-
if (ext === ".cmd" || ext === ".bat") return cmdShimPlan(found, args, env);
|
|
8705
|
-
return {
|
|
8706
|
-
file: found,
|
|
8707
|
-
args
|
|
8708
|
-
};
|
|
8709
|
-
}
|
|
8710
9211
|
function exec(file, args, timeoutMs) {
|
|
8711
9212
|
const plan = planSpawn(file, args);
|
|
8712
9213
|
return new Promise((resolve) => {
|
|
@@ -10030,99 +10531,14 @@ function realSpawnDeps(opts) {
|
|
|
10030
10531
|
})
|
|
10031
10532
|
};
|
|
10032
10533
|
}
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
binaries: ["claude-agent-acp"],
|
|
10042
|
-
args: [],
|
|
10043
|
-
adapterPackage: "@agentclientprotocol/claude-agent-acp",
|
|
10044
|
-
modes: {
|
|
10045
|
-
read: "plan",
|
|
10046
|
-
edit: "acceptEdits",
|
|
10047
|
-
full: "bypassPermissions"
|
|
10048
|
-
},
|
|
10049
|
-
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.",
|
|
10050
|
-
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)"]
|
|
10051
|
-
}
|
|
10052
|
-
},
|
|
10053
|
-
codex: {
|
|
10054
|
-
binaries: ["codex"],
|
|
10055
|
-
interactive: (task) => task === void 0 ? [] : [task],
|
|
10056
|
-
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["-c", `model_reasoning_effort=${c.effort}`] : []],
|
|
10057
|
-
interactivePrompt: true,
|
|
10058
|
-
docs: ["https://developers.openai.com/codex/cli/reference (codex [PROMPT])", "reference/src/codex/codex-rs/tui/src/cli.rs (the optional PROMPT argument)"],
|
|
10059
|
-
acp: {
|
|
10060
|
-
binaries: ["codex-acp"],
|
|
10061
|
-
args: [],
|
|
10062
|
-
adapterPackage: "@agentclientprotocol/codex-acp",
|
|
10063
|
-
modes: {
|
|
10064
|
-
read: "read-only",
|
|
10065
|
-
edit: "workspace-write",
|
|
10066
|
-
full: "agent-full-access"
|
|
10067
|
-
},
|
|
10068
|
-
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.",
|
|
10069
|
-
docs: [
|
|
10070
|
-
"https://github.com/agentclientprotocol/codex-acp (Apache-2.0, built on the Codex app server)",
|
|
10071
|
-
"https://www.npmjs.com/package/@agentclientprotocol/codex-acp (bin codex-acp)",
|
|
10072
|
-
"reference/src/codex/codex-rs/app-server (the app server it drives)"
|
|
10073
|
-
]
|
|
10074
|
-
}
|
|
10075
|
-
},
|
|
10076
|
-
opencode: {
|
|
10077
|
-
binaries: ["opencode"],
|
|
10078
|
-
interactive: (task) => task === void 0 ? [] : ["--prompt", task],
|
|
10079
|
-
modelArgs: (c) => c.model ? ["-m", c.model] : [],
|
|
10080
|
-
interactivePrompt: true,
|
|
10081
|
-
docs: ["https://opencode.ai/docs/cli/ (the TUI --prompt flag)", "reference/src/opencode/packages/cli/src/commands/commands.ts at v2.4.3 (--prompt)"],
|
|
10082
|
-
acp: {
|
|
10083
|
-
binaries: ["opencode"],
|
|
10084
|
-
args: ["acp"],
|
|
10085
|
-
modes: {
|
|
10086
|
-
read: "plan",
|
|
10087
|
-
edit: "build",
|
|
10088
|
-
full: "build"
|
|
10089
|
-
},
|
|
10090
|
-
note: "",
|
|
10091
|
-
docs: ["https://opencode.ai/docs/cli/acp/ (opencode acp, stdio, protocol version 1)", "reference/src/opencode/packages/opencode/src/cli/cmd/acp.ts"]
|
|
10092
|
-
}
|
|
10093
|
-
},
|
|
10094
|
-
antigravity: {
|
|
10095
|
-
binaries: ["agy"],
|
|
10096
|
-
interactive: () => [],
|
|
10097
|
-
modelArgs: (c) => [...c.model ? ["--model", c.model] : [], ...c.effort ? ["--effort", c.effort] : []],
|
|
10098
|
-
interactivePrompt: false,
|
|
10099
|
-
docs: ["https://antigravity.google/docs/cli/acp (agy)"],
|
|
10100
|
-
acp: {
|
|
10101
|
-
binaries: ["agy"],
|
|
10102
|
-
args: ["acp"],
|
|
10103
|
-
modes: {
|
|
10104
|
-
read: "plan",
|
|
10105
|
-
edit: "accept-edits",
|
|
10106
|
-
full: "default"
|
|
10107
|
-
},
|
|
10108
|
-
note: "Uses the sign-in cached by an interactive `agy`.",
|
|
10109
|
-
docs: ["https://antigravity.google/docs/cli/acp (agy acp, stdio)"]
|
|
10110
|
-
}
|
|
10111
|
-
},
|
|
10112
|
-
grok: {
|
|
10113
|
-
binaries: ["grok"],
|
|
10114
|
-
interactive: (task) => task === void 0 ? [] : [task],
|
|
10115
|
-
modelArgs: (c) => [...c.model ? ["-m", c.model] : [], ...c.effort ? ["--reasoning-effort", c.effort] : []],
|
|
10116
|
-
interactivePrompt: true,
|
|
10117
|
-
docs: ["reference/src/grok-build/crates/codegen/xai-grok-pager/src/app/cli.rs (prompt)"],
|
|
10118
|
-
acp: {
|
|
10119
|
-
binaries: ["grok"],
|
|
10120
|
-
args: ["agent", "stdio"],
|
|
10121
|
-
note: "",
|
|
10122
|
-
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"]
|
|
10123
|
-
}
|
|
10124
|
-
}
|
|
10125
|
-
};
|
|
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
|
+
}]));
|
|
10126
10542
|
const SPAWN_CLIS = Object.keys(SPAWN_TABLE);
|
|
10127
10543
|
const isSpawnCli = (cli) => Object.hasOwn(SPAWN_TABLE, cli);
|
|
10128
10544
|
/** The CLIs that have an ACP server Conveno can drive. */
|
|
@@ -10582,4 +10998,4 @@ async function waitForRegistration(deps, w) {
|
|
|
10582
10998
|
await deps.sleep(250);
|
|
10583
10999
|
}
|
|
10584
11000
|
}
|
|
10585
|
-
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 };
|