@moxt-ai/mobius 0.0.46 → 0.0.48
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/session-manager.d.ts +1 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +27 -24
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts +0 -1
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +0 -2
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts +0 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.js +0 -2
- package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +2 -2
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-catalog/local-agent.d.ts +1 -2
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +2 -7
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/bots/bot-execution-context.d.ts +0 -1
- package/dist/bots/bot-execution-context.d.ts.map +1 -1
- package/dist/bots/bot-execution-context.js +0 -7
- package/dist/bots/bot-execution-context.js.map +1 -1
- package/dist/cli.js +174 -82
- package/dist/cli.js.map +3 -3
- package/dist/index.js +173 -81
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +89 -31
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +173 -81
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22154,11 +22154,7 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22154
22154
|
id;
|
|
22155
22155
|
label;
|
|
22156
22156
|
permissionProfile;
|
|
22157
|
-
|
|
22158
|
-
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, promptTimeoutMilliseconds = 30 * 60 * 1e3, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22159
|
-
if (!Number.isSafeInteger(promptTimeoutMilliseconds) || promptTimeoutMilliseconds < 1) {
|
|
22160
|
-
throw new Error("The local Agent prompt deadline is invalid");
|
|
22161
|
-
}
|
|
22157
|
+
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22162
22158
|
this.adapterIdentity = adapterIdentity;
|
|
22163
22159
|
this.adapterPath = adapterIdentity.realPath;
|
|
22164
22160
|
this.adapterVersion = adapterVersion;
|
|
@@ -22168,7 +22164,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22168
22164
|
this.id = id;
|
|
22169
22165
|
this.label = label;
|
|
22170
22166
|
this.permissionProfile = permissionProfile;
|
|
22171
|
-
this.promptTimeoutMilliseconds = promptTimeoutMilliseconds;
|
|
22172
22167
|
this.command = adapterIdentity.realPath;
|
|
22173
22168
|
this.arguments = Object.freeze([...arguments_]);
|
|
22174
22169
|
this.environment = permissionProfile.apply(environment, permissionProfile.currentMode(environment));
|
|
@@ -22187,7 +22182,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22187
22182
|
this.agentVersion,
|
|
22188
22183
|
this.adapterIdentity,
|
|
22189
22184
|
this.agentIdentity,
|
|
22190
|
-
this.promptTimeoutMilliseconds,
|
|
22191
22185
|
this.capabilities,
|
|
22192
22186
|
this.permissionProfile
|
|
22193
22187
|
);
|
|
@@ -31113,6 +31107,7 @@ var MAX_ACP_PROCESSES = 10;
|
|
|
31113
31107
|
var MAX_PRE_SESSION_UPDATES = 100;
|
|
31114
31108
|
var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
31115
31109
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
31110
|
+
var SESSION_CONTROL_TIMEOUT_MILLISECONDS = 3e4;
|
|
31116
31111
|
var NullAcpSessionObserver = class {
|
|
31117
31112
|
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
31118
31113
|
signal.throwIfAborted();
|
|
@@ -31676,7 +31671,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31676
31671
|
#preSessionUpdateBytes = 0;
|
|
31677
31672
|
#agentName = "";
|
|
31678
31673
|
#agentVersion = "";
|
|
31679
|
-
#bufferedAgentText =
|
|
31674
|
+
#bufferedAgentText = [];
|
|
31680
31675
|
#capabilities = {
|
|
31681
31676
|
additionalDirectories: false,
|
|
31682
31677
|
audioPrompt: false,
|
|
@@ -31865,20 +31860,30 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31865
31860
|
});
|
|
31866
31861
|
};
|
|
31867
31862
|
bufferAgentText = async (text3, messageId) => {
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
this.#bufferedAgentText =
|
|
31863
|
+
const previous2 = this.#bufferedAgentText.at(-1);
|
|
31864
|
+
if (previous2?.messageId === messageId) {
|
|
31865
|
+
this.#bufferedAgentText = [
|
|
31866
|
+
...this.#bufferedAgentText.slice(0, -1),
|
|
31867
|
+
{ chunks: [...previous2.chunks, text3], messageId }
|
|
31868
|
+
];
|
|
31869
|
+
return;
|
|
31871
31870
|
}
|
|
31872
|
-
this.#bufferedAgentText = {
|
|
31873
|
-
chunks: [...this.#bufferedAgentText?.chunks ?? [], text3],
|
|
31874
|
-
messageId
|
|
31875
|
-
};
|
|
31871
|
+
this.#bufferedAgentText = [...this.#bufferedAgentText, { chunks: [text3], messageId }];
|
|
31876
31872
|
};
|
|
31877
31873
|
flushAgentText = async () => {
|
|
31878
31874
|
const buffered = this.#bufferedAgentText;
|
|
31879
|
-
this.#bufferedAgentText =
|
|
31880
|
-
|
|
31881
|
-
await this.emitAgentMessage(
|
|
31875
|
+
this.#bufferedAgentText = [];
|
|
31876
|
+
for (const message of buffered) {
|
|
31877
|
+
await this.emitAgentMessage(message.chunks, message.messageId);
|
|
31878
|
+
}
|
|
31879
|
+
};
|
|
31880
|
+
recordBufferedAgentTextAsProgress = async () => {
|
|
31881
|
+
const buffered = this.#bufferedAgentText;
|
|
31882
|
+
this.#bufferedAgentText = [];
|
|
31883
|
+
for (const message of buffered) {
|
|
31884
|
+
for (const chunk of message.chunks) {
|
|
31885
|
+
await this.#turn.activities.recordNarrative("progress", message.messageId, chunk);
|
|
31886
|
+
}
|
|
31882
31887
|
}
|
|
31883
31888
|
};
|
|
31884
31889
|
prepareAgentContent = async (content3) => {
|
|
@@ -32392,7 +32397,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32392
32397
|
cause: error62
|
|
32393
32398
|
});
|
|
32394
32399
|
} finally {
|
|
32395
|
-
this.#bufferedAgentText =
|
|
32400
|
+
this.#bufferedAgentText = [];
|
|
32396
32401
|
this.#turn = new IdleAcpTurn();
|
|
32397
32402
|
}
|
|
32398
32403
|
};
|
|
@@ -32707,6 +32712,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32707
32712
|
return;
|
|
32708
32713
|
}
|
|
32709
32714
|
if (update.sessionUpdate === "tool_call") {
|
|
32715
|
+
await this.recordBufferedAgentTextAsProgress();
|
|
32710
32716
|
await this.#turn.activities.recordToolCall(update);
|
|
32711
32717
|
return;
|
|
32712
32718
|
}
|
|
@@ -33552,7 +33558,7 @@ var AcpSessionManager = class {
|
|
|
33552
33558
|
() => deadlineController.abort(
|
|
33553
33559
|
new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
|
|
33554
33560
|
),
|
|
33555
|
-
|
|
33561
|
+
SESSION_CONTROL_TIMEOUT_MILLISECONDS
|
|
33556
33562
|
);
|
|
33557
33563
|
deadline.unref();
|
|
33558
33564
|
try {
|
|
@@ -33577,28 +33583,13 @@ var AcpSessionManager = class {
|
|
|
33577
33583
|
if (this.#activeSessionIds.has(options.sessionId)) {
|
|
33578
33584
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
33579
33585
|
}
|
|
33580
|
-
const deadlineController = new AbortController();
|
|
33581
|
-
const deadlineError = new AcpExecutionError(
|
|
33582
|
-
"The local Agent prompt exceeded its deadline",
|
|
33583
|
-
{},
|
|
33584
|
-
"prompt_timeout"
|
|
33585
|
-
);
|
|
33586
|
-
const deadline = setTimeout(
|
|
33587
|
-
() => deadlineController.abort(deadlineError),
|
|
33588
|
-
options.agent.promptTimeoutMilliseconds
|
|
33589
|
-
);
|
|
33590
|
-
deadline.unref();
|
|
33591
|
-
const boundedOptions = {
|
|
33592
|
-
...options,
|
|
33593
|
-
signal: AbortSignal.any([options.signal, deadlineController.signal])
|
|
33594
|
-
};
|
|
33595
33586
|
this.#activeSessionIds.add(options.sessionId);
|
|
33596
33587
|
this.#activeCommandIds.set(options.sessionId, options.commandId);
|
|
33597
33588
|
try {
|
|
33598
33589
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
33599
33590
|
return { stopReason: "cancelled" };
|
|
33600
33591
|
}
|
|
33601
|
-
const runtime = await this.ensureSession(
|
|
33592
|
+
const runtime = await this.ensureSession(options);
|
|
33602
33593
|
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
33603
33594
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
33604
33595
|
}
|
|
@@ -33606,7 +33597,7 @@ var AcpSessionManager = class {
|
|
|
33606
33597
|
return { stopReason: "cancelled" };
|
|
33607
33598
|
}
|
|
33608
33599
|
try {
|
|
33609
|
-
const result = await runtime.prompt(
|
|
33600
|
+
const result = await runtime.prompt(options);
|
|
33610
33601
|
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
33611
33602
|
} catch (error62) {
|
|
33612
33603
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -33634,7 +33625,6 @@ var AcpSessionManager = class {
|
|
|
33634
33625
|
cause: error62
|
|
33635
33626
|
});
|
|
33636
33627
|
} finally {
|
|
33637
|
-
clearTimeout(deadline);
|
|
33638
33628
|
try {
|
|
33639
33629
|
await this.#cancellationRequests.get(options.sessionId);
|
|
33640
33630
|
} finally {
|
|
@@ -34143,10 +34133,6 @@ var BotExecutionContextRegistry = class {
|
|
|
34143
34133
|
#activeByHandle = /* @__PURE__ */ new Map();
|
|
34144
34134
|
#handlesBySession = /* @__PURE__ */ new Map();
|
|
34145
34135
|
#inactiveHandles = /* @__PURE__ */ new Set();
|
|
34146
|
-
#now;
|
|
34147
|
-
constructor(now = Date.now) {
|
|
34148
|
-
this.#now = now;
|
|
34149
|
-
}
|
|
34150
34136
|
activate = (command) => {
|
|
34151
34137
|
let handle = this.#handlesBySession.get(command.sessionId);
|
|
34152
34138
|
if (handle === void 0) {
|
|
@@ -34180,12 +34166,6 @@ var BotExecutionContextRegistry = class {
|
|
|
34180
34166
|
"An active Bot execution context is required"
|
|
34181
34167
|
);
|
|
34182
34168
|
}
|
|
34183
|
-
if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
|
|
34184
|
-
throw new LocalBotAuthorizationError(
|
|
34185
|
-
"execution_capability_expired",
|
|
34186
|
-
"The Bot execution capability has expired"
|
|
34187
|
-
);
|
|
34188
|
-
}
|
|
34189
34169
|
return context;
|
|
34190
34170
|
};
|
|
34191
34171
|
};
|
|
@@ -35031,7 +35011,6 @@ function normalizeVersionOutput(output2) {
|
|
|
35031
35011
|
// src/agent-catalog/agent-specification.ts
|
|
35032
35012
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e3;
|
|
35033
35013
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 5e3;
|
|
35034
|
-
var DEFAULT_PROMPT_TIMEOUT_MILLISECONDS = 30 * 60 * 1e3;
|
|
35035
35014
|
var LocalAgentSpecification = class {
|
|
35036
35015
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
35037
35016
|
authenticationCommand = () => "";
|
|
@@ -35039,7 +35018,6 @@ var LocalAgentSpecification = class {
|
|
|
35039
35018
|
agentVersionArguments = ["--version"];
|
|
35040
35019
|
normalizeAdapterVersion = normalizeVersionOutput;
|
|
35041
35020
|
normalizeAgentVersion = normalizeVersionOutput;
|
|
35042
|
-
promptTimeoutMilliseconds = DEFAULT_PROMPT_TIMEOUT_MILLISECONDS;
|
|
35043
35021
|
versionProbeTimeoutMilliseconds = VERSION_PROBE_TIMEOUT_MILLISECONDS;
|
|
35044
35022
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
35045
35023
|
signal.throwIfAborted();
|
|
@@ -35880,7 +35858,6 @@ var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
|
|
|
35880
35858
|
|
|
35881
35859
|
// src/agent-catalog/agents/pi-agent.ts
|
|
35882
35860
|
var ACP_PROBE_TIMEOUT_MILLISECONDS2 = 3e4;
|
|
35883
|
-
var PROMPT_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
35884
35861
|
var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
35885
35862
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS2;
|
|
35886
35863
|
adapterEnvironmentVariable = "PI_ACP_PI_COMMAND";
|
|
@@ -35912,7 +35889,6 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
35912
35889
|
"bundle",
|
|
35913
35890
|
"cli.js"
|
|
35914
35891
|
];
|
|
35915
|
-
promptTimeoutMilliseconds = PROMPT_TIMEOUT_MILLISECONDS;
|
|
35916
35892
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
35917
35893
|
signal.throwIfAborted();
|
|
35918
35894
|
const executable = await validateManagedNpmPackage(
|
|
@@ -36535,8 +36511,7 @@ async function discoverAgent(specification, context) {
|
|
|
36535
36511
|
adapterVersion,
|
|
36536
36512
|
agentVersion,
|
|
36537
36513
|
adapter.identity,
|
|
36538
|
-
agent.identity
|
|
36539
|
-
specification.promptTimeoutMilliseconds
|
|
36514
|
+
agent.identity
|
|
36540
36515
|
);
|
|
36541
36516
|
try {
|
|
36542
36517
|
const readiness = await probeAcpReadiness(
|
|
@@ -36562,7 +36537,6 @@ async function discoverAgent(specification, context) {
|
|
|
36562
36537
|
agentVersion,
|
|
36563
36538
|
adapter.identity,
|
|
36564
36539
|
agent.identity,
|
|
36565
|
-
specification.promptTimeoutMilliseconds,
|
|
36566
36540
|
readiness.capabilities
|
|
36567
36541
|
)
|
|
36568
36542
|
);
|
|
@@ -40688,11 +40662,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40688
40662
|
} else {
|
|
40689
40663
|
await applyCompleteSessionConfiguration(
|
|
40690
40664
|
sessions,
|
|
40665
|
+
audit,
|
|
40691
40666
|
prepared.configOptions,
|
|
40692
40667
|
command.sessionConfigurations,
|
|
40693
40668
|
agent,
|
|
40694
40669
|
resolved.cwd,
|
|
40695
40670
|
resolved.additionalDirectories,
|
|
40671
|
+
command.commandId,
|
|
40696
40672
|
command.sessionId,
|
|
40697
40673
|
signal
|
|
40698
40674
|
);
|
|
@@ -40833,6 +40809,26 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40833
40809
|
}
|
|
40834
40810
|
}
|
|
40835
40811
|
}
|
|
40812
|
+
function assertSessionConfigurationCoverage(options, selections) {
|
|
40813
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40814
|
+
if (selectionsById.size !== selections.length) {
|
|
40815
|
+
throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
|
|
40816
|
+
}
|
|
40817
|
+
for (const option2 of options) {
|
|
40818
|
+
if (!selectionsById.has(option2.id)) {
|
|
40819
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40820
|
+
}
|
|
40821
|
+
}
|
|
40822
|
+
}
|
|
40823
|
+
function sessionConfigurationSelectionIsAvailable(option2, selection) {
|
|
40824
|
+
if (option2.type !== selection.valueType) {
|
|
40825
|
+
return false;
|
|
40826
|
+
}
|
|
40827
|
+
if (option2.type === "boolean") {
|
|
40828
|
+
return selection.value.length === 0;
|
|
40829
|
+
}
|
|
40830
|
+
return !selection.booleanValue && option2.values.some((value) => value.value === selection.value);
|
|
40831
|
+
}
|
|
40836
40832
|
function sessionConfigurationMatches(option2, selection) {
|
|
40837
40833
|
validateSessionConfigurationSelection(option2, selection);
|
|
40838
40834
|
return option2.type === "boolean" ? option2.booleanValue === selection.booleanValue : option2.currentValue === selection.value;
|
|
@@ -40863,11 +40859,92 @@ function assertCompleteSessionConfiguration(options, selections) {
|
|
|
40863
40859
|
}
|
|
40864
40860
|
}
|
|
40865
40861
|
}
|
|
40866
|
-
|
|
40862
|
+
function assertAppliedSessionConfiguration(options, selections) {
|
|
40863
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40864
|
+
for (const option2 of options) {
|
|
40865
|
+
const selection = selectionsById.get(option2.id);
|
|
40866
|
+
if (option2.id === AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40867
|
+
if (selection === void 0 || !sessionConfigurationMatches(option2, selection)) {
|
|
40868
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40869
|
+
}
|
|
40870
|
+
continue;
|
|
40871
|
+
}
|
|
40872
|
+
if (selection === void 0 || !sessionConfigurationSelectionIsAvailable(option2, selection)) {
|
|
40873
|
+
continue;
|
|
40874
|
+
}
|
|
40875
|
+
if (!sessionConfigurationMatches(option2, selection)) {
|
|
40876
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40877
|
+
}
|
|
40878
|
+
}
|
|
40879
|
+
}
|
|
40880
|
+
function unavailableSessionConfigurationCategory(selection) {
|
|
40881
|
+
if (selection.configId === "model") {
|
|
40882
|
+
return "model";
|
|
40883
|
+
}
|
|
40884
|
+
if (selection.configId === "reasoning_effort") {
|
|
40885
|
+
return "thought_level";
|
|
40886
|
+
}
|
|
40887
|
+
return "unknown";
|
|
40888
|
+
}
|
|
40889
|
+
async function applySessionConfigurationSelection(sessions, audit, options, selection, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40867
40890
|
const option2 = options.find((candidate) => candidate.id === selection.configId);
|
|
40868
40891
|
if (option2 === void 0) {
|
|
40892
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40893
|
+
warnIgnoredSetting(
|
|
40894
|
+
audit,
|
|
40895
|
+
"session_configuration_setting_ignored",
|
|
40896
|
+
commandId,
|
|
40897
|
+
sessionId,
|
|
40898
|
+
agent.id,
|
|
40899
|
+
selection,
|
|
40900
|
+
unavailableSessionConfigurationCategory(selection),
|
|
40901
|
+
"setting_unavailable"
|
|
40902
|
+
);
|
|
40903
|
+
return options;
|
|
40904
|
+
}
|
|
40869
40905
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40870
40906
|
}
|
|
40907
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40908
|
+
if (option2.type !== selection.valueType) {
|
|
40909
|
+
warnIgnoredSetting(
|
|
40910
|
+
audit,
|
|
40911
|
+
"session_configuration_setting_ignored",
|
|
40912
|
+
commandId,
|
|
40913
|
+
sessionId,
|
|
40914
|
+
agent.id,
|
|
40915
|
+
selection,
|
|
40916
|
+
option2.category,
|
|
40917
|
+
"setting_schema_mismatch"
|
|
40918
|
+
);
|
|
40919
|
+
return options;
|
|
40920
|
+
}
|
|
40921
|
+
if (option2.type === "boolean" && selection.value.length > 0 || option2.type === "select" && selection.booleanValue) {
|
|
40922
|
+
warnIgnoredSetting(
|
|
40923
|
+
audit,
|
|
40924
|
+
"session_configuration_setting_ignored",
|
|
40925
|
+
commandId,
|
|
40926
|
+
sessionId,
|
|
40927
|
+
agent.id,
|
|
40928
|
+
selection,
|
|
40929
|
+
option2.category,
|
|
40930
|
+
"selection_schema_mismatch"
|
|
40931
|
+
);
|
|
40932
|
+
return options;
|
|
40933
|
+
}
|
|
40934
|
+
if (option2.type === "select" && !option2.values.some((value) => value.value === selection.value)) {
|
|
40935
|
+
warnIgnoredSetting(
|
|
40936
|
+
audit,
|
|
40937
|
+
"session_configuration_setting_ignored",
|
|
40938
|
+
commandId,
|
|
40939
|
+
sessionId,
|
|
40940
|
+
agent.id,
|
|
40941
|
+
selection,
|
|
40942
|
+
option2.category,
|
|
40943
|
+
"value_unavailable"
|
|
40944
|
+
);
|
|
40945
|
+
return options;
|
|
40946
|
+
}
|
|
40947
|
+
}
|
|
40871
40948
|
if (sessionConfigurationMatches(option2, selection)) {
|
|
40872
40949
|
return options;
|
|
40873
40950
|
}
|
|
@@ -40884,8 +40961,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
40884
40961
|
valueType: selection.valueType
|
|
40885
40962
|
});
|
|
40886
40963
|
}
|
|
40887
|
-
async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
40888
|
-
|
|
40964
|
+
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40965
|
+
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40889
40966
|
let options = initialOptions;
|
|
40890
40967
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40891
40968
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -40894,16 +40971,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
|
|
|
40894
40971
|
for (const selection of orderedSelections) {
|
|
40895
40972
|
options = await applySessionConfigurationSelection(
|
|
40896
40973
|
sessions,
|
|
40974
|
+
audit,
|
|
40897
40975
|
options,
|
|
40898
40976
|
selection,
|
|
40899
40977
|
agent,
|
|
40900
40978
|
cwd,
|
|
40901
40979
|
additionalDirectories,
|
|
40980
|
+
commandId,
|
|
40902
40981
|
sessionId,
|
|
40903
40982
|
signal
|
|
40904
40983
|
);
|
|
40905
40984
|
}
|
|
40906
|
-
|
|
40985
|
+
assertAppliedSessionConfiguration(options, selections);
|
|
40907
40986
|
}
|
|
40908
40987
|
function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
40909
40988
|
return new LocalAgentDefinition(
|
|
@@ -40922,7 +41001,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
40922
41001
|
agent.agentVersion,
|
|
40923
41002
|
agent.adapterIdentity,
|
|
40924
41003
|
agent.agentIdentity,
|
|
40925
|
-
agent.promptTimeoutMilliseconds,
|
|
40926
41004
|
agent.capabilities,
|
|
40927
41005
|
agent.permissionProfile
|
|
40928
41006
|
);
|
|
@@ -40937,7 +41015,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
40937
41015
|
);
|
|
40938
41016
|
}
|
|
40939
41017
|
}
|
|
40940
|
-
function
|
|
41018
|
+
function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
|
|
40941
41019
|
const details = {
|
|
40942
41020
|
agentId,
|
|
40943
41021
|
category,
|
|
@@ -40945,7 +41023,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
|
|
|
40945
41023
|
reason,
|
|
40946
41024
|
requestedValue: selection.value
|
|
40947
41025
|
};
|
|
40948
|
-
const event = "bot_execution_setting_ignored";
|
|
40949
41026
|
audit.record({ commandId, details, event, sessionId });
|
|
40950
41027
|
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
40951
41028
|
`);
|
|
@@ -40956,12 +41033,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40956
41033
|
}
|
|
40957
41034
|
const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
40958
41035
|
if (option2 === void 0) {
|
|
40959
|
-
|
|
41036
|
+
warnIgnoredSetting(
|
|
41037
|
+
audit,
|
|
41038
|
+
"bot_execution_setting_ignored",
|
|
41039
|
+
commandId,
|
|
41040
|
+
sessionId,
|
|
41041
|
+
agent.id,
|
|
41042
|
+
selection,
|
|
41043
|
+
category,
|
|
41044
|
+
"setting_unavailable"
|
|
41045
|
+
);
|
|
40960
41046
|
return configOptions;
|
|
40961
41047
|
}
|
|
40962
41048
|
if (option2.type !== "select" || option2.category !== category) {
|
|
40963
|
-
|
|
41049
|
+
warnIgnoredSetting(
|
|
40964
41050
|
audit,
|
|
41051
|
+
"bot_execution_setting_ignored",
|
|
40965
41052
|
commandId,
|
|
40966
41053
|
sessionId,
|
|
40967
41054
|
agent.id,
|
|
@@ -40972,8 +41059,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40972
41059
|
return configOptions;
|
|
40973
41060
|
}
|
|
40974
41061
|
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
40975
|
-
|
|
41062
|
+
warnIgnoredSetting(
|
|
40976
41063
|
audit,
|
|
41064
|
+
"bot_execution_setting_ignored",
|
|
40977
41065
|
commandId,
|
|
40978
41066
|
sessionId,
|
|
40979
41067
|
agent.id,
|
|
@@ -40984,7 +41072,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40984
41072
|
return configOptions;
|
|
40985
41073
|
}
|
|
40986
41074
|
if (!option2.values.some((value) => value.value === selection.value)) {
|
|
40987
|
-
|
|
41075
|
+
warnIgnoredSetting(
|
|
41076
|
+
audit,
|
|
41077
|
+
"bot_execution_setting_ignored",
|
|
41078
|
+
commandId,
|
|
41079
|
+
sessionId,
|
|
41080
|
+
agent.id,
|
|
41081
|
+
selection,
|
|
41082
|
+
category,
|
|
41083
|
+
"value_unavailable"
|
|
41084
|
+
);
|
|
40988
41085
|
return configOptions;
|
|
40989
41086
|
}
|
|
40990
41087
|
if (option2.currentValue === selection.value) {
|
|
@@ -41008,10 +41105,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41008
41105
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
41009
41106
|
});
|
|
41010
41107
|
try {
|
|
41011
|
-
const
|
|
41012
|
-
|
|
41013
|
-
|
|
41014
|
-
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired");
|
|
41108
|
+
const startDeadline = Date.parse(command.executionDeadlineAt);
|
|
41109
|
+
if (!Number.isSafeInteger(startDeadline) || startDeadline <= Date.now()) {
|
|
41110
|
+
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution start deadline has expired");
|
|
41015
41111
|
}
|
|
41016
41112
|
const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
|
|
41017
41113
|
const resolved = await resolveSessionDirectories(
|
|
@@ -41023,8 +41119,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41023
41119
|
);
|
|
41024
41120
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
41025
41121
|
const applied = await applicator.apply(command, execution, attachments.resources, signal);
|
|
41026
|
-
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
41027
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
41028
41122
|
const startExecution = () => {
|
|
41029
41123
|
audit.record({
|
|
41030
41124
|
commandId: command.commandId,
|
|
@@ -41062,7 +41156,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41062
41156
|
prompt: command.prompt,
|
|
41063
41157
|
resources: applied.resources,
|
|
41064
41158
|
sessionId: command.sessionId,
|
|
41065
|
-
signal
|
|
41159
|
+
signal,
|
|
41066
41160
|
targetCommandId: command.targetCommandId
|
|
41067
41161
|
});
|
|
41068
41162
|
} else {
|
|
@@ -41081,7 +41175,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41081
41175
|
agent,
|
|
41082
41176
|
cwd: resolved.cwd,
|
|
41083
41177
|
sessionId: command.sessionId,
|
|
41084
|
-
signal
|
|
41178
|
+
signal
|
|
41085
41179
|
});
|
|
41086
41180
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
41087
41181
|
let configOptions = await applySupportedExecutionSelection(
|
|
@@ -41095,7 +41189,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41095
41189
|
resolved.additionalDirectories,
|
|
41096
41190
|
command.commandId,
|
|
41097
41191
|
command.sessionId,
|
|
41098
|
-
|
|
41192
|
+
signal
|
|
41099
41193
|
);
|
|
41100
41194
|
configOptions = await applySupportedExecutionSelection(
|
|
41101
41195
|
sessions,
|
|
@@ -41108,7 +41202,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41108
41202
|
resolved.additionalDirectories,
|
|
41109
41203
|
command.commandId,
|
|
41110
41204
|
command.sessionId,
|
|
41111
|
-
|
|
41205
|
+
signal
|
|
41112
41206
|
);
|
|
41113
41207
|
for (const selection of command.sessionConfigurations) {
|
|
41114
41208
|
await sessions.configureSession({
|
|
@@ -41119,7 +41213,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41119
41213
|
cwd: resolved.cwd,
|
|
41120
41214
|
requestId: `cfg_${randomUUID5()}`,
|
|
41121
41215
|
sessionId: command.sessionId,
|
|
41122
|
-
signal
|
|
41216
|
+
signal,
|
|
41123
41217
|
value: selection.value,
|
|
41124
41218
|
valueType: selection.valueType
|
|
41125
41219
|
});
|
|
@@ -41150,7 +41244,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41150
41244
|
prompt: command.prompt,
|
|
41151
41245
|
resources: applied.resources,
|
|
41152
41246
|
sessionId: command.sessionId,
|
|
41153
|
-
signal
|
|
41247
|
+
signal,
|
|
41154
41248
|
targetCommandId: command.targetCommandId
|
|
41155
41249
|
});
|
|
41156
41250
|
stopReason = result.stopReason;
|
|
@@ -41178,9 +41272,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41178
41272
|
});
|
|
41179
41273
|
} catch (error62) {
|
|
41180
41274
|
activities.flush();
|
|
41181
|
-
const failure2 =
|
|
41182
|
-
cause: error62
|
|
41183
|
-
}) : error62;
|
|
41275
|
+
const failure2 = error62;
|
|
41184
41276
|
audit.record({
|
|
41185
41277
|
commandId: command.commandId,
|
|
41186
41278
|
details: {
|