@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/runtime.js
CHANGED
|
@@ -774,10 +774,11 @@ var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
|
|
|
774
774
|
};
|
|
775
775
|
var IncompatibleAdapter = class extends UnavailableInstalledAgent {
|
|
776
776
|
code = "acp_incompatible";
|
|
777
|
-
message
|
|
777
|
+
message;
|
|
778
778
|
status = "incompatible_adapter";
|
|
779
|
-
constructor(specification, agent) {
|
|
779
|
+
constructor(specification, agent, message) {
|
|
780
780
|
super(specification, agent);
|
|
781
|
+
this.message = message;
|
|
781
782
|
}
|
|
782
783
|
};
|
|
783
784
|
var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
|
|
@@ -1513,6 +1514,9 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1513
1514
|
// src/agent-catalog/agents/grok-build-agent.ts
|
|
1514
1515
|
import { realpath as realpath4 } from "node:fs/promises";
|
|
1515
1516
|
import { isAbsolute as isAbsolute4, join as join7, relative as relative2, sep as sep2 } from "node:path";
|
|
1517
|
+
import {
|
|
1518
|
+
RequestError
|
|
1519
|
+
} from "@agentclientprotocol/sdk";
|
|
1516
1520
|
|
|
1517
1521
|
// src/agent-installation/grok-managed-package.ts
|
|
1518
1522
|
var GROK_BUILD_MANAGED_VERSION = "1.0.21";
|
|
@@ -1625,11 +1629,23 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1625
1629
|
};
|
|
1626
1630
|
verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
|
|
1627
1631
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1632
|
+
if (capabilities.loadSession !== true) {
|
|
1633
|
+
throw new AgentProbeError("acp_incompatible", "Grok Build did not report ACP session loading");
|
|
1634
|
+
}
|
|
1635
|
+
const authMethods = initialized.authMethods ?? [];
|
|
1636
|
+
if (authMethods.length === 0) {
|
|
1637
|
+
throw new AgentProbeError("acp_incompatible", "Grok Build did not report an ACP authentication method");
|
|
1638
|
+
}
|
|
1639
|
+
try {
|
|
1640
|
+
await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
|
|
1641
|
+
} catch (cause) {
|
|
1642
|
+
const detail = cause instanceof RequestError ? `ACP error ${cause.code}: ${cause.message}` : cause instanceof Error ? `${cause.name}: ${cause.message}` : "unknown error";
|
|
1643
|
+
throw new AgentProbeError(
|
|
1644
|
+
"acp_incompatible",
|
|
1645
|
+
`Grok Build could not create an ACP session (${detail}; auth methods: ${authMethods.map(({ id }) => id).join(", ")})`,
|
|
1646
|
+
{ cause }
|
|
1647
|
+
);
|
|
1631
1648
|
}
|
|
1632
|
-
await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
|
|
1633
1649
|
};
|
|
1634
1650
|
};
|
|
1635
1651
|
|
|
@@ -2172,7 +2188,7 @@ import {
|
|
|
2172
2188
|
methods as methods4,
|
|
2173
2189
|
ndJsonStream,
|
|
2174
2190
|
PROTOCOL_VERSION,
|
|
2175
|
-
RequestError
|
|
2191
|
+
RequestError as RequestError2
|
|
2176
2192
|
} from "@agentclientprotocol/sdk";
|
|
2177
2193
|
|
|
2178
2194
|
// src/acp/create-client.ts
|
|
@@ -2350,7 +2366,7 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
|
|
|
2350
2366
|
if (error62 instanceof AgentProbeError) {
|
|
2351
2367
|
throw error62;
|
|
2352
2368
|
}
|
|
2353
|
-
if (error62 instanceof
|
|
2369
|
+
if (error62 instanceof RequestError2 && error62.code === -32e3 && specification.authenticationCommand().length > 0) {
|
|
2354
2370
|
throw new AgentProbeError("authentication_required", "Agent authentication is required", { cause: error62 });
|
|
2355
2371
|
}
|
|
2356
2372
|
throw new AgentProbeError("acp_incompatible", "ACP adapter initialization failed", { cause: error62 });
|
|
@@ -2587,7 +2603,7 @@ function integrationProbeFailure(specification, agent, error62) {
|
|
|
2587
2603
|
if (error62.code === "authentication_required") {
|
|
2588
2604
|
return new AuthenticationRequiredAgent(specification, agent);
|
|
2589
2605
|
}
|
|
2590
|
-
return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
|
|
2606
|
+
return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent, error62.message) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
|
|
2591
2607
|
}
|
|
2592
2608
|
if (error62 instanceof ProcessExecutionError) {
|
|
2593
2609
|
const code = error62.code === "process_timeout" ? "adapter_probe_timeout" : "adapter_probe_failed";
|
|
@@ -23571,6 +23587,7 @@ var BotSessionPromptCommand = class {
|
|
|
23571
23587
|
commandId;
|
|
23572
23588
|
conversationId;
|
|
23573
23589
|
directoryId;
|
|
23590
|
+
disposition;
|
|
23574
23591
|
executionCapabilityId;
|
|
23575
23592
|
executionCapabilitySecret;
|
|
23576
23593
|
executionDeadlineAt;
|
|
@@ -23583,13 +23600,15 @@ var BotSessionPromptCommand = class {
|
|
|
23583
23600
|
resources;
|
|
23584
23601
|
sessionConfigurations;
|
|
23585
23602
|
sessionId;
|
|
23603
|
+
targetCommandId;
|
|
23586
23604
|
turnId;
|
|
23587
|
-
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 = []) {
|
|
23605
|
+
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 = "") {
|
|
23588
23606
|
this.sessionId = sessionId;
|
|
23589
23607
|
this.commandId = commandId;
|
|
23590
23608
|
this.agentId = agentId;
|
|
23591
23609
|
this.bindingId = bindingId;
|
|
23592
23610
|
this.directoryId = directoryId2;
|
|
23611
|
+
this.disposition = disposition;
|
|
23593
23612
|
this.additionalDirectoryIds = Object.freeze([...additionalDirectoryIds]);
|
|
23594
23613
|
this.images = Object.freeze([...images]);
|
|
23595
23614
|
this.resources = Object.freeze([...resources]);
|
|
@@ -23613,12 +23632,14 @@ var BotSessionPromptCommand = class {
|
|
|
23613
23632
|
);
|
|
23614
23633
|
this.replyRoute = replyRoute;
|
|
23615
23634
|
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
23635
|
+
this.targetCommandId = targetCommandId;
|
|
23616
23636
|
}
|
|
23617
23637
|
toJSON() {
|
|
23618
|
-
const { sessionConfigurations, ...command } = this;
|
|
23638
|
+
const { disposition, sessionConfigurations, targetCommandId, ...command } = this;
|
|
23619
23639
|
return {
|
|
23620
23640
|
...command,
|
|
23621
|
-
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
|
|
23641
|
+
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations },
|
|
23642
|
+
...disposition === SessionPromptDisposition.Reject ? {} : { disposition, targetCommandId }
|
|
23622
23643
|
};
|
|
23623
23644
|
}
|
|
23624
23645
|
};
|
|
@@ -23912,11 +23933,26 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
23912
23933
|
"sessionId",
|
|
23913
23934
|
"turnId"
|
|
23914
23935
|
],
|
|
23915
|
-
["sessionConfigurations"]
|
|
23936
|
+
["disposition", "sessionConfigurations", "targetCommandId"]
|
|
23916
23937
|
);
|
|
23917
23938
|
if (value["kind"] !== BOT_SESSION_PROMPT_KIND) {
|
|
23918
23939
|
throw new ProtocolMessageError("Invalid Bot Session prompt kind");
|
|
23919
23940
|
}
|
|
23941
|
+
const rawDisposition = value["disposition"];
|
|
23942
|
+
let disposition;
|
|
23943
|
+
if (rawDisposition === void 0 || rawDisposition === SessionPromptDisposition.Reject) {
|
|
23944
|
+
disposition = SessionPromptDisposition.Reject;
|
|
23945
|
+
} else if (rawDisposition === SessionPromptDisposition.Queue) {
|
|
23946
|
+
disposition = SessionPromptDisposition.Queue;
|
|
23947
|
+
} else if (rawDisposition === SessionPromptDisposition.Steer) {
|
|
23948
|
+
disposition = SessionPromptDisposition.Steer;
|
|
23949
|
+
} else {
|
|
23950
|
+
throw new ProtocolMessageError("Invalid Bot Session prompt disposition");
|
|
23951
|
+
}
|
|
23952
|
+
const targetCommandId = value["targetCommandId"] === void 0 ? "" : readText2(value, "targetCommandId", 128, false);
|
|
23953
|
+
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !IDENTIFIER_PATTERN3.test(targetCommandId)) {
|
|
23954
|
+
throw new ProtocolMessageError("Bot Session prompt disposition has an invalid target command");
|
|
23955
|
+
}
|
|
23920
23956
|
return new BotSessionPromptCommand(
|
|
23921
23957
|
readIdentifier2(value, "sessionId"),
|
|
23922
23958
|
readIdentifier2(value, "commandId"),
|
|
@@ -23941,7 +23977,9 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
23941
23977
|
readDigest(value, "behaviorDigest"),
|
|
23942
23978
|
readTargets(value, "allowedDeliveryTargets"),
|
|
23943
23979
|
readReplyRoute(value["replyRoute"]),
|
|
23944
|
-
readSessionConfigurations(value)
|
|
23980
|
+
readSessionConfigurations(value),
|
|
23981
|
+
disposition,
|
|
23982
|
+
targetCommandId
|
|
23945
23983
|
);
|
|
23946
23984
|
}
|
|
23947
23985
|
|
|
@@ -24269,7 +24307,7 @@ import {
|
|
|
24269
24307
|
methods as methods6,
|
|
24270
24308
|
ndJsonStream as ndJsonStream2,
|
|
24271
24309
|
PROTOCOL_VERSION as PROTOCOL_VERSION2,
|
|
24272
|
-
RequestError as
|
|
24310
|
+
RequestError as RequestError3
|
|
24273
24311
|
} from "@agentclientprotocol/sdk";
|
|
24274
24312
|
|
|
24275
24313
|
// src/authorization/local-raster.ts
|
|
@@ -34502,7 +34540,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34502
34540
|
]);
|
|
34503
34541
|
} catch (error62) {
|
|
34504
34542
|
signal.throwIfAborted();
|
|
34505
|
-
if (error62 instanceof
|
|
34543
|
+
if (error62 instanceof RequestError3 && error62.code === -32e3) {
|
|
34506
34544
|
throw new AcpExecutionError(
|
|
34507
34545
|
"Agent authentication is required",
|
|
34508
34546
|
{ cause: error62 },
|
|
@@ -35728,14 +35766,14 @@ var FixedInstallationExecutor = class {
|
|
|
35728
35766
|
if (initialDiscovery instanceof MissingAgent) {
|
|
35729
35767
|
throw new InstallationManagerError(
|
|
35730
35768
|
"agent_not_installed",
|
|
35731
|
-
`Install ${specification.label} on this machine, then
|
|
35769
|
+
`Install ${specification.label} on this machine, then check local Agents again.`
|
|
35732
35770
|
);
|
|
35733
35771
|
}
|
|
35734
35772
|
const verifiedAgent = await findVerifiedAgentExecutable(specification, discoveryOptions);
|
|
35735
35773
|
if (verifiedAgent === null) {
|
|
35736
35774
|
throw new InstallationManagerError(
|
|
35737
35775
|
"agent_not_installed",
|
|
35738
|
-
`Install ${specification.label} on this machine, then
|
|
35776
|
+
`Install ${specification.label} on this machine, then check local Agents again.`
|
|
35739
35777
|
);
|
|
35740
35778
|
}
|
|
35741
35779
|
const agent = verifiedAgent.executable;
|
|
@@ -40008,32 +40046,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40008
40046
|
}
|
|
40009
40047
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
40010
40048
|
const applied = await applicator.apply(command, grant, attachments.resources, signal);
|
|
40011
|
-
const
|
|
40012
|
-
|
|
40013
|
-
|
|
40014
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40015
|
-
const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
|
|
40016
|
-
await sessions.prepareExecutionSession({
|
|
40017
|
-
additionalDirectories: resolved.additionalDirectories,
|
|
40018
|
-
agent,
|
|
40019
|
-
cwd: resolved.cwd,
|
|
40020
|
-
sessionId: command.sessionId,
|
|
40021
|
-
signal: executionSignal
|
|
40022
|
-
});
|
|
40023
|
-
for (const selection of command.sessionConfigurations) {
|
|
40024
|
-
await sessions.configureSession({
|
|
40025
|
-
additionalDirectories: resolved.additionalDirectories,
|
|
40026
|
-
agent,
|
|
40027
|
-
booleanValue: selection.booleanValue,
|
|
40028
|
-
configId: selection.configId,
|
|
40029
|
-
cwd: resolved.cwd,
|
|
40030
|
-
requestId: `cfg_${randomUUID4()}`,
|
|
40031
|
-
sessionId: command.sessionId,
|
|
40032
|
-
signal: executionSignal,
|
|
40033
|
-
value: selection.value,
|
|
40034
|
-
valueType: selection.valueType
|
|
40035
|
-
});
|
|
40036
|
-
}
|
|
40049
|
+
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
40050
|
+
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40051
|
+
const startExecution = () => {
|
|
40037
40052
|
audit.record({
|
|
40038
40053
|
commandId: command.commandId,
|
|
40039
40054
|
details: {
|
|
@@ -40058,56 +40073,106 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40058
40073
|
attemptId
|
|
40059
40074
|
);
|
|
40060
40075
|
activateAttempt();
|
|
40061
|
-
|
|
40076
|
+
};
|
|
40077
|
+
let stopReason = "steered";
|
|
40078
|
+
if (command.disposition === SessionPromptDisposition.Steer) {
|
|
40079
|
+
startExecution();
|
|
40080
|
+
await sessions.steerPrompt({
|
|
40062
40081
|
additionalDirectories: resolved.additionalDirectories,
|
|
40063
|
-
agent,
|
|
40082
|
+
agent: grant.agent,
|
|
40064
40083
|
commandId: command.commandId,
|
|
40065
40084
|
cwd: resolved.cwd,
|
|
40066
40085
|
images: attachments.images,
|
|
40067
|
-
onActivity: activities.record,
|
|
40068
|
-
onText: (text3, messageId) => {
|
|
40069
|
-
publisher.recordAttempt(
|
|
40070
|
-
command.sessionId,
|
|
40071
|
-
encodeAgentMessageDeltaEvent({
|
|
40072
|
-
commandId: command.commandId,
|
|
40073
|
-
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40074
|
-
messageId,
|
|
40075
|
-
sessionId: command.sessionId,
|
|
40076
|
-
text: text3
|
|
40077
|
-
}),
|
|
40078
|
-
attemptId
|
|
40079
|
-
);
|
|
40080
|
-
return Promise.resolve();
|
|
40081
|
-
},
|
|
40082
40086
|
prompt: command.prompt,
|
|
40083
40087
|
resources: applied.resources,
|
|
40084
40088
|
sessionId: command.sessionId,
|
|
40085
|
-
signal: executionSignal
|
|
40089
|
+
signal: executionSignal,
|
|
40090
|
+
targetCommandId: command.targetCommandId
|
|
40086
40091
|
});
|
|
40087
|
-
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
|
|
40092
|
+
} else {
|
|
40093
|
+
if (command.disposition === SessionPromptDisposition.Queue && !outbox.isTerminalExecution(command.targetCommandId, command.sessionId)) {
|
|
40094
|
+
throw new AcpExecutionError(
|
|
40095
|
+
"The queued Bot prompt target is unavailable",
|
|
40096
|
+
{},
|
|
40097
|
+
"prompt_queue_target_unavailable"
|
|
40098
|
+
);
|
|
40099
|
+
}
|
|
40100
|
+
const lease = contexts.activate(command);
|
|
40101
|
+
try {
|
|
40102
|
+
const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
|
|
40103
|
+
await sessions.prepareExecutionSession({
|
|
40104
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40105
|
+
agent,
|
|
40106
|
+
cwd: resolved.cwd,
|
|
40107
|
+
sessionId: command.sessionId,
|
|
40108
|
+
signal: executionSignal
|
|
40109
|
+
});
|
|
40110
|
+
for (const selection of command.sessionConfigurations) {
|
|
40111
|
+
await sessions.configureSession({
|
|
40112
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40113
|
+
agent,
|
|
40114
|
+
booleanValue: selection.booleanValue,
|
|
40115
|
+
configId: selection.configId,
|
|
40116
|
+
cwd: resolved.cwd,
|
|
40117
|
+
requestId: `cfg_${randomUUID4()}`,
|
|
40118
|
+
sessionId: command.sessionId,
|
|
40119
|
+
signal: executionSignal,
|
|
40120
|
+
value: selection.value,
|
|
40121
|
+
valueType: selection.valueType
|
|
40122
|
+
});
|
|
40123
|
+
}
|
|
40124
|
+
startExecution();
|
|
40125
|
+
const result = await sessions.runPrompt({
|
|
40126
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40127
|
+
agent,
|
|
40091
40128
|
commandId: command.commandId,
|
|
40092
|
-
|
|
40129
|
+
cwd: resolved.cwd,
|
|
40130
|
+
disposition: command.disposition,
|
|
40131
|
+
images: attachments.images,
|
|
40132
|
+
onActivity: activities.record,
|
|
40133
|
+
onText: (text3, messageId) => {
|
|
40134
|
+
publisher.recordAttempt(
|
|
40135
|
+
command.sessionId,
|
|
40136
|
+
encodeAgentMessageDeltaEvent({
|
|
40137
|
+
commandId: command.commandId,
|
|
40138
|
+
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40139
|
+
messageId,
|
|
40140
|
+
sessionId: command.sessionId,
|
|
40141
|
+
text: text3
|
|
40142
|
+
}),
|
|
40143
|
+
attemptId
|
|
40144
|
+
);
|
|
40145
|
+
return Promise.resolve();
|
|
40146
|
+
},
|
|
40147
|
+
prompt: command.prompt,
|
|
40148
|
+
resources: applied.resources,
|
|
40093
40149
|
sessionId: command.sessionId,
|
|
40094
|
-
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
|
|
40100
|
-
|
|
40101
|
-
);
|
|
40102
|
-
audit.record({
|
|
40103
|
-
commandId: command.commandId,
|
|
40104
|
-
details: { botId: command.botId, executionId: command.executionId },
|
|
40105
|
-
event: result.stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
|
|
40106
|
-
sessionId: command.sessionId
|
|
40107
|
-
});
|
|
40108
|
-
} finally {
|
|
40109
|
-
lease.release();
|
|
40150
|
+
signal: executionSignal,
|
|
40151
|
+
targetCommandId: command.targetCommandId
|
|
40152
|
+
});
|
|
40153
|
+
stopReason = result.stopReason;
|
|
40154
|
+
} finally {
|
|
40155
|
+
lease.release();
|
|
40156
|
+
}
|
|
40110
40157
|
}
|
|
40158
|
+
activities.flush();
|
|
40159
|
+
publisher.recordAttempt(
|
|
40160
|
+
command.sessionId,
|
|
40161
|
+
encodeSessionCompletedEvent({
|
|
40162
|
+
commandId: command.commandId,
|
|
40163
|
+
kind: SESSION_COMPLETED_KIND,
|
|
40164
|
+
sessionId: command.sessionId,
|
|
40165
|
+
stopReason
|
|
40166
|
+
}),
|
|
40167
|
+
attemptId
|
|
40168
|
+
);
|
|
40169
|
+
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
40170
|
+
audit.record({
|
|
40171
|
+
commandId: command.commandId,
|
|
40172
|
+
details: { botId: command.botId, executionId: command.executionId },
|
|
40173
|
+
event: stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
|
|
40174
|
+
sessionId: command.sessionId
|
|
40175
|
+
});
|
|
40111
40176
|
} catch (error62) {
|
|
40112
40177
|
activities.flush();
|
|
40113
40178
|
const failure2 = Date.parse(command.executionDeadlineAt) <= Date.now() ? new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired", {
|
|
@@ -40171,6 +40236,22 @@ async function publishAgentCatalogUntilAvailable(config2, diagnostics, signal, t
|
|
|
40171
40236
|
}
|
|
40172
40237
|
}
|
|
40173
40238
|
}
|
|
40239
|
+
async function installDetectedAgentIntegrations(config2, installations, signal) {
|
|
40240
|
+
for (const agent of config2.catalog.read().installableAgents) {
|
|
40241
|
+
if (!(agent instanceof AgentIntegrationDefinition)) {
|
|
40242
|
+
continue;
|
|
40243
|
+
}
|
|
40244
|
+
signal.throwIfAborted();
|
|
40245
|
+
await installations.request(
|
|
40246
|
+
{
|
|
40247
|
+
agentId: agent.id,
|
|
40248
|
+
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
40249
|
+
requestId: `automatic-integration-${randomUUID4()}`
|
|
40250
|
+
},
|
|
40251
|
+
signal
|
|
40252
|
+
);
|
|
40253
|
+
}
|
|
40254
|
+
}
|
|
40174
40255
|
async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, publisher, grants, contexts, applicator, ipc, activeTurns, activeAttemptIds, connectionEpoch, diagnostics, onConnected, signal, timer) {
|
|
40175
40256
|
const relayUrl = new URL(config2.relayUrl);
|
|
40176
40257
|
relayUrl.searchParams.set("deliveryReceipts", "1");
|
|
@@ -40178,11 +40259,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40178
40259
|
const socket = await connectRelay(relayUrl, signal);
|
|
40179
40260
|
const reconnectingTurns = [...activeTurns.values()];
|
|
40180
40261
|
diagnostics.connectionOpened(connectionEpoch);
|
|
40181
|
-
onConnected();
|
|
40182
40262
|
const connectionController = new AbortController();
|
|
40183
40263
|
const nativeRequests = /* @__PURE__ */ new Map();
|
|
40184
40264
|
const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
|
|
40185
40265
|
installationObserver.connect(socket);
|
|
40266
|
+
onConnected();
|
|
40186
40267
|
try {
|
|
40187
40268
|
await new Promise((resolve6, reject) => {
|
|
40188
40269
|
let finished = false;
|
|
@@ -40342,7 +40423,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40342
40423
|
await processDeliveredPrompt(
|
|
40343
40424
|
delivery,
|
|
40344
40425
|
command,
|
|
40345
|
-
|
|
40426
|
+
command.disposition !== SessionPromptDisposition.Steer,
|
|
40346
40427
|
(attemptId, activateAttempt, executionSignal) => executeBotPrompt(
|
|
40347
40428
|
outbox,
|
|
40348
40429
|
publisher,
|
|
@@ -40995,7 +41076,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40995
41076
|
applicator,
|
|
40996
41077
|
ipc,
|
|
40997
41078
|
receipt2.attemptId,
|
|
40998
|
-
() =>
|
|
41079
|
+
() => {
|
|
41080
|
+
if (command2.disposition !== SessionPromptDisposition.Steer) {
|
|
41081
|
+
activeAttemptIds.set(command2.sessionId, receipt2.attemptId);
|
|
41082
|
+
}
|
|
41083
|
+
},
|
|
40999
41084
|
timer,
|
|
41000
41085
|
turn2.signal
|
|
41001
41086
|
).catch((error62) => {
|
|
@@ -41138,9 +41223,24 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41138
41223
|
installationAudit
|
|
41139
41224
|
);
|
|
41140
41225
|
let connectionEpoch = 0;
|
|
41226
|
+
let automaticIntegrationProvisioningStarted = false;
|
|
41227
|
+
let automaticIntegrationProvisioning = Promise.resolve();
|
|
41141
41228
|
let connectionAnnounced = false;
|
|
41142
41229
|
let catalogPublished = false;
|
|
41143
41230
|
let readinessAnnounced = false;
|
|
41231
|
+
const startAutomaticIntegrationProvisioning = () => {
|
|
41232
|
+
if (!connectionAnnounced || !catalogPublished || automaticIntegrationProvisioningStarted) {
|
|
41233
|
+
return;
|
|
41234
|
+
}
|
|
41235
|
+
automaticIntegrationProvisioningStarted = true;
|
|
41236
|
+
automaticIntegrationProvisioning = installDetectedAgentIntegrations(config2, installations, signal).catch(
|
|
41237
|
+
(error62) => {
|
|
41238
|
+
if (!signal.aborted) {
|
|
41239
|
+
console.error("Mobius daemon could not automatically install detected Agent integrations", error62);
|
|
41240
|
+
}
|
|
41241
|
+
}
|
|
41242
|
+
);
|
|
41243
|
+
};
|
|
41144
41244
|
const announceReadiness = () => {
|
|
41145
41245
|
if (!connectionAnnounced || !catalogPublished || readinessAnnounced) {
|
|
41146
41246
|
return;
|
|
@@ -41162,6 +41262,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41162
41262
|
`
|
|
41163
41263
|
);
|
|
41164
41264
|
announceReadiness();
|
|
41265
|
+
startAutomaticIntegrationProvisioning();
|
|
41165
41266
|
};
|
|
41166
41267
|
const catalogPublication = publishAgentCatalogUntilAvailable(config2, diagnostics, signal, timer);
|
|
41167
41268
|
void catalogPublication.then(() => {
|
|
@@ -41170,6 +41271,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41170
41271
|
}
|
|
41171
41272
|
catalogPublished = true;
|
|
41172
41273
|
announceReadiness();
|
|
41274
|
+
startAutomaticIntegrationProvisioning();
|
|
41173
41275
|
});
|
|
41174
41276
|
try {
|
|
41175
41277
|
await ipc.listen(signal);
|
|
@@ -41216,24 +41318,28 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41216
41318
|
await catalogPublication;
|
|
41217
41319
|
} finally {
|
|
41218
41320
|
try {
|
|
41219
|
-
await
|
|
41321
|
+
await automaticIntegrationProvisioning;
|
|
41220
41322
|
} finally {
|
|
41221
41323
|
try {
|
|
41222
|
-
await
|
|
41324
|
+
await installations.close();
|
|
41223
41325
|
} finally {
|
|
41224
41326
|
try {
|
|
41225
|
-
await
|
|
41327
|
+
await ipc.close();
|
|
41226
41328
|
} finally {
|
|
41227
41329
|
try {
|
|
41228
|
-
|
|
41330
|
+
await sessions.close();
|
|
41229
41331
|
} finally {
|
|
41230
41332
|
try {
|
|
41231
|
-
|
|
41333
|
+
sessionStore.close();
|
|
41232
41334
|
} finally {
|
|
41233
41335
|
try {
|
|
41234
|
-
|
|
41336
|
+
grants.close();
|
|
41235
41337
|
} finally {
|
|
41236
|
-
|
|
41338
|
+
try {
|
|
41339
|
+
publisher.close();
|
|
41340
|
+
} finally {
|
|
41341
|
+
outbox.close();
|
|
41342
|
+
}
|
|
41237
41343
|
}
|
|
41238
41344
|
}
|
|
41239
41345
|
}
|