@morty-build/cli 0.1.1 → 0.2.0
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/NOTICE +1 -1
- package/dist/{chunk-6KNXEAOQ.js → chunk-MBS25BBY.js} +103 -117
- package/dist/{chunk-6KNXEAOQ.js.map → chunk-MBS25BBY.js.map} +4 -4
- package/dist/{chunk-B4H65VAU.js → chunk-ZSUNNLEK.js} +2 -2
- package/dist/{chunk-B4H65VAU.js.map → chunk-ZSUNNLEK.js.map} +1 -1
- package/dist/cli/handler/agents/index.js +2 -2
- package/dist/cli/handler/agents/index.js.map +1 -1
- package/dist/cli/handler/daemon/install.js +3 -3
- package/dist/cli/handler/daemon/install.js.map +1 -1
- package/dist/cli/handler/daemon/quit.js +2 -2
- package/dist/cli/handler/daemon/quit.js.map +1 -1
- package/dist/cli/handler/daemon/release.js +2 -2
- package/dist/cli/handler/daemon/release.js.map +1 -1
- package/dist/cli/handler/daemon/start.d.ts.map +1 -1
- package/dist/cli/handler/daemon/start.js +3 -3
- package/dist/cli/handler/daemon/start.js.map +1 -1
- package/dist/cli/handler/daemon/upgrade.js +2 -2
- package/dist/cli/handler/daemon/upgrade.js.map +1 -1
- package/dist/cli/handler/diagnose/worker.js +2 -2
- package/dist/cli/handler/diagnose/worker.js.map +1 -1
- package/dist/cli/handler/logs/index.js +1 -1
- package/dist/cli/handler/logs/index.js.map +1 -1
- package/dist/cli/handler/pair/list.js +2 -2
- package/dist/cli/handler/pair/list.js.map +1 -1
- package/dist/cli/handler/pair/pair.js +3 -3
- package/dist/cli/handler/pair/pair.js.map +1 -1
- package/dist/cli/handler/pair/remove.d.ts.map +1 -1
- package/dist/cli/handler/pair/remove.js +3 -3
- package/dist/cli/handler/pair/remove.js.map +1 -1
- package/dist/cli/handler/pair/stop.d.ts.map +1 -1
- package/dist/cli/handler/pair/stop.js +3 -3
- package/dist/cli/handler/pair/stop.js.map +1 -1
- package/dist/cli/handler/version/index.js +2 -2
- package/dist/cli/handler/version/index.js.map +1 -1
- package/dist/{cli-6OIRF2M7.js → cli-4I5WYVG2.js} +36 -36
- package/dist/{cli-6OIRF2M7.js.map → cli-4I5WYVG2.js.map} +2 -2
- package/dist/cli.js +2 -2
- package/dist/daemon/config.d.ts +1 -1
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +1 -1
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/lifecycle/daemon.js +5 -5
- package/dist/daemon/lifecycle/daemon.js.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.d.ts +2 -2
- package/dist/daemon/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.js +7 -7
- package/dist/daemon/pairing/pair-local-machine.js.map +1 -1
- package/dist/engine/acp/adapter/agent-initialization.js +2 -2
- package/dist/engine/acp/adapter/agent-initialization.js.map +1 -1
- package/dist/engine/acp/adapter/codex/adapter.js +3 -3
- package/dist/engine/acp/adapter/codex/adapter.js.map +1 -1
- package/dist/engine/acp/adapter/session-events.d.ts +2 -2
- package/dist/engine/acp/adapter/session-events.d.ts.map +1 -1
- package/dist/engine/acp/adapter/session-events.js +5 -5
- package/dist/engine/acp/adapter/session-events.js.map +1 -1
- package/dist/engine/acp/agent/in-process-endpoint.d.ts +2 -2
- package/dist/engine/acp/agent/in-process-endpoint.d.ts.map +1 -1
- package/dist/engine/acp/client/prompt-content.js +1 -1
- package/dist/engine/acp/client/prompt-content.js.map +1 -1
- package/dist/engine/acp/connection/create-client.js +1 -1
- package/dist/engine/acp/connection/create-client.js.map +1 -1
- package/dist/engine/acp/content/content-externalizer.js +1 -1
- package/dist/engine/acp/content/content-externalizer.js.map +1 -1
- package/dist/engine/acp/harness/codex/agent.d.ts +2 -2
- package/dist/engine/acp/harness/codex/agent.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/agent.js +8 -8
- package/dist/engine/acp/harness/codex/agent.js.map +1 -1
- package/dist/engine/acp/harness/codex/app-server-client.d.ts +1 -1
- package/dist/engine/acp/harness/codex/app-server-client.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/app-server-client.js +2 -2
- package/dist/engine/acp/harness/codex/app-server-client.js.map +1 -1
- package/dist/engine/acp/harness/codex/app-server-protocol.js +6 -6
- package/dist/engine/acp/harness/codex/app-server-protocol.js.map +1 -1
- package/dist/engine/acp/harness/codex/items.d.ts +1 -1
- package/dist/engine/acp/harness/codex/items.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/items.js +3 -3
- package/dist/engine/acp/harness/codex/items.js.map +1 -1
- package/dist/engine/acp/harness/codex/owned-agent.js +8 -8
- package/dist/engine/acp/harness/codex/owned-agent.js.map +1 -1
- package/dist/engine/acp/harness/codex/settings.d.ts +1 -1
- package/dist/engine/acp/harness/codex/settings.d.ts.map +1 -1
- package/dist/engine/acp/harness/codex/settings.js +1 -1
- package/dist/engine/acp/harness/codex/settings.js.map +1 -1
- package/dist/engine/acp/harness/pi/endpoint.js +1 -1
- package/dist/engine/acp/harness/pi/endpoint.js.map +1 -1
- package/dist/engine/acp/protocol/elicitation.js +1 -1
- package/dist/engine/acp/protocol/elicitation.js.map +1 -1
- package/dist/engine/acp/protocol/session-config-protocol.js +1 -1
- package/dist/engine/acp/protocol/session-config-protocol.js.map +1 -1
- package/dist/engine/agent/discovery/acp-readiness-probe.js +1 -1
- package/dist/engine/agent/discovery/acp-readiness-probe.js.map +1 -1
- package/dist/engine/agent/discovery/agent-discovery-context.d.ts +1 -1
- package/dist/engine/agent/discovery/agent-discovery-context.d.ts.map +1 -1
- package/dist/engine/agent/specification/agent-specification.d.ts +2 -2
- package/dist/engine/agent/specification/agent-specification.js +2 -2
- package/dist/engine/agent/specification/vendors/codex-agent.js +1 -1
- package/dist/engine/agent/specification/vendors/codex-agent.js.map +1 -1
- package/dist/engine/agent/specification/vendors/pi-agent.js +2 -2
- package/dist/engine/agent/specification/vendors/pi-agent.js.map +1 -1
- package/dist/engine/runtime/catalog/discover-agent-catalog.js +1 -1
- package/dist/engine/runtime/catalog/discover-agent-catalog.js.map +1 -1
- package/dist/engine/runtime/command/registry/prompt.js +1 -1
- package/dist/engine/runtime/command/registry/prompt.js.map +1 -1
- package/dist/engine/runtime/engine.d.ts +9 -9
- package/dist/engine/runtime/engine.d.ts.map +1 -1
- package/dist/engine/runtime/engine.js +1 -1
- package/dist/engine/runtime/engine.js.map +1 -1
- package/dist/engine/runtime/pairing.d.ts +2 -2
- package/dist/engine/runtime/pairing.d.ts.map +1 -1
- package/dist/engine/runtime/pairing.js +4 -4
- package/dist/engine/runtime/pairing.js.map +1 -1
- package/dist/engine/runtime/runtime-loop.d.ts +2 -2
- package/dist/engine/runtime/runtime-loop.d.ts.map +1 -1
- package/dist/engine/runtime/runtime-loop.js.map +1 -1
- package/dist/engine/session/api/session-layer.js +1 -1
- package/dist/engine/session/api/session-layer.js.map +1 -1
- package/dist/engine/session/content/external-content-store.js +3 -3
- package/dist/engine/session/content/external-content-store.js.map +1 -1
- package/dist/engine/session/interaction/session-interactions.js +1 -1
- package/dist/engine/session/interaction/session-interactions.js.map +1 -1
- package/dist/engine/session/live/agent-session.js +22 -22
- package/dist/engine/session/live/agent-session.js.map +1 -1
- package/dist/engine/session/manager/session-manager.d.ts +1 -1
- package/dist/engine/session/manager/session-manager.js +1 -1
- package/dist/engine/session/native/native-session-browser.js +1 -1
- package/dist/engine/session/native/native-session-browser.js.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.js +2 -2
- package/dist/engine/session/prompt/prompt-lifecycle.js.map +1 -1
- package/dist/engine/storage/session/session-event-cache-table.js +3 -3
- package/dist/engine/storage/session/session-event-cache-table.js.map +1 -1
- package/dist/engine/storage/session/temporary-session-event-cache.js +1 -1
- package/dist/engine/storage/session/temporary-session-event-cache.js.map +1 -1
- package/dist/engine/storage/sqlite/local-databases.d.ts +1 -1
- package/dist/engine/storage/sqlite/local-databases.d.ts.map +1 -1
- package/dist/engine/storage/sqlite/local-databases.js +1 -26
- package/dist/engine/storage/sqlite/local-databases.js.map +1 -1
- package/dist/engine/storage/sqlite/local-sqlite-database.js +1 -1
- package/dist/engine/storage/sqlite/local-sqlite-database.js.map +1 -1
- package/dist/engine/util/platform/posix.d.ts.map +1 -1
- package/dist/engine/util/platform/posix.js +8 -1
- package/dist/engine/util/platform/posix.js.map +1 -1
- package/dist/engine.js +4 -4
- package/dist/exports/engine.d.ts +2 -2
- package/dist/exports/engine.d.ts.map +1 -1
- package/dist/exports/engine.js +1 -1
- package/dist/exports/engine.js.map +1 -1
- package/dist/storage/state-directory.d.ts +1 -1
- package/dist/storage/state-root-layout.d.ts +1 -1
- package/dist/storage/state-root-layout.d.ts.map +1 -1
- package/dist/storage/state-root-layout.js +1 -1
- package/dist/storage/state-root-layout.js.map +1 -1
- package/dist/storage/state-root.d.ts +1 -1
- package/dist/storage/state-root.d.ts.map +1 -1
- package/dist/storage/state-root.js +1 -1
- package/dist/storage/state-root.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__using,
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZSUNNLEK.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/runtime/relay/runtime-revocation.ts
|
|
9
9
|
var runtimeRevocationCloseCode = 1008;
|
|
@@ -85,27 +85,27 @@ var ConnectionManager = class {
|
|
|
85
85
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
86
86
|
import { resolve } from "node:path";
|
|
87
87
|
|
|
88
|
-
// ../client/src/protocol/platform/
|
|
89
|
-
var MORTY_API_PREFIX = "/
|
|
88
|
+
// ../client/src/protocol/platform/morty-api.ts
|
|
89
|
+
var MORTY_API_PREFIX = "/morty/api";
|
|
90
90
|
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
91
|
-
var
|
|
91
|
+
var MortyApiConfigurationError = class extends Error {
|
|
92
92
|
code = "invalid_api_prefix";
|
|
93
93
|
constructor() {
|
|
94
|
-
super("The
|
|
95
|
-
this.name = "
|
|
94
|
+
super("The Morty API prefix must be an absolute path without parameters");
|
|
95
|
+
this.name = "MortyApiConfigurationError";
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
function
|
|
98
|
+
function parseMortyApiPrefix(value) {
|
|
99
99
|
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
100
|
-
throw new
|
|
100
|
+
throw new MortyApiConfigurationError();
|
|
101
101
|
}
|
|
102
102
|
return value;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return `${
|
|
104
|
+
function mortyApiPath(resourcePath, apiPrefix = MORTY_API_PREFIX) {
|
|
105
|
+
return `${parseMortyApiPrefix(apiPrefix)}${resourcePath}`;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return new URL(
|
|
107
|
+
function mortyApiUrl(origin, resourcePath, apiPrefix = MORTY_API_PREFIX) {
|
|
108
|
+
return new URL(mortyApiPath(resourcePath, apiPrefix), origin);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
|
|
@@ -20832,14 +20832,14 @@ var sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
|
|
|
20832
20832
|
external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
20833
20833
|
]);
|
|
20834
20834
|
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
20835
|
-
var
|
|
20835
|
+
var mortyMetadataFields = {
|
|
20836
20836
|
omitted: external_exports.literal(true).optional(),
|
|
20837
20837
|
recordedOutcome: external_exports.literal(true).optional(),
|
|
20838
20838
|
restated: external_exports.literal(true).optional()
|
|
20839
20839
|
};
|
|
20840
20840
|
var sharedSessionEventFields = {
|
|
20841
20841
|
eventId: identifierStringSchema,
|
|
20842
|
-
|
|
20842
|
+
mortyMetadata: external_exports.object(mortyMetadataFields).readonly().optional(),
|
|
20843
20843
|
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
20844
20844
|
sessionGenerationId: identifierStringSchema,
|
|
20845
20845
|
sessionId: identifierStringSchema
|
|
@@ -20862,7 +20862,7 @@ var wireLifecyclePayloadSchema = external_exports.object({
|
|
|
20862
20862
|
}).passthrough().readonly();
|
|
20863
20863
|
var wireEventFields = {
|
|
20864
20864
|
...sessionLiveEventFields,
|
|
20865
|
-
|
|
20865
|
+
mortyMetadata: external_exports.object(mortyMetadataFields).passthrough().readonly().optional()
|
|
20866
20866
|
};
|
|
20867
20867
|
var sessionWireEventSchema = external_exports.union([
|
|
20868
20868
|
external_exports.object({
|
|
@@ -21536,7 +21536,7 @@ var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
|
21536
21536
|
]);
|
|
21537
21537
|
var nativeSessionEntrySchema = external_exports.object({
|
|
21538
21538
|
entryId: identifierStringSchema,
|
|
21539
|
-
|
|
21539
|
+
mortySessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
21540
21540
|
nativeSessionId: identifierStringSchema,
|
|
21541
21541
|
title: external_exports.string().max(500),
|
|
21542
21542
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
@@ -21561,13 +21561,12 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21561
21561
|
}).readonly()
|
|
21562
21562
|
).readonly(),
|
|
21563
21563
|
turn: activeTurnSnapshotSchema.nullable(),
|
|
21564
|
-
//
|
|
21565
|
-
interactionState: sessionInteractionSnapshotSchema.
|
|
21566
|
-
// Present only when the request named a command
|
|
21567
|
-
|
|
21568
|
-
command
|
|
21569
|
-
|
|
21570
|
-
lastTurn: lastTurnOutcomeSchema.optional().catch(void 0),
|
|
21564
|
+
// Null when this Runtime has no retained Session for the requested identity.
|
|
21565
|
+
interactionState: sessionInteractionSnapshotSchema.nullable(),
|
|
21566
|
+
// Present only when the request named a command.
|
|
21567
|
+
command: commandDeliverySchema.optional(),
|
|
21568
|
+
// Absent while the last started command is running or none has started.
|
|
21569
|
+
lastTurn: lastTurnOutcomeSchema.optional(),
|
|
21571
21570
|
// The Runtime withdraws a queued command only before it starts.
|
|
21572
21571
|
queuedCancellation: external_exports.literal("before-start")
|
|
21573
21572
|
}).readonly(),
|
|
@@ -22240,7 +22239,12 @@ async function removeControlSocket(path7) {
|
|
|
22240
22239
|
}
|
|
22241
22240
|
}
|
|
22242
22241
|
var posixOperations = {
|
|
22243
|
-
controlSocketPath: (installationHash) =>
|
|
22242
|
+
controlSocketPath: (installationHash) => {
|
|
22243
|
+
const directory = `morty-${process.getuid?.()}`;
|
|
22244
|
+
const filename = `${installationHash}.sock`;
|
|
22245
|
+
const preferred = join2(tmpdir(), directory, filename);
|
|
22246
|
+
return Buffer.byteLength(preferred) < 104 ? preferred : join2("/tmp", directory, filename);
|
|
22247
|
+
},
|
|
22244
22248
|
prepareControlSocket: async (path7) => {
|
|
22245
22249
|
const directory = dirname2(path7);
|
|
22246
22250
|
await mkdir3(directory, { mode: 448, recursive: true });
|
|
@@ -26723,7 +26727,7 @@ async function raceAgentOperation(operation, termination, exitMessage, signal) {
|
|
|
26723
26727
|
}
|
|
26724
26728
|
|
|
26725
26729
|
// src/engine/acp/connection/create-client.ts
|
|
26726
|
-
var createAcpClient = (handler) => client({ name: "
|
|
26730
|
+
var createAcpClient = (handler) => client({ name: "morty" }).onRequest(
|
|
26727
26731
|
methods.client.session.requestPermission,
|
|
26728
26732
|
async (context) => await handler.onPermission(context.params, context.signal)
|
|
26729
26733
|
).onRequest(
|
|
@@ -63273,7 +63277,7 @@ function backgroundTaskUpdate(task, linked) {
|
|
|
63273
63277
|
const status = task.status === "completed" ? "completed" : task.status === "running" ? "in_progress" : task.status === "unknown" ? void 0 : "failed";
|
|
63274
63278
|
const fields = {
|
|
63275
63279
|
toolCallId: task.toolUseId ?? `claude-task-${task.id}`,
|
|
63276
|
-
_meta: { "
|
|
63280
|
+
_meta: { "morty.backgroundTask": { id: task.id, status: task.status } },
|
|
63277
63281
|
...status === void 0 ? {} : { status },
|
|
63278
63282
|
content: [{ type: "content", content: { type: "text", text: task.summary } }]
|
|
63279
63283
|
};
|
|
@@ -70884,7 +70888,7 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
70884
70888
|
},
|
|
70885
70889
|
...launchedTaskId === void 0 && toolMeta?.terminal_exit ? { terminal_exit: toolMeta.terminal_exit } : {},
|
|
70886
70890
|
...launchedTaskId === void 0 ? {} : {
|
|
70887
|
-
"
|
|
70891
|
+
"morty.backgroundTask": {
|
|
70888
70892
|
id: launchedTaskId,
|
|
70889
70893
|
status: options?.historical ? "unknown" : "running"
|
|
70890
70894
|
}
|
|
@@ -72464,7 +72468,7 @@ var CodexAppServerClient = class {
|
|
|
72464
72468
|
this.#fail(
|
|
72465
72469
|
error62 instanceof CodexAppServerError ? error62 : new CodexAppServerError(
|
|
72466
72470
|
"codex_app_server_client_error",
|
|
72467
|
-
"
|
|
72471
|
+
"Morty could not process a Codex app-server message",
|
|
72468
72472
|
{ cause: error62 }
|
|
72469
72473
|
)
|
|
72470
72474
|
);
|
|
@@ -72549,7 +72553,7 @@ var CodexAppServerClient = class {
|
|
|
72549
72553
|
"initialize",
|
|
72550
72554
|
{
|
|
72551
72555
|
capabilities: { experimentalApi: true },
|
|
72552
|
-
clientInfo: { name: "
|
|
72556
|
+
clientInfo: { name: "morty", version: "1.0.0" }
|
|
72553
72557
|
},
|
|
72554
72558
|
AbortSignal.any([signal, AbortSignal.timeout(INITIALIZE_TIMEOUT_MILLISECONDS)])
|
|
72555
72559
|
);
|
|
@@ -72964,7 +72968,7 @@ function agentMessageUpdate(messageId, text2, questions = []) {
|
|
|
72964
72968
|
content: { text: text2, type: "text" },
|
|
72965
72969
|
messageId,
|
|
72966
72970
|
sessionUpdate: "agent_message_chunk",
|
|
72967
|
-
...questions.length === 0 ? {} : { _meta: { "
|
|
72971
|
+
...questions.length === 0 ? {} : { _meta: { "morty.questions": questions } }
|
|
72968
72972
|
};
|
|
72969
72973
|
}
|
|
72970
72974
|
function userInputSchema(questions) {
|
|
@@ -73181,7 +73185,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
73181
73185
|
await this.#context.emit({
|
|
73182
73186
|
sessionUpdate: "tool_call_update",
|
|
73183
73187
|
toolCallId: id,
|
|
73184
|
-
_meta: { "
|
|
73188
|
+
_meta: { "morty.backgroundTask": { id, status: "running" } }
|
|
73185
73189
|
});
|
|
73186
73190
|
}
|
|
73187
73191
|
});
|
|
@@ -73357,7 +73361,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
73357
73361
|
...this.#runningCommands.get(item.id) === "background" ? {
|
|
73358
73362
|
_meta: {
|
|
73359
73363
|
...update._meta,
|
|
73360
|
-
"
|
|
73364
|
+
"morty.backgroundTask": {
|
|
73361
73365
|
id: item.id,
|
|
73362
73366
|
status: update.status === "completed" ? "completed" : "failed"
|
|
73363
73367
|
}
|
|
@@ -73385,7 +73389,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
73385
73389
|
await this.#requestMcpElicitation(request);
|
|
73386
73390
|
return;
|
|
73387
73391
|
}
|
|
73388
|
-
this.#appServer.respondWithError(request.id, -32601, `
|
|
73392
|
+
this.#appServer.respondWithError(request.id, -32601, `Morty does not support ${request.method}`);
|
|
73389
73393
|
};
|
|
73390
73394
|
#askPermission = async (title2, toolCallId, signal) => {
|
|
73391
73395
|
const connection = this.#context.connection();
|
|
@@ -73406,7 +73410,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
73406
73410
|
#requestApproval = async (request) => {
|
|
73407
73411
|
const decoded = request.method === "item/commandExecution/requestApproval" ? commandApprovalParamsSchema.safeParse(request.params) : fileChangeApprovalParamsSchema.safeParse(request.params);
|
|
73408
73412
|
if (!decoded.success) {
|
|
73409
|
-
this.#appServer.respondWithError(request.id, -32602, "
|
|
73413
|
+
this.#appServer.respondWithError(request.id, -32602, "Morty could not read the approval request");
|
|
73410
73414
|
return;
|
|
73411
73415
|
}
|
|
73412
73416
|
const params = decoded.data;
|
|
@@ -73452,7 +73456,7 @@ var CodexOwnedAcpAgent = class {
|
|
|
73452
73456
|
const decoded = mcpElicitationParamsSchema.safeParse(request.params);
|
|
73453
73457
|
const connection = this.#context.connection();
|
|
73454
73458
|
if (!decoded.success || connection === null) {
|
|
73455
|
-
this.#appServer.respondWithError(request.id, -32602, "
|
|
73459
|
+
this.#appServer.respondWithError(request.id, -32602, "Morty could not read the elicitation request");
|
|
73456
73460
|
return;
|
|
73457
73461
|
}
|
|
73458
73462
|
const params = decoded.data;
|
|
@@ -74585,7 +74589,7 @@ var CodexSettings = class {
|
|
|
74585
74589
|
this.#collaborationModeSupported = false;
|
|
74586
74590
|
}
|
|
74587
74591
|
};
|
|
74588
|
-
/** The ACP settings
|
|
74592
|
+
/** The ACP settings Morty discovers and renders in Run settings. */
|
|
74589
74593
|
configOptions = () => {
|
|
74590
74594
|
const options = [];
|
|
74591
74595
|
const model = modelSetting(this.#models, this.#selection.model);
|
|
@@ -74807,7 +74811,7 @@ var CodexAcpAgent = class {
|
|
|
74807
74811
|
});
|
|
74808
74812
|
}
|
|
74809
74813
|
});
|
|
74810
|
-
this.#app = agent({ name: "
|
|
74814
|
+
this.#app = agent({ name: "morty-codex" }).onConnect((connection) => {
|
|
74811
74815
|
this.#connection = connection;
|
|
74812
74816
|
}).onRequest(methods.agent.initialize, async () => ({
|
|
74813
74817
|
_meta: { steering: { supported: true } },
|
|
@@ -74918,7 +74922,7 @@ var CodexAcpAgent = class {
|
|
|
74918
74922
|
});
|
|
74919
74923
|
}
|
|
74920
74924
|
agentSettingsModelEffort = () => this.#settings.agentModelEffort();
|
|
74921
|
-
/** The ACP agent app
|
|
74925
|
+
/** The ACP agent app Morty connects its own ACP client to, in-process. */
|
|
74922
74926
|
app = () => this.#app;
|
|
74923
74927
|
nativeTurnId = () => this.#sessionAgent.nativeTurnId();
|
|
74924
74928
|
/** Starts the app-server, performs its handshake, and reads the model catalog Codex offers. */
|
|
@@ -74999,7 +75003,7 @@ var CodexAcpAgent = class {
|
|
|
74999
75003
|
this.#settings.selectRestoredThread(resumed);
|
|
75000
75004
|
await this.#settings.probeCollaborationMode(this.#nativeSessionId, signal);
|
|
75001
75005
|
};
|
|
75002
|
-
/** What the session response tells
|
|
75006
|
+
/** What the session response tells Morty about the session behavior selected while opening it. */
|
|
75003
75007
|
#sessionMeta = () => ({
|
|
75004
75008
|
steering: { supported: this.#sessionAgent.steeringSupported },
|
|
75005
75009
|
codex: { runsTurns: this.#sessionAgent.runsTurns }
|
|
@@ -76113,7 +76117,7 @@ function questionField(question) {
|
|
|
76113
76117
|
title: title2,
|
|
76114
76118
|
default: question.prefill,
|
|
76115
76119
|
maxLength: 1e4,
|
|
76116
|
-
_meta: { "io.
|
|
76120
|
+
_meta: { "io.morty/multiline": true }
|
|
76117
76121
|
};
|
|
76118
76122
|
}
|
|
76119
76123
|
}
|
|
@@ -76954,7 +76958,7 @@ var PiAcpSession = class {
|
|
|
76954
76958
|
} else if (retryFailure !== null && !this.cancelRequested) {
|
|
76955
76959
|
this.pendingTurn?.reject(
|
|
76956
76960
|
// The message rides in `data.details` so clients that unwrap the
|
|
76957
|
-
// JSON-RPC internal-error envelope (like
|
|
76961
|
+
// JSON-RPC internal-error envelope (like Morty) surface the real
|
|
76958
76962
|
// model error; `code` keeps the failure machine-readable.
|
|
76959
76963
|
RequestError.internalError({
|
|
76960
76964
|
code: "pi_retries_exhausted",
|
|
@@ -79000,7 +79004,7 @@ var PiAcpEndpoint = class {
|
|
|
79000
79004
|
PI_ACP_PI_COMMAND: options.command
|
|
79001
79005
|
});
|
|
79002
79006
|
let piAgent = null;
|
|
79003
|
-
this.#app = agent({ name: "
|
|
79007
|
+
this.#app = agent({ name: "morty-pi" }).onConnect((connection) => {
|
|
79004
79008
|
this.#connection = connection;
|
|
79005
79009
|
piAgent = new PiAcpAgent(
|
|
79006
79010
|
createPiAcpClient(connection, options.onSessionUpdate, options.onUserMessageStart),
|
|
@@ -79141,7 +79145,7 @@ var PiAgentSpecification = class extends InProcessAcpAgentSpecification {
|
|
|
79141
79145
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS2;
|
|
79142
79146
|
agentExecutable = "pi";
|
|
79143
79147
|
createConnection = (options) => new PiAgentConnection(options);
|
|
79144
|
-
// The Pi ACP fork inlines embedded prompt resources into the turn message, so
|
|
79148
|
+
// The Pi ACP fork inlines embedded prompt resources into the turn message, so Morty
|
|
79145
79149
|
// keeps the adapter's opt-in capability flag enabled for every launch it owns.
|
|
79146
79150
|
createLaunchEnvironment = async (_agent, context) => {
|
|
79147
79151
|
const workspaceHash = createHash3("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
|
|
@@ -79478,7 +79482,7 @@ async function probeAcpReadiness(specification, agent2, environment, defaultWork
|
|
|
79478
79482
|
methods.agent.initialize,
|
|
79479
79483
|
{
|
|
79480
79484
|
clientCapabilities: {},
|
|
79481
|
-
clientInfo: { name: "
|
|
79485
|
+
clientInfo: { name: "morty", version: "0.0.3" },
|
|
79482
79486
|
protocolVersion: PROTOCOL_VERSION
|
|
79483
79487
|
},
|
|
79484
79488
|
{ cancellationSignal: controller.signal }
|
|
@@ -79930,7 +79934,7 @@ function buildPromptContent(options, capabilities) {
|
|
|
79930
79934
|
}
|
|
79931
79935
|
for (const image of options.images) {
|
|
79932
79936
|
prompt.push({
|
|
79933
|
-
_meta: {
|
|
79937
|
+
_meta: { morty: { name: image.name } },
|
|
79934
79938
|
data: image.data,
|
|
79935
79939
|
mimeType: image.mimeType,
|
|
79936
79940
|
type: "image"
|
|
@@ -80037,7 +80041,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
80037
80041
|
const id = truncate3(readString3(option["id"]), 128);
|
|
80038
80042
|
const name2 = truncate3(readString3(option["name"], id), 255);
|
|
80039
80043
|
const category = truncate3(readString3(option["category"]), 128);
|
|
80040
|
-
if (id.length === 0 || name2.length === 0 || category === "
|
|
80044
|
+
if (id.length === 0 || name2.length === 0 || category === "_morty_permission") {
|
|
80041
80045
|
continue;
|
|
80042
80046
|
}
|
|
80043
80047
|
if (option["type"] === "boolean") {
|
|
@@ -80282,7 +80286,7 @@ async function validateAgentRuntime(agent2, signal) {
|
|
|
80282
80286
|
signal.throwIfAborted();
|
|
80283
80287
|
if (unchanged.some((result) => !result)) {
|
|
80284
80288
|
throw new AcpExecutionError(
|
|
80285
|
-
"The local Agent runtime changed; restart
|
|
80289
|
+
"The local Agent runtime changed; restart Morty before starting a new conversation",
|
|
80286
80290
|
{},
|
|
80287
80291
|
"agent_runtime_changed"
|
|
80288
80292
|
);
|
|
@@ -80302,7 +80306,7 @@ async function initializeAgentConnection(connection, agentId, verifiedVersion, s
|
|
|
80302
80306
|
plan: {},
|
|
80303
80307
|
session: { compaction: {}, configOptions: { boolean: {} } }
|
|
80304
80308
|
},
|
|
80305
|
-
clientInfo: { name: "
|
|
80309
|
+
clientInfo: { name: "morty", version: "0.0.3" },
|
|
80306
80310
|
protocolVersion: PROTOCOL_VERSION
|
|
80307
80311
|
},
|
|
80308
80312
|
{ cancellationSignal: signal }
|
|
@@ -80364,18 +80368,18 @@ function applyConfigurationChanges(base, changes) {
|
|
|
80364
80368
|
}
|
|
80365
80369
|
|
|
80366
80370
|
// src/engine/acp/adapter/session-events.ts
|
|
80367
|
-
function
|
|
80371
|
+
function withMortyFields(update, eventUpdate) {
|
|
80368
80372
|
if (typeof eventUpdate !== "object" || eventUpdate === null) {
|
|
80369
80373
|
return eventUpdate;
|
|
80370
80374
|
}
|
|
80371
80375
|
switch (update.sessionUpdate) {
|
|
80372
80376
|
case "tool_call":
|
|
80373
80377
|
case "tool_call_update": {
|
|
80374
|
-
const backgroundTask = update._meta?.["
|
|
80378
|
+
const backgroundTask = update._meta?.["morty.backgroundTask"];
|
|
80375
80379
|
return backgroundTask === void 0 ? eventUpdate : { ...eventUpdate, backgroundTask };
|
|
80376
80380
|
}
|
|
80377
80381
|
case "agent_message_chunk": {
|
|
80378
|
-
const questions = update._meta?.["
|
|
80382
|
+
const questions = update._meta?.["morty.questions"];
|
|
80379
80383
|
return questions === void 0 ? eventUpdate : { ...eventUpdate, questions };
|
|
80380
80384
|
}
|
|
80381
80385
|
default:
|
|
@@ -80412,7 +80416,7 @@ var AdapterSessionConnection = class {
|
|
|
80412
80416
|
const update = externalized.agent;
|
|
80413
80417
|
for (const eventUpdate of externalized.events) {
|
|
80414
80418
|
const payload = decodeAcpSessionUpdate(
|
|
80415
|
-
JSON.stringify(normalizeEvent(
|
|
80419
|
+
JSON.stringify(normalizeEvent(withMortyFields(update, eventUpdate)))
|
|
80416
80420
|
);
|
|
80417
80421
|
let event;
|
|
80418
80422
|
switch (update.sessionUpdate) {
|
|
@@ -82102,9 +82106,7 @@ import { join as join24 } from "node:path";
|
|
|
82102
82106
|
|
|
82103
82107
|
// src/engine/storage/sqlite/local-databases.ts
|
|
82104
82108
|
import { createHash as createHash4 } from "node:crypto";
|
|
82105
|
-
import { existsSync as existsSync9 } from "node:fs";
|
|
82106
82109
|
import { join as join23 } from "node:path";
|
|
82107
|
-
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
82108
82110
|
|
|
82109
82111
|
// src/engine/generated/acp-session-store-migrations.ts
|
|
82110
82112
|
var acpSessionStoreMigrations = [
|
|
@@ -87067,7 +87069,7 @@ var LocalSqliteDatabase = class {
|
|
|
87067
87069
|
#migrate = (label, migrations) => {
|
|
87068
87070
|
const version3 = external_exports.object({ user_version: external_exports.number().int().nonnegative() }).parse(this.#sqlite.prepare("PRAGMA user_version").get()).user_version;
|
|
87069
87071
|
if (version3 > migrations.length) {
|
|
87070
|
-
throw new Error(`The ${label} was created by a newer
|
|
87072
|
+
throw new Error(`The ${label} was created by a newer Morty version`);
|
|
87071
87073
|
}
|
|
87072
87074
|
for (let index2 = version3; index2 < migrations.length; index2 += 1) {
|
|
87073
87075
|
const migration = migrations[index2];
|
|
@@ -87110,23 +87112,7 @@ function channelSessionDatabasePaths(stateDirectory, channelId) {
|
|
|
87110
87112
|
sessions: join23(stateDirectory, "sessions", `${channelHash}.sqlite`)
|
|
87111
87113
|
};
|
|
87112
87114
|
}
|
|
87113
|
-
function recordAppliedAdmissionOrder(path7) {
|
|
87114
|
-
if (!existsSync9(path7)) {
|
|
87115
|
-
return;
|
|
87116
|
-
}
|
|
87117
|
-
const database = new DatabaseSync3(path7);
|
|
87118
|
-
try {
|
|
87119
|
-
const version3 = database.prepare("PRAGMA user_version").get()?.["user_version"];
|
|
87120
|
-
const column = database.prepare("SELECT name FROM pragma_table_info('execution_receipt') WHERE name = 'admission_order'").get();
|
|
87121
|
-
if (version3 === 9 && column !== void 0) {
|
|
87122
|
-
database.exec("PRAGMA user_version = 10");
|
|
87123
|
-
}
|
|
87124
|
-
} finally {
|
|
87125
|
-
database.close();
|
|
87126
|
-
}
|
|
87127
|
-
}
|
|
87128
87115
|
var openAcpSessionDatabase = (path7) => {
|
|
87129
|
-
recordAppliedAdmissionOrder(path7);
|
|
87130
87116
|
return new LocalSqliteDatabase(path7, "ACP Session database", acpSessionStoreMigrations);
|
|
87131
87117
|
};
|
|
87132
87118
|
var openCommandCancellationDatabase = (path7) => new LocalSqliteDatabase(path7, "Command cancellation database", commandCancellationMigrations);
|
|
@@ -87279,7 +87265,7 @@ var SessionEventCacheTable = class {
|
|
|
87279
87265
|
} catch (cause) {
|
|
87280
87266
|
this.#isAvailable = false;
|
|
87281
87267
|
this.#ignoredPersistedSessions.add(sessionId);
|
|
87282
|
-
console.warn("
|
|
87268
|
+
console.warn("Morty V2 Session event cache writes are unavailable; retaining events in memory", cause);
|
|
87283
87269
|
}
|
|
87284
87270
|
};
|
|
87285
87271
|
close = () => {
|
|
@@ -87287,7 +87273,7 @@ var SessionEventCacheTable = class {
|
|
|
87287
87273
|
try {
|
|
87288
87274
|
this.#checkpoint();
|
|
87289
87275
|
} catch (cause) {
|
|
87290
|
-
console.warn("
|
|
87276
|
+
console.warn("Morty V2 Session event cache checkpoint on close failed", cause);
|
|
87291
87277
|
}
|
|
87292
87278
|
}
|
|
87293
87279
|
this.#localDatabase.close();
|
|
@@ -87298,13 +87284,13 @@ var SessionEventCacheTable = class {
|
|
|
87298
87284
|
};
|
|
87299
87285
|
#disableWrites = (cause) => {
|
|
87300
87286
|
this.#isAvailable = false;
|
|
87301
|
-
console.warn("
|
|
87287
|
+
console.warn("Morty V2 Session event cache writes are unavailable; retaining events in memory", cause);
|
|
87302
87288
|
};
|
|
87303
87289
|
};
|
|
87304
87290
|
|
|
87305
87291
|
// src/engine/storage/session/temporary-session-event-cache.ts
|
|
87306
87292
|
function openTemporarySessionEventCache() {
|
|
87307
|
-
const directory = mkdtempSync(join24(tmpdir2(), "
|
|
87293
|
+
const directory = mkdtempSync(join24(tmpdir2(), "morty-preview-events-"));
|
|
87308
87294
|
const removeFiles = () => rmSync2(directory, { recursive: true, force: true });
|
|
87309
87295
|
try {
|
|
87310
87296
|
return {
|
|
@@ -87569,7 +87555,7 @@ var CodexAdapter = class {
|
|
|
87569
87555
|
}
|
|
87570
87556
|
if (!await revalidateExecutable(agent2.agentIdentity)) {
|
|
87571
87557
|
throw new AcpExecutionError(
|
|
87572
|
-
"The local Codex executable changed. Restart
|
|
87558
|
+
"The local Codex executable changed. Restart Morty to discover it again.",
|
|
87573
87559
|
{},
|
|
87574
87560
|
"agent_executable_changed"
|
|
87575
87561
|
);
|
|
@@ -87613,7 +87599,7 @@ var CodexAdapter = class {
|
|
|
87613
87599
|
events.push({
|
|
87614
87600
|
type: "acp",
|
|
87615
87601
|
payload: decodeAcpSessionUpdate(
|
|
87616
|
-
JSON.stringify(fitCodexToolEvent(
|
|
87602
|
+
JSON.stringify(fitCodexToolEvent(withMortyFields(update, event)))
|
|
87617
87603
|
)
|
|
87618
87604
|
});
|
|
87619
87605
|
}
|
|
@@ -87835,7 +87821,7 @@ var AcpContentExternalizer = class {
|
|
|
87835
87821
|
signal
|
|
87836
87822
|
);
|
|
87837
87823
|
return {
|
|
87838
|
-
agent: { ...content, data: "", uri: `
|
|
87824
|
+
agent: { ...content, data: "", uri: `morty-content:image:${stored.key}` },
|
|
87839
87825
|
event: {
|
|
87840
87826
|
_meta: content._meta,
|
|
87841
87827
|
annotations: content.annotations,
|
|
@@ -88329,7 +88315,7 @@ async function discoverRuntimeAgentInventory(options, channelId) {
|
|
|
88329
88315
|
const log = new RuntimeDiagnosticLog(options.dataDirectory);
|
|
88330
88316
|
const record2 = (details) => {
|
|
88331
88317
|
log.record(
|
|
88332
|
-
`
|
|
88318
|
+
`Morty agent discovery diagnostic ${JSON.stringify({
|
|
88333
88319
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
88334
88320
|
channelId,
|
|
88335
88321
|
...details
|
|
@@ -88757,7 +88743,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, signal) {
|
|
|
88757
88743
|
id: agent2.id,
|
|
88758
88744
|
label: agent2.label
|
|
88759
88745
|
}));
|
|
88760
|
-
const endpoint = options.pairingId.length > 0 ?
|
|
88746
|
+
const endpoint = options.pairingId.length > 0 ? mortyApiUrl(options.relayOrigin, `/v1/runtime-pairings/${encodeURIComponent(options.pairingId)}/redeem`) : mortyApiUrl(options.relayOrigin, "/pairings/claim");
|
|
88761
88747
|
let response;
|
|
88762
88748
|
try {
|
|
88763
88749
|
response = await fetch3(endpoint, {
|
|
@@ -88783,7 +88769,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, signal) {
|
|
|
88783
88769
|
return options.pairingId.length > 0 ? decodePairingResponse(value, "runtimeCredential", REDEEM_RESPONSE_KEYS) : decodePairingResponse(value, "daemonToken", CLAIM_RESPONSE_KEYS);
|
|
88784
88770
|
}
|
|
88785
88771
|
function buildSavedRuntimeConfig(connection, defaultWorkspace, inventory, localContext) {
|
|
88786
|
-
const relayUrl =
|
|
88772
|
+
const relayUrl = mortyApiUrl(connection.relayOrigin, "/v1/runtimes/connect");
|
|
88787
88773
|
relayUrl.protocol = relayUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
88788
88774
|
relayUrl.searchParams.set("token", connection.runtimeCredential);
|
|
88789
88775
|
const config2 = createRuntimeConfig(
|
|
@@ -89305,7 +89291,7 @@ function normalizeElicitationFields(requestedSchema) {
|
|
|
89305
89291
|
maximumLength: numericString(property["maxLength"] ?? property["maxItems"]),
|
|
89306
89292
|
minimum: numericString(property["minimum"]),
|
|
89307
89293
|
minimumLength: numericString(property["minLength"] ?? property["minItems"]),
|
|
89308
|
-
...normalizedType === "string" && isRecord5(metadata) && metadata["io.
|
|
89294
|
+
...normalizedType === "string" && isRecord5(metadata) && metadata["io.morty/multiline"] === true ? { multiline: true } : {},
|
|
89309
89295
|
name: truncate(name2, 128),
|
|
89310
89296
|
options,
|
|
89311
89297
|
pattern: truncate(readString2(property["pattern"]), 500),
|
|
@@ -89684,7 +89670,7 @@ var SessionInteractions = class {
|
|
|
89684
89670
|
const sessionId = Reflect.get(request, "sessionId");
|
|
89685
89671
|
if (typeof sessionId !== "string") {
|
|
89686
89672
|
throw new AcpExecutionError(
|
|
89687
|
-
"
|
|
89673
|
+
"Morty only accepts session-scoped ACP elicitations",
|
|
89688
89674
|
{},
|
|
89689
89675
|
"unsupported_elicitation_scope"
|
|
89690
89676
|
);
|
|
@@ -90172,7 +90158,7 @@ var AgentSession = class _AgentSession {
|
|
|
90172
90158
|
return this.#restored;
|
|
90173
90159
|
}
|
|
90174
90160
|
get sessionId() {
|
|
90175
|
-
return this.#
|
|
90161
|
+
return this.#mortySessionId;
|
|
90176
90162
|
}
|
|
90177
90163
|
get store() {
|
|
90178
90164
|
return this.#store;
|
|
@@ -90198,7 +90184,7 @@ var AgentSession = class _AgentSession {
|
|
|
90198
90184
|
#getObserver;
|
|
90199
90185
|
#agentCommand;
|
|
90200
90186
|
#interactions;
|
|
90201
|
-
#
|
|
90187
|
+
#mortySessionId;
|
|
90202
90188
|
#metrics;
|
|
90203
90189
|
#store;
|
|
90204
90190
|
#agentName = "";
|
|
@@ -90216,22 +90202,22 @@ var AgentSession = class _AgentSession {
|
|
|
90216
90202
|
#restored = false;
|
|
90217
90203
|
#sessionTitle = null;
|
|
90218
90204
|
#sessionUpdatedAt = "";
|
|
90219
|
-
constructor(agent2, cwd, additionalDirectories,
|
|
90220
|
-
this.#agentCommand = () => agentCommand(this.#
|
|
90205
|
+
constructor(agent2, cwd, additionalDirectories, mortySessionId, getObserver, agentCommand, store, metrics, adapter, externalize) {
|
|
90206
|
+
this.#agentCommand = () => agentCommand(this.#mortySessionId);
|
|
90221
90207
|
this.#additionalDirectories = [...additionalDirectories];
|
|
90222
90208
|
this.#adapter = adapter;
|
|
90223
90209
|
this.#agentId = agent2.id;
|
|
90224
90210
|
this.#commands = [];
|
|
90225
90211
|
this.#cwd = cwd;
|
|
90226
90212
|
this.#environment = agent2.environment;
|
|
90227
|
-
this.#
|
|
90213
|
+
this.#mortySessionId = mortySessionId;
|
|
90228
90214
|
this.#metrics = metrics;
|
|
90229
90215
|
this.#store = store;
|
|
90230
90216
|
this.#getObserver = getObserver;
|
|
90231
90217
|
this.#interactions = new SessionInteractions({
|
|
90232
90218
|
cwd: () => this.#cwd,
|
|
90233
|
-
getToolCall: (toolCallId) => this.#store.events.getToolCall(this.#
|
|
90234
|
-
sessionId: () => this.#
|
|
90219
|
+
getToolCall: (toolCallId) => this.#store.events.getToolCall(this.#mortySessionId, toolCallId),
|
|
90220
|
+
sessionId: () => this.#mortySessionId,
|
|
90235
90221
|
commandId: () => this.#agentCommand() ?? SESSION_CONTROL_COMMAND_ID,
|
|
90236
90222
|
assertNativeSession: this.assertNativeSession,
|
|
90237
90223
|
observer: getObserver,
|
|
@@ -90241,7 +90227,7 @@ var AgentSession = class _AgentSession {
|
|
|
90241
90227
|
agent: agent2,
|
|
90242
90228
|
cwd,
|
|
90243
90229
|
additionalDirectories: this.#additionalDirectories,
|
|
90244
|
-
...externalize === void 0 ? {} : { externalizeUpdate: (update, signal) => externalize(this.#
|
|
90230
|
+
...externalize === void 0 ? {} : { externalizeUpdate: (update, signal) => externalize(this.#mortySessionId, update, signal) }
|
|
90245
90231
|
};
|
|
90246
90232
|
this.#subscriber = {
|
|
90247
90233
|
onSessionEvent: async (nativeSessionId, event) => {
|
|
@@ -90334,7 +90320,7 @@ var AgentSession = class _AgentSession {
|
|
|
90334
90320
|
writeStoredSession = (updatedAt) => {
|
|
90335
90321
|
this.#store.write(
|
|
90336
90322
|
new StoredSession(
|
|
90337
|
-
this.#
|
|
90323
|
+
this.#mortySessionId,
|
|
90338
90324
|
this.#agentId,
|
|
90339
90325
|
this.#nativeSessionId,
|
|
90340
90326
|
this.#cwd,
|
|
@@ -90437,7 +90423,7 @@ var AgentSession = class _AgentSession {
|
|
|
90437
90423
|
return;
|
|
90438
90424
|
}
|
|
90439
90425
|
this.#sessionLoad = {
|
|
90440
|
-
history: new HistoryReplayCapture(this.#store.events, this.#
|
|
90426
|
+
history: new HistoryReplayCapture(this.#store.events, this.#mortySessionId),
|
|
90441
90427
|
kind: "execution-only"
|
|
90442
90428
|
};
|
|
90443
90429
|
};
|
|
@@ -90455,9 +90441,9 @@ var AgentSession = class _AgentSession {
|
|
|
90455
90441
|
async #completedHistory(signal) {
|
|
90456
90442
|
if (!this.#prompted && this.#nativeHistoryOwnership.kind === "fresh-session") {
|
|
90457
90443
|
if (this.#sessionLoad.kind === "not-requested") {
|
|
90458
|
-
this.#store.events.reset(this.#
|
|
90444
|
+
this.#store.events.reset(this.#mortySessionId);
|
|
90459
90445
|
this.#sessionLoad = {
|
|
90460
|
-
history: new HistoryReplayCapture(this.#store.events, this.#
|
|
90446
|
+
history: new HistoryReplayCapture(this.#store.events, this.#mortySessionId),
|
|
90461
90447
|
kind: "loaded",
|
|
90462
90448
|
opened: {
|
|
90463
90449
|
nativeSessionId: this.nativeSessionId(),
|
|
@@ -90482,8 +90468,8 @@ var AgentSession = class _AgentSession {
|
|
|
90482
90468
|
if (this.#sessionLoad.kind === "capturing") {
|
|
90483
90469
|
return await waitForSharedOperation(this.#sessionLoad.completion, signal);
|
|
90484
90470
|
}
|
|
90485
|
-
this.#store.events.reset(this.#
|
|
90486
|
-
const history = new HistoryReplayCapture(this.#store.events, this.#
|
|
90471
|
+
this.#store.events.reset(this.#mortySessionId);
|
|
90472
|
+
const history = new HistoryReplayCapture(this.#store.events, this.#mortySessionId);
|
|
90487
90473
|
const completion = Promise.resolve().then(async () => {
|
|
90488
90474
|
try {
|
|
90489
90475
|
const opened = await this.#writeNativeHistory(
|
|
@@ -90586,7 +90572,7 @@ var AgentSession = class _AgentSession {
|
|
|
90586
90572
|
if (this.#prompted || this.#nativeSessionId !== sessionId) {
|
|
90587
90573
|
throw new AcpExecutionError("The new native Session cannot be adopted", {}, "session_identity_mismatch");
|
|
90588
90574
|
}
|
|
90589
|
-
const previousSessionId = this.#
|
|
90575
|
+
const previousSessionId = this.#mortySessionId;
|
|
90590
90576
|
this.#store.write(
|
|
90591
90577
|
new StoredSession(
|
|
90592
90578
|
sessionId,
|
|
@@ -90601,7 +90587,7 @@ var AgentSession = class _AgentSession {
|
|
|
90601
90587
|
)
|
|
90602
90588
|
);
|
|
90603
90589
|
this.#store.remove(previousSessionId);
|
|
90604
|
-
this.#
|
|
90590
|
+
this.#mortySessionId = sessionId;
|
|
90605
90591
|
};
|
|
90606
90592
|
#applyConfiguration = async (selection, signal) => {
|
|
90607
90593
|
const before = this.#configOptions;
|
|
@@ -90644,7 +90630,7 @@ var AgentSession = class _AgentSession {
|
|
|
90644
90630
|
};
|
|
90645
90631
|
};
|
|
90646
90632
|
#publishConfiguration = async () => {
|
|
90647
|
-
const event = this.#store.events.append(this.#
|
|
90633
|
+
const event = this.#store.events.append(this.#mortySessionId, {
|
|
90648
90634
|
type: "acp",
|
|
90649
90635
|
payload: {
|
|
90650
90636
|
sessionUpdate: "config_option_update",
|
|
@@ -90670,7 +90656,7 @@ var AgentSession = class _AgentSession {
|
|
|
90670
90656
|
if (!this.#capabilities.loadSession && this.#sessionLoad.kind === "not-requested") {
|
|
90671
90657
|
this.#sessionLoad = {
|
|
90672
90658
|
kind: "loaded",
|
|
90673
|
-
history: new HistoryReplayCapture(this.#store.events, this.#
|
|
90659
|
+
history: new HistoryReplayCapture(this.#store.events, this.#mortySessionId),
|
|
90674
90660
|
opened: {
|
|
90675
90661
|
nativeSessionId: this.nativeSessionId(),
|
|
90676
90662
|
capabilities: this.#capabilities,
|
|
@@ -90849,7 +90835,7 @@ var AgentSession = class _AgentSession {
|
|
|
90849
90835
|
return "retained";
|
|
90850
90836
|
};
|
|
90851
90837
|
interactionSnapshot = () => {
|
|
90852
|
-
const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(this.#
|
|
90838
|
+
const { sessionGenerationId, throughPosition } = this.#store.events.livePosition(this.#mortySessionId);
|
|
90853
90839
|
return { sessionGenerationId, throughPosition, interactions: this.#interactions.snapshot() };
|
|
90854
90840
|
};
|
|
90855
90841
|
respondPermission = async (options) => {
|
|
@@ -90906,7 +90892,7 @@ var AgentSession = class _AgentSession {
|
|
|
90906
90892
|
await this.#getObserver().onCommands({
|
|
90907
90893
|
commands: this.#commands,
|
|
90908
90894
|
kind: SESSION_COMMANDS_UPDATED_KIND,
|
|
90909
|
-
sessionId: this.#
|
|
90895
|
+
sessionId: this.#mortySessionId
|
|
90910
90896
|
});
|
|
90911
90897
|
return;
|
|
90912
90898
|
case "configuration":
|
|
@@ -90929,7 +90915,7 @@ var AgentSession = class _AgentSession {
|
|
|
90929
90915
|
}
|
|
90930
90916
|
await this.#getObserver().onInfo({
|
|
90931
90917
|
kind: SESSION_INFO_UPDATED_KIND,
|
|
90932
|
-
sessionId: this.#
|
|
90918
|
+
sessionId: this.#mortySessionId,
|
|
90933
90919
|
title: this.#sessionTitle,
|
|
90934
90920
|
updatedAt: this.#sessionUpdatedAt
|
|
90935
90921
|
});
|
|
@@ -90994,7 +90980,7 @@ var AgentSession = class _AgentSession {
|
|
|
90994
90980
|
configurationRevision: configurationRevision(this.#configOptions),
|
|
90995
90981
|
kind: SESSION_CONFIG_UPDATED_KIND,
|
|
90996
90982
|
requestId: `agent-update-${crypto.randomUUID()}`,
|
|
90997
|
-
sessionId: this.#
|
|
90983
|
+
sessionId: this.#mortySessionId
|
|
90998
90984
|
});
|
|
90999
90985
|
};
|
|
91000
90986
|
};
|
|
@@ -91421,7 +91407,7 @@ var SessionManager2 = class {
|
|
|
91421
91407
|
/**
|
|
91422
91408
|
* Opens a short-lived native ACP session only to read the local Agent's
|
|
91423
91409
|
* authoritative settings. Its identity and store are private to this
|
|
91424
|
-
* operation and never become a
|
|
91410
|
+
* operation and never become a Morty Session.
|
|
91425
91411
|
*/
|
|
91426
91412
|
inspectAgentSettings = async (options) => this.#operations.run(options, async (options2) => {
|
|
91427
91413
|
return await this.#processes.runTransient(
|
|
@@ -92088,7 +92074,7 @@ var NativeSessionService = class {
|
|
|
92088
92074
|
});
|
|
92089
92075
|
return {
|
|
92090
92076
|
entryId,
|
|
92091
|
-
|
|
92077
|
+
mortySessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
|
|
92092
92078
|
nativeSessionId: decodeIdentifier(info.sessionId),
|
|
92093
92079
|
title: info.title ?? "Untitled session",
|
|
92094
92080
|
directoryId: authorized.directoryId,
|
|
@@ -92526,8 +92512,8 @@ var PromptLifecycle = class {
|
|
|
92526
92512
|
const restated = this.#append(sessionId, event, recordedAt);
|
|
92527
92513
|
this.#publishInOrder({
|
|
92528
92514
|
...restated,
|
|
92529
|
-
|
|
92530
|
-
...restated.
|
|
92515
|
+
mortyMetadata: {
|
|
92516
|
+
...restated.mortyMetadata,
|
|
92531
92517
|
...recordedAt === void 0 ? {} : { recordedOutcome: true },
|
|
92532
92518
|
restated: true
|
|
92533
92519
|
}
|
|
@@ -93774,7 +93760,7 @@ function buildSessionLayer(options) {
|
|
|
93774
93760
|
});
|
|
93775
93761
|
return {
|
|
93776
93762
|
...snapshot,
|
|
93777
|
-
|
|
93763
|
+
interactionState: interactionState ?? null,
|
|
93778
93764
|
...request.deliveryCommandId === void 0 ? {} : { command: operations.delivery(request.deliveryCommandId, request.targetSessionId) },
|
|
93779
93765
|
...lastTurn === void 0 ? {} : { lastTurn }
|
|
93780
93766
|
};
|
|
@@ -93884,7 +93870,7 @@ var ScratchDirectory = class {
|
|
|
93884
93870
|
};
|
|
93885
93871
|
|
|
93886
93872
|
// src/engine/session/content/external-content-store.ts
|
|
93887
|
-
var contentRequest = /^
|
|
93873
|
+
var contentRequest = /^morty-content:(image|audio|resource):([a-f0-9]{64})$/u;
|
|
93888
93874
|
var CONTENT_LIFETIME_MILLISECONDS = 24 * 60 * 60 * 1e3;
|
|
93889
93875
|
var metadataSchema = external_exports.strictObject({
|
|
93890
93876
|
kind: external_exports.enum(["image", "audio", "resource"]),
|
|
@@ -93938,7 +93924,7 @@ var LocalExternalContentStore = class {
|
|
|
93938
93924
|
active.throwIfAborted();
|
|
93939
93925
|
const metadata = metadataSchema.parse({ kind, mediaType, name: name2 });
|
|
93940
93926
|
const key = createHash9("sha256").update(bytes).digest("hex");
|
|
93941
|
-
const request = `
|
|
93927
|
+
const request = `morty-content:${kind}:${key}`;
|
|
93942
93928
|
const existing = this.#entries.get(request);
|
|
93943
93929
|
if (existing !== void 0 && existing.expiresAt > Date.now()) {
|
|
93944
93930
|
this.#entries.set(request, {
|
|
@@ -94003,7 +93989,7 @@ var LocalExternalContentStore = class {
|
|
|
94003
93989
|
}
|
|
94004
93990
|
const resources = [];
|
|
94005
93991
|
for (const [request, entry] of this.#entries) {
|
|
94006
|
-
if (!request.startsWith("
|
|
93992
|
+
if (!request.startsWith("morty-content:resource:") || entry.expiresAt <= Date.now()) {
|
|
94007
93993
|
continue;
|
|
94008
93994
|
}
|
|
94009
93995
|
const uri = pathToFileURL3(entry.path).href;
|
|
@@ -96253,7 +96239,7 @@ var sessionPromptCommand = {
|
|
|
96253
96239
|
readArtifact: async (attachment, signal) => {
|
|
96254
96240
|
const artifact = await context.externalContent.read(
|
|
96255
96241
|
message.sessionId,
|
|
96256
|
-
`
|
|
96242
|
+
`morty-content:${attachment.kind}:${attachment.contentKey}`,
|
|
96257
96243
|
signal
|
|
96258
96244
|
);
|
|
96259
96245
|
if (artifact === null) {
|
|
@@ -97819,7 +97805,7 @@ var RuntimeLoop = class {
|
|
|
97819
97805
|
};
|
|
97820
97806
|
|
|
97821
97807
|
// src/engine/runtime/engine.ts
|
|
97822
|
-
var
|
|
97808
|
+
var MortyRuntimeEngine = class {
|
|
97823
97809
|
#engineDataDir;
|
|
97824
97810
|
#agentLaunchEnvironment;
|
|
97825
97811
|
#maxAcpProcesses;
|
|
@@ -97939,7 +97925,7 @@ export {
|
|
|
97939
97925
|
refreshAgentCatalog,
|
|
97940
97926
|
RuntimeRelayRevokedError,
|
|
97941
97927
|
RuntimeLoop,
|
|
97942
|
-
|
|
97928
|
+
MortyRuntimeEngine
|
|
97943
97929
|
};
|
|
97944
97930
|
/*! Bundled license information:
|
|
97945
97931
|
|
|
@@ -97951,4 +97937,4 @@ export {
|
|
|
97951
97937
|
* MIT Licensed
|
|
97952
97938
|
*)
|
|
97953
97939
|
*/
|
|
97954
|
-
//# sourceMappingURL=chunk-
|
|
97940
|
+
//# sourceMappingURL=chunk-MBS25BBY.js.map
|