@dxos/agent-runtime 0.14.0 → 0.16.0
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/lib/chunk-AgentService.mjs +7 -5
- package/dist/lib/chunk-AgentService.mjs.map +1 -1
- package/dist/lib/index.mjs +1 -2
- package/dist/lib/testing.mjs +1 -1
- package/dist/lib/testing.mjs.map +1 -1
- package/dist/types/src/agent-service/AgentService.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/agent-service/AgentService.test.ts +41 -0
- package/src/agent-service/AgentService.ts +9 -4
|
@@ -3,6 +3,7 @@ import * as Effect from "effect/Effect";
|
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Atom from "effect/reactivity/Atom";
|
|
5
5
|
import * as Semaphore from "effect/Semaphore";
|
|
6
|
+
import { AiService, Model, OpaqueToolkit, SessionConfig } from "@dxos/ai";
|
|
6
7
|
import { AiContext, AiSession, Alarm, HarnessControl, SessionStore, SkillHooks, getOperationFromTool, makeToolExecutionService, makeToolResolverFromOperations } from "@dxos/assistant";
|
|
7
8
|
import * as Chat from "@dxos/assistant/Chat";
|
|
8
9
|
import * as AgentService from "@dxos/compute/AgentService";
|
|
@@ -21,7 +22,6 @@ import * as Exit from "effect/Exit";
|
|
|
21
22
|
import * as Option from "effect/Option";
|
|
22
23
|
import * as Schema from "effect/Schema";
|
|
23
24
|
import * as Struct from "effect/Struct";
|
|
24
|
-
import { AiService, Model, OpaqueToolkit } from "@dxos/ai";
|
|
25
25
|
import { OperationProcess } from "@dxos/compute-runtime";
|
|
26
26
|
import * as Credential from "@dxos/compute/Credential";
|
|
27
27
|
import * as McpServer from "@dxos/compute/McpServer";
|
|
@@ -1056,7 +1056,7 @@ var layer = (opts) => Layer.effect(AgentService.AgentService, Effect.gen(functio
|
|
|
1056
1056
|
log.warn("agent process not contributed; running the default", { key }, {
|
|
1057
1057
|
"~LogMeta": "~LogMeta",
|
|
1058
1058
|
F: __dxlog_file,
|
|
1059
|
-
L:
|
|
1059
|
+
L: 203,
|
|
1060
1060
|
S: this
|
|
1061
1061
|
});
|
|
1062
1062
|
return makeExecutable(provider);
|
|
@@ -1067,13 +1067,14 @@ var layer = (opts) => Layer.effect(AgentService.AgentService, Effect.gen(functio
|
|
|
1067
1067
|
getSession: (chat, options) => Effect.suspend(() => lockFor(chat.id).withPermits(1)(Effect.gen(function* () {
|
|
1068
1068
|
const provider = options?.provider ?? opts?.provider;
|
|
1069
1069
|
const model = chat.session?.model;
|
|
1070
|
+
const harness = SessionConfig.harnessOf(chat.session);
|
|
1070
1071
|
const instructions = chat.instructions?.uri;
|
|
1071
1072
|
const location = options?.location ?? "local";
|
|
1072
1073
|
const executable = executableFor(chat, provider);
|
|
1073
1074
|
if (location === "edge" && executable.key !== "org.dxos.testing.process.agent") return yield* Effect.die(/* @__PURE__ */ new Error(`Agent process ${executable.key} runs only locally, but the chat asked for edge.`));
|
|
1074
1075
|
const cached = sessionCache.get(chat.id);
|
|
1075
1076
|
if (cached) {
|
|
1076
|
-
if (cached.model === model && cached.provider === provider && cached.instructions === instructions && cached.location === location && cached.process === executable.key && !Process.isTerminal(cached.handle.status.state)) return cached.session;
|
|
1077
|
+
if (cached.model === model && cached.harness === harness && cached.provider === provider && cached.instructions === instructions && cached.location === location && cached.process === executable.key && !Process.isTerminal(cached.handle.status.state)) return cached.session;
|
|
1077
1078
|
if (!Process.isTerminal(cached.handle.status.state)) yield* cached.handle.terminate();
|
|
1078
1079
|
sessionCache.delete(chat.id);
|
|
1079
1080
|
}
|
|
@@ -1118,6 +1119,7 @@ var layer = (opts) => Layer.effect(AgentService.AgentService, Effect.gen(functio
|
|
|
1118
1119
|
const session = makeSession(handle, chat, feed, releaseSession, isFinished, resubmit);
|
|
1119
1120
|
sessionCache.set(chat.id, {
|
|
1120
1121
|
model,
|
|
1122
|
+
harness,
|
|
1121
1123
|
provider,
|
|
1122
1124
|
instructions,
|
|
1123
1125
|
location,
|
|
@@ -1154,7 +1156,7 @@ var layer = (opts) => Layer.effect(AgentService.AgentService, Effect.gen(functio
|
|
|
1154
1156
|
log("agent hydrate", { count: agents.length }, {
|
|
1155
1157
|
"~LogMeta": "~LogMeta",
|
|
1156
1158
|
F: __dxlog_file,
|
|
1157
|
-
L:
|
|
1159
|
+
L: 233,
|
|
1158
1160
|
S: this
|
|
1159
1161
|
});
|
|
1160
1162
|
for (const { agent, executable } of agents) yield* agent.hydrate(executable).pipe(Effect.catchCause((cause) => Effect.sync(() => log.warn("agent hydrate skipped", {
|
|
@@ -1163,7 +1165,7 @@ var layer = (opts) => Layer.effect(AgentService.AgentService, Effect.gen(functio
|
|
|
1163
1165
|
}, {
|
|
1164
1166
|
"~LogMeta": "~LogMeta",
|
|
1165
1167
|
F: __dxlog_file,
|
|
1166
|
-
L:
|
|
1168
|
+
L: 239,
|
|
1167
1169
|
S: this
|
|
1168
1170
|
}))));
|
|
1169
1171
|
})
|