@caltra/backend-sdk 0.2.0 → 0.2.2
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/README.md +2 -1
- package/dist/protocol.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install --save-dev typescript tsx @types/node
|
|
|
15
15
|
cp node_modules/@caltra/backend-sdk/examples/quickstart.ts quickstart.ts
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
In Caltra, open **Backends → Add backend**.
|
|
18
|
+
In Caltra, open **Backends → Add backend**. Select its environment, then save the backend ID and one-time credential. All replicas share those credentials.
|
|
19
19
|
|
|
20
20
|
Create `backend.config.json` using your backend ID and credential:
|
|
21
21
|
|
|
@@ -49,6 +49,7 @@ import { BackendTool, CaltraBackendClient, type ToolContext } from "@caltra/back
|
|
|
49
49
|
|
|
50
50
|
- `BackendTool` takes a name, description, Zod input/output schemas, and `handler(context, inputs)`. Use JSON-Schema-compatible Zod schemas. Input and output validation happens locally and on Caltra.
|
|
51
51
|
- `new CaltraBackendClient({ url, backendId, credential, label, tools, maxConcurrency? })` creates a client. Default concurrency is 1; supported values are 1–100.
|
|
52
|
+
- Manifests support up to 1,000 uniquely named tools. SDK 0.2.2 and its matching Caltra API support encoded RPC frames up to 4 MiB, including document project data and HTML. Earlier SDKs and servers have a 1 MiB limit. Upgrade both endpoints together. SDK 0.2.1 also raises the tool-count bound from 100 to 1,000; older endpoints reject larger catalogs.
|
|
52
53
|
- `publish()` explicitly publishes definitions and returns `{ id, version, hash }`. It opens and closes its own connection. Identical current definitions reuse the version.
|
|
53
54
|
- `connect()` registers one replica against matching, already-published definitions. It returns `{ instanceId, manifest, heartbeatMs }` and starts transport heartbeats.
|
|
54
55
|
- `waitForDisconnect()` waits for that serving connection to close. The SDK does not reconnect automatically.
|
package/dist/protocol.js
CHANGED
|
@@ -6,7 +6,7 @@ export const ToolManifestSchema = z.object({
|
|
|
6
6
|
inputSchema: z.record(z.string(), z.unknown()),
|
|
7
7
|
outputSchema: z.record(z.string(), z.unknown()),
|
|
8
8
|
}).strict();
|
|
9
|
-
export const ManifestSchema = z.array(ToolManifestSchema).max(
|
|
9
|
+
export const ManifestSchema = z.array(ToolManifestSchema).max(1000).superRefine((tools, context) => {
|
|
10
10
|
if (new Set(tools.map(tool => tool.name)).size !== tools.length)
|
|
11
11
|
context.addIssue({ code: "custom", message: "Duplicate tool names." });
|
|
12
12
|
});
|
|
@@ -54,7 +54,8 @@ export class BackendProtocol {
|
|
|
54
54
|
return { ...call, context: LegacyCallContextSchema.parse(context) };
|
|
55
55
|
}
|
|
56
56
|
static path = "/backends/v1/connect";
|
|
57
|
-
|
|
57
|
+
// A document operation can carry both editor project data and rendered HTML.
|
|
58
|
+
static maxBytes = 4 * 1024 * 1024;
|
|
58
59
|
static heartbeatMs = 10000;
|
|
59
60
|
static leaseMs = 35000;
|
|
60
61
|
static callTimeoutMs = 15000;
|