stitchkit 0.68.0 → 0.68.1

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 (175) hide show
  1. package/dist/agent-runtime/admission-lanes.d.ts +1 -1
  2. package/dist/agent-runtime/compaction.d.ts +2 -2
  3. package/dist/agent-runtime/events.d.ts +1 -1
  4. package/dist/agent-runtime/history.d.ts +1 -1
  5. package/dist/agent-runtime/history.d.ts.map +1 -1
  6. package/dist/agent-runtime/injection.d.ts +1 -1
  7. package/dist/agent-runtime/managed-tools.d.ts +3 -3
  8. package/dist/agent-runtime/models.d.ts +1 -1
  9. package/dist/agent-runtime/observability.d.ts +1 -1
  10. package/dist/agent-runtime/prompt.d.ts +1 -1
  11. package/dist/agent-runtime/prompt.d.ts.map +1 -1
  12. package/dist/agent-runtime/protocol.d.ts +19 -1
  13. package/dist/agent-runtime/protocol.d.ts.map +1 -1
  14. package/dist/agent-runtime/run-execution.d.ts +5 -5
  15. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  16. package/dist/agent-runtime/runtime-internals.d.ts +1 -1
  17. package/dist/agent-runtime/runtime-result.d.ts +1 -1
  18. package/dist/agent-runtime/runtime.d.ts +14 -12
  19. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  20. package/dist/agent-runtime/store-driver.d.ts +2 -2
  21. package/dist/agent-runtime/store.d.ts +2 -2
  22. package/dist/agent-runtime/terminal-commit.d.ts +2 -2
  23. package/dist/agent-runtime/terminal-status.d.ts +1 -1
  24. package/dist/agent-runtime-openrouter.d.ts +1 -1
  25. package/dist/agent-runtime.d.ts +15 -15
  26. package/dist/agent-runtime.d.ts.map +1 -1
  27. package/dist/agent-runtime.js +87 -26
  28. package/dist/application/admission.d.ts +1 -1
  29. package/dist/application/events.d.ts +2 -2
  30. package/dist/application/grammy.d.ts +2 -2
  31. package/dist/application/graph.d.ts +1 -1
  32. package/dist/application/health.d.ts +1 -1
  33. package/dist/application/kernel.d.ts +3 -3
  34. package/dist/application/opentelemetry.d.ts +3 -3
  35. package/dist/application/resource.d.ts +1 -1
  36. package/dist/application/schedule.d.ts +1 -1
  37. package/dist/application/server-resource.d.ts +7 -9
  38. package/dist/application/server-resource.d.ts.map +1 -1
  39. package/dist/application-grammy.d.ts +1 -1
  40. package/dist/application-opentelemetry.d.ts +1 -1
  41. package/dist/application.d.ts +11 -11
  42. package/dist/application.js +7 -7
  43. package/dist/browser/client-multipart.d.ts +1 -1
  44. package/dist/browser/client-url.d.ts +2 -2
  45. package/dist/browser/client.d.ts +4 -4
  46. package/dist/browser/client.d.ts.map +1 -1
  47. package/dist/browser/contract-stream.d.ts +1 -1
  48. package/dist/browser/http.d.ts +7 -7
  49. package/dist/browser/http.d.ts.map +1 -1
  50. package/dist/browser/socket-io.d.ts +12 -31
  51. package/dist/browser/socket-io.d.ts.map +1 -1
  52. package/dist/browser/stream.d.ts +2 -2
  53. package/dist/cli.d.ts +6 -6
  54. package/dist/cli.js +4 -3
  55. package/dist/contract/errors-factory.d.ts +1 -1
  56. package/dist/contract/factory.d.ts +1 -1
  57. package/dist/contract/index.d.ts +7 -7
  58. package/dist/files/boundary.d.ts +1 -1
  59. package/dist/files.d.ts +2 -2
  60. package/dist/{index-zd4v31v2.js → index-2ve29dzn.js} +3 -3
  61. package/dist/index-7etq650s.js +75 -0
  62. package/dist/{index-7pn02bgv.js → index-cszjsxy5.js} +22 -83
  63. package/dist/index-g2j2m6vv.js +63 -0
  64. package/dist/{index-nymn7wbg.js → index-nck3yx3y.js} +15 -8
  65. package/dist/index.d.ts +10 -10
  66. package/dist/index.js +4 -4
  67. package/dist/internal/errors.d.ts +1 -1
  68. package/dist/internal/observability-sink.d.ts +1 -1
  69. package/dist/node.d.ts +11 -11
  70. package/dist/node.js +2 -2
  71. package/dist/observability/audit.d.ts +5 -5
  72. package/dist/observability/context.d.ts +2 -2
  73. package/dist/observability/event.d.ts +2 -2
  74. package/dist/observability/index.d.ts +6 -6
  75. package/dist/react/entity-cache.d.ts +26 -1
  76. package/dist/react/entity-cache.d.ts.map +1 -1
  77. package/dist/react.d.ts +3 -3
  78. package/dist/react.d.ts.map +1 -1
  79. package/dist/react.js +136 -38
  80. package/dist/realtime/contract.d.ts +1 -1
  81. package/dist/realtime/index.d.ts +4 -4
  82. package/dist/realtime/rejection.d.ts +1 -1
  83. package/dist/realtime/request.d.ts +1 -1
  84. package/dist/realtime/socket.d.ts +2 -2
  85. package/dist/remote.d.ts +1 -1
  86. package/dist/remote.js +1 -1
  87. package/dist/server/bun.d.ts +3 -3
  88. package/dist/server/context-contribution.d.ts +1 -1
  89. package/dist/server/context.d.ts +4 -4
  90. package/dist/server/contract-stream.d.ts +2 -2
  91. package/dist/server/create.d.ts +1 -1
  92. package/dist/server/error-hook.d.ts +3 -3
  93. package/dist/server/file.d.ts +1 -1
  94. package/dist/server/implement.d.ts +2 -2
  95. package/dist/server/index.d.ts +31 -31
  96. package/dist/server/index.js +9 -9
  97. package/dist/server/lifecycle.d.ts +1 -1
  98. package/dist/server/logging.d.ts +1 -1
  99. package/dist/server/middleware/auth.d.ts +2 -2
  100. package/dist/server/multipart.d.ts +2 -2
  101. package/dist/server/node.d.ts +2 -2
  102. package/dist/server/openapi.d.ts +1 -1
  103. package/dist/server/process-signal-common.d.ts +1 -1
  104. package/dist/server/process-signals.d.ts +1 -1
  105. package/dist/server/realtime.d.ts +4 -4
  106. package/dist/server/response-metadata.d.ts +1 -1
  107. package/dist/server/router.d.ts +1 -1
  108. package/dist/server/shutdown.d.ts +1 -1
  109. package/dist/server/socket-io-node.d.ts +3 -3
  110. package/dist/server/socket-io.d.ts +6 -6
  111. package/dist/server/streaming-route.d.ts +2 -2
  112. package/dist/server/types.d.ts +6 -6
  113. package/dist/server/unix-client-bun.d.ts.map +1 -1
  114. package/dist/server/unix-client.d.ts +2 -2
  115. package/dist/server/unix-client.d.ts.map +1 -1
  116. package/dist/testing/agent-store-conformance.d.ts +1 -1
  117. package/dist/testing/managed-resource-conformance-contract.d.ts +1 -1
  118. package/dist/testing/managed-resource-conformance-driver.d.ts +2 -2
  119. package/dist/testing/managed-resource-conformance-scenarios.d.ts +2 -2
  120. package/dist/testing/managed-resource-conformance.d.ts +2 -2
  121. package/dist/testing/surface-conformance.d.ts +3 -3
  122. package/dist/testing/surface-manifest.d.ts +5 -5
  123. package/dist/testing.d.ts +8 -8
  124. package/dist/testing.js +1 -1
  125. package/dist/tool-invoker.d.ts +9 -0
  126. package/dist/tool-invoker.d.ts.map +1 -0
  127. package/dist/tool-invoker.js +16 -0
  128. package/dist/tools/agent.d.ts +4 -4
  129. package/dist/tools/async-operation.d.ts +3 -3
  130. package/dist/tools/cli-command.d.ts +3 -3
  131. package/dist/tools/cli-format.d.ts +1 -1
  132. package/dist/tools/cli-policy.d.ts +1 -1
  133. package/dist/tools/cli-wait.d.ts +1 -1
  134. package/dist/tools/cli.d.ts +7 -7
  135. package/dist/tools/define-download-tool.d.ts +4 -4
  136. package/dist/tools/define-upload-tool.d.ts +3 -3
  137. package/dist/tools/define-view-file-tool.d.ts +3 -3
  138. package/dist/tools/define-wait-tool.d.ts +2 -2
  139. package/dist/tools/download-core.d.ts +2 -2
  140. package/dist/tools/execute.d.ts +2 -2
  141. package/dist/tools/flatten-join.d.ts +1 -1
  142. package/dist/tools/internal/surface-projector.d.ts +3 -3
  143. package/dist/tools/invoker.d.ts +4 -4
  144. package/dist/tools/lifecycle.d.ts +1 -1
  145. package/dist/tools/list-names.d.ts +2 -2
  146. package/dist/tools/managed-file-error.d.ts +1 -1
  147. package/dist/tools/manifest.d.ts +3 -3
  148. package/dist/tools/mcp-handler.d.ts +4 -4
  149. package/dist/tools/mcp-prepare.d.ts +8 -8
  150. package/dist/tools/mcp-round-policy.d.ts +1 -1
  151. package/dist/tools/mcp-round.d.ts +3 -3
  152. package/dist/tools/mcp-stdio-signals.d.ts +2 -2
  153. package/dist/tools/mcp-stdio.d.ts +3 -3
  154. package/dist/tools/mcp.d.ts +7 -7
  155. package/dist/tools/mount-download.d.ts +1 -1
  156. package/dist/tools/mount-upload.d.ts +1 -1
  157. package/dist/tools/mount.d.ts +5 -5
  158. package/dist/tools/native-definition.d.ts +2 -2
  159. package/dist/tools/native-mcp.d.ts +3 -3
  160. package/dist/tools/oauth-metadata.d.ts +1 -1
  161. package/dist/tools/oauth-provider.d.ts +1 -1
  162. package/dist/tools/presentation.d.ts +1 -1
  163. package/dist/tools/remote.d.ts +3 -3
  164. package/dist/tools/runtime-tool.d.ts +2 -2
  165. package/dist/tools/surface.d.ts +5 -5
  166. package/dist/tools/tool-logger.d.ts +1 -1
  167. package/dist/tools/toolkit.d.ts +7 -7
  168. package/dist/tools/transports.d.ts +2 -2
  169. package/dist/tools/upload-core.d.ts +1 -1
  170. package/dist/tools/view-file.d.ts +1 -1
  171. package/dist/tools.d.ts +42 -42
  172. package/dist/tools.js +18 -61
  173. package/llms-full.txt +169 -18
  174. package/package.json +8 -4
  175. package/dist/{index-avjd67h6.js → index-cz32amcb.js} +3 -3
