@plimsollmark/client 0.18.0 → 0.20.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/trigger.js CHANGED
@@ -3,9 +3,10 @@
3
3
  // sandbox. Warm in onTurnStart without blocking, reuse for every executeCode call,
4
4
  // dispose in onChatSuspend (right before the run sleeps) and in onComplete.
5
5
  //
6
- // The sandboxes live in this module's memory, keyed by run id; chat.local holds
7
- // only the run id, because Trigger.dev serializes chat.local into subtask
8
- // metadata and a session ID is a capability that must stay in this process.
6
+ // The sandboxes live in this module's memory, keyed by run id (and the run's owner,
7
+ // when warm names one); chat.local holds only the run id, because Trigger.dev
8
+ // serializes chat.local into subtask metadata, a session ID is a capability that must
9
+ // stay in this process, and the owner is a user's identity.
9
10
  import { chat } from "@trigger.dev/sdk/ai";
10
11
  import { tool } from "ai";
11
12
  import { CodeSandboxes } from "./sandboxes.js";
@@ -13,17 +14,29 @@ import { executeCodeDescription, executeCodeInput } from "./tool.js";
13
14
  export function plimsollCodeSandbox(opts) {
14
15
  const sandboxes = new CodeSandboxes(opts);
15
16
  const current = chat.local({ id: opts.localId ?? "plimsollCodeSandbox" });
16
- function warm(runId) {
17
+ // The owner warm named for each run, in this module's memory only.
18
+ const owners = new Map();
19
+ const keyOf = (runId) => {
20
+ const owner = owners.get(runId);
21
+ return owner === undefined ? runId : { owner, conversation: runId };
22
+ };
23
+ function warm(runId, owner) {
17
24
  current.init({ runId });
18
- sandboxes.warm(runId);
25
+ if (owner !== undefined)
26
+ owners.set(runId, owner);
27
+ sandboxes.warm(keyOf(runId));
19
28
  }
20
- function dispose(runId) {
21
- return sandboxes.dispose(runId);
29
+ async function dispose(runId) {
30
+ const key = keyOf(runId);
31
+ owners.delete(runId);
32
+ await sandboxes.dispose(key);
22
33
  }
23
34
  const executeCode = tool({
24
35
  description: executeCodeDescription(sandboxes.languages),
25
36
  inputSchema: executeCodeInput(sandboxes.languages),
26
- execute: async (input, { abortSignal }) => sandboxes.run(current.get().runId, input, abortSignal),
37
+ // The key is read inside run, so a turn whose onTurnStart never warmed (chat.local
38
+ // then has no run id) is refused as nothing ran, with the lead the model needs.
39
+ execute: async (input, { abortSignal }) => sandboxes.run(() => keyOf(current.get().runId), input, abortSignal),
27
40
  });
28
41
  return { executeCode, warm, dispose, sandboxes };
29
42
  }
package/dist/wire.d.ts CHANGED
@@ -153,6 +153,8 @@ export type WireDescribeResponse = {
153
153
  supportsSessions?: boolean;
154
154
  sessionLifetimeMs?: number;
155
155
  sessionIdleTimeoutMs?: number;
156
+ maxSessionsPerCaller?: number;
157
+ maxSessionsPerOwner?: number;
156
158
  sessionEnvironment?: WirePayloadEnvironment;
157
159
  };
158
160
  export type WireOpenSessionRequest = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plimsollmark/client",
3
- "version": "0.18.0",
4
- "description": "TypeScript client for plimsolld, with Trigger.dev and Mastra executeCode add-ons",
3
+ "version": "0.20.0",
4
+ "description": "TypeScript client for plimsolld, with AI SDK, Trigger.dev and Mastra executeCode add-ons",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/plimsollmark/plimsoll/tree/main/clients/typescript#readme",
7
7
  "repository": {
@@ -15,6 +15,7 @@
15
15
  "code-execution",
16
16
  "ai-agents",
17
17
  "trigger.dev",
18
+ "ai-sdk",
18
19
  "mastra",
19
20
  "code-interpreter"
20
21
  ],
@@ -24,6 +25,10 @@
24
25
  "types": "./dist/index.d.ts",
25
26
  "default": "./dist/index.js"
26
27
  },
28
+ "./ai-sdk": {
29
+ "types": "./dist/ai-sdk.d.ts",
30
+ "default": "./dist/ai-sdk.js"
31
+ },
27
32
  "./trigger": {
28
33
  "types": "./dist/trigger.d.ts",
29
34
  "default": "./dist/trigger.js"
@@ -49,10 +54,10 @@
49
54
  "test": "cd ../.. && go test ./clients/typescript/"
50
55
  },
51
56
  "peerDependencies": {
52
- "@mastra/core": ">=1.0.0 <2",
53
- "@trigger.dev/sdk": ">=4.5.0 <5",
54
- "ai": ">=6.0.0 <8",
55
- "zod": ">=3.25.0 <5"
57
+ "@mastra/core": ">=1.73.0 <2",
58
+ "@trigger.dev/sdk": ">=4.7.0 <5",
59
+ "ai": ">=7.0.126 <8",
60
+ "zod": ">=4.6.5 <5"
56
61
  },
57
62
  "peerDependenciesMeta": {
58
63
  "@mastra/core": {
@@ -75,5 +80,8 @@
75
80
  "ai": "^7.0.126",
76
81
  "typescript": "^7.0.2",
77
82
  "zod": "^4.6.5"
83
+ },
84
+ "overrides": {
85
+ "engine.io-client": "^6.6.7"
78
86
  }
79
87
  }