@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/index.js
CHANGED
|
@@ -20338,39 +20338,65 @@ var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.
|
|
|
20338
20338
|
var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
|
|
20339
20339
|
var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
|
|
20340
20340
|
var decodeAgentSettingsDiscoverCommand = (encoded) => decode3(encoded, agentSettingsDiscoverCommandSchema);
|
|
20341
|
+
var encodeAgentSettingsDiscoverCommand = (message) => encode3(message, agentSettingsDiscoverCommandSchema);
|
|
20342
|
+
var decodeAgentSettingsDiscoveredEvent = (encoded) => decode3(encoded, agentSettingsDiscoveredEventSchema);
|
|
20341
20343
|
var encodeAgentSettingsDiscoveredEvent = (message) => encode3(message, agentSettingsDiscoveredEventSchema);
|
|
20344
|
+
var decodeAgentSettingsDiscoveryFailedEvent = (encoded) => decode3(encoded, agentSettingsDiscoveryFailedEventSchema);
|
|
20342
20345
|
var encodeAgentSettingsDiscoveryFailedEvent = (message) => encode3(message, agentSettingsDiscoveryFailedEventSchema);
|
|
20343
20346
|
var decodeAgentCatalogRefreshCommand = (encoded) => decode3(encoded, agentCatalogRefreshCommandSchema);
|
|
20347
|
+
var encodeAgentCatalogRefreshCommand = (message) => encode3(message, agentCatalogRefreshCommandSchema);
|
|
20348
|
+
var decodeAgentCatalogRefreshedEvent = (encoded) => decode3(encoded, agentCatalogRefreshedEventSchema);
|
|
20344
20349
|
var encodeAgentCatalogRefreshedEvent = (message) => encode3(message, agentCatalogRefreshedEventSchema);
|
|
20350
|
+
var decodeAgentCatalogRefreshFailedEvent = (encoded) => decode3(encoded, agentCatalogRefreshFailedEventSchema);
|
|
20345
20351
|
var encodeAgentCatalogRefreshFailedEvent = (message) => encode3(message, agentCatalogRefreshFailedEventSchema);
|
|
20346
20352
|
var decodeFileReadCommand = (encoded) => decode3(encoded, fileReadCommandSchema);
|
|
20353
|
+
var encodeFileReadCommand = (message) => encode3(message, fileReadCommandSchema);
|
|
20354
|
+
var decodeFileBeginEvent = (encoded) => decode3(encoded, fileBeginEventSchema);
|
|
20347
20355
|
var encodeFileBeginEvent = (message) => encode3(message, fileBeginEventSchema);
|
|
20356
|
+
var decodeFileChunkEvent = (encoded) => decode3(encoded, fileChunkEventSchema);
|
|
20348
20357
|
var encodeFileChunkEvent = (message) => encode3(message, fileChunkEventSchema);
|
|
20358
|
+
var decodeFileEndEvent = (encoded) => decode3(encoded, fileEndEventSchema);
|
|
20349
20359
|
var encodeFileEndEvent = (message) => encode3(message, fileEndEventSchema);
|
|
20360
|
+
var decodeFileFailedEvent = (encoded) => decode3(encoded, fileFailedEventSchema);
|
|
20350
20361
|
var encodeFileFailedEvent = (message) => encode3(message, fileFailedEventSchema);
|
|
20351
20362
|
var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListCommandSchema);
|
|
20363
|
+
var encodeWorkspaceListCommand = (message) => encode3(message, workspaceListCommandSchema);
|
|
20364
|
+
var decodeWorkspaceEntriesEvent = (encoded) => decode3(encoded, workspaceEntriesEventSchema);
|
|
20352
20365
|
var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
|
|
20353
20366
|
var decodeSessionPrepareCommand = (encoded) => decode3(encoded, sessionPrepareCommandSchema);
|
|
20367
|
+
var encodeSessionPrepareCommand = (message) => encode3(message, sessionPrepareCommandSchema);
|
|
20368
|
+
var decodeSessionReadyEvent = (encoded) => decode3(encoded, sessionReadyEventSchema);
|
|
20354
20369
|
var encodeSessionReadyEvent = (message) => encode3(message, sessionReadyEventSchema);
|
|
20355
20370
|
var decodeSessionConfigureCommand = (encoded) => decode3(encoded, sessionConfigureCommandSchema);
|
|
20356
|
-
var
|
|
20357
|
-
var
|
|
20358
|
-
var
|
|
20359
|
-
var
|
|
20360
|
-
var
|
|
20371
|
+
var encodeSessionConfigureCommand = (message) => encode3(message, sessionConfigureCommandSchema);
|
|
20372
|
+
var decodeSessionConfigUpdatedEvent = (encoded) => decode3(encoded, sessionConfigUpdatedEventSchema);
|
|
20373
|
+
var decodeSessionUsageUpdatedEvent = (encoded) => decode3(encoded, sessionUsageUpdatedEventSchema);
|
|
20374
|
+
var decodeSessionCommandsUpdatedEvent = (encoded) => decode3(encoded, sessionCommandsUpdatedEventSchema);
|
|
20375
|
+
var decodeSessionInfoUpdatedEvent = (encoded) => decode3(encoded, sessionInfoUpdatedEventSchema);
|
|
20376
|
+
var decodeSessionPermissionRequestedEvent = (encoded) => decode3(encoded, sessionPermissionRequestedEventSchema);
|
|
20361
20377
|
var decodeSessionPermissionRespondCommand = (encoded) => decode3(encoded, sessionPermissionRespondCommandSchema);
|
|
20362
|
-
var
|
|
20363
|
-
var
|
|
20378
|
+
var encodeSessionPermissionRespondCommand = (message) => encode3(message, sessionPermissionRespondCommandSchema);
|
|
20379
|
+
var decodeSessionPermissionResolvedEvent = (encoded) => decode3(encoded, sessionPermissionResolvedEventSchema);
|
|
20380
|
+
var decodeSessionElicitationRequestedEvent = (encoded) => decode3(encoded, sessionElicitationRequestedEventSchema);
|
|
20364
20381
|
var decodeSessionElicitationRespondCommand = (encoded) => decode3(encoded, sessionElicitationRespondCommandSchema);
|
|
20365
|
-
var
|
|
20382
|
+
var encodeSessionElicitationRespondCommand = (message) => encode3(message, sessionElicitationRespondCommandSchema);
|
|
20383
|
+
var decodeSessionElicitationResolvedEvent = (encoded) => decode3(encoded, sessionElicitationResolvedEventSchema);
|
|
20384
|
+
var decodeSessionOperationFailedEvent = (encoded) => decode3(encoded, sessionOperationFailedEventSchema);
|
|
20366
20385
|
var encodeSessionOperationFailedEvent = (message) => encode3(message, sessionOperationFailedEventSchema);
|
|
20367
|
-
var
|
|
20386
|
+
var decodeAgentContentEvent = (encoded) => decode3(encoded, agentContentEventSchema);
|
|
20368
20387
|
var decodeAgentInstallRequestCommand = (encoded) => decode3(encoded, agentInstallRequestCommandSchema);
|
|
20388
|
+
var encodeAgentInstallRequestCommand = (message) => encode3(message, agentInstallRequestCommandSchema);
|
|
20369
20389
|
var decodeAgentInstallCancelCommand = (encoded) => decode3(encoded, agentInstallCancelCommandSchema);
|
|
20390
|
+
var encodeAgentInstallCancelCommand = (message) => encode3(message, agentInstallCancelCommandSchema);
|
|
20391
|
+
var decodeAgentInstallStartedEvent = (encoded) => decode3(encoded, agentInstallStartedEventSchema);
|
|
20370
20392
|
var encodeAgentInstallStartedEvent = (message) => encode3(message, agentInstallStartedEventSchema);
|
|
20393
|
+
var decodeAgentInstallProgressEvent = (encoded) => decode3(encoded, agentInstallProgressEventSchema);
|
|
20371
20394
|
var encodeAgentInstallProgressEvent = (message) => encode3(message, agentInstallProgressEventSchema);
|
|
20395
|
+
var decodeAgentInstallCompletedEvent = (encoded) => decode3(encoded, agentInstallCompletedEventSchema);
|
|
20372
20396
|
var encodeAgentInstallCompletedEvent = (message) => encode3(message, agentInstallCompletedEventSchema);
|
|
20397
|
+
var decodeAgentInstallFailedEvent = (encoded) => decode3(encoded, agentInstallFailedEventSchema);
|
|
20373
20398
|
var encodeAgentInstallFailedEvent = (message) => encode3(message, agentInstallFailedEventSchema);
|
|
20399
|
+
var decodeAgentInstallCancelledEvent = (encoded) => decode3(encoded, agentInstallCancelledEventSchema);
|
|
20374
20400
|
var encodeAgentInstallCancelledEvent = (message) => encode3(message, agentInstallCancelledEventSchema);
|
|
20375
20401
|
|
|
20376
20402
|
// ../protocol/src/messages.ts
|
|
@@ -20805,49 +20831,29 @@ function decodeSessionFailedEvent(encoded) {
|
|
|
20805
20831
|
sessionId: readIdentifier(value, "sessionId")
|
|
20806
20832
|
};
|
|
20807
20833
|
}
|
|
20808
|
-
function
|
|
20809
|
-
return JSON.stringify(
|
|
20810
|
-
}
|
|
20811
|
-
function encodeRuntimeDeliveryReceived(message) {
|
|
20812
|
-
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
20834
|
+
function encodeSessionPromptCommand(message) {
|
|
20835
|
+
return JSON.stringify(decodeSessionPromptCommand(JSON.stringify(message)));
|
|
20813
20836
|
}
|
|
20814
|
-
function
|
|
20815
|
-
return JSON.stringify(
|
|
20837
|
+
function encodeSessionCancelCommand(message) {
|
|
20838
|
+
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
20816
20839
|
}
|
|
20817
|
-
function
|
|
20818
|
-
return JSON.stringify(
|
|
20840
|
+
function encodeRuntimeLivenessReadyEvent(message) {
|
|
20841
|
+
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
20819
20842
|
}
|
|
20820
|
-
function
|
|
20821
|
-
return JSON.stringify(
|
|
20843
|
+
function encodeRuntimeHeartbeatEvent(message) {
|
|
20844
|
+
return JSON.stringify(decodeRuntimeHeartbeatEvent(JSON.stringify(message)));
|
|
20822
20845
|
}
|
|
20823
|
-
function
|
|
20824
|
-
return JSON.stringify(
|
|
20846
|
+
function encodeRuntimeHeartbeatAckEvent(message) {
|
|
20847
|
+
return JSON.stringify(decodeRuntimeHeartbeatAckEvent(JSON.stringify(message)));
|
|
20825
20848
|
}
|
|
20826
|
-
function
|
|
20827
|
-
return JSON.stringify(
|
|
20849
|
+
function encodeRuntimeDelivery(message) {
|
|
20850
|
+
return JSON.stringify(decodeRuntimeDelivery(JSON.stringify(message)));
|
|
20828
20851
|
}
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
20832
|
-
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
20833
|
-
var MobiusApiConfigurationError = class extends Error {
|
|
20834
|
-
code = "invalid_api_prefix";
|
|
20835
|
-
constructor() {
|
|
20836
|
-
super("The Mobius API prefix must be an absolute path without parameters");
|
|
20837
|
-
this.name = "MobiusApiConfigurationError";
|
|
20838
|
-
}
|
|
20839
|
-
};
|
|
20840
|
-
function parseMobiusApiPrefix(value) {
|
|
20841
|
-
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
20842
|
-
throw new MobiusApiConfigurationError();
|
|
20843
|
-
}
|
|
20844
|
-
return value;
|
|
20852
|
+
function encodeRuntimeDeliveryReceived(message) {
|
|
20853
|
+
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
20845
20854
|
}
|
|
20846
|
-
function
|
|
20847
|
-
return
|
|
20848
|
-
}
|
|
20849
|
-
function mobiusApiUrl(origin, resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
20850
|
-
return new URL(mobiusApiPath(resourcePath, apiPrefix), origin);
|
|
20855
|
+
function encodeRuntimeDeliveryCommitted(message) {
|
|
20856
|
+
return JSON.stringify(decodeRuntimeDeliveryCommitted(JSON.stringify(message)));
|
|
20851
20857
|
}
|
|
20852
20858
|
|
|
20853
20859
|
// ../protocol/src/session-history.ts
|
|
@@ -21024,9 +21030,13 @@ function decode4(schema, encoded) {
|
|
|
21024
21030
|
}
|
|
21025
21031
|
}
|
|
21026
21032
|
var decodeNativeSessionCommand = (encoded) => decode4(nativeSessionCommandSchema, encoded);
|
|
21033
|
+
var encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
21034
|
+
var decodeNativeSessionResult = (encoded) => decode4(nativeSessionResultSchema, encoded);
|
|
21027
21035
|
var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
21028
21036
|
var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
21037
|
+
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
21029
21038
|
var decodeNativeSessionTurnForkCommand = (encoded) => decode4(nativeSessionTurnForkCommandSchema, encoded);
|
|
21039
|
+
var encodeNativeSessionTurnForkCommand = (value) => JSON.stringify(nativeSessionTurnForkCommandSchema.parse(value));
|
|
21030
21040
|
|
|
21031
21041
|
// ../protocol/src/session-events.ts
|
|
21032
21042
|
var SESSION_EVENT_KIND = "session.event";
|
|
@@ -21118,8 +21128,285 @@ var encode4 = (message, schema) => {
|
|
|
21118
21128
|
var decodeSessionEventEnvelope = (encoded) => decode5(encoded, eventEnvelopeSchema);
|
|
21119
21129
|
var encodeSessionEventEnvelope = (message) => encode4(message, eventEnvelopeSchema);
|
|
21120
21130
|
var decodeSessionEventAcknowledgement = (encoded) => decode5(encoded, eventAcknowledgementSchema);
|
|
21131
|
+
var encodeSessionEventAcknowledgement = (message) => encode4(message, eventAcknowledgementSchema);
|
|
21121
21132
|
var decodeSessionEventDeferred = (encoded) => decode5(encoded, eventDeferredSchema);
|
|
21133
|
+
var encodeSessionEventDeferred = (message) => encode4(message, eventDeferredSchema);
|
|
21122
21134
|
var decodeSessionEventRejection = (encoded) => decode5(encoded, eventRejectionSchema);
|
|
21135
|
+
var encodeSessionEventRejection = (message) => encode4(message, eventRejectionSchema);
|
|
21136
|
+
function decodeRecordedSessionEvent(encoded) {
|
|
21137
|
+
const kind = decodeMessageKind(encoded);
|
|
21138
|
+
switch (kind) {
|
|
21139
|
+
case AGENT_ACTIVITY_KIND:
|
|
21140
|
+
return decodeAgentActivityEvent(encoded);
|
|
21141
|
+
case AGENT_CONTENT_KIND:
|
|
21142
|
+
return decodeAgentContentEvent(encoded);
|
|
21143
|
+
case AGENT_MESSAGE_DELTA_KIND:
|
|
21144
|
+
return decodeAgentMessageDeltaEvent(encoded);
|
|
21145
|
+
case SESSION_COMMANDS_UPDATED_KIND:
|
|
21146
|
+
return decodeSessionCommandsUpdatedEvent(encoded);
|
|
21147
|
+
case SESSION_COMPLETED_KIND:
|
|
21148
|
+
return decodeSessionCompletedEvent(encoded);
|
|
21149
|
+
case SESSION_CONFIG_UPDATED_KIND:
|
|
21150
|
+
return decodeSessionConfigUpdatedEvent(encoded);
|
|
21151
|
+
case SESSION_ELICITATION_REQUESTED_KIND:
|
|
21152
|
+
return decodeSessionElicitationRequestedEvent(encoded);
|
|
21153
|
+
case SESSION_ELICITATION_RESOLVED_KIND:
|
|
21154
|
+
return decodeSessionElicitationResolvedEvent(encoded);
|
|
21155
|
+
case SESSION_FAILED_KIND:
|
|
21156
|
+
return decodeSessionFailedEvent(encoded);
|
|
21157
|
+
case SESSION_INFO_UPDATED_KIND:
|
|
21158
|
+
return decodeSessionInfoUpdatedEvent(encoded);
|
|
21159
|
+
case SESSION_PERMISSION_REQUESTED_KIND:
|
|
21160
|
+
return decodeSessionPermissionRequestedEvent(encoded);
|
|
21161
|
+
case SESSION_PERMISSION_RESOLVED_KIND:
|
|
21162
|
+
return decodeSessionPermissionResolvedEvent(encoded);
|
|
21163
|
+
case SESSION_READY_KIND:
|
|
21164
|
+
return decodeSessionReadyEvent(encoded);
|
|
21165
|
+
case SESSION_STARTED_KIND:
|
|
21166
|
+
return decodeSessionStartedEvent(encoded);
|
|
21167
|
+
case SESSION_USAGE_UPDATED_KIND:
|
|
21168
|
+
return decodeSessionUsageUpdatedEvent(encoded);
|
|
21169
|
+
default:
|
|
21170
|
+
throw new ProtocolMessageError("Unsupported recorded session event");
|
|
21171
|
+
}
|
|
21172
|
+
}
|
|
21173
|
+
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
21174
|
+
|
|
21175
|
+
// ../protocol/src/daemon-transport.ts
|
|
21176
|
+
function defineMessageSignature(kind, encoder, decoder) {
|
|
21177
|
+
const schema = (message) => decoder(JSON.stringify(message));
|
|
21178
|
+
return {
|
|
21179
|
+
decoder,
|
|
21180
|
+
encoder: (message) => encoder(schema(message)),
|
|
21181
|
+
kind,
|
|
21182
|
+
schema
|
|
21183
|
+
};
|
|
21184
|
+
}
|
|
21185
|
+
var serviceToDaemonSignatures = {
|
|
21186
|
+
[AGENT_CATALOG_REFRESH_KIND]: defineMessageSignature(
|
|
21187
|
+
AGENT_CATALOG_REFRESH_KIND,
|
|
21188
|
+
encodeAgentCatalogRefreshCommand,
|
|
21189
|
+
decodeAgentCatalogRefreshCommand
|
|
21190
|
+
),
|
|
21191
|
+
[AGENT_INSTALL_CANCEL_KIND]: defineMessageSignature(
|
|
21192
|
+
AGENT_INSTALL_CANCEL_KIND,
|
|
21193
|
+
encodeAgentInstallCancelCommand,
|
|
21194
|
+
decodeAgentInstallCancelCommand
|
|
21195
|
+
),
|
|
21196
|
+
[AGENT_INSTALL_REQUEST_KIND]: defineMessageSignature(
|
|
21197
|
+
AGENT_INSTALL_REQUEST_KIND,
|
|
21198
|
+
encodeAgentInstallRequestCommand,
|
|
21199
|
+
decodeAgentInstallRequestCommand
|
|
21200
|
+
),
|
|
21201
|
+
[AGENT_SETTINGS_DISCOVER_KIND]: defineMessageSignature(
|
|
21202
|
+
AGENT_SETTINGS_DISCOVER_KIND,
|
|
21203
|
+
encodeAgentSettingsDiscoverCommand,
|
|
21204
|
+
decodeAgentSettingsDiscoverCommand
|
|
21205
|
+
),
|
|
21206
|
+
[FILE_READ_KIND]: defineMessageSignature(FILE_READ_KIND, encodeFileReadCommand, decodeFileReadCommand),
|
|
21207
|
+
[NATIVE_SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
21208
|
+
NATIVE_SESSION_CANCEL_KIND,
|
|
21209
|
+
encodeNativeSessionCancel,
|
|
21210
|
+
decodeNativeSessionCancel
|
|
21211
|
+
),
|
|
21212
|
+
[NATIVE_SESSION_REQUEST_KIND]: defineMessageSignature(
|
|
21213
|
+
NATIVE_SESSION_REQUEST_KIND,
|
|
21214
|
+
encodeNativeSessionCommand,
|
|
21215
|
+
decodeNativeSessionCommand
|
|
21216
|
+
),
|
|
21217
|
+
[NATIVE_SESSION_TURN_FORK_KIND]: defineMessageSignature(
|
|
21218
|
+
NATIVE_SESSION_TURN_FORK_KIND,
|
|
21219
|
+
encodeNativeSessionTurnForkCommand,
|
|
21220
|
+
decodeNativeSessionTurnForkCommand
|
|
21221
|
+
),
|
|
21222
|
+
[RUNTIME_DELIVERY_KIND]: defineMessageSignature(
|
|
21223
|
+
RUNTIME_DELIVERY_KIND,
|
|
21224
|
+
encodeRuntimeDelivery,
|
|
21225
|
+
decodeRuntimeDelivery
|
|
21226
|
+
),
|
|
21227
|
+
[RUNTIME_DELIVERY_COMMITTED_KIND]: defineMessageSignature(
|
|
21228
|
+
RUNTIME_DELIVERY_COMMITTED_KIND,
|
|
21229
|
+
encodeRuntimeDeliveryCommitted,
|
|
21230
|
+
decodeRuntimeDeliveryCommitted
|
|
21231
|
+
),
|
|
21232
|
+
[RUNTIME_HEARTBEAT_ACK_KIND]: defineMessageSignature(
|
|
21233
|
+
RUNTIME_HEARTBEAT_ACK_KIND,
|
|
21234
|
+
encodeRuntimeHeartbeatAckEvent,
|
|
21235
|
+
decodeRuntimeHeartbeatAckEvent
|
|
21236
|
+
),
|
|
21237
|
+
[RUNTIME_LIVENESS_READY_KIND]: defineMessageSignature(
|
|
21238
|
+
RUNTIME_LIVENESS_READY_KIND,
|
|
21239
|
+
encodeRuntimeLivenessReadyEvent,
|
|
21240
|
+
decodeRuntimeLivenessReadyEvent
|
|
21241
|
+
),
|
|
21242
|
+
[SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
21243
|
+
SESSION_CANCEL_KIND,
|
|
21244
|
+
encodeSessionCancelCommand,
|
|
21245
|
+
decodeSessionCancelCommand
|
|
21246
|
+
),
|
|
21247
|
+
[SESSION_CONFIGURE_KIND]: defineMessageSignature(
|
|
21248
|
+
SESSION_CONFIGURE_KIND,
|
|
21249
|
+
encodeSessionConfigureCommand,
|
|
21250
|
+
decodeSessionConfigureCommand
|
|
21251
|
+
),
|
|
21252
|
+
[SESSION_ELICITATION_RESPOND_KIND]: defineMessageSignature(
|
|
21253
|
+
SESSION_ELICITATION_RESPOND_KIND,
|
|
21254
|
+
encodeSessionElicitationRespondCommand,
|
|
21255
|
+
decodeSessionElicitationRespondCommand
|
|
21256
|
+
),
|
|
21257
|
+
[SESSION_EVENT_ACK_KIND]: defineMessageSignature(
|
|
21258
|
+
SESSION_EVENT_ACK_KIND,
|
|
21259
|
+
encodeSessionEventAcknowledgement,
|
|
21260
|
+
decodeSessionEventAcknowledgement
|
|
21261
|
+
),
|
|
21262
|
+
[SESSION_EVENT_DEFERRED_KIND]: defineMessageSignature(
|
|
21263
|
+
SESSION_EVENT_DEFERRED_KIND,
|
|
21264
|
+
encodeSessionEventDeferred,
|
|
21265
|
+
decodeSessionEventDeferred
|
|
21266
|
+
),
|
|
21267
|
+
[SESSION_EVENT_REJECTED_KIND]: defineMessageSignature(
|
|
21268
|
+
SESSION_EVENT_REJECTED_KIND,
|
|
21269
|
+
encodeSessionEventRejection,
|
|
21270
|
+
decodeSessionEventRejection
|
|
21271
|
+
),
|
|
21272
|
+
[SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
|
|
21273
|
+
SESSION_PERMISSION_RESPOND_KIND,
|
|
21274
|
+
encodeSessionPermissionRespondCommand,
|
|
21275
|
+
decodeSessionPermissionRespondCommand
|
|
21276
|
+
),
|
|
21277
|
+
[SESSION_PREPARE_KIND]: defineMessageSignature(
|
|
21278
|
+
SESSION_PREPARE_KIND,
|
|
21279
|
+
encodeSessionPrepareCommand,
|
|
21280
|
+
decodeSessionPrepareCommand
|
|
21281
|
+
),
|
|
21282
|
+
[SESSION_PROMPT_KIND]: defineMessageSignature(
|
|
21283
|
+
SESSION_PROMPT_KIND,
|
|
21284
|
+
encodeSessionPromptCommand,
|
|
21285
|
+
decodeSessionPromptCommand
|
|
21286
|
+
),
|
|
21287
|
+
[WORKSPACE_LIST_KIND]: defineMessageSignature(
|
|
21288
|
+
WORKSPACE_LIST_KIND,
|
|
21289
|
+
encodeWorkspaceListCommand,
|
|
21290
|
+
decodeWorkspaceListCommand
|
|
21291
|
+
)
|
|
21292
|
+
};
|
|
21293
|
+
var serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
21294
|
+
function decodeServiceToDaemonMessage(encoded) {
|
|
21295
|
+
const kind = decodeMessageKind(encoded);
|
|
21296
|
+
const signature = serviceToDaemonRegistry[kind];
|
|
21297
|
+
if (signature === void 0) {
|
|
21298
|
+
throw new ProtocolMessageError(`Unsupported service-to-daemon message kind: ${kind}`);
|
|
21299
|
+
}
|
|
21300
|
+
return signature.decoder(encoded);
|
|
21301
|
+
}
|
|
21302
|
+
var daemonToServiceSignatures = {
|
|
21303
|
+
[AGENT_CATALOG_REFRESHED_KIND]: defineMessageSignature(
|
|
21304
|
+
AGENT_CATALOG_REFRESHED_KIND,
|
|
21305
|
+
encodeAgentCatalogRefreshedEvent,
|
|
21306
|
+
decodeAgentCatalogRefreshedEvent
|
|
21307
|
+
),
|
|
21308
|
+
[AGENT_CATALOG_REFRESH_FAILED_KIND]: defineMessageSignature(
|
|
21309
|
+
AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
21310
|
+
encodeAgentCatalogRefreshFailedEvent,
|
|
21311
|
+
decodeAgentCatalogRefreshFailedEvent
|
|
21312
|
+
),
|
|
21313
|
+
[AGENT_INSTALL_CANCELLED_KIND]: defineMessageSignature(
|
|
21314
|
+
AGENT_INSTALL_CANCELLED_KIND,
|
|
21315
|
+
encodeAgentInstallCancelledEvent,
|
|
21316
|
+
decodeAgentInstallCancelledEvent
|
|
21317
|
+
),
|
|
21318
|
+
[AGENT_INSTALL_COMPLETED_KIND]: defineMessageSignature(
|
|
21319
|
+
AGENT_INSTALL_COMPLETED_KIND,
|
|
21320
|
+
encodeAgentInstallCompletedEvent,
|
|
21321
|
+
decodeAgentInstallCompletedEvent
|
|
21322
|
+
),
|
|
21323
|
+
[AGENT_INSTALL_FAILED_KIND]: defineMessageSignature(
|
|
21324
|
+
AGENT_INSTALL_FAILED_KIND,
|
|
21325
|
+
encodeAgentInstallFailedEvent,
|
|
21326
|
+
decodeAgentInstallFailedEvent
|
|
21327
|
+
),
|
|
21328
|
+
[AGENT_INSTALL_PROGRESS_KIND]: defineMessageSignature(
|
|
21329
|
+
AGENT_INSTALL_PROGRESS_KIND,
|
|
21330
|
+
encodeAgentInstallProgressEvent,
|
|
21331
|
+
decodeAgentInstallProgressEvent
|
|
21332
|
+
),
|
|
21333
|
+
[AGENT_INSTALL_STARTED_KIND]: defineMessageSignature(
|
|
21334
|
+
AGENT_INSTALL_STARTED_KIND,
|
|
21335
|
+
encodeAgentInstallStartedEvent,
|
|
21336
|
+
decodeAgentInstallStartedEvent
|
|
21337
|
+
),
|
|
21338
|
+
[AGENT_SETTINGS_DISCOVERED_KIND]: defineMessageSignature(
|
|
21339
|
+
AGENT_SETTINGS_DISCOVERED_KIND,
|
|
21340
|
+
encodeAgentSettingsDiscoveredEvent,
|
|
21341
|
+
decodeAgentSettingsDiscoveredEvent
|
|
21342
|
+
),
|
|
21343
|
+
[AGENT_SETTINGS_DISCOVERY_FAILED_KIND]: defineMessageSignature(
|
|
21344
|
+
AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
21345
|
+
encodeAgentSettingsDiscoveryFailedEvent,
|
|
21346
|
+
decodeAgentSettingsDiscoveryFailedEvent
|
|
21347
|
+
),
|
|
21348
|
+
[FILE_BEGIN_KIND]: defineMessageSignature(FILE_BEGIN_KIND, encodeFileBeginEvent, decodeFileBeginEvent),
|
|
21349
|
+
[FILE_CHUNK_KIND]: defineMessageSignature(FILE_CHUNK_KIND, encodeFileChunkEvent, decodeFileChunkEvent),
|
|
21350
|
+
[FILE_END_KIND]: defineMessageSignature(FILE_END_KIND, encodeFileEndEvent, decodeFileEndEvent),
|
|
21351
|
+
[FILE_FAILED_KIND]: defineMessageSignature(FILE_FAILED_KIND, encodeFileFailedEvent, decodeFileFailedEvent),
|
|
21352
|
+
[NATIVE_SESSION_RESULT_KIND]: defineMessageSignature(
|
|
21353
|
+
NATIVE_SESSION_RESULT_KIND,
|
|
21354
|
+
encodeNativeSessionResult,
|
|
21355
|
+
decodeNativeSessionResult
|
|
21356
|
+
),
|
|
21357
|
+
[RUNTIME_DELIVERY_RECEIVED_KIND]: defineMessageSignature(
|
|
21358
|
+
RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
21359
|
+
encodeRuntimeDeliveryReceived,
|
|
21360
|
+
decodeRuntimeDeliveryReceived
|
|
21361
|
+
),
|
|
21362
|
+
[RUNTIME_HEARTBEAT_KIND]: defineMessageSignature(
|
|
21363
|
+
RUNTIME_HEARTBEAT_KIND,
|
|
21364
|
+
encodeRuntimeHeartbeatEvent,
|
|
21365
|
+
decodeRuntimeHeartbeatEvent
|
|
21366
|
+
),
|
|
21367
|
+
[SESSION_EVENT_KIND]: defineMessageSignature(
|
|
21368
|
+
SESSION_EVENT_KIND,
|
|
21369
|
+
encodeSessionEventEnvelope,
|
|
21370
|
+
decodeSessionEventEnvelope
|
|
21371
|
+
),
|
|
21372
|
+
[SESSION_OPERATION_FAILED_KIND]: defineMessageSignature(
|
|
21373
|
+
SESSION_OPERATION_FAILED_KIND,
|
|
21374
|
+
encodeSessionOperationFailedEvent,
|
|
21375
|
+
decodeSessionOperationFailedEvent
|
|
21376
|
+
),
|
|
21377
|
+
[SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
|
|
21378
|
+
[WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
|
|
21379
|
+
WORKSPACE_ENTRIES_KIND,
|
|
21380
|
+
encodeWorkspaceEntriesEvent,
|
|
21381
|
+
decodeWorkspaceEntriesEvent
|
|
21382
|
+
)
|
|
21383
|
+
};
|
|
21384
|
+
function encodeDaemonToServiceMessage(message) {
|
|
21385
|
+
return daemonToServiceSignatures[message.kind].encoder(message);
|
|
21386
|
+
}
|
|
21387
|
+
|
|
21388
|
+
// ../protocol/src/mobius-api.ts
|
|
21389
|
+
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
21390
|
+
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
21391
|
+
var MobiusApiConfigurationError = class extends Error {
|
|
21392
|
+
code = "invalid_api_prefix";
|
|
21393
|
+
constructor() {
|
|
21394
|
+
super("The Mobius API prefix must be an absolute path without parameters");
|
|
21395
|
+
this.name = "MobiusApiConfigurationError";
|
|
21396
|
+
}
|
|
21397
|
+
};
|
|
21398
|
+
function parseMobiusApiPrefix(value) {
|
|
21399
|
+
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
21400
|
+
throw new MobiusApiConfigurationError();
|
|
21401
|
+
}
|
|
21402
|
+
return value;
|
|
21403
|
+
}
|
|
21404
|
+
function mobiusApiPath(resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
21405
|
+
return `${parseMobiusApiPrefix(apiPrefix)}${resourcePath}`;
|
|
21406
|
+
}
|
|
21407
|
+
function mobiusApiUrl(origin, resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
21408
|
+
return new URL(mobiusApiPath(resourcePath, apiPrefix), origin);
|
|
21409
|
+
}
|
|
21123
21410
|
|
|
21124
21411
|
// src/agent-catalog/local-agent.ts
|
|
21125
21412
|
import { realpathSync, statSync } from "node:fs";
|
|
@@ -36650,11 +36937,42 @@ function relayHttpEndpoint(relayUrl) {
|
|
|
36650
36937
|
var CATALOG_UPDATE_TIMEOUT_MILLISECONDS = 2e4;
|
|
36651
36938
|
var AgentCatalogPublishError = class extends Error {
|
|
36652
36939
|
code = "agent_catalog_update_failed";
|
|
36653
|
-
|
|
36940
|
+
diagnosticDetails;
|
|
36941
|
+
constructor(message, options = {}, diagnosticDetails = {}) {
|
|
36654
36942
|
super(message, options);
|
|
36943
|
+
this.diagnosticDetails = diagnosticDetails;
|
|
36655
36944
|
this.name = "AgentCatalogPublishError";
|
|
36656
36945
|
}
|
|
36657
36946
|
};
|
|
36947
|
+
function isRecord10(value) {
|
|
36948
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36949
|
+
}
|
|
36950
|
+
function isSafeRelayErrorMessage(value) {
|
|
36951
|
+
return value.length > 0 && value.length <= 512 && Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127);
|
|
36952
|
+
}
|
|
36953
|
+
async function rejectedCatalogError(response) {
|
|
36954
|
+
let value;
|
|
36955
|
+
try {
|
|
36956
|
+
value = await response.json();
|
|
36957
|
+
} catch {
|
|
36958
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
36959
|
+
}
|
|
36960
|
+
if (!isRecord10(value) || !isRecord10(value["error"])) {
|
|
36961
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
36962
|
+
}
|
|
36963
|
+
const code = value["error"]["code"];
|
|
36964
|
+
const message = value["error"]["message"];
|
|
36965
|
+
if (typeof code !== "string" || !/^[a-z][a-z0-9_]{0,63}$/.test(code) || typeof message !== "string" || !isSafeRelayErrorMessage(message)) {
|
|
36966
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
36967
|
+
}
|
|
36968
|
+
return new AgentCatalogPublishError(
|
|
36969
|
+
`The Relay rejected the Agent catalog update (${code}): ${message}`,
|
|
36970
|
+
{},
|
|
36971
|
+
{
|
|
36972
|
+
relayErrorCode: code
|
|
36973
|
+
}
|
|
36974
|
+
);
|
|
36975
|
+
}
|
|
36658
36976
|
function catalogEndpoint(config2) {
|
|
36659
36977
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
36660
36978
|
if (endpoint.pathname.endsWith("/daemon")) {
|
|
@@ -36702,10 +37020,10 @@ async function publishAgentCatalog(config2, signal) {
|
|
|
36702
37020
|
{ cause: error62 }
|
|
36703
37021
|
);
|
|
36704
37022
|
}
|
|
36705
|
-
await response.body?.cancel();
|
|
36706
37023
|
if (!response.ok) {
|
|
36707
|
-
throw
|
|
37024
|
+
throw await rejectedCatalogError(response);
|
|
36708
37025
|
}
|
|
37026
|
+
await response.body?.cancel();
|
|
36709
37027
|
}
|
|
36710
37028
|
|
|
36711
37029
|
// src/agent-installation/agent-installation-manager.ts
|
|
@@ -37214,30 +37532,26 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37214
37532
|
throw new Error("The local file is too large to read");
|
|
37215
37533
|
}
|
|
37216
37534
|
const raster = await readLocalRaster(target, signal);
|
|
37217
|
-
send2(
|
|
37218
|
-
|
|
37219
|
-
|
|
37220
|
-
|
|
37221
|
-
|
|
37222
|
-
|
|
37223
|
-
|
|
37224
|
-
|
|
37225
|
-
|
|
37226
|
-
})
|
|
37227
|
-
);
|
|
37535
|
+
send2({
|
|
37536
|
+
byteLength: before.size,
|
|
37537
|
+
kind: FILE_BEGIN_KIND,
|
|
37538
|
+
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
37539
|
+
modifiedAt: before.mtime.toISOString(),
|
|
37540
|
+
name: basename4(target) || "file",
|
|
37541
|
+
requestId: command.requestId,
|
|
37542
|
+
sessionId: command.sessionId
|
|
37543
|
+
});
|
|
37228
37544
|
let sequence = 0;
|
|
37229
37545
|
const stream = createReadStream2(target, { highWaterMark: CHUNK_BYTES, signal });
|
|
37230
37546
|
for await (const value of stream) {
|
|
37231
37547
|
const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
37232
|
-
send2(
|
|
37233
|
-
|
|
37234
|
-
|
|
37235
|
-
|
|
37236
|
-
|
|
37237
|
-
|
|
37238
|
-
|
|
37239
|
-
})
|
|
37240
|
-
);
|
|
37548
|
+
send2({
|
|
37549
|
+
data: Buffer.from(bytes).toString("base64"),
|
|
37550
|
+
kind: FILE_CHUNK_KIND,
|
|
37551
|
+
requestId: command.requestId,
|
|
37552
|
+
sequence,
|
|
37553
|
+
sessionId: command.sessionId
|
|
37554
|
+
});
|
|
37241
37555
|
sequence += 1;
|
|
37242
37556
|
}
|
|
37243
37557
|
const after = await stat7(target);
|
|
@@ -37245,13 +37559,11 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37245
37559
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
37246
37560
|
throw new Error("The local file changed during transfer");
|
|
37247
37561
|
}
|
|
37248
|
-
send2(
|
|
37249
|
-
|
|
37250
|
-
|
|
37251
|
-
|
|
37252
|
-
|
|
37253
|
-
})
|
|
37254
|
-
);
|
|
37562
|
+
send2({
|
|
37563
|
+
kind: FILE_END_KIND,
|
|
37564
|
+
requestId: command.requestId,
|
|
37565
|
+
sessionId: command.sessionId
|
|
37566
|
+
});
|
|
37255
37567
|
}
|
|
37256
37568
|
|
|
37257
37569
|
// src/artifacts/runtime-artifact-uploader.ts
|
|
@@ -37284,11 +37596,11 @@ var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
|
37284
37596
|
function invalidResponse(message) {
|
|
37285
37597
|
return new MobiusProtocolError(message);
|
|
37286
37598
|
}
|
|
37287
|
-
function
|
|
37599
|
+
function isRecord11(value) {
|
|
37288
37600
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37289
37601
|
}
|
|
37290
37602
|
function record2(value, name) {
|
|
37291
|
-
if (!
|
|
37603
|
+
if (!isRecord11(value)) {
|
|
37292
37604
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37293
37605
|
}
|
|
37294
37606
|
return value;
|
|
@@ -38909,6 +39221,25 @@ var RelayConnectionDiagnostics = class {
|
|
|
38909
39221
|
addFailureDetails(details, failure2);
|
|
38910
39222
|
this.#record("relay_connection_failed", connectionEpoch.toString(), details, true);
|
|
38911
39223
|
};
|
|
39224
|
+
/**
|
|
39225
|
+
* Records that the Runtime gave up on Agent turns the Relay already settled. This is not a connection
|
|
39226
|
+
* failure, so it is recorded independently of the per-epoch failure deduplication.
|
|
39227
|
+
*/
|
|
39228
|
+
reconciliationAbandoned = (connectionEpoch, relayErrorCode2, turnCount) => {
|
|
39229
|
+
this.#record(
|
|
39230
|
+
"relay_reconciliation_abandoned",
|
|
39231
|
+
connectionEpoch.toString(),
|
|
39232
|
+
{
|
|
39233
|
+
connectionEpoch: connectionEpoch.toString(),
|
|
39234
|
+
relayErrorCode: relayErrorCode2 ?? "unknown",
|
|
39235
|
+
relayOrigin: this.#relayOrigin,
|
|
39236
|
+
source: "reconciliation_abandoned",
|
|
39237
|
+
turnCount: turnCount.toString(),
|
|
39238
|
+
...this.#route
|
|
39239
|
+
},
|
|
39240
|
+
true
|
|
39241
|
+
);
|
|
39242
|
+
};
|
|
38912
39243
|
connectionOpened = (connectionEpoch) => {
|
|
38913
39244
|
this.#record(
|
|
38914
39245
|
"relay_connection_opened",
|
|
@@ -39048,12 +39379,10 @@ var RelayConnectionLiveness = class {
|
|
|
39048
39379
|
heartbeatId,
|
|
39049
39380
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
39050
39381
|
);
|
|
39051
|
-
const sent = this.#transport.send(
|
|
39052
|
-
|
|
39053
|
-
|
|
39054
|
-
|
|
39055
|
-
})
|
|
39056
|
-
);
|
|
39382
|
+
const sent = this.#transport.send({
|
|
39383
|
+
heartbeatId,
|
|
39384
|
+
kind: RUNTIME_HEARTBEAT_KIND
|
|
39385
|
+
});
|
|
39057
39386
|
if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
|
|
39058
39387
|
this.#state.timeout.cancel();
|
|
39059
39388
|
this.#state = new FinishedRelayLivenessState();
|
|
@@ -39673,39 +40002,39 @@ var DaemonAcpObserver = class {
|
|
|
39673
40002
|
}
|
|
39674
40003
|
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39675
40004
|
onCommands = (event) => {
|
|
39676
|
-
this.#record(event.sessionId,
|
|
40005
|
+
this.#record(event.sessionId, event);
|
|
39677
40006
|
return Promise.resolve();
|
|
39678
40007
|
};
|
|
39679
40008
|
onConfig = (event) => {
|
|
39680
|
-
this.#record(event.sessionId,
|
|
40009
|
+
this.#record(event.sessionId, event);
|
|
39681
40010
|
return Promise.resolve();
|
|
39682
40011
|
};
|
|
39683
40012
|
onContent = (event) => {
|
|
39684
|
-
this.#record(event.sessionId,
|
|
40013
|
+
this.#record(event.sessionId, event);
|
|
39685
40014
|
return Promise.resolve();
|
|
39686
40015
|
};
|
|
39687
40016
|
onElicitation = (event) => {
|
|
39688
|
-
this.#record(event.sessionId,
|
|
40017
|
+
this.#record(event.sessionId, event);
|
|
39689
40018
|
return Promise.resolve();
|
|
39690
40019
|
};
|
|
39691
40020
|
onElicitationResolved = (event) => {
|
|
39692
|
-
this.#record(event.sessionId,
|
|
40021
|
+
this.#record(event.sessionId, event);
|
|
39693
40022
|
return Promise.resolve();
|
|
39694
40023
|
};
|
|
39695
40024
|
onInfo = (event) => {
|
|
39696
|
-
this.#record(event.sessionId,
|
|
40025
|
+
this.#record(event.sessionId, event);
|
|
39697
40026
|
return Promise.resolve();
|
|
39698
40027
|
};
|
|
39699
40028
|
onPermission = (event) => {
|
|
39700
|
-
this.#record(event.sessionId,
|
|
40029
|
+
this.#record(event.sessionId, event);
|
|
39701
40030
|
return Promise.resolve();
|
|
39702
40031
|
};
|
|
39703
40032
|
onPermissionResolved = (event) => {
|
|
39704
|
-
this.#record(event.sessionId,
|
|
40033
|
+
this.#record(event.sessionId, event);
|
|
39705
40034
|
return Promise.resolve();
|
|
39706
40035
|
};
|
|
39707
40036
|
onUsage = (event) => {
|
|
39708
|
-
this.#record(event.sessionId,
|
|
40037
|
+
this.#record(event.sessionId, event);
|
|
39709
40038
|
return Promise.resolve();
|
|
39710
40039
|
};
|
|
39711
40040
|
};
|
|
@@ -39754,60 +40083,45 @@ var DaemonInstallationObserver = class {
|
|
|
39754
40083
|
if (state instanceof RunningInstallation) {
|
|
39755
40084
|
if (!this.#started.has(state.requestId)) {
|
|
39756
40085
|
this.#started.add(state.requestId);
|
|
39757
|
-
this.#send(
|
|
39758
|
-
socket,
|
|
39759
|
-
encodeAgentInstallStartedEvent({
|
|
39760
|
-
agentId: state.agentId,
|
|
39761
|
-
kind: AGENT_INSTALL_STARTED_KIND,
|
|
39762
|
-
requestId: state.requestId
|
|
39763
|
-
})
|
|
39764
|
-
);
|
|
39765
|
-
}
|
|
39766
|
-
this.#send(
|
|
39767
|
-
socket,
|
|
39768
|
-
encodeAgentInstallProgressEvent({
|
|
40086
|
+
this.#send(socket, {
|
|
39769
40087
|
agentId: state.agentId,
|
|
39770
|
-
kind:
|
|
39771
|
-
requestId: state.requestId
|
|
39772
|
-
|
|
39773
|
-
|
|
39774
|
-
|
|
40088
|
+
kind: AGENT_INSTALL_STARTED_KIND,
|
|
40089
|
+
requestId: state.requestId
|
|
40090
|
+
});
|
|
40091
|
+
}
|
|
40092
|
+
this.#send(socket, {
|
|
40093
|
+
agentId: state.agentId,
|
|
40094
|
+
kind: AGENT_INSTALL_PROGRESS_KIND,
|
|
40095
|
+
requestId: state.requestId,
|
|
40096
|
+
stage: state.stage
|
|
40097
|
+
});
|
|
39775
40098
|
return Promise.resolve();
|
|
39776
40099
|
}
|
|
39777
40100
|
if (state instanceof SucceededInstallation) {
|
|
39778
|
-
this.#send(
|
|
39779
|
-
|
|
39780
|
-
|
|
39781
|
-
|
|
39782
|
-
|
|
39783
|
-
|
|
39784
|
-
requestId: state.requestId
|
|
39785
|
-
})
|
|
39786
|
-
);
|
|
40101
|
+
this.#send(socket, {
|
|
40102
|
+
agentId: state.agentId,
|
|
40103
|
+
authenticationMayBeRequired: state.authenticationMayBeRequired,
|
|
40104
|
+
kind: AGENT_INSTALL_COMPLETED_KIND,
|
|
40105
|
+
requestId: state.requestId
|
|
40106
|
+
});
|
|
39787
40107
|
return Promise.resolve();
|
|
39788
40108
|
}
|
|
39789
40109
|
if (state instanceof FailedInstallation) {
|
|
39790
|
-
this.#send(
|
|
39791
|
-
|
|
39792
|
-
|
|
39793
|
-
|
|
39794
|
-
|
|
39795
|
-
|
|
39796
|
-
|
|
39797
|
-
requestId: state.requestId
|
|
39798
|
-
})
|
|
39799
|
-
);
|
|
40110
|
+
this.#send(socket, {
|
|
40111
|
+
agentId: state.agentId,
|
|
40112
|
+
code: state.code,
|
|
40113
|
+
kind: AGENT_INSTALL_FAILED_KIND,
|
|
40114
|
+
message: state.message,
|
|
40115
|
+
requestId: state.requestId
|
|
40116
|
+
});
|
|
39800
40117
|
return Promise.resolve();
|
|
39801
40118
|
}
|
|
39802
40119
|
if (state instanceof CancelledInstallation) {
|
|
39803
|
-
this.#send(
|
|
39804
|
-
|
|
39805
|
-
|
|
39806
|
-
|
|
39807
|
-
|
|
39808
|
-
requestId: state.requestId
|
|
39809
|
-
})
|
|
39810
|
-
);
|
|
40120
|
+
this.#send(socket, {
|
|
40121
|
+
agentId: state.agentId,
|
|
40122
|
+
kind: AGENT_INSTALL_CANCELLED_KIND,
|
|
40123
|
+
requestId: state.requestId
|
|
40124
|
+
});
|
|
39811
40125
|
return Promise.resolve();
|
|
39812
40126
|
}
|
|
39813
40127
|
throw new Error("Unsupported Agent integration installation state");
|
|
@@ -39855,11 +40169,34 @@ var ActiveDaemonTurn = class {
|
|
|
39855
40169
|
};
|
|
39856
40170
|
var ActiveTurnReconciliationError = class extends Error {
|
|
39857
40171
|
code = "active_turn_reconciliation_failed";
|
|
40172
|
+
diagnosticDetails;
|
|
40173
|
+
relayErrorCode;
|
|
40174
|
+
terminal;
|
|
39858
40175
|
constructor(message, options = {}) {
|
|
39859
40176
|
super(message, options);
|
|
39860
40177
|
this.name = "ActiveTurnReconciliationError";
|
|
40178
|
+
this.relayErrorCode = options.relayErrorCode ?? null;
|
|
40179
|
+
this.terminal = options.terminal ?? false;
|
|
40180
|
+
this.diagnosticDetails = this.relayErrorCode === null ? {} : { relayErrorCode: this.relayErrorCode };
|
|
39861
40181
|
}
|
|
39862
40182
|
};
|
|
40183
|
+
var TERMINAL_RECONCILIATION_RELAY_CODES = /* @__PURE__ */ new Set(["session_conflict"]);
|
|
40184
|
+
async function relayErrorCode(response) {
|
|
40185
|
+
try {
|
|
40186
|
+
const body = JSON.parse(await response.text());
|
|
40187
|
+
if (typeof body !== "object" || body === null) {
|
|
40188
|
+
return null;
|
|
40189
|
+
}
|
|
40190
|
+
const error62 = Reflect.get(body, "error");
|
|
40191
|
+
if (typeof error62 !== "object" || error62 === null) {
|
|
40192
|
+
return null;
|
|
40193
|
+
}
|
|
40194
|
+
const code = Reflect.get(error62, "code");
|
|
40195
|
+
return typeof code === "string" && code.length > 0 ? code : null;
|
|
40196
|
+
} catch {
|
|
40197
|
+
return null;
|
|
40198
|
+
}
|
|
40199
|
+
}
|
|
39863
40200
|
function activeTurnReconciliationEndpoint(config2, turn) {
|
|
39864
40201
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
39865
40202
|
let channelPath = "";
|
|
@@ -39897,12 +40234,15 @@ async function reconcileActiveTurn(config2, turn, signal) {
|
|
|
39897
40234
|
{ cause: error62 }
|
|
39898
40235
|
);
|
|
39899
40236
|
}
|
|
39900
|
-
await response.body?.cancel();
|
|
39901
40237
|
if (!response.ok) {
|
|
40238
|
+
const errorCode = await relayErrorCode(response);
|
|
40239
|
+
const terminal = errorCode !== null && TERMINAL_RECONCILIATION_RELAY_CODES.has(errorCode);
|
|
39902
40240
|
throw new ActiveTurnReconciliationError(
|
|
39903
|
-
`The Relay rejected the active Agent turn reconciliation with status ${response.status.toString()}
|
|
40241
|
+
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()}`,
|
|
40242
|
+
{ relayErrorCode: errorCode, terminal }
|
|
39904
40243
|
);
|
|
39905
40244
|
}
|
|
40245
|
+
await response.body?.cancel();
|
|
39906
40246
|
}
|
|
39907
40247
|
async function reconcileActiveTurns(config2, turns, signal) {
|
|
39908
40248
|
await Promise.all(turns.map(async (turn) => await reconcileActiveTurn(config2, turn, signal)));
|
|
@@ -39911,7 +40251,7 @@ function send(socket, message) {
|
|
|
39911
40251
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
39912
40252
|
throw new Error("Relay connection is not open");
|
|
39913
40253
|
}
|
|
39914
|
-
socket.send(message);
|
|
40254
|
+
socket.send(encodeDaemonToServiceMessage(message));
|
|
39915
40255
|
}
|
|
39916
40256
|
function closeRelaySocket(socket, code, reason) {
|
|
39917
40257
|
try {
|
|
@@ -39945,7 +40285,7 @@ var ConnectedDaemonSessionEventState = class extends DaemonSessionEventConnectio
|
|
|
39945
40285
|
return false;
|
|
39946
40286
|
}
|
|
39947
40287
|
try {
|
|
39948
|
-
this.#socket.send(message);
|
|
40288
|
+
this.#socket.send(encodeDaemonToServiceMessage(message));
|
|
39949
40289
|
return true;
|
|
39950
40290
|
} catch {
|
|
39951
40291
|
return false;
|
|
@@ -39989,17 +40329,17 @@ var DaemonSessionEventPublisher = class {
|
|
|
39989
40329
|
this.#connection = this.#connection.disconnect(socket);
|
|
39990
40330
|
this.#clearInFlight();
|
|
39991
40331
|
};
|
|
39992
|
-
recordAttempt = (sessionId,
|
|
39993
|
-
const
|
|
39994
|
-
if (kind === SESSION_COMPLETED_KIND || kind === SESSION_FAILED_KIND) {
|
|
39995
|
-
this.#outbox.enqueueCritical(sessionId,
|
|
40332
|
+
recordAttempt = (sessionId, event, attemptId) => {
|
|
40333
|
+
const encoded = encodeRecordedSessionEvent(event);
|
|
40334
|
+
if (event.kind === SESSION_COMPLETED_KIND || event.kind === SESSION_FAILED_KIND) {
|
|
40335
|
+
this.#outbox.enqueueCritical(sessionId, encoded, attemptId);
|
|
39996
40336
|
} else {
|
|
39997
|
-
this.#outbox.enqueue(sessionId,
|
|
40337
|
+
this.#outbox.enqueue(sessionId, encoded, attemptId);
|
|
39998
40338
|
}
|
|
39999
40339
|
this.#publishNextBatch();
|
|
40000
40340
|
};
|
|
40001
|
-
recordRuntime = (sessionId,
|
|
40002
|
-
this.#outbox.enqueue(sessionId,
|
|
40341
|
+
recordRuntime = (sessionId, event) => {
|
|
40342
|
+
this.#outbox.enqueue(sessionId, encodeRecordedSessionEvent(event));
|
|
40003
40343
|
this.#publishNextBatch();
|
|
40004
40344
|
};
|
|
40005
40345
|
acknowledge = (acknowledgement) => {
|
|
@@ -40066,7 +40406,7 @@ var DaemonSessionEventPublisher = class {
|
|
|
40066
40406
|
if (this.#inFlightBytes + byteLength > SESSION_EVENT_REPLAY_BYTE_LIMIT) {
|
|
40067
40407
|
continue;
|
|
40068
40408
|
}
|
|
40069
|
-
if (!this.#connection.send(
|
|
40409
|
+
if (!this.#connection.send(envelope2)) {
|
|
40070
40410
|
this.#clearInFlight();
|
|
40071
40411
|
return;
|
|
40072
40412
|
}
|
|
@@ -40160,8 +40500,8 @@ var CoalescingDaemonActivityPublisher = class {
|
|
|
40160
40500
|
}
|
|
40161
40501
|
};
|
|
40162
40502
|
};
|
|
40163
|
-
function
|
|
40164
|
-
return
|
|
40503
|
+
function daemonActivity(command, activity) {
|
|
40504
|
+
return {
|
|
40165
40505
|
activityId: activity.activityId,
|
|
40166
40506
|
activityType: activity.activityType,
|
|
40167
40507
|
commandId: command.commandId,
|
|
@@ -40177,18 +40517,18 @@ function encodeDaemonActivity(command, activity) {
|
|
|
40177
40517
|
status: activity.status,
|
|
40178
40518
|
title: activity.title,
|
|
40179
40519
|
toolKind: activity.toolKind
|
|
40180
|
-
}
|
|
40520
|
+
};
|
|
40181
40521
|
}
|
|
40182
40522
|
function reportFailure(publisher, command, code, message, attemptId) {
|
|
40183
40523
|
publisher.recordAttempt(
|
|
40184
40524
|
command.sessionId,
|
|
40185
|
-
|
|
40525
|
+
{
|
|
40186
40526
|
code,
|
|
40187
40527
|
commandId: command.commandId,
|
|
40188
40528
|
kind: SESSION_FAILED_KIND,
|
|
40189
40529
|
message,
|
|
40190
40530
|
sessionId: command.sessionId
|
|
40191
|
-
}
|
|
40531
|
+
},
|
|
40192
40532
|
attemptId
|
|
40193
40533
|
);
|
|
40194
40534
|
}
|
|
@@ -40208,17 +40548,14 @@ function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTi
|
|
|
40208
40548
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40209
40549
|
return;
|
|
40210
40550
|
}
|
|
40211
|
-
send(
|
|
40212
|
-
|
|
40213
|
-
|
|
40214
|
-
|
|
40215
|
-
|
|
40216
|
-
|
|
40217
|
-
|
|
40218
|
-
|
|
40219
|
-
sessionId
|
|
40220
|
-
})
|
|
40221
|
-
);
|
|
40551
|
+
send(socket, {
|
|
40552
|
+
code: operationErrorCode(error62),
|
|
40553
|
+
kind: "session.operation.failed",
|
|
40554
|
+
message: operationErrorMessage(error62),
|
|
40555
|
+
requestId,
|
|
40556
|
+
...runtimeTimings.length === 0 ? {} : { runtimeTimings },
|
|
40557
|
+
sessionId
|
|
40558
|
+
});
|
|
40222
40559
|
}
|
|
40223
40560
|
async function resolveSessionDirectories(directories, bindingId, directoryId2, additionalDirectoryIds, signal) {
|
|
40224
40561
|
const cwd = await directories.resolve(bindingId, directoryId2, signal);
|
|
@@ -40410,18 +40747,15 @@ async function executeWorkspaceList(socket, command, directories, audit, signal)
|
|
|
40410
40747
|
event: "workspace_list_authorized",
|
|
40411
40748
|
sessionId: "workspace-browser"
|
|
40412
40749
|
});
|
|
40413
|
-
send(
|
|
40414
|
-
|
|
40415
|
-
|
|
40416
|
-
|
|
40417
|
-
|
|
40418
|
-
|
|
40419
|
-
|
|
40420
|
-
|
|
40421
|
-
|
|
40422
|
-
requestId: command.requestId
|
|
40423
|
-
})
|
|
40424
|
-
);
|
|
40750
|
+
send(socket, {
|
|
40751
|
+
bindingId: command.bindingId,
|
|
40752
|
+
directoryId: listing.directoryId,
|
|
40753
|
+
directoryLabel: listing.directoryLabel,
|
|
40754
|
+
entries: listing.entries,
|
|
40755
|
+
kind: "workspace.entries",
|
|
40756
|
+
parentDirectoryId: listing.parentDirectoryId,
|
|
40757
|
+
requestId: command.requestId
|
|
40758
|
+
});
|
|
40425
40759
|
} catch (error62) {
|
|
40426
40760
|
reportOperationFailure(socket, command.requestId, "", error62);
|
|
40427
40761
|
}
|
|
@@ -40476,15 +40810,12 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40476
40810
|
event: "session_configured",
|
|
40477
40811
|
sessionId: command.sessionId
|
|
40478
40812
|
});
|
|
40479
|
-
publisher.recordRuntime(
|
|
40480
|
-
|
|
40481
|
-
|
|
40482
|
-
|
|
40483
|
-
|
|
40484
|
-
|
|
40485
|
-
sessionId: command.sessionId
|
|
40486
|
-
})
|
|
40487
|
-
);
|
|
40813
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40814
|
+
configOptions,
|
|
40815
|
+
kind: "session.config.updated",
|
|
40816
|
+
requestId: command.requestId,
|
|
40817
|
+
sessionId: command.sessionId
|
|
40818
|
+
});
|
|
40488
40819
|
}
|
|
40489
40820
|
const event = {
|
|
40490
40821
|
additionalDirectories: resolved.additionalDirectoryEntries,
|
|
@@ -40503,17 +40834,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40503
40834
|
runtimeTimings: metrics.snapshot()
|
|
40504
40835
|
};
|
|
40505
40836
|
metrics.measureSync("readiness-commit", () => {
|
|
40506
|
-
publisher.recordRuntime(command.sessionId,
|
|
40837
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40507
40838
|
});
|
|
40508
40839
|
return event;
|
|
40509
40840
|
});
|
|
40510
|
-
send(
|
|
40511
|
-
|
|
40512
|
-
|
|
40513
|
-
|
|
40514
|
-
runtimeTimings: metrics.snapshot()
|
|
40515
|
-
})
|
|
40516
|
-
);
|
|
40841
|
+
send(socket, {
|
|
40842
|
+
...readyEvent,
|
|
40843
|
+
runtimeTimings: metrics.snapshot()
|
|
40844
|
+
});
|
|
40517
40845
|
} catch (error62) {
|
|
40518
40846
|
audit.record({
|
|
40519
40847
|
commandId: command.requestId,
|
|
@@ -40553,15 +40881,12 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40553
40881
|
event: "session_configured",
|
|
40554
40882
|
sessionId: command.sessionId
|
|
40555
40883
|
});
|
|
40556
|
-
publisher.recordRuntime(
|
|
40557
|
-
|
|
40558
|
-
|
|
40559
|
-
|
|
40560
|
-
|
|
40561
|
-
|
|
40562
|
-
sessionId: command.sessionId
|
|
40563
|
-
})
|
|
40564
|
-
);
|
|
40884
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40885
|
+
configOptions,
|
|
40886
|
+
kind: "session.config.updated",
|
|
40887
|
+
requestId: command.requestId,
|
|
40888
|
+
sessionId: command.sessionId
|
|
40889
|
+
});
|
|
40565
40890
|
} catch (error62) {
|
|
40566
40891
|
if (signal.aborted) {
|
|
40567
40892
|
signal.throwIfAborted();
|
|
@@ -40571,20 +40896,20 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40571
40896
|
}
|
|
40572
40897
|
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
40573
40898
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity) => {
|
|
40574
|
-
publisher.recordAttempt(command.sessionId,
|
|
40899
|
+
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity), attemptId);
|
|
40575
40900
|
});
|
|
40576
40901
|
const text3 = new CoalescingTextPublisher(
|
|
40577
40902
|
timer,
|
|
40578
40903
|
(messageId, delta) => {
|
|
40579
40904
|
publisher.recordAttempt(
|
|
40580
40905
|
command.sessionId,
|
|
40581
|
-
|
|
40906
|
+
{
|
|
40582
40907
|
commandId: command.commandId,
|
|
40583
40908
|
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40584
40909
|
messageId,
|
|
40585
40910
|
sessionId: command.sessionId,
|
|
40586
40911
|
text: delta
|
|
40587
|
-
}
|
|
40912
|
+
},
|
|
40588
40913
|
attemptId
|
|
40589
40914
|
);
|
|
40590
40915
|
},
|
|
@@ -40643,12 +40968,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40643
40968
|
outbox.transitionExecution(command.commandId, "running");
|
|
40644
40969
|
publisher.recordAttempt(
|
|
40645
40970
|
command.sessionId,
|
|
40646
|
-
|
|
40971
|
+
{
|
|
40647
40972
|
commandId: command.commandId,
|
|
40648
40973
|
kind: SESSION_STARTED_KIND,
|
|
40649
40974
|
attemptId,
|
|
40650
40975
|
sessionId: command.sessionId
|
|
40651
|
-
}
|
|
40976
|
+
},
|
|
40652
40977
|
attemptId
|
|
40653
40978
|
);
|
|
40654
40979
|
activateAttempt();
|
|
@@ -40693,12 +41018,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40693
41018
|
activities.flush();
|
|
40694
41019
|
publisher.recordAttempt(
|
|
40695
41020
|
command.sessionId,
|
|
40696
|
-
|
|
41021
|
+
{
|
|
40697
41022
|
commandId: command.commandId,
|
|
40698
41023
|
kind: SESSION_COMPLETED_KIND,
|
|
40699
41024
|
sessionId: command.sessionId,
|
|
40700
41025
|
stopReason
|
|
40701
|
-
}
|
|
41026
|
+
},
|
|
40702
41027
|
attemptId
|
|
40703
41028
|
);
|
|
40704
41029
|
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
@@ -41122,9 +41447,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41122
41447
|
}
|
|
41123
41448
|
};
|
|
41124
41449
|
const processDeliveredPayload = async (delivery) => {
|
|
41125
|
-
const
|
|
41450
|
+
const message = decodeServiceToDaemonMessage(delivery.payload);
|
|
41451
|
+
const kind = message.kind;
|
|
41126
41452
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41127
|
-
const cancellation =
|
|
41453
|
+
const cancellation = message;
|
|
41128
41454
|
if (cancellation.sessionId !== delivery.sessionId) {
|
|
41129
41455
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41130
41456
|
}
|
|
@@ -41141,7 +41467,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41141
41467
|
return;
|
|
41142
41468
|
}
|
|
41143
41469
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41144
|
-
const command =
|
|
41470
|
+
const command = message;
|
|
41145
41471
|
if (command.sessionId !== delivery.sessionId) {
|
|
41146
41472
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41147
41473
|
}
|
|
@@ -41158,7 +41484,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41158
41484
|
return;
|
|
41159
41485
|
}
|
|
41160
41486
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41161
|
-
const command =
|
|
41487
|
+
const command = message;
|
|
41162
41488
|
if (command.sessionId !== delivery.sessionId) {
|
|
41163
41489
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41164
41490
|
}
|
|
@@ -41175,7 +41501,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41175
41501
|
return;
|
|
41176
41502
|
}
|
|
41177
41503
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41178
|
-
const command =
|
|
41504
|
+
const command = message;
|
|
41179
41505
|
if (command.sessionId !== delivery.sessionId) {
|
|
41180
41506
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41181
41507
|
}
|
|
@@ -41192,7 +41518,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41192
41518
|
return;
|
|
41193
41519
|
}
|
|
41194
41520
|
if (kind === SESSION_PROMPT_KIND) {
|
|
41195
|
-
const command =
|
|
41521
|
+
const command = message;
|
|
41196
41522
|
await processDeliveredPrompt(
|
|
41197
41523
|
delivery,
|
|
41198
41524
|
command,
|
|
@@ -41236,18 +41562,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41236
41562
|
}).finally(() => processingDeliveryIds.delete(delivery.deliveryId));
|
|
41237
41563
|
};
|
|
41238
41564
|
const receiveRuntimeDelivery = (delivery) => {
|
|
41239
|
-
const
|
|
41565
|
+
const payload = decodeServiceToDaemonMessage(delivery.payload);
|
|
41566
|
+
const payloadKind = payload.kind;
|
|
41240
41567
|
let payloadSessionId = "";
|
|
41241
41568
|
if (payloadKind === SESSION_CANCEL_KIND) {
|
|
41242
|
-
payloadSessionId =
|
|
41569
|
+
payloadSessionId = payload.sessionId;
|
|
41243
41570
|
} else if (payloadKind === SESSION_CONFIGURE_KIND) {
|
|
41244
|
-
payloadSessionId =
|
|
41571
|
+
payloadSessionId = payload.sessionId;
|
|
41245
41572
|
} else if (payloadKind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41246
|
-
payloadSessionId =
|
|
41573
|
+
payloadSessionId = payload.sessionId;
|
|
41247
41574
|
} else if (payloadKind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41248
|
-
payloadSessionId =
|
|
41575
|
+
payloadSessionId = payload.sessionId;
|
|
41249
41576
|
} else if (payloadKind === SESSION_PROMPT_KIND) {
|
|
41250
|
-
payloadSessionId =
|
|
41577
|
+
payloadSessionId = payload.sessionId;
|
|
41251
41578
|
} else {
|
|
41252
41579
|
throw new Error("Runtime delivery contains an unsupported protocol message");
|
|
41253
41580
|
}
|
|
@@ -41255,14 +41582,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41255
41582
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41256
41583
|
}
|
|
41257
41584
|
const stored = outbox.claimRuntimeDelivery(delivery);
|
|
41258
|
-
send(
|
|
41259
|
-
|
|
41260
|
-
|
|
41261
|
-
|
|
41262
|
-
|
|
41263
|
-
sessionId: delivery.sessionId
|
|
41264
|
-
})
|
|
41265
|
-
);
|
|
41585
|
+
send(socket, {
|
|
41586
|
+
deliveryId: delivery.deliveryId,
|
|
41587
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41588
|
+
sessionId: delivery.sessionId
|
|
41589
|
+
});
|
|
41266
41590
|
processRuntimeDelivery(delivery, stored.state);
|
|
41267
41591
|
};
|
|
41268
41592
|
const resumeRuntimeDeliveries = () => {
|
|
@@ -41274,14 +41598,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41274
41598
|
sessionId: stored.sessionId
|
|
41275
41599
|
};
|
|
41276
41600
|
if (stored.state !== "relay_committed") {
|
|
41277
|
-
send(
|
|
41278
|
-
|
|
41279
|
-
|
|
41280
|
-
|
|
41281
|
-
|
|
41282
|
-
sessionId: stored.sessionId
|
|
41283
|
-
})
|
|
41284
|
-
);
|
|
41601
|
+
send(socket, {
|
|
41602
|
+
deliveryId: stored.deliveryId,
|
|
41603
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41604
|
+
sessionId: stored.sessionId
|
|
41605
|
+
});
|
|
41285
41606
|
}
|
|
41286
41607
|
processRuntimeDelivery(delivery, stored.state);
|
|
41287
41608
|
}
|
|
@@ -41340,28 +41661,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41340
41661
|
return;
|
|
41341
41662
|
}
|
|
41342
41663
|
try {
|
|
41343
|
-
const
|
|
41664
|
+
const message = decodeServiceToDaemonMessage(encoded);
|
|
41665
|
+
const kind = message.kind;
|
|
41344
41666
|
if (kind === RUNTIME_DELIVERY_COMMITTED_KIND) {
|
|
41345
|
-
const committed =
|
|
41667
|
+
const committed = message;
|
|
41346
41668
|
if (!outbox.markRuntimeDeliveryCommitted(committed.deliveryId, committed.sessionId)) {
|
|
41347
41669
|
console.warn("Mobius daemon ignored confirmation for an unknown Runtime delivery");
|
|
41348
41670
|
}
|
|
41349
41671
|
return;
|
|
41350
41672
|
}
|
|
41351
41673
|
if (kind === RUNTIME_DELIVERY_KIND) {
|
|
41352
|
-
receiveRuntimeDelivery(
|
|
41674
|
+
receiveRuntimeDelivery(message);
|
|
41353
41675
|
return;
|
|
41354
41676
|
}
|
|
41355
41677
|
if (kind === SESSION_EVENT_ACK_KIND) {
|
|
41356
|
-
publisher.acknowledge(
|
|
41678
|
+
publisher.acknowledge(message);
|
|
41357
41679
|
return;
|
|
41358
41680
|
}
|
|
41359
41681
|
if (kind === SESSION_EVENT_DEFERRED_KIND) {
|
|
41360
|
-
publisher.defer(
|
|
41682
|
+
publisher.defer(message);
|
|
41361
41683
|
return;
|
|
41362
41684
|
}
|
|
41363
41685
|
if (kind === SESSION_EVENT_REJECTED_KIND) {
|
|
41364
|
-
const rejection =
|
|
41686
|
+
const rejection = message;
|
|
41365
41687
|
if (publisher.quarantine(rejection)) {
|
|
41366
41688
|
audit.record({
|
|
41367
41689
|
commandId: rejection.eventId,
|
|
@@ -41375,7 +41697,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41375
41697
|
return;
|
|
41376
41698
|
}
|
|
41377
41699
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
41378
|
-
const command2 =
|
|
41700
|
+
const command2 = message;
|
|
41379
41701
|
const pending = nativeRequests.get(command2.requestId);
|
|
41380
41702
|
if (pending?.sessionId === command2.sessionId) {
|
|
41381
41703
|
pending.controller.abort(
|
|
@@ -41389,35 +41711,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41389
41711
|
return;
|
|
41390
41712
|
}
|
|
41391
41713
|
if (kind === AGENT_SETTINGS_DISCOVER_KIND) {
|
|
41392
|
-
const command2 =
|
|
41714
|
+
const command2 = message;
|
|
41393
41715
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
41394
41716
|
(request) => request.agentId === command2.agentId && !request.controller.signal.aborted
|
|
41395
41717
|
);
|
|
41396
41718
|
if (agentSettingsDiscoveries.has(command2.requestId) || existing !== void 0) {
|
|
41397
41719
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41398
|
-
send(
|
|
41399
|
-
|
|
41400
|
-
|
|
41401
|
-
|
|
41402
|
-
|
|
41403
|
-
|
|
41404
|
-
requestId: command2.requestId
|
|
41405
|
-
})
|
|
41406
|
-
);
|
|
41720
|
+
send(socket, {
|
|
41721
|
+
code: "agent_settings_discovery_busy",
|
|
41722
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41723
|
+
message: "Another settings discovery is already running for this Agent",
|
|
41724
|
+
requestId: command2.requestId
|
|
41725
|
+
});
|
|
41407
41726
|
}
|
|
41408
41727
|
return;
|
|
41409
41728
|
}
|
|
41410
41729
|
if (agentSettingsDiscoveries.size >= 4) {
|
|
41411
41730
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41412
|
-
send(
|
|
41413
|
-
|
|
41414
|
-
|
|
41415
|
-
|
|
41416
|
-
|
|
41417
|
-
|
|
41418
|
-
requestId: command2.requestId
|
|
41419
|
-
})
|
|
41420
|
-
);
|
|
41731
|
+
send(socket, {
|
|
41732
|
+
code: "agent_settings_discovery_busy",
|
|
41733
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41734
|
+
message: "Too many Agent settings discoveries are running",
|
|
41735
|
+
requestId: command2.requestId
|
|
41736
|
+
});
|
|
41421
41737
|
}
|
|
41422
41738
|
return;
|
|
41423
41739
|
}
|
|
@@ -41449,7 +41765,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41449
41765
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41450
41766
|
});
|
|
41451
41767
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41452
|
-
send(socket,
|
|
41768
|
+
send(socket, result);
|
|
41453
41769
|
}
|
|
41454
41770
|
} catch (error62) {
|
|
41455
41771
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41464,15 +41780,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41464
41780
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41465
41781
|
});
|
|
41466
41782
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41467
|
-
send(
|
|
41468
|
-
|
|
41469
|
-
|
|
41470
|
-
|
|
41471
|
-
|
|
41472
|
-
|
|
41473
|
-
requestId: command2.requestId
|
|
41474
|
-
})
|
|
41475
|
-
);
|
|
41783
|
+
send(socket, {
|
|
41784
|
+
code: operationErrorCode(failure2),
|
|
41785
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41786
|
+
message: operationErrorMessage(failure2),
|
|
41787
|
+
requestId: command2.requestId
|
|
41788
|
+
});
|
|
41476
41789
|
}
|
|
41477
41790
|
} finally {
|
|
41478
41791
|
timeout.cancel();
|
|
@@ -41487,18 +41800,15 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41487
41800
|
return;
|
|
41488
41801
|
}
|
|
41489
41802
|
if (kind === AGENT_CATALOG_REFRESH_KIND) {
|
|
41490
|
-
const command2 =
|
|
41803
|
+
const command2 = message;
|
|
41491
41804
|
if (agentCatalogRefreshes.has(command2.requestId) || agentCatalogRefreshes.size > 0) {
|
|
41492
41805
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41493
|
-
send(
|
|
41494
|
-
|
|
41495
|
-
|
|
41496
|
-
|
|
41497
|
-
|
|
41498
|
-
|
|
41499
|
-
requestId: command2.requestId
|
|
41500
|
-
})
|
|
41501
|
-
);
|
|
41806
|
+
send(socket, {
|
|
41807
|
+
code: "agent_catalog_refresh_busy",
|
|
41808
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41809
|
+
message: "Another local Agent catalog refresh is already running",
|
|
41810
|
+
requestId: command2.requestId
|
|
41811
|
+
});
|
|
41502
41812
|
}
|
|
41503
41813
|
return;
|
|
41504
41814
|
}
|
|
@@ -41523,13 +41833,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41523
41833
|
sessionId: "agent-catalog"
|
|
41524
41834
|
});
|
|
41525
41835
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41526
|
-
send(
|
|
41527
|
-
|
|
41528
|
-
|
|
41529
|
-
|
|
41530
|
-
requestId: command2.requestId
|
|
41531
|
-
})
|
|
41532
|
-
);
|
|
41836
|
+
send(socket, {
|
|
41837
|
+
kind: AGENT_CATALOG_REFRESHED_KIND,
|
|
41838
|
+
requestId: command2.requestId
|
|
41839
|
+
});
|
|
41533
41840
|
}
|
|
41534
41841
|
} catch (error62) {
|
|
41535
41842
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41544,15 +41851,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41544
41851
|
sessionId: "agent-catalog"
|
|
41545
41852
|
});
|
|
41546
41853
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41547
|
-
send(
|
|
41548
|
-
|
|
41549
|
-
|
|
41550
|
-
|
|
41551
|
-
|
|
41552
|
-
|
|
41553
|
-
requestId: command2.requestId
|
|
41554
|
-
})
|
|
41555
|
-
);
|
|
41854
|
+
send(socket, {
|
|
41855
|
+
code: operationErrorCode(failure2),
|
|
41856
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41857
|
+
message: operationErrorMessage(failure2),
|
|
41858
|
+
requestId: command2.requestId
|
|
41859
|
+
});
|
|
41556
41860
|
}
|
|
41557
41861
|
} finally {
|
|
41558
41862
|
timeout.cancel();
|
|
@@ -41563,7 +41867,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41563
41867
|
return;
|
|
41564
41868
|
}
|
|
41565
41869
|
if (kind === NATIVE_SESSION_REQUEST_KIND) {
|
|
41566
|
-
const command2 =
|
|
41870
|
+
const command2 = message;
|
|
41567
41871
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41568
41872
|
(request) => request.agentId === command2.agentId
|
|
41569
41873
|
);
|
|
@@ -41616,7 +41920,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41616
41920
|
operationSignal.throwIfAborted();
|
|
41617
41921
|
const result = await nativeSessions.execute(command2, operationSignal);
|
|
41618
41922
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41619
|
-
send(socket,
|
|
41923
|
+
send(socket, result);
|
|
41620
41924
|
}
|
|
41621
41925
|
} catch (error62) {
|
|
41622
41926
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41645,7 +41949,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41645
41949
|
return;
|
|
41646
41950
|
}
|
|
41647
41951
|
if (kind === NATIVE_SESSION_TURN_FORK_KIND) {
|
|
41648
|
-
const command2 =
|
|
41952
|
+
const command2 = message;
|
|
41649
41953
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41650
41954
|
(request) => request.agentId === command2.agentId
|
|
41651
41955
|
);
|
|
@@ -41696,7 +42000,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41696
42000
|
operationSignal.throwIfAborted();
|
|
41697
42001
|
const result = await nativeSessions.executeTurnFork(command2, operationSignal);
|
|
41698
42002
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41699
|
-
send(socket,
|
|
42003
|
+
send(socket, result);
|
|
41700
42004
|
}
|
|
41701
42005
|
} catch (error62) {
|
|
41702
42006
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41725,39 +42029,35 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41725
42029
|
return;
|
|
41726
42030
|
}
|
|
41727
42031
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
41728
|
-
decodeRuntimeLivenessReadyEvent(encoded);
|
|
41729
42032
|
connectionLiveness.start();
|
|
41730
42033
|
return;
|
|
41731
42034
|
}
|
|
41732
42035
|
if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
|
|
41733
|
-
connectionLiveness.acknowledge(
|
|
42036
|
+
connectionLiveness.acknowledge(message);
|
|
41734
42037
|
return;
|
|
41735
42038
|
}
|
|
41736
42039
|
if (kind === FILE_READ_KIND) {
|
|
41737
|
-
const command2 =
|
|
42040
|
+
const command2 = message;
|
|
41738
42041
|
void streamLocalFile(
|
|
41739
42042
|
command2,
|
|
41740
|
-
(
|
|
42043
|
+
(message2) => send(socket, message2),
|
|
41741
42044
|
connectionController.signal
|
|
41742
42045
|
).catch((error62) => {
|
|
41743
42046
|
if (socket.readyState !== WebSocket2.OPEN || connectionController.signal.aborted) {
|
|
41744
42047
|
return;
|
|
41745
42048
|
}
|
|
41746
|
-
send(
|
|
41747
|
-
|
|
41748
|
-
|
|
41749
|
-
|
|
41750
|
-
|
|
41751
|
-
|
|
41752
|
-
|
|
41753
|
-
sessionId: command2.sessionId
|
|
41754
|
-
})
|
|
41755
|
-
);
|
|
42049
|
+
send(socket, {
|
|
42050
|
+
code: "file_unavailable",
|
|
42051
|
+
kind: FILE_FAILED_KIND,
|
|
42052
|
+
message: error62 instanceof Error ? error62.message : "The local file is unavailable",
|
|
42053
|
+
requestId: command2.requestId,
|
|
42054
|
+
sessionId: command2.sessionId
|
|
42055
|
+
});
|
|
41756
42056
|
});
|
|
41757
42057
|
return;
|
|
41758
42058
|
}
|
|
41759
42059
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41760
|
-
const cancellation =
|
|
42060
|
+
const cancellation = message;
|
|
41761
42061
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
41762
42062
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
41763
42063
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -41777,12 +42077,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41777
42077
|
return;
|
|
41778
42078
|
}
|
|
41779
42079
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
41780
|
-
const command2 =
|
|
42080
|
+
const command2 = message;
|
|
41781
42081
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
41782
42082
|
return;
|
|
41783
42083
|
}
|
|
41784
42084
|
if (kind === SESSION_PREPARE_KIND) {
|
|
41785
|
-
const command2 =
|
|
42085
|
+
const command2 = message;
|
|
41786
42086
|
void executeSessionPrepare(
|
|
41787
42087
|
publisher,
|
|
41788
42088
|
socket,
|
|
@@ -41796,7 +42096,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41796
42096
|
return;
|
|
41797
42097
|
}
|
|
41798
42098
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41799
|
-
const command2 =
|
|
42099
|
+
const command2 = message;
|
|
41800
42100
|
void executeSessionConfigure(
|
|
41801
42101
|
publisher,
|
|
41802
42102
|
socket,
|
|
@@ -41810,7 +42110,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41810
42110
|
return;
|
|
41811
42111
|
}
|
|
41812
42112
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41813
|
-
const command2 =
|
|
42113
|
+
const command2 = message;
|
|
41814
42114
|
void sessions.respondPermission(command2).then(() => {
|
|
41815
42115
|
audit.record({
|
|
41816
42116
|
commandId: command2.interactionId,
|
|
@@ -41823,7 +42123,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41823
42123
|
return;
|
|
41824
42124
|
}
|
|
41825
42125
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41826
|
-
const command2 =
|
|
42126
|
+
const command2 = message;
|
|
41827
42127
|
void sessions.respondElicitation(command2).then(() => {
|
|
41828
42128
|
audit.record({
|
|
41829
42129
|
commandId: command2.interactionId,
|
|
@@ -41836,14 +42136,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41836
42136
|
return;
|
|
41837
42137
|
}
|
|
41838
42138
|
if (kind === AGENT_INSTALL_REQUEST_KIND) {
|
|
41839
|
-
const command2 =
|
|
42139
|
+
const command2 = message;
|
|
41840
42140
|
void installations.request(command2, signal).catch((error62) => {
|
|
41841
42141
|
console.error("Mobius Agent integration installation failed", error62);
|
|
41842
42142
|
});
|
|
41843
42143
|
return;
|
|
41844
42144
|
}
|
|
41845
42145
|
if (kind === AGENT_INSTALL_CANCEL_KIND) {
|
|
41846
|
-
const command2 =
|
|
42146
|
+
const command2 = message;
|
|
41847
42147
|
void installations.cancel(command2.requestId).catch((error62) => {
|
|
41848
42148
|
reportOperationFailure(socket, command2.requestId, "", error62);
|
|
41849
42149
|
});
|
|
@@ -41852,7 +42152,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41852
42152
|
if (kind !== SESSION_PROMPT_KIND) {
|
|
41853
42153
|
throw new Error("Unsupported protocol message");
|
|
41854
42154
|
}
|
|
41855
|
-
const command =
|
|
42155
|
+
const command = message;
|
|
41856
42156
|
if (activeTurns.has(command.commandId)) {
|
|
41857
42157
|
return;
|
|
41858
42158
|
}
|
|
@@ -41917,6 +42217,24 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41917
42217
|
return;
|
|
41918
42218
|
}
|
|
41919
42219
|
console.error("Mobius daemon could not reconcile active Agent turns", error62);
|
|
42220
|
+
if (error62 instanceof ActiveTurnReconciliationError && error62.terminal) {
|
|
42221
|
+
diagnostics.reconciliationAbandoned(
|
|
42222
|
+
connectionEpoch,
|
|
42223
|
+
error62.relayErrorCode,
|
|
42224
|
+
reconnectingTurns.length
|
|
42225
|
+
);
|
|
42226
|
+
console.error(
|
|
42227
|
+
"Mobius daemon abandoned Agent turns the Relay already settled",
|
|
42228
|
+
error62.relayErrorCode
|
|
42229
|
+
);
|
|
42230
|
+
for (const turn of reconnectingTurns) {
|
|
42231
|
+
activeTurns.delete(turn.command.commandId);
|
|
42232
|
+
turn.abortDaemon();
|
|
42233
|
+
}
|
|
42234
|
+
publisher.connect(socket);
|
|
42235
|
+
resumeRuntimeDeliveries();
|
|
42236
|
+
return;
|
|
42237
|
+
}
|
|
41920
42238
|
failAndClose(
|
|
41921
42239
|
new Error("Active Agent turn reconciliation failed", { cause: error62 }),
|
|
41922
42240
|
ACTIVE_TURN_RECONCILIATION_CLOSE_CODE,
|
|
@@ -41955,13 +42273,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
41955
42273
|
const publisher = new DaemonSessionEventPublisher(outbox, timer);
|
|
41956
42274
|
const activeTurns = /* @__PURE__ */ new Map();
|
|
41957
42275
|
const activeAttemptIds = /* @__PURE__ */ new Map();
|
|
41958
|
-
const recordSessionEvent = (sessionId,
|
|
42276
|
+
const recordSessionEvent = (sessionId, event) => {
|
|
41959
42277
|
const attemptId = activeAttemptIds.get(sessionId);
|
|
41960
42278
|
if (attemptId === void 0) {
|
|
41961
|
-
publisher.recordRuntime(sessionId,
|
|
42279
|
+
publisher.recordRuntime(sessionId, event);
|
|
41962
42280
|
return;
|
|
41963
42281
|
}
|
|
41964
|
-
publisher.recordAttempt(sessionId,
|
|
42282
|
+
publisher.recordAttempt(sessionId, event, attemptId);
|
|
41965
42283
|
};
|
|
41966
42284
|
const sessions = new AcpSessionManager(new DaemonAcpObserver(config2, recordSessionEvent), sessionStore);
|
|
41967
42285
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|