apps 0.0.1-beta.2 → 0.0.1-beta.21

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.
Files changed (119) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  4. package/js/{chunk-WFSQXYUT.js → chunk-4QQ62BVS.js} +37 -3
  5. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  6. package/js/chunk-625MBYU4.js +524 -0
  7. package/js/{chunk-RN2MXB4R.js → chunk-BLI53LPN.js} +28 -9
  8. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  9. package/js/{chunk-J7O55ZV7.js → chunk-CHAK4P5C.js} +317 -176
  10. package/js/{chunk-HDTGZWP2.js → chunk-CMRKLZZY.js} +8 -8
  11. package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
  12. package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
  13. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  14. package/js/chunk-KUMBKVJD.js +39 -0
  15. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  16. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  17. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  18. package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
  19. package/js/chunk-NMKHTJOQ.js +254 -0
  20. package/js/chunk-OD3KFKZD.js +1617 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
  22. package/js/{chunk-5MQZEB6Y.js → chunk-OZ4UK3CD.js} +37 -12
  23. package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
  24. package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
  25. package/js/{chunk-LGIYBDWA.js → chunk-R3EV5FTO.js} +13 -1
  26. package/js/{chunk-Z5NMEGJN.js → chunk-RAAPJMVZ.js} +21 -9
  27. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  28. package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
  29. package/js/{chunk-MYYEW3RA.js → chunk-VXWY44LE.js} +780 -55
  30. package/js/{chunk-JN55AYQH.js → chunk-XNCYIB4D.js} +61 -32
  31. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  32. package/js/client.js +10 -26
  33. package/js/contracts.js +74 -16
  34. package/js/effect.js +19 -20
  35. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  36. package/js/graphql.js +47 -49
  37. package/js/host.js +19 -20
  38. package/js/index.js +232 -201
  39. package/js/mcp/effect.js +21 -22
  40. package/js/mcp/stdio.js +25 -26
  41. package/js/mcp.js +74 -56
  42. package/js/openapi.js +3428 -1276
  43. package/js/react.js +3 -3
  44. package/js/skills/effect.js +3 -3
  45. package/js/skills.js +12 -13
  46. package/js/storage/facet.js +4 -4
  47. package/js/ui/auth/contracts.js +8 -9
  48. package/js/ui/auth.js +16 -14
  49. package/js/ui/contracts.js +4 -4
  50. package/js/ui/serving.js +71 -218
  51. package/package.json +1 -1
  52. package/runtime.json +1 -1
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/app-data/src/implementation/schema.d.ts +2 -17
  55. package/types/apps/src/contracts/app.d.ts +7 -6
  56. package/types/apps/src/contracts/failure.d.ts +25 -0
  57. package/types/apps/src/contracts/host.d.ts +31 -10
  58. package/types/apps/src/contracts/mcp.d.ts +16 -0
  59. package/types/apps/src/contracts/openapi.d.ts +5 -1
  60. package/types/apps/src/contracts/operations.d.ts +0 -5
  61. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  62. package/types/apps/src/contracts/protocols/1.d.ts +235 -67
  63. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  64. package/types/apps/src/contracts/protocols/3.d.ts +718 -0
  65. package/types/apps/src/contracts/protocols/4.d.ts +1299 -0
  66. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  67. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  68. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  69. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  70. package/types/apps/src/contracts/provider.d.ts +109 -10
  71. package/types/apps/src/contracts/router.d.ts +59 -0
  72. package/types/apps/src/contracts/storage.d.ts +3 -3
  73. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  74. package/types/apps/src/contracts/ui.d.ts +18 -0
  75. package/types/apps/src/contracts/workflows.d.ts +34 -3
  76. package/types/apps/src/graphql.d.ts +1 -3
  77. package/types/apps/src/implementation/account-router.d.ts +12 -0
  78. package/types/apps/src/implementation/app.d.ts +5 -4
  79. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  80. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  81. package/types/apps/src/implementation/elicitation.d.ts +2 -2
  82. package/types/apps/src/implementation/failure-detail.d.ts +26 -0
  83. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  84. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  85. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  86. package/types/apps/src/implementation/mcp.d.ts +35 -19
  87. package/types/apps/src/implementation/openapi-compile.d.ts +9 -5
  88. package/types/apps/src/implementation/openapi-document.d.ts +15 -2
  89. package/types/apps/src/implementation/openapi-request.d.ts +8 -1
  90. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  91. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  92. package/types/apps/src/implementation/operations.d.ts +36 -3
  93. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  94. package/types/apps/src/implementation/provider.d.ts +19 -5
  95. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  96. package/types/apps/src/implementation/router.d.ts +68 -0
  97. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  98. package/types/apps/src/implementation/schema.d.ts +44 -1
  99. package/types/apps/src/implementation/storage.d.ts +5 -3
  100. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  101. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  102. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  103. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  104. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  105. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  106. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  107. package/types/apps/src/index.d.ts +28 -11
  108. package/types/apps/src/mcp-stdio.d.ts +2 -5
  109. package/types/apps/src/mcp.d.ts +5 -4
  110. package/types/apps/src/openapi.d.ts +6 -6
  111. package/types/apps/src/ui-auth.d.ts +2 -2
  112. package/types/telemetry/src/browser-operations.d.ts +5 -2
  113. package/js/chunk-PYUYJRSK.js +0 -93
  114. package/js/chunk-SWPD52J7.js +0 -35
  115. package/js/chunk-TE4KO4HI.js +0 -47
  116. package/js/chunk-W7D7WVSY.js +0 -18
  117. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  118. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  119. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FetchHttpClient_exports
