@moxt-ai/mobius 0.0.335 → 0.0.336
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/cli.js +283 -123
- package/dist/cli.js.map +3 -3
- package/dist/daemon/control/protocol.d.ts +2 -0
- package/dist/daemon/control/protocol.d.ts.map +1 -1
- package/dist/daemon/control/protocol.js +25 -0
- package/dist/daemon/control/protocol.js.map +1 -1
- package/dist/daemon/control/switch-status.d.ts.map +1 -1
- package/dist/daemon/control/switch-status.js +3 -3
- package/dist/daemon/control/switch-status.js.map +1 -1
- package/dist/daemon/lifecycle/manager-client.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager-client.js +12 -12
- package/dist/daemon/lifecycle/manager-client.js.map +1 -1
- package/dist/daemon/lifecycle/manager.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager.js +4 -9
- package/dist/daemon/lifecycle/manager.js.map +1 -1
- package/dist/daemon/upgrades/upgrade.d.ts.map +1 -1
- package/dist/daemon/upgrades/upgrade.js +4 -4
- package/dist/daemon/upgrades/upgrade.js.map +1 -1
- package/dist/runtime/relay/run-relay-connection.d.ts.map +1 -1
- package/dist/runtime/relay/run-relay-connection.js +5 -57
- package/dist/runtime/relay/run-relay-connection.js.map +1 -1
- package/dist/runtime.js +236 -93
- package/dist/runtime.js.map +3 -3
- package/dist/session/live/session-configurations.d.ts.map +1 -1
- package/dist/session/live/session-configurations.js +8 -1
- package/dist/session/live/session-configurations.js.map +1 -1
- package/dist/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/session/turn/execution-receipts.js +6 -3
- package/dist/session/turn/execution-receipts.js.map +1 -1
- package/dist/storage/session/execution-receipt-table.d.ts.map +1 -1
- package/dist/storage/session/execution-receipt-table.js +5 -2
- package/dist/storage/session/execution-receipt-table.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2086,7 +2086,7 @@ var init_package = __esm({
|
|
|
2086
2086
|
"package.json"() {
|
|
2087
2087
|
package_default = {
|
|
2088
2088
|
name: "@moxt-ai/mobius",
|
|
2089
|
-
version: "0.0.
|
|
2089
|
+
version: "0.0.336",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -73958,7 +73958,7 @@ function decodeZodValue(value, schema) {
|
|
|
73958
73958
|
function encodeZodMessage(message, schema) {
|
|
73959
73959
|
return JSON.stringify(decodeZodValue(message, schema));
|
|
73960
73960
|
}
|
|
73961
|
-
var ProtocolMessageError
|
|
73961
|
+
var ProtocolMessageError;
|
|
73962
73962
|
var init_message_codec = __esm({
|
|
73963
73963
|
"../mobius-sdk/src/protocol/shared/message-codec.ts"() {
|
|
73964
73964
|
"use strict";
|
|
@@ -73971,17 +73971,6 @@ var init_message_codec = __esm({
|
|
|
73971
73971
|
this.name = "ProtocolMessageError";
|
|
73972
73972
|
}
|
|
73973
73973
|
};
|
|
73974
|
-
UnsupportedProtocolMessageKindError = class extends Error {
|
|
73975
|
-
code = "unsupported_protocol_message_kind";
|
|
73976
|
-
direction;
|
|
73977
|
-
messageKind;
|
|
73978
|
-
constructor(direction, messageKind) {
|
|
73979
|
-
super(`Unsupported ${direction} message kind: ${messageKind}`);
|
|
73980
|
-
this.name = "UnsupportedProtocolMessageKindError";
|
|
73981
|
-
this.direction = direction;
|
|
73982
|
-
this.messageKind = messageKind;
|
|
73983
|
-
}
|
|
73984
|
-
};
|
|
73985
73974
|
}
|
|
73986
73975
|
});
|
|
73987
73976
|
|
|
@@ -75278,6 +75267,86 @@ var init_native = __esm({
|
|
|
75278
75267
|
});
|
|
75279
75268
|
|
|
75280
75269
|
// ../mobius-sdk/src/protocol/session/observability/event-log.ts
|
|
75270
|
+
function isRecord4(value) {
|
|
75271
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
75272
|
+
}
|
|
75273
|
+
function hasUnknownDiscriminator(value, key, known) {
|
|
75274
|
+
if (!isRecord4(value)) {
|
|
75275
|
+
return false;
|
|
75276
|
+
}
|
|
75277
|
+
const variant = value[key];
|
|
75278
|
+
return typeof variant === "string" && !known.has(variant);
|
|
75279
|
+
}
|
|
75280
|
+
function containsUnknownContentBlock(value) {
|
|
75281
|
+
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
75282
|
+
}
|
|
75283
|
+
function containsUnknownToolCallContent(value) {
|
|
75284
|
+
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
75285
|
+
return true;
|
|
75286
|
+
}
|
|
75287
|
+
return isRecord4(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
75288
|
+
}
|
|
75289
|
+
function arrayContainsUnknown(value, predicate) {
|
|
75290
|
+
return Array.isArray(value) && value.some(predicate);
|
|
75291
|
+
}
|
|
75292
|
+
function containsUnknownAcpVariant(payload) {
|
|
75293
|
+
const update = payload["sessionUpdate"];
|
|
75294
|
+
if (typeof update !== "string") {
|
|
75295
|
+
return false;
|
|
75296
|
+
}
|
|
75297
|
+
if (!knownSessionUpdates.has(update)) {
|
|
75298
|
+
return true;
|
|
75299
|
+
}
|
|
75300
|
+
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
75301
|
+
update
|
|
75302
|
+
)) {
|
|
75303
|
+
return containsUnknownContentBlock(payload["content"]);
|
|
75304
|
+
}
|
|
75305
|
+
if (update === "tool_call" || update === "tool_call_update") {
|
|
75306
|
+
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
75307
|
+
}
|
|
75308
|
+
if (update === "plan_update") {
|
|
75309
|
+
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
75310
|
+
}
|
|
75311
|
+
if (update === "config_option_update") {
|
|
75312
|
+
return arrayContainsUnknown(
|
|
75313
|
+
payload["configOptions"],
|
|
75314
|
+
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
75315
|
+
);
|
|
75316
|
+
}
|
|
75317
|
+
if (update === "compaction_update") {
|
|
75318
|
+
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
75319
|
+
}
|
|
75320
|
+
return false;
|
|
75321
|
+
}
|
|
75322
|
+
function isKnownSessionEventVariant(value) {
|
|
75323
|
+
if (!isRecord4(value)) {
|
|
75324
|
+
return true;
|
|
75325
|
+
}
|
|
75326
|
+
const type = value["type"];
|
|
75327
|
+
if (typeof type !== "string") {
|
|
75328
|
+
return true;
|
|
75329
|
+
}
|
|
75330
|
+
if (type === "acp") {
|
|
75331
|
+
const payload = value["payload"];
|
|
75332
|
+
return !isRecord4(payload) || !containsUnknownAcpVariant(payload);
|
|
75333
|
+
}
|
|
75334
|
+
if (type === "lifecycle-metadata") {
|
|
75335
|
+
const payload = value["payload"];
|
|
75336
|
+
if (!isRecord4(payload)) {
|
|
75337
|
+
return true;
|
|
75338
|
+
}
|
|
75339
|
+
const kind = payload["kind"];
|
|
75340
|
+
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
75341
|
+
return false;
|
|
75342
|
+
}
|
|
75343
|
+
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
75344
|
+
}
|
|
75345
|
+
return false;
|
|
75346
|
+
}
|
|
75347
|
+
function filterKnownSessionEventVariants(events) {
|
|
75348
|
+
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
75349
|
+
}
|
|
75281
75350
|
function inputValue(value) {
|
|
75282
75351
|
if (typeof value !== "string") {
|
|
75283
75352
|
return value;
|
|
@@ -75300,7 +75369,22 @@ function decode4(value, schema) {
|
|
|
75300
75369
|
function encode3(value, schema) {
|
|
75301
75370
|
return JSON.stringify(decode4(value, schema));
|
|
75302
75371
|
}
|
|
75303
|
-
|
|
75372
|
+
function sanitizeKnownNativeSessionEvents(value) {
|
|
75373
|
+
const input2 = inputValue(value);
|
|
75374
|
+
if (!isRecord4(input2)) {
|
|
75375
|
+
return input2;
|
|
75376
|
+
}
|
|
75377
|
+
const page = input2["events"];
|
|
75378
|
+
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
75379
|
+
return {
|
|
75380
|
+
...input2,
|
|
75381
|
+
events: isRecord4(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
75382
|
+
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
75383
|
+
(prompt) => !isRecord4(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
75384
|
+
) : queuedPromptRequests
|
|
75385
|
+
};
|
|
75386
|
+
}
|
|
75387
|
+
var MAX_EVENT_COUNT, MAX_COLLECTION_SIZE2, MAX_CONTENT_LENGTH2, SESSION_EVENT_KIND, SESSION_EVENT_BATCH_MAX_SIZE, boundedString2, shortString, externalContentKeySchema, annotationsSchema, contentFields, textContentSchema, imageContentSchema, audioContentSchema, externalImageContentSchema, externalAudioContentSchema, externalResourceContentSchema, resourceLinkSchema, textResourceSchema, blobResourceSchema, embeddedResourceSchema, contentBlockSchema, toolCallContentSchema, toolKindSchema, toolStatusSchema, backgroundTaskSchema, toolPatchFields, planEntrySchema, planContentSchema, commandSchema, configSelectOptionSchema, configSelectGroupSchema, configBaseFields, sessionConfigOptionSchema2, contentChunkFields, acpSessionUpdateSchema, lifecycleBase, promptExecutionContextSchema, lifecycleMetadataSchema, sessionEventPayloadSchema, positionSchema, sharedSessionEventFields, sessionLiveEventFields, sessionEventSchema, sessionLiveEventSchema, wireLifecyclePayloadSchema, wireEventFields, sessionWireEventSchema, sessionWireEnvelopeSchema, knownContentBlockTypes, knownToolCallContentTypes, knownPlanTypes, knownConfigOptionTypes, knownSessionUpdates, knownLifecycleKinds, sessionEventBatchSchema, sessionLiveEventBatchSchema, sessionExportSchema, mobiusSessionExportSchema, sessionEventEnvelopeSchema, sessionEventLogPageSchema, sessionEventOmissionSchema, nativeEventPageRequestSchema, queuedPromptRequestEventLogSchema, nativeSessionEventsSchema, knownSessionLiveEventBatchSchema, decodeSessionEvent, decodeKnownSessionEventPayload, decodeSessionEventEnvelope, encodeSessionEventEnvelope, decodeAcpSessionUpdate, decodeKnownNativeSessionEvents;
|
|
75304
75388
|
var init_event_log = __esm({
|
|
75305
75389
|
"../mobius-sdk/src/protocol/session/observability/event-log.ts"() {
|
|
75306
75390
|
"use strict";
|
|
@@ -75642,7 +75726,49 @@ var init_event_log = __esm({
|
|
|
75642
75726
|
sessionWireEnvelopeSchema = external_exports.object({
|
|
75643
75727
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
75644
75728
|
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
75645
|
-
}).readonly();
|
|
75729
|
+
}).passthrough().readonly();
|
|
75730
|
+
knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
75731
|
+
"text",
|
|
75732
|
+
"image",
|
|
75733
|
+
"audio",
|
|
75734
|
+
"resource_link",
|
|
75735
|
+
"resource",
|
|
75736
|
+
"external_image",
|
|
75737
|
+
"external_audio",
|
|
75738
|
+
"external_resource"
|
|
75739
|
+
]);
|
|
75740
|
+
knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
75741
|
+
knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
75742
|
+
knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
75743
|
+
knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
75744
|
+
"user_message_chunk",
|
|
75745
|
+
"agent_message_chunk",
|
|
75746
|
+
"agent_thought_chunk",
|
|
75747
|
+
"tool_call",
|
|
75748
|
+
"tool_call_update",
|
|
75749
|
+
"plan",
|
|
75750
|
+
"plan_update",
|
|
75751
|
+
"plan_removed",
|
|
75752
|
+
"available_commands_update",
|
|
75753
|
+
"current_mode_update",
|
|
75754
|
+
"config_option_update",
|
|
75755
|
+
"session_info_update",
|
|
75756
|
+
"usage_update",
|
|
75757
|
+
"compaction_update",
|
|
75758
|
+
"compaction_summary_chunk"
|
|
75759
|
+
]);
|
|
75760
|
+
knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
75761
|
+
"session.queue.changed",
|
|
75762
|
+
"session.permission.requested",
|
|
75763
|
+
"session.permission.resolved",
|
|
75764
|
+
"session.elicitation.requested",
|
|
75765
|
+
"session.elicitation.resolved",
|
|
75766
|
+
"prompt.requested",
|
|
75767
|
+
"prompt.started",
|
|
75768
|
+
"prompt.completed",
|
|
75769
|
+
"prompt.failed-before-start",
|
|
75770
|
+
"prompt.failed"
|
|
75771
|
+
]);
|
|
75646
75772
|
sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75647
75773
|
sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75648
75774
|
sessionExportSchema = external_exports.object({
|
|
@@ -75706,10 +75832,13 @@ var init_event_log = __esm({
|
|
|
75706
75832
|
events: sessionEventLogPageSchema,
|
|
75707
75833
|
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75708
75834
|
}).readonly();
|
|
75835
|
+
knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75709
75836
|
decodeSessionEvent = (value) => decode4(value, sessionEventSchema);
|
|
75837
|
+
decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode4(value, sessionEventPayloadSchema) : null;
|
|
75710
75838
|
decodeSessionEventEnvelope = (value) => decode4(value, sessionEventEnvelopeSchema);
|
|
75711
75839
|
encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
75712
75840
|
decodeAcpSessionUpdate = (value) => decode4(value, acpSessionUpdateSchema);
|
|
75841
|
+
decodeKnownNativeSessionEvents = (value) => decode4(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
75713
75842
|
}
|
|
75714
75843
|
});
|
|
75715
75844
|
|
|
@@ -75722,7 +75851,18 @@ function decode5(schema, encoded) {
|
|
|
75722
75851
|
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
75723
75852
|
}
|
|
75724
75853
|
}
|
|
75725
|
-
|
|
75854
|
+
function decodeLoaded(schema, encoded) {
|
|
75855
|
+
try {
|
|
75856
|
+
const value = JSON.parse(encoded);
|
|
75857
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
75858
|
+
return schema.parse(value);
|
|
75859
|
+
}
|
|
75860
|
+
return schema.parse({ ...value, events: decodeKnownNativeSessionEvents(Reflect.get(value, "events")) });
|
|
75861
|
+
} catch (cause) {
|
|
75862
|
+
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
75863
|
+
}
|
|
75864
|
+
}
|
|
75865
|
+
var SESSION_HISTORY_PAGE_LOAD_KIND, SESSION_HISTORY_PAGE_LOADED_KIND, SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND, SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND, pageRequestFields, sessionHistoryPageLoadSchema, sessionPreviewHistoryPageLoadSchema, pageLoadedFields, sessionHistoryPageLoadedSchema, sessionPreviewHistoryPageLoadedSchema, wireNativeSessionEventsSchema, sessionHistoryWirePageLoadedSchema, sessionPreviewHistoryWirePageLoadedSchema, decodeSessionHistoryPageLoad, decodeSessionHistoryPageLoaded, decodeSessionPreviewHistoryPageLoad, decodeSessionPreviewHistoryPageLoaded, encodeSessionHistoryPageLoad, encodeSessionHistoryPageLoaded, encodeSessionPreviewHistoryPageLoad, encodeSessionPreviewHistoryPageLoaded;
|
|
75726
75866
|
var init_history2 = __esm({
|
|
75727
75867
|
"../mobius-sdk/src/protocol/session/observability/history.ts"() {
|
|
75728
75868
|
"use strict";
|
|
@@ -75759,10 +75899,34 @@ var init_history2 = __esm({
|
|
|
75759
75899
|
};
|
|
75760
75900
|
sessionHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
75761
75901
|
sessionPreviewHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
75902
|
+
wireNativeSessionEventsSchema = external_exports.object({
|
|
75903
|
+
events: external_exports.object({
|
|
75904
|
+
events: external_exports.array(external_exports.unknown()).max(1e4).readonly(),
|
|
75905
|
+
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
75906
|
+
sessionGenerationId: identifierStringSchema,
|
|
75907
|
+
tailCursor: external_exports.string().max(512),
|
|
75908
|
+
throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/u).optional(),
|
|
75909
|
+
truncated: external_exports.boolean(),
|
|
75910
|
+
version: external_exports.literal(2)
|
|
75911
|
+
}).passthrough().readonly(),
|
|
75912
|
+
queuedPromptRequests: external_exports.array(external_exports.unknown()).max(1e3).readonly()
|
|
75913
|
+
}).passthrough().readonly();
|
|
75914
|
+
sessionHistoryWirePageLoadedSchema = external_exports.object({
|
|
75915
|
+
events: wireNativeSessionEventsSchema,
|
|
75916
|
+
kind: external_exports.literal(SESSION_HISTORY_PAGE_LOADED_KIND),
|
|
75917
|
+
requestId: identifierStringSchema,
|
|
75918
|
+
sessionId: identifierStringSchema
|
|
75919
|
+
}).passthrough().readonly();
|
|
75920
|
+
sessionPreviewHistoryWirePageLoadedSchema = external_exports.object({
|
|
75921
|
+
events: wireNativeSessionEventsSchema,
|
|
75922
|
+
kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND),
|
|
75923
|
+
requestId: identifierStringSchema,
|
|
75924
|
+
sessionId: identifierStringSchema
|
|
75925
|
+
}).passthrough().readonly();
|
|
75762
75926
|
decodeSessionHistoryPageLoad = (encoded) => decode5(sessionHistoryPageLoadSchema, encoded);
|
|
75763
|
-
decodeSessionHistoryPageLoaded = (encoded) =>
|
|
75927
|
+
decodeSessionHistoryPageLoaded = (encoded) => decodeLoaded(sessionHistoryPageLoadedSchema, encoded);
|
|
75764
75928
|
decodeSessionPreviewHistoryPageLoad = (encoded) => decode5(sessionPreviewHistoryPageLoadSchema, encoded);
|
|
75765
|
-
decodeSessionPreviewHistoryPageLoaded = (encoded) =>
|
|
75929
|
+
decodeSessionPreviewHistoryPageLoaded = (encoded) => decodeLoaded(sessionPreviewHistoryPageLoadedSchema, encoded);
|
|
75766
75930
|
encodeSessionHistoryPageLoad = (value) => JSON.stringify(sessionHistoryPageLoadSchema.parse(value));
|
|
75767
75931
|
encodeSessionHistoryPageLoaded = (value) => JSON.stringify(sessionHistoryPageLoadedSchema.parse(value));
|
|
75768
75932
|
encodeSessionPreviewHistoryPageLoad = (value) => JSON.stringify(sessionPreviewHistoryPageLoadSchema.parse(value));
|
|
@@ -76094,7 +76258,7 @@ var init_turn_history = __esm({
|
|
|
76094
76258
|
});
|
|
76095
76259
|
|
|
76096
76260
|
// ../mobius-sdk/src/protocol/session/recording/webhooks.ts
|
|
76097
|
-
var isoTimestamp2, shortText2, promptSucceededOutcome2, promptCancelledOutcome2, promptFailedOutcome2, sessionStatusWebhookCommandSchema, sessionStatusWebhookBodySchema;
|
|
76261
|
+
var isoTimestamp2, shortText2, promptSucceededOutcome2, promptCancelledOutcome2, promptFailedOutcome2, sessionStatusWebhookCommandSchema, sessionStatusWebhookBodyFields, sessionStatusWebhookBodySchema, consumedSessionStatusWebhookBodySchema;
|
|
76098
76262
|
var init_webhooks = __esm({
|
|
76099
76263
|
"../mobius-sdk/src/protocol/session/recording/webhooks.ts"() {
|
|
76100
76264
|
"use strict";
|
|
@@ -76127,13 +76291,20 @@ var init_webhooks = __esm({
|
|
|
76127
76291
|
outcome: external_exports.literal("failed")
|
|
76128
76292
|
}).readonly()
|
|
76129
76293
|
]);
|
|
76130
|
-
|
|
76294
|
+
sessionStatusWebhookBodyFields = {
|
|
76131
76295
|
appId: identifierStringSchema,
|
|
76132
|
-
commands: external_exports.array(sessionStatusWebhookCommandSchema).min(1).readonly(),
|
|
76133
76296
|
projectId: identifierStringSchema,
|
|
76134
76297
|
runtimeId: identifierStringSchema,
|
|
76135
76298
|
sessionId: identifierStringSchema,
|
|
76136
76299
|
status: sessionRecordingStatusSchema
|
|
76300
|
+
};
|
|
76301
|
+
sessionStatusWebhookBodySchema = external_exports.object({
|
|
76302
|
+
...sessionStatusWebhookBodyFields,
|
|
76303
|
+
commands: external_exports.array(sessionStatusWebhookCommandSchema).min(1).readonly()
|
|
76304
|
+
}).readonly();
|
|
76305
|
+
consumedSessionStatusWebhookBodySchema = external_exports.object({
|
|
76306
|
+
...sessionStatusWebhookBodyFields,
|
|
76307
|
+
commands: external_exports.array(sessionStatusWebhookCommandSchema).readonly()
|
|
76137
76308
|
}).readonly();
|
|
76138
76309
|
}
|
|
76139
76310
|
});
|
|
@@ -76251,18 +76422,32 @@ function defineMessageSignature(kind, encoder, decoder) {
|
|
|
76251
76422
|
schema
|
|
76252
76423
|
};
|
|
76253
76424
|
}
|
|
76254
|
-
function
|
|
76425
|
+
function isRecord5(value) {
|
|
76426
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76427
|
+
}
|
|
76428
|
+
function hasUnknownDiscriminator2(value, key, known) {
|
|
76429
|
+
if (!isRecord5(value)) {
|
|
76430
|
+
return false;
|
|
76431
|
+
}
|
|
76432
|
+
const variant = value[key];
|
|
76433
|
+
return typeof variant === "string" && !known.has(variant);
|
|
76434
|
+
}
|
|
76435
|
+
function hasUnknownServiceVariant(kind, value) {
|
|
76436
|
+
return kind === NATIVE_SESSION_REQUEST_KIND && hasUnknownDiscriminator2(value, "action", knownNativeActions);
|
|
76437
|
+
}
|
|
76438
|
+
function decodeKnownServiceToDaemonMessage(encoded) {
|
|
76255
76439
|
const kind = decodeMessageKind(encoded);
|
|
76256
76440
|
const signature = serviceToDaemonRegistry[kind];
|
|
76257
76441
|
if (signature === void 0) {
|
|
76258
|
-
|
|
76442
|
+
return null;
|
|
76259
76443
|
}
|
|
76260
|
-
|
|
76444
|
+
const value = parseJson(encoded);
|
|
76445
|
+
return hasUnknownServiceVariant(kind, value) ? null : signature.decoder(encoded);
|
|
76261
76446
|
}
|
|
76262
76447
|
function encodeDaemonToServiceMessage(message) {
|
|
76263
76448
|
return daemonToServiceSignatures[message.kind].encoder(message);
|
|
76264
76449
|
}
|
|
76265
|
-
var serviceToDaemonSignatures, serviceToDaemonRegistry, daemonToServiceSignatures;
|
|
76450
|
+
var serviceToDaemonSignatures, serviceToDaemonRegistry, knownNativeActions, daemonToServiceSignatures;
|
|
76266
76451
|
var init_daemon_transport = __esm({
|
|
76267
76452
|
"../mobius-sdk/src/protocol/transport/daemon-transport.ts"() {
|
|
76268
76453
|
"use strict";
|
|
@@ -76413,6 +76598,7 @@ var init_daemon_transport = __esm({
|
|
|
76413
76598
|
)
|
|
76414
76599
|
};
|
|
76415
76600
|
serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
76601
|
+
knownNativeActions = /* @__PURE__ */ new Set(["active-turn", "find", "list", "import", "fork"]);
|
|
76416
76602
|
daemonToServiceSignatures = {
|
|
76417
76603
|
[SESSION_CLOSED_KIND]: defineMessageSignature(
|
|
76418
76604
|
SESSION_CLOSED_KIND,
|
|
@@ -76574,7 +76760,6 @@ var init_protocol = __esm({
|
|
|
76574
76760
|
init_workspace();
|
|
76575
76761
|
init_directory();
|
|
76576
76762
|
init_identifier();
|
|
76577
|
-
init_message_codec();
|
|
76578
76763
|
init_daemon_transport();
|
|
76579
76764
|
}
|
|
76580
76765
|
});
|
|
@@ -82393,7 +82578,7 @@ var init_native_session = __esm({
|
|
|
82393
82578
|
|
|
82394
82579
|
// src/acp/protocol/session-config-protocol.ts
|
|
82395
82580
|
import { methods as methods9 } from "@agentclientprotocol/sdk";
|
|
82396
|
-
function
|
|
82581
|
+
function isRecord6(value) {
|
|
82397
82582
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82398
82583
|
}
|
|
82399
82584
|
function readString3(value, fallback = "") {
|
|
@@ -82424,7 +82609,7 @@ function normalizeConfigValues(value) {
|
|
|
82424
82609
|
}
|
|
82425
82610
|
const normalized = [];
|
|
82426
82611
|
for (const entry of value) {
|
|
82427
|
-
if (!
|
|
82612
|
+
if (!isRecord6(entry)) {
|
|
82428
82613
|
continue;
|
|
82429
82614
|
}
|
|
82430
82615
|
const groupedOptions = entry["options"];
|
|
@@ -82432,7 +82617,7 @@ function normalizeConfigValues(value) {
|
|
|
82432
82617
|
const groupId = readString3(entry["group"]);
|
|
82433
82618
|
const groupName = readString3(entry["name"]);
|
|
82434
82619
|
for (const groupedOption of groupedOptions) {
|
|
82435
|
-
if (
|
|
82620
|
+
if (isRecord6(groupedOption)) {
|
|
82436
82621
|
const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
|
|
82437
82622
|
if (normalizedValue !== void 0) {
|
|
82438
82623
|
normalized.push(normalizedValue);
|
|
@@ -82457,7 +82642,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82457
82642
|
const normalized = [];
|
|
82458
82643
|
if (Array.isArray(value)) {
|
|
82459
82644
|
for (const option of value) {
|
|
82460
|
-
if (!
|
|
82645
|
+
if (!isRecord6(option)) {
|
|
82461
82646
|
continue;
|
|
82462
82647
|
}
|
|
82463
82648
|
const id = truncate3(readString3(option["id"]), 128);
|
|
@@ -82497,12 +82682,12 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82497
82682
|
}
|
|
82498
82683
|
}
|
|
82499
82684
|
}
|
|
82500
|
-
if (
|
|
82685
|
+
if (isRecord6(modes)) {
|
|
82501
82686
|
const values = [];
|
|
82502
82687
|
const availableModes = modes["availableModes"];
|
|
82503
82688
|
if (Array.isArray(availableModes)) {
|
|
82504
82689
|
for (const mode of availableModes) {
|
|
82505
|
-
if (!
|
|
82690
|
+
if (!isRecord6(mode)) {
|
|
82506
82691
|
continue;
|
|
82507
82692
|
}
|
|
82508
82693
|
const id = truncate3(readString3(mode["id"]), 500);
|
|
@@ -82535,7 +82720,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82535
82720
|
return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
82536
82721
|
}
|
|
82537
82722
|
function normalizeStandardLifecycle(response) {
|
|
82538
|
-
const lifecycle =
|
|
82723
|
+
const lifecycle = isRecord6(response) ? response : {};
|
|
82539
82724
|
return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
82540
82725
|
}
|
|
82541
82726
|
function replaceStandardConfigOptions(current, value) {
|
|
@@ -82592,7 +82777,7 @@ var init_session_config_protocol = __esm({
|
|
|
82592
82777
|
"ACP agent exited while changing session configuration",
|
|
82593
82778
|
change.signal
|
|
82594
82779
|
);
|
|
82595
|
-
if (!
|
|
82780
|
+
if (!isRecord6(response) || !Array.isArray(response["configOptions"])) {
|
|
82596
82781
|
throw new SessionConfigProtocolError("The Agent returned an invalid session configuration response");
|
|
82597
82782
|
}
|
|
82598
82783
|
return replaceStandardConfigOptions(current, response["configOptions"]);
|
|
@@ -90431,7 +90616,7 @@ function decodeBase64(data) {
|
|
|
90431
90616
|
}
|
|
90432
90617
|
return bytes;
|
|
90433
90618
|
}
|
|
90434
|
-
function
|
|
90619
|
+
function isRecord7(value) {
|
|
90435
90620
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90436
90621
|
}
|
|
90437
90622
|
var MAXIMUM_ENCODED_CONTENT_CHARACTERS, embeddedImageSchema, inlineImageUrlSchema, toolImageSchema, AcpContentExternalizer;
|
|
@@ -90568,13 +90753,13 @@ var init_content_externalizer = __esm({
|
|
|
90568
90753
|
}
|
|
90569
90754
|
return result2;
|
|
90570
90755
|
}
|
|
90571
|
-
if (!
|
|
90756
|
+
if (!isRecord7(value)) {
|
|
90572
90757
|
return value;
|
|
90573
90758
|
}
|
|
90574
90759
|
const image = toolImageSchema.safeParse(value);
|
|
90575
90760
|
if (image.success && image.data.data.length > 0) {
|
|
90576
90761
|
const prepared = await this.#content(sessionId, image.data, signal);
|
|
90577
|
-
if (
|
|
90762
|
+
if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
90578
90763
|
images.set(prepared.event["imageKey"], prepared);
|
|
90579
90764
|
} else {
|
|
90580
90765
|
images.set(`unavailable:${images.size}`, prepared);
|
|
@@ -90605,7 +90790,7 @@ var init_content_externalizer = __esm({
|
|
|
90605
90790
|
const prepared = await this.#content(sessionId, content, signal);
|
|
90606
90791
|
agentContent.push({ ...item, content: prepared.agent });
|
|
90607
90792
|
eventContent.push({ ...item, content: prepared.event });
|
|
90608
|
-
if (
|
|
90793
|
+
if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
90609
90794
|
images.delete(prepared.event["imageKey"]);
|
|
90610
90795
|
}
|
|
90611
90796
|
}
|
|
@@ -90766,7 +90951,7 @@ var init_relay_authentication = __esm({
|
|
|
90766
90951
|
|
|
90767
90952
|
// src/runtime/catalog/publish-agent-catalog.ts
|
|
90768
90953
|
import { fetch as fetch2 } from "undici";
|
|
90769
|
-
function
|
|
90954
|
+
function isRecord8(value) {
|
|
90770
90955
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90771
90956
|
}
|
|
90772
90957
|
function isSafeRelayErrorMessage(value) {
|
|
@@ -90779,7 +90964,7 @@ async function rejectedCatalogError(response) {
|
|
|
90779
90964
|
} catch {
|
|
90780
90965
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
90781
90966
|
}
|
|
90782
|
-
if (!
|
|
90967
|
+
if (!isRecord8(value) || !isRecord8(value["error"])) {
|
|
90783
90968
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
90784
90969
|
}
|
|
90785
90970
|
const code = value["error"]["code"];
|
|
@@ -91128,7 +91313,7 @@ var init_runtime_connection = __esm({
|
|
|
91128
91313
|
// src/runtime/connection/runtime-installation-store.ts
|
|
91129
91314
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
91130
91315
|
import { resolve as resolve15 } from "node:path";
|
|
91131
|
-
function
|
|
91316
|
+
function isRecord9(value) {
|
|
91132
91317
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
91133
91318
|
}
|
|
91134
91319
|
function hasExactKeys(value, expectedKeys) {
|
|
@@ -91195,7 +91380,7 @@ function installationId() {
|
|
|
91195
91380
|
return `min_${randomUUID13().replaceAll("-", "")}`;
|
|
91196
91381
|
}
|
|
91197
91382
|
function decodeInstallationPointer(value) {
|
|
91198
|
-
if (!
|
|
91383
|
+
if (!isRecord9(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
91199
91384
|
throw new RuntimeInstallationStoreError("invalid_installation", "The local installation record is invalid");
|
|
91200
91385
|
}
|
|
91201
91386
|
const storedInstallationId = value["installationId"];
|
|
@@ -91205,7 +91390,7 @@ function decodeInstallationPointer(value) {
|
|
|
91205
91390
|
return { installationId: validateInstallationId(storedInstallationId) };
|
|
91206
91391
|
}
|
|
91207
91392
|
function decodeChannelIndex(value) {
|
|
91208
|
-
if (!
|
|
91393
|
+
if (!isRecord9(value) || !hasExactKeys(value, CHANNEL_INDEX_KEYS) || value["version"] !== 1) {
|
|
91209
91394
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
91210
91395
|
}
|
|
91211
91396
|
const applicationId = value["applicationId"];
|
|
@@ -91255,7 +91440,7 @@ function decodeVerifiedConnection(value) {
|
|
|
91255
91440
|
);
|
|
91256
91441
|
}
|
|
91257
91442
|
function decodeConnection(value) {
|
|
91258
|
-
if (!
|
|
91443
|
+
if (!isRecord9(value)) {
|
|
91259
91444
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
91260
91445
|
}
|
|
91261
91446
|
return decodeVerifiedConnection(value);
|
|
@@ -92477,7 +92662,10 @@ var init_local_server = __esm({
|
|
|
92477
92662
|
});
|
|
92478
92663
|
|
|
92479
92664
|
// src/daemon/control/protocol.ts
|
|
92480
|
-
|
|
92665
|
+
function hasUnknownKind(value, known) {
|
|
92666
|
+
return typeof value === "object" && value !== null && "kind" in value && typeof value.kind === "string" && !known.has(value.kind);
|
|
92667
|
+
}
|
|
92668
|
+
var workerLaunch, transition, daemonSwitchState, lifecycleCommand, lifecycleResponse, lifecycleCommandKinds, lifecycleResponseKinds, daemonSwitchStateKinds, decodeKnownLifecycleCommand, decodeKnownLifecycleResponse;
|
|
92481
92669
|
var init_protocol2 = __esm({
|
|
92482
92670
|
"src/daemon/control/protocol.ts"() {
|
|
92483
92671
|
"use strict";
|
|
@@ -92529,15 +92717,28 @@ var init_protocol2 = __esm({
|
|
|
92529
92717
|
external_exports.object({ kind: external_exports.literal("switching") }),
|
|
92530
92718
|
external_exports.object({ kind: external_exports.literal("error"), code: external_exports.string(), message: external_exports.string() })
|
|
92531
92719
|
]).readonly();
|
|
92720
|
+
lifecycleCommandKinds = /* @__PURE__ */ new Set(["ensure", "status", "stop", "switch", "switch-status"]);
|
|
92721
|
+
lifecycleResponseKinds = /* @__PURE__ */ new Set(["error", "status", "stopped", "switching", "switch-status"]);
|
|
92722
|
+
daemonSwitchStateKinds = /* @__PURE__ */ new Set(["rolled-back", "switched", "switching"]);
|
|
92723
|
+
decodeKnownLifecycleCommand = (value) => hasUnknownKind(value, lifecycleCommandKinds) ? null : lifecycleCommand.parse(value);
|
|
92724
|
+
decodeKnownLifecycleResponse = (value) => {
|
|
92725
|
+
if (hasUnknownKind(value, lifecycleResponseKinds)) {
|
|
92726
|
+
return null;
|
|
92727
|
+
}
|
|
92728
|
+
if (typeof value === "object" && value !== null && "kind" in value && value.kind === "switch-status" && "state" in value && hasUnknownKind(value.state, daemonSwitchStateKinds)) {
|
|
92729
|
+
return lifecycleResponse.parse({ ...value, state: null });
|
|
92730
|
+
}
|
|
92731
|
+
return lifecycleResponse.parse(value);
|
|
92732
|
+
};
|
|
92532
92733
|
}
|
|
92533
92734
|
});
|
|
92534
92735
|
|
|
92535
92736
|
// src/daemon/control/switch-status.ts
|
|
92536
92737
|
async function readSwitchStatus(directory, signal, wait = false) {
|
|
92537
|
-
const response =
|
|
92738
|
+
const response = decodeKnownLifecycleResponse(
|
|
92538
92739
|
await sendLocalRequest(directory, "manager", { kind: "switch-status", wait }, signal)
|
|
92539
92740
|
);
|
|
92540
|
-
if (response
|
|
92741
|
+
if (response?.kind !== "switch-status") {
|
|
92541
92742
|
throw new Error("The manager could not return the switch status");
|
|
92542
92743
|
}
|
|
92543
92744
|
return response.state;
|
|
@@ -93190,15 +93391,10 @@ async function runManager(stateDirectory, signal) {
|
|
|
93190
93391
|
}
|
|
93191
93392
|
};
|
|
93192
93393
|
const handle = async (value, requestSignal) => {
|
|
93193
|
-
const
|
|
93194
|
-
if (
|
|
93195
|
-
return
|
|
93196
|
-
kind: "error",
|
|
93197
|
-
code: "unsupported_lifecycle_command",
|
|
93198
|
-
message: "The manager only accepts lifecycle commands"
|
|
93199
|
-
};
|
|
93394
|
+
const command = decodeKnownLifecycleCommand(value);
|
|
93395
|
+
if (command === null) {
|
|
93396
|
+
return null;
|
|
93200
93397
|
}
|
|
93201
|
-
const command = parsed.data;
|
|
93202
93398
|
if (command.kind === "switch-status" && !command.wait) {
|
|
93203
93399
|
return { kind: "switch-status", state: switchState };
|
|
93204
93400
|
}
|
|
@@ -93537,24 +93733,24 @@ async function ensureWorkingProcess(stateDirectory, cliVersion, signal) {
|
|
|
93537
93733
|
const launch = await prepareDaemonReleaseVersion(version2, signal);
|
|
93538
93734
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(CONTROL_TIMEOUT_MILLISECONDS)]);
|
|
93539
93735
|
await ensureManager(stateDirectory, launch, deadline);
|
|
93540
|
-
const response =
|
|
93736
|
+
const response = decodeKnownLifecycleResponse(
|
|
93541
93737
|
await sendLocalRequest(stateDirectory, "manager", { kind: "ensure", launch }, deadline)
|
|
93542
93738
|
);
|
|
93543
|
-
if (response
|
|
93739
|
+
if (response?.kind === "error") {
|
|
93544
93740
|
throw new Error(response.message);
|
|
93545
93741
|
}
|
|
93546
|
-
if (response
|
|
93742
|
+
if (response?.kind !== "status" || response.worker?.version !== version2) {
|
|
93547
93743
|
throw new Error("The working daemon did not start");
|
|
93548
93744
|
}
|
|
93549
93745
|
return version2;
|
|
93550
93746
|
}
|
|
93551
93747
|
async function readWorkingProcessVersion(stateDirectory, signal) {
|
|
93552
93748
|
try {
|
|
93553
|
-
const response =
|
|
93749
|
+
const response = decodeKnownLifecycleResponse(
|
|
93554
93750
|
await sendLocalRequest(stateDirectory, "manager", { kind: "status" }, signal)
|
|
93555
93751
|
);
|
|
93556
|
-
if (response
|
|
93557
|
-
return response.
|
|
93752
|
+
if (response?.kind === "status") {
|
|
93753
|
+
return response.worker?.version ?? null;
|
|
93558
93754
|
}
|
|
93559
93755
|
} catch (cause) {
|
|
93560
93756
|
if (!isNodeError(cause, "ENOENT") && !isNodeError(cause, "ECONNREFUSED")) {
|
|
@@ -93567,10 +93763,10 @@ async function ensureManager(stateDirectory, launch, signal) {
|
|
|
93567
93763
|
let managerStarted = false;
|
|
93568
93764
|
while (!signal.aborted) {
|
|
93569
93765
|
try {
|
|
93570
|
-
const response =
|
|
93766
|
+
const response = decodeKnownLifecycleResponse(
|
|
93571
93767
|
await sendLocalRequest(stateDirectory, "manager", { kind: "status" }, signal)
|
|
93572
93768
|
);
|
|
93573
|
-
if (response
|
|
93769
|
+
if (response?.kind === "status") {
|
|
93574
93770
|
if (managerStarted) {
|
|
93575
93771
|
process.stdout.write(`Mobius daemon ${launch.version} started
|
|
93576
93772
|
`);
|
|
@@ -93604,13 +93800,13 @@ async function ensureManager(stateDirectory, launch, signal) {
|
|
|
93604
93800
|
}
|
|
93605
93801
|
async function stopManager(stateDirectory, signal) {
|
|
93606
93802
|
try {
|
|
93607
|
-
const response =
|
|
93803
|
+
const response = decodeKnownLifecycleResponse(
|
|
93608
93804
|
await sendLocalRequest(stateDirectory, "manager", { kind: "stop" }, signal)
|
|
93609
93805
|
);
|
|
93610
|
-
if (response
|
|
93806
|
+
if (response?.kind === "error") {
|
|
93611
93807
|
throw new Error(response.message);
|
|
93612
93808
|
}
|
|
93613
|
-
if (response
|
|
93809
|
+
if (response?.kind !== "stopped") {
|
|
93614
93810
|
throw new Error("The Mobius manager returned an unexpected response");
|
|
93615
93811
|
}
|
|
93616
93812
|
await waitForManagerExit(stateDirectory, signal);
|
|
@@ -93798,7 +93994,10 @@ function legacyState(receipt) {
|
|
|
93798
93994
|
if (receipt.outcome === null) {
|
|
93799
93995
|
return receipt.started ? "running" : "dispatching";
|
|
93800
93996
|
}
|
|
93801
|
-
const event =
|
|
93997
|
+
const event = decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
93998
|
+
if (event === null) {
|
|
93999
|
+
return "failed";
|
|
94000
|
+
}
|
|
93802
94001
|
return event.type === "lifecycle-metadata" && event.payload.kind === "prompt.completed" ? event.payload.stopReason === "cancelled" ? "cancelled" : "succeeded" : "failed";
|
|
93803
94002
|
}
|
|
93804
94003
|
var receiptSchema, identitySchema, ExecutionReceiptTable;
|
|
@@ -94782,7 +94981,11 @@ var init_session_configurations = __esm({
|
|
|
94782
94981
|
external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
|
|
94783
94982
|
])
|
|
94784
94983
|
).max(100);
|
|
94785
|
-
decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(
|
|
94984
|
+
decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(
|
|
94985
|
+
Array.isArray(value) ? value.filter(
|
|
94986
|
+
(configuration) => typeof configuration !== "object" || configuration === null || !("type" in configuration) || typeof configuration.type !== "string" || configuration.type === "boolean" || configuration.type === "select"
|
|
94987
|
+
) : value
|
|
94988
|
+
);
|
|
94786
94989
|
SessionConfigurations = class {
|
|
94787
94990
|
#selected = [];
|
|
94788
94991
|
stored = () => this.#selected;
|
|
@@ -97405,7 +97608,7 @@ var init_execution_receipts = __esm({
|
|
|
97405
97608
|
};
|
|
97406
97609
|
outcome = (commandId) => {
|
|
97407
97610
|
const receipt = this.#executions.get(commandId);
|
|
97408
|
-
return receipt?.outcome === null || receipt === void 0 ? void 0 :
|
|
97611
|
+
return receipt?.outcome === null || receipt === void 0 ? void 0 : decodeKnownSessionEventPayload(JSON.parse(receipt.outcome)) ?? void 0;
|
|
97409
97612
|
};
|
|
97410
97613
|
/** Reserves an unseen command for cancellation before a delayed prompt can claim its identity. */
|
|
97411
97614
|
recordCancellationBeforeAdmission = (commandId, sessionId) => {
|
|
@@ -97468,7 +97671,10 @@ var init_execution_receipts = __esm({
|
|
|
97468
97671
|
code: "runtime_restarted",
|
|
97469
97672
|
message: "The local runtime restarted before this request started"
|
|
97470
97673
|
}
|
|
97471
|
-
} :
|
|
97674
|
+
} : decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
97675
|
+
if (event === null) {
|
|
97676
|
+
continue;
|
|
97677
|
+
}
|
|
97472
97678
|
const recordedAt = receipt.outcome === null ? (/* @__PURE__ */ new Date()).toISOString() : external_exports.object({ recordedAt: external_exports.string() }).parse(JSON.parse(receipt.outcome)).recordedAt;
|
|
97473
97679
|
recovered.push({ sessionId: receipt.sessionId, event, recordedAt });
|
|
97474
97680
|
if (receipt.outcome === null) {
|
|
@@ -101793,35 +101999,6 @@ function closeRelaySocket(socket, code, reason) {
|
|
|
101793
101999
|
}
|
|
101794
102000
|
}
|
|
101795
102001
|
}
|
|
101796
|
-
function readCommandCorrelation(encoded) {
|
|
101797
|
-
let value;
|
|
101798
|
-
try {
|
|
101799
|
-
value = JSON.parse(encoded);
|
|
101800
|
-
} catch {
|
|
101801
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
101802
|
-
}
|
|
101803
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
101804
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
101805
|
-
}
|
|
101806
|
-
const requestId = Reflect.get(value, "requestId");
|
|
101807
|
-
const sessionId = Reflect.get(value, "sessionId");
|
|
101808
|
-
return {
|
|
101809
|
-
requestId: typeof requestId === "string" && isIdentifier(requestId) ? requestId : "unsupported",
|
|
101810
|
-
sessionId: typeof sessionId === "string" && isIdentifier(sessionId) ? sessionId : ""
|
|
101811
|
-
};
|
|
101812
|
-
}
|
|
101813
|
-
function rejectUnsupportedCommand(socket, correlation, rejection) {
|
|
101814
|
-
if (socket.readyState !== WebSocket8.OPEN) {
|
|
101815
|
-
return;
|
|
101816
|
-
}
|
|
101817
|
-
send(socket, {
|
|
101818
|
-
code: rejection.code,
|
|
101819
|
-
kind: SESSION_OPERATION_FAILED_KIND,
|
|
101820
|
-
message: "The Relay sent a command this daemon does not support",
|
|
101821
|
-
requestId: correlation.requestId,
|
|
101822
|
-
sessionId: correlation.sessionId
|
|
101823
|
-
});
|
|
101824
|
-
}
|
|
101825
102002
|
async function runRelayConnection({
|
|
101826
102003
|
resolveAgent,
|
|
101827
102004
|
config: config2,
|
|
@@ -101974,7 +102151,10 @@ async function runRelayConnection({
|
|
|
101974
102151
|
return;
|
|
101975
102152
|
}
|
|
101976
102153
|
try {
|
|
101977
|
-
const message =
|
|
102154
|
+
const message = decodeKnownServiceToDaemonMessage(encoded);
|
|
102155
|
+
if (message === null) {
|
|
102156
|
+
return;
|
|
102157
|
+
}
|
|
101978
102158
|
const kind = message.kind;
|
|
101979
102159
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
101980
102160
|
if (ready) {
|
|
@@ -101992,26 +102172,6 @@ async function runRelayConnection({
|
|
|
101992
102172
|
}
|
|
101993
102173
|
commands.dispatch(message);
|
|
101994
102174
|
} catch (error62) {
|
|
101995
|
-
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
101996
|
-
const correlation = readCommandCorrelation(encoded);
|
|
101997
|
-
console.warn("Mobius daemon rejected an unsupported Relay command", {
|
|
101998
|
-
code: error62.code,
|
|
101999
|
-
direction: error62.direction,
|
|
102000
|
-
messageKind: error62.messageKind
|
|
102001
|
-
});
|
|
102002
|
-
diagnostics.daemonDiagnostic(
|
|
102003
|
-
"relay_command_unsupported",
|
|
102004
|
-
correlation.requestId,
|
|
102005
|
-
{
|
|
102006
|
-
code: error62.code,
|
|
102007
|
-
direction: error62.direction,
|
|
102008
|
-
messageKind: error62.messageKind
|
|
102009
|
-
},
|
|
102010
|
-
error62
|
|
102011
|
-
);
|
|
102012
|
-
rejectUnsupportedCommand(socket, correlation, error62);
|
|
102013
|
-
return;
|
|
102014
|
-
}
|
|
102015
102175
|
console.error("Mobius daemon rejected a message", error62);
|
|
102016
102176
|
failAndClose(
|
|
102017
102177
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|
|
@@ -102583,13 +102743,13 @@ async function requestDaemonReleaseUpgrade(stateDirectory, currentVersion, signa
|
|
|
102583
102743
|
}
|
|
102584
102744
|
async function requestInstalledDaemonReleaseSwitch(stateDirectory, launch, signal) {
|
|
102585
102745
|
const id = randomUUID20();
|
|
102586
|
-
const response =
|
|
102746
|
+
const response = decodeKnownLifecycleResponse(
|
|
102587
102747
|
await sendLocalRequest(stateDirectory, "manager", { kind: "switch", id, context: "npm", launch }, signal)
|
|
102588
102748
|
);
|
|
102589
|
-
if (response
|
|
102749
|
+
if (response?.kind === "error") {
|
|
102590
102750
|
throw new DaemonReleaseUpgradeError(response.code, response.message);
|
|
102591
102751
|
}
|
|
102592
|
-
if (response
|
|
102752
|
+
if (response?.kind !== "switching") {
|
|
102593
102753
|
throw new DaemonReleaseUpgradeError("manager_incompatible", "The manager does not support daemon switching");
|
|
102594
102754
|
}
|
|
102595
102755
|
return { kind: "requested", id, version: launch.version };
|