@moxt-ai/mobius 0.0.39 → 0.0.40

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/index.js CHANGED
@@ -20829,6 +20829,7 @@ var BotSessionPromptCommand = class {
20829
20829
  commandId;
20830
20830
  conversationId;
20831
20831
  directoryId;
20832
+ disposition;
20832
20833
  executionCapabilityId;
20833
20834
  executionCapabilitySecret;
20834
20835
  executionDeadlineAt;
@@ -20841,13 +20842,15 @@ var BotSessionPromptCommand = class {
20841
20842
  resources;
20842
20843
  sessionConfigurations;
20843
20844
  sessionId;
20845
+ targetCommandId;
20844
20846
  turnId;
20845
- constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, sessionConfigurations = []) {
20847
+ constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, sessionConfigurations = [], disposition = SessionPromptDisposition.Reject, targetCommandId = "") {
20846
20848
  this.sessionId = sessionId;
20847
20849
  this.commandId = commandId;
20848
20850
  this.agentId = agentId;
20849
20851
  this.bindingId = bindingId;
20850
20852
  this.directoryId = directoryId2;
20853
+ this.disposition = disposition;
20851
20854
  this.additionalDirectoryIds = Object.freeze([...additionalDirectoryIds]);
20852
20855
  this.images = Object.freeze([...images]);
20853
20856
  this.resources = Object.freeze([...resources]);
@@ -20871,12 +20874,14 @@ var BotSessionPromptCommand = class {
20871
20874
  );
20872
20875
  this.replyRoute = replyRoute;
20873
20876
  this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
20877
+ this.targetCommandId = targetCommandId;
20874
20878
  }
20875
20879
  toJSON() {
20876
- const { sessionConfigurations, ...command } = this;
20880
+ const { disposition, sessionConfigurations, targetCommandId, ...command } = this;
20877
20881
  return {
20878
20882
  ...command,
20879
- ...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
20883
+ ...sessionConfigurations.length === 0 ? {} : { sessionConfigurations },
20884
+ ...disposition === SessionPromptDisposition.Reject ? {} : { disposition, targetCommandId }
20880
20885
  };
20881
20886
  }
20882
20887
  };
@@ -21170,11 +21175,26 @@ function decodeBotSessionPromptCommand(encoded) {
21170
21175
  "sessionId",
21171
21176
  "turnId"
21172
21177
  ],
21173
- ["sessionConfigurations"]
21178
+ ["disposition", "sessionConfigurations", "targetCommandId"]
21174
21179
  );
21175
21180
  if (value["kind"] !== BOT_SESSION_PROMPT_KIND) {
21176
21181
  throw new ProtocolMessageError("Invalid Bot Session prompt kind");
21177
21182
  }
21183
+ const rawDisposition = value["disposition"];
21184
+ let disposition;
21185
+ if (rawDisposition === void 0 || rawDisposition === SessionPromptDisposition.Reject) {
21186
+ disposition = SessionPromptDisposition.Reject;
21187
+ } else if (rawDisposition === SessionPromptDisposition.Queue) {
21188
+ disposition = SessionPromptDisposition.Queue;
21189
+ } else if (rawDisposition === SessionPromptDisposition.Steer) {
21190
+ disposition = SessionPromptDisposition.Steer;
21191
+ } else {
21192
+ throw new ProtocolMessageError("Invalid Bot Session prompt disposition");
21193
+ }
21194
+ const targetCommandId = value["targetCommandId"] === void 0 ? "" : readText2(value, "targetCommandId", 128, false);
21195
+ if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !IDENTIFIER_PATTERN3.test(targetCommandId)) {
21196
+ throw new ProtocolMessageError("Bot Session prompt disposition has an invalid target command");
21197
+ }
21178
21198
  return new BotSessionPromptCommand(
21179
21199
  readIdentifier2(value, "sessionId"),
21180
21200
  readIdentifier2(value, "commandId"),
@@ -21199,7 +21219,9 @@ function decodeBotSessionPromptCommand(encoded) {
21199
21219
  readDigest(value, "behaviorDigest"),
21200
21220
  readTargets(value, "allowedDeliveryTargets"),
21201
21221
  readReplyRoute(value["replyRoute"]),
21202
- readSessionConfigurations(value)
21222
+ readSessionConfigurations(value),
21223
+ disposition,
21224
+ targetCommandId
21203
21225
  );
21204
21226
  }
21205
21227
 
@@ -34381,10 +34403,11 @@ var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
34381
34403
  };