3
- } from "./chunk-HDJH3RPR.js";
3
+ } from "./chunk-57RKNWL2.js";
4
4
  import {
5
5
  HttpBody_exports,
6
6
  HttpClient,
@@ -18,7 +18,7 @@ import {
18
18
  setBody,
19
19
  transformResponse,
20
20
  uint8Array
21
- } from "./chunk-QKHR7BMF.js";
21
+ } from "./chunk-UK573G7W.js";
22
22
  import {
23
23
  Array as Array2,
24
24
  Boolean2 as Boolean,
@@ -125,7 +125,7 @@ import {
125
125
  withDefault2 as withDefault,
126
126
  withTracerEnabled,
127
127
  zero
128
- } from "./chunk-FW5HBOIK.js";
128
+ } from "./chunk-CDL5PM2Q.js";
129
129
  import {
130
130
  __export
131
131
  } from "./chunk-CZ7CSFO4.js";
@@ -2508,7 +2508,6 @@ export {
2508
2508
  withRemoteSpan,
2509
2509
  invocationFetch,
2510
2510
  collectTelemetry,
2511
- TraceContext,
2512
2511
  externalTrace,
2513
2512
  traceLinks,
2514
2513
  pendingSpan
@@ -1,24 +1,32 @@
1
1
  import {
2
2
  CacheError
3
- } from "./chunk-LGIYBDWA.js";
3
+ } from "./chunk-R3EV5FTO.js";
4
4
  import {
5
5
  wrap
6
- } from "./chunk-WFSQXYUT.js";
6
+ } from "./chunk-4QQ62BVS.js";
7
7
  import {
8
8
  JsonObject
9
- } from "./chunk-SATWJKN6.js";
9
+ } from "./chunk-27F7W2LG.js";
10
10
  import {
11
11
  Duration_exports,
12
12
  Effect_exports,
13
13
  Schema_exports
14
- } from "./chunk-FW5HBOIK.js";
14
+ } from "./chunk-CDL5PM2Q.js";
15
15
 
16
16
  // src/implementation/catalog-cache.ts
17
+ var catalogScope = (options, invalid) => {
18
+ const { account, cache, headers } = options;
19
+ if (account === void 0)
20
+ return headers === void 0 ? Effect_exports.succeed(cache) : Effect_exports.fail(invalid());
21
+ if (cache === void 0) return Effect_exports.succeed(void 0);
22
+ return Effect_exports.try({ try: () => cache.forAccount(account), catch: invalid });
23
+ };
17
24
  var schema = (decoder) => wrap(decoder, false);
18
25
  var Manifest = Schema_exports.Struct({
19
26
  revision: Schema_exports.String,
20
27
  pages: Schema_exports.Int,
21
- summaries: Schema_exports.Int
28
+ summaries: Schema_exports.Int,
29
+ header: Schema_exports.optionalKey(JsonObject)
22
30
  });
23
31
  var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
