@moxt-ai/mobius 0.0.17 → 0.0.19
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/activity.d.ts.map +1 -1
- package/dist/acp/activity.js +4 -12
- package/dist/acp/activity.js.map +1 -1
- package/dist/acp/create-client.d.ts.map +1 -1
- package/dist/acp/create-client.js.map +1 -1
- package/dist/acp/native-session.d.ts.map +1 -1
- package/dist/acp/native-session.js +1 -3
- package/dist/acp/native-session.js.map +1 -1
- package/dist/acp/run-prompt.d.ts.map +1 -1
- package/dist/acp/run-prompt.js +1 -1
- package/dist/acp/run-prompt.js.map +1 -1
- package/dist/acp/session-capabilities.d.ts +5 -0
- package/dist/acp/session-capabilities.d.ts.map +1 -0
- package/dist/acp/session-capabilities.js +31 -0
- package/dist/acp/session-capabilities.js.map +1 -0
- package/dist/acp/session-config/grok-build-session-config.d.ts.map +1 -1
- package/dist/acp/session-config/grok-build-session-config.js +6 -11
- package/dist/acp/session-config/grok-build-session-config.js.map +1 -1
- package/dist/acp/session-config/session-config-protocol.d.ts.map +1 -1
- package/dist/acp/session-config/session-config-protocol.js +4 -12
- package/dist/acp/session-config/session-config-protocol.js.map +1 -1
- package/dist/acp/session-config/session-config-registry.d.ts.map +1 -1
- package/dist/acp/session-config/session-config-registry.js +2 -4
- package/dist/acp/session-config/session-config-registry.js.map +1 -1
- package/dist/acp/session-history.d.ts.map +1 -1
- package/dist/acp/session-history.js +7 -8
- package/dist/acp/session-history.js.map +1 -1
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +59 -96
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/acp/session-store.d.ts.map +1 -1
- package/dist/acp/session-store.js +12 -24
- package/dist/acp/session-store.js.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.d.ts +7 -1
- package/dist/agent-catalog/acp-readiness-probe.d.ts.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.js +13 -3
- package/dist/agent-catalog/acp-readiness-probe.js.map +1 -1
- package/dist/agent-catalog/agent-diagnostics.d.ts.map +1 -1
- package/dist/agent-catalog/agent-diagnostics.js.map +1 -1
- package/dist/agent-catalog/agent-discovery-context.d.ts.map +1 -1
- package/dist/agent-catalog/agent-discovery.d.ts +19 -9
- package/dist/agent-catalog/agent-discovery.d.ts.map +1 -1
- package/dist/agent-catalog/agent-discovery.js +32 -16
- package/dist/agent-catalog/agent-discovery.js.map +1 -1
- package/dist/agent-catalog/agent-probe-error.d.ts.map +1 -1
- package/dist/agent-catalog/agent-probe-error.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts +0 -1
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +2 -6
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/agents/claude-code-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/claude-code-agent.js +1 -8
- package/dist/agent-catalog/agents/claude-code-agent.js.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.js.map +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts +0 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.js +0 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.js.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.js +4 -4
- package/dist/agent-catalog/agents/deepseek-harness-agent.js.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.js +4 -14
- package/dist/agent-catalog/agents/grok-build-agent.js.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.js +1 -1
- package/dist/agent-catalog/agents/opencode-agent.js.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.js +1 -1
- package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
- package/dist/agent-catalog/agents/supported-agent-specifications.js.map +1 -1
- package/dist/agent-catalog/agents/verify-session-creation.d.ts.map +1 -1
- package/dist/agent-catalog/agents/verify-session-creation.js +1 -1
- package/dist/agent-catalog/agents/verify-session-creation.js.map +1 -1
- package/dist/agent-catalog/agents/workbuddy-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/workbuddy-agent.js +3 -6
- package/dist/agent-catalog/agents/workbuddy-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +33 -29
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-catalog/discover-local-agents.d.ts +0 -1
- package/dist/agent-catalog/discover-local-agents.d.ts.map +1 -1
- package/dist/agent-catalog/discover-local-agents.js +1 -1
- package/dist/agent-catalog/discover-local-agents.js.map +1 -1
- package/dist/agent-catalog/executable-discovery.d.ts.map +1 -1
- package/dist/agent-catalog/executable-discovery.js.map +1 -1
- package/dist/agent-catalog/local-agent.d.ts +15 -2
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +21 -3
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/agent-catalog/publish-agent-catalog.d.ts.map +1 -1
- package/dist/agent-catalog/publish-agent-catalog.js +5 -7
- package/dist/agent-catalog/publish-agent-catalog.js.map +1 -1
- package/dist/agent-installation/agent-installation-manager.d.ts.map +1 -1
- package/dist/agent-installation/agent-installation-manager.js +8 -7
- package/dist/agent-installation/agent-installation-manager.js.map +1 -1
- package/dist/agent-installation/deepseek-managed-package.d.ts.map +1 -1
- package/dist/agent-installation/deepseek-managed-package.js +1 -3
- package/dist/agent-installation/deepseek-managed-package.js.map +1 -1
- package/dist/agent-installation/fixed-installation-executor.d.ts +2 -3
- package/dist/agent-installation/fixed-installation-executor.d.ts.map +1 -1
- package/dist/agent-installation/fixed-installation-executor.js +47 -70
- package/dist/agent-installation/fixed-installation-executor.js.map +1 -1
- package/dist/agent-installation/grok-managed-package.d.ts.map +1 -1
- package/dist/agent-installation/grok-managed-package.js +2 -4
- package/dist/agent-installation/grok-managed-package.js.map +1 -1
- package/dist/agent-installation/managed-adapter-installer.d.ts.map +1 -1
- package/dist/agent-installation/managed-adapter-installer.js +3 -1
- package/dist/agent-installation/managed-adapter-installer.js.map +1 -1
- package/dist/agent-installation/managed-agent-archive.d.ts +2 -5
- package/dist/agent-installation/managed-agent-archive.d.ts.map +1 -1
- package/dist/agent-installation/managed-agent-archive.js +18 -20
- package/dist/agent-installation/managed-agent-archive.js.map +1 -1
- package/dist/agent-installation/managed-npm-package.d.ts.map +1 -1
- package/dist/agent-installation/managed-npm-package.js +8 -13
- package/dist/agent-installation/managed-npm-package.js.map +1 -1
- package/dist/agent-installation/opencode-managed-release.d.ts.map +1 -1
- package/dist/agent-installation/opencode-managed-release.js.map +1 -1
- package/dist/agent-installation/pi-managed-packages.js.map +1 -1
- package/dist/agent-installation/verified-download.d.ts +0 -4
- package/dist/agent-installation/verified-download.d.ts.map +1 -1
- package/dist/agent-installation/verified-download.js +5 -5
- package/dist/agent-installation/verified-download.js.map +1 -1
- package/dist/agent-installation/workbuddy-managed-package.d.ts.map +1 -1
- package/dist/agent-installation/workbuddy-managed-package.js +1 -3
- package/dist/agent-installation/workbuddy-managed-package.js.map +1 -1
- package/dist/audit/audit-store.d.ts.map +1 -1
- package/dist/audit/audit-store.js +1 -3
- package/dist/audit/audit-store.js.map +1 -1
- package/dist/authorization/local-authorization-error.d.ts.map +1 -1
- package/dist/authorization/local-authorization-error.js.map +1 -1
- package/dist/authorization/workspace-directory.d.ts.map +1 -1
- package/dist/authorization/workspace-directory.js +30 -21
- package/dist/authorization/workspace-directory.js.map +1 -1
- package/dist/cli.js +1295 -3431
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -2
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1238 -3355
- package/dist/index.js.map +4 -4
- package/dist/native-sessions/codex-history.d.ts.map +1 -1
- package/dist/native-sessions/codex-history.js +26 -17
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +46 -36
- package/dist/native-sessions/service.js.map +1 -1
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js +16 -29
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/process/executable.d.ts.map +1 -1
- package/dist/process/executable.js +16 -15
- package/dist/process/executable.js.map +1 -1
- package/dist/prompt-artifact-resolver.d.ts +13 -0
- package/dist/prompt-artifact-resolver.d.ts.map +1 -0
- package/dist/prompt-artifact-resolver.js +205 -0
- package/dist/prompt-artifact-resolver.js.map +1 -0
- package/dist/relay-connection/connect.d.ts.map +1 -1
- package/dist/relay-connection/connect.js +3 -1
- package/dist/relay-connection/connect.js.map +1 -1
- package/dist/relay-connection/liveness.d.ts.map +1 -1
- package/dist/relay-connection/liveness.js +1 -2
- package/dist/relay-connection/liveness.js.map +1 -1
- package/dist/relay-connection/session-event-outbox.d.ts.map +1 -1
- package/dist/relay-connection/session-event-outbox.js +7 -19
- package/dist/relay-connection/session-event-outbox.js.map +1 -1
- package/dist/relay-connection/timer.d.ts.map +1 -1
- package/dist/relay-connection/timer.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +202 -87
- package/dist/run-daemon.js.map +1 -1
- package/dist/storage/state-directory.d.ts.map +1 -1
- package/dist/storage/state-directory.js.map +1 -1
- package/package.json +55 -55
- package/dist/agent-installation/automatic-adapter-provisioner.d.ts +0 -19
- package/dist/agent-installation/automatic-adapter-provisioner.d.ts.map +0 -1
- package/dist/agent-installation/automatic-adapter-provisioner.js +0 -125
- package/dist/agent-installation/automatic-adapter-provisioner.js.map +0 -1
- package/dist/agent-installation/fixed-agent-install-recipe.d.ts +0 -20
- package/dist/agent-installation/fixed-agent-install-recipe.d.ts.map +0 -1
- package/dist/agent-installation/fixed-agent-install-recipe.js +0 -18
- package/dist/agent-installation/fixed-agent-install-recipe.js.map +0 -1
- package/dist/agent-installation/fixed-agent-install-recipes.d.ts +0 -26
- package/dist/agent-installation/fixed-agent-install-recipes.d.ts.map +0 -1
- package/dist/agent-installation/fixed-agent-install-recipes.js +0 -301
- package/dist/agent-installation/fixed-agent-install-recipes.js.map +0 -1
- package/dist/agent-installation/grok-build-install-recipe.d.ts +0 -12
- package/dist/agent-installation/grok-build-install-recipe.d.ts.map +0 -1
- package/dist/agent-installation/grok-build-install-recipe.js +0 -102
- package/dist/agent-installation/grok-build-install-recipe.js.map +0 -1
- package/dist/agent-installation/workbuddy-install-recipe.d.ts +0 -12
- package/dist/agent-installation/workbuddy-install-recipe.d.ts.map +0 -1
- package/dist/agent-installation/workbuddy-install-recipe.js +0 -51
- package/dist/agent-installation/workbuddy-install-recipe.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/acp/session-manager.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/acp/session-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,+BAA+B,EAEpC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAM9B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,cAAc,EASnB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,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I,CAAC,CAY9D;IAEF,QAAQ,CAAC,SAAS,YAAmB,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC,CAoE5E;IAEF,QAAQ,CAAC,iBAAiB,YAAmB,4BAA4B,KAAG,OAAO,CAAC,IAAI,CAAC,CAMvF;IAEF,QAAQ,CAAC,kBAAkB,YAAmB,6BAA6B,KAAG,OAAO,CAAC,IAAI,CAAC,CAMzF;IAEF,QAAQ,CAAC,KAAK,QAAa,OAAO,CAAC,IAAI,CAAC,CAMtC;IAEF,QAAQ,CAAC,aAAa,YAAmB,iBAAiB,KAAG,OAAO,CAAC,iBAAiB,CAAC,CAkBrF;IAsBF,QAAQ,CAAC,kBAAkB,YACd,iBAAiB,UAClB,MAAM,GAAG,IAAI,KACtB,OAAO,CAAC,iBAAiB,CAAC,CAC0E;IAEvG,QAAQ,CAAC,iBAAiB,YACb,iBAAiB,UAClB,mBAAmB,KAC5B,OAAO,CAAC;QACP,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;QACtC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;KAC1C,CAAC,CA2EA;IAEF,QAAQ,CAAC,mBAAmB,YACf,iBAAiB,mBACT,MAAM,KACxB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAmC3B;CACL"}
|
|
@@ -2,10 +2,11 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { methods, ndJsonStream, PROTOCOL_VERSION, RequestError, } from "@agentclientprotocol/sdk";
|
|
3
3
|
import { AGENT_CONTENT_KIND, decodeAgentPromptResponse, SESSION_COMMANDS_UPDATED_KIND, SESSION_CONFIG_UPDATED_KIND, SESSION_ELICITATION_REQUESTED_KIND, SESSION_ELICITATION_RESOLVED_KIND, SESSION_INFO_UPDATED_KIND, SESSION_PERMISSION_REQUESTED_KIND, SESSION_PERMISSION_RESOLVED_KIND, SESSION_USAGE_UPDATED_KIND, } from "@moxt-ai/mobius-protocol";
|
|
4
4
|
import { captureProcessTree, revalidateExecutable, stopProcessTree, } from "../process/executable.js";
|
|
5
|
-
import { AcpActivityTracker, isProgressMessage, normalizeContentBlock
|
|
5
|
+
import { AcpActivityTracker, isProgressMessage, normalizeContentBlock } from "./activity.js";
|
|
6
6
|
import { createAcpClient } from "./create-client.js";
|
|
7
7
|
import { nativeSessionIdSchema, nativeSessionPageSchema, } from "./native-session.js";
|
|
8
|
-
import {
|
|
8
|
+
import { normalizeAcpCapabilities } from "./session-capabilities.js";
|
|
9
|
+
import { SessionConfigProtocolError } from "./session-config/session-config-protocol.js";
|
|
9
10
|
import { sessionConfigProtocolForAgent } from "./session-config/session-config-registry.js";
|
|
10
11
|
import { AcpHistoryReplay } from "./session-history.js";
|
|
11
12
|
import { AcpStoredSession, DeletedAcpStoredSession, FoundAcpStoredSession, MemoryAcpSessionStore, } from "./session-store.js";
|
|
@@ -130,9 +131,7 @@ export function createWritableAcpStream(output) {
|
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
function truncate(value, maximumLength) {
|
|
133
|
-
return value.length <= maximumLength
|
|
134
|
-
? value
|
|
135
|
-
: `${value.slice(0, Math.max(0, maximumLength - 1))}…`;
|
|
134
|
+
return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}…`;
|
|
136
135
|
}
|
|
137
136
|
function isRecord(value) {
|
|
138
137
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -141,24 +140,7 @@ function readString(value, fallback = "") {
|
|
|
141
140
|
return typeof value === "string" ? value : fallback;
|
|
142
141
|
}
|
|
143
142
|
function arraysEqual(left, right) {
|
|
144
|
-
return
|
|
145
|
-
left.every((value, index) => value === right[index]));
|
|
146
|
-
}
|
|
147
|
-
function normalizeCapabilities(capabilities) {
|
|
148
|
-
const session = capabilities.sessionCapabilities;
|
|
149
|
-
const prompt = capabilities.promptCapabilities;
|
|
150
|
-
return {
|
|
151
|
-
additionalDirectories: session?.additionalDirectories != null,
|
|
152
|
-
audioPrompt: prompt?.audio === true,
|
|
153
|
-
closeSession: session?.close != null,
|
|
154
|
-
deleteSession: session?.delete != null,
|
|
155
|
-
embeddedContextPrompt: prompt?.embeddedContext === true,
|
|
156
|
-
imagePrompt: prompt?.image === true,
|
|
157
|
-
listSessions: session?.list != null,
|
|
158
|
-
loadSession: capabilities.loadSession === true,
|
|
159
|
-
resumeSession: session?.resume != null,
|
|
160
|
-
unstableForkSession: session?.fork != null,
|
|
161
|
-
};
|
|
143
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
162
144
|
}
|
|
163
145
|
function elicitationFieldType(value) {
|
|
164
146
|
if (value === "boolean") {
|
|
@@ -210,9 +192,7 @@ function normalizeElicitationOptions(schema) {
|
|
|
210
192
|
return normalizeElicitationOptions({ enum: items["enum"] });
|
|
211
193
|
}
|
|
212
194
|
function numericString(value) {
|
|
213
|
-
return typeof value === "number" && Number.isFinite(value)
|
|
214
|
-
? value.toString()
|
|
215
|
-
: "";
|
|
195
|
+
return typeof value === "number" && Number.isFinite(value) ? value.toString() : "";
|
|
216
196
|
}
|
|
217
197
|
function normalizeElicitationFields(requestedSchema) {
|
|
218
198
|
if (!isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
|
|
@@ -220,9 +200,7 @@ function normalizeElicitationFields(requestedSchema) {
|
|
|
220
200
|
}
|
|
221
201
|
const properties = requestedSchema["properties"];
|
|
222
202
|
const requiredValues = requestedSchema["required"];
|
|
223
|
-
const required = new Set(Array.isArray(requiredValues)
|
|
224
|
-
? requiredValues.filter((entry) => typeof entry === "string")
|
|
225
|
-
: []);
|
|
203
|
+
const required = new Set(Array.isArray(requiredValues) ? requiredValues.filter((entry) => typeof entry === "string") : []);
|
|
226
204
|
const normalized = [];
|
|
227
205
|
for (const [name, property] of Object.entries(properties)) {
|
|
228
206
|
if (!isRecord(property)) {
|
|
@@ -234,9 +212,7 @@ function normalizeElicitationFields(requestedSchema) {
|
|
|
234
212
|
const defaultValue = property["default"];
|
|
235
213
|
normalized.push({
|
|
236
214
|
defaultBooleanValue: typeof defaultValue === "boolean" ? defaultValue : false,
|
|
237
|
-
defaultNumberValue: typeof defaultValue === "number" && Number.isFinite(defaultValue)
|
|
238
|
-
? defaultValue
|
|
239
|
-
: 0,
|
|
215
|
+
defaultNumberValue: typeof defaultValue === "number" && Number.isFinite(defaultValue) ? defaultValue : 0,
|
|
240
216
|
defaultStringValue: typeof defaultValue === "string"
|
|
241
217
|
? truncate(defaultValue, 10_000)
|
|
242
218
|
: Array.isArray(defaultValue)
|
|
@@ -283,8 +259,7 @@ function validateNumericValue(name, value, schema, integer) {
|
|
|
283
259
|
}
|
|
284
260
|
const minimum = schema["minimum"];
|
|
285
261
|
const maximum = schema["maximum"];
|
|
286
|
-
if ((typeof minimum === "number" && value < minimum) ||
|
|
287
|
-
(typeof maximum === "number" && value > maximum)) {
|
|
262
|
+
if ((typeof minimum === "number" && value < minimum) || (typeof maximum === "number" && value > maximum)) {
|
|
288
263
|
throw new AcpExecutionError(`Elicitation field ${name} is outside the allowed range`, {}, "invalid_elicitation_response");
|
|
289
264
|
}
|
|
290
265
|
}
|
|
@@ -296,16 +271,12 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
296
271
|
catch (error) {
|
|
297
272
|
throw new AcpExecutionError("Elicitation response is not valid JSON", { cause: error }, "invalid_elicitation_response");
|
|
298
273
|
}
|
|
299
|
-
if (!isRecord(decoded) ||
|
|
300
|
-
!isRecord(requestedSchema) ||
|
|
301
|
-
!isRecord(requestedSchema["properties"])) {
|
|
274
|
+
if (!isRecord(decoded) || !isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
|
|
302
275
|
throw new AcpExecutionError("Elicitation response does not match the requested form", {}, "invalid_elicitation_response");
|
|
303
276
|
}
|
|
304
277
|
const properties = requestedSchema["properties"];
|
|
305
278
|
const requiredValue = requestedSchema["required"];
|
|
306
|
-
const required = new Set(Array.isArray(requiredValue)
|
|
307
|
-
? requiredValue.filter((entry) => typeof entry === "string")
|
|
308
|
-
: []);
|
|
279
|
+
const required = new Set(Array.isArray(requiredValue) ? requiredValue.filter((entry) => typeof entry === "string") : []);
|
|
309
280
|
for (const name of required) {
|
|
310
281
|
if (!(name in decoded)) {
|
|
311
282
|
throw new AcpExecutionError(`Elicitation field ${name} is required`, {}, "invalid_elicitation_response");
|
|
@@ -336,9 +307,7 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
336
307
|
validated[name] = value;
|
|
337
308
|
continue;
|
|
338
309
|
}
|
|
339
|
-
if (property["type"] === "array" &&
|
|
340
|
-
Array.isArray(value) &&
|
|
341
|
-
value.every((entry) => typeof entry === "string")) {
|
|
310
|
+
if (property["type"] === "array" && Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
|
|
342
311
|
const minimum = property["minItems"];
|
|
343
312
|
const maximum = property["maxItems"];
|
|
344
313
|
if ((typeof minimum === "number" && value.length < minimum) ||
|
|
@@ -346,8 +315,7 @@ function validateElicitationContent(encoded, requestedSchema) {
|
|
|
346
315
|
throw new AcpExecutionError(`Elicitation field ${name} has an invalid selection count`, {}, "invalid_elicitation_response");
|
|
347
316
|
}
|
|
348
317
|
const allowed = normalizeElicitationOptions(property);
|
|
349
|
-
if (allowed.length > 0 &&
|
|
350
|
-
value.some((entry) => !allowed.some((option) => option.value === entry))) {
|
|
318
|
+
if (allowed.length > 0 && value.some((entry) => !allowed.some((option) => option.value === entry))) {
|
|
351
319
|
throw new AcpExecutionError(`Elicitation field ${name} contains an invalid selection`, {}, "invalid_elicitation_response");
|
|
352
320
|
}
|
|
353
321
|
validated[name] = value;
|
|
@@ -560,8 +528,9 @@ class AcpProcessSession {
|
|
|
560
528
|
canRebind = () => !this.#prompted && !this.#turn.running;
|
|
561
529
|
prepared = () => new AcpPreparedSession(this.#agentName, this.#agentVersion, this.#capabilities, this.#commands, this.#configOptions, this.#restored);
|
|
562
530
|
loadHistory = async (signal) => {
|
|
563
|
-
if (!this.#capabilities.loadSession)
|
|
531
|
+
if (!this.#capabilities.loadSession) {
|
|
564
532
|
return { status: "unavailable" };
|
|
533
|
+
}
|
|
565
534
|
const history = new AcpHistoryReplay();
|
|
566
535
|
this.#replay = { kind: "capture", history };
|
|
567
536
|
try {
|
|
@@ -596,13 +565,9 @@ class AcpProcessSession {
|
|
|
596
565
|
throw new AcpExecutionError("ACP agent selected an unsupported protocol version", {}, "unsupported_acp_protocol");
|
|
597
566
|
}
|
|
598
567
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
599
|
-
this.#capabilities =
|
|
600
|
-
this.#agentName = truncate(initialized.agentInfo?.title ??
|
|
601
|
-
|
|
602
|
-
this.#agentId, 255);
|
|
603
|
-
this.#agentVersion = truncate(this.#verifiedAgentVersion.length > 0
|
|
604
|
-
? this.#verifiedAgentVersion
|
|
605
|
-
: (initialized.agentInfo?.version ?? ""), 128);
|
|
568
|
+
this.#capabilities = normalizeAcpCapabilities(capabilities);
|
|
569
|
+
this.#agentName = truncate(initialized.agentInfo?.title ?? initialized.agentInfo?.name ?? this.#agentId, 255);
|
|
570
|
+
this.#agentVersion = truncate(this.#verifiedAgentVersion.length > 0 ? this.#verifiedAgentVersion : (initialized.agentInfo?.version ?? ""), 128);
|
|
606
571
|
}
|
|
607
572
|
initialize = async (signal, origin) => {
|
|
608
573
|
await this.#initializeAgent(signal);
|
|
@@ -613,12 +578,14 @@ class AcpProcessSession {
|
|
|
613
578
|
this.#store.remove(this.#mobiusSessionId);
|
|
614
579
|
stored = this.#store.read(this.#mobiusSessionId);
|
|
615
580
|
}
|
|
616
|
-
if (stored instanceof DeletedAcpStoredSession)
|
|
581
|
+
if (stored instanceof DeletedAcpStoredSession) {
|
|
617
582
|
throw new AcpExecutionError("The native Agent session was deleted. Start a new chat.", {}, "native_session_deleted");
|
|
583
|
+
}
|
|
618
584
|
let lifecycleResponse;
|
|
619
585
|
if (origin?.kind === "fork") {
|
|
620
|
-
if (!this.#capabilities.unstableForkSession)
|
|
586
|
+
if (!this.#capabilities.unstableForkSession) {
|
|
621
587
|
throw new AcpExecutionError("This Agent does not support session forking", {}, "native_session_unsupported");
|
|
588
|
+
}
|
|
622
589
|
const forked = await this.race(this.#connection.agent.request(methods.agent.session.fork, {
|
|
623
590
|
sessionId: nativeSessionIdSchema.parse(origin.nativeSessionId),
|
|
624
591
|
cwd: this.#cwd,
|
|
@@ -683,8 +650,7 @@ class AcpProcessSession {
|
|
|
683
650
|
this.selectNativeSession(created.sessionId);
|
|
684
651
|
lifecycleResponse = created;
|
|
685
652
|
}
|
|
686
|
-
this.#configOptions =
|
|
687
|
-
this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
|
|
653
|
+
this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
|
|
688
654
|
await this.#updateTail;
|
|
689
655
|
signal.throwIfAborted();
|
|
690
656
|
if (this.#prompted) {
|
|
@@ -692,17 +658,22 @@ class AcpProcessSession {
|
|
|
692
658
|
}
|
|
693
659
|
};
|
|
694
660
|
listNativeSessions = async (cursor, signal) => {
|
|
695
|
-
if (!this.#capabilities.listSessions)
|
|
661
|
+
if (!this.#capabilities.listSessions) {
|
|
696
662
|
throw new AcpExecutionError("This Agent does not support native session listing", {}, "native_session_unsupported");
|
|
697
|
-
|
|
663
|
+
}
|
|
664
|
+
const response = await this.race(this.#connection.agent.request(methods.agent.session.list, cursor === null ? {} : { cursor }, {
|
|
665
|
+
cancellationSignal: signal,
|
|
666
|
+
}), "ACP agent exited while listing sessions", signal);
|
|
698
667
|
const decoded = nativeSessionPageSchema.safeParse(response);
|
|
699
|
-
if (!decoded.success)
|
|
668
|
+
if (!decoded.success) {
|
|
700
669
|
throw new AcpExecutionError("The Agent returned an invalid native session list", { cause: decoded.error }, "invalid_native_session_response");
|
|
670
|
+
}
|
|
701
671
|
return decoded.data;
|
|
702
672
|
};
|
|
703
673
|
deleteNativeSession = async (nativeSessionId, signal) => {
|
|
704
|
-
if (!this.#capabilities.deleteSession || !this.#capabilities.listSessions)
|
|
674
|
+
if (!this.#capabilities.deleteSession || !this.#capabilities.listSessions) {
|
|
705
675
|
throw new AcpExecutionError("This Agent does not support native session deletion", {}, "native_session_unsupported");
|
|
676
|
+
}
|
|
706
677
|
await this.race(this.#connection.agent.request(methods.agent.session.delete, { sessionId: nativeSessionIdSchema.parse(nativeSessionId) }, { cancellationSignal: signal }), "ACP agent exited while deleting a session", signal);
|
|
707
678
|
};
|
|
708
679
|
nativeSessionId = () => this.#nativeSessionId;
|
|
@@ -844,13 +815,10 @@ class AcpProcessSession {
|
|
|
844
815
|
if (pending === undefined) {
|
|
845
816
|
throw new AcpExecutionError("The permission request is no longer active", {}, "permission_request_not_found");
|
|
846
817
|
}
|
|
847
|
-
if (options.outcome === "selected" &&
|
|
848
|
-
!pending.optionIds.has(options.optionId)) {
|
|
818
|
+
if (options.outcome === "selected" && !pending.optionIds.has(options.optionId)) {
|
|
849
819
|
throw new AcpExecutionError("The selected permission option is unavailable", {}, "invalid_permission_response");
|
|
850
820
|
}
|
|
851
|
-
const resolved = options.outcome === "selected"
|
|
852
|
-
? pending.select(options.optionId)
|
|
853
|
-
: pending.cancel();
|
|
821
|
+
const resolved = options.outcome === "selected" ? pending.select(options.optionId) : pending.cancel();
|
|
854
822
|
if (!resolved) {
|
|
855
823
|
throw new AcpExecutionError("The permission request was already resolved", {}, "permission_request_not_found");
|
|
856
824
|
}
|
|
@@ -900,9 +868,7 @@ class AcpProcessSession {
|
|
|
900
868
|
onPermission = async (request, signal) => {
|
|
901
869
|
this.assertNativeSession(request.sessionId);
|
|
902
870
|
const interactionId = `permission-${crypto.randomUUID()}`;
|
|
903
|
-
const options = request.options
|
|
904
|
-
.slice(0, 20)
|
|
905
|
-
.map((option) => ({
|
|
871
|
+
const options = request.options.slice(0, 20).map((option) => ({
|
|
906
872
|
kind: option.kind,
|
|
907
873
|
name: truncate(option.name, 255),
|
|
908
874
|
optionId: truncate(option.optionId, 255),
|
|
@@ -947,9 +913,7 @@ class AcpProcessSession {
|
|
|
947
913
|
const schemaValue = Reflect.get(request, "requestedSchema");
|
|
948
914
|
const requestedSchema = request.mode === "form" ? schemaValue : {};
|
|
949
915
|
const elicitationIdValue = Reflect.get(request, "elicitationId");
|
|
950
|
-
const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string"
|
|
951
|
-
? truncate(elicitationIdValue, 255)
|
|
952
|
-
: "";
|
|
916
|
+
const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate(elicitationIdValue, 255) : "";
|
|
953
917
|
const pending = new PendingElicitation(interactionId, elicitationId, requestedSchema);
|
|
954
918
|
this.#pendingElicitations.set(interactionId, pending);
|
|
955
919
|
const abort = () => {
|
|
@@ -967,8 +931,7 @@ class AcpProcessSession {
|
|
|
967
931
|
message: truncate(request.message, 2_000),
|
|
968
932
|
mode: request.mode,
|
|
969
933
|
sessionId: this.#mobiusSessionId,
|
|
970
|
-
url: request.mode === "url" &&
|
|
971
|
-
typeof Reflect.get(request, "url") === "string"
|
|
934
|
+
url: request.mode === "url" && typeof Reflect.get(request, "url") === "string"
|
|
972
935
|
? truncate(readString(Reflect.get(request, "url")), 4_096)
|
|
973
936
|
: "",
|
|
974
937
|
});
|
|
@@ -996,8 +959,7 @@ class AcpProcessSession {
|
|
|
996
959
|
if (this.#nativeSessionId.length === 0) {
|
|
997
960
|
const notificationBytes = Buffer.byteLength(JSON.stringify(notification));
|
|
998
961
|
if (this.#preSessionUpdates.length >= MAX_PRE_SESSION_UPDATES ||
|
|
999
|
-
this.#preSessionUpdateBytes + notificationBytes >
|
|
1000
|
-
MAX_PRE_SESSION_UPDATE_BYTES) {
|
|
962
|
+
this.#preSessionUpdateBytes + notificationBytes > MAX_PRE_SESSION_UPDATE_BYTES) {
|
|
1001
963
|
return Promise.reject(new AcpExecutionError("ACP agent sent too many updates before creating its session", {}, "agent_update_limit"));
|
|
1002
964
|
}
|
|
1003
965
|
this.#preSessionUpdates.push(notification);
|
|
@@ -1012,8 +974,7 @@ class AcpProcessSession {
|
|
|
1012
974
|
};
|
|
1013
975
|
selectNativeSession = (sessionId) => {
|
|
1014
976
|
const selected = nativeSessionIdSchema.parse(sessionId);
|
|
1015
|
-
if (this.#nativeSessionId.length > 0 &&
|
|
1016
|
-
this.#nativeSessionId !== selected) {
|
|
977
|
+
if (this.#nativeSessionId.length > 0 && this.#nativeSessionId !== selected) {
|
|
1017
978
|
throw new AcpExecutionError("ACP agent attempted to replace the selected session", {}, "invalid_agent_session");
|
|
1018
979
|
}
|
|
1019
980
|
this.#nativeSessionId = selected;
|
|
@@ -1026,8 +987,9 @@ class AcpProcessSession {
|
|
|
1026
987
|
processUpdate = async (notification) => {
|
|
1027
988
|
this.assertNativeSession(notification.sessionId);
|
|
1028
989
|
const update = notification.update;
|
|
1029
|
-
if (this.#replay.kind === "capture")
|
|
990
|
+
if (this.#replay.kind === "capture") {
|
|
1030
991
|
this.#replay.history.record(update);
|
|
992
|
+
}
|
|
1031
993
|
if (this.#replay.kind !== "idle" &&
|
|
1032
994
|
(update.sessionUpdate === "user_message_chunk" ||
|
|
1033
995
|
update.sessionUpdate === "agent_message_chunk" ||
|
|
@@ -1112,9 +1074,7 @@ class AcpProcessSession {
|
|
|
1112
1074
|
return;
|
|
1113
1075
|
}
|
|
1114
1076
|
if (update.sessionUpdate === "current_mode_update") {
|
|
1115
|
-
this.#configOptions = this.#configOptions.map((option) => option.category === "mode"
|
|
1116
|
-
? { ...option, currentValue: update.currentModeId }
|
|
1117
|
-
: option);
|
|
1077
|
+
this.#configOptions = this.#configOptions.map((option) => option.category === "mode" ? { ...option, currentValue: update.currentModeId } : option);
|
|
1118
1078
|
this.#configRevision += 1;
|
|
1119
1079
|
await this.emitConfigUpdate();
|
|
1120
1080
|
return;
|
|
@@ -1347,11 +1307,13 @@ export class AcpSessionManager {
|
|
|
1347
1307
|
}
|
|
1348
1308
|
prepareSession = async (options) => {
|
|
1349
1309
|
const stored = this.#store.read(options.sessionId);
|
|
1350
|
-
if (stored instanceof DeletedAcpStoredSession)
|
|
1310
|
+
if (stored instanceof DeletedAcpStoredSession) {
|
|
1351
1311
|
throw new AcpExecutionError("The native Agent session was deleted. Start a new chat.", {}, "native_session_deleted");
|
|
1312
|
+
}
|
|
1352
1313
|
if (stored instanceof FoundAcpStoredSession &&
|
|
1353
|
-
this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`))
|
|
1314
|
+
this.#nativeOperations.has(`${stored.session.agentId}:${stored.session.nativeSessionId}`)) {
|
|
1354
1315
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
1316
|
+
}
|
|
1355
1317
|
const pending = this.#preparing.get(options.sessionId);
|
|
1356
1318
|
if (pending !== undefined) {
|
|
1357
1319
|
const runtime = await pending;
|
|
@@ -1438,16 +1400,15 @@ export class AcpSessionManager {
|
|
|
1438
1400
|
return { stopReason: "cancelled" };
|
|
1439
1401
|
}
|
|
1440
1402
|
const runtime = await this.ensureSession(boundedOptions);
|
|
1441
|
-
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`))
|
|
1403
|
+
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
1442
1404
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
1405
|
+
}
|
|
1443
1406
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
1444
1407
|
return { stopReason: "cancelled" };
|
|
1445
1408
|
}
|
|
1446
1409
|
try {
|
|
1447
1410
|
const result = await runtime.prompt(boundedOptions);
|
|
1448
|
-
return this.#cancellationRequests.has(options.sessionId)
|
|
1449
|
-
? { stopReason: "cancelled" }
|
|
1450
|
-
: result;
|
|
1411
|
+
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
1451
1412
|
}
|
|
1452
1413
|
catch (error) {
|
|
1453
1414
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -1533,21 +1494,22 @@ export class AcpSessionManager {
|
|
|
1533
1494
|
listNativeSessions = async (options, cursor) => await (await this.#ensureNativeSessionBrowser(options)).listNativeSessions(cursor, options.signal);
|
|
1534
1495
|
openNativeSession = async (options, origin) => {
|
|
1535
1496
|
const key = `${options.agent.id}:${origin.nativeSessionId}`;
|
|
1536
|
-
if (this.#nativeOperations.has(key))
|
|
1497
|
+
if (this.#nativeOperations.has(key)) {
|
|
1537
1498
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
1499
|
+
}
|
|
1538
1500
|
const linked = this.#store.findNative(options.agent.id, origin.nativeSessionId);
|
|
1539
|
-
if (linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) ||
|
|
1540
|
-
this.#preparing.has(entry.sessionId)))
|
|
1501
|
+
if (linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId))) {
|
|
1541
1502
|
throw new AcpExecutionError("Wait for the native session's running operation to finish", {}, "session_busy");
|
|
1503
|
+
}
|
|
1542
1504
|
const existing = linked[0];
|
|
1543
1505
|
if (origin.kind === "import" && existing !== undefined) {
|
|
1544
1506
|
const runtime = await this.ensureSession({
|
|
1545
1507
|
...options,
|
|
1546
1508
|
sessionId: existing.sessionId,
|
|
1547
1509
|
});
|
|
1548
|
-
if (this.#activeSessionIds.has(existing.sessionId) ||
|
|
1549
|
-
this.#nativeOperations.has(key))
|
|
1510
|
+
if (this.#activeSessionIds.has(existing.sessionId) || this.#nativeOperations.has(key)) {
|
|
1550
1511
|
throw new AcpExecutionError("Wait for the native session's running operation to finish", {}, "session_busy");
|
|
1512
|
+
}
|
|
1551
1513
|
this.#nativeOperations.add(key);
|
|
1552
1514
|
try {
|
|
1553
1515
|
const history = await runtime.loadHistory(options.signal);
|
|
@@ -1569,8 +1531,9 @@ export class AcpSessionManager {
|
|
|
1569
1531
|
if (this.#sessions.has(options.sessionId) ||
|
|
1570
1532
|
this.#preparing.has(options.sessionId) ||
|
|
1571
1533
|
this.#store.read(options.sessionId) instanceof FoundAcpStoredSession ||
|
|
1572
|
-
this.#store.read(options.sessionId) instanceof DeletedAcpStoredSession)
|
|
1534
|
+
this.#store.read(options.sessionId) instanceof DeletedAcpStoredSession) {
|
|
1573
1535
|
throw new AcpExecutionError("The destination conversation already exists", {}, "session_identity_mismatch");
|
|
1536
|
+
}
|
|
1574
1537
|
this.#nativeOperations.add(key);
|
|
1575
1538
|
try {
|
|
1576
1539
|
const runtime = await this.#startPreparation({ ...options, origin });
|
|
@@ -1603,9 +1566,9 @@ export class AcpSessionManager {
|
|
|
1603
1566
|
const key = `${options.agent.id}:${nativeSessionId}`;
|
|
1604
1567
|
const linked = this.#store.findNative(options.agent.id, nativeSessionId);
|
|
1605
1568
|
if (this.#nativeOperations.has(key) ||
|
|
1606
|
-
linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) ||
|
|
1607
|
-
this.#preparing.has(entry.sessionId)))
|
|
1569
|
+
linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId))) {
|
|
1608
1570
|
throw new AcpExecutionError("Wait for the native session's running operation to finish", {}, "session_busy");
|
|
1571
|
+
}
|
|
1609
1572
|
this.#nativeOperations.add(key);
|
|
1610
1573
|
try {
|
|
1611
1574
|
for (const entry of linked) {
|