apps 0.0.1-beta.1 → 0.0.1-beta.3

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 (58) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/browser-XIPJGLH2.js +65 -0
  3. package/js/{chunk-6YBRWRK3.js → chunk-5MQZEB6Y.js} +16 -4
  4. package/js/chunk-D47C7KG5.js +172 -0
  5. package/js/{chunk-ZTFQHGEB.js → chunk-FDNTX5QJ.js} +1 -3
  6. package/js/{chunk-OHRT55C4.js → chunk-G7ZIRKMK.js} +0 -3
  7. package/js/{chunk-G7IE6BKC.js → chunk-HDTGZWP2.js} +2 -2
  8. package/js/{chunk-KOXMLKTM.js → chunk-J7O55ZV7.js} +20 -148
  9. package/js/{chunk-RBAC33PQ.js → chunk-JN55AYQH.js} +3 -57
  10. package/js/chunk-LGIYBDWA.js +85 -0
  11. package/js/{chunk-IHQ4ML7K.js → chunk-MYYEW3RA.js} +130 -86
  12. package/js/chunk-NQ3OMCA5.js +39 -0
  13. package/js/{chunk-PZ36XMXW.js → chunk-PYUYJRSK.js} +1 -1
  14. package/js/{chunk-X7SFGU4Q.js → chunk-RN2MXB4R.js} +4 -4
  15. package/js/{chunk-4LPG6RCH.js → chunk-T2LAZCAD.js} +4 -24
  16. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  17. package/js/{chunk-2HHMABB6.js → chunk-WFSQXYUT.js} +46 -10
  18. package/js/{chunk-6IIO4NPI.js → chunk-Z5NMEGJN.js} +1 -1
  19. package/js/client.js +2 -2
  20. package/js/contracts.js +8 -1
  21. package/js/effect.js +8 -7
  22. package/js/es-APDZKREY.js +40968 -0
  23. package/js/graphql.js +10 -9
  24. package/js/host.js +12 -11
  25. package/js/index.js +7 -5
  26. package/js/mcp/effect.js +10 -9
  27. package/js/mcp/stdio.js +10 -9
  28. package/js/mcp.js +12 -11
  29. package/js/openapi.js +776 -41590
  30. package/js/skills/effect.js +1 -2
  31. package/js/skills.js +47 -10
  32. package/js/ui/auth/contracts.js +7 -8
  33. package/js/ui/auth.js +13 -11
  34. package/js/ui/contracts.js +1 -1
  35. package/js/ui/serving.js +3 -2
  36. package/package.json +1 -1
  37. package/runtime.json +1 -1
  38. package/types/app-cache/src/contracts/cache.d.ts +42 -2
  39. package/types/app-cache/src/index.d.ts +59 -1
  40. package/types/apps/src/contracts/cache.d.ts +4 -1
  41. package/types/apps/src/contracts/host.d.ts +8 -672
  42. package/types/apps/src/contracts/openapi.d.ts +6 -0
  43. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  44. package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
  45. package/types/apps/src/contracts/skills.d.ts +17 -8
  46. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  47. package/types/apps/src/implementation/cache.d.ts +3 -1
  48. package/types/apps/src/implementation/openapi-compile.d.ts +1 -1
  49. package/types/apps/src/implementation/openapi-document.d.ts +0 -2
  50. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  51. package/types/apps/src/implementation/openapi-request.d.ts +0 -1
  52. package/types/apps/src/implementation/openapi-source.d.ts +5 -1
  53. package/types/apps/src/implementation/schema.d.ts +0 -5
  54. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  55. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  56. package/types/apps/src/skills.d.ts +6 -3
  57. package/types/apps/src/ui-auth.d.ts +2 -2
  58. package/js/chunk-TE4KO4HI.js +0 -47
