@moxt-ai/mobius 0.0.283 → 0.0.284
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/protocol/session-capabilities.d.ts.map +1 -1
- package/dist/acp/protocol/session-capabilities.js +1 -3
- package/dist/acp/protocol/session-capabilities.js.map +1 -1
- package/dist/cli.js +43 -64
- package/dist/cli.js.map +4 -4
- package/dist/daemon/lifecycle/worker-process.d.ts +0 -1
- package/dist/daemon/lifecycle/worker-process.d.ts.map +1 -1
- package/dist/daemon/lifecycle/worker-process.js +1 -3
- package/dist/daemon/lifecycle/worker-process.js.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.js +1 -3
- package/dist/daemon/pairing/pair-local-machine.js.map +1 -1
- package/dist/runtime.js +85 -103
- package/dist/runtime.js.map +4 -4
- package/dist/session/live/agent-session.d.ts +0 -4
- package/dist/session/live/agent-session.d.ts.map +1 -1
- package/dist/session/live/agent-session.js +0 -12
- package/dist/session/live/agent-session.js.map +1 -1
- package/dist/session/native/native-chat-agent.d.ts +0 -1
- package/dist/session/native/native-chat-agent.d.ts.map +1 -1
- package/dist/session/native/native-chat-agent.js +0 -3
- package/dist/session/native/native-chat-agent.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -894,10 +894,26 @@ function readExecutableIdentity(path7) {
|
|
|
894
894
|
);
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
// src/
|
|
897
|
+
// src/util/value-utils.ts
|
|
898
|
+
function truncate(value, maximumLength) {
|
|
899
|
+
return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}\u2026`;
|
|
900
|
+
}
|
|
898
901
|
function isRecord(value) {
|
|
899
902
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
900
903
|
}
|
|
904
|
+
function readString(value, fallback = "") {
|
|
905
|
+
return typeof value === "string" ? value : fallback;
|
|
906
|
+
}
|
|
907
|
+
function arraysEqual(left, right) {
|
|
908
|
+
return left.length === right.length && left.every((value, index2) => value === right[index2]);
|
|
909
|
+
}
|
|
910
|
+
function recordsEqual(left, right) {
|
|
911
|
+
const leftEntries = Object.entries(left);
|
|
912
|
+
const rightEntries = Object.entries(right);
|
|
913
|
+
return leftEntries.length === rightEntries.length && leftEntries.every(([name2, value]) => right[name2] === value);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// src/acp/protocol/session-capabilities.ts
|
|
901
917
|
function hasTrueChildField(value, childKey, fieldKey) {
|
|
902
918
|
if (!isRecord(value)) {
|
|
903
919
|
return false;
|
|
@@ -20777,7 +20793,7 @@ function parseJson(encoded) {
|
|
|
20777
20793
|
}
|
|
20778
20794
|
return value;
|
|
20779
20795
|
}
|
|
20780
|
-
function
|
|
20796
|
+
function readString2(value, key, maximumLength) {
|
|
20781
20797
|
const field = value[key];
|
|
20782
20798
|
if (typeof field !== "string" || field.length === 0 || field.length > maximumLength) {
|
|
20783
20799
|
throw new ProtocolMessageError(`Invalid string field: ${key}`);
|
|
@@ -20815,7 +20831,7 @@ function readIdentifier(value, key) {
|
|
|
20815
20831
|
}
|
|
20816
20832
|
}
|
|
20817
20833
|
function readDirectoryIdentifier(value, key) {
|
|
20818
|
-
const field =
|
|
20834
|
+
const field = readString2(value, key, MAX_DIRECTORY_IDENTIFIER_LENGTH);
|
|
20819
20835
|
if (!isDirectoryIdentifier(field)) {
|
|
20820
20836
|
throw new ProtocolMessageError(`Invalid directory identifier field: ${key}`);
|
|
20821
20837
|
}
|
|
@@ -20827,7 +20843,7 @@ function assertKind(value, expectedKind) {
|
|
|
20827
20843
|
}
|
|
20828
20844
|
}
|
|
20829
20845
|
function decodeMessageKind(encoded) {
|
|
20830
|
-
return
|
|
20846
|
+
return readString2(parseJson(encoded), "kind", 64);
|
|
20831
20847
|
}
|
|
20832
20848
|
function decodeZodMessage(encoded, schema) {
|
|
20833
20849
|
const result = schema.safeParse(parseJson(encoded));
|
|
@@ -22552,7 +22568,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
22552
22568
|
// package.json
|
|
22553
22569
|
var package_default = {
|
|
22554
22570
|
name: "@moxt-ai/mobius",
|
|
22555
|
-
version: "0.0.
|
|
22571
|
+
version: "0.0.284",
|
|
22556
22572
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
22557
22573
|
type: "module",
|
|
22558
22574
|
bin: {
|
|
@@ -67056,7 +67072,7 @@ import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
|
67056
67072
|
import { pathToFileURL } from "node:url";
|
|
67057
67073
|
var TOOL_OUTPUT_CHARACTER_LIMIT = 32768;
|
|
67058
67074
|
var TITLE_CHARACTER_LIMIT = 500;
|
|
67059
|
-
function
|
|
67075
|
+
function truncate2(value, limit) {
|
|
67060
67076
|
return value.length <= limit ? value : value.slice(0, limit);
|
|
67061
67077
|
}
|
|
67062
67078
|
function boundedParagraphs(values, limit) {
|
|
@@ -67072,7 +67088,7 @@ function boundedParagraphs(values, limit) {
|
|
|
67072
67088
|
return text2;
|
|
67073
67089
|
}
|
|
67074
67090
|
function textContent(text2) {
|
|
67075
|
-
const block = { text:
|
|
67091
|
+
const block = { text: truncate2(text2, TOOL_OUTPUT_CHARACTER_LIMIT), type: "text" };
|
|
67076
67092
|
return { content: block, type: "content" };
|
|
67077
67093
|
}
|
|
67078
67094
|
function structuredToolText(value) {
|
|
@@ -67161,16 +67177,16 @@ function presentToolItem(item) {
|
|
|
67161
67177
|
rawInput: { command: item.command, cwd: item.cwd },
|
|
67162
67178
|
rawOutput: {
|
|
67163
67179
|
...item.exitCode == null ? {} : { exitCode: item.exitCode },
|
|
67164
|
-
output:
|
|
67180
|
+
output: truncate2(output2, TOOL_OUTPUT_CHARACTER_LIMIT)
|
|
67165
67181
|
},
|
|
67166
67182
|
status: commandStatus(item.status),
|
|
67167
|
-
title:
|
|
67183
|
+
title: truncate2(firstLine(item.command), TITLE_CHARACTER_LIMIT)
|
|
67168
67184
|
};
|
|
67169
67185
|
}
|
|
67170
67186
|
if (item.type === "fileChange") {
|
|
67171
67187
|
const paths = item.changes.map((change) => change.path);
|
|
67172
67188
|
const content = item.changes.map((change) => ({
|
|
67173
|
-
newText:
|
|
67189
|
+
newText: truncate2(change.diff, TOOL_OUTPUT_CHARACTER_LIMIT),
|
|
67174
67190
|
path: change.path,
|
|
67175
67191
|
type: "diff"
|
|
67176
67192
|
}));
|
|
@@ -67181,7 +67197,7 @@ function presentToolItem(item) {
|
|
|
67181
67197
|
rawInput: { changes: item.changes.map((change) => change.path) },
|
|
67182
67198
|
rawOutput: null,
|
|
67183
67199
|
status: patchStatus(item.status),
|
|
67184
|
-
title:
|
|
67200
|
+
title: truncate2(paths.join(", "), TITLE_CHARACTER_LIMIT)
|
|
67185
67201
|
};
|
|
67186
67202
|
}
|
|
67187
67203
|
if (item.type === "mcpToolCall") {
|
|
@@ -67194,7 +67210,7 @@ function presentToolItem(item) {
|
|
|
67194
67210
|
rawInput: item.arguments ?? null,
|
|
67195
67211
|
rawOutput: item.error ?? item.result ?? null,
|
|
67196
67212
|
status: mcpStatus(item.status),
|
|
67197
|
-
title:
|
|
67213
|
+
title: truncate2(label, TITLE_CHARACTER_LIMIT)
|
|
67198
67214
|
};
|
|
67199
67215
|
}
|
|
67200
67216
|
if (item.type === "dynamicToolCall") {
|
|
@@ -67207,7 +67223,7 @@ function presentToolItem(item) {
|
|
|
67207
67223
|
rawInput: item.arguments ?? null,
|
|
67208
67224
|
rawOutput: item.contentItems ?? null,
|
|
67209
67225
|
status: mcpStatus(item.status),
|
|
67210
|
-
title:
|
|
67226
|
+
title: truncate2(label, TITLE_CHARACTER_LIMIT)
|
|
67211
67227
|
};
|
|
67212
67228
|
}
|
|
67213
67229
|
if (item.type === "collabAgentToolCall") {
|
|
@@ -67238,7 +67254,7 @@ function presentToolItem(item) {
|
|
|
67238
67254
|
rawInput: { agentPath: item.agentPath },
|
|
67239
67255
|
rawOutput: { agentThreadId: item.agentThreadId },
|
|
67240
67256
|
status: "in_progress",
|
|
67241
|
-
title:
|
|
67257
|
+
title: truncate2(`Dispatch subagent ${item.agentPath}`, TITLE_CHARACTER_LIMIT)
|
|
67242
67258
|
};
|
|
67243
67259
|
}
|
|
67244
67260
|
return null;
|
|
@@ -74387,9 +74403,6 @@ var PairingClientError = class extends Error {
|
|
|
74387
74403
|
this.name = "PairingClientError";
|
|
74388
74404
|
}
|
|
74389
74405
|
};
|
|
74390
|
-
function isRecord6(value) {
|
|
74391
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
74392
|
-
}
|
|
74393
74406
|
function hasExactKeys2(value, expectedKeys) {
|
|
74394
74407
|
const keys = Object.keys(value);
|
|
74395
74408
|
return keys.length === expectedKeys.length && expectedKeys.every((key) => Object.hasOwn(value, key));
|
|
@@ -74461,9 +74474,9 @@ async function readJsonResponse(response) {
|
|
|
74461
74474
|
}
|
|
74462
74475
|
}
|
|
74463
74476
|
function readRelayError(value) {
|
|
74464
|
-
if (
|
|
74477
|
+
if (isRecord(value)) {
|
|
74465
74478
|
const error62 = value["error"];
|
|
74466
|
-
if (
|
|
74479
|
+
if (isRecord(error62)) {
|
|
74467
74480
|
const code = error62["code"];
|
|
74468
74481
|
const message = error62["message"];
|
|
74469
74482
|
if (typeof code === "string" && typeof message === "string") {
|
|
@@ -74474,7 +74487,7 @@ function readRelayError(value) {
|
|
|
74474
74487
|
return new PairingClientError("pairing_failed", "The relay could not pair this machine");
|
|
74475
74488
|
}
|
|
74476
74489
|
function decodePairingResponse(value, credentialField, expectedKeys) {
|
|
74477
|
-
if (!
|
|
74490
|
+
if (!isRecord(value) || !hasExactKeys2(value, expectedKeys)) {
|
|
74478
74491
|
throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
|
|
74479
74492
|
}
|
|
74480
74493
|
const appId = value["appId"];
|
|
@@ -75691,7 +75704,7 @@ var toolImageSchema = external_exports.union([
|
|
|
75691
75704
|
file: external_exports.object({ base64: external_exports.string(), type: external_exports.string() })
|
|
75692
75705
|
}).transform(({ file: file2 }) => ({ type: "image", data: file2.base64, mimeType: file2.type }))
|
|
75693
75706
|
]);
|
|
75694
|
-
function
|
|
75707
|
+
function isRecord6(value) {
|
|
75695
75708
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
75696
75709
|
}
|
|
75697
75710
|
var AcpContentExternalizer = class {
|
|
@@ -75798,13 +75811,13 @@ var AcpContentExternalizer = class {
|
|
|
75798
75811
|
}
|
|
75799
75812
|
return result2;
|
|
75800
75813
|
}
|
|
75801
|
-
if (!
|
|
75814
|
+
if (!isRecord6(value)) {
|
|
75802
75815
|
return value;
|
|
75803
75816
|
}
|
|
75804
75817
|
const image = toolImageSchema.safeParse(value);
|
|
75805
75818
|
if (image.success && image.data.data.length > 0) {
|
|
75806
75819
|
const prepared = await this.#content(sessionId, image.data, signal);
|
|
75807
|
-
if (
|
|
75820
|
+
if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
75808
75821
|
images.set(prepared.event["imageKey"], prepared);
|
|
75809
75822
|
} else {
|
|
75810
75823
|
images.set(`unavailable:${images.size}`, prepared);
|
|
@@ -75835,7 +75848,7 @@ var AcpContentExternalizer = class {
|
|
|
75835
75848
|
const prepared = await this.#content(sessionId, content, signal);
|
|
75836
75849
|
agentContent.push({ ...item, content: prepared.agent });
|
|
75837
75850
|
eventContent.push({ ...item, content: prepared.event });
|
|
75838
|
-
if (
|
|
75851
|
+
if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
75839
75852
|
images.delete(prepared.event["imageKey"]);
|
|
75840
75853
|
}
|
|
75841
75854
|
}
|
|
@@ -81921,41 +81934,20 @@ function buildPromptContent(options, capabilities) {
|
|
|
81921
81934
|
// src/acp/connection/agent-connection.ts
|
|
81922
81935
|
import { spawn as spawn7 } from "node:child_process";
|
|
81923
81936
|
import { ndJsonStream as ndJsonStream3, RequestError as RequestError8 } from "@agentclientprotocol/sdk";
|
|
81924
|
-
|
|
81925
|
-
// src/util/value-utils.ts
|
|
81926
|
-
function truncate2(value, maximumLength) {
|
|
81927
|
-
return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}\u2026`;
|
|
81928
|
-
}
|
|
81929
|
-
function isRecord8(value) {
|
|
81930
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81931
|
-
}
|
|
81932
|
-
function readString2(value, fallback = "") {
|
|
81933
|
-
return typeof value === "string" ? value : fallback;
|
|
81934
|
-
}
|
|
81935
|
-
function arraysEqual(left, right) {
|
|
81936
|
-
return left.length === right.length && left.every((value, index2) => value === right[index2]);
|
|
81937
|
-
}
|
|
81938
|
-
function recordsEqual(left, right) {
|
|
81939
|
-
const leftEntries = Object.entries(left);
|
|
81940
|
-
const rightEntries = Object.entries(right);
|
|
81941
|
-
return leftEntries.length === rightEntries.length && leftEntries.every(([name2, value]) => right[name2] === value);
|
|
81942
|
-
}
|
|
81943
|
-
|
|
81944
|
-
// src/acp/connection/agent-connection.ts
|
|
81945
81937
|
function requestErrorMessage(error62) {
|
|
81946
|
-
const fallback =
|
|
81947
|
-
if (error62.message !== "Internal error" || !
|
|
81938
|
+
const fallback = truncate(error62.message, 500);
|
|
81939
|
+
if (error62.message !== "Internal error" || !isRecord(error62.data)) {
|
|
81948
81940
|
return fallback;
|
|
81949
81941
|
}
|
|
81950
81942
|
const agentError = error62.data["error"];
|
|
81951
|
-
if (
|
|
81943
|
+
if (isRecord(agentError)) {
|
|
81952
81944
|
const message = agentError["message"];
|
|
81953
81945
|
if (typeof message === "string" && message.length > 0) {
|
|
81954
|
-
return
|
|
81946
|
+
return truncate(message, 500);
|
|
81955
81947
|
}
|
|
81956
81948
|
}
|
|
81957
81949
|
const details = error62.data["details"];
|
|
81958
|
-
return typeof details === "string" && details.length > 0 ?
|
|
81950
|
+
return typeof details === "string" && details.length > 0 ? truncate(details, 500) : fallback;
|
|
81959
81951
|
}
|
|
81960
81952
|
function readableWebStream(input2) {
|
|
81961
81953
|
let streamOpen = true;
|
|
@@ -82255,7 +82247,7 @@ var SessionConfigProtocolError = class extends Error {
|
|
|
82255
82247
|
this.name = "SessionConfigProtocolError";
|
|
82256
82248
|
}
|
|
82257
82249
|
};
|
|
82258
|
-
function
|
|
82250
|
+
function isRecord7(value) {
|
|
82259
82251
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82260
82252
|
}
|
|
82261
82253
|
function readString3(value, fallback = "") {
|
|
@@ -82286,7 +82278,7 @@ function normalizeConfigValues(value) {
|
|
|
82286
82278
|
}
|
|
82287
82279
|
const normalized = [];
|
|
82288
82280
|
for (const entry of value) {
|
|
82289
|
-
if (!
|
|
82281
|
+
if (!isRecord7(entry)) {
|
|
82290
82282
|
continue;
|
|
82291
82283
|
}
|
|
82292
82284
|
const groupedOptions = entry["options"];
|
|
@@ -82294,7 +82286,7 @@ function normalizeConfigValues(value) {
|
|
|
82294
82286
|
const groupId = readString3(entry["group"]);
|
|
82295
82287
|
const groupName = readString3(entry["name"]);
|
|
82296
82288
|
for (const groupedOption of groupedOptions) {
|
|
82297
|
-
if (
|
|
82289
|
+
if (isRecord7(groupedOption)) {
|
|
82298
82290
|
const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
|
|
82299
82291
|
if (normalizedValue !== void 0) {
|
|
82300
82292
|
normalized.push(normalizedValue);
|
|
@@ -82319,7 +82311,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82319
82311
|
const normalized = [];
|
|
82320
82312
|
if (Array.isArray(value)) {
|
|
82321
82313
|
for (const option of value) {
|
|
82322
|
-
if (!
|
|
82314
|
+
if (!isRecord7(option)) {
|
|
82323
82315
|
continue;
|
|
82324
82316
|
}
|
|
82325
82317
|
const id = truncate3(readString3(option["id"]), 128);
|
|
@@ -82359,12 +82351,12 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82359
82351
|
}
|
|
82360
82352
|
}
|
|
82361
82353
|
}
|
|
82362
|
-
if (
|
|
82354
|
+
if (isRecord7(modes)) {
|
|
82363
82355
|
const values = [];
|
|
82364
82356
|
const availableModes = modes["availableModes"];
|
|
82365
82357
|
if (Array.isArray(availableModes)) {
|
|
82366
82358
|
for (const mode of availableModes) {
|
|
82367
|
-
if (!
|
|
82359
|
+
if (!isRecord7(mode)) {
|
|
82368
82360
|
continue;
|
|
82369
82361
|
}
|
|
82370
82362
|
const id = truncate3(readString3(mode["id"]), 500);
|
|
@@ -82397,7 +82389,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82397
82389
|
return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
82398
82390
|
}
|
|
82399
82391
|
function normalizeStandardLifecycle(response) {
|
|
82400
|
-
const lifecycle =
|
|
82392
|
+
const lifecycle = isRecord7(response) ? response : {};
|
|
82401
82393
|
return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
82402
82394
|
}
|
|
82403
82395
|
function replaceStandardConfigOptions(current, value) {
|
|
@@ -82439,7 +82431,7 @@ var StandardSessionConfigProtocol = class {
|
|
|
82439
82431
|
"ACP agent exited while changing session configuration",
|
|
82440
82432
|
change.signal
|
|
82441
82433
|
);
|
|
82442
|
-
if (!
|
|
82434
|
+
if (!isRecord7(response) || !Array.isArray(response["configOptions"])) {
|
|
82443
82435
|
throw new SessionConfigProtocolError("The Agent returned an invalid session configuration response");
|
|
82444
82436
|
}
|
|
82445
82437
|
return replaceStandardConfigOptions(current, response["configOptions"]);
|
|
@@ -82536,11 +82528,11 @@ function normalizeElicitationOptions(schema) {
|
|
|
82536
82528
|
const oneOf = schema["oneOf"];
|
|
82537
82529
|
if (Array.isArray(oneOf)) {
|
|
82538
82530
|
for (const option of oneOf) {
|
|
82539
|
-
if (
|
|
82531
|
+
if (isRecord(option) && typeof option["const"] === "string") {
|
|
82540
82532
|
normalized.push({
|
|
82541
|
-
description:
|
|
82542
|
-
label:
|
|
82543
|
-
value:
|
|
82533
|
+
description: truncate(readString(option["description"]), 500),
|
|
82534
|
+
label: truncate(readString(option["title"], option["const"]), 255),
|
|
82535
|
+
value: truncate(option["const"], 500)
|
|
82544
82536
|
});
|
|
82545
82537
|
}
|
|
82546
82538
|
}
|
|
@@ -82556,7 +82548,7 @@ function normalizeElicitationOptions(schema) {
|
|
|
82556
82548
|
return normalized.slice(0, 200);
|
|
82557
82549
|
}
|
|
82558
82550
|
const items = schema["items"];
|
|
82559
|
-
if (!
|
|
82551
|
+
if (!isRecord(items)) {
|
|
82560
82552
|
return normalized;
|
|
82561
82553
|
}
|
|
82562
82554
|
const anyOf = items["anyOf"];
|
|
@@ -82569,7 +82561,7 @@ function numericString(value) {
|
|
|
82569
82561
|
return typeof value === "number" && Number.isFinite(value) ? value.toString() : "";
|
|
82570
82562
|
}
|
|
82571
82563
|
function normalizeElicitationFields(requestedSchema) {
|
|
82572
|
-
if (!
|
|
82564
|
+
if (!isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
|
|
82573
82565
|
return [];
|
|
82574
82566
|
}
|
|
82575
82567
|
const properties = requestedSchema["properties"];
|
|
@@ -82579,7 +82571,7 @@ function normalizeElicitationFields(requestedSchema) {
|
|
|
82579
82571
|
);
|
|
82580
82572
|
const normalized = [];
|
|
82581
82573
|
for (const [name2, property] of Object.entries(properties)) {
|
|
82582
|
-
if (!
|
|
82574
|
+
if (!isRecord(property)) {
|
|
82583
82575
|
continue;
|
|
82584
82576
|
}
|
|
82585
82577
|
const type = elicitationFieldType(property["type"]);
|
|
@@ -82589,19 +82581,19 @@ function normalizeElicitationFields(requestedSchema) {
|
|
|
82589
82581
|
normalized.push({
|
|
82590
82582
|
defaultBooleanValue: typeof defaultValue === "boolean" ? defaultValue : false,
|
|
82591
82583
|
defaultNumberValue: typeof defaultValue === "number" && Number.isFinite(defaultValue) ? defaultValue : 0,
|
|
82592
|
-
defaultStringValue: typeof defaultValue === "string" ?
|
|
82593
|
-
description:
|
|
82594
|
-
format:
|
|
82584
|
+
defaultStringValue: typeof defaultValue === "string" ? truncate(defaultValue, 1e4) : Array.isArray(defaultValue) ? truncate(JSON.stringify(defaultValue), 1e4) : "",
|
|
82585
|
+
description: truncate(readString(property["description"]), 500),
|
|
82586
|
+
format: truncate(readString(property["format"]), 64),
|
|
82595
82587
|
hasDefaultValue: defaultValue !== void 0 && defaultValue !== null,
|
|
82596
82588
|
maximum: numericString(property["maximum"]),
|
|
82597
82589
|
maximumLength: numericString(property["maxLength"] ?? property["maxItems"]),
|
|
82598
82590
|
minimum: numericString(property["minimum"]),
|
|
82599
82591
|
minimumLength: numericString(property["minLength"] ?? property["minItems"]),
|
|
82600
|
-
name:
|
|
82592
|
+
name: truncate(name2, 128),
|
|
82601
82593
|
options,
|
|
82602
|
-
pattern:
|
|
82594
|
+
pattern: truncate(readString(property["pattern"]), 500),
|
|
82603
82595
|
required: required2.has(name2),
|
|
82604
|
-
title:
|
|
82596
|
+
title: truncate(readString(property["title"], name2), 255),
|
|
82605
82597
|
type: normalizedType
|
|
82606
82598
|
});
|
|
82607
82599
|
}
|
|
@@ -82670,7 +82662,7 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
82670
82662
|
"invalid_elicitation_response"
|
|
82671
82663
|
);
|
|
82672
82664
|
}
|
|
82673
|
-
if (!
|
|
82665
|
+
if (!isRecord(decoded) || !isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
|
|
82674
82666
|
throw new AcpExecutionError(
|
|
82675
82667
|
"Elicitation response does not match the requested form",
|
|
82676
82668
|
{},
|
|
@@ -82690,7 +82682,7 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
82690
82682
|
const validated = {};
|
|
82691
82683
|
for (const [name2, value] of Object.entries(decoded)) {
|
|
82692
82684
|
const property = properties[name2];
|
|
82693
|
-
if (!
|
|
82685
|
+
if (!isRecord(property)) {
|
|
82694
82686
|
throw new AcpExecutionError(
|
|
82695
82687
|
`Elicitation field ${name2} was not requested`,
|
|
82696
82688
|
{},
|
|
@@ -82922,8 +82914,8 @@ var SessionInteractions = class {
|
|
|
82922
82914
|
const interactionId = `permission-${crypto.randomUUID()}`;
|
|
82923
82915
|
const options = request.options.slice(0, 20).map((option) => ({
|
|
82924
82916
|
kind: option.kind,
|
|
82925
|
-
name:
|
|
82926
|
-
optionId:
|
|
82917
|
+
name: truncate(option.name, 255),
|
|
82918
|
+
optionId: truncate(option.optionId, 255)
|
|
82927
82919
|
}));
|
|
82928
82920
|
if (options.length === 0) {
|
|
82929
82921
|
throw new AcpExecutionError(
|
|
@@ -82955,9 +82947,9 @@ var SessionInteractions = class {
|
|
|
82955
82947
|
kind: SESSION_PERMISSION_REQUESTED_KIND,
|
|
82956
82948
|
options,
|
|
82957
82949
|
sessionId: this.#context.sessionId(),
|
|
82958
|
-
title:
|
|
82959
|
-
toolCallId:
|
|
82960
|
-
toolKind:
|
|
82950
|
+
title: truncate(title2 ?? "Permission required", 500),
|
|
82951
|
+
toolCallId: truncate(request.toolCall.toolCallId, 255),
|
|
82952
|
+
toolKind: truncate(kind ?? "other", 64)
|
|
82961
82953
|
});
|
|
82962
82954
|
return await pending.completion.promise;
|
|
82963
82955
|
} finally {
|
|
@@ -82986,7 +82978,7 @@ var SessionInteractions = class {
|
|
|
82986
82978
|
const schemaValue = Reflect.get(request, "requestedSchema");
|
|
82987
82979
|
const requestedSchema = request.mode === "form" ? schemaValue : {};
|
|
82988
82980
|
const elicitationIdValue = Reflect.get(request, "elicitationId");
|
|
82989
|
-
const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ?
|
|
82981
|
+
const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate(elicitationIdValue, 255) : "";
|
|
82990
82982
|
const pending = new PendingElicitation(interactionId, elicitationId, requestedSchema);
|
|
82991
82983
|
this.#pendingElicitations.set(interactionId, pending);
|
|
82992
82984
|
const abort = () => {
|
|
@@ -83001,10 +82993,10 @@ var SessionInteractions = class {
|
|
|
83001
82993
|
fields: normalizeElicitationFields(requestedSchema),
|
|
83002
82994
|
interactionId,
|
|
83003
82995
|
kind: SESSION_ELICITATION_REQUESTED_KIND,
|
|
83004
|
-
message:
|
|
82996
|
+
message: truncate(request.message, 2e3),
|
|
83005
82997
|
mode: request.mode,
|
|
83006
82998
|
sessionId: this.#context.sessionId(),
|
|
83007
|
-
url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ?
|
|
82999
|
+
url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString(Reflect.get(request, "url")), 4096) : ""
|
|
83008
83000
|
});
|
|
83009
83001
|
return await pending.completion.promise;
|
|
83010
83002
|
} finally {
|
|
@@ -83518,7 +83510,6 @@ var AgentSession = class _AgentSession {
|
|
|
83518
83510
|
#sessionConfigurations = new SessionConfigurations();
|
|
83519
83511
|
#nativeHistoryOwnership = { kind: "unbound" };
|
|
83520
83512
|
#prompted = false;
|
|
83521
|
-
#nativePrompt = null;
|
|
83522
83513
|
#sessionLoad = { kind: "not-requested" };
|
|
83523
83514
|
#restored = false;
|
|
83524
83515
|
#sessionTitle = null;
|
|
@@ -83644,7 +83635,7 @@ var AgentSession = class _AgentSession {
|
|
|
83644
83635
|
* directory observes the same title transition.
|
|
83645
83636
|
*/
|
|
83646
83637
|
renameSession = async (title2, signal) => {
|
|
83647
|
-
const normalized =
|
|
83638
|
+
const normalized = truncate(title2, 500);
|
|
83648
83639
|
if (normalized.length === 0) {
|
|
83649
83640
|
throw new AcpExecutionError("The Session title cannot be empty", {}, "invalid_session_title");
|
|
83650
83641
|
}
|
|
@@ -83825,8 +83816,8 @@ var AgentSession = class _AgentSession {
|
|
|
83825
83816
|
);
|
|
83826
83817
|
}
|
|
83827
83818
|
this.#capabilities = normalizeAcpCapabilities(initialized);
|
|
83828
|
-
this.#agentName =
|
|
83829
|
-
this.#agentVersion =
|
|
83819
|
+
this.#agentName = truncate(initialized.agentInfo?.title ?? initialized.agentInfo?.name ?? this.#agentId, 255);
|
|
83820
|
+
this.#agentVersion = truncate(
|
|
83830
83821
|
this.#verifiedAgentVersion.length > 0 ? this.#verifiedAgentVersion : initialized.agentInfo?.version ?? "",
|
|
83831
83822
|
128
|
|
83832
83823
|
);
|
|
@@ -83956,11 +83947,6 @@ var AgentSession = class _AgentSession {
|
|
|
83956
83947
|
return this.#configOptions;
|
|
83957
83948
|
};
|
|
83958
83949
|
buildPrompt = (options) => buildPromptContent(options, this.#capabilities);
|
|
83959
|
-
nativeHistoryTurn = () => {
|
|
83960
|
-
const prompt = this.#nativePrompt;
|
|
83961
|
-
const nativeTurnId = this.#connection.inProcessAgent?.nativeTurnId?.() ?? null;
|
|
83962
|
-
return prompt === null || nativeTurnId === null || nativeTurnId === prompt.previousTurnId ? null : { commandId: prompt.commandId, nativeTurnId };
|
|
83963
|
-
};
|
|
83964
83950
|
prompt = async (options) => {
|
|
83965
83951
|
if (this.#turn.running) {
|
|
83966
83952
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
@@ -83977,7 +83963,7 @@ var AgentSession = class _AgentSession {
|
|
|
83977
83963
|
}
|
|
83978
83964
|
const prompt = this.buildPrompt(options);
|
|
83979
83965
|
if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
|
|
83980
|
-
this.#sessionTitle =
|
|
83966
|
+
this.#sessionTitle = truncate(options.prompt, 500);
|
|
83981
83967
|
}
|
|
83982
83968
|
this.#prompted = true;
|
|
83983
83969
|
this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -84006,10 +83992,6 @@ var AgentSession = class _AgentSession {
|
|
|
84006
83992
|
type: "lifecycle-metadata"
|
|
84007
83993
|
});
|
|
84008
83994
|
}
|
|
84009
|
-
this.#nativePrompt = {
|
|
84010
|
-
commandId: options.commandId,
|
|
84011
|
-
previousTurnId: this.#connection.inProcessAgent?.nativeTurnId?.() ?? null
|
|
84012
|
-
};
|
|
84013
83995
|
try {
|
|
84014
83996
|
const response = await this.race(
|
|
84015
83997
|
this.#connection.connection.agent.request(
|
|
@@ -84048,7 +84030,7 @@ var AgentSession = class _AgentSession {
|
|
|
84048
84030
|
code: failure2.code,
|
|
84049
84031
|
commandId: options.commandId,
|
|
84050
84032
|
kind: "prompt.failed",
|
|
84051
|
-
message:
|
|
84033
|
+
message: truncate(failure2.message, 500)
|
|
84052
84034
|
},
|
|
84053
84035
|
type: "lifecycle-metadata"
|
|
84054
84036
|
});
|
|
@@ -84106,7 +84088,7 @@ var AgentSession = class _AgentSession {
|
|
|
84106
84088
|
"ACP agent exited during steering",
|
|
84107
84089
|
options.signal
|
|
84108
84090
|
);
|
|
84109
|
-
if (!
|
|
84091
|
+
if (!isRecord(response)) {
|
|
84110
84092
|
throw new AcpExecutionError(
|
|
84111
84093
|
"ACP agent returned an invalid steering response",
|
|
84112
84094
|
{},
|
|
@@ -84147,7 +84129,7 @@ var AgentSession = class _AgentSession {
|
|
|
84147
84129
|
code: failure2.code,
|
|
84148
84130
|
commandId: options.commandId,
|
|
84149
84131
|
kind: "prompt.failed",
|
|
84150
|
-
message:
|
|
84132
|
+
message: truncate(failure2.message, 500)
|
|
84151
84133
|
},
|
|
84152
84134
|
type: "lifecycle-metadata"
|
|
84153
84135
|
});
|
|
@@ -84214,9 +84196,9 @@ var AgentSession = class _AgentSession {
|
|
|
84214
84196
|
}
|
|
84215
84197
|
if (update.sessionUpdate === "available_commands_update") {
|
|
84216
84198
|
const commands = update.availableCommands.slice(0, 500).map((command) => ({
|
|
84217
|
-
description:
|
|
84218
|
-
inputHint:
|
|
84219
|
-
name:
|
|
84199
|
+
description: truncate(command.description, 500),
|
|
84200
|
+
inputHint: truncate(command.input?.hint ?? "", 255),
|
|
84201
|
+
name: truncate(command.name, 128)
|
|
84220
84202
|
})).filter((command) => command.name.length > 0);
|
|
84221
84203
|
this.#commands = commands;
|
|
84222
84204
|
await this.#getObserver().onCommands({
|
|
@@ -84247,10 +84229,10 @@ var AgentSession = class _AgentSession {
|
|
|
84247
84229
|
}
|
|
84248
84230
|
if (update.sessionUpdate === "session_info_update") {
|
|
84249
84231
|
if (Object.hasOwn(update, "title")) {
|
|
84250
|
-
this.#sessionTitle =
|
|
84232
|
+
this.#sessionTitle = truncate(update.title ?? "", 500);
|
|
84251
84233
|
}
|
|
84252
84234
|
if (Object.hasOwn(update, "updatedAt")) {
|
|
84253
|
-
this.#sessionUpdatedAt =
|
|
84235
|
+
this.#sessionUpdatedAt = truncate(update.updatedAt ?? "", 128);
|
|
84254
84236
|
}
|
|
84255
84237
|
if (this.#updates.sessionId().length > 0) {
|
|
84256
84238
|
this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
|