@moxt-ai/mobius 0.0.58 → 0.0.60
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/agent-catalog/publish-agent-catalog.d.ts.map +1 -1
- package/dist/agent-catalog/publish-agent-catalog.js +36 -3
- package/dist/agent-catalog/publish-agent-catalog.js.map +1 -1
- package/dist/artifacts/local-file-streamer.d.ts +2 -2
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +7 -7
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +648 -330
- package/dist/cli.js.map +4 -4
- package/dist/index.js +647 -329
- package/dist/index.js.map +4 -4
- package/dist/relay-connection/diagnostics.d.ts +5 -0
- package/dist/relay-connection/diagnostics.d.ts.map +1 -1
- package/dist/relay-connection/diagnostics.js +14 -0
- package/dist/relay-connection/diagnostics.js.map +1 -1
- package/dist/relay-connection/liveness.d.ts +2 -2
- package/dist/relay-connection/liveness.d.ts.map +1 -1
- package/dist/relay-connection/liveness.js +3 -3
- package/dist/relay-connection/liveness.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +162 -114
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +656 -338
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.60",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -23187,39 +23187,65 @@ var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.
|
|
|
23187
23187
|
var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
|
|
23188
23188
|
var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
|
|
23189
23189
|
var decodeAgentSettingsDiscoverCommand = (encoded) => decode3(encoded, agentSettingsDiscoverCommandSchema);
|
|
23190
|
+
var encodeAgentSettingsDiscoverCommand = (message) => encode3(message, agentSettingsDiscoverCommandSchema);
|
|
23191
|
+
var decodeAgentSettingsDiscoveredEvent = (encoded) => decode3(encoded, agentSettingsDiscoveredEventSchema);
|
|
23190
23192
|
var encodeAgentSettingsDiscoveredEvent = (message) => encode3(message, agentSettingsDiscoveredEventSchema);
|
|
23193
|
+
var decodeAgentSettingsDiscoveryFailedEvent = (encoded) => decode3(encoded, agentSettingsDiscoveryFailedEventSchema);
|
|
23191
23194
|
var encodeAgentSettingsDiscoveryFailedEvent = (message) => encode3(message, agentSettingsDiscoveryFailedEventSchema);
|
|
23192
23195
|
var decodeAgentCatalogRefreshCommand = (encoded) => decode3(encoded, agentCatalogRefreshCommandSchema);
|
|
23196
|
+
var encodeAgentCatalogRefreshCommand = (message) => encode3(message, agentCatalogRefreshCommandSchema);
|
|
23197
|
+
var decodeAgentCatalogRefreshedEvent = (encoded) => decode3(encoded, agentCatalogRefreshedEventSchema);
|
|
23193
23198
|
var encodeAgentCatalogRefreshedEvent = (message) => encode3(message, agentCatalogRefreshedEventSchema);
|
|
23199
|
+
var decodeAgentCatalogRefreshFailedEvent = (encoded) => decode3(encoded, agentCatalogRefreshFailedEventSchema);
|
|
23194
23200
|
var encodeAgentCatalogRefreshFailedEvent = (message) => encode3(message, agentCatalogRefreshFailedEventSchema);
|
|
23195
23201
|
var decodeFileReadCommand = (encoded) => decode3(encoded, fileReadCommandSchema);
|
|
23202
|
+
var encodeFileReadCommand = (message) => encode3(message, fileReadCommandSchema);
|
|
23203
|
+
var decodeFileBeginEvent = (encoded) => decode3(encoded, fileBeginEventSchema);
|
|
23196
23204
|
var encodeFileBeginEvent = (message) => encode3(message, fileBeginEventSchema);
|
|
23205
|
+
var decodeFileChunkEvent = (encoded) => decode3(encoded, fileChunkEventSchema);
|
|
23197
23206
|
var encodeFileChunkEvent = (message) => encode3(message, fileChunkEventSchema);
|
|
23207
|
+
var decodeFileEndEvent = (encoded) => decode3(encoded, fileEndEventSchema);
|
|
23198
23208
|
var encodeFileEndEvent = (message) => encode3(message, fileEndEventSchema);
|
|
23209
|
+
var decodeFileFailedEvent = (encoded) => decode3(encoded, fileFailedEventSchema);
|
|
23199
23210
|
var encodeFileFailedEvent = (message) => encode3(message, fileFailedEventSchema);
|
|
23200
23211
|
var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListCommandSchema);
|
|
23212
|
+
var encodeWorkspaceListCommand = (message) => encode3(message, workspaceListCommandSchema);
|
|
23213
|
+
var decodeWorkspaceEntriesEvent = (encoded) => decode3(encoded, workspaceEntriesEventSchema);
|
|
23201
23214
|
var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
|
|
23202
23215
|
var decodeSessionPrepareCommand = (encoded) => decode3(encoded, sessionPrepareCommandSchema);
|
|
23216
|
+
var encodeSessionPrepareCommand = (message) => encode3(message, sessionPrepareCommandSchema);
|
|
23217
|
+
var decodeSessionReadyEvent = (encoded) => decode3(encoded, sessionReadyEventSchema);
|
|
23203
23218
|
var encodeSessionReadyEvent = (message) => encode3(message, sessionReadyEventSchema);
|
|
23204
23219
|
var decodeSessionConfigureCommand = (encoded) => decode3(encoded, sessionConfigureCommandSchema);
|
|
23205
|
-
var
|
|
23206
|
-
var
|
|
23207
|
-
var
|
|
23208
|
-
var
|
|
23209
|
-
var
|
|
23220
|
+
var encodeSessionConfigureCommand = (message) => encode3(message, sessionConfigureCommandSchema);
|
|
23221
|
+
var decodeSessionConfigUpdatedEvent = (encoded) => decode3(encoded, sessionConfigUpdatedEventSchema);
|
|
23222
|
+
var decodeSessionUsageUpdatedEvent = (encoded) => decode3(encoded, sessionUsageUpdatedEventSchema);
|
|
23223
|
+
var decodeSessionCommandsUpdatedEvent = (encoded) => decode3(encoded, sessionCommandsUpdatedEventSchema);
|
|
23224
|
+
var decodeSessionInfoUpdatedEvent = (encoded) => decode3(encoded, sessionInfoUpdatedEventSchema);
|
|
23225
|
+
var decodeSessionPermissionRequestedEvent = (encoded) => decode3(encoded, sessionPermissionRequestedEventSchema);
|
|
23210
23226
|
var decodeSessionPermissionRespondCommand = (encoded) => decode3(encoded, sessionPermissionRespondCommandSchema);
|
|
23211
|
-
var
|
|
23212
|
-
var
|
|
23227
|
+
var encodeSessionPermissionRespondCommand = (message) => encode3(message, sessionPermissionRespondCommandSchema);
|
|
23228
|
+
var decodeSessionPermissionResolvedEvent = (encoded) => decode3(encoded, sessionPermissionResolvedEventSchema);
|
|
23229
|
+
var decodeSessionElicitationRequestedEvent = (encoded) => decode3(encoded, sessionElicitationRequestedEventSchema);
|
|
23213
23230
|
var decodeSessionElicitationRespondCommand = (encoded) => decode3(encoded, sessionElicitationRespondCommandSchema);
|
|
23214
|
-
var
|
|
23231
|
+
var encodeSessionElicitationRespondCommand = (message) => encode3(message, sessionElicitationRespondCommandSchema);
|
|
23232
|
+
var decodeSessionElicitationResolvedEvent = (encoded) => decode3(encoded, sessionElicitationResolvedEventSchema);
|
|
23233
|
+
var decodeSessionOperationFailedEvent = (encoded) => decode3(encoded, sessionOperationFailedEventSchema);
|
|
23215
23234
|
var encodeSessionOperationFailedEvent = (message) => encode3(message, sessionOperationFailedEventSchema);
|
|
23216
|
-
var
|
|
23235
|
+
var decodeAgentContentEvent = (encoded) => decode3(encoded, agentContentEventSchema);
|
|
23217
23236
|
var decodeAgentInstallRequestCommand = (encoded) => decode3(encoded, agentInstallRequestCommandSchema);
|
|
23237
|
+
var encodeAgentInstallRequestCommand = (message) => encode3(message, agentInstallRequestCommandSchema);
|
|
23218
23238
|
var decodeAgentInstallCancelCommand = (encoded) => decode3(encoded, agentInstallCancelCommandSchema);
|
|
23239
|
+
var encodeAgentInstallCancelCommand = (message) => encode3(message, agentInstallCancelCommandSchema);
|
|
23240
|
+
var decodeAgentInstallStartedEvent = (encoded) => decode3(encoded, agentInstallStartedEventSchema);
|
|
23219
23241
|
var encodeAgentInstallStartedEvent = (message) => encode3(message, agentInstallStartedEventSchema);
|
|
23242
|
+
var decodeAgentInstallProgressEvent = (encoded) => decode3(encoded, agentInstallProgressEventSchema);
|
|
23220
23243
|
var encodeAgentInstallProgressEvent = (message) => encode3(message, agentInstallProgressEventSchema);
|
|
23244
|
+
var decodeAgentInstallCompletedEvent = (encoded) => decode3(encoded, agentInstallCompletedEventSchema);
|
|
23221
23245
|
var encodeAgentInstallCompletedEvent = (message) => encode3(message, agentInstallCompletedEventSchema);
|
|
23246
|
+
var decodeAgentInstallFailedEvent = (encoded) => decode3(encoded, agentInstallFailedEventSchema);
|
|
23222
23247
|
var encodeAgentInstallFailedEvent = (message) => encode3(message, agentInstallFailedEventSchema);
|
|
23248
|
+
var decodeAgentInstallCancelledEvent = (encoded) => decode3(encoded, agentInstallCancelledEventSchema);
|
|
23223
23249
|
var encodeAgentInstallCancelledEvent = (message) => encode3(message, agentInstallCancelledEventSchema);
|
|
23224
23250
|
|
|
23225
23251
|
// ../protocol/src/messages.ts
|
|
@@ -23654,49 +23680,29 @@ function decodeSessionFailedEvent(encoded) {
|
|
|
23654
23680
|
sessionId: readIdentifier(value, "sessionId")
|
|
23655
23681
|
};
|
|
23656
23682
|
}
|
|
23657
|
-
function
|
|
23658
|
-
return JSON.stringify(
|
|
23659
|
-
}
|
|
23660
|
-
function encodeRuntimeDeliveryReceived(message) {
|
|
23661
|
-
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
23683
|
+
function encodeSessionPromptCommand(message) {
|
|
23684
|
+
return JSON.stringify(decodeSessionPromptCommand(JSON.stringify(message)));
|
|
23662
23685
|
}
|
|
23663
|
-
function
|
|
23664
|
-
return JSON.stringify(
|
|
23686
|
+
function encodeSessionCancelCommand(message) {
|
|
23687
|
+
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
23665
23688
|
}
|
|
23666
|
-
function
|
|
23667
|
-
return JSON.stringify(
|
|
23689
|
+
function encodeRuntimeLivenessReadyEvent(message) {
|
|
23690
|
+
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
23668
23691
|
}
|
|
23669
|
-
function
|
|
23670
|
-
return JSON.stringify(
|
|
23692
|
+
function encodeRuntimeHeartbeatEvent(message) {
|
|
23693
|
+
return JSON.stringify(decodeRuntimeHeartbeatEvent(JSON.stringify(message)));
|
|
23671
23694
|
}
|
|
23672
|
-
function
|
|
23673
|
-
return JSON.stringify(
|
|
23695
|
+
function encodeRuntimeHeartbeatAckEvent(message) {
|
|
23696
|
+
return JSON.stringify(decodeRuntimeHeartbeatAckEvent(JSON.stringify(message)));
|
|
23674
23697
|
}
|
|
23675
|
-
function
|
|
23676
|
-
return JSON.stringify(
|
|
23698
|
+
function encodeRuntimeDelivery(message) {
|
|
23699
|
+
return JSON.stringify(decodeRuntimeDelivery(JSON.stringify(message)));
|
|
23677
23700
|
}
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
23681
|
-
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
23682
|
-
var MobiusApiConfigurationError = class extends Error {
|
|
23683
|
-
code = "invalid_api_prefix";
|
|
23684
|
-
constructor() {
|
|
23685
|
-
super("The Mobius API prefix must be an absolute path without parameters");
|
|
23686
|
-
this.name = "MobiusApiConfigurationError";
|
|
23687
|
-
}
|
|
23688
|
-
};
|
|
23689
|
-
function parseMobiusApiPrefix(value) {
|
|
23690
|
-
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
23691
|
-
throw new MobiusApiConfigurationError();
|
|
23692
|
-
}
|
|
23693
|
-
return value;
|
|
23701
|
+
function encodeRuntimeDeliveryReceived(message) {
|
|
23702
|
+
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
23694
23703
|
}
|
|
23695
|
-
function
|
|
23696
|
-
return
|
|
23697
|
-
}
|
|
23698
|
-
function mobiusApiUrl(origin, resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
23699
|
-
return new URL(mobiusApiPath(resourcePath, apiPrefix), origin);
|
|
23704
|
+
function encodeRuntimeDeliveryCommitted(message) {
|
|
23705
|
+
return JSON.stringify(decodeRuntimeDeliveryCommitted(JSON.stringify(message)));
|
|
23700
23706
|
}
|
|
23701
23707
|
|
|
23702
23708
|
// ../protocol/src/session-history.ts
|
|
@@ -23873,9 +23879,13 @@ function decode4(schema, encoded) {
|
|
|
23873
23879
|
}
|
|
23874
23880
|
}
|
|
23875
23881
|
var decodeNativeSessionCommand = (encoded) => decode4(nativeSessionCommandSchema, encoded);
|
|
23882
|
+
var encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
23883
|
+
var decodeNativeSessionResult = (encoded) => decode4(nativeSessionResultSchema, encoded);
|
|
23876
23884
|
var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
23877
23885
|
var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
23886
|
+
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
23878
23887
|
var decodeNativeSessionTurnForkCommand = (encoded) => decode4(nativeSessionTurnForkCommandSchema, encoded);
|
|
23888
|
+
var encodeNativeSessionTurnForkCommand = (value) => JSON.stringify(nativeSessionTurnForkCommandSchema.parse(value));
|
|
23879
23889
|
|
|
23880
23890
|
// ../protocol/src/session-events.ts
|
|
23881
23891
|
var SESSION_EVENT_KIND = "session.event";
|
|
@@ -23967,8 +23977,285 @@ var encode4 = (message, schema) => {
|
|
|
23967
23977
|
var decodeSessionEventEnvelope = (encoded) => decode5(encoded, eventEnvelopeSchema);
|
|
23968
23978
|
var encodeSessionEventEnvelope = (message) => encode4(message, eventEnvelopeSchema);
|
|
23969
23979
|
var decodeSessionEventAcknowledgement = (encoded) => decode5(encoded, eventAcknowledgementSchema);
|
|
23980
|
+
var encodeSessionEventAcknowledgement = (message) => encode4(message, eventAcknowledgementSchema);
|
|
23970
23981
|
var decodeSessionEventDeferred = (encoded) => decode5(encoded, eventDeferredSchema);
|
|
23982
|
+
var encodeSessionEventDeferred = (message) => encode4(message, eventDeferredSchema);
|
|
23971
23983
|
var decodeSessionEventRejection = (encoded) => decode5(encoded, eventRejectionSchema);
|
|
23984
|
+
var encodeSessionEventRejection = (message) => encode4(message, eventRejectionSchema);
|
|
23985
|
+
function decodeRecordedSessionEvent(encoded) {
|
|
23986
|
+
const kind = decodeMessageKind(encoded);
|
|
23987
|
+
switch (kind) {
|
|
23988
|
+
case AGENT_ACTIVITY_KIND:
|
|
23989
|
+
return decodeAgentActivityEvent(encoded);
|
|
23990
|
+
case AGENT_CONTENT_KIND:
|
|
23991
|
+
return decodeAgentContentEvent(encoded);
|
|
23992
|
+
case AGENT_MESSAGE_DELTA_KIND:
|
|
23993
|
+
return decodeAgentMessageDeltaEvent(encoded);
|
|
23994
|
+
case SESSION_COMMANDS_UPDATED_KIND:
|
|
23995
|
+
return decodeSessionCommandsUpdatedEvent(encoded);
|
|
23996
|
+
case SESSION_COMPLETED_KIND:
|
|
23997
|
+
return decodeSessionCompletedEvent(encoded);
|
|
23998
|
+
case SESSION_CONFIG_UPDATED_KIND:
|
|
23999
|
+
return decodeSessionConfigUpdatedEvent(encoded);
|
|
24000
|
+
case SESSION_ELICITATION_REQUESTED_KIND:
|
|
24001
|
+
return decodeSessionElicitationRequestedEvent(encoded);
|
|
24002
|
+
case SESSION_ELICITATION_RESOLVED_KIND:
|
|
24003
|
+
return decodeSessionElicitationResolvedEvent(encoded);
|
|
24004
|
+
case SESSION_FAILED_KIND:
|
|
24005
|
+
return decodeSessionFailedEvent(encoded);
|
|
24006
|
+
case SESSION_INFO_UPDATED_KIND:
|
|
24007
|
+
return decodeSessionInfoUpdatedEvent(encoded);
|
|
24008
|
+
case SESSION_PERMISSION_REQUESTED_KIND:
|
|
24009
|
+
return decodeSessionPermissionRequestedEvent(encoded);
|
|
24010
|
+
case SESSION_PERMISSION_RESOLVED_KIND:
|
|
24011
|
+
return decodeSessionPermissionResolvedEvent(encoded);
|
|
24012
|
+
case SESSION_READY_KIND:
|
|
24013
|
+
return decodeSessionReadyEvent(encoded);
|
|
24014
|
+
case SESSION_STARTED_KIND:
|
|
24015
|
+
return decodeSessionStartedEvent(encoded);
|
|
24016
|
+
case SESSION_USAGE_UPDATED_KIND:
|
|
24017
|
+
return decodeSessionUsageUpdatedEvent(encoded);
|
|
24018
|
+
default:
|
|
24019
|
+
throw new ProtocolMessageError("Unsupported recorded session event");
|
|
24020
|
+
}
|
|
24021
|
+
}
|
|
24022
|
+
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
24023
|
+
|
|
24024
|
+
// ../protocol/src/daemon-transport.ts
|
|
24025
|
+
function defineMessageSignature(kind, encoder, decoder) {
|
|
24026
|
+
const schema = (message) => decoder(JSON.stringify(message));
|
|
24027
|
+
return {
|
|
24028
|
+
decoder,
|
|
24029
|
+
encoder: (message) => encoder(schema(message)),
|
|
24030
|
+
kind,
|
|
24031
|
+
schema
|
|
24032
|
+
};
|
|
24033
|
+
}
|
|
24034
|
+
var serviceToDaemonSignatures = {
|
|
24035
|
+
[AGENT_CATALOG_REFRESH_KIND]: defineMessageSignature(
|
|
24036
|
+
AGENT_CATALOG_REFRESH_KIND,
|
|
24037
|
+
encodeAgentCatalogRefreshCommand,
|
|
24038
|
+
decodeAgentCatalogRefreshCommand
|
|
24039
|
+
),
|
|
24040
|
+
[AGENT_INSTALL_CANCEL_KIND]: defineMessageSignature(
|
|
24041
|
+
AGENT_INSTALL_CANCEL_KIND,
|
|
24042
|
+
encodeAgentInstallCancelCommand,
|
|
24043
|
+
decodeAgentInstallCancelCommand
|
|
24044
|
+
),
|
|
24045
|
+
[AGENT_INSTALL_REQUEST_KIND]: defineMessageSignature(
|
|
24046
|
+
AGENT_INSTALL_REQUEST_KIND,
|
|
24047
|
+
encodeAgentInstallRequestCommand,
|
|
24048
|
+
decodeAgentInstallRequestCommand
|
|
24049
|
+
),
|
|
24050
|
+
[AGENT_SETTINGS_DISCOVER_KIND]: defineMessageSignature(
|
|
24051
|
+
AGENT_SETTINGS_DISCOVER_KIND,
|
|
24052
|
+
encodeAgentSettingsDiscoverCommand,
|
|
24053
|
+
decodeAgentSettingsDiscoverCommand
|
|
24054
|
+
),
|
|
24055
|
+
[FILE_READ_KIND]: defineMessageSignature(FILE_READ_KIND, encodeFileReadCommand, decodeFileReadCommand),
|
|
24056
|
+
[NATIVE_SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
24057
|
+
NATIVE_SESSION_CANCEL_KIND,
|
|
24058
|
+
encodeNativeSessionCancel,
|
|
24059
|
+
decodeNativeSessionCancel
|
|
24060
|
+
),
|
|
24061
|
+
[NATIVE_SESSION_REQUEST_KIND]: defineMessageSignature(
|
|
24062
|
+
NATIVE_SESSION_REQUEST_KIND,
|
|
24063
|
+
encodeNativeSessionCommand,
|
|
24064
|
+
decodeNativeSessionCommand
|
|
24065
|
+
),
|
|
24066
|
+
[NATIVE_SESSION_TURN_FORK_KIND]: defineMessageSignature(
|
|
24067
|
+
NATIVE_SESSION_TURN_FORK_KIND,
|
|
24068
|
+
encodeNativeSessionTurnForkCommand,
|
|
24069
|
+
decodeNativeSessionTurnForkCommand
|
|
24070
|
+
),
|
|
24071
|
+
[RUNTIME_DELIVERY_KIND]: defineMessageSignature(
|
|
24072
|
+
RUNTIME_DELIVERY_KIND,
|
|
24073
|
+
encodeRuntimeDelivery,
|
|
24074
|
+
decodeRuntimeDelivery
|
|
24075
|
+
),
|
|
24076
|
+
[RUNTIME_DELIVERY_COMMITTED_KIND]: defineMessageSignature(
|
|
24077
|
+
RUNTIME_DELIVERY_COMMITTED_KIND,
|
|
24078
|
+
encodeRuntimeDeliveryCommitted,
|
|
24079
|
+
decodeRuntimeDeliveryCommitted
|
|
24080
|
+
),
|
|
24081
|
+
[RUNTIME_HEARTBEAT_ACK_KIND]: defineMessageSignature(
|
|
24082
|
+
RUNTIME_HEARTBEAT_ACK_KIND,
|
|
24083
|
+
encodeRuntimeHeartbeatAckEvent,
|
|
24084
|
+
decodeRuntimeHeartbeatAckEvent
|
|
24085
|
+
),
|
|
24086
|
+
[RUNTIME_LIVENESS_READY_KIND]: defineMessageSignature(
|
|
24087
|
+
RUNTIME_LIVENESS_READY_KIND,
|
|
24088
|
+
encodeRuntimeLivenessReadyEvent,
|
|
24089
|
+
decodeRuntimeLivenessReadyEvent
|
|
24090
|
+
),
|
|
24091
|
+
[SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
24092
|
+
SESSION_CANCEL_KIND,
|
|
24093
|
+
encodeSessionCancelCommand,
|
|
24094
|
+
decodeSessionCancelCommand
|
|
24095
|
+
),
|
|
24096
|
+
[SESSION_CONFIGURE_KIND]: defineMessageSignature(
|
|
24097
|
+
SESSION_CONFIGURE_KIND,
|
|
24098
|
+
encodeSessionConfigureCommand,
|
|
24099
|
+
decodeSessionConfigureCommand
|
|
24100
|
+
),
|
|
24101
|
+
[SESSION_ELICITATION_RESPOND_KIND]: defineMessageSignature(
|
|
24102
|
+
SESSION_ELICITATION_RESPOND_KIND,
|
|
24103
|
+
encodeSessionElicitationRespondCommand,
|
|
24104
|
+
decodeSessionElicitationRespondCommand
|
|
24105
|
+
),
|
|
24106
|
+
[SESSION_EVENT_ACK_KIND]: defineMessageSignature(
|
|
24107
|
+
SESSION_EVENT_ACK_KIND,
|
|
24108
|
+
encodeSessionEventAcknowledgement,
|
|
24109
|
+
decodeSessionEventAcknowledgement
|
|
24110
|
+
),
|
|
24111
|
+
[SESSION_EVENT_DEFERRED_KIND]: defineMessageSignature(
|
|
24112
|
+
SESSION_EVENT_DEFERRED_KIND,
|
|
24113
|
+
encodeSessionEventDeferred,
|
|
24114
|
+
decodeSessionEventDeferred
|
|
24115
|
+
),
|
|
24116
|
+
[SESSION_EVENT_REJECTED_KIND]: defineMessageSignature(
|
|
24117
|
+
SESSION_EVENT_REJECTED_KIND,
|
|
24118
|
+
encodeSessionEventRejection,
|
|
24119
|
+
decodeSessionEventRejection
|
|
24120
|
+
),
|
|
24121
|
+
[SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
|
|
24122
|
+
SESSION_PERMISSION_RESPOND_KIND,
|
|
24123
|
+
encodeSessionPermissionRespondCommand,
|
|
24124
|
+
decodeSessionPermissionRespondCommand
|
|
24125
|
+
),
|
|
24126
|
+
[SESSION_PREPARE_KIND]: defineMessageSignature(
|
|
24127
|
+
SESSION_PREPARE_KIND,
|
|
24128
|
+
encodeSessionPrepareCommand,
|
|
24129
|
+
decodeSessionPrepareCommand
|
|
24130
|
+
),
|
|
24131
|
+
[SESSION_PROMPT_KIND]: defineMessageSignature(
|
|
24132
|
+
SESSION_PROMPT_KIND,
|
|
24133
|
+
encodeSessionPromptCommand,
|
|
24134
|
+
decodeSessionPromptCommand
|
|
24135
|
+
),
|
|
24136
|
+
[WORKSPACE_LIST_KIND]: defineMessageSignature(
|
|
24137
|
+
WORKSPACE_LIST_KIND,
|
|
24138
|
+
encodeWorkspaceListCommand,
|
|
24139
|
+
decodeWorkspaceListCommand
|
|
24140
|
+
)
|
|
24141
|
+
};
|
|
24142
|
+
var serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
24143
|
+
function decodeServiceToDaemonMessage(encoded) {
|
|
24144
|
+
const kind = decodeMessageKind(encoded);
|
|
24145
|
+
const signature = serviceToDaemonRegistry[kind];
|
|
24146
|
+
if (signature === void 0) {
|
|
24147
|
+
throw new ProtocolMessageError(`Unsupported service-to-daemon message kind: ${kind}`);
|
|
24148
|
+
}
|
|
24149
|
+
return signature.decoder(encoded);
|
|
24150
|
+
}
|
|
24151
|
+
var daemonToServiceSignatures = {
|
|
24152
|
+
[AGENT_CATALOG_REFRESHED_KIND]: defineMessageSignature(
|
|
24153
|
+
AGENT_CATALOG_REFRESHED_KIND,
|
|
24154
|
+
encodeAgentCatalogRefreshedEvent,
|
|
24155
|
+
decodeAgentCatalogRefreshedEvent
|
|
24156
|
+
),
|
|
24157
|
+
[AGENT_CATALOG_REFRESH_FAILED_KIND]: defineMessageSignature(
|
|
24158
|
+
AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
24159
|
+
encodeAgentCatalogRefreshFailedEvent,
|
|
24160
|
+
decodeAgentCatalogRefreshFailedEvent
|
|
24161
|
+
),
|
|
24162
|
+
[AGENT_INSTALL_CANCELLED_KIND]: defineMessageSignature(
|
|
24163
|
+
AGENT_INSTALL_CANCELLED_KIND,
|
|
24164
|
+
encodeAgentInstallCancelledEvent,
|
|
24165
|
+
decodeAgentInstallCancelledEvent
|
|
24166
|
+
),
|
|
24167
|
+
[AGENT_INSTALL_COMPLETED_KIND]: defineMessageSignature(
|
|
24168
|
+
AGENT_INSTALL_COMPLETED_KIND,
|
|
24169
|
+
encodeAgentInstallCompletedEvent,
|
|
24170
|
+
decodeAgentInstallCompletedEvent
|
|
24171
|
+
),
|
|
24172
|
+
[AGENT_INSTALL_FAILED_KIND]: defineMessageSignature(
|
|
24173
|
+
AGENT_INSTALL_FAILED_KIND,
|
|
24174
|
+
encodeAgentInstallFailedEvent,
|
|
24175
|
+
decodeAgentInstallFailedEvent
|
|
24176
|
+
),
|
|
24177
|
+
[AGENT_INSTALL_PROGRESS_KIND]: defineMessageSignature(
|
|
24178
|
+
AGENT_INSTALL_PROGRESS_KIND,
|
|
24179
|
+
encodeAgentInstallProgressEvent,
|
|
24180
|
+
decodeAgentInstallProgressEvent
|
|
24181
|
+
),
|
|
24182
|
+
[AGENT_INSTALL_STARTED_KIND]: defineMessageSignature(
|
|
24183
|
+
AGENT_INSTALL_STARTED_KIND,
|
|
24184
|
+
encodeAgentInstallStartedEvent,
|
|
24185
|
+
decodeAgentInstallStartedEvent
|
|
24186
|
+
),
|
|
24187
|
+
[AGENT_SETTINGS_DISCOVERED_KIND]: defineMessageSignature(
|
|
24188
|
+
AGENT_SETTINGS_DISCOVERED_KIND,
|
|
24189
|
+
encodeAgentSettingsDiscoveredEvent,
|
|
24190
|
+
decodeAgentSettingsDiscoveredEvent
|
|
24191
|
+
),
|
|
24192
|
+
[AGENT_SETTINGS_DISCOVERY_FAILED_KIND]: defineMessageSignature(
|
|
24193
|
+
AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
24194
|
+
encodeAgentSettingsDiscoveryFailedEvent,
|
|
24195
|
+
decodeAgentSettingsDiscoveryFailedEvent
|
|
24196
|
+
),
|
|
24197
|
+
[FILE_BEGIN_KIND]: defineMessageSignature(FILE_BEGIN_KIND, encodeFileBeginEvent, decodeFileBeginEvent),
|
|
24198
|
+
[FILE_CHUNK_KIND]: defineMessageSignature(FILE_CHUNK_KIND, encodeFileChunkEvent, decodeFileChunkEvent),
|
|
24199
|
+
[FILE_END_KIND]: defineMessageSignature(FILE_END_KIND, encodeFileEndEvent, decodeFileEndEvent),
|
|
24200
|
+
[FILE_FAILED_KIND]: defineMessageSignature(FILE_FAILED_KIND, encodeFileFailedEvent, decodeFileFailedEvent),
|
|
24201
|
+
[NATIVE_SESSION_RESULT_KIND]: defineMessageSignature(
|
|
24202
|
+
NATIVE_SESSION_RESULT_KIND,
|
|
24203
|
+
encodeNativeSessionResult,
|
|
24204
|
+
decodeNativeSessionResult
|
|
24205
|
+
),
|
|
24206
|
+
[RUNTIME_DELIVERY_RECEIVED_KIND]: defineMessageSignature(
|
|
24207
|
+
RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
24208
|
+
encodeRuntimeDeliveryReceived,
|
|
24209
|
+
decodeRuntimeDeliveryReceived
|
|
24210
|
+
),
|
|
24211
|
+
[RUNTIME_HEARTBEAT_KIND]: defineMessageSignature(
|
|
24212
|
+
RUNTIME_HEARTBEAT_KIND,
|
|
24213
|
+
encodeRuntimeHeartbeatEvent,
|
|
24214
|
+
decodeRuntimeHeartbeatEvent
|
|
24215
|
+
),
|
|
24216
|
+
[SESSION_EVENT_KIND]: defineMessageSignature(
|
|
24217
|
+
SESSION_EVENT_KIND,
|
|
24218
|
+
encodeSessionEventEnvelope,
|
|
24219
|
+
decodeSessionEventEnvelope
|
|
24220
|
+
),
|
|
24221
|
+
[SESSION_OPERATION_FAILED_KIND]: defineMessageSignature(
|
|
24222
|
+
SESSION_OPERATION_FAILED_KIND,
|
|
24223
|
+
encodeSessionOperationFailedEvent,
|
|
24224
|
+
decodeSessionOperationFailedEvent
|
|
24225
|
+
),
|
|
24226
|
+
[SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
|
|
24227
|
+
[WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
|
|
24228
|
+
WORKSPACE_ENTRIES_KIND,
|
|
24229
|
+
encodeWorkspaceEntriesEvent,
|
|
24230
|
+
decodeWorkspaceEntriesEvent
|
|
24231
|
+
)
|
|
24232
|
+
};
|
|
24233
|
+
function encodeDaemonToServiceMessage(message) {
|
|
24234
|
+
return daemonToServiceSignatures[message.kind].encoder(message);
|
|
24235
|
+
}
|
|
24236
|
+
|
|
24237
|
+
// ../protocol/src/mobius-api.ts
|
|
24238
|
+
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
24239
|
+
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
24240
|
+
var MobiusApiConfigurationError = class extends Error {
|
|
24241
|
+
code = "invalid_api_prefix";
|
|
24242
|
+
constructor() {
|
|
24243
|
+
super("The Mobius API prefix must be an absolute path without parameters");
|
|
24244
|
+
this.name = "MobiusApiConfigurationError";
|
|
24245
|
+
}
|
|
24246
|
+
};
|
|
24247
|
+
function parseMobiusApiPrefix(value) {
|
|
24248
|
+
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
24249
|
+
throw new MobiusApiConfigurationError();
|
|
24250
|
+
}
|
|
24251
|
+
return value;
|
|
24252
|
+
}
|
|
24253
|
+
function mobiusApiPath(resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
24254
|
+
return `${parseMobiusApiPrefix(apiPrefix)}${resourcePath}`;
|
|
24255
|
+
}
|
|
24256
|
+
function mobiusApiUrl(origin, resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
24257
|
+
return new URL(mobiusApiPath(resourcePath, apiPrefix), origin);
|
|
24258
|
+
}
|
|
23972
24259
|
|
|
23973
24260
|
// src/config.ts
|
|
23974
24261
|
function loadDefaultWorkspace(environment = process.env) {
|
|
@@ -36706,11 +36993,42 @@ function relayHttpEndpoint(relayUrl) {
|
|
|
36706
36993
|
var CATALOG_UPDATE_TIMEOUT_MILLISECONDS = 2e4;
|
|
36707
36994
|
var AgentCatalogPublishError = class extends Error {
|
|
36708
36995
|
code = "agent_catalog_update_failed";
|
|
36709
|
-
|
|
36996
|
+
diagnosticDetails;
|
|
36997
|
+
constructor(message, options = {}, diagnosticDetails = {}) {
|
|
36710
36998
|
super(message, options);
|
|
36999
|
+
this.diagnosticDetails = diagnosticDetails;
|
|
36711
37000
|
this.name = "AgentCatalogPublishError";
|
|
36712
37001
|
}
|
|
36713
37002
|
};
|
|
37003
|
+
function isRecord10(value) {
|
|
37004
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37005
|
+
}
|
|
37006
|
+
function isSafeRelayErrorMessage(value) {
|
|
37007
|
+
return value.length > 0 && value.length <= 512 && Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127);
|
|
37008
|
+
}
|
|
37009
|
+
async function rejectedCatalogError(response) {
|
|
37010
|
+
let value;
|
|
37011
|
+
try {
|
|
37012
|
+
value = await response.json();
|
|
37013
|
+
} catch {
|
|
37014
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37015
|
+
}
|
|
37016
|
+
if (!isRecord10(value) || !isRecord10(value["error"])) {
|
|
37017
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37018
|
+
}
|
|
37019
|
+
const code = value["error"]["code"];
|
|
37020
|
+
const message = value["error"]["message"];
|
|
37021
|
+
if (typeof code !== "string" || !/^[a-z][a-z0-9_]{0,63}$/.test(code) || typeof message !== "string" || !isSafeRelayErrorMessage(message)) {
|
|
37022
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37023
|
+
}
|
|
37024
|
+
return new AgentCatalogPublishError(
|
|
37025
|
+
`The Relay rejected the Agent catalog update (${code}): ${message}`,
|
|
37026
|
+
{},
|
|
37027
|
+
{
|
|
37028
|
+
relayErrorCode: code
|
|
37029
|
+
}
|
|
37030
|
+
);
|
|
37031
|
+
}
|
|
36714
37032
|
function catalogEndpoint(config2) {
|
|
36715
37033
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
36716
37034
|
if (endpoint.pathname.endsWith("/daemon")) {
|
|
@@ -36758,10 +37076,10 @@ async function publishAgentCatalog(config2, signal) {
|
|
|
36758
37076
|
{ cause: error62 }
|
|
36759
37077
|
);
|
|
36760
37078
|
}
|
|
36761
|
-
await response.body?.cancel();
|
|
36762
37079
|
if (!response.ok) {
|
|
36763
|
-
throw
|
|
37080
|
+
throw await rejectedCatalogError(response);
|
|
36764
37081
|
}
|
|
37082
|
+
await response.body?.cancel();
|
|
36765
37083
|
}
|
|
36766
37084
|
|
|
36767
37085
|
// src/agent-installation/agent-installation-manager.ts
|
|
@@ -37270,30 +37588,26 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37270
37588
|
throw new Error("The local file is too large to read");
|
|
37271
37589
|
}
|
|
37272
37590
|
const raster = await readLocalRaster(target, signal);
|
|
37273
|
-
send2(
|
|
37274
|
-
|
|
37275
|
-
|
|
37276
|
-
|
|
37277
|
-
|
|
37278
|
-
|
|
37279
|
-
|
|
37280
|
-
|
|
37281
|
-
|
|
37282
|
-
})
|
|
37283
|
-
);
|
|
37591
|
+
send2({
|
|
37592
|
+
byteLength: before.size,
|
|
37593
|
+
kind: FILE_BEGIN_KIND,
|
|
37594
|
+
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
37595
|
+
modifiedAt: before.mtime.toISOString(),
|
|
37596
|
+
name: basename4(target) || "file",
|
|
37597
|
+
requestId: command.requestId,
|
|
37598
|
+
sessionId: command.sessionId
|
|
37599
|
+
});
|
|
37284
37600
|
let sequence = 0;
|
|
37285
37601
|
const stream = createReadStream2(target, { highWaterMark: CHUNK_BYTES, signal });
|
|
37286
37602
|
for await (const value of stream) {
|
|
37287
37603
|
const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
37288
|
-
send2(
|
|
37289
|
-
|
|
37290
|
-
|
|
37291
|
-
|
|
37292
|
-
|
|
37293
|
-
|
|
37294
|
-
|
|
37295
|
-
})
|
|
37296
|
-
);
|
|
37604
|
+
send2({
|
|
37605
|
+
data: Buffer.from(bytes).toString("base64"),
|
|
37606
|
+
kind: FILE_CHUNK_KIND,
|
|
37607
|
+
requestId: command.requestId,
|
|
37608
|
+
sequence,
|
|
37609
|
+
sessionId: command.sessionId
|
|
37610
|
+
});
|
|
37297
37611
|
sequence += 1;
|
|
37298
37612
|
}
|
|
37299
37613
|
const after = await stat7(target);
|
|
@@ -37301,13 +37615,11 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37301
37615
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
37302
37616
|
throw new Error("The local file changed during transfer");
|
|
37303
37617
|
}
|
|
37304
|
-
send2(
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
|
|
37309
|
-
})
|
|
37310
|
-
);
|
|
37618
|
+
send2({
|
|
37619
|
+
kind: FILE_END_KIND,
|
|
37620
|
+
requestId: command.requestId,
|
|
37621
|
+
sessionId: command.sessionId
|
|
37622
|
+
});
|
|
37311
37623
|
}
|
|
37312
37624
|
|
|
37313
37625
|
// src/artifacts/runtime-artifact-uploader.ts
|
|
@@ -37340,11 +37652,11 @@ var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
|
37340
37652
|
function invalidResponse(message) {
|
|
37341
37653
|
return new MobiusProtocolError(message);
|
|
37342
37654
|
}
|
|
37343
|
-
function
|
|
37655
|
+
function isRecord11(value) {
|
|
37344
37656
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37345
37657
|
}
|
|
37346
37658
|
function record2(value, name) {
|
|
37347
|
-
if (!
|
|
37659
|
+
if (!isRecord11(value)) {
|
|
37348
37660
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37349
37661
|
}
|
|
37350
37662
|
return value;
|
|
@@ -38994,6 +39306,25 @@ var RelayConnectionDiagnostics = class {
|
|
|
38994
39306
|
addFailureDetails(details, failure2);
|
|
38995
39307
|
this.#record("relay_connection_failed", connectionEpoch.toString(), details, true);
|
|
38996
39308
|
};
|
|
39309
|
+
/**
|
|
39310
|
+
* Records that the Runtime gave up on Agent turns the Relay already settled. This is not a connection
|
|
39311
|
+
* failure, so it is recorded independently of the per-epoch failure deduplication.
|
|
39312
|
+
*/
|
|
39313
|
+
reconciliationAbandoned = (connectionEpoch, relayErrorCode2, turnCount) => {
|
|
39314
|
+
this.#record(
|
|
39315
|
+
"relay_reconciliation_abandoned",
|
|
39316
|
+
connectionEpoch.toString(),
|
|
39317
|
+
{
|
|
39318
|
+
connectionEpoch: connectionEpoch.toString(),
|
|
39319
|
+
relayErrorCode: relayErrorCode2 ?? "unknown",
|
|
39320
|
+
relayOrigin: this.#relayOrigin,
|
|
39321
|
+
source: "reconciliation_abandoned",
|
|
39322
|
+
turnCount: turnCount.toString(),
|
|
39323
|
+
...this.#route
|
|
39324
|
+
},
|
|
39325
|
+
true
|
|
39326
|
+
);
|
|
39327
|
+
};
|
|
38997
39328
|
connectionOpened = (connectionEpoch) => {
|
|
38998
39329
|
this.#record(
|
|
38999
39330
|
"relay_connection_opened",
|
|
@@ -39133,12 +39464,10 @@ var RelayConnectionLiveness = class {
|
|
|
39133
39464
|
heartbeatId,
|
|
39134
39465
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
39135
39466
|
);
|
|
39136
|
-
const sent = this.#transport.send(
|
|
39137
|
-
|
|
39138
|
-
|
|
39139
|
-
|
|
39140
|
-
})
|
|
39141
|
-
);
|
|
39467
|
+
const sent = this.#transport.send({
|
|
39468
|
+
heartbeatId,
|
|
39469
|
+
kind: RUNTIME_HEARTBEAT_KIND
|
|
39470
|
+
});
|
|
39142
39471
|
if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
|
|
39143
39472
|
this.#state.timeout.cancel();
|
|
39144
39473
|
this.#state = new FinishedRelayLivenessState();
|
|
@@ -39758,39 +40087,39 @@ var DaemonAcpObserver = class {
|
|
|
39758
40087
|
}
|
|
39759
40088
|
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39760
40089
|
onCommands = (event) => {
|
|
39761
|
-
this.#record(event.sessionId,
|
|
40090
|
+
this.#record(event.sessionId, event);
|
|
39762
40091
|
return Promise.resolve();
|
|
39763
40092
|
};
|
|
39764
40093
|
onConfig = (event) => {
|
|
39765
|
-
this.#record(event.sessionId,
|
|
40094
|
+
this.#record(event.sessionId, event);
|
|
39766
40095
|
return Promise.resolve();
|
|
39767
40096
|
};
|
|
39768
40097
|
onContent = (event) => {
|
|
39769
|
-
this.#record(event.sessionId,
|
|
40098
|
+
this.#record(event.sessionId, event);
|
|
39770
40099
|
return Promise.resolve();
|
|
39771
40100
|
};
|
|
39772
40101
|
onElicitation = (event) => {
|
|
39773
|
-
this.#record(event.sessionId,
|
|
40102
|
+
this.#record(event.sessionId, event);
|
|
39774
40103
|
return Promise.resolve();
|
|
39775
40104
|
};
|
|
39776
40105
|
onElicitationResolved = (event) => {
|
|
39777
|
-
this.#record(event.sessionId,
|
|
40106
|
+
this.#record(event.sessionId, event);
|
|
39778
40107
|
return Promise.resolve();
|
|
39779
40108
|
};
|
|
39780
40109
|
onInfo = (event) => {
|
|
39781
|
-
this.#record(event.sessionId,
|
|
40110
|
+
this.#record(event.sessionId, event);
|
|
39782
40111
|
return Promise.resolve();
|
|
39783
40112
|
};
|
|
39784
40113
|
onPermission = (event) => {
|
|
39785
|
-
this.#record(event.sessionId,
|
|
40114
|
+
this.#record(event.sessionId, event);
|
|
39786
40115
|
return Promise.resolve();
|
|
39787
40116
|
};
|
|
39788
40117
|
onPermissionResolved = (event) => {
|
|
39789
|
-
this.#record(event.sessionId,
|
|
40118
|
+
this.#record(event.sessionId, event);
|
|
39790
40119
|
return Promise.resolve();
|
|
39791
40120
|
};
|
|
39792
40121
|
onUsage = (event) => {
|
|
39793
|
-
this.#record(event.sessionId,
|
|
40122
|
+
this.#record(event.sessionId, event);
|
|
39794
40123
|
return Promise.resolve();
|
|
39795
40124
|
};
|
|
39796
40125
|
};
|
|
@@ -39839,60 +40168,45 @@ var DaemonInstallationObserver = class {
|
|
|
39839
40168
|
if (state instanceof RunningInstallation) {
|
|
39840
40169
|
if (!this.#started.has(state.requestId)) {
|
|
39841
40170
|
this.#started.add(state.requestId);
|
|
39842
|
-
this.#send(
|
|
39843
|
-
socket,
|
|
39844
|
-
encodeAgentInstallStartedEvent({
|
|
39845
|
-
agentId: state.agentId,
|
|
39846
|
-
kind: AGENT_INSTALL_STARTED_KIND,
|
|
39847
|
-
requestId: state.requestId
|
|
39848
|
-
})
|
|
39849
|
-
);
|
|
39850
|
-
}
|
|
39851
|
-
this.#send(
|
|
39852
|
-
socket,
|
|
39853
|
-
encodeAgentInstallProgressEvent({
|
|
40171
|
+
this.#send(socket, {
|
|
39854
40172
|
agentId: state.agentId,
|
|
39855
|
-
kind:
|
|
39856
|
-
requestId: state.requestId
|
|
39857
|
-
|
|
39858
|
-
|
|
39859
|
-
|
|
40173
|
+
kind: AGENT_INSTALL_STARTED_KIND,
|
|
40174
|
+
requestId: state.requestId
|
|
40175
|
+
});
|
|
40176
|
+
}
|
|
40177
|
+
this.#send(socket, {
|
|
40178
|
+
agentId: state.agentId,
|
|
40179
|
+
kind: AGENT_INSTALL_PROGRESS_KIND,
|
|
40180
|
+
requestId: state.requestId,
|
|
40181
|
+
stage: state.stage
|
|
40182
|
+
});
|
|
39860
40183
|
return Promise.resolve();
|
|
39861
40184
|
}
|
|
39862
40185
|
if (state instanceof SucceededInstallation) {
|
|
39863
|
-
this.#send(
|
|
39864
|
-
|
|
39865
|
-
|
|
39866
|
-
|
|
39867
|
-
|
|
39868
|
-
|
|
39869
|
-
requestId: state.requestId
|
|
39870
|
-
})
|
|
39871
|
-
);
|
|
40186
|
+
this.#send(socket, {
|
|
40187
|
+
agentId: state.agentId,
|
|
40188
|
+
authenticationMayBeRequired: state.authenticationMayBeRequired,
|
|
40189
|
+
kind: AGENT_INSTALL_COMPLETED_KIND,
|
|
40190
|
+
requestId: state.requestId
|
|
40191
|
+
});
|
|
39872
40192
|
return Promise.resolve();
|
|
39873
40193
|
}
|
|
39874
40194
|
if (state instanceof FailedInstallation) {
|
|
39875
|
-
this.#send(
|
|
39876
|
-
|
|
39877
|
-
|
|
39878
|
-
|
|
39879
|
-
|
|
39880
|
-
|
|
39881
|
-
|
|
39882
|
-
requestId: state.requestId
|
|
39883
|
-
})
|
|
39884
|
-
);
|
|
40195
|
+
this.#send(socket, {
|
|
40196
|
+
agentId: state.agentId,
|
|
40197
|
+
code: state.code,
|
|
40198
|
+
kind: AGENT_INSTALL_FAILED_KIND,
|
|
40199
|
+
message: state.message,
|
|
40200
|
+
requestId: state.requestId
|
|
40201
|
+
});
|
|
39885
40202
|
return Promise.resolve();
|
|
39886
40203
|
}
|
|
39887
40204
|
if (state instanceof CancelledInstallation) {
|
|
39888
|
-
this.#send(
|
|
39889
|
-
|
|
39890
|
-
|
|
39891
|
-
|
|
39892
|
-
|
|
39893
|
-
requestId: state.requestId
|
|
39894
|
-
})
|
|
39895
|
-
);
|
|
40205
|
+
this.#send(socket, {
|
|
40206
|
+
agentId: state.agentId,
|
|
40207
|
+
kind: AGENT_INSTALL_CANCELLED_KIND,
|
|
40208
|
+
requestId: state.requestId
|
|
40209
|
+
});
|
|
39896
40210
|
return Promise.resolve();
|
|
39897
40211
|
}
|
|
39898
40212
|
throw new Error("Unsupported Agent integration installation state");
|
|
@@ -39940,11 +40254,34 @@ var ActiveDaemonTurn = class {
|
|
|
39940
40254
|
};
|
|
39941
40255
|
var ActiveTurnReconciliationError = class extends Error {
|
|
39942
40256
|
code = "active_turn_reconciliation_failed";
|
|
40257
|
+
diagnosticDetails;
|
|
40258
|
+
relayErrorCode;
|
|
40259
|
+
terminal;
|
|
39943
40260
|
constructor(message, options = {}) {
|
|
39944
40261
|
super(message, options);
|
|
39945
40262
|
this.name = "ActiveTurnReconciliationError";
|
|
40263
|
+
this.relayErrorCode = options.relayErrorCode ?? null;
|
|
40264
|
+
this.terminal = options.terminal ?? false;
|
|
40265
|
+
this.diagnosticDetails = this.relayErrorCode === null ? {} : { relayErrorCode: this.relayErrorCode };
|
|
39946
40266
|
}
|
|
39947
40267
|
};
|
|
40268
|
+
var TERMINAL_RECONCILIATION_RELAY_CODES = /* @__PURE__ */ new Set(["session_conflict"]);
|
|
40269
|
+
async function relayErrorCode(response) {
|
|
40270
|
+
try {
|
|
40271
|
+
const body = JSON.parse(await response.text());
|
|
40272
|
+
if (typeof body !== "object" || body === null) {
|
|
40273
|
+
return null;
|
|
40274
|
+
}
|
|
40275
|
+
const error62 = Reflect.get(body, "error");
|
|
40276
|
+
if (typeof error62 !== "object" || error62 === null) {
|
|
40277
|
+
return null;
|
|
40278
|
+
}
|
|
40279
|
+
const code = Reflect.get(error62, "code");
|
|
40280
|
+
return typeof code === "string" && code.length > 0 ? code : null;
|
|
40281
|
+
} catch {
|
|
40282
|
+
return null;
|
|
40283
|
+
}
|
|
40284
|
+
}
|
|
39948
40285
|
function activeTurnReconciliationEndpoint(config2, turn) {
|
|
39949
40286
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
39950
40287
|
let channelPath = "";
|
|
@@ -39982,12 +40319,15 @@ async function reconcileActiveTurn(config2, turn, signal) {
|
|
|
39982
40319
|
{ cause: error62 }
|
|
39983
40320
|
);
|
|
39984
40321
|
}
|
|
39985
|
-
await response.body?.cancel();
|
|
39986
40322
|
if (!response.ok) {
|
|
40323
|
+
const errorCode = await relayErrorCode(response);
|
|
40324
|
+
const terminal = errorCode !== null && TERMINAL_RECONCILIATION_RELAY_CODES.has(errorCode);
|
|
39987
40325
|
throw new ActiveTurnReconciliationError(
|
|
39988
|
-
`The Relay rejected the active Agent turn reconciliation with status ${response.status.toString()}
|
|
40326
|
+
terminal ? `The Relay reported that the active Agent turn can no longer be reconciled (${errorCode})` : `The Relay rejected the active Agent turn reconciliation with status ${response.status.toString()}`,
|
|
40327
|
+
{ relayErrorCode: errorCode, terminal }
|
|
39989
40328
|
);
|
|
39990
40329
|
}
|
|
40330
|
+
await response.body?.cancel();
|
|
39991
40331
|
}
|
|
39992
40332
|
async function reconcileActiveTurns(config2, turns, signal) {
|
|
39993
40333
|
await Promise.all(turns.map(async (turn) => await reconcileActiveTurn(config2, turn, signal)));
|
|
@@ -39996,7 +40336,7 @@ function send(socket, message) {
|
|
|
39996
40336
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
39997
40337
|
throw new Error("Relay connection is not open");
|
|
39998
40338
|
}
|
|
39999
|
-
socket.send(message);
|
|
40339
|
+
socket.send(encodeDaemonToServiceMessage(message));
|
|
40000
40340
|
}
|
|
40001
40341
|
function closeRelaySocket(socket, code, reason) {
|
|
40002
40342
|
try {
|
|
@@ -40030,7 +40370,7 @@ var ConnectedDaemonSessionEventState = class extends DaemonSessionEventConnectio
|
|
|
40030
40370
|
return false;
|
|
40031
40371
|
}
|
|
40032
40372
|
try {
|
|
40033
|
-
this.#socket.send(message);
|
|
40373
|
+
this.#socket.send(encodeDaemonToServiceMessage(message));
|
|
40034
40374
|
return true;
|
|
40035
40375
|
} catch {
|
|
40036
40376
|
return false;
|
|
@@ -40074,17 +40414,17 @@ var DaemonSessionEventPublisher = class {
|
|
|
40074
40414
|
this.#connection = this.#connection.disconnect(socket);
|
|
40075
40415
|
this.#clearInFlight();
|
|
40076
40416
|
};
|
|
40077
|
-
recordAttempt = (sessionId,
|
|
40078
|
-
const
|
|
40079
|
-
if (kind === SESSION_COMPLETED_KIND || kind === SESSION_FAILED_KIND) {
|
|
40080
|
-
this.#outbox.enqueueCritical(sessionId,
|
|
40417
|
+
recordAttempt = (sessionId, event, attemptId) => {
|
|
40418
|
+
const encoded = encodeRecordedSessionEvent(event);
|
|
40419
|
+
if (event.kind === SESSION_COMPLETED_KIND || event.kind === SESSION_FAILED_KIND) {
|
|
40420
|
+
this.#outbox.enqueueCritical(sessionId, encoded, attemptId);
|
|
40081
40421
|
} else {
|
|
40082
|
-
this.#outbox.enqueue(sessionId,
|
|
40422
|
+
this.#outbox.enqueue(sessionId, encoded, attemptId);
|
|
40083
40423
|
}
|
|
40084
40424
|
this.#publishNextBatch();
|
|
40085
40425
|
};
|
|
40086
|
-
recordRuntime = (sessionId,
|
|
40087
|
-
this.#outbox.enqueue(sessionId,
|
|
40426
|
+
recordRuntime = (sessionId, event) => {
|
|
40427
|
+
this.#outbox.enqueue(sessionId, encodeRecordedSessionEvent(event));
|
|
40088
40428
|
this.#publishNextBatch();
|
|
40089
40429
|
};
|
|
40090
40430
|
acknowledge = (acknowledgement) => {
|
|
@@ -40151,7 +40491,7 @@ var DaemonSessionEventPublisher = class {
|
|
|
40151
40491
|
if (this.#inFlightBytes + byteLength > SESSION_EVENT_REPLAY_BYTE_LIMIT) {
|
|
40152
40492
|
continue;
|
|
40153
40493
|
}
|
|
40154
|
-
if (!this.#connection.send(
|
|
40494
|
+
if (!this.#connection.send(envelope2)) {
|
|
40155
40495
|
this.#clearInFlight();
|
|
40156
40496
|
return;
|
|
40157
40497
|
}
|
|
@@ -40245,8 +40585,8 @@ var CoalescingDaemonActivityPublisher = class {
|
|
|
40245
40585
|
}
|
|
40246
40586
|
};
|
|
40247
40587
|
};
|
|
40248
|
-
function
|
|
40249
|
-
return
|
|
40588
|
+
function daemonActivity(command, activity) {
|
|
40589
|
+
return {
|
|
40250
40590
|
activityId: activity.activityId,
|
|
40251
40591
|
activityType: activity.activityType,
|
|
40252
40592
|
commandId: command.commandId,
|
|
@@ -40262,18 +40602,18 @@ function encodeDaemonActivity(command, activity) {
|
|
|
40262
40602
|
status: activity.status,
|
|
40263
40603
|
title: activity.title,
|
|
40264
40604
|
toolKind: activity.toolKind
|
|
40265
|
-
}
|
|
40605
|
+
};
|
|
40266
40606
|
}
|
|
40267
40607
|
function reportFailure(publisher, command, code, message, attemptId) {
|
|
40268
40608
|
publisher.recordAttempt(
|
|
40269
40609
|
command.sessionId,
|
|
40270
|
-
|
|
40610
|
+
{
|
|
40271
40611
|
code,
|
|
40272
40612
|
commandId: command.commandId,
|
|
40273
40613
|
kind: SESSION_FAILED_KIND,
|
|
40274
40614
|
message,
|
|
40275
40615
|
sessionId: command.sessionId
|
|
40276
|
-
}
|
|
40616
|
+
},
|
|
40277
40617
|
attemptId
|
|
40278
40618
|
);
|
|
40279
40619
|
}
|
|
@@ -40293,17 +40633,14 @@ function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTi
|
|
|
40293
40633
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40294
40634
|
return;
|
|
40295
40635
|
}
|
|
40296
|
-
send(
|
|
40297
|
-
|
|
40298
|
-
|
|
40299
|
-
|
|
40300
|
-
|
|
40301
|
-
|
|
40302
|
-
|
|
40303
|
-
|
|
40304
|
-
sessionId
|
|
40305
|
-
})
|
|
40306
|
-
);
|
|
40636
|
+
send(socket, {
|
|
40637
|
+
code: operationErrorCode(error62),
|
|
40638
|
+
kind: "session.operation.failed",
|
|
40639
|
+
message: operationErrorMessage(error62),
|
|
40640
|
+
requestId,
|
|
40641
|
+
...runtimeTimings.length === 0 ? {} : { runtimeTimings },
|
|
40642
|
+
sessionId
|
|
40643
|
+
});
|
|
40307
40644
|
}
|
|
40308
40645
|
async function resolveSessionDirectories(directories, bindingId, directoryId2, additionalDirectoryIds, signal) {
|
|
40309
40646
|
const cwd = await directories.resolve(bindingId, directoryId2, signal);
|
|
@@ -40495,18 +40832,15 @@ async function executeWorkspaceList(socket, command, directories, audit, signal)
|
|
|
40495
40832
|
event: "workspace_list_authorized",
|
|
40496
40833
|
sessionId: "workspace-browser"
|
|
40497
40834
|
});
|
|
40498
|
-
send(
|
|
40499
|
-
|
|
40500
|
-
|
|
40501
|
-
|
|
40502
|
-
|
|
40503
|
-
|
|
40504
|
-
|
|
40505
|
-
|
|
40506
|
-
|
|
40507
|
-
requestId: command.requestId
|
|
40508
|
-
})
|
|
40509
|
-
);
|
|
40835
|
+
send(socket, {
|
|
40836
|
+
bindingId: command.bindingId,
|
|
40837
|
+
directoryId: listing.directoryId,
|
|
40838
|
+
directoryLabel: listing.directoryLabel,
|
|
40839
|
+
entries: listing.entries,
|
|
40840
|
+
kind: "workspace.entries",
|
|
40841
|
+
parentDirectoryId: listing.parentDirectoryId,
|
|
40842
|
+
requestId: command.requestId
|
|
40843
|
+
});
|
|
40510
40844
|
} catch (error62) {
|
|
40511
40845
|
reportOperationFailure(socket, command.requestId, "", error62);
|
|
40512
40846
|
}
|
|
@@ -40561,15 +40895,12 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40561
40895
|
event: "session_configured",
|
|
40562
40896
|
sessionId: command.sessionId
|
|
40563
40897
|
});
|
|
40564
|
-
publisher.recordRuntime(
|
|
40565
|
-
|
|
40566
|
-
|
|
40567
|
-
|
|
40568
|
-
|
|
40569
|
-
|
|
40570
|
-
sessionId: command.sessionId
|
|
40571
|
-
})
|
|
40572
|
-
);
|
|
40898
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40899
|
+
configOptions,
|
|
40900
|
+
kind: "session.config.updated",
|
|
40901
|
+
requestId: command.requestId,
|
|
40902
|
+
sessionId: command.sessionId
|
|
40903
|
+
});
|
|
40573
40904
|
}
|
|
40574
40905
|
const event = {
|
|
40575
40906
|
additionalDirectories: resolved.additionalDirectoryEntries,
|
|
@@ -40588,17 +40919,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40588
40919
|
runtimeTimings: metrics.snapshot()
|
|
40589
40920
|
};
|
|
40590
40921
|
metrics.measureSync("readiness-commit", () => {
|
|
40591
|
-
publisher.recordRuntime(command.sessionId,
|
|
40922
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40592
40923
|
});
|
|
40593
40924
|
return event;
|
|
40594
40925
|
});
|
|
40595
|
-
send(
|
|
40596
|
-
|
|
40597
|
-
|
|
40598
|
-
|
|
40599
|
-
runtimeTimings: metrics.snapshot()
|
|
40600
|
-
})
|
|
40601
|
-
);
|
|
40926
|
+
send(socket, {
|
|
40927
|
+
...readyEvent,
|
|
40928
|
+
runtimeTimings: metrics.snapshot()
|
|
40929
|
+
});
|
|
40602
40930
|
} catch (error62) {
|
|
40603
40931
|
audit.record({
|
|
40604
40932
|
commandId: command.requestId,
|
|
@@ -40638,15 +40966,12 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40638
40966
|
event: "session_configured",
|
|
40639
40967
|
sessionId: command.sessionId
|
|
40640
40968
|
});
|
|
40641
|
-
publisher.recordRuntime(
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
40647
|
-
sessionId: command.sessionId
|
|
40648
|
-
})
|
|
40649
|
-
);
|
|
40969
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40970
|
+
configOptions,
|
|
40971
|
+
kind: "session.config.updated",
|
|
40972
|
+
requestId: command.requestId,
|
|
40973
|
+
sessionId: command.sessionId
|
|
40974
|
+
});
|
|
40650
40975
|
} catch (error62) {
|
|
40651
40976
|
if (signal.aborted) {
|
|
40652
40977
|
signal.throwIfAborted();
|
|
@@ -40656,20 +40981,20 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40656
40981
|
}
|
|
40657
40982
|
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
40658
40983
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity) => {
|
|
40659
|
-
publisher.recordAttempt(command.sessionId,
|
|
40984
|
+
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity), attemptId);
|
|
40660
40985
|
});
|
|
40661
40986
|
const text3 = new CoalescingTextPublisher(
|
|
40662
40987
|
timer,
|
|
40663
40988
|
(messageId, delta) => {
|
|
40664
40989
|
publisher.recordAttempt(
|
|
40665
40990
|
command.sessionId,
|
|
40666
|
-
|
|
40991
|
+
{
|
|
40667
40992
|
commandId: command.commandId,
|
|
40668
40993
|
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40669
40994
|
messageId,
|
|
40670
40995
|
sessionId: command.sessionId,
|
|
40671
40996
|
text: delta
|
|
40672
|
-
}
|
|
40997
|
+
},
|
|
40673
40998
|
attemptId
|
|
40674
40999
|
);
|
|
40675
41000
|
},
|
|
@@ -40728,12 +41053,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40728
41053
|
outbox.transitionExecution(command.commandId, "running");
|
|
40729
41054
|
publisher.recordAttempt(
|
|
40730
41055
|
command.sessionId,
|
|
40731
|
-
|
|
41056
|
+
{
|
|
40732
41057
|
commandId: command.commandId,
|
|
40733
41058
|
kind: SESSION_STARTED_KIND,
|
|
40734
41059
|
attemptId,
|
|
40735
41060
|
sessionId: command.sessionId
|
|
40736
|
-
}
|
|
41061
|
+
},
|
|
40737
41062
|
attemptId
|
|
40738
41063
|
);
|
|
40739
41064
|
activateAttempt();
|
|
@@ -40778,12 +41103,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40778
41103
|
activities.flush();
|
|
40779
41104
|
publisher.recordAttempt(
|
|
40780
41105
|
command.sessionId,
|
|
40781
|
-
|
|
41106
|
+
{
|
|
40782
41107
|
commandId: command.commandId,
|
|
40783
41108
|
kind: SESSION_COMPLETED_KIND,
|
|
40784
41109
|
sessionId: command.sessionId,
|
|
40785
41110
|
stopReason
|
|
40786
|
-
}
|
|
41111
|
+
},
|
|
40787
41112
|
attemptId
|
|
40788
41113
|
);
|
|
40789
41114
|
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
@@ -41207,9 +41532,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41207
41532
|
}
|
|
41208
41533
|
};
|
|
41209
41534
|
const processDeliveredPayload = async (delivery) => {
|
|
41210
|
-
const
|
|
41535
|
+
const message = decodeServiceToDaemonMessage(delivery.payload);
|
|
41536
|
+
const kind = message.kind;
|
|
41211
41537
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41212
|
-
const cancellation =
|
|
41538
|
+
const cancellation = message;
|
|
41213
41539
|
if (cancellation.sessionId !== delivery.sessionId) {
|
|
41214
41540
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41215
41541
|
}
|
|
@@ -41226,7 +41552,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41226
41552
|
return;
|
|
41227
41553
|
}
|
|
41228
41554
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41229
|
-
const command =
|
|
41555
|
+
const command = message;
|
|
41230
41556
|
if (command.sessionId !== delivery.sessionId) {
|
|
41231
41557
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41232
41558
|
}
|
|
@@ -41243,7 +41569,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41243
41569
|
return;
|
|
41244
41570
|
}
|
|
41245
41571
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41246
|
-
const command =
|
|
41572
|
+
const command = message;
|
|
41247
41573
|
if (command.sessionId !== delivery.sessionId) {
|
|
41248
41574
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41249
41575
|
}
|
|
@@ -41260,7 +41586,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41260
41586
|
return;
|
|
41261
41587
|
}
|
|
41262
41588
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41263
|
-
const command =
|
|
41589
|
+
const command = message;
|
|
41264
41590
|
if (command.sessionId !== delivery.sessionId) {
|
|
41265
41591
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41266
41592
|
}
|
|
@@ -41277,7 +41603,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41277
41603
|
return;
|
|
41278
41604
|
}
|
|
41279
41605
|
if (kind === SESSION_PROMPT_KIND) {
|
|
41280
|
-
const command =
|
|
41606
|
+
const command = message;
|
|
41281
41607
|
await processDeliveredPrompt(
|
|
41282
41608
|
delivery,
|
|
41283
41609
|
command,
|
|
@@ -41321,18 +41647,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41321
41647
|
}).finally(() => processingDeliveryIds.delete(delivery.deliveryId));
|
|
41322
41648
|
};
|
|
41323
41649
|
const receiveRuntimeDelivery = (delivery) => {
|
|
41324
|
-
const
|
|
41650
|
+
const payload = decodeServiceToDaemonMessage(delivery.payload);
|
|
41651
|
+
const payloadKind = payload.kind;
|
|
41325
41652
|
let payloadSessionId = "";
|
|
41326
41653
|
if (payloadKind === SESSION_CANCEL_KIND) {
|
|
41327
|
-
payloadSessionId =
|
|
41654
|
+
payloadSessionId = payload.sessionId;
|
|
41328
41655
|
} else if (payloadKind === SESSION_CONFIGURE_KIND) {
|
|
41329
|
-
payloadSessionId =
|
|
41656
|
+
payloadSessionId = payload.sessionId;
|
|
41330
41657
|
} else if (payloadKind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41331
|
-
payloadSessionId =
|
|
41658
|
+
payloadSessionId = payload.sessionId;
|
|
41332
41659
|
} else if (payloadKind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41333
|
-
payloadSessionId =
|
|
41660
|
+
payloadSessionId = payload.sessionId;
|
|
41334
41661
|
} else if (payloadKind === SESSION_PROMPT_KIND) {
|
|
41335
|
-
payloadSessionId =
|
|
41662
|
+
payloadSessionId = payload.sessionId;
|
|
41336
41663
|
} else {
|
|
41337
41664
|
throw new Error("Runtime delivery contains an unsupported protocol message");
|
|
41338
41665
|
}
|
|
@@ -41340,14 +41667,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41340
41667
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41341
41668
|
}
|
|
41342
41669
|
const stored = outbox.claimRuntimeDelivery(delivery);
|
|
41343
|
-
send(
|
|
41344
|
-
|
|
41345
|
-
|
|
41346
|
-
|
|
41347
|
-
|
|
41348
|
-
sessionId: delivery.sessionId
|
|
41349
|
-
})
|
|
41350
|
-
);
|
|
41670
|
+
send(socket, {
|
|
41671
|
+
deliveryId: delivery.deliveryId,
|
|
41672
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41673
|
+
sessionId: delivery.sessionId
|
|
41674
|
+
});
|
|
41351
41675
|
processRuntimeDelivery(delivery, stored.state);
|
|
41352
41676
|
};
|
|
41353
41677
|
const resumeRuntimeDeliveries = () => {
|
|
@@ -41359,14 +41683,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41359
41683
|
sessionId: stored.sessionId
|
|
41360
41684
|
};
|
|
41361
41685
|
if (stored.state !== "relay_committed") {
|
|
41362
|
-
send(
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
|
|
41366
|
-
|
|
41367
|
-
sessionId: stored.sessionId
|
|
41368
|
-
})
|
|
41369
|
-
);
|
|
41686
|
+
send(socket, {
|
|
41687
|
+
deliveryId: stored.deliveryId,
|
|
41688
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41689
|
+
sessionId: stored.sessionId
|
|
41690
|
+
});
|
|
41370
41691
|
}
|
|
41371
41692
|
processRuntimeDelivery(delivery, stored.state);
|
|
41372
41693
|
}
|
|
@@ -41425,28 +41746,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41425
41746
|
return;
|
|
41426
41747
|
}
|
|
41427
41748
|
try {
|
|
41428
|
-
const
|
|
41749
|
+
const message = decodeServiceToDaemonMessage(encoded);
|
|
41750
|
+
const kind = message.kind;
|
|
41429
41751
|
if (kind === RUNTIME_DELIVERY_COMMITTED_KIND) {
|
|
41430
|
-
const committed =
|
|
41752
|
+
const committed = message;
|
|
41431
41753
|
if (!outbox.markRuntimeDeliveryCommitted(committed.deliveryId, committed.sessionId)) {
|
|
41432
41754
|
console.warn("Mobius daemon ignored confirmation for an unknown Runtime delivery");
|
|
41433
41755
|
}
|
|
41434
41756
|
return;
|
|
41435
41757
|
}
|
|
41436
41758
|
if (kind === RUNTIME_DELIVERY_KIND) {
|
|
41437
|
-
receiveRuntimeDelivery(
|
|
41759
|
+
receiveRuntimeDelivery(message);
|
|
41438
41760
|
return;
|
|
41439
41761
|
}
|
|
41440
41762
|
if (kind === SESSION_EVENT_ACK_KIND) {
|
|
41441
|
-
publisher.acknowledge(
|
|
41763
|
+
publisher.acknowledge(message);
|
|
41442
41764
|
return;
|
|
41443
41765
|
}
|
|
41444
41766
|
if (kind === SESSION_EVENT_DEFERRED_KIND) {
|
|
41445
|
-
publisher.defer(
|
|
41767
|
+
publisher.defer(message);
|
|
41446
41768
|
return;
|
|
41447
41769
|
}
|
|
41448
41770
|
if (kind === SESSION_EVENT_REJECTED_KIND) {
|
|
41449
|
-
const rejection =
|
|
41771
|
+
const rejection = message;
|
|
41450
41772
|
if (publisher.quarantine(rejection)) {
|
|
41451
41773
|
audit.record({
|
|
41452
41774
|
commandId: rejection.eventId,
|
|
@@ -41460,7 +41782,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41460
41782
|
return;
|
|
41461
41783
|
}
|
|
41462
41784
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
41463
|
-
const command2 =
|
|
41785
|
+
const command2 = message;
|
|
41464
41786
|
const pending = nativeRequests.get(command2.requestId);
|
|
41465
41787
|
if (pending?.sessionId === command2.sessionId) {
|
|
41466
41788
|
pending.controller.abort(
|
|
@@ -41474,35 +41796,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41474
41796
|
return;
|
|
41475
41797
|
}
|
|
41476
41798
|
if (kind === AGENT_SETTINGS_DISCOVER_KIND) {
|
|
41477
|
-
const command2 =
|
|
41799
|
+
const command2 = message;
|
|
41478
41800
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
41479
41801
|
(request) => request.agentId === command2.agentId && !request.controller.signal.aborted
|
|
41480
41802
|
);
|
|
41481
41803
|
if (agentSettingsDiscoveries.has(command2.requestId) || existing !== void 0) {
|
|
41482
41804
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41483
|
-
send(
|
|
41484
|
-
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
|
|
41488
|
-
|
|
41489
|
-
requestId: command2.requestId
|
|
41490
|
-
})
|
|
41491
|
-
);
|
|
41805
|
+
send(socket, {
|
|
41806
|
+
code: "agent_settings_discovery_busy",
|
|
41807
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41808
|
+
message: "Another settings discovery is already running for this Agent",
|
|
41809
|
+
requestId: command2.requestId
|
|
41810
|
+
});
|
|
41492
41811
|
}
|
|
41493
41812
|
return;
|
|
41494
41813
|
}
|
|
41495
41814
|
if (agentSettingsDiscoveries.size >= 4) {
|
|
41496
41815
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41497
|
-
send(
|
|
41498
|
-
|
|
41499
|
-
|
|
41500
|
-
|
|
41501
|
-
|
|
41502
|
-
|
|
41503
|
-
requestId: command2.requestId
|
|
41504
|
-
})
|
|
41505
|
-
);
|
|
41816
|
+
send(socket, {
|
|
41817
|
+
code: "agent_settings_discovery_busy",
|
|
41818
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41819
|
+
message: "Too many Agent settings discoveries are running",
|
|
41820
|
+
requestId: command2.requestId
|
|
41821
|
+
});
|
|
41506
41822
|
}
|
|
41507
41823
|
return;
|
|
41508
41824
|
}
|
|
@@ -41534,7 +41850,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41534
41850
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41535
41851
|
});
|
|
41536
41852
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41537
|
-
send(socket,
|
|
41853
|
+
send(socket, result);
|
|
41538
41854
|
}
|
|
41539
41855
|
} catch (error62) {
|
|
41540
41856
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41549,15 +41865,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41549
41865
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41550
41866
|
});
|
|
41551
41867
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41552
|
-
send(
|
|
41553
|
-
|
|
41554
|
-
|
|
41555
|
-
|
|
41556
|
-
|
|
41557
|
-
|
|
41558
|
-
requestId: command2.requestId
|
|
41559
|
-
})
|
|
41560
|
-
);
|
|
41868
|
+
send(socket, {
|
|
41869
|
+
code: operationErrorCode(failure2),
|
|
41870
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41871
|
+
message: operationErrorMessage(failure2),
|
|
41872
|
+
requestId: command2.requestId
|
|
41873
|
+
});
|
|
41561
41874
|
}
|
|
41562
41875
|
} finally {
|
|
41563
41876
|
timeout.cancel();
|
|
@@ -41572,18 +41885,15 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41572
41885
|
return;
|
|
41573
41886
|
}
|
|
41574
41887
|
if (kind === AGENT_CATALOG_REFRESH_KIND) {
|
|
41575
|
-
const command2 =
|
|
41888
|
+
const command2 = message;
|
|
41576
41889
|
if (agentCatalogRefreshes.has(command2.requestId) || agentCatalogRefreshes.size > 0) {
|
|
41577
41890
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41578
|
-
send(
|
|
41579
|
-
|
|
41580
|
-
|
|
41581
|
-
|
|
41582
|
-
|
|
41583
|
-
|
|
41584
|
-
requestId: command2.requestId
|
|
41585
|
-
})
|
|
41586
|
-
);
|
|
41891
|
+
send(socket, {
|
|
41892
|
+
code: "agent_catalog_refresh_busy",
|
|
41893
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41894
|
+
message: "Another local Agent catalog refresh is already running",
|
|
41895
|
+
requestId: command2.requestId
|
|
41896
|
+
});
|
|
41587
41897
|
}
|
|
41588
41898
|
return;
|
|
41589
41899
|
}
|
|
@@ -41608,13 +41918,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41608
41918
|
sessionId: "agent-catalog"
|
|
41609
41919
|
});
|
|
41610
41920
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41611
|
-
send(
|
|
41612
|
-
|
|
41613
|
-
|
|
41614
|
-
|
|
41615
|
-
requestId: command2.requestId
|
|
41616
|
-
})
|
|
41617
|
-
);
|
|
41921
|
+
send(socket, {
|
|
41922
|
+
kind: AGENT_CATALOG_REFRESHED_KIND,
|
|
41923
|
+
requestId: command2.requestId
|
|
41924
|
+
});
|
|
41618
41925
|
}
|
|
41619
41926
|
} catch (error62) {
|
|
41620
41927
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41629,15 +41936,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41629
41936
|
sessionId: "agent-catalog"
|
|
41630
41937
|
});
|
|
41631
41938
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41632
|
-
send(
|
|
41633
|
-
|
|
41634
|
-
|
|
41635
|
-
|
|
41636
|
-
|
|
41637
|
-
|
|
41638
|
-
requestId: command2.requestId
|
|
41639
|
-
})
|
|
41640
|
-
);
|
|
41939
|
+
send(socket, {
|
|
41940
|
+
code: operationErrorCode(failure2),
|
|
41941
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41942
|
+
message: operationErrorMessage(failure2),
|
|
41943
|
+
requestId: command2.requestId
|
|
41944
|
+
});
|
|
41641
41945
|
}
|
|
41642
41946
|
} finally {
|
|
41643
41947
|
timeout.cancel();
|
|
@@ -41648,7 +41952,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41648
41952
|
return;
|
|
41649
41953
|
}
|
|
41650
41954
|
if (kind === NATIVE_SESSION_REQUEST_KIND) {
|
|
41651
|
-
const command2 =
|
|
41955
|
+
const command2 = message;
|
|
41652
41956
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41653
41957
|
(request) => request.agentId === command2.agentId
|
|
41654
41958
|
);
|
|
@@ -41701,7 +42005,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41701
42005
|
operationSignal.throwIfAborted();
|
|
41702
42006
|
const result = await nativeSessions.execute(command2, operationSignal);
|
|
41703
42007
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41704
|
-
send(socket,
|
|
42008
|
+
send(socket, result);
|
|
41705
42009
|
}
|
|
41706
42010
|
} catch (error62) {
|
|
41707
42011
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41730,7 +42034,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41730
42034
|
return;
|
|
41731
42035
|
}
|
|
41732
42036
|
if (kind === NATIVE_SESSION_TURN_FORK_KIND) {
|
|
41733
|
-
const command2 =
|
|
42037
|
+
const command2 = message;
|
|
41734
42038
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41735
42039
|
(request) => request.agentId === command2.agentId
|
|
41736
42040
|
);
|
|
@@ -41781,7 +42085,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41781
42085
|
operationSignal.throwIfAborted();
|
|
41782
42086
|
const result = await nativeSessions.executeTurnFork(command2, operationSignal);
|
|
41783
42087
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41784
|
-
send(socket,
|
|
42088
|
+
send(socket, result);
|
|
41785
42089
|
}
|
|
41786
42090
|
} catch (error62) {
|
|
41787
42091
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41810,39 +42114,35 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41810
42114
|
return;
|
|
41811
42115
|
}
|
|
41812
42116
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
41813
|
-
decodeRuntimeLivenessReadyEvent(encoded);
|
|
41814
42117
|
connectionLiveness.start();
|
|
41815
42118
|
return;
|
|
41816
42119
|
}
|
|
41817
42120
|
if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
|
|
41818
|
-
connectionLiveness.acknowledge(
|
|
42121
|
+
connectionLiveness.acknowledge(message);
|
|
41819
42122
|
return;
|
|
41820
42123
|
}
|
|
41821
42124
|
if (kind === FILE_READ_KIND) {
|
|
41822
|
-
const command2 =
|
|
42125
|
+
const command2 = message;
|
|
41823
42126
|
void streamLocalFile(
|
|
41824
42127
|
command2,
|
|
41825
|
-
(
|
|
42128
|
+
(message2) => send(socket, message2),
|
|
41826
42129
|
connectionController.signal
|
|
41827
42130
|
).catch((error62) => {
|
|
41828
42131
|
if (socket.readyState !== WebSocket2.OPEN || connectionController.signal.aborted) {
|
|
41829
42132
|
return;
|
|
41830
42133
|
}
|
|
41831
|
-
send(
|
|
41832
|
-
|
|
41833
|
-
|
|
41834
|
-
|
|
41835
|
-
|
|
41836
|
-
|
|
41837
|
-
|
|
41838
|
-
sessionId: command2.sessionId
|
|
41839
|
-
})
|
|
41840
|
-
);
|
|
42134
|
+
send(socket, {
|
|
42135
|
+
code: "file_unavailable",
|
|
42136
|
+
kind: FILE_FAILED_KIND,
|
|
42137
|
+
message: error62 instanceof Error ? error62.message : "The local file is unavailable",
|
|
42138
|
+
requestId: command2.requestId,
|
|
42139
|
+
sessionId: command2.sessionId
|
|
42140
|
+
});
|
|
41841
42141
|
});
|
|
41842
42142
|
return;
|
|
41843
42143
|
}
|
|
41844
42144
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41845
|
-
const cancellation =
|
|
42145
|
+
const cancellation = message;
|
|
41846
42146
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
41847
42147
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
41848
42148
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -41862,12 +42162,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41862
42162
|
return;
|
|
41863
42163
|
}
|
|
41864
42164
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
41865
|
-
const command2 =
|
|
42165
|
+
const command2 = message;
|
|
41866
42166
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
41867
42167
|
return;
|
|
41868
42168
|
}
|
|
41869
42169
|
if (kind === SESSION_PREPARE_KIND) {
|
|
41870
|
-
const command2 =
|
|
42170
|
+
const command2 = message;
|
|
41871
42171
|
void executeSessionPrepare(
|
|
41872
42172
|
publisher,
|
|
41873
42173
|
socket,
|
|
@@ -41881,7 +42181,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41881
42181
|
return;
|
|
41882
42182
|
}
|
|
41883
42183
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41884
|
-
const command2 =
|
|
42184
|
+
const command2 = message;
|
|
41885
42185
|
void executeSessionConfigure(
|
|
41886
42186
|
publisher,
|
|
41887
42187
|
socket,
|
|
@@ -41895,7 +42195,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41895
42195
|
return;
|
|
41896
42196
|
}
|
|
41897
42197
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41898
|
-
const command2 =
|
|
42198
|
+
const command2 = message;
|
|
41899
42199
|
void sessions.respondPermission(command2).then(() => {
|
|
41900
42200
|
audit.record({
|
|
41901
42201
|
commandId: command2.interactionId,
|
|
@@ -41908,7 +42208,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41908
42208
|
return;
|
|
41909
42209
|
}
|
|
41910
42210
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41911
|
-
const command2 =
|
|
42211
|
+
const command2 = message;
|
|
41912
42212
|
void sessions.respondElicitation(command2).then(() => {
|
|
41913
42213
|
audit.record({
|
|
41914
42214
|
commandId: command2.interactionId,
|
|
@@ -41921,14 +42221,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41921
42221
|
return;
|
|
41922
42222
|
}
|
|
41923
42223
|
if (kind === AGENT_INSTALL_REQUEST_KIND) {
|
|
41924
|
-
const command2 =
|
|
42224
|
+
const command2 = message;
|
|
41925
42225
|
void installations.request(command2, signal).catch((error62) => {
|
|
41926
42226
|
console.error("Mobius Agent integration installation failed", error62);
|
|
41927
42227
|
});
|
|
41928
42228
|
return;
|
|
41929
42229
|
}
|
|
41930
42230
|
if (kind === AGENT_INSTALL_CANCEL_KIND) {
|
|
41931
|
-
const command2 =
|
|
42231
|
+
const command2 = message;
|
|
41932
42232
|
void installations.cancel(command2.requestId).catch((error62) => {
|
|
41933
42233
|
reportOperationFailure(socket, command2.requestId, "", error62);
|
|
41934
42234
|
});
|
|
@@ -41937,7 +42237,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41937
42237
|
if (kind !== SESSION_PROMPT_KIND) {
|
|
41938
42238
|
throw new Error("Unsupported protocol message");
|
|
41939
42239
|
}
|
|
41940
|
-
const command =
|
|
42240
|
+
const command = message;
|
|
41941
42241
|
if (activeTurns.has(command.commandId)) {
|
|
41942
42242
|
return;
|
|
41943
42243
|
}
|
|
@@ -42002,6 +42302,24 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
42002
42302
|
return;
|
|
42003
42303
|
}
|
|
42004
42304
|
console.error("Mobius daemon could not reconcile active Agent turns", error62);
|
|
42305
|
+
if (error62 instanceof ActiveTurnReconciliationError && error62.terminal) {
|
|
42306
|
+
diagnostics.reconciliationAbandoned(
|
|
42307
|
+
connectionEpoch,
|
|
42308
|
+
error62.relayErrorCode,
|
|
42309
|
+
reconnectingTurns.length
|
|
42310
|
+
);
|
|
42311
|
+
console.error(
|
|
42312
|
+
"Mobius daemon abandoned Agent turns the Relay already settled",
|
|
42313
|
+
error62.relayErrorCode
|
|
42314
|
+
);
|
|
42315
|
+
for (const turn of reconnectingTurns) {
|
|
42316
|
+
activeTurns.delete(turn.command.commandId);
|
|
42317
|
+
turn.abortDaemon();
|
|
42318
|
+
}
|
|
42319
|
+
publisher.connect(socket);
|
|
42320
|
+
resumeRuntimeDeliveries();
|
|
42321
|
+
return;
|
|
42322
|
+
}
|
|
42005
42323
|
failAndClose(
|
|
42006
42324
|
new Error("Active Agent turn reconciliation failed", { cause: error62 }),
|
|
42007
42325
|
ACTIVE_TURN_RECONCILIATION_CLOSE_CODE,
|
|
@@ -42040,13 +42358,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42040
42358
|
const publisher = new DaemonSessionEventPublisher(outbox, timer);
|
|
42041
42359
|
const activeTurns = /* @__PURE__ */ new Map();
|
|
42042
42360
|
const activeAttemptIds = /* @__PURE__ */ new Map();
|
|
42043
|
-
const recordSessionEvent = (sessionId,
|
|
42361
|
+
const recordSessionEvent = (sessionId, event) => {
|
|
42044
42362
|
const attemptId = activeAttemptIds.get(sessionId);
|
|
42045
42363
|
if (attemptId === void 0) {
|
|
42046
|
-
publisher.recordRuntime(sessionId,
|
|
42364
|
+
publisher.recordRuntime(sessionId, event);
|
|
42047
42365
|
return;
|
|
42048
42366
|
}
|
|
42049
|
-
publisher.recordAttempt(sessionId,
|
|
42367
|
+
publisher.recordAttempt(sessionId, event, attemptId);
|
|
42050
42368
|
};
|
|
42051
42369
|
const sessions = new AcpSessionManager(new DaemonAcpObserver(config2, recordSessionEvent), sessionStore);
|
|
42052
42370
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|