@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.
Files changed (33) hide show
  1. package/dist/acp/session-manager.d.ts +1 -0
  2. package/dist/acp/session-manager.d.ts.map +1 -1
  3. package/dist/acp/session-manager.js +27 -24
  4. package/dist/acp/session-manager.js.map +1 -1
  5. package/dist/agent-catalog/agent-specification.d.ts +0 -1
  6. package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
  7. package/dist/agent-catalog/agent-specification.js +0 -2
  8. package/dist/agent-catalog/agent-specification.js.map +1 -1
  9. package/dist/agent-catalog/agents/pi-agent.d.ts +0 -1
  10. package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
  11. package/dist/agent-catalog/agents/pi-agent.js +0 -2
  12. package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
  13. package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
  14. package/dist/agent-catalog/discover-agent.js +2 -2
  15. package/dist/agent-catalog/discover-agent.js.map +1 -1
  16. package/dist/agent-catalog/local-agent.d.ts +1 -2
  17. package/dist/agent-catalog/local-agent.d.ts.map +1 -1
  18. package/dist/agent-catalog/local-agent.js +2 -7
  19. package/dist/agent-catalog/local-agent.js.map +1 -1
  20. package/dist/bots/bot-execution-context.d.ts +0 -1
  21. package/dist/bots/bot-execution-context.d.ts.map +1 -1
  22. package/dist/bots/bot-execution-context.js +0 -7
  23. package/dist/bots/bot-execution-context.js.map +1 -1
  24. package/dist/cli.js +174 -82
  25. package/dist/cli.js.map +3 -3
  26. package/dist/index.js +173 -81
  27. package/dist/index.js.map +3 -3
  28. package/dist/run-daemon.d.ts.map +1 -1
  29. package/dist/run-daemon.js +89 -31
  30. package/dist/run-daemon.js.map +1 -1
  31. package/dist/runtime.js +173 -81
  32. package/dist/runtime.js.map +3 -3
  33. 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.46",
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
- promptTimeoutMilliseconds;
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();
@@ -34347,7 +34336,7 @@ var AcpProcessSession = class _AcpProcessSession {
34347
34336
  #preSessionUpdateBytes = 0;
34348
34337
  #agentName = "";
34349
34338
  #agentVersion = "";
34350
- #bufferedAgentText = null;
34339
+ #bufferedAgentText = [];
34351
34340
  #capabilities = {
34352
34341
  additionalDirectories: false,
34353
34342
  audioPrompt: false,
@@ -34536,20 +34525,30 @@ var AcpProcessSession = class _AcpProcessSession {
34536
34525
  });
34537
34526
  };
34538
34527
  bufferAgentText = async (text3, messageId) => {
34539
- if (this.#bufferedAgentText !== null && this.#bufferedAgentText.messageId !== messageId) {
34540
- await this.emitAgentMessage(this.#bufferedAgentText.chunks, this.#bufferedAgentText.messageId);
34541
- this.#bufferedAgentText = null;
34528
+ const previous2 = this.#bufferedAgentText.at(-1);
34529
+ if (previous2?.messageId === messageId) {
34530
+ this.#bufferedAgentText = [
34531
+ ...this.#bufferedAgentText.slice(0, -1),
34532
+ { chunks: [...previous2.chunks, text3], messageId }
34533
+ ];
34534
+ return;
34542
34535
  }
34543
- this.#bufferedAgentText = {
34544
- chunks: [...this.#bufferedAgentText?.chunks ?? [], text3],
34545
- messageId
34546
- };
34536
+ this.#bufferedAgentText = [...this.#bufferedAgentText, { chunks: [text3], messageId }];
34547
34537
  };
34548
34538
  flushAgentText = async () => {
34549
34539
  const buffered = this.#bufferedAgentText;
34550
- this.#bufferedAgentText = null;
34551
- if (buffered !== null) {
34552
- await this.emitAgentMessage(buffered.chunks, buffered.messageId);
34540
+ this.#bufferedAgentText = [];
34541
+ for (const message of buffered) {
34542
+ await this.emitAgentMessage(message.chunks, message.messageId);
34543
+ }
34544
+ };
34545
+ recordBufferedAgentTextAsProgress = async () => {
34546
+ const buffered = this.#bufferedAgentText;
34547
+ this.#bufferedAgentText = [];
34548
+ for (const message of buffered) {
34549
+ for (const chunk of message.chunks) {
34550
+ await this.#turn.activities.recordNarrative("progress", message.messageId, chunk);
34551
+ }
34553
34552
  }
34554
34553
  };
34555
34554
  prepareAgentContent = async (content3) => {
@@ -35063,7 +35062,7 @@ var AcpProcessSession = class _AcpProcessSession {
35063
35062
  cause: error62
35064
35063
  });
35065
35064
  } finally {
35066
- this.#bufferedAgentText = null;
35065
+ this.#bufferedAgentText = [];
35067
35066
  this.#turn = new IdleAcpTurn();
35068
35067
  }
35069
35068
  };
