@flue/sdk 0.5.0 → 0.5.1
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/client.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { u as discoverSessionContext } from "./result-K1IRhWKM.mjs";
|
|
2
2
|
import "./providers-BjEEoKLy.mjs";
|
|
3
|
-
import { a as assertRoleExists } from "./session-
|
|
3
|
+
import { a as assertRoleExists } from "./session-BQULcLE9.mjs";
|
|
4
4
|
import { bashFactoryToSessionEnv, createCwdSessionEnv } from "./sandbox.mjs";
|
|
5
|
-
import { n as Harness, t as connectMcpServer } from "./mcp-
|
|
5
|
+
import { n as Harness, t as connectMcpServer } from "./mcp-0-egKS1N.mjs";
|
|
6
6
|
import { Type } from "@mariozechner/pi-ai";
|
|
7
7
|
|
|
8
8
|
//#region src/client.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../result-K1IRhWKM.mjs";
|
|
2
2
|
import { c as CLOUDFLARE_AI_BINDING_API, n as getModelBinding } from "../providers-BjEEoKLy.mjs";
|
|
3
3
|
import { t as abortErrorFor } from "../abort-Bg3qsAkU.mjs";
|
|
4
|
-
import "../session-
|
|
4
|
+
import "../session-BQULcLE9.mjs";
|
|
5
5
|
import { createSandboxSessionEnv } from "../sandbox.mjs";
|
|
6
6
|
import { createAssistantMessageEventStream, parseStreamingJson } from "@mariozechner/pi-ai";
|
|
7
7
|
import { Workspace, WorkspaceFileSystem } from "@cloudflare/shell";
|
package/dist/internal.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./result-K1IRhWKM.mjs";
|
|
2
2
|
import { a as handleAgentRequest, i as handleRunRouteRequest, n as createDefaultFlueApp, t as configureFlueRuntime } from "./flue-app-SjL4I83Y.mjs";
|
|
3
3
|
import { r as getProviderConfiguration, s as resolveRegisteredModel } from "./providers-BjEEoKLy.mjs";
|
|
4
|
-
import { t as InMemorySessionStore } from "./session-
|
|
4
|
+
import { t as InMemorySessionStore } from "./session-BQULcLE9.mjs";
|
|
5
5
|
import { bashFactoryToSessionEnv } from "./sandbox.mjs";
|
|
6
|
-
import "./mcp-
|
|
6
|
+
import "./mcp-0-egKS1N.mjs";
|
|
7
7
|
import { createFlueContext } from "./client.mjs";
|
|
8
8
|
import { getModel } from "@mariozechner/pi-ai";
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as discoverSessionContext } from "./result-K1IRhWKM.mjs";
|
|
2
2
|
import { n as createCallHandle } from "./abort-Bg3qsAkU.mjs";
|
|
3
|
-
import { a as assertRoleExists, n as Session, r as deleteSessionTree } from "./session-
|
|
3
|
+
import { a as assertRoleExists, n as Session, r as deleteSessionTree } from "./session-BQULcLE9.mjs";
|
|
4
4
|
import { createCwdSessionEnv, createFlueFs } from "./sandbox.mjs";
|
|
5
5
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
6
6
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
@@ -52,6 +52,7 @@ var Harness = class {
|
|
|
52
52
|
return open;
|
|
53
53
|
}
|
|
54
54
|
const storageKey = createSessionStorageKey(this.instanceId, this.name, sessionName);
|
|
55
|
+
const affinityKey = createSessionAffinityKey(this.instanceId, this.name, sessionName);
|
|
55
56
|
const existingData = await this.store.load(storageKey);
|
|
56
57
|
if (mode === "get" && !existingData) throw new Error(`[flue] Session "${sessionName}" does not exist in harness "${this.name}".`);
|
|
57
58
|
if (mode === "create" && existingData) throw new Error(`[flue] Session "${sessionName}" already exists in harness "${this.name}".`);
|
|
@@ -63,6 +64,7 @@ var Harness = class {
|
|
|
63
64
|
const session = new Session({
|
|
64
65
|
name: sessionName,
|
|
65
66
|
storageKey,
|
|
67
|
+
affinityKey,
|
|
66
68
|
config: this.config,
|
|
67
69
|
env: this.env,
|
|
68
70
|
store: this.store,
|
|
@@ -97,6 +99,7 @@ var Harness = class {
|
|
|
97
99
|
skills: localContext.skills
|
|
98
100
|
};
|
|
99
101
|
const storageKey = createSessionStorageKey(this.instanceId, this.name, sessionName);
|
|
102
|
+
const affinityKey = createSessionAffinityKey(this.instanceId, this.name, sessionName);
|
|
100
103
|
const data = createEmptySessionData();
|
|
101
104
|
data.metadata = {
|
|
102
105
|
parentSession: options.parentSession,
|
|
@@ -117,6 +120,7 @@ var Harness = class {
|
|
|
117
120
|
return new Session({
|
|
118
121
|
name: sessionName,
|
|
119
122
|
storageKey,
|
|
123
|
+
affinityKey,
|
|
120
124
|
config: taskConfig,
|
|
121
125
|
env: taskEnv,
|
|
122
126
|
store: this.store,
|
|
@@ -147,6 +151,9 @@ function createSessionStorageKey(instanceId, harness, sessionName) {
|
|
|
147
151
|
sessionName
|
|
148
152
|
])}`;
|
|
149
153
|
}
|
|
154
|
+
function createSessionAffinityKey(instanceId, harness, sessionName) {
|
|
155
|
+
return `${instanceId}::${harness}::${sessionName}`;
|
|
156
|
+
}
|
|
150
157
|
function createEmptySessionData() {
|
|
151
158
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
152
159
|
return {
|
package/dist/sandbox.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./result-K1IRhWKM.mjs";
|
|
2
2
|
import "./providers-BjEEoKLy.mjs";
|
|
3
3
|
import { t as abortErrorFor } from "./abort-Bg3qsAkU.mjs";
|
|
4
|
-
import { i as normalizePath } from "./session-
|
|
4
|
+
import { i as normalizePath } from "./session-BQULcLE9.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/sandbox.ts
|
|
7
7
|
/** Adapt a SessionEnv to the public FlueFs surface. */
|
|
@@ -767,7 +767,8 @@ var Session = class {
|
|
|
767
767
|
},
|
|
768
768
|
getApiKey: (provider) => this.getProviderApiKey(provider),
|
|
769
769
|
onPayload: (payload, model) => this.applyProviderPayloadOverrides(payload, model),
|
|
770
|
-
toolExecution: "parallel"
|
|
770
|
+
toolExecution: "parallel",
|
|
771
|
+
sessionId: options.affinityKey
|
|
771
772
|
});
|
|
772
773
|
this.eventCallback = options.onAgentEvent;
|
|
773
774
|
this.harness.subscribe(async (event) => {
|