apps 0.0.1-beta.5 → 0.0.1-beta.7

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 (66) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-FWQC6I3C.js → chunk-5T57N25Q.js} +13 -1
  4. package/js/{chunk-TDNYXSIX.js → chunk-72JNVHPK.js} +21 -9
  5. package/js/{chunk-UDDE5KOR.js → chunk-CMYUWAX7.js} +26 -7
  6. package/js/chunk-FL2QR3XW.js +507 -0
  7. package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
  8. package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
  9. package/js/{chunk-67EVWIGJ.js → chunk-OCYUEU47.js} +4 -4
  10. package/js/{chunk-YEPYT6SD.js → chunk-R3EV5FTO.js} +12 -0
  11. package/js/{chunk-XHO2ZX6W.js → chunk-RFVIONFX.js} +27 -10
  12. package/js/{chunk-LUVSFETN.js → chunk-UESPOTUI.js} +127 -231
  13. package/js/{chunk-DQAZTA4I.js → chunk-WLE7WX2U.js} +290 -20
  14. package/js/{chunk-C3VAOK5B.js → chunk-YXQHV65J.js} +53 -26
  15. package/js/chunk-Z5M2LQOZ.js +209 -0
  16. package/js/client.js +1 -1
  17. package/js/contracts.js +34 -11
  18. package/js/effect.js +9 -11
  19. package/js/graphql.js +25 -32
  20. package/js/host.js +9 -11
  21. package/js/index.js +194 -192
  22. package/js/mcp/effect.js +11 -13
  23. package/js/mcp/stdio.js +15 -17
  24. package/js/mcp.js +50 -36
  25. package/js/openapi.js +166 -108
  26. package/js/skills.js +6 -7
  27. package/package.json +1 -1
  28. package/runtime.json +1 -1
  29. package/types/apps/src/contracts/app.d.ts +2 -5
  30. package/types/apps/src/contracts/host.d.ts +19 -7
  31. package/types/apps/src/contracts/mcp.d.ts +16 -0
  32. package/types/apps/src/contracts/openapi.d.ts +4 -0
  33. package/types/apps/src/contracts/operations.d.ts +0 -5
  34. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  35. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  36. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  37. package/types/apps/src/contracts/provider.d.ts +51 -5
  38. package/types/apps/src/contracts/router.d.ts +59 -0
  39. package/types/apps/src/graphql.d.ts +1 -3
  40. package/types/apps/src/implementation/account-router.d.ts +12 -0
  41. package/types/apps/src/implementation/app.d.ts +5 -4
  42. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  43. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  44. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  45. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  46. package/types/apps/src/implementation/mcp.d.ts +35 -19
  47. package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
  48. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  49. package/types/apps/src/implementation/operations.d.ts +26 -3
  50. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  51. package/types/apps/src/implementation/provider.d.ts +9 -4
  52. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  53. package/types/apps/src/implementation/router.d.ts +59 -0
  54. package/types/apps/src/implementation/schema.d.ts +5 -1
  55. package/types/apps/src/implementation/workflow-context.d.ts +1 -1
  56. package/types/apps/src/index.d.ts +5 -4
  57. package/types/apps/src/mcp-stdio.d.ts +2 -5
  58. package/types/apps/src/mcp.d.ts +5 -4
  59. package/types/apps/src/openapi.d.ts +6 -6
  60. package/js/chunk-3XKZDQLM.js +0 -93
  61. package/js/chunk-4M277YTM.js +0 -136
  62. package/js/chunk-SB3V4YVR.js +0 -18
  63. package/js/chunk-W4DMKWAB.js +0 -35
  64. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  65. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  66. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -3,7 +3,6 @@ import type { DatabaseDefinition } from "./storage.js";
3
3
  /** Native app contracts; factories and handlers compose in the host's Effect runtime. */
4
4
  import { type Effect, Schema } from "effect";
5
5
  import type { OperationSchedule } from "./schedules.js";
6
- import type { AppOperation } from "./operations.js";
7
6
  import type { AccountOf, AuthMethods, ManyAccounts, Provider } from "./provider.js";
8
7
  import type { AppWorkflow, WorkflowReads } from "./workflows.js";