@@ -35378,6 +35377,7 @@ var AcpProcessSession = class _AcpProcessSession {
35378
35377
  return;
35379
35378
  }
35380
35379
  if (update.sessionUpdate === "tool_call") {
35380
+ await this.recordBufferedAgentTextAsProgress();
35381
35381
  await this.#turn.activities.recordToolCall(update);
35382
35382
  return;
35383
35383
  }
@@ -36223,7 +36223,7 @@ var AcpSessionManager = class {
36223
36223
  () => deadlineController.abort(
36224
36224
  new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
36225
36225
  ),
36226
- options.agent.promptTimeoutMilliseconds
36226
+ SESSION_CONTROL_TIMEOUT_MILLISECONDS
36227
36227
  );
36228
36228
  deadline.unref();
36229
36229
  try {
@@ -36248,28 +36248,13 @@ var AcpSessionManager = class {
36248
36248
  if (this.#activeSessionIds.has(options.sessionId)) {
36249
36249
  throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
36250
36250
  }
36251
- const deadlineController = new AbortController();
36252
- const deadlineError = new AcpExecutionError(
36253
- "The local Agent prompt exceeded its deadline",
36254
- {},
36255
- "prompt_timeout"
36256
- );
36257
- const deadline = setTimeout(
36258
- () => deadlineController.abort(deadlineError),
36259
- options.agent.promptTimeoutMilliseconds
36260
- );
36261
- deadline.unref();
36262
- const boundedOptions = {
36263
- ...options,
36264
- signal: AbortSignal.any([options.signal, deadlineController.signal])
36265
- };
36266
36251
  this.#activeSessionIds.add(options.sessionId);
36267
36252
  this.#activeCommandIds.set(options.sessionId, options.commandId);
36268
36253
  try {
36269
36254
  if (this.#cancellationRequests.has(options.sessionId)) {
36270
36255
  return { stopReason: "cancelled" };
36271
36256
  }
36272
- const runtime = await this.ensureSession(boundedOptions);
36257
+ const runtime = await this.ensureSession(options);
36273
36258
  if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
36274
36259
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
36275
36260
  }
@@ -36277,7 +36262,7 @@ var AcpSessionManager = class {
36277
36262
  return { stopReason: "cancelled" };
36278
36263
  }
36279
36264
  try {
36280
- const result = await runtime.prompt(boundedOptions);
36265
+ const result = await runtime.prompt(options);
36281
36266
  return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
36282
36267
  } catch (error62) {
36283
36268
  if (this.#cancellationRequests.has(options.sessionId)) {
@@ -36305,7 +36290,6 @@ var AcpSessionManager = class {
36305
36290
  cause: error62
36306
36291
  });
36307
36292
  } finally {
36308
- clearTimeout(deadline);
36309
36293
  try {
36310
36294
  await this.#cancellationRequests.get(options.sessionId);
36311
36295
  } finally {
@@ -37854,10 +37838,6 @@ var BotExecutionContextRegistry = class {
37854
37838
  #activeByHandle = /* @__PURE__ */ new Map();
37855
37839
  #handlesBySession = /* @__PURE__ */ new Map();
37856
37840
  #inactiveHandles = /* @__PURE__ */ new Set();
37857
- #now;
37858
- constructor(now = Date.now) {
37859
- this.#now = now;
37860
- }
37861
37841
  activate = (command) => {
37862
37842
  let handle = this.#handlesBySession.get(command.sessionId);
37863
37843
  if (handle === void 0) {
@@ -37891,12 +37871,6 @@ var BotExecutionContextRegistry = class {
37891
37871
  "An active Bot execution context is required"
37892
37872
  );
37893
37873
  }
37894
- if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
37895
- throw new LocalBotAuthorizationError(
37896
- "execution_capability_expired",
37897
- "The Bot execution capability has expired"
37898
- );
37899
- }
37900
37874
  return context;
37901
37875
  };
37902
37876
  };
@@ -40766,11 +40740,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
40766
40740
  } else {
40767
40741
  await applyCompleteSessionConfiguration(
40768
40742
  sessions,
40743
+ audit,
40769
40744
  prepared.configOptions,
40770
40745
  command.sessionConfigurations,
40771
40746
  agent,
40772
40747
  resolved.cwd,
40773
40748
  resolved.additionalDirectories,
40749
+ command.commandId,
40774
40750
  command.sessionId,
40775
40751
  signal
40776
40752
  );
@@ -40911,6 +40887,26 @@ function assertSessionConfigurationSchema(options, selections) {
40911
40887
  }
40912
40888
  }
40913
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
+ }
40914
40910
  function sessionConfigurationMatches(option2, selection) {
40915
40911
  validateSessionConfigurationSelection(option2, selection);
40916
40912
  return option2.type === "boolean" ? option2.booleanValue === selection.booleanValue : option2.currentValue === selection.value;
@@ -40941,11 +40937,92 @@ function assertCompleteSessionConfiguration(options, selections) {
40941
40937
  }
40942
40938
  }
40943
40939
  }