@@ -0,0 +1,85 @@
1
+ import {
2
+ Schema_exports
3
+ } from "./chunk-FW5HBOIK.js";
4
+
5
+ // ../app-cache/src/contracts/cache.ts
6
+ var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
7
+ reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"])
8
+ }) {
9
+ };
10
+ var cacheLimits = {
11
+ keyBytes: 8192,
12
+ entryBytes: 2e6,
13
+ batchBytes: 8e6,
14
+ batchEntries: 128,
15
+ totalBytes: 128e6,
16
+ totalEntries: 1e5,
17
+ retentionMs: 7 * 24 * 60 * 60 * 1e3,
18
+ loadTimeoutMs: 9e4,
19
+ /**
20
+ * A loader's lease lapses this long after its host last renewed it. Hosts renew every
21
+ * `renewMs` while the invocation that claimed it runs, so a stalled or lost holder frees the
22
+ * key well inside an MCP execute budget.
23
+ */
24
+ leaseMs: 15e3,
25
+ renewMs: 5e3,
26
+ /** The longest a caller waits on another loader before loading for itself without publishing. */
27
+ waitMs: 1e4,
28
+ /** Bound for one command to a host store; a lost reply fails instead of holding its caller. */
29
+ commandTimeoutMs: 1e4
30
+ };
31
+ var Key = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/));
32
+ var Time = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
33
+ var CacheEntry = Schema_exports.Struct({
34
+ value: Schema_exports.Json,
35
+ version: Schema_exports.String,
36
+ freshUntil: Time,
37
+ staleUntil: Time
38
+ });
39
+ var CacheAcquired = Schema_exports.Struct({
40
+ entry: Schema_exports.NullOr(CacheEntry),
41
+ lease: Schema_exports.NullOr(Schema_exports.String)
42
+ });
43
+ var CacheCommand = Schema_exports.Union([
44
+ Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
45
+ Schema_exports.Struct({
46
+ operation: Schema_exports.Literal("acquire"),
47
+ key: Key,
48
+ /** Claim even a fresh entry, as an explicit refresh does. */
49
+ refresh: Schema_exports.Boolean,
50
+ /** Claim only while the entry still has this version. Absent accepts the current one. */
51
+ version: Schema_exports.optionalKey(Schema_exports.NullOr(Schema_exports.String))
52
+ }),
53
+ Schema_exports.Struct({
54
+ operation: Schema_exports.Literal("claim"),
55
+ key: Key,
56
+ version: Schema_exports.NullOr(Schema_exports.String)
57
+ }),
58
+ Schema_exports.Struct({
59
+ operation: Schema_exports.Literal("publish"),
60
+ key: Key,
61
+ lease: Schema_exports.String,
62
+ entry: CacheEntry
63
+ }),
64
+ Schema_exports.Struct({ operation: Schema_exports.Literal("release"), key: Key, lease: Schema_exports.String }),
65
+ /** Extend a lease its holder still owns. Replies false once the lease lapsed or was replaced. */
66
+ Schema_exports.Struct({ operation: Schema_exports.Literal("renew"), key: Key, lease: Schema_exports.String }),
67
+ Schema_exports.Struct({
68
+ operation: Schema_exports.Literal("write"),
69
+ entries: Schema_exports.Array(Schema_exports.Struct({ key: Key, entry: CacheEntry }))
70
+ }),
71
+ Schema_exports.Struct({ operation: Schema_exports.Literal("invalidate"), key: Key })
72
+ ]);
73
+ var CacheReply = Schema_exports.Union([
74
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: Schema_exports.Json }),
75
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: CacheError })
76
+ ]);
77
+
78
+ export {
79
+ CacheError,
80
+ cacheLimits,
81
+ CacheEntry,
82
+ CacheAcquired,
83
+ CacheCommand,
84
+ CacheReply
85
+ };
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  DatabaseSchema
3
3
  } from "./chunk-BMOIAIVR.js";
