@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/runtime.js
CHANGED
|
@@ -20993,17 +20993,6 @@ var ProtocolMessageError = class extends Error {
|
|
|
20993
20993
|
this.name = "ProtocolMessageError";
|
|
20994
20994
|
}
|
|
20995
20995
|
};
|
|
20996
|
-
var UnsupportedProtocolMessageKindError = class extends Error {
|
|
20997
|
-
code = "unsupported_protocol_message_kind";
|
|
20998
|
-
direction;
|
|
20999
|
-
messageKind;
|
|
21000
|
-
constructor(direction, messageKind) {
|
|
21001
|
-
super(`Unsupported ${direction} message kind: ${messageKind}`);
|
|
21002
|
-
this.name = "UnsupportedProtocolMessageKindError";
|
|
21003
|
-
this.direction = direction;
|
|
21004
|
-
this.messageKind = messageKind;
|
|
21005
|
-
}
|
|
21006
|
-
};
|
|
21007
20996
|
function isRecord2(value) {
|
|
21008
20997
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21009
20998
|
}
|
|
@@ -22507,7 +22496,129 @@ var sessionWireEventSchema = external_exports.union([
|
|
|
22507
22496
|
var sessionWireEnvelopeSchema = external_exports.object({
|
|
22508
22497
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
22509
22498
|
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
22510
|
-
}).readonly();
|
|
22499
|
+
}).passthrough().readonly();
|
|
22500
|
+
var knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
22501
|
+
"text",
|
|
22502
|
+
"image",
|
|
22503
|
+
"audio",
|
|
22504
|
+
"resource_link",
|
|
22505
|
+
"resource",
|
|
22506
|
+
"external_image",
|
|
22507
|
+
"external_audio",
|
|
22508
|
+
"external_resource"
|
|
22509
|
+
]);
|
|
22510
|
+
var knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
22511
|
+
var knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
22512
|
+
var knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
22513
|
+
var knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
22514
|
+
"user_message_chunk",
|
|
22515
|
+
"agent_message_chunk",
|
|
22516
|
+
"agent_thought_chunk",
|
|
22517
|
+
"tool_call",
|
|
22518
|
+
"tool_call_update",
|
|
22519
|
+
"plan",
|
|
22520
|
+
"plan_update",
|
|
22521
|
+
"plan_removed",
|
|
22522
|
+
"available_commands_update",
|
|
22523
|
+
"current_mode_update",
|
|
22524
|
+
"config_option_update",
|
|
22525
|
+
"session_info_update",
|
|
22526
|
+
"usage_update",
|
|
22527
|
+
"compaction_update",
|
|
22528
|
+
"compaction_summary_chunk"
|
|
22529
|
+
]);
|
|
22530
|
+
var knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
22531
|
+
"session.queue.changed",
|
|
22532
|
+
"session.permission.requested",
|
|
22533
|
+
"session.permission.resolved",
|
|
22534
|
+
"session.elicitation.requested",
|
|
22535
|
+
"session.elicitation.resolved",
|
|
22536
|
+
"prompt.requested",
|
|
22537
|
+
"prompt.started",
|
|
22538
|
+
"prompt.completed",
|
|
22539
|
+
"prompt.failed-before-start",
|
|
22540
|
+
"prompt.failed"
|
|
22541
|
+
]);
|
|
22542
|
+
function isRecord3(value) {
|
|
22543
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22544
|
+
}
|
|
22545
|
+
function hasUnknownDiscriminator(value, key, known) {
|
|
22546
|
+
if (!isRecord3(value)) {
|
|
22547
|
+
return false;
|
|
22548
|
+
}
|
|
22549
|
+
const variant = value[key];
|
|
22550
|
+
return typeof variant === "string" && !known.has(variant);
|
|
22551
|
+
}
|
|
22552
|
+
function containsUnknownContentBlock(value) {
|
|
22553
|
+
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
22554
|
+
}
|
|
22555
|
+
function containsUnknownToolCallContent(value) {
|
|
22556
|
+
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
22557
|
+
return true;
|
|
22558
|
+
}
|
|
22559
|
+
return isRecord3(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
22560
|
+
}
|
|
22561
|
+
function arrayContainsUnknown(value, predicate) {
|
|
22562
|
+
return Array.isArray(value) && value.some(predicate);
|
|
22563
|
+
}
|
|
22564
|
+
function containsUnknownAcpVariant(payload) {
|
|
22565
|
+
const update = payload["sessionUpdate"];
|
|
22566
|
+
if (typeof update !== "string") {
|
|
22567
|
+
return false;
|
|
22568
|
+
}
|
|
22569
|
+
if (!knownSessionUpdates.has(update)) {
|
|
22570
|
+
return true;
|
|
22571
|
+
}
|
|
22572
|
+
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
22573
|
+
update
|
|
22574
|
+
)) {
|
|
22575
|
+
return containsUnknownContentBlock(payload["content"]);
|
|
22576
|
+
}
|
|
22577
|
+
if (update === "tool_call" || update === "tool_call_update") {
|
|
22578
|
+
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
22579
|
+
}
|
|
22580
|
+
if (update === "plan_update") {
|
|
22581
|
+
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
22582
|
+
}
|
|
22583
|
+
if (update === "config_option_update") {
|
|
22584
|
+
return arrayContainsUnknown(
|
|
22585
|
+
payload["configOptions"],
|
|
22586
|
+
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
22587
|
+
);
|
|
22588
|
+
}
|
|
22589
|
+
if (update === "compaction_update") {
|
|
22590
|
+
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
22591
|
+
}
|
|
22592
|
+
return false;
|
|
22593
|
+
}
|
|
22594
|
+
function isKnownSessionEventVariant(value) {
|
|
22595
|
+
if (!isRecord3(value)) {
|
|
22596
|
+
return true;
|
|
22597
|
+
}
|
|
22598
|
+
const type = value["type"];
|
|
22599
|
+
if (typeof type !== "string") {
|
|
22600
|
+
return true;
|
|
22601
|
+
}
|
|
22602
|
+
if (type === "acp") {
|
|
22603
|
+
const payload = value["payload"];
|
|
22604
|
+
return !isRecord3(payload) || !containsUnknownAcpVariant(payload);
|
|
22605
|
+
}
|
|
22606
|
+
if (type === "lifecycle-metadata") {
|
|
22607
|
+
const payload = value["payload"];
|
|
22608
|
+
if (!isRecord3(payload)) {
|
|
22609
|
+
return true;
|
|
22610
|
+
}
|
|
22611
|
+
const kind = payload["kind"];
|
|
22612
|
+
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
22613
|
+
return false;
|
|
22614
|
+
}
|
|
22615
|
+
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
22616
|
+
}
|
|
22617
|
+
return false;
|
|
22618
|
+
}
|
|
22619
|
+
function filterKnownSessionEventVariants(events) {
|
|
22620
|
+
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
22621
|
+
}
|
|
22511
22622
|
var sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
22512
22623
|
var sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
22513
22624
|
var sessionExportSchema = external_exports.object({
|
|
@@ -22593,10 +22704,28 @@ function decode4(value, schema) {
|
|
|
22593
22704
|
function encode3(value, schema) {
|
|
22594
22705
|
return JSON.stringify(decode4(value, schema));
|
|
22595
22706
|
}
|
|
22707
|
+
function sanitizeKnownNativeSessionEvents(value) {
|
|
22708
|
+
const input2 = inputValue(value);
|
|
22709
|
+
if (!isRecord3(input2)) {
|
|
22710
|
+
return input2;
|
|
22711
|
+
}
|
|
22712
|
+
const page = input2["events"];
|
|
22713
|
+
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
22714
|
+
return {
|
|
22715
|
+
...input2,
|
|
22716
|
+
events: isRecord3(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
22717
|
+
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
22718
|
+
(prompt) => !isRecord3(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
22719
|
+
) : queuedPromptRequests
|
|
22720
|
+
};
|
|
22721
|
+
}
|
|
22722
|
+
var knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
22596
22723
|
var decodeSessionEvent = (value) => decode4(value, sessionEventSchema);
|
|
22724
|
+
var decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode4(value, sessionEventPayloadSchema) : null;
|
|
22597
22725
|
var decodeSessionEventEnvelope = (value) => decode4(value, sessionEventEnvelopeSchema);
|
|
22598
22726
|
var encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
22599
22727
|
var decodeAcpSessionUpdate = (value) => decode4(value, acpSessionUpdateSchema);
|
|
22728
|
+
var decodeKnownNativeSessionEvents = (value) => decode4(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
22600
22729
|
|
|
22601
22730
|
// ../mobius-sdk/src/protocol/session/observability/history.ts
|
|
22602
22731
|
var SESSION_HISTORY_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
@@ -22627,6 +22756,30 @@ var pageLoadedFields = {
|
|
|
22627
22756
|
};
|
|
22628
22757
|
var sessionHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
22629
22758
|
var sessionPreviewHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
22759
|
+
var wireNativeSessionEventsSchema = external_exports.object({
|
|
22760
|
+
events: external_exports.object({
|
|
22761
|
+
events: external_exports.array(external_exports.unknown()).max(1e4).readonly(),
|
|
22762
|
+
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
22763
|
+
sessionGenerationId: identifierStringSchema,
|
|
22764
|
+
tailCursor: external_exports.string().max(512),
|
|
22765
|
+
throughPosition: external_exports.string().regex(/^(0|[1-9][0-9]*)$/u).optional(),
|
|
22766
|
+
truncated: external_exports.boolean(),
|
|
22767
|
+
version: external_exports.literal(2)
|
|
22768
|
+
}).passthrough().readonly(),
|
|
22769
|
+
queuedPromptRequests: external_exports.array(external_exports.unknown()).max(1e3).readonly()
|
|
22770
|
+
}).passthrough().readonly();
|
|
22771
|
+
var sessionHistoryWirePageLoadedSchema = external_exports.object({
|
|
22772
|
+
events: wireNativeSessionEventsSchema,
|
|
22773
|
+
kind: external_exports.literal(SESSION_HISTORY_PAGE_LOADED_KIND),
|
|
22774
|
+
requestId: identifierStringSchema,
|
|
22775
|
+
sessionId: identifierStringSchema
|
|
22776
|
+
}).passthrough().readonly();
|
|
22777
|
+
var sessionPreviewHistoryWirePageLoadedSchema = external_exports.object({
|
|
22778
|
+
events: wireNativeSessionEventsSchema,
|
|
22779
|
+
kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND),
|
|
22780
|
+
requestId: identifierStringSchema,
|
|
22781
|
+
sessionId: identifierStringSchema
|
|
22782
|
+
}).passthrough().readonly();
|
|
22630
22783
|
function decode5(schema, encoded) {
|
|
22631
22784
|
try {
|
|
22632
22785
|
const value = JSON.parse(encoded);
|
|
@@ -22635,10 +22788,21 @@ function decode5(schema, encoded) {
|
|
|
22635
22788
|
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
22636
22789
|
}
|
|
22637
22790
|
}
|
|
22791
|
+
function decodeLoaded(schema, encoded) {
|
|
22792
|
+
try {
|
|
22793
|
+
const value = JSON.parse(encoded);
|
|
22794
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
22795
|
+
return schema.parse(value);
|
|
22796
|
+
}
|
|
22797
|
+
return schema.parse({ ...value, events: decodeKnownNativeSessionEvents(Reflect.get(value, "events")) });
|
|
22798
|
+
} catch (cause) {
|
|
22799
|
+
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
22800
|
+
}
|
|
22801
|
+
}
|
|
22638
22802
|
var decodeSessionHistoryPageLoad = (encoded) => decode5(sessionHistoryPageLoadSchema, encoded);
|
|
22639
|
-
var decodeSessionHistoryPageLoaded = (encoded) =>
|
|
22803
|
+
var decodeSessionHistoryPageLoaded = (encoded) => decodeLoaded(sessionHistoryPageLoadedSchema, encoded);
|
|
22640
22804
|
var decodeSessionPreviewHistoryPageLoad = (encoded) => decode5(sessionPreviewHistoryPageLoadSchema, encoded);
|
|
22641
|
-
var decodeSessionPreviewHistoryPageLoaded = (encoded) =>
|
|
22805
|
+
var decodeSessionPreviewHistoryPageLoaded = (encoded) => decodeLoaded(sessionPreviewHistoryPageLoadedSchema, encoded);
|
|
22642
22806
|
var encodeSessionHistoryPageLoad = (value) => JSON.stringify(sessionHistoryPageLoadSchema.parse(value));
|
|
22643
22807
|
var encodeSessionHistoryPageLoaded = (value) => JSON.stringify(sessionHistoryPageLoadedSchema.parse(value));
|
|
22644
22808
|
var encodeSessionPreviewHistoryPageLoad = (value) => JSON.stringify(sessionPreviewHistoryPageLoadSchema.parse(value));
|
|
@@ -22879,13 +23043,28 @@ var serviceToDaemonSignatures = {
|
|
|
22879
23043
|
)
|
|
22880
23044
|
};
|
|
22881
23045
|
var serviceToDaemonRegistry = serviceToDaemonSignatures;
|
|
22882
|
-
|
|
23046
|
+
var knownNativeActions = /* @__PURE__ */ new Set(["active-turn", "find", "list", "import", "fork"]);
|
|
23047
|
+
function isRecord4(value) {
|
|
23048
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23049
|
+
}
|
|
23050
|
+
function hasUnknownDiscriminator2(value, key, known) {
|
|
23051
|
+
if (!isRecord4(value)) {
|
|
23052
|
+
return false;
|
|
23053
|
+
}
|
|
23054
|
+
const variant = value[key];
|
|
23055
|
+
return typeof variant === "string" && !known.has(variant);
|
|
23056
|
+
}
|
|
23057
|
+
function hasUnknownServiceVariant(kind, value) {
|
|
23058
|
+
return kind === NATIVE_SESSION_REQUEST_KIND && hasUnknownDiscriminator2(value, "action", knownNativeActions);
|
|
23059
|
+
}
|
|
23060
|
+
function decodeKnownServiceToDaemonMessage(encoded) {
|
|
22883
23061
|
const kind = decodeMessageKind(encoded);
|
|
22884
23062
|
const signature = serviceToDaemonRegistry[kind];
|
|
22885
23063
|
if (signature === void 0) {
|
|
22886
|
-
|
|
23064
|
+
return null;
|
|
22887
23065
|
}
|
|
22888
|
-
|
|
23066
|
+
const value = parseJson(encoded);
|
|
23067
|
+
return hasUnknownServiceVariant(kind, value) ? null : signature.decoder(encoded);
|
|
22889
23068
|
}
|
|
22890
23069
|
var daemonToServiceSignatures = {
|
|
22891
23070
|
[SESSION_CLOSED_KIND]: defineMessageSignature(
|
|
@@ -23101,7 +23280,7 @@ var SessionConfigProtocolError = class extends Error {
|
|
|
23101
23280
|
this.name = "SessionConfigProtocolError";
|
|
23102
23281
|
}
|
|
23103
23282
|
};
|
|
23104
|
-
function
|
|
23283
|
+
function isRecord5(value) {
|
|
23105
23284
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23106
23285
|
}
|
|
23107
23286
|
function readString3(value, fallback = "") {
|
|
@@ -23132,7 +23311,7 @@ function normalizeConfigValues(value) {
|
|
|
23132
23311
|
}
|
|
23133
23312
|
const normalized = [];
|
|
23134
23313
|
for (const entry of value) {
|
|
23135
|
-
if (!
|
|
23314
|
+
if (!isRecord5(entry)) {
|
|
23136
23315
|
continue;
|
|
23137
23316
|
}
|
|
23138
23317
|
const groupedOptions = entry["options"];
|
|
@@ -23140,7 +23319,7 @@ function normalizeConfigValues(value) {
|
|
|
23140
23319
|
const groupId = readString3(entry["group"]);
|
|
23141
23320
|
const groupName = readString3(entry["name"]);
|
|
23142
23321
|
for (const groupedOption of groupedOptions) {
|
|
23143
|
-
if (
|
|
23322
|
+
if (isRecord5(groupedOption)) {
|
|
23144
23323
|
const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
|
|
23145
23324
|
if (normalizedValue !== void 0) {
|
|
23146
23325
|
normalized.push(normalizedValue);
|
|
@@ -23165,7 +23344,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
23165
23344
|
const normalized = [];
|
|
23166
23345
|
if (Array.isArray(value)) {
|
|
23167
23346
|
for (const option of value) {
|
|
23168
|
-
if (!
|
|
23347
|
+
if (!isRecord5(option)) {
|
|
23169
23348
|
continue;
|
|
23170
23349
|
}
|
|
23171
23350
|
const id = truncate2(readString3(option["id"]), 128);
|
|
@@ -23205,12 +23384,12 @@ function normalizeConfigOptions(value, modes) {
|
|
|
23205
23384
|
}
|
|
23206
23385
|
}
|
|
23207
23386
|
}
|
|
23208
|
-
if (
|
|
23387
|
+
if (isRecord5(modes)) {
|
|
23209
23388
|
const values = [];
|
|
23210
23389
|
const availableModes = modes["availableModes"];
|
|
23211
23390
|
if (Array.isArray(availableModes)) {
|
|
23212
23391
|
for (const mode of availableModes) {
|
|
23213
|
-
if (!
|
|
23392
|
+
if (!isRecord5(mode)) {
|
|
23214
23393
|
continue;
|
|
23215
23394
|
}
|
|
23216
23395
|
const id = truncate2(readString3(mode["id"]), 500);
|
|
@@ -23243,7 +23422,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
23243
23422
|
return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
23244
23423
|
}
|
|
23245
23424
|
function normalizeStandardLifecycle(response) {
|
|
23246
|
-
const lifecycle =
|
|
23425
|
+
const lifecycle = isRecord5(response) ? response : {};
|
|
23247
23426
|
return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
23248
23427
|
}
|
|
23249
23428
|
function replaceStandardConfigOptions(current, value) {
|
|
@@ -23285,7 +23464,7 @@ var StandardSessionConfigProtocol = class {
|
|
|
23285
23464
|
"ACP agent exited while changing session configuration",
|
|
23286
23465
|
change.signal
|
|
23287
23466
|
);
|
|
23288
|
-
if (!
|
|
23467
|
+
if (!isRecord5(response) || !Array.isArray(response["configOptions"])) {
|
|
23289
23468
|
throw new SessionConfigProtocolError("The Agent returned an invalid session configuration response");
|
|
23290
23469
|
}
|
|
23291
23470
|
return replaceStandardConfigOptions(current, response["configOptions"]);
|
|
@@ -32345,7 +32524,7 @@ var toolImageSchema = external_exports.union([
|
|
|
32345
32524
|
file: external_exports.object({ base64: external_exports.string(), type: external_exports.string() })
|
|
32346
32525
|
}).transform(({ file: file2 }) => ({ type: "image", data: file2.base64, mimeType: file2.type }))
|
|
32347
32526
|
]);
|
|
32348
|
-
function
|
|
32527
|
+
function isRecord6(value) {
|
|
32349
32528
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32350
32529
|
}
|
|
32351
32530
|
var AcpContentExternalizer = class {
|
|
@@ -32452,13 +32631,13 @@ var AcpContentExternalizer = class {
|
|
|
32452
32631
|
}
|
|
32453
32632
|
return result2;
|
|
32454
32633
|
}
|
|
32455
|
-
if (!
|
|
32634
|
+
if (!isRecord6(value)) {
|
|
32456
32635
|
return value;
|
|
32457
32636
|
}
|
|
32458
32637
|
const image = toolImageSchema.safeParse(value);
|
|
32459
32638
|
if (image.success && image.data.data.length > 0) {
|
|
32460
32639
|
const prepared = await this.#content(sessionId, image.data, signal);
|
|
32461
|
-
if (
|
|
32640
|
+
if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
32462
32641
|
images.set(prepared.event["imageKey"], prepared);
|
|
32463
32642
|
} else {
|
|
32464
32643
|
images.set(`unavailable:${images.size}`, prepared);
|
|
@@ -32489,7 +32668,7 @@ var AcpContentExternalizer = class {
|
|
|
32489
32668
|
const prepared = await this.#content(sessionId, content, signal);
|
|
32490
32669
|
agentContent.push({ ...item, content: prepared.agent });
|
|
32491
32670
|
eventContent.push({ ...item, content: prepared.event });
|
|
32492
|
-
if (
|
|
32671
|
+
if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
|
|
32493
32672
|
images.delete(prepared.event["imageKey"]);
|
|
32494
32673
|
}
|
|
32495
32674
|
}
|
|
@@ -32569,7 +32748,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
32569
32748
|
// package.json
|
|
32570
32749
|
var package_default = {
|
|
32571
32750
|
name: "@moxt-ai/mobius",
|
|
32572
|
-
version: "0.0.
|
|
32751
|
+
version: "0.0.336",
|
|
32573
32752
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
32574
32753
|
type: "module",
|
|
32575
32754
|
bin: {
|
|
@@ -69847,7 +70026,7 @@ var DESTINATIONS = /* @__PURE__ */ new Set([
|
|
|
69847
70026
|
]);
|
|
69848
70027
|
var BEHAVIORS = /* @__PURE__ */ new Set(["allow", "deny", "ask"]);
|
|
69849
70028
|
var MODES = /* @__PURE__ */ new Set(["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"]);
|
|
69850
|
-
function
|
|
70029
|
+
function isRecord7(value) {
|
|
69851
70030
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
69852
70031
|
}
|
|
69853
70032
|
function isDestination(value) {
|
|
@@ -69864,13 +70043,13 @@ function safePlainString(value, maxLength) {
|
|
|
69864
70043
|
});
|
|
69865
70044
|
}
|
|
69866
70045
|
function isRule(value) {
|
|
69867
|
-
if (!
|
|
70046
|
+
if (!isRecord7(value) || !safePlainString(value.toolName, MAX_TOOL_NAME_LENGTH)) {
|
|
69868
70047
|
return false;
|
|
69869
70048
|
}
|
|
69870
70049
|
return value.ruleContent === void 0 || safePlainString(value.ruleContent, MAX_RULE_CONTENT_LENGTH);
|
|
69871
70050
|
}
|
|
69872
70051
|
function isKnownUpdate(value) {
|
|
69873
|
-
if (!
|
|
70052
|
+
if (!isRecord7(value) || !isDestination(value.destination) || typeof value.type !== "string") {
|
|
69874
70053
|
return false;
|
|
69875
70054
|
}
|
|
69876
70055
|
switch (value.type) {
|
|
@@ -82594,7 +82773,7 @@ var AgentCatalogPublishError = class extends Error {
|
|
|
82594
82773
|
this.name = "AgentCatalogPublishError";
|
|
82595
82774
|
}
|
|
82596
82775
|
};
|
|
82597
|
-
function
|
|
82776
|
+
function isRecord8(value) {
|
|
82598
82777
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82599
82778
|
}
|
|
82600
82779
|
function isSafeRelayErrorMessage(value) {
|
|
@@ -82607,7 +82786,7 @@ async function rejectedCatalogError(response) {
|
|
|
82607
82786
|
} catch {
|
|
82608
82787
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
82609
82788
|
}
|
|
82610
|
-
if (!
|
|
82789
|
+
if (!isRecord8(value) || !isRecord8(value["error"])) {
|
|
82611
82790
|
return new AgentCatalogPublishError("The Relay rejected the Agent catalog update");
|
|
82612
82791
|
}
|
|
82613
82792
|
const code = value["error"]["code"];
|
|
@@ -83029,7 +83208,7 @@ var RuntimeInstallationStoreError = class extends Error {
|
|
|
83029
83208
|
this.name = "RuntimeInstallationStoreError";
|
|
83030
83209
|
}
|
|
83031
83210
|
};
|
|
83032
|
-
function
|
|
83211
|
+
function isRecord9(value) {
|
|
83033
83212
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83034
83213
|
}
|
|
83035
83214
|
function hasExactKeys(value, expectedKeys) {
|
|
@@ -83096,7 +83275,7 @@ function installationId() {
|
|
|
83096
83275
|
return `min_${randomUUID13().replaceAll("-", "")}`;
|
|
83097
83276
|
}
|
|
83098
83277
|
function decodeInstallationPointer(value) {
|
|
83099
|
-
if (!
|
|
83278
|
+
if (!isRecord9(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
83100
83279
|
throw new RuntimeInstallationStoreError("invalid_installation", "The local installation record is invalid");
|
|
83101
83280
|
}
|
|
83102
83281
|
const storedInstallationId = value["installationId"];
|
|
@@ -83106,7 +83285,7 @@ function decodeInstallationPointer(value) {
|
|
|
83106
83285
|
return { installationId: validateInstallationId(storedInstallationId) };
|
|
83107
83286
|
}
|
|
83108
83287
|
function decodeChannelIndex(value) {
|
|
83109
|
-
if (!
|
|
83288
|
+
if (!isRecord9(value) || !hasExactKeys(value, CHANNEL_INDEX_KEYS) || value["version"] !== 1) {
|
|
83110
83289
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
83111
83290
|
}
|
|
83112
83291
|
const applicationId = value["applicationId"];
|
|
@@ -83156,7 +83335,7 @@ function decodeVerifiedConnection(value) {
|
|
|
83156
83335
|
);
|
|
83157
83336
|
}
|
|
83158
83337
|
function decodeConnection(value) {
|
|
83159
|
-
if (!
|
|
83338
|
+
if (!isRecord9(value)) {
|
|
83160
83339
|
throw new RuntimeInstallationStoreError("invalid_connection", "The saved Runtime connection is invalid");
|
|
83161
83340
|
}
|
|
83162
83341
|
return decodeVerifiedConnection(value);
|
|
@@ -83769,7 +83948,10 @@ function legacyState(receipt) {
|
|
|
83769
83948
|
if (receipt.outcome === null) {
|
|
83770
83949
|
return receipt.started ? "running" : "dispatching";
|
|
83771
83950
|
}
|
|
83772
|
-
const event =
|
|
83951
|
+
const event = decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
83952
|
+
if (event === null) {
|
|
83953
|
+
return "failed";
|
|
83954
|
+
}
|
|
83773
83955
|
return event.type === "lifecycle-metadata" && event.payload.kind === "prompt.completed" ? event.payload.stopReason === "cancelled" ? "cancelled" : "succeeded" : "failed";
|
|
83774
83956
|
}
|
|
83775
83957
|
var ExecutionReceiptTable = class {
|
|
@@ -84578,7 +84760,11 @@ var storedSessionConfigurationsSchema = external_exports.array(
|
|
|
84578
84760
|
external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
|
|
84579
84761
|
])
|
|
84580
84762
|
).max(100);
|
|
84581
|
-
var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(
|
|
84763
|
+
var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(
|
|
84764
|
+
Array.isArray(value) ? value.filter(
|
|
84765
|
+
(configuration) => typeof configuration !== "object" || configuration === null || !("type" in configuration) || typeof configuration.type !== "string" || configuration.type === "boolean" || configuration.type === "select"
|
|
84766
|
+
) : value
|
|
84767
|
+
);
|
|
84582
84768
|
var SessionConfigurations = class {
|
|
84583
84769
|
#selected = [];
|
|
84584
84770
|
stored = () => this.#selected;
|
|
@@ -87092,7 +87278,7 @@ var ExecutionReceipts = class {
|
|
|
87092
87278
|
};
|
|
87093
87279
|
outcome = (commandId) => {
|
|
87094
87280
|
const receipt = this.#executions.get(commandId);
|
|
87095
|
-
return receipt?.outcome === null || receipt === void 0 ? void 0 :
|
|
87281
|
+
return receipt?.outcome === null || receipt === void 0 ? void 0 : decodeKnownSessionEventPayload(JSON.parse(receipt.outcome)) ?? void 0;
|
|
87096
87282
|
};
|
|
87097
87283
|
/** Reserves an unseen command for cancellation before a delayed prompt can claim its identity. */
|
|
87098
87284
|
recordCancellationBeforeAdmission = (commandId, sessionId) => {
|
|
@@ -87155,7 +87341,10 @@ var ExecutionReceipts = class {
|
|
|
87155
87341
|
code: "runtime_restarted",
|
|
87156
87342
|
message: "The local runtime restarted before this request started"
|
|
87157
87343
|
}
|
|
87158
|
-
} :
|
|
87344
|
+
} : decodeKnownSessionEventPayload(JSON.parse(receipt.outcome));
|
|
87345
|
+
if (event === null) {
|
|
87346
|
+
continue;
|
|
87347
|
+
}
|
|
87159
87348
|
const recordedAt = receipt.outcome === null ? (/* @__PURE__ */ new Date()).toISOString() : external_exports.object({ recordedAt: external_exports.string() }).parse(JSON.parse(receipt.outcome)).recordedAt;
|
|
87160
87349
|
recovered.push({ sessionId: receipt.sessionId, event, recordedAt });
|
|
87161
87350
|
if (receipt.outcome === null) {
|
|
@@ -91234,35 +91423,6 @@ function closeRelaySocket(socket, code, reason) {
|
|
|
91234
91423
|
}
|
|
91235
91424
|
}
|
|
91236
91425
|
}
|
|
91237
|
-
function readCommandCorrelation(encoded) {
|
|
91238
|
-
let value;
|
|
91239
|
-
try {
|
|
91240
|
-
value = JSON.parse(encoded);
|
|
91241
|
-
} catch {
|
|
91242
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
91243
|
-
}
|
|
91244
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
91245
|
-
return { requestId: "unsupported", sessionId: "" };
|
|
91246
|
-
}
|
|
91247
|
-
const requestId = Reflect.get(value, "requestId");
|
|
91248
|
-
const sessionId = Reflect.get(value, "sessionId");
|
|
91249
|
-
return {
|
|
91250
|
-
requestId: typeof requestId === "string" && isIdentifier(requestId) ? requestId : "unsupported",
|
|
91251
|
-
sessionId: typeof sessionId === "string" && isIdentifier(sessionId) ? sessionId : ""
|
|
91252
|
-
};
|
|
91253
|
-
}
|
|
91254
|
-
function rejectUnsupportedCommand(socket, correlation, rejection) {
|
|
91255
|
-
if (socket.readyState !== WebSocket8.OPEN) {
|
|
91256
|
-
return;
|
|
91257
|
-
}
|
|
91258
|
-
send(socket, {
|
|
91259
|
-
code: rejection.code,
|
|
91260
|
-
kind: SESSION_OPERATION_FAILED_KIND,
|
|
91261
|
-
message: "The Relay sent a command this daemon does not support",
|
|
91262
|
-
requestId: correlation.requestId,
|
|
91263
|
-
sessionId: correlation.sessionId
|
|
91264
|
-
});
|
|
91265
|
-
}
|
|
91266
91426
|
async function runRelayConnection({
|
|
91267
91427
|
resolveAgent,
|
|
91268
91428
|
config: config2,
|
|
@@ -91415,7 +91575,10 @@ async function runRelayConnection({
|
|
|
91415
91575
|
return;
|
|
91416
91576
|
}
|
|
91417
91577
|
try {
|
|
91418
|
-
const message =
|
|
91578
|
+
const message = decodeKnownServiceToDaemonMessage(encoded);
|
|
91579
|
+
if (message === null) {
|
|
91580
|
+
return;
|
|
91581
|
+
}
|
|
91419
91582
|
const kind = message.kind;
|
|
91420
91583
|
if (kind === RUNTIME_LIVENESS_READY_KIND) {
|
|
91421
91584
|
if (ready) {
|
|
@@ -91433,26 +91596,6 @@ async function runRelayConnection({
|
|
|
91433
91596
|
}
|
|
91434
91597
|
commands.dispatch(message);
|
|
91435
91598
|
} catch (error62) {
|
|
91436
|
-
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
91437
|
-
const correlation = readCommandCorrelation(encoded);
|
|
91438
|
-
console.warn("Mobius daemon rejected an unsupported Relay command", {
|
|
91439
|
-
code: error62.code,
|
|
91440
|
-
direction: error62.direction,
|
|
91441
|
-
messageKind: error62.messageKind
|
|
91442
|
-
});
|
|
91443
|
-
diagnostics.daemonDiagnostic(
|
|
91444
|
-
"relay_command_unsupported",
|
|
91445
|
-
correlation.requestId,
|
|
91446
|
-
{
|
|
91447
|
-
code: error62.code,
|
|
91448
|
-
direction: error62.direction,
|
|
91449
|
-
messageKind: error62.messageKind
|
|
91450
|
-
},
|
|
91451
|
-
error62
|
|
91452
|
-
);
|
|
91453
|
-
rejectUnsupportedCommand(socket, correlation, error62);
|
|
91454
|
-
return;
|
|
91455
|
-
}
|
|
91456
91599
|
console.error("Mobius daemon rejected a message", error62);
|
|
91457
91600
|
failAndClose(
|
|
91458
91601
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|