@@ -1,7 +1,7 @@
1
1
  import { type CallToolResult, type McpServer } from '@modelcontextprotocol/server';
2
- import { executeToolMethod, type ToolCallHooks, type ToolLifecycle } from './execute';
3
- import type { PreparedRuntimeMcpTool } from './mcp-prepare';
4
- import type { McpRoundRuntime } from './mcp-round';
2
+ import { executeToolMethod, type ToolCallHooks, type ToolLifecycle } from './execute.js';
3
+ import type { PreparedRuntimeMcpTool } from './mcp-prepare.js';
4
+ import type { McpRoundRuntime } from './mcp-round.js';
5
5
  interface NativeMcpRuntimeConfig {
6
6
  context?: Record<string, unknown>;
7
7
  hooks?: ToolCallHooks;
@@ -1,4 +1,4 @@
1
- import type { RawRoute } from '../server/types';
1
+ import type { RawRoute } from '../server/types.js';
2
2
  /**
3
3
  * OAuth 2.0 Protected Resource Metadata (RFC 9728). An MCP server acting as a
4
4
  * resource server publishes this so a client, after a `401`, can discover which
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { RawRoute } from '../server/types';
2
+ import type { RawRoute } from '../server/types.js';
3
3
  /**
4
4
  * OpenID Connect DCR `application_type` (SEP-837). A `native` client (desktop /
5
5
  * CLI) may register an `http` loopback redirect; a `web` client may not — the
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { type ToolPresentationSchema } from './flatten';
2
+ import { type ToolPresentationSchema } from './flatten.js';
3
3
  export interface ToolPresentationConfig {
4
4
  paramsSchema?: z.ZodType;
5
5
  inputSchema?: z.ZodType;
@@ -1,6 +1,6 @@
1
- import { type HttpClient } from '../browser/http';
2
- import { type ContractDef, type EndpointDef } from '../contract';
3
- import type { ServiceDef } from '../server/types';
1
+ import { type HttpClient } from '../browser/http.js';
2
+ import { type ContractDef, type EndpointDef } from '../contract/index.js';
3
+ import type { ServiceDef } from '../server/types.js';
4
4
  export interface ImplementRemoteOptions {
5
5
  /**
6
6
  * Rewrite a call's arguments before they are forwarded to the remote API.
@@ -1,8 +1,8 @@
1
1
  import type { CallToolResult } from '@modelcontextprotocol/server';
2
2
  import type { Tool } from 'ai';
3
3
  import type { ZodObject, ZodType, z } from 'zod';
4
- import type { EndpointMcpPolicy, EndpointToolAnnotations, EndpointUiMeta, HttpMethod, McpCallContext, RuntimeContext } from '../contract';
5
- import type { MountableTool } from './mount';
4
+ import type { EndpointMcpPolicy, EndpointToolAnnotations, EndpointUiMeta, HttpMethod, McpCallContext, RuntimeContext } from '../contract/index.js';
5
+ import type { MountableTool } from './mount.js';
6
6
  export type RuntimeToolTransport = 'MCP' | 'AGENT' | 'CLI';
7
7
  export interface RuntimeToolIdentity {
8
8
  serviceName: string;
@@ -1,8 +1,8 @@
1
- import type { Transport } from '../contract';
2
- import type { ServiceDef } from '../server/types';
3
- import { type ProjectedTool } from './internal/surface-projector';
4
- import { type CollectToolsConfig, type MountableTool } from './mount';
5
- import { type RuntimeToolDefinition } from './runtime-tool';
1
+ import type { Transport } from '../contract/index.js';
2
+ import type { ServiceDef } from '../server/types.js';
3
+ import { type ProjectedTool } from './internal/surface-projector.js';
4
+ import { type CollectToolsConfig, type MountableTool } from './mount.js';
5
+ import { type RuntimeToolDefinition } from './runtime-tool.js';
6
6
  export type ToolSurfaceTransport = Exclude<Transport, 'HTTP'>;
7
7
  /** Contract and pathless runtime operations that form one tool surface. */
8
8
  export interface ToolSurfaceDefinition {
@@ -1,4 +1,4 @@
1
- import type { ToolCallHooks } from './execute';
1
+ import type { ToolCallHooks } from './execute.js';
2
2
  /** The structured record behind each logged line — for metrics via `onRecord`. */
3
3
  export interface ToolCallRecord {
4
4
  /** The mounted tool name. */
@@ -16,13 +16,13 @@
16
16
  */
17
17
  import type { McpServer } from '@modelcontextprotocol/server';
18
18
  import type { ToolSet } from 'ai';
19
- import type { ServiceDef } from '../server/types';
20
- import { type AgentMountConfig } from './agent';
21
- import { type CliConfig } from './cli';
22
- import { type McpMountConfig, type McpServerBuildConfig } from './mcp';
23
- import { type McpHandlerConfig, type McpHttpHandler } from './mcp-handler';
24
- import { type McpStdioHandle, type StdioMcpServerConfig } from './mcp-stdio';
25
- import type { ToolExtend } from './mount';
19
+ import type { ServiceDef } from '../server/types.js';
20
+ import { type AgentMountConfig } from './agent.js';
21
+ import { type CliConfig } from './cli.js';
22
+ import { type McpMountConfig, type McpServerBuildConfig } from './mcp.js';
23
+ import { type McpHandlerConfig, type McpHttpHandler } from './mcp-handler.js';
24
+ import { type McpStdioHandle, type StdioMcpServerConfig } from './mcp-stdio.js';
25
+ import type { ToolExtend } from './mount.js';
26
26
  /** Re-type a config's static `context` (and `extend`) to the toolkit's `TContext`. */
27
27
  type WithStaticContext<C, TContext extends Record<string, unknown>> = C extends unknown ? Omit<C, 'context' | 'extend'> & {
28
28
  context?: TContext;
@@ -7,8 +7,8 @@
7
7
  * Tool counts come from the mixed-surface collector the mounts use, so runtime
8
8
  * definitions cannot disappear from the boot diagnostic.
9
9
  */
10
- import type { Transport } from '../contract';
11
- import { type ToolSurfaceDefinition } from './surface';
10
+ import type { Transport } from '../contract/index.js';
11
+ import { type ToolSurfaceDefinition } from './surface.js';
12
12
  /** Operation counts per transport, for one service or the whole fleet. */
13
13
  export type TransportCounts = Record<Transport, number>;
14
14
  /** The result of `summarizeTransports`. */
@@ -1,4 +1,4 @@
1
- import type { ManagedFileBoundary, ManagedFileSource } from '../files/boundary';
1
+ import type { ManagedFileBoundary, ManagedFileSource } from '../files/boundary.js';
2
2
  /** Read one bounded managed source and hand its immutable bytes to an uploader. */
3
3
  export declare function runUploadOperation<T>(files: ManagedFileBoundary, path: string, upload: (source: ManagedFileSource, signal?: AbortSignal) => T | Promise<T>, signal?: AbortSignal): Promise<T>;
4
4
  //# sourceMappingURL=upload-core.d.ts.map
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import type { McpServer } from '@modelcontextprotocol/server';
16
16
  import { z } from 'zod';
17
- import { type ManagedFileBoundary } from '../files/boundary';
17
+ import { type ManagedFileBoundary } from '../files/boundary.js';
18
18
  /**
19
19
  * Annotation telling the client who a content block is for. `audience` lists
20
20
  * `'user'` (render for the human) and/or `'assistant'` (keep in model context);
package/dist/tools.d.ts CHANGED
@@ -1,44 +1,44 @@
1
1
  export type { McpServer } from '@modelcontextprotocol/server';
2
- export type { ManagedFileBoundary, ManagedFileReadOptions, ManagedFileSource, ManagedFileWriteOptions, } from './files/boundary';
3
- export type { OperationIdentity } from './server/types';
4
- export { type AgentContext, type AgentMountConfig, mountAgent } from './tools/agent';
5
- export { type AdaptedContractAsyncOperationConfig, type AdaptedContractAsyncOperationFollowKey, type AdaptedContractAsyncOperationStartKey, type AdaptedContractAsyncOperationWaitKey, type AsyncOperationCancelCapability, type AsyncOperationCancelResult, AsyncOperationCancelResultSchema, type AsyncOperationCapability, type AsyncOperationContractConfig, type AsyncOperationContractWithStartOutputConfig, type AsyncOperationFollowDefinition, type AsyncOperationIdentity, type AsyncOperationOutputCapability, type AsyncOperationStartDefinition, type BoundAdaptedContractAsyncOperation, bindContractAsyncOperation, type ContractAsyncOperationConfig, type ContractAsyncOperationFollowKey, type ContractAsyncOperationInputAdapters, type ContractAsyncOperationKeys, type ContractAsyncOperationStartKey, type ContractAsyncOperationWaitKey, createAsyncOperationSnapshotSchema, type DefinedAsyncOperationContract, defineAsyncOperation, defineAsyncOperationContract, type RuntimeAsyncOperation, type RuntimeAsyncOperationConfig, } from './tools/async-operation';
6
- export { type CliConfig, type CliSurfaceSource, createCli } from './tools/cli';
7
- export { type CliCommandContext, type CliCommandDefinition, type CliCommandDefinitionBase, type CliCommandDefinitionWithOutput, type CliCommandDefinitionWithoutOutput, defineCliCommand, } from './tools/cli-command';
8
- export type { ExitCodeMap } from './tools/cli-format';
9
- export type { CliPresentationPolicyConfig } from './tools/cli-policy';
10
- export type { CliWaitConfig } from './tools/cli-wait';
11
- export { coerceJsonArgs } from './tools/coerce';
12
- export { type DefineDownloadToolConfig, defineDownloadTool, } from './tools/define-download-tool';
13
- export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, } from './tools/define-upload-tool';
14
- export { type DefineViewFileToolConfig, defineViewFileTool, } from './tools/define-view-file-tool';
15
- export { type DefineWaitToolConfig, defineWaitTool, type ManagedWaitRender, } from './tools/define-wait-tool';
16
- export type { AfterToolCallOptions, BeforeToolCallOptions, ErrorHintFn, ToolCallContext, ToolCallHooks, ToolErrorOptions, ToolExecutionControlReason, ToolLifecycle, ToolOperation, ToolResult, } from './tools/execute';
17
- export { isToolExecutionControlError, ToolExecutionControlError } from './tools/execute';
18
- export { flattenToolJsonSchema, type ToolPresentationSchema, } from './tools/flatten';
19
- export { createToolInvoker, type ToolInvocationOptions, type ToolInvoker, type ToolInvokerConfig, type ToolInvokerTransport, } from './tools/invoker';
20
- export { composeToolLifecycle } from './tools/lifecycle';
21
- export { listContractToolNames, listToolNames, type ToolNameEntry, } from './tools/list-names';
22
- export { buildToolManifest, type ToolManifestConfig, type ToolManifestEntry, } from './tools/manifest';
23
- export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfig, type McpMountConfig, type McpServerBuildConfig, type McpServerSharedConfig, mountMcp, mountMcpResource, validateMcpSchemas, } from './tools/mcp';
24
- export { EXT_APPS_BUNDLE_PLACEHOLDER, inlineMcpAppBundle, type McpAppCsp, type McpAppResourceMeta, type McpResourceDef, RESOURCE_MIME_TYPE, } from './tools/mcp-app';
25
- export { createMcpHandler, createMcpHttpRoute, type McpHandlerConfig, type McpHttpConfig, type McpHttpHandler, type McpHttpSecurityConfig, type McpLegacyPolicy, } from './tools/mcp-handler';
26
- export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from './tools/mcp-prepare';
27
- export { createStdioMcpServer, type McpStdioHandle, type StdioAuthConfig, type StdioMcpServerConfig, } from './tools/mcp-stdio';
28
- export { bindStdioProcessSignals, type StdioCloseTarget, type StdioProcessSignalsBinding, type StdioProcessSignalsErrorPhase, type StdioProcessSignalsOptions, } from './tools/mcp-stdio-signals';
29
- export { type CollectToolsConfig, collectTools, type MountableTool, type ToolExtend, } from './tools/mount';
30
- export { type DownloadToolConfig, mountDownload } from './tools/mount-download';
31
- export { mountUpload, type UploadToolConfig } from './tools/mount-upload';
32
- export { mountWait, type WaitToolConfig } from './tools/mount-wait';
33
- export type { ManagedNativeToolConfig, NativeToolIdentity, } from './tools/native-definition';
34
- export { oauthProtectedResourceRoute, PROTECTED_RESOURCE_PATH, type ProtectedResourceConfig, protectedResourceMetadataUrl, wwwAuthenticateHeader, } from './tools/oauth-metadata';
35
- export { type ApplicationType, type AuthCodeData, type AuthRequest, type CimdCacheEvent, type CimdCachePolicy, type CimdClientMetadata, type CimdClientMetadataFetcher, type CimdFetchPolicy, type CimdFetchResponse, type ClientMetadata, createSecureClientMetadataFetcher, mountOAuthProvider, type OAuthClientRegistrationConfig, type OAuthProviderConfig, type RefreshData, type RegisteredClient, } from './tools/oauth-provider';
36
- export { findNonPortableFormats, type NonPortableFormat, PORTABLE_JSON_SCHEMA_FORMATS, } from './tools/portable-formats';
37
- export { createRuntimeToolFactory, defineRuntimeTool, type RuntimeAgentModelOutput, type RuntimeMcpInput, type RuntimeMcpPresentation, type RuntimeToolDefinition, type RuntimeToolDefinitionBase, type RuntimeToolDefinitionWithOutput, type RuntimeToolDefinitionWithoutOutput, type RuntimeToolFactory, type RuntimeToolFactoryConfig, type RuntimeToolFactoryDefinitionWithOutput, type RuntimeToolFactoryDefinitionWithoutOutput, type RuntimeToolFactoryHandlerContext, type RuntimeToolFactoryIdentityFields, type RuntimeToolHandlerContext, type RuntimeToolIdentity, type RuntimeToolOutput, type RuntimeToolPresenters, type RuntimeToolTransport, } from './tools/runtime-tool';
38
- export type { ToolSurfaceDefinition, ToolSurfaceTransport, } from './tools/surface';
39
- export { createToolLogger, type ToolCallRecord, type ToolLoggerConfig, } from './tools/tool-logger';
40
- export { createToolkit, type Toolkit } from './tools/toolkit';
41
- export { summarizeTransports, type TransportCounts, type TransportSummary, } from './tools/transports';
42
- export { findUntypedProperties, type UntypedProperty } from './tools/untyped-properties';
43
- export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, mountViewFile, resolveMedia, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOptions, type ViewFileOutput, ViewFileOutputSchema, } from './tools/view-file';
2
+ export type { ManagedFileBoundary, ManagedFileReadOptions, ManagedFileSource, ManagedFileWriteOptions, } from './files/boundary.js';
3
+ export type { OperationIdentity } from './server/types.js';
4
+ export { type AgentContext, type AgentMountConfig, mountAgent } from './tools/agent.js';
5
+ export { type AdaptedContractAsyncOperationConfig, type AdaptedContractAsyncOperationFollowKey, type AdaptedContractAsyncOperationStartKey, type AdaptedContractAsyncOperationWaitKey, type AsyncOperationCancelCapability, type AsyncOperationCancelResult, AsyncOperationCancelResultSchema, type AsyncOperationCapability, type AsyncOperationContractConfig, type AsyncOperationContractWithStartOutputConfig, type AsyncOperationFollowDefinition, type AsyncOperationIdentity, type AsyncOperationOutputCapability, type AsyncOperationStartDefinition, type BoundAdaptedContractAsyncOperation, bindContractAsyncOperation, type ContractAsyncOperationConfig, type ContractAsyncOperationFollowKey, type ContractAsyncOperationInputAdapters, type ContractAsyncOperationKeys, type ContractAsyncOperationStartKey, type ContractAsyncOperationWaitKey, createAsyncOperationSnapshotSchema, type DefinedAsyncOperationContract, defineAsyncOperation, defineAsyncOperationContract, type RuntimeAsyncOperation, type RuntimeAsyncOperationConfig, } from './tools/async-operation.js';
6
+ export { type CliConfig, type CliSurfaceSource, createCli } from './tools/cli.js';
7
+ export { type CliCommandContext, type CliCommandDefinition, type CliCommandDefinitionBase, type CliCommandDefinitionWithOutput, type CliCommandDefinitionWithoutOutput, defineCliCommand, } from './tools/cli-command.js';
8
+ export type { ExitCodeMap } from './tools/cli-format.js';
9
+ export type { CliPresentationPolicyConfig } from './tools/cli-policy.js';
10
+ export type { CliWaitConfig } from './tools/cli-wait.js';
11
+ export { coerceJsonArgs } from './tools/coerce.js';
12
+ export { type DefineDownloadToolConfig, defineDownloadTool, } from './tools/define-download-tool.js';
13
+ export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, } from './tools/define-upload-tool.js';
14
+ export { type DefineViewFileToolConfig, defineViewFileTool, } from './tools/define-view-file-tool.js';
15
+ export { type DefineWaitToolConfig, defineWaitTool, type ManagedWaitRender, } from './tools/define-wait-tool.js';
16
+ export type { AfterToolCallOptions, BeforeToolCallOptions, ErrorHintFn, ToolCallContext, ToolCallHooks, ToolErrorOptions, ToolExecutionControlReason, ToolLifecycle, ToolOperation, ToolResult, } from './tools/execute.js';
17
+ export { isToolExecutionControlError, ToolExecutionControlError } from './tools/execute.js';
18
+ export { flattenToolJsonSchema, type ToolPresentationSchema, } from './tools/flatten.js';
19
+ export { createToolInvoker, type ToolInvocationOptions, type ToolInvoker, type ToolInvokerConfig, type ToolInvokerTransport, } from './tools/invoker.js';
20
+ export { composeToolLifecycle } from './tools/lifecycle.js';
21
+ export { listContractToolNames, listToolNames, type ToolNameEntry, } from './tools/list-names.js';
22
+ export { buildToolManifest, type ToolManifestConfig, type ToolManifestEntry, } from './tools/manifest.js';
23
+ export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfig, type McpMountConfig, type McpServerBuildConfig, type McpServerSharedConfig, mountMcp, mountMcpResource, validateMcpSchemas, } from './tools/mcp.js';
24
+ export { EXT_APPS_BUNDLE_PLACEHOLDER, inlineMcpAppBundle, type McpAppCsp, type McpAppResourceMeta, type McpResourceDef, RESOURCE_MIME_TYPE, } from './tools/mcp-app.js';
25
+ export { createMcpHandler, createMcpHttpRoute, type McpHandlerConfig, type McpHttpConfig, type McpHttpHandler, type McpHttpSecurityConfig, type McpLegacyPolicy, } from './tools/mcp-handler.js';
26
+ export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from './tools/mcp-prepare.js';
27
+ export { createStdioMcpServer, type McpStdioHandle, type StdioAuthConfig, type StdioMcpServerConfig, } from './tools/mcp-stdio.js';
28
+ export { bindStdioProcessSignals, type StdioCloseTarget, type StdioProcessSignalsBinding, type StdioProcessSignalsErrorPhase, type StdioProcessSignalsOptions, } from './tools/mcp-stdio-signals.js';
29
+ export { type CollectToolsConfig, collectTools, type MountableTool, type ToolExtend, } from './tools/mount.js';
30
+ export { type DownloadToolConfig, mountDownload } from './tools/mount-download.js';
31
+ export { mountUpload, type UploadToolConfig } from './tools/mount-upload.js';
32
+ export { mountWait, type WaitToolConfig } from './tools/mount-wait.js';
33
+ export type { ManagedNativeToolConfig, NativeToolIdentity, } from './tools/native-definition.js';
34
+ export { oauthProtectedResourceRoute, PROTECTED_RESOURCE_PATH, type ProtectedResourceConfig, protectedResourceMetadataUrl, wwwAuthenticateHeader, } from './tools/oauth-metadata.js';
35
+ export { type ApplicationType, type AuthCodeData, type AuthRequest, type CimdCacheEvent, type CimdCachePolicy, type CimdClientMetadata, type CimdClientMetadataFetcher, type CimdFetchPolicy, type CimdFetchResponse, type ClientMetadata, createSecureClientMetadataFetcher, mountOAuthProvider, type OAuthClientRegistrationConfig, type OAuthProviderConfig, type RefreshData, type RegisteredClient, } from './tools/oauth-provider.js';
36
+ export { findNonPortableFormats, type NonPortableFormat, PORTABLE_JSON_SCHEMA_FORMATS, } from './tools/portable-formats.js';
37
+ export { createRuntimeToolFactory, defineRuntimeTool, type RuntimeAgentModelOutput, type RuntimeMcpInput, type RuntimeMcpPresentation, type RuntimeToolDefinition, type RuntimeToolDefinitionBase, type RuntimeToolDefinitionWithOutput, type RuntimeToolDefinitionWithoutOutput, type RuntimeToolFactory, type RuntimeToolFactoryConfig, type RuntimeToolFactoryDefinitionWithOutput, type RuntimeToolFactoryDefinitionWithoutOutput, type RuntimeToolFactoryHandlerContext, type RuntimeToolFactoryIdentityFields, type RuntimeToolHandlerContext, type RuntimeToolIdentity, type RuntimeToolOutput, type RuntimeToolPresenters, type RuntimeToolTransport, } from './tools/runtime-tool.js';
38
+ export type { ToolSurfaceDefinition, ToolSurfaceTransport, } from './tools/surface.js';
39
+ export { createToolLogger, type ToolCallRecord, type ToolLoggerConfig, } from './tools/tool-logger.js';
40
+ export { createToolkit, type Toolkit } from './tools/toolkit.js';
41
+ export { summarizeTransports, type TransportCounts, type TransportSummary, } from './tools/transports.js';
42
+ export { findUntypedProperties, type UntypedProperty } from './tools/untyped-properties.js';
43
+ export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, mountViewFile, resolveMedia, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOptions, type ViewFileOutput, ViewFileOutputSchema, } from './tools/view-file.js';
44
44
  //# sourceMappingURL=tools.d.ts.map
package/dist/tools.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ redact
3
+ } from "./index-dafax5md.js";
1
4
  import {
2
5
  signJwt,
3
6
  verifyPkce
@@ -10,29 +13,38 @@ import {
10
13
  guardSignalCallback,
11
14
  reportSignalError
12
15
  } from "./index-pr0qsmjy.js";
16
+ import {
17
+ createToolInvoker
18
+ } from "./index-g2j2m6vv.js";
13
19
  import {
14
20
  WaitTimeoutError,
15
21
  collectToolSurface,
16
- collectTools,
17
22
  createCli,
18
23
  createRuntimeToolFactory,
19
- createToolRunner,
20
24
  defineCliCommand,
21
25
  defineRuntimeTool,
22
26
  fetchGuarded,
23
27
  fetchPinnedDocument,
24
- formatToolError,
25
28
  readCapped,
26
29
  runWaitOperation
27
- } from "./index-7pn02bgv.js";
30
+ } from "./index-cszjsxy5.js";
31
+ import {
32
+ collectTools,
33
+ createToolRunner,
34
+ formatToolError
35
+ } from "./index-7etq650s.js";
28
36
  import {
29
37
  ToolExecutionControlError,
30
38
  coerceJsonArgs,
31
39
  executeToolMethod,
32
40
  isToolExecutionControlError,
33
- toolErrorFromResult,
34
41
  toolResultFromError
35
- } from "./index-avjd67h6.js";
42
+ } from "./index-cz32amcb.js";
43
+ import {
44
+ getRequestContext,
45
+ getTraceId,
46
+ runWithRequestContext
47
+ } from "./index-69m2278y.js";
36
48
  import {
37
49
  ManagedFileError
38
50
  } from "./index-bfcpjw20.js";
@@ -50,14 +62,6 @@ import {
50
62
  } from "./index-vkk06pv1.js";
51
63
  import"./index-6djpbnda.js";
52
64
  import"./index-cby4ar3v.js";
53
- import {
54
- redact
55
- } from "./index-dafax5md.js";
56
- import {
57
- getRequestContext,
58
- getTraceId,
59
- runWithRequestContext
60
- } from "./index-69m2278y.js";
61
65
  import {
62
66
  defineContract,
63
67
  normalizeError,
@@ -950,53 +954,6 @@ function defineViewFileTool(config) {
950
954
  }, context.signal)
951
955
  });
952
956
  }
953
- // src/tools/invoker.ts
954
- function createToolInvoker(services, config) {
955
- const serviceList = Array.isArray(services) ? services : [services];
956
- const tools = new Map;
957
- for (const service of serviceList) {
958
- for (const tool2 of collectTools(service, config.transport, {
959
- extend: config.extend,
960
- flattenUnionInput: config.flattenUnionInput
961
- })) {
962
- assertUniqueToolName(tool2.name, tools.has(tool2.name), "in-process tool name");
963
- tools.set(tool2.name, tool2);
964
- }
965
- }
966
- const names = Object.freeze([...tools.keys()].sort());
967
- const operation = (name) => {
968
- const tool2 = tools.get(name);
969
- if (tool2)
970
- return tool2;
971
- throw new AppError("NOT_FOUND", `Unknown tool: ${name}`, 404, {
972
- available: names
973
- });
974
- };
975
- const run = (name, args, options = {}) => {
976
- const runTool = createToolRunner({
977
- source: options.source ?? "internal",
978
- context: options.context,
979
- hooks: options.hooks,
980
- lifecycle: options.lifecycle,
981
- extend: config.extend,
982
- coerceJsonArgs: config.coerceJsonArgs,
983
- onOutputStrip: options.onOutputStrip
984
- });
985
- return runTool(operation(name), args);
986
- };
987
- return Object.freeze({
988
- names,
989
- invoke(name, args, options) {
990
- return run(name, args, options);
991
- },
992
- async invokeOrThrow(name, args, options) {
993
- const result = await run(name, args, options);
994
- if (!result.ok)
995
- throw toolErrorFromResult(result);
996
- return result.data;
997
- }
998
- });
999
- }
1000
957
  // src/tools/lifecycle.ts
1001
958
  function composeToolLifecycle(...hooks) {
1002
959
  return {