9
8
  import type { Elicit } from "./elicitation.js";
@@ -11,8 +10,8 @@ import type { Elicit } from "./elicitation.js";
11
10
  type Handler<Context> = (context: Context, input: never) => Effect.Effect<unknown, unknown>;
12
11
  /** App capabilities share one account context. Package metadata belongs in package.json. */
13
12
  export interface AppDefinition<Context> {
14
- /** Optional dynamic tools; resolution does not enumerate the catalog. */
15
- readonly dynamicTools?: import("./dynamic-tools.js").DynamicTools;
13
+ /** The app's root router. Its keys form tool paths such as `issues.list`. */
14
+ readonly tools?: import("./router.js").AppRouter | import("./router.js").DynamicRouter;
16
15
  /** Omission reads packaged skills/. An explicit catalog replaces that default, including []. */
17
16
  readonly skills?: readonly AppSkillSource[];
18
17
  /** Optional lazy skills, added to the static catalog. Only skill reads call them. */
@@ -21,8 +20,6 @@ export interface AppDefinition<Context> {
21
20
  readonly schedules?: Readonly<Record<string, Omit<OperationSchedule, "name"> & {
22
21
  readonly tool: string;
23
22
  }>>;
24
- readonly queries?: Readonly<Record<string, AppOperation>>;
25
- readonly mutations?: Readonly<Record<string, AppOperation>>;
26
23
  readonly webhooks?: Readonly<Record<string, {
27
24
  readonly account: string;
28
25
  readonly config: Schema.Decoder<unknown>;
@@ -30,8 +30,12 @@ export { frameworkProtocol } from "./protocol-version.js";
30
30
  export { protocol1 } from "./protocols/1.js";
31
31
  export { protocol2 } from "./protocols/2.js";
32
32
  export { protocol3 } from "./protocols/3.js";
33
- import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/3.js";
34
- export { DeclaredAuthMethod, DeclaredProvider, DeclaredRequirements, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, SkillSources, SkillCatalogResponse, HostRequest, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/3.js";
33
+ export { protocol4 } from "./protocols/4.js";
34
+ export { protocol5, AccountCheckCommand } from "./protocols/5.js";
35
+ export { AccountCheckResult, AccountInfo } from "./provider.js";
36
+ import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostKindMismatch, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/5.js";
37
+ export { DeclaredRequirements, HostRequest } from "./protocols/5.js";
38
+ export { DeclaredAuthMethod, DeclaredProvider, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, HostRouterError, HostedRouter, HostedCatalog, HostedCatalogSummary, SkillSources, SkillCatalogResponse, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, HostKindMismatch, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/5.js";
35
39
  /** Raw host inputs; the host boundary parses and redacts these immediately. */
36
40
  export type ResolvedAccountsInput = typeof ResolvedAccounts.Encoded;
37
41
  /** Trusted invocation context, supplied separately from the Request. */
@@ -82,17 +86,24 @@ export declare const indexCommand: {
82
86
  };
83
87
  /** Keep only the requested tools from an inspection that may have described every tool. */
84
88
  export declare const selectTools: (tools?: readonly string[]) => <A extends {
85
- readonly name: string;
86
- }>(all: readonly A[]) => readonly A[];
89
+ readonly tools: readonly {
90
+ readonly name: string;
91
+ }[];
92
+ }>(catalog: A) => A;
87
93
  /** Declaration reads do not bind accounts or evaluate the app factory. A named declaration
88
94
  * problem, such as a reserved database field, is reported so the deploy can explain it. */
89
95
  export declare const HostRequirementsError: Schema.Union<readonly [typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof DatabaseFieldReserved]>;
90
96
  /** Inspection can fail while binding accounts or evaluating the live definition. */
91
97
  export declare const HostInspectError: Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>;
92
98
  /** Tool invocation adds lookup, input, execution and output failures to inspection. */
93
- export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
99
+ export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
100
+ /**
101
+ * An account check binds one account and runs the provider's check without evaluating the app.
102
+ * Timeouts arrive as WorkflowFailure from the shared deadline guard.
103
+ */
104
+ export declare const HostAccountCheckError: Schema.Union<readonly [typeof ProviderError, typeof WorkflowFailure, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostOutputInvalid]>;
94
105
  /** Queries, mutations and agent calls use the same operation failures. */
95
- export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
106
+ export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
96
107
  /** Invocation-owned outcome sink. Framework adapters report semantic failures
97
108
  * independently of successful JSON transport; customer output is never inspected. */
98
109
  export declare const ToolResultObservation: Context.Reference<{
@@ -100,5 +111,6 @@ export declare const ToolResultObservation: Context.Reference<{
100
111
  }>;
101
112
  /** Native handler; context comes from host authority, never from request content. */
102
113
  export type AppHandler = (request: Request, context: HostContext) => Effect.Effect<Response>;
103
- export { OperationToolPrefixes, type AppOperation, type OperationContext } from "./operations.js";
114
+ export { type AppOperation, type OperationContext } from "./operations.js";
115
+ export { RouterIcon, RouterKey, RouterMeta, type AppNode, type AppRouter, type DynamicRouter, } from "./router.js";
104
116
  export * from "./schedules.js";
@@ -63,6 +63,22 @@ export declare const McpToolMetadata: Schema.Struct<{
63
63
  readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
64
64
  }>;
65
65
  export type McpToolMetadata = typeof McpToolMetadata.Type;
66
+ /** What a server reports about itself when a session initializes. Icons are for display only. */
67
+ export declare const McpServerHeader: Schema.Struct<{
68
+ readonly name: Schema.optionalKey<Schema.String>;
69
+ readonly title: Schema.optionalKey<Schema.String>;
70
+ readonly version: Schema.optionalKey<Schema.String>;
71
+ readonly description: Schema.optionalKey<Schema.String>;
72
+ readonly websiteUrl: Schema.optionalKey<Schema.String>;
73
+ readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
74
+ readonly src: Schema.NonEmptyString;
75
+ readonly mimeType: Schema.optionalKey<Schema.String>;
76
+ readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
77
+ readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
78
+ }>>>;
79
+ readonly instructions: Schema.optionalKey<Schema.String>;
80
+ }>;
81
+ export type McpServerHeader = typeof McpServerHeader.Type;
66
82
  /** Direct callers can omit interaction capabilities. A server that asks for input then fails explicitly. */
67
83
  export interface McpToolContext {
68
84
  readonly elicit?: Elicit;
@@ -75,6 +75,8 @@ export declare const OpenapiOperation: Schema.Struct<{
75
75
  }>;
76
76
  /** Streams remain in the metadata but cannot run through a single-result tool call. */
77
77
  readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
78
+ /** The operation's OpenAPI tags, shown to agents as labels within its router. */
79
+ readonly tags: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
78
80
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
79
81
  readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
80
82
  readonly errorResponses: Schema.optionalKey<Schema.$Array<Schema.Struct<{
@@ -153,6 +155,8 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
153
155
  }>;
154
156
  /** Streams remain in the metadata but cannot run through a single-result tool call. */
155
157
  readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
158
+ /** The operation's OpenAPI tags, shown to agents as labels within its router. */
159
+ readonly tags: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
156
160
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
157
161
  readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
158
162
  readonly errorResponses: Schema.optionalKey<Schema.$Array<Schema.Struct<{
@@ -23,8 +23,3 @@ export interface AppOperation<Input = unknown, Output = unknown> {
23
23
  readonly approval?: Approval<Input>;
24
24
  readonly run: (context: OperationContext, input: Input) => Effect.Effect<Output, unknown>;
25
25
  }
26
- /** Agent tool names carry the operation kind; catalogs may reuse the same local name. */
27
- export declare const OperationToolPrefixes: {
28
- readonly query: "queries.";
29
- readonly mutate: "mutations.";
30
- };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The host protocol this framework speaks. It is written into `runtime.json` and every host
3
- * snapshot. Released protocols are frozen: see `protocols/3.ts` and notes/apps-publishing.md.
3
+ * snapshot. Released protocols are frozen: see `protocols/4.ts` and notes/apps-publishing.md.
4
4
  * This file has no imports so the package build script can read it directly.
5
5
  */
6
- export declare const frameworkProtocol = 3;
6
+ export declare const frameworkProtocol = 5;