24
32
  var catalogCache = (options) => Effect_exports.gen(function* () {
@@ -35,9 +43,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
35
43
  const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
36
44
  const local = yield* Effect_exports.cached(options.load());
37
45
  const refresh = (context) => Effect_exports.gen(function* () {
38
- const tools = yield* options.load(context);
46
+ const { tools, header } = yield* options.load(context);
39
47
  const digest = yield* invoke(
40
- () => crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(tools)))
48
+ () => crypto.subtle.digest(
49
+ "SHA-256",
50
+ new TextEncoder().encode(JSON.stringify({ tools, header: header ?? null }))
51
+ )
41
52
  );
42
53
  const revision = Array.from(
43
54
  new Uint8Array(digest),
@@ -104,7 +115,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
104
115
  yield* pageOut();
105
116
  yield* summaryOut();
106
117
  yield* flush();
107
- return { revision, pages: pages2, summaries };
118
+ return {
119
+ revision,
120
+ pages: pages2,
121
+ summaries,
122
+ ...header === void 0 ? {} : { header: yield* json(header) }
123
+ };
108
124
  });
109
125
  const getOptions = {
110
126
  key,
@@ -113,7 +129,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
113
129
  staleFor,
114
130
  load: (context) => Effect_exports.runPromise(refresh(context), { signal: context.signal })
115
131
  };
116
- const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(() => cache.get(getOptions));
132
+ let reading;
133
+ const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(
134
+ () => reading ??= cache.get(getOptions).finally(() => {
135
+ reading = void 0;
136
+ })
137
+ );
117
138
  if (options.revalidate) {
118
139
  if (cache === void 0) yield* local;
119
140
  else yield* invoke(() => cache.revalidate(getOptions));
@@ -140,14 +161,17 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
140
161
  return values;
141
162
  });
142
163
  const metadata = () => Effect_exports.gen(function* () {
143
- if (cache === void 0) return yield* local;
164
+ if (cache === void 0) return (yield* local).tools;
144
165
  const manifest = yield* current();
145
166
  return yield* pages(cache, manifest.revision, "page", manifest.pages, options.schema);
146
167
  });
147
168
  return {
148
169
  list: metadata,
170
+ /** The record stored with the current revision, if the source supplied one. */
171
+ header: () => cache === void 0 ? local.pipe(Effect_exports.map(({ header }) => header)) : current().pipe(Effect_exports.map((manifest) => manifest.header)),
149
172
  summaries: () => Effect_exports.gen(function* () {
150
- if (cache === void 0) return (yield* local).map((tool) => options.summary.of(tool));
173
+ if (cache === void 0)
174
+ return (yield* local).tools.map((tool) => options.summary.of(tool));
151
175
  const manifest = yield* current();
152
176
  return yield* pages(
153
177
  cache,
@@ -157,7 +181,7 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
157
181
  options.summary.schema
158
182
  );
159
183
  }),
160
- resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map((tools) => tools.find((tool) => tool.name === name))) : current().pipe(
184
+ resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map(({ tools }) => tools.find((tool) => tool.name === name))) : current().pipe(
161
185
  Effect_exports.flatMap(
162
186
  (manifest) => invoke(
163
187
  () => cache.read(part(manifest.revision, "tool", name), schema(options.schema))
@@ -168,5 +192,6 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
168
192
  });
169
193
 
170
194
  export {
195
+ catalogScope,
171
196
  catalogCache
172
197
  };
@@ -58,7 +58,7 @@ import {
58
58
  useSpan,
59
59
  void_2 as void_,
60
60
  withFiber
61
- } from "./chunk-FW5HBOIK.js";
61
+ } from "./chunk-CDL5PM2Q.js";
62
62
 
63
63
  // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/reactivity/Reactivity.js
64
64
  var TypeId = "~effect/reactivity/Reactivity";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Schema_exports
3
- } from "./chunk-FW5HBOIK.js";
3
+ } from "./chunk-CDL5PM2Q.js";
4
4
 
5
5
  // src/contracts/storage.ts
6
6
  var StorageName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
@@ -1,6 +1,17 @@
1
+ import {
2
+ AccountId
3
+ } from "./chunk-27F7W2LG.js";
1
4
  import {
2
5
  Schema_exports
3
- } from "./chunk-FW5HBOIK.js";
6
+ } from "./chunk-CDL5PM2Q.js";
7
+
8
+ // src/contracts/provider-error.ts
9
+ var ProviderError = class extends Schema_exports.TaggedError()("ProviderError", {
10
+ reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
11
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
12
+ accountId: Schema_exports.optional(AccountId)
13
+ }) {
14
+ };
4
15
 
5
16
  // ../app-cache/src/contracts/cache.ts
6
17
  var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
@@ -76,6 +87,7 @@ var CacheReply = Schema_exports.Union([
76
87
  ]);
77
88
 
78
89
  export {
90
+ ProviderError,
79
91
  CacheError,
80
92
  cacheLimits,
81
93
  CacheEntry,
@@ -1,13 +1,17 @@
1
1
  import {
2
- operationDeclaration
3
- } from "./chunk-PYUYJRSK.js";
2
+ fixedRouter
3
+ } from "./chunk-625MBYU4.js";
4
+ import {
5
+ nativeOperation,
6
+ operationDeclaration,
7
+ routerDeclaration
8
+ } from "./chunk-NMKHTJOQ.js";
4
9
 
