@moxt-ai/mobius 0.0.334 → 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 +407 -132
- package/dist/cli.js.map +4 -4
- 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 +263 -102
- package/dist/runtime.js.map +4 -4
- package/dist/session/live/agent-session.d.ts.map +1 -1
- package/dist/session/live/agent-session.js +2 -1
- package/dist/session/live/agent-session.js.map +1 -1
- 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";
|
|
@@ -75603,14 +75687,7 @@ var init_event_log = __esm({
|
|
|
75603
75687
|
sessionId: identifierStringSchema
|
|
75604
75688
|
};
|
|
75605
75689
|
sessionLiveEventFields = { ...sharedSessionEventFields, position: positionSchema };
|
|
75606
|
-
sessionEventSchema = external_exports.
|
|
75607
|
-
external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75608
|
-
external_exports.object({
|
|
75609
|
-
...sharedSessionEventFields,
|
|
75610
|
-
payload: lifecycleMetadataSchema,
|
|
75611
|
-
type: external_exports.literal("lifecycle-metadata")
|
|
75612
|
-
}).readonly()
|
|
75613
|
-
]);
|
|
75690
|
+
sessionEventSchema = external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly();
|
|
75614
75691
|
sessionLiveEventSchema = external_exports.discriminatedUnion("type", [
|
|
75615
75692
|
external_exports.object({ ...sessionLiveEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75616
75693
|
external_exports.object({
|
|
@@ -75649,7 +75726,49 @@ var init_event_log = __esm({
|
|
|
75649
75726
|
sessionWireEnvelopeSchema = external_exports.object({
|
|
75650
75727
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
75651
75728
|
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
75652
|
-
}).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
|
+
]);
|
|
75653
75772
|
sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75654
75773
|
sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75655
75774
|
sessionExportSchema = external_exports.object({
|
|
@@ -75713,10 +75832,13 @@ var init_event_log = __esm({
|
|
|
75713
75832
|
events: sessionEventLogPageSchema,
|
|
75714
75833
|
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75715
75834
|
}).readonly();
|
|
75835
|
+
knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75716
75836
|
decodeSessionEvent = (value) => decode4(value, sessionEventSchema);
|
|
75837
|
+
decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode4(value, sessionEventPayloadSchema) : null;
|
|
75717
75838
|
decodeSessionEventEnvelope = (value) => decode4(value, sessionEventEnvelopeSchema);
|
|
75718
75839
|
encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
75719
75840
|
decodeAcpSessionUpdate = (value) => decode4(value, acpSessionUpdateSchema);
|
|
75841
|
+
decodeKnownNativeSessionEvents = (value) => decode4(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
75720
75842
|
}
|
|
75721
75843
|
});
|
|
75722
75844
|
|
|
@@ -75729,7 +75851,18 @@ function decode5(schema, encoded) {
|
|
|
75729
75851
|
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
75730
75852
|
}
|
|
75731
75853
|
}
|
|
75732
|
-
|
|
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;
|
|
75733
75866
|
var init_history2 = __esm({
|
|
75734
75867
|
"../mobius-sdk/src/protocol/session/observability/history.ts"() {
|
|
75735
75868
|
"use strict";
|
|
@@ -75766,10 +75899,34 @@ var init_history2 = __esm({
|
|
|
75766
75899
|
};
|
|
75767
75900
|
sessionHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
75768
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();
|
|
75769
75926
|
decodeSessionHistoryPageLoad = (encoded) => decode5(sessionHistoryPageLoadSchema, encoded);
|
|
75770
|
-
decodeSessionHistoryPageLoaded = (encoded) =>
|
|
75927
|
+
decodeSessionHistoryPageLoaded = (encoded) => decodeLoaded(sessionHistoryPageLoadedSchema, encoded);
|
|
75771
75928
|
decodeSessionPreviewHistoryPageLoad = (encoded) => decode5(sessionPreviewHistoryPageLoadSchema, encoded);
|
|
75772
|
-
decodeSessionPreviewHistoryPageLoaded = (encoded) =>
|
|
75929
|
+
decodeSessionPreviewHistoryPageLoaded = (encoded) => decodeLoaded(sessionPreviewHistoryPageLoadedSchema, encoded);
|
|
75773
75930
|
encodeSessionHistoryPageLoad = (value) => JSON.stringify(sessionHistoryPageLoadSchema.parse(value));
|
|
75774
75931
|
encodeSessionHistoryPageLoaded = (value) => JSON.stringify(sessionHistoryPageLoadedSchema.parse(value));
|
|
75775
75932
|
encodeSessionPreviewHistoryPageLoad = (value) => JSON.stringify(sessionPreviewHistoryPageLoadSchema.parse(value));
|
|
@@ -76101,7 +76258,7 @@ var init_turn_history = __esm({
|
|
|
76101
76258
|
});
|
|
76102
76259
|
|
|
76103
76260
|
// ../mobius-sdk/src/protocol/session/recording/webhooks.ts
|
|
76104
|
-
var isoTimestamp2, shortText2, promptSucceededOutcome2, promptCancelledOutcome2, promptFailedOutcome2, sessionStatusWebhookCommandSchema, sessionStatusWebhookBodySchema;
|
|
76261
|
+
var isoTimestamp2, shortText2, promptSucceededOutcome2, promptCancelledOutcome2, promptFailedOutcome2, sessionStatusWebhookCommandSchema, sessionStatusWebhookBodyFields, sessionStatusWebhookBodySchema, consumedSessionStatusWebhookBodySchema;
|
|
76105
76262
|
var init_webhooks = __esm({
|
|
76106
76263
|
"../mobius-sdk/src/protocol/session/recording/webhooks.ts"() {
|
|
76107
76264
|
"use strict";
|
|
@@ -76134,13 +76291,20 @@ var init_webhooks = __esm({
|
|
|
76134
76291
|
outcome: external_exports.literal("failed")
|
|
76135
76292
|
}).readonly()
|
|
76136
76293
|
]);
|
|
76137
|
-
|
|
76294
|
+
sessionStatusWebhookBodyFields = {
|
|
76138
76295
|
appId: identifierStringSchema,
|
|
76139
|
-
commands: external_exports.array(sessionStatusWebhookCommandSchema).min(1).readonly(),
|
|
76140
76296
|
projectId: identifierStringSchema,
|
|
76141
76297
|
runtimeId: identifierStringSchema,
|
|
76142
76298
|
sessionId: identifierStringSchema,
|
|
76143
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()
|
|
76144
76308
|
}).readonly();
|
|
76145
76309
|
}
|
|
76146
76310
|
});
|
|
@@ -76258,18 +76422,32 @@ function defineMessageSignature(kind, encoder, decoder) {
|
|
|
76258
76422
|
schema
|
|
76259
76423
|
};
|
|
76260
76424
|
}
|
|
76261
|
-
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) {
|
|
76262
76439
|
const kind = decodeMessageKind(encoded);
|
|
76263
76440
|
const signature = serviceToDaemonRegistry[kind];
|
|
76264
76441
|
if (signature === void 0) {
|
|
76265
|
-
|
|
76442
|
+
return null;
|
|
76266
76443
|
}
|
|
76267
|
-
|
|
76444
|
+
const value = parseJson(encoded);
|
|
76445
|
+
return hasUnknownServiceVariant(kind, value) ? null : signature.decoder(encoded);
|
|
76268
76446
|
}
|
|
76269
76447
|
function encodeDaemonToServiceMessage(message) {
|
|
76270
76448
|
return daemonToServiceSignatures[message.kind].encoder(message);
|
|
76271
76449
|
}
|
|
76272
|
-
var serviceToDaemonSignatures, serviceToDaemonRegistry, daemonToServiceSignatures;
|
|
76450
|
+
var serviceToDaemonSignatures, serviceToDaemonRegistry, knownNativeActions, daemonToServiceSignatures;
|
|
76273
76451
|
var init_daemon_transport = __esm({
|
|
76274
76452
|
"../mobius-sdk/src/protocol/transport/daemon-transport.ts"() {
|
|
76275
76453
|
"use strict";
|
|
@@ -76420,6 +76598,7 @@ var init_daemon_transport = __esm({
|
|
|
76420
76598
|
)
|
|
76421
76599
|
};
|
|
76422
76600
|
serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
76601
|
+
knownNativeActions = /* @__PURE__ */ new Set(["active-turn", "find", "list", "import", "fork"]);
|
|
76423
76602
|
daemonToServiceSignatures = {
|
|
76424
76603
|
[SESSION_CLOSED_KIND]: defineMessageSignature(
|
|
76425
76604
|
SESSION_CLOSED_KIND,
|
|
@@ -76581,7 +76760,6 @@ var init_protocol = __esm({
|
|
|
76581
76760
|
init_workspace();
|
|
76582
76761
|
init_directory();
|
|
76583
76762
|
init_identifier();
|
|
76584
|
-
init_message_codec();
|
|
76585
76763
|
init_daemon_transport();
|
|
76586
76764
|
}
|
|
76587
76765
|
});
|
|
@@ -82400,7 +82578,7 @@ var init_native_session = __esm({
|
|
|
82400
82578
|
|
|
82401
82579
|
// src/acp/protocol/session-config-protocol.ts
|
|
82402
82580
|
import { methods as methods9 } from "@agentclientprotocol/sdk";
|
|
82403
|
-
function
|
|
82581
|
+
function isRecord6(value) {
|
|
82404
82582
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82405
82583
|
}
|
|
82406
82584
|
function readString3(value, fallback = "") {
|
|
@@ -82431,7 +82609,7 @@ function normalizeConfigValues(value) {
|
|
|
82431
82609
|
}
|
|
82432
82610
|
const normalized = [];
|
|
82433
82611
|
for (const entry of value) {
|
|
82434
|
-
if (!
|
|
82612
|
+
if (!isRecord6(entry)) {
|
|
82435
82613
|
continue;
|
|
82436
82614
|
}
|
|
82437
82615
|
const groupedOptions = entry["options"];
|
|
@@ -82439,7 +82617,7 @@ function normalizeConfigValues(value) {
|
|
|
82439
82617
|
const groupId = readString3(entry["group"]);
|
|
82440
82618
|
const groupName = readString3(entry["name"]);
|
|
82441
82619
|
for (const groupedOption of groupedOptions) {
|
|
82442
|
-
if (
|
|
82620
|
+
if (isRecord6(groupedOption)) {
|
|
82443
82621
|
const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
|
|
82444
82622
|
if (normalizedValue !== void 0) {
|
|
82445
82623
|
normalized.push(normalizedValue);
|
|
@@ -82464,7 +82642,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82464
82642
|
const normalized = [];
|
|
82465
82643
|
if (Array.isArray(value)) {
|
|
82466
82644
|
for (const option of value) {
|
|
82467
|
-
if (!
|
|
82645
|
+
if (!isRecord6(option)) {
|
|
82468
82646
|
continue;
|
|
82469
82647
|
}
|
|
82470
82648
|
const id = truncate3(readString3(option["id"]), 128);
|
|
@@ -82504,12 +82682,12 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82504
82682
|
}
|
|
82505
82683
|
}
|
|
82506
82684
|
}
|
|
82507
|
-
if (
|
|
82685
|
+
if (isRecord6(modes)) {
|
|
82508
82686
|
const values = [];
|
|
82509
82687
|
const availableModes = modes["availableModes"];
|
|
82510
82688
|
if (Array.isArray(availableModes)) {
|
|
82511
82689
|
for (const mode of availableModes) {
|
|
82512
|
-
if (!
|
|
82690
|
+
if (!isRecord6(mode)) {
|
|
82513
82691
|
continue;
|
|
82514
82692
|
}
|
|
82515
82693
|
const id = truncate3(readString3(mode["id"]), 500);
|
|
@@ -82542,7 +82720,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
82542
82720
|
return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
82543
82721
|
}
|
|
82544
82722
|
function normalizeStandardLifecycle(response) {
|
|
82545
|
-
const lifecycle =
|
|
82723
|
+
const lifecycle = isRecord6(response) ? response : {};
|
|
82546
82724
|
return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
82547
82725
|
}
|
|
82548
82726
|
function replaceStandardConfigOptions(current, value) {
|
|
@@ -82599,7 +82777,7 @@ var init_session_config_protocol = __esm({
|
|
|
82599
82777
|
"ACP agent exited while changing session configuration",
|
|
82600
82778
|
change.signal
|
|
82601
82779
|
);
|
|
82602
|
-
if (!
|
|
82780
|
+
if (!isRecord6(response) || !Array.isArray(response["configOptions"])) {
|
|
82603
82781
|
throw new SessionConfigProtocolError("The Agent returned an invalid session configuration response");
|
|
82604
82782
|
}
|
|
82605
82783
|
return replaceStandardConfigOptions(current, response["configOptions"]);
|
|
@@ -90438,7 +90616,7 @@ function decodeBase64(data) {
|
|
|
90438
90616
|
}
|
|
90439
90617
|
return bytes;
|
|
90440
90618
|
}
|
|
90441
|
-
function
|
|
90619
|
+
function isRecord7(value) {
|
|
90442
90620
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90443
90621
|
}
|
|
90444
90622
|
var MAXIMUM_ENCODED_CONTENT_CHARACTERS, embeddedImageSchema, inlineImageUrlSchema, toolImageSchema, AcpContentExternalizer;
|
|
@@ -90575,13 +90753,13 @@ var init_content_externalizer = __esm({
|
|
|
90575
90753
|
}
|
|
90576
90754
|
return result2;
|
|
90577
90755
|
}
|
|
90578
|
-
if (!
|
|
90756
|
+
if (!isRecord7(value)) {
|
|
90579
90757
|
return value;
|
|
90580
90758
|
}
|
|
90581
90759
|
const image = toolImageSchema.safeParse(value);
|
|
90582
90760
|
if (image.success && image.data.data.length > 0) {
|
|
90583
90761
|
const prepared = await this.#content(sessionId, image.data, signal);
|
|
90584
|
-
if (
|
|
90762
|
+
if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
90585
90763
|
images.set(prepared.event["imageKey"], prepared);
|
|
90586
90764
|
} else {
|
|
90587
90765
|
images.set(`unavailable:${images.size}`, prepared);
|
|
@@ -90612,7 +90790,7 @@ var init_content_externalizer = __esm({
|
|
|
90612
90790
|
const prepared = await this.#content(sessionId, content, signal);
|
|
90613
90791
|
agentContent.push({ ...item, content: prepared.agent });
|
|
90614
90792
|
eventContent.push({ ...item, content: prepared.event });
|
|
90615
|
-
if (
|
|
90793
|
+
if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
90616
90794
|
images.delete(prepared.event["imageKey"]);
|
|
90617
90795
|
}
|
|
90618
90796
|
}
|
|
@@ -90773,7 +90951,7 @@ var init_relay_authentication = __esm({
|
|
|
90773
90951
|
|
|
90774
90952
|
// src/runtime/catalog/publish-agent-catalog.ts
|
|
90775
90953
|
import { fetch as fetch2 } from "undici";
|
|
90776
|
-
function
|
|
90954
|
+
function isRecord8(value) {
|
|
90777
90955
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90778
90956
|
}
|
|
90779
90957
|
function isSafeRelayErrorMessage(value) {
|
|
@@ -90786,7 +90964,7 @@ async function rejectedCatalogError(response) {
|
|
|
90786
90964
|
} catch {
|
|
90787
90965
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
90788
90966
|
}
|
|
90789
|
-
if (!
|
|
90967
|
+
if (!isRecord8(value) || !isRecord8(value["error"])) {
|
|
90790
90968
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
90791
90969
|
}
|
|
90792
90970
|
const code = value["error"]["code"];
|
|
@@ -91135,7 +91313,7 @@ var init_runtime_connection = __esm({
|
|
|
91135
91313
|
// src/runtime/connection/runtime-installation-store.ts
|
|
91136
91314
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
91137
91315
|
import { resolve as resolve15 } from "node:path";
|
|
91138
|
-
function
|
|
91316
|
+
function isRecord9(value) {
|
|
91139
91317
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
91140
91318
|
}
|
|
91141
91319
|
function hasExactKeys(value, expectedKeys) {
|
|
@@ -91202,7 +91380,7 @@ function installationId() {
|
|
|
91202
91380
|
return `min_${randomUUID13().replaceAll("-", "")}`;
|
|
91203
91381
|
}
|
|
91204
91382
|
function decodeInstallationPointer(value) {
|
|
91205
|
-
if (!
|
|
91383
|
+
if (!isRecord9(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
91206
91384
|
throw new RuntimeInstallationStoreError("invalid_installation", "The local installation record is invalid");
|
|
91207
91385
|
}
|
|
91208
91386
|
const storedInstallationId = value["installationId"];
|
|
@@ -91212,7 +91390,7 @@ function decodeInstallationPointer(value) {
|
|
|
91212
91390
|
return { installationId: validateInstallationId(storedInstallationId) };
|
|
91213
91391
|
}
|
|
91214
91392
|
function decodeChannelIndex(value) {
|
|
91215
|
-
if (!
|
|
91393
|
+
if (!isRecord9(value) || !hasExactKeys(value, CHANNEL_INDEX_KEYS) || value["version"] !== 1) {
|
|
91216
91394
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
91217
91395
|
}
|
|
91218
91396
|
const applicationId = value["applicationId"];
|
|
@@ -91262,7 +91440,7 @@ function decodeVerifiedConnection(value) {
|
|
|
91262
91440
|
);
|
|
91263
91441
|
}
|
|
91264
91442
|
function decodeConnection(value) {
|
|
91265
|
-
if (!
|
|
91443
|
+
if (!isRecord9(value)) {
|
|
91266
91444
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
91267
91445
|
}
|
|
91268
91446
|
return decodeVerifiedConnection(value);
|
|
@@ -92484,7 +92662,10 @@ var init_local_server = __esm({
|
|
|
92484
92662
|
});
|
|
92485
92663
|
|
|
92486
92664
|
// src/daemon/control/protocol.ts
|
|
92487
|
-
|
|
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;
|
|
92488
92669
|
var init_protocol2 = __esm({
|
|
92489
92670
|
"src/daemon/control/protocol.ts"() {
|
|
92490
92671
|
"use strict";
|
|
@@ -92536,15 +92717,28 @@ var init_protocol2 = __esm({
|
|
|
92536
92717
|
external_exports.object({ kind: external_exports.literal("switching") }),
|
|
92537
92718
|
external_exports.object({ kind: external_exports.literal("error"), code: external_exports.string(), message: external_exports.string() })
|
|
92538
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
|
+
};
|
|
92539
92733
|
}
|
|
92540
92734
|
});
|
|
92541
92735
|
|
|
92542
92736
|
// src/daemon/control/switch-status.ts
|
|
92543
92737
|
async function readSwitchStatus(directory, signal, wait = false) {
|
|
92544
|
-
const response =
|
|
92738
|
+
const response = decodeKnownLifecycleResponse(
|
|
92545
92739
|
await sendLocalRequest(directory, "manager", { kind: "switch-status", wait }, signal)
|
|
92546
92740
|
);
|
|
92547
|
-
if (response
|
|
92741
|
+
if (response?.kind !== "switch-status") {
|
|
92548
92742
|
throw new Error("The manager could not return the switch status");
|
|
92549
92743
|
}
|
|
92550
92744
|
return response.state;
|
|
@@ -93197,15 +93391,10 @@ async function runManager(stateDirectory, signal) {
|
|
|
93197
93391
|
}
|
|
93198
93392
|
};
|
|
93199
93393
|
const handle = async (value, requestSignal) => {
|
|
93200
|
-
const
|
|
93201
|
-
if (
|
|
93202
|
-
return
|
|
93203
|
-
kind: "error",
|
|
93204
|
-
code: "unsupported_lifecycle_command",
|
|
93205
|
-
message: "The manager only accepts lifecycle commands"
|
|
93206
|
-
};
|
|
93394
|
+
const command = decodeKnownLifecycleCommand(value);
|
|
93395
|
+
if (command === null) {
|
|
93396
|
+
return null;
|
|
93207
93397
|
}
|
|
93208
|
-
const command = parsed.data;
|
|
93209
93398
|
if (command.kind === "switch-status" && !command.wait) {
|
|
93210
93399
|
return { kind: "switch-status", state: switchState };
|
|
93211
93400
|
}
|
|
@@ -93544,24 +93733,24 @@ async function ensureWorkingProcess(stateDirectory, cliVersion, signal) {
|
|
|
93544
93733
|
const launch = await prepareDaemonReleaseVersion(version2, signal);
|
|
93545
93734
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(CONTROL_TIMEOUT_MILLISECONDS)]);
|
|
93546
93735
|
await ensureManager(stateDirectory, launch, deadline);
|
|
93547
|
-
const response =
|
|
93736
|
+
const response = decodeKnownLifecycleResponse(
|
|
93548
93737
|
await sendLocalRequest(stateDirectory, "manager", { kind: "ensure", launch }, deadline)
|
|
93549
93738
|
);
|
|
93550
|
-
if (response
|
|
93739
|
+
if (response?.kind === "error") {
|
|
93551
93740
|
throw new Error(response.message);
|
|
93552
93741
|
}
|
|
93553
|
-
if (response
|
|
93742
|
+
if (response?.kind !== "status" || response.worker?.version !== version2) {
|
|
93554
93743
|
throw new Error("The working daemon did not start");
|
|
93555
93744
|
}
|
|
93556
93745
|
return version2;
|
|
93557
93746
|
}
|
|
93558
93747
|
async function readWorkingProcessVersion(stateDirectory, signal) {
|
|
93559
93748
|
try {
|
|
93560
|
-
const response =
|
|
93749
|
+
const response = decodeKnownLifecycleResponse(
|
|
93561
93750
|
await sendLocalRequest(stateDirectory, "manager", { kind: "status" }, signal)
|
|
93562
93751
|
);
|
|
93563
|
-
if (response
|
|
93564
|
-
return response.
|
|
93752
|
+
if (response?.kind === "status") {
|
|
93753
|
+
return response.worker?.version ?? null;
|
|
93565
93754
|
}
|
|
93566
93755
|
} catch (cause) {
|
|
93567
93756
|
if (!isNodeError(cause, "ENOENT") && !isNodeError(cause, "ECONNREFUSED")) {
|
|
@@ -93574,10 +93763,10 @@ async function ensureManager(stateDirectory, launch, signal) {
|
|
|
93574
93763
|
let managerStarted = false;
|
|
93575
93764
|
while (!signal.aborted) {
|
|
93576
93765
|
try {
|
|
93577
|
-
const response =
|
|
93766
|
+
const response = decodeKnownLifecycleResponse(
|
|
93578
93767
|
await sendLocalRequest(stateDirectory, "manager", { kind: "status" }, signal)
|
|
93579
93768
|
);
|
|
93580
|
-
if (response
|
|
93769
|
+
if (response?.kind === "status") {
|
|
93581
93770
|
if (managerStarted) {
|
|
93582
93771
|
process.stdout.write(`Mobius daemon ${launch.version} started
|
|
93583
93772
|
`);
|
|
@@ -93611,13 +93800,13 @@ async function ensureManager(stateDirectory, launch, signal) {
|
|
|
93611
93800
|
}
|
|
93612
93801
|
async function stopManager(stateDirectory, signal) {
|
|
93613
93802
|
try {
|
|
93614
|
-
const response =
|
|
93803
|
+
const response = decodeKnownLifecycleResponse(
|
|
93615
93804
|
await sendLocalRequest(stateDirectory, "manager", { kind: "stop" }, signal)
|
|
93616
93805
|
);
|
|
93617
|
-
if (response
|
|
93806
|
+
if (response?.kind === "error") {
|
|
93618
93807
|
throw new Error(response.message);
|
|
93619
93808
|
}
|
|
93620
|
-
if (response
|
|
93809
|
+
if (response?.kind !== "stopped") {
|
|
93621
93810
|
throw new Error("The Mobius manager returned an unexpected response");
|
|
93622
93811
|
}
|
|
93623
93812
|
await waitForManagerExit(stateDirectory, signal);
|
|
@@ -93805,7 +93994,10 @@ function legacyState(receipt) {
|
|
|
93805
93994
|
if (receipt.outcome === null) {
|
|
93806
93995
|
return receipt.started ? "running" : "dispatching";
|
|
93807
93996
|
}
|
|
93808
|
-
const event =
|
|
93997
|
+
const event = decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
93998
|
+
if (event === null) {
|
|
93999
|
+
return "failed";
|
|
94000
|
+
}
|
|
93809
94001
|
return event.type === "lifecycle-metadata" && event.payload.kind === "prompt.completed" ? event.payload.stopReason === "cancelled" ? "cancelled" : "succeeded" : "failed";
|
|
93810
94002
|
}
|
|
93811
94003
|
var receiptSchema, identitySchema, ExecutionReceiptTable;
|
|
@@ -93992,6 +94184,127 @@ var init_operation_metrics = __esm({
|
|
|
93992
94184
|
}
|
|
93993
94185
|
});
|
|
93994
94186
|
|
|
94187
|
+
// ../mobius-sdk/src/conversation-title.ts
|
|
94188
|
+
function conversationTitleFromText(text2) {
|
|
94189
|
+
let compact = "";
|
|
94190
|
+
for (const line of text2.split(/\r?\n/u)) {
|
|
94191
|
+
const candidate = line.replaceAll(/\s+/g, " ").trim();
|
|
94192
|
+
if (candidate.length === 0 || candidate.startsWith("```") || candidate.startsWith("~~~")) {
|
|
94193
|
+
continue;
|
|
94194
|
+
}
|
|
94195
|
+
const readable = candidate.replace(/^(?:>\s*)+/u, "").replace(/^#{1,6}(?:\s+|$)/u, "").replace(/^(?:[-*+]|\d+[.)])\s+/u, "").trim();
|
|
94196
|
+
if (readable.length > 0) {
|
|
94197
|
+
compact = readable;
|
|
94198
|
+
break;
|
|
94199
|
+
}
|
|
94200
|
+
}
|
|
94201
|
+
if (compact.length === 0) {
|
|
94202
|
+
compact = text2.replaceAll(/\s+/g, " ").trim();
|
|
94203
|
+
}
|
|
94204
|
+
const characters = Array.from(compact);
|
|
94205
|
+
if (characters.length <= CONVERSATION_TITLE_CHARACTER_LIMIT) {
|
|
94206
|
+
return compact;
|
|
94207
|
+
}
|
|
94208
|
+
return `${characters.slice(0, CONVERSATION_TITLE_CHARACTER_LIMIT - 1).join("")}\u2026`;
|
|
94209
|
+
}
|
|
94210
|
+
var CONVERSATION_TITLE_CHARACTER_LIMIT;
|
|
94211
|
+
var init_conversation_title = __esm({
|
|
94212
|
+
"../mobius-sdk/src/conversation-title.ts"() {
|
|
94213
|
+
"use strict";
|
|
94214
|
+
CONVERSATION_TITLE_CHARACTER_LIMIT = 42;
|
|
94215
|
+
}
|
|
94216
|
+
});
|
|
94217
|
+
|
|
94218
|
+
// ../mobius-sdk/src/errors.ts
|
|
94219
|
+
var init_errors4 = __esm({
|
|
94220
|
+
"../mobius-sdk/src/errors.ts"() {
|
|
94221
|
+
"use strict";
|
|
94222
|
+
}
|
|
94223
|
+
});
|
|
94224
|
+
|
|
94225
|
+
// ../mobius-sdk/src/project-authentication.ts
|
|
94226
|
+
var MAXIMUM_RESPONSE_LENGTH, PROJECT_PERMISSIONS, MobiusCredentialLifecycle;
|
|
94227
|
+
var init_project_authentication = __esm({
|
|
94228
|
+
"../mobius-sdk/src/project-authentication.ts"() {
|
|
94229
|
+
"use strict";
|
|
94230
|
+
MAXIMUM_RESPONSE_LENGTH = 8 * 1024 * 1024;
|
|
94231
|
+
PROJECT_PERMISSIONS = Object.freeze([
|
|
94232
|
+
"artifact:read",
|
|
94233
|
+
"artifact:write",
|
|
94234
|
+
"identity-binding:manage",
|
|
94235
|
+
"interaction:respond",
|
|
94236
|
+
"owner-credential:manage",
|
|
94237
|
+
"project:event:read",
|
|
94238
|
+
"project:read",
|
|
94239
|
+
"runtime:pair",
|
|
94240
|
+
"runtime:read",
|
|
94241
|
+
"runtime:revoke",
|
|
94242
|
+
"session:delete",
|
|
94243
|
+
"session:read",
|
|
94244
|
+
"session:write"
|
|
94245
|
+
]);
|
|
94246
|
+
MobiusCredentialLifecycle = class _MobiusCredentialLifecycle {
|
|
94247
|
+
static Current = new _MobiusCredentialLifecycle("current");
|
|
94248
|
+
static Replaced = new _MobiusCredentialLifecycle("replaced");
|
|
94249
|
+
static Revoked = new _MobiusCredentialLifecycle("revoked");
|
|
94250
|
+
value;
|
|
94251
|
+
constructor(value) {
|
|
94252
|
+
this.value = value;
|
|
94253
|
+
}
|
|
94254
|
+
toJSON = () => this.value;
|
|
94255
|
+
};
|
|
94256
|
+
}
|
|
94257
|
+
});
|
|
94258
|
+
|
|
94259
|
+
// ../mobius-sdk/src/resources.ts
|
|
94260
|
+
var MobiusRuntimePairingLifecycle;
|
|
94261
|
+
var init_resources = __esm({
|
|
94262
|
+
"../mobius-sdk/src/resources.ts"() {
|
|
94263
|
+
"use strict";
|
|
94264
|
+
MobiusRuntimePairingLifecycle = Object.freeze({
|
|
94265
|
+
Expired: "expired",
|
|
94266
|
+
Paired: "paired",
|
|
94267
|
+
Pending: "pending",
|
|
94268
|
+
Revoked: "revoked"
|
|
94269
|
+
});
|
|
94270
|
+
}
|
|
94271
|
+
});
|
|
94272
|
+
|
|
94273
|
+
// ../mobius-sdk/src/transport/http-transport.ts
|
|
94274
|
+
var init_http_transport = __esm({
|
|
94275
|
+
"../mobius-sdk/src/transport/http-transport.ts"() {
|
|
94276
|
+
"use strict";
|
|
94277
|
+
}
|
|
94278
|
+
});
|
|
94279
|
+
|
|
94280
|
+
// ../mobius-sdk/src/service-client.ts
|
|
94281
|
+
var init_service_client = __esm({
|
|
94282
|
+
"../mobius-sdk/src/service-client.ts"() {
|
|
94283
|
+
"use strict";
|
|
94284
|
+
}
|
|
94285
|
+
});
|
|
94286
|
+
|
|
94287
|
+
// ../mobius-sdk/src/transport/ws-transport.ts
|
|
94288
|
+
var init_ws_transport = __esm({
|
|
94289
|
+
"../mobius-sdk/src/transport/ws-transport.ts"() {
|
|
94290
|
+
"use strict";
|
|
94291
|
+
}
|
|
94292
|
+
});
|
|
94293
|
+
|
|
94294
|
+
// ../mobius-sdk/src/index.ts
|
|
94295
|
+
var init_src = __esm({
|
|
94296
|
+
"../mobius-sdk/src/index.ts"() {
|
|
94297
|
+
"use strict";
|
|
94298
|
+
init_conversation_title();
|
|
94299
|
+
init_errors4();
|
|
94300
|
+
init_project_authentication();
|
|
94301
|
+
init_resources();
|
|
94302
|
+
init_service_client();
|
|
94303
|
+
init_http_transport();
|
|
94304
|
+
init_ws_transport();
|
|
94305
|
+
}
|
|
94306
|
+
});
|
|
94307
|
+
|
|
93995
94308
|
// src/session/api/session-api.ts
|
|
93996
94309
|
var NullSessionObserver, PreparedSession, AgentSettingsSnapshot;
|
|
93997
94310
|
var init_session_api = __esm({
|
|
@@ -94668,7 +94981,11 @@ var init_session_configurations = __esm({
|
|
|
94668
94981
|
external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
|
|
94669
94982
|
])
|
|
94670
94983
|
).max(100);
|
|
94671
|
-
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
|
+
);
|
|
94672
94989
|
SessionConfigurations = class {
|
|
94673
94990
|
#selected = [];
|
|
94674
94991
|
stored = () => this.#selected;
|
|
@@ -95085,6 +95402,7 @@ var AgentSession;
|
|
|
95085
95402
|
var init_agent_session = __esm({
|
|
95086
95403
|
"src/session/live/agent-session.ts"() {
|
|
95087
95404
|
"use strict";
|
|
95405
|
+
init_src();
|
|
95088
95406
|
init_protocol();
|
|
95089
95407
|
init_acp_error();
|
|
95090
95408
|
init_agent_initialization();
|
|
@@ -95516,7 +95834,7 @@ var init_agent_session = __esm({
|
|
|
95516
95834
|
}
|
|
95517
95835
|
validatePromptContent(options, this.#capabilities);
|
|
95518
95836
|
if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
|
|
95519
|
-
this.#sessionTitle =
|
|
95837
|
+
this.#sessionTitle = conversationTitleFromText(options.prompt);
|
|
95520
95838
|
}
|
|
95521
95839
|
this.#prompted = true;
|
|
95522
95840
|
this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -97290,7 +97608,7 @@ var init_execution_receipts = __esm({
|
|
|
97290
97608
|
};
|
|
97291
97609
|
outcome = (commandId) => {
|
|
97292
97610
|
const receipt = this.#executions.get(commandId);
|
|
97293
|
-
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;
|
|
97294
97612
|
};
|
|
97295
97613
|
/** Reserves an unseen command for cancellation before a delayed prompt can claim its identity. */
|
|
97296
97614
|
recordCancellationBeforeAdmission = (commandId, sessionId) => {
|
|
@@ -97353,7 +97671,10 @@ var init_execution_receipts = __esm({
|
|
|
97353
97671
|
code: "runtime_restarted",
|
|
97354
97672
|
message: "The local runtime restarted before this request started"
|
|
97355
97673
|
}
|
|
97356
|
-
} :
|
|
97674
|
+
} : decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
97675
|
+
if (event === null) {
|
|
97676
|
+
continue;
|
|
97677
|
+
}
|
|
97357
97678
|
const recordedAt = receipt.outcome === null ? (/* @__PURE__ */ new Date()).toISOString() : external_exports.object({ recordedAt: external_exports.string() }).parse(JSON.parse(receipt.outcome)).recordedAt;
|
|
97358
97679
|
recovered.push({ sessionId: receipt.sessionId, event, recordedAt });
|
|
97359
97680
|
if (receipt.outcome === null) {
|
|
@@ -101678,35 +101999,6 @@ function closeRelaySocket(socket, code, reason) {
|
|
|
101678
101999
|
}
|
|
101679
102000
|
}
|
|
101680
102001
|
}
|
|
101681
|
-
function readCommandCorrelation(encoded) {
|
|
101682
|
-
let value;
|
|
101683
|
-
try {
|
|
101684
|
-
value = JSON.parse(encoded);
|
|
101685
|
-
} catch {
|
|
101686
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
101687
|
-
}
|
|
101688
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
101689
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
101690
|
-
}
|
|
101691
|
-
const requestId = Reflect.get(value, "requestId");
|
|
101692
|
-
const sessionId = Reflect.get(value, "sessionId");
|
|
101693
|
-
return {
|
|
101694
|
-
requestId: typeof requestId === "string" && isIdentifier(requestId) ? requestId : "unsupported",
|
|
101695
|
-
sessionId: typeof sessionId === "string" && isIdentifier(sessionId) ? sessionId : ""
|
|
101696
|
-
};
|
|
101697
|
-
}
|
|
101698
|
-
function rejectUnsupportedCommand(socket, correlation, rejection) {
|
|
101699
|
-
if (socket.readyState !== WebSocket8.OPEN) {
|
|
101700
|
-
return;
|
|
101701
|
-
}
|
|
101702
|
-
send(socket, {
|
|
101703
|
-
code: rejection.code,
|
|
101704
|
-
kind: SESSION_OPERATION_FAILED_KIND,
|
|
101705
|
-
message: "The Relay sent a command this daemon does not support",
|
|
101706
|
-
requestId: correlation.requestId,
|
|
101707
|
-
sessionId: correlation.sessionId
|
|
101708
|
-
});
|
|
101709
|
-
}
|
|
101710
102002
|
async function runRelayConnection({
|
|
101711
102003
|
resolveAgent,
|
|
101712
102004
|
config: config2,
|
|
@@ -101859,7 +102151,10 @@ async function runRelayConnection({
|
|
|
101859
102151
|
return;
|
|
101860
102152
|
}
|
|
101861
102153
|
try {
|
|
101862
|
-
const message =
|
|
102154
|
+
const message = decodeKnownServiceToDaemonMessage(encoded);
|
|
102155
|
+
if (message === null) {
|
|
102156
|
+
return;
|
|
102157
|
+
}
|
|
101863
102158
|
const kind = message.kind;
|
|
101864
102159
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
101865
102160
|
if (ready) {
|
|
@@ -101877,26 +102172,6 @@ async function runRelayConnection({
|
|
|
101877
102172
|
}
|
|
101878
102173
|
commands.dispatch(message);
|
|
101879
102174
|
} catch (error62) {
|
|
101880
|
-
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
101881
|
-
const correlation = readCommandCorrelation(encoded);
|
|
101882
|
-
console.warn("Mobius daemon rejected an unsupported Relay command", {
|
|
101883
|
-
code: error62.code,
|
|
101884
|
-
direction: error62.direction,
|
|
101885
|
-
messageKind: error62.messageKind
|
|
101886
|
-
});
|
|
101887
|
-
diagnostics.daemonDiagnostic(
|
|
101888
|
-
"relay_command_unsupported",
|
|
101889
|
-
correlation.requestId,
|
|
101890
|
-
{
|
|
101891
|
-
code: error62.code,
|
|
101892
|
-
direction: error62.direction,
|
|
101893
|
-
messageKind: error62.messageKind
|
|
101894
|
-
},
|
|
101895
|
-
error62
|
|
101896
|
-
);
|
|
101897
|
-
rejectUnsupportedCommand(socket, correlation, error62);
|
|
101898
|
-
return;
|
|
101899
|
-
}
|
|
101900
102175
|
console.error("Mobius daemon rejected a message", error62);
|
|
101901
102176
|
failAndClose(
|
|
101902
102177
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|
|
@@ -102468,13 +102743,13 @@ async function requestDaemonReleaseUpgrade(stateDirectory, currentVersion, signa
|
|
|
102468
102743
|
}
|
|
102469
102744
|
async function requestInstalledDaemonReleaseSwitch(stateDirectory, launch, signal) {
|
|
102470
102745
|
const id = randomUUID20();
|
|
102471
|
-
const response =
|
|
102746
|
+
const response = decodeKnownLifecycleResponse(
|
|
102472
102747
|
await sendLocalRequest(stateDirectory, "manager", { kind: "switch", id, context: "npm", launch }, signal)
|
|
102473
102748
|
);
|
|
102474
|
-
if (response
|
|
102749
|
+
if (response?.kind === "error") {
|
|
102475
102750
|
throw new DaemonReleaseUpgradeError(response.code, response.message);
|
|
102476
102751
|
}
|
|
102477
|
-
if (response
|
|
102752
|
+
if (response?.kind !== "switching") {
|
|
102478
102753
|
throw new DaemonReleaseUpgradeError("manager_incompatible", "The manager does not support daemon switching");
|
|
102479
102754
|
}
|
|
102480
102755
|
return { kind: "requested", id, version: launch.version };
|