@moxt-ai/mobius 0.0.59 → 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 +583 -328
- package/dist/cli.js.map +4 -4
- package/dist/index.js +582 -327
- package/dist/index.js.map +4 -4
- 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 +114 -112
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +591 -336
- 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(
|
|
20834
|
+
function encodeSessionPromptCommand(message) {
|
|
20835
|
+
return JSON.stringify(decodeSessionPromptCommand(JSON.stringify(message)));
|
|
20810
20836
|
}
|
|
20811
|
-
function
|
|
20812
|
-
return JSON.stringify(
|
|
20837
|
+
function encodeSessionCancelCommand(message) {
|
|
20838
|
+
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
20813
20839
|
}
|
|
20814
|
-
function
|
|
20815
|
-
return JSON.stringify(
|
|
20840
|
+
function encodeRuntimeLivenessReadyEvent(message) {
|
|
20841
|
+
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
20816
20842
|
}
|
|
20817
|
-
function
|
|
20818
|
-
return JSON.stringify(
|
|
20819
|
-
}
|
|
20820
|
-
function encodeAgentActivityEvent(message) {
|
|
20821
|
-
return JSON.stringify(decodeAgentActivityEvent(JSON.stringify(message)));
|
|
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;
|
|
20845
|
-
}
|
|
20846
|
-
function mobiusApiPath(resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
20847
|
-
return `${parseMobiusApiPrefix(apiPrefix)}${resourcePath}`;
|
|
20852
|
+
function encodeRuntimeDeliveryReceived(message) {
|
|
20853
|
+
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
20848
20854
|
}
|
|
20849
|
-
function
|
|
20850
|
-
return
|
|
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;
|
|
@@ -39067,12 +39379,10 @@ var RelayConnectionLiveness = class {
|
|
|
39067
39379
|
heartbeatId,
|
|
39068
39380
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
39069
39381
|
);
|
|
39070
|
-
const sent = this.#transport.send(
|
|
39071
|
-
|
|
39072
|
-
|
|
39073
|
-
|
|
39074
|
-
})
|
|
39075
|
-
);
|
|
39382
|
+
const sent = this.#transport.send({
|
|
39383
|
+
heartbeatId,
|
|
39384
|
+
kind: RUNTIME_HEARTBEAT_KIND
|
|
39385
|
+
});
|
|
39076
39386
|
if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
|
|
39077
39387
|
this.#state.timeout.cancel();
|
|
39078
39388
|
this.#state = new FinishedRelayLivenessState();
|
|
@@ -39692,39 +40002,39 @@ var DaemonAcpObserver = class {
|
|
|
39692
40002
|
}
|
|
39693
40003
|
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39694
40004
|
onCommands = (event) => {
|
|
39695
|
-
this.#record(event.sessionId,
|
|
40005
|
+
this.#record(event.sessionId, event);
|
|
39696
40006
|
return Promise.resolve();
|
|
39697
40007
|
};
|
|
39698
40008
|
onConfig = (event) => {
|
|
39699
|
-
this.#record(event.sessionId,
|
|
40009
|
+
this.#record(event.sessionId, event);
|
|
39700
40010
|
return Promise.resolve();
|
|
39701
40011
|
};
|
|
39702
40012
|
onContent = (event) => {
|
|
39703
|
-
this.#record(event.sessionId,
|
|
40013
|
+
this.#record(event.sessionId, event);
|
|
39704
40014
|
return Promise.resolve();
|
|
39705
40015
|
};
|
|
39706
40016
|
onElicitation = (event) => {
|
|
39707
|
-
this.#record(event.sessionId,
|
|
40017
|
+
this.#record(event.sessionId, event);
|
|
39708
40018
|
return Promise.resolve();
|
|
39709
40019
|
};
|
|
39710
40020
|
onElicitationResolved = (event) => {
|
|
39711
|
-
this.#record(event.sessionId,
|
|
40021
|
+
this.#record(event.sessionId, event);
|
|
39712
40022
|
return Promise.resolve();
|
|
39713
40023
|
};
|
|
39714
40024
|
onInfo = (event) => {
|
|
39715
|
-
this.#record(event.sessionId,
|
|
40025
|
+
this.#record(event.sessionId, event);
|
|
39716
40026
|
return Promise.resolve();
|
|
39717
40027
|
};
|
|
39718
40028
|
onPermission = (event) => {
|
|
39719
|
-
this.#record(event.sessionId,
|
|
40029
|
+
this.#record(event.sessionId, event);
|
|
39720
40030
|
return Promise.resolve();
|
|
39721
40031
|
};
|
|
39722
40032
|
onPermissionResolved = (event) => {
|
|
39723
|
-
this.#record(event.sessionId,
|
|
40033
|
+
this.#record(event.sessionId, event);
|
|
39724
40034
|
return Promise.resolve();
|
|
39725
40035
|
};
|
|
39726
40036
|
onUsage = (event) => {
|
|
39727
|
-
this.#record(event.sessionId,
|
|
40037
|
+
this.#record(event.sessionId, event);
|
|
39728
40038
|
return Promise.resolve();
|
|
39729
40039
|
};
|
|
39730
40040
|
};
|
|
@@ -39773,60 +40083,45 @@ var DaemonInstallationObserver = class {
|
|
|
39773
40083
|
if (state instanceof RunningInstallation) {
|
|
39774
40084
|
if (!this.#started.has(state.requestId)) {
|
|
39775
40085
|
this.#started.add(state.requestId);
|
|
39776
|
-
this.#send(
|
|
39777
|
-
socket,
|
|
39778
|
-
encodeAgentInstallStartedEvent({
|
|
39779
|
-
agentId: state.agentId,
|
|
39780
|
-
kind: AGENT_INSTALL_STARTED_KIND,
|
|
39781
|
-
requestId: state.requestId
|
|
39782
|
-
})
|
|
39783
|
-
);
|
|
39784
|
-
}
|
|
39785
|
-
this.#send(
|
|
39786
|
-
socket,
|
|
39787
|
-
encodeAgentInstallProgressEvent({
|
|
40086
|
+
this.#send(socket, {
|
|
39788
40087
|
agentId: state.agentId,
|
|
39789
|
-
kind:
|
|
39790
|
-
requestId: state.requestId
|
|
39791
|
-
|
|
39792
|
-
|
|
39793
|
-
|
|
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
|
+
});
|
|
39794
40098
|
return Promise.resolve();
|
|
39795
40099
|
}
|
|
39796
40100
|
if (state instanceof SucceededInstallation) {
|
|
39797
|
-
this.#send(
|
|
39798
|
-
|
|
39799
|
-
|
|
39800
|
-
|
|
39801
|
-
|
|
39802
|
-
|
|
39803
|
-
requestId: state.requestId
|
|
39804
|
-
})
|
|
39805
|
-
);
|
|
40101
|
+
this.#send(socket, {
|
|
40102
|
+
agentId: state.agentId,
|
|
40103
|
+
authenticationMayBeRequired: state.authenticationMayBeRequired,
|
|
40104
|
+
kind: AGENT_INSTALL_COMPLETED_KIND,
|
|
40105
|
+
requestId: state.requestId
|
|
40106
|
+
});
|
|
39806
40107
|
return Promise.resolve();
|
|
39807
40108
|
}
|
|
39808
40109
|
if (state instanceof FailedInstallation) {
|
|
39809
|
-
this.#send(
|
|
39810
|
-
|
|
39811
|
-
|
|
39812
|
-
|
|
39813
|
-
|
|
39814
|
-
|
|
39815
|
-
|
|
39816
|
-
requestId: state.requestId
|
|
39817
|
-
})
|
|
39818
|
-
);
|
|
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
|
+
});
|
|
39819
40117
|
return Promise.resolve();
|
|
39820
40118
|
}
|
|
39821
40119
|
if (state instanceof CancelledInstallation) {
|
|
39822
|
-
this.#send(
|
|
39823
|
-
|
|
39824
|
-
|
|
39825
|
-
|
|
39826
|
-
|
|
39827
|
-
requestId: state.requestId
|
|
39828
|
-
})
|
|
39829
|
-
);
|
|
40120
|
+
this.#send(socket, {
|
|
40121
|
+
agentId: state.agentId,
|
|
40122
|
+
kind: AGENT_INSTALL_CANCELLED_KIND,
|
|
40123
|
+
requestId: state.requestId
|
|
40124
|
+
});
|
|
39830
40125
|
return Promise.resolve();
|
|
39831
40126
|
}
|
|
39832
40127
|
throw new Error("Unsupported Agent integration installation state");
|
|
@@ -39956,7 +40251,7 @@ function send(socket, message) {
|
|
|
39956
40251
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
39957
40252
|
throw new Error("Relay connection is not open");
|
|
39958
40253
|
}
|
|
39959
|
-
socket.send(message);
|
|
40254
|
+
socket.send(encodeDaemonToServiceMessage(message));
|
|
39960
40255
|
}
|
|
39961
40256
|
function closeRelaySocket(socket, code, reason) {
|
|
39962
40257
|
try {
|
|
@@ -39990,7 +40285,7 @@ var ConnectedDaemonSessionEventState = class extends DaemonSessionEventConnectio
|
|
|
39990
40285
|
return false;
|
|
39991
40286
|
}
|
|
39992
40287
|
try {
|
|
39993
|
-
this.#socket.send(message);
|
|
40288
|
+
this.#socket.send(encodeDaemonToServiceMessage(message));
|
|
39994
40289
|
return true;
|
|
39995
40290
|
} catch {
|
|
39996
40291
|
return false;
|
|
@@ -40034,17 +40329,17 @@ var DaemonSessionEventPublisher = class {
|
|
|
40034
40329
|
this.#connection = this.#connection.disconnect(socket);
|
|
40035
40330
|
this.#clearInFlight();
|
|
40036
40331
|
};
|
|
40037
|
-
recordAttempt = (sessionId,
|
|
40038
|
-
const
|
|
40039
|
-
if (kind === SESSION_COMPLETED_KIND || kind === SESSION_FAILED_KIND) {
|
|
40040
|
-
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);
|
|
40041
40336
|
} else {
|
|
40042
|
-
this.#outbox.enqueue(sessionId,
|
|
40337
|
+
this.#outbox.enqueue(sessionId, encoded, attemptId);
|
|
40043
40338
|
}
|
|
40044
40339
|
this.#publishNextBatch();
|
|
40045
40340
|
};
|
|
40046
|
-
recordRuntime = (sessionId,
|
|
40047
|
-
this.#outbox.enqueue(sessionId,
|
|
40341
|
+
recordRuntime = (sessionId, event) => {
|
|
40342
|
+
this.#outbox.enqueue(sessionId, encodeRecordedSessionEvent(event));
|
|
40048
40343
|
this.#publishNextBatch();
|
|
40049
40344
|
};
|
|
40050
40345
|
acknowledge = (acknowledgement) => {
|
|
@@ -40111,7 +40406,7 @@ var DaemonSessionEventPublisher = class {
|
|
|
40111
40406
|
if (this.#inFlightBytes + byteLength > SESSION_EVENT_REPLAY_BYTE_LIMIT) {
|
|
40112
40407
|
continue;
|
|
40113
40408
|
}
|
|
40114
|
-
if (!this.#connection.send(
|
|
40409
|
+
if (!this.#connection.send(envelope2)) {
|
|
40115
40410
|
this.#clearInFlight();
|
|
40116
40411
|
return;
|
|
40117
40412
|
}
|
|
@@ -40205,8 +40500,8 @@ var CoalescingDaemonActivityPublisher = class {
|
|
|
40205
40500
|
}
|
|
40206
40501
|
};
|
|
40207
40502
|
};
|
|
40208
|
-
function
|
|
40209
|
-
return
|
|
40503
|
+
function daemonActivity(command, activity) {
|
|
40504
|
+
return {
|
|
40210
40505
|
activityId: activity.activityId,
|
|
40211
40506
|
activityType: activity.activityType,
|
|
40212
40507
|
commandId: command.commandId,
|
|
@@ -40222,18 +40517,18 @@ function encodeDaemonActivity(command, activity) {
|
|
|
40222
40517
|
status: activity.status,
|
|
40223
40518
|
title: activity.title,
|
|
40224
40519
|
toolKind: activity.toolKind
|
|
40225
|
-
}
|
|
40520
|
+
};
|
|
40226
40521
|
}
|
|
40227
40522
|
function reportFailure(publisher, command, code, message, attemptId) {
|
|
40228
40523
|
publisher.recordAttempt(
|
|
40229
40524
|
command.sessionId,
|
|
40230
|
-
|
|
40525
|
+
{
|
|
40231
40526
|
code,
|
|
40232
40527
|
commandId: command.commandId,
|
|
40233
40528
|
kind: SESSION_FAILED_KIND,
|
|
40234
40529
|
message,
|
|
40235
40530
|
sessionId: command.sessionId
|
|
40236
|
-
}
|
|
40531
|
+
},
|
|
40237
40532
|
attemptId
|
|
40238
40533
|
);
|
|
40239
40534
|
}
|
|
@@ -40253,17 +40548,14 @@ function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTi
|
|
|
40253
40548
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40254
40549
|
return;
|
|
40255
40550
|
}
|
|
40256
|
-
send(
|
|
40257
|
-
|
|
40258
|
-
|
|
40259
|
-
|
|
40260
|
-
|
|
40261
|
-
|
|
40262
|
-
|
|
40263
|
-
|
|
40264
|
-
sessionId
|
|
40265
|
-
})
|
|
40266
|
-
);
|
|
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
|
+
});
|
|
40267
40559
|
}
|
|
40268
40560
|
async function resolveSessionDirectories(directories, bindingId, directoryId2, additionalDirectoryIds, signal) {
|
|
40269
40561
|
const cwd = await directories.resolve(bindingId, directoryId2, signal);
|
|
@@ -40455,18 +40747,15 @@ async function executeWorkspaceList(socket, command, directories, audit, signal)
|
|
|
40455
40747
|
event: "workspace_list_authorized",
|
|
40456
40748
|
sessionId: "workspace-browser"
|
|
40457
40749
|
});
|
|
40458
|
-
send(
|
|
40459
|
-
|
|
40460
|
-
|
|
40461
|
-
|
|
40462
|
-
|
|
40463
|
-
|
|
40464
|
-
|
|
40465
|
-
|
|
40466
|
-
|
|
40467
|
-
requestId: command.requestId
|
|
40468
|
-
})
|
|
40469
|
-
);
|
|
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
|
+
});
|
|
40470
40759
|
} catch (error62) {
|
|
40471
40760
|
reportOperationFailure(socket, command.requestId, "", error62);
|
|
40472
40761
|
}
|
|
@@ -40521,15 +40810,12 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40521
40810
|
event: "session_configured",
|
|
40522
40811
|
sessionId: command.sessionId
|
|
40523
40812
|
});
|
|
40524
|
-
publisher.recordRuntime(
|
|
40525
|
-
|
|
40526
|
-
|
|
40527
|
-
|
|
40528
|
-
|
|
40529
|
-
|
|
40530
|
-
sessionId: command.sessionId
|
|
40531
|
-
})
|
|
40532
|
-
);
|
|
40813
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40814
|
+
configOptions,
|
|
40815
|
+
kind: "session.config.updated",
|
|
40816
|
+
requestId: command.requestId,
|
|
40817
|
+
sessionId: command.sessionId
|
|
40818
|
+
});
|
|
40533
40819
|
}
|
|
40534
40820
|
const event = {
|
|
40535
40821
|
additionalDirectories: resolved.additionalDirectoryEntries,
|
|
@@ -40548,17 +40834,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40548
40834
|
runtimeTimings: metrics.snapshot()
|
|
40549
40835
|
};
|
|
40550
40836
|
metrics.measureSync("readiness-commit", () => {
|
|
40551
|
-
publisher.recordRuntime(command.sessionId,
|
|
40837
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40552
40838
|
});
|
|
40553
40839
|
return event;
|
|
40554
40840
|
});
|
|
40555
|
-
send(
|
|
40556
|
-
|
|
40557
|
-
|
|
40558
|
-
|
|
40559
|
-
runtimeTimings: metrics.snapshot()
|
|
40560
|
-
})
|
|
40561
|
-
);
|
|
40841
|
+
send(socket, {
|
|
40842
|
+
...readyEvent,
|
|
40843
|
+
runtimeTimings: metrics.snapshot()
|
|
40844
|
+
});
|
|
40562
40845
|
} catch (error62) {
|
|
40563
40846
|
audit.record({
|
|
40564
40847
|
commandId: command.requestId,
|
|
@@ -40598,15 +40881,12 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40598
40881
|
event: "session_configured",
|
|
40599
40882
|
sessionId: command.sessionId
|
|
40600
40883
|
});
|
|
40601
|
-
publisher.recordRuntime(
|
|
40602
|
-
|
|
40603
|
-
|
|
40604
|
-
|
|
40605
|
-
|
|
40606
|
-
|
|
40607
|
-
sessionId: command.sessionId
|
|
40608
|
-
})
|
|
40609
|
-
);
|
|
40884
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40885
|
+
configOptions,
|
|
40886
|
+
kind: "session.config.updated",
|
|
40887
|
+
requestId: command.requestId,
|
|
40888
|
+
sessionId: command.sessionId
|
|
40889
|
+
});
|
|
40610
40890
|
} catch (error62) {
|
|
40611
40891
|
if (signal.aborted) {
|
|
40612
40892
|
signal.throwIfAborted();
|
|
@@ -40616,20 +40896,20 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40616
40896
|
}
|
|
40617
40897
|
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
40618
40898
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity) => {
|
|
40619
|
-
publisher.recordAttempt(command.sessionId,
|
|
40899
|
+
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity), attemptId);
|
|
40620
40900
|
});
|
|
40621
40901
|
const text3 = new CoalescingTextPublisher(
|
|
40622
40902
|
timer,
|
|
40623
40903
|
(messageId, delta) => {
|
|
40624
40904
|
publisher.recordAttempt(
|
|
40625
40905
|
command.sessionId,
|
|
40626
|
-
|
|
40906
|
+
{
|
|
40627
40907
|
commandId: command.commandId,
|
|
40628
40908
|
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40629
40909
|
messageId,
|
|
40630
40910
|
sessionId: command.sessionId,
|
|
40631
40911
|
text: delta
|
|
40632
|
-
}
|
|
40912
|
+
},
|
|
40633
40913
|
attemptId
|
|
40634
40914
|
);
|
|
40635
40915
|
},
|
|
@@ -40688,12 +40968,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40688
40968
|
outbox.transitionExecution(command.commandId, "running");
|
|
40689
40969
|
publisher.recordAttempt(
|
|
40690
40970
|
command.sessionId,
|
|
40691
|
-
|
|
40971
|
+
{
|
|
40692
40972
|
commandId: command.commandId,
|
|
40693
40973
|
kind: SESSION_STARTED_KIND,
|
|
40694
40974
|
attemptId,
|
|
40695
40975
|
sessionId: command.sessionId
|
|
40696
|
-
}
|
|
40976
|
+
},
|
|
40697
40977
|
attemptId
|
|
40698
40978
|
);
|
|
40699
40979
|
activateAttempt();
|
|
@@ -40738,12 +41018,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40738
41018
|
activities.flush();
|
|
40739
41019
|
publisher.recordAttempt(
|
|
40740
41020
|
command.sessionId,
|
|
40741
|
-
|
|
41021
|
+
{
|
|
40742
41022
|
commandId: command.commandId,
|
|
40743
41023
|
kind: SESSION_COMPLETED_KIND,
|
|
40744
41024
|
sessionId: command.sessionId,
|
|
40745
41025
|
stopReason
|
|
40746
|
-
}
|
|
41026
|
+
},
|
|
40747
41027
|
attemptId
|
|
40748
41028
|
);
|
|
40749
41029
|
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
@@ -41167,9 +41447,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41167
41447
|
}
|
|
41168
41448
|
};
|
|
41169
41449
|
const processDeliveredPayload = async (delivery) => {
|
|
41170
|
-
const
|
|
41450
|
+
const message = decodeServiceToDaemonMessage(delivery.payload);
|
|
41451
|
+
const kind = message.kind;
|
|
41171
41452
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41172
|
-
const cancellation =
|
|
41453
|
+
const cancellation = message;
|
|
41173
41454
|
if (cancellation.sessionId !== delivery.sessionId) {
|
|
41174
41455
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41175
41456
|
}
|
|
@@ -41186,7 +41467,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41186
41467
|
return;
|
|
41187
41468
|
}
|
|
41188
41469
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41189
|
-
const command =
|
|
41470
|
+
const command = message;
|
|
41190
41471
|
if (command.sessionId !== delivery.sessionId) {
|
|
41191
41472
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41192
41473
|
}
|
|
@@ -41203,7 +41484,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41203
41484
|
return;
|
|
41204
41485
|
}
|
|
41205
41486
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41206
|
-
const command =
|
|
41487
|
+
const command = message;
|
|
41207
41488
|
if (command.sessionId !== delivery.sessionId) {
|
|
41208
41489
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41209
41490
|
}
|
|
@@ -41220,7 +41501,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41220
41501
|
return;
|
|
41221
41502
|
}
|
|
41222
41503
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41223
|
-
const command =
|
|
41504
|
+
const command = message;
|
|
41224
41505
|
if (command.sessionId !== delivery.sessionId) {
|
|
41225
41506
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41226
41507
|
}
|
|
@@ -41237,7 +41518,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41237
41518
|
return;
|
|
41238
41519
|
}
|
|
41239
41520
|
if (kind === SESSION_PROMPT_KIND) {
|
|
41240
|
-
const command =
|
|
41521
|
+
const command = message;
|
|
41241
41522
|
await processDeliveredPrompt(
|
|
41242
41523
|
delivery,
|
|
41243
41524
|
command,
|
|
@@ -41281,18 +41562,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41281
41562
|
}).finally(() => processingDeliveryIds.delete(delivery.deliveryId));
|
|
41282
41563
|
};
|
|
41283
41564
|
const receiveRuntimeDelivery = (delivery) => {
|
|
41284
|
-
const
|
|
41565
|
+
const payload = decodeServiceToDaemonMessage(delivery.payload);
|
|
41566
|
+
const payloadKind = payload.kind;
|
|
41285
41567
|
let payloadSessionId = "";
|
|
41286
41568
|
if (payloadKind === SESSION_CANCEL_KIND) {
|
|
41287
|
-
payloadSessionId =
|
|
41569
|
+
payloadSessionId = payload.sessionId;
|
|
41288
41570
|
} else if (payloadKind === SESSION_CONFIGURE_KIND) {
|
|
41289
|
-
payloadSessionId =
|
|
41571
|
+
payloadSessionId = payload.sessionId;
|
|
41290
41572
|
} else if (payloadKind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41291
|
-
payloadSessionId =
|
|
41573
|
+
payloadSessionId = payload.sessionId;
|
|
41292
41574
|
} else if (payloadKind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41293
|
-
payloadSessionId =
|
|
41575
|
+
payloadSessionId = payload.sessionId;
|
|
41294
41576
|
} else if (payloadKind === SESSION_PROMPT_KIND) {
|
|
41295
|
-
payloadSessionId =
|
|
41577
|
+
payloadSessionId = payload.sessionId;
|
|
41296
41578
|
} else {
|
|
41297
41579
|
throw new Error("Runtime delivery contains an unsupported protocol message");
|
|
41298
41580
|
}
|
|
@@ -41300,14 +41582,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41300
41582
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41301
41583
|
}
|
|
41302
41584
|
const stored = outbox.claimRuntimeDelivery(delivery);
|
|
41303
|
-
send(
|
|
41304
|
-
|
|
41305
|
-
|
|
41306
|
-
|
|
41307
|
-
|
|
41308
|
-
sessionId: delivery.sessionId
|
|
41309
|
-
})
|
|
41310
|
-
);
|
|
41585
|
+
send(socket, {
|
|
41586
|
+
deliveryId: delivery.deliveryId,
|
|
41587
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41588
|
+
sessionId: delivery.sessionId
|
|
41589
|
+
});
|
|
41311
41590
|
processRuntimeDelivery(delivery, stored.state);
|
|
41312
41591
|
};
|
|
41313
41592
|
const resumeRuntimeDeliveries = () => {
|
|
@@ -41319,14 +41598,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41319
41598
|
sessionId: stored.sessionId
|
|
41320
41599
|
};
|
|
41321
41600
|
if (stored.state !== "relay_committed") {
|
|
41322
|
-
send(
|
|
41323
|
-
|
|
41324
|
-
|
|
41325
|
-
|
|
41326
|
-
|
|
41327
|
-
sessionId: stored.sessionId
|
|
41328
|
-
})
|
|
41329
|
-
);
|
|
41601
|
+
send(socket, {
|
|
41602
|
+
deliveryId: stored.deliveryId,
|
|
41603
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41604
|
+
sessionId: stored.sessionId
|
|
41605
|
+
});
|
|
41330
41606
|
}
|
|
41331
41607
|
processRuntimeDelivery(delivery, stored.state);
|
|
41332
41608
|
}
|
|
@@ -41385,28 +41661,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41385
41661
|
return;
|
|
41386
41662
|
}
|
|
41387
41663
|
try {
|
|
41388
|
-
const
|
|
41664
|
+
const message = decodeServiceToDaemonMessage(encoded);
|
|
41665
|
+
const kind = message.kind;
|
|
41389
41666
|
if (kind === RUNTIME_DELIVERY_COMMITTED_KIND) {
|
|
41390
|
-
const committed =
|
|
41667
|
+
const committed = message;
|
|
41391
41668
|
if (!outbox.markRuntimeDeliveryCommitted(committed.deliveryId, committed.sessionId)) {
|
|
41392
41669
|
console.warn("Mobius daemon ignored confirmation for an unknown Runtime delivery");
|
|
41393
41670
|
}
|
|
41394
41671
|
return;
|
|
41395
41672
|
}
|
|
41396
41673
|
if (kind === RUNTIME_DELIVERY_KIND) {
|
|
41397
|
-
receiveRuntimeDelivery(
|
|
41674
|
+
receiveRuntimeDelivery(message);
|
|
41398
41675
|
return;
|
|
41399
41676
|
}
|
|
41400
41677
|
if (kind === SESSION_EVENT_ACK_KIND) {
|
|
41401
|
-
publisher.acknowledge(
|
|
41678
|
+
publisher.acknowledge(message);
|
|
41402
41679
|
return;
|
|
41403
41680
|
}
|
|
41404
41681
|
if (kind === SESSION_EVENT_DEFERRED_KIND) {
|
|
41405
|
-
publisher.defer(
|
|
41682
|
+
publisher.defer(message);
|
|
41406
41683
|
return;
|
|
41407
41684
|
}
|
|
41408
41685
|
if (kind === SESSION_EVENT_REJECTED_KIND) {
|
|
41409
|
-
const rejection =
|
|
41686
|
+
const rejection = message;
|
|
41410
41687
|
if (publisher.quarantine(rejection)) {
|
|
41411
41688
|
audit.record({
|
|
41412
41689
|
commandId: rejection.eventId,
|
|
@@ -41420,7 +41697,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41420
41697
|
return;
|
|
41421
41698
|
}
|
|
41422
41699
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
41423
|
-
const command2 =
|
|
41700
|
+
const command2 = message;
|
|
41424
41701
|
const pending = nativeRequests.get(command2.requestId);
|
|
41425
41702
|
if (pending?.sessionId === command2.sessionId) {
|
|
41426
41703
|
pending.controller.abort(
|
|
@@ -41434,35 +41711,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41434
41711
|
return;
|
|
41435
41712
|
}
|
|
41436
41713
|
if (kind === AGENT_SETTINGS_DISCOVER_KIND) {
|
|
41437
|
-
const command2 =
|
|
41714
|
+
const command2 = message;
|
|
41438
41715
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
41439
41716
|
(request) => request.agentId === command2.agentId && !request.controller.signal.aborted
|
|
41440
41717
|
);
|
|
41441
41718
|
if (agentSettingsDiscoveries.has(command2.requestId) || existing !== void 0) {
|
|
41442
41719
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41443
|
-
send(
|
|
41444
|
-
|
|
41445
|
-
|
|
41446
|
-
|
|
41447
|
-
|
|
41448
|
-
|
|
41449
|
-
requestId: command2.requestId
|
|
41450
|
-
})
|
|
41451
|
-
);
|
|
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
|
+
});
|
|
41452
41726
|
}
|
|
41453
41727
|
return;
|
|
41454
41728
|
}
|
|
41455
41729
|
if (agentSettingsDiscoveries.size >= 4) {
|
|
41456
41730
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41457
|
-
send(
|
|
41458
|
-
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41462
|
-
|
|
41463
|
-
requestId: command2.requestId
|
|
41464
|
-
})
|
|
41465
|
-
);
|
|
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
|
+
});
|
|
41466
41737
|
}
|
|
41467
41738
|
return;
|
|
41468
41739
|
}
|
|
@@ -41494,7 +41765,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41494
41765
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41495
41766
|
});
|
|
41496
41767
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41497
|
-
send(socket,
|
|
41768
|
+
send(socket, result);
|
|
41498
41769
|
}
|
|
41499
41770
|
} catch (error62) {
|
|
41500
41771
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41509,15 +41780,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41509
41780
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41510
41781
|
});
|
|
41511
41782
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41512
|
-
send(
|
|
41513
|
-
|
|
41514
|
-
|
|
41515
|
-
|
|
41516
|
-
|
|
41517
|
-
|
|
41518
|
-
requestId: command2.requestId
|
|
41519
|
-
})
|
|
41520
|
-
);
|
|
41783
|
+
send(socket, {
|
|
41784
|
+
code: operationErrorCode(failure2),
|
|
41785
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41786
|
+
message: operationErrorMessage(failure2),
|
|
41787
|
+
requestId: command2.requestId
|
|
41788
|
+
});
|
|
41521
41789
|
}
|
|
41522
41790
|
} finally {
|
|
41523
41791
|
timeout.cancel();
|
|
@@ -41532,18 +41800,15 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41532
41800
|
return;
|
|
41533
41801
|
}
|
|
41534
41802
|
if (kind === AGENT_CATALOG_REFRESH_KIND) {
|
|
41535
|
-
const command2 =
|
|
41803
|
+
const command2 = message;
|
|
41536
41804
|
if (agentCatalogRefreshes.has(command2.requestId) || agentCatalogRefreshes.size > 0) {
|
|
41537
41805
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41538
|
-
send(
|
|
41539
|
-
|
|
41540
|
-
|
|
41541
|
-
|
|
41542
|
-
|
|
41543
|
-
|
|
41544
|
-
requestId: command2.requestId
|
|
41545
|
-
})
|
|
41546
|
-
);
|
|
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
|
+
});
|
|
41547
41812
|
}
|
|
41548
41813
|
return;
|
|
41549
41814
|
}
|
|
@@ -41568,13 +41833,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41568
41833
|
sessionId: "agent-catalog"
|
|
41569
41834
|
});
|
|
41570
41835
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41571
|
-
send(
|
|
41572
|
-
|
|
41573
|
-
|
|
41574
|
-
|
|
41575
|
-
requestId: command2.requestId
|
|
41576
|
-
})
|
|
41577
|
-
);
|
|
41836
|
+
send(socket, {
|
|
41837
|
+
kind: AGENT_CATALOG_REFRESHED_KIND,
|
|
41838
|
+
requestId: command2.requestId
|
|
41839
|
+
});
|
|
41578
41840
|
}
|
|
41579
41841
|
} catch (error62) {
|
|
41580
41842
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41589,15 +41851,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41589
41851
|
sessionId: "agent-catalog"
|
|
41590
41852
|
});
|
|
41591
41853
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41592
|
-
send(
|
|
41593
|
-
|
|
41594
|
-
|
|
41595
|
-
|
|
41596
|
-
|
|
41597
|
-
|
|
41598
|
-
requestId: command2.requestId
|
|
41599
|
-
})
|
|
41600
|
-
);
|
|
41854
|
+
send(socket, {
|
|
41855
|
+
code: operationErrorCode(failure2),
|
|
41856
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41857
|
+
message: operationErrorMessage(failure2),
|
|
41858
|
+
requestId: command2.requestId
|
|
41859
|
+
});
|
|
41601
41860
|
}
|
|
41602
41861
|
} finally {
|
|
41603
41862
|
timeout.cancel();
|
|
@@ -41608,7 +41867,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41608
41867
|
return;
|
|
41609
41868
|
}
|
|
41610
41869
|
if (kind === NATIVE_SESSION_REQUEST_KIND) {
|
|
41611
|
-
const command2 =
|
|
41870
|
+
const command2 = message;
|
|
41612
41871
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41613
41872
|
(request) => request.agentId === command2.agentId
|
|
41614
41873
|
);
|
|
@@ -41661,7 +41920,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41661
41920
|
operationSignal.throwIfAborted();
|
|
41662
41921
|
const result = await nativeSessions.execute(command2, operationSignal);
|
|
41663
41922
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41664
|
-
send(socket,
|
|
41923
|
+
send(socket, result);
|
|
41665
41924
|
}
|
|
41666
41925
|
} catch (error62) {
|
|
41667
41926
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41690,7 +41949,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41690
41949
|
return;
|
|
41691
41950
|
}
|
|
41692
41951
|
if (kind === NATIVE_SESSION_TURN_FORK_KIND) {
|
|
41693
|
-
const command2 =
|
|
41952
|
+
const command2 = message;
|
|
41694
41953
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41695
41954
|
(request) => request.agentId === command2.agentId
|
|
41696
41955
|
);
|
|
@@ -41741,7 +42000,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41741
42000
|
operationSignal.throwIfAborted();
|
|
41742
42001
|
const result = await nativeSessions.executeTurnFork(command2, operationSignal);
|
|
41743
42002
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41744
|
-
send(socket,
|
|
42003
|
+
send(socket, result);
|
|
41745
42004
|
}
|
|
41746
42005
|
} catch (error62) {
|
|
41747
42006
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41770,39 +42029,35 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41770
42029
|
return;
|
|
41771
42030
|
}
|
|
41772
42031
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
41773
|
-
decodeRuntimeLivenessReadyEvent(encoded);
|
|
41774
42032
|
connectionLiveness.start();
|
|
41775
42033
|
return;
|
|
41776
42034
|
}
|
|
41777
42035
|
if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
|
|
41778
|
-
connectionLiveness.acknowledge(
|
|
42036
|
+
connectionLiveness.acknowledge(message);
|
|
41779
42037
|
return;
|
|
41780
42038
|
}
|
|
41781
42039
|
if (kind === FILE_READ_KIND) {
|
|
41782
|
-
const command2 =
|
|
42040
|
+
const command2 = message;
|
|
41783
42041
|
void streamLocalFile(
|
|
41784
42042
|
command2,
|
|
41785
|
-
(
|
|
42043
|
+
(message2) => send(socket, message2),
|
|
41786
42044
|
connectionController.signal
|
|
41787
42045
|
).catch((error62) => {
|
|
41788
42046
|
if (socket.readyState !== WebSocket2.OPEN || connectionController.signal.aborted) {
|
|
41789
42047
|
return;
|
|
41790
42048
|
}
|
|
41791
|
-
send(
|
|
41792
|
-
|
|
41793
|
-
|
|
41794
|
-
|
|
41795
|
-
|
|
41796
|
-
|
|
41797
|
-
|
|
41798
|
-
sessionId: command2.sessionId
|
|
41799
|
-
})
|
|
41800
|
-
);
|
|
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
|
+
});
|
|
41801
42056
|
});
|
|
41802
42057
|
return;
|
|
41803
42058
|
}
|
|
41804
42059
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41805
|
-
const cancellation =
|
|
42060
|
+
const cancellation = message;
|
|
41806
42061
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
41807
42062
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
41808
42063
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -41822,12 +42077,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41822
42077
|
return;
|
|
41823
42078
|
}
|
|
41824
42079
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
41825
|
-
const command2 =
|
|
42080
|
+
const command2 = message;
|
|
41826
42081
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
41827
42082
|
return;
|
|
41828
42083
|
}
|
|
41829
42084
|
if (kind === SESSION_PREPARE_KIND) {
|
|
41830
|
-
const command2 =
|
|
42085
|
+
const command2 = message;
|
|
41831
42086
|
void executeSessionPrepare(
|
|
41832
42087
|
publisher,
|
|
41833
42088
|
socket,
|
|
@@ -41841,7 +42096,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41841
42096
|
return;
|
|
41842
42097
|
}
|
|
41843
42098
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41844
|
-
const command2 =
|
|
42099
|
+
const command2 = message;
|
|
41845
42100
|
void executeSessionConfigure(
|
|
41846
42101
|
publisher,
|
|
41847
42102
|
socket,
|
|
@@ -41855,7 +42110,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41855
42110
|
return;
|
|
41856
42111
|
}
|
|
41857
42112
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41858
|
-
const command2 =
|
|
42113
|
+
const command2 = message;
|
|
41859
42114
|
void sessions.respondPermission(command2).then(() => {
|
|
41860
42115
|
audit.record({
|
|
41861
42116
|
commandId: command2.interactionId,
|
|
@@ -41868,7 +42123,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41868
42123
|
return;
|
|
41869
42124
|
}
|
|
41870
42125
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41871
|
-
const command2 =
|
|
42126
|
+
const command2 = message;
|
|
41872
42127
|
void sessions.respondElicitation(command2).then(() => {
|
|
41873
42128
|
audit.record({
|
|
41874
42129
|
commandId: command2.interactionId,
|
|
@@ -41881,14 +42136,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41881
42136
|
return;
|
|
41882
42137
|
}
|
|
41883
42138
|
if (kind === AGENT_INSTALL_REQUEST_KIND) {
|
|
41884
|
-
const command2 =
|
|
42139
|
+
const command2 = message;
|
|
41885
42140
|
void installations.request(command2, signal).catch((error62) => {
|
|
41886
42141
|
console.error("Mobius Agent integration installation failed", error62);
|
|
41887
42142
|
});
|
|
41888
42143
|
return;
|
|
41889
42144
|
}
|
|
41890
42145
|
if (kind === AGENT_INSTALL_CANCEL_KIND) {
|
|
41891
|
-
const command2 =
|
|
42146
|
+
const command2 = message;
|
|
41892
42147
|
void installations.cancel(command2.requestId).catch((error62) => {
|
|
41893
42148
|
reportOperationFailure(socket, command2.requestId, "", error62);
|
|
41894
42149
|
});
|
|
@@ -41897,7 +42152,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41897
42152
|
if (kind !== SESSION_PROMPT_KIND) {
|
|
41898
42153
|
throw new Error("Unsupported protocol message");
|
|
41899
42154
|
}
|
|
41900
|
-
const command =
|
|
42155
|
+
const command = message;
|
|
41901
42156
|
if (activeTurns.has(command.commandId)) {
|
|
41902
42157
|
return;
|
|
41903
42158
|
}
|
|
@@ -42018,13 +42273,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42018
42273
|
const publisher = new DaemonSessionEventPublisher(outbox, timer);
|
|
42019
42274
|
const activeTurns = /* @__PURE__ */ new Map();
|
|
42020
42275
|
const activeAttemptIds = /* @__PURE__ */ new Map();
|
|
42021
|
-
const recordSessionEvent = (sessionId,
|
|
42276
|
+
const recordSessionEvent = (sessionId, event) => {
|
|
42022
42277
|
const attemptId = activeAttemptIds.get(sessionId);
|
|
42023
42278
|
if (attemptId === void 0) {
|
|
42024
|
-
publisher.recordRuntime(sessionId,
|
|
42279
|
+
publisher.recordRuntime(sessionId, event);
|
|
42025
42280
|
return;
|
|
42026
42281
|
}
|
|
42027
|
-
publisher.recordAttempt(sessionId,
|
|
42282
|
+
publisher.recordAttempt(sessionId, event, attemptId);
|
|
42028
42283
|
};
|
|
42029
42284
|
const sessions = new AcpSessionManager(new DaemonAcpObserver(config2, recordSessionEvent), sessionStore);
|
|
42030
42285
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|