apps 0.0.1-beta.89 → 0.0.1-beta.90
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 +27 -10
- package/framework-reference.json +1 -1
- package/js/{chunk-H6NFR354.js → chunk-36UFTECB.js} +6 -8
- package/js/{chunk-I46RIOKQ.js → chunk-5MDA7MKL.js} +14 -13
- package/js/{chunk-NQW2E44U.js → chunk-6XQLA5NC.js} +579 -81
- package/js/{chunk-6FUJH3T4.js → chunk-7PHHWYV4.js} +6 -5
- package/js/{chunk-7Z3NUCTP.js → chunk-DADXWWRZ.js} +24 -6
- package/js/{chunk-BZFFXNWA.js → chunk-I5C7FD5Z.js} +1 -1
- package/js/{chunk-EKZLPXHK.js → chunk-KUCCHNVY.js} +3 -3
- package/js/{chunk-ZK7JDZJS.js → chunk-PYQLOLOC.js} +2 -2
- package/js/{chunk-ELSILABS.js → chunk-WMD4NHXZ.js} +113 -73
- package/js/{chunk-JJH3MBAM.js → chunk-YNJ5CZMJ.js} +3 -2
- package/js/{chunk-5ZVAYXLT.js → chunk-YRGL4QEF.js} +1 -1
- package/js/{chunk-GLXEYET6.js → chunk-YWFUWTUJ.js} +12 -7
- package/js/client.js +1 -1
- package/js/contracts.js +37 -25
- package/js/effect.js +8 -9
- package/js/graphql.js +10 -11
- package/js/host.js +11 -13
- package/js/index.js +29 -31
- package/js/mcp/effect.js +9 -10
- package/js/mcp.js +11 -12
- package/js/openapi.js +9 -11
- package/js/skills.js +6 -6
- package/js/ui/contracts.js +1 -1
- package/js/ui/serving.js +5 -6
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/app.d.ts +51 -8
- package/types/apps/src/contracts/cache.d.ts +1 -1
- package/types/apps/src/contracts/context.d.ts +37 -8
- package/types/apps/src/contracts/events.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +800 -4
- package/types/apps/src/contracts/operations.d.ts +6 -3
- package/types/apps/src/contracts/protocol-version.d.ts +1 -1
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/current.d.ts +4445 -1633
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/ui.d.ts +11 -15
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +13 -17
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/cache.d.ts +1 -1
- package/types/apps/src/implementation/events.d.ts +6 -1
- package/types/apps/src/implementation/failure-detail.d.ts +3 -2
- package/types/apps/src/implementation/operations.d.ts +40 -5
- package/types/apps/src/implementation/router-catalog.d.ts +4 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/ui-serving.d.ts +2 -2
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +10 -3
- package/types/apps/src/index.d.ts +15 -9
- package/js/chunk-F2G534HD.js +0 -285
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ it. In this repository, `bun run pack` builds a local tarball.
|
|
|
17
17
|
import { defineApp } from "apps";
|
|
18
18
|
import { mcpRouter } from "apps/mcp";
|
|
19
19
|
|
|
20
|
-
export default defineApp({
|
|
20
|
+
export default defineApp({}, async ({ signal }) => ({
|
|
21
21
|
tools: await mcpRouter({
|
|
22
22
|
url: "https://mcp.deepwiki.com/mcp",
|
|
23
23
|
...(signal === undefined ? {} : { signal }),
|
|
@@ -59,7 +59,7 @@ operation and shared schema before publishing the current revision. A warm call
|
|
|
59
59
|
reads that revision and the requested operation's schema dependencies. It does
|
|
60
60
|
not download, parse, or read the full catalog. `openapiRouter` remains the
|
|
61
61
|
lower-level helper for already normalized metadata.
|
|
62
|
-
`parameterDefaults` binds path, query or header values to the
|
|
62
|
+
`parameterDefaults` binds path, query or header values to the account.
|
|
63
63
|
Those parameters become optional and publish their value as the schema `default`;
|
|
64
64
|
an explicit value still wins.
|
|
65
65
|
|
|
@@ -71,14 +71,31 @@ Accounts bind at execution time. Live documents cannot change credential
|
|
|
71
71
|
placement or send credentials to another origin. Editing generated source and
|
|
72
72
|
redeploying is required to change those static choices.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Requirements are declared by scope. `user: { accounts }` holds each caller's
|
|
75
|
+
own accounts, read as `ctx.user.accounts`; `app: { accounts }` holds the app's
|
|
76
|
+
own accounts, which people who can edit the app link for everyone, read as
|
|
77
|
+
`ctx.app.accounts`. A requirement name is used once across both. Contexts of the
|
|
78
|
+
`"app"` scope, such as `MutationContext<typeof requirements, "app">`, have no
|
|
79
|
+
`user`: app schedules (`appCron`, `appInterval`), webhooks whose `account` is
|
|
80
|
+
`{ app: "..." }` and the workflows they start run without a caller. App
|
|
81
|
+
schedules also accept a mutation whose handler declares no parameters, unless
|
|
82
|
+
the call passes explicit type arguments: their third, the context, defaults to
|
|
83
|
+
the caller's. A
|
|
84
|
+
handler that declares its context without a type gets the caller's, with
|
|
85
|
+
`ctx.user`, as a tool's does; app schedules reject it. User
|
|
86
|
+
schedules (`userCron`, `userInterval`) run once for each member who enables them,
|
|
87
|
+
as them. `{ accounts }` requirements and `ctx.accounts` are removed.
|
|
88
|
+
|
|
89
|
+
Authenticated templates use a `provider.many()` user requirement and
|
|
90
|
+
`accountRouter` from `apps`. A factory also runs without a caller for app-scope
|
|
91
|
+
work, so `ctx.user` may be undefined there:
|
|
75
92
|
|
|
76
93
|
```ts
|
|
77
94
|
export default defineApp(
|
|
78
|
-
{ accounts: { service: provider.many() } },
|
|
79
|
-
async ({
|
|
95
|
+
{ user: { accounts: { service: provider.many() } } },
|
|
96
|
+
async ({ user, signal }) => ({
|
|
80
97
|
tools: await accountRouter(
|
|
81
|
-
accounts.service,
|
|
98
|
+
user?.accounts.service ?? [],
|
|
82
99
|
(account) =>
|
|
83
100
|
mcpRouter({
|
|
84
101
|
url: "https://example.com/mcp",
|
|
@@ -100,7 +117,7 @@ plus five minutes stale. Use `freshFor` / `staleFor` to change the windows, or
|
|
|
100
117
|
`revalidate: true` to await a refresh. Tool results are never cached.
|
|
101
118
|
|
|
102
119
|
Each combined tool takes `{ accountId, input }`. `input` keeps the upstream shape;
|
|
103
|
-
`accountId` must identify
|
|
120
|
+
`accountId` must identify one of the caller's accounts that exposes that tool. Discovery
|
|
104
121
|
and validation remain specific to each account. An empty selection returns no
|
|
105
122
|
tools. This helper also works with OpenAPI and GraphQL operations.
|
|
106
123
|
|
|
@@ -109,7 +126,7 @@ Promise conversion happens at the public entry points. `apps/mcp/effect` exposes
|
|
|
109
126
|
the native HTTP discovery operation for host-side import probing.
|
|
110
127
|
|
|
111
128
|
Helpers are ordinary app libraries. The SDK still builds and invokes one app
|
|
112
|
-
model with the
|
|
129
|
+
model with the accounts each operation runs with; there is no protocol dispatcher.
|
|
113
130
|
Existing retained builds keep their bundled code until a new deployment.
|
|
114
131
|
|
|
115
132
|
The packaged runtime uses host protocol 1. A package missing that runtime or using
|
|
@@ -223,7 +240,7 @@ private data; it also includes the current credential fingerprint. Use the
|
|
|
223
240
|
shared cache for public metadata that is identical across accounts.
|
|
224
241
|
|
|
225
242
|
```ts
|
|
226
|
-
const projects = await ctx.cache.forAccount(ctx.accounts.service).get({
|
|
243
|
+
const projects = await ctx.cache.forAccount(ctx.user.accounts.service).get({
|
|
227
244
|
key: ["projects", region],
|
|
228
245
|
schema: array(object({ id: string(), name: string() })),
|
|
229
246
|
freshFor: "1 minute",
|
|
@@ -278,7 +295,7 @@ duplicate names.
|
|
|
278
295
|
|
|
279
296
|
```ts
|
|
280
297
|
export default defineApp(
|
|
281
|
-
{
|
|
298
|
+
{},
|
|
282
299
|
{
|
|
283
300
|
tools: dynamicRouter({
|
|
284
301
|
list: async () => [
|