34382
34404
  var IncompatibleAdapter = class extends UnavailableInstalledAgent {
34383
34405
  code = "acp_incompatible";
34384
- message = "ACP adapter is incompatible";
34406
+ message;
34385
34407
  status = "incompatible_adapter";
34386
- constructor(specification, agent) {
34408
+ constructor(specification, agent, message) {
34387
34409
  super(specification, agent);
34410
+ this.message = message;
34388
34411
  }
34389
34412
  };
34390
34413
  var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
@@ -35109,6 +35132,9 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
35109
35132
  // src/agent-catalog/agents/grok-build-agent.ts
35110
35133
  import { realpath as realpath5 } from "node:fs/promises";
35111
35134
  import { isAbsolute as isAbsolute6, join as join8, relative as relative3, sep as sep3 } from "node:path";
35135
+ import {
35136
+ RequestError as RequestError2
35137
+ } from "@agentclientprotocol/sdk";
35112
35138
 
35113
35139
  // src/agent-installation/grok-managed-package.ts
35114
35140
  var GROK_BUILD_MANAGED_VERSION = "1.0.21";
@@ -35221,11 +35247,23 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
35221
35247
  };
35222
35248
  verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
35223
35249
  const capabilities = initialized.agentCapabilities ?? {};
35224
- const session = capabilities.sessionCapabilities;
35225
- if (capabilities.loadSession !== true || session?.close == null || session.list == null || session.resume == null || !(initialized.authMethods ?? []).some((method) => method.id === "xai.api_key" || method.id === "grok.com")) {
35226
- throw new AgentProbeError("acp_incompatible", "Grok Build reported an unsupported ACP capability set");
35250
+ if (capabilities.loadSession !== true) {
35251
+ throw new AgentProbeError("acp_incompatible", "Grok Build did not report ACP session loading");
35252
+ }
35253
+ const authMethods = initialized.authMethods ?? [];
35254
+ if (authMethods.length === 0) {
35255
+ throw new AgentProbeError("acp_incompatible", "Grok Build did not report an ACP authentication method");
35256
+ }
35257
+ try {
35258
+ await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
35259
+ } catch (cause) {
35260
+ const detail = cause instanceof RequestError2 ? `ACP error ${cause.code}: ${cause.message}` : cause instanceof Error ? `${cause.name}: ${cause.message}` : "unknown error";
35261
+ throw new AgentProbeError(
35262
+ "acp_incompatible",
35263
+ `Grok Build could not create an ACP session (${detail}; auth methods: ${authMethods.map(({ id }) => id).join(", ")})`,
35264
+ { cause }
35265
+ );
35227
35266
  }
35228
- await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
35229
35267
  };
35230
35268
  };
35231
35269
 
@@ -35768,7 +35806,7 @@ import {
35768
35806
  methods as methods6,
35769
35807
  ndJsonStream as ndJsonStream2,
35770
35808
  PROTOCOL_VERSION as PROTOCOL_VERSION2,
35771
- RequestError as RequestError2
35809
+ RequestError as RequestError3
35772
35810
  } from "@agentclientprotocol/sdk";
35773
35811
  var ACP_OUTPUT_LIMIT_BYTES = 1024 * 1024;
