@softr/sdk 0.0.89-alpha.3 → 0.0.89
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/auth/platform.js +1 -1
- package/dist/core/file-upload.js +3 -2
- package/dist/core/workflow.js +5 -4
- package/dist/datasource/record.js +1 -1
- package/dist/fetch.js +63 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -4
- package/dist/locale-settings.js +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +3 -5
- package/dist/package.js +1 -1
- package/dist/pwa.js +2 -2
- package/package.json +1 -1
- package/skills/softr-sdk/SKILL.md +1 -5
- package/skills/softr-sdk/auth/SKILL.md +1 -1
- package/skills/softr-sdk/charts-and-metrics/SKILL.md +1 -1
- package/skills/softr-sdk/current-user/SKILL.md +1 -1
- package/skills/softr-sdk/file-uploads/SKILL.md +1 -1
- package/skills/softr-sdk/formatting/SKILL.md +1 -1
- package/skills/softr-sdk/integrations/SKILL.md +1 -1
- package/skills/softr-sdk/mcp/SKILL.md +1 -1
- package/skills/softr-sdk/pwa/SKILL.md +1 -1
- package/skills/softr-sdk/record-mutations/SKILL.md +1 -1
- package/skills/softr-sdk/record-queries/SKILL.md +1 -1
- package/skills/softr-sdk/region-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/routes-and-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/workflows/SKILL.md +1 -1
- package/dist/agent/agent-fns.d.ts +0 -30
- package/dist/agent/agent-fns.js +0 -215
- package/dist/agent/use-agent-chat.d.ts +0 -106
- package/dist/agent/use-agent-chat.js +0 -486
- package/skills/softr-sdk/agent-chat/SKILL.md +0 -125
package/dist/auth/platform.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert, panic } from "../assertions.js";
|
|
2
|
+
import { softrApiUrl } from "../softr-api.js";
|
|
2
3
|
import { fetch } from "../fetch.js";
|
|
3
4
|
import { softrConfig } from "../softr-config.js";
|
|
4
5
|
import { permissionsSchema } from "./permissions.js";
|
|
5
|
-
import { softrApiUrl } from "../softr-api.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
8
|
//#region src/auth/platform.ts
|
package/dist/core/file-upload.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { softrApiUrl } from "../softr-api.js";
|
|
1
2
|
import { fetch } from "../fetch.js";
|
|
2
3
|
import { sessionConfig } from "../auth/config.js";
|
|
3
4
|
import { readSessionToken } from "../auth/session.js";
|
|
4
|
-
import {
|
|
5
|
+
import { describeFailure } from "../datasource/record.js";
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
7
|
|
|
7
8
|
//#region src/core/file-upload.ts
|
|
@@ -18,7 +19,7 @@ async function upload(action, file) {
|
|
|
18
19
|
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
19
20
|
body: formData
|
|
20
21
|
});
|
|
21
|
-
if (!res.ok) throw new Error(`File upload failed: ${res
|
|
22
|
+
if (!res.ok) throw new Error(`File upload failed: ${await describeFailure(res)}`);
|
|
22
23
|
const resultJSON = await res.json();
|
|
23
24
|
return {
|
|
24
25
|
url: resultJSON.url,
|
package/dist/core/workflow.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { softrApiUrl } from "../softr-api.js";
|
|
1
2
|
import { fetch } from "../fetch.js";
|
|
2
3
|
import { sessionConfig } from "../auth/config.js";
|
|
3
4
|
import { readSessionToken } from "../auth/session.js";
|
|
4
|
-
import {
|
|
5
|
+
import { describeFailure } from "../datasource/record.js";
|
|
5
6
|
|
|
6
7
|
//#region src/core/workflow.ts
|
|
7
8
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -14,7 +15,7 @@ async function triggerWorkflow(action, payload) {
|
|
|
14
15
|
},
|
|
15
16
|
body: JSON.stringify({ input: payload ?? {} })
|
|
16
17
|
});
|
|
17
|
-
if (!triggerRes.ok) throw new Error(`Workflow trigger failed: ${triggerRes
|
|
18
|
+
if (!triggerRes.ok) throw new Error(`Workflow trigger failed: ${await describeFailure(triggerRes)}`);
|
|
18
19
|
let details = await triggerRes.json();
|
|
19
20
|
while (details.status !== "FINISHED") {
|
|
20
21
|
if (details.status === "PENDING_INTERACTION") for (const interaction of details.nextInteractions) {
|
|
@@ -23,11 +24,11 @@ async function triggerWorkflow(action, payload) {
|
|
|
23
24
|
headers: { "Content-Type": "application/json" },
|
|
24
25
|
body: "{}"
|
|
25
26
|
});
|
|
26
|
-
if (!interactionRes.ok) throw new Error(`Workflow interaction failed: ${interactionRes
|
|
27
|
+
if (!interactionRes.ok) throw new Error(`Workflow interaction failed: ${await describeFailure(interactionRes)}`);
|
|
27
28
|
}
|
|
28
29
|
await sleep(1e3);
|
|
29
30
|
const detailsRes = await fetch(`${softrApiUrl("SOFTR_WORKFLOWS_API_URL")}/v1/workflows/${action.resource.workflowId}/executions/${details.id}/details`);
|
|
30
|
-
if (!detailsRes.ok) throw new Error(`Workflow status check failed: ${detailsRes
|
|
31
|
+
if (!detailsRes.ok) throw new Error(`Workflow status check failed: ${await describeFailure(detailsRes)}`);
|
|
31
32
|
details = await detailsRes.json();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert, panic } from "../assertions.js";
|
|
2
|
+
import { softrApiUrl } from "../softr-api.js";
|
|
2
3
|
import { fetch } from "../fetch.js";
|
|
3
4
|
import { readUserTimezone } from "../cookies.js";
|
|
4
5
|
import { readSessionToken } from "../auth/session.js";
|
|
5
|
-
import { softrApiUrl } from "../softr-api.js";
|
|
6
6
|
import { isDatasourceAction } from "../action.js";
|
|
7
7
|
import { buildFilterCriteria, buildOrderBy, dealiasFilterCriteria, dealiasOrderBy } from "./filter.js";
|
|
8
8
|
import { andAll, makeFieldSet, makeSortSet } from "./fields.js";
|
package/dist/fetch.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
import { version } from "./package.js";
|
|
2
|
+
import { assert, requireDefined } from "./assertions.js";
|
|
1
3
|
import { logger } from "./logger.js";
|
|
4
|
+
import { softrApiUrl } from "./softr-api.js";
|
|
2
5
|
|
|
3
6
|
//#region src/fetch.ts
|
|
4
7
|
const fetch = async (input, init) => {
|
|
5
|
-
if (process.env.NODE_ENV === "production") return globalThis.fetch(input, init);
|
|
6
8
|
const url = input instanceof Request ? input.url : String(input);
|
|
9
|
+
if ([
|
|
10
|
+
softrApiUrl("SOFTR_PLATFORM_API_URL"),
|
|
11
|
+
softrApiUrl("SOFTR_DATASOURCE_API_URL"),
|
|
12
|
+
softrApiUrl("SOFTR_WORKFLOWS_API_URL")
|
|
13
|
+
].some((base) => url.startsWith(`${base}/`))) {
|
|
14
|
+
const headers = new Headers(init?.headers ?? (input instanceof Request ? input.headers : void 0));
|
|
15
|
+
headers.set("user-agent", `softr-sdk/${version}`);
|
|
16
|
+
init = {
|
|
17
|
+
...init,
|
|
18
|
+
headers
|
|
19
|
+
};
|
|
20
|
+
const signed = await sign(input, init);
|
|
21
|
+
if (signed) {
|
|
22
|
+
input = signed;
|
|
23
|
+
init = void 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (process.env.NODE_ENV === "production") return globalThis.fetch(input, init);
|
|
7
27
|
const method = init?.method ?? (input instanceof Request ? input.method : "GET");
|
|
8
28
|
const started = Date.now();
|
|
9
29
|
try {
|
|
@@ -16,6 +36,48 @@ const fetch = async (input, init) => {
|
|
|
16
36
|
throw error;
|
|
17
37
|
}
|
|
18
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* RFC 9421 signature over the request, with the key Studio handed the app at publish or session start. The SDK
|
|
41
|
+
* never derives, rotates or inspects the key: Softr derives it from a master key and the app's nonce, and the key
|
|
42
|
+
* id (`<environment>/<applicationId>/<master number>`) is copied into the signature as is so the verifier can
|
|
43
|
+
* derive the same key.
|
|
44
|
+
*
|
|
45
|
+
* The signature covers the method, authority, path, query and, when sent, the Authorization header. The body is
|
|
46
|
+
* not covered: TLS protects it in transit, and signing is there to tell the app's own server from anyone holding a
|
|
47
|
+
* user token, which needs no body coverage. So nothing is buffered here and the body streams through as given.
|
|
48
|
+
*/
|
|
49
|
+
async function sign(input, init) {
|
|
50
|
+
const key = process.env.SOFTR_REQUEST_SIGNING_KEY;
|
|
51
|
+
const keyId = process.env.SOFTR_REQUEST_SIGNING_KEY_ID;
|
|
52
|
+
if (!key || !keyId) return void 0;
|
|
53
|
+
assert(/^[0-9a-f]{64}$/i.test(key), "SOFTR_REQUEST_SIGNING_KEY must be 64 hex characters");
|
|
54
|
+
assert(!/["\\]/.test(keyId), "SOFTR_REQUEST_SIGNING_KEY_ID must not contain quotes or backslashes");
|
|
55
|
+
const request = new Request(input, init);
|
|
56
|
+
const headers = new Headers(request.headers);
|
|
57
|
+
const { host, pathname, search } = new URL(request.url);
|
|
58
|
+
const derived = {
|
|
59
|
+
"@method": request.method,
|
|
60
|
+
"@authority": host,
|
|
61
|
+
"@path": pathname,
|
|
62
|
+
"@query": search || "?"
|
|
63
|
+
};
|
|
64
|
+
const fields = Object.keys(derived);
|
|
65
|
+
if (headers.has("authorization")) fields.push("authorization");
|
|
66
|
+
const created = Math.floor(Date.now() / 1e3);
|
|
67
|
+
const params = `(${fields.map((field) => `"${field}"`).join(" ")});created=${created};keyid="${keyId}";tag="softr-code-app"`;
|
|
68
|
+
const base = [...fields.map((field) => `"${field}": ${derived[field] ?? requireDefined(headers.get(field), field)}`), `"@signature-params": ${params}`].join("\n");
|
|
69
|
+
const hmacKey = await crypto.subtle.importKey("raw", Uint8Array.from(key.match(/../g) ?? [], (byte) => parseInt(byte, 16)), {
|
|
70
|
+
name: "HMAC",
|
|
71
|
+
hash: "SHA-256"
|
|
72
|
+
}, false, ["sign"]);
|
|
73
|
+
const signature = base64(await crypto.subtle.sign("HMAC", hmacKey, new TextEncoder().encode(base)));
|
|
74
|
+
headers.set("signature-input", `softr=${params}`);
|
|
75
|
+
headers.set("signature", `softr=:${signature}:`);
|
|
76
|
+
return new Request(request, { headers });
|
|
77
|
+
}
|
|
78
|
+
function base64(bytes) {
|
|
79
|
+
return btoa(String.fromCharCode(...new Uint8Array(bytes)));
|
|
80
|
+
}
|
|
19
81
|
|
|
20
82
|
//#endregion
|
|
21
83
|
export { fetch };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,5 @@ import { useOverrides } from "./core/use-overrides.js";
|
|
|
16
16
|
import { useUserTimezone } from "./timezone.js";
|
|
17
17
|
import { PwaInstall, PwaPlatform, SoftrPwaHead, usePwaInstall } from "./pwa.js";
|
|
18
18
|
import { DefaultErrorOverlay } from "./default-error-overlay.js";
|
|
19
|
-
import { Agent, AgentChatSummary, listAgents } from "./agent/agent-fns.js";
|
|
20
|
-
import { AgentBlock, AgentChat, AgentChatOptions, AgentMessage, AgentQuestion, AgentTodo, AgentToolCall, useAgentChat } from "./agent/use-agent-chat.js";
|
|
21
19
|
import { Audience } from "./route/audience.js";
|
|
22
|
-
export { type ActionPermissions,
|
|
20
|
+
export { type ActionPermissions, Audience, type AuthOptions, type AuthSettings, AuthSettingsProvider, type DateOptions, type DateParts, type DateSeparator, type DateValue, DefaultErrorOverlay, type FieldShape, type FileAttachment, type FileItem, type FixedDateFormat, FormattedDate, type Formatting, FormattingScope, type Page, type PageSettings, type PwaInstall, type PwaPlatform, type SoftrContext, type SoftrDatasources, type SoftrFieldRegistry, SoftrPwaHead, type SoftrUserGroupId, type SoftrUserGroups, type SoftrUserProperties, type User, type WeekDay, assertRouteAccess, checkAccess, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useOverrides, usePwaInstall, useUserTimezone };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFileUpload } from "./core/use-file-upload.js";
|
|
2
1
|
import { defineIntegration, defineMutation, defineQuery, defineWorkflow } from "./action.js";
|
|
2
|
+
import { useFileUpload } from "./core/use-file-upload.js";
|
|
3
3
|
import { checkAccess, defineVisibility, isAuthorized } from "./route/visibility.js";
|
|
4
4
|
import { assertRouteAccess, guardRoute, isAccessError, isAlreadyAuthenticatedError, isForbiddenError, isUnauthenticatedError } from "./route/route.js";
|
|
5
5
|
import { definePage, pageHead } from "./route/page.js";
|
|
@@ -12,8 +12,6 @@ import { fieldShape, formatDuration, formatField, formatValue, registerSoftrFiel
|
|
|
12
12
|
import { useOverrides } from "./core/use-overrides.js";
|
|
13
13
|
import { useUserTimezone } from "./timezone.js";
|
|
14
14
|
import { DefaultErrorOverlay } from "./default-error-overlay.js";
|
|
15
|
-
import { listAgents } from "./agent/agent-fns.js";
|
|
16
|
-
import { useAgentChat } from "./agent/use-agent-chat.js";
|
|
17
15
|
import { Audience } from "./route/audience.js";
|
|
18
16
|
|
|
19
|
-
export { Audience, AuthSettingsProvider, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError,
|
|
17
|
+
export { Audience, AuthSettingsProvider, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useOverrides, usePwaInstall, useUserTimezone };
|
package/dist/locale-settings.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { logger } from "./logger.js";
|
|
2
|
+
import { softrApiUrl } from "./softr-api.js";
|
|
2
3
|
import { fetch } from "./fetch.js";
|
|
3
4
|
import { readRequestCookies, serializeCookie, writeCookies } from "./cookies.js";
|
|
4
5
|
import { sessionConfig } from "./auth/config.js";
|
|
5
|
-
import { softrApiUrl } from "./softr-api.js";
|
|
6
6
|
import { localeSettingsSchema } from "./formatting.js";
|
|
7
7
|
import { getRequestProtocol } from "@tanstack/react-start/server";
|
|
8
8
|
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatasourceAction } from "./action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tanstack_react_start6 from "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
5
5
|
|
|
@@ -31,6 +31,6 @@ type SoftrMcpOptions = {
|
|
|
31
31
|
* ],
|
|
32
32
|
* }))
|
|
33
33
|
*/
|
|
34
|
-
declare function softrMcpMiddleware(options?: SoftrMcpOptions):
|
|
34
|
+
declare function softrMcpMiddleware(options?: SoftrMcpOptions): _tanstack_react_start6.RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { softrMcpMiddleware };
|
package/dist/mcp.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assert } from "./assertions.js";
|
|
2
|
+
import { softrApiUrl } from "./softr-api.js";
|
|
2
3
|
import { fetch } from "./fetch.js";
|
|
3
4
|
import { softrConfig } from "./softr-config.js";
|
|
4
5
|
import { sessionConfig } from "./auth/config.js";
|
|
5
6
|
import { readSessionToken, withSessionToken } from "./auth/session.js";
|
|
6
|
-
import { softrApiUrl } from "./softr-api.js";
|
|
7
7
|
import { isDatasourceAction } from "./action.js";
|
|
8
8
|
import { makePlatform } from "./auth/platform.js";
|
|
9
9
|
import { ds } from "./datasource/datasource.js";
|
|
@@ -385,10 +385,8 @@ async function rpc(request, origin, actions) {
|
|
|
385
385
|
const token = bearerToken(request);
|
|
386
386
|
if (token === null) return unauthorized(origin);
|
|
387
387
|
const session = await platformSession(token);
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
else if (session.refused && await resolveUser(token) !== null) sessionToken = token;
|
|
391
|
-
else return session.refused ? unauthorized(origin) : unavailable();
|
|
388
|
+
if (!session.ok) return session.refused ? unauthorized(origin) : unavailable();
|
|
389
|
+
const { sessionToken } = session;
|
|
392
390
|
const body = await readJson(request);
|
|
393
391
|
const message = z.object({
|
|
394
392
|
id: z.union([z.string(), z.number()]).optional(),
|
package/dist/package.js
CHANGED
package/dist/pwa.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from "./logger.js";
|
|
2
|
+
import { softrApiUrl } from "./softr-api.js";
|
|
2
3
|
import { fetch } from "./fetch.js";
|
|
3
4
|
import { sessionConfig } from "./auth/config.js";
|
|
4
|
-
import { softrApiUrl } from "./softr-api.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { Fragment, createElement, useEffect, useState } from "react";
|
|
7
7
|
import { createMiddleware } from "@tanstack/react-start";
|
|
@@ -125,7 +125,7 @@ function usePwaInstall() {
|
|
|
125
125
|
useEffect(() => {
|
|
126
126
|
if (window.matchMedia("(display-mode: standalone)").matches || "standalone" in navigator && navigator.standalone === true) return;
|
|
127
127
|
let cancelled = false;
|
|
128
|
-
fetch(INSTALL_PATH, { headers: { accept: "application/json" } }).then(async (response) => {
|
|
128
|
+
globalThis.fetch(INSTALL_PATH, { headers: { accept: "application/json" } }).then(async (response) => {
|
|
129
129
|
if (!response.ok) return;
|
|
130
130
|
const parsed = installSchema.safeParse(await response.json());
|
|
131
131
|
if (!parsed.success || cancelled) return;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: core
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Softr SDK core
|
|
@@ -49,7 +49,6 @@ Each sub-skill stands alone for its task and repeats the boundary above, so most
|
|
|
49
49
|
| Sign a visitor in, out, or up | [auth/SKILL.md](./auth/SKILL.md) |
|
|
50
50
|
| Call a connected third-party API (Slack, Stripe, Gmail, …) | [integrations/SKILL.md](./integrations/SKILL.md) |
|
|
51
51
|
| Open the app to AI assistants over MCP | [mcp/SKILL.md](./mcp/SKILL.md) |
|
|
52
|
-
| Let visitors chat with a Softr agent | [agent-chat/SKILL.md](./agent-chat/SKILL.md) |
|
|
53
52
|
| Let visitors install the app on their home screen | [pwa/SKILL.md](./pwa/SKILL.md) |
|
|
54
53
|
| Show a date, a time or a number | [formatting/SKILL.md](./formatting/SKILL.md) |
|
|
55
54
|
|
|
@@ -86,9 +85,6 @@ Calling a connected third-party API (Slack, Stripe, Gmail, Google Calendar, …)
|
|
|
86
85
|
Opening the app to an AI assistant over MCP?
|
|
87
86
|
load softr-sdk/mcp
|
|
88
87
|
|
|
89
|
-
Adding a chat with one of the app's Softr agents, or a Connect button for the visitor's account it needs?
|
|
90
|
-
load softr-sdk/agent-chat
|
|
91
|
-
|
|
92
88
|
Adding an install button, or making the app installable?
|
|
93
89
|
load softr-sdk/pwa
|
|
94
90
|
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 0.0.89
|
|
10
|
+
library_version: 0.0.89
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
**Boundary.** `upload` lives on `@softr/sdk/server` and runs inside server functions. `useFileUpload` and `FileItem` live on `@softr/sdk` and run in components. `FileAttachment` comes from `@softr/sdk` and can be imported anywhere.
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 0.0.89
|
|
10
|
+
library_version: 0.0.89
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
**Boundary.** `integration` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineIntegration` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `softrMcpMiddleware` lives on `@softr/sdk` and is registered once, in `src/start.ts`. The actions you hand it are the same `defineQuery` / `defineMutation` values the app's own pages use — declared wherever they already live, not duplicated for MCP.
|
|
@@ -8,7 +8,7 @@ description: >-
|
|
|
8
8
|
metadata:
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: softr-sdk
|
|
11
|
-
library_version: 0.0.89
|
|
11
|
+
library_version: 0.0.89
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineMutation` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. The same holds for any helper that calls `ds`: declare it inside the handler. A function at module level that calls `ds` keeps the server-only import in the browser bundle, and every page stops loading until it moves. `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `definePage`, `pageHead`, the access functions and the error predicates come from `@softr/sdk` and work anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.89
|
|
12
|
+
library_version: 0.0.89
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `workflow` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineWorkflow` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _tanstack_react_start8 from "@tanstack/react-start";
|
|
3
|
-
|
|
4
|
-
//#region src/agent/agent-fns.d.ts
|
|
5
|
-
|
|
6
|
-
declare const agentSchema: z.ZodObject<{
|
|
7
|
-
id: z.ZodString;
|
|
8
|
-
title: z.ZodString;
|
|
9
|
-
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
-
thumbnail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
/** An agent the visitor may chat with. */
|
|
13
|
-
type Agent = z.infer<typeof agentSchema>;
|
|
14
|
-
/**
|
|
15
|
-
* The agents the visitor may chat with in this app. The builder attaches them
|
|
16
|
-
* in Studio, and each one's visibility settings decide who sees it.
|
|
17
|
-
*/
|
|
18
|
-
declare const listAgents: _tanstack_react_start8.OptionalFetcher<undefined, undefined, Promise<{
|
|
19
|
-
id: string;
|
|
20
|
-
title: string;
|
|
21
|
-
avatar?: string | null | undefined;
|
|
22
|
-
thumbnail?: string | null | undefined;
|
|
23
|
-
}[]>>;
|
|
24
|
-
/** One past chat with an agent. `title` is null until the agent names the chat. */
|
|
25
|
-
type AgentChatSummary = {
|
|
26
|
-
id: string;
|
|
27
|
-
title: string | null;
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { Agent, AgentChatSummary, listAgents };
|