lody 0.89.2 → 0.89.4
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/chunks/{acp-CrvzLY5A.js → acp-DBqkNziA.js} +28 -0
- package/dist/chunks/{index-CnpJljBf.js → index-Bag7dEYc.js} +9 -9
- package/dist/chunks/{package-4KuPYsnp.js → package-DlotPnLa.js} +1 -1
- package/dist/chunks/{review-viewer-UwUaqbcj.js → review-viewer-HMN3RPEa.js} +3 -3
- package/dist/claude-acp.js +20305 -18678
- package/dist/codex-acp.js +1 -1
- package/dist/deepseek-acp.js +1 -1
- package/dist/index.js +1469 -853
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16,25 +16,25 @@ import * as path from "node:path";
|
|
|
16
16
|
import path__default, { posix as posix$1, basename, win32, join as join$2, resolve as resolve$1, dirname as dirname$1, relative as relative$1, isAbsolute as isAbsolute$2, sep as sep$1, delimiter, normalize } from "node:path";
|
|
17
17
|
import { _ as _coercedNumber, Z as ZodNumber$1, o as object$1, s as string$1, l as literal$1, n as number$4, b as boolean, a as _enum$1, c as array$2, d as discriminatedUnion, e as _instanceof, r as record$1, u as unknown, f as union$7, p as preprocess, g as ZodError$1, h as _null, i as normalizeParams, $ as $constructor, j as $ZodObject, k as defineLazy, m as $ZodType, q as parse$5, t as safeParse$1, v as parseAsync, w as safeParseAsync$1, x as clone$2, y as looseObject, z as intersection, A as optional$1, B as datetime, C as custom$1, D as toJSONSchema, E as ZodOptional$1, F as never$1, G as xor } from "./chunks/schemas-Du3qLZPS.js";
|
|
18
18
|
import require$$0$4, { once as once$1, EventEmitter as EventEmitter$1 } from "node:events";
|
|
19
|
-
import
|
|
19
|
+
import Tw__default, { execFile, spawn as spawn$1, execFileSync } from "node:child_process";
|
|
20
20
|
import process$2 from "node:process";
|
|
21
21
|
import tty from "node:tty";
|
|
22
22
|
import * as os from "os";
|
|
23
23
|
import os__default$1 from "os";
|
|
24
24
|
import crypto__default$1, { randomFillSync, randomUUID, createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
25
25
|
import require$$0$5, { promisify as promisify$1 } from "util";
|
|
26
|
-
import
|
|
26
|
+
import xo, { Transform as Transform$1, Readable as Readable$1 } from "stream";
|
|
27
27
|
import require$$0$6, { Buffer as Buffer$1 } from "buffer";
|
|
28
28
|
import require$$0$7, { EventEmitter as EventEmitter$2 } from "events";
|
|
29
|
-
import * as
|
|
30
|
-
import
|
|
29
|
+
import * as Ri from "zlib";
|
|
30
|
+
import Ri__default from "zlib";
|
|
31
31
|
import require$$1$2 from "tty";
|
|
32
32
|
import require$$1$3 from "string_decoder";
|
|
33
33
|
import http from "http";
|
|
34
34
|
import require$$1__default from "https";
|
|
35
35
|
import require$$0$8, { promisify, inspect as inspect$1, stripVTControlCharacters, isDeepStrictEqual } from "node:util";
|
|
36
|
-
import * as
|
|
37
|
-
import
|
|
36
|
+
import * as Xt from "node:fs/promises";
|
|
37
|
+
import Xt__default, { mkdir as mkdir$1, realpath, symlink, mkdtemp, chmod, writeFile, rm, rename, readFile, readdir, stat, lstat, unlink, open, opendir } from "node:fs/promises";
|
|
38
38
|
import zlib__default, { gzip, gunzip as gunzip$1, gunzipSync, brotliDecompressSync } from "node:zlib";
|
|
39
39
|
import require$$1$8, { exec, execFile as execFile$1, spawn as spawn$2 } from "child_process";
|
|
40
40
|
import { i as imports, _ as __wbg_set_wasm$1, r as rawWasm, L as LoroDoc, E as EphemeralStoreWasm, U as UndoManager, a as isValidContainerId, c as callPendingEvents$3, b as LoroTree, d as LoroText, e as LoroMovableList, f as LoroList, g as LoroMap, V as VersionVector, h as __vite__initWasm, j as decodeImportBlobMeta, __tla as __tla_0 } from "./chunks/loro_wasm_bg-Br-Fa9wV.js";
|
|
@@ -62,11 +62,11 @@ import require$$1$5, { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
62
62
|
import require$$1$6 from "node:console";
|
|
63
63
|
import require$$1$7 from "node:dns";
|
|
64
64
|
import { C as CodeCollabV2FileIndexRequestSchema, a as CodeCollabV2OpenTextRequestSchema, b as CodeCollabV2RefreshTextRequestSchema, c as CodeCollabV2SaveTextRequestSchema, d as CodeCollabV2OpenCurrentDiffRequestSchema, e as CodeCollabV2OpenAllChangesDiffRequestSchema, f as CodeCollabV2OpenTurnDiffRequestSchema, g as CodeCollabV2InitDirectoryRequestSchema, h as CodeCollabV2FileIndexSnapshotSchema, i as CodeCollabV2OpenTextOkSchema, j as CodeCollabV2RefreshTextResponseSchema, k as CodeCollabV2SaveTextResponseSchema, l as CodeCollabV2OpenCurrentDiffResponseSchema, m as CodeCollabV2OpenAllChangesDiffResponseSchema, n as CodeCollabV2OpenTurnDiffResponseSchema, o as CodeCollabV2InitDirectoryOkSchema, p as CodeCollabV2LspUnsupportedSchema, q as CodeCollabV2ErrorSchema, r as CodeCollabV2RpcContentEnvelopeSchema, s as deriveCodeCollabV2ContentKeyId, t as CodeCollabV2ErrorCodeSchema, u as CodeCollabV2RpcResponseSchema, v as deriveCodeCollabV2ContentKeyBytes, w as readCodeCollabFileIndexSignalFromFlock, x as writeCodeCollabFileIndexSignalToFlock, y as writeCodeCollabFileIndexToFlock, z as buildCodeCollabFileIndexState, A as CODE_COLLAB_V2_TEXT_LIMITS, B as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, D as computeAllChanges, E as codeCollabFileIndexStatesEqual, F as scanGitDirectoryEntries, G as closeDirectoryQuietly } from "./chunks/directory-handle-Bp47LF5g.js";
|
|
65
|
-
import { C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream } from "./chunks/acp-
|
|
65
|
+
import { C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream, c as client$2, m as methods$1 } from "./chunks/acp-DBqkNziA.js";
|
|
66
66
|
import { StringDecoder } from "node:string_decoder";
|
|
67
67
|
import { L as LODY_EXTENSION_METHODS, n as normalizeLodyExtensionMethod } from "./chunks/methods-CvEDMahD.js";
|
|
68
68
|
import { pipeline, finished } from "node:stream/promises";
|
|
69
|
-
import { p as packageJson } from "./chunks/package-
|
|
69
|
+
import { p as packageJson } from "./chunks/package-DlotPnLa.js";
|
|
70
70
|
import { r as runtimeManifest } from "./chunks/runtime-manifest-DnyvD_EC.js";
|
|
71
71
|
import { AsyncLocalStorage as AsyncLocalStorage$1 } from "async_hooks";
|
|
72
72
|
import { createRequire } from "module";
|
|
@@ -4325,7 +4325,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4325
4325
|
}
|
|
4326
4326
|
const name$2 = "lody";
|
|
4327
4327
|
const name$1 = "@lody/cli-cloud";
|
|
4328
|
-
const version$9 = "0.89.
|
|
4328
|
+
const version$9 = "0.89.4";
|
|
4329
4329
|
const type$2 = "module";
|
|
4330
4330
|
const scripts = {
|
|
4331
4331
|
"dev": "node dev.mjs",
|
|
@@ -4878,7 +4878,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4878
4878
|
},
|
|
4879
4879
|
{
|
|
4880
4880
|
id: "default",
|
|
4881
|
-
name: "
|
|
4881
|
+
name: "Manual",
|
|
4882
4882
|
description: "Standard behavior, prompts for dangerous operations"
|
|
4883
4883
|
},
|
|
4884
4884
|
{
|
|
@@ -4895,33 +4895,38 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4895
4895
|
id: "dontAsk",
|
|
4896
4896
|
name: "Don't Ask",
|
|
4897
4897
|
description: "Don't prompt for permissions, deny if not pre-approved"
|
|
4898
|
+
},
|
|
4899
|
+
{
|
|
4900
|
+
id: "bypassPermissions",
|
|
4901
|
+
name: "Bypass Permissions",
|
|
4902
|
+
description: "Bypass all permission checks"
|
|
4898
4903
|
}
|
|
4899
4904
|
];
|
|
4900
4905
|
const CLAUDE_STATIC_MODELS = [
|
|
4901
4906
|
{
|
|
4902
4907
|
modelId: "default",
|
|
4903
|
-
name: "Default",
|
|
4904
|
-
description: "
|
|
4908
|
+
name: "Default (recommended)",
|
|
4909
|
+
description: "Opus (1M context)"
|
|
4905
4910
|
},
|
|
4906
4911
|
{
|
|
4907
|
-
modelId: "opus",
|
|
4908
|
-
name: "Opus",
|
|
4909
|
-
description: "
|
|
4912
|
+
modelId: "opus[1m]",
|
|
4913
|
+
name: "Opus (1M context)",
|
|
4914
|
+
description: "Opus 5 with 1M context \xB7 Best for everyday, complex tasks"
|
|
4910
4915
|
},
|
|
4911
4916
|
{
|
|
4912
|
-
modelId: "claude-fable-5[1m]",
|
|
4917
|
+
modelId: "claude-fable-5-1[1m]",
|
|
4913
4918
|
name: "Fable",
|
|
4914
|
-
description: "
|
|
4919
|
+
description: "Fable 5.1 \xB7 Most capable for your hardest and longest-running tasks"
|
|
4915
4920
|
},
|
|
4916
4921
|
{
|
|
4917
4922
|
modelId: "sonnet",
|
|
4918
4923
|
name: "Sonnet",
|
|
4919
|
-
description: "
|
|
4924
|
+
description: "Sonnet 5 \xB7 Efficient for routine tasks"
|
|
4920
4925
|
},
|
|
4921
4926
|
{
|
|
4922
4927
|
modelId: "haiku",
|
|
4923
4928
|
name: "Haiku",
|
|
4924
|
-
description: "
|
|
4929
|
+
description: "Haiku 4.5 \xB7 Fastest for quick answers"
|
|
4925
4930
|
}
|
|
4926
4931
|
];
|
|
4927
4932
|
[
|
|
@@ -4974,8 +4979,25 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4974
4979
|
{
|
|
4975
4980
|
value: "high",
|
|
4976
4981
|
name: "High"
|
|
4982
|
+
},
|
|
4983
|
+
{
|
|
4984
|
+
value: "xhigh",
|
|
4985
|
+
name: "Xhigh"
|
|
4986
|
+
},
|
|
4987
|
+
{
|
|
4988
|
+
value: "max",
|
|
4989
|
+
name: "Max"
|
|
4977
4990
|
}
|
|
4978
4991
|
]
|
|
4992
|
+
},
|
|
4993
|
+
{
|
|
4994
|
+
id: "fast",
|
|
4995
|
+
name: "Fast mode",
|
|
4996
|
+
description: "Faster responses on supported models",
|
|
4997
|
+
category: "model_config",
|
|
4998
|
+
type: "boolean",
|
|
4999
|
+
currentValue: false,
|
|
5000
|
+
options: []
|
|
4979
5001
|
}
|
|
4980
5002
|
];
|
|
4981
5003
|
const KIMI_STATIC_MODES = [
|
|
@@ -5892,6 +5914,16 @@ Requirements:
|
|
|
5892
5914
|
"ANTHROPIC_VERTEX_PROJECT_ID"
|
|
5893
5915
|
];
|
|
5894
5916
|
const hasBuiltinEnvAuthentication = (agentType, env2) => agentType === "claude" && CLAUDE_ENV_AUTH_KEYS.some((key2) => Boolean(env2?.[key2]?.trim()));
|
|
5917
|
+
const ACP_AUTH_METHOD_MAX_COUNT = 32;
|
|
5918
|
+
const ACP_AUTH_FORM_FIELD_MAX_COUNT = 32;
|
|
5919
|
+
const ACP_AUTH_SELECT_OPTION_MAX_COUNT = 256;
|
|
5920
|
+
const ACP_AUTH_ID_MAX_LENGTH = 1024;
|
|
5921
|
+
const ACP_AUTH_LABEL_MAX_LENGTH = 4096;
|
|
5922
|
+
const ACP_AUTH_TEXT_MAX_LENGTH = 16384;
|
|
5923
|
+
const ACP_AUTHORIZATION_URL_MAX_LENGTH = 8192;
|
|
5924
|
+
const ACP_AUTHENTICATION_FORM_MAX_BYTES = 256 * 1024;
|
|
5925
|
+
const textEncoder$5 = new TextEncoder();
|
|
5926
|
+
const isAcpAuthenticationFormWithinByteLimit = (form) => textEncoder$5.encode(JSON.stringify(form)).byteLength <= ACP_AUTHENTICATION_FORM_MAX_BYTES;
|
|
5895
5927
|
function getMapFieldSchema(schema2, key2) {
|
|
5896
5928
|
if (!schema2) return void 0;
|
|
5897
5929
|
if (Object.prototype.hasOwnProperty.call(schema2.definition, key2)) {
|
|
@@ -10917,6 +10949,12 @@ Requirements:
|
|
|
10917
10949
|
url: schema.String(),
|
|
10918
10950
|
number: schema.Number()
|
|
10919
10951
|
});
|
|
10952
|
+
const agentRoleIdSchema = schema.String({
|
|
10953
|
+
required: false
|
|
10954
|
+
}).transform({
|
|
10955
|
+
decode: (value) => value,
|
|
10956
|
+
encode: (value) => value
|
|
10957
|
+
});
|
|
10920
10958
|
const acpSessionConfigSchema = schema.LoroMap({
|
|
10921
10959
|
prompt: schema.String(),
|
|
10922
10960
|
inputBlocks: schema.Any({
|
|
@@ -10945,6 +10983,10 @@ Requirements:
|
|
|
10945
10983
|
taskToolsEnabled: schema.Boolean({
|
|
10946
10984
|
required: false
|
|
10947
10985
|
}),
|
|
10986
|
+
agentRoleId: agentRoleIdSchema,
|
|
10987
|
+
agentRoleRevision: schema.Number({
|
|
10988
|
+
required: false
|
|
10989
|
+
}),
|
|
10948
10990
|
chainDepth: schema.Number({
|
|
10949
10991
|
required: false
|
|
10950
10992
|
})
|
|
@@ -12079,6 +12121,8 @@ Requirements:
|
|
|
12079
12121
|
configOptionValues: AcpConfigOptionValuesSchema.optional(),
|
|
12080
12122
|
mcpServerIds: array$2(string$1()).optional(),
|
|
12081
12123
|
taskToolsEnabled: boolean().optional(),
|
|
12124
|
+
agentRoleId: string$1().trim().min(1).nullable().optional(),
|
|
12125
|
+
agentRoleRevision: number$4().int().nonnegative().optional(),
|
|
12082
12126
|
issuePRMentions: array$2(IssuePRMentionSchema).optional(),
|
|
12083
12127
|
resume: ACPSessionIdSchema.optional(),
|
|
12084
12128
|
chainDepth: number$4().int().nonnegative().optional()
|
|
@@ -12095,6 +12139,8 @@ Requirements:
|
|
|
12095
12139
|
configOptionValues: AcpConfigOptionValuesSchema.optional(),
|
|
12096
12140
|
mcpServerIds: array$2(string$1()).optional(),
|
|
12097
12141
|
taskToolsEnabled: boolean().optional(),
|
|
12142
|
+
agentRoleId: string$1().trim().min(1).nullable().optional(),
|
|
12143
|
+
agentRoleRevision: number$4().int().nonnegative().optional(),
|
|
12098
12144
|
issuePRMentions: array$2(IssuePRMentionSchema).optional(),
|
|
12099
12145
|
resume: ACPSessionIdSchema.optional(),
|
|
12100
12146
|
chainDepth: number$4().int().nonnegative().optional()
|
|
@@ -12166,6 +12212,18 @@ Requirements:
|
|
|
12166
12212
|
if (taskToolsEnabled !== void 0) {
|
|
12167
12213
|
normalized.taskToolsEnabled = taskToolsEnabled;
|
|
12168
12214
|
}
|
|
12215
|
+
if (record2.agentRoleId === null) {
|
|
12216
|
+
normalized.agentRoleId = null;
|
|
12217
|
+
} else {
|
|
12218
|
+
const agentRoleId = trimOptionalString(record2.agentRoleId);
|
|
12219
|
+
if (agentRoleId) {
|
|
12220
|
+
normalized.agentRoleId = agentRoleId;
|
|
12221
|
+
}
|
|
12222
|
+
}
|
|
12223
|
+
const agentRoleRevision = maybeParseField(number$4().int().nonnegative(), record2.agentRoleRevision);
|
|
12224
|
+
if (agentRoleRevision !== void 0) {
|
|
12225
|
+
normalized.agentRoleRevision = agentRoleRevision;
|
|
12226
|
+
}
|
|
12169
12227
|
const issuePRMentions = maybeParseField(array$2(IssuePRMentionSchema), record2.issuePRMentions);
|
|
12170
12228
|
if (issuePRMentions) {
|
|
12171
12229
|
normalized.issuePRMentions = issuePRMentions;
|
|
@@ -12681,21 +12739,101 @@ Requirements:
|
|
|
12681
12739
|
"env_var",
|
|
12682
12740
|
"terminal"
|
|
12683
12741
|
]),
|
|
12684
|
-
id: string$1().optional(),
|
|
12685
|
-
name: string$1().optional(),
|
|
12686
|
-
description: string$1().optional(),
|
|
12687
|
-
args: array$2(string$1()).optional()
|
|
12742
|
+
id: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH).optional(),
|
|
12743
|
+
name: string$1().max(ACP_AUTH_LABEL_MAX_LENGTH).optional(),
|
|
12744
|
+
description: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12745
|
+
args: array$2(string$1().max(ACP_AUTH_LABEL_MAX_LENGTH)).max(64).optional()
|
|
12688
12746
|
}).strict();
|
|
12747
|
+
const MachineAcpAuthenticationFormFieldSchema = discriminatedUnion("type", [
|
|
12748
|
+
object$1({
|
|
12749
|
+
id: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12750
|
+
type: literal$1("text"),
|
|
12751
|
+
label: string$1().trim().min(1).max(ACP_AUTH_LABEL_MAX_LENGTH),
|
|
12752
|
+
description: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12753
|
+
required: boolean(),
|
|
12754
|
+
defaultValue: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional()
|
|
12755
|
+
}).strict(),
|
|
12756
|
+
object$1({
|
|
12757
|
+
id: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12758
|
+
type: literal$1("secret"),
|
|
12759
|
+
label: string$1().trim().min(1).max(ACP_AUTH_LABEL_MAX_LENGTH),
|
|
12760
|
+
description: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12761
|
+
required: boolean()
|
|
12762
|
+
}).strict(),
|
|
12763
|
+
object$1({
|
|
12764
|
+
id: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12765
|
+
type: literal$1("select"),
|
|
12766
|
+
label: string$1().trim().min(1).max(ACP_AUTH_LABEL_MAX_LENGTH),
|
|
12767
|
+
description: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12768
|
+
required: boolean(),
|
|
12769
|
+
options: array$2(object$1({
|
|
12770
|
+
value: string$1().min(1).max(ACP_AUTH_TEXT_MAX_LENGTH),
|
|
12771
|
+
label: string$1().trim().min(1).max(ACP_AUTH_LABEL_MAX_LENGTH)
|
|
12772
|
+
}).strict()).min(1).max(ACP_AUTH_SELECT_OPTION_MAX_COUNT),
|
|
12773
|
+
defaultValue: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional()
|
|
12774
|
+
}).strict()
|
|
12775
|
+
]);
|
|
12776
|
+
const MachineAcpAuthenticationFormSchema = object$1({
|
|
12777
|
+
title: string$1().max(ACP_AUTH_LABEL_MAX_LENGTH).optional(),
|
|
12778
|
+
description: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12779
|
+
fields: array$2(MachineAcpAuthenticationFormFieldSchema).min(1).max(ACP_AUTH_FORM_FIELD_MAX_COUNT)
|
|
12780
|
+
}).strict().superRefine((value, context2) => {
|
|
12781
|
+
if (!isAcpAuthenticationFormWithinByteLimit(value)) {
|
|
12782
|
+
context2.addIssue({
|
|
12783
|
+
code: "custom",
|
|
12784
|
+
message: "Authentication form exceeds the serialized size limit"
|
|
12785
|
+
});
|
|
12786
|
+
}
|
|
12787
|
+
const fieldIds = /* @__PURE__ */ new Set();
|
|
12788
|
+
value.fields.forEach((field, fieldIndex) => {
|
|
12789
|
+
if (fieldIds.has(field.id)) {
|
|
12790
|
+
context2.addIssue({
|
|
12791
|
+
code: "custom",
|
|
12792
|
+
path: [
|
|
12793
|
+
"fields",
|
|
12794
|
+
fieldIndex,
|
|
12795
|
+
"id"
|
|
12796
|
+
],
|
|
12797
|
+
message: "Authentication form field ids must be unique"
|
|
12798
|
+
});
|
|
12799
|
+
}
|
|
12800
|
+
fieldIds.add(field.id);
|
|
12801
|
+
if (field.type !== "select") return;
|
|
12802
|
+
const optionValues = /* @__PURE__ */ new Set();
|
|
12803
|
+
field.options.forEach((option2, optionIndex) => {
|
|
12804
|
+
if (optionValues.has(option2.value)) {
|
|
12805
|
+
context2.addIssue({
|
|
12806
|
+
code: "custom",
|
|
12807
|
+
path: [
|
|
12808
|
+
"fields",
|
|
12809
|
+
fieldIndex,
|
|
12810
|
+
"options",
|
|
12811
|
+
optionIndex,
|
|
12812
|
+
"value"
|
|
12813
|
+
],
|
|
12814
|
+
message: "Authentication select option values must be unique"
|
|
12815
|
+
});
|
|
12816
|
+
}
|
|
12817
|
+
optionValues.add(option2.value);
|
|
12818
|
+
});
|
|
12819
|
+
if (field.defaultValue !== void 0 && !optionValues.has(field.defaultValue)) {
|
|
12820
|
+
context2.addIssue({
|
|
12821
|
+
code: "custom",
|
|
12822
|
+
path: [
|
|
12823
|
+
"fields",
|
|
12824
|
+
fieldIndex,
|
|
12825
|
+
"defaultValue"
|
|
12826
|
+
],
|
|
12827
|
+
message: "Authentication select default must match an option"
|
|
12828
|
+
});
|
|
12829
|
+
}
|
|
12830
|
+
});
|
|
12831
|
+
});
|
|
12689
12832
|
const MachineAcpCapabilitiesRefreshRequestSchema = object$1({
|
|
12690
12833
|
type: literal$1("machine/acp-capabilities-refresh"),
|
|
12691
12834
|
machineId: MachineIdSchema$1,
|
|
12692
12835
|
workspaceId: WorkspaceIdSchema,
|
|
12693
|
-
configId: AgentConfigIdSchema
|
|
12694
|
-
cliType: AgentConfigCliTypeSchema,
|
|
12695
|
-
agentType: string$1().trim().min(1),
|
|
12696
|
-
customAcp: CustomAcpLaunchSpecSchema.optional(),
|
|
12697
|
-
runtimeOverrides: BuiltinRuntimeOverridesSchema.optional(),
|
|
12698
|
-
env: record$1(string$1(), string$1()).optional()
|
|
12836
|
+
configId: AgentConfigIdSchema
|
|
12699
12837
|
}).strict();
|
|
12700
12838
|
const MachineAcpCapabilitiesRefreshResponseSchema = object$1({
|
|
12701
12839
|
type: literal$1("machine/acp-capabilities-refresh_response"),
|
|
@@ -12717,55 +12855,36 @@ Requirements:
|
|
|
12717
12855
|
description: string$1().optional()
|
|
12718
12856
|
})).optional(),
|
|
12719
12857
|
authRequired: boolean().optional(),
|
|
12720
|
-
authMethods: array$2(MachineAcpAuthMethodSummarySchema).optional(),
|
|
12858
|
+
authMethods: array$2(MachineAcpAuthMethodSummarySchema).max(ACP_AUTH_METHOD_MAX_COUNT).optional(),
|
|
12721
12859
|
error: string$1().optional()
|
|
12722
12860
|
}).strict();
|
|
12723
|
-
const
|
|
12861
|
+
const MachineAcpAuthenticateRequestBaseSchema = object$1({
|
|
12724
12862
|
type: literal$1("machine/acp-authenticate"),
|
|
12725
12863
|
machineId: MachineIdSchema$1,
|
|
12726
12864
|
workspaceId: WorkspaceIdSchema,
|
|
12727
|
-
requestId: string$1().trim().min(1)
|
|
12728
|
-
action: _enum$1([
|
|
12729
|
-
"start",
|
|
12730
|
-
"cancel",
|
|
12731
|
-
"submit-code"
|
|
12732
|
-
]),
|
|
12733
|
-
authenticationRequestId: string$1().trim().min(1).optional(),
|
|
12734
|
-
authorizationCode: string$1().trim().min(1).max(4096).optional(),
|
|
12735
|
-
methodId: string$1().trim().min(1).max(256).optional(),
|
|
12736
|
-
configId: AgentConfigIdSchema.optional(),
|
|
12737
|
-
cliType: AgentConfigCliTypeSchema,
|
|
12738
|
-
agentType: string$1().trim().min(1),
|
|
12739
|
-
customAcp: CustomAcpLaunchSpecSchema.optional(),
|
|
12740
|
-
runtimeOverrides: BuiltinRuntimeOverridesSchema.optional(),
|
|
12741
|
-
env: record$1(string$1(), string$1()).optional()
|
|
12742
|
-
}).strict().superRefine((value, context2) => {
|
|
12743
|
-
if (value.action === "submit-code") {
|
|
12744
|
-
if (!value.authenticationRequestId) {
|
|
12745
|
-
context2.addIssue({
|
|
12746
|
-
code: "custom",
|
|
12747
|
-
path: [
|
|
12748
|
-
"authenticationRequestId"
|
|
12749
|
-
],
|
|
12750
|
-
message: "authenticationRequestId is required when submitting an authorization code"
|
|
12751
|
-
});
|
|
12752
|
-
}
|
|
12753
|
-
if (!value.authorizationCode) {
|
|
12754
|
-
context2.addIssue({
|
|
12755
|
-
code: "custom",
|
|
12756
|
-
path: [
|
|
12757
|
-
"authorizationCode"
|
|
12758
|
-
],
|
|
12759
|
-
message: "authorizationCode is required when submitting an authorization code"
|
|
12760
|
-
});
|
|
12761
|
-
}
|
|
12762
|
-
} else if (value.authenticationRequestId || value.authorizationCode) {
|
|
12763
|
-
context2.addIssue({
|
|
12764
|
-
code: "custom",
|
|
12765
|
-
message: "Authorization-code fields are only valid for submit-code"
|
|
12766
|
-
});
|
|
12767
|
-
}
|
|
12865
|
+
requestId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH)
|
|
12768
12866
|
});
|
|
12867
|
+
const MachineAcpAuthenticateRequestSchema = discriminatedUnion("action", [
|
|
12868
|
+
MachineAcpAuthenticateRequestBaseSchema.extend({
|
|
12869
|
+
action: literal$1("start"),
|
|
12870
|
+
configId: AgentConfigIdSchema
|
|
12871
|
+
}).strict(),
|
|
12872
|
+
MachineAcpAuthenticateRequestBaseSchema.extend({
|
|
12873
|
+
action: literal$1("cancel"),
|
|
12874
|
+
authenticationRequestId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH)
|
|
12875
|
+
}).strict(),
|
|
12876
|
+
MachineAcpAuthenticateRequestBaseSchema.extend({
|
|
12877
|
+
action: literal$1("submit-code"),
|
|
12878
|
+
authenticationRequestId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12879
|
+
authorizationCode: string$1().trim().min(1).max(ACP_AUTH_LABEL_MAX_LENGTH)
|
|
12880
|
+
}).strict(),
|
|
12881
|
+
MachineAcpAuthenticateRequestBaseSchema.extend({
|
|
12882
|
+
action: literal$1("submit-input"),
|
|
12883
|
+
authenticationRequestId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12884
|
+
interactionId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH),
|
|
12885
|
+
authenticationInput: string$1().min(1).max(65536)
|
|
12886
|
+
}).strict()
|
|
12887
|
+
]);
|
|
12769
12888
|
const MachineAcpAuthenticateResponseSchema = object$1({
|
|
12770
12889
|
type: literal$1("machine/acp-authenticate_response"),
|
|
12771
12890
|
machineId: MachineIdSchema$1,
|
|
@@ -12782,7 +12901,7 @@ Requirements:
|
|
|
12782
12901
|
]),
|
|
12783
12902
|
capabilitiesRefreshed: boolean().optional(),
|
|
12784
12903
|
authRequired: boolean().optional(),
|
|
12785
|
-
authMethods: array$2(MachineAcpAuthMethodSummarySchema).optional(),
|
|
12904
|
+
authMethods: array$2(MachineAcpAuthMethodSummarySchema).max(ACP_AUTH_METHOD_MAX_COUNT).optional(),
|
|
12786
12905
|
error: string$1().optional()
|
|
12787
12906
|
}).strict();
|
|
12788
12907
|
const MachineAcpAuthenticationProgressMessageSchema = object$1({
|
|
@@ -12792,23 +12911,34 @@ Requirements:
|
|
|
12792
12911
|
agentType: string$1().trim().min(1),
|
|
12793
12912
|
status: _enum$1([
|
|
12794
12913
|
"starting",
|
|
12914
|
+
"auth-methods",
|
|
12795
12915
|
"authorization",
|
|
12916
|
+
"input-required",
|
|
12796
12917
|
"output",
|
|
12797
12918
|
"authenticated",
|
|
12798
12919
|
"cancelled",
|
|
12799
12920
|
"error"
|
|
12800
12921
|
]),
|
|
12801
|
-
|
|
12922
|
+
authMethods: array$2(MachineAcpAuthMethodSummarySchema).max(ACP_AUTH_METHOD_MAX_COUNT).optional(),
|
|
12923
|
+
interactionId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH).optional(),
|
|
12924
|
+
message: string$1().max(ACP_AUTH_TEXT_MAX_LENGTH).optional(),
|
|
12925
|
+
form: MachineAcpAuthenticationFormSchema.optional(),
|
|
12926
|
+
authorizationUrl: string$1().url().max(ACP_AUTHORIZATION_URL_MAX_LENGTH).refine((value) => {
|
|
12927
|
+
const protocol = new URL(value).protocol;
|
|
12928
|
+
return protocol === "https:" || protocol === "http:";
|
|
12929
|
+
}, "authorizationUrl must use http or https").optional(),
|
|
12802
12930
|
userCode: string$1().trim().min(1).max(128).optional(),
|
|
12803
12931
|
acceptsAuthorizationCode: boolean().optional(),
|
|
12804
12932
|
authorizationCodePublicKey: RpcSecretPublicKeySchema.optional(),
|
|
12933
|
+
authenticationInputPublicKey: RpcSecretPublicKeySchema.optional(),
|
|
12934
|
+
requiresAuthorizationConsent: boolean().optional(),
|
|
12805
12935
|
expiresInSeconds: number$4().int().positive().optional(),
|
|
12806
12936
|
stream: _enum$1([
|
|
12807
12937
|
"stdout",
|
|
12808
12938
|
"stderr"
|
|
12809
12939
|
]).optional(),
|
|
12810
|
-
output: string$1().optional(),
|
|
12811
|
-
error: string$1().optional()
|
|
12940
|
+
output: string$1().max(16384).optional(),
|
|
12941
|
+
error: string$1().max(65536).optional()
|
|
12812
12942
|
}).strict().superRefine((value, context2) => {
|
|
12813
12943
|
if (value.status === "authorization" && !value.authorizationUrl) {
|
|
12814
12944
|
context2.addIssue({
|
|
@@ -12819,6 +12949,33 @@ Requirements:
|
|
|
12819
12949
|
message: "authorizationUrl is required for authorization progress"
|
|
12820
12950
|
});
|
|
12821
12951
|
}
|
|
12952
|
+
if (value.status === "auth-methods" && (!value.interactionId || !value.authMethods?.length || value.authMethods.some((method) => !method.id || method.type !== "agent") || new Set(value.authMethods.map((method) => method.id)).size !== value.authMethods.length)) {
|
|
12953
|
+
context2.addIssue({
|
|
12954
|
+
code: "custom",
|
|
12955
|
+
path: [
|
|
12956
|
+
"authMethods"
|
|
12957
|
+
],
|
|
12958
|
+
message: "auth-methods progress requires an interaction and methods with ids"
|
|
12959
|
+
});
|
|
12960
|
+
}
|
|
12961
|
+
if (value.status === "input-required" && (!value.interactionId || !value.form)) {
|
|
12962
|
+
context2.addIssue({
|
|
12963
|
+
code: "custom",
|
|
12964
|
+
path: [
|
|
12965
|
+
"form"
|
|
12966
|
+
],
|
|
12967
|
+
message: "input-required progress requires an interaction and form"
|
|
12968
|
+
});
|
|
12969
|
+
}
|
|
12970
|
+
if (value.status === "authorization" && value.requiresAuthorizationConsent && !value.interactionId) {
|
|
12971
|
+
context2.addIssue({
|
|
12972
|
+
code: "custom",
|
|
12973
|
+
path: [
|
|
12974
|
+
"interactionId"
|
|
12975
|
+
],
|
|
12976
|
+
message: "URL consent requires an interaction id"
|
|
12977
|
+
});
|
|
12978
|
+
}
|
|
12822
12979
|
});
|
|
12823
12980
|
const MachineAcpBinaryStatusRequestSchema = object$1({
|
|
12824
12981
|
type: literal$1("machine/acp-binary-status"),
|
|
@@ -14103,6 +14260,7 @@ Requirements:
|
|
|
14103
14260
|
"acp_auth_required",
|
|
14104
14261
|
"acp_internal_error",
|
|
14105
14262
|
"acp_upstream_api_error",
|
|
14263
|
+
"acp_provider_overloaded",
|
|
14106
14264
|
"acp_session_storage_incompatible",
|
|
14107
14265
|
"acp_resource_not_found",
|
|
14108
14266
|
"acp_request_cancelled",
|
|
@@ -18436,6 +18594,13 @@ ${outputTail}` : blockTail.output;
|
|
|
18436
18594
|
"~/.cursor/skills"
|
|
18437
18595
|
]),
|
|
18438
18596
|
deepagents: skillDirs([], []),
|
|
18597
|
+
deepseek: skillDirs([
|
|
18598
|
+
DEFAULT_PROJECT_SKILL_DIR,
|
|
18599
|
+
".dsh/skills"
|
|
18600
|
+
], [
|
|
18601
|
+
"~/.dsh/skills",
|
|
18602
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18603
|
+
]),
|
|
18439
18604
|
devin: skillDirs([
|
|
18440
18605
|
".devin/skills",
|
|
18441
18606
|
".windsurf/skills"
|
|
@@ -18519,6 +18684,17 @@ ${outputTail}` : blockTail.output;
|
|
|
18519
18684
|
"~/.config/goose/skills",
|
|
18520
18685
|
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18521
18686
|
]),
|
|
18687
|
+
grok: skillDirs([
|
|
18688
|
+
DEFAULT_PROJECT_SKILL_DIR,
|
|
18689
|
+
".grok/skills",
|
|
18690
|
+
CLAUDE_PROJECT_SKILL_DIR,
|
|
18691
|
+
".cursor/skills"
|
|
18692
|
+
], [
|
|
18693
|
+
"~/.grok/skills",
|
|
18694
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR,
|
|
18695
|
+
CLAUDE_GLOBAL_SKILL_DIR,
|
|
18696
|
+
"~/.cursor/skills"
|
|
18697
|
+
]),
|
|
18522
18698
|
"hermes-agent": skillDirs([
|
|
18523
18699
|
".hermes/skills"
|
|
18524
18700
|
], [
|
|
@@ -18577,16 +18753,25 @@ ${outputTail}` : blockTail.output;
|
|
|
18577
18753
|
]),
|
|
18578
18754
|
kimi: skillDirs([
|
|
18579
18755
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18580
|
-
".kimi/skills"
|
|
18581
|
-
], [
|
|
18756
|
+
".kimi-code/skills"
|
|
18757
|
+
], [
|
|
18758
|
+
"~/.kimi-code/skills",
|
|
18759
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18760
|
+
]),
|
|
18582
18761
|
"kimi-code": skillDirs([
|
|
18583
18762
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18584
|
-
".kimi/skills"
|
|
18585
|
-
], [
|
|
18763
|
+
".kimi-code/skills"
|
|
18764
|
+
], [
|
|
18765
|
+
"~/.kimi-code/skills",
|
|
18766
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18767
|
+
]),
|
|
18586
18768
|
"kimi-code-cli": skillDirs([
|
|
18587
18769
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18588
|
-
".kimi/skills"
|
|
18589
|
-
], [
|
|
18770
|
+
".kimi-code/skills"
|
|
18771
|
+
], [
|
|
18772
|
+
"~/.kimi-code/skills",
|
|
18773
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18774
|
+
]),
|
|
18590
18775
|
kode: skillDirs([
|
|
18591
18776
|
".kode/skills"
|
|
18592
18777
|
], [
|
|
@@ -18656,13 +18841,15 @@ ${outputTail}` : blockTail.output;
|
|
|
18656
18841
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18657
18842
|
".pi/skills"
|
|
18658
18843
|
], [
|
|
18659
|
-
"~/.pi/agent/skills"
|
|
18844
|
+
"~/.pi/agent/skills",
|
|
18845
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18660
18846
|
]),
|
|
18661
18847
|
"pi-acp": skillDirs([
|
|
18662
18848
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18663
18849
|
".pi/skills"
|
|
18664
18850
|
], [
|
|
18665
|
-
"~/.pi/agent/skills"
|
|
18851
|
+
"~/.pi/agent/skills",
|
|
18852
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18666
18853
|
]),
|
|
18667
18854
|
pochi: skillDirs([
|
|
18668
18855
|
".pochi/skills"
|
|
@@ -20685,14 +20872,17 @@ ${tailedOutput}` : null;
|
|
|
20685
20872
|
return parsed;
|
|
20686
20873
|
};
|
|
20687
20874
|
const MACHINE_PROTOCOL_CAPABILITIES = {
|
|
20875
|
+
acpAuthenticationInteractions: "acpAuthenticationInteractions",
|
|
20688
20876
|
localProjectRemoval: "localProjectRemoval",
|
|
20689
20877
|
providerSetup: "providerSetup",
|
|
20690
20878
|
acpProtocolAuthentication: "acpProtocolAuthentication"
|
|
20691
20879
|
};
|
|
20880
|
+
const ACP_AUTHENTICATION_INTERACTIONS_PROTOCOL_VERSION = 2;
|
|
20692
20881
|
const LOCAL_PROJECT_REMOVAL_PROTOCOL_VERSION = 1;
|
|
20693
20882
|
const PROVIDER_SETUP_PROTOCOL_VERSION = 1;
|
|
20694
|
-
const ACP_PROTOCOL_AUTHENTICATION_VERSION =
|
|
20883
|
+
const ACP_PROTOCOL_AUTHENTICATION_VERSION = 2;
|
|
20695
20884
|
const CURRENT_MACHINE_PROTOCOL_CAPABILITIES = {
|
|
20885
|
+
[MACHINE_PROTOCOL_CAPABILITIES.acpAuthenticationInteractions]: ACP_AUTHENTICATION_INTERACTIONS_PROTOCOL_VERSION,
|
|
20696
20886
|
[MACHINE_PROTOCOL_CAPABILITIES.localProjectRemoval]: LOCAL_PROJECT_REMOVAL_PROTOCOL_VERSION,
|
|
20697
20887
|
[MACHINE_PROTOCOL_CAPABILITIES.providerSetup]: PROVIDER_SETUP_PROTOCOL_VERSION,
|
|
20698
20888
|
[MACHINE_PROTOCOL_CAPABILITIES.acpProtocolAuthentication]: ACP_PROTOCOL_AUTHENTICATION_VERSION
|
|
@@ -20713,6 +20903,29 @@ ${tailedOutput}` : null;
|
|
|
20713
20903
|
}
|
|
20714
20904
|
return false;
|
|
20715
20905
|
};
|
|
20906
|
+
const collectSessionConversationSources = (history, messageQueue = []) => {
|
|
20907
|
+
const sources = [];
|
|
20908
|
+
for (let index = messageQueue.length - 1; index >= 0; index -= 1) {
|
|
20909
|
+
const item = messageQueue[index];
|
|
20910
|
+
const itemId = typeof item?.$cid === "string" ? item.$cid : String(index);
|
|
20911
|
+
const userTurnId = typeof item?.userTurnId === "string" && item.userTurnId.trim() ? item.userTurnId.trim() : null;
|
|
20912
|
+
sources.push({
|
|
20913
|
+
value: item?.acpSessionConfig,
|
|
20914
|
+
configKey: `queue:${itemId}`,
|
|
20915
|
+
turnKey: `turn:${userTurnId ?? `queued-${itemId}`}`
|
|
20916
|
+
});
|
|
20917
|
+
}
|
|
20918
|
+
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
20919
|
+
const entry = history[index];
|
|
20920
|
+
if (entry?.role !== "user") continue;
|
|
20921
|
+
sources.push({
|
|
20922
|
+
value: entry.inputConfig,
|
|
20923
|
+
configKey: `history:${entry.id}`,
|
|
20924
|
+
turnKey: `turn:${entry.id}`
|
|
20925
|
+
});
|
|
20926
|
+
}
|
|
20927
|
+
return sources;
|
|
20928
|
+
};
|
|
20716
20929
|
const resolveSessionConversationConfig = (history, messageQueue = []) => {
|
|
20717
20930
|
const resolveConfig = (value, sourceConfigKey) => {
|
|
20718
20931
|
const inputConfig = normalizeSessionTurnInputConfig(value);
|
|
@@ -20735,23 +20948,32 @@ ${tailedOutput}` : null;
|
|
|
20735
20948
|
} : {},
|
|
20736
20949
|
...typeof inputConfig.taskToolsEnabled === "boolean" ? {
|
|
20737
20950
|
taskToolsEnabled: inputConfig.taskToolsEnabled
|
|
20951
|
+
} : {},
|
|
20952
|
+
...inputConfig.agentRoleId !== void 0 ? {
|
|
20953
|
+
agentRoleId: inputConfig.agentRoleId
|
|
20954
|
+
} : {},
|
|
20955
|
+
...typeof inputConfig.agentRoleId === "string" && inputConfig.agentRoleRevision !== void 0 ? {
|
|
20956
|
+
agentRoleRevision: inputConfig.agentRoleRevision
|
|
20738
20957
|
} : {}
|
|
20739
20958
|
};
|
|
20740
20959
|
};
|
|
20741
|
-
const
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20960
|
+
const sources = collectSessionConversationSources(history, messageQueue);
|
|
20961
|
+
const latest2 = sources[0];
|
|
20962
|
+
if (!latest2) return {};
|
|
20963
|
+
const resolved = resolveConfig(latest2.value, latest2.configKey) ?? {};
|
|
20964
|
+
if (resolved.agentRoleId !== void 0) return resolved;
|
|
20965
|
+
for (const source of sources.slice(1)) {
|
|
20966
|
+
const older = normalizeSessionTurnInputConfig(source.value);
|
|
20967
|
+
if (!older || older.agentRoleId === void 0) continue;
|
|
20968
|
+
return {
|
|
20969
|
+
...resolved,
|
|
20970
|
+
agentRoleId: older.agentRoleId,
|
|
20971
|
+
...older.agentRoleId !== null && older.agentRoleRevision !== void 0 ? {
|
|
20972
|
+
agentRoleRevision: older.agentRoleRevision
|
|
20973
|
+
} : {}
|
|
20974
|
+
};
|
|
20753
20975
|
}
|
|
20754
|
-
return
|
|
20976
|
+
return resolved;
|
|
20755
20977
|
};
|
|
20756
20978
|
const resolveSessionMcpSelection = (history, messageQueue = []) => resolveSessionConversationConfig(history, messageQueue).mcpServerIds ?? [];
|
|
20757
20979
|
const resolveSessionTaskToolsEnabled = (history, messageQueue = []) => resolveSessionConversationConfig(history, messageQueue).taskToolsEnabled === true;
|
|
@@ -20999,6 +21221,12 @@ ${tailedOutput}` : null;
|
|
|
20999
21221
|
...args2.taskToolsEnabled !== void 0 ? {
|
|
21000
21222
|
taskToolsEnabled: args2.taskToolsEnabled === true
|
|
21001
21223
|
} : {},
|
|
21224
|
+
...args2.agentRoleId !== void 0 ? {
|
|
21225
|
+
agentRoleId: args2.agentRoleId
|
|
21226
|
+
} : {},
|
|
21227
|
+
...typeof args2.agentRoleId === "string" && args2.agentRoleRevision !== void 0 ? {
|
|
21228
|
+
agentRoleRevision: args2.agentRoleRevision
|
|
21229
|
+
} : {},
|
|
21002
21230
|
issuePRMentions: args2.issuePRMentions,
|
|
21003
21231
|
resume: args2.resume
|
|
21004
21232
|
};
|
|
@@ -23869,7 +24097,7 @@ ${context2.authorReply.trim()}
|
|
|
23869
24097
|
}
|
|
23870
24098
|
case "agentConfig": {
|
|
23871
24099
|
const config2 = normalizeAgentConfigMeta$1(value);
|
|
23872
|
-
return config2 ? {
|
|
24100
|
+
return config2 && config2.id === parsedKey.agentConfigId ? {
|
|
23873
24101
|
key: parsedKey.key,
|
|
23874
24102
|
value: config2
|
|
23875
24103
|
} : void 0;
|
|
@@ -26406,7 +26634,7 @@ ${context2.authorReply.trim()}
|
|
|
26406
26634
|
if (hasRequiredCommand$1) return command$1;
|
|
26407
26635
|
hasRequiredCommand$1 = 1;
|
|
26408
26636
|
const EventEmitter2 = require$$0$4.EventEmitter;
|
|
26409
|
-
const childProcess =
|
|
26637
|
+
const childProcess = Tw__default;
|
|
26410
26638
|
const path2 = path__default;
|
|
26411
26639
|
const fs2 = fs__default$1;
|
|
26412
26640
|
const process2 = process$2;
|
|
@@ -31348,7 +31576,7 @@ ${originalIndentation}`;
|
|
|
31348
31576
|
function requireStream$3() {
|
|
31349
31577
|
if (hasRequiredStream$3) return stream$3;
|
|
31350
31578
|
hasRequiredStream$3 = 1;
|
|
31351
|
-
stream$3 =
|
|
31579
|
+
stream$3 = xo;
|
|
31352
31580
|
return stream$3;
|
|
31353
31581
|
}
|
|
31354
31582
|
var destroy_1;
|
|
@@ -34939,7 +35167,7 @@ ${originalIndentation}`;
|
|
|
34939
35167
|
if (hasRequiredReadable$1) return readable$1.exports;
|
|
34940
35168
|
hasRequiredReadable$1 = 1;
|
|
34941
35169
|
(function(module2, exports$1) {
|
|
34942
|
-
var Stream =
|
|
35170
|
+
var Stream = xo;
|
|
34943
35171
|
if (process.env.READABLE_STREAM === "disable" && Stream) {
|
|
34944
35172
|
module2.exports = Stream.Readable;
|
|
34945
35173
|
Object.assign(module2.exports, Stream);
|
|
@@ -37845,7 +38073,7 @@ ${originalIndentation}`;
|
|
|
37845
38073
|
const fs2 = fs__default;
|
|
37846
38074
|
const path2 = path__default$1;
|
|
37847
38075
|
const asyncSeries = requireSeries();
|
|
37848
|
-
const zlib =
|
|
38076
|
+
const zlib = Ri__default;
|
|
37849
38077
|
const { MESSAGE } = requireTripleBeam();
|
|
37850
38078
|
const { Stream, PassThrough: PassThrough2 } = requireReadable$1();
|
|
37851
38079
|
const TransportStream = requireWinstonTransport();
|
|
@@ -44782,10 +45010,10 @@ ${originalIndentation}`;
|
|
|
44782
45010
|
const os2 = os__default$1;
|
|
44783
45011
|
const path2 = path__default$1;
|
|
44784
45012
|
const util2 = require$$0$5;
|
|
44785
|
-
const zlib =
|
|
45013
|
+
const zlib = Ri__default;
|
|
44786
45014
|
const hash2 = requireObjectHash();
|
|
44787
45015
|
const MESSAGE = requireTripleBeam().MESSAGE;
|
|
44788
|
-
const PassThrough2 =
|
|
45016
|
+
const PassThrough2 = xo.PassThrough;
|
|
44789
45017
|
const Transport = requireWinstonTransport();
|
|
44790
45018
|
const loggerDefaults = {
|
|
44791
45019
|
json: false,
|
|
@@ -45237,7 +45465,7 @@ ${value.slice(value.length - safeTailChars)}`;
|
|
|
45237
45465
|
return files;
|
|
45238
45466
|
}
|
|
45239
45467
|
async function readDailyLogFile(file2) {
|
|
45240
|
-
const raw2 = await
|
|
45468
|
+
const raw2 = await Xt__default.readFile(file2.path);
|
|
45241
45469
|
if (!file2.compressed) return raw2.toString("utf8");
|
|
45242
45470
|
return (await gunzip(raw2)).toString("utf8");
|
|
45243
45471
|
}
|
|
@@ -50155,7 +50383,7 @@ ${fromBody}`;
|
|
|
50155
50383
|
function isRecord$6(value) {
|
|
50156
50384
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50157
50385
|
}
|
|
50158
|
-
function asRecord$
|
|
50386
|
+
function asRecord$2(value) {
|
|
50159
50387
|
return isRecord$6(value) ? value : null;
|
|
50160
50388
|
}
|
|
50161
50389
|
function readSessionUserFromResponse(response2) {
|
|
@@ -50168,7 +50396,7 @@ ${fromBody}`;
|
|
|
50168
50396
|
return nested;
|
|
50169
50397
|
}
|
|
50170
50398
|
}
|
|
50171
|
-
const user = asRecord$
|
|
50399
|
+
const user = asRecord$2(response2.user);
|
|
50172
50400
|
const parsed = SessionUserSchema.safeParse(user);
|
|
50173
50401
|
if (!parsed.success) {
|
|
50174
50402
|
return null;
|
|
@@ -65152,7 +65380,7 @@ ${peerId}`;
|
|
|
65152
65380
|
function requirePermessageDeflate$1() {
|
|
65153
65381
|
if (hasRequiredPermessageDeflate$1) return permessageDeflate$1;
|
|
65154
65382
|
hasRequiredPermessageDeflate$1 = 1;
|
|
65155
|
-
const zlib =
|
|
65383
|
+
const zlib = Ri__default;
|
|
65156
65384
|
const bufferUtil2 = requireBufferUtil();
|
|
65157
65385
|
const Limiter = requireLimiter();
|
|
65158
65386
|
const { kStatusCode } = requireConstants$5();
|
|
@@ -65607,7 +65835,7 @@ ${peerId}`;
|
|
|
65607
65835
|
function requireReceiver$1() {
|
|
65608
65836
|
if (hasRequiredReceiver$1) return receiver$1;
|
|
65609
65837
|
hasRequiredReceiver$1 = 1;
|
|
65610
|
-
const { Writable } =
|
|
65838
|
+
const { Writable } = xo;
|
|
65611
65839
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
65612
65840
|
const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = requireConstants$5();
|
|
65613
65841
|
const { concat: concat2, toArrayBuffer: toArrayBuffer2, unmask } = requireBufferUtil();
|
|
@@ -65974,7 +66202,7 @@ ${peerId}`;
|
|
|
65974
66202
|
function requireSender$1() {
|
|
65975
66203
|
if (hasRequiredSender$1) return sender$1;
|
|
65976
66204
|
hasRequiredSender$1 = 1;
|
|
65977
|
-
const { Duplex } =
|
|
66205
|
+
const { Duplex } = xo;
|
|
65978
66206
|
const { randomFillSync: randomFillSync2 } = crypto__default;
|
|
65979
66207
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
65980
66208
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants$5();
|
|
@@ -66711,7 +66939,7 @@ ${peerId}`;
|
|
|
66711
66939
|
const net2 = require$$0$9;
|
|
66712
66940
|
const tls = require$$4$2;
|
|
66713
66941
|
const { randomBytes: randomBytes2, createHash: createHash2 } = crypto__default;
|
|
66714
|
-
const { Duplex, Readable: Readable2 } =
|
|
66942
|
+
const { Duplex, Readable: Readable2 } = xo;
|
|
66715
66943
|
const { URL: URL2 } = require$$7$2;
|
|
66716
66944
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
66717
66945
|
const Receiver = requireReceiver$1();
|
|
@@ -67449,7 +67677,7 @@ ${peerId}`;
|
|
|
67449
67677
|
if (hasRequiredStream$1) return stream$1;
|
|
67450
67678
|
hasRequiredStream$1 = 1;
|
|
67451
67679
|
requireWebsocket$1();
|
|
67452
|
-
const { Duplex } =
|
|
67680
|
+
const { Duplex } = xo;
|
|
67453
67681
|
function emitClose(stream2) {
|
|
67454
67682
|
stream2.emit("close");
|
|
67455
67683
|
}
|
|
@@ -67600,7 +67828,7 @@ ${peerId}`;
|
|
|
67600
67828
|
hasRequiredWebsocketServer = 1;
|
|
67601
67829
|
const EventEmitter2 = require$$0$7;
|
|
67602
67830
|
const http$12 = http;
|
|
67603
|
-
const { Duplex } =
|
|
67831
|
+
const { Duplex } = xo;
|
|
67604
67832
|
const { createHash: createHash2 } = crypto__default;
|
|
67605
67833
|
const extension2 = requireExtension();
|
|
67606
67834
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
@@ -101627,15 +101855,15 @@ ${value}`;
|
|
|
101627
101855
|
}
|
|
101628
101856
|
undiciDiagnosticsInstalled = true;
|
|
101629
101857
|
channel("undici:client:connected").subscribe((message) => {
|
|
101630
|
-
const record2 = asRecord(message);
|
|
101631
|
-
const socket = asRecord(record2?.socket);
|
|
101632
|
-
const connectParams = asRecord(record2?.connectParams);
|
|
101858
|
+
const record2 = asRecord$1(message);
|
|
101859
|
+
const socket = asRecord$1(record2?.socket);
|
|
101860
|
+
const connectParams = asRecord$1(record2?.connectParams);
|
|
101633
101861
|
const alpn = readString(socket, "alpnProtocol") ?? "unknown";
|
|
101634
101862
|
const origin = readString(connectParams, "origin") ?? readString(connectParams, "host") ?? readString(connectParams, "hostname") ?? "unknown";
|
|
101635
101863
|
logger2.debug(`[http-transport] undici connected origin=${sanitizeUrlForLogging(origin)} alpn=${alpn}`);
|
|
101636
101864
|
});
|
|
101637
101865
|
channel("undici:proxy:connected").subscribe((message) => {
|
|
101638
|
-
const record2 = asRecord(message);
|
|
101866
|
+
const record2 = asRecord$1(message);
|
|
101639
101867
|
const proxy = readString(record2, "proxy") ?? readString(record2, "origin") ?? "configured";
|
|
101640
101868
|
logger2.debug(`[http-transport] undici proxy connected proxy=${sanitizeUrlForLogging(proxy)}`);
|
|
101641
101869
|
});
|
|
@@ -101671,7 +101899,7 @@ ${value}`;
|
|
|
101671
101899
|
const parsed = Number.parseInt(value, 10);
|
|
101672
101900
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback2;
|
|
101673
101901
|
}
|
|
101674
|
-
function asRecord(value) {
|
|
101902
|
+
function asRecord$1(value) {
|
|
101675
101903
|
return typeof value === "object" && value !== null ? value : null;
|
|
101676
101904
|
}
|
|
101677
101905
|
function readString(record2, key2) {
|
|
@@ -101930,7 +102158,7 @@ ${value}`;
|
|
|
101930
102158
|
return "internal";
|
|
101931
102159
|
}
|
|
101932
102160
|
}
|
|
101933
|
-
async function withDeadline
|
|
102161
|
+
async function withDeadline(operation, options) {
|
|
101934
102162
|
const { timeoutMs, signal } = options;
|
|
101935
102163
|
if (timeoutMs === void 0 && !signal) return operation;
|
|
101936
102164
|
if (signal?.aborted) options.onAbort();
|
|
@@ -102262,7 +102490,7 @@ ${value}`;
|
|
|
102262
102490
|
});
|
|
102263
102491
|
}
|
|
102264
102492
|
awaitWithDeadline(operation, options, ctx) {
|
|
102265
|
-
return withDeadline
|
|
102493
|
+
return withDeadline(operation, {
|
|
102266
102494
|
timeoutMs: options?.timeout,
|
|
102267
102495
|
signal: options?.signal,
|
|
102268
102496
|
onTimeout: () => {
|
|
@@ -103717,6 +103945,21 @@ ${value}`;
|
|
|
103717
103945
|
...entry,
|
|
103718
103946
|
inputConfig: normalizeSessionTurnInputConfig(entry.inputConfig)
|
|
103719
103947
|
});
|
|
103948
|
+
const isValidDaemonLaunchConfig = (config2, expectedConfigId, expectedMachineId) => {
|
|
103949
|
+
if (config2.id !== expectedConfigId || config2.machineId !== expectedMachineId || typeof config2.agentType !== "string" || config2.agentType.trim().length === 0 || typeof config2.env !== "object" || config2.env === null || Array.isArray(config2.env) || Object.values(config2.env).some((value) => typeof value !== "string")) {
|
|
103950
|
+
return false;
|
|
103951
|
+
}
|
|
103952
|
+
if (config2.cliType === "custom") {
|
|
103953
|
+
return CustomAcpLaunchSpecSchema.safeParse(config2.customAcp).success && config2.runtimeOverrides === void 0;
|
|
103954
|
+
}
|
|
103955
|
+
if (config2.cliType === "registry") {
|
|
103956
|
+
return config2.customAcp === void 0 && config2.runtimeOverrides === void 0;
|
|
103957
|
+
}
|
|
103958
|
+
if (config2.cliType === "builtin") {
|
|
103959
|
+
return config2.customAcp === void 0 && (config2.runtimeOverrides === void 0 || BuiltinRuntimeOverridesSchema.safeParse(config2.runtimeOverrides).success);
|
|
103960
|
+
}
|
|
103961
|
+
return false;
|
|
103962
|
+
};
|
|
103720
103963
|
const localLoroDataPlaneScheduler = createLocalLoroDataPlaneScheduler((work) => {
|
|
103721
103964
|
const handle = setImmediate(work);
|
|
103722
103965
|
return () => clearImmediate(handle);
|
|
@@ -104459,6 +104702,24 @@ ${value}`;
|
|
|
104459
104702
|
const configs = await listMergedAgentConfigs(this.repo, this.workspaceId);
|
|
104460
104703
|
return configs.find((config2) => config2.id === agentConfigId) ?? null;
|
|
104461
104704
|
}
|
|
104705
|
+
async getAgentConfigForMachineLaunch(agentConfigId, machineId) {
|
|
104706
|
+
const config2 = await this.getAgentConfigById(agentConfigId, machineId);
|
|
104707
|
+
if (config2) {
|
|
104708
|
+
return isValidDaemonLaunchConfig(config2, agentConfigId, machineId) ? config2 : null;
|
|
104709
|
+
}
|
|
104710
|
+
const handle = await this.repo.openFlockDoc(getMachineFlockDocId(this.workspaceId, machineId));
|
|
104711
|
+
const rows = readMachineFlockRowsFromFlock(handle.flock, {
|
|
104712
|
+
prefixes: [
|
|
104713
|
+
machineFlockKeys.providerSetup(agentConfigId),
|
|
104714
|
+
machineFlockKeys.providerSetupCancellation(agentConfigId)
|
|
104715
|
+
]
|
|
104716
|
+
});
|
|
104717
|
+
if (getMachineFlockProviderSetupCancellations(rows)[agentConfigId]) {
|
|
104718
|
+
return null;
|
|
104719
|
+
}
|
|
104720
|
+
const setup = getMachineFlockProviderSetups(rows)[agentConfigId];
|
|
104721
|
+
return setup?.machineId === machineId && isValidDaemonLaunchConfig(setup.config, agentConfigId, machineId) ? setup.config : null;
|
|
104722
|
+
}
|
|
104462
104723
|
async createAgentConfig(cliType, agentType, machineId, name2) {
|
|
104463
104724
|
const agentConfigId = v4();
|
|
104464
104725
|
await upsertMachineAgentConfig(this.repo, this.workspaceId, {
|
|
@@ -105885,6 +106146,7 @@ ${value}`;
|
|
|
105885
106146
|
return pair;
|
|
105886
106147
|
};
|
|
105887
106148
|
const getMachineAcpAuthorizationCodeSecretContext = (options) => `machine/acp-authenticate\0${options.workspaceId}\0${options.machineId}\0${options.authenticationRequestId}`;
|
|
106149
|
+
const getMachineAcpAuthenticationInputSecretContext = (options) => `machine/acp-authenticate-input\0${options.workspaceId}\0${options.machineId}\0${options.authenticationRequestId}\0${options.interactionId}`;
|
|
105888
106150
|
const createRpcSecretRecipient = async () => {
|
|
105889
106151
|
const pair = await createKeyPair();
|
|
105890
106152
|
const keyIdBytes = new Uint8Array(16);
|
|
@@ -106034,12 +106296,7 @@ ${value}`;
|
|
|
106034
106296
|
const LoroMachineAcpCapabilitiesRefreshRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106035
106297
|
method: literal$1("machine/acp-capabilities-refresh"),
|
|
106036
106298
|
params: object$1({
|
|
106037
|
-
configId: AgentConfigIdSchema
|
|
106038
|
-
cliType: AgentConfigCliTypeSchema,
|
|
106039
|
-
agentType: string$1().trim().min(1),
|
|
106040
|
-
customAcp: CustomAcpLaunchSpecSchema.optional(),
|
|
106041
|
-
runtimeOverrides: BuiltinRuntimeOverridesSchema.optional(),
|
|
106042
|
-
env: record$1(string$1(), string$1()).optional()
|
|
106299
|
+
configId: AgentConfigIdSchema
|
|
106043
106300
|
}).strict()
|
|
106044
106301
|
}).strict();
|
|
106045
106302
|
const LoroMachineAcpCapabilitiesRefreshCancelRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
@@ -106050,37 +106307,31 @@ ${value}`;
|
|
|
106050
106307
|
}).strict();
|
|
106051
106308
|
const LoroMachineAcpAuthenticateRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106052
106309
|
method: literal$1("machine/acp-authenticate"),
|
|
106053
|
-
params:
|
|
106054
|
-
|
|
106055
|
-
|
|
106056
|
-
"start",
|
|
106057
|
-
|
|
106058
|
-
|
|
106059
|
-
|
|
106060
|
-
|
|
106061
|
-
|
|
106062
|
-
|
|
106063
|
-
|
|
106064
|
-
|
|
106065
|
-
|
|
106066
|
-
|
|
106067
|
-
|
|
106068
|
-
|
|
106069
|
-
|
|
106070
|
-
|
|
106071
|
-
|
|
106072
|
-
|
|
106073
|
-
|
|
106074
|
-
|
|
106075
|
-
|
|
106076
|
-
|
|
106077
|
-
|
|
106078
|
-
context2.addIssue({
|
|
106079
|
-
code: "custom",
|
|
106080
|
-
message: "Authorization-code fields are only valid for submit-code"
|
|
106081
|
-
});
|
|
106082
|
-
}
|
|
106083
|
-
})
|
|
106310
|
+
params: discriminatedUnion("action", [
|
|
106311
|
+
object$1({
|
|
106312
|
+
requestId: string$1().trim().min(1).max(1024),
|
|
106313
|
+
action: literal$1("start"),
|
|
106314
|
+
configId: AgentConfigIdSchema
|
|
106315
|
+
}).strict(),
|
|
106316
|
+
object$1({
|
|
106317
|
+
requestId: string$1().trim().min(1).max(1024),
|
|
106318
|
+
action: literal$1("cancel"),
|
|
106319
|
+
authenticationRequestId: string$1().trim().min(1).max(1024)
|
|
106320
|
+
}).strict(),
|
|
106321
|
+
object$1({
|
|
106322
|
+
requestId: string$1().trim().min(1).max(1024),
|
|
106323
|
+
action: literal$1("submit-code"),
|
|
106324
|
+
authenticationRequestId: string$1().trim().min(1).max(1024),
|
|
106325
|
+
authorizationCodeEnvelope: RpcSecretEnvelopeSchema
|
|
106326
|
+
}).strict(),
|
|
106327
|
+
object$1({
|
|
106328
|
+
requestId: string$1().trim().min(1).max(1024),
|
|
106329
|
+
action: literal$1("submit-input"),
|
|
106330
|
+
authenticationRequestId: string$1().trim().min(1).max(1024),
|
|
106331
|
+
interactionId: string$1().trim().min(1).max(1024),
|
|
106332
|
+
authenticationInputEnvelope: RpcSecretEnvelopeSchema
|
|
106333
|
+
}).strict()
|
|
106334
|
+
])
|
|
106084
106335
|
}).strict();
|
|
106085
106336
|
const LoroMachineAcpBinaryStatusRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106086
106337
|
method: literal$1("machine/acp-binary-status"),
|
|
@@ -107392,18 +107643,14 @@ ${value}`;
|
|
|
107392
107643
|
onAcpBinaryProgress: options.onProgress,
|
|
107393
107644
|
signal: options.signal,
|
|
107394
107645
|
params: {
|
|
107395
|
-
configId: options.configId
|
|
107396
|
-
cliType: options.cliType,
|
|
107397
|
-
agentType: options.agentType,
|
|
107398
|
-
customAcp: options.customAcp,
|
|
107399
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
107400
|
-
env: options.env
|
|
107646
|
+
configId: options.configId
|
|
107401
107647
|
}
|
|
107402
107648
|
});
|
|
107403
107649
|
}
|
|
107404
107650
|
async requestMachineAcpAuthenticate(options) {
|
|
107405
|
-
const authenticationRequestId = options.authenticationRequestId;
|
|
107651
|
+
const authenticationRequestId = options.action === "start" ? void 0 : options.authenticationRequestId;
|
|
107406
107652
|
let authorizationCodeEnvelope;
|
|
107653
|
+
let authenticationInputEnvelope;
|
|
107407
107654
|
if (options.action === "submit-code") {
|
|
107408
107655
|
if (!authenticationRequestId || !options.authorizationCode?.trim() || options.authorizationCode.length > 4096) {
|
|
107409
107656
|
throw new Error("Submitting an authorization code requires an authentication request.");
|
|
@@ -107418,36 +107665,79 @@ ${value}`;
|
|
|
107418
107665
|
authenticationRequestId
|
|
107419
107666
|
}));
|
|
107420
107667
|
}
|
|
107668
|
+
if (options.action === "submit-input") {
|
|
107669
|
+
if (!authenticationRequestId || !options.interactionId || !options.authenticationInput || options.authenticationInput.length > 65536) {
|
|
107670
|
+
throw new Error("Submitting authentication input requires an active interaction.");
|
|
107671
|
+
}
|
|
107672
|
+
const publicKey = this.acpAuthorizationCodePublicKeys.get(authenticationRequestId);
|
|
107673
|
+
if (!publicKey) {
|
|
107674
|
+
throw new Error("The target machine did not provide an authentication-input key.");
|
|
107675
|
+
}
|
|
107676
|
+
authenticationInputEnvelope = await encryptRpcSecret(publicKey, options.authenticationInput, getMachineAcpAuthenticationInputSecretContext({
|
|
107677
|
+
workspaceId: this.options.workspaceId,
|
|
107678
|
+
machineId: this.options.machineId,
|
|
107679
|
+
authenticationRequestId,
|
|
107680
|
+
interactionId: options.interactionId
|
|
107681
|
+
}));
|
|
107682
|
+
}
|
|
107421
107683
|
const onProgress = (progress) => {
|
|
107422
|
-
|
|
107423
|
-
|
|
107684
|
+
const inputPublicKey = progress.authenticationInputPublicKey ?? progress.authorizationCodePublicKey;
|
|
107685
|
+
if (inputPublicKey) {
|
|
107686
|
+
this.acpAuthorizationCodePublicKeys.set(progress.requestId, inputPublicKey);
|
|
107424
107687
|
}
|
|
107425
107688
|
options.onProgress?.(progress);
|
|
107426
107689
|
};
|
|
107427
107690
|
try {
|
|
107691
|
+
const params = (() => {
|
|
107692
|
+
switch (options.action) {
|
|
107693
|
+
case "start":
|
|
107694
|
+
return {
|
|
107695
|
+
requestId: options.requestId,
|
|
107696
|
+
action: options.action,
|
|
107697
|
+
configId: options.configId
|
|
107698
|
+
};
|
|
107699
|
+
case "cancel":
|
|
107700
|
+
return {
|
|
107701
|
+
requestId: options.requestId,
|
|
107702
|
+
action: options.action,
|
|
107703
|
+
authenticationRequestId: options.authenticationRequestId
|
|
107704
|
+
};
|
|
107705
|
+
case "submit-code":
|
|
107706
|
+
if (!authorizationCodeEnvelope) {
|
|
107707
|
+
throw new Error("Authorization-code encryption did not produce an envelope.");
|
|
107708
|
+
}
|
|
107709
|
+
return {
|
|
107710
|
+
requestId: options.requestId,
|
|
107711
|
+
action: options.action,
|
|
107712
|
+
authenticationRequestId: options.authenticationRequestId,
|
|
107713
|
+
authorizationCodeEnvelope
|
|
107714
|
+
};
|
|
107715
|
+
case "submit-input":
|
|
107716
|
+
if (!authenticationInputEnvelope) {
|
|
107717
|
+
throw new Error("Authentication-input encryption did not produce an envelope.");
|
|
107718
|
+
}
|
|
107719
|
+
return {
|
|
107720
|
+
requestId: options.requestId,
|
|
107721
|
+
action: options.action,
|
|
107722
|
+
authenticationRequestId: options.authenticationRequestId,
|
|
107723
|
+
interactionId: options.interactionId,
|
|
107724
|
+
authenticationInputEnvelope
|
|
107725
|
+
};
|
|
107726
|
+
default:
|
|
107727
|
+
throw new Error("Unsupported ACP authentication action.");
|
|
107728
|
+
}
|
|
107729
|
+
})();
|
|
107428
107730
|
return await this.sendRequest({
|
|
107429
107731
|
method: "machine/acp-authenticate",
|
|
107430
107732
|
timeoutMs: options.timeoutMs ?? 3e5,
|
|
107431
107733
|
onAcpAuthenticationProgress: onProgress,
|
|
107432
|
-
params
|
|
107433
|
-
requestId: options.requestId,
|
|
107434
|
-
action: options.action,
|
|
107435
|
-
authenticationRequestId,
|
|
107436
|
-
authorizationCodeEnvelope,
|
|
107437
|
-
...options.methodId ? {
|
|
107438
|
-
methodId: options.methodId
|
|
107439
|
-
} : {},
|
|
107440
|
-
configId: options.configId,
|
|
107441
|
-
cliType: options.cliType,
|
|
107442
|
-
agentType: options.agentType,
|
|
107443
|
-
customAcp: options.customAcp,
|
|
107444
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
107445
|
-
env: options.env
|
|
107446
|
-
}
|
|
107734
|
+
params
|
|
107447
107735
|
});
|
|
107448
107736
|
} finally {
|
|
107449
|
-
if (options.action === "start"
|
|
107737
|
+
if (options.action === "start") {
|
|
107450
107738
|
this.acpAuthorizationCodePublicKeys.delete(options.requestId);
|
|
107739
|
+
} else if (options.action === "cancel") {
|
|
107740
|
+
this.acpAuthorizationCodePublicKeys.delete(options.authenticationRequestId);
|
|
107451
107741
|
}
|
|
107452
107742
|
}
|
|
107453
107743
|
}
|
|
@@ -107812,8 +108102,8 @@ ${value}`;
|
|
|
107812
108102
|
timeoutMs,
|
|
107813
108103
|
refreshContext: args2.method === "machine/acp-capabilities-refresh" ? {
|
|
107814
108104
|
configId: args2.params.configId,
|
|
107815
|
-
cliType:
|
|
107816
|
-
agentType:
|
|
108105
|
+
cliType: "builtin",
|
|
108106
|
+
agentType: "unknown"
|
|
107817
108107
|
} : void 0,
|
|
107818
108108
|
pingContext: args2.method === "machine/ping" ? {
|
|
107819
108109
|
requestId: args2.params.requestId
|
|
@@ -107825,7 +108115,7 @@ ${value}`;
|
|
|
107825
108115
|
requestId: args2.params.requestId
|
|
107826
108116
|
} : void 0,
|
|
107827
108117
|
binaryContext: args2.method === "machine/acp-authenticate" ? {
|
|
107828
|
-
agentType:
|
|
108118
|
+
agentType: "unknown",
|
|
107829
108119
|
requestId: args2.params.requestId
|
|
107830
108120
|
} : args2.method === "machine/acp-binary-status" || args2.method === "machine/acp-binary-install" ? {
|
|
107831
108121
|
agentType: args2.params.agentType
|
|
@@ -108240,14 +108530,29 @@ ${value}`;
|
|
|
108240
108530
|
const redactRpcRequestForLog = (raw2) => {
|
|
108241
108531
|
if (typeof raw2 !== "object" || raw2 === null) return raw2;
|
|
108242
108532
|
const request2 = raw2;
|
|
108243
|
-
if (request2.method !== "machine/acp-authenticate" || typeof request2.params !== "object" || request2.params === null
|
|
108533
|
+
if (request2.method !== "machine/acp-authenticate" && request2.method !== "machine/acp-capabilities-refresh" || typeof request2.params !== "object" || request2.params === null) {
|
|
108244
108534
|
return raw2;
|
|
108245
108535
|
}
|
|
108536
|
+
const params = request2.params;
|
|
108246
108537
|
return {
|
|
108247
108538
|
...request2,
|
|
108248
108539
|
params: {
|
|
108249
|
-
...
|
|
108250
|
-
|
|
108540
|
+
...params,
|
|
108541
|
+
...Object.hasOwn(params, "env") ? {
|
|
108542
|
+
env: "[REDACTED]"
|
|
108543
|
+
} : {},
|
|
108544
|
+
...Object.hasOwn(params, "authorizationCode") ? {
|
|
108545
|
+
authorizationCode: "[REDACTED]"
|
|
108546
|
+
} : {},
|
|
108547
|
+
...Object.hasOwn(params, "authenticationInput") ? {
|
|
108548
|
+
authenticationInput: "[REDACTED]"
|
|
108549
|
+
} : {},
|
|
108550
|
+
...Object.hasOwn(params, "authorizationCodeEnvelope") ? {
|
|
108551
|
+
authorizationCodeEnvelope: "[REDACTED]"
|
|
108552
|
+
} : {},
|
|
108553
|
+
...Object.hasOwn(params, "authenticationInputEnvelope") ? {
|
|
108554
|
+
authenticationInputEnvelope: "[REDACTED]"
|
|
108555
|
+
} : {}
|
|
108251
108556
|
}
|
|
108252
108557
|
};
|
|
108253
108558
|
};
|
|
@@ -108492,7 +108797,7 @@ ${value}`;
|
|
|
108492
108797
|
return false;
|
|
108493
108798
|
}
|
|
108494
108799
|
const action = request2.params.action;
|
|
108495
|
-
return action === "cancel" || action === "submit-code";
|
|
108800
|
+
return action === "cancel" || action === "submit-code" || action === "submit-input";
|
|
108496
108801
|
}
|
|
108497
108802
|
async runRequestTask(raw2, lane, options) {
|
|
108498
108803
|
if (options?.deferredAcquire) {
|
|
@@ -108606,11 +108911,6 @@ ${value}`;
|
|
|
108606
108911
|
};
|
|
108607
108912
|
const response2 = await this.deps.refreshMachineAcpCapabilities({
|
|
108608
108913
|
configId: request2.params.configId,
|
|
108609
|
-
cliType: request2.params.cliType,
|
|
108610
|
-
agentType: request2.params.agentType,
|
|
108611
|
-
customAcp: request2.params.customAcp,
|
|
108612
|
-
runtimeOverrides: request2.params.runtimeOverrides,
|
|
108613
|
-
env: request2.params.env,
|
|
108614
108914
|
onAcpBinaryProgress: appendProgress,
|
|
108615
108915
|
signal: controller.signal
|
|
108616
108916
|
});
|
|
@@ -108647,19 +108947,23 @@ ${value}`;
|
|
|
108647
108947
|
}
|
|
108648
108948
|
let progressWrites = Promise.resolve();
|
|
108649
108949
|
const appendProgress = (progress) => {
|
|
108650
|
-
const
|
|
108950
|
+
const acceptsInteractionInput = progress.status === "auth-methods" || progress.status === "input-required" || progress.requiresAuthorizationConsent === true;
|
|
108951
|
+
const safeProgress = recipient && (progress.acceptsAuthorizationCode || acceptsInteractionInput) ? {
|
|
108651
108952
|
...progress,
|
|
108652
|
-
|
|
108953
|
+
...progress.acceptsAuthorizationCode ? {
|
|
108954
|
+
authorizationCodePublicKey: recipient.publicKey
|
|
108955
|
+
} : {},
|
|
108956
|
+
...acceptsInteractionInput ? {
|
|
108957
|
+
authenticationInputPublicKey: recipient.publicKey
|
|
108958
|
+
} : {}
|
|
108653
108959
|
} : progress;
|
|
108654
108960
|
progressWrites = progressWrites.then(() => this.appendResultResponse(request2.replyTo, request2.id, request2.method, safeProgress)).catch(() => void 0);
|
|
108655
108961
|
};
|
|
108656
108962
|
let authorizationCode;
|
|
108963
|
+
let authenticationInput;
|
|
108657
108964
|
if (request2.params.action === "submit-code") {
|
|
108658
108965
|
const authenticationRequestId = request2.params.authenticationRequestId;
|
|
108659
108966
|
const authorizationCodeEnvelope = request2.params.authorizationCodeEnvelope;
|
|
108660
|
-
if (!authenticationRequestId || !authorizationCodeEnvelope) {
|
|
108661
|
-
throw new Error("Missing encrypted authorization-code input.");
|
|
108662
|
-
}
|
|
108663
108967
|
const activeRecipient = this.acpAuthorizationCodeRecipients.get(authenticationRequestId);
|
|
108664
108968
|
if (!activeRecipient) {
|
|
108665
108969
|
throw new Error("Authorization-code recipient is no longer active.");
|
|
@@ -108673,27 +108977,79 @@ ${value}`;
|
|
|
108673
108977
|
throw new Error("Invalid decrypted authorization-code input.");
|
|
108674
108978
|
}
|
|
108675
108979
|
}
|
|
108980
|
+
if (request2.params.action === "submit-input") {
|
|
108981
|
+
const authenticationRequestId = request2.params.authenticationRequestId;
|
|
108982
|
+
const interactionId = request2.params.interactionId;
|
|
108983
|
+
const authenticationInputEnvelope = request2.params.authenticationInputEnvelope;
|
|
108984
|
+
const activeRecipient = this.acpAuthorizationCodeRecipients.get(authenticationRequestId);
|
|
108985
|
+
if (!activeRecipient) {
|
|
108986
|
+
throw new Error("Authentication-input recipient is no longer active.");
|
|
108987
|
+
}
|
|
108988
|
+
authenticationInput = await activeRecipient.decrypt(authenticationInputEnvelope, getMachineAcpAuthenticationInputSecretContext({
|
|
108989
|
+
workspaceId: this.deps.workspaceId,
|
|
108990
|
+
machineId: this.deps.machineId,
|
|
108991
|
+
authenticationRequestId,
|
|
108992
|
+
interactionId
|
|
108993
|
+
}));
|
|
108994
|
+
if (!authenticationInput || authenticationInput.length > 65536) {
|
|
108995
|
+
throw new Error("Invalid decrypted authentication input.");
|
|
108996
|
+
}
|
|
108997
|
+
}
|
|
108676
108998
|
try {
|
|
108677
|
-
const response2 = await
|
|
108678
|
-
|
|
108679
|
-
|
|
108680
|
-
|
|
108681
|
-
|
|
108682
|
-
|
|
108683
|
-
|
|
108684
|
-
|
|
108685
|
-
|
|
108686
|
-
|
|
108687
|
-
|
|
108688
|
-
|
|
108689
|
-
|
|
108690
|
-
|
|
108999
|
+
const response2 = await (() => {
|
|
109000
|
+
switch (request2.params.action) {
|
|
109001
|
+
case "start":
|
|
109002
|
+
return this.deps.authenticateMachineAcp?.({
|
|
109003
|
+
requestId: request2.params.requestId,
|
|
109004
|
+
action: request2.params.action,
|
|
109005
|
+
configId: request2.params.configId,
|
|
109006
|
+
onProgress: appendProgress
|
|
109007
|
+
});
|
|
109008
|
+
case "cancel":
|
|
109009
|
+
return this.deps.authenticateMachineAcp?.({
|
|
109010
|
+
requestId: request2.params.requestId,
|
|
109011
|
+
action: request2.params.action,
|
|
109012
|
+
authenticationRequestId: request2.params.authenticationRequestId,
|
|
109013
|
+
onProgress: appendProgress
|
|
109014
|
+
});
|
|
109015
|
+
case "submit-code":
|
|
109016
|
+
if (authorizationCode === void 0) {
|
|
109017
|
+
throw new Error("Missing decrypted authorization-code input.");
|
|
109018
|
+
}
|
|
109019
|
+
return this.deps.authenticateMachineAcp?.({
|
|
109020
|
+
requestId: request2.params.requestId,
|
|
109021
|
+
action: request2.params.action,
|
|
109022
|
+
authenticationRequestId: request2.params.authenticationRequestId,
|
|
109023
|
+
authorizationCode,
|
|
109024
|
+
onProgress: appendProgress
|
|
109025
|
+
});
|
|
109026
|
+
case "submit-input":
|
|
109027
|
+
if (authenticationInput === void 0) {
|
|
109028
|
+
throw new Error("Missing decrypted authentication input.");
|
|
109029
|
+
}
|
|
109030
|
+
return this.deps.authenticateMachineAcp?.({
|
|
109031
|
+
requestId: request2.params.requestId,
|
|
109032
|
+
action: request2.params.action,
|
|
109033
|
+
authenticationRequestId: request2.params.authenticationRequestId,
|
|
109034
|
+
interactionId: request2.params.interactionId,
|
|
109035
|
+
authenticationInput,
|
|
109036
|
+
onProgress: appendProgress
|
|
109037
|
+
});
|
|
109038
|
+
default:
|
|
109039
|
+
throw new Error("Unsupported ACP authentication action.");
|
|
109040
|
+
}
|
|
109041
|
+
})();
|
|
109042
|
+
if (!response2) {
|
|
109043
|
+
throw new Error("ACP authentication is not available on this machine.");
|
|
109044
|
+
}
|
|
108691
109045
|
await progressWrites;
|
|
108692
109046
|
await this.appendResultResponse(request2.replyTo, request2.id, request2.method, response2);
|
|
108693
109047
|
return;
|
|
108694
109048
|
} finally {
|
|
108695
|
-
if (isStart
|
|
109049
|
+
if (isStart) {
|
|
108696
109050
|
this.acpAuthorizationCodeRecipients.delete(request2.params.requestId);
|
|
109051
|
+
} else if (request2.params.action === "cancel") {
|
|
109052
|
+
this.acpAuthorizationCodeRecipients.delete(request2.params.authenticationRequestId);
|
|
108697
109053
|
}
|
|
108698
109054
|
}
|
|
108699
109055
|
}
|
|
@@ -109434,12 +109790,7 @@ ${value}`;
|
|
|
109434
109790
|
type: "machine/acp-capabilities-refresh",
|
|
109435
109791
|
machineId: this.machineId,
|
|
109436
109792
|
workspaceId: this.workspaceId,
|
|
109437
|
-
configId: verifying.config.id
|
|
109438
|
-
cliType: verifying.config.cliType,
|
|
109439
|
-
agentType: verifying.config.agentType,
|
|
109440
|
-
customAcp: verifying.config.customAcp,
|
|
109441
|
-
runtimeOverrides: verifying.config.runtimeOverrides,
|
|
109442
|
-
env: verifying.config.env
|
|
109793
|
+
configId: verifying.config.id
|
|
109443
109794
|
});
|
|
109444
109795
|
if (response2.success) {
|
|
109445
109796
|
await this.publishVerifiedConfig(verifying.id, attempt);
|
|
@@ -109863,20 +110214,20 @@ ${value}`;
|
|
|
109863
110214
|
};
|
|
109864
110215
|
const parsed = DaemonUpgradeIntentSchema.parse(value);
|
|
109865
110216
|
const dir = path.dirname(DAEMON_UPGRADE_INTENT_FILE);
|
|
109866
|
-
await
|
|
110217
|
+
await Xt.mkdir(dir, {
|
|
109867
110218
|
recursive: true
|
|
109868
110219
|
});
|
|
109869
110220
|
const tmpPath = path.join(dir, `.${path.basename(DAEMON_UPGRADE_INTENT_FILE)}.${process.pid}.tmp`);
|
|
109870
|
-
await
|
|
110221
|
+
await Xt.writeFile(tmpPath, `${JSON.stringify(parsed, null, 2)}
|
|
109871
110222
|
`, {
|
|
109872
110223
|
encoding: "utf8",
|
|
109873
110224
|
mode: 384
|
|
109874
110225
|
});
|
|
109875
|
-
await
|
|
110226
|
+
await Xt.rename(tmpPath, DAEMON_UPGRADE_INTENT_FILE);
|
|
109876
110227
|
};
|
|
109877
110228
|
const readDaemonUpgradeIntent = async () => {
|
|
109878
110229
|
try {
|
|
109879
|
-
const raw2 = await
|
|
110230
|
+
const raw2 = await Xt.readFile(DAEMON_UPGRADE_INTENT_FILE, "utf8");
|
|
109880
110231
|
const parsed = DaemonUpgradeIntentSchema.safeParse(JSON.parse(raw2));
|
|
109881
110232
|
return parsed.success ? parsed.data : null;
|
|
109882
110233
|
} catch {
|
|
@@ -109885,7 +110236,7 @@ ${value}`;
|
|
|
109885
110236
|
};
|
|
109886
110237
|
const clearDaemonUpgradeIntent = async () => {
|
|
109887
110238
|
try {
|
|
109888
|
-
await
|
|
110239
|
+
await Xt.unlink(DAEMON_UPGRADE_INTENT_FILE);
|
|
109889
110240
|
} catch {
|
|
109890
110241
|
}
|
|
109891
110242
|
};
|
|
@@ -117522,7 +117873,7 @@ ${error2.message}` : execaMessage;
|
|
|
117522
117873
|
function requireBufferStream() {
|
|
117523
117874
|
if (hasRequiredBufferStream) return bufferStream;
|
|
117524
117875
|
hasRequiredBufferStream = 1;
|
|
117525
|
-
const { PassThrough: PassThroughStream } =
|
|
117876
|
+
const { PassThrough: PassThroughStream } = xo;
|
|
117526
117877
|
bufferStream = (options) => {
|
|
117527
117878
|
options = {
|
|
117528
117879
|
...options
|
|
@@ -117571,7 +117922,7 @@ ${error2.message}` : execaMessage;
|
|
|
117571
117922
|
if (hasRequiredGetStream) return getStream.exports;
|
|
117572
117923
|
hasRequiredGetStream = 1;
|
|
117573
117924
|
const { constants: BufferConstants } = require$$0$6;
|
|
117574
|
-
const stream2 =
|
|
117925
|
+
const stream2 = xo;
|
|
117575
117926
|
const { promisify: promisify2 } = require$$0$5;
|
|
117576
117927
|
const bufferStream2 = requireBufferStream();
|
|
117577
117928
|
const streamPipelinePromisified = promisify2(stream2.pipeline);
|
|
@@ -117631,7 +117982,7 @@ ${error2.message}` : execaMessage;
|
|
|
117631
117982
|
function requireMergeStream() {
|
|
117632
117983
|
if (hasRequiredMergeStream) return mergeStream;
|
|
117633
117984
|
hasRequiredMergeStream = 1;
|
|
117634
|
-
const { PassThrough: PassThrough2 } =
|
|
117985
|
+
const { PassThrough: PassThrough2 } = xo;
|
|
117635
117986
|
mergeStream = function() {
|
|
117636
117987
|
var sources = [];
|
|
117637
117988
|
var output = new PassThrough2({
|
|
@@ -119362,7 +119713,7 @@ ${error2.message}` : execaMessage;
|
|
|
119362
119713
|
validate: validate2
|
|
119363
119714
|
});
|
|
119364
119715
|
};
|
|
119365
|
-
const realZlibConstants =
|
|
119716
|
+
const realZlibConstants = Ri__default.constants || {
|
|
119366
119717
|
ZLIB_VERNUM: 4736
|
|
119367
119718
|
};
|
|
119368
119719
|
const constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
@@ -119522,11 +119873,11 @@ ${error2.message}` : execaMessage;
|
|
|
119522
119873
|
this.#flushFlag = opts.flush ?? 0;
|
|
119523
119874
|
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
|
119524
119875
|
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
|
119525
|
-
if (typeof
|
|
119876
|
+
if (typeof Ri[mode2] !== "function") {
|
|
119526
119877
|
throw new TypeError("Compression method not supported: " + mode2);
|
|
119527
119878
|
}
|
|
119528
119879
|
try {
|
|
119529
|
-
this.#handle = new
|
|
119880
|
+
this.#handle = new Ri[mode2](opts);
|
|
119530
119881
|
} catch (er) {
|
|
119531
119882
|
throw new ZlibError(er, this.constructor);
|
|
119532
119883
|
}
|
|
@@ -122541,7 +122892,7 @@ ${error2.message}` : execaMessage;
|
|
|
122541
122892
|
return checkCwd(dir, done2);
|
|
122542
122893
|
}
|
|
122543
122894
|
if (preserve) {
|
|
122544
|
-
return
|
|
122895
|
+
return Xt__default.mkdir(dir, {
|
|
122545
122896
|
mode: mode2,
|
|
122546
122897
|
recursive: true
|
|
122547
122898
|
}).then((made) => done2(null, made ?? void 0), done2);
|
|
@@ -123791,7 +124142,7 @@ ${error2.message}` : execaMessage;
|
|
|
123791
124142
|
hasRequiredFdSlicer = 1;
|
|
123792
124143
|
var fs2 = fs__default;
|
|
123793
124144
|
var util2 = require$$0$5;
|
|
123794
|
-
var stream2 =
|
|
124145
|
+
var stream2 = xo;
|
|
123795
124146
|
var Readable2 = stream2.Readable;
|
|
123796
124147
|
var Writable = stream2.Writable;
|
|
123797
124148
|
var PassThrough2 = stream2.PassThrough;
|
|
@@ -124357,14 +124708,14 @@ ${error2.message}` : execaMessage;
|
|
|
124357
124708
|
if (hasRequiredYauzl) return yauzl;
|
|
124358
124709
|
hasRequiredYauzl = 1;
|
|
124359
124710
|
var fs2 = fs__default;
|
|
124360
|
-
var zlib =
|
|
124711
|
+
var zlib = Ri__default;
|
|
124361
124712
|
var fd_slicer = requireFdSlicer();
|
|
124362
124713
|
var crc322 = requireBufferCrc32();
|
|
124363
124714
|
var util2 = require$$0$5;
|
|
124364
124715
|
var EventEmitter2 = require$$0$7.EventEmitter;
|
|
124365
|
-
var Transform2 =
|
|
124366
|
-
var PassThrough2 =
|
|
124367
|
-
var Writable =
|
|
124716
|
+
var Transform2 = xo.Transform;
|
|
124717
|
+
var PassThrough2 = xo.PassThrough;
|
|
124718
|
+
var Writable = xo.Writable;
|
|
124368
124719
|
yauzl.open = open2;
|
|
124369
124720
|
yauzl.fromFd = fromFd;
|
|
124370
124721
|
yauzl.fromBuffer = fromBuffer;
|
|
@@ -125805,99 +126156,99 @@ ${error2.message}` : execaMessage;
|
|
|
125805
126156
|
const grokPackageJson = {
|
|
125806
126157
|
version: version$6
|
|
125807
126158
|
};
|
|
125808
|
-
const version$5 = "2.1.
|
|
126159
|
+
const version$5 = "2.1.258";
|
|
125809
126160
|
const platforms = {
|
|
125810
126161
|
"darwin-arm64": {
|
|
125811
126162
|
"binary": "claude",
|
|
125812
|
-
"checksum": "
|
|
125813
|
-
"size":
|
|
126163
|
+
"checksum": "b63136194160791c27cfa7b0403060d85eb0752991625fde8c09f9acacb17c78",
|
|
126164
|
+
"size": 199027600
|
|
125814
126165
|
},
|
|
125815
126166
|
"darwin-x64": {
|
|
125816
126167
|
"binary": "claude",
|
|
125817
|
-
"checksum": "
|
|
125818
|
-
"size":
|
|
126168
|
+
"checksum": "c857db5cd712865623bd61e806cf3f7e8e279c9e5c7c0af5eca06ca6717fc7fb",
|
|
126169
|
+
"size": 207778640
|
|
125819
126170
|
},
|
|
125820
126171
|
"linux-arm64": {
|
|
125821
126172
|
"binary": "claude",
|
|
125822
|
-
"checksum": "
|
|
125823
|
-
"size":
|
|
126173
|
+
"checksum": "43dc490af55262edcb3e9b1cb315de22cc09ccb08bd52a4c39bc5eabaa63100f",
|
|
126174
|
+
"size": 215014736
|
|
125824
126175
|
},
|
|
125825
126176
|
"linux-x64": {
|
|
125826
126177
|
"binary": "claude",
|
|
125827
|
-
"checksum": "
|
|
125828
|
-
"size":
|
|
126178
|
+
"checksum": "704f1334ac65d3e89e1c6c1d7663293ad786a6166afdb71b5075337df630f976",
|
|
126179
|
+
"size": 215473560
|
|
125829
126180
|
},
|
|
125830
126181
|
"linux-arm64-musl": {
|
|
125831
126182
|
"binary": "claude",
|
|
125832
|
-
"checksum": "
|
|
125833
|
-
"size":
|
|
126183
|
+
"checksum": "d3bef6ba403fe3efba684fa93e1bb26bc7a08c054bd516639d54e77c77bb9821",
|
|
126184
|
+
"size": 207894168
|
|
125834
126185
|
},
|
|
125835
126186
|
"linux-x64-musl": {
|
|
125836
126187
|
"binary": "claude",
|
|
125837
|
-
"checksum": "
|
|
125838
|
-
"size":
|
|
126188
|
+
"checksum": "e74a226cf174d911664aff982486c55ca770d9c00007e52e86b13d10bae72af3",
|
|
126189
|
+
"size": 209493960
|
|
125839
126190
|
},
|
|
125840
126191
|
"win32-x64": {
|
|
125841
126192
|
"binary": "claude.exe",
|
|
125842
|
-
"checksum": "
|
|
125843
|
-
"size":
|
|
126193
|
+
"checksum": "22f5f3a44093e14c75a4d1c8ce25c730b21dd634318fbe3268e9057d12b17c41",
|
|
126194
|
+
"size": 218507936
|
|
125844
126195
|
},
|
|
125845
126196
|
"win32-arm64": {
|
|
125846
126197
|
"binary": "claude.exe",
|
|
125847
|
-
"checksum": "
|
|
125848
|
-
"size":
|
|
126198
|
+
"checksum": "42675c431b6014ad7243fea0ed0e371045dedc89d94aac81a9a0f528e644ed97",
|
|
126199
|
+
"size": 209548960
|
|
125849
126200
|
}
|
|
125850
126201
|
};
|
|
125851
126202
|
const claudeSdkManifestJson = {
|
|
125852
126203
|
version: version$5,
|
|
125853
126204
|
platforms
|
|
125854
126205
|
};
|
|
125855
|
-
const version$4 = "0.3.
|
|
126206
|
+
const version$4 = "0.3.258";
|
|
125856
126207
|
const claudeSdkPackageJson = {
|
|
125857
126208
|
version: version$4
|
|
125858
126209
|
};
|
|
125859
|
-
const sdkVersion = "0.3.
|
|
125860
|
-
const version$3 = "2.1.
|
|
126210
|
+
const sdkVersion = "0.3.258";
|
|
126211
|
+
const version$3 = "2.1.258";
|
|
125861
126212
|
const artifacts$1 = {
|
|
125862
126213
|
"darwin-arm64": {
|
|
125863
|
-
"fileName": "anthropic-ai-claude-agent-sdk-darwin-arm64-0.3.
|
|
125864
|
-
"sha256": "
|
|
125865
|
-
"size":
|
|
126214
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-arm64-0.3.258.tar.zst",
|
|
126215
|
+
"sha256": "dd01a1ae8868c41ac7755e89fa4fc087d28e265b6d7ab122c18317dfd7023ed2",
|
|
126216
|
+
"size": 73550133
|
|
125866
126217
|
},
|
|
125867
126218
|
"darwin-x64": {
|
|
125868
|
-
"fileName": "anthropic-ai-claude-agent-sdk-darwin-x64-0.3.
|
|
125869
|
-
"sha256": "
|
|
125870
|
-
"size":
|
|
126219
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-x64-0.3.258.tar.zst",
|
|
126220
|
+
"sha256": "f46392ec768822fca40d61f6986d7d293a42b3ee5820b0c1a6c14bee474fdb02",
|
|
126221
|
+
"size": 77362894
|
|
125871
126222
|
},
|
|
125872
126223
|
"linux-arm64": {
|
|
125873
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-0.3.
|
|
125874
|
-
"sha256": "
|
|
125875
|
-
"size":
|
|
126224
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-0.3.258.tar.zst",
|
|
126225
|
+
"sha256": "b2df6e0ac548e348a1609d5cba8c1c22c8f4f98b9a3ab54f5ce2082ff96db0f2",
|
|
126226
|
+
"size": 83313235
|
|
125876
126227
|
},
|
|
125877
126228
|
"linux-x64": {
|
|
125878
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-0.3.
|
|
125879
|
-
"sha256": "
|
|
125880
|
-
"size":
|
|
126229
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-0.3.258.tar.zst",
|
|
126230
|
+
"sha256": "ea9bfd7a1cfe218b9c9451450401d654711787bf1972b8a22d3b5f7b495a73f8",
|
|
126231
|
+
"size": 83414920
|
|
125881
126232
|
},
|
|
125882
126233
|
"linux-arm64-musl": {
|
|
125883
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-musl-0.3.
|
|
125884
|
-
"sha256": "
|
|
125885
|
-
"size":
|
|
126234
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-musl-0.3.258.tar.zst",
|
|
126235
|
+
"sha256": "9293b47fd63fa6f368fe0a9fa2930fd6963e6108e65b34584f854919df7f227b",
|
|
126236
|
+
"size": 81542174
|
|
125886
126237
|
},
|
|
125887
126238
|
"linux-x64-musl": {
|
|
125888
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-musl-0.3.
|
|
125889
|
-
"sha256": "
|
|
125890
|
-
"size":
|
|
126239
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-musl-0.3.258.tar.zst",
|
|
126240
|
+
"sha256": "ba0e031ff3266f41d73a28effc25d4334d992891b0495542ca7cf3b2a75632c8",
|
|
126241
|
+
"size": 81733248
|
|
125891
126242
|
},
|
|
125892
126243
|
"win32-arm64": {
|
|
125893
|
-
"fileName": "anthropic-ai-claude-agent-sdk-win32-arm64-0.3.
|
|
125894
|
-
"sha256": "
|
|
125895
|
-
"size":
|
|
126244
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-arm64-0.3.258.tar.zst",
|
|
126245
|
+
"sha256": "13cd9e1ad2958bc8dbaaf908362852136b63f8ce4f452beade38d0323a40774d",
|
|
126246
|
+
"size": 83257894
|
|
125896
126247
|
},
|
|
125897
126248
|
"win32-x64": {
|
|
125898
|
-
"fileName": "anthropic-ai-claude-agent-sdk-win32-x64-0.3.
|
|
125899
|
-
"sha256": "
|
|
125900
|
-
"size":
|
|
126249
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-x64-0.3.258.tar.zst",
|
|
126250
|
+
"sha256": "ae93d318561a4c069d7074726d345224b588e1b3b0a6955b604f6a06ec0c3195",
|
|
126251
|
+
"size": 86357676
|
|
125901
126252
|
}
|
|
125902
126253
|
};
|
|
125903
126254
|
const claudeRuntimeManifestJson = {
|
|
@@ -127787,19 +128138,33 @@ ${error2.message}` : execaMessage;
|
|
|
127787
128138
|
let streamStarted = false;
|
|
127788
128139
|
let pendingController = null;
|
|
127789
128140
|
let stdoutEnded = false;
|
|
127790
|
-
|
|
128141
|
+
let controllerClosed = false;
|
|
128142
|
+
const onData = (chunk) => {
|
|
128143
|
+
if (controllerClosed) return;
|
|
127791
128144
|
if (streamStarted && pendingController) {
|
|
127792
128145
|
pendingController.enqueue(chunk);
|
|
127793
128146
|
} else {
|
|
127794
128147
|
bufferedChunks.push(chunk);
|
|
127795
128148
|
}
|
|
127796
|
-
}
|
|
127797
|
-
|
|
128149
|
+
};
|
|
128150
|
+
const closeController = () => {
|
|
128151
|
+
if (!pendingController || controllerClosed) return;
|
|
128152
|
+
controllerClosed = true;
|
|
128153
|
+
const controller = pendingController;
|
|
128154
|
+
pendingController = null;
|
|
128155
|
+
controller.close();
|
|
128156
|
+
};
|
|
128157
|
+
const onEnd = () => {
|
|
127798
128158
|
stdoutEnded = true;
|
|
127799
|
-
if (streamStarted
|
|
127800
|
-
|
|
127801
|
-
|
|
127802
|
-
|
|
128159
|
+
if (streamStarted) closeController();
|
|
128160
|
+
detach();
|
|
128161
|
+
};
|
|
128162
|
+
const detach = () => {
|
|
128163
|
+
stdout.removeListener("data", onData);
|
|
128164
|
+
stdout.removeListener("end", onEnd);
|
|
128165
|
+
};
|
|
128166
|
+
stdout.on("data", onData);
|
|
128167
|
+
stdout.on("end", onEnd);
|
|
127803
128168
|
return new ReadableStream({
|
|
127804
128169
|
start(controller) {
|
|
127805
128170
|
pendingController = controller;
|
|
@@ -127809,8 +128174,14 @@ ${error2.message}` : execaMessage;
|
|
|
127809
128174
|
bufferedChunks.length = 0;
|
|
127810
128175
|
streamStarted = true;
|
|
127811
128176
|
if (stdoutEnded) {
|
|
127812
|
-
|
|
128177
|
+
closeController();
|
|
127813
128178
|
}
|
|
128179
|
+
},
|
|
128180
|
+
cancel() {
|
|
128181
|
+
controllerClosed = true;
|
|
128182
|
+
pendingController = null;
|
|
128183
|
+
bufferedChunks.length = 0;
|
|
128184
|
+
detach();
|
|
127814
128185
|
}
|
|
127815
128186
|
});
|
|
127816
128187
|
}
|
|
@@ -129201,217 +129572,6 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129201
129572
|
super(isLikelyAuthorizationUrl, false);
|
|
129202
129573
|
}
|
|
129203
129574
|
}
|
|
129204
|
-
const ACP_AUTHENTICATION_INITIALIZE_TIMEOUT_MS = 6e4;
|
|
129205
|
-
const AUTHENTICATION_TERMINATION_GRACE_MS = 3e3;
|
|
129206
|
-
function normalizeAcpAuthMethod(method) {
|
|
129207
|
-
const record2 = method;
|
|
129208
|
-
const id2 = typeof record2.id === "string" ? record2.id.trim() : "";
|
|
129209
|
-
if (!id2) return null;
|
|
129210
|
-
const type2 = record2.type === "terminal" || record2.type === "env_var" ? record2.type : "agent";
|
|
129211
|
-
const args2 = Array.isArray(record2.args) && record2.args.every((arg) => typeof arg === "string") ? record2.args : void 0;
|
|
129212
|
-
const env2 = typeof record2.env === "object" && record2.env !== null ? Object.fromEntries(Object.entries(record2.env).filter((entry) => typeof entry[1] === "string")) : void 0;
|
|
129213
|
-
return {
|
|
129214
|
-
type: type2,
|
|
129215
|
-
id: id2,
|
|
129216
|
-
...typeof record2.name === "string" ? {
|
|
129217
|
-
name: record2.name
|
|
129218
|
-
} : {},
|
|
129219
|
-
...typeof record2.description === "string" ? {
|
|
129220
|
-
description: record2.description
|
|
129221
|
-
} : {},
|
|
129222
|
-
...args2 ? {
|
|
129223
|
-
args: args2
|
|
129224
|
-
} : {},
|
|
129225
|
-
...env2 && Object.keys(env2).length > 0 ? {
|
|
129226
|
-
env: env2
|
|
129227
|
-
} : {}
|
|
129228
|
-
};
|
|
129229
|
-
}
|
|
129230
|
-
function describeAcpAuthMethod(method) {
|
|
129231
|
-
return method.name?.trim() ? method.name : method.id;
|
|
129232
|
-
}
|
|
129233
|
-
function formatEnvVarAuthMethodError(method, normalized) {
|
|
129234
|
-
const vars = method.vars;
|
|
129235
|
-
const names2 = Array.isArray(vars) ? vars.map((entry) => typeof entry === "object" && entry !== null && typeof entry.name === "string" ? entry.name : null).filter((name2) => Boolean(name2)) : [];
|
|
129236
|
-
const suffix = names2.length > 0 ? `: ${names2.join(", ")}` : "";
|
|
129237
|
-
return `${describeAcpAuthMethod(normalized)} authenticates through environment variables. Add them to this agent's environment in its settings${suffix}.`;
|
|
129238
|
-
}
|
|
129239
|
-
function selectAuthMethod(methods2, methodId) {
|
|
129240
|
-
for (const method of methods2) {
|
|
129241
|
-
const normalized = normalizeAcpAuthMethod(method);
|
|
129242
|
-
if (!normalized) continue;
|
|
129243
|
-
if (methodId === void 0 || normalized.id === methodId) {
|
|
129244
|
-
return {
|
|
129245
|
-
method,
|
|
129246
|
-
normalized
|
|
129247
|
-
};
|
|
129248
|
-
}
|
|
129249
|
-
}
|
|
129250
|
-
return null;
|
|
129251
|
-
}
|
|
129252
|
-
function withDeadline(promise2, timeoutMs, label2) {
|
|
129253
|
-
let timeoutHandle;
|
|
129254
|
-
const timeout2 = new Promise((_resolve, reject2) => {
|
|
129255
|
-
timeoutHandle = setTimeout(() => reject2(new Error(`${label2} timed out after ${Math.round(timeoutMs / 1e3)}s`)), timeoutMs);
|
|
129256
|
-
timeoutHandle.unref?.();
|
|
129257
|
-
});
|
|
129258
|
-
return Promise.race([
|
|
129259
|
-
promise2,
|
|
129260
|
-
timeout2
|
|
129261
|
-
]).finally(() => {
|
|
129262
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
129263
|
-
});
|
|
129264
|
-
}
|
|
129265
|
-
async function runAcpProtocolAuthentication(options) {
|
|
129266
|
-
options.signal?.throwIfAborted();
|
|
129267
|
-
const child = spawnAcpProcess({
|
|
129268
|
-
cliType: options.cliType,
|
|
129269
|
-
agentType: options.agentType,
|
|
129270
|
-
workdir: options.workdir,
|
|
129271
|
-
env: options.env,
|
|
129272
|
-
command: options.launch.command,
|
|
129273
|
-
args: options.launch.args,
|
|
129274
|
-
spawnImpl: options.spawnProcess
|
|
129275
|
-
});
|
|
129276
|
-
options.attachProcess?.(child);
|
|
129277
|
-
let stderrTail = "";
|
|
129278
|
-
const parser = new AcpAgentAuthorizationOutputParser();
|
|
129279
|
-
child.stderr?.setEncoding("utf8");
|
|
129280
|
-
child.stderr?.on("data", (chunk) => {
|
|
129281
|
-
if (!chunk) return;
|
|
129282
|
-
stderrTail = appendStderrTail(stderrTail, chunk);
|
|
129283
|
-
const authorization = parser.push(chunk);
|
|
129284
|
-
if (authorization) {
|
|
129285
|
-
options.onProgress?.({
|
|
129286
|
-
status: "authorization",
|
|
129287
|
-
...authorization
|
|
129288
|
-
});
|
|
129289
|
-
}
|
|
129290
|
-
});
|
|
129291
|
-
let rejectProcessFailure;
|
|
129292
|
-
const processFailure = new Promise((_resolve, reject2) => {
|
|
129293
|
-
rejectProcessFailure = reject2;
|
|
129294
|
-
});
|
|
129295
|
-
const handleExit = (code2, signal) => {
|
|
129296
|
-
rejectProcessFailure?.(new Error(`${options.agentType} exited during authentication (code ${code2 ?? "null"}${signal ? `, signal ${signal}` : ""})${stderrTail ? `: ${stderrTail}` : ""}`));
|
|
129297
|
-
};
|
|
129298
|
-
const handleError2 = (error2) => {
|
|
129299
|
-
rejectProcessFailure?.(new Error(`${options.agentType} failed to start: ${error2.message}`));
|
|
129300
|
-
};
|
|
129301
|
-
child.once("exit", handleExit);
|
|
129302
|
-
child.once("error", handleError2);
|
|
129303
|
-
processFailure.catch(() => void 0);
|
|
129304
|
-
const handleAbort = () => {
|
|
129305
|
-
rejectProcessFailure?.(new DOMException("ACP authentication was cancelled", "AbortError"));
|
|
129306
|
-
};
|
|
129307
|
-
options.signal?.addEventListener("abort", handleAbort, {
|
|
129308
|
-
once: true
|
|
129309
|
-
});
|
|
129310
|
-
const terminate = () => {
|
|
129311
|
-
child.off("exit", handleExit);
|
|
129312
|
-
child.off("error", handleError2);
|
|
129313
|
-
options.signal?.removeEventListener("abort", handleAbort);
|
|
129314
|
-
void shutdownLocalAcpAgent({
|
|
129315
|
-
agentProcess: child,
|
|
129316
|
-
logger: options.logger,
|
|
129317
|
-
sessionLabel: `acp-auth-protocol:${options.agentType}`,
|
|
129318
|
-
exitTimeoutMs: AUTHENTICATION_TERMINATION_GRACE_MS
|
|
129319
|
-
}).catch((error2) => {
|
|
129320
|
-
options.logger.debug(`[acp-auth] Failed to stop ${options.agentType} after authentication: ${formatErrorMessage(error2)}`);
|
|
129321
|
-
});
|
|
129322
|
-
};
|
|
129323
|
-
try {
|
|
129324
|
-
if (!child.stdout || !child.stdin) {
|
|
129325
|
-
throw new Error("Agent process stdio is not available");
|
|
129326
|
-
}
|
|
129327
|
-
const stream2 = ndJsonStream(createStdinWritableStream(child.stdin), createStdoutReadableStream(child.stdout));
|
|
129328
|
-
const connection2 = new ClientSideConnection(() => ({
|
|
129329
|
-
requestPermission: async () => ({
|
|
129330
|
-
outcome: {
|
|
129331
|
-
outcome: "cancelled"
|
|
129332
|
-
}
|
|
129333
|
-
}),
|
|
129334
|
-
sessionUpdate: () => {
|
|
129335
|
-
}
|
|
129336
|
-
}), stream2);
|
|
129337
|
-
const initializeResponse = await Promise.race([
|
|
129338
|
-
withDeadline(connection2.initialize({
|
|
129339
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
129340
|
-
clientCapabilities: {
|
|
129341
|
-
terminal: false,
|
|
129342
|
-
fs: {
|
|
129343
|
-
readTextFile: false,
|
|
129344
|
-
writeTextFile: false
|
|
129345
|
-
},
|
|
129346
|
-
auth: {
|
|
129347
|
-
terminal: true
|
|
129348
|
-
}
|
|
129349
|
-
}
|
|
129350
|
-
}), Math.max(1, options.initializeTimeoutMs ?? ACP_AUTHENTICATION_INITIALIZE_TIMEOUT_MS), `${options.agentType} initialize`),
|
|
129351
|
-
processFailure
|
|
129352
|
-
]);
|
|
129353
|
-
options.signal?.throwIfAborted();
|
|
129354
|
-
const advertised = initializeResponse.authMethods ?? [];
|
|
129355
|
-
if (advertised.length === 0) {
|
|
129356
|
-
return {
|
|
129357
|
-
kind: "error",
|
|
129358
|
-
error: `${options.agentType} does not advertise an authentication method. Check the agent's own setup instructions or configure its credentials in this agent's environment.`
|
|
129359
|
-
};
|
|
129360
|
-
}
|
|
129361
|
-
const selected = selectAuthMethod(advertised, options.methodId);
|
|
129362
|
-
if (!selected) {
|
|
129363
|
-
if (options.methodId !== void 0) {
|
|
129364
|
-
return {
|
|
129365
|
-
kind: "error",
|
|
129366
|
-
error: `${options.agentType} no longer advertises the authentication method "${options.methodId}"`
|
|
129367
|
-
};
|
|
129368
|
-
}
|
|
129369
|
-
return {
|
|
129370
|
-
kind: "error",
|
|
129371
|
-
error: `${options.agentType} advertised no usable authentication method`
|
|
129372
|
-
};
|
|
129373
|
-
}
|
|
129374
|
-
const normalizedMethods = advertised.map(normalizeAcpAuthMethod).filter((method) => method !== null);
|
|
129375
|
-
if (options.methodId === void 0 && normalizedMethods.length > 1) {
|
|
129376
|
-
return {
|
|
129377
|
-
kind: "method-required",
|
|
129378
|
-
authMethods: normalizedMethods
|
|
129379
|
-
};
|
|
129380
|
-
}
|
|
129381
|
-
if (selected.normalized.type === "env_var") {
|
|
129382
|
-
return {
|
|
129383
|
-
kind: "error",
|
|
129384
|
-
error: formatEnvVarAuthMethodError(selected.method, selected.normalized)
|
|
129385
|
-
};
|
|
129386
|
-
}
|
|
129387
|
-
if (selected.normalized.type === "terminal") {
|
|
129388
|
-
return {
|
|
129389
|
-
kind: "terminal-method",
|
|
129390
|
-
method: selected.normalized
|
|
129391
|
-
};
|
|
129392
|
-
}
|
|
129393
|
-
options.logger.debug(`[acp-auth] ${options.agentType} authenticate methodId=${selected.normalized.id}`);
|
|
129394
|
-
await Promise.race([
|
|
129395
|
-
connection2.authenticate({
|
|
129396
|
-
methodId: selected.normalized.id
|
|
129397
|
-
}),
|
|
129398
|
-
processFailure
|
|
129399
|
-
]);
|
|
129400
|
-
return {
|
|
129401
|
-
kind: "authenticated"
|
|
129402
|
-
};
|
|
129403
|
-
} catch (error2) {
|
|
129404
|
-
if (error2 instanceof DOMException && error2.name === "AbortError") {
|
|
129405
|
-
throw error2;
|
|
129406
|
-
}
|
|
129407
|
-
return {
|
|
129408
|
-
kind: "error",
|
|
129409
|
-
error: formatErrorMessage(error2)
|
|
129410
|
-
};
|
|
129411
|
-
} finally {
|
|
129412
|
-
terminate();
|
|
129413
|
-
}
|
|
129414
|
-
}
|
|
129415
129575
|
const DEFAULT_AUTHENTICATION_TIMEOUT_MS = 285e3;
|
|
129416
129576
|
const DEFAULT_TERMINATION_GRACE_MS$1 = 3e3;
|
|
129417
129577
|
const DEFAULT_STATUS_PROBE_TIMEOUT_MS = 15e3;
|
|
@@ -129460,6 +129620,139 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129460
129620
|
}
|
|
129461
129621
|
]
|
|
129462
129622
|
};
|
|
129623
|
+
const AcpAuthenticationInteractionInputSchema = discriminatedUnion("action", [
|
|
129624
|
+
object$1({
|
|
129625
|
+
action: literal$1("accept"),
|
|
129626
|
+
methodId: string$1().trim().min(1).max(ACP_AUTH_ID_MAX_LENGTH).optional(),
|
|
129627
|
+
content: record$1(string$1(), unknown()).optional()
|
|
129628
|
+
}).strict(),
|
|
129629
|
+
object$1({
|
|
129630
|
+
action: _enum$1([
|
|
129631
|
+
"decline",
|
|
129632
|
+
"cancel"
|
|
129633
|
+
])
|
|
129634
|
+
}).strict()
|
|
129635
|
+
]);
|
|
129636
|
+
const asRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
129637
|
+
function isAllowedAuthorizationUrl(value) {
|
|
129638
|
+
if (value.length > ACP_AUTHORIZATION_URL_MAX_LENGTH) return false;
|
|
129639
|
+
try {
|
|
129640
|
+
const protocol = new URL(value).protocol;
|
|
129641
|
+
return protocol === "https:" || protocol === "http:";
|
|
129642
|
+
} catch {
|
|
129643
|
+
return false;
|
|
129644
|
+
}
|
|
129645
|
+
}
|
|
129646
|
+
function toAuthenticationForm(request2) {
|
|
129647
|
+
const rawRequest = asRecord(request2);
|
|
129648
|
+
const schema2 = asRecord(rawRequest?.requestedSchema);
|
|
129649
|
+
const properties2 = asRecord(schema2?.properties);
|
|
129650
|
+
if (!rawRequest || rawRequest.mode !== "form" || !schema2 || !properties2) return null;
|
|
129651
|
+
const propertyEntries = Object.entries(properties2);
|
|
129652
|
+
if (propertyEntries.length === 0 || propertyEntries.length > ACP_AUTH_FORM_FIELD_MAX_COUNT) {
|
|
129653
|
+
return null;
|
|
129654
|
+
}
|
|
129655
|
+
if (typeof schema2.title === "string" && schema2.title.length > ACP_AUTH_LABEL_MAX_LENGTH || typeof schema2.description === "string" && schema2.description.length > ACP_AUTH_TEXT_MAX_LENGTH) {
|
|
129656
|
+
return null;
|
|
129657
|
+
}
|
|
129658
|
+
if (schema2.required !== void 0 && (!Array.isArray(schema2.required) || schema2.required.some((value) => typeof value !== "string"))) {
|
|
129659
|
+
return null;
|
|
129660
|
+
}
|
|
129661
|
+
const required2 = new Set(schema2.required ?? []);
|
|
129662
|
+
if ([
|
|
129663
|
+
...required2
|
|
129664
|
+
].some((id2) => !Object.hasOwn(properties2, id2))) return null;
|
|
129665
|
+
const fields = [];
|
|
129666
|
+
for (const [id2, rawProperty] of propertyEntries) {
|
|
129667
|
+
const property = asRecord(rawProperty);
|
|
129668
|
+
if (!property || property.type !== "string") return null;
|
|
129669
|
+
const label2 = typeof property.title === "string" && property.title.trim() ? property.title : id2;
|
|
129670
|
+
const description2 = typeof property.description === "string" ? property.description : void 0;
|
|
129671
|
+
if (!id2.trim() || id2.length > ACP_AUTH_ID_MAX_LENGTH || !label2.trim() || label2.length > ACP_AUTH_LABEL_MAX_LENGTH || (description2?.length ?? 0) > ACP_AUTH_TEXT_MAX_LENGTH) {
|
|
129672
|
+
return null;
|
|
129673
|
+
}
|
|
129674
|
+
const meta = asRecord(property._meta);
|
|
129675
|
+
const secret = getLodyElicitationMeta(property._meta)?.secret === true || meta?.secret === true || meta?.sensitive === true || property.format === "password";
|
|
129676
|
+
const defaultValue = !secret && typeof property.default === "string" ? property.default : void 0;
|
|
129677
|
+
if ((defaultValue?.length ?? 0) > ACP_AUTH_TEXT_MAX_LENGTH) return null;
|
|
129678
|
+
if (property.oneOf !== void 0 && !Array.isArray(property.oneOf) || property.enum !== void 0 && !Array.isArray(property.enum)) {
|
|
129679
|
+
return null;
|
|
129680
|
+
}
|
|
129681
|
+
const titledOptions = Array.isArray(property.oneOf) ? property.oneOf.map((rawOption) => {
|
|
129682
|
+
const option2 = asRecord(rawOption);
|
|
129683
|
+
if (!option2 || typeof option2.const !== "string" || !option2.const) return null;
|
|
129684
|
+
const optionLabel = typeof option2.title === "string" && option2.title.trim() ? option2.title : option2.const;
|
|
129685
|
+
return {
|
|
129686
|
+
value: option2.const,
|
|
129687
|
+
label: optionLabel
|
|
129688
|
+
};
|
|
129689
|
+
}) : [];
|
|
129690
|
+
const enumOptions = Array.isArray(property.enum) ? property.enum.map((value) => typeof value === "string" && value ? {
|
|
129691
|
+
value,
|
|
129692
|
+
label: value
|
|
129693
|
+
} : null) : [];
|
|
129694
|
+
if (titledOptions.some((option2) => option2 === null) || enumOptions.some((option2) => option2 === null)) {
|
|
129695
|
+
return null;
|
|
129696
|
+
}
|
|
129697
|
+
const options = titledOptions.length > 0 ? titledOptions : enumOptions;
|
|
129698
|
+
if ((Array.isArray(property.oneOf) || Array.isArray(property.enum)) && options.length === 0 || options.length > ACP_AUTH_SELECT_OPTION_MAX_COUNT || options.some((option2) => option2 === null || option2.value.length > ACP_AUTH_TEXT_MAX_LENGTH || option2.label.length > ACP_AUTH_LABEL_MAX_LENGTH)) {
|
|
129699
|
+
return null;
|
|
129700
|
+
}
|
|
129701
|
+
if (options.length > 0) {
|
|
129702
|
+
if (new Set(options.map((option2) => option2?.value)).size !== options.length) {
|
|
129703
|
+
return null;
|
|
129704
|
+
}
|
|
129705
|
+
if (defaultValue !== void 0 && !options.some((option2) => option2?.value === defaultValue)) {
|
|
129706
|
+
return null;
|
|
129707
|
+
}
|
|
129708
|
+
fields.push({
|
|
129709
|
+
id: id2,
|
|
129710
|
+
type: "select",
|
|
129711
|
+
label: label2,
|
|
129712
|
+
...description2 !== void 0 ? {
|
|
129713
|
+
description: description2
|
|
129714
|
+
} : {},
|
|
129715
|
+
required: required2.has(id2),
|
|
129716
|
+
options: options.filter((option2) => !!option2),
|
|
129717
|
+
...defaultValue !== void 0 ? {
|
|
129718
|
+
defaultValue
|
|
129719
|
+
} : {}
|
|
129720
|
+
});
|
|
129721
|
+
continue;
|
|
129722
|
+
}
|
|
129723
|
+
fields.push(secret ? {
|
|
129724
|
+
id: id2,
|
|
129725
|
+
type: "secret",
|
|
129726
|
+
label: label2,
|
|
129727
|
+
...description2 !== void 0 ? {
|
|
129728
|
+
description: description2
|
|
129729
|
+
} : {},
|
|
129730
|
+
required: required2.has(id2)
|
|
129731
|
+
} : {
|
|
129732
|
+
id: id2,
|
|
129733
|
+
type: "text",
|
|
129734
|
+
label: label2,
|
|
129735
|
+
...description2 !== void 0 ? {
|
|
129736
|
+
description: description2
|
|
129737
|
+
} : {},
|
|
129738
|
+
required: required2.has(id2),
|
|
129739
|
+
...defaultValue !== void 0 ? {
|
|
129740
|
+
defaultValue
|
|
129741
|
+
} : {}
|
|
129742
|
+
});
|
|
129743
|
+
}
|
|
129744
|
+
if (fields.length === 0) return null;
|
|
129745
|
+
const form = {
|
|
129746
|
+
title: typeof schema2.title === "string" ? schema2.title : void 0,
|
|
129747
|
+
description: typeof schema2.description === "string" ? schema2.description : void 0,
|
|
129748
|
+
fields
|
|
129749
|
+
};
|
|
129750
|
+
return isAcpAuthenticationFormWithinByteLimit(form) ? form : null;
|
|
129751
|
+
}
|
|
129752
|
+
function getAuthMethodType(method) {
|
|
129753
|
+
const type2 = asRecord(method)?.type;
|
|
129754
|
+
return type2 === "env_var" || type2 === "terminal" ? type2 : "agent";
|
|
129755
|
+
}
|
|
129463
129756
|
function getBuiltinDisplayName(agentType) {
|
|
129464
129757
|
return getManagedBuiltinRuntimeByAgentType(agentType)?.displayName ?? agentType;
|
|
129465
129758
|
}
|
|
@@ -129476,7 +129769,7 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129476
129769
|
NO_COLOR: "1"
|
|
129477
129770
|
};
|
|
129478
129771
|
delete baseEnv.FORCE_COLOR;
|
|
129479
|
-
return withoutElectronBootstrapCredentials(withDefaultAcpPathEntries(mergeACPProcessEnv(options.launch, mergeLoginShellEnv(baseEnv, loginShellEnv)), options.agentType));
|
|
129772
|
+
return withLoopbackNoProxy(withoutElectronBootstrapCredentials(withLodyNpmCacheForNpx(options.launch.command, withDefaultAcpPathEntries(mergeACPProcessEnv(options.launch, mergeLoginShellEnv(baseEnv, loginShellEnv)), options.agentType))));
|
|
129480
129773
|
}
|
|
129481
129774
|
async function probeBuiltinAuthentication(options) {
|
|
129482
129775
|
options.signal?.throwIfAborted();
|
|
@@ -129600,8 +129893,8 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129600
129893
|
spawnProcess;
|
|
129601
129894
|
resolveLoginShellEnv;
|
|
129602
129895
|
async authenticate(options) {
|
|
129603
|
-
const
|
|
129604
|
-
const displayName =
|
|
129896
|
+
const isBuiltinAuthentication = options.cliType === "builtin" && isManagedBuiltinAgentType(options.agentType);
|
|
129897
|
+
const displayName = isBuiltinAuthentication ? getBuiltinDisplayName(options.agentType) : options.agentType;
|
|
129605
129898
|
if (this.runningByAgentType.has(options.agentType)) {
|
|
129606
129899
|
return {
|
|
129607
129900
|
success: false,
|
|
@@ -129616,7 +129909,7 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129616
129909
|
terminating: false,
|
|
129617
129910
|
acceptsAuthorizationCode: false,
|
|
129618
129911
|
authorizationCodeSubmitted: false,
|
|
129619
|
-
|
|
129912
|
+
abortController: new AbortController()
|
|
129620
129913
|
};
|
|
129621
129914
|
this.runningByAgentType.set(options.agentType, running2);
|
|
129622
129915
|
let timeoutHandle;
|
|
@@ -129647,6 +129940,11 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129647
129940
|
timeoutHandle = setTimeout(() => {
|
|
129648
129941
|
if (running2.cancelled) return;
|
|
129649
129942
|
running2.timedOut = true;
|
|
129943
|
+
running2.abortController.abort();
|
|
129944
|
+
running2.pendingInteraction?.resolve({
|
|
129945
|
+
action: "cancel"
|
|
129946
|
+
});
|
|
129947
|
+
running2.pendingInteraction = void 0;
|
|
129650
129948
|
if (!running2.child && this.runningByAgentType.get(options.agentType) === running2) {
|
|
129651
129949
|
this.runningByAgentType.delete(options.agentType);
|
|
129652
129950
|
}
|
|
@@ -129654,18 +129952,103 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129654
129952
|
}, this.authenticationTimeoutMs);
|
|
129655
129953
|
timeoutHandle.unref?.();
|
|
129656
129954
|
try {
|
|
129657
|
-
|
|
129658
|
-
options,
|
|
129659
|
-
|
|
129660
|
-
|
|
129661
|
-
|
|
129662
|
-
|
|
129663
|
-
|
|
129664
|
-
options,
|
|
129665
|
-
|
|
129666
|
-
interruptedResult
|
|
129955
|
+
if (!isBuiltinAuthentication) {
|
|
129956
|
+
return await this.authenticateProtocolDrivenAcp(options, running2);
|
|
129957
|
+
}
|
|
129958
|
+
const agentType = options.agentType;
|
|
129959
|
+
const launch = await resolveBuiltinAuthenticationProcessLaunch({
|
|
129960
|
+
cliType: options.cliType,
|
|
129961
|
+
agentType: options.agentType,
|
|
129962
|
+
runtimeOverrides: options.runtimeOverrides,
|
|
129963
|
+
action: "login"
|
|
129667
129964
|
});
|
|
129668
|
-
|
|
129965
|
+
if (!launch) {
|
|
129966
|
+
throw new Error(`${displayName} authentication is unavailable`);
|
|
129967
|
+
}
|
|
129968
|
+
const launchInterruption = interruptedResult();
|
|
129969
|
+
if (launchInterruption) return launchInterruption;
|
|
129970
|
+
const env2 = await buildAuthenticationProcessEnv({
|
|
129971
|
+
launch,
|
|
129972
|
+
agentType: options.agentType,
|
|
129973
|
+
env: options.env,
|
|
129974
|
+
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
129975
|
+
});
|
|
129976
|
+
const preparationInterruption = interruptedResult();
|
|
129977
|
+
if (preparationInterruption) return preparationInterruption;
|
|
129978
|
+
options.onProgress?.({
|
|
129979
|
+
status: "starting"
|
|
129980
|
+
});
|
|
129981
|
+
const child = this.spawnProcess(launch.command, launch.args, {
|
|
129982
|
+
cwd: os__default$1.homedir(),
|
|
129983
|
+
env: env2,
|
|
129984
|
+
stdio: [
|
|
129985
|
+
"pipe",
|
|
129986
|
+
"pipe",
|
|
129987
|
+
"pipe"
|
|
129988
|
+
],
|
|
129989
|
+
detached: process.platform !== "win32",
|
|
129990
|
+
windowsHide: true
|
|
129991
|
+
});
|
|
129992
|
+
running2.child = child;
|
|
129993
|
+
child.stdin?.on("error", (error2) => {
|
|
129994
|
+
this.logger.debug(`[acp-auth] ${displayName} authorization input failed: ${formatErrorMessage(error2)}`);
|
|
129995
|
+
});
|
|
129996
|
+
const outputParser = new BuiltinAuthenticationOutputParser(agentType);
|
|
129997
|
+
const emitOutput = (stream2, chunk) => {
|
|
129998
|
+
const output = String(chunk);
|
|
129999
|
+
if (output.length === 0) return;
|
|
130000
|
+
const authorization = outputParser.push(output);
|
|
130001
|
+
if (authorization) {
|
|
130002
|
+
running2.acceptsAuthorizationCode = authorization.acceptsAuthorizationCode === true;
|
|
130003
|
+
options.onProgress?.({
|
|
130004
|
+
status: "authorization",
|
|
130005
|
+
...authorization
|
|
130006
|
+
});
|
|
130007
|
+
}
|
|
130008
|
+
options.onProgress?.({
|
|
130009
|
+
status: "output",
|
|
130010
|
+
stream: stream2,
|
|
130011
|
+
output: output.slice(0, 16384)
|
|
130012
|
+
});
|
|
130013
|
+
};
|
|
130014
|
+
child.stdout?.on("data", (chunk) => emitOutput("stdout", chunk));
|
|
130015
|
+
child.stderr?.on("data", (chunk) => emitOutput("stderr", chunk));
|
|
130016
|
+
const exit2 = await new Promise((resolve2) => {
|
|
130017
|
+
let settled = false;
|
|
130018
|
+
const finish = (result) => {
|
|
130019
|
+
if (settled) return;
|
|
130020
|
+
settled = true;
|
|
130021
|
+
resolve2(result);
|
|
130022
|
+
};
|
|
130023
|
+
child.once("error", (error2) => finish({
|
|
130024
|
+
code: null,
|
|
130025
|
+
error: error2
|
|
130026
|
+
}));
|
|
130027
|
+
child.once("exit", (code2) => finish({
|
|
130028
|
+
code: code2
|
|
130029
|
+
}));
|
|
130030
|
+
});
|
|
130031
|
+
const processInterruption = interruptedResult();
|
|
130032
|
+
if (processInterruption) return processInterruption;
|
|
130033
|
+
if (exit2.error !== void 0 || exit2.code !== 0) {
|
|
130034
|
+
const error2 = exit2.error !== void 0 ? formatErrorMessage(exit2.error) : formatAuthenticationExitError(agentType, displayName, exit2.code);
|
|
130035
|
+
options.onProgress?.({
|
|
130036
|
+
status: "error",
|
|
130037
|
+
error: error2
|
|
130038
|
+
});
|
|
130039
|
+
return {
|
|
130040
|
+
success: false,
|
|
130041
|
+
disposition: "error",
|
|
130042
|
+
error: error2
|
|
130043
|
+
};
|
|
130044
|
+
}
|
|
130045
|
+
options.onProgress?.({
|
|
130046
|
+
status: "authenticated"
|
|
130047
|
+
});
|
|
130048
|
+
return {
|
|
130049
|
+
success: true,
|
|
130050
|
+
disposition: "authenticated"
|
|
130051
|
+
};
|
|
129669
130052
|
} catch (error2) {
|
|
129670
130053
|
const interruption2 = interruptedResult();
|
|
129671
130054
|
if (interruption2) return interruption2;
|
|
@@ -129688,250 +130071,24 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129688
130071
|
}
|
|
129689
130072
|
}
|
|
129690
130073
|
}
|
|
129691
|
-
|
|
129692
|
-
|
|
129693
|
-
const launch = await resolveBuiltinAuthenticationProcessLaunch({
|
|
129694
|
-
cliType: options.cliType,
|
|
129695
|
-
agentType: options.agentType,
|
|
129696
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129697
|
-
action: "login"
|
|
129698
|
-
});
|
|
129699
|
-
if (!launch) {
|
|
129700
|
-
throw new Error(`${displayName} authentication is unavailable`);
|
|
129701
|
-
}
|
|
129702
|
-
const launchInterruption = interruptedResult();
|
|
129703
|
-
if (launchInterruption) return launchInterruption;
|
|
129704
|
-
const env2 = await buildAuthenticationProcessEnv({
|
|
129705
|
-
launch,
|
|
129706
|
-
agentType: options.agentType,
|
|
129707
|
-
env: options.env,
|
|
129708
|
-
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
129709
|
-
});
|
|
129710
|
-
const preparationInterruption = interruptedResult();
|
|
129711
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129712
|
-
options.onProgress?.({
|
|
129713
|
-
status: "starting"
|
|
129714
|
-
});
|
|
129715
|
-
return await this.runLoginProcess({
|
|
129716
|
-
...ctx,
|
|
129717
|
-
displayName,
|
|
129718
|
-
command: launch.command,
|
|
129719
|
-
args: launch.args,
|
|
129720
|
-
env: env2,
|
|
129721
|
-
parser: new BuiltinAuthenticationOutputParser(agentType),
|
|
129722
|
-
formatExitError: (code2) => formatAuthenticationExitError(agentType, displayName, code2),
|
|
129723
|
-
acceptsAuthorizationCodeOnStdin: true
|
|
129724
|
-
});
|
|
130074
|
+
getAgentType(requestId) {
|
|
130075
|
+
return this.findRunningAuthentication(requestId)?.agentType;
|
|
129725
130076
|
}
|
|
129726
|
-
|
|
129727
|
-
const
|
|
129728
|
-
|
|
129729
|
-
cliType: options.cliType,
|
|
129730
|
-
agentType: options.agentType,
|
|
129731
|
-
customAcp: options.customAcp,
|
|
129732
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129733
|
-
signal: running2.abort.signal
|
|
129734
|
-
});
|
|
129735
|
-
const launchInterruption = interruptedResult();
|
|
129736
|
-
if (launchInterruption) return launchInterruption;
|
|
129737
|
-
const env2 = await this.buildAcpAuthenticationProcessEnv(launch, options, {
|
|
129738
|
-
protocolStdio: true
|
|
129739
|
-
});
|
|
129740
|
-
const preparationInterruption = interruptedResult();
|
|
129741
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129742
|
-
options.onProgress?.({
|
|
129743
|
-
status: "starting"
|
|
129744
|
-
});
|
|
129745
|
-
const outcome = await runAcpProtocolAuthentication({
|
|
129746
|
-
launch: {
|
|
129747
|
-
command: launch.command,
|
|
129748
|
-
args: launch.args
|
|
129749
|
-
},
|
|
129750
|
-
cliType: options.cliType,
|
|
129751
|
-
agentType: options.agentType,
|
|
129752
|
-
workdir: os__default$1.homedir(),
|
|
129753
|
-
env: env2,
|
|
129754
|
-
methodId: options.methodId,
|
|
129755
|
-
logger: this.logger,
|
|
129756
|
-
signal: running2.abort.signal,
|
|
129757
|
-
onProgress: options.onProgress,
|
|
129758
|
-
attachProcess: (child) => {
|
|
129759
|
-
running2.child = child;
|
|
129760
|
-
},
|
|
129761
|
-
spawnProcess: this.spawnProcess
|
|
129762
|
-
});
|
|
129763
|
-
const outcomeInterruption = interruptedResult();
|
|
129764
|
-
if (outcomeInterruption) return outcomeInterruption;
|
|
129765
|
-
if (outcome.kind === "authenticated") {
|
|
129766
|
-
options.onProgress?.({
|
|
129767
|
-
status: "authenticated"
|
|
129768
|
-
});
|
|
129769
|
-
return {
|
|
129770
|
-
success: true,
|
|
129771
|
-
disposition: "authenticated"
|
|
129772
|
-
};
|
|
129773
|
-
}
|
|
129774
|
-
if (outcome.kind === "method-required") {
|
|
129775
|
-
return {
|
|
129776
|
-
success: true,
|
|
129777
|
-
disposition: "method-required",
|
|
129778
|
-
authMethods: outcome.authMethods.map((method) => ({
|
|
129779
|
-
type: method.type,
|
|
129780
|
-
id: method.id,
|
|
129781
|
-
...method.name ? {
|
|
129782
|
-
name: method.name
|
|
129783
|
-
} : {},
|
|
129784
|
-
...method.description ? {
|
|
129785
|
-
description: method.description
|
|
129786
|
-
} : {}
|
|
129787
|
-
}))
|
|
129788
|
-
};
|
|
129789
|
-
}
|
|
129790
|
-
if (outcome.kind === "terminal-method") {
|
|
129791
|
-
running2.child = void 0;
|
|
129792
|
-
return await this.runTerminalAuthMethod(ctx, outcome.method);
|
|
129793
|
-
}
|
|
129794
|
-
options.onProgress?.({
|
|
129795
|
-
status: "error",
|
|
129796
|
-
error: outcome.error
|
|
129797
|
-
});
|
|
129798
|
-
return {
|
|
129799
|
-
success: false,
|
|
129800
|
-
disposition: "error",
|
|
129801
|
-
error: outcome.error
|
|
129802
|
-
};
|
|
129803
|
-
}
|
|
129804
|
-
async runTerminalAuthMethod(ctx, method) {
|
|
129805
|
-
const { options, interruptedResult } = ctx;
|
|
129806
|
-
const displayName = describeAcpAuthMethod(method);
|
|
129807
|
-
const launch = await resolveACPProcessLaunchAsync({
|
|
129808
|
-
cliType: options.cliType,
|
|
129809
|
-
agentType: options.agentType,
|
|
129810
|
-
customAcp: options.customAcp,
|
|
129811
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129812
|
-
extraArgs: [
|
|
129813
|
-
...method.args ?? []
|
|
129814
|
-
],
|
|
129815
|
-
signal: ctx.running.abort.signal
|
|
129816
|
-
});
|
|
129817
|
-
const launchInterruption = interruptedResult();
|
|
129818
|
-
if (launchInterruption) return launchInterruption;
|
|
129819
|
-
const env2 = await this.buildAcpAuthenticationProcessEnv(launch, options, {
|
|
129820
|
-
methodEnv: method.env
|
|
129821
|
-
});
|
|
129822
|
-
const preparationInterruption = interruptedResult();
|
|
129823
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129824
|
-
return await this.runLoginProcess({
|
|
129825
|
-
...ctx,
|
|
129826
|
-
displayName,
|
|
129827
|
-
command: launch.command,
|
|
129828
|
-
args: launch.args,
|
|
129829
|
-
env: env2,
|
|
129830
|
-
parser: new AcpAgentAuthorizationOutputParser(),
|
|
129831
|
-
formatExitError: (code2) => `${options.agentType} authentication exited with code ${code2 ?? "unknown"}`,
|
|
129832
|
-
acceptsAuthorizationCodeOnStdin: false
|
|
129833
|
-
});
|
|
129834
|
-
}
|
|
129835
|
-
async buildAcpAuthenticationProcessEnv(launch, options, settings = {}) {
|
|
129836
|
-
const env2 = await buildAuthenticationProcessEnv({
|
|
129837
|
-
launch,
|
|
129838
|
-
agentType: options.agentType,
|
|
129839
|
-
env: settings.methodEnv ? {
|
|
129840
|
-
...options.env,
|
|
129841
|
-
...settings.methodEnv
|
|
129842
|
-
} : options.env,
|
|
129843
|
-
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
129844
|
-
});
|
|
129845
|
-
if (settings.protocolStdio) {
|
|
129846
|
-
delete env2.TERM;
|
|
129847
|
-
}
|
|
129848
|
-
return withLodyNpmCacheForNpx(launch.command, env2);
|
|
129849
|
-
}
|
|
129850
|
-
async runLoginProcess(ctx) {
|
|
129851
|
-
const { options, running: running2, interruptedResult, displayName } = ctx;
|
|
129852
|
-
const child = this.spawnProcess(ctx.command, ctx.args, {
|
|
129853
|
-
cwd: os__default$1.homedir(),
|
|
129854
|
-
env: ctx.env,
|
|
129855
|
-
stdio: [
|
|
129856
|
-
"pipe",
|
|
129857
|
-
"pipe",
|
|
129858
|
-
"pipe"
|
|
129859
|
-
],
|
|
129860
|
-
detached: process.platform !== "win32",
|
|
129861
|
-
windowsHide: true
|
|
129862
|
-
});
|
|
129863
|
-
running2.child = child;
|
|
129864
|
-
if (running2.cancelled || running2.timedOut) {
|
|
129865
|
-
this.terminateAuthentication(options.agentType, running2, running2.cancelled ? "cancelled" : "timed out");
|
|
129866
|
-
}
|
|
129867
|
-
child.stdin?.on("error", (error2) => {
|
|
129868
|
-
this.logger.debug(`[acp-auth] ${displayName} authorization input failed: ${formatErrorMessage(error2)}`);
|
|
129869
|
-
});
|
|
129870
|
-
const emitOutput = (stream2, chunk) => {
|
|
129871
|
-
const output = String(chunk);
|
|
129872
|
-
if (output.length === 0) return;
|
|
129873
|
-
const authorization = ctx.parser.push(output);
|
|
129874
|
-
if (authorization) {
|
|
129875
|
-
running2.acceptsAuthorizationCode = ctx.acceptsAuthorizationCodeOnStdin && authorization.acceptsAuthorizationCode === true;
|
|
129876
|
-
options.onProgress?.({
|
|
129877
|
-
status: "authorization",
|
|
129878
|
-
...authorization
|
|
129879
|
-
});
|
|
129880
|
-
}
|
|
129881
|
-
options.onProgress?.({
|
|
129882
|
-
status: "output",
|
|
129883
|
-
stream: stream2,
|
|
129884
|
-
output: output.slice(0, 16384)
|
|
129885
|
-
});
|
|
129886
|
-
};
|
|
129887
|
-
child.stdout?.on("data", (chunk) => emitOutput("stdout", chunk));
|
|
129888
|
-
child.stderr?.on("data", (chunk) => emitOutput("stderr", chunk));
|
|
129889
|
-
const exit2 = await new Promise((resolve2) => {
|
|
129890
|
-
let settled = false;
|
|
129891
|
-
const finish = (result) => {
|
|
129892
|
-
if (settled) return;
|
|
129893
|
-
settled = true;
|
|
129894
|
-
resolve2(result);
|
|
129895
|
-
};
|
|
129896
|
-
child.once("error", (error2) => finish({
|
|
129897
|
-
code: null,
|
|
129898
|
-
error: error2
|
|
129899
|
-
}));
|
|
129900
|
-
child.once("exit", (code2) => finish({
|
|
129901
|
-
code: code2
|
|
129902
|
-
}));
|
|
129903
|
-
});
|
|
129904
|
-
const processInterruption = interruptedResult();
|
|
129905
|
-
if (processInterruption) return processInterruption;
|
|
129906
|
-
if (exit2.error !== void 0 || exit2.code !== 0) {
|
|
129907
|
-
const error2 = exit2.error !== void 0 ? formatErrorMessage(exit2.error) : ctx.formatExitError(exit2.code);
|
|
129908
|
-
options.onProgress?.({
|
|
129909
|
-
status: "error",
|
|
129910
|
-
error: error2
|
|
129911
|
-
});
|
|
129912
|
-
return {
|
|
129913
|
-
success: false,
|
|
129914
|
-
disposition: "error",
|
|
129915
|
-
error: error2
|
|
129916
|
-
};
|
|
129917
|
-
}
|
|
129918
|
-
options.onProgress?.({
|
|
129919
|
-
status: "authenticated"
|
|
129920
|
-
});
|
|
129921
|
-
return {
|
|
129922
|
-
success: true,
|
|
129923
|
-
disposition: "authenticated"
|
|
129924
|
-
};
|
|
129925
|
-
}
|
|
129926
|
-
cancel(agentType, requestId) {
|
|
129927
|
-
const running2 = this.runningByAgentType.get(agentType);
|
|
129928
|
-
if (!running2 || running2.requestId !== requestId) {
|
|
130077
|
+
cancel(requestId) {
|
|
130078
|
+
const active2 = this.findRunningAuthentication(requestId);
|
|
130079
|
+
if (!active2) {
|
|
129929
130080
|
return {
|
|
129930
130081
|
success: true,
|
|
129931
130082
|
disposition: "not-running"
|
|
129932
130083
|
};
|
|
129933
130084
|
}
|
|
130085
|
+
const { agentType, running: running2 } = active2;
|
|
129934
130086
|
running2.cancelled = true;
|
|
130087
|
+
running2.abortController.abort();
|
|
130088
|
+
running2.pendingInteraction?.resolve({
|
|
130089
|
+
action: "cancel"
|
|
130090
|
+
});
|
|
130091
|
+
running2.pendingInteraction = void 0;
|
|
129935
130092
|
if (!running2.child && this.runningByAgentType.get(agentType) === running2) {
|
|
129936
130093
|
this.runningByAgentType.delete(agentType);
|
|
129937
130094
|
}
|
|
@@ -129941,14 +130098,15 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129941
130098
|
disposition: "cancelled"
|
|
129942
130099
|
};
|
|
129943
130100
|
}
|
|
129944
|
-
submitAuthorizationCode(
|
|
129945
|
-
const
|
|
129946
|
-
if (!
|
|
130101
|
+
submitAuthorizationCode(requestId, authorizationCode) {
|
|
130102
|
+
const active2 = this.findRunningAuthentication(requestId);
|
|
130103
|
+
if (!active2) {
|
|
129947
130104
|
return {
|
|
129948
130105
|
success: true,
|
|
129949
130106
|
disposition: "not-running"
|
|
129950
130107
|
};
|
|
129951
130108
|
}
|
|
130109
|
+
const { agentType, running: running2 } = active2;
|
|
129952
130110
|
if (!running2.acceptsAuthorizationCode) {
|
|
129953
130111
|
return {
|
|
129954
130112
|
success: false,
|
|
@@ -129996,8 +130154,327 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129996
130154
|
};
|
|
129997
130155
|
}
|
|
129998
130156
|
}
|
|
130157
|
+
submitAuthenticationInput(requestId, interactionId, authenticationInput) {
|
|
130158
|
+
const active2 = this.findRunningAuthentication(requestId);
|
|
130159
|
+
if (!active2) {
|
|
130160
|
+
return {
|
|
130161
|
+
success: true,
|
|
130162
|
+
disposition: "not-running"
|
|
130163
|
+
};
|
|
130164
|
+
}
|
|
130165
|
+
const { agentType, running: running2 } = active2;
|
|
130166
|
+
const pending2 = running2.pendingInteraction;
|
|
130167
|
+
if (!pending2 || pending2.id !== interactionId) {
|
|
130168
|
+
return {
|
|
130169
|
+
success: false,
|
|
130170
|
+
disposition: "error",
|
|
130171
|
+
error: `${getBuiltinDisplayName(agentType)} is not waiting for this authentication input`
|
|
130172
|
+
};
|
|
130173
|
+
}
|
|
130174
|
+
const parsedJson = (() => {
|
|
130175
|
+
try {
|
|
130176
|
+
return JSON.parse(authenticationInput);
|
|
130177
|
+
} catch {
|
|
130178
|
+
return null;
|
|
130179
|
+
}
|
|
130180
|
+
})();
|
|
130181
|
+
const parsed = AcpAuthenticationInteractionInputSchema.safeParse(parsedJson);
|
|
130182
|
+
if (!parsed.success) {
|
|
130183
|
+
return {
|
|
130184
|
+
success: false,
|
|
130185
|
+
disposition: "error",
|
|
130186
|
+
error: "Invalid authentication input"
|
|
130187
|
+
};
|
|
130188
|
+
}
|
|
130189
|
+
running2.pendingInteraction = void 0;
|
|
130190
|
+
pending2.resolve(parsed.data);
|
|
130191
|
+
return {
|
|
130192
|
+
success: true,
|
|
130193
|
+
disposition: "input-accepted"
|
|
130194
|
+
};
|
|
130195
|
+
}
|
|
130196
|
+
findRunningAuthentication(requestId) {
|
|
130197
|
+
for (const [agentType, running2] of this.runningByAgentType) {
|
|
130198
|
+
if (running2.requestId === requestId) return {
|
|
130199
|
+
agentType,
|
|
130200
|
+
running: running2
|
|
130201
|
+
};
|
|
130202
|
+
}
|
|
130203
|
+
return void 0;
|
|
130204
|
+
}
|
|
130205
|
+
waitForAuthenticationInput(running2, interactionId) {
|
|
130206
|
+
if (running2.pendingInteraction) {
|
|
130207
|
+
return null;
|
|
130208
|
+
}
|
|
130209
|
+
return new Promise((resolve2) => {
|
|
130210
|
+
running2.pendingInteraction = {
|
|
130211
|
+
id: interactionId,
|
|
130212
|
+
resolve: resolve2
|
|
130213
|
+
};
|
|
130214
|
+
if (running2.abortController.signal.aborted) {
|
|
130215
|
+
running2.pendingInteraction = void 0;
|
|
130216
|
+
resolve2({
|
|
130217
|
+
action: "cancel"
|
|
130218
|
+
});
|
|
130219
|
+
}
|
|
130220
|
+
});
|
|
130221
|
+
}
|
|
130222
|
+
async authenticateProtocolDrivenAcp(options, running2) {
|
|
130223
|
+
const launch = await resolveACPProcessLaunchAsync({
|
|
130224
|
+
cliType: options.cliType,
|
|
130225
|
+
agentType: options.agentType,
|
|
130226
|
+
customAcp: options.customAcp,
|
|
130227
|
+
runtimeOverrides: options.runtimeOverrides,
|
|
130228
|
+
signal: running2.abortController.signal
|
|
130229
|
+
});
|
|
130230
|
+
const env2 = await buildAuthenticationProcessEnv({
|
|
130231
|
+
launch,
|
|
130232
|
+
agentType: options.agentType,
|
|
130233
|
+
env: options.env,
|
|
130234
|
+
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
130235
|
+
});
|
|
130236
|
+
delete env2.TERM;
|
|
130237
|
+
running2.abortController.signal.throwIfAborted();
|
|
130238
|
+
let lastStderrTail = "";
|
|
130239
|
+
await withAcpSessionStartSlot({
|
|
130240
|
+
label: `acp-auth:${options.agentType}`,
|
|
130241
|
+
logger: this.logger,
|
|
130242
|
+
abortSignal: running2.abortController.signal
|
|
130243
|
+
}, async () => await runNpxStartupWithRecovery({
|
|
130244
|
+
command: launch.command,
|
|
130245
|
+
args: launch.args,
|
|
130246
|
+
env: env2,
|
|
130247
|
+
logger: this.logger,
|
|
130248
|
+
logPrefix: "[acp-auth]",
|
|
130249
|
+
getStderrTail: () => lastStderrTail,
|
|
130250
|
+
attempt: async ({ args: args2 }) => {
|
|
130251
|
+
running2.abortController.signal.throwIfAborted();
|
|
130252
|
+
lastStderrTail = "";
|
|
130253
|
+
options.onProgress?.({
|
|
130254
|
+
status: "starting"
|
|
130255
|
+
});
|
|
130256
|
+
const child = spawnAcpProcess({
|
|
130257
|
+
cliType: options.cliType,
|
|
130258
|
+
agentType: options.agentType,
|
|
130259
|
+
customAcp: options.customAcp,
|
|
130260
|
+
runtimeOverrides: options.runtimeOverrides,
|
|
130261
|
+
workdir: process.cwd(),
|
|
130262
|
+
env: env2,
|
|
130263
|
+
command: launch.command,
|
|
130264
|
+
args: [
|
|
130265
|
+
...args2
|
|
130266
|
+
],
|
|
130267
|
+
spawnImpl: this.spawnProcess
|
|
130268
|
+
});
|
|
130269
|
+
running2.child = child;
|
|
130270
|
+
running2.terminating = false;
|
|
130271
|
+
child.stderr?.setEncoding("utf8");
|
|
130272
|
+
const authorizationParser = new AcpAgentAuthorizationOutputParser();
|
|
130273
|
+
child.stderr?.on("data", (chunk) => {
|
|
130274
|
+
lastStderrTail = appendStderrTail(lastStderrTail, chunk);
|
|
130275
|
+
const authorization = authorizationParser.push(chunk);
|
|
130276
|
+
if (authorization && isAllowedAuthorizationUrl(authorization.authorizationUrl)) {
|
|
130277
|
+
options.onProgress?.({
|
|
130278
|
+
status: "authorization",
|
|
130279
|
+
...authorization
|
|
130280
|
+
});
|
|
130281
|
+
}
|
|
130282
|
+
});
|
|
130283
|
+
const startupMonitor = createAcpStartupMonitor({
|
|
130284
|
+
onExit: (listener) => {
|
|
130285
|
+
child.on("exit", listener);
|
|
130286
|
+
return () => child.off("exit", listener);
|
|
130287
|
+
},
|
|
130288
|
+
onError: (listener) => {
|
|
130289
|
+
child.on("error", listener);
|
|
130290
|
+
return () => child.off("error", listener);
|
|
130291
|
+
}
|
|
130292
|
+
}, {
|
|
130293
|
+
sessionId: `acp-auth:${options.agentType}`,
|
|
130294
|
+
command: launch.command,
|
|
130295
|
+
args: [
|
|
130296
|
+
...args2
|
|
130297
|
+
],
|
|
130298
|
+
getStderrTail: () => ""
|
|
130299
|
+
});
|
|
130300
|
+
try {
|
|
130301
|
+
running2.abortController.signal.throwIfAborted();
|
|
130302
|
+
if (!child.stdin || !child.stdout) {
|
|
130303
|
+
throw new Error(`${options.agentType} ACP authentication streams are unavailable`);
|
|
130304
|
+
}
|
|
130305
|
+
let interactionError;
|
|
130306
|
+
const app = client$2({
|
|
130307
|
+
name: "lody-authentication"
|
|
130308
|
+
}).onRequest(methods$1.client.elicitation.create, async ({ params }) => {
|
|
130309
|
+
const raw2 = asRecord(params);
|
|
130310
|
+
if (raw2?.mode === "url") {
|
|
130311
|
+
if (typeof raw2.url !== "string" || !isAllowedAuthorizationUrl(raw2.url)) {
|
|
130312
|
+
const error2 = `${options.agentType} requested an unsafe authentication URL. Lody only opens HTTP and HTTPS authorization pages.`;
|
|
130313
|
+
interactionError = error2;
|
|
130314
|
+
this.logger.debug(`[acp-auth] ${error2}`);
|
|
130315
|
+
options.onProgress?.({
|
|
130316
|
+
status: "error",
|
|
130317
|
+
error: error2
|
|
130318
|
+
});
|
|
130319
|
+
return {
|
|
130320
|
+
action: "decline"
|
|
130321
|
+
};
|
|
130322
|
+
}
|
|
130323
|
+
const interactionId2 = randomUUID();
|
|
130324
|
+
const inputPromise2 = this.waitForAuthenticationInput(running2, interactionId2);
|
|
130325
|
+
if (!inputPromise2) return {
|
|
130326
|
+
action: "decline"
|
|
130327
|
+
};
|
|
130328
|
+
options.onProgress?.({
|
|
130329
|
+
status: "authorization",
|
|
130330
|
+
authorizationUrl: raw2.url,
|
|
130331
|
+
interactionId: interactionId2,
|
|
130332
|
+
message: typeof raw2.message === "string" ? raw2.message.slice(0, ACP_AUTH_TEXT_MAX_LENGTH) : void 0,
|
|
130333
|
+
requiresAuthorizationConsent: true
|
|
130334
|
+
});
|
|
130335
|
+
const input22 = await inputPromise2;
|
|
130336
|
+
return input22.action === "accept" ? {
|
|
130337
|
+
action: "accept"
|
|
130338
|
+
} : {
|
|
130339
|
+
action: input22.action
|
|
130340
|
+
};
|
|
130341
|
+
}
|
|
130342
|
+
const form = toAuthenticationForm(params);
|
|
130343
|
+
if (!form) {
|
|
130344
|
+
const error2 = `${options.agentType} requested an unsupported authentication form or one larger than Lody's ${ACP_AUTHENTICATION_FORM_MAX_BYTES / 1024} KiB limit. Lody currently supports text, secret, and single-select fields.`;
|
|
130345
|
+
interactionError = error2;
|
|
130346
|
+
this.logger.debug(`[acp-auth] ${error2}`);
|
|
130347
|
+
options.onProgress?.({
|
|
130348
|
+
status: "error",
|
|
130349
|
+
error: error2
|
|
130350
|
+
});
|
|
130351
|
+
return {
|
|
130352
|
+
action: "decline"
|
|
130353
|
+
};
|
|
130354
|
+
}
|
|
130355
|
+
const interactionId = randomUUID();
|
|
130356
|
+
const inputPromise = this.waitForAuthenticationInput(running2, interactionId);
|
|
130357
|
+
if (!inputPromise) return {
|
|
130358
|
+
action: "decline"
|
|
130359
|
+
};
|
|
130360
|
+
options.onProgress?.({
|
|
130361
|
+
status: "input-required",
|
|
130362
|
+
interactionId,
|
|
130363
|
+
message: typeof raw2?.message === "string" ? raw2.message.slice(0, ACP_AUTH_TEXT_MAX_LENGTH) : `Enter the information requested by ${options.agentType}`,
|
|
130364
|
+
form
|
|
130365
|
+
});
|
|
130366
|
+
const input2 = await inputPromise;
|
|
130367
|
+
return input2.action === "accept" ? {
|
|
130368
|
+
action: "accept",
|
|
130369
|
+
content: input2.content ?? {}
|
|
130370
|
+
} : {
|
|
130371
|
+
action: input2.action
|
|
130372
|
+
};
|
|
130373
|
+
});
|
|
130374
|
+
const stream2 = ndJsonStream(createStdinWritableStream(child.stdin), createStdoutReadableStream(child.stdout));
|
|
130375
|
+
await Promise.race([
|
|
130376
|
+
app.connectWith(stream2, async (context2) => {
|
|
130377
|
+
const initialized2 = await context2.request(methods$1.agent.initialize, {
|
|
130378
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
130379
|
+
clientCapabilities: {
|
|
130380
|
+
auth: {
|
|
130381
|
+
terminal: false
|
|
130382
|
+
},
|
|
130383
|
+
elicitation: {
|
|
130384
|
+
form: {},
|
|
130385
|
+
url: {}
|
|
130386
|
+
}
|
|
130387
|
+
},
|
|
130388
|
+
clientInfo: {
|
|
130389
|
+
name: "lody",
|
|
130390
|
+
title: "Lody",
|
|
130391
|
+
version: "1"
|
|
130392
|
+
}
|
|
130393
|
+
}, {
|
|
130394
|
+
cancellationSignal: running2.abortController.signal
|
|
130395
|
+
});
|
|
130396
|
+
const advertisedMethods = [
|
|
130397
|
+
...initialized2.authMethods ?? []
|
|
130398
|
+
];
|
|
130399
|
+
const methods2 = advertisedMethods.filter((method) => getAuthMethodType(method) === "agent");
|
|
130400
|
+
if (methods2.length === 0) {
|
|
130401
|
+
const unsupportedTypes = new Set(advertisedMethods.map((method) => getAuthMethodType(method)));
|
|
130402
|
+
const hasDeprecatedEnv = unsupportedTypes.has("env_var");
|
|
130403
|
+
const hasUnsupportedTerminal = unsupportedTypes.has("terminal");
|
|
130404
|
+
throw new Error(hasDeprecatedEnv && hasUnsupportedTerminal ? `${options.agentType} only advertised deprecated env_var and unsupported terminal authentication methods` : hasDeprecatedEnv ? `${options.agentType} only advertised the deprecated ACP env_var authentication method` : hasUnsupportedTerminal ? `${options.agentType} only advertised terminal authentication, which requires an interactive terminal that is not available over Machine RPC` : `${options.agentType} did not advertise an authentication method`);
|
|
130405
|
+
}
|
|
130406
|
+
if (methods2.length > ACP_AUTH_METHOD_MAX_COUNT || new Set(methods2.map((method) => method.id)).size !== methods2.length || methods2.some((method) => typeof method.id !== "string" || !method.id.trim() || method.id.length > ACP_AUTH_ID_MAX_LENGTH)) {
|
|
130407
|
+
throw new Error(`${options.agentType} advertised too many or invalid authentication methods`);
|
|
130408
|
+
}
|
|
130409
|
+
let methodId;
|
|
130410
|
+
if (methods2.length === 1) {
|
|
130411
|
+
methodId = methods2[0]?.id;
|
|
130412
|
+
}
|
|
130413
|
+
if (!methodId) {
|
|
130414
|
+
const interactionId = randomUUID();
|
|
130415
|
+
const inputPromise = this.waitForAuthenticationInput(running2, interactionId);
|
|
130416
|
+
if (!inputPromise) {
|
|
130417
|
+
throw new Error(`${options.agentType} requested overlapping authentication interactions`);
|
|
130418
|
+
}
|
|
130419
|
+
options.onProgress?.({
|
|
130420
|
+
status: "auth-methods",
|
|
130421
|
+
interactionId,
|
|
130422
|
+
authMethods: methods2
|
|
130423
|
+
});
|
|
130424
|
+
const input2 = await inputPromise;
|
|
130425
|
+
if (input2.action !== "accept" || !input2.methodId) {
|
|
130426
|
+
throw new DOMException("ACP authentication was cancelled", "AbortError");
|
|
130427
|
+
}
|
|
130428
|
+
methodId = input2.methodId;
|
|
130429
|
+
}
|
|
130430
|
+
const selectedMethod = methods2.find((method) => method.id === methodId);
|
|
130431
|
+
if (!selectedMethod) {
|
|
130432
|
+
const advertisedMethod = advertisedMethods.find((method) => method.id === methodId);
|
|
130433
|
+
if (advertisedMethod) {
|
|
130434
|
+
throw new Error(getAuthMethodType(advertisedMethod) === "env_var" ? `${options.agentType} authentication method ${methodId} uses deprecated env_var authentication` : `${options.agentType} authentication method ${methodId} requires an interactive terminal that is not available over Machine RPC`);
|
|
130435
|
+
}
|
|
130436
|
+
throw new Error(`${options.agentType} no longer advertises authentication method ${methodId}`);
|
|
130437
|
+
}
|
|
130438
|
+
await context2.request(methods$1.agent.authenticate, {
|
|
130439
|
+
methodId
|
|
130440
|
+
}, {
|
|
130441
|
+
cancellationSignal: running2.abortController.signal
|
|
130442
|
+
});
|
|
130443
|
+
if (interactionError) {
|
|
130444
|
+
throw new Error(interactionError);
|
|
130445
|
+
}
|
|
130446
|
+
}),
|
|
130447
|
+
startupMonitor.abortPromise
|
|
130448
|
+
]);
|
|
130449
|
+
} finally {
|
|
130450
|
+
running2.pendingInteraction?.resolve({
|
|
130451
|
+
action: "cancel"
|
|
130452
|
+
});
|
|
130453
|
+
running2.pendingInteraction = void 0;
|
|
130454
|
+
startupMonitor.dispose();
|
|
130455
|
+
await shutdownLocalAcpAgent({
|
|
130456
|
+
agentProcess: child,
|
|
130457
|
+
logger: this.logger,
|
|
130458
|
+
sessionLabel: `acp-auth:${options.agentType}:protocol`,
|
|
130459
|
+
exitTimeoutMs: this.terminationGraceMs
|
|
130460
|
+
}).catch((error2) => {
|
|
130461
|
+
this.logger.debug(`[acp-auth] Failed to terminate protocol authentication process: ${formatErrorMessage(error2)}`);
|
|
130462
|
+
});
|
|
130463
|
+
if (running2.child === child) running2.child = void 0;
|
|
130464
|
+
}
|
|
130465
|
+
}
|
|
130466
|
+
}));
|
|
130467
|
+
running2.abortController.signal.throwIfAborted();
|
|
130468
|
+
options.onProgress?.({
|
|
130469
|
+
status: "authenticated"
|
|
130470
|
+
});
|
|
130471
|
+
return {
|
|
130472
|
+
success: true,
|
|
130473
|
+
disposition: "authenticated"
|
|
130474
|
+
};
|
|
130475
|
+
}
|
|
129999
130476
|
terminateAuthentication(agentType, running2, reason) {
|
|
130000
|
-
running2.
|
|
130477
|
+
running2.abortController.abort();
|
|
130001
130478
|
if (running2.terminating || !running2.child) return;
|
|
130002
130479
|
running2.terminating = true;
|
|
130003
130480
|
void shutdownLocalAcpAgent({
|
|
@@ -134297,6 +134774,7 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134297
134774
|
return firstDataMessage ?? error2.message;
|
|
134298
134775
|
};
|
|
134299
134776
|
const isUpstreamApiACPError = (error2) => /API Error:\s*(?:500|502|503|529)\b/.test(getACPDiagnosticText(error2, error2));
|
|
134777
|
+
const isProviderOverloadedACPError = (error2) => getStringField(error2.data, "codexErrorInfo") === "serverOverloaded";
|
|
134300
134778
|
const isAcpSessionStorageIncompatibleError = (error2) => {
|
|
134301
134779
|
const diagnosticText = getACPDiagnosticText(error2);
|
|
134302
134780
|
return /session artifact[\s\S]{0,1000}uses \.jsonl(?:\.zstd)?[\s\S]{0,1000}configured for compression/iu.test(diagnosticText) || /session root[\s\S]{0,1000}contains both raw and Zstandard session artifacts/iu.test(diagnosticText);
|
|
@@ -134329,6 +134807,9 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134329
134807
|
if (isAgentDisconnectedError(error2) || isAcpSessionNotFoundError(error2)) {
|
|
134330
134808
|
return "agent_disconnected";
|
|
134331
134809
|
}
|
|
134810
|
+
if (isProviderOverloadedACPError(error2)) {
|
|
134811
|
+
return "acp_provider_overloaded";
|
|
134812
|
+
}
|
|
134332
134813
|
if (isUpstreamApiACPError(error2)) {
|
|
134333
134814
|
return "acp_upstream_api_error";
|
|
134334
134815
|
}
|
|
@@ -134359,10 +134840,15 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134359
134840
|
if (failureReason === "acp_upstream_api_error") {
|
|
134360
134841
|
return false;
|
|
134361
134842
|
}
|
|
134843
|
+
if (failureReason === "acp_provider_overloaded") {
|
|
134844
|
+
return false;
|
|
134845
|
+
}
|
|
134362
134846
|
return error2.code === ACP_ERROR_CODES.INTERNAL_ERROR;
|
|
134363
134847
|
};
|
|
134364
134848
|
const shouldRecoverStaleACPConnectionPrompt = (args2) => !args2.alreadyAttempted && !args2.hasPromptOutput && (isAgentDisconnectedError(args2.error) || isAcpSessionNotFoundError(args2.error));
|
|
134365
134849
|
const TURN_FINALIZATION_STAGE_WARN_MS = 5e3;
|
|
134850
|
+
const ACP_AUTHENTICATION_WORKFLOW_DEADLINE_MS = 295e3;
|
|
134851
|
+
const ACP_POST_AUTH_REFRESH_MAX_MS = 6e4;
|
|
134366
134852
|
const SILENT_TURN_FAILURE_MESSAGE = "The agent ended the turn without producing any output. The model call most likely failed upstream (a context-length or rate-limit rejection is the usual cause) and the agent reported it as a normal completion instead of an error. Retry your message, or start a new session if this conversation has grown too long.";
|
|
134367
134853
|
class SessionTurnCancelled extends TaggedError("SessionTurnCancelled") {
|
|
134368
134854
|
}
|
|
@@ -134411,19 +134897,23 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134411
134897
|
const summarizeAcpAuthMethod = (method) => {
|
|
134412
134898
|
const record2 = typeof method === "object" && method !== null ? method : {};
|
|
134413
134899
|
const type2 = record2.type === "terminal" || record2.type === "env_var" ? record2.type : "agent";
|
|
134900
|
+
const boundedString = (value, maxLength) => typeof value === "string" ? value.slice(0, maxLength) : void 0;
|
|
134901
|
+
const id2 = boundedString(record2.id, 1024);
|
|
134902
|
+
const name2 = boundedString(record2.name, 4096);
|
|
134903
|
+
const description2 = boundedString(record2.description, 16384);
|
|
134414
134904
|
return {
|
|
134415
134905
|
type: type2,
|
|
134416
|
-
...
|
|
134417
|
-
id:
|
|
134906
|
+
...id2 !== void 0 ? {
|
|
134907
|
+
id: id2
|
|
134418
134908
|
} : {},
|
|
134419
|
-
...
|
|
134420
|
-
name:
|
|
134909
|
+
...name2 !== void 0 ? {
|
|
134910
|
+
name: name2
|
|
134421
134911
|
} : {},
|
|
134422
|
-
...
|
|
134423
|
-
description:
|
|
134912
|
+
...description2 !== void 0 ? {
|
|
134913
|
+
description: description2
|
|
134424
134914
|
} : {},
|
|
134425
134915
|
...Array.isArray(record2.args) && record2.args.every((arg) => typeof arg === "string") ? {
|
|
134426
|
-
args: record2.args
|
|
134916
|
+
args: record2.args.slice(0, 64).map((arg) => arg.slice(0, 4096))
|
|
134427
134917
|
} : {}
|
|
134428
134918
|
};
|
|
134429
134919
|
};
|
|
@@ -137182,11 +137672,14 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137182
137672
|
});
|
|
137183
137673
|
}
|
|
137184
137674
|
async authenticateMachineAcp(message, options = {}) {
|
|
137675
|
+
const workflowStartedAt = Date.now();
|
|
137676
|
+
const targetRequestId = message.action === "start" ? message.requestId : message.authenticationRequestId;
|
|
137677
|
+
const activeAgentType = this.acpAuthenticationManager.getAgentType(targetRequestId);
|
|
137185
137678
|
const base = {
|
|
137186
137679
|
type: "machine/acp-authenticate_response",
|
|
137187
137680
|
machineId: this.deps.machineId,
|
|
137188
137681
|
requestId: message.requestId,
|
|
137189
|
-
agentType:
|
|
137682
|
+
agentType: activeAgentType ?? "unknown"
|
|
137190
137683
|
};
|
|
137191
137684
|
if (message.machineId !== this.deps.machineId) {
|
|
137192
137685
|
return {
|
|
@@ -137199,68 +137692,100 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137199
137692
|
if (message.action === "cancel") {
|
|
137200
137693
|
return {
|
|
137201
137694
|
...base,
|
|
137202
|
-
...this.acpAuthenticationManager.cancel(message.
|
|
137695
|
+
...this.acpAuthenticationManager.cancel(message.authenticationRequestId)
|
|
137203
137696
|
};
|
|
137204
137697
|
}
|
|
137205
137698
|
if (message.action === "submit-code") {
|
|
137206
|
-
if (!message.authenticationRequestId || !message.authorizationCode) {
|
|
137207
|
-
return {
|
|
137208
|
-
...base,
|
|
137209
|
-
success: false,
|
|
137210
|
-
disposition: "error",
|
|
137211
|
-
error: "Missing authentication request or authorization code"
|
|
137212
|
-
};
|
|
137213
|
-
}
|
|
137214
137699
|
return {
|
|
137215
137700
|
...base,
|
|
137216
|
-
...this.acpAuthenticationManager.submitAuthorizationCode(message.
|
|
137701
|
+
...this.acpAuthenticationManager.submitAuthorizationCode(message.authenticationRequestId, message.authorizationCode)
|
|
137702
|
+
};
|
|
137703
|
+
}
|
|
137704
|
+
if (message.action === "submit-input") {
|
|
137705
|
+
return {
|
|
137706
|
+
...base,
|
|
137707
|
+
...this.acpAuthenticationManager.submitAuthenticationInput(message.authenticationRequestId, message.interactionId, message.authenticationInput)
|
|
137708
|
+
};
|
|
137709
|
+
}
|
|
137710
|
+
const config2 = await this.deps.workspaceDocument.getAgentConfigForMachineLaunch(message.configId, this.deps.machineId);
|
|
137711
|
+
if (!config2 || config2.cliType === "custom" && !config2.customAcp) {
|
|
137712
|
+
return {
|
|
137713
|
+
...base,
|
|
137714
|
+
success: false,
|
|
137715
|
+
disposition: "error",
|
|
137716
|
+
error: `Provider config not found or invalid on this machine: ${message.configId}`
|
|
137217
137717
|
};
|
|
137218
137718
|
}
|
|
137719
|
+
const resolvedBase = {
|
|
137720
|
+
...base,
|
|
137721
|
+
agentType: config2.agentType
|
|
137722
|
+
};
|
|
137219
137723
|
const onProgress = (event) => {
|
|
137724
|
+
if (event.status === "auth-methods") {
|
|
137725
|
+
options.onProgress?.({
|
|
137726
|
+
type: "machine/acp-authentication-progress",
|
|
137727
|
+
machineId: this.deps.machineId,
|
|
137728
|
+
requestId: message.requestId,
|
|
137729
|
+
agentType: config2.agentType,
|
|
137730
|
+
status: event.status,
|
|
137731
|
+
interactionId: event.interactionId,
|
|
137732
|
+
authMethods: event.authMethods.map(summarizeAcpAuthMethod)
|
|
137733
|
+
});
|
|
137734
|
+
return;
|
|
137735
|
+
}
|
|
137220
137736
|
options.onProgress?.({
|
|
137221
137737
|
type: "machine/acp-authentication-progress",
|
|
137222
137738
|
machineId: this.deps.machineId,
|
|
137223
137739
|
requestId: message.requestId,
|
|
137224
|
-
agentType:
|
|
137740
|
+
agentType: config2.agentType,
|
|
137225
137741
|
...event
|
|
137226
137742
|
});
|
|
137227
137743
|
};
|
|
137228
137744
|
const result = await this.acpAuthenticationManager.authenticate({
|
|
137229
137745
|
requestId: message.requestId,
|
|
137230
|
-
cliType:
|
|
137231
|
-
agentType:
|
|
137232
|
-
customAcp:
|
|
137233
|
-
runtimeOverrides:
|
|
137234
|
-
env:
|
|
137235
|
-
methodId: message.methodId,
|
|
137746
|
+
cliType: config2.cliType,
|
|
137747
|
+
agentType: config2.agentType,
|
|
137748
|
+
customAcp: config2.customAcp,
|
|
137749
|
+
runtimeOverrides: config2.runtimeOverrides,
|
|
137750
|
+
env: config2.env,
|
|
137236
137751
|
onProgress
|
|
137237
137752
|
});
|
|
137238
|
-
if (result.disposition === "
|
|
137239
|
-
|
|
137240
|
-
|
|
137241
|
-
|
|
137242
|
-
|
|
137243
|
-
|
|
137244
|
-
|
|
137245
|
-
|
|
137246
|
-
|
|
137247
|
-
|
|
137248
|
-
|
|
137249
|
-
|
|
137250
|
-
|
|
137251
|
-
|
|
137252
|
-
|
|
137253
|
-
|
|
137254
|
-
|
|
137255
|
-
|
|
137256
|
-
|
|
137257
|
-
|
|
137258
|
-
|
|
137259
|
-
|
|
137260
|
-
|
|
137753
|
+
if (result.success && result.disposition === "authenticated") {
|
|
137754
|
+
const refreshController = new AbortController();
|
|
137755
|
+
const refreshTimeoutMs = Math.max(1, Math.min(ACP_POST_AUTH_REFRESH_MAX_MS, ACP_AUTHENTICATION_WORKFLOW_DEADLINE_MS - (Date.now() - workflowStartedAt)));
|
|
137756
|
+
const refreshTimeout = setTimeout(() => refreshController.abort(), refreshTimeoutMs);
|
|
137757
|
+
refreshTimeout.unref?.();
|
|
137758
|
+
let refresh;
|
|
137759
|
+
try {
|
|
137760
|
+
refresh = await this.refreshMachineAcpCapabilitiesForConfig({
|
|
137761
|
+
type: "machine/acp-capabilities-refresh",
|
|
137762
|
+
machineId: message.machineId,
|
|
137763
|
+
workspaceId: message.workspaceId,
|
|
137764
|
+
configId: message.configId,
|
|
137765
|
+
cliType: config2.cliType,
|
|
137766
|
+
agentType: config2.agentType,
|
|
137767
|
+
customAcp: config2.customAcp,
|
|
137768
|
+
runtimeOverrides: config2.runtimeOverrides,
|
|
137769
|
+
env: config2.env
|
|
137770
|
+
}, {
|
|
137771
|
+
signal: refreshController.signal
|
|
137772
|
+
});
|
|
137773
|
+
} catch (error2) {
|
|
137774
|
+
refresh = {
|
|
137775
|
+
type: "machine/acp-capabilities-refresh_response",
|
|
137776
|
+
machineId: message.machineId,
|
|
137777
|
+
configId: message.configId,
|
|
137778
|
+
cliType: config2.cliType,
|
|
137779
|
+
agentType: config2.agentType,
|
|
137780
|
+
success: false,
|
|
137781
|
+
error: refreshController.signal.aborted ? "Authentication succeeded, but capability verification timed out" : formatErrorMessage(error2)
|
|
137782
|
+
};
|
|
137783
|
+
} finally {
|
|
137784
|
+
clearTimeout(refreshTimeout);
|
|
137785
|
+
}
|
|
137261
137786
|
if (!refresh.success) {
|
|
137262
137787
|
return {
|
|
137263
|
-
...
|
|
137788
|
+
...resolvedBase,
|
|
137264
137789
|
...result,
|
|
137265
137790
|
capabilitiesRefreshed: false,
|
|
137266
137791
|
authRequired: refresh.authRequired,
|
|
@@ -137269,13 +137794,13 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137269
137794
|
};
|
|
137270
137795
|
}
|
|
137271
137796
|
return {
|
|
137272
|
-
...
|
|
137797
|
+
...resolvedBase,
|
|
137273
137798
|
...result,
|
|
137274
137799
|
capabilitiesRefreshed: true
|
|
137275
137800
|
};
|
|
137276
137801
|
}
|
|
137277
137802
|
return {
|
|
137278
|
-
...
|
|
137803
|
+
...resolvedBase,
|
|
137279
137804
|
...result
|
|
137280
137805
|
};
|
|
137281
137806
|
}
|
|
@@ -137285,12 +137810,34 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137285
137810
|
type: "machine/acp-capabilities-refresh_response",
|
|
137286
137811
|
machineId: this.deps.machineId,
|
|
137287
137812
|
configId: message.configId,
|
|
137288
|
-
cliType:
|
|
137289
|
-
agentType:
|
|
137813
|
+
cliType: "builtin",
|
|
137814
|
+
agentType: "unknown",
|
|
137290
137815
|
success: false,
|
|
137291
137816
|
error: `Machine mismatch: expected ${this.deps.machineId}, got ${message.machineId}`
|
|
137292
137817
|
};
|
|
137293
137818
|
}
|
|
137819
|
+
const config2 = await this.deps.workspaceDocument.getAgentConfigForMachineLaunch(message.configId, this.deps.machineId);
|
|
137820
|
+
if (!config2) {
|
|
137821
|
+
return {
|
|
137822
|
+
type: "machine/acp-capabilities-refresh_response",
|
|
137823
|
+
machineId: this.deps.machineId,
|
|
137824
|
+
configId: message.configId,
|
|
137825
|
+
cliType: "builtin",
|
|
137826
|
+
agentType: "unknown",
|
|
137827
|
+
success: false,
|
|
137828
|
+
error: `Provider config not found on this machine: ${message.configId}`
|
|
137829
|
+
};
|
|
137830
|
+
}
|
|
137831
|
+
return await this.refreshMachineAcpCapabilitiesForConfig({
|
|
137832
|
+
...message,
|
|
137833
|
+
cliType: config2.cliType,
|
|
137834
|
+
agentType: config2.agentType,
|
|
137835
|
+
customAcp: config2.customAcp,
|
|
137836
|
+
runtimeOverrides: config2.runtimeOverrides,
|
|
137837
|
+
env: config2.env
|
|
137838
|
+
}, options);
|
|
137839
|
+
}
|
|
137840
|
+
async refreshMachineAcpCapabilitiesForConfig(message, options = {}) {
|
|
137294
137841
|
const dedupeKey = computeAcpRefreshDedupeKey(message.configId, message.cliType, message.agentType, message.env, message.customAcp, message.runtimeOverrides);
|
|
137295
137842
|
this.deps.logger.debug(`[acp-capabilities] Refresh requested (cliType=${message.cliType} agentType=${message.agentType})`);
|
|
137296
137843
|
if (options.signal?.aborted) {
|
|
@@ -138995,6 +139542,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
138995
139542
|
configOptionValues: entry.inputConfig?.configOptionValues,
|
|
138996
139543
|
mcpServerIds: entry.inputConfig?.mcpServerIds ?? [],
|
|
138997
139544
|
taskToolsEnabled: entry.inputConfig?.taskToolsEnabled === true,
|
|
139545
|
+
agentRoleId: entry.inputConfig?.agentRoleId,
|
|
139546
|
+
agentRoleRevision: entry.inputConfig?.agentRoleRevision,
|
|
138998
139547
|
issuePRMentions: entry.inputConfig?.issuePRMentions,
|
|
138999
139548
|
resume: entry.inputConfig?.resume ?? resolveDispatchAcpSessionId(meta)
|
|
139000
139549
|
},
|
|
@@ -139028,6 +139577,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
139028
139577
|
configOptionValues: entry.inputConfig?.configOptionValues,
|
|
139029
139578
|
mcpServerIds: entry.inputConfig?.mcpServerIds ?? [],
|
|
139030
139579
|
taskToolsEnabled: entry.inputConfig?.taskToolsEnabled === true,
|
|
139580
|
+
agentRoleId: entry.inputConfig?.agentRoleId,
|
|
139581
|
+
agentRoleRevision: entry.inputConfig?.agentRoleRevision,
|
|
139031
139582
|
issuePRMentions: entry.inputConfig?.issuePRMentions,
|
|
139032
139583
|
resume: entry.inputConfig?.resume
|
|
139033
139584
|
},
|
|
@@ -139084,6 +139635,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
139084
139635
|
configOptionValues: isConfigOptionValueRecord(queuedItem.acpSessionConfig?.configOptionValues) ? queuedItem.acpSessionConfig.configOptionValues : void 0,
|
|
139085
139636
|
mcpServerIds: normalizeMcpServerIdSelection(queuedItem.acpSessionConfig?.mcpServerIds) ?? [],
|
|
139086
139637
|
taskToolsEnabled: queuedItem.acpSessionConfig?.taskToolsEnabled === true,
|
|
139638
|
+
agentRoleId: queuedItem.acpSessionConfig?.agentRoleId,
|
|
139639
|
+
agentRoleRevision: queuedItem.acpSessionConfig?.agentRoleRevision,
|
|
139087
139640
|
issuePRMentions: queuedItem.acpSessionConfig?.issuePRMentions,
|
|
139088
139641
|
resume: resolveResumableAcpSessionId(meta)
|
|
139089
139642
|
});
|
|
@@ -153567,10 +154120,7 @@ ${edit.newString}` : edit.newString;
|
|
|
153567
154120
|
type: "machine/acp-capabilities-refresh",
|
|
153568
154121
|
machineId: machine.id,
|
|
153569
154122
|
workspaceId: workspace.id,
|
|
153570
|
-
configId: config2.id
|
|
153571
|
-
cliType: config2.cliType,
|
|
153572
|
-
agentType: config2.agentType,
|
|
153573
|
-
env: config2.env
|
|
154123
|
+
configId: config2.id
|
|
153574
154124
|
}));
|
|
153575
154125
|
if (!response2.success) {
|
|
153576
154126
|
throw new Error(response2.error ?? `Failed to refresh capabilities for ${config2.name} on machine ${machine.id}.`);
|
|
@@ -157118,11 +157668,11 @@ ${entry.text}`).join("\n\n");
|
|
|
157118
157668
|
return null;
|
|
157119
157669
|
}
|
|
157120
157670
|
try {
|
|
157121
|
-
const stat2 = await
|
|
157671
|
+
const stat2 = await Xt.stat(absolutePath);
|
|
157122
157672
|
if (!stat2.isFile() || stat2.size > (options?.maxBytes ?? defaultMaxTextFileBytes)) {
|
|
157123
157673
|
return null;
|
|
157124
157674
|
}
|
|
157125
|
-
const content = await
|
|
157675
|
+
const content = await Xt.readFile(absolutePath);
|
|
157126
157676
|
if (content.includes(0)) {
|
|
157127
157677
|
return null;
|
|
157128
157678
|
}
|
|
@@ -167887,38 +168437,59 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
167887
168437
|
this.triggerPendingProcessLifecycleAction(response2.requestId);
|
|
167888
168438
|
}
|
|
167889
168439
|
},
|
|
167890
|
-
refreshMachineAcpCapabilities: async ({ configId,
|
|
168440
|
+
refreshMachineAcpCapabilities: async ({ configId, onAcpBinaryProgress, signal }) => await this.executionService.refreshMachineAcpCapabilities({
|
|
167891
168441
|
type: "machine/acp-capabilities-refresh",
|
|
167892
168442
|
machineId: this.machineId,
|
|
167893
168443
|
workspaceId: this.workspaceId,
|
|
167894
|
-
configId
|
|
167895
|
-
cliType,
|
|
167896
|
-
agentType,
|
|
167897
|
-
customAcp,
|
|
167898
|
-
runtimeOverrides,
|
|
167899
|
-
env: env2
|
|
168444
|
+
configId
|
|
167900
168445
|
}, {
|
|
167901
168446
|
onAcpBinaryProgress,
|
|
167902
168447
|
signal
|
|
167903
168448
|
}),
|
|
167904
|
-
authenticateMachineAcp: async (
|
|
167905
|
-
|
|
167906
|
-
|
|
167907
|
-
|
|
167908
|
-
|
|
167909
|
-
|
|
167910
|
-
|
|
167911
|
-
|
|
167912
|
-
|
|
167913
|
-
|
|
167914
|
-
|
|
167915
|
-
|
|
167916
|
-
|
|
167917
|
-
|
|
167918
|
-
|
|
167919
|
-
|
|
167920
|
-
|
|
167921
|
-
|
|
168449
|
+
authenticateMachineAcp: async (args2) => {
|
|
168450
|
+
const common2 = {
|
|
168451
|
+
type: "machine/acp-authenticate",
|
|
168452
|
+
machineId: this.machineId,
|
|
168453
|
+
workspaceId: this.workspaceId,
|
|
168454
|
+
requestId: args2.requestId
|
|
168455
|
+
};
|
|
168456
|
+
const message = (() => {
|
|
168457
|
+
switch (args2.action) {
|
|
168458
|
+
case "start":
|
|
168459
|
+
return {
|
|
168460
|
+
...common2,
|
|
168461
|
+
action: args2.action,
|
|
168462
|
+
configId: args2.configId
|
|
168463
|
+
};
|
|
168464
|
+
case "cancel":
|
|
168465
|
+
return {
|
|
168466
|
+
...common2,
|
|
168467
|
+
action: args2.action,
|
|
168468
|
+
authenticationRequestId: args2.authenticationRequestId
|
|
168469
|
+
};
|
|
168470
|
+
case "submit-code":
|
|
168471
|
+
return {
|
|
168472
|
+
...common2,
|
|
168473
|
+
action: args2.action,
|
|
168474
|
+
authenticationRequestId: args2.authenticationRequestId,
|
|
168475
|
+
authorizationCode: args2.authorizationCode
|
|
168476
|
+
};
|
|
168477
|
+
case "submit-input":
|
|
168478
|
+
return {
|
|
168479
|
+
...common2,
|
|
168480
|
+
action: args2.action,
|
|
168481
|
+
authenticationRequestId: args2.authenticationRequestId,
|
|
168482
|
+
interactionId: args2.interactionId,
|
|
168483
|
+
authenticationInput: args2.authenticationInput
|
|
168484
|
+
};
|
|
168485
|
+
default:
|
|
168486
|
+
throw new Error("Unsupported ACP authentication action");
|
|
168487
|
+
}
|
|
168488
|
+
})();
|
|
168489
|
+
return await this.authenticateMachineAcpAndResumeSetup(message, {
|
|
168490
|
+
onProgress: args2.onProgress
|
|
168491
|
+
});
|
|
168492
|
+
},
|
|
167922
168493
|
getMachineAcpBinaryStatus: async ({ agentType }) => await this.executionService.getMachineAcpBinaryStatus({
|
|
167923
168494
|
type: "machine/acp-binary-status",
|
|
167924
168495
|
machineId: this.machineId,
|
|
@@ -171703,19 +172274,64 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
171703
172274
|
const project = meta.project;
|
|
171704
172275
|
const ownerSessionId = meta.parentSessionId ?? sessionId;
|
|
171705
172276
|
if (project?.kind === "local") {
|
|
171706
|
-
const
|
|
171707
|
-
if (!
|
|
172277
|
+
const originalRootPath = await resolveWorkspaceLocalProjectRootPath(this.workspaceDocument.repo, this.workspaceId, this.machineId, project.localProjectId);
|
|
172278
|
+
if (!originalRootPath) {
|
|
171708
172279
|
return {
|
|
171709
172280
|
ok: false,
|
|
171710
172281
|
error: "workspace_unavailable",
|
|
171711
172282
|
message: `Local project not found in workspace: ${project.localProjectId}`
|
|
171712
172283
|
};
|
|
171713
172284
|
}
|
|
172285
|
+
const isLocalWorktree = meta.isWorktree === true || project.useWorktree === true;
|
|
172286
|
+
if (!isLocalWorktree) {
|
|
172287
|
+
return {
|
|
172288
|
+
ok: true,
|
|
172289
|
+
workspaceRoot: originalRootPath,
|
|
172290
|
+
source: `local-project:${project.localProjectId}`,
|
|
172291
|
+
...ownerSessionIdField(ownerSessionId)
|
|
172292
|
+
};
|
|
172293
|
+
}
|
|
172294
|
+
const worktreeManager = getWorktreeManager({
|
|
172295
|
+
repoId: deriveRepoIdFromLocalProjectPath(originalRootPath),
|
|
172296
|
+
source: {
|
|
172297
|
+
kind: "local-shared",
|
|
172298
|
+
originalRootPath
|
|
172299
|
+
},
|
|
172300
|
+
logger: this.logger
|
|
172301
|
+
});
|
|
172302
|
+
if (worktreeManager.hasWorktree(ownerSessionId)) {
|
|
172303
|
+
return {
|
|
172304
|
+
ok: true,
|
|
172305
|
+
workspaceRoot: worktreeManager.getWorktreeHostPath(ownerSessionId),
|
|
172306
|
+
source: `local-worktree-existing:${ownerSessionId}`,
|
|
172307
|
+
...ownerSessionIdField(ownerSessionId)
|
|
172308
|
+
};
|
|
172309
|
+
}
|
|
172310
|
+
this.logCodeCollabDebug(`[${sessionId}] Code Collab v2 workspace resolution waiting for local worktree ownerSessionId=${ownerSessionId} project=${project.localProjectId}`);
|
|
172311
|
+
const waited = await waitForSessionWorkspaceRoot({
|
|
172312
|
+
targetSessionId: ownerSessionId,
|
|
172313
|
+
activeSource: ownerSessionId === sessionId ? "active-session-after-wait" : `active-parent-session:${ownerSessionId}`,
|
|
172314
|
+
pendingSource: ownerSessionId === sessionId ? "pending-session-after-wait" : `pending-parent-session:${ownerSessionId}`,
|
|
172315
|
+
timeoutMs: CODE_COLLAB_WORKSPACE_WAIT_TIMEOUT_MS
|
|
172316
|
+
});
|
|
172317
|
+
if (waited) {
|
|
172318
|
+
return waited.ok ? {
|
|
172319
|
+
...waited,
|
|
172320
|
+
...ownerSessionIdField(ownerSessionId)
|
|
172321
|
+
} : waited;
|
|
172322
|
+
}
|
|
172323
|
+
if (worktreeManager.hasWorktree(ownerSessionId)) {
|
|
172324
|
+
return {
|
|
172325
|
+
ok: true,
|
|
172326
|
+
workspaceRoot: worktreeManager.getWorktreeHostPath(ownerSessionId),
|
|
172327
|
+
source: `local-worktree-existing-after-wait:${ownerSessionId}`,
|
|
172328
|
+
...ownerSessionIdField(ownerSessionId)
|
|
172329
|
+
};
|
|
172330
|
+
}
|
|
171714
172331
|
return {
|
|
171715
|
-
ok:
|
|
171716
|
-
|
|
171717
|
-
|
|
171718
|
-
...ownerSessionIdField(ownerSessionId)
|
|
172332
|
+
ok: false,
|
|
172333
|
+
error: "session_initializing",
|
|
172334
|
+
message: "Session workspace is still being prepared. Code Collab will start after the session is ready."
|
|
171719
172335
|
};
|
|
171720
172336
|
}
|
|
171721
172337
|
if (meta.parentSessionId) {
|
|
@@ -173213,7 +173829,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
173213
173829
|
}
|
|
173214
173830
|
async authenticateMachineAcpAndResumeSetup(message, options = {}) {
|
|
173215
173831
|
const response2 = await this.executionService.authenticateMachineAcp(message, options);
|
|
173216
|
-
if (message.action === "start" &&
|
|
173832
|
+
if (message.action === "start" && response2.success && response2.disposition === "authenticated") {
|
|
173217
173833
|
try {
|
|
173218
173834
|
await this.providerSetupManager.resumeAfterAuthentication(message.configId);
|
|
173219
173835
|
} catch (error2) {
|
|
@@ -197157,7 +197773,7 @@ Shutting down gracefully${reason}...`);
|
|
|
197157
197773
|
function requireLib$1() {
|
|
197158
197774
|
if (hasRequiredLib$1) return lib$1;
|
|
197159
197775
|
hasRequiredLib$1 = 1;
|
|
197160
|
-
const Stream =
|
|
197776
|
+
const Stream = xo;
|
|
197161
197777
|
class MuteStream2 extends Stream {
|
|
197162
197778
|
#isTTY = null;
|
|
197163
197779
|
constructor(opts = {}) {
|
|
@@ -206635,7 +207251,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206635
207251
|
function requireStreams() {
|
|
206636
207252
|
if (hasRequiredStreams) return streams;
|
|
206637
207253
|
hasRequiredStreams = 1;
|
|
206638
|
-
var Buffer2 = require$$0$6.Buffer, Transform2 =
|
|
207254
|
+
var Buffer2 = require$$0$6.Buffer, Transform2 = xo.Transform;
|
|
206639
207255
|
streams = function(iconv2) {
|
|
206640
207256
|
iconv2.encodeStream = function encodeStream(encoding2, options) {
|
|
206641
207257
|
return new IconvLiteEncoderStream(iconv2.getEncoder(encoding2, options), options);
|
|
@@ -206855,7 +207471,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206855
207471
|
return length2;
|
|
206856
207472
|
};
|
|
206857
207473
|
if (iconv2.supportsStreams) {
|
|
206858
|
-
var Readable2 =
|
|
207474
|
+
var Readable2 = xo.Readable;
|
|
206859
207475
|
original.ReadableSetEncoding = Readable2.prototype.setEncoding;
|
|
206860
207476
|
Readable2.prototype.setEncoding = function setEncoding(enc, options) {
|
|
206861
207477
|
this._readableState.decoder = iconv2.getDecoder(enc, options);
|
|
@@ -206876,7 +207492,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206876
207492
|
Buffer2.prototype.toString = original.BufferToString;
|
|
206877
207493
|
Buffer2.prototype.write = original.BufferWrite;
|
|
206878
207494
|
if (iconv2.supportsStreams) {
|
|
206879
|
-
var Readable2 =
|
|
207495
|
+
var Readable2 = xo.Readable;
|
|
206880
207496
|
Readable2.prototype.setEncoding = original.ReadableSetEncoding;
|
|
206881
207497
|
delete Readable2.prototype.collect;
|
|
206882
207498
|
}
|
|
@@ -221554,7 +222170,7 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
|
221554
222170
|
data = createReviewBundleSnapshot(bundle);
|
|
221555
222171
|
}
|
|
221556
222172
|
const { injectReviewSnapshot } = await import("./chunks/index-VoI6Ds2-.js");
|
|
221557
|
-
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-
|
|
222173
|
+
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-HMN3RPEa.js").then(async (m) => {
|
|
221558
222174
|
await m.__tla;
|
|
221559
222175
|
return m;
|
|
221560
222176
|
});
|