35774
35812
  var VerifiedAcpReadiness = class {
@@ -35917,7 +35955,7 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
35917
35955
  if (error62 instanceof AgentProbeError) {
35918
35956
  throw error62;
35919
35957
  }
35920
- if (error62 instanceof RequestError2 && error62.code === -32e3 && specification.authenticationCommand().length > 0) {
35958
+ if (error62 instanceof RequestError3 && error62.code === -32e3 && specification.authenticationCommand().length > 0) {
35921
35959
  throw new AgentProbeError("authentication_required", "Agent authentication is required", { cause: error62 });
35922
35960
  }
35923
35961
  throw new AgentProbeError("acp_incompatible", "ACP adapter initialization failed", { cause: error62 });
@@ -36154,7 +36192,7 @@ function integrationProbeFailure(specification, agent, error62) {
36154
36192
  if (error62.code === "authentication_required") {
36155
36193
  return new AuthenticationRequiredAgent(specification, agent);
36156
36194
  }
36157
- return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
36195
+ return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent, error62.message) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
36158
36196
  }
36159
36197
  if (error62 instanceof ProcessExecutionError) {
36160
36198
  const code = error62.code === "process_timeout" ? "adapter_probe_timeout" : "adapter_probe_failed";
@@ -37104,14 +37142,14 @@ var FixedInstallationExecutor = class {
37104
37142
  if (initialDiscovery instanceof MissingAgent) {
37105
37143
  throw new InstallationManagerError(
37106
37144
  "agent_not_installed",
37107
- `Install ${specification.label} on this machine, then try installing the integration again.`
37145
+ `Install ${specification.label} on this machine, then check local Agents again.`
37108
37146
  );
37109
37147
  }
37110
37148
  const verifiedAgent = await findVerifiedAgentExecutable(specification, discoveryOptions);
37111
37149
  if (verifiedAgent === null) {
37112
37150
  throw new InstallationManagerError(
37113
37151
  "agent_not_installed",
37114
- `Install ${specification.label} on this machine, then try installing the integration again.`
37152
+ `Install ${specification.label} on this machine, then check local Agents again.`
37115
37153
  );
37116
37154
  }
37117
37155
  const agent = verifiedAgent.executable;
@@ -40564,32 +40602,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
40564
40602
  }
40565
40603
  const attachments = await resolvePromptArtifacts(config2, command, signal);
40566
40604
  const applied = await applicator.apply(command, grant, attachments.resources, signal);
40567
- const lease = contexts.activate(command);
40568
- try {
40569
- const deadlineSignal = AbortSignal.timeout(remaining);
40570
- const executionSignal = AbortSignal.any([signal, deadlineSignal]);
40571
- const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
40572
- await sessions.prepareExecutionSession({
40573
- additionalDirectories: resolved.additionalDirectories,
40574
- agent,
40575
- cwd: resolved.cwd,
40576
- sessionId: command.sessionId,
40577
- signal: executionSignal
40578
- });
40579
- for (const selection of command.sessionConfigurations) {
40580
- await sessions.configureSession({
40581
- additionalDirectories: resolved.additionalDirectories,
40582
- agent,
40583
- booleanValue: selection.booleanValue,
40584
- configId: selection.configId,
40585
- cwd: resolved.cwd,
40586
- requestId: `cfg_${randomUUID6()}`,
40587
- sessionId: command.sessionId,
40588
- signal: executionSignal,
40589
- value: selection.value,
40590
- valueType: selection.valueType
40591
- });
40592
- }
40605
+ const deadlineSignal = AbortSignal.timeout(remaining);
40606
+ const executionSignal = AbortSignal.any([signal, deadlineSignal]);
40607
+ const startExecution = () => {
40593
40608
  audit.record({
40594
40609
  commandId: command.commandId,
40595
40610
  details: {
@@ -40614,56 +40629,106 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
40614
40629
  attemptId
40615
40630
  );
40616
40631
  activateAttempt();
40617
- const result = await sessions.runPrompt({
40632
+ };
40633
+ let stopReason = "steered";
40634
+ if (command.disposition === SessionPromptDisposition.Steer) {
40635
+ startExecution();
40636
+ await sessions.steerPrompt({
40618
40637
  additionalDirectories: resolved.additionalDirectories,
40619
- agent,
40638
+ agent: grant.agent,
40620
40639
  commandId: command.commandId,
40621
40640
  cwd: resolved.cwd,
40622
40641
  images: attachments.images,
40623
- onActivity: activities.record,
40624
- onText: (text3, messageId) => {
40625
- publisher.recordAttempt(
40626
- command.sessionId,
40627
- encodeAgentMessageDeltaEvent({
40628
- commandId: command.commandId,
40629
- kind: AGENT_MESSAGE_DELTA_KIND,
40630
- messageId,
40631
- sessionId: command.sessionId,
40632
- text: text3
40633
- }),
40634
- attemptId
40635
- );
40636
- return Promise.resolve();
40637
- },
40638
40642
  prompt: command.prompt,
40639
40643
  resources: applied.resources,
40640
40644
  sessionId: command.sessionId,
40641
- signal: executionSignal
40645
+ signal: executionSignal,
40646
+ targetCommandId: command.targetCommandId
40642
40647
  });
40643
- activities.flush();
40644
- publisher.recordAttempt(
40645
- command.sessionId,
40646
- encodeSessionCompletedEvent({
40648
+ } else {
40649
+ if (command.disposition === SessionPromptDisposition.Queue && !outbox.isTerminalExecution(command.targetCommandId, command.sessionId)) {
40650
+ throw new AcpExecutionError(
40651
+ "The queued Bot prompt target is unavailable",
40652
+ {},
40653
+ "prompt_queue_target_unavailable"
40654
+ );
40655
+ }
40656
+ const lease = contexts.activate(command);
40657
+ try {
40658
+ const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
40659
+ await sessions.prepareExecutionSession({
40660
+ additionalDirectories: resolved.additionalDirectories,
40661
+ agent,
40662
+ cwd: resolved.cwd,
40663
+ sessionId: command.sessionId,
40664
+ signal: executionSignal
40665
+ });
40666
+ for (const selection of command.sessionConfigurations) {
40667
+ await sessions.configureSession({
40668
+ additionalDirectories: resolved.additionalDirectories,
40669
+ agent,
40670
+ booleanValue: selection.booleanValue,
40671
+ configId: selection.configId,
40672
+ cwd: resolved.cwd,
40673
+ requestId: `cfg_${randomUUID6()}`,
40674
+ sessionId: command.sessionId,
40675
+ signal: executionSignal,
40676
+ value: selection.value,
40677
+ valueType: selection.valueType
40678
+ });
40679
+ }
40680
+ startExecution();
40681
+ const result = await sessions.runPrompt({
40682
+ additionalDirectories: resolved.additionalDirectories,
40683
+ agent,
40647
40684
  commandId: command.commandId,
40648
- kind: SESSION_COMPLETED_KIND,
40685
+ cwd: resolved.cwd,
40686
+ disposition: command.disposition,
40687
+ images: attachments.images,
40688
+ onActivity: activities.record,
40689
+ onText: (text3, messageId) => {
40690
+ publisher.recordAttempt(
40691
+ command.sessionId,
40692
+ encodeAgentMessageDeltaEvent({
40693
+ commandId: command.commandId,
40694
+ kind: AGENT_MESSAGE_DELTA_KIND,
40695
+ messageId,
40696
+ sessionId: command.sessionId,
40697
+ text: text3
40698
+ }),
40699
+ attemptId
40700
+ );
40701
+ return Promise.resolve();
40702
+ },
40703
+ prompt: command.prompt,
40704
+ resources: applied.resources,
40649
40705
  sessionId: command.sessionId,
40650
- stopReason: result.stopReason
40651
- }),
40652
- attemptId
40653
- );
40654
- outbox.transitionExecution(
40655
- command.commandId,
40656
- result.stopReason === "cancelled" ? "cancelled" : "succeeded"
40657
- );
40658
- audit.record({
40659
- commandId: command.commandId,
40660
- details: { botId: command.botId, executionId: command.executionId },
40661
- event: result.stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
40662
- sessionId: command.sessionId
40663
- });
40664
- } finally {
40665
- lease.release();
40706
+ signal: executionSignal,
40707
+ targetCommandId: command.targetCommandId
40708
+ });
40709
+ stopReason = result.stopReason;
40710
+ } finally {
40711
+ lease.release();
40712
+ }
40666
40713
  }
40714
+ activities.flush();
40715
+ publisher.recordAttempt(
40716
+ command.sessionId,
40717
+ encodeSessionCompletedEvent({
40718
+ commandId: command.commandId,
40719
+ kind: SESSION_COMPLETED_KIND,
40720
+ sessionId: command.sessionId,
40721
+ stopReason
40722
+ }),
40723
+ attemptId
40724
+ );
40725
+ outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
40726
+ audit.record({
40727
+ commandId: command.commandId,
40728
+ details: { botId: command.botId, executionId: command.executionId },
40729
+ event: stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
40730
+ sessionId: command.sessionId
40731
+ });
40667
40732
  } catch (error62) {
40668
40733
  activities.flush();
40669
40734
  const failure2 = Date.parse(command.executionDeadlineAt) <= Date.now() ? new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired", {
@@ -40914,7 +40979,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40914
40979
  await processDeliveredPrompt(
40915
40980
  delivery,
40916
40981
  command,
40917
- true,
40982
+ command.disposition !== SessionPromptDisposition.Steer,
40918
40983
  (attemptId, activateAttempt, executionSignal) => executeBotPrompt(
40919
40984
  outbox,
40920
40985
  publisher,
@@ -41567,7 +41632,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41567
41632
  applicator,
41568
41633
  ipc,
41569
41634
  receipt2.attemptId,
41570
- () => activeAttemptIds.set(command2.sessionId, receipt2.attemptId),
41635
+ () => {
41636
+ if (command2.disposition !== SessionPromptDisposition.Steer) {
41637
+ activeAttemptIds.set(command2.sessionId, receipt2.attemptId);
41638
+ }
41639
+ },
41571
41640
  timer,
41572
41641
  turn2.signal
41573
41642
  ).catch((error62) => {