40944
- async function applySessionConfigurationSelection(sessions, options, selection, agent, cwd, additionalDirectories, sessionId, signal) {
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) {
40945
40968
  const option2 = options.find((candidate) => candidate.id === selection.configId);
40946
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
+ }
40947
40983
  throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
40948
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
+ }
40949
41026
  if (sessionConfigurationMatches(option2, selection)) {
40950
41027
  return options;
40951
41028
  }
@@ -40962,8 +41039,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
40962
41039
  valueType: selection.valueType
40963
41040
  });
40964
41041
  }
40965
- async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
40966
- assertSessionConfigurationSchema(initialOptions, selections);
41042
+ async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
41043
+ assertSessionConfigurationCoverage(initialOptions, selections);
40967
41044
  let options = initialOptions;
40968
41045
  const orderedSelections = selections.toSorted((left, right) => {
40969
41046
  const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
@@ -40972,16 +41049,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
40972
41049
  for (const selection of orderedSelections) {
40973
41050
  options = await applySessionConfigurationSelection(
40974
41051
  sessions,
41052
+ audit,
40975
41053
  options,
40976
41054
  selection,
40977
41055
  agent,
40978
41056
  cwd,
40979
41057
  additionalDirectories,
41058
+ commandId,
40980
41059
  sessionId,
40981
41060
  signal
40982
41061
  );
40983
41062
  }
40984
- assertCompleteSessionConfiguration(options, selections);
41063
+ assertAppliedSessionConfiguration(options, selections);
40985
41064
  }
40986
41065
  function botExecutionAgent(agent, contextHandle, socketPath) {
40987
41066
  return new LocalAgentDefinition(
@@ -41000,7 +41079,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
41000
41079
  agent.agentVersion,
41001
41080
  agent.adapterIdentity,
41002
41081
  agent.agentIdentity,
41003
- agent.promptTimeoutMilliseconds,
41004
41082
  agent.capabilities,
41005
41083
  agent.permissionProfile
41006
41084
  );
@@ -41015,7 +41093,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
41015
41093
  );
41016
41094
  }
41017
41095
  }
