@moxt-ai/mobius 0.0.100 → 0.0.102
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 +136 -41
- package/dist/cli.js.map +3 -3
- package/dist/daemon-session-commands.d.ts +1 -1
- package/dist/daemon-session-commands.d.ts.map +1 -1
- package/dist/daemon-session-commands.js +2 -1
- package/dist/daemon-session-commands.js.map +1 -1
- package/dist/daemon-turn-reconciliation.d.ts +10 -4
- package/dist/daemon-turn-reconciliation.d.ts.map +1 -1
- package/dist/daemon-turn-reconciliation.js +29 -0
- package/dist/daemon-turn-reconciliation.js.map +1 -1
- package/dist/index.js +135 -40
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/service.d.ts +5 -1
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +15 -1
- package/dist/native-sessions/service.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +67 -30
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +139 -44
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -25662,6 +25662,7 @@ var nativeSessionTurnForkCommandSchema = external_exports.strictObject({
|
|
|
25662
25662
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
25663
25663
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
25664
25664
|
external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
|
|
25665
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
|
|
25665
25666
|
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
|
|
25666
25667
|
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
|
|
25667
25668
|
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
|
|
@@ -25685,6 +25686,7 @@ var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
|
25685
25686
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
25686
25687
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
25687
25688
|
external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
|
|
25689
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
|
|
25688
25690
|
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
|
|
25689
25691
|
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
|
|
25690
25692
|
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
|
|
@@ -25732,6 +25734,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
25732
25734
|
targetSessionId: identifier,
|
|
25733
25735
|
history: sessionHistorySchema
|
|
25734
25736
|
}).readonly(),
|
|
25737
|
+
external_exports.strictObject({
|
|
25738
|
+
...resultEnvelope,
|
|
25739
|
+
action: external_exports.literal("active-turn"),
|
|
25740
|
+
targetSessionId: identifier,
|
|
25741
|
+
turn: external_exports.strictObject({
|
|
25742
|
+
commandId: identifier,
|
|
25743
|
+
prompt: external_exports.string().max(1e5),
|
|
25744
|
+
text: external_exports.string().max(1e5),
|
|
25745
|
+
truncated: external_exports.boolean(),
|
|
25746
|
+
epoch: identifier,
|
|
25747
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
25748
|
+
state: external_exports.literal("running")
|
|
25749
|
+
}).readonly().nullable()
|
|
25750
|
+
}).readonly(),
|
|
25735
25751
|
external_exports.strictObject({
|
|
25736
25752
|
...resultEnvelope,
|
|
25737
25753
|
action: external_exports.literal("unlinked-history"),
|
|
@@ -26295,7 +26311,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
26295
26311
|
}
|
|
26296
26312
|
|
|
26297
26313
|
// src/run-daemon.ts
|
|
26298
|
-
import { randomUUID as
|
|
26314
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
26299
26315
|
import { styleText } from "node:util";
|
|
26300
26316
|
import { WebSocket as WebSocket5 } from "undici";
|
|
26301
26317
|
|
|
@@ -33000,7 +33016,7 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
33000
33016
|
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
33001
33017
|
}
|
|
33002
33018
|
}
|
|
33003
|
-
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
33019
|
+
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal, recordLiveText) {
|
|
33004
33020
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity2) => {
|
|
33005
33021
|
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity2), attemptId);
|
|
33006
33022
|
});
|
|
@@ -33133,6 +33149,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
33133
33149
|
return Promise.resolve();
|
|
33134
33150
|
},
|
|
33135
33151
|
onText: (delta, messageId) => {
|
|
33152
|
+
recordLiveText(delta);
|
|
33136
33153
|
text.record(messageId, delta);
|
|
33137
33154
|
return Promise.resolve();
|
|
33138
33155
|
},
|
|
@@ -33319,14 +33336,21 @@ var DaemonInstallationObserver = class {
|
|
|
33319
33336
|
};
|
|
33320
33337
|
|
|
33321
33338
|
// src/daemon-turn-reconciliation.ts
|
|
33339
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
33322
33340
|
import { fetch as fetch4 } from "undici";
|
|
33323
33341
|
var ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS = 2e4;
|
|
33342
|
+
var ACTIVE_TURN_TEXT_LIMIT = 1e5;
|
|
33324
33343
|
var ActiveDaemonTurn = class {
|
|
33325
33344
|
attemptId;
|
|
33326
33345
|
command;
|
|
33327
33346
|
#controller;
|
|
33328
33347
|
#finished = Promise.withResolvers();
|
|
33329
33348
|
#cancellationRequested = false;
|
|
33349
|
+
#accepted = false;
|
|
33350
|
+
#text = "";
|
|
33351
|
+
#truncated = false;
|
|
33352
|
+
#sequence = 0;
|
|
33353
|
+
#epoch = randomUUID2();
|
|
33330
33354
|
constructor(command, attemptId) {
|
|
33331
33355
|
this.attemptId = attemptId;
|
|
33332
33356
|
this.command = command;
|
|
@@ -33336,6 +33360,26 @@ var ActiveDaemonTurn = class {
|
|
|
33336
33360
|
this.#controller.abort();
|
|
33337
33361
|
};
|
|
33338
33362
|
finish = () => this.#finished.resolve();
|
|
33363
|
+
accept = () => {
|
|
33364
|
+
this.#accepted = true;
|
|
33365
|
+
};
|
|
33366
|
+
recordText = (delta) => {
|
|
33367
|
+
this.#sequence += 1;
|
|
33368
|
+
this.#text += delta;
|
|
33369
|
+
if (this.#text.length > ACTIVE_TURN_TEXT_LIMIT) {
|
|
33370
|
+
this.#text = this.#text.slice(-ACTIVE_TURN_TEXT_LIMIT);
|
|
33371
|
+
this.#truncated = true;
|
|
33372
|
+
}
|
|
33373
|
+
};
|
|
33374
|
+
snapshot = () => this.#accepted ? {
|
|
33375
|
+
commandId: this.command.commandId,
|
|
33376
|
+
prompt: this.command.prompt,
|
|
33377
|
+
text: this.#text,
|
|
33378
|
+
truncated: this.#truncated,
|
|
33379
|
+
epoch: this.#epoch,
|
|
33380
|
+
sequence: this.#sequence,
|
|
33381
|
+
state: "running"
|
|
33382
|
+
} : null;
|
|
33339
33383
|
matches = (cancellation) => cancellation.commandId === this.command.commandId && cancellation.sessionId === this.command.sessionId;
|
|
33340
33384
|
requestCancellation = () => {
|
|
33341
33385
|
if (this.#cancellationRequested) {
|
|
@@ -33859,7 +33903,7 @@ var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await read
|
|
|
33859
33903
|
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "rich" });
|
|
33860
33904
|
|
|
33861
33905
|
// src/native-sessions/service.ts
|
|
33862
|
-
import { randomUUID as
|
|
33906
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
33863
33907
|
import { basename as basename6 } from "node:path";
|
|
33864
33908
|
|
|
33865
33909
|
// src/native-sessions/acp-history.ts
|
|
@@ -33951,11 +33995,13 @@ var NativeSessionService = class {
|
|
|
33951
33995
|
#directories;
|
|
33952
33996
|
#sessions;
|
|
33953
33997
|
#audit;
|
|
33954
|
-
|
|
33998
|
+
#activeTurn;
|
|
33999
|
+
constructor(config2, directories, sessions, audit, activeTurn) {
|
|
33955
34000
|
this.#config = config2;
|
|
33956
34001
|
this.#directories = directories;
|
|
33957
34002
|
this.#sessions = sessions;
|
|
33958
34003
|
this.#audit = audit;
|
|
34004
|
+
this.#activeTurn = activeTurn;
|
|
33959
34005
|
}
|
|
33960
34006
|
execute = async (command, signal) => {
|
|
33961
34007
|
signal.throwIfAborted();
|
|
@@ -33973,6 +34019,18 @@ var NativeSessionService = class {
|
|
|
33973
34019
|
sessionId: command.sessionId,
|
|
33974
34020
|
signal
|
|
33975
34021
|
};
|
|
34022
|
+
if (command.action === "active-turn") {
|
|
34023
|
+
nativeSessionIdSchema.parse(command.targetSessionId);
|
|
34024
|
+
this.record(command, "active_turn_read");
|
|
34025
|
+
return {
|
|
34026
|
+
action: "active-turn",
|
|
34027
|
+
kind: "native.session.result",
|
|
34028
|
+
requestId: command.requestId,
|
|
34029
|
+
sessionId: command.sessionId,
|
|
34030
|
+
targetSessionId: command.targetSessionId,
|
|
34031
|
+
turn: this.#activeTurn(command)
|
|
34032
|
+
};
|
|
34033
|
+
}
|
|
33976
34034
|
if (command.action === "linked-history") {
|
|
33977
34035
|
const nativeSessionId = nativeSessionIdSchema.parse(command.targetSessionId);
|
|
33978
34036
|
if (this.#sessions.hasPreparedSession(nativeSessionId, options.agent.id, cwd, additionalDirectories) && await this.#sessions.loadLinkedSessionHistory({ ...options, sessionId: nativeSessionId }) === null) {
|
|
@@ -34043,7 +34101,7 @@ var NativeSessionService = class {
|
|
|
34043
34101
|
if (authorized === null) {
|
|
34044
34102
|
return null;
|
|
34045
34103
|
}
|
|
34046
|
-
const entryId =
|
|
34104
|
+
const entryId = randomUUID3();
|
|
34047
34105
|
if (this.#entries.size >= 5e3) {
|
|
34048
34106
|
this.#entries.clear();
|
|
34049
34107
|
}
|
|
@@ -34098,7 +34156,7 @@ var NativeSessionService = class {
|
|
|
34098
34156
|
"invalid_native_session_response"
|
|
34099
34157
|
);
|
|
34100
34158
|
}
|
|
34101
|
-
nextCursor =
|
|
34159
|
+
nextCursor = randomUUID3();
|
|
34102
34160
|
if (this.#cursors.size >= 500) {
|
|
34103
34161
|
this.#cursors.clear();
|
|
34104
34162
|
}
|
|
@@ -34717,7 +34775,7 @@ var RelayConnectionDiagnostics = class {
|
|
|
34717
34775
|
};
|
|
34718
34776
|
|
|
34719
34777
|
// src/relay-connection/liveness.ts
|
|
34720
|
-
import { randomUUID as
|
|
34778
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
34721
34779
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
34722
34780
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
34723
34781
|
var RelayLivenessState = class {
|
|
@@ -34806,7 +34864,7 @@ var RelayConnectionLiveness = class {
|
|
|
34806
34864
|
}
|
|
34807
34865
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
34808
34866
|
}
|
|
34809
|
-
const heartbeatId =
|
|
34867
|
+
const heartbeatId = randomUUID4();
|
|
34810
34868
|
this.#state = new AwaitingHeartbeatAckState(
|
|
34811
34869
|
heartbeatId,
|
|
34812
34870
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
@@ -35654,7 +35712,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
35654
35712
|
{
|
|
35655
35713
|
agentId: agent.id,
|
|
35656
35714
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
35657
|
-
requestId: `automatic-integration-${
|
|
35715
|
+
requestId: `automatic-integration-${randomUUID5()}`
|
|
35658
35716
|
},
|
|
35659
35717
|
signal
|
|
35660
35718
|
);
|
|
@@ -35782,12 +35840,13 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
35782
35840
|
const turn = new ActiveDaemonTurn(command, receipt.attemptId);
|
|
35783
35841
|
activeTurns.set(command.commandId, turn);
|
|
35784
35842
|
const activateAttempt = () => {
|
|
35843
|
+
turn.accept();
|
|
35785
35844
|
if (trackActiveAttempt) {
|
|
35786
35845
|
activeAttemptIds.set(command.sessionId, receipt.attemptId);
|
|
35787
35846
|
}
|
|
35788
35847
|
};
|
|
35789
35848
|
try {
|
|
35790
|
-
await execute(receipt.attemptId, activateAttempt, turn.signal);
|
|
35849
|
+
await execute(receipt.attemptId, activateAttempt, turn.signal, turn);
|
|
35791
35850
|
} finally {
|
|
35792
35851
|
activeTurns.delete(command.commandId);
|
|
35793
35852
|
if (activeAttemptIds.get(command.sessionId) === receipt.attemptId) {
|
|
@@ -35877,7 +35936,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
35877
35936
|
delivery,
|
|
35878
35937
|
command,
|
|
35879
35938
|
command.disposition !== SessionPromptDisposition.Steer,
|
|
35880
|
-
(attemptId, activateAttempt, executionSignal) => executePrompt(
|
|
35939
|
+
(attemptId, activateAttempt, executionSignal, turn) => executePrompt(
|
|
35881
35940
|
outbox,
|
|
35882
35941
|
publisher,
|
|
35883
35942
|
command,
|
|
@@ -35888,7 +35947,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
35888
35947
|
attemptId,
|
|
35889
35948
|
activateAttempt,
|
|
35890
35949
|
timer,
|
|
35891
|
-
executionSignal
|
|
35950
|
+
executionSignal,
|
|
35951
|
+
turn.recordText
|
|
35892
35952
|
)
|
|
35893
35953
|
);
|
|
35894
35954
|
return;
|
|
@@ -36095,7 +36155,24 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36095
36155
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
36096
36156
|
(request) => request.agentId === command2.agentId && !request.controller.signal.aborted
|
|
36097
36157
|
);
|
|
36098
|
-
if (agentSettingsDiscoveries.
|
|
36158
|
+
if ([...agentSettingsDiscoveries.values()].some(
|
|
36159
|
+
(request) => request.requestIds.has(command2.requestId)
|
|
36160
|
+
)) {
|
|
36161
|
+
if (socket.readyState === WebSocket5.OPEN) {
|
|
36162
|
+
send(socket, {
|
|
36163
|
+
code: "agent_settings_discovery_busy",
|
|
36164
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
36165
|
+
message: "This settings discovery request is already running",
|
|
36166
|
+
requestId: command2.requestId
|
|
36167
|
+
});
|
|
36168
|
+
}
|
|
36169
|
+
return;
|
|
36170
|
+
}
|
|
36171
|
+
if (existing !== void 0 && existing.model === command2.model && existing.requestIds.size < 16) {
|
|
36172
|
+
existing.requestIds.add(command2.requestId);
|
|
36173
|
+
return;
|
|
36174
|
+
}
|
|
36175
|
+
if (existing !== void 0) {
|
|
36099
36176
|
if (socket.readyState === WebSocket5.OPEN) {
|
|
36100
36177
|
send(socket, {
|
|
36101
36178
|
code: "agent_settings_discovery_busy",
|
|
@@ -36118,6 +36195,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36118
36195
|
return;
|
|
36119
36196
|
}
|
|
36120
36197
|
const controller = new AbortController();
|
|
36198
|
+
const requestIds = /* @__PURE__ */ new Set([command2.requestId]);
|
|
36121
36199
|
const operationSignal = AbortSignal.any([connectionController.signal, controller.signal]);
|
|
36122
36200
|
const timeout = timer.schedule(
|
|
36123
36201
|
() => controller.abort(
|
|
@@ -36156,17 +36234,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36156
36234
|
`
|
|
36157
36235
|
);
|
|
36158
36236
|
}
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
|
|
36164
|
-
|
|
36165
|
-
|
|
36166
|
-
|
|
36167
|
-
|
|
36168
|
-
|
|
36169
|
-
|
|
36237
|
+
for (const requestId of requestIds) {
|
|
36238
|
+
audit.record({
|
|
36239
|
+
commandId: requestId,
|
|
36240
|
+
details: {
|
|
36241
|
+
agentId: command2.agentId,
|
|
36242
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
36243
|
+
},
|
|
36244
|
+
event: "agent_settings_discovered",
|
|
36245
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
36246
|
+
});
|
|
36247
|
+
if (socket.readyState === WebSocket5.OPEN) {
|
|
36248
|
+
send(socket, { ...result.event, requestId });
|
|
36249
|
+
}
|
|
36170
36250
|
}
|
|
36171
36251
|
} catch (error62) {
|
|
36172
36252
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -36175,12 +36255,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36175
36255
|
"agent_settings_discovery_cancelled"
|
|
36176
36256
|
) : error62;
|
|
36177
36257
|
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
36178
|
-
|
|
36179
|
-
|
|
36180
|
-
|
|
36181
|
-
|
|
36182
|
-
|
|
36183
|
-
|
|
36258
|
+
for (const requestId of requestIds) {
|
|
36259
|
+
audit.record({
|
|
36260
|
+
commandId: requestId,
|
|
36261
|
+
details,
|
|
36262
|
+
event: "agent_settings_discovery_failed",
|
|
36263
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
36264
|
+
});
|
|
36265
|
+
}
|
|
36184
36266
|
diagnostics.daemonDiagnostic(
|
|
36185
36267
|
"agent_settings_discovery_failed",
|
|
36186
36268
|
command2.requestId,
|
|
@@ -36194,12 +36276,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36194
36276
|
);
|
|
36195
36277
|
}
|
|
36196
36278
|
if (socket.readyState === WebSocket5.OPEN) {
|
|
36197
|
-
|
|
36198
|
-
|
|
36199
|
-
|
|
36200
|
-
|
|
36201
|
-
|
|
36202
|
-
|
|
36279
|
+
for (const requestId of requestIds) {
|
|
36280
|
+
send(socket, {
|
|
36281
|
+
code: operationErrorCode(failure2),
|
|
36282
|
+
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
36283
|
+
message: operationErrorMessage(failure2),
|
|
36284
|
+
requestId
|
|
36285
|
+
});
|
|
36286
|
+
}
|
|
36203
36287
|
}
|
|
36204
36288
|
} finally {
|
|
36205
36289
|
timeout.cancel();
|
|
@@ -36208,6 +36292,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36208
36292
|
})();
|
|
36209
36293
|
agentSettingsDiscoveries.set(command2.requestId, {
|
|
36210
36294
|
agentId: command2.agentId,
|
|
36295
|
+
model: command2.model,
|
|
36296
|
+
requestIds,
|
|
36211
36297
|
completion,
|
|
36212
36298
|
controller
|
|
36213
36299
|
});
|
|
@@ -36291,7 +36377,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36291
36377
|
const previous = [...nativeRequests.values()].filter(
|
|
36292
36378
|
(request) => request.agentId === command2.agentId
|
|
36293
36379
|
);
|
|
36294
|
-
if (nativeRequests.has(command2.requestId) || nativeRequests.size >= 4 || previous.some((request) => !request.controller.signal.aborted)) {
|
|
36380
|
+
if (nativeRequests.has(command2.requestId) || nativeRequests.size >= 4 || command2.action !== "linked-history" && command2.action !== "active-turn" && previous.some((request) => !request.controller.signal.aborted)) {
|
|
36295
36381
|
reportOperationFailure(
|
|
36296
36382
|
socket,
|
|
36297
36383
|
command2.requestId,
|
|
@@ -36319,7 +36405,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36319
36405
|
const completion = (async () => {
|
|
36320
36406
|
try {
|
|
36321
36407
|
operationSignal.throwIfAborted();
|
|
36322
|
-
if (previous.length > 0) {
|
|
36408
|
+
if (previous.length > 0 && command2.action !== "active-turn") {
|
|
36323
36409
|
await new Promise((resolve9, reject2) => {
|
|
36324
36410
|
const cancel = () => reject2(operationSignal.reason);
|
|
36325
36411
|
operationSignal.addEventListener("abort", cancel, {
|
|
@@ -36613,12 +36699,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36613
36699
|
sessions,
|
|
36614
36700
|
receipt.attemptId,
|
|
36615
36701
|
() => {
|
|
36702
|
+
turn.accept();
|
|
36616
36703
|
if (command.disposition !== SessionPromptDisposition.Steer) {
|
|
36617
36704
|
activeAttemptIds.set(command.sessionId, receipt.attemptId);
|
|
36618
36705
|
}
|
|
36619
36706
|
},
|
|
36620
36707
|
timer,
|
|
36621
|
-
turn.signal
|
|
36708
|
+
turn.signal,
|
|
36709
|
+
turn.recordText
|
|
36622
36710
|
).catch((error62) => {
|
|
36623
36711
|
console.error("Mobius daemon turn failed", error62);
|
|
36624
36712
|
}).finally(() => {
|
|
@@ -36738,7 +36826,14 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
36738
36826
|
config2.relayUrl,
|
|
36739
36827
|
new DaemonDiagnosticLog(stateDirectory)
|
|
36740
36828
|
);
|
|
36741
|
-
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit)
|
|
36829
|
+
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit, (request) => {
|
|
36830
|
+
const turn = [...activeTurns.values()].find(
|
|
36831
|
+
(candidate) => candidate.command.sessionId === request.targetSessionId && candidate.command.agentId === request.agentId && candidate.command.directoryId === request.directoryId && candidate.command.additionalDirectoryIds.length === request.additionalDirectoryIds.length && candidate.command.additionalDirectoryIds.every(
|
|
36832
|
+
(directoryId2, index) => directoryId2 === request.additionalDirectoryIds[index]
|
|
36833
|
+
)
|
|
36834
|
+
);
|
|
36835
|
+
return turn?.snapshot() ?? null;
|
|
36836
|
+
});
|
|
36742
36837
|
const installations = new AgentInstallationManager(
|
|
36743
36838
|
specifications,
|
|
36744
36839
|
installationExecutor,
|
|
@@ -36883,7 +36978,7 @@ import { basename as basename7, resolve as resolve6 } from "node:path";
|
|
|
36883
36978
|
import { fetch as fetch5 } from "undici";
|
|
36884
36979
|
|
|
36885
36980
|
// src/storage/runtime-installation-store.ts
|
|
36886
|
-
import { createHash as createHash5, randomUUID as
|
|
36981
|
+
import { createHash as createHash5, randomUUID as randomUUID6 } from "node:crypto";
|
|
36887
36982
|
import { mkdir as mkdir4, open as open5, readdir as readdir3, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
36888
36983
|
import { dirname as dirname4, join as join17, resolve as resolve5 } from "node:path";
|
|
36889
36984
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
@@ -37014,10 +37109,10 @@ function parseRelayOrigin(value) {
|
|
|
37014
37109
|
return origin;
|
|
37015
37110
|
}
|
|
37016
37111
|
function connectionId() {
|
|
37017
|
-
return `mcn_${
|
|
37112
|
+
return `mcn_${randomUUID6().replaceAll("-", "")}`;
|
|
37018
37113
|
}
|
|
37019
37114
|
function installationId() {
|
|
37020
|
-
return `min_${
|
|
37115
|
+
return `min_${randomUUID6().replaceAll("-", "")}`;
|
|
37021
37116
|
}
|
|
37022
37117
|
function channelIndexFileName(channelId) {
|
|
37023
37118
|
return `mci_${createHash5("sha256").update(channelId).digest("hex")}.json`;
|
|
@@ -37129,7 +37224,7 @@ async function readJsonFile(path2, signal, missingCode) {
|
|
|
37129
37224
|
async function writeJsonAtomically(path2, value, signal) {
|
|
37130
37225
|
signal.throwIfAborted();
|
|
37131
37226
|
const directory = dirname4(path2);
|
|
37132
|
-
const temporaryPath = join17(directory, `.${
|
|
37227
|
+
const temporaryPath = join17(directory, `.${randomUUID6()}.tmp`);
|
|
37133
37228
|
try {
|
|
37134
37229
|
await mkdir4(directory, { mode: 448, recursive: true });
|
|
37135
37230
|
signal.throwIfAborted();
|