@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/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.60",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -23187,39 +23187,65 @@ var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.
|
|
|
23187
23187
|
var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
|
|
23188
23188
|
var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
|
|
23189
23189
|
var decodeAgentSettingsDiscoverCommand = (encoded) => decode3(encoded, agentSettingsDiscoverCommandSchema);
|
|
23190
|
+
var encodeAgentSettingsDiscoverCommand = (message) => encode3(message, agentSettingsDiscoverCommandSchema);
|
|
23191
|
+
var decodeAgentSettingsDiscoveredEvent = (encoded) => decode3(encoded, agentSettingsDiscoveredEventSchema);
|
|
23190
23192
|
var encodeAgentSettingsDiscoveredEvent = (message) => encode3(message, agentSettingsDiscoveredEventSchema);
|
|
23193
|
+
var decodeAgentSettingsDiscoveryFailedEvent = (encoded) => decode3(encoded, agentSettingsDiscoveryFailedEventSchema);
|
|
23191
23194
|
var encodeAgentSettingsDiscoveryFailedEvent = (message) => encode3(message, agentSettingsDiscoveryFailedEventSchema);
|
|
23192
23195
|
var decodeAgentCatalogRefreshCommand = (encoded) => decode3(encoded, agentCatalogRefreshCommandSchema);
|
|
23196
|
+
var encodeAgentCatalogRefreshCommand = (message) => encode3(message, agentCatalogRefreshCommandSchema);
|
|
23197
|
+
var decodeAgentCatalogRefreshedEvent = (encoded) => decode3(encoded, agentCatalogRefreshedEventSchema);
|
|
23193
23198
|
var encodeAgentCatalogRefreshedEvent = (message) => encode3(message, agentCatalogRefreshedEventSchema);
|
|
23199
|
+
var decodeAgentCatalogRefreshFailedEvent = (encoded) => decode3(encoded, agentCatalogRefreshFailedEventSchema);
|
|
23194
23200
|
var encodeAgentCatalogRefreshFailedEvent = (message) => encode3(message, agentCatalogRefreshFailedEventSchema);
|
|
23195
23201
|
var decodeFileReadCommand = (encoded) => decode3(encoded, fileReadCommandSchema);
|
|
23202
|
+
var encodeFileReadCommand = (message) => encode3(message, fileReadCommandSchema);
|
|
23203
|
+
var decodeFileBeginEvent = (encoded) => decode3(encoded, fileBeginEventSchema);
|
|
23196
23204
|
var encodeFileBeginEvent = (message) => encode3(message, fileBeginEventSchema);
|
|
23205
|
+
var decodeFileChunkEvent = (encoded) => decode3(encoded, fileChunkEventSchema);
|
|
23197
23206
|
var encodeFileChunkEvent = (message) => encode3(message, fileChunkEventSchema);
|
|
23207
|
+
var decodeFileEndEvent = (encoded) => decode3(encoded, fileEndEventSchema);
|
|
23198
23208
|
var encodeFileEndEvent = (message) => encode3(message, fileEndEventSchema);
|
|
23209
|
+
var decodeFileFailedEvent = (encoded) => decode3(encoded, fileFailedEventSchema);
|
|
23199
23210
|
var encodeFileFailedEvent = (message) => encode3(message, fileFailedEventSchema);
|
|
23200
23211
|
var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListCommandSchema);
|
|
23212
|
+
var encodeWorkspaceListCommand = (message) => encode3(message, workspaceListCommandSchema);
|
|
23213
|
+
var decodeWorkspaceEntriesEvent = (encoded) => decode3(encoded, workspaceEntriesEventSchema);
|
|
23201
23214
|
var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
|
|
23202
23215
|
var decodeSessionPrepareCommand = (encoded) => decode3(encoded, sessionPrepareCommandSchema);
|
|
23216
|
+
var encodeSessionPrepareCommand = (message) => encode3(message, sessionPrepareCommandSchema);
|
|
23217
|
+
var decodeSessionReadyEvent = (encoded) => decode3(encoded, sessionReadyEventSchema);
|
|
23203
23218
|
var encodeSessionReadyEvent = (message) => encode3(message, sessionReadyEventSchema);
|
|
23204
23219
|
var decodeSessionConfigureCommand = (encoded) => decode3(encoded, sessionConfigureCommandSchema);
|
|
23205
|
-
var
|
|
23206
|
-
var
|
|
23207
|
-
var
|
|
23208
|
-
var
|
|
23209
|
-
var
|
|
23220
|
+
var encodeSessionConfigureCommand = (message) => encode3(message, sessionConfigureCommandSchema);
|
|
23221
|
+
var decodeSessionConfigUpdatedEvent = (encoded) => decode3(encoded, sessionConfigUpdatedEventSchema);
|
|
23222
|
+
var decodeSessionUsageUpdatedEvent = (encoded) => decode3(encoded, sessionUsageUpdatedEventSchema);
|
|
23223
|
+
var decodeSessionCommandsUpdatedEvent = (encoded) => decode3(encoded, sessionCommandsUpdatedEventSchema);
|
|
23224
|
+
var decodeSessionInfoUpdatedEvent = (encoded) => decode3(encoded, sessionInfoUpdatedEventSchema);
|
|
23225
|
+
var decodeSessionPermissionRequestedEvent = (encoded) => decode3(encoded, sessionPermissionRequestedEventSchema);
|
|
23210
23226
|
var decodeSessionPermissionRespondCommand = (encoded) => decode3(encoded, sessionPermissionRespondCommandSchema);
|
|
23211
|
-
var
|
|
23212
|
-
var
|
|
23227
|
+
var encodeSessionPermissionRespondCommand = (message) => encode3(message, sessionPermissionRespondCommandSchema);
|
|
23228
|
+
var decodeSessionPermissionResolvedEvent = (encoded) => decode3(encoded, sessionPermissionResolvedEventSchema);
|
|
23229
|
+
var decodeSessionElicitationRequestedEvent = (encoded) => decode3(encoded, sessionElicitationRequestedEventSchema);
|
|
23213
23230
|
var decodeSessionElicitationRespondCommand = (encoded) => decode3(encoded, sessionElicitationRespondCommandSchema);
|
|
23214
|
-
var
|
|
23231
|
+
var encodeSessionElicitationRespondCommand = (message) => encode3(message, sessionElicitationRespondCommandSchema);
|
|
23232
|
+
var decodeSessionElicitationResolvedEvent = (encoded) => decode3(encoded, sessionElicitationResolvedEventSchema);
|
|
23233
|
+
var decodeSessionOperationFailedEvent = (encoded) => decode3(encoded, sessionOperationFailedEventSchema);
|
|
23215
23234
|
var encodeSessionOperationFailedEvent = (message) => encode3(message, sessionOperationFailedEventSchema);
|
|
23216
|
-
var
|
|
23235
|
+
var decodeAgentContentEvent = (encoded) => decode3(encoded, agentContentEventSchema);
|
|
23217
23236
|
var decodeAgentInstallRequestCommand = (encoded) => decode3(encoded, agentInstallRequestCommandSchema);
|
|
23237
|
+
var encodeAgentInstallRequestCommand = (message) => encode3(message, agentInstallRequestCommandSchema);
|
|
23218
23238
|
var decodeAgentInstallCancelCommand = (encoded) => decode3(encoded, agentInstallCancelCommandSchema);
|
|
23239
|
+
var encodeAgentInstallCancelCommand = (message) => encode3(message, agentInstallCancelCommandSchema);
|
|
23240
|
+
var decodeAgentInstallStartedEvent = (encoded) => decode3(encoded, agentInstallStartedEventSchema);
|
|
23219
23241
|
var encodeAgentInstallStartedEvent = (message) => encode3(message, agentInstallStartedEventSchema);
|
|
23242
|
+
var decodeAgentInstallProgressEvent = (encoded) => decode3(encoded, agentInstallProgressEventSchema);
|
|
23220
23243
|
var encodeAgentInstallProgressEvent = (message) => encode3(message, agentInstallProgressEventSchema);
|
|
23244
|
+
var decodeAgentInstallCompletedEvent = (encoded) => decode3(encoded, agentInstallCompletedEventSchema);
|
|
23221
23245
|
var encodeAgentInstallCompletedEvent = (message) => encode3(message, agentInstallCompletedEventSchema);
|
|
23246
|
+
var decodeAgentInstallFailedEvent = (encoded) => decode3(encoded, agentInstallFailedEventSchema);
|
|
23222
23247
|
var encodeAgentInstallFailedEvent = (message) => encode3(message, agentInstallFailedEventSchema);
|
|
23248
|
+
var decodeAgentInstallCancelledEvent = (encoded) => decode3(encoded, agentInstallCancelledEventSchema);
|
|
23223
23249
|
var encodeAgentInstallCancelledEvent = (message) => encode3(message, agentInstallCancelledEventSchema);
|
|
23224
23250
|
|
|
23225
23251
|
// ../protocol/src/messages.ts
|
|
@@ -23654,49 +23680,29 @@ function decodeSessionFailedEvent(encoded) {
|
|
|
23654
23680
|
sessionId: readIdentifier(value, "sessionId")
|
|
23655
23681
|
};
|
|
23656
23682
|
}
|
|
23657
|
-
function
|
|
23658
|
-
return JSON.stringify(
|
|
23683
|
+
function encodeSessionPromptCommand(message) {
|
|
23684
|
+
return JSON.stringify(decodeSessionPromptCommand(JSON.stringify(message)));
|
|
23659
23685
|
}
|
|
23660
|
-
function
|
|
23661
|
-
return JSON.stringify(
|
|
23686
|
+
function encodeSessionCancelCommand(message) {
|
|
23687
|
+
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
23662
23688
|
}
|
|
23663
|
-
function
|
|
23664
|
-
return JSON.stringify(
|
|
23689
|
+
function encodeRuntimeLivenessReadyEvent(message) {
|
|
23690
|
+
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
23665
23691
|
}
|
|
23666
|
-
function
|
|
23667
|
-
return JSON.stringify(
|
|
23668
|
-
}
|
|
23669
|
-
function encodeAgentActivityEvent(message) {
|
|
23670
|
-
return JSON.stringify(decodeAgentActivityEvent(JSON.stringify(message)));
|
|
23692
|
+
function encodeRuntimeHeartbeatEvent(message) {
|
|
23693
|
+
return JSON.stringify(decodeRuntimeHeartbeatEvent(JSON.stringify(message)));
|
|
23671
23694
|
}
|
|
23672
|
-
function
|
|
23673
|
-
return JSON.stringify(
|
|
23695
|
+
function encodeRuntimeHeartbeatAckEvent(message) {
|
|
23696
|
+
return JSON.stringify(decodeRuntimeHeartbeatAckEvent(JSON.stringify(message)));
|
|
23674
23697
|
}
|
|
23675
|
-
function
|
|
23676
|
-
return JSON.stringify(
|
|
23698
|
+
function encodeRuntimeDelivery(message) {
|
|
23699
|
+
return JSON.stringify(decodeRuntimeDelivery(JSON.stringify(message)));
|
|
23677
23700
|
}
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
23681
|
-
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
23682
|
-
var MobiusApiConfigurationError = class extends Error {
|
|
23683
|
-
code = "invalid_api_prefix";
|
|
23684
|
-
constructor() {
|
|
23685
|
-
super("The Mobius API prefix must be an absolute path without parameters");
|
|
23686
|
-
this.name = "MobiusApiConfigurationError";
|
|
23687
|
-
}
|
|
23688
|
-
};
|
|
23689
|
-
function parseMobiusApiPrefix(value) {
|
|
23690
|
-
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
23691
|
-
throw new MobiusApiConfigurationError();
|
|
23692
|
-
}
|
|
23693
|
-
return value;
|
|
23694
|
-
}
|
|
23695
|
-
function mobiusApiPath(resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
23696
|
-
return `${parseMobiusApiPrefix(apiPrefix)}${resourcePath}`;
|
|
23701
|
+
function encodeRuntimeDeliveryReceived(message) {
|
|
23702
|
+
return JSON.stringify(decodeRuntimeDeliveryReceived(JSON.stringify(message)));
|
|
23697
23703
|
}
|
|
23698
|
-
function
|
|
23699
|
-
return
|
|
23704
|
+
function encodeRuntimeDeliveryCommitted(message) {
|
|
23705
|
+
return JSON.stringify(decodeRuntimeDeliveryCommitted(JSON.stringify(message)));
|
|
23700
23706
|
}
|
|
23701
23707
|
|
|
23702
23708
|
// ../protocol/src/session-history.ts
|
|
@@ -23873,9 +23879,13 @@ function decode4(schema, encoded) {
|
|
|
23873
23879
|
}
|
|
23874
23880
|
}
|
|
23875
23881
|
var decodeNativeSessionCommand = (encoded) => decode4(nativeSessionCommandSchema, encoded);
|
|
23882
|
+
var encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
23883
|
+
var decodeNativeSessionResult = (encoded) => decode4(nativeSessionResultSchema, encoded);
|
|
23876
23884
|
var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
23877
23885
|
var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
23886
|
+
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
23878
23887
|
var decodeNativeSessionTurnForkCommand = (encoded) => decode4(nativeSessionTurnForkCommandSchema, encoded);
|
|
23888
|
+
var encodeNativeSessionTurnForkCommand = (value) => JSON.stringify(nativeSessionTurnForkCommandSchema.parse(value));
|
|
23879
23889
|
|
|
23880
23890
|
// ../protocol/src/session-events.ts
|
|
23881
23891
|
var SESSION_EVENT_KIND = "session.event";
|
|
@@ -23967,8 +23977,285 @@ var encode4 = (message, schema) => {
|
|
|
23967
23977
|
var decodeSessionEventEnvelope = (encoded) => decode5(encoded, eventEnvelopeSchema);
|
|
23968
23978
|
var encodeSessionEventEnvelope = (message) => encode4(message, eventEnvelopeSchema);
|
|
23969
23979
|
var decodeSessionEventAcknowledgement = (encoded) => decode5(encoded, eventAcknowledgementSchema);
|
|
23980
|
+
var encodeSessionEventAcknowledgement = (message) => encode4(message, eventAcknowledgementSchema);
|
|
23970
23981
|
var decodeSessionEventDeferred = (encoded) => decode5(encoded, eventDeferredSchema);
|
|
23982
|
+
var encodeSessionEventDeferred = (message) => encode4(message, eventDeferredSchema);
|
|
23971
23983
|
var decodeSessionEventRejection = (encoded) => decode5(encoded, eventRejectionSchema);
|
|
23984
|
+
var encodeSessionEventRejection = (message) => encode4(message, eventRejectionSchema);
|
|
23985
|
+
function decodeRecordedSessionEvent(encoded) {
|
|
23986
|
+
const kind = decodeMessageKind(encoded);
|
|
23987
|
+
switch (kind) {
|
|
23988
|
+
case AGENT_ACTIVITY_KIND:
|
|
23989
|
+
return decodeAgentActivityEvent(encoded);
|
|
23990
|
+
case AGENT_CONTENT_KIND:
|
|
23991
|
+
return decodeAgentContentEvent(encoded);
|
|
23992
|
+
case AGENT_MESSAGE_DELTA_KIND:
|
|
23993
|
+
return decodeAgentMessageDeltaEvent(encoded);
|
|
23994
|
+
case SESSION_COMMANDS_UPDATED_KIND:
|
|
23995
|
+
return decodeSessionCommandsUpdatedEvent(encoded);
|
|
23996
|
+
case SESSION_COMPLETED_KIND:
|
|
23997
|
+
return decodeSessionCompletedEvent(encoded);
|
|
23998
|
+
case SESSION_CONFIG_UPDATED_KIND:
|
|
23999
|
+
return decodeSessionConfigUpdatedEvent(encoded);
|
|
24000
|
+
case SESSION_ELICITATION_REQUESTED_KIND:
|
|
24001
|
+
return decodeSessionElicitationRequestedEvent(encoded);
|
|
24002
|
+
case SESSION_ELICITATION_RESOLVED_KIND:
|
|
24003
|
+
return decodeSessionElicitationResolvedEvent(encoded);
|
|
24004
|
+
case SESSION_FAILED_KIND:
|
|
24005
|
+
return decodeSessionFailedEvent(encoded);
|
|
24006
|
+
case SESSION_INFO_UPDATED_KIND:
|
|
24007
|
+
return decodeSessionInfoUpdatedEvent(encoded);
|
|
24008
|
+
case SESSION_PERMISSION_REQUESTED_KIND:
|
|
24009
|
+
return decodeSessionPermissionRequestedEvent(encoded);
|
|
24010
|
+
case SESSION_PERMISSION_RESOLVED_KIND:
|
|
24011
|
+
return decodeSessionPermissionResolvedEvent(encoded);
|
|
24012
|
+
case SESSION_READY_KIND:
|
|
24013
|
+
return decodeSessionReadyEvent(encoded);
|
|
24014
|
+
case SESSION_STARTED_KIND:
|
|
24015
|
+
return decodeSessionStartedEvent(encoded);
|
|
24016
|
+
case SESSION_USAGE_UPDATED_KIND:
|
|
24017
|
+
return decodeSessionUsageUpdatedEvent(encoded);
|
|
24018
|
+
default:
|
|
24019
|
+
throw new ProtocolMessageError("Unsupported recorded session event");
|
|
24020
|
+
}
|
|
24021
|
+
}
|
|
24022
|
+
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
24023
|
+
|
|
24024
|
+
// ../protocol/src/daemon-transport.ts
|
|
24025
|
+
function defineMessageSignature(kind, encoder, decoder) {
|
|
24026
|
+
const schema = (message) => decoder(JSON.stringify(message));
|
|
24027
|
+
return {
|
|
24028
|
+
decoder,
|
|
24029
|
+
encoder: (message) => encoder(schema(message)),
|
|
24030
|
+
kind,
|
|
24031
|
+
schema
|
|
24032
|
+
};
|
|
24033
|
+
}
|
|
24034
|
+
var serviceToDaemonSignatures = {
|
|
24035
|
+
[AGENT_CATALOG_REFRESH_KIND]: defineMessageSignature(
|
|
24036
|
+
AGENT_CATALOG_REFRESH_KIND,
|
|
24037
|
+
encodeAgentCatalogRefreshCommand,
|
|
24038
|
+
decodeAgentCatalogRefreshCommand
|
|
24039
|
+
),
|
|
24040
|
+
[AGENT_INSTALL_CANCEL_KIND]: defineMessageSignature(
|
|
24041
|
+
AGENT_INSTALL_CANCEL_KIND,
|
|
24042
|
+
encodeAgentInstallCancelCommand,
|
|
24043
|
+
decodeAgentInstallCancelCommand
|
|
24044
|
+
),
|
|
24045
|
+
[AGENT_INSTALL_REQUEST_KIND]: defineMessageSignature(
|
|
24046
|
+
AGENT_INSTALL_REQUEST_KIND,
|
|
24047
|
+
encodeAgentInstallRequestCommand,
|
|
24048
|
+
decodeAgentInstallRequestCommand
|
|
24049
|
+
),
|
|
24050
|
+
[AGENT_SETTINGS_DISCOVER_KIND]: defineMessageSignature(
|
|
24051
|
+
AGENT_SETTINGS_DISCOVER_KIND,
|
|
24052
|
+
encodeAgentSettingsDiscoverCommand,
|
|
24053
|
+
decodeAgentSettingsDiscoverCommand
|
|
24054
|
+
),
|
|
24055
|
+
[FILE_READ_KIND]: defineMessageSignature(FILE_READ_KIND, encodeFileReadCommand, decodeFileReadCommand),
|
|
24056
|
+
[NATIVE_SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
24057
|
+
NATIVE_SESSION_CANCEL_KIND,
|
|
24058
|
+
encodeNativeSessionCancel,
|
|
24059
|
+
decodeNativeSessionCancel
|
|
24060
|
+
),
|
|
24061
|
+
[NATIVE_SESSION_REQUEST_KIND]: defineMessageSignature(
|
|
24062
|
+
NATIVE_SESSION_REQUEST_KIND,
|
|
24063
|
+
encodeNativeSessionCommand,
|
|
24064
|
+
decodeNativeSessionCommand
|
|
24065
|
+
),
|
|
24066
|
+
[NATIVE_SESSION_TURN_FORK_KIND]: defineMessageSignature(
|
|
24067
|
+
NATIVE_SESSION_TURN_FORK_KIND,
|
|
24068
|
+
encodeNativeSessionTurnForkCommand,
|
|
24069
|
+
decodeNativeSessionTurnForkCommand
|
|
24070
|
+
),
|
|
24071
|
+
[RUNTIME_DELIVERY_KIND]: defineMessageSignature(
|
|
24072
|
+
RUNTIME_DELIVERY_KIND,
|
|
24073
|
+
encodeRuntimeDelivery,
|
|
24074
|
+
decodeRuntimeDelivery
|
|
24075
|
+
),
|
|
24076
|
+
[RUNTIME_DELIVERY_COMMITTED_KIND]: defineMessageSignature(
|
|
24077
|
+
RUNTIME_DELIVERY_COMMITTED_KIND,
|
|
24078
|
+
encodeRuntimeDeliveryCommitted,
|
|
24079
|
+
decodeRuntimeDeliveryCommitted
|
|
24080
|
+
),
|
|
24081
|
+
[RUNTIME_HEARTBEAT_ACK_KIND]: defineMessageSignature(
|
|
24082
|
+
RUNTIME_HEARTBEAT_ACK_KIND,
|
|
24083
|
+
encodeRuntimeHeartbeatAckEvent,
|
|
24084
|
+
decodeRuntimeHeartbeatAckEvent
|
|
24085
|
+
),
|
|
24086
|
+
[RUNTIME_LIVENESS_READY_KIND]: defineMessageSignature(
|
|
24087
|
+
RUNTIME_LIVENESS_READY_KIND,
|
|
24088
|
+
encodeRuntimeLivenessReadyEvent,
|
|
24089
|
+
decodeRuntimeLivenessReadyEvent
|
|
24090
|
+
),
|
|
24091
|
+
[SESSION_CANCEL_KIND]: defineMessageSignature(
|
|
24092
|
+
SESSION_CANCEL_KIND,
|
|
24093
|
+
encodeSessionCancelCommand,
|
|
24094
|
+
decodeSessionCancelCommand
|
|
24095
|
+
),
|
|
24096
|
+
[SESSION_CONFIGURE_KIND]: defineMessageSignature(
|
|
24097
|
+
SESSION_CONFIGURE_KIND,
|
|
24098
|
+
encodeSessionConfigureCommand,
|
|
24099
|
+
decodeSessionConfigureCommand
|
|
24100
|
+
),
|
|
24101
|
+
[SESSION_ELICITATION_RESPOND_KIND]: defineMessageSignature(
|
|
24102
|
+
SESSION_ELICITATION_RESPOND_KIND,
|
|
24103
|
+
encodeSessionElicitationRespondCommand,
|
|
24104
|
+
decodeSessionElicitationRespondCommand
|
|
24105
|
+
),
|
|
24106
|
+
[SESSION_EVENT_ACK_KIND]: defineMessageSignature(
|
|
24107
|
+
SESSION_EVENT_ACK_KIND,
|
|
24108
|
+
encodeSessionEventAcknowledgement,
|
|
24109
|
+
decodeSessionEventAcknowledgement
|
|
24110
|
+
),
|
|
24111
|
+
[SESSION_EVENT_DEFERRED_KIND]: defineMessageSignature(
|
|
24112
|
+
SESSION_EVENT_DEFERRED_KIND,
|
|
24113
|
+
encodeSessionEventDeferred,
|
|
24114
|
+
decodeSessionEventDeferred
|
|
24115
|
+
),
|
|
24116
|
+
[SESSION_EVENT_REJECTED_KIND]: defineMessageSignature(
|
|
24117
|
+
SESSION_EVENT_REJECTED_KIND,
|
|
24118
|
+
encodeSessionEventRejection,
|
|
24119
|
+
decodeSessionEventRejection
|
|
24120
|
+
),
|
|
24121
|
+
[SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
|
|
24122
|
+
SESSION_PERMISSION_RESPOND_KIND,
|
|
24123
|
+
encodeSessionPermissionRespondCommand,
|
|
24124
|
+
decodeSessionPermissionRespondCommand
|
|
24125
|
+
),
|
|
24126
|
+
[SESSION_PREPARE_KIND]: defineMessageSignature(
|
|
24127
|
+
SESSION_PREPARE_KIND,
|
|
24128
|
+
encodeSessionPrepareCommand,
|
|
24129
|
+
decodeSessionPrepareCommand
|
|
24130
|
+
),
|
|
24131
|
+
[SESSION_PROMPT_KIND]: defineMessageSignature(
|
|
24132
|
+
SESSION_PROMPT_KIND,
|
|
24133
|
+
encodeSessionPromptCommand,
|
|
24134
|
+
decodeSessionPromptCommand
|
|
24135
|
+
),
|
|
24136
|
+
[WORKSPACE_LIST_KIND]: defineMessageSignature(
|
|
24137
|
+
WORKSPACE_LIST_KIND,
|
|
24138
|
+
encodeWorkspaceListCommand,
|
|
24139
|
+
decodeWorkspaceListCommand
|
|
24140
|
+
)
|
|
24141
|
+
};
|
|
24142
|
+
var serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
24143
|
+
function decodeServiceToDaemonMessage(encoded) {
|
|
24144
|
+
const kind = decodeMessageKind(encoded);
|
|
24145
|
+
const signature = serviceToDaemonRegistry[kind];
|
|
24146
|
+
if (signature === void 0) {
|
|
24147
|
+
throw new ProtocolMessageError(`Unsupported service-to-daemon message kind: ${kind}`);
|
|
24148
|
+
}
|
|
24149
|
+
return signature.decoder(encoded);
|
|
24150
|
+
}
|
|
24151
|
+
var daemonToServiceSignatures = {
|
|
24152
|
+
[AGENT_CATALOG_REFRESHED_KIND]: defineMessageSignature(
|
|
24153
|
+
AGENT_CATALOG_REFRESHED_KIND,
|
|
24154
|
+
encodeAgentCatalogRefreshedEvent,
|
|
24155
|
+
decodeAgentCatalogRefreshedEvent
|
|
24156
|
+
),
|
|
24157
|
+
[AGENT_CATALOG_REFRESH_FAILED_KIND]: defineMessageSignature(
|
|
24158
|
+
AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
24159
|
+
encodeAgentCatalogRefreshFailedEvent,
|
|
24160
|
+
decodeAgentCatalogRefreshFailedEvent
|
|
24161
|
+
),
|
|
24162
|
+
[AGENT_INSTALL_CANCELLED_KIND]: defineMessageSignature(
|
|
24163
|
+
AGENT_INSTALL_CANCELLED_KIND,
|
|
24164
|
+
encodeAgentInstallCancelledEvent,
|
|
24165
|
+
decodeAgentInstallCancelledEvent
|
|
24166
|
+
),
|
|
24167
|
+
[AGENT_INSTALL_COMPLETED_KIND]: defineMessageSignature(
|
|
24168
|
+
AGENT_INSTALL_COMPLETED_KIND,
|
|
24169
|
+
encodeAgentInstallCompletedEvent,
|
|
24170
|
+
decodeAgentInstallCompletedEvent
|
|
24171
|
+
),
|
|
24172
|
+
[AGENT_INSTALL_FAILED_KIND]: defineMessageSignature(
|
|
24173
|
+
AGENT_INSTALL_FAILED_KIND,
|
|
24174
|
+
encodeAgentInstallFailedEvent,
|
|
24175
|
+
decodeAgentInstallFailedEvent
|
|
24176
|
+
),
|
|
24177
|
+
[AGENT_INSTALL_PROGRESS_KIND]: defineMessageSignature(
|
|
24178
|
+
AGENT_INSTALL_PROGRESS_KIND,
|
|
24179
|
+
encodeAgentInstallProgressEvent,
|
|
24180
|
+
decodeAgentInstallProgressEvent
|
|
24181
|
+
),
|
|
24182
|
+
[AGENT_INSTALL_STARTED_KIND]: defineMessageSignature(
|
|
24183
|
+
AGENT_INSTALL_STARTED_KIND,
|
|
24184
|
+
encodeAgentInstallStartedEvent,
|
|
24185
|
+
decodeAgentInstallStartedEvent
|
|
24186
|
+
),
|
|
24187
|
+
[AGENT_SETTINGS_DISCOVERED_KIND]: defineMessageSignature(
|
|
24188
|
+
AGENT_SETTINGS_DISCOVERED_KIND,
|
|
24189
|
+
encodeAgentSettingsDiscoveredEvent,
|
|
24190
|
+
decodeAgentSettingsDiscoveredEvent
|
|
24191
|
+
),
|
|
24192
|
+
[AGENT_SETTINGS_DISCOVERY_FAILED_KIND]: defineMessageSignature(
|
|
24193
|
+
AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
24194
|
+
encodeAgentSettingsDiscoveryFailedEvent,
|
|
24195
|
+
decodeAgentSettingsDiscoveryFailedEvent
|
|
24196
|
+
),
|
|
24197
|
+
[FILE_BEGIN_KIND]: defineMessageSignature(FILE_BEGIN_KIND, encodeFileBeginEvent, decodeFileBeginEvent),
|
|
24198
|
+
[FILE_CHUNK_KIND]: defineMessageSignature(FILE_CHUNK_KIND, encodeFileChunkEvent, decodeFileChunkEvent),
|
|
24199
|
+
[FILE_END_KIND]: defineMessageSignature(FILE_END_KIND, encodeFileEndEvent, decodeFileEndEvent),
|
|
24200
|
+
[FILE_FAILED_KIND]: defineMessageSignature(FILE_FAILED_KIND, encodeFileFailedEvent, decodeFileFailedEvent),
|
|
24201
|
+
[NATIVE_SESSION_RESULT_KIND]: defineMessageSignature(
|
|
24202
|
+
NATIVE_SESSION_RESULT_KIND,
|
|
24203
|
+
encodeNativeSessionResult,
|
|
24204
|
+
decodeNativeSessionResult
|
|
24205
|
+
),
|
|
24206
|
+
[RUNTIME_DELIVERY_RECEIVED_KIND]: defineMessageSignature(
|
|
24207
|
+
RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
24208
|
+
encodeRuntimeDeliveryReceived,
|
|
24209
|
+
decodeRuntimeDeliveryReceived
|
|
24210
|
+
),
|
|
24211
|
+
[RUNTIME_HEARTBEAT_KIND]: defineMessageSignature(
|
|
24212
|
+
RUNTIME_HEARTBEAT_KIND,
|
|
24213
|
+
encodeRuntimeHeartbeatEvent,
|
|
24214
|
+
decodeRuntimeHeartbeatEvent
|
|
24215
|
+
),
|
|
24216
|
+
[SESSION_EVENT_KIND]: defineMessageSignature(
|
|
24217
|
+
SESSION_EVENT_KIND,
|
|
24218
|
+
encodeSessionEventEnvelope,
|
|
24219
|
+
decodeSessionEventEnvelope
|
|
24220
|
+
),
|
|
24221
|
+
[SESSION_OPERATION_FAILED_KIND]: defineMessageSignature(
|
|
24222
|
+
SESSION_OPERATION_FAILED_KIND,
|
|
24223
|
+
encodeSessionOperationFailedEvent,
|
|
24224
|
+
decodeSessionOperationFailedEvent
|
|
24225
|
+
),
|
|
24226
|
+
[SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
|
|
24227
|
+
[WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
|
|
24228
|
+
WORKSPACE_ENTRIES_KIND,
|
|
24229
|
+
encodeWorkspaceEntriesEvent,
|
|
24230
|
+
decodeWorkspaceEntriesEvent
|
|
24231
|
+
)
|
|
24232
|
+
};
|
|
24233
|
+
function encodeDaemonToServiceMessage(message) {
|
|
24234
|
+
return daemonToServiceSignatures[message.kind].encoder(message);
|
|
24235
|
+
}
|
|
24236
|
+
|
|
24237
|
+
// ../protocol/src/mobius-api.ts
|
|
24238
|
+
var MOBIUS_API_PREFIX = "/mobius/api";
|
|
24239
|
+
var API_PREFIX_PATTERN = /^\/[a-zA-Z0-9._~-]+(?:\/[a-zA-Z0-9._~-]+)*$/;
|
|
24240
|
+
var MobiusApiConfigurationError = class extends Error {
|
|
24241
|
+
code = "invalid_api_prefix";
|
|
24242
|
+
constructor() {
|
|
24243
|
+
super("The Mobius API prefix must be an absolute path without parameters");
|
|
24244
|
+
this.name = "MobiusApiConfigurationError";
|
|
24245
|
+
}
|
|
24246
|
+
};
|
|
24247
|
+
function parseMobiusApiPrefix(value) {
|
|
24248
|
+
if (typeof value !== "string" || !API_PREFIX_PATTERN.test(value)) {
|
|
24249
|
+
throw new MobiusApiConfigurationError();
|
|
24250
|
+
}
|
|
24251
|
+
return value;
|
|
24252
|
+
}
|
|
24253
|
+
function mobiusApiPath(resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
24254
|
+
return `${parseMobiusApiPrefix(apiPrefix)}${resourcePath}`;
|
|
24255
|
+
}
|
|
24256
|
+
function mobiusApiUrl(origin, resourcePath, apiPrefix = MOBIUS_API_PREFIX) {
|
|
24257
|
+
return new URL(mobiusApiPath(resourcePath, apiPrefix), origin);
|
|
24258
|
+
}
|
|
23972
24259
|
|
|
23973
24260
|
// src/config.ts
|
|
23974
24261
|
function loadDefaultWorkspace(environment = process.env) {
|
|
@@ -36706,11 +36993,42 @@ function relayHttpEndpoint(relayUrl) {
|
|
|
36706
36993
|
var CATALOG_UPDATE_TIMEOUT_MILLISECONDS = 2e4;
|
|
36707
36994
|
var AgentCatalogPublishError = class extends Error {
|
|
36708
36995
|
code = "agent_catalog_update_failed";
|
|
36709
|
-
|
|
36996
|
+
diagnosticDetails;
|
|
36997
|
+
constructor(message, options = {}, diagnosticDetails = {}) {
|
|
36710
36998
|
super(message, options);
|
|
36999
|
+
this.diagnosticDetails = diagnosticDetails;
|
|
36711
37000
|
this.name = "AgentCatalogPublishError";
|
|
36712
37001
|
}
|
|
36713
37002
|
};
|
|
37003
|
+
function isRecord10(value) {
|
|
37004
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37005
|
+
}
|
|
37006
|
+
function isSafeRelayErrorMessage(value) {
|
|
37007
|
+
return value.length > 0 && value.length <= 512 && Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127);
|
|
37008
|
+
}
|
|
37009
|
+
async function rejectedCatalogError(response) {
|
|
37010
|
+
let value;
|
|
37011
|
+
try {
|
|
37012
|
+
value = await response.json();
|
|
37013
|
+
} catch {
|
|
37014
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37015
|
+
}
|
|
37016
|
+
if (!isRecord10(value) || !isRecord10(value["error"])) {
|
|
37017
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37018
|
+
}
|
|
37019
|
+
const code = value["error"]["code"];
|
|
37020
|
+
const message = value["error"]["message"];
|
|
37021
|
+
if (typeof code !== "string" || !/^[a-z][a-z0-9_]{0,63}$/.test(code) || typeof message !== "string" || !isSafeRelayErrorMessage(message)) {
|
|
37022
|
+
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
37023
|
+
}
|
|
37024
|
+
return new AgentCatalogPublishError(
|
|
37025
|
+
`The Relay rejected the Agent catalog update (${code}): ${message}`,
|
|
37026
|
+
{},
|
|
37027
|
+
{
|
|
37028
|
+
relayErrorCode: code
|
|
37029
|
+
}
|
|
37030
|
+
);
|
|
37031
|
+
}
|
|
36714
37032
|
function catalogEndpoint(config2) {
|
|
36715
37033
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
36716
37034
|
if (endpoint.pathname.endsWith("/daemon")) {
|
|
@@ -36758,10 +37076,10 @@ async function publishAgentCatalog(config2, signal) {
|
|
|
36758
37076
|
{ cause: error62 }
|
|
36759
37077
|
);
|
|
36760
37078
|
}
|
|
36761
|
-
await response.body?.cancel();
|
|
36762
37079
|
if (!response.ok) {
|
|
36763
|
-
throw
|
|
37080
|
+
throw await rejectedCatalogError(response);
|
|
36764
37081
|
}
|
|
37082
|
+
await response.body?.cancel();
|
|
36765
37083
|
}
|
|
36766
37084
|
|
|
36767
37085
|
// src/agent-installation/agent-installation-manager.ts
|
|
@@ -37270,30 +37588,26 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37270
37588
|
throw new Error("The local file is too large to read");
|
|
37271
37589
|
}
|
|
37272
37590
|
const raster = await readLocalRaster(target, signal);
|
|
37273
|
-
send2(
|
|
37274
|
-
|
|
37275
|
-
|
|
37276
|
-
|
|
37277
|
-
|
|
37278
|
-
|
|
37279
|
-
|
|
37280
|
-
|
|
37281
|
-
|
|
37282
|
-
})
|
|
37283
|
-
);
|
|
37591
|
+
send2({
|
|
37592
|
+
byteLength: before.size,
|
|
37593
|
+
kind: FILE_BEGIN_KIND,
|
|
37594
|
+
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
37595
|
+
modifiedAt: before.mtime.toISOString(),
|
|
37596
|
+
name: basename4(target) || "file",
|
|
37597
|
+
requestId: command.requestId,
|
|
37598
|
+
sessionId: command.sessionId
|
|
37599
|
+
});
|
|
37284
37600
|
let sequence = 0;
|
|
37285
37601
|
const stream = createReadStream2(target, { highWaterMark: CHUNK_BYTES, signal });
|
|
37286
37602
|
for await (const value of stream) {
|
|
37287
37603
|
const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
37288
|
-
send2(
|
|
37289
|
-
|
|
37290
|
-
|
|
37291
|
-
|
|
37292
|
-
|
|
37293
|
-
|
|
37294
|
-
|
|
37295
|
-
})
|
|
37296
|
-
);
|
|
37604
|
+
send2({
|
|
37605
|
+
data: Buffer.from(bytes).toString("base64"),
|
|
37606
|
+
kind: FILE_CHUNK_KIND,
|
|
37607
|
+
requestId: command.requestId,
|
|
37608
|
+
sequence,
|
|
37609
|
+
sessionId: command.sessionId
|
|
37610
|
+
});
|
|
37297
37611
|
sequence += 1;
|
|
37298
37612
|
}
|
|
37299
37613
|
const after = await stat7(target);
|
|
@@ -37301,13 +37615,11 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37301
37615
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
37302
37616
|
throw new Error("The local file changed during transfer");
|
|
37303
37617
|
}
|
|
37304
|
-
send2(
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
|
|
37309
|
-
})
|
|
37310
|
-
);
|
|
37618
|
+
send2({
|
|
37619
|
+
kind: FILE_END_KIND,
|
|
37620
|
+
requestId: command.requestId,
|
|
37621
|
+
sessionId: command.sessionId
|
|
37622
|
+
});
|
|
37311
37623
|
}
|
|
37312
37624
|
|
|
37313
37625
|
// src/artifacts/runtime-artifact-uploader.ts
|
|
@@ -37340,11 +37652,11 @@ var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
|
37340
37652
|
function invalidResponse(message) {
|
|
37341
37653
|
return new MobiusProtocolError(message);
|
|
37342
37654
|
}
|
|
37343
|
-
function
|
|
37655
|
+
function isRecord11(value) {
|
|
37344
37656
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37345
37657
|
}
|
|
37346
37658
|
function record2(value, name) {
|
|
37347
|
-
if (!
|
|
37659
|
+
if (!isRecord11(value)) {
|
|
37348
37660
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37349
37661
|
}
|
|
37350
37662
|
return value;
|
|
@@ -39152,12 +39464,10 @@ var RelayConnectionLiveness = class {
|
|
|
39152
39464
|
heartbeatId,
|
|
39153
39465
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
39154
39466
|
);
|
|
39155
|
-
const sent = this.#transport.send(
|
|
39156
|
-
|
|
39157
|
-
|
|
39158
|
-
|
|
39159
|
-
})
|
|
39160
|
-
);
|
|
39467
|
+
const sent = this.#transport.send({
|
|
39468
|
+
heartbeatId,
|
|
39469
|
+
kind: RUNTIME_HEARTBEAT_KIND
|
|
39470
|
+
});
|
|
39161
39471
|
if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
|
|
39162
39472
|
this.#state.timeout.cancel();
|
|
39163
39473
|
this.#state = new FinishedRelayLivenessState();
|
|
@@ -39777,39 +40087,39 @@ var DaemonAcpObserver = class {
|
|
|
39777
40087
|
}
|
|
39778
40088
|
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39779
40089
|
onCommands = (event) => {
|
|
39780
|
-
this.#record(event.sessionId,
|
|
40090
|
+
this.#record(event.sessionId, event);
|
|
39781
40091
|
return Promise.resolve();
|
|
39782
40092
|
};
|
|
39783
40093
|
onConfig = (event) => {
|
|
39784
|
-
this.#record(event.sessionId,
|
|
40094
|
+
this.#record(event.sessionId, event);
|
|
39785
40095
|
return Promise.resolve();
|
|
39786
40096
|
};
|
|
39787
40097
|
onContent = (event) => {
|
|
39788
|
-
this.#record(event.sessionId,
|
|
40098
|
+
this.#record(event.sessionId, event);
|
|
39789
40099
|
return Promise.resolve();
|
|
39790
40100
|
};
|
|
39791
40101
|
onElicitation = (event) => {
|
|
39792
|
-
this.#record(event.sessionId,
|
|
40102
|
+
this.#record(event.sessionId, event);
|
|
39793
40103
|
return Promise.resolve();
|
|
39794
40104
|
};
|
|
39795
40105
|
onElicitationResolved = (event) => {
|
|
39796
|
-
this.#record(event.sessionId,
|
|
40106
|
+
this.#record(event.sessionId, event);
|
|
39797
40107
|
return Promise.resolve();
|
|
39798
40108
|
};
|
|
39799
40109
|
onInfo = (event) => {
|
|
39800
|
-
this.#record(event.sessionId,
|
|
40110
|
+
this.#record(event.sessionId, event);
|
|
39801
40111
|
return Promise.resolve();
|
|
39802
40112
|
};
|
|
39803
40113
|
onPermission = (event) => {
|
|
39804
|
-
this.#record(event.sessionId,
|
|
40114
|
+
this.#record(event.sessionId, event);
|
|
39805
40115
|
return Promise.resolve();
|
|
39806
40116
|
};
|
|
39807
40117
|
onPermissionResolved = (event) => {
|
|
39808
|
-
this.#record(event.sessionId,
|
|
40118
|
+
this.#record(event.sessionId, event);
|
|
39809
40119
|
return Promise.resolve();
|
|
39810
40120
|
};
|
|
39811
40121
|
onUsage = (event) => {
|
|
39812
|
-
this.#record(event.sessionId,
|
|
40122
|
+
this.#record(event.sessionId, event);
|
|
39813
40123
|
return Promise.resolve();
|
|
39814
40124
|
};
|
|
39815
40125
|
};
|
|
@@ -39858,60 +40168,45 @@ var DaemonInstallationObserver = class {
|
|
|
39858
40168
|
if (state instanceof RunningInstallation) {
|
|
39859
40169
|
if (!this.#started.has(state.requestId)) {
|
|
39860
40170
|
this.#started.add(state.requestId);
|
|
39861
|
-
this.#send(
|
|
39862
|
-
socket,
|
|
39863
|
-
encodeAgentInstallStartedEvent({
|
|
39864
|
-
agentId: state.agentId,
|
|
39865
|
-
kind: AGENT_INSTALL_STARTED_KIND,
|
|
39866
|
-
requestId: state.requestId
|
|
39867
|
-
})
|
|
39868
|
-
);
|
|
39869
|
-
}
|
|
39870
|
-
this.#send(
|
|
39871
|
-
socket,
|
|
39872
|
-
encodeAgentInstallProgressEvent({
|
|
40171
|
+
this.#send(socket, {
|
|
39873
40172
|
agentId: state.agentId,
|
|
39874
|
-
kind:
|
|
39875
|
-
requestId: state.requestId
|
|
39876
|
-
|
|
39877
|
-
|
|
39878
|
-
|
|
40173
|
+
kind: AGENT_INSTALL_STARTED_KIND,
|
|
40174
|
+
requestId: state.requestId
|
|
40175
|
+
});
|
|
40176
|
+
}
|
|
40177
|
+
this.#send(socket, {
|
|
40178
|
+
agentId: state.agentId,
|
|
40179
|
+
kind: AGENT_INSTALL_PROGRESS_KIND,
|
|
40180
|
+
requestId: state.requestId,
|
|
40181
|
+
stage: state.stage
|
|
40182
|
+
});
|
|
39879
40183
|
return Promise.resolve();
|
|
39880
40184
|
}
|
|
39881
40185
|
if (state instanceof SucceededInstallation) {
|
|
39882
|
-
this.#send(
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
39887
|
-
|
|
39888
|
-
requestId: state.requestId
|
|
39889
|
-
})
|
|
39890
|
-
);
|
|
40186
|
+
this.#send(socket, {
|
|
40187
|
+
agentId: state.agentId,
|
|
40188
|
+
authenticationMayBeRequired: state.authenticationMayBeRequired,
|
|
40189
|
+
kind: AGENT_INSTALL_COMPLETED_KIND,
|
|
40190
|
+
requestId: state.requestId
|
|
40191
|
+
});
|
|
39891
40192
|
return Promise.resolve();
|
|
39892
40193
|
}
|
|
39893
40194
|
if (state instanceof FailedInstallation) {
|
|
39894
|
-
this.#send(
|
|
39895
|
-
|
|
39896
|
-
|
|
39897
|
-
|
|
39898
|
-
|
|
39899
|
-
|
|
39900
|
-
|
|
39901
|
-
requestId: state.requestId
|
|
39902
|
-
})
|
|
39903
|
-
);
|
|
40195
|
+
this.#send(socket, {
|
|
40196
|
+
agentId: state.agentId,
|
|
40197
|
+
code: state.code,
|
|
40198
|
+
kind: AGENT_INSTALL_FAILED_KIND,
|
|
40199
|
+
message: state.message,
|
|
40200
|
+
requestId: state.requestId
|
|
40201
|
+
});
|
|
39904
40202
|
return Promise.resolve();
|
|
39905
40203
|
}
|
|
39906
40204
|
if (state instanceof CancelledInstallation) {
|
|
39907
|
-
this.#send(
|
|
39908
|
-
|
|
39909
|
-
|
|
39910
|
-
|
|
39911
|
-
|
|
39912
|
-
requestId: state.requestId
|
|
39913
|
-
})
|
|
39914
|
-
);
|
|
40205
|
+
this.#send(socket, {
|
|
40206
|
+
agentId: state.agentId,
|
|
40207
|
+
kind: AGENT_INSTALL_CANCELLED_KIND,
|
|
40208
|
+
requestId: state.requestId
|
|
40209
|
+
});
|
|
39915
40210
|
return Promise.resolve();
|
|
39916
40211
|
}
|
|
39917
40212
|
throw new Error("Unsupported Agent integration installation state");
|
|
@@ -40041,7 +40336,7 @@ function send(socket, message) {
|
|
|
40041
40336
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40042
40337
|
throw new Error("Relay connection is not open");
|
|
40043
40338
|
}
|
|
40044
|
-
socket.send(message);
|
|
40339
|
+
socket.send(encodeDaemonToServiceMessage(message));
|
|
40045
40340
|
}
|
|
40046
40341
|
function closeRelaySocket(socket, code, reason) {
|
|
40047
40342
|
try {
|
|
@@ -40075,7 +40370,7 @@ var ConnectedDaemonSessionEventState = class extends DaemonSessionEventConnectio
|
|
|
40075
40370
|
return false;
|
|
40076
40371
|
}
|
|
40077
40372
|
try {
|
|
40078
|
-
this.#socket.send(message);
|
|
40373
|
+
this.#socket.send(encodeDaemonToServiceMessage(message));
|
|
40079
40374
|
return true;
|
|
40080
40375
|
} catch {
|
|
40081
40376
|
return false;
|
|
@@ -40119,17 +40414,17 @@ var DaemonSessionEventPublisher = class {
|
|
|
40119
40414
|
this.#connection = this.#connection.disconnect(socket);
|
|
40120
40415
|
this.#clearInFlight();
|
|
40121
40416
|
};
|
|
40122
|
-
recordAttempt = (sessionId,
|
|
40123
|
-
const
|
|
40124
|
-
if (kind === SESSION_COMPLETED_KIND || kind === SESSION_FAILED_KIND) {
|
|
40125
|
-
this.#outbox.enqueueCritical(sessionId,
|
|
40417
|
+
recordAttempt = (sessionId, event, attemptId) => {
|
|
40418
|
+
const encoded = encodeRecordedSessionEvent(event);
|
|
40419
|
+
if (event.kind === SESSION_COMPLETED_KIND || event.kind === SESSION_FAILED_KIND) {
|
|
40420
|
+
this.#outbox.enqueueCritical(sessionId, encoded, attemptId);
|
|
40126
40421
|
} else {
|
|
40127
|
-
this.#outbox.enqueue(sessionId,
|
|
40422
|
+
this.#outbox.enqueue(sessionId, encoded, attemptId);
|
|
40128
40423
|
}
|
|
40129
40424
|
this.#publishNextBatch();
|
|
40130
40425
|
};
|
|
40131
|
-
recordRuntime = (sessionId,
|
|
40132
|
-
this.#outbox.enqueue(sessionId,
|
|
40426
|
+
recordRuntime = (sessionId, event) => {
|
|
40427
|
+
this.#outbox.enqueue(sessionId, encodeRecordedSessionEvent(event));
|
|
40133
40428
|
this.#publishNextBatch();
|
|
40134
40429
|
};
|
|
40135
40430
|
acknowledge = (acknowledgement) => {
|
|
@@ -40196,7 +40491,7 @@ var DaemonSessionEventPublisher = class {
|
|
|
40196
40491
|
if (this.#inFlightBytes + byteLength > SESSION_EVENT_REPLAY_BYTE_LIMIT) {
|
|
40197
40492
|
continue;
|
|
40198
40493
|
}
|
|
40199
|
-
if (!this.#connection.send(
|
|
40494
|
+
if (!this.#connection.send(envelope2)) {
|
|
40200
40495
|
this.#clearInFlight();
|
|
40201
40496
|
return;
|
|
40202
40497
|
}
|
|
@@ -40290,8 +40585,8 @@ var CoalescingDaemonActivityPublisher = class {
|
|
|
40290
40585
|
}
|
|
40291
40586
|
};
|
|
40292
40587
|
};
|
|
40293
|
-
function
|
|
40294
|
-
return
|
|
40588
|
+
function daemonActivity(command, activity) {
|
|
40589
|
+
return {
|
|
40295
40590
|
activityId: activity.activityId,
|
|
40296
40591
|
activityType: activity.activityType,
|
|
40297
40592
|
commandId: command.commandId,
|
|
@@ -40307,18 +40602,18 @@ function encodeDaemonActivity(command, activity) {
|
|
|
40307
40602
|
status: activity.status,
|
|
40308
40603
|
title: activity.title,
|
|
40309
40604
|
toolKind: activity.toolKind
|
|
40310
|
-
}
|
|
40605
|
+
};
|
|
40311
40606
|
}
|
|
40312
40607
|
function reportFailure(publisher, command, code, message, attemptId) {
|
|
40313
40608
|
publisher.recordAttempt(
|
|
40314
40609
|
command.sessionId,
|
|
40315
|
-
|
|
40610
|
+
{
|
|
40316
40611
|
code,
|
|
40317
40612
|
commandId: command.commandId,
|
|
40318
40613
|
kind: SESSION_FAILED_KIND,
|
|
40319
40614
|
message,
|
|
40320
40615
|
sessionId: command.sessionId
|
|
40321
|
-
}
|
|
40616
|
+
},
|
|
40322
40617
|
attemptId
|
|
40323
40618
|
);
|
|
40324
40619
|
}
|
|
@@ -40338,17 +40633,14 @@ function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTi
|
|
|
40338
40633
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40339
40634
|
return;
|
|
40340
40635
|
}
|
|
40341
|
-
send(
|
|
40342
|
-
|
|
40343
|
-
|
|
40344
|
-
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
sessionId
|
|
40350
|
-
})
|
|
40351
|
-
);
|
|
40636
|
+
send(socket, {
|
|
40637
|
+
code: operationErrorCode(error62),
|
|
40638
|
+
kind: "session.operation.failed",
|
|
40639
|
+
message: operationErrorMessage(error62),
|
|
40640
|
+
requestId,
|
|
40641
|
+
...runtimeTimings.length === 0 ? {} : { runtimeTimings },
|
|
40642
|
+
sessionId
|
|
40643
|
+
});
|
|
40352
40644
|
}
|
|
40353
40645
|
async function resolveSessionDirectories(directories, bindingId, directoryId2, additionalDirectoryIds, signal) {
|
|
40354
40646
|
const cwd = await directories.resolve(bindingId, directoryId2, signal);
|
|
@@ -40540,18 +40832,15 @@ async function executeWorkspaceList(socket, command, directories, audit, signal)
|
|
|
40540
40832
|
event: "workspace_list_authorized",
|
|
40541
40833
|
sessionId: "workspace-browser"
|
|
40542
40834
|
});
|
|
40543
|
-
send(
|
|
40544
|
-
|
|
40545
|
-
|
|
40546
|
-
|
|
40547
|
-
|
|
40548
|
-
|
|
40549
|
-
|
|
40550
|
-
|
|
40551
|
-
|
|
40552
|
-
requestId: command.requestId
|
|
40553
|
-
})
|
|
40554
|
-
);
|
|
40835
|
+
send(socket, {
|
|
40836
|
+
bindingId: command.bindingId,
|
|
40837
|
+
directoryId: listing.directoryId,
|
|
40838
|
+
directoryLabel: listing.directoryLabel,
|
|
40839
|
+
entries: listing.entries,
|
|
40840
|
+
kind: "workspace.entries",
|
|
40841
|
+
parentDirectoryId: listing.parentDirectoryId,
|
|
40842
|
+
requestId: command.requestId
|
|
40843
|
+
});
|
|
40555
40844
|
} catch (error62) {
|
|
40556
40845
|
reportOperationFailure(socket, command.requestId, "", error62);
|
|
40557
40846
|
}
|
|
@@ -40606,15 +40895,12 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40606
40895
|
event: "session_configured",
|
|
40607
40896
|
sessionId: command.sessionId
|
|
40608
40897
|
});
|
|
40609
|
-
publisher.recordRuntime(
|
|
40610
|
-
|
|
40611
|
-
|
|
40612
|
-
|
|
40613
|
-
|
|
40614
|
-
|
|
40615
|
-
sessionId: command.sessionId
|
|
40616
|
-
})
|
|
40617
|
-
);
|
|
40898
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40899
|
+
configOptions,
|
|
40900
|
+
kind: "session.config.updated",
|
|
40901
|
+
requestId: command.requestId,
|
|
40902
|
+
sessionId: command.sessionId
|
|
40903
|
+
});
|
|
40618
40904
|
}
|
|
40619
40905
|
const event = {
|
|
40620
40906
|
additionalDirectories: resolved.additionalDirectoryEntries,
|
|
@@ -40633,17 +40919,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40633
40919
|
runtimeTimings: metrics.snapshot()
|
|
40634
40920
|
};
|
|
40635
40921
|
metrics.measureSync("readiness-commit", () => {
|
|
40636
|
-
publisher.recordRuntime(command.sessionId,
|
|
40922
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40637
40923
|
});
|
|
40638
40924
|
return event;
|
|
40639
40925
|
});
|
|
40640
|
-
send(
|
|
40641
|
-
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
runtimeTimings: metrics.snapshot()
|
|
40645
|
-
})
|
|
40646
|
-
);
|
|
40926
|
+
send(socket, {
|
|
40927
|
+
...readyEvent,
|
|
40928
|
+
runtimeTimings: metrics.snapshot()
|
|
40929
|
+
});
|
|
40647
40930
|
} catch (error62) {
|
|
40648
40931
|
audit.record({
|
|
40649
40932
|
commandId: command.requestId,
|
|
@@ -40683,15 +40966,12 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40683
40966
|
event: "session_configured",
|
|
40684
40967
|
sessionId: command.sessionId
|
|
40685
40968
|
});
|
|
40686
|
-
publisher.recordRuntime(
|
|
40687
|
-
|
|
40688
|
-
|
|
40689
|
-
|
|
40690
|
-
|
|
40691
|
-
|
|
40692
|
-
sessionId: command.sessionId
|
|
40693
|
-
})
|
|
40694
|
-
);
|
|
40969
|
+
publisher.recordRuntime(command.sessionId, {
|
|
40970
|
+
configOptions,
|
|
40971
|
+
kind: "session.config.updated",
|
|
40972
|
+
requestId: command.requestId,
|
|
40973
|
+
sessionId: command.sessionId
|
|
40974
|
+
});
|
|
40695
40975
|
} catch (error62) {
|
|
40696
40976
|
if (signal.aborted) {
|
|
40697
40977
|
signal.throwIfAborted();
|
|
@@ -40701,20 +40981,20 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
40701
40981
|
}
|
|
40702
40982
|
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
40703
40983
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity) => {
|
|
40704
|
-
publisher.recordAttempt(command.sessionId,
|
|
40984
|
+
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity), attemptId);
|
|
40705
40985
|
});
|
|
40706
40986
|
const text3 = new CoalescingTextPublisher(
|
|
40707
40987
|
timer,
|
|
40708
40988
|
(messageId, delta) => {
|
|
40709
40989
|
publisher.recordAttempt(
|
|
40710
40990
|
command.sessionId,
|
|
40711
|
-
|
|
40991
|
+
{
|
|
40712
40992
|
commandId: command.commandId,
|
|
40713
40993
|
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40714
40994
|
messageId,
|
|
40715
40995
|
sessionId: command.sessionId,
|
|
40716
40996
|
text: delta
|
|
40717
|
-
}
|
|
40997
|
+
},
|
|
40718
40998
|
attemptId
|
|
40719
40999
|
);
|
|
40720
41000
|
},
|
|
@@ -40773,12 +41053,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40773
41053
|
outbox.transitionExecution(command.commandId, "running");
|
|
40774
41054
|
publisher.recordAttempt(
|
|
40775
41055
|
command.sessionId,
|
|
40776
|
-
|
|
41056
|
+
{
|
|
40777
41057
|
commandId: command.commandId,
|
|
40778
41058
|
kind: SESSION_STARTED_KIND,
|
|
40779
41059
|
attemptId,
|
|
40780
41060
|
sessionId: command.sessionId
|
|
40781
|
-
}
|
|
41061
|
+
},
|
|
40782
41062
|
attemptId
|
|
40783
41063
|
);
|
|
40784
41064
|
activateAttempt();
|
|
@@ -40823,12 +41103,12 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40823
41103
|
activities.flush();
|
|
40824
41104
|
publisher.recordAttempt(
|
|
40825
41105
|
command.sessionId,
|
|
40826
|
-
|
|
41106
|
+
{
|
|
40827
41107
|
commandId: command.commandId,
|
|
40828
41108
|
kind: SESSION_COMPLETED_KIND,
|
|
40829
41109
|
sessionId: command.sessionId,
|
|
40830
41110
|
stopReason
|
|
40831
|
-
}
|
|
41111
|
+
},
|
|
40832
41112
|
attemptId
|
|
40833
41113
|
);
|
|
40834
41114
|
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
@@ -41252,9 +41532,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41252
41532
|
}
|
|
41253
41533
|
};
|
|
41254
41534
|
const processDeliveredPayload = async (delivery) => {
|
|
41255
|
-
const
|
|
41535
|
+
const message = decodeServiceToDaemonMessage(delivery.payload);
|
|
41536
|
+
const kind = message.kind;
|
|
41256
41537
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41257
|
-
const cancellation =
|
|
41538
|
+
const cancellation = message;
|
|
41258
41539
|
if (cancellation.sessionId !== delivery.sessionId) {
|
|
41259
41540
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41260
41541
|
}
|
|
@@ -41271,7 +41552,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41271
41552
|
return;
|
|
41272
41553
|
}
|
|
41273
41554
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41274
|
-
const command =
|
|
41555
|
+
const command = message;
|
|
41275
41556
|
if (command.sessionId !== delivery.sessionId) {
|
|
41276
41557
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41277
41558
|
}
|
|
@@ -41288,7 +41569,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41288
41569
|
return;
|
|
41289
41570
|
}
|
|
41290
41571
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41291
|
-
const command =
|
|
41572
|
+
const command = message;
|
|
41292
41573
|
if (command.sessionId !== delivery.sessionId) {
|
|
41293
41574
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41294
41575
|
}
|
|
@@ -41305,7 +41586,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41305
41586
|
return;
|
|
41306
41587
|
}
|
|
41307
41588
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41308
|
-
const command =
|
|
41589
|
+
const command = message;
|
|
41309
41590
|
if (command.sessionId !== delivery.sessionId) {
|
|
41310
41591
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41311
41592
|
}
|
|
@@ -41322,7 +41603,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41322
41603
|
return;
|
|
41323
41604
|
}
|
|
41324
41605
|
if (kind === SESSION_PROMPT_KIND) {
|
|
41325
|
-
const command =
|
|
41606
|
+
const command = message;
|
|
41326
41607
|
await processDeliveredPrompt(
|
|
41327
41608
|
delivery,
|
|
41328
41609
|
command,
|
|
@@ -41366,18 +41647,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41366
41647
|
}).finally(() => processingDeliveryIds.delete(delivery.deliveryId));
|
|
41367
41648
|
};
|
|
41368
41649
|
const receiveRuntimeDelivery = (delivery) => {
|
|
41369
|
-
const
|
|
41650
|
+
const payload = decodeServiceToDaemonMessage(delivery.payload);
|
|
41651
|
+
const payloadKind = payload.kind;
|
|
41370
41652
|
let payloadSessionId = "";
|
|
41371
41653
|
if (payloadKind === SESSION_CANCEL_KIND) {
|
|
41372
|
-
payloadSessionId =
|
|
41654
|
+
payloadSessionId = payload.sessionId;
|
|
41373
41655
|
} else if (payloadKind === SESSION_CONFIGURE_KIND) {
|
|
41374
|
-
payloadSessionId =
|
|
41656
|
+
payloadSessionId = payload.sessionId;
|
|
41375
41657
|
} else if (payloadKind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41376
|
-
payloadSessionId =
|
|
41658
|
+
payloadSessionId = payload.sessionId;
|
|
41377
41659
|
} else if (payloadKind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41378
|
-
payloadSessionId =
|
|
41660
|
+
payloadSessionId = payload.sessionId;
|
|
41379
41661
|
} else if (payloadKind === SESSION_PROMPT_KIND) {
|
|
41380
|
-
payloadSessionId =
|
|
41662
|
+
payloadSessionId = payload.sessionId;
|
|
41381
41663
|
} else {
|
|
41382
41664
|
throw new Error("Runtime delivery contains an unsupported protocol message");
|
|
41383
41665
|
}
|
|
@@ -41385,14 +41667,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41385
41667
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
41386
41668
|
}
|
|
41387
41669
|
const stored = outbox.claimRuntimeDelivery(delivery);
|
|
41388
|
-
send(
|
|
41389
|
-
|
|
41390
|
-
|
|
41391
|
-
|
|
41392
|
-
|
|
41393
|
-
sessionId: delivery.sessionId
|
|
41394
|
-
})
|
|
41395
|
-
);
|
|
41670
|
+
send(socket, {
|
|
41671
|
+
deliveryId: delivery.deliveryId,
|
|
41672
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41673
|
+
sessionId: delivery.sessionId
|
|
41674
|
+
});
|
|
41396
41675
|
processRuntimeDelivery(delivery, stored.state);
|
|
41397
41676
|
};
|
|
41398
41677
|
const resumeRuntimeDeliveries = () => {
|
|
@@ -41404,14 +41683,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41404
41683
|
sessionId: stored.sessionId
|
|
41405
41684
|
};
|
|
41406
41685
|
if (stored.state !== "relay_committed") {
|
|
41407
|
-
send(
|
|
41408
|
-
|
|
41409
|
-
|
|
41410
|
-
|
|
41411
|
-
|
|
41412
|
-
sessionId: stored.sessionId
|
|
41413
|
-
})
|
|
41414
|
-
);
|
|
41686
|
+
send(socket, {
|
|
41687
|
+
deliveryId: stored.deliveryId,
|
|
41688
|
+
kind: RUNTIME_DELIVERY_RECEIVED_KIND,
|
|
41689
|
+
sessionId: stored.sessionId
|
|
41690
|
+
});
|
|
41415
41691
|
}
|
|
41416
41692
|
processRuntimeDelivery(delivery, stored.state);
|
|
41417
41693
|
}
|
|
@@ -41470,28 +41746,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41470
41746
|
return;
|
|
41471
41747
|
}
|
|
41472
41748
|
try {
|
|
41473
|
-
const
|
|
41749
|
+
const message = decodeServiceToDaemonMessage(encoded);
|
|
41750
|
+
const kind = message.kind;
|
|
41474
41751
|
if (kind === RUNTIME_DELIVERY_COMMITTED_KIND) {
|
|
41475
|
-
const committed =
|
|
41752
|
+
const committed = message;
|
|
41476
41753
|
if (!outbox.markRuntimeDeliveryCommitted(committed.deliveryId, committed.sessionId)) {
|
|
41477
41754
|
console.warn("Mobius daemon ignored confirmation for an unknown Runtime delivery");
|
|
41478
41755
|
}
|
|
41479
41756
|
return;
|
|
41480
41757
|
}
|
|
41481
41758
|
if (kind === RUNTIME_DELIVERY_KIND) {
|
|
41482
|
-
receiveRuntimeDelivery(
|
|
41759
|
+
receiveRuntimeDelivery(message);
|
|
41483
41760
|
return;
|
|
41484
41761
|
}
|
|
41485
41762
|
if (kind === SESSION_EVENT_ACK_KIND) {
|
|
41486
|
-
publisher.acknowledge(
|
|
41763
|
+
publisher.acknowledge(message);
|
|
41487
41764
|
return;
|
|
41488
41765
|
}
|
|
41489
41766
|
if (kind === SESSION_EVENT_DEFERRED_KIND) {
|
|
41490
|
-
publisher.defer(
|
|
41767
|
+
publisher.defer(message);
|
|
41491
41768
|
return;
|
|
41492
41769
|
}
|
|
41493
41770
|
if (kind === SESSION_EVENT_REJECTED_KIND) {
|
|
41494
|
-
const rejection =
|
|
41771
|
+
const rejection = message;
|
|
41495
41772
|
if (publisher.quarantine(rejection)) {
|
|
41496
41773
|
audit.record({
|
|
41497
41774
|
commandId: rejection.eventId,
|
|
@@ -41505,7 +41782,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41505
41782
|
return;
|
|
41506
41783
|
}
|
|
41507
41784
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
41508
|
-
const command2 =
|
|
41785
|
+
const command2 = message;
|
|
41509
41786
|
const pending = nativeRequests.get(command2.requestId);
|
|
41510
41787
|
if (pending?.sessionId === command2.sessionId) {
|
|
41511
41788
|
pending.controller.abort(
|
|
@@ -41519,35 +41796,29 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41519
41796
|
return;
|
|
41520
41797
|
}
|
|
41521
41798
|
if (kind === AGENT_SETTINGS_DISCOVER_KIND) {
|
|
41522
|
-
const command2 =
|
|
41799
|
+
const command2 = message;
|
|
41523
41800
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
41524
41801
|
(request) => request.agentId === command2.agentId && !request.controller.signal.aborted
|
|
41525
41802
|
);
|
|
41526
41803
|
if (agentSettingsDiscoveries.has(command2.requestId) || existing !== void 0) {
|
|
41527
41804
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41528
|
-
send(
|
|
41529
|
-
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41533
|
-
|
|
41534
|
-
requestId: command2.requestId
|
|
41535
|
-
})
|
|
41536
|
-
);
|
|
41805
|
+
send(socket, {
|
|
41806
|
+
code: "agent_settings_discovery_busy",
|
|
41807
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41808
|
+
message: "Another settings discovery is already running for this Agent",
|
|
41809
|
+
requestId: command2.requestId
|
|
41810
|
+
});
|
|
41537
41811
|
}
|
|
41538
41812
|
return;
|
|
41539
41813
|
}
|
|
41540
41814
|
if (agentSettingsDiscoveries.size >= 4) {
|
|
41541
41815
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41542
|
-
send(
|
|
41543
|
-
|
|
41544
|
-
|
|
41545
|
-
|
|
41546
|
-
|
|
41547
|
-
|
|
41548
|
-
requestId: command2.requestId
|
|
41549
|
-
})
|
|
41550
|
-
);
|
|
41816
|
+
send(socket, {
|
|
41817
|
+
code: "agent_settings_discovery_busy",
|
|
41818
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41819
|
+
message: "Too many Agent settings discoveries are running",
|
|
41820
|
+
requestId: command2.requestId
|
|
41821
|
+
});
|
|
41551
41822
|
}
|
|
41552
41823
|
return;
|
|
41553
41824
|
}
|
|
@@ -41579,7 +41850,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41579
41850
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41580
41851
|
});
|
|
41581
41852
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41582
|
-
send(socket,
|
|
41853
|
+
send(socket, result);
|
|
41583
41854
|
}
|
|
41584
41855
|
} catch (error62) {
|
|
41585
41856
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41594,15 +41865,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41594
41865
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41595
41866
|
});
|
|
41596
41867
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41597
|
-
send(
|
|
41598
|
-
|
|
41599
|
-
|
|
41600
|
-
|
|
41601
|
-
|
|
41602
|
-
|
|
41603
|
-
requestId: command2.requestId
|
|
41604
|
-
})
|
|
41605
|
-
);
|
|
41868
|
+
send(socket, {
|
|
41869
|
+
code: operationErrorCode(failure2),
|
|
41870
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
41871
|
+
message: operationErrorMessage(failure2),
|
|
41872
|
+
requestId: command2.requestId
|
|
41873
|
+
});
|
|
41606
41874
|
}
|
|
41607
41875
|
} finally {
|
|
41608
41876
|
timeout.cancel();
|
|
@@ -41617,18 +41885,15 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41617
41885
|
return;
|
|
41618
41886
|
}
|
|
41619
41887
|
if (kind === AGENT_CATALOG_REFRESH_KIND) {
|
|
41620
|
-
const command2 =
|
|
41888
|
+
const command2 = message;
|
|
41621
41889
|
if (agentCatalogRefreshes.has(command2.requestId) || agentCatalogRefreshes.size > 0) {
|
|
41622
41890
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41623
|
-
send(
|
|
41624
|
-
|
|
41625
|
-
|
|
41626
|
-
|
|
41627
|
-
|
|
41628
|
-
|
|
41629
|
-
requestId: command2.requestId
|
|
41630
|
-
})
|
|
41631
|
-
);
|
|
41891
|
+
send(socket, {
|
|
41892
|
+
code: "agent_catalog_refresh_busy",
|
|
41893
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41894
|
+
message: "Another local Agent catalog refresh is already running",
|
|
41895
|
+
requestId: command2.requestId
|
|
41896
|
+
});
|
|
41632
41897
|
}
|
|
41633
41898
|
return;
|
|
41634
41899
|
}
|
|
@@ -41653,13 +41918,10 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41653
41918
|
sessionId: "agent-catalog"
|
|
41654
41919
|
});
|
|
41655
41920
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41656
|
-
send(
|
|
41657
|
-
|
|
41658
|
-
|
|
41659
|
-
|
|
41660
|
-
requestId: command2.requestId
|
|
41661
|
-
})
|
|
41662
|
-
);
|
|
41921
|
+
send(socket, {
|
|
41922
|
+
kind: AGENT_CATALOG_REFRESHED_KIND,
|
|
41923
|
+
requestId: command2.requestId
|
|
41924
|
+
});
|
|
41663
41925
|
}
|
|
41664
41926
|
} catch (error62) {
|
|
41665
41927
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41674,15 +41936,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41674
41936
|
sessionId: "agent-catalog"
|
|
41675
41937
|
});
|
|
41676
41938
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41677
|
-
send(
|
|
41678
|
-
|
|
41679
|
-
|
|
41680
|
-
|
|
41681
|
-
|
|
41682
|
-
|
|
41683
|
-
requestId: command2.requestId
|
|
41684
|
-
})
|
|
41685
|
-
);
|
|
41939
|
+
send(socket, {
|
|
41940
|
+
code: operationErrorCode(failure2),
|
|
41941
|
+
kind: AGENT_CATALOG_REFRESH_FAILED_KIND,
|
|
41942
|
+
message: operationErrorMessage(failure2),
|
|
41943
|
+
requestId: command2.requestId
|
|
41944
|
+
});
|
|
41686
41945
|
}
|
|
41687
41946
|
} finally {
|
|
41688
41947
|
timeout.cancel();
|
|
@@ -41693,7 +41952,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41693
41952
|
return;
|
|
41694
41953
|
}
|
|
41695
41954
|
if (kind === NATIVE_SESSION_REQUEST_KIND) {
|
|
41696
|
-
const command2 =
|
|
41955
|
+
const command2 = message;
|
|
41697
41956
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41698
41957
|
(request) => request.agentId === command2.agentId
|
|
41699
41958
|
);
|
|
@@ -41746,7 +42005,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41746
42005
|
operationSignal.throwIfAborted();
|
|
41747
42006
|
const result = await nativeSessions.execute(command2, operationSignal);
|
|
41748
42007
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41749
|
-
send(socket,
|
|
42008
|
+
send(socket, result);
|
|
41750
42009
|
}
|
|
41751
42010
|
} catch (error62) {
|
|
41752
42011
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41775,7 +42034,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41775
42034
|
return;
|
|
41776
42035
|
}
|
|
41777
42036
|
if (kind === NATIVE_SESSION_TURN_FORK_KIND) {
|
|
41778
|
-
const command2 =
|
|
42037
|
+
const command2 = message;
|
|
41779
42038
|
const previous2 = [...nativeRequests.values()].filter(
|
|
41780
42039
|
(request) => request.agentId === command2.agentId
|
|
41781
42040
|
);
|
|
@@ -41826,7 +42085,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41826
42085
|
operationSignal.throwIfAborted();
|
|
41827
42086
|
const result = await nativeSessions.executeTurnFork(command2, operationSignal);
|
|
41828
42087
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41829
|
-
send(socket,
|
|
42088
|
+
send(socket, result);
|
|
41830
42089
|
}
|
|
41831
42090
|
} catch (error62) {
|
|
41832
42091
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41855,39 +42114,35 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41855
42114
|
return;
|
|
41856
42115
|
}
|
|
41857
42116
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
41858
|
-
decodeRuntimeLivenessReadyEvent(encoded);
|
|
41859
42117
|
connectionLiveness.start();
|
|
41860
42118
|
return;
|
|
41861
42119
|
}
|
|
41862
42120
|
if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
|
|
41863
|
-
connectionLiveness.acknowledge(
|
|
42121
|
+
connectionLiveness.acknowledge(message);
|
|
41864
42122
|
return;
|
|
41865
42123
|
}
|
|
41866
42124
|
if (kind === FILE_READ_KIND) {
|
|
41867
|
-
const command2 =
|
|
42125
|
+
const command2 = message;
|
|
41868
42126
|
void streamLocalFile(
|
|
41869
42127
|
command2,
|
|
41870
|
-
(
|
|
42128
|
+
(message2) => send(socket, message2),
|
|
41871
42129
|
connectionController.signal
|
|
41872
42130
|
).catch((error62) => {
|
|
41873
42131
|
if (socket.readyState !== WebSocket2.OPEN || connectionController.signal.aborted) {
|
|
41874
42132
|
return;
|
|
41875
42133
|
}
|
|
41876
|
-
send(
|
|
41877
|
-
|
|
41878
|
-
|
|
41879
|
-
|
|
41880
|
-
|
|
41881
|
-
|
|
41882
|
-
|
|
41883
|
-
sessionId: command2.sessionId
|
|
41884
|
-
})
|
|
41885
|
-
);
|
|
42134
|
+
send(socket, {
|
|
42135
|
+
code: "file_unavailable",
|
|
42136
|
+
kind: FILE_FAILED_KIND,
|
|
42137
|
+
message: error62 instanceof Error ? error62.message : "The local file is unavailable",
|
|
42138
|
+
requestId: command2.requestId,
|
|
42139
|
+
sessionId: command2.sessionId
|
|
42140
|
+
});
|
|
41886
42141
|
});
|
|
41887
42142
|
return;
|
|
41888
42143
|
}
|
|
41889
42144
|
if (kind === SESSION_CANCEL_KIND) {
|
|
41890
|
-
const cancellation =
|
|
42145
|
+
const cancellation = message;
|
|
41891
42146
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
41892
42147
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
41893
42148
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -41907,12 +42162,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41907
42162
|
return;
|
|
41908
42163
|
}
|
|
41909
42164
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
41910
|
-
const command2 =
|
|
42165
|
+
const command2 = message;
|
|
41911
42166
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
41912
42167
|
return;
|
|
41913
42168
|
}
|
|
41914
42169
|
if (kind === SESSION_PREPARE_KIND) {
|
|
41915
|
-
const command2 =
|
|
42170
|
+
const command2 = message;
|
|
41916
42171
|
void executeSessionPrepare(
|
|
41917
42172
|
publisher,
|
|
41918
42173
|
socket,
|
|
@@ -41926,7 +42181,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41926
42181
|
return;
|
|
41927
42182
|
}
|
|
41928
42183
|
if (kind === SESSION_CONFIGURE_KIND) {
|
|
41929
|
-
const command2 =
|
|
42184
|
+
const command2 = message;
|
|
41930
42185
|
void executeSessionConfigure(
|
|
41931
42186
|
publisher,
|
|
41932
42187
|
socket,
|
|
@@ -41940,7 +42195,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41940
42195
|
return;
|
|
41941
42196
|
}
|
|
41942
42197
|
if (kind === SESSION_PERMISSION_RESPOND_KIND) {
|
|
41943
|
-
const command2 =
|
|
42198
|
+
const command2 = message;
|
|
41944
42199
|
void sessions.respondPermission(command2).then(() => {
|
|
41945
42200
|
audit.record({
|
|
41946
42201
|
commandId: command2.interactionId,
|
|
@@ -41953,7 +42208,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41953
42208
|
return;
|
|
41954
42209
|
}
|
|
41955
42210
|
if (kind === SESSION_ELICITATION_RESPOND_KIND) {
|
|
41956
|
-
const command2 =
|
|
42211
|
+
const command2 = message;
|
|
41957
42212
|
void sessions.respondElicitation(command2).then(() => {
|
|
41958
42213
|
audit.record({
|
|
41959
42214
|
commandId: command2.interactionId,
|
|
@@ -41966,14 +42221,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41966
42221
|
return;
|
|
41967
42222
|
}
|
|
41968
42223
|
if (kind === AGENT_INSTALL_REQUEST_KIND) {
|
|
41969
|
-
const command2 =
|
|
42224
|
+
const command2 = message;
|
|
41970
42225
|
void installations.request(command2, signal).catch((error62) => {
|
|
41971
42226
|
console.error("Mobius Agent integration installation failed", error62);
|
|
41972
42227
|
});
|
|
41973
42228
|
return;
|
|
41974
42229
|
}
|
|
41975
42230
|
if (kind === AGENT_INSTALL_CANCEL_KIND) {
|
|
41976
|
-
const command2 =
|
|
42231
|
+
const command2 = message;
|
|
41977
42232
|
void installations.cancel(command2.requestId).catch((error62) => {
|
|
41978
42233
|
reportOperationFailure(socket, command2.requestId, "", error62);
|
|
41979
42234
|
});
|
|
@@ -41982,7 +42237,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41982
42237
|
if (kind !== SESSION_PROMPT_KIND) {
|
|
41983
42238
|
throw new Error("Unsupported protocol message");
|
|
41984
42239
|
}
|
|
41985
|
-
const command =
|
|
42240
|
+
const command = message;
|
|
41986
42241
|
if (activeTurns.has(command.commandId)) {
|
|
41987
42242
|
return;
|
|
41988
42243
|
}
|
|
@@ -42103,13 +42358,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42103
42358
|
const publisher = new DaemonSessionEventPublisher(outbox, timer);
|
|
42104
42359
|
const activeTurns = /* @__PURE__ */ new Map();
|
|
42105
42360
|
const activeAttemptIds = /* @__PURE__ */ new Map();
|
|
42106
|
-
const recordSessionEvent = (sessionId,
|
|
42361
|
+
const recordSessionEvent = (sessionId, event) => {
|
|
42107
42362
|
const attemptId = activeAttemptIds.get(sessionId);
|
|
42108
42363
|
if (attemptId === void 0) {
|
|
42109
|
-
publisher.recordRuntime(sessionId,
|
|
42364
|
+
publisher.recordRuntime(sessionId, event);
|
|
42110
42365
|
return;
|
|
42111
42366
|
}
|
|
42112
|
-
publisher.recordAttempt(sessionId,
|
|
42367
|
+
publisher.recordAttempt(sessionId, event, attemptId);
|
|
42113
42368
|
};
|
|
42114
42369
|
const sessions = new AcpSessionManager(new DaemonAcpObserver(config2, recordSessionEvent), sessionStore);
|
|
42115
42370
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|