41018
- function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selection, category, reason) {
41096
+ function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
41019
41097
  const details = {
41020
41098
  agentId,
41021
41099
  category,
@@ -41023,7 +41101,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
41023
41101
  reason,
41024
41102
  requestedValue: selection.value
41025
41103
  };
41026
- const event = "bot_execution_setting_ignored";
41027
41104
  audit.record({ commandId, details, event, sessionId });
41028
41105
  process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
41029
41106
  `);
@@ -41034,12 +41111,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
41034
41111
  }
41035
41112
  const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
41036
41113
  if (option2 === void 0) {
41037
- warnIgnoredExecutionSetting(audit, commandId, sessionId, agent.id, selection, category, "setting_unavailable");
41114
+ warnIgnoredSetting(
41115
+ audit,
41116
+ "bot_execution_setting_ignored",
41117
+ commandId,
41118
+ sessionId,
41119
+ agent.id,
41120
+ selection,
41121
+ category,
41122
+ "setting_unavailable"
41123
+ );
41038
41124
  return configOptions;
41039
41125
  }
41040
41126
  if (option2.type !== "select" || option2.category !== category) {
41041
- warnIgnoredExecutionSetting(
41127
+ warnIgnoredSetting(
41042
41128
  audit,
41129
+ "bot_execution_setting_ignored",
41043
41130
  commandId,
41044
41131
  sessionId,
41045
41132
  agent.id,
@@ -41050,8 +41137,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
41050
41137
  return configOptions;
41051
41138
  }
41052
41139
  if (selection.valueType !== "select" || selection.booleanValue) {
41053
- warnIgnoredExecutionSetting(
41140
+ warnIgnoredSetting(
41054
41141
  audit,
41142
+ "bot_execution_setting_ignored",
41055
41143
  commandId,
41056
41144
  sessionId,
41057
41145
  agent.id,
@@ -41062,7 +41150,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
41062
41150
  return configOptions;
41063
41151
  }
41064
41152
  if (!option2.values.some((value) => value.value === selection.value)) {
41065
- warnIgnoredExecutionSetting(audit, commandId, sessionId, agent.id, selection, category, "value_unavailable");
41153
+ warnIgnoredSetting(
41154
+ audit,
41155
+ "bot_execution_setting_ignored",
41156
+ commandId,
41157
+ sessionId,
41158
+ agent.id,
41159
+ selection,
41160
+ category,
41161
+ "value_unavailable"
41162
+ );
41066
41163
  return configOptions;
41067
41164
  }
41068
41165
  if (option2.currentValue === selection.value) {
@@ -41086,10 +41183,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41086
41183
  publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
41087
41184
  });
41088
41185
  try {
41089
- const deadline = Date.parse(command.executionDeadlineAt);
41090
- const remaining = deadline - Date.now();
41091
- if (!Number.isSafeInteger(deadline) || remaining <= 0) {
41092
- 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");
41093
41189
  }
41094
41190
  const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
41095
41191
  const resolved = await resolveSessionDirectories(
@@ -41101,8 +41197,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41101
41197
  );
41102
41198
  const attachments = await resolvePromptArtifacts(config2, command, signal);
41103
41199
  const applied = await applicator.apply(command, execution, attachments.resources, signal);
41104
- const deadlineSignal = AbortSignal.timeout(remaining);
41105
- const executionSignal = AbortSignal.any([signal, deadlineSignal]);
41106
41200
  const startExecution = () => {
41107
41201
  audit.record({
41108
41202
  commandId: command.commandId,
@@ -41140,7 +41234,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41140
41234
  prompt: command.prompt,
41141
41235
  resources: applied.resources,
41142
41236
  sessionId: command.sessionId,
41143
- signal: executionSignal,
41237
+ signal,
41144
41238
  targetCommandId: command.targetCommandId
41145
41239
  });
41146
41240
  } else {
@@ -41159,7 +41253,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41159
41253
  agent,
41160
41254
  cwd: resolved.cwd,
41161
41255
  sessionId: command.sessionId,
41162
- signal: executionSignal
41256
+ signal
41163
41257
  });
41164
41258
  assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
41165
41259
  let configOptions = await applySupportedExecutionSelection(
@@ -41173,7 +41267,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41173
41267
  resolved.additionalDirectories,
41174
41268
  command.commandId,
41175
41269
  command.sessionId,
41176
- executionSignal
41270
+ signal
41177
41271
  );
41178
41272
  configOptions = await applySupportedExecutionSelection(
41179
41273
  sessions,
@@ -41186,7 +41280,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41186
41280
  resolved.additionalDirectories,
41187
41281
  command.commandId,
41188
41282
  command.sessionId,
41189
- executionSignal
41283
+ signal
41190
41284
  );
41191
41285
  for (const selection of command.sessionConfigurations) {
41192
41286
  await sessions.configureSession({
@@ -41197,7 +41291,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41197
41291
  cwd: resolved.cwd,
41198
41292
  requestId: `cfg_${randomUUID5()}`,
41199
41293
  sessionId: command.sessionId,
41200
- signal: executionSignal,
41294
+ signal,
41201
41295
  value: selection.value,
41202
41296
  valueType: selection.valueType
41203
41297
  });
@@ -41228,7 +41322,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41228
41322
  prompt: command.prompt,
41229
41323
  resources: applied.resources,
41230
41324
  sessionId: command.sessionId,
41231
- signal: executionSignal,
41325
+ signal,
41232
41326
  targetCommandId: command.targetCommandId
41233
41327
  });
41234
41328
  stopReason = result.stopReason;
@@ -41256,9 +41350,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
41256
41350
  });
41257
41351
  } catch (error62) {
41258
41352
  activities.flush();
41259
- const failure2 = Date.parse(command.executionDeadlineAt) <= Date.now() ? new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired", {
41260
- cause: error62
41261
- }) : error62;
41353
+ const failure2 = error62;
41262
41354
  audit.record({
41263
41355
  commandId: command.commandId,
41264
41356
  details: {