@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/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();
|
|
@@ -33563,7 +33558,7 @@ var AcpSessionManager = class {
|
|
|
33563
33558
|
() => deadlineController.abort(
|
|
33564
33559
|
new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
|
|
33565
33560
|
),
|
|
33566
|
-
|
|
33561
|
+
SESSION_CONTROL_TIMEOUT_MILLISECONDS
|
|
33567
33562
|
);
|
|
33568
33563
|
deadline.unref();
|
|
33569
33564
|
try {
|
|
@@ -33588,28 +33583,13 @@ var AcpSessionManager = class {
|
|
|
33588
33583
|
if (this.#activeSessionIds.has(options.sessionId)) {
|
|
33589
33584
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
33590
33585
|
}
|
|
33591
|
-
const deadlineController = new AbortController();
|
|
33592
|
-
const deadlineError = new AcpExecutionError(
|
|
33593
|
-
"The local Agent prompt exceeded its deadline",
|
|
33594
|
-
{},
|
|
33595
|
-
"prompt_timeout"
|
|
33596
|
-
);
|
|
33597
|
-
const deadline = setTimeout(
|
|
33598
|
-
() => deadlineController.abort(deadlineError),
|
|
33599
|
-
options.agent.promptTimeoutMilliseconds
|
|
33600
|
-
);
|
|
33601
|
-
deadline.unref();
|
|
33602
|
-
const boundedOptions = {
|
|
33603
|
-
...options,
|
|
33604
|
-
signal: AbortSignal.any([options.signal, deadlineController.signal])
|
|
33605
|
-
};
|
|
33606
33586
|
this.#activeSessionIds.add(options.sessionId);
|
|
33607
33587
|
this.#activeCommandIds.set(options.sessionId, options.commandId);
|
|
33608
33588
|
try {
|
|
33609
33589
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
33610
33590
|
return { stopReason: "cancelled" };
|
|
33611
33591
|
}
|
|
33612
|
-
const runtime = await this.ensureSession(
|
|
33592
|
+
const runtime = await this.ensureSession(options);
|
|
33613
33593
|
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
33614
33594
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
33615
33595
|
}
|
|
@@ -33617,7 +33597,7 @@ var AcpSessionManager = class {
|
|
|
33617
33597
|
return { stopReason: "cancelled" };
|
|
33618
33598
|
}
|
|
33619
33599
|
try {
|
|
33620
|
-
const result = await runtime.prompt(
|
|
33600
|
+
const result = await runtime.prompt(options);
|
|
33621
33601
|
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
33622
33602
|
} catch (error62) {
|
|
33623
33603
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -33645,7 +33625,6 @@ var AcpSessionManager = class {
|
|
|
33645
33625
|
cause: error62
|
|
33646
33626
|
});
|
|
33647
33627
|
} finally {
|
|
33648
|
-
clearTimeout(deadline);
|
|
33649
33628
|
try {
|
|
33650
33629
|
await this.#cancellationRequests.get(options.sessionId);
|
|
33651
33630
|
} finally {
|
|
@@ -34154,10 +34133,6 @@ var BotExecutionContextRegistry = class {
|
|
|
34154
34133
|
#activeByHandle = /* @__PURE__ */ new Map();
|
|
34155
34134
|
#handlesBySession = /* @__PURE__ */ new Map();
|
|
34156
34135
|
#inactiveHandles = /* @__PURE__ */ new Set();
|
|
34157
|
-
#now;
|
|
34158
|
-
constructor(now = Date.now) {
|
|
34159
|
-
this.#now = now;
|
|
34160
|
-
}
|
|
34161
34136
|
activate = (command) => {
|
|
34162
34137
|
let handle = this.#handlesBySession.get(command.sessionId);
|
|
34163
34138
|
if (handle === void 0) {
|
|
@@ -34191,12 +34166,6 @@ var BotExecutionContextRegistry = class {
|
|
|
34191
34166
|
"An active Bot execution context is required"
|
|
34192
34167
|
);
|
|
34193
34168
|
}
|
|
34194
|
-
if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
|
|
34195
|
-
throw new LocalBotAuthorizationError(
|
|
34196
|
-
"execution_capability_expired",
|
|
34197
|
-
"The Bot execution capability has expired"
|
|
34198
|
-
);
|
|
34199
|
-
}
|
|
34200
34169
|
return context;
|
|
34201
34170
|
};
|
|
34202
34171
|
};
|
|
@@ -35042,7 +35011,6 @@ function normalizeVersionOutput(output2) {
|
|
|
35042
35011
|
// src/agent-catalog/agent-specification.ts
|
|
35043
35012
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e3;
|
|
35044
35013
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 5e3;
|
|
35045
|
-
var DEFAULT_PROMPT_TIMEOUT_MILLISECONDS = 30 * 60 * 1e3;
|
|
35046
35014
|
var LocalAgentSpecification = class {
|
|
35047
35015
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
35048
35016
|
authenticationCommand = () => "";
|
|
@@ -35050,7 +35018,6 @@ var LocalAgentSpecification = class {
|
|
|
35050
35018
|
agentVersionArguments = ["--version"];
|
|
35051
35019
|
normalizeAdapterVersion = normalizeVersionOutput;
|
|
35052
35020
|
normalizeAgentVersion = normalizeVersionOutput;
|
|
35053
|
-
promptTimeoutMilliseconds = DEFAULT_PROMPT_TIMEOUT_MILLISECONDS;
|
|
35054
35021
|
versionProbeTimeoutMilliseconds = VERSION_PROBE_TIMEOUT_MILLISECONDS;
|
|
35055
35022
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
35056
35023
|
signal.throwIfAborted();
|
|
@@ -35891,7 +35858,6 @@ var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
|
|
|
35891
35858
|
|
|
35892
35859
|
// src/agent-catalog/agents/pi-agent.ts
|
|
35893
35860
|
var ACP_PROBE_TIMEOUT_MILLISECONDS2 = 3e4;
|
|
35894
|
-
var PROMPT_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
35895
35861
|
var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
35896
35862
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS2;
|
|
35897
35863
|
adapterEnvironmentVariable = "PI_ACP_PI_COMMAND";
|
|
@@ -35923,7 +35889,6 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
35923
35889
|
"bundle",
|
|
35924
35890
|
"cli.js"
|
|
35925
35891
|
];
|
|
35926
|
-
promptTimeoutMilliseconds = PROMPT_TIMEOUT_MILLISECONDS;
|
|
35927
35892
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
35928
35893
|
signal.throwIfAborted();
|
|
35929
35894
|
const executable = await validateManagedNpmPackage(
|
|
@@ -36546,8 +36511,7 @@ async function discoverAgent(specification, context) {
|
|
|
36546
36511
|
adapterVersion,
|
|
36547
36512
|
agentVersion,
|
|
36548
36513
|
adapter.identity,
|
|
36549
|
-
agent.identity
|
|
36550
|
-
specification.promptTimeoutMilliseconds
|
|
36514
|
+
agent.identity
|
|
36551
36515
|
);
|
|
36552
36516
|
try {
|
|
36553
36517
|
const readiness = await probeAcpReadiness(
|
|
@@ -36573,7 +36537,6 @@ async function discoverAgent(specification, context) {
|
|
|
36573
36537
|
agentVersion,
|
|
36574
36538
|
adapter.identity,
|
|
36575
36539
|
agent.identity,
|
|
36576
|
-
specification.promptTimeoutMilliseconds,
|
|
36577
36540
|
readiness.capabilities
|
|
36578
36541
|
)
|
|
36579
36542
|
);
|
|
@@ -40699,11 +40662,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40699
40662
|
} else {
|
|
40700
40663
|
await applyCompleteSessionConfiguration(
|
|
40701
40664
|
sessions,
|
|
40665
|
+
audit,
|
|
40702
40666
|
prepared.configOptions,
|
|
40703
40667
|
command.sessionConfigurations,
|
|
40704
40668
|
agent,
|
|
40705
40669
|
resolved.cwd,
|
|
40706
40670
|
resolved.additionalDirectories,
|
|
40671
|
+
command.commandId,
|
|
40707
40672
|
command.sessionId,
|
|
40708
40673
|
signal
|
|
40709
40674
|
);
|
|
@@ -40844,6 +40809,26 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40844
40809
|
}
|
|
40845
40810
|
}
|
|
40846
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
|
+
}
|
|
40847
40832
|
function sessionConfigurationMatches(option2, selection) {
|
|
40848
40833
|
validateSessionConfigurationSelection(option2, selection);
|
|
40849
40834
|
return option2.type === "boolean" ? option2.booleanValue === selection.booleanValue : option2.currentValue === selection.value;
|
|
@@ -40874,11 +40859,92 @@ function assertCompleteSessionConfiguration(options, selections) {
|
|
|
40874
40859
|
}
|
|
40875
40860
|
}
|
|
40876
40861
|
}
|
|
40877
|
-
|
|
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) {
|
|
40878
40890
|
const option2 = options.find((candidate) => candidate.id === selection.configId);
|
|
40879
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
|
+
}
|
|
40880
40905
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40881
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
|
+
}
|
|
40882
40948
|
if (sessionConfigurationMatches(option2, selection)) {
|
|
40883
40949
|
return options;
|
|
40884
40950
|
}
|
|
@@ -40895,8 +40961,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
40895
40961
|
valueType: selection.valueType
|
|
40896
40962
|
});
|
|
40897
40963
|
}
|
|
40898
|
-
async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
40899
|
-
|
|
40964
|
+
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40965
|
+
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40900
40966
|
let options = initialOptions;
|
|
40901
40967
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40902
40968
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -40905,16 +40971,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
|
|
|
40905
40971
|
for (const selection of orderedSelections) {
|
|
40906
40972
|
options = await applySessionConfigurationSelection(
|
|
40907
40973
|
sessions,
|
|
40974
|
+
audit,
|
|
40908
40975
|
options,
|
|
40909
40976
|
selection,
|
|
40910
40977
|
agent,
|
|
40911
40978
|
cwd,
|
|
40912
40979
|
additionalDirectories,
|
|
40980
|
+
commandId,
|
|
40913
40981
|
sessionId,
|
|
40914
40982
|
signal
|
|
40915
40983
|
);
|
|
40916
40984
|
}
|
|
40917
|
-
|
|
40985
|
+
assertAppliedSessionConfiguration(options, selections);
|
|
40918
40986
|
}
|
|
40919
40987
|
function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
40920
40988
|
return new LocalAgentDefinition(
|
|
@@ -40933,7 +41001,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
40933
41001
|
agent.agentVersion,
|
|
40934
41002
|
agent.adapterIdentity,
|
|
40935
41003
|
agent.agentIdentity,
|
|
40936
|
-
agent.promptTimeoutMilliseconds,
|
|
40937
41004
|
agent.capabilities,
|
|
40938
41005
|
agent.permissionProfile
|
|
40939
41006
|
);
|
|
@@ -40948,7 +41015,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
40948
41015
|
);
|
|
40949
41016
|
}
|
|
40950
41017
|
}
|
|
40951
|
-
function
|
|
41018
|
+
function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
|
|
40952
41019
|
const details = {
|
|
40953
41020
|
agentId,
|
|
40954
41021
|
category,
|
|
@@ -40956,7 +41023,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
|
|
|
40956
41023
|
reason,
|
|
40957
41024
|
requestedValue: selection.value
|
|
40958
41025
|
};
|
|
40959
|
-
const event = "bot_execution_setting_ignored";
|
|
40960
41026
|
audit.record({ commandId, details, event, sessionId });
|
|
40961
41027
|
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
40962
41028
|
`);
|
|
@@ -40967,12 +41033,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40967
41033
|
}
|
|
40968
41034
|
const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
40969
41035
|
if (option2 === void 0) {
|
|
40970
|
-
|
|
41036
|
+
warnIgnoredSetting(
|
|
41037
|
+
audit,
|
|
41038
|
+
"bot_execution_setting_ignored",
|
|
41039
|
+
commandId,
|
|
41040
|
+
sessionId,
|
|
41041
|
+
agent.id,
|
|
41042
|
+
selection,
|
|
41043
|
+
category,
|
|
41044
|
+
"setting_unavailable"
|
|
41045
|
+
);
|
|
40971
41046
|
return configOptions;
|
|
40972
41047
|
}
|
|
40973
41048
|
if (option2.type !== "select" || option2.category !== category) {
|
|
40974
|
-
|
|
41049
|
+
warnIgnoredSetting(
|
|
40975
41050
|
audit,
|
|
41051
|
+
"bot_execution_setting_ignored",
|
|
40976
41052
|
commandId,
|
|
40977
41053
|
sessionId,
|
|
40978
41054
|
agent.id,
|
|
@@ -40983,8 +41059,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40983
41059
|
return configOptions;
|
|
40984
41060
|
}
|
|
40985
41061
|
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
40986
|
-
|
|
41062
|
+
warnIgnoredSetting(
|
|
40987
41063
|
audit,
|
|
41064
|
+
"bot_execution_setting_ignored",
|
|
40988
41065
|
commandId,
|
|
40989
41066
|
sessionId,
|
|
40990
41067
|
agent.id,
|
|
@@ -40995,7 +41072,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40995
41072
|
return configOptions;
|
|
40996
41073
|
}
|
|
40997
41074
|
if (!option2.values.some((value) => value.value === selection.value)) {
|
|
40998
|
-
|
|
41075
|
+
warnIgnoredSetting(
|
|
41076
|
+
audit,
|
|
41077
|
+
"bot_execution_setting_ignored",
|
|
41078
|
+
commandId,
|
|
41079
|
+
sessionId,
|
|
41080
|
+
agent.id,
|
|
41081
|
+
selection,
|
|
41082
|
+
category,
|
|
41083
|
+
"value_unavailable"
|
|
41084
|
+
);
|
|
40999
41085
|
return configOptions;
|
|
41000
41086
|
}
|
|
41001
41087
|
if (option2.currentValue === selection.value) {
|
|
@@ -41019,10 +41105,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41019
41105
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
41020
41106
|
});
|
|
41021
41107
|
try {
|
|
41022
|
-
const
|
|
41023
|
-
|
|
41024
|
-
|
|
41025
|
-
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");
|
|
41026
41111
|
}
|
|
41027
41112
|
const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
|
|
41028
41113
|
const resolved = await resolveSessionDirectories(
|
|
@@ -41034,8 +41119,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41034
41119
|
);
|
|
41035
41120
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
41036
41121
|
const applied = await applicator.apply(command, execution, attachments.resources, signal);
|
|
41037
|
-
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
41038
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
41039
41122
|
const startExecution = () => {
|
|
41040
41123
|
audit.record({
|
|
41041
41124
|
commandId: command.commandId,
|
|
@@ -41073,7 +41156,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41073
41156
|
prompt: command.prompt,
|
|
41074
41157
|
resources: applied.resources,
|
|
41075
41158
|
sessionId: command.sessionId,
|
|
41076
|
-
signal
|
|
41159
|
+
signal,
|
|
41077
41160
|
targetCommandId: command.targetCommandId
|
|
41078
41161
|
});
|
|
41079
41162
|
} else {
|
|
@@ -41092,7 +41175,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41092
41175
|
agent,
|
|
41093
41176
|
cwd: resolved.cwd,
|
|
41094
41177
|
sessionId: command.sessionId,
|
|
41095
|
-
signal
|
|
41178
|
+
signal
|
|
41096
41179
|
});
|
|
41097
41180
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
41098
41181
|
let configOptions = await applySupportedExecutionSelection(
|
|
@@ -41106,7 +41189,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41106
41189
|
resolved.additionalDirectories,
|
|
41107
41190
|
command.commandId,
|
|
41108
41191
|
command.sessionId,
|
|
41109
|
-
|
|
41192
|
+
signal
|
|
41110
41193
|
);
|
|
41111
41194
|
configOptions = await applySupportedExecutionSelection(
|
|
41112
41195
|
sessions,
|
|
@@ -41119,7 +41202,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41119
41202
|
resolved.additionalDirectories,
|
|
41120
41203
|
command.commandId,
|
|
41121
41204
|
command.sessionId,
|
|
41122
|
-
|
|
41205
|
+
signal
|
|
41123
41206
|
);
|
|
41124
41207
|
for (const selection of command.sessionConfigurations) {
|
|
41125
41208
|
await sessions.configureSession({
|
|
@@ -41130,7 +41213,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41130
41213
|
cwd: resolved.cwd,
|
|
41131
41214
|
requestId: `cfg_${randomUUID5()}`,
|
|
41132
41215
|
sessionId: command.sessionId,
|
|
41133
|
-
signal
|
|
41216
|
+
signal,
|
|
41134
41217
|
value: selection.value,
|
|
41135
41218
|
valueType: selection.valueType
|
|
41136
41219
|
});
|
|
@@ -41161,7 +41244,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41161
41244
|
prompt: command.prompt,
|
|
41162
41245
|
resources: applied.resources,
|
|
41163
41246
|
sessionId: command.sessionId,
|
|
41164
|
-
signal
|
|
41247
|
+
signal,
|
|
41165
41248
|
targetCommandId: command.targetCommandId
|
|
41166
41249
|
});
|
|
41167
41250
|
stopReason = result.stopReason;
|
|
@@ -41189,9 +41272,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41189
41272
|
});
|
|
41190
41273
|
} catch (error62) {
|
|
41191
41274
|
activities.flush();
|
|
41192
|
-
const failure2 =
|
|
41193
|
-
cause: error62
|
|
41194
|
-
}) : error62;
|
|
41275
|
+
const failure2 = error62;
|
|
41195
41276
|
audit.record({
|
|
41196
41277
|
commandId: command.commandId,
|
|
41197
41278
|
details: {
|