@moxt-ai/mobius 0.0.38 → 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/agent-catalog/agent-discovery.d.ts +2 -2
- package/dist/agent-catalog/agent-discovery.d.ts.map +1 -1
- package/dist/agent-catalog/agent-discovery.js +3 -2
- package/dist/agent-catalog/agent-discovery.js.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.d.ts +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/grok-build-agent.js +18 -8
- package/dist/agent-catalog/agents/grok-build-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.js +1 -1
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-catalog/discover-local-agents.d.ts +0 -1
- package/dist/agent-catalog/discover-local-agents.d.ts.map +1 -1
- package/dist/agent-catalog/discover-local-agents.js +0 -1
- package/dist/agent-catalog/discover-local-agents.js.map +1 -1
- package/dist/agent-installation/fixed-installation-executor.js +2 -2
- package/dist/agent-installation/fixed-installation-executor.js.map +1 -1
- package/dist/cli.js +200 -94
- package/dist/cli.js.map +3 -3
- package/dist/index.js +197 -91
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +131 -66
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +199 -93
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
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
|
|
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
|
-
|
|
35225
|
-
|
|
35226
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
40568
|
-
|
|
40569
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40651
|
-
|
|
40652
|
-
|
|
40653
|
-
|
|
40654
|
-
|
|
40655
|
-
|
|
40656
|
-
|
|
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", {
|
|
@@ -40727,6 +40792,22 @@ async function publishAgentCatalogUntilAvailable(config2, diagnostics, signal, t
|
|
|
40727
40792
|
}
|
|
40728
40793
|
}
|
|
40729
40794
|
}
|
|
40795
|
+
async function installDetectedAgentIntegrations(config2, installations, signal) {
|
|
40796
|
+
for (const agent of config2.catalog.read().installableAgents) {
|
|
40797
|
+
if (!(agent instanceof AgentIntegrationDefinition)) {
|
|
40798
|
+
continue;
|
|
40799
|
+
}
|
|
40800
|
+
signal.throwIfAborted();
|
|
40801
|
+
await installations.request(
|
|
40802
|
+
{
|
|
40803
|
+
agentId: agent.id,
|
|
40804
|
+
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
40805
|
+
requestId: `automatic-integration-${randomUUID6()}`
|
|
40806
|
+
},
|
|
40807
|
+
signal
|
|
40808
|
+
);
|
|
40809
|
+
}
|
|
40810
|
+
}
|
|
40730
40811
|
async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, publisher, grants, contexts, applicator, ipc, activeTurns, activeAttemptIds, connectionEpoch, diagnostics, onConnected, signal, timer) {
|
|
40731
40812
|
const relayUrl = new URL(config2.relayUrl);
|
|
40732
40813
|
relayUrl.searchParams.set("deliveryReceipts", "1");
|
|
@@ -40734,11 +40815,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40734
40815
|
const socket = await connectRelay(relayUrl, signal);
|
|
40735
40816
|
const reconnectingTurns = [...activeTurns.values()];
|
|
40736
40817
|
diagnostics.connectionOpened(connectionEpoch);
|
|
40737
|
-
onConnected();
|
|
40738
40818
|
const connectionController = new AbortController();
|
|
40739
40819
|
const nativeRequests = /* @__PURE__ */ new Map();
|
|
40740
40820
|
const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
|
|
40741
40821
|
installationObserver.connect(socket);
|
|
40822
|
+
onConnected();
|
|
40742
40823
|
try {
|
|
40743
40824
|
await new Promise((resolve6, reject) => {
|
|
40744
40825
|
let finished = false;
|
|
@@ -40898,7 +40979,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40898
40979
|
await processDeliveredPrompt(
|
|
40899
40980
|
delivery,
|
|
40900
40981
|
command,
|
|
40901
|
-
|
|
40982
|
+
command.disposition !== SessionPromptDisposition.Steer,
|
|
40902
40983
|
(attemptId, activateAttempt, executionSignal) => executeBotPrompt(
|
|
40903
40984
|
outbox,
|
|
40904
40985
|
publisher,
|
|
@@ -41551,7 +41632,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41551
41632
|
applicator,
|
|
41552
41633
|
ipc,
|
|
41553
41634
|
receipt2.attemptId,
|
|
41554
|
-
() =>
|
|
41635
|
+
() => {
|
|
41636
|
+
if (command2.disposition !== SessionPromptDisposition.Steer) {
|
|
41637
|
+
activeAttemptIds.set(command2.sessionId, receipt2.attemptId);
|
|
41638
|
+
}
|
|
41639
|
+
},
|
|
41555
41640
|
timer,
|
|
41556
41641
|
turn2.signal
|
|
41557
41642
|
).catch((error62) => {
|
|
@@ -41694,9 +41779,24 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41694
41779
|
installationAudit
|
|
41695
41780
|
);
|
|
41696
41781
|
let connectionEpoch = 0;
|
|
41782
|
+
let automaticIntegrationProvisioningStarted = false;
|
|
41783
|
+
let automaticIntegrationProvisioning = Promise.resolve();
|
|
41697
41784
|
let connectionAnnounced = false;
|
|
41698
41785
|
let catalogPublished = false;
|
|
41699
41786
|
let readinessAnnounced = false;
|
|
41787
|
+
const startAutomaticIntegrationProvisioning = () => {
|
|
41788
|
+
if (!connectionAnnounced || !catalogPublished || automaticIntegrationProvisioningStarted) {
|
|
41789
|
+
return;
|
|
41790
|
+
}
|
|
41791
|
+
automaticIntegrationProvisioningStarted = true;
|
|
41792
|
+
automaticIntegrationProvisioning = installDetectedAgentIntegrations(config2, installations, signal).catch(
|
|
41793
|
+
(error62) => {
|
|
41794
|
+
if (!signal.aborted) {
|
|
41795
|
+
console.error("Mobius daemon could not automatically install detected Agent integrations", error62);
|
|
41796
|
+
}
|
|
41797
|
+
}
|
|
41798
|
+
);
|
|
41799
|
+
};
|
|
41700
41800
|
const announceReadiness = () => {
|
|
41701
41801
|
if (!connectionAnnounced || !catalogPublished || readinessAnnounced) {
|
|
41702
41802
|
return;
|
|
@@ -41718,6 +41818,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41718
41818
|
`
|
|
41719
41819
|
);
|
|
41720
41820
|
announceReadiness();
|
|
41821
|
+
startAutomaticIntegrationProvisioning();
|
|
41721
41822
|
};
|
|
41722
41823
|
const catalogPublication = publishAgentCatalogUntilAvailable(config2, diagnostics, signal, timer);
|
|
41723
41824
|
void catalogPublication.then(() => {
|
|
@@ -41726,6 +41827,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41726
41827
|
}
|
|
41727
41828
|
catalogPublished = true;
|
|
41728
41829
|
announceReadiness();
|
|
41830
|
+
startAutomaticIntegrationProvisioning();
|
|
41729
41831
|
});
|
|
41730
41832
|
try {
|
|
41731
41833
|
await ipc.listen(signal);
|
|
@@ -41772,24 +41874,28 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41772
41874
|
await catalogPublication;
|
|
41773
41875
|
} finally {
|
|
41774
41876
|
try {
|
|
41775
|
-
await
|
|
41877
|
+
await automaticIntegrationProvisioning;
|
|
41776
41878
|
} finally {
|
|
41777
41879
|
try {
|
|
41778
|
-
await
|
|
41880
|
+
await installations.close();
|
|
41779
41881
|
} finally {
|
|
41780
41882
|
try {
|
|
41781
|
-
await
|
|
41883
|
+
await ipc.close();
|
|
41782
41884
|
} finally {
|
|
41783
41885
|
try {
|
|
41784
|
-
|
|
41886
|
+
await sessions.close();
|
|
41785
41887
|
} finally {
|
|
41786
41888
|
try {
|
|
41787
|
-
|
|
41889
|
+
sessionStore.close();
|
|
41788
41890
|
} finally {
|
|
41789
41891
|
try {
|
|
41790
|
-
|
|
41892
|
+
grants.close();
|
|
41791
41893
|
} finally {
|
|
41792
|
-
|
|
41894
|
+
try {
|
|
41895
|
+
publisher.close();
|
|
41896
|
+
} finally {
|
|
41897
|
+
outbox.close();
|
|
41898
|
+
}
|
|
41793
41899
|
}
|
|
41794
41900
|
}
|
|
41795
41901
|
}
|