4
+ import {
5
+ CacheCommand,
6
+ CacheReply
7
+ } from "./chunk-LGIYBDWA.js";
4
8
  import {
5
9
  AppSkills,
6
10
  SkillLoadFailed
@@ -307,41 +311,6 @@ var WorkflowControlCommand = Schema_exports.Union([
307
311
  Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
308
312
  ]);
309
313
 
310
- // src/contracts/schedules.ts
311
- var minimumIntervalMilliseconds = 6e4;
312
- var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
313
- var absent = Schema_exports.optionalKey(Schema_exports.Never);
314
- var Interval = Schema_exports.Union([
315
- Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
316
- Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
317
- Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
318
- ]);
319
- var CalendarSchedule = Schema_exports.Struct({
320
- expression: Schema_exports.NonEmptyString,
321
- timezone: Schema_exports.NonEmptyString
322
- }).check(
323
- Schema_exports.makeFilter(
324
- (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
325
- )
326
- );
327
- var ScheduleTiming = Schema_exports.Union([
328
- Schema_exports.Struct({
329
- kind: Schema_exports.Literal("interval"),
330
- milliseconds: Schema_exports.Int.check(
331
- Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
332
- message: "Schedule intervals must be at least 60 seconds"
333
- }),
334
- Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
335
- )
336
- }),
337
- Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
338
- ]);
339
- var OperationSchedule = Schema_exports.Struct({
340
- name: Schema_exports.NonEmptyString,
341
- timing: ScheduleTiming,
342
- input: JsonValue
343
- });
344
-
345
314
  // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
346
315
  var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
347
316
  var schema = /* @__PURE__ */ declare(isStream);
@@ -1849,10 +1818,45 @@ var Provider = class extends Data_exports.Class {
1849
1818
  var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1850
1819
  };
1851
1820
 
1852
- // src/contracts/operations.ts
1853
- var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
1821
+ // src/contracts/protocol-version.ts
1822
+ var frameworkProtocol = 1;
1854
1823
 