5
10
  // src/implementation/protocol-operations.ts
6
11
  var protocolOperations = (operations, kinds = {}) => {
7
- const queries = {};
8
- const mutations = {};
12
+ const declared = {};
9
13
  for (const [name, operation] of Object.entries(operations)) {
10
- const kind = Object.hasOwn(kinds, name) ? kinds[name] : operation.readOnly === true ? "query" : "mutation";
14
+ const kind = Object.hasOwn(kinds, name) ? kinds[name] ?? "mutation" : operation.readOnly === true ? "query" : "mutation";
11
15
  const native = {
12
16
  description: operation.description,
13
17
  ...operation.title === void 0 ? {} : { title: operation.title },
@@ -18,12 +22,20 @@ var protocolOperations = (operations, kinds = {}) => {
18
22
  };
19
23
  const output = Object.getOwnPropertyDescriptor(operation, "outputSchema");
20
24
  const withOutput = (target) => output === void 0 || output.get === void 0 && output.value === void 0 ? target : Object.defineProperty(target, "outputSchema", { ...output, enumerable: true });
21
- if (kind === "query") queries[name] = operationDeclaration(withOutput({ ...native, kind }));
22
- else mutations[name] = operationDeclaration(withOutput({ ...native, kind: "mutation" }));
25
+ declared[name] = operationDeclaration(withOutput({ ...native, kind }));
26
+ }
27
+ return declared;
28
+ };
29
+ var protocolRouter = (operations, kinds = {}) => {
30
+ const native = {};
31
+ for (const [name, declaration] of Object.entries(protocolOperations(operations, kinds))) {
32
+ const operation = nativeOperation(declaration);
33
+ if (operation !== void 0) native[name] = operation;
23
34
  }
24
- return { queries, mutations };
35
+ return routerDeclaration(fixedRouter(native));
25
36
  };
26
37
 
27
38
  export {
28
- protocolOperations
39
+ protocolOperations,
40
+ protocolRouter
29
41
  };
@@ -211,7 +211,7 @@ import {
211
211
  withFiber,
212
212
  withParentSpan,
213
213
  zero2 as zero
214
- } from "./chunk-FW5HBOIK.js";
214
+ } from "./chunk-CDL5PM2Q.js";
215
215
  import {
216
216
  __export
217
217
  } from "./chunk-CZ7CSFO4.js";
@@ -1,14 +1,6 @@
1
- import {
2
- HttpApiEndpoint_exports,
3
- HttpApiGroup_exports,
4
- HttpApi_exports,
5
- UiFailed,
6
- UiForbidden,
7
- UiUnauthorized
8
- } from "./chunk-OHRT55C4.js";
9
1
  import {
10
2
  Schema_exports
11
- } from "./chunk-FW5HBOIK.js";
3
+ } from "./chunk-CDL5PM2Q.js";
12
4
 
13
5
  // src/contracts/ui-auth.ts
14
6
  var AppSignInId = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/)).pipe(
@@ -31,26 +23,14 @@ var AppReturnPath = Schema_exports.String.check(
31
23
  })
32
24
  ).pipe(Schema_exports.brand("AppReturnPath"));
33
25
  var AppSignInCallback = Schema_exports.Struct({ request: AppSignInId, code: AppSignInCode });
34
- var AppSignInApi = HttpApi_exports.make("app-sign-in").add(
35
- HttpApiGroup_exports.make("appSignIn").add(
36
- HttpApiEndpoint_exports.post("start", "/_executor/auth/start", {
37
- payload: Schema_exports.Struct({ returnTo: AppReturnPath }),
38
- success: Schema_exports.Struct({ url: Schema_exports.String }),
39
- error: [UiForbidden, UiFailed]
40
- })
41
- ).add(
42
- HttpApiEndpoint_exports.post("complete", "/_executor/auth/complete", {
43
- payload: AppSignInCallback,
44
- success: Schema_exports.Struct({ returnTo: AppReturnPath }),
45
- error: [UiUnauthorized, UiForbidden, UiFailed]
46
- })
47
- )
48
- );
26
+ var appSignInCallbackPath = "/_executor/auth/callback";
27
+ var AppSignInFailure = Schema_exports.Literals(["ended", "forbidden", "unavailable"]);
49
28
 
50
29
  export {
51
30
  AppSignInId,
52
31
  AppSignInCode,
53
32
  AppReturnPath,
54
33
  AppSignInCallback,
55
- AppSignInApi
34
+ appSignInCallbackPath,
35
+ AppSignInFailure
56
36
  };