@moxt-ai/mobius 0.0.341 → 0.0.342
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/acp/adapter/claude/agent-connection.js +1 -1
- package/dist/acp/adapter/claude/agent-connection.js.map +1 -1
- package/dist/acp/adapter/codex/agent-connection.js +1 -1
- package/dist/acp/adapter/codex/agent-connection.js.map +1 -1
- package/dist/acp/adapter/pi/agent-connection.js +1 -1
- package/dist/acp/adapter/pi/agent-connection.js.map +1 -1
- package/dist/acp/adapter/session-events.d.ts +2 -1
- package/dist/acp/adapter/session-events.d.ts.map +1 -1
- package/dist/acp/adapter/session-events.js +7 -7
- package/dist/acp/adapter/session-events.js.map +1 -1
- package/dist/acp/agent/in-process-endpoint.d.ts +3 -1
- package/dist/acp/agent/in-process-endpoint.d.ts.map +1 -1
- package/dist/acp/connection/agent-connection.d.ts +2 -2
- package/dist/acp/connection/agent-connection.d.ts.map +1 -1
- package/dist/acp/harness/claude/endpoint.js +1 -1
- package/dist/acp/harness/claude/endpoint.js.map +1 -1
- package/dist/acp/harness/codex/agent.js +3 -3
- package/dist/acp/harness/codex/agent.js.map +1 -1
- package/dist/acp/harness/codex/owned-agent.d.ts +2 -2
- package/dist/acp/harness/codex/owned-agent.d.ts.map +1 -1
- package/dist/acp/harness/codex/owned-agent.js +3 -3
- package/dist/acp/harness/codex/owned-agent.js.map +1 -1
- package/dist/cli.js +175 -77
- package/dist/cli.js.map +4 -4
- package/dist/daemon/upgrades/upgrade.js +4 -7
- package/dist/daemon/upgrades/upgrade.js.map +1 -1
- package/dist/runtime.js +159 -65
- package/dist/runtime.js.map +4 -4
- package/dist/session/api/session-api.d.ts +3 -2
- package/dist/session/api/session-api.d.ts.map +1 -1
- package/dist/session/api/session-api.js +1 -1
- package/dist/session/api/session-api.js.map +1 -1
- package/dist/session/api/session-layer.d.ts +3 -2
- package/dist/session/api/session-layer.d.ts.map +1 -1
- package/dist/session/api/session-layer.js +4 -4
- package/dist/session/api/session-layer.js.map +1 -1
- package/dist/session/live/agent-session.js +1 -1
- package/dist/session/live/agent-session.js.map +1 -1
- package/dist/session/turn/runtime-turn-activity.d.ts +5 -2
- package/dist/session/turn/runtime-turn-activity.d.ts.map +1 -1
- package/dist/session/turn/runtime-turn-activity.js +15 -10
- package/dist/session/turn/runtime-turn-activity.js.map +1 -1
- package/package.json +1 -1
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.342",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -62509,6 +62509,114 @@ var init_background_task_notifications = __esm({
|
|
|
62509
62509
|
}
|
|
62510
62510
|
});
|
|
62511
62511
|
|
|
62512
|
+
// src/acp/harness/claude/upstream/dist/context-resources.js
|
|
62513
|
+
import { extname } from "node:path";
|
|
62514
|
+
function formatUriAsLink(uri) {
|
|
62515
|
+
if (uri.startsWith("file://")) {
|
|
62516
|
+
const path8 = uri.slice(7);
|
|
62517
|
+
return `[@${path8.split("/").pop() || path8}](${uri})`;
|
|
62518
|
+
}
|
|
62519
|
+
if (uri.startsWith("zed://")) {
|
|
62520
|
+
return `[@${uri.split("/").pop() || uri}](${uri})`;
|
|
62521
|
+
}
|
|
62522
|
+
return uri;
|
|
62523
|
+
}
|
|
62524
|
+
function parseContextBlock(block) {
|
|
62525
|
+
if (block.type !== "text" || typeof block.text !== "string") {
|
|
62526
|
+
return null;
|
|
62527
|
+
}
|
|
62528
|
+
const match = /^\n<context ref="([^"\r\n]+)">\n([\s\S]*)\n<\/context>$/u.exec(block.text);
|
|
62529
|
+
const uri = match?.[1];
|
|
62530
|
+
const text2 = match?.[2];
|
|
62531
|
+
if (uri === void 0 || text2 === void 0 || formatContextBlock(uri, text2) !== block.text) {
|
|
62532
|
+
return null;
|
|
62533
|
+
}
|
|
62534
|
+
return { uri, text: text2 };
|
|
62535
|
+
}
|
|
62536
|
+
function contextMimeType(uri) {
|
|
62537
|
+
let pathname = uri;
|
|
62538
|
+
try {
|
|
62539
|
+
pathname = new URL(uri).pathname;
|
|
62540
|
+
} catch {
|
|
62541
|
+
}
|
|
62542
|
+
switch (extname(pathname).toLowerCase()) {
|
|
62543
|
+
case ".html":
|
|
62544
|
+
case ".htm":
|
|
62545
|
+
return "text/html";
|
|
62546
|
+
case ".js":
|
|
62547
|
+
case ".mjs":
|
|
62548
|
+
case ".cjs":
|
|
62549
|
+
return "text/javascript";
|
|
62550
|
+
case ".css":
|
|
62551
|
+
return "text/css";
|
|
62552
|
+
case ".json":
|
|
62553
|
+
return "application/json";
|
|
62554
|
+
case ".md":
|
|
62555
|
+
case ".markdown":
|
|
62556
|
+
return "text/markdown";
|
|
62557
|
+
case ".xml":
|
|
62558
|
+
return "application/xml";
|
|
62559
|
+
case ".svg":
|
|
62560
|
+
return "image/svg+xml";
|
|
62561
|
+
case ".csv":
|
|
62562
|
+
return "text/csv";
|
|
62563
|
+
default:
|
|
62564
|
+
return "text/plain";
|
|
62565
|
+
}
|
|
62566
|
+
}
|
|
62567
|
+
function replayContextResources(content) {
|
|
62568
|
+
const contexts = [];
|
|
62569
|
+
let contextStart = content.length;
|
|
62570
|
+
for (let index2 = content.length - 1; index2 >= 0; index2 -= 1) {
|
|
62571
|
+
const block = content[index2];
|
|
62572
|
+
const parsed = block === void 0 ? null : parseContextBlock(block);
|
|
62573
|
+
if (parsed === null) {
|
|
62574
|
+
break;
|
|
62575
|
+
}
|
|
62576
|
+
contexts.push(parsed);
|
|
62577
|
+
contextStart = index2;
|
|
62578
|
+
}
|
|
62579
|
+
if (contexts.length === 0) {
|
|
62580
|
+
return null;
|
|
62581
|
+
}
|
|
62582
|
+
contexts.reverse();
|
|
62583
|
+
const links = new Set(contexts.map(({ uri }) => formatUriAsLink(uri)));
|
|
62584
|
+
const resources = /* @__PURE__ */ new Map();
|
|
62585
|
+
let nextContext = 0;
|
|
62586
|
+
for (let index2 = 0; index2 < contextStart; index2 += 1) {
|
|
62587
|
+
const block = content[index2];
|
|
62588
|
+
if (block?.type !== "text" || typeof block.text !== "string") {
|
|
62589
|
+
continue;
|
|
62590
|
+
}
|
|
62591
|
+
if (block.text.startsWith('\n<context ref="')) {
|
|
62592
|
+
return null;
|
|
62593
|
+
}
|
|
62594
|
+
if (!links.has(block.text)) {
|
|
62595
|
+
continue;
|
|
62596
|
+
}
|
|
62597
|
+
const context = contexts[nextContext];
|
|
62598
|
+
if (context === void 0 || block.text !== formatUriAsLink(context.uri)) {
|
|
62599
|
+
return null;
|
|
62600
|
+
}
|
|
62601
|
+
resources.set(index2, {
|
|
62602
|
+
type: "resource",
|
|
62603
|
+
resource: { ...context, mimeType: contextMimeType(context.uri) }
|
|
62604
|
+
});
|
|
62605
|
+
nextContext += 1;
|
|
62606
|
+
}
|
|
62607
|
+
return nextContext === contexts.length ? { contextStart, resources } : null;
|
|
62608
|
+
}
|
|
62609
|
+
var formatContextBlock;
|
|
62610
|
+
var init_context_resources = __esm({
|
|
62611
|
+
"src/acp/harness/claude/upstream/dist/context-resources.js"() {
|
|
62612
|
+
"use strict";
|
|
62613
|
+
formatContextBlock = (uri, text2) => `
|
|
62614
|
+
<context ref="${uri}">
|
|
62615
|
+
${text2}
|
|
62616
|
+
</context>`;
|
|
62617
|
+
}
|
|
62618
|
+
});
|
|
62619
|
+
|
|
62512
62620
|
// src/acp/harness/claude/upstream/dist/elicitation.js
|
|
62513
62621
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
62514
62622
|
import { CreateElicitationResponse } from "@agentclientprotocol/sdk";
|
|
@@ -66515,22 +66623,6 @@ function getAvailableSlashCommands(commands, terminalCommands) {
|
|
|
66515
66623
|
};
|
|
66516
66624
|
}).filter((command) => !UNSUPPORTED_COMMANDS.includes(command.name));
|
|
66517
66625
|
}
|
|
66518
|
-
function formatUriAsLink(uri) {
|
|
66519
|
-
try {
|
|
66520
|
-
if (uri.startsWith("file://")) {
|
|
66521
|
-
const path8 = uri.slice(7);
|
|
66522
|
-
const name2 = path8.split("/").pop() || path8;
|
|
66523
|
-
return `[@${name2}](${uri})`;
|
|
66524
|
-
} else if (uri.startsWith("zed://")) {
|
|
66525
|
-
const parts = uri.split("/");
|
|
66526
|
-
const name2 = parts[parts.length - 1] || uri;
|
|
66527
|
-
return `[@${name2}](${uri})`;
|
|
66528
|
-
}
|
|
66529
|
-
return uri;
|
|
66530
|
-
} catch {
|
|
66531
|
-
return uri;
|
|
66532
|
-
}
|
|
66533
|
-
}
|
|
66534
66626
|
function promptToClaude(prompt) {
|
|
66535
66627
|
const content = [];
|
|
66536
66628
|
const context = [];
|
|
@@ -66563,10 +66655,7 @@ function promptToClaude(prompt) {
|
|
|
66563
66655
|
});
|
|
66564
66656
|
context.push({
|
|
66565
66657
|
type: "text",
|
|
66566
|
-
text:
|
|
66567
|
-
<context ref="${chunk.resource.uri}">
|
|
66568
|
-
${chunk.resource.text}
|
|
66569
|
-
</context>`
|
|
66658
|
+
text: formatContextBlock(chunk.resource.uri, chunk.resource.text)
|
|
66570
66659
|
});
|
|
66571
66660
|
}
|
|
66572
66661
|
break;
|
|
@@ -66735,8 +66824,13 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
66735
66824
|
const toolUseResult = options?.toolUseResult !== void 0 && content.filter((c) => typeof c === "object" && c !== null && c.type === "tool_result").length === 1 ? options.toolUseResult : void 0;
|
|
66736
66825
|
const toolResultMeta = parseToolResultMeta(options?.toolResultMeta);
|
|
66737
66826
|
const output2 = [];
|
|
66738
|
-
|
|
66827
|
+
const replayedResources = role === "user" && options.historical === true ? replayContextResources(content) : null;
|
|
66828
|
+
for (const [index2, chunk] of content.entries()) {
|
|
66829
|
+
if (replayedResources !== null && index2 >= replayedResources.contextStart) {
|
|
66830
|
+
break;
|
|
66831
|
+
}
|
|
66739
66832
|
let update = null;
|
|
66833
|
+
const resource = replayedResources?.resources.get(index2);
|
|
66740
66834
|
switch (chunk.type) {
|
|
66741
66835
|
case "text":
|
|
66742
66836
|
case "text_delta": {
|
|
@@ -66745,7 +66839,7 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
66745
66839
|
update = {
|
|
66746
66840
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
66747
66841
|
messageId,
|
|
66748
|
-
content: {
|
|
66842
|
+
content: resource ?? {
|
|
66749
66843
|
type: "text",
|
|
66750
66844
|
text: chunk.text
|
|
66751
66845
|
}
|
|
@@ -67216,6 +67310,7 @@ var init_acp_agent = __esm({
|
|
|
67216
67310
|
"use strict";
|
|
67217
67311
|
init_sdk();
|
|
67218
67312
|
init_background_task_notifications();
|
|
67313
|
+
init_context_resources();
|
|
67219
67314
|
init_elicitation();
|
|
67220
67315
|
init_environment_session_fork();
|
|
67221
67316
|
init_environment_session_list();
|
|
@@ -67327,14 +67422,15 @@ var init_acp_agent = __esm({
|
|
|
67327
67422
|
providerUpdate = null;
|
|
67328
67423
|
exitPlan;
|
|
67329
67424
|
environment;
|
|
67330
|
-
backgroundSessions = /* @__PURE__ */ new
|
|
67331
|
-
reportBackgroundActivity(session,
|
|
67332
|
-
if (
|
|
67333
|
-
this.backgroundSessions.add(session);
|
|
67334
|
-
} else {
|
|
67425
|
+
backgroundSessions = /* @__PURE__ */ new Map();
|
|
67426
|
+
reportBackgroundActivity(session, activity) {
|
|
67427
|
+
if (activity === "none") {
|
|
67335
67428
|
this.backgroundSessions.delete(session);
|
|
67429
|
+
} else {
|
|
67430
|
+
this.backgroundSessions.set(session, activity);
|
|
67336
67431
|
}
|
|
67337
|
-
|
|
67432
|
+
const activities = new Set(this.backgroundSessions.values());
|
|
67433
|
+
this.onBackgroundActivity?.(activities.has("running") ? "running" : activities.has("awaiting-results") ? "awaiting-results" : "none");
|
|
67338
67434
|
}
|
|
67339
67435
|
/** Grace period before a `session/cancel` forces a wedged prompt loop to
|
|
67340
67436
|
* return "cancelled". See {@link DEFAULT_FORCE_CANCEL_GRACE_MS}. Mutable so
|
|
@@ -67959,7 +68055,7 @@ var init_acp_agent = __esm({
|
|
|
67959
68055
|
const awaitingBackgroundResults = /* @__PURE__ */ new Set();
|
|
67960
68056
|
let processingBackgroundResults = /* @__PURE__ */ new Set();
|
|
67961
68057
|
let hasBackgroundLevel = false;
|
|
67962
|
-
const reportBackgroundActivity = () => this.reportBackgroundActivity(session, backgroundTasks.size > 0
|
|
68058
|
+
const reportBackgroundActivity = () => this.reportBackgroundActivity(session, backgroundTasks.size > 0 ? "running" : awaitingBackgroundResults.size > 0 ? "awaiting-results" : "none");
|
|
67963
68059
|
let lastAssistantTotalUsage = null;
|
|
67964
68060
|
let lastAssistantUsage = null;
|
|
67965
68061
|
let lastAssistantModel = null;
|
|
@@ -69296,7 +69392,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
69296
69392
|
session.settingsManager.dispose();
|
|
69297
69393
|
session.input.end();
|
|
69298
69394
|
session.query.close();
|
|
69299
|
-
this.reportBackgroundActivity(session,
|
|
69395
|
+
this.reportBackgroundActivity(session, "none");
|
|
69300
69396
|
}
|
|
69301
69397
|
/** Cleanly tear down a session: cancel in-flight work, release stream
|
|
69302
69398
|
* resources, and remove it from the session map. */
|
|
@@ -70375,7 +70471,7 @@ var init_endpoint = __esm({
|
|
|
70375
70471
|
CLAUDE_CODE_EXECUTABLE: options.command
|
|
70376
70472
|
}),
|
|
70377
70473
|
onSessionUpdate: options.onSessionUpdate,
|
|
70378
|
-
onBackgroundActivity: (
|
|
70474
|
+
onBackgroundActivity: (activity) => options.onBackgroundActivity?.(activity),
|
|
70379
70475
|
onConnect: (connection) => {
|
|
70380
70476
|
this.#connection = connection;
|
|
70381
70477
|
}
|
|
@@ -70420,7 +70516,7 @@ var init_agent_connection = __esm({
|
|
|
70420
70516
|
onSessionUpdate: async (notification) => {
|
|
70421
70517
|
await options.client.onUpdate(notification);
|
|
70422
70518
|
},
|
|
70423
|
-
onBackgroundActivity: (
|
|
70519
|
+
onBackgroundActivity: (activity) => options.onBackgroundActivity?.(activity)
|
|
70424
70520
|
});
|
|
70425
70521
|
super(endpoint, options.client);
|
|
70426
70522
|
}
|
|
@@ -70959,7 +71055,7 @@ var init_process_error = __esm({
|
|
|
70959
71055
|
// src/util/process/platform/windows.ts
|
|
70960
71056
|
import { execFile as execFile4 } from "node:child_process";
|
|
70961
71057
|
import { readFile as readFile5, realpath as realpath5 } from "node:fs/promises";
|
|
70962
|
-
import { dirname as dirname7, extname, join as join16, resolve as resolve8 } from "node:path";
|
|
71058
|
+
import { dirname as dirname7, extname as extname2, join as join16, resolve as resolve8 } from "node:path";
|
|
70963
71059
|
function environmentValue2(environment, name2) {
|
|
70964
71060
|
return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
|
|
70965
71061
|
}
|
|
@@ -70974,14 +71070,14 @@ function executableExtensions(executableName, environment) {
|
|
|
70974
71070
|
async function resolveExecutableTarget(path8) {
|
|
70975
71071
|
let resolvedPath;
|
|
70976
71072
|
try {
|
|
70977
|
-
resolvedPath = await realpath5(
|
|
71073
|
+
resolvedPath = await realpath5(extname2(path8) === "" ? `${path8}.cmd` : path8);
|
|
70978
71074
|
} catch (cause) {
|
|
70979
|
-
if (
|
|
71075
|
+
if (extname2(path8) !== "" || !(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
|
|
70980
71076
|
throw cause;
|
|
70981
71077
|
}
|
|
70982
71078
|
resolvedPath = await realpath5(path8);
|
|
70983
71079
|
}
|
|
70984
|
-
if (
|
|
71080
|
+
if (extname2(resolvedPath).toLowerCase() === ".cmd") {
|
|
70985
71081
|
const shim = await readFile5(resolvedPath, "utf8");
|
|
70986
71082
|
if (shim.includes('SET "NPM_CLI_JS=%~dp0\\node_modules\\npm\\bin\\npm-cli.js"') && shim.includes('"%NODE_EXE%" "%NPM_CLI_JS%" %*')) {
|
|
70987
71083
|
return await realpath5(resolve8(dirname7(resolvedPath), "node_modules/npm/bin/npm-cli.js"));
|
|
@@ -73432,7 +73528,7 @@ var init_owned_agent = __esm({
|
|
|
73432
73528
|
await this.#enqueue(async () => {
|
|
73433
73529
|
if (item.type === "commandExecution" && method === "item/started") {
|
|
73434
73530
|
this.#runningCommands.set(item.id, "foreground");
|
|
73435
|
-
this.#context.onBackgroundActivity?.(
|
|
73531
|
+
this.#context.onBackgroundActivity?.("running");
|
|
73436
73532
|
}
|
|
73437
73533
|
if (method === "item/started") {
|
|
73438
73534
|
await this.#context.emit({ ...update, sessionUpdate: "tool_call" });
|
|
@@ -73453,7 +73549,7 @@ var init_owned_agent = __esm({
|
|
|
73453
73549
|
}
|
|
73454
73550
|
if (item.type === "commandExecution" && method === "item/completed") {
|
|
73455
73551
|
this.#runningCommands.delete(item.id);
|
|
73456
|
-
this.#context.onBackgroundActivity?.(this.#runningCommands.size > 0);
|
|
73552
|
+
this.#context.onBackgroundActivity?.(this.#runningCommands.size > 0 ? "running" : "none");
|
|
73457
73553
|
}
|
|
73458
73554
|
});
|
|
73459
73555
|
}
|
|
@@ -76760,9 +76856,9 @@ var init_agent = __esm({
|
|
|
76760
76856
|
threadId: () => this.#nativeSessionId,
|
|
76761
76857
|
connection: () => this.#connection,
|
|
76762
76858
|
emit: this.#emit,
|
|
76763
|
-
onBackgroundActivity: (
|
|
76859
|
+
onBackgroundActivity: (activity) => {
|
|
76764
76860
|
if (this.#closePromise === null) {
|
|
76765
|
-
this.#onBackgroundActivity?.(
|
|
76861
|
+
this.#onBackgroundActivity?.(activity);
|
|
76766
76862
|
}
|
|
76767
76863
|
},
|
|
76768
76864
|
close: this.close
|
|
@@ -76910,7 +77006,7 @@ var init_agent = __esm({
|
|
|
76910
77006
|
await stopProcessTree(child, captured);
|
|
76911
77007
|
} finally {
|
|
76912
77008
|
this.#connection?.close();
|
|
76913
|
-
this.#onBackgroundActivity?.(
|
|
77009
|
+
this.#onBackgroundActivity?.("none");
|
|
76914
77010
|
}
|
|
76915
77011
|
})();
|
|
76916
77012
|
}
|
|
@@ -77015,7 +77111,7 @@ var init_agent_connection2 = __esm({
|
|
|
77015
77111
|
cwd: options.cwd,
|
|
77016
77112
|
environment: options.environment,
|
|
77017
77113
|
onSessionUpdate: options.client.onUpdate,
|
|
77018
|
-
onBackgroundActivity: (
|
|
77114
|
+
onBackgroundActivity: (activity) => options.onBackgroundActivity?.(activity)
|
|
77019
77115
|
});
|
|
77020
77116
|
super(endpoint, options.client);
|
|
77021
77117
|
}
|
|
@@ -81112,7 +81208,7 @@ var init_agent_connection3 = __esm({
|
|
|
81112
81208
|
await options.client.onUpdate({ ...notification, update });
|
|
81113
81209
|
}
|
|
81114
81210
|
},
|
|
81115
|
-
onBackgroundActivity: (
|
|
81211
|
+
onBackgroundActivity: (activity) => options.onBackgroundActivity?.(activity)
|
|
81116
81212
|
});
|
|
81117
81213
|
super(endpoint, options.client);
|
|
81118
81214
|
}
|
|
@@ -82405,8 +82501,8 @@ var init_session_events = __esm({
|
|
|
82405
82501
|
AdapterSessionConnection = class {
|
|
82406
82502
|
#connection;
|
|
82407
82503
|
#onBackgroundActivity;
|
|
82408
|
-
#backgroundActivity =
|
|
82409
|
-
hasBackgroundActivity = () => this.#backgroundActivity;
|
|
82504
|
+
#backgroundActivity = "none";
|
|
82505
|
+
hasBackgroundActivity = () => this.#backgroundActivity !== "none";
|
|
82410
82506
|
#updates;
|
|
82411
82507
|
#lifetime = new AbortController();
|
|
82412
82508
|
#onClosed;
|
|
@@ -82510,12 +82606,12 @@ var init_session_events = __esm({
|
|
|
82510
82606
|
this.#connection = options.agent.createConnection({
|
|
82511
82607
|
cwd: options.cwd,
|
|
82512
82608
|
client: client2,
|
|
82513
|
-
onBackgroundActivity: (
|
|
82609
|
+
onBackgroundActivity: (activity) => {
|
|
82514
82610
|
if (this.#lifetime.signal.aborted) {
|
|
82515
82611
|
return;
|
|
82516
82612
|
}
|
|
82517
|
-
this.#backgroundActivity =
|
|
82518
|
-
this.#onBackgroundActivity(
|
|
82613
|
+
this.#backgroundActivity = activity;
|
|
82614
|
+
this.#onBackgroundActivity(activity);
|
|
82519
82615
|
}
|
|
82520
82616
|
});
|
|
82521
82617
|
}
|
|
@@ -82534,8 +82630,8 @@ var init_session_events = __esm({
|
|
|
82534
82630
|
await this.#updates.drained().catch(() => void 0);
|
|
82535
82631
|
} finally {
|
|
82536
82632
|
this.#onClosed();
|
|
82537
|
-
this.#backgroundActivity =
|
|
82538
|
-
this.#onBackgroundActivity(
|
|
82633
|
+
this.#backgroundActivity = "none";
|
|
82634
|
+
this.#onBackgroundActivity("none");
|
|
82539
82635
|
}
|
|
82540
82636
|
}
|
|
82541
82637
|
};
|
|
@@ -93811,7 +93907,7 @@ var init_session_api = __esm({
|
|
|
93811
93907
|
"src/session/api/session-api.ts"() {
|
|
93812
93908
|
"use strict";
|
|
93813
93909
|
NullSessionObserver = class {
|
|
93814
|
-
onBackgroundActivity = (_source,
|
|
93910
|
+
onBackgroundActivity = (_source, _activity) => {
|
|
93815
93911
|
};
|
|
93816
93912
|
onSessionEvent = (_event) => Promise.resolve();
|
|
93817
93913
|
onCommands = () => Promise.resolve();
|
|
@@ -95010,7 +95106,7 @@ var init_agent_session = __esm({
|
|
|
95010
95106
|
...scope,
|
|
95011
95107
|
additionalDirectories: this.#additionalDirectories,
|
|
95012
95108
|
capabilities: () => this.#capabilities,
|
|
95013
|
-
onBackgroundActivity: (
|
|
95109
|
+
onBackgroundActivity: (activity) => this.#getObserver().onBackgroundActivity?.(this, activity),
|
|
95014
95110
|
interactions: {
|
|
95015
95111
|
onPermission: this.#interactions.onPermission,
|
|
95016
95112
|
onElicitation: this.#interactions.onElicitation,
|
|
@@ -97252,25 +97348,30 @@ var init_runtime_turn_activity = __esm({
|
|
|
97252
97348
|
"use strict";
|
|
97253
97349
|
RuntimeTurnActivity = class {
|
|
97254
97350
|
#turns = /* @__PURE__ */ new Set();
|
|
97255
|
-
#backgroundSources = /* @__PURE__ */ new
|
|
97351
|
+
#backgroundSources = /* @__PURE__ */ new Map();
|
|
97256
97352
|
#idleWaiters = /* @__PURE__ */ new Set();
|
|
97257
97353
|
// When work last started or stopped; the quiet period is measured from here.
|
|
97258
97354
|
#changedAt = Date.now();
|
|
97259
97355
|
#reserved = false;
|
|
97260
97356
|
acceptsPrompts = () => !this.#reserved;
|
|
97261
97357
|
count = () => this.#turns.size + this.#backgroundSources.size;
|
|
97262
|
-
|
|
97263
|
-
|
|
97264
|
-
|
|
97265
|
-
|
|
97266
|
-
|
|
97267
|
-
|
|
97358
|
+
/** Why admission is held: prompts running or queued, native tasks running, results not yet handled. */
|
|
97359
|
+
describe = () => {
|
|
97360
|
+
const activities = [...this.#backgroundSources.values()];
|
|
97361
|
+
return {
|
|
97362
|
+
turns: this.#turns.size,
|
|
97363
|
+
backgroundRunning: activities.filter((activity) => activity === "running").length,
|
|
97364
|
+
backgroundAwaitingResults: activities.filter((activity) => activity === "awaiting-results").length
|
|
97365
|
+
};
|
|
97366
|
+
};
|
|
97367
|
+
setBackgroundActivity = (source, activity) => {
|
|
97368
|
+
if (activity === (this.#backgroundSources.get(source) ?? "none")) {
|
|
97268
97369
|
return;
|
|
97269
97370
|
}
|
|
97270
|
-
if (
|
|
97271
|
-
this.#backgroundSources.add(source);
|
|
97272
|
-
} else {
|
|
97371
|
+
if (activity === "none") {
|
|
97273
97372
|
this.#backgroundSources.delete(source);
|
|
97373
|
+
} else {
|
|
97374
|
+
this.#backgroundSources.set(source, activity);
|
|
97274
97375
|
}
|
|
97275
97376
|
this.#changed();
|
|
97276
97377
|
};
|
|
@@ -97842,8 +97943,8 @@ function buildSessionLayer(options) {
|
|
|
97842
97943
|
eventProjection.record(event);
|
|
97843
97944
|
},
|
|
97844
97945
|
sink.publishInfo,
|
|
97845
|
-
(source,
|
|
97846
|
-
options.turnActivity?.setBackgroundActivity(source,
|
|
97946
|
+
(source, activity) => {
|
|
97947
|
+
options.turnActivity?.setBackgroundActivity(source, activity);
|
|
97847
97948
|
options.processes.notifyChanged();
|
|
97848
97949
|
}
|
|
97849
97950
|
),
|
|
@@ -97933,8 +98034,8 @@ var init_session_layer = __esm({
|
|
|
97933
98034
|
this.#publishInfo = publishInfo;
|
|
97934
98035
|
this.#record = record2;
|
|
97935
98036
|
}
|
|
97936
|
-
onBackgroundActivity = (source,
|
|
97937
|
-
this.#backgroundActivity(source,
|
|
98037
|
+
onBackgroundActivity = (source, activity) => {
|
|
98038
|
+
this.#backgroundActivity(source, activity);
|
|
97938
98039
|
};
|
|
97939
98040
|
onSessionEvent = (event) => {
|
|
97940
98041
|
this.#record(event);
|
|
@@ -99569,7 +99670,7 @@ var init_content_write = __esm({
|
|
|
99569
99670
|
});
|
|
99570
99671
|
|
|
99571
99672
|
// src/session/content/session-files.ts
|
|
99572
|
-
import { basename as basename9, extname as
|
|
99673
|
+
import { basename as basename9, extname as extname3, isAbsolute as isAbsolute18, join as join39, normalize as normalize3, resolve as resolve18 } from "node:path";
|
|
99573
99674
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
99574
99675
|
function requestedPath(value) {
|
|
99575
99676
|
if (value.includes("\0")) {
|
|
@@ -99625,7 +99726,7 @@ async function streamLocalFile(command, send2, sendChunk, signal, workingDirecto
|
|
|
99625
99726
|
send2({
|
|
99626
99727
|
byteLength: before.size,
|
|
99627
99728
|
kind: FILE_BEGIN_KIND,
|
|
99628
|
-
mediaType: external?.mediaType ?? raster?.mimeType ?? (
|
|
99729
|
+
mediaType: external?.mediaType ?? raster?.mimeType ?? (extname3(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
|
|
99629
99730
|
modifiedAt: before.modifiedAt.toISOString(),
|
|
99630
99731
|
name: external?.name ?? (basename9(target) || "file"),
|
|
99631
99732
|
requestId: command.requestId,
|
|
@@ -102336,16 +102437,13 @@ async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
|
102336
102437
|
const launch = await installDaemonReleaseVersion(version2, signal);
|
|
102337
102438
|
let reservation = activity.reserveIfQuiet(UPGRADE_QUIET_MILLISECONDS);
|
|
102338
102439
|
if (reservation === null) {
|
|
102339
|
-
new RuntimeDiagnosticLog(control.stateDirectory)
|
|
102340
|
-
|
|
102341
|
-
|
|
102342
|
-
event: "daemon_upgrade_deferred",
|
|
102343
|
-
version: version2,
|
|
102344
|
-
activeWork: activity.count(),
|
|
102345
|
-
...activity.describe()
|
|
102346
|
-
})}`
|
|
102440
|
+
const diagnostics = new RuntimeDiagnosticLog(control.stateDirectory);
|
|
102441
|
+
const record2 = (event, details = {}) => diagnostics.record(
|
|
102442
|
+
`Mobius daemon diagnostic ${JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), event, version: version2, ...details })}`
|
|
102347
102443
|
);
|
|
102444
|
+
record2("daemon_upgrade_deferred", { activeWork: activity.count(), ...activity.describe() });
|
|
102348
102445
|
reservation = await reserveWhenQuiet(activity, signal);
|
|
102446
|
+
record2("daemon_upgrade_released");
|
|
102349
102447
|
}
|
|
102350
102448
|
const _reservation = __using(_stack, reservation);
|
|
102351
102449
|
signal.throwIfAborted();
|