@moxt-ai/mobius 0.0.47 → 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.map +1 -1
- package/dist/acp/session-manager.js +4 -12
- 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 +151 -70
- package/dist/cli.js.map +2 -2
- package/dist/index.js +150 -69
- package/dist/index.js.map +2 -2
- 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 +150 -69
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.48",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -22194,11 +22194,7 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22194
22194
|
id;
|
|
22195
22195
|
label;
|
|
22196
22196
|
permissionProfile;
|
|
22197
|
-
|
|
22198
|
-
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, promptTimeoutMilliseconds = 30 * 60 * 1e3, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22199
|
-
if (!Number.isSafeInteger(promptTimeoutMilliseconds) || promptTimeoutMilliseconds < 1) {
|
|
22200
|
-
throw new Error("The local Agent prompt deadline is invalid");
|
|
22201
|
-
}
|
|
22197
|
+
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22202
22198
|
this.adapterIdentity = adapterIdentity;
|
|
22203
22199
|
this.adapterPath = adapterIdentity.realPath;
|
|
22204
22200
|
this.adapterVersion = adapterVersion;
|
|
@@ -22208,7 +22204,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22208
22204
|
this.id = id;
|
|
22209
22205
|
this.label = label;
|
|
22210
22206
|
this.permissionProfile = permissionProfile;
|
|
22211
|
-
this.promptTimeoutMilliseconds = promptTimeoutMilliseconds;
|
|
22212
22207
|
this.command = adapterIdentity.realPath;
|
|
22213
22208
|
this.arguments = Object.freeze([...arguments_]);
|
|
22214
22209
|
this.environment = permissionProfile.apply(environment, permissionProfile.currentMode(environment));
|
|
@@ -22227,7 +22222,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22227
22222
|
this.agentVersion,
|
|
22228
22223
|
this.adapterIdentity,
|
|
22229
22224
|
this.agentIdentity,
|
|
22230
|
-
this.promptTimeoutMilliseconds,
|
|
22231
22225
|
this.capabilities,
|
|
22232
22226
|
this.permissionProfile
|
|
22233
22227
|
);
|
|
@@ -22811,7 +22805,6 @@ function normalizeVersionOutput(output2) {
|
|
|
22811
22805
|
// src/agent-catalog/agent-specification.ts
|
|
22812
22806
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e3;
|
|
22813
22807
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 5e3;
|
|
22814
|
-
var DEFAULT_PROMPT_TIMEOUT_MILLISECONDS = 30 * 60 * 1e3;
|
|
22815
22808
|
var LocalAgentSpecification = class {
|
|
22816
22809
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
22817
22810
|
authenticationCommand = () => "";
|
|
@@ -22819,7 +22812,6 @@ var LocalAgentSpecification = class {
|
|
|
22819
22812
|
agentVersionArguments = ["--version"];
|
|
22820
22813
|
normalizeAdapterVersion = normalizeVersionOutput;
|
|
22821
22814
|
normalizeAgentVersion = normalizeVersionOutput;
|
|
22822
|
-
promptTimeoutMilliseconds = DEFAULT_PROMPT_TIMEOUT_MILLISECONDS;
|
|
22823
22815
|
versionProbeTimeoutMilliseconds = VERSION_PROBE_TIMEOUT_MILLISECONDS;
|
|
22824
22816
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
22825
22817
|
signal.throwIfAborted();
|
|
@@ -23671,7 +23663,6 @@ var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
|
|
|
23671
23663
|
|
|
23672
23664
|
// src/agent-catalog/agents/pi-agent.ts
|
|
23673
23665
|
var ACP_PROBE_TIMEOUT_MILLISECONDS2 = 3e4;
|
|
23674
|
-
var PROMPT_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
23675
23666
|
var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
23676
23667
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS2;
|
|
23677
23668
|
adapterEnvironmentVariable = "PI_ACP_PI_COMMAND";
|
|
@@ -23703,7 +23694,6 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
23703
23694
|
"bundle",
|
|
23704
23695
|
"cli.js"
|
|
23705
23696
|
];
|
|
23706
|
-
promptTimeoutMilliseconds = PROMPT_TIMEOUT_MILLISECONDS;
|
|
23707
23697
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
23708
23698
|
signal.throwIfAborted();
|
|
23709
23699
|
const executable = await validateManagedNpmPackage(
|
|
@@ -24355,8 +24345,7 @@ async function discoverAgent(specification, context) {
|
|
|
24355
24345
|
adapterVersion,
|
|
24356
24346
|
agentVersion,
|
|
24357
24347
|
adapter.identity,
|
|
24358
|
-
agent.identity
|
|
24359
|
-
specification.promptTimeoutMilliseconds
|
|
24348
|
+
agent.identity
|
|
24360
24349
|
);
|
|
24361
24350
|
try {
|
|
24362
24351
|
const readiness = await probeAcpReadiness(
|
|
@@ -24382,7 +24371,6 @@ async function discoverAgent(specification, context) {
|
|
|
24382
24371
|
agentVersion,
|
|
24383
24372
|
adapter.identity,
|
|
24384
24373
|
agent.identity,
|
|
24385
|
-
specification.promptTimeoutMilliseconds,
|
|
24386
24374
|
readiness.capabilities
|
|
24387
24375
|
)
|
|
24388
24376
|
);
|
|
@@ -33784,6 +33772,7 @@ var MAX_ACP_PROCESSES = 10;
|
|
|
33784
33772
|
var MAX_PRE_SESSION_UPDATES = 100;
|
|
33785
33773
|
var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
33786
33774
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
33775
|
+
var SESSION_CONTROL_TIMEOUT_MILLISECONDS = 3e4;
|
|
33787
33776
|
var NullAcpSessionObserver = class {
|
|
33788
33777
|
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
33789
33778
|
signal.throwIfAborted();
|
|
@@ -36234,7 +36223,7 @@ var AcpSessionManager = class {
|
|
|
36234
36223
|
() => deadlineController.abort(
|
|
36235
36224
|
new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
|
|
36236
36225
|
),
|
|
36237
|
-
|
|
36226
|
+
SESSION_CONTROL_TIMEOUT_MILLISECONDS
|
|
36238
36227
|
);
|
|
36239
36228
|
deadline.unref();
|
|
36240
36229
|
try {
|
|
@@ -36259,28 +36248,13 @@ var AcpSessionManager = class {
|
|
|
36259
36248
|
if (this.#activeSessionIds.has(options.sessionId)) {
|
|
36260
36249
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
36261
36250
|
}
|
|
36262
|
-
const deadlineController = new AbortController();
|
|
36263
|
-
const deadlineError = new AcpExecutionError(
|
|
36264
|
-
"The local Agent prompt exceeded its deadline",
|
|
36265
|
-
{},
|
|
36266
|
-
"prompt_timeout"
|
|
36267
|
-
);
|
|
36268
|
-
const deadline = setTimeout(
|
|
36269
|
-
() => deadlineController.abort(deadlineError),
|
|
36270
|
-
options.agent.promptTimeoutMilliseconds
|
|
36271
|
-
);
|
|
36272
|
-
deadline.unref();
|
|
36273
|
-
const boundedOptions = {
|
|
36274
|
-
...options,
|
|
36275
|
-
signal: AbortSignal.any([options.signal, deadlineController.signal])
|
|
36276
|
-
};
|
|
36277
36251
|
this.#activeSessionIds.add(options.sessionId);
|
|
36278
36252
|
this.#activeCommandIds.set(options.sessionId, options.commandId);
|
|
36279
36253
|
try {
|
|
36280
36254
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
36281
36255
|
return { stopReason: "cancelled" };
|
|
36282
36256
|
}
|
|
36283
|
-
const runtime = await this.ensureSession(
|
|
36257
|
+
const runtime = await this.ensureSession(options);
|
|
36284
36258
|
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
36285
36259
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
36286
36260
|
}
|
|
@@ -36288,7 +36262,7 @@ var AcpSessionManager = class {
|
|
|
36288
36262
|
return { stopReason: "cancelled" };
|
|
36289
36263
|
}
|
|
36290
36264
|
try {
|
|
36291
|
-
const result = await runtime.prompt(
|
|
36265
|
+
const result = await runtime.prompt(options);
|
|
36292
36266
|
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
36293
36267
|
} catch (error62) {
|
|
36294
36268
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -36316,7 +36290,6 @@ var AcpSessionManager = class {
|
|
|
36316
36290
|
cause: error62
|
|
36317
36291
|
});
|
|
36318
36292
|
} finally {
|
|
36319
|
-
clearTimeout(deadline);
|
|
36320
36293
|
try {
|
|
36321
36294
|
await this.#cancellationRequests.get(options.sessionId);
|
|
36322
36295
|
} finally {
|
|
@@ -37865,10 +37838,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37865
37838
|
#activeByHandle = /* @__PURE__ */ new Map();
|
|
37866
37839
|
#handlesBySession = /* @__PURE__ */ new Map();
|
|
37867
37840
|
#inactiveHandles = /* @__PURE__ */ new Set();
|
|
37868
|
-
#now;
|
|
37869
|
-
constructor(now = Date.now) {
|
|
37870
|
-
this.#now = now;
|
|
37871
|
-
}
|
|
37872
37841
|
activate = (command) => {
|
|
37873
37842
|
let handle = this.#handlesBySession.get(command.sessionId);
|
|
37874
37843
|
if (handle === void 0) {
|
|
@@ -37902,12 +37871,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37902
37871
|
"An active Bot execution context is required"
|
|
37903
37872
|
);
|
|
37904
37873
|
}
|
|
37905
|
-
if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
|
|
37906
|
-
throw new LocalBotAuthorizationError(
|
|
37907
|
-
"execution_capability_expired",
|
|
37908
|
-
"The Bot execution capability has expired"
|
|
37909
|
-
);
|
|
37910
|
-
}
|
|
37911
37874
|
return context;
|
|
37912
37875
|
};
|
|
37913
37876
|
};
|
|
@@ -40777,11 +40740,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40777
40740
|
} else {
|
|
40778
40741
|
await applyCompleteSessionConfiguration(
|
|
40779
40742
|
sessions,
|
|
40743
|
+
audit,
|
|
40780
40744
|
prepared.configOptions,
|
|
40781
40745
|
command.sessionConfigurations,
|
|
40782
40746
|
agent,
|
|
40783
40747
|
resolved.cwd,
|
|
40784
40748
|
resolved.additionalDirectories,
|
|
40749
|
+
command.commandId,
|
|
40785
40750
|
command.sessionId,
|
|
40786
40751
|
signal
|
|
40787
40752
|
);
|
|
@@ -40922,6 +40887,26 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40922
40887
|
}
|
|
40923
40888
|
}
|
|
40924
40889
|
}
|
|
40890
|
+
function assertSessionConfigurationCoverage(options, selections) {
|
|
40891
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40892
|
+
if (selectionsById.size !== selections.length) {
|
|
40893
|
+
throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
|
|
40894
|
+
}
|
|
40895
|
+
for (const option2 of options) {
|
|
40896
|
+
if (!selectionsById.has(option2.id)) {
|
|
40897
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40898
|
+
}
|
|
40899
|
+
}
|
|
40900
|
+
}
|
|
40901
|
+
function sessionConfigurationSelectionIsAvailable(option2, selection) {
|
|
40902
|
+
if (option2.type !== selection.valueType) {
|
|
40903
|
+
return false;
|
|
40904
|
+
}
|
|
40905
|
+
if (option2.type === "boolean") {
|
|
40906
|
+
return selection.value.length === 0;
|
|
40907
|
+
}
|
|
40908
|
+
return !selection.booleanValue && option2.values.some((value) => value.value === selection.value);
|
|
40909
|
+
}
|
|
40925
40910
|
function sessionConfigurationMatches(option2, selection) {
|
|
40926
40911
|
validateSessionConfigurationSelection(option2, selection);
|
|
40927
40912
|
return option2.type === "boolean" ? option2.booleanValue === selection.booleanValue : option2.currentValue === selection.value;
|
|
@@ -40952,11 +40937,92 @@ function assertCompleteSessionConfiguration(options, selections) {
|
|
|
40952
40937
|
}
|
|
40953
40938
|
}
|
|
40954
40939
|
}
|
|
40955
|
-
|
|
40940
|
+
function assertAppliedSessionConfiguration(options, selections) {
|
|
40941
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40942
|
+
for (const option2 of options) {
|
|
40943
|
+
const selection = selectionsById.get(option2.id);
|
|
40944
|
+
if (option2.id === AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40945
|
+
if (selection === void 0 || !sessionConfigurationMatches(option2, selection)) {
|
|
40946
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40947
|
+
}
|
|
40948
|
+
continue;
|
|
40949
|
+
}
|
|
40950
|
+
if (selection === void 0 || !sessionConfigurationSelectionIsAvailable(option2, selection)) {
|
|
40951
|
+
continue;
|
|
40952
|
+
}
|
|
40953
|
+
if (!sessionConfigurationMatches(option2, selection)) {
|
|
40954
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option2.id}`);
|
|
40955
|
+
}
|
|
40956
|
+
}
|
|
40957
|
+
}
|
|
40958
|
+
function unavailableSessionConfigurationCategory(selection) {
|
|
40959
|
+
if (selection.configId === "model") {
|
|
40960
|
+
return "model";
|
|
40961
|
+
}
|
|
40962
|
+
if (selection.configId === "reasoning_effort") {
|
|
40963
|
+
return "thought_level";
|
|
40964
|
+
}
|
|
40965
|
+
return "unknown";
|
|
40966
|
+
}
|
|
40967
|
+
async function applySessionConfigurationSelection(sessions, audit, options, selection, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40956
40968
|
const option2 = options.find((candidate) => candidate.id === selection.configId);
|
|
40957
40969
|
if (option2 === void 0) {
|
|
40970
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40971
|
+
warnIgnoredSetting(
|
|
40972
|
+
audit,
|
|
40973
|
+
"session_configuration_setting_ignored",
|
|
40974
|
+
commandId,
|
|
40975
|
+
sessionId,
|
|
40976
|
+
agent.id,
|
|
40977
|
+
selection,
|
|
40978
|
+
unavailableSessionConfigurationCategory(selection),
|
|
40979
|
+
"setting_unavailable"
|
|
40980
|
+
);
|
|
40981
|
+
return options;
|
|
40982
|
+
}
|
|
40958
40983
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40959
40984
|
}
|
|
40985
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40986
|
+
if (option2.type !== selection.valueType) {
|
|
40987
|
+
warnIgnoredSetting(
|
|
40988
|
+
audit,
|
|
40989
|
+
"session_configuration_setting_ignored",
|
|
40990
|
+
commandId,
|
|
40991
|
+
sessionId,
|
|
40992
|
+
agent.id,
|
|
40993
|
+
selection,
|
|
40994
|
+
option2.category,
|
|
40995
|
+
"setting_schema_mismatch"
|
|
40996
|
+
);
|
|
40997
|
+
return options;
|
|
40998
|
+
}
|
|
40999
|
+
if (option2.type === "boolean" && selection.value.length > 0 || option2.type === "select" && selection.booleanValue) {
|
|
41000
|
+
warnIgnoredSetting(
|
|
41001
|
+
audit,
|
|
41002
|
+
"session_configuration_setting_ignored",
|
|
41003
|
+
commandId,
|
|
41004
|
+
sessionId,
|
|
41005
|
+
agent.id,
|
|
41006
|
+
selection,
|
|
41007
|
+
option2.category,
|
|
41008
|
+
"selection_schema_mismatch"
|
|
41009
|
+
);
|
|
41010
|
+
return options;
|
|
41011
|
+
}
|
|
41012
|
+
if (option2.type === "select" && !option2.values.some((value) => value.value === selection.value)) {
|
|
41013
|
+
warnIgnoredSetting(
|
|
41014
|
+
audit,
|
|
41015
|
+
"session_configuration_setting_ignored",
|
|
41016
|
+
commandId,
|
|
41017
|
+
sessionId,
|
|
41018
|
+
agent.id,
|
|
41019
|
+
selection,
|
|
41020
|
+
option2.category,
|
|
41021
|
+
"value_unavailable"
|
|
41022
|
+
);
|
|
41023
|
+
return options;
|
|
41024
|
+
}
|
|
41025
|
+
}
|
|
40960
41026
|
if (sessionConfigurationMatches(option2, selection)) {
|
|
40961
41027
|
return options;
|
|
40962
41028
|
}
|
|
@@ -40973,8 +41039,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
40973
41039
|
valueType: selection.valueType
|
|
40974
41040
|
});
|
|
40975
41041
|
}
|
|
40976
|
-
async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
40977
|
-
|
|
41042
|
+
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
41043
|
+
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40978
41044
|
let options = initialOptions;
|
|
40979
41045
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40980
41046
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -40983,16 +41049,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
|
|
|
40983
41049
|
for (const selection of orderedSelections) {
|
|
40984
41050
|
options = await applySessionConfigurationSelection(
|
|
40985
41051
|
sessions,
|
|
41052
|
+
audit,
|
|
40986
41053
|
options,
|
|
40987
41054
|
selection,
|
|
40988
41055
|
agent,
|
|
40989
41056
|
cwd,
|
|
40990
41057
|
additionalDirectories,
|
|
41058
|
+
commandId,
|
|
40991
41059
|
sessionId,
|
|
40992
41060
|
signal
|
|
40993
41061
|
);
|
|
40994
41062
|
}
|
|
40995
|
-
|
|
41063
|
+
assertAppliedSessionConfiguration(options, selections);
|
|
40996
41064
|
}
|
|
40997
41065
|
function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
40998
41066
|
return new LocalAgentDefinition(
|
|
@@ -41011,7 +41079,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
41011
41079
|
agent.agentVersion,
|
|
41012
41080
|
agent.adapterIdentity,
|
|
41013
41081
|
agent.agentIdentity,
|
|
41014
|
-
agent.promptTimeoutMilliseconds,
|
|
41015
41082
|
agent.capabilities,
|
|
41016
41083
|
agent.permissionProfile
|
|
41017
41084
|
);
|
|
@@ -41026,7 +41093,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
41026
41093
|
);
|
|
41027
41094
|
}
|
|
41028
41095
|
}
|
|
41029
|
-
function
|
|
41096
|
+
function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
|
|
41030
41097
|
const details = {
|
|
41031
41098
|
agentId,
|
|
41032
41099
|
category,
|
|
@@ -41034,7 +41101,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
|
|
|
41034
41101
|
reason,
|
|
41035
41102
|
requestedValue: selection.value
|
|
41036
41103
|
};
|
|
41037
|
-
const event = "bot_execution_setting_ignored";
|
|
41038
41104
|
audit.record({ commandId, details, event, sessionId });
|
|
41039
41105
|
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
41040
41106
|
`);
|
|
@@ -41045,12 +41111,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
41045
41111
|
}
|
|
41046
41112
|
const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
41047
41113
|
if (option2 === void 0) {
|
|
41048
|
-
|
|
41114
|
+
warnIgnoredSetting(
|
|
41115
|
+
audit,
|
|
41116
|
+
"bot_execution_setting_ignored",
|
|
41117
|
+
commandId,
|
|
41118
|
+
sessionId,
|
|
41119
|
+
agent.id,
|
|
41120
|
+
selection,
|
|
41121
|
+
category,
|
|
41122
|
+
"setting_unavailable"
|
|
41123
|
+
);
|
|
41049
41124
|
return configOptions;
|
|
41050
41125
|
}
|
|
41051
41126
|
if (option2.type !== "select" || option2.category !== category) {
|
|
41052
|
-
|
|
41127
|
+
warnIgnoredSetting(
|
|
41053
41128
|
audit,
|
|
41129
|
+
"bot_execution_setting_ignored",
|
|
41054
41130
|
commandId,
|
|
41055
41131
|
sessionId,
|
|
41056
41132
|
agent.id,
|
|
@@ -41061,8 +41137,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
41061
41137
|
return configOptions;
|
|
41062
41138
|
}
|
|
41063
41139
|
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
41064
|
-
|
|
41140
|
+
warnIgnoredSetting(
|
|
41065
41141
|
audit,
|
|
41142
|
+
"bot_execution_setting_ignored",
|
|
41066
41143
|
commandId,
|
|
41067
41144
|
sessionId,
|
|
41068
41145
|
agent.id,
|
|
@@ -41073,7 +41150,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
41073
41150
|
return configOptions;
|
|
41074
41151
|
}
|
|
41075
41152
|
if (!option2.values.some((value) => value.value === selection.value)) {
|
|
41076
|
-
|
|
41153
|
+
warnIgnoredSetting(
|
|
41154
|
+
audit,
|
|
41155
|
+
"bot_execution_setting_ignored",
|
|
41156
|
+
commandId,
|
|
41157
|
+
sessionId,
|
|
41158
|
+
agent.id,
|
|
41159
|
+
selection,
|
|
41160
|
+
category,
|
|
41161
|
+
"value_unavailable"
|
|
41162
|
+
);
|
|
41077
41163
|
return configOptions;
|
|
41078
41164
|
}
|
|
41079
41165
|
if (option2.currentValue === selection.value) {
|
|
@@ -41097,10 +41183,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41097
41183
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
41098
41184
|
});
|
|
41099
41185
|
try {
|
|
41100
|
-
const
|
|
41101
|
-
|
|
41102
|
-
|
|
41103
|
-
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired");
|
|
41186
|
+
const startDeadline = Date.parse(command.executionDeadlineAt);
|
|
41187
|
+
if (!Number.isSafeInteger(startDeadline) || startDeadline <= Date.now()) {
|
|
41188
|
+
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution start deadline has expired");
|
|
41104
41189
|
}
|
|
41105
41190
|
const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
|
|
41106
41191
|
const resolved = await resolveSessionDirectories(
|
|
@@ -41112,8 +41197,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41112
41197
|
);
|
|
41113
41198
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
41114
41199
|
const applied = await applicator.apply(command, execution, attachments.resources, signal);
|
|
41115
|
-
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
41116
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
41117
41200
|
const startExecution = () => {
|
|
41118
41201
|
audit.record({
|
|
41119
41202
|
commandId: command.commandId,
|
|
@@ -41151,7 +41234,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41151
41234
|
prompt: command.prompt,
|
|
41152
41235
|
resources: applied.resources,
|
|
41153
41236
|
sessionId: command.sessionId,
|
|
41154
|
-
signal
|
|
41237
|
+
signal,
|
|
41155
41238
|
targetCommandId: command.targetCommandId
|
|
41156
41239
|
});
|
|
41157
41240
|
} else {
|
|
@@ -41170,7 +41253,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41170
41253
|
agent,
|
|
41171
41254
|
cwd: resolved.cwd,
|
|
41172
41255
|
sessionId: command.sessionId,
|
|
41173
|
-
signal
|
|
41256
|
+
signal
|
|
41174
41257
|
});
|
|
41175
41258
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
41176
41259
|
let configOptions = await applySupportedExecutionSelection(
|
|
@@ -41184,7 +41267,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41184
41267
|
resolved.additionalDirectories,
|
|
41185
41268
|
command.commandId,
|
|
41186
41269
|
command.sessionId,
|
|
41187
|
-
|
|
41270
|
+
signal
|
|
41188
41271
|
);
|
|
41189
41272
|
configOptions = await applySupportedExecutionSelection(
|
|
41190
41273
|
sessions,
|
|
@@ -41197,7 +41280,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41197
41280
|
resolved.additionalDirectories,
|
|
41198
41281
|
command.commandId,
|
|
41199
41282
|
command.sessionId,
|
|
41200
|
-
|
|
41283
|
+
signal
|
|
41201
41284
|
);
|
|
41202
41285
|
for (const selection of command.sessionConfigurations) {
|
|
41203
41286
|
await sessions.configureSession({
|
|
@@ -41208,7 +41291,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41208
41291
|
cwd: resolved.cwd,
|
|
41209
41292
|
requestId: `cfg_${randomUUID5()}`,
|
|
41210
41293
|
sessionId: command.sessionId,
|
|
41211
|
-
signal
|
|
41294
|
+
signal,
|
|
41212
41295
|
value: selection.value,
|
|
41213
41296
|
valueType: selection.valueType
|
|
41214
41297
|
});
|
|
@@ -41239,7 +41322,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41239
41322
|
prompt: command.prompt,
|
|
41240
41323
|
resources: applied.resources,
|
|
41241
41324
|
sessionId: command.sessionId,
|
|
41242
|
-
signal
|
|
41325
|
+
signal,
|
|
41243
41326
|
targetCommandId: command.targetCommandId
|
|
41244
41327
|
});
|
|
41245
41328
|
stopReason = result.stopReason;
|
|
@@ -41267,9 +41350,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41267
41350
|
});
|
|
41268
41351
|
} catch (error62) {
|
|
41269
41352
|
activities.flush();
|
|
41270
|
-
const failure2 =
|
|
41271
|
-
cause: error62
|
|
41272
|
-
}) : error62;
|
|
41353
|
+
const failure2 = error62;
|
|
41273
41354
|
audit.record({
|
|
41274
41355
|
commandId: command.commandId,
|
|
41275
41356
|
details: {
|