apps 0.0.1-beta.5 → 0.0.1-beta.6

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 (63) 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-67EVWIGJ.js → chunk-6BSSI67S.js} +4 -4
  5. package/js/{chunk-DQAZTA4I.js → chunk-B3EOZTK3.js} +212 -19
  6. package/js/{chunk-TDNYXSIX.js → chunk-ECQFRCH4.js} +21 -9
  7. package/js/{chunk-UDDE5KOR.js → chunk-ITM77QPO.js} +26 -7
  8. package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
  9. package/js/chunk-MNMNLXBL.js +507 -0
  10. package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
  11. package/js/{chunk-C3VAOK5B.js → chunk-OE3QQTSB.js} +33 -26
  12. package/js/{chunk-YEPYT6SD.js → chunk-R3EV5FTO.js} +12 -0
  13. package/js/{chunk-XHO2ZX6W.js → chunk-RFVIONFX.js} +27 -10
  14. package/js/{chunk-LUVSFETN.js → chunk-SB4HEPNJ.js} +72 -228
  15. package/js/chunk-T7GKZBLP.js +209 -0
  16. package/js/client.js +1 -1
  17. package/js/contracts.js +24 -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 +184 -173
  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 +11 -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/router.d.ts +59 -0
  37. package/types/apps/src/graphql.d.ts +1 -3
  38. package/types/apps/src/implementation/account-router.d.ts +12 -0
  39. package/types/apps/src/implementation/app.d.ts +5 -4
  40. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  41. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  42. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  43. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  44. package/types/apps/src/implementation/mcp.d.ts +35 -19
  45. package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
  46. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  47. package/types/apps/src/implementation/operations.d.ts +26 -3
  48. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  49. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  50. package/types/apps/src/implementation/router.d.ts +59 -0
  51. package/types/apps/src/implementation/schema.d.ts +5 -1
  52. package/types/apps/src/implementation/workflow-context.d.ts +1 -1
  53. package/types/apps/src/index.d.ts +3 -2
  54. package/types/apps/src/mcp-stdio.d.ts +2 -5
  55. package/types/apps/src/mcp.d.ts +5 -4
  56. package/types/apps/src/openapi.d.ts +6 -6
  57. package/js/chunk-3XKZDQLM.js +0 -93
  58. package/js/chunk-4M277YTM.js +0 -136
  59. package/js/chunk-SB3V4YVR.js +0 -18
  60. package/js/chunk-W4DMKWAB.js +0 -35
  61. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  62. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  63. 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,9 @@ 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
+ import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostKindMismatch, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/4.js";
35
+ export { DeclaredAuthMethod, DeclaredProvider, DeclaredRequirements, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, HostRouterError, HostedRouter, HostedCatalog, HostedCatalogSummary, SkillSources, SkillCatalogResponse, HostRequest, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, HostKindMismatch, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/4.js";
35
36
  /** Raw host inputs; the host boundary parses and redacts these immediately. */
36
37
  export type ResolvedAccountsInput = typeof ResolvedAccounts.Encoded;
37
38
  /** Trusted invocation context, supplied separately from the Request. */
@@ -82,17 +83,19 @@ export declare const indexCommand: {
82
83
  };
83
84
  /** Keep only the requested tools from an inspection that may have described every tool. */
84
85
  export declare const selectTools: (tools?: readonly string[]) => <A extends {
85
- readonly name: string;
86
- }>(all: readonly A[]) => readonly A[];
86
+ readonly tools: readonly {
87
+ readonly name: string;
88
+ }[];
89
+ }>(catalog: A) => A;
87
90
  /** Declaration reads do not bind accounts or evaluate the app factory. A named declaration
88
91
  * problem, such as a reserved database field, is reported so the deploy can explain it. */
89
92
  export declare const HostRequirementsError: Schema.Union<readonly [typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof DatabaseFieldReserved]>;
90
93
  /** Inspection can fail while binding accounts or evaluating the live definition. */
91
94
  export declare const HostInspectError: Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>;
92
95
  /** 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]>;
96
+ 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]>;
94
97
  /** 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]>;
98
+ 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
99
  /** Invocation-owned outcome sink. Framework adapters report semantic failures
97
100
  * independently of successful JSON transport; customer output is never inspected. */
98
101
  export declare const ToolResultObservation: Context.Reference<{
@@ -100,5 +103,6 @@ export declare const ToolResultObservation: Context.Reference<{
100
103
  }>;
101
104
  /** Native handler; context comes from host authority, never from request content. */
102
105
  export type AppHandler = (request: Request, context: HostContext) => Effect.Effect<Response>;
103
- export { OperationToolPrefixes, type AppOperation, type OperationContext } from "./operations.js";
106
+ export { type AppOperation, type OperationContext } from "./operations.js";
107
+ export { RouterIcon, RouterKey, RouterMeta, type AppNode, type AppRouter, type DynamicRouter, } from "./router.js";
104
108
  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 = 4;