replicas-cli 0.3.431 → 0.3.433
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +116 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38498,7 +38498,7 @@ var CLI_VERSION;
|
|
|
38498
38498
|
var init_cli_version = __esm({
|
|
38499
38499
|
"../shared/src/cli-version.ts"() {
|
|
38500
38500
|
"use strict";
|
|
38501
|
-
CLI_VERSION = "0.3.
|
|
38501
|
+
CLI_VERSION = "0.3.433";
|
|
38502
38502
|
}
|
|
38503
38503
|
});
|
|
38504
38504
|
|
|
@@ -38536,6 +38536,101 @@ var init_chat_tabs = __esm({
|
|
|
38536
38536
|
}
|
|
38537
38537
|
});
|
|
38538
38538
|
|
|
38539
|
+
// ../shared/src/engine/exec-protocol.ts
|
|
38540
|
+
var EXEC_MAX_FRAME_BYTES, EXEC_DEFAULT_READ_BYTES, EXEC_PROCESS_BUFFER_BYTES, EXEC_DEFAULT_IDLE_TTL_MS, EXEC_MAX_IDLE_TTL_MS, encoder2, decoder2, EXEC_ERROR_CODES, execRequestSchema, execStartedSchema, execExitSchema, execReplySchemas, execEventSchema, execErrorBodySchema;
|
|
38541
|
+
var init_exec_protocol = __esm({
|
|
38542
|
+
"../shared/src/engine/exec-protocol.ts"() {
|
|
38543
|
+
"use strict";
|
|
38544
|
+
init_zod();
|
|
38545
|
+
EXEC_MAX_FRAME_BYTES = 16 * 1024 * 1024;
|
|
38546
|
+
EXEC_DEFAULT_READ_BYTES = 8 * 1024 * 1024;
|
|
38547
|
+
EXEC_PROCESS_BUFFER_BYTES = 2 * 1024 * 1024;
|
|
38548
|
+
EXEC_DEFAULT_IDLE_TTL_MS = 30 * 6e4;
|
|
38549
|
+
EXEC_MAX_IDLE_TTL_MS = 24 * 60 * 6e4;
|
|
38550
|
+
encoder2 = new TextEncoder();
|
|
38551
|
+
decoder2 = new TextDecoder();
|
|
38552
|
+
EXEC_ERROR_CODES = [
|
|
38553
|
+
"ENOENT",
|
|
38554
|
+
"EISDIR",
|
|
38555
|
+
"ENOTDIR",
|
|
38556
|
+
"EACCES",
|
|
38557
|
+
"EEXIST",
|
|
38558
|
+
"EINVAL",
|
|
38559
|
+
"EFBIG",
|
|
38560
|
+
"ESRCH",
|
|
38561
|
+
"ENOTSUP",
|
|
38562
|
+
"spawn_error",
|
|
38563
|
+
"aborted",
|
|
38564
|
+
"lost",
|
|
38565
|
+
"unknown"
|
|
38566
|
+
];
|
|
38567
|
+
execRequestSchema = external_exports.object({
|
|
38568
|
+
/** The thread that owns the process; ending the thread kills its processes. */
|
|
38569
|
+
threadId: external_exports.string().min(1),
|
|
38570
|
+
label: external_exports.string().max(200).optional(),
|
|
38571
|
+
/** Run through bash; `login` (default true) sources the login profile like Codex's `bash -lc`. */
|
|
38572
|
+
command: external_exports.string().min(1).optional(),
|
|
38573
|
+
argv: external_exports.array(external_exports.string()).min(1).optional(),
|
|
38574
|
+
login: external_exports.boolean().optional(),
|
|
38575
|
+
cwd: external_exports.string().min(1).optional(),
|
|
38576
|
+
env: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
38577
|
+
/** Kill after this long, whoever is attached. */
|
|
38578
|
+
timeoutMs: external_exports.number().int().positive().optional(),
|
|
38579
|
+
/** Kill after this long with nobody attached. */
|
|
38580
|
+
idleTtlMs: external_exports.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional()
|
|
38581
|
+
}).refine((body) => body.command === void 0 !== (body.argv === void 0), { message: "Pass exactly one of command or argv" });
|
|
38582
|
+
execStartedSchema = external_exports.object({ processId: external_exports.string(), pid: external_exports.number() });
|
|
38583
|
+
execExitSchema = external_exports.object({ exitCode: external_exports.number(), signal: external_exports.string().nullable(), reason: external_exports.enum(["exit", "timeout", "killed", "idle"]) });
|
|
38584
|
+
execReplySchemas = {
|
|
38585
|
+
hello: external_exports.object({
|
|
38586
|
+
protocol: external_exports.number(),
|
|
38587
|
+
version: external_exports.string(),
|
|
38588
|
+
os: external_exports.string(),
|
|
38589
|
+
arch: external_exports.string(),
|
|
38590
|
+
home: external_exports.string(),
|
|
38591
|
+
root: external_exports.string(),
|
|
38592
|
+
bootId: external_exports.string(),
|
|
38593
|
+
features: external_exports.array(external_exports.string())
|
|
38594
|
+
}),
|
|
38595
|
+
stat: external_exports.object({ kind: external_exports.enum(["file", "directory", "symlink", "other"]), size: external_exports.number(), mtimeMs: external_exports.number() }),
|
|
38596
|
+
read: external_exports.object({ size: external_exports.number() }),
|
|
38597
|
+
write: external_exports.object({ bytes: external_exports.number() }),
|
|
38598
|
+
exit: execExitSchema,
|
|
38599
|
+
kill: external_exports.object({}).strip(),
|
|
38600
|
+
killThread: external_exports.object({ killed: external_exports.number() }),
|
|
38601
|
+
list: external_exports.object({
|
|
38602
|
+
processes: external_exports.array(execStartedSchema.extend({
|
|
38603
|
+
threadId: external_exports.string(),
|
|
38604
|
+
label: external_exports.string().nullable(),
|
|
38605
|
+
command: external_exports.string(),
|
|
38606
|
+
startedAt: external_exports.string(),
|
|
38607
|
+
outputBytes: external_exports.number(),
|
|
38608
|
+
bufferStart: external_exports.number(),
|
|
38609
|
+
exit: execExitSchema.nullable()
|
|
38610
|
+
}))
|
|
38611
|
+
})
|
|
38612
|
+
};
|
|
38613
|
+
execEventSchema = external_exports.discriminatedUnion("kind", [
|
|
38614
|
+
execStartedSchema.extend({ kind: external_exports.literal("started") }),
|
|
38615
|
+
external_exports.object({ kind: external_exports.literal("output"), stream: external_exports.enum(["stdout", "stderr"]), offset: external_exports.number() }),
|
|
38616
|
+
external_exports.object({ kind: external_exports.literal("skipped"), offset: external_exports.number(), bytes: external_exports.number() })
|
|
38617
|
+
]);
|
|
38618
|
+
execErrorBodySchema = external_exports.object({ code: external_exports.enum(EXEC_ERROR_CODES), message: external_exports.string(), path: external_exports.string().optional() });
|
|
38619
|
+
}
|
|
38620
|
+
});
|
|
38621
|
+
|
|
38622
|
+
// ../shared/src/engine/exec-client.ts
|
|
38623
|
+
var RECONNECT_GIVE_UP_MS, encoder3;
|
|
38624
|
+
var init_exec_client = __esm({
|
|
38625
|
+
"../shared/src/engine/exec-client.ts"() {
|
|
38626
|
+
"use strict";
|
|
38627
|
+
init_result();
|
|
38628
|
+
init_exec_protocol();
|
|
38629
|
+
RECONNECT_GIVE_UP_MS = 2 * 6e4;
|
|
38630
|
+
encoder3 = new TextEncoder();
|
|
38631
|
+
}
|
|
38632
|
+
});
|
|
38633
|
+
|
|
38539
38634
|
// ../shared/src/engine/webhook.ts
|
|
38540
38635
|
var init_webhook = __esm({
|
|
38541
38636
|
"../shared/src/engine/webhook.ts"() {
|
|
@@ -49551,14 +49646,14 @@ function parseSseChunk(chunk) {
|
|
|
49551
49646
|
}
|
|
49552
49647
|
async function* iterateSseStream(body, onChunk) {
|
|
49553
49648
|
const reader = body.getReader();
|
|
49554
|
-
const
|
|
49649
|
+
const decoder3 = new TextDecoder();
|
|
49555
49650
|
let buffer = "";
|
|
49556
49651
|
let searchFrom = 0;
|
|
49557
49652
|
while (true) {
|
|
49558
49653
|
const { done, value } = await reader.read();
|
|
49559
49654
|
if (done) break;
|
|
49560
49655
|
onChunk?.();
|
|
49561
|
-
buffer +=
|
|
49656
|
+
buffer += decoder3.decode(value, { stream: true });
|
|
49562
49657
|
let end = buffer.indexOf("\n\n", searchFrom);
|
|
49563
49658
|
while (end >= 0) {
|
|
49564
49659
|
const event = parseSseChunk(buffer.slice(0, end));
|
|
@@ -49766,6 +49861,8 @@ var init_src = __esm({
|
|
|
49766
49861
|
init_environment_files();
|
|
49767
49862
|
init_chat_tabs();
|
|
49768
49863
|
init_environment2();
|
|
49864
|
+
init_exec_protocol();
|
|
49865
|
+
init_exec_client();
|
|
49769
49866
|
init_types4();
|
|
49770
49867
|
init_v1();
|
|
49771
49868
|
init_chat_kind();
|
|
@@ -51722,6 +51819,15 @@ var init_codex_auth2 = __esm({
|
|
|
51722
51819
|
}
|
|
51723
51820
|
});
|
|
51724
51821
|
|
|
51822
|
+
// ../shared/src/claude-setup-token.ts
|
|
51823
|
+
var CLAUDE_SETUP_TOKEN_LIFETIME_SECONDS;
|
|
51824
|
+
var init_claude_setup_token = __esm({
|
|
51825
|
+
"../shared/src/claude-setup-token.ts"() {
|
|
51826
|
+
"use strict";
|
|
51827
|
+
CLAUDE_SETUP_TOKEN_LIFETIME_SECONDS = 365 * 24 * 60 * 60;
|
|
51828
|
+
}
|
|
51829
|
+
});
|
|
51830
|
+
|
|
51725
51831
|
// src/lib/claude-oauth.ts
|
|
51726
51832
|
function buildAuthorizationUrl2(codeChallenge, state) {
|
|
51727
51833
|
const params = new URLSearchParams({
|
|
@@ -51782,7 +51888,7 @@ async function exchangeCodeForTokens2(code, state, expectedState, codeVerifier)
|
|
|
51782
51888
|
client_id: CLAUDE_CLIENT_ID,
|
|
51783
51889
|
redirect_uri: REDIRECT_URI,
|
|
51784
51890
|
code_verifier: codeVerifier,
|
|
51785
|
-
expires_in:
|
|
51891
|
+
expires_in: CLAUDE_SETUP_TOKEN_LIFETIME_SECONDS
|
|
51786
51892
|
};
|
|
51787
51893
|
const response = await fetch(TOKEN_ENDPOINT2, {
|
|
51788
51894
|
method: "POST",
|
|
@@ -51800,7 +51906,7 @@ async function exchangeCodeForTokens2(code, state, expectedState, codeVerifier)
|
|
|
51800
51906
|
accessToken: data.access_token,
|
|
51801
51907
|
tokenType: data.token_type,
|
|
51802
51908
|
scope: data.scope,
|
|
51803
|
-
expiresAt: new Date(Date.now() + (data.expires_in ??
|
|
51909
|
+
expiresAt: new Date(Date.now() + (data.expires_in ?? CLAUDE_SETUP_TOKEN_LIFETIME_SECONDS) * 1e3).toISOString(),
|
|
51804
51910
|
accountEmail: data.account?.email_address
|
|
51805
51911
|
};
|
|
51806
51912
|
}
|
|
@@ -51821,7 +51927,7 @@ async function runClaudeOAuthFlow(totalSteps) {
|
|
|
51821
51927
|
}
|
|
51822
51928
|
return exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
51823
51929
|
}
|
|
51824
|
-
var import_readline, import_chalk15, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES
|
|
51930
|
+
var import_readline, import_chalk15, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES;
|
|
51825
51931
|
var init_claude_oauth = __esm({
|
|
51826
51932
|
"src/lib/claude-oauth.ts"() {
|
|
51827
51933
|
"use strict";
|
|
@@ -51830,13 +51936,13 @@ var init_claude_oauth = __esm({
|
|
|
51830
51936
|
init_oauth_flow_ui();
|
|
51831
51937
|
init_output();
|
|
51832
51938
|
init_pkce();
|
|
51939
|
+
init_claude_setup_token();
|
|
51833
51940
|
DEFAULT_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
51834
51941
|
CLAUDE_CLIENT_ID = process.env.CLAUDE_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID;
|
|
51835
51942
|
AUTHORIZATION_ENDPOINT2 = "https://claude.com/cai/oauth/authorize";
|
|
51836
51943
|
TOKEN_ENDPOINT2 = "https://platform.claude.com/v1/oauth/token";
|
|
51837
51944
|
REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
51838
51945
|
SCOPES = "user:inference";
|
|
51839
|
-
TOKEN_LIFETIME_SECONDS = 365 * 24 * 60 * 60;
|
|
51840
51946
|
}
|
|
51841
51947
|
});
|
|
51842
51948
|
|
|
@@ -55554,7 +55660,7 @@ async function gpuDeleteCommand(id, options) {
|
|
|
55554
55660
|
}
|
|
55555
55661
|
async function streamOutput(response) {
|
|
55556
55662
|
if (!response.body) throw new Error("Empty response from the GPU sandbox");
|
|
55557
|
-
const
|
|
55663
|
+
const decoder3 = new TextDecoder();
|
|
55558
55664
|
let buffer = "";
|
|
55559
55665
|
let exit;
|
|
55560
55666
|
const handle = (line) => {
|
|
@@ -55566,12 +55672,12 @@ async function streamOutput(response) {
|
|
|
55566
55672
|
else if (event.type === "exit") exit = { exitCode: event.exitCode };
|
|
55567
55673
|
};
|
|
55568
55674
|
for await (const chunk of import_node_stream.Readable.fromWeb(response.body)) {
|
|
55569
|
-
buffer +=
|
|
55675
|
+
buffer += decoder3.decode(chunk, { stream: true });
|
|
55570
55676
|
const lines = buffer.split("\n");
|
|
55571
55677
|
buffer = lines.pop() ?? "";
|
|
55572
55678
|
lines.forEach(handle);
|
|
55573
55679
|
}
|
|
55574
|
-
handle(buffer +
|
|
55680
|
+
handle(buffer + decoder3.decode());
|
|
55575
55681
|
if (!exit) {
|
|
55576
55682
|
throw new Error('Lost the connection to the GPU sandbox; the command may still be running. Use --detach and "replicas gpu logs -f" for long jobs.');
|
|
55577
55683
|
}
|