@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/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.
|
|
14
|
+
version: "0.0.40",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -841,10 +841,11 @@ var IntegrationProbeFailed = class extends UnavailableInstalledAgent {
|
|
|
841
841
|
};
|
|
842
842
|
var IncompatibleAdapter = class extends UnavailableInstalledAgent {
|
|
843
843
|
code = "acp_incompatible";
|
|
844
|
-
message
|
|
844
|
+
message;
|
|
845
845
|
status = "incompatible_adapter";
|
|
846
|
-
constructor(specification, agent) {
|
|
846
|
+
constructor(specification, agent, message) {
|
|
847
847
|
super(specification, agent);
|
|
848
|
+
this.message = message;
|
|
848
849
|
}
|
|
849
850
|
};
|
|
850
851
|
var AuthenticationRequiredAgent = class extends UnavailableInstalledAgent {
|
|
@@ -1645,6 +1646,9 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1645
1646
|
// src/agent-catalog/agents/grok-build-agent.ts
|
|
1646
1647
|
import { realpath as realpath4 } from "node:fs/promises";
|
|
1647
1648
|
import { isAbsolute as isAbsolute4, join as join7, relative as relative2, sep as sep2 } from "node:path";
|
|
1649
|
+
import {
|
|
1650
|
+
RequestError
|
|
1651
|
+
} from "@agentclientprotocol/sdk";
|
|
1648
1652
|
|
|
1649
1653
|
// src/agent-installation/grok-managed-package.ts
|
|
1650
1654
|
var GROK_BUILD_MANAGED_VERSION = "1.0.21";
|
|
@@ -1757,11 +1761,23 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1757
1761
|
};
|
|
1758
1762
|
verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
|
|
1759
1763
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1764
|
+
if (capabilities.loadSession !== true) {
|
|
1765
|
+
throw new AgentProbeError("acp_incompatible", "Grok Build did not report ACP session loading");
|
|
1766
|
+
}
|
|
1767
|
+
const authMethods = initialized.authMethods ?? [];
|
|
1768
|
+
if (authMethods.length === 0) {
|
|
1769
|
+
throw new AgentProbeError("acp_incompatible", "Grok Build did not report an ACP authentication method");
|
|
1770
|
+
}
|
|
1771
|
+
try {
|
|
1772
|
+
await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
|
|
1773
|
+
} catch (cause) {
|
|
1774
|
+
const detail = cause instanceof RequestError ? `ACP error ${cause.code}: ${cause.message}` : cause instanceof Error ? `${cause.name}: ${cause.message}` : "unknown error";
|
|
1775
|
+
throw new AgentProbeError(
|
|
1776
|
+
"acp_incompatible",
|
|
1777
|
+
`Grok Build could not create an ACP session (${detail}; auth methods: ${authMethods.map(({ id }) => id).join(", ")})`,
|
|
1778
|
+
{ cause }
|
|
1779
|
+
);
|
|
1763
1780
|
}
|
|
1764
|
-
await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
|
|
1765
1781
|
};
|
|
1766
1782
|
};
|
|
1767
1783
|
|
|
@@ -2304,7 +2320,7 @@ import {
|
|
|
2304
2320
|
methods as methods4,
|
|
2305
2321
|
ndJsonStream,
|
|
2306
2322
|
PROTOCOL_VERSION,
|
|
2307
|
-
RequestError
|
|
2323
|
+
RequestError as RequestError2
|
|
2308
2324
|
} from "@agentclientprotocol/sdk";
|
|
2309
2325
|
|
|
2310
2326
|
// src/acp/create-client.ts
|
|
@@ -2482,7 +2498,7 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
|
|
|
2482
2498
|
if (error62 instanceof AgentProbeError) {
|
|
2483
2499
|
throw error62;
|
|
2484
2500
|
}
|
|
2485
|
-
if (error62 instanceof
|
|
2501
|
+
if (error62 instanceof RequestError2 && error62.code === -32e3 && specification.authenticationCommand().length > 0) {
|
|
2486
2502
|
throw new AgentProbeError("authentication_required", "Agent authentication is required", { cause: error62 });
|
|
2487
2503
|
}
|
|
2488
2504
|
throw new AgentProbeError("acp_incompatible", "ACP adapter initialization failed", { cause: error62 });
|
|
@@ -2719,7 +2735,7 @@ function integrationProbeFailure(specification, agent, error62) {
|
|
|
2719
2735
|
if (error62.code === "authentication_required") {
|
|
2720
2736
|
return new AuthenticationRequiredAgent(specification, agent);
|
|
2721
2737
|
}
|
|
2722
|
-
return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
|
|
2738
|
+
return error62.code === "acp_incompatible" ? new IncompatibleAdapter(specification, agent, error62.message) : new IntegrationProbeFailed(specification, agent, error62.code, error62.message);
|
|
2723
2739
|
}
|
|
2724
2740
|
if (error62 instanceof ProcessExecutionError) {
|
|
2725
2741
|
const code = error62.code === "process_timeout" ? "adapter_probe_timeout" : "adapter_probe_failed";
|
|
@@ -23824,6 +23840,7 @@ var BotSessionPromptCommand = class {
|
|
|
23824
23840
|
commandId;
|
|
23825
23841
|
conversationId;
|
|
23826
23842
|
directoryId;
|
|
23843
|
+
disposition;
|
|
23827
23844
|
executionCapabilityId;
|
|
23828
23845
|
executionCapabilitySecret;
|
|
23829
23846
|
executionDeadlineAt;
|
|
@@ -23836,13 +23853,15 @@ var BotSessionPromptCommand = class {
|
|
|
23836
23853
|
resources;
|
|
23837
23854
|
sessionConfigurations;
|
|
23838
23855
|
sessionId;
|
|
23856
|
+
targetCommandId;
|
|
23839
23857
|
turnId;
|
|
23840
|
-
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 = []) {
|
|
23858
|
+
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 = "") {
|
|
23841
23859
|
this.sessionId = sessionId;
|
|
23842
23860
|
this.commandId = commandId;
|
|
23843
23861
|
this.agentId = agentId;
|
|
23844
23862
|
this.bindingId = bindingId;
|
|
23845
23863
|
this.directoryId = directoryId2;
|
|
23864
|
+
this.disposition = disposition;
|
|
23846
23865
|
this.additionalDirectoryIds = Object.freeze([...additionalDirectoryIds]);
|
|
23847
23866
|
this.images = Object.freeze([...images]);
|
|
23848
23867
|
this.resources = Object.freeze([...resources]);
|
|
@@ -23866,12 +23885,14 @@ var BotSessionPromptCommand = class {
|
|
|
23866
23885
|
);
|
|
23867
23886
|
this.replyRoute = replyRoute;
|
|
23868
23887
|
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
23888
|
+
this.targetCommandId = targetCommandId;
|
|
23869
23889
|
}
|
|
23870
23890
|
toJSON() {
|
|
23871
|
-
const { sessionConfigurations, ...command } = this;
|
|
23891
|
+
const { disposition, sessionConfigurations, targetCommandId, ...command } = this;
|
|
23872
23892
|
return {
|
|
23873
23893
|
...command,
|
|
23874
|
-
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
|
|
23894
|
+
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations },
|
|
23895
|
+
...disposition === SessionPromptDisposition.Reject ? {} : { disposition, targetCommandId }
|
|
23875
23896
|
};
|
|
23876
23897
|
}
|
|
23877
23898
|
};
|
|
@@ -24165,11 +24186,26 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
24165
24186
|
"sessionId",
|
|
24166
24187
|
"turnId"
|
|
24167
24188
|
],
|
|
24168
|
-
["sessionConfigurations"]
|
|
24189
|
+
["disposition", "sessionConfigurations", "targetCommandId"]
|
|
24169
24190
|
);
|
|
24170
24191
|
if (value["kind"] !== BOT_SESSION_PROMPT_KIND) {
|
|
24171
24192
|
throw new ProtocolMessageError("Invalid Bot Session prompt kind");
|
|
24172
24193
|
}
|
|
24194
|
+
const rawDisposition = value["disposition"];
|
|
24195
|
+
let disposition;
|
|
24196
|
+
if (rawDisposition === void 0 || rawDisposition === SessionPromptDisposition.Reject) {
|
|
24197
|
+
disposition = SessionPromptDisposition.Reject;
|
|
24198
|
+
} else if (rawDisposition === SessionPromptDisposition.Queue) {
|
|
24199
|
+
disposition = SessionPromptDisposition.Queue;
|
|
24200
|
+
} else if (rawDisposition === SessionPromptDisposition.Steer) {
|
|
24201
|
+
disposition = SessionPromptDisposition.Steer;
|
|
24202
|
+
} else {
|
|
24203
|
+
throw new ProtocolMessageError("Invalid Bot Session prompt disposition");
|
|
24204
|
+
}
|
|
24205
|
+
const targetCommandId = value["targetCommandId"] === void 0 ? "" : readText2(value, "targetCommandId", 128, false);
|
|
24206
|
+
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !IDENTIFIER_PATTERN3.test(targetCommandId)) {
|
|
24207
|
+
throw new ProtocolMessageError("Bot Session prompt disposition has an invalid target command");
|
|
24208
|
+
}
|
|
24173
24209
|
return new BotSessionPromptCommand(
|
|
24174
24210
|
readIdentifier2(value, "sessionId"),
|
|
24175
24211
|
readIdentifier2(value, "commandId"),
|
|
@@ -24194,7 +24230,9 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
24194
24230
|
readDigest(value, "behaviorDigest"),
|
|
24195
24231
|
readTargets(value, "allowedDeliveryTargets"),
|
|
24196
24232
|
readReplyRoute(value["replyRoute"]),
|
|
24197
|
-
readSessionConfigurations(value)
|
|
24233
|
+
readSessionConfigurations(value),
|
|
24234
|
+
disposition,
|
|
24235
|
+
targetCommandId
|
|
24198
24236
|
);
|
|
24199
24237
|
}
|
|
24200
24238
|
|
|
@@ -25653,7 +25691,7 @@ import {
|
|
|
25653
25691
|
methods as methods6,
|
|
25654
25692
|
ndJsonStream as ndJsonStream2,
|
|
25655
25693
|
PROTOCOL_VERSION as PROTOCOL_VERSION2,
|
|
25656
|
-
RequestError as
|
|
25694
|
+
RequestError as RequestError3
|
|
25657
25695
|
} from "@agentclientprotocol/sdk";
|
|
25658
25696
|
|
|
25659
25697
|
// src/authorization/local-raster.ts
|
|
@@ -35886,7 +35924,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
35886
35924
|
]);
|
|
35887
35925
|
} catch (error62) {
|
|
35888
35926
|
signal.throwIfAborted();
|
|
35889
|
-
if (error62 instanceof
|
|
35927
|
+
if (error62 instanceof RequestError3 && error62.code === -32e3) {
|
|
35890
35928
|
throw new AcpExecutionError(
|
|
35891
35929
|
"Agent authentication is required",
|
|
35892
35930
|
{ cause: error62 },
|
|
@@ -37112,14 +37150,14 @@ var FixedInstallationExecutor = class {
|
|
|
37112
37150
|
if (initialDiscovery instanceof MissingAgent) {
|
|
37113
37151
|
throw new InstallationManagerError(
|
|
37114
37152
|
"agent_not_installed",
|
|
37115
|
-
`Install ${specification.label} on this machine, then
|
|
37153
|
+
`Install ${specification.label} on this machine, then check local Agents again.`
|
|
37116
37154
|
);
|
|
37117
37155
|
}
|
|
37118
37156
|
const verifiedAgent = await findVerifiedAgentExecutable(specification, discoveryOptions);
|
|
37119
37157
|
if (verifiedAgent === null) {
|
|
37120
37158
|
throw new InstallationManagerError(
|
|
37121
37159
|
"agent_not_installed",
|
|
37122
|
-
`Install ${specification.label} on this machine, then
|
|
37160
|
+
`Install ${specification.label} on this machine, then check local Agents again.`
|
|
37123
37161
|
);
|
|
37124
37162
|
}
|
|
37125
37163
|
const agent = verifiedAgent.executable;
|
|
@@ -40756,32 +40794,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40756
40794
|
}
|
|
40757
40795
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
40758
40796
|
const applied = await applicator.apply(command, grant, attachments.resources, signal);
|
|
40759
|
-
const
|
|
40760
|
-
|
|
40761
|
-
|
|
40762
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40763
|
-
const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
|
|
40764
|
-
await sessions.prepareExecutionSession({
|
|
40765
|
-
additionalDirectories: resolved.additionalDirectories,
|
|
40766
|
-
agent,
|
|
40767
|
-
cwd: resolved.cwd,
|
|
40768
|
-
sessionId: command.sessionId,
|
|
40769
|
-
signal: executionSignal
|
|
40770
|
-
});
|
|
40771
|
-
for (const selection of command.sessionConfigurations) {
|
|
40772
|
-
await sessions.configureSession({
|
|
40773
|
-
additionalDirectories: resolved.additionalDirectories,
|
|
40774
|
-
agent,
|
|
40775
|
-
booleanValue: selection.booleanValue,
|
|
40776
|
-
configId: selection.configId,
|
|
40777
|
-
cwd: resolved.cwd,
|
|
40778
|
-
requestId: `cfg_${randomUUID6()}`,
|
|
40779
|
-
sessionId: command.sessionId,
|
|
40780
|
-
signal: executionSignal,
|
|
40781
|
-
value: selection.value,
|
|
40782
|
-
valueType: selection.valueType
|
|
40783
|
-
});
|
|
40784
|
-
}
|
|
40797
|
+
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
40798
|
+
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40799
|
+
const startExecution = () => {
|
|
40785
40800
|
audit.record({
|
|
40786
40801
|
commandId: command.commandId,
|
|
40787
40802
|
details: {
|
|
@@ -40806,56 +40821,106 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40806
40821
|
attemptId
|
|
40807
40822
|
);
|
|
40808
40823
|
activateAttempt();
|
|
40809
|
-
|
|
40824
|
+
};
|
|
40825
|
+
let stopReason = "steered";
|
|
40826
|
+
if (command.disposition === SessionPromptDisposition.Steer) {
|
|
40827
|
+
startExecution();
|
|
40828
|
+
await sessions.steerPrompt({
|
|
40810
40829
|
additionalDirectories: resolved.additionalDirectories,
|
|
40811
|
-
agent,
|
|
40830
|
+
agent: grant.agent,
|
|
40812
40831
|
commandId: command.commandId,
|
|
40813
40832
|
cwd: resolved.cwd,
|
|
40814
40833
|
images: attachments.images,
|
|
40815
|
-
onActivity: activities.record,
|
|
40816
|
-
onText: (text3, messageId) => {
|
|
40817
|
-
publisher.recordAttempt(
|
|
40818
|
-
command.sessionId,
|
|
40819
|
-
encodeAgentMessageDeltaEvent({
|
|
40820
|
-
commandId: command.commandId,
|
|
40821
|
-
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40822
|
-
messageId,
|
|
40823
|
-
sessionId: command.sessionId,
|
|
40824
|
-
text: text3
|
|
40825
|
-
}),
|
|
40826
|
-
attemptId
|
|
40827
|
-
);
|
|
40828
|
-
return Promise.resolve();
|
|
40829
|
-
},
|
|
40830
40834
|
prompt: command.prompt,
|
|
40831
40835
|
resources: applied.resources,
|
|
40832
40836
|
sessionId: command.sessionId,
|
|
40833
|
-
signal: executionSignal
|
|
40837
|
+
signal: executionSignal,
|
|
40838
|
+
targetCommandId: command.targetCommandId
|
|
40834
40839
|
});
|
|
40835
|
-
|
|
40836
|
-
|
|
40837
|
-
|
|
40838
|
-
|
|
40840
|
+
} else {
|
|
40841
|
+
if (command.disposition === SessionPromptDisposition.Queue && !outbox.isTerminalExecution(command.targetCommandId, command.sessionId)) {
|
|
40842
|
+
throw new AcpExecutionError(
|
|
40843
|
+
"The queued Bot prompt target is unavailable",
|
|
40844
|
+
{},
|
|
40845
|
+
"prompt_queue_target_unavailable"
|
|
40846
|
+
);
|
|
40847
|
+
}
|
|
40848
|
+
const lease = contexts.activate(command);
|
|
40849
|
+
try {
|
|
40850
|
+
const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
|
|
40851
|
+
await sessions.prepareExecutionSession({
|
|
40852
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40853
|
+
agent,
|
|
40854
|
+
cwd: resolved.cwd,
|
|
40855
|
+
sessionId: command.sessionId,
|
|
40856
|
+
signal: executionSignal
|
|
40857
|
+
});
|
|
40858
|
+
for (const selection of command.sessionConfigurations) {
|
|
40859
|
+
await sessions.configureSession({
|
|
40860
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40861
|
+
agent,
|
|
40862
|
+
booleanValue: selection.booleanValue,
|
|
40863
|
+
configId: selection.configId,
|
|
40864
|
+
cwd: resolved.cwd,
|
|
40865
|
+
requestId: `cfg_${randomUUID6()}`,
|
|
40866
|
+
sessionId: command.sessionId,
|
|
40867
|
+
signal: executionSignal,
|
|
40868
|
+
value: selection.value,
|
|
40869
|
+
valueType: selection.valueType
|
|
40870
|
+
});
|
|
40871
|
+
}
|
|
40872
|
+
startExecution();
|
|
40873
|
+
const result = await sessions.runPrompt({
|
|
40874
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
40875
|
+
agent,
|
|
40839
40876
|
commandId: command.commandId,
|
|
40840
|
-
|
|
40877
|
+
cwd: resolved.cwd,
|
|
40878
|
+
disposition: command.disposition,
|
|
40879
|
+
images: attachments.images,
|
|
40880
|
+
onActivity: activities.record,
|
|
40881
|
+
onText: (text3, messageId) => {
|
|
40882
|
+
publisher.recordAttempt(
|
|
40883
|
+
command.sessionId,
|
|
40884
|
+
encodeAgentMessageDeltaEvent({
|
|
40885
|
+
commandId: command.commandId,
|
|
40886
|
+
kind: AGENT_MESSAGE_DELTA_KIND,
|
|
40887
|
+
messageId,
|
|
40888
|
+
sessionId: command.sessionId,
|
|
40889
|
+
text: text3
|
|
40890
|
+
}),
|
|
40891
|
+
attemptId
|
|
40892
|
+
);
|
|
40893
|
+
return Promise.resolve();
|
|
40894
|
+
},
|
|
40895
|
+
prompt: command.prompt,
|
|
40896
|
+
resources: applied.resources,
|
|
40841
40897
|
sessionId: command.sessionId,
|
|
40842
|
-
|
|
40843
|
-
|
|
40844
|
-
|
|
40845
|
-
|
|
40846
|
-
|
|
40847
|
-
|
|
40848
|
-
|
|
40849
|
-
);
|
|
40850
|
-
audit.record({
|
|
40851
|
-
commandId: command.commandId,
|
|
40852
|
-
details: { botId: command.botId, executionId: command.executionId },
|
|
40853
|
-
event: result.stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
|
|
40854
|
-
sessionId: command.sessionId
|
|
40855
|
-
});
|
|
40856
|
-
} finally {
|
|
40857
|
-
lease.release();
|
|
40898
|
+
signal: executionSignal,
|
|
40899
|
+
targetCommandId: command.targetCommandId
|
|
40900
|
+
});
|
|
40901
|
+
stopReason = result.stopReason;
|
|
40902
|
+
} finally {
|
|
40903
|
+
lease.release();
|
|
40904
|
+
}
|
|
40858
40905
|
}
|
|
40906
|
+
activities.flush();
|
|
40907
|
+
publisher.recordAttempt(
|
|
40908
|
+
command.sessionId,
|
|
40909
|
+
encodeSessionCompletedEvent({
|
|
40910
|
+
commandId: command.commandId,
|
|
40911
|
+
kind: SESSION_COMPLETED_KIND,
|
|
40912
|
+
sessionId: command.sessionId,
|
|
40913
|
+
stopReason
|
|
40914
|
+
}),
|
|
40915
|
+
attemptId
|
|
40916
|
+
);
|
|
40917
|
+
outbox.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
40918
|
+
audit.record({
|
|
40919
|
+
commandId: command.commandId,
|
|
40920
|
+
details: { botId: command.botId, executionId: command.executionId },
|
|
40921
|
+
event: stopReason === "cancelled" ? "bot_session_cancelled" : "bot_session_completed",
|
|
40922
|
+
sessionId: command.sessionId
|
|
40923
|
+
});
|
|
40859
40924
|
} catch (error62) {
|
|
40860
40925
|
activities.flush();
|
|
40861
40926
|
const failure2 = Date.parse(command.executionDeadlineAt) <= Date.now() ? new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired", {
|
|
@@ -40919,6 +40984,22 @@ async function publishAgentCatalogUntilAvailable(config2, diagnostics, signal, t
|
|
|
40919
40984
|
}
|
|
40920
40985
|
}
|
|
40921
40986
|
}
|
|
40987
|
+
async function installDetectedAgentIntegrations(config2, installations, signal) {
|
|
40988
|
+
for (const agent of config2.catalog.read().installableAgents) {
|
|
40989
|
+
if (!(agent instanceof AgentIntegrationDefinition)) {
|
|
40990
|
+
continue;
|
|
40991
|
+
}
|
|
40992
|
+
signal.throwIfAborted();
|
|
40993
|
+
await installations.request(
|
|
40994
|
+
{
|
|
40995
|
+
agentId: agent.id,
|
|
40996
|
+
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
40997
|
+
requestId: `automatic-integration-${randomUUID6()}`
|
|
40998
|
+
},
|
|
40999
|
+
signal
|
|
41000
|
+
);
|
|
41001
|
+
}
|
|
41002
|
+
}
|
|
40922
41003
|
async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, publisher, grants, contexts, applicator, ipc, activeTurns, activeAttemptIds, connectionEpoch, diagnostics, onConnected, signal, timer) {
|
|
40923
41004
|
const relayUrl = new URL(config2.relayUrl);
|
|
40924
41005
|
relayUrl.searchParams.set("deliveryReceipts", "1");
|
|
@@ -40926,11 +41007,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40926
41007
|
const socket = await connectRelay(relayUrl, signal);
|
|
40927
41008
|
const reconnectingTurns = [...activeTurns.values()];
|
|
40928
41009
|
diagnostics.connectionOpened(connectionEpoch);
|
|
40929
|
-
onConnected();
|
|
40930
41010
|
const connectionController = new AbortController();
|
|
40931
41011
|
const nativeRequests = /* @__PURE__ */ new Map();
|
|
40932
41012
|
const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
|
|
40933
41013
|
installationObserver.connect(socket);
|
|
41014
|
+
onConnected();
|
|
40934
41015
|
try {
|
|
40935
41016
|
await new Promise((resolve5, reject) => {
|
|
40936
41017
|
let finished = false;
|
|
@@ -41090,7 +41171,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41090
41171
|
await processDeliveredPrompt(
|
|
41091
41172
|
delivery,
|
|
41092
41173
|
command,
|
|
41093
|
-
|
|
41174
|
+
command.disposition !== SessionPromptDisposition.Steer,
|
|
41094
41175
|
(attemptId, activateAttempt, executionSignal) => executeBotPrompt(
|
|
41095
41176
|
outbox,
|
|
41096
41177
|
publisher,
|
|
@@ -41743,7 +41824,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41743
41824
|
applicator,
|
|
41744
41825
|
ipc,
|
|
41745
41826
|
receipt2.attemptId,
|
|
41746
|
-
() =>
|
|
41827
|
+
() => {
|
|
41828
|
+
if (command2.disposition !== SessionPromptDisposition.Steer) {
|
|
41829
|
+
activeAttemptIds.set(command2.sessionId, receipt2.attemptId);
|
|
41830
|
+
}
|
|
41831
|
+
},
|
|
41747
41832
|
timer,
|
|
41748
41833
|
turn2.signal
|
|
41749
41834
|
).catch((error62) => {
|
|
@@ -41886,9 +41971,24 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41886
41971
|
installationAudit
|
|
41887
41972
|
);
|
|
41888
41973
|
let connectionEpoch = 0;
|
|
41974
|
+
let automaticIntegrationProvisioningStarted = false;
|
|
41975
|
+
let automaticIntegrationProvisioning = Promise.resolve();
|
|
41889
41976
|
let connectionAnnounced = false;
|
|
41890
41977
|
let catalogPublished = false;
|
|
41891
41978
|
let readinessAnnounced = false;
|
|
41979
|
+
const startAutomaticIntegrationProvisioning = () => {
|
|
41980
|
+
if (!connectionAnnounced || !catalogPublished || automaticIntegrationProvisioningStarted) {
|
|
41981
|
+
return;
|
|
41982
|
+
}
|
|
41983
|
+
automaticIntegrationProvisioningStarted = true;
|
|
41984
|
+
automaticIntegrationProvisioning = installDetectedAgentIntegrations(config2, installations, signal).catch(
|
|
41985
|
+
(error62) => {
|
|
41986
|
+
if (!signal.aborted) {
|
|
41987
|
+
console.error("Mobius daemon could not automatically install detected Agent integrations", error62);
|
|
41988
|
+
}
|
|
41989
|
+
}
|
|
41990
|
+
);
|
|
41991
|
+
};
|
|
41892
41992
|
const announceReadiness = () => {
|
|
41893
41993
|
if (!connectionAnnounced || !catalogPublished || readinessAnnounced) {
|
|
41894
41994
|
return;
|
|
@@ -41910,6 +42010,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41910
42010
|
`
|
|
41911
42011
|
);
|
|
41912
42012
|
announceReadiness();
|
|
42013
|
+
startAutomaticIntegrationProvisioning();
|
|
41913
42014
|
};
|
|
41914
42015
|
const catalogPublication = publishAgentCatalogUntilAvailable(config2, diagnostics, signal, timer);
|
|
41915
42016
|
void catalogPublication.then(() => {
|
|
@@ -41918,6 +42019,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41918
42019
|
}
|
|
41919
42020
|
catalogPublished = true;
|
|
41920
42021
|
announceReadiness();
|
|
42022
|
+
startAutomaticIntegrationProvisioning();
|
|
41921
42023
|
});
|
|
41922
42024
|
try {
|
|
41923
42025
|
await ipc.listen(signal);
|
|
@@ -41964,24 +42066,28 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
41964
42066
|
await catalogPublication;
|
|
41965
42067
|
} finally {
|
|
41966
42068
|
try {
|
|
41967
|
-
await
|
|
42069
|
+
await automaticIntegrationProvisioning;
|
|
41968
42070
|
} finally {
|
|
41969
42071
|
try {
|
|
41970
|
-
await
|
|
42072
|
+
await installations.close();
|
|
41971
42073
|
} finally {
|
|
41972
42074
|
try {
|
|
41973
|
-
await
|
|
42075
|
+
await ipc.close();
|
|
41974
42076
|
} finally {
|
|
41975
42077
|
try {
|
|
41976
|
-
|
|
42078
|
+
await sessions.close();
|
|
41977
42079
|
} finally {
|
|
41978
42080
|
try {
|
|
41979
|
-
|
|
42081
|
+
sessionStore.close();
|
|
41980
42082
|
} finally {
|
|
41981
42083
|
try {
|
|
41982
|
-
|
|
42084
|
+
grants.close();
|
|
41983
42085
|
} finally {
|
|
41984
|
-
|
|
42086
|
+
try {
|
|
42087
|
+
publisher.close();
|
|
42088
|
+
} finally {
|
|
42089
|
+
outbox.close();
|
|
42090
|
+
}
|
|
41985
42091
|
}
|
|
41986
42092
|
}
|
|
41987
42093
|
}
|