apps 0.0.1-beta.3 → 0.0.1-beta.30
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 +68 -44
- package/framework-reference.json +1 -1
- package/js/{chunk-G7ZIRKMK.js → chunk-2D2PKLGQ.js} +118 -197
- package/js/chunk-3SPRHIEE.js +42 -0
- package/js/{chunk-FDNTX5QJ.js → chunk-4N26L465.js} +2 -2
- package/js/chunk-5ZHHO4OM.js +92 -0
- package/js/{chunk-EVJUVWN2.js → chunk-65SZ23BK.js} +2 -2
- package/js/{chunk-M6ZRRIBI.js → chunk-6JBTHTI5.js} +1 -1
- package/js/{chunk-J7O55ZV7.js → chunk-6NK26ONC.js} +332 -187
- package/js/chunk-6VWYEQ4X.js +254 -0
- package/js/{chunk-RN2MXB4R.js → chunk-AE4FWJQU.js} +128 -24
- package/js/{chunk-HDJH3RPR.js → chunk-BBTELEAN.js} +2 -2
- package/js/{chunk-LGIYBDWA.js → chunk-BRGF7VFN.js} +65 -1
- package/js/{chunk-MYYEW3RA.js → chunk-BSRU52RU.js} +984 -61
- package/js/{chunk-FZJOYIZO.js → chunk-BTJMXW4I.js} +1 -1
- package/js/{chunk-HDTGZWP2.js → chunk-IMCEF6KE.js} +139 -32
- package/js/chunk-KQCMHI3K.js +118 -0
- package/js/{chunk-BMOIAIVR.js → chunk-M2KEEOIQ.js} +49 -1
- package/js/{chunk-YEJOQEII.js → chunk-MYCVMDWI.js} +45 -7
- package/js/{chunk-FW5HBOIK.js → chunk-NXTXZ635.js} +1841 -1701
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-JN55AYQH.js → chunk-OI5CKSBU.js} +61 -32
- package/js/{chunk-NQ3OMCA5.js → chunk-P46HIAX6.js} +2 -2
- package/js/chunk-PUC24GZP.js +801 -0
- package/js/{chunk-SATWJKN6.js → chunk-PWF2DRJ3.js} +1 -1
- package/js/{chunk-D47C7KG5.js → chunk-VUVBMNKC.js} +2 -2
- package/js/{chunk-ZCAMUXSG.js → chunk-WGBI5MVX.js} +3 -4
- package/js/{chunk-T2LAZCAD.js → chunk-WQ5MVBTP.js} +1 -1
- package/js/{chunk-PLCMJREA.js → chunk-XBQTJP76.js} +60 -20
- package/js/{chunk-QKHR7BMF.js → chunk-XGN5IFOZ.js} +3 -3
- package/js/{chunk-WFSQXYUT.js → chunk-YML53Z7H.js} +42 -5
- package/js/{chunk-5MQZEB6Y.js → chunk-ZZOCEUTB.js} +37 -12
- package/js/client.js +120 -84
- package/js/contracts.js +110 -16
- package/js/effect.js +20 -20
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +58 -54
- package/js/host.js +20 -20
- package/js/index.js +247 -204
- package/js/mcp/effect.js +24 -22
- package/js/mcp/stdio.js +35 -30
- package/js/mcp.js +105 -68
- package/js/openapi.js +4087 -1503
- package/js/react.js +3 -3
- package/js/skills/effect.js +5 -3
- package/js/skills.js +15 -15
- package/js/storage/facet.js +4 -4
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8516 -214
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/app-data/src/implementation/schema.d.ts +2 -17
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -6
- package/types/apps/src/contracts/failure.d.ts +54 -0
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +34 -11
- package/types/apps/src/contracts/mcp.d.ts +91 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
- package/types/apps/src/contracts/openapi.d.ts +45 -9
- package/types/apps/src/contracts/operations.d.ts +5 -6
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +251 -69
- package/types/apps/src/contracts/protocols/2.d.ts +710 -0
- package/types/apps/src/contracts/protocols/3.d.ts +716 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1298 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +115 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +18 -5
- package/types/apps/src/contracts/storage.d.ts +3 -3
- package/types/apps/src/contracts/ui.d.ts +18 -0
- package/types/apps/src/contracts/workflows.d.ts +34 -3
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/implementation/account-router.d.ts +12 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
- package/types/apps/src/implementation/elicitation.d.ts +9 -9
- package/types/apps/src/implementation/failure-detail.d.ts +46 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
- package/types/apps/src/implementation/openapi-document.d.ts +35 -8
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +8 -6
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +36 -3
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/router-catalog.d.ts +224 -0
- package/types/apps/src/implementation/router.d.ts +68 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +52 -1
- package/types/apps/src/implementation/skills.d.ts +2 -2
- package/types/apps/src/implementation/storage.d.ts +5 -3
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +10 -4
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflow-context.d.ts +11 -3
- package/types/apps/src/index.d.ts +29 -11
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +6 -6
- package/types/apps/src/skills.d.ts +4 -4
- package/types/telemetry/src/browser-operations.d.ts +5 -2
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/utils/src/api-error.d.ts +48 -0
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-W7D7WVSY.js +0 -18
- package/js/chunk-Z5NMEGJN.js +0 -29
- package/js/chunk-ZJWDMTE3.js +0 -63
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
-
parseDatabaseSchema,
|
|
3
2
|
promiseTable
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XBQTJP76.js";
|
|
5
4
|
import {
|
|
5
|
+
declaredOperations,
|
|
6
6
|
fromPromise,
|
|
7
|
-
nativeOperation
|
|
8
|
-
|
|
7
|
+
nativeOperation,
|
|
8
|
+
nativeRouter
|
|
9
|
+
} from "./chunk-6VWYEQ4X.js";
|
|
9
10
|
import {
|
|
10
11
|
ScheduleTiming
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BSRU52RU.js";
|
|
13
|
+
import {
|
|
14
|
+
DatabaseSchema
|
|
15
|
+
} from "./chunk-M2KEEOIQ.js";
|
|
12
16
|
import {
|
|
13
17
|
decoderOf,
|
|
14
18
|
isSchema,
|
|
15
19
|
storageFieldOf
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YML53Z7H.js";
|
|
17
21
|
import {
|
|
18
22
|
AppStorageUnavailable
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-BTJMXW4I.js";
|
|
20
24
|
import {
|
|
21
25
|
JsonValue
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-PWF2DRJ3.js";
|
|
23
27
|
import {
|
|
24
28
|
Effect_exports,
|
|
25
29
|
Schema_exports
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-NXTXZ635.js";
|
|
31
|
+
|
|
32
|
+
// src/contracts/http.ts
|
|
33
|
+
var ResponseStatusError = class extends Schema_exports.TaggedError()(
|
|
34
|
+
"ResponseStatusError",
|
|
35
|
+
{ status: Schema_exports.Number }
|
|
36
|
+
) {
|
|
37
|
+
get message() {
|
|
38
|
+
return `Request failed with status ${this.status}`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var ResponseDecodeError = class extends Schema_exports.TaggedError()(
|
|
42
|
+
"ResponseDecodeError",
|
|
43
|
+
{}
|
|
44
|
+
) {
|
|
45
|
+
get message() {
|
|
46
|
+
return "Response body did not match the expected schema";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
27
49
|
|
|
28
50
|
// src/implementation/workflows.ts
|
|
29
51
|
var NativeWorkflow = /* @__PURE__ */ Symbol("apps.Workflow");
|
|
@@ -48,8 +70,12 @@ var nativeWorkflow = (value) => {
|
|
|
48
70
|
var InternalApp = /* @__PURE__ */ Symbol("apps.App");
|
|
49
71
|
var isApp = (value) => typeof value === "object" && value !== null && InternalApp in value;
|
|
50
72
|
var toEffectApp = (app) => app[InternalApp];
|
|
73
|
+
function rejectCatalogs(definition) {
|
|
74
|
+
if ("queries" in definition || "mutations" in definition)
|
|
75
|
+
throw new Error("Put queries and mutations in a router under tools");
|
|
76
|
+
}
|
|
51
77
|
function adaptDefinition(definition) {
|
|
52
|
-
|
|
78
|
+
rejectCatalogs(definition);
|
|
53
79
|
const webhooks = definition.webhooks === void 0 ? {} : {
|
|
54
80
|
webhooks: Object.fromEntries(
|
|
55
81
|
Object.entries(definition.webhooks).map(([name, webhook]) => [
|
|
@@ -65,42 +91,42 @@ function adaptDefinition(definition) {
|
|
|
65
91
|
])
|
|
66
92
|
)
|
|
67
93
|
};
|
|
68
|
-
const operations = (kind, catalog) => Object.fromEntries(
|
|
69
|
-
Object.entries(catalog).map(([name, value]) => {
|
|
70
|
-
const operation = nativeOperation(value);
|
|
71
|
-
if (operation === void 0 || operation.kind !== kind)
|
|
72
|
-
throw new Error("Invalid app data operation");
|
|
73
|
-
return [name, operation];
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
94
|
const workflows = definition.workflows === void 0 ? {} : {
|
|
77
95
|
workflows: Object.fromEntries(
|
|
78
96
|
Object.entries(definition.workflows).map(([name, value]) => {
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return [name,
|
|
97
|
+
const declared2 = nativeWorkflow(value);
|
|
98
|
+
if (declared2 === void 0) throw new Error("Invalid workflow declaration");
|
|
99
|
+
return [name, declared2];
|
|
82
100
|
})
|
|
83
101
|
)
|
|
84
102
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
103
|
+
const root = definition.tools === void 0 ? void 0 : nativeRouter(definition.tools);
|
|
104
|
+
if (definition.tools !== void 0 && root === void 0)
|
|
105
|
+
throw new Error("tools must be a router");
|
|
106
|
+
const data = root === void 0 ? {} : { tools: root };
|
|
107
|
+
const declared = root?.kind === "router" ? declaredOperations(root) : [];
|
|
108
|
+
const mutations = /* @__PURE__ */ new Set();
|
|
109
|
+
for (const { operation } of declared) {
|
|
110
|
+
if (operation.kind !== "mutation") continue;
|
|
111
|
+
if (mutations.has(operation))
|
|
112
|
+
throw new Error("A mutation can be mounted at only one path in tools");
|
|
113
|
+
mutations.add(operation);
|
|
114
|
+
}
|
|
89
115
|
const schedules = definition.schedules === void 0 ? {} : {
|
|
90
116
|
schedules: Object.fromEntries(
|
|
91
117
|
Object.entries(definition.schedules).map(([name, schedule]) => {
|
|
92
|
-
const
|
|
93
|
-
|
|
118
|
+
const target = nativeOperation(schedule.operation);
|
|
119
|
+
const match = declared.find(
|
|
120
|
+
({ operation }) => operation === target && operation.kind === "mutation"
|
|
94
121
|
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
throw new Error("A schedule must reference exactly one named mutation in this app");
|
|
122
|
+
if (match === void 0)
|
|
123
|
+
throw new Error("A schedule must reference a mutation in this app's tools");
|
|
98
124
|
return [
|
|
99
125
|
name,
|
|
100
126
|
{
|
|
101
127
|
timing: Schema_exports.decodeUnknownSync(ScheduleTiming)(schedule.timing),
|
|
102
128
|
input: Schema_exports.decodeUnknownSync(JsonValue)(schedule.input),
|
|
103
|
-
tool:
|
|
129
|
+
tool: match.name
|
|
104
130
|
}
|
|
105
131
|
];
|
|
106
132
|
})
|
|
@@ -115,6 +141,7 @@ function adaptDefinition(definition) {
|
|
|
115
141
|
};
|
|
116
142
|
}
|
|
117
143
|
var defineApp = (requirements, definition) => {
|
|
144
|
+
if (typeof definition !== "function") rejectCatalogs(definition);
|
|
118
145
|
const evaluate = typeof definition === "function" ? definition : async () => definition;
|
|
119
146
|
const factory = fromPromise(evaluate);
|
|
120
147
|
const native = {
|
|
@@ -152,7 +179,7 @@ var serialize = (tables) => {
|
|
|
152
179
|
}
|
|
153
180
|
])
|
|
154
181
|
);
|
|
155
|
-
return
|
|
182
|
+
return Schema_exports.decodeUnknownSync(DatabaseSchema)(definitions);
|
|
156
183
|
};
|
|
157
184
|
var authorDatabase = (tables, session, signal, writable) => {
|
|
158
185
|
return Object.fromEntries(
|
|
@@ -202,6 +229,8 @@ var unavailableStorage = {
|
|
|
202
229
|
};
|
|
203
230
|
|
|
204
231
|
export {
|
|
232
|
+
ResponseStatusError,
|
|
233
|
+
ResponseDecodeError,
|
|
205
234
|
workflow,
|
|
206
235
|
isApp,
|
|
207
236
|
toEffectApp,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appSignInCallbackPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WQ5MVBTP.js";
|
|
4
4
|
import {
|
|
5
5
|
HttpServerResponse_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XGN5IFOZ.js";
|
|
7
7
|
|
|
8
8
|
// src/implementation/ui-auth.ts
|
|
9
9
|
var appPrivateHeaders = {
|