lody 0.89.3 → 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-bQ2iglyz.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 +1461 -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"),
|
|
@@ -18437,6 +18594,13 @@ ${outputTail}` : blockTail.output;
|
|
|
18437
18594
|
"~/.cursor/skills"
|
|
18438
18595
|
]),
|
|
18439
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
|
+
]),
|
|
18440
18604
|
devin: skillDirs([
|
|
18441
18605
|
".devin/skills",
|
|
18442
18606
|
".windsurf/skills"
|
|
@@ -18520,6 +18684,17 @@ ${outputTail}` : blockTail.output;
|
|
|
18520
18684
|
"~/.config/goose/skills",
|
|
18521
18685
|
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18522
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
|
+
]),
|
|
18523
18698
|
"hermes-agent": skillDirs([
|
|
18524
18699
|
".hermes/skills"
|
|
18525
18700
|
], [
|
|
@@ -18578,16 +18753,25 @@ ${outputTail}` : blockTail.output;
|
|
|
18578
18753
|
]),
|
|
18579
18754
|
kimi: skillDirs([
|
|
18580
18755
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18581
|
-
".kimi/skills"
|
|
18582
|
-
], [
|
|
18756
|
+
".kimi-code/skills"
|
|
18757
|
+
], [
|
|
18758
|
+
"~/.kimi-code/skills",
|
|
18759
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18760
|
+
]),
|
|
18583
18761
|
"kimi-code": skillDirs([
|
|
18584
18762
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18585
|
-
".kimi/skills"
|
|
18586
|
-
], [
|
|
18763
|
+
".kimi-code/skills"
|
|
18764
|
+
], [
|
|
18765
|
+
"~/.kimi-code/skills",
|
|
18766
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18767
|
+
]),
|
|
18587
18768
|
"kimi-code-cli": skillDirs([
|
|
18588
18769
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18589
|
-
".kimi/skills"
|
|
18590
|
-
], [
|
|
18770
|
+
".kimi-code/skills"
|
|
18771
|
+
], [
|
|
18772
|
+
"~/.kimi-code/skills",
|
|
18773
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18774
|
+
]),
|
|
18591
18775
|
kode: skillDirs([
|
|
18592
18776
|
".kode/skills"
|
|
18593
18777
|
], [
|
|
@@ -18657,13 +18841,15 @@ ${outputTail}` : blockTail.output;
|
|
|
18657
18841
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18658
18842
|
".pi/skills"
|
|
18659
18843
|
], [
|
|
18660
|
-
"~/.pi/agent/skills"
|
|
18844
|
+
"~/.pi/agent/skills",
|
|
18845
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18661
18846
|
]),
|
|
18662
18847
|
"pi-acp": skillDirs([
|
|
18663
18848
|
DEFAULT_PROJECT_SKILL_DIR,
|
|
18664
18849
|
".pi/skills"
|
|
18665
18850
|
], [
|
|
18666
|
-
"~/.pi/agent/skills"
|
|
18851
|
+
"~/.pi/agent/skills",
|
|
18852
|
+
DEFAULT_AGENTS_GLOBAL_SKILL_DIR
|
|
18667
18853
|
]),
|
|
18668
18854
|
pochi: skillDirs([
|
|
18669
18855
|
".pochi/skills"
|
|
@@ -20686,14 +20872,17 @@ ${tailedOutput}` : null;
|
|
|
20686
20872
|
return parsed;
|
|
20687
20873
|
};
|
|
20688
20874
|
const MACHINE_PROTOCOL_CAPABILITIES = {
|
|
20875
|
+
acpAuthenticationInteractions: "acpAuthenticationInteractions",
|
|
20689
20876
|
localProjectRemoval: "localProjectRemoval",
|
|
20690
20877
|
providerSetup: "providerSetup",
|
|
20691
20878
|
acpProtocolAuthentication: "acpProtocolAuthentication"
|
|
20692
20879
|
};
|
|
20880
|
+
const ACP_AUTHENTICATION_INTERACTIONS_PROTOCOL_VERSION = 2;
|
|
20693
20881
|
const LOCAL_PROJECT_REMOVAL_PROTOCOL_VERSION = 1;
|
|
20694
20882
|
const PROVIDER_SETUP_PROTOCOL_VERSION = 1;
|
|
20695
|
-
const ACP_PROTOCOL_AUTHENTICATION_VERSION =
|
|
20883
|
+
const ACP_PROTOCOL_AUTHENTICATION_VERSION = 2;
|
|
20696
20884
|
const CURRENT_MACHINE_PROTOCOL_CAPABILITIES = {
|
|
20885
|
+
[MACHINE_PROTOCOL_CAPABILITIES.acpAuthenticationInteractions]: ACP_AUTHENTICATION_INTERACTIONS_PROTOCOL_VERSION,
|
|
20697
20886
|
[MACHINE_PROTOCOL_CAPABILITIES.localProjectRemoval]: LOCAL_PROJECT_REMOVAL_PROTOCOL_VERSION,
|
|
20698
20887
|
[MACHINE_PROTOCOL_CAPABILITIES.providerSetup]: PROVIDER_SETUP_PROTOCOL_VERSION,
|
|
20699
20888
|
[MACHINE_PROTOCOL_CAPABILITIES.acpProtocolAuthentication]: ACP_PROTOCOL_AUTHENTICATION_VERSION
|
|
@@ -20714,6 +20903,29 @@ ${tailedOutput}` : null;
|
|
|
20714
20903
|
}
|
|
20715
20904
|
return false;
|
|
20716
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
|
+
};
|
|
20717
20929
|
const resolveSessionConversationConfig = (history, messageQueue = []) => {
|
|
20718
20930
|
const resolveConfig = (value, sourceConfigKey) => {
|
|
20719
20931
|
const inputConfig = normalizeSessionTurnInputConfig(value);
|
|
@@ -20736,23 +20948,32 @@ ${tailedOutput}` : null;
|
|
|
20736
20948
|
} : {},
|
|
20737
20949
|
...typeof inputConfig.taskToolsEnabled === "boolean" ? {
|
|
20738
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
|
|
20739
20957
|
} : {}
|
|
20740
20958
|
};
|
|
20741
20959
|
};
|
|
20742
|
-
const
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
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
|
+
};
|
|
20754
20975
|
}
|
|
20755
|
-
return
|
|
20976
|
+
return resolved;
|
|
20756
20977
|
};
|
|
20757
20978
|
const resolveSessionMcpSelection = (history, messageQueue = []) => resolveSessionConversationConfig(history, messageQueue).mcpServerIds ?? [];
|
|
20758
20979
|
const resolveSessionTaskToolsEnabled = (history, messageQueue = []) => resolveSessionConversationConfig(history, messageQueue).taskToolsEnabled === true;
|
|
@@ -21000,6 +21221,12 @@ ${tailedOutput}` : null;
|
|
|
21000
21221
|
...args2.taskToolsEnabled !== void 0 ? {
|
|
21001
21222
|
taskToolsEnabled: args2.taskToolsEnabled === true
|
|
21002
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
|
+
} : {},
|
|
21003
21230
|
issuePRMentions: args2.issuePRMentions,
|
|
21004
21231
|
resume: args2.resume
|
|
21005
21232
|
};
|
|
@@ -23870,7 +24097,7 @@ ${context2.authorReply.trim()}
|
|
|
23870
24097
|
}
|
|
23871
24098
|
case "agentConfig": {
|
|
23872
24099
|
const config2 = normalizeAgentConfigMeta$1(value);
|
|
23873
|
-
return config2 ? {
|
|
24100
|
+
return config2 && config2.id === parsedKey.agentConfigId ? {
|
|
23874
24101
|
key: parsedKey.key,
|
|
23875
24102
|
value: config2
|
|
23876
24103
|
} : void 0;
|
|
@@ -26407,7 +26634,7 @@ ${context2.authorReply.trim()}
|
|
|
26407
26634
|
if (hasRequiredCommand$1) return command$1;
|
|
26408
26635
|
hasRequiredCommand$1 = 1;
|
|
26409
26636
|
const EventEmitter2 = require$$0$4.EventEmitter;
|
|
26410
|
-
const childProcess =
|
|
26637
|
+
const childProcess = Tw__default;
|
|
26411
26638
|
const path2 = path__default;
|
|
26412
26639
|
const fs2 = fs__default$1;
|
|
26413
26640
|
const process2 = process$2;
|
|
@@ -31349,7 +31576,7 @@ ${originalIndentation}`;
|
|
|
31349
31576
|
function requireStream$3() {
|
|
31350
31577
|
if (hasRequiredStream$3) return stream$3;
|
|
31351
31578
|
hasRequiredStream$3 = 1;
|
|
31352
|
-
stream$3 =
|
|
31579
|
+
stream$3 = xo;
|
|
31353
31580
|
return stream$3;
|
|
31354
31581
|
}
|
|
31355
31582
|
var destroy_1;
|
|
@@ -34940,7 +35167,7 @@ ${originalIndentation}`;
|
|
|
34940
35167
|
if (hasRequiredReadable$1) return readable$1.exports;
|
|
34941
35168
|
hasRequiredReadable$1 = 1;
|
|
34942
35169
|
(function(module2, exports$1) {
|
|
34943
|
-
var Stream =
|
|
35170
|
+
var Stream = xo;
|
|
34944
35171
|
if (process.env.READABLE_STREAM === "disable" && Stream) {
|
|
34945
35172
|
module2.exports = Stream.Readable;
|
|
34946
35173
|
Object.assign(module2.exports, Stream);
|
|
@@ -37846,7 +38073,7 @@ ${originalIndentation}`;
|
|
|
37846
38073
|
const fs2 = fs__default;
|
|
37847
38074
|
const path2 = path__default$1;
|
|
37848
38075
|
const asyncSeries = requireSeries();
|
|
37849
|
-
const zlib =
|
|
38076
|
+
const zlib = Ri__default;
|
|
37850
38077
|
const { MESSAGE } = requireTripleBeam();
|
|
37851
38078
|
const { Stream, PassThrough: PassThrough2 } = requireReadable$1();
|
|
37852
38079
|
const TransportStream = requireWinstonTransport();
|
|
@@ -44783,10 +45010,10 @@ ${originalIndentation}`;
|
|
|
44783
45010
|
const os2 = os__default$1;
|
|
44784
45011
|
const path2 = path__default$1;
|
|
44785
45012
|
const util2 = require$$0$5;
|
|
44786
|
-
const zlib =
|
|
45013
|
+
const zlib = Ri__default;
|
|
44787
45014
|
const hash2 = requireObjectHash();
|
|
44788
45015
|
const MESSAGE = requireTripleBeam().MESSAGE;
|
|
44789
|
-
const PassThrough2 =
|
|
45016
|
+
const PassThrough2 = xo.PassThrough;
|
|
44790
45017
|
const Transport = requireWinstonTransport();
|
|
44791
45018
|
const loggerDefaults = {
|
|
44792
45019
|
json: false,
|
|
@@ -45238,7 +45465,7 @@ ${value.slice(value.length - safeTailChars)}`;
|
|
|
45238
45465
|
return files;
|
|
45239
45466
|
}
|
|
45240
45467
|
async function readDailyLogFile(file2) {
|
|
45241
|
-
const raw2 = await
|
|
45468
|
+
const raw2 = await Xt__default.readFile(file2.path);
|
|
45242
45469
|
if (!file2.compressed) return raw2.toString("utf8");
|
|
45243
45470
|
return (await gunzip(raw2)).toString("utf8");
|
|
45244
45471
|
}
|
|
@@ -50156,7 +50383,7 @@ ${fromBody}`;
|
|
|
50156
50383
|
function isRecord$6(value) {
|
|
50157
50384
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50158
50385
|
}
|
|
50159
|
-
function asRecord$
|
|
50386
|
+
function asRecord$2(value) {
|
|
50160
50387
|
return isRecord$6(value) ? value : null;
|
|
50161
50388
|
}
|
|
50162
50389
|
function readSessionUserFromResponse(response2) {
|
|
@@ -50169,7 +50396,7 @@ ${fromBody}`;
|
|
|
50169
50396
|
return nested;
|
|
50170
50397
|
}
|
|
50171
50398
|
}
|
|
50172
|
-
const user = asRecord$
|
|
50399
|
+
const user = asRecord$2(response2.user);
|
|
50173
50400
|
const parsed = SessionUserSchema.safeParse(user);
|
|
50174
50401
|
if (!parsed.success) {
|
|
50175
50402
|
return null;
|
|
@@ -65153,7 +65380,7 @@ ${peerId}`;
|
|
|
65153
65380
|
function requirePermessageDeflate$1() {
|
|
65154
65381
|
if (hasRequiredPermessageDeflate$1) return permessageDeflate$1;
|
|
65155
65382
|
hasRequiredPermessageDeflate$1 = 1;
|
|
65156
|
-
const zlib =
|
|
65383
|
+
const zlib = Ri__default;
|
|
65157
65384
|
const bufferUtil2 = requireBufferUtil();
|
|
65158
65385
|
const Limiter = requireLimiter();
|
|
65159
65386
|
const { kStatusCode } = requireConstants$5();
|
|
@@ -65608,7 +65835,7 @@ ${peerId}`;
|
|
|
65608
65835
|
function requireReceiver$1() {
|
|
65609
65836
|
if (hasRequiredReceiver$1) return receiver$1;
|
|
65610
65837
|
hasRequiredReceiver$1 = 1;
|
|
65611
|
-
const { Writable } =
|
|
65838
|
+
const { Writable } = xo;
|
|
65612
65839
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
65613
65840
|
const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = requireConstants$5();
|
|
65614
65841
|
const { concat: concat2, toArrayBuffer: toArrayBuffer2, unmask } = requireBufferUtil();
|
|
@@ -65975,7 +66202,7 @@ ${peerId}`;
|
|
|
65975
66202
|
function requireSender$1() {
|
|
65976
66203
|
if (hasRequiredSender$1) return sender$1;
|
|
65977
66204
|
hasRequiredSender$1 = 1;
|
|
65978
|
-
const { Duplex } =
|
|
66205
|
+
const { Duplex } = xo;
|
|
65979
66206
|
const { randomFillSync: randomFillSync2 } = crypto__default;
|
|
65980
66207
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
65981
66208
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants$5();
|
|
@@ -66712,7 +66939,7 @@ ${peerId}`;
|
|
|
66712
66939
|
const net2 = require$$0$9;
|
|
66713
66940
|
const tls = require$$4$2;
|
|
66714
66941
|
const { randomBytes: randomBytes2, createHash: createHash2 } = crypto__default;
|
|
66715
|
-
const { Duplex, Readable: Readable2 } =
|
|
66942
|
+
const { Duplex, Readable: Readable2 } = xo;
|
|
66716
66943
|
const { URL: URL2 } = require$$7$2;
|
|
66717
66944
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
66718
66945
|
const Receiver = requireReceiver$1();
|
|
@@ -67450,7 +67677,7 @@ ${peerId}`;
|
|
|
67450
67677
|
if (hasRequiredStream$1) return stream$1;
|
|
67451
67678
|
hasRequiredStream$1 = 1;
|
|
67452
67679
|
requireWebsocket$1();
|
|
67453
|
-
const { Duplex } =
|
|
67680
|
+
const { Duplex } = xo;
|
|
67454
67681
|
function emitClose(stream2) {
|
|
67455
67682
|
stream2.emit("close");
|
|
67456
67683
|
}
|
|
@@ -67601,7 +67828,7 @@ ${peerId}`;
|
|
|
67601
67828
|
hasRequiredWebsocketServer = 1;
|
|
67602
67829
|
const EventEmitter2 = require$$0$7;
|
|
67603
67830
|
const http$12 = http;
|
|
67604
|
-
const { Duplex } =
|
|
67831
|
+
const { Duplex } = xo;
|
|
67605
67832
|
const { createHash: createHash2 } = crypto__default;
|
|
67606
67833
|
const extension2 = requireExtension();
|
|
67607
67834
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
@@ -101628,15 +101855,15 @@ ${value}`;
|
|
|
101628
101855
|
}
|
|
101629
101856
|
undiciDiagnosticsInstalled = true;
|
|
101630
101857
|
channel("undici:client:connected").subscribe((message) => {
|
|
101631
|
-
const record2 = asRecord(message);
|
|
101632
|
-
const socket = asRecord(record2?.socket);
|
|
101633
|
-
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);
|
|
101634
101861
|
const alpn = readString(socket, "alpnProtocol") ?? "unknown";
|
|
101635
101862
|
const origin = readString(connectParams, "origin") ?? readString(connectParams, "host") ?? readString(connectParams, "hostname") ?? "unknown";
|
|
101636
101863
|
logger2.debug(`[http-transport] undici connected origin=${sanitizeUrlForLogging(origin)} alpn=${alpn}`);
|
|
101637
101864
|
});
|
|
101638
101865
|
channel("undici:proxy:connected").subscribe((message) => {
|
|
101639
|
-
const record2 = asRecord(message);
|
|
101866
|
+
const record2 = asRecord$1(message);
|
|
101640
101867
|
const proxy = readString(record2, "proxy") ?? readString(record2, "origin") ?? "configured";
|
|
101641
101868
|
logger2.debug(`[http-transport] undici proxy connected proxy=${sanitizeUrlForLogging(proxy)}`);
|
|
101642
101869
|
});
|
|
@@ -101672,7 +101899,7 @@ ${value}`;
|
|
|
101672
101899
|
const parsed = Number.parseInt(value, 10);
|
|
101673
101900
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback2;
|
|
101674
101901
|
}
|
|
101675
|
-
function asRecord(value) {
|
|
101902
|
+
function asRecord$1(value) {
|
|
101676
101903
|
return typeof value === "object" && value !== null ? value : null;
|
|
101677
101904
|
}
|
|
101678
101905
|
function readString(record2, key2) {
|
|
@@ -101931,7 +102158,7 @@ ${value}`;
|
|
|
101931
102158
|
return "internal";
|
|
101932
102159
|
}
|
|
101933
102160
|
}
|
|
101934
|
-
async function withDeadline
|
|
102161
|
+
async function withDeadline(operation, options) {
|
|
101935
102162
|
const { timeoutMs, signal } = options;
|
|
101936
102163
|
if (timeoutMs === void 0 && !signal) return operation;
|
|
101937
102164
|
if (signal?.aborted) options.onAbort();
|
|
@@ -102263,7 +102490,7 @@ ${value}`;
|
|
|
102263
102490
|
});
|
|
102264
102491
|
}
|
|
102265
102492
|
awaitWithDeadline(operation, options, ctx) {
|
|
102266
|
-
return withDeadline
|
|
102493
|
+
return withDeadline(operation, {
|
|
102267
102494
|
timeoutMs: options?.timeout,
|
|
102268
102495
|
signal: options?.signal,
|
|
102269
102496
|
onTimeout: () => {
|
|
@@ -103718,6 +103945,21 @@ ${value}`;
|
|
|
103718
103945
|
...entry,
|
|
103719
103946
|
inputConfig: normalizeSessionTurnInputConfig(entry.inputConfig)
|
|
103720
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
|
+
};
|
|
103721
103963
|
const localLoroDataPlaneScheduler = createLocalLoroDataPlaneScheduler((work) => {
|
|
103722
103964
|
const handle = setImmediate(work);
|
|
103723
103965
|
return () => clearImmediate(handle);
|
|
@@ -104460,6 +104702,24 @@ ${value}`;
|
|
|
104460
104702
|
const configs = await listMergedAgentConfigs(this.repo, this.workspaceId);
|
|
104461
104703
|
return configs.find((config2) => config2.id === agentConfigId) ?? null;
|
|
104462
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
|
+
}
|
|
104463
104723
|
async createAgentConfig(cliType, agentType, machineId, name2) {
|
|
104464
104724
|
const agentConfigId = v4();
|
|
104465
104725
|
await upsertMachineAgentConfig(this.repo, this.workspaceId, {
|
|
@@ -105886,6 +106146,7 @@ ${value}`;
|
|
|
105886
106146
|
return pair;
|
|
105887
106147
|
};
|
|
105888
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}`;
|
|
105889
106150
|
const createRpcSecretRecipient = async () => {
|
|
105890
106151
|
const pair = await createKeyPair();
|
|
105891
106152
|
const keyIdBytes = new Uint8Array(16);
|
|
@@ -106035,12 +106296,7 @@ ${value}`;
|
|
|
106035
106296
|
const LoroMachineAcpCapabilitiesRefreshRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106036
106297
|
method: literal$1("machine/acp-capabilities-refresh"),
|
|
106037
106298
|
params: object$1({
|
|
106038
|
-
configId: AgentConfigIdSchema
|
|
106039
|
-
cliType: AgentConfigCliTypeSchema,
|
|
106040
|
-
agentType: string$1().trim().min(1),
|
|
106041
|
-
customAcp: CustomAcpLaunchSpecSchema.optional(),
|
|
106042
|
-
runtimeOverrides: BuiltinRuntimeOverridesSchema.optional(),
|
|
106043
|
-
env: record$1(string$1(), string$1()).optional()
|
|
106299
|
+
configId: AgentConfigIdSchema
|
|
106044
106300
|
}).strict()
|
|
106045
106301
|
}).strict();
|
|
106046
106302
|
const LoroMachineAcpCapabilitiesRefreshCancelRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
@@ -106051,37 +106307,31 @@ ${value}`;
|
|
|
106051
106307
|
}).strict();
|
|
106052
106308
|
const LoroMachineAcpAuthenticateRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106053
106309
|
method: literal$1("machine/acp-authenticate"),
|
|
106054
|
-
params:
|
|
106055
|
-
|
|
106056
|
-
|
|
106057
|
-
"start",
|
|
106058
|
-
|
|
106059
|
-
|
|
106060
|
-
|
|
106061
|
-
|
|
106062
|
-
|
|
106063
|
-
|
|
106064
|
-
|
|
106065
|
-
|
|
106066
|
-
|
|
106067
|
-
|
|
106068
|
-
|
|
106069
|
-
|
|
106070
|
-
|
|
106071
|
-
|
|
106072
|
-
|
|
106073
|
-
|
|
106074
|
-
|
|
106075
|
-
|
|
106076
|
-
|
|
106077
|
-
|
|
106078
|
-
|
|
106079
|
-
context2.addIssue({
|
|
106080
|
-
code: "custom",
|
|
106081
|
-
message: "Authorization-code fields are only valid for submit-code"
|
|
106082
|
-
});
|
|
106083
|
-
}
|
|
106084
|
-
})
|
|
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
|
+
])
|
|
106085
106335
|
}).strict();
|
|
106086
106336
|
const LoroMachineAcpBinaryStatusRpcRequestSchema = BaseRpcRequestSchema.extend({
|
|
106087
106337
|
method: literal$1("machine/acp-binary-status"),
|
|
@@ -107393,18 +107643,14 @@ ${value}`;
|
|
|
107393
107643
|
onAcpBinaryProgress: options.onProgress,
|
|
107394
107644
|
signal: options.signal,
|
|
107395
107645
|
params: {
|
|
107396
|
-
configId: options.configId
|
|
107397
|
-
cliType: options.cliType,
|
|
107398
|
-
agentType: options.agentType,
|
|
107399
|
-
customAcp: options.customAcp,
|
|
107400
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
107401
|
-
env: options.env
|
|
107646
|
+
configId: options.configId
|
|
107402
107647
|
}
|
|
107403
107648
|
});
|
|
107404
107649
|
}
|
|
107405
107650
|
async requestMachineAcpAuthenticate(options) {
|
|
107406
|
-
const authenticationRequestId = options.authenticationRequestId;
|
|
107651
|
+
const authenticationRequestId = options.action === "start" ? void 0 : options.authenticationRequestId;
|
|
107407
107652
|
let authorizationCodeEnvelope;
|
|
107653
|
+
let authenticationInputEnvelope;
|
|
107408
107654
|
if (options.action === "submit-code") {
|
|
107409
107655
|
if (!authenticationRequestId || !options.authorizationCode?.trim() || options.authorizationCode.length > 4096) {
|
|
107410
107656
|
throw new Error("Submitting an authorization code requires an authentication request.");
|
|
@@ -107419,36 +107665,79 @@ ${value}`;
|
|
|
107419
107665
|
authenticationRequestId
|
|
107420
107666
|
}));
|
|
107421
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
|
+
}
|
|
107422
107683
|
const onProgress = (progress) => {
|
|
107423
|
-
|
|
107424
|
-
|
|
107684
|
+
const inputPublicKey = progress.authenticationInputPublicKey ?? progress.authorizationCodePublicKey;
|
|
107685
|
+
if (inputPublicKey) {
|
|
107686
|
+
this.acpAuthorizationCodePublicKeys.set(progress.requestId, inputPublicKey);
|
|
107425
107687
|
}
|
|
107426
107688
|
options.onProgress?.(progress);
|
|
107427
107689
|
};
|
|
107428
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
|
+
})();
|
|
107429
107730
|
return await this.sendRequest({
|
|
107430
107731
|
method: "machine/acp-authenticate",
|
|
107431
107732
|
timeoutMs: options.timeoutMs ?? 3e5,
|
|
107432
107733
|
onAcpAuthenticationProgress: onProgress,
|
|
107433
|
-
params
|
|
107434
|
-
requestId: options.requestId,
|
|
107435
|
-
action: options.action,
|
|
107436
|
-
authenticationRequestId,
|
|
107437
|
-
authorizationCodeEnvelope,
|
|
107438
|
-
...options.methodId ? {
|
|
107439
|
-
methodId: options.methodId
|
|
107440
|
-
} : {},
|
|
107441
|
-
configId: options.configId,
|
|
107442
|
-
cliType: options.cliType,
|
|
107443
|
-
agentType: options.agentType,
|
|
107444
|
-
customAcp: options.customAcp,
|
|
107445
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
107446
|
-
env: options.env
|
|
107447
|
-
}
|
|
107734
|
+
params
|
|
107448
107735
|
});
|
|
107449
107736
|
} finally {
|
|
107450
|
-
if (options.action === "start"
|
|
107737
|
+
if (options.action === "start") {
|
|
107451
107738
|
this.acpAuthorizationCodePublicKeys.delete(options.requestId);
|
|
107739
|
+
} else if (options.action === "cancel") {
|
|
107740
|
+
this.acpAuthorizationCodePublicKeys.delete(options.authenticationRequestId);
|
|
107452
107741
|
}
|
|
107453
107742
|
}
|
|
107454
107743
|
}
|
|
@@ -107813,8 +108102,8 @@ ${value}`;
|
|
|
107813
108102
|
timeoutMs,
|
|
107814
108103
|
refreshContext: args2.method === "machine/acp-capabilities-refresh" ? {
|
|
107815
108104
|
configId: args2.params.configId,
|
|
107816
|
-
cliType:
|
|
107817
|
-
agentType:
|
|
108105
|
+
cliType: "builtin",
|
|
108106
|
+
agentType: "unknown"
|
|
107818
108107
|
} : void 0,
|
|
107819
108108
|
pingContext: args2.method === "machine/ping" ? {
|
|
107820
108109
|
requestId: args2.params.requestId
|
|
@@ -107826,7 +108115,7 @@ ${value}`;
|
|
|
107826
108115
|
requestId: args2.params.requestId
|
|
107827
108116
|
} : void 0,
|
|
107828
108117
|
binaryContext: args2.method === "machine/acp-authenticate" ? {
|
|
107829
|
-
agentType:
|
|
108118
|
+
agentType: "unknown",
|
|
107830
108119
|
requestId: args2.params.requestId
|
|
107831
108120
|
} : args2.method === "machine/acp-binary-status" || args2.method === "machine/acp-binary-install" ? {
|
|
107832
108121
|
agentType: args2.params.agentType
|
|
@@ -108241,14 +108530,29 @@ ${value}`;
|
|
|
108241
108530
|
const redactRpcRequestForLog = (raw2) => {
|
|
108242
108531
|
if (typeof raw2 !== "object" || raw2 === null) return raw2;
|
|
108243
108532
|
const request2 = raw2;
|
|
108244
|
-
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) {
|
|
108245
108534
|
return raw2;
|
|
108246
108535
|
}
|
|
108536
|
+
const params = request2.params;
|
|
108247
108537
|
return {
|
|
108248
108538
|
...request2,
|
|
108249
108539
|
params: {
|
|
108250
|
-
...
|
|
108251
|
-
|
|
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
|
+
} : {}
|
|
108252
108556
|
}
|
|
108253
108557
|
};
|
|
108254
108558
|
};
|
|
@@ -108493,7 +108797,7 @@ ${value}`;
|
|
|
108493
108797
|
return false;
|
|
108494
108798
|
}
|
|
108495
108799
|
const action = request2.params.action;
|
|
108496
|
-
return action === "cancel" || action === "submit-code";
|
|
108800
|
+
return action === "cancel" || action === "submit-code" || action === "submit-input";
|
|
108497
108801
|
}
|
|
108498
108802
|
async runRequestTask(raw2, lane, options) {
|
|
108499
108803
|
if (options?.deferredAcquire) {
|
|
@@ -108607,11 +108911,6 @@ ${value}`;
|
|
|
108607
108911
|
};
|
|
108608
108912
|
const response2 = await this.deps.refreshMachineAcpCapabilities({
|
|
108609
108913
|
configId: request2.params.configId,
|
|
108610
|
-
cliType: request2.params.cliType,
|
|
108611
|
-
agentType: request2.params.agentType,
|
|
108612
|
-
customAcp: request2.params.customAcp,
|
|
108613
|
-
runtimeOverrides: request2.params.runtimeOverrides,
|
|
108614
|
-
env: request2.params.env,
|
|
108615
108914
|
onAcpBinaryProgress: appendProgress,
|
|
108616
108915
|
signal: controller.signal
|
|
108617
108916
|
});
|
|
@@ -108648,19 +108947,23 @@ ${value}`;
|
|
|
108648
108947
|
}
|
|
108649
108948
|
let progressWrites = Promise.resolve();
|
|
108650
108949
|
const appendProgress = (progress) => {
|
|
108651
|
-
const
|
|
108950
|
+
const acceptsInteractionInput = progress.status === "auth-methods" || progress.status === "input-required" || progress.requiresAuthorizationConsent === true;
|
|
108951
|
+
const safeProgress = recipient && (progress.acceptsAuthorizationCode || acceptsInteractionInput) ? {
|
|
108652
108952
|
...progress,
|
|
108653
|
-
|
|
108953
|
+
...progress.acceptsAuthorizationCode ? {
|
|
108954
|
+
authorizationCodePublicKey: recipient.publicKey
|
|
108955
|
+
} : {},
|
|
108956
|
+
...acceptsInteractionInput ? {
|
|
108957
|
+
authenticationInputPublicKey: recipient.publicKey
|
|
108958
|
+
} : {}
|
|
108654
108959
|
} : progress;
|
|
108655
108960
|
progressWrites = progressWrites.then(() => this.appendResultResponse(request2.replyTo, request2.id, request2.method, safeProgress)).catch(() => void 0);
|
|
108656
108961
|
};
|
|
108657
108962
|
let authorizationCode;
|
|
108963
|
+
let authenticationInput;
|
|
108658
108964
|
if (request2.params.action === "submit-code") {
|
|
108659
108965
|
const authenticationRequestId = request2.params.authenticationRequestId;
|
|
108660
108966
|
const authorizationCodeEnvelope = request2.params.authorizationCodeEnvelope;
|
|
108661
|
-
if (!authenticationRequestId || !authorizationCodeEnvelope) {
|
|
108662
|
-
throw new Error("Missing encrypted authorization-code input.");
|
|
108663
|
-
}
|
|
108664
108967
|
const activeRecipient = this.acpAuthorizationCodeRecipients.get(authenticationRequestId);
|
|
108665
108968
|
if (!activeRecipient) {
|
|
108666
108969
|
throw new Error("Authorization-code recipient is no longer active.");
|
|
@@ -108674,27 +108977,79 @@ ${value}`;
|
|
|
108674
108977
|
throw new Error("Invalid decrypted authorization-code input.");
|
|
108675
108978
|
}
|
|
108676
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
|
+
}
|
|
108677
108998
|
try {
|
|
108678
|
-
const response2 = await
|
|
108679
|
-
|
|
108680
|
-
|
|
108681
|
-
|
|
108682
|
-
|
|
108683
|
-
|
|
108684
|
-
|
|
108685
|
-
|
|
108686
|
-
|
|
108687
|
-
|
|
108688
|
-
|
|
108689
|
-
|
|
108690
|
-
|
|
108691
|
-
|
|
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
|
+
}
|
|
108692
109045
|
await progressWrites;
|
|
108693
109046
|
await this.appendResultResponse(request2.replyTo, request2.id, request2.method, response2);
|
|
108694
109047
|
return;
|
|
108695
109048
|
} finally {
|
|
108696
|
-
if (isStart
|
|
109049
|
+
if (isStart) {
|
|
108697
109050
|
this.acpAuthorizationCodeRecipients.delete(request2.params.requestId);
|
|
109051
|
+
} else if (request2.params.action === "cancel") {
|
|
109052
|
+
this.acpAuthorizationCodeRecipients.delete(request2.params.authenticationRequestId);
|
|
108698
109053
|
}
|
|
108699
109054
|
}
|
|
108700
109055
|
}
|
|
@@ -109435,12 +109790,7 @@ ${value}`;
|
|
|
109435
109790
|
type: "machine/acp-capabilities-refresh",
|
|
109436
109791
|
machineId: this.machineId,
|
|
109437
109792
|
workspaceId: this.workspaceId,
|
|
109438
|
-
configId: verifying.config.id
|
|
109439
|
-
cliType: verifying.config.cliType,
|
|
109440
|
-
agentType: verifying.config.agentType,
|
|
109441
|
-
customAcp: verifying.config.customAcp,
|
|
109442
|
-
runtimeOverrides: verifying.config.runtimeOverrides,
|
|
109443
|
-
env: verifying.config.env
|
|
109793
|
+
configId: verifying.config.id
|
|
109444
109794
|
});
|
|
109445
109795
|
if (response2.success) {
|
|
109446
109796
|
await this.publishVerifiedConfig(verifying.id, attempt);
|
|
@@ -109864,20 +110214,20 @@ ${value}`;
|
|
|
109864
110214
|
};
|
|
109865
110215
|
const parsed = DaemonUpgradeIntentSchema.parse(value);
|
|
109866
110216
|
const dir = path.dirname(DAEMON_UPGRADE_INTENT_FILE);
|
|
109867
|
-
await
|
|
110217
|
+
await Xt.mkdir(dir, {
|
|
109868
110218
|
recursive: true
|
|
109869
110219
|
});
|
|
109870
110220
|
const tmpPath = path.join(dir, `.${path.basename(DAEMON_UPGRADE_INTENT_FILE)}.${process.pid}.tmp`);
|
|
109871
|
-
await
|
|
110221
|
+
await Xt.writeFile(tmpPath, `${JSON.stringify(parsed, null, 2)}
|
|
109872
110222
|
`, {
|
|
109873
110223
|
encoding: "utf8",
|
|
109874
110224
|
mode: 384
|
|
109875
110225
|
});
|
|
109876
|
-
await
|
|
110226
|
+
await Xt.rename(tmpPath, DAEMON_UPGRADE_INTENT_FILE);
|
|
109877
110227
|
};
|
|
109878
110228
|
const readDaemonUpgradeIntent = async () => {
|
|
109879
110229
|
try {
|
|
109880
|
-
const raw2 = await
|
|
110230
|
+
const raw2 = await Xt.readFile(DAEMON_UPGRADE_INTENT_FILE, "utf8");
|
|
109881
110231
|
const parsed = DaemonUpgradeIntentSchema.safeParse(JSON.parse(raw2));
|
|
109882
110232
|
return parsed.success ? parsed.data : null;
|
|
109883
110233
|
} catch {
|
|
@@ -109886,7 +110236,7 @@ ${value}`;
|
|
|
109886
110236
|
};
|
|
109887
110237
|
const clearDaemonUpgradeIntent = async () => {
|
|
109888
110238
|
try {
|
|
109889
|
-
await
|
|
110239
|
+
await Xt.unlink(DAEMON_UPGRADE_INTENT_FILE);
|
|
109890
110240
|
} catch {
|
|
109891
110241
|
}
|
|
109892
110242
|
};
|
|
@@ -117523,7 +117873,7 @@ ${error2.message}` : execaMessage;
|
|
|
117523
117873
|
function requireBufferStream() {
|
|
117524
117874
|
if (hasRequiredBufferStream) return bufferStream;
|
|
117525
117875
|
hasRequiredBufferStream = 1;
|
|
117526
|
-
const { PassThrough: PassThroughStream } =
|
|
117876
|
+
const { PassThrough: PassThroughStream } = xo;
|
|
117527
117877
|
bufferStream = (options) => {
|
|
117528
117878
|
options = {
|
|
117529
117879
|
...options
|
|
@@ -117572,7 +117922,7 @@ ${error2.message}` : execaMessage;
|
|
|
117572
117922
|
if (hasRequiredGetStream) return getStream.exports;
|
|
117573
117923
|
hasRequiredGetStream = 1;
|
|
117574
117924
|
const { constants: BufferConstants } = require$$0$6;
|
|
117575
|
-
const stream2 =
|
|
117925
|
+
const stream2 = xo;
|
|
117576
117926
|
const { promisify: promisify2 } = require$$0$5;
|
|
117577
117927
|
const bufferStream2 = requireBufferStream();
|
|
117578
117928
|
const streamPipelinePromisified = promisify2(stream2.pipeline);
|
|
@@ -117632,7 +117982,7 @@ ${error2.message}` : execaMessage;
|
|
|
117632
117982
|
function requireMergeStream() {
|
|
117633
117983
|
if (hasRequiredMergeStream) return mergeStream;
|
|
117634
117984
|
hasRequiredMergeStream = 1;
|
|
117635
|
-
const { PassThrough: PassThrough2 } =
|
|
117985
|
+
const { PassThrough: PassThrough2 } = xo;
|
|
117636
117986
|
mergeStream = function() {
|
|
117637
117987
|
var sources = [];
|
|
117638
117988
|
var output = new PassThrough2({
|
|
@@ -119363,7 +119713,7 @@ ${error2.message}` : execaMessage;
|
|
|
119363
119713
|
validate: validate2
|
|
119364
119714
|
});
|
|
119365
119715
|
};
|
|
119366
|
-
const realZlibConstants =
|
|
119716
|
+
const realZlibConstants = Ri__default.constants || {
|
|
119367
119717
|
ZLIB_VERNUM: 4736
|
|
119368
119718
|
};
|
|
119369
119719
|
const constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
@@ -119523,11 +119873,11 @@ ${error2.message}` : execaMessage;
|
|
|
119523
119873
|
this.#flushFlag = opts.flush ?? 0;
|
|
119524
119874
|
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
|
119525
119875
|
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
|
119526
|
-
if (typeof
|
|
119876
|
+
if (typeof Ri[mode2] !== "function") {
|
|
119527
119877
|
throw new TypeError("Compression method not supported: " + mode2);
|
|
119528
119878
|
}
|
|
119529
119879
|
try {
|
|
119530
|
-
this.#handle = new
|
|
119880
|
+
this.#handle = new Ri[mode2](opts);
|
|
119531
119881
|
} catch (er) {
|
|
119532
119882
|
throw new ZlibError(er, this.constructor);
|
|
119533
119883
|
}
|
|
@@ -122542,7 +122892,7 @@ ${error2.message}` : execaMessage;
|
|
|
122542
122892
|
return checkCwd(dir, done2);
|
|
122543
122893
|
}
|
|
122544
122894
|
if (preserve) {
|
|
122545
|
-
return
|
|
122895
|
+
return Xt__default.mkdir(dir, {
|
|
122546
122896
|
mode: mode2,
|
|
122547
122897
|
recursive: true
|
|
122548
122898
|
}).then((made) => done2(null, made ?? void 0), done2);
|
|
@@ -123792,7 +124142,7 @@ ${error2.message}` : execaMessage;
|
|
|
123792
124142
|
hasRequiredFdSlicer = 1;
|
|
123793
124143
|
var fs2 = fs__default;
|
|
123794
124144
|
var util2 = require$$0$5;
|
|
123795
|
-
var stream2 =
|
|
124145
|
+
var stream2 = xo;
|
|
123796
124146
|
var Readable2 = stream2.Readable;
|
|
123797
124147
|
var Writable = stream2.Writable;
|
|
123798
124148
|
var PassThrough2 = stream2.PassThrough;
|
|
@@ -124358,14 +124708,14 @@ ${error2.message}` : execaMessage;
|
|
|
124358
124708
|
if (hasRequiredYauzl) return yauzl;
|
|
124359
124709
|
hasRequiredYauzl = 1;
|
|
124360
124710
|
var fs2 = fs__default;
|
|
124361
|
-
var zlib =
|
|
124711
|
+
var zlib = Ri__default;
|
|
124362
124712
|
var fd_slicer = requireFdSlicer();
|
|
124363
124713
|
var crc322 = requireBufferCrc32();
|
|
124364
124714
|
var util2 = require$$0$5;
|
|
124365
124715
|
var EventEmitter2 = require$$0$7.EventEmitter;
|
|
124366
|
-
var Transform2 =
|
|
124367
|
-
var PassThrough2 =
|
|
124368
|
-
var Writable =
|
|
124716
|
+
var Transform2 = xo.Transform;
|
|
124717
|
+
var PassThrough2 = xo.PassThrough;
|
|
124718
|
+
var Writable = xo.Writable;
|
|
124369
124719
|
yauzl.open = open2;
|
|
124370
124720
|
yauzl.fromFd = fromFd;
|
|
124371
124721
|
yauzl.fromBuffer = fromBuffer;
|
|
@@ -125806,99 +126156,99 @@ ${error2.message}` : execaMessage;
|
|
|
125806
126156
|
const grokPackageJson = {
|
|
125807
126157
|
version: version$6
|
|
125808
126158
|
};
|
|
125809
|
-
const version$5 = "2.1.
|
|
126159
|
+
const version$5 = "2.1.258";
|
|
125810
126160
|
const platforms = {
|
|
125811
126161
|
"darwin-arm64": {
|
|
125812
126162
|
"binary": "claude",
|
|
125813
|
-
"checksum": "
|
|
125814
|
-
"size":
|
|
126163
|
+
"checksum": "b63136194160791c27cfa7b0403060d85eb0752991625fde8c09f9acacb17c78",
|
|
126164
|
+
"size": 199027600
|
|
125815
126165
|
},
|
|
125816
126166
|
"darwin-x64": {
|
|
125817
126167
|
"binary": "claude",
|
|
125818
|
-
"checksum": "
|
|
125819
|
-
"size":
|
|
126168
|
+
"checksum": "c857db5cd712865623bd61e806cf3f7e8e279c9e5c7c0af5eca06ca6717fc7fb",
|
|
126169
|
+
"size": 207778640
|
|
125820
126170
|
},
|
|
125821
126171
|
"linux-arm64": {
|
|
125822
126172
|
"binary": "claude",
|
|
125823
|
-
"checksum": "
|
|
125824
|
-
"size":
|
|
126173
|
+
"checksum": "43dc490af55262edcb3e9b1cb315de22cc09ccb08bd52a4c39bc5eabaa63100f",
|
|
126174
|
+
"size": 215014736
|
|
125825
126175
|
},
|
|
125826
126176
|
"linux-x64": {
|
|
125827
126177
|
"binary": "claude",
|
|
125828
|
-
"checksum": "
|
|
125829
|
-
"size":
|
|
126178
|
+
"checksum": "704f1334ac65d3e89e1c6c1d7663293ad786a6166afdb71b5075337df630f976",
|
|
126179
|
+
"size": 215473560
|
|
125830
126180
|
},
|
|
125831
126181
|
"linux-arm64-musl": {
|
|
125832
126182
|
"binary": "claude",
|
|
125833
|
-
"checksum": "
|
|
125834
|
-
"size":
|
|
126183
|
+
"checksum": "d3bef6ba403fe3efba684fa93e1bb26bc7a08c054bd516639d54e77c77bb9821",
|
|
126184
|
+
"size": 207894168
|
|
125835
126185
|
},
|
|
125836
126186
|
"linux-x64-musl": {
|
|
125837
126187
|
"binary": "claude",
|
|
125838
|
-
"checksum": "
|
|
125839
|
-
"size":
|
|
126188
|
+
"checksum": "e74a226cf174d911664aff982486c55ca770d9c00007e52e86b13d10bae72af3",
|
|
126189
|
+
"size": 209493960
|
|
125840
126190
|
},
|
|
125841
126191
|
"win32-x64": {
|
|
125842
126192
|
"binary": "claude.exe",
|
|
125843
|
-
"checksum": "
|
|
125844
|
-
"size":
|
|
126193
|
+
"checksum": "22f5f3a44093e14c75a4d1c8ce25c730b21dd634318fbe3268e9057d12b17c41",
|
|
126194
|
+
"size": 218507936
|
|
125845
126195
|
},
|
|
125846
126196
|
"win32-arm64": {
|
|
125847
126197
|
"binary": "claude.exe",
|
|
125848
|
-
"checksum": "
|
|
125849
|
-
"size":
|
|
126198
|
+
"checksum": "42675c431b6014ad7243fea0ed0e371045dedc89d94aac81a9a0f528e644ed97",
|
|
126199
|
+
"size": 209548960
|
|
125850
126200
|
}
|
|
125851
126201
|
};
|
|
125852
126202
|
const claudeSdkManifestJson = {
|
|
125853
126203
|
version: version$5,
|
|
125854
126204
|
platforms
|
|
125855
126205
|
};
|
|
125856
|
-
const version$4 = "0.3.
|
|
126206
|
+
const version$4 = "0.3.258";
|
|
125857
126207
|
const claudeSdkPackageJson = {
|
|
125858
126208
|
version: version$4
|
|
125859
126209
|
};
|
|
125860
|
-
const sdkVersion = "0.3.
|
|
125861
|
-
const version$3 = "2.1.
|
|
126210
|
+
const sdkVersion = "0.3.258";
|
|
126211
|
+
const version$3 = "2.1.258";
|
|
125862
126212
|
const artifacts$1 = {
|
|
125863
126213
|
"darwin-arm64": {
|
|
125864
|
-
"fileName": "anthropic-ai-claude-agent-sdk-darwin-arm64-0.3.
|
|
125865
|
-
"sha256": "
|
|
125866
|
-
"size":
|
|
126214
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-arm64-0.3.258.tar.zst",
|
|
126215
|
+
"sha256": "dd01a1ae8868c41ac7755e89fa4fc087d28e265b6d7ab122c18317dfd7023ed2",
|
|
126216
|
+
"size": 73550133
|
|
125867
126217
|
},
|
|
125868
126218
|
"darwin-x64": {
|
|
125869
|
-
"fileName": "anthropic-ai-claude-agent-sdk-darwin-x64-0.3.
|
|
125870
|
-
"sha256": "
|
|
125871
|
-
"size":
|
|
126219
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-x64-0.3.258.tar.zst",
|
|
126220
|
+
"sha256": "f46392ec768822fca40d61f6986d7d293a42b3ee5820b0c1a6c14bee474fdb02",
|
|
126221
|
+
"size": 77362894
|
|
125872
126222
|
},
|
|
125873
126223
|
"linux-arm64": {
|
|
125874
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-0.3.
|
|
125875
|
-
"sha256": "
|
|
125876
|
-
"size":
|
|
126224
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-0.3.258.tar.zst",
|
|
126225
|
+
"sha256": "b2df6e0ac548e348a1609d5cba8c1c22c8f4f98b9a3ab54f5ce2082ff96db0f2",
|
|
126226
|
+
"size": 83313235
|
|
125877
126227
|
},
|
|
125878
126228
|
"linux-x64": {
|
|
125879
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-0.3.
|
|
125880
|
-
"sha256": "
|
|
125881
|
-
"size":
|
|
126229
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-0.3.258.tar.zst",
|
|
126230
|
+
"sha256": "ea9bfd7a1cfe218b9c9451450401d654711787bf1972b8a22d3b5f7b495a73f8",
|
|
126231
|
+
"size": 83414920
|
|
125882
126232
|
},
|
|
125883
126233
|
"linux-arm64-musl": {
|
|
125884
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-musl-0.3.
|
|
125885
|
-
"sha256": "
|
|
125886
|
-
"size":
|
|
126234
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-musl-0.3.258.tar.zst",
|
|
126235
|
+
"sha256": "9293b47fd63fa6f368fe0a9fa2930fd6963e6108e65b34584f854919df7f227b",
|
|
126236
|
+
"size": 81542174
|
|
125887
126237
|
},
|
|
125888
126238
|
"linux-x64-musl": {
|
|
125889
|
-
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-musl-0.3.
|
|
125890
|
-
"sha256": "
|
|
125891
|
-
"size":
|
|
126239
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-musl-0.3.258.tar.zst",
|
|
126240
|
+
"sha256": "ba0e031ff3266f41d73a28effc25d4334d992891b0495542ca7cf3b2a75632c8",
|
|
126241
|
+
"size": 81733248
|
|
125892
126242
|
},
|
|
125893
126243
|
"win32-arm64": {
|
|
125894
|
-
"fileName": "anthropic-ai-claude-agent-sdk-win32-arm64-0.3.
|
|
125895
|
-
"sha256": "
|
|
125896
|
-
"size":
|
|
126244
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-arm64-0.3.258.tar.zst",
|
|
126245
|
+
"sha256": "13cd9e1ad2958bc8dbaaf908362852136b63f8ce4f452beade38d0323a40774d",
|
|
126246
|
+
"size": 83257894
|
|
125897
126247
|
},
|
|
125898
126248
|
"win32-x64": {
|
|
125899
|
-
"fileName": "anthropic-ai-claude-agent-sdk-win32-x64-0.3.
|
|
125900
|
-
"sha256": "
|
|
125901
|
-
"size":
|
|
126249
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-x64-0.3.258.tar.zst",
|
|
126250
|
+
"sha256": "ae93d318561a4c069d7074726d345224b588e1b3b0a6955b604f6a06ec0c3195",
|
|
126251
|
+
"size": 86357676
|
|
125902
126252
|
}
|
|
125903
126253
|
};
|
|
125904
126254
|
const claudeRuntimeManifestJson = {
|
|
@@ -127788,19 +128138,33 @@ ${error2.message}` : execaMessage;
|
|
|
127788
128138
|
let streamStarted = false;
|
|
127789
128139
|
let pendingController = null;
|
|
127790
128140
|
let stdoutEnded = false;
|
|
127791
|
-
|
|
128141
|
+
let controllerClosed = false;
|
|
128142
|
+
const onData = (chunk) => {
|
|
128143
|
+
if (controllerClosed) return;
|
|
127792
128144
|
if (streamStarted && pendingController) {
|
|
127793
128145
|
pendingController.enqueue(chunk);
|
|
127794
128146
|
} else {
|
|
127795
128147
|
bufferedChunks.push(chunk);
|
|
127796
128148
|
}
|
|
127797
|
-
}
|
|
127798
|
-
|
|
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 = () => {
|
|
127799
128158
|
stdoutEnded = true;
|
|
127800
|
-
if (streamStarted
|
|
127801
|
-
|
|
127802
|
-
|
|
127803
|
-
|
|
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);
|
|
127804
128168
|
return new ReadableStream({
|
|
127805
128169
|
start(controller) {
|
|
127806
128170
|
pendingController = controller;
|
|
@@ -127810,8 +128174,14 @@ ${error2.message}` : execaMessage;
|
|
|
127810
128174
|
bufferedChunks.length = 0;
|
|
127811
128175
|
streamStarted = true;
|
|
127812
128176
|
if (stdoutEnded) {
|
|
127813
|
-
|
|
128177
|
+
closeController();
|
|
127814
128178
|
}
|
|
128179
|
+
},
|
|
128180
|
+
cancel() {
|
|
128181
|
+
controllerClosed = true;
|
|
128182
|
+
pendingController = null;
|
|
128183
|
+
bufferedChunks.length = 0;
|
|
128184
|
+
detach();
|
|
127815
128185
|
}
|
|
127816
128186
|
});
|
|
127817
128187
|
}
|
|
@@ -129202,217 +129572,6 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129202
129572
|
super(isLikelyAuthorizationUrl, false);
|
|
129203
129573
|
}
|
|
129204
129574
|
}
|
|
129205
|
-
const ACP_AUTHENTICATION_INITIALIZE_TIMEOUT_MS = 6e4;
|
|
129206
|
-
const AUTHENTICATION_TERMINATION_GRACE_MS = 3e3;
|
|
129207
|
-
function normalizeAcpAuthMethod(method) {
|
|
129208
|
-
const record2 = method;
|
|
129209
|
-
const id2 = typeof record2.id === "string" ? record2.id.trim() : "";
|
|
129210
|
-
if (!id2) return null;
|
|
129211
|
-
const type2 = record2.type === "terminal" || record2.type === "env_var" ? record2.type : "agent";
|
|
129212
|
-
const args2 = Array.isArray(record2.args) && record2.args.every((arg) => typeof arg === "string") ? record2.args : void 0;
|
|
129213
|
-
const env2 = typeof record2.env === "object" && record2.env !== null ? Object.fromEntries(Object.entries(record2.env).filter((entry) => typeof entry[1] === "string")) : void 0;
|
|
129214
|
-
return {
|
|
129215
|
-
type: type2,
|
|
129216
|
-
id: id2,
|
|
129217
|
-
...typeof record2.name === "string" ? {
|
|
129218
|
-
name: record2.name
|
|
129219
|
-
} : {},
|
|
129220
|
-
...typeof record2.description === "string" ? {
|
|
129221
|
-
description: record2.description
|
|
129222
|
-
} : {},
|
|
129223
|
-
...args2 ? {
|
|
129224
|
-
args: args2
|
|
129225
|
-
} : {},
|
|
129226
|
-
...env2 && Object.keys(env2).length > 0 ? {
|
|
129227
|
-
env: env2
|
|
129228
|
-
} : {}
|
|
129229
|
-
};
|
|
129230
|
-
}
|
|
129231
|
-
function describeAcpAuthMethod(method) {
|
|
129232
|
-
return method.name?.trim() ? method.name : method.id;
|
|
129233
|
-
}
|
|
129234
|
-
function formatEnvVarAuthMethodError(method, normalized) {
|
|
129235
|
-
const vars = method.vars;
|
|
129236
|
-
const names2 = Array.isArray(vars) ? vars.map((entry) => typeof entry === "object" && entry !== null && typeof entry.name === "string" ? entry.name : null).filter((name2) => Boolean(name2)) : [];
|
|
129237
|
-
const suffix = names2.length > 0 ? `: ${names2.join(", ")}` : "";
|
|
129238
|
-
return `${describeAcpAuthMethod(normalized)} authenticates through environment variables. Add them to this agent's environment in its settings${suffix}.`;
|
|
129239
|
-
}
|
|
129240
|
-
function selectAuthMethod(methods2, methodId) {
|
|
129241
|
-
for (const method of methods2) {
|
|
129242
|
-
const normalized = normalizeAcpAuthMethod(method);
|
|
129243
|
-
if (!normalized) continue;
|
|
129244
|
-
if (methodId === void 0 || normalized.id === methodId) {
|
|
129245
|
-
return {
|
|
129246
|
-
method,
|
|
129247
|
-
normalized
|
|
129248
|
-
};
|
|
129249
|
-
}
|
|
129250
|
-
}
|
|
129251
|
-
return null;
|
|
129252
|
-
}
|
|
129253
|
-
function withDeadline(promise2, timeoutMs, label2) {
|
|
129254
|
-
let timeoutHandle;
|
|
129255
|
-
const timeout2 = new Promise((_resolve, reject2) => {
|
|
129256
|
-
timeoutHandle = setTimeout(() => reject2(new Error(`${label2} timed out after ${Math.round(timeoutMs / 1e3)}s`)), timeoutMs);
|
|
129257
|
-
timeoutHandle.unref?.();
|
|
129258
|
-
});
|
|
129259
|
-
return Promise.race([
|
|
129260
|
-
promise2,
|
|
129261
|
-
timeout2
|
|
129262
|
-
]).finally(() => {
|
|
129263
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
129264
|
-
});
|
|
129265
|
-
}
|
|
129266
|
-
async function runAcpProtocolAuthentication(options) {
|
|
129267
|
-
options.signal?.throwIfAborted();
|
|
129268
|
-
const child = spawnAcpProcess({
|
|
129269
|
-
cliType: options.cliType,
|
|
129270
|
-
agentType: options.agentType,
|
|
129271
|
-
workdir: options.workdir,
|
|
129272
|
-
env: options.env,
|
|
129273
|
-
command: options.launch.command,
|
|
129274
|
-
args: options.launch.args,
|
|
129275
|
-
spawnImpl: options.spawnProcess
|
|
129276
|
-
});
|
|
129277
|
-
options.attachProcess?.(child);
|
|
129278
|
-
let stderrTail = "";
|
|
129279
|
-
const parser = new AcpAgentAuthorizationOutputParser();
|
|
129280
|
-
child.stderr?.setEncoding("utf8");
|
|
129281
|
-
child.stderr?.on("data", (chunk) => {
|
|
129282
|
-
if (!chunk) return;
|
|
129283
|
-
stderrTail = appendStderrTail(stderrTail, chunk);
|
|
129284
|
-
const authorization = parser.push(chunk);
|
|
129285
|
-
if (authorization) {
|
|
129286
|
-
options.onProgress?.({
|
|
129287
|
-
status: "authorization",
|
|
129288
|
-
...authorization
|
|
129289
|
-
});
|
|
129290
|
-
}
|
|
129291
|
-
});
|
|
129292
|
-
let rejectProcessFailure;
|
|
129293
|
-
const processFailure = new Promise((_resolve, reject2) => {
|
|
129294
|
-
rejectProcessFailure = reject2;
|
|
129295
|
-
});
|
|
129296
|
-
const handleExit = (code2, signal) => {
|
|
129297
|
-
rejectProcessFailure?.(new Error(`${options.agentType} exited during authentication (code ${code2 ?? "null"}${signal ? `, signal ${signal}` : ""})${stderrTail ? `: ${stderrTail}` : ""}`));
|
|
129298
|
-
};
|
|
129299
|
-
const handleError2 = (error2) => {
|
|
129300
|
-
rejectProcessFailure?.(new Error(`${options.agentType} failed to start: ${error2.message}`));
|
|
129301
|
-
};
|
|
129302
|
-
child.once("exit", handleExit);
|
|
129303
|
-
child.once("error", handleError2);
|
|
129304
|
-
processFailure.catch(() => void 0);
|
|
129305
|
-
const handleAbort = () => {
|
|
129306
|
-
rejectProcessFailure?.(new DOMException("ACP authentication was cancelled", "AbortError"));
|
|
129307
|
-
};
|
|
129308
|
-
options.signal?.addEventListener("abort", handleAbort, {
|
|
129309
|
-
once: true
|
|
129310
|
-
});
|
|
129311
|
-
const terminate = () => {
|
|
129312
|
-
child.off("exit", handleExit);
|
|
129313
|
-
child.off("error", handleError2);
|
|
129314
|
-
options.signal?.removeEventListener("abort", handleAbort);
|
|
129315
|
-
void shutdownLocalAcpAgent({
|
|
129316
|
-
agentProcess: child,
|
|
129317
|
-
logger: options.logger,
|
|
129318
|
-
sessionLabel: `acp-auth-protocol:${options.agentType}`,
|
|
129319
|
-
exitTimeoutMs: AUTHENTICATION_TERMINATION_GRACE_MS
|
|
129320
|
-
}).catch((error2) => {
|
|
129321
|
-
options.logger.debug(`[acp-auth] Failed to stop ${options.agentType} after authentication: ${formatErrorMessage(error2)}`);
|
|
129322
|
-
});
|
|
129323
|
-
};
|
|
129324
|
-
try {
|
|
129325
|
-
if (!child.stdout || !child.stdin) {
|
|
129326
|
-
throw new Error("Agent process stdio is not available");
|
|
129327
|
-
}
|
|
129328
|
-
const stream2 = ndJsonStream(createStdinWritableStream(child.stdin), createStdoutReadableStream(child.stdout));
|
|
129329
|
-
const connection2 = new ClientSideConnection(() => ({
|
|
129330
|
-
requestPermission: async () => ({
|
|
129331
|
-
outcome: {
|
|
129332
|
-
outcome: "cancelled"
|
|
129333
|
-
}
|
|
129334
|
-
}),
|
|
129335
|
-
sessionUpdate: () => {
|
|
129336
|
-
}
|
|
129337
|
-
}), stream2);
|
|
129338
|
-
const initializeResponse = await Promise.race([
|
|
129339
|
-
withDeadline(connection2.initialize({
|
|
129340
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
129341
|
-
clientCapabilities: {
|
|
129342
|
-
terminal: false,
|
|
129343
|
-
fs: {
|
|
129344
|
-
readTextFile: false,
|
|
129345
|
-
writeTextFile: false
|
|
129346
|
-
},
|
|
129347
|
-
auth: {
|
|
129348
|
-
terminal: true
|
|
129349
|
-
}
|
|
129350
|
-
}
|
|
129351
|
-
}), Math.max(1, options.initializeTimeoutMs ?? ACP_AUTHENTICATION_INITIALIZE_TIMEOUT_MS), `${options.agentType} initialize`),
|
|
129352
|
-
processFailure
|
|
129353
|
-
]);
|
|
129354
|
-
options.signal?.throwIfAborted();
|
|
129355
|
-
const advertised = initializeResponse.authMethods ?? [];
|
|
129356
|
-
if (advertised.length === 0) {
|
|
129357
|
-
return {
|
|
129358
|
-
kind: "error",
|
|
129359
|
-
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.`
|
|
129360
|
-
};
|
|
129361
|
-
}
|
|
129362
|
-
const selected = selectAuthMethod(advertised, options.methodId);
|
|
129363
|
-
if (!selected) {
|
|
129364
|
-
if (options.methodId !== void 0) {
|
|
129365
|
-
return {
|
|
129366
|
-
kind: "error",
|
|
129367
|
-
error: `${options.agentType} no longer advertises the authentication method "${options.methodId}"`
|
|
129368
|
-
};
|
|
129369
|
-
}
|
|
129370
|
-
return {
|
|
129371
|
-
kind: "error",
|
|
129372
|
-
error: `${options.agentType} advertised no usable authentication method`
|
|
129373
|
-
};
|
|
129374
|
-
}
|
|
129375
|
-
const normalizedMethods = advertised.map(normalizeAcpAuthMethod).filter((method) => method !== null);
|
|
129376
|
-
if (options.methodId === void 0 && normalizedMethods.length > 1) {
|
|
129377
|
-
return {
|
|
129378
|
-
kind: "method-required",
|
|
129379
|
-
authMethods: normalizedMethods
|
|
129380
|
-
};
|
|
129381
|
-
}
|
|
129382
|
-
if (selected.normalized.type === "env_var") {
|
|
129383
|
-
return {
|
|
129384
|
-
kind: "error",
|
|
129385
|
-
error: formatEnvVarAuthMethodError(selected.method, selected.normalized)
|
|
129386
|
-
};
|
|
129387
|
-
}
|
|
129388
|
-
if (selected.normalized.type === "terminal") {
|
|
129389
|
-
return {
|
|
129390
|
-
kind: "terminal-method",
|
|
129391
|
-
method: selected.normalized
|
|
129392
|
-
};
|
|
129393
|
-
}
|
|
129394
|
-
options.logger.debug(`[acp-auth] ${options.agentType} authenticate methodId=${selected.normalized.id}`);
|
|
129395
|
-
await Promise.race([
|
|
129396
|
-
connection2.authenticate({
|
|
129397
|
-
methodId: selected.normalized.id
|
|
129398
|
-
}),
|
|
129399
|
-
processFailure
|
|
129400
|
-
]);
|
|
129401
|
-
return {
|
|
129402
|
-
kind: "authenticated"
|
|
129403
|
-
};
|
|
129404
|
-
} catch (error2) {
|
|
129405
|
-
if (error2 instanceof DOMException && error2.name === "AbortError") {
|
|
129406
|
-
throw error2;
|
|
129407
|
-
}
|
|
129408
|
-
return {
|
|
129409
|
-
kind: "error",
|
|
129410
|
-
error: formatErrorMessage(error2)
|
|
129411
|
-
};
|
|
129412
|
-
} finally {
|
|
129413
|
-
terminate();
|
|
129414
|
-
}
|
|
129415
|
-
}
|
|
129416
129575
|
const DEFAULT_AUTHENTICATION_TIMEOUT_MS = 285e3;
|
|
129417
129576
|
const DEFAULT_TERMINATION_GRACE_MS$1 = 3e3;
|
|
129418
129577
|
const DEFAULT_STATUS_PROBE_TIMEOUT_MS = 15e3;
|
|
@@ -129461,6 +129620,139 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129461
129620
|
}
|
|
129462
129621
|
]
|
|
129463
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
|
+
}
|
|
129464
129756
|
function getBuiltinDisplayName(agentType) {
|
|
129465
129757
|
return getManagedBuiltinRuntimeByAgentType(agentType)?.displayName ?? agentType;
|
|
129466
129758
|
}
|
|
@@ -129477,7 +129769,7 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129477
129769
|
NO_COLOR: "1"
|
|
129478
129770
|
};
|
|
129479
129771
|
delete baseEnv.FORCE_COLOR;
|
|
129480
|
-
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))));
|
|
129481
129773
|
}
|
|
129482
129774
|
async function probeBuiltinAuthentication(options) {
|
|
129483
129775
|
options.signal?.throwIfAborted();
|
|
@@ -129601,8 +129893,8 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129601
129893
|
spawnProcess;
|
|
129602
129894
|
resolveLoginShellEnv;
|
|
129603
129895
|
async authenticate(options) {
|
|
129604
|
-
const
|
|
129605
|
-
const displayName =
|
|
129896
|
+
const isBuiltinAuthentication = options.cliType === "builtin" && isManagedBuiltinAgentType(options.agentType);
|
|
129897
|
+
const displayName = isBuiltinAuthentication ? getBuiltinDisplayName(options.agentType) : options.agentType;
|
|
129606
129898
|
if (this.runningByAgentType.has(options.agentType)) {
|
|
129607
129899
|
return {
|
|
129608
129900
|
success: false,
|
|
@@ -129617,7 +129909,7 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129617
129909
|
terminating: false,
|
|
129618
129910
|
acceptsAuthorizationCode: false,
|
|
129619
129911
|
authorizationCodeSubmitted: false,
|
|
129620
|
-
|
|
129912
|
+
abortController: new AbortController()
|
|
129621
129913
|
};
|
|
129622
129914
|
this.runningByAgentType.set(options.agentType, running2);
|
|
129623
129915
|
let timeoutHandle;
|
|
@@ -129648,6 +129940,11 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129648
129940
|
timeoutHandle = setTimeout(() => {
|
|
129649
129941
|
if (running2.cancelled) return;
|
|
129650
129942
|
running2.timedOut = true;
|
|
129943
|
+
running2.abortController.abort();
|
|
129944
|
+
running2.pendingInteraction?.resolve({
|
|
129945
|
+
action: "cancel"
|
|
129946
|
+
});
|
|
129947
|
+
running2.pendingInteraction = void 0;
|
|
129651
129948
|
if (!running2.child && this.runningByAgentType.get(options.agentType) === running2) {
|
|
129652
129949
|
this.runningByAgentType.delete(options.agentType);
|
|
129653
129950
|
}
|
|
@@ -129655,18 +129952,103 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129655
129952
|
}, this.authenticationTimeoutMs);
|
|
129656
129953
|
timeoutHandle.unref?.();
|
|
129657
129954
|
try {
|
|
129658
|
-
|
|
129659
|
-
options,
|
|
129660
|
-
|
|
129661
|
-
|
|
129662
|
-
|
|
129663
|
-
|
|
129664
|
-
|
|
129665
|
-
options,
|
|
129666
|
-
|
|
129667
|
-
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"
|
|
129668
129964
|
});
|
|
129669
|
-
|
|
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
|
+
};
|
|
129670
130052
|
} catch (error2) {
|
|
129671
130053
|
const interruption2 = interruptedResult();
|
|
129672
130054
|
if (interruption2) return interruption2;
|
|
@@ -129689,250 +130071,24 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129689
130071
|
}
|
|
129690
130072
|
}
|
|
129691
130073
|
}
|
|
129692
|
-
|
|
129693
|
-
|
|
129694
|
-
const launch = await resolveBuiltinAuthenticationProcessLaunch({
|
|
129695
|
-
cliType: options.cliType,
|
|
129696
|
-
agentType: options.agentType,
|
|
129697
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129698
|
-
action: "login"
|
|
129699
|
-
});
|
|
129700
|
-
if (!launch) {
|
|
129701
|
-
throw new Error(`${displayName} authentication is unavailable`);
|
|
129702
|
-
}
|
|
129703
|
-
const launchInterruption = interruptedResult();
|
|
129704
|
-
if (launchInterruption) return launchInterruption;
|
|
129705
|
-
const env2 = await buildAuthenticationProcessEnv({
|
|
129706
|
-
launch,
|
|
129707
|
-
agentType: options.agentType,
|
|
129708
|
-
env: options.env,
|
|
129709
|
-
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
129710
|
-
});
|
|
129711
|
-
const preparationInterruption = interruptedResult();
|
|
129712
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129713
|
-
options.onProgress?.({
|
|
129714
|
-
status: "starting"
|
|
129715
|
-
});
|
|
129716
|
-
return await this.runLoginProcess({
|
|
129717
|
-
...ctx,
|
|
129718
|
-
displayName,
|
|
129719
|
-
command: launch.command,
|
|
129720
|
-
args: launch.args,
|
|
129721
|
-
env: env2,
|
|
129722
|
-
parser: new BuiltinAuthenticationOutputParser(agentType),
|
|
129723
|
-
formatExitError: (code2) => formatAuthenticationExitError(agentType, displayName, code2),
|
|
129724
|
-
acceptsAuthorizationCodeOnStdin: true
|
|
129725
|
-
});
|
|
130074
|
+
getAgentType(requestId) {
|
|
130075
|
+
return this.findRunningAuthentication(requestId)?.agentType;
|
|
129726
130076
|
}
|
|
129727
|
-
|
|
129728
|
-
const
|
|
129729
|
-
|
|
129730
|
-
cliType: options.cliType,
|
|
129731
|
-
agentType: options.agentType,
|
|
129732
|
-
customAcp: options.customAcp,
|
|
129733
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129734
|
-
signal: running2.abort.signal
|
|
129735
|
-
});
|
|
129736
|
-
const launchInterruption = interruptedResult();
|
|
129737
|
-
if (launchInterruption) return launchInterruption;
|
|
129738
|
-
const env2 = await this.buildAcpAuthenticationProcessEnv(launch, options, {
|
|
129739
|
-
protocolStdio: true
|
|
129740
|
-
});
|
|
129741
|
-
const preparationInterruption = interruptedResult();
|
|
129742
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129743
|
-
options.onProgress?.({
|
|
129744
|
-
status: "starting"
|
|
129745
|
-
});
|
|
129746
|
-
const outcome = await runAcpProtocolAuthentication({
|
|
129747
|
-
launch: {
|
|
129748
|
-
command: launch.command,
|
|
129749
|
-
args: launch.args
|
|
129750
|
-
},
|
|
129751
|
-
cliType: options.cliType,
|
|
129752
|
-
agentType: options.agentType,
|
|
129753
|
-
workdir: os__default$1.homedir(),
|
|
129754
|
-
env: env2,
|
|
129755
|
-
methodId: options.methodId,
|
|
129756
|
-
logger: this.logger,
|
|
129757
|
-
signal: running2.abort.signal,
|
|
129758
|
-
onProgress: options.onProgress,
|
|
129759
|
-
attachProcess: (child) => {
|
|
129760
|
-
running2.child = child;
|
|
129761
|
-
},
|
|
129762
|
-
spawnProcess: this.spawnProcess
|
|
129763
|
-
});
|
|
129764
|
-
const outcomeInterruption = interruptedResult();
|
|
129765
|
-
if (outcomeInterruption) return outcomeInterruption;
|
|
129766
|
-
if (outcome.kind === "authenticated") {
|
|
129767
|
-
options.onProgress?.({
|
|
129768
|
-
status: "authenticated"
|
|
129769
|
-
});
|
|
129770
|
-
return {
|
|
129771
|
-
success: true,
|
|
129772
|
-
disposition: "authenticated"
|
|
129773
|
-
};
|
|
129774
|
-
}
|
|
129775
|
-
if (outcome.kind === "method-required") {
|
|
129776
|
-
return {
|
|
129777
|
-
success: true,
|
|
129778
|
-
disposition: "method-required",
|
|
129779
|
-
authMethods: outcome.authMethods.map((method) => ({
|
|
129780
|
-
type: method.type,
|
|
129781
|
-
id: method.id,
|
|
129782
|
-
...method.name ? {
|
|
129783
|
-
name: method.name
|
|
129784
|
-
} : {},
|
|
129785
|
-
...method.description ? {
|
|
129786
|
-
description: method.description
|
|
129787
|
-
} : {}
|
|
129788
|
-
}))
|
|
129789
|
-
};
|
|
129790
|
-
}
|
|
129791
|
-
if (outcome.kind === "terminal-method") {
|
|
129792
|
-
running2.child = void 0;
|
|
129793
|
-
return await this.runTerminalAuthMethod(ctx, outcome.method);
|
|
129794
|
-
}
|
|
129795
|
-
options.onProgress?.({
|
|
129796
|
-
status: "error",
|
|
129797
|
-
error: outcome.error
|
|
129798
|
-
});
|
|
129799
|
-
return {
|
|
129800
|
-
success: false,
|
|
129801
|
-
disposition: "error",
|
|
129802
|
-
error: outcome.error
|
|
129803
|
-
};
|
|
129804
|
-
}
|
|
129805
|
-
async runTerminalAuthMethod(ctx, method) {
|
|
129806
|
-
const { options, interruptedResult } = ctx;
|
|
129807
|
-
const displayName = describeAcpAuthMethod(method);
|
|
129808
|
-
const launch = await resolveACPProcessLaunchAsync({
|
|
129809
|
-
cliType: options.cliType,
|
|
129810
|
-
agentType: options.agentType,
|
|
129811
|
-
customAcp: options.customAcp,
|
|
129812
|
-
runtimeOverrides: options.runtimeOverrides,
|
|
129813
|
-
extraArgs: [
|
|
129814
|
-
...method.args ?? []
|
|
129815
|
-
],
|
|
129816
|
-
signal: ctx.running.abort.signal
|
|
129817
|
-
});
|
|
129818
|
-
const launchInterruption = interruptedResult();
|
|
129819
|
-
if (launchInterruption) return launchInterruption;
|
|
129820
|
-
const env2 = await this.buildAcpAuthenticationProcessEnv(launch, options, {
|
|
129821
|
-
methodEnv: method.env
|
|
129822
|
-
});
|
|
129823
|
-
const preparationInterruption = interruptedResult();
|
|
129824
|
-
if (preparationInterruption) return preparationInterruption;
|
|
129825
|
-
return await this.runLoginProcess({
|
|
129826
|
-
...ctx,
|
|
129827
|
-
displayName,
|
|
129828
|
-
command: launch.command,
|
|
129829
|
-
args: launch.args,
|
|
129830
|
-
env: env2,
|
|
129831
|
-
parser: new AcpAgentAuthorizationOutputParser(),
|
|
129832
|
-
formatExitError: (code2) => `${options.agentType} authentication exited with code ${code2 ?? "unknown"}`,
|
|
129833
|
-
acceptsAuthorizationCodeOnStdin: false
|
|
129834
|
-
});
|
|
129835
|
-
}
|
|
129836
|
-
async buildAcpAuthenticationProcessEnv(launch, options, settings = {}) {
|
|
129837
|
-
const env2 = await buildAuthenticationProcessEnv({
|
|
129838
|
-
launch,
|
|
129839
|
-
agentType: options.agentType,
|
|
129840
|
-
env: settings.methodEnv ? {
|
|
129841
|
-
...options.env,
|
|
129842
|
-
...settings.methodEnv
|
|
129843
|
-
} : options.env,
|
|
129844
|
-
resolveLoginShellEnv: this.resolveLoginShellEnv
|
|
129845
|
-
});
|
|
129846
|
-
if (settings.protocolStdio) {
|
|
129847
|
-
delete env2.TERM;
|
|
129848
|
-
}
|
|
129849
|
-
return withLodyNpmCacheForNpx(launch.command, env2);
|
|
129850
|
-
}
|
|
129851
|
-
async runLoginProcess(ctx) {
|
|
129852
|
-
const { options, running: running2, interruptedResult, displayName } = ctx;
|
|
129853
|
-
const child = this.spawnProcess(ctx.command, ctx.args, {
|
|
129854
|
-
cwd: os__default$1.homedir(),
|
|
129855
|
-
env: ctx.env,
|
|
129856
|
-
stdio: [
|
|
129857
|
-
"pipe",
|
|
129858
|
-
"pipe",
|
|
129859
|
-
"pipe"
|
|
129860
|
-
],
|
|
129861
|
-
detached: process.platform !== "win32",
|
|
129862
|
-
windowsHide: true
|
|
129863
|
-
});
|
|
129864
|
-
running2.child = child;
|
|
129865
|
-
if (running2.cancelled || running2.timedOut) {
|
|
129866
|
-
this.terminateAuthentication(options.agentType, running2, running2.cancelled ? "cancelled" : "timed out");
|
|
129867
|
-
}
|
|
129868
|
-
child.stdin?.on("error", (error2) => {
|
|
129869
|
-
this.logger.debug(`[acp-auth] ${displayName} authorization input failed: ${formatErrorMessage(error2)}`);
|
|
129870
|
-
});
|
|
129871
|
-
const emitOutput = (stream2, chunk) => {
|
|
129872
|
-
const output = String(chunk);
|
|
129873
|
-
if (output.length === 0) return;
|
|
129874
|
-
const authorization = ctx.parser.push(output);
|
|
129875
|
-
if (authorization) {
|
|
129876
|
-
running2.acceptsAuthorizationCode = ctx.acceptsAuthorizationCodeOnStdin && authorization.acceptsAuthorizationCode === true;
|
|
129877
|
-
options.onProgress?.({
|
|
129878
|
-
status: "authorization",
|
|
129879
|
-
...authorization
|
|
129880
|
-
});
|
|
129881
|
-
}
|
|
129882
|
-
options.onProgress?.({
|
|
129883
|
-
status: "output",
|
|
129884
|
-
stream: stream2,
|
|
129885
|
-
output: output.slice(0, 16384)
|
|
129886
|
-
});
|
|
129887
|
-
};
|
|
129888
|
-
child.stdout?.on("data", (chunk) => emitOutput("stdout", chunk));
|
|
129889
|
-
child.stderr?.on("data", (chunk) => emitOutput("stderr", chunk));
|
|
129890
|
-
const exit2 = await new Promise((resolve2) => {
|
|
129891
|
-
let settled = false;
|
|
129892
|
-
const finish = (result) => {
|
|
129893
|
-
if (settled) return;
|
|
129894
|
-
settled = true;
|
|
129895
|
-
resolve2(result);
|
|
129896
|
-
};
|
|
129897
|
-
child.once("error", (error2) => finish({
|
|
129898
|
-
code: null,
|
|
129899
|
-
error: error2
|
|
129900
|
-
}));
|
|
129901
|
-
child.once("exit", (code2) => finish({
|
|
129902
|
-
code: code2
|
|
129903
|
-
}));
|
|
129904
|
-
});
|
|
129905
|
-
const processInterruption = interruptedResult();
|
|
129906
|
-
if (processInterruption) return processInterruption;
|
|
129907
|
-
if (exit2.error !== void 0 || exit2.code !== 0) {
|
|
129908
|
-
const error2 = exit2.error !== void 0 ? formatErrorMessage(exit2.error) : ctx.formatExitError(exit2.code);
|
|
129909
|
-
options.onProgress?.({
|
|
129910
|
-
status: "error",
|
|
129911
|
-
error: error2
|
|
129912
|
-
});
|
|
129913
|
-
return {
|
|
129914
|
-
success: false,
|
|
129915
|
-
disposition: "error",
|
|
129916
|
-
error: error2
|
|
129917
|
-
};
|
|
129918
|
-
}
|
|
129919
|
-
options.onProgress?.({
|
|
129920
|
-
status: "authenticated"
|
|
129921
|
-
});
|
|
129922
|
-
return {
|
|
129923
|
-
success: true,
|
|
129924
|
-
disposition: "authenticated"
|
|
129925
|
-
};
|
|
129926
|
-
}
|
|
129927
|
-
cancel(agentType, requestId) {
|
|
129928
|
-
const running2 = this.runningByAgentType.get(agentType);
|
|
129929
|
-
if (!running2 || running2.requestId !== requestId) {
|
|
130077
|
+
cancel(requestId) {
|
|
130078
|
+
const active2 = this.findRunningAuthentication(requestId);
|
|
130079
|
+
if (!active2) {
|
|
129930
130080
|
return {
|
|
129931
130081
|
success: true,
|
|
129932
130082
|
disposition: "not-running"
|
|
129933
130083
|
};
|
|
129934
130084
|
}
|
|
130085
|
+
const { agentType, running: running2 } = active2;
|
|
129935
130086
|
running2.cancelled = true;
|
|
130087
|
+
running2.abortController.abort();
|
|
130088
|
+
running2.pendingInteraction?.resolve({
|
|
130089
|
+
action: "cancel"
|
|
130090
|
+
});
|
|
130091
|
+
running2.pendingInteraction = void 0;
|
|
129936
130092
|
if (!running2.child && this.runningByAgentType.get(agentType) === running2) {
|
|
129937
130093
|
this.runningByAgentType.delete(agentType);
|
|
129938
130094
|
}
|
|
@@ -129942,14 +130098,15 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129942
130098
|
disposition: "cancelled"
|
|
129943
130099
|
};
|
|
129944
130100
|
}
|
|
129945
|
-
submitAuthorizationCode(
|
|
129946
|
-
const
|
|
129947
|
-
if (!
|
|
130101
|
+
submitAuthorizationCode(requestId, authorizationCode) {
|
|
130102
|
+
const active2 = this.findRunningAuthentication(requestId);
|
|
130103
|
+
if (!active2) {
|
|
129948
130104
|
return {
|
|
129949
130105
|
success: true,
|
|
129950
130106
|
disposition: "not-running"
|
|
129951
130107
|
};
|
|
129952
130108
|
}
|
|
130109
|
+
const { agentType, running: running2 } = active2;
|
|
129953
130110
|
if (!running2.acceptsAuthorizationCode) {
|
|
129954
130111
|
return {
|
|
129955
130112
|
success: false,
|
|
@@ -129997,8 +130154,327 @@ ${fallbackStderrTail}` : errorMessage2;
|
|
|
129997
130154
|
};
|
|
129998
130155
|
}
|
|
129999
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
|
+
}
|
|
130000
130476
|
terminateAuthentication(agentType, running2, reason) {
|
|
130001
|
-
running2.
|
|
130477
|
+
running2.abortController.abort();
|
|
130002
130478
|
if (running2.terminating || !running2.child) return;
|
|
130003
130479
|
running2.terminating = true;
|
|
130004
130480
|
void shutdownLocalAcpAgent({
|
|
@@ -134371,6 +134847,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134371
134847
|
};
|
|
134372
134848
|
const shouldRecoverStaleACPConnectionPrompt = (args2) => !args2.alreadyAttempted && !args2.hasPromptOutput && (isAgentDisconnectedError(args2.error) || isAcpSessionNotFoundError(args2.error));
|
|
134373
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;
|
|
134374
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.";
|
|
134375
134853
|
class SessionTurnCancelled extends TaggedError("SessionTurnCancelled") {
|
|
134376
134854
|
}
|
|
@@ -134419,19 +134897,23 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
134419
134897
|
const summarizeAcpAuthMethod = (method) => {
|
|
134420
134898
|
const record2 = typeof method === "object" && method !== null ? method : {};
|
|
134421
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);
|
|
134422
134904
|
return {
|
|
134423
134905
|
type: type2,
|
|
134424
|
-
...
|
|
134425
|
-
id:
|
|
134906
|
+
...id2 !== void 0 ? {
|
|
134907
|
+
id: id2
|
|
134426
134908
|
} : {},
|
|
134427
|
-
...
|
|
134428
|
-
name:
|
|
134909
|
+
...name2 !== void 0 ? {
|
|
134910
|
+
name: name2
|
|
134429
134911
|
} : {},
|
|
134430
|
-
...
|
|
134431
|
-
description:
|
|
134912
|
+
...description2 !== void 0 ? {
|
|
134913
|
+
description: description2
|
|
134432
134914
|
} : {},
|
|
134433
134915
|
...Array.isArray(record2.args) && record2.args.every((arg) => typeof arg === "string") ? {
|
|
134434
|
-
args: record2.args
|
|
134916
|
+
args: record2.args.slice(0, 64).map((arg) => arg.slice(0, 4096))
|
|
134435
134917
|
} : {}
|
|
134436
134918
|
};
|
|
134437
134919
|
};
|
|
@@ -137190,11 +137672,14 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137190
137672
|
});
|
|
137191
137673
|
}
|
|
137192
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);
|
|
137193
137678
|
const base = {
|
|
137194
137679
|
type: "machine/acp-authenticate_response",
|
|
137195
137680
|
machineId: this.deps.machineId,
|
|
137196
137681
|
requestId: message.requestId,
|
|
137197
|
-
agentType:
|
|
137682
|
+
agentType: activeAgentType ?? "unknown"
|
|
137198
137683
|
};
|
|
137199
137684
|
if (message.machineId !== this.deps.machineId) {
|
|
137200
137685
|
return {
|
|
@@ -137207,68 +137692,100 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137207
137692
|
if (message.action === "cancel") {
|
|
137208
137693
|
return {
|
|
137209
137694
|
...base,
|
|
137210
|
-
...this.acpAuthenticationManager.cancel(message.
|
|
137695
|
+
...this.acpAuthenticationManager.cancel(message.authenticationRequestId)
|
|
137211
137696
|
};
|
|
137212
137697
|
}
|
|
137213
137698
|
if (message.action === "submit-code") {
|
|
137214
|
-
if (!message.authenticationRequestId || !message.authorizationCode) {
|
|
137215
|
-
return {
|
|
137216
|
-
...base,
|
|
137217
|
-
success: false,
|
|
137218
|
-
disposition: "error",
|
|
137219
|
-
error: "Missing authentication request or authorization code"
|
|
137220
|
-
};
|
|
137221
|
-
}
|
|
137222
137699
|
return {
|
|
137223
137700
|
...base,
|
|
137224
|
-
...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}`
|
|
137225
137717
|
};
|
|
137226
137718
|
}
|
|
137719
|
+
const resolvedBase = {
|
|
137720
|
+
...base,
|
|
137721
|
+
agentType: config2.agentType
|
|
137722
|
+
};
|
|
137227
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
|
+
}
|
|
137228
137736
|
options.onProgress?.({
|
|
137229
137737
|
type: "machine/acp-authentication-progress",
|
|
137230
137738
|
machineId: this.deps.machineId,
|
|
137231
137739
|
requestId: message.requestId,
|
|
137232
|
-
agentType:
|
|
137740
|
+
agentType: config2.agentType,
|
|
137233
137741
|
...event
|
|
137234
137742
|
});
|
|
137235
137743
|
};
|
|
137236
137744
|
const result = await this.acpAuthenticationManager.authenticate({
|
|
137237
137745
|
requestId: message.requestId,
|
|
137238
|
-
cliType:
|
|
137239
|
-
agentType:
|
|
137240
|
-
customAcp:
|
|
137241
|
-
runtimeOverrides:
|
|
137242
|
-
env:
|
|
137243
|
-
methodId: message.methodId,
|
|
137746
|
+
cliType: config2.cliType,
|
|
137747
|
+
agentType: config2.agentType,
|
|
137748
|
+
customAcp: config2.customAcp,
|
|
137749
|
+
runtimeOverrides: config2.runtimeOverrides,
|
|
137750
|
+
env: config2.env,
|
|
137244
137751
|
onProgress
|
|
137245
137752
|
});
|
|
137246
|
-
if (result.disposition === "
|
|
137247
|
-
|
|
137248
|
-
|
|
137249
|
-
|
|
137250
|
-
|
|
137251
|
-
|
|
137252
|
-
|
|
137253
|
-
|
|
137254
|
-
|
|
137255
|
-
|
|
137256
|
-
|
|
137257
|
-
|
|
137258
|
-
|
|
137259
|
-
|
|
137260
|
-
|
|
137261
|
-
|
|
137262
|
-
|
|
137263
|
-
|
|
137264
|
-
|
|
137265
|
-
|
|
137266
|
-
|
|
137267
|
-
|
|
137268
|
-
|
|
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
|
+
}
|
|
137269
137786
|
if (!refresh.success) {
|
|
137270
137787
|
return {
|
|
137271
|
-
...
|
|
137788
|
+
...resolvedBase,
|
|
137272
137789
|
...result,
|
|
137273
137790
|
capabilitiesRefreshed: false,
|
|
137274
137791
|
authRequired: refresh.authRequired,
|
|
@@ -137277,13 +137794,13 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137277
137794
|
};
|
|
137278
137795
|
}
|
|
137279
137796
|
return {
|
|
137280
|
-
...
|
|
137797
|
+
...resolvedBase,
|
|
137281
137798
|
...result,
|
|
137282
137799
|
capabilitiesRefreshed: true
|
|
137283
137800
|
};
|
|
137284
137801
|
}
|
|
137285
137802
|
return {
|
|
137286
|
-
...
|
|
137803
|
+
...resolvedBase,
|
|
137287
137804
|
...result
|
|
137288
137805
|
};
|
|
137289
137806
|
}
|
|
@@ -137293,12 +137810,34 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
137293
137810
|
type: "machine/acp-capabilities-refresh_response",
|
|
137294
137811
|
machineId: this.deps.machineId,
|
|
137295
137812
|
configId: message.configId,
|
|
137296
|
-
cliType:
|
|
137297
|
-
agentType:
|
|
137813
|
+
cliType: "builtin",
|
|
137814
|
+
agentType: "unknown",
|
|
137298
137815
|
success: false,
|
|
137299
137816
|
error: `Machine mismatch: expected ${this.deps.machineId}, got ${message.machineId}`
|
|
137300
137817
|
};
|
|
137301
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 = {}) {
|
|
137302
137841
|
const dedupeKey = computeAcpRefreshDedupeKey(message.configId, message.cliType, message.agentType, message.env, message.customAcp, message.runtimeOverrides);
|
|
137303
137842
|
this.deps.logger.debug(`[acp-capabilities] Refresh requested (cliType=${message.cliType} agentType=${message.agentType})`);
|
|
137304
137843
|
if (options.signal?.aborted) {
|
|
@@ -139003,6 +139542,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
139003
139542
|
configOptionValues: entry.inputConfig?.configOptionValues,
|
|
139004
139543
|
mcpServerIds: entry.inputConfig?.mcpServerIds ?? [],
|
|
139005
139544
|
taskToolsEnabled: entry.inputConfig?.taskToolsEnabled === true,
|
|
139545
|
+
agentRoleId: entry.inputConfig?.agentRoleId,
|
|
139546
|
+
agentRoleRevision: entry.inputConfig?.agentRoleRevision,
|
|
139006
139547
|
issuePRMentions: entry.inputConfig?.issuePRMentions,
|
|
139007
139548
|
resume: entry.inputConfig?.resume ?? resolveDispatchAcpSessionId(meta)
|
|
139008
139549
|
},
|
|
@@ -139036,6 +139577,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
139036
139577
|
configOptionValues: entry.inputConfig?.configOptionValues,
|
|
139037
139578
|
mcpServerIds: entry.inputConfig?.mcpServerIds ?? [],
|
|
139038
139579
|
taskToolsEnabled: entry.inputConfig?.taskToolsEnabled === true,
|
|
139580
|
+
agentRoleId: entry.inputConfig?.agentRoleId,
|
|
139581
|
+
agentRoleRevision: entry.inputConfig?.agentRoleRevision,
|
|
139039
139582
|
issuePRMentions: entry.inputConfig?.issuePRMentions,
|
|
139040
139583
|
resume: entry.inputConfig?.resume
|
|
139041
139584
|
},
|
|
@@ -139092,6 +139635,8 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
|
|
|
139092
139635
|
configOptionValues: isConfigOptionValueRecord(queuedItem.acpSessionConfig?.configOptionValues) ? queuedItem.acpSessionConfig.configOptionValues : void 0,
|
|
139093
139636
|
mcpServerIds: normalizeMcpServerIdSelection(queuedItem.acpSessionConfig?.mcpServerIds) ?? [],
|
|
139094
139637
|
taskToolsEnabled: queuedItem.acpSessionConfig?.taskToolsEnabled === true,
|
|
139638
|
+
agentRoleId: queuedItem.acpSessionConfig?.agentRoleId,
|
|
139639
|
+
agentRoleRevision: queuedItem.acpSessionConfig?.agentRoleRevision,
|
|
139095
139640
|
issuePRMentions: queuedItem.acpSessionConfig?.issuePRMentions,
|
|
139096
139641
|
resume: resolveResumableAcpSessionId(meta)
|
|
139097
139642
|
});
|
|
@@ -153575,10 +154120,7 @@ ${edit.newString}` : edit.newString;
|
|
|
153575
154120
|
type: "machine/acp-capabilities-refresh",
|
|
153576
154121
|
machineId: machine.id,
|
|
153577
154122
|
workspaceId: workspace.id,
|
|
153578
|
-
configId: config2.id
|
|
153579
|
-
cliType: config2.cliType,
|
|
153580
|
-
agentType: config2.agentType,
|
|
153581
|
-
env: config2.env
|
|
154123
|
+
configId: config2.id
|
|
153582
154124
|
}));
|
|
153583
154125
|
if (!response2.success) {
|
|
153584
154126
|
throw new Error(response2.error ?? `Failed to refresh capabilities for ${config2.name} on machine ${machine.id}.`);
|
|
@@ -157126,11 +157668,11 @@ ${entry.text}`).join("\n\n");
|
|
|
157126
157668
|
return null;
|
|
157127
157669
|
}
|
|
157128
157670
|
try {
|
|
157129
|
-
const stat2 = await
|
|
157671
|
+
const stat2 = await Xt.stat(absolutePath);
|
|
157130
157672
|
if (!stat2.isFile() || stat2.size > (options?.maxBytes ?? defaultMaxTextFileBytes)) {
|
|
157131
157673
|
return null;
|
|
157132
157674
|
}
|
|
157133
|
-
const content = await
|
|
157675
|
+
const content = await Xt.readFile(absolutePath);
|
|
157134
157676
|
if (content.includes(0)) {
|
|
157135
157677
|
return null;
|
|
157136
157678
|
}
|
|
@@ -167895,38 +168437,59 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
167895
168437
|
this.triggerPendingProcessLifecycleAction(response2.requestId);
|
|
167896
168438
|
}
|
|
167897
168439
|
},
|
|
167898
|
-
refreshMachineAcpCapabilities: async ({ configId,
|
|
168440
|
+
refreshMachineAcpCapabilities: async ({ configId, onAcpBinaryProgress, signal }) => await this.executionService.refreshMachineAcpCapabilities({
|
|
167899
168441
|
type: "machine/acp-capabilities-refresh",
|
|
167900
168442
|
machineId: this.machineId,
|
|
167901
168443
|
workspaceId: this.workspaceId,
|
|
167902
|
-
configId
|
|
167903
|
-
cliType,
|
|
167904
|
-
agentType,
|
|
167905
|
-
customAcp,
|
|
167906
|
-
runtimeOverrides,
|
|
167907
|
-
env: env2
|
|
168444
|
+
configId
|
|
167908
168445
|
}, {
|
|
167909
168446
|
onAcpBinaryProgress,
|
|
167910
168447
|
signal
|
|
167911
168448
|
}),
|
|
167912
|
-
authenticateMachineAcp: async (
|
|
167913
|
-
|
|
167914
|
-
|
|
167915
|
-
|
|
167916
|
-
|
|
167917
|
-
|
|
167918
|
-
|
|
167919
|
-
|
|
167920
|
-
|
|
167921
|
-
|
|
167922
|
-
|
|
167923
|
-
|
|
167924
|
-
|
|
167925
|
-
|
|
167926
|
-
|
|
167927
|
-
|
|
167928
|
-
|
|
167929
|
-
|
|
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
|
+
},
|
|
167930
168493
|
getMachineAcpBinaryStatus: async ({ agentType }) => await this.executionService.getMachineAcpBinaryStatus({
|
|
167931
168494
|
type: "machine/acp-binary-status",
|
|
167932
168495
|
machineId: this.machineId,
|
|
@@ -171711,19 +172274,64 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
171711
172274
|
const project = meta.project;
|
|
171712
172275
|
const ownerSessionId = meta.parentSessionId ?? sessionId;
|
|
171713
172276
|
if (project?.kind === "local") {
|
|
171714
|
-
const
|
|
171715
|
-
if (!
|
|
172277
|
+
const originalRootPath = await resolveWorkspaceLocalProjectRootPath(this.workspaceDocument.repo, this.workspaceId, this.machineId, project.localProjectId);
|
|
172278
|
+
if (!originalRootPath) {
|
|
171716
172279
|
return {
|
|
171717
172280
|
ok: false,
|
|
171718
172281
|
error: "workspace_unavailable",
|
|
171719
172282
|
message: `Local project not found in workspace: ${project.localProjectId}`
|
|
171720
172283
|
};
|
|
171721
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
|
+
}
|
|
171722
172331
|
return {
|
|
171723
|
-
ok:
|
|
171724
|
-
|
|
171725
|
-
|
|
171726
|
-
...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."
|
|
171727
172335
|
};
|
|
171728
172336
|
}
|
|
171729
172337
|
if (meta.parentSessionId) {
|
|
@@ -173221,7 +173829,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
173221
173829
|
}
|
|
173222
173830
|
async authenticateMachineAcpAndResumeSetup(message, options = {}) {
|
|
173223
173831
|
const response2 = await this.executionService.authenticateMachineAcp(message, options);
|
|
173224
|
-
if (message.action === "start" &&
|
|
173832
|
+
if (message.action === "start" && response2.success && response2.disposition === "authenticated") {
|
|
173225
173833
|
try {
|
|
173226
173834
|
await this.providerSetupManager.resumeAfterAuthentication(message.configId);
|
|
173227
173835
|
} catch (error2) {
|
|
@@ -197165,7 +197773,7 @@ Shutting down gracefully${reason}...`);
|
|
|
197165
197773
|
function requireLib$1() {
|
|
197166
197774
|
if (hasRequiredLib$1) return lib$1;
|
|
197167
197775
|
hasRequiredLib$1 = 1;
|
|
197168
|
-
const Stream =
|
|
197776
|
+
const Stream = xo;
|
|
197169
197777
|
class MuteStream2 extends Stream {
|
|
197170
197778
|
#isTTY = null;
|
|
197171
197779
|
constructor(opts = {}) {
|
|
@@ -206643,7 +207251,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206643
207251
|
function requireStreams() {
|
|
206644
207252
|
if (hasRequiredStreams) return streams;
|
|
206645
207253
|
hasRequiredStreams = 1;
|
|
206646
|
-
var Buffer2 = require$$0$6.Buffer, Transform2 =
|
|
207254
|
+
var Buffer2 = require$$0$6.Buffer, Transform2 = xo.Transform;
|
|
206647
207255
|
streams = function(iconv2) {
|
|
206648
207256
|
iconv2.encodeStream = function encodeStream(encoding2, options) {
|
|
206649
207257
|
return new IconvLiteEncoderStream(iconv2.getEncoder(encoding2, options), options);
|
|
@@ -206863,7 +207471,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206863
207471
|
return length2;
|
|
206864
207472
|
};
|
|
206865
207473
|
if (iconv2.supportsStreams) {
|
|
206866
|
-
var Readable2 =
|
|
207474
|
+
var Readable2 = xo.Readable;
|
|
206867
207475
|
original.ReadableSetEncoding = Readable2.prototype.setEncoding;
|
|
206868
207476
|
Readable2.prototype.setEncoding = function setEncoding(enc, options) {
|
|
206869
207477
|
this._readableState.decoder = iconv2.getDecoder(enc, options);
|
|
@@ -206884,7 +207492,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
206884
207492
|
Buffer2.prototype.toString = original.BufferToString;
|
|
206885
207493
|
Buffer2.prototype.write = original.BufferWrite;
|
|
206886
207494
|
if (iconv2.supportsStreams) {
|
|
206887
|
-
var Readable2 =
|
|
207495
|
+
var Readable2 = xo.Readable;
|
|
206888
207496
|
Readable2.prototype.setEncoding = original.ReadableSetEncoding;
|
|
206889
207497
|
delete Readable2.prototype.collect;
|
|
206890
207498
|
}
|
|
@@ -221562,7 +222170,7 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
|
221562
222170
|
data = createReviewBundleSnapshot(bundle);
|
|
221563
222171
|
}
|
|
221564
222172
|
const { injectReviewSnapshot } = await import("./chunks/index-VoI6Ds2-.js");
|
|
221565
|
-
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-
|
|
222173
|
+
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-HMN3RPEa.js").then(async (m) => {
|
|
221566
222174
|
await m.__tla;
|
|
221567
222175
|
return m;
|
|
221568
222176
|
});
|