1855
- // src/contracts/host.ts
1824
+ // src/contracts/schedules.ts
1825
+ var minimumIntervalMilliseconds = 6e4;
1826
+ var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
1827
+ var absent = Schema_exports.optionalKey(Schema_exports.Never);
1828
+ var Interval = Schema_exports.Union([
1829
+ Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
1830
+ Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
1831
+ Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
1832
+ ]);
1833
+ var CalendarSchedule = Schema_exports.Struct({
1834
+ expression: Schema_exports.NonEmptyString,
1835
+ timezone: Schema_exports.NonEmptyString
1836
+ }).check(
1837
+ Schema_exports.makeFilter(
1838
+ (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
1839
+ )
1840
+ );
1841
+ var ScheduleTiming = Schema_exports.Union([
1842
+ Schema_exports.Struct({
1843
+ kind: Schema_exports.Literal("interval"),
1844
+ milliseconds: Schema_exports.Int.check(
1845
+ Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
1846
+ message: "Schedule intervals must be at least 60 seconds"
1847
+ }),
1848
+ Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
1849
+ )
1850
+ }),
1851
+ Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
1852
+ ]);
1853
+ var OperationSchedule = Schema_exports.Struct({
1854
+ name: Schema_exports.NonEmptyString,
1855
+ timing: ScheduleTiming,
1856
+ input: JsonValue
1857
+ });
1858
+
1859
+ // src/contracts/protocols/1.ts
1856
1860
  var DeclaredAuthMethod = Schema_exports.Union([
1857
1861
  Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1858
1862
  Schema_exports.Struct({
@@ -1906,6 +1910,11 @@ var ResolvedAccount = Schema_exports.Struct({
1906
1910
  id: AccountId,
1907
1911
  provider: DeclaredProvider,
1908
1912
  method: Schema_exports.NonEmptyString,
1913
+ /**
1914
+ * Changes when the account is reconnected or its credentials replaced, not on renewal. Hosts
1915
+ * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
1916
+ */
1917
+ generation: Schema_exports.optionalKey(Schema_exports.Int),
1909
1918
  fields: JsonObject2
1910
1919
  });
1911
1920
  var ResolvedAccounts = Schema_exports.Record(
@@ -1929,16 +1938,7 @@ var HostedToolSummary = HostedTool.mapFields(
1929
1938
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
1930
1939
  );
1931
1940
  var SkillSources = Schema_exports.Struct({ skills: AppSkills, dynamic: Schema_exports.Boolean });
1932
- var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
1933
1941
  var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills]);
1934
- var skillCatalog = (response) => Schema_exports.is(SkillSources)(response) ? response : { skills: response };
1935
- var inspectCommand = (tools, scheduled) => ({
1936
- operation: "inspect",
1937
- ...tools === void 0 ? {} : { tools: [...tools] },
1938
- ...scheduled === void 0 ? {} : { scheduled }
1939
- });
1940
- var indexCommand = { operation: "inspect", detail: "summary" };
1941
- var selectTools = (tools) => (all) => tools === void 0 ? all : all.filter((tool) => tools.includes(tool.name));
1942
1942
  var HostRequest = Schema_exports.Union([
1943
1943
  WorkflowCommand,
1944
1944
  WebhookCommand,
@@ -2036,23 +2036,19 @@ var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2036
2036
  {}
2037
2037
  ) {
2038
2038
  };
2039
- var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
2040
- var HostInspectError = Schema_exports.Union([
2039
+ var HostError = Schema_exports.Union([
2040
+ OpenapiResponseError,
2041
2041
  ProviderError,
2042
2042
  McpError,
2043
2043
  SkillLoadFailed,
2044
+ WorkflowFailure,
2044
2045
  HostRequestInvalid,
2045
- HostDeclarationInvalid,
2046
2046
  HostAccountsInvalid,
2047
- HostEvaluationFailed
2048
- ]);
2049
- var HostCallError = Schema_exports.Union([
2050
- OpenapiResponseError,
2051
- WorkflowFailure,
2052
- HostInspectError,
2053
- HostToolNotFound,
2047
+ HostDeclarationInvalid,
2048
+ HostEvaluationFailed,
2054
2049
  HostOperationNotFound,
2055
2050
  HostOperationFailed,
2051
+ HostToolNotFound,
2056
2052
  HostInputInvalid,
2057
2053
  HostOutputInvalid,
2058
2054
  HostToolBlocked,
@@ -2060,20 +2056,72 @@ var HostCallError = Schema_exports.Union([
2060
2056
  HostToolPolicyFailed,
2061
2057
  ElicitationFailed
2062
2058
  ]);
2063
- var HostDataError = HostCallError;
2064
- var HostError = Schema_exports.Union([
2065
- OpenapiResponseError,
2059
+ var HostResponse = Schema_exports.Union([
2060
+ Schema_exports.Struct({
2061
+ ok: Schema_exports.Literal(true),
2062
+ value: JsonValue,
2063
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2064
+ }),
2065
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
2066
+ ]);
2067
+ var HostInvocation = Schema_exports.Struct({
2068
+ command: HostRequest,
2069
+ accounts: ResolvedAccounts,
2070
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2071
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2072
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2073
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2074
+ });
2075
+ var protocol1 = {
2076
+ version: 1,
2077
+ schemas: {
2078
+ invocation: HostInvocation,
2079
+ request: HostRequest,
2080
+ response: HostResponse,
2081
+ requirements: DeclaredRequirements,
2082
+ tools: Schema_exports.Array(HostedTool),
2083
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2084
+ skills: SkillCatalogResponse,
2085
+ elicitationRequest: FormElicitation,
2086
+ elicitationReply: ElicitationReply,
2087
+ workflowStep: WorkflowRpcCommand,
2088
+ workflowStepReply: WorkflowRpcResult,
2089
+ workflowControl: WorkflowControlCommand,
2090
+ cacheCommand: CacheCommand,
2091
+ cacheReply: CacheReply
2092
+ }
2093
+ };
2094
+
2095
+ // src/contracts/operations.ts
2096
+ var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
2097
+
2098
+ // src/contracts/host.ts
2099
+ var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2100
+ var skillCatalog = (response) => Schema_exports.is(SkillSources)(response) ? response : { skills: response };
2101
+ var inspectCommand = (tools, scheduled) => ({
2102
+ operation: "inspect",
2103
+ ...tools === void 0 ? {} : { tools: [...tools] },
2104
+ ...scheduled === void 0 ? {} : { scheduled }
2105
+ });
2106
+ var indexCommand = { operation: "inspect", detail: "summary" };
2107
+ var selectTools = (tools) => (all) => tools === void 0 ? all : all.filter((tool) => tools.includes(tool.name));
2108
+ var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
2109
+ var HostInspectError = Schema_exports.Union([
2066
2110
  ProviderError,
2067
2111
  McpError,
2068
2112
  SkillLoadFailed,
2069
- WorkflowFailure,
2070
2113
  HostRequestInvalid,
2071
- HostAccountsInvalid,
2072
2114
  HostDeclarationInvalid,
2073
- HostEvaluationFailed,
2115
+ HostAccountsInvalid,
2116
+ HostEvaluationFailed
2117
+ ]);
2118
+ var HostCallError = Schema_exports.Union([
2119
+ OpenapiResponseError,
2120
+ WorkflowFailure,
2121
+ HostInspectError,
2122
+ HostToolNotFound,
2074
2123
  HostOperationNotFound,
2075
2124
  HostOperationFailed,
2076
- HostToolNotFound,
2077
2125
  HostInputInvalid,
2078
2126
  HostOutputInvalid,
2079
2127
  HostToolBlocked,
@@ -2081,19 +2129,12 @@ var HostError = Schema_exports.Union([
2081
2129
  HostToolPolicyFailed,
2082
2130
  ElicitationFailed
2083
2131
  ]);
2132
+ var HostDataError = HostCallError;
2084
2133
  var ToolResultObservation = Context_exports.Reference(
2085
2134
  "apps/ToolResultObservation",
2086
2135
  { defaultValue: () => ({ failed: () => {
2087
2136
  } }) }
2088
2137
  );
2089
- var HostResponse = Schema_exports.Union([
2090
- Schema_exports.Struct({
2091
- ok: Schema_exports.Literal(true),
2092
- value: JsonValue,
2093
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2094
- }),
2095
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
2096
- ]);
2097
2138
 
2098
2139
  export {
2099
2140
  SecretsMethod,
@@ -2129,11 +2170,6 @@ export {
2129
2170
  WorkflowRpcCommand,
2130
2171
  WorkflowRpcResult,
2131
2172
  WorkflowControlCommand,
2132
- minimumIntervalMilliseconds,
2133
- Interval,
2134
- CalendarSchedule,
2135
- ScheduleTiming,
2136
- OperationSchedule,
2137
2173
  ElicitationLimits,
2138
2174
  defaultElicitationLimits,
2139
2175
  FormElicitation,
@@ -2151,7 +2187,12 @@ export {
2151
2187
  ManualWebhookDescriptor,
2152
2188
  HostedWebhook,
2153
2189
  WebhookCommand,
2154
- OperationToolPrefixes,
2190
+ frameworkProtocol,
2191
+ minimumIntervalMilliseconds,
2192
+ Interval,
2193
+ CalendarSchedule,
2194
+ ScheduleTiming,
2195
+ OperationSchedule,
2155
2196
  DeclaredAuthMethod,
2156
2197
  DeclaredProvider,
2157
2198
  DeclaredRequirements,
@@ -2162,12 +2203,7 @@ export {
2162
2203
  HostedTool,
2163
2204
  HostedToolSummary,
2164
2205
  SkillSources,
2165
- skillsCommand,
2166
2206
  SkillCatalogResponse,
2167
- skillCatalog,
2168
- inspectCommand,
2169
- indexCommand,
2170
- selectTools,
2171
2207
  HostRequest,
2172
2208
  HostRequestInvalid,
2173
2209
  HostAccountsInvalid,
@@ -2183,11 +2219,19 @@ export {
2183
2219
  HostToolApprovalRequired,
2184
2220
  HostToolPolicyFailed,
2185
2221
  HostOutputInvalid,
2222
+ HostError,
2223
+ HostResponse,
2224
+ HostInvocation,
2225
+ protocol1,
2226
+ OperationToolPrefixes,
2227
+ skillsCommand,
2228
+ skillCatalog,
2229
+ inspectCommand,
2230
+ indexCommand,
2231
+ selectTools,
2186
2232
  HostRequirementsError,
2187
2233
  HostInspectError,
2188
2234
  HostCallError,
2189
2235
  HostDataError,
2190
- HostError,
2191
- ToolResultObservation,
2192
- HostResponse
2236
+ ToolResultObservation
2193
2237
  };
@@ -0,0 +1,39 @@
1
+ import {
2
+ appSignInCallbackPath
3
+ } from "./chunk-T2LAZCAD.js";
4
+ import {
5
+ HttpServerResponse_exports
6
+ } from "./chunk-QKHR7BMF.js";
7
+
8
+ // src/implementation/ui-auth.ts
9
+ var appPrivateHeaders = {
10
+ "cache-control": "no-store",
11
+ "referrer-policy": "no-referrer",
12
+ "x-content-type-options": "nosniff",
13
+ "content-security-policy": "frame-ancestors 'none'"
14
+ };
15
+ var appRedirect = (url) => HttpServerResponse_exports.redirect(url, { status: 302, headers: appPrivateHeaders });
16
+ var appSignInCallback = (origin, request, code) => {
17
+ const callback = new URL(appSignInCallbackPath, origin);
18
+ callback.searchParams.set("request", request);
19
+ callback.searchParams.set("code", code);
20
+ return callback.href;
21
+ };
22
+ var appSignInFailed = () => HttpServerResponse_exports.text(
23
+ `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Could not open app</title></head><body><p>Could not sign in to this app. Try opening it again.</p><a href="/">Try again</a></body></html>`,
24
+ {
25
+ status: 401,
26
+ contentType: "text/html",
27
+ headers: {
28
+ ...appPrivateHeaders,
29
+ "content-security-policy": "default-src 'none'; frame-ancestors 'none'; base-uri 'none'"
30
+ }
31
+ }
32
+ );
33
+
34
+ export {
35
+ appPrivateHeaders,
36
+ appRedirect,
37
+ appSignInCallback,
38
+ appSignInFailed
39
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  decoderOf
3
- } from "./chunk-2HHMABB6.js";
3
+ } from "./chunk-WFSQXYUT.js";
4
4
  import {
5
5
  Effect_exports
6
6
  } from "./chunk-FW5HBOIK.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-KOXMLKTM.js";
3
+ } from "./chunk-J7O55ZV7.js";
4
4
  import {
5
5
  fromPromise
6
- } from "./chunk-PZ36XMXW.js";
6
+ } from "./chunk-PYUYJRSK.js";
7
7
  import {
8
8
  ElicitationFailed,
9
9
  McpError,
@@ -13,11 +13,11 @@ import {
13
13
  defaultElicitationLimits,
14
14
  defaultMcpClientLimits,
15
15
  mcpSdkTimerCeilingMs
16
- } from "./chunk-IHQ4ML7K.js";
16
+ } from "./chunk-MYYEW3RA.js";
17
17
  import {
18
18
  compileJsonSchemaDecoder,
19
19
  jsonSchemaDecoder
20
- } from "./chunk-2HHMABB6.js";
20
+ } from "./chunk-WFSQXYUT.js";
21
21
  import {
22
22
  JsonObject
23
23
  } from "./chunk-SATWJKN6.js";
@@ -1,11 +1,3 @@
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
3
  } from "./chunk-FW5HBOIK.js";
@@ -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
  };