stitchkit 0.119.0 → 0.121.0

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 (163) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +10 -7
  3. package/dist/agent-runtime/coding-discovery.d.ts +25 -0
  4. package/dist/agent-runtime/coding-discovery.d.ts.map +1 -0
  5. package/dist/agent-runtime/coding-search-automaton.d.ts +37 -0
  6. package/dist/agent-runtime/coding-search-automaton.d.ts.map +1 -0
  7. package/dist/agent-runtime/coding-search-case-fold.d.ts +4 -0
  8. package/dist/agent-runtime/coding-search-case-fold.d.ts.map +1 -0
  9. package/dist/agent-runtime/coding-search-class-ranges.d.ts +10 -0
  10. package/dist/agent-runtime/coding-search-class-ranges.d.ts.map +1 -0
  11. package/dist/agent-runtime/coding-search-contract.d.ts +86 -0
  12. package/dist/agent-runtime/coding-search-contract.d.ts.map +1 -0
  13. package/dist/agent-runtime/coding-search-limits.d.ts +13 -0
  14. package/dist/agent-runtime/coding-search-limits.d.ts.map +1 -0
  15. package/dist/agent-runtime/coding-search-matcher.d.ts +33 -0
  16. package/dist/agent-runtime/coding-search-matcher.d.ts.map +1 -0
  17. package/dist/agent-runtime/coding-search-output.d.ts +5 -0
  18. package/dist/agent-runtime/coding-search-output.d.ts.map +1 -0
  19. package/dist/agent-runtime/coding-search-regex-syntax.d.ts +39 -0
  20. package/dist/agent-runtime/coding-search-regex-syntax.d.ts.map +1 -0
  21. package/dist/agent-runtime/coding-search-unit-classes.d.ts +31 -0
  22. package/dist/agent-runtime/coding-search-unit-classes.d.ts.map +1 -0
  23. package/dist/agent-runtime/coding-shell-process.d.ts +1 -0
  24. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  25. package/dist/agent-runtime/coding-tool-contract.d.ts +8 -3
  26. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  27. package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
  28. package/dist/agent-runtime/coding-tool-listing.d.ts +1 -11
  29. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  30. package/dist/agent-runtime/coding-tool-paths.d.ts +6 -2
  31. package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
  32. package/dist/agent-runtime/coding-tool-refusals.d.ts +6 -0
  33. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  34. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  35. package/dist/agent-runtime/coding-tool-search.d.ts +113 -0
  36. package/dist/agent-runtime/coding-tool-search.d.ts.map +1 -0
  37. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  38. package/dist/agent-runtime/contained-scan-budget.d.ts +32 -0
  39. package/dist/agent-runtime/contained-scan-budget.d.ts.map +1 -0
  40. package/dist/agent-runtime/contained-scan-contract.d.ts +52 -0
  41. package/dist/agent-runtime/contained-scan-contract.d.ts.map +1 -0
  42. package/dist/agent-runtime/contained-scan.d.ts +48 -13
  43. package/dist/agent-runtime/contained-scan.d.ts.map +1 -1
  44. package/dist/agent-runtime/sandbox.d.ts +5 -1
  45. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  46. package/dist/agent-runtime/workspace-glob.d.ts +6 -0
  47. package/dist/agent-runtime/workspace-glob.d.ts.map +1 -0
  48. package/dist/entrypoints/agent-runtime/coding-tools.js +7 -7
  49. package/dist/entrypoints/agent-runtime/harness.js +5 -5
  50. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  51. package/dist/entrypoints/agent-runtime/sandbox.js +8 -8
  52. package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -9
  53. package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -9
  54. package/dist/entrypoints/agent-runtime/testing.js +9 -9
  55. package/dist/entrypoints/agent-runtime.js +16 -14
  56. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  57. package/dist/entrypoints/application/directory-inbox.js +5 -5
  58. package/dist/entrypoints/application.js +6 -6
  59. package/dist/entrypoints/cli/publish.js +5 -5
  60. package/dist/entrypoints/cli.js +8 -8
  61. package/dist/entrypoints/contract.js +4 -4
  62. package/dist/entrypoints/files.js +4 -4
  63. package/dist/entrypoints/http.js +2 -2
  64. package/dist/entrypoints/index.js +2 -2
  65. package/dist/entrypoints/node.js +1 -1
  66. package/dist/entrypoints/process/owner-loss.js +2 -1
  67. package/dist/entrypoints/process.js +4 -4
  68. package/dist/entrypoints/remote.js +1 -1
  69. package/dist/entrypoints/server.js +12 -12
  70. package/dist/entrypoints/telegram/screens.js +5 -5
  71. package/dist/entrypoints/telegram.js +8 -8
  72. package/dist/entrypoints/testing.js +2 -2
  73. package/dist/entrypoints/tools/agent.d.ts +9 -0
  74. package/dist/entrypoints/tools/agent.d.ts.map +1 -0
  75. package/dist/entrypoints/tools/agent.js +16 -0
  76. package/dist/entrypoints/tools/connections.js +4 -4
  77. package/dist/entrypoints/tools/mcp.js +104 -4
  78. package/dist/entrypoints/tools/toolkit.d.ts +9 -0
  79. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -0
  80. package/dist/entrypoints/tools/toolkit.js +40 -0
  81. package/dist/entrypoints/tools.d.ts +0 -10
  82. package/dist/entrypoints/tools.d.ts.map +1 -1
  83. package/dist/entrypoints/tools.js +25 -69
  84. package/dist/{index-s0qjs6ee.js → index-0fra8xvy.js} +9 -81
  85. package/dist/{index-rxcgp4b9.js → index-10rg78vf.js} +1 -1
  86. package/dist/index-1psbyyhj.js +21 -0
  87. package/dist/index-3prvb42w.js +30 -0
  88. package/dist/{index-ba7are04.js → index-4tyt1qya.js} +1 -1
  89. package/dist/index-568w258r.js +76 -0
  90. package/dist/{index-fqd4yqwd.js → index-6j15ktag.js} +1 -1
  91. package/dist/{index-zrdcmg6j.js → index-72xtvcvr.js} +40 -6
  92. package/dist/{index-6a69xzrx.js → index-7zwtbak8.js} +5 -46
  93. package/dist/{index-fcqj44mb.js → index-8ryydawp.js} +4 -4
  94. package/dist/{index-q968hy6y.js → index-aqmadanx.js} +2 -2
  95. package/dist/{index-s20s2mad.js → index-bgcwxhxh.js} +16 -14
  96. package/dist/index-bph35vpy.js +77 -0
  97. package/dist/{index-arjmb6de.js → index-eeahxwvg.js} +60 -76
  98. package/dist/{index-57gqaq8b.js → index-f6pw75e1.js} +1 -1
  99. package/dist/{index-f4njz9j0.js → index-gq3fnq3f.js} +1 -1
  100. package/dist/{index-ynrf908v.js → index-gtx3eknx.js} +1 -1
  101. package/dist/index-h1j71dr1.js +48 -0
  102. package/dist/{index-nn9qvkww.js → index-j95jp7ee.js} +45 -9
  103. package/dist/{index-mgb7r8b8.js → index-jswst0h3.js} +1 -1
  104. package/dist/{index-bbvc59gw.js → index-knmnj11j.js} +9 -180
  105. package/dist/{index-2kbysk9s.js → index-m5m9rmvt.js} +2 -0
  106. package/dist/{index-g444vfz2.js → index-nwm3ww60.js} +1 -1
  107. package/dist/{index-yk4g8805.js → index-pq7rkwkk.js} +1 -30
  108. package/dist/index-qaqxdbxf.js +2857 -0
  109. package/dist/{index-x8d9fdeg.js → index-qctbzmg9.js} +8 -4
  110. package/dist/index-s9a0fjh3.js +305 -0
  111. package/dist/index-sb9dr3tq.js +14 -0
  112. package/dist/{index-tvtacc9a.js → index-zyc64nbh.js} +1 -34
  113. package/dist/internal/contained-directory.d.ts +1 -1
  114. package/dist/internal/contained-directory.d.ts.map +1 -1
  115. package/dist/internal/contained-files.d.ts +18 -51
  116. package/dist/internal/contained-files.d.ts.map +1 -1
  117. package/dist/internal/contained-read.d.ts +17 -0
  118. package/dist/internal/contained-read.d.ts.map +1 -0
  119. package/dist/internal/darwin-binding.d.ts +3 -1
  120. package/dist/internal/darwin-binding.d.ts.map +1 -1
  121. package/dist/process/bun-child.d.ts.map +1 -1
  122. package/dist/process/command-owner.d.ts.map +1 -1
  123. package/dist/process/group.d.ts +2 -0
  124. package/dist/process/group.d.ts.map +1 -1
  125. package/dist/process/launch.d.ts +1 -0
  126. package/dist/process/launch.d.ts.map +1 -1
  127. package/dist/process/owned-child.d.ts.map +1 -1
  128. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  129. package/dist/process/owner-loss-protocol.d.ts +1 -0
  130. package/dist/process/owner-loss-protocol.d.ts.map +1 -1
  131. package/llms/agent-runtime-coding-tools.txt +9 -9
  132. package/llms/agent-runtime-harness.txt +4 -3
  133. package/llms/agent-runtime-sandbox.txt +1 -1
  134. package/llms/agent-runtime.2.txt +20 -2
  135. package/llms/agent-runtime.3.txt +4 -46
  136. package/llms/agent-runtime.4.txt +113 -0
  137. package/llms/agent-runtime.txt +70 -37
  138. package/llms/application.3.txt +5 -2
  139. package/llms/cli.txt +1 -1
  140. package/llms/contract.txt +1 -1
  141. package/llms/process.txt +3 -1
  142. package/llms/server.5.txt +2 -0
  143. package/llms/stitchkit.txt +15 -9
  144. package/llms/testing.txt +4 -6
  145. package/llms/tools-agent.txt +24 -0
  146. package/llms/tools-mcp.txt +71 -6
  147. package/llms/tools-toolkit.txt +23 -0
  148. package/llms/tools.2.txt +6 -3
  149. package/llms/tools.3.txt +8 -77
  150. package/llms/tools.txt +8 -8
  151. package/llms/{upgrading-0.106.0-0.119.0.txt → upgrading-0.106.0-0.121.0.txt} +84 -3
  152. package/llms/upgrading.txt +1 -1
  153. package/llms-full.txt +360 -139
  154. package/llms.txt +11 -9
  155. package/native/darwin-arm64.node +0 -0
  156. package/native/darwin-x64.node +0 -0
  157. package/native-assets.json +4 -4
  158. package/package.json +10 -2
  159. package/dist/index-1k18qzqa.js +0 -1478
  160. package/dist/index-6f49krb5.js +0 -107
  161. package/dist/{index-2dfvv1jg.js → index-2fc1k9k2.js} +0 -0
  162. package/dist/{index-qndsr7f0.js → index-5efrpfmj.js} +3 -3
  163. /package/dist/{index-cyxp8rbf.js → index-mtwh9hyp.js} +0 -0
@@ -1,4 +1,3 @@
1
- export type { McpServer } from '@modelcontextprotocol/server';
2
1
  export { createLocalStepDurability, type EffectHandlers, type EffectOutcome, type EffectRunOptions, EffectUnresolvedError, type LocalStepDurability, type LocalStepDurabilityOptions, type StepDurabilityLedger, } from '../durability/engine.js';
3
2
  export type { AgentStoreEventEnvelope, AgentStoreEventPage, AppendAgentStoreEvent, ReadAgentStoreEvents, } from '../durability/events.js';
4
3
  export type { ManagedFileBoundary, ManagedFileReadOptions, ManagedFileSource, ManagedFileWriteOptions, } from '../files/boundary.js';
@@ -6,7 +5,6 @@ export { type CimdCacheEvent, type CimdCachePolicy, type CimdClientMetadata, typ
6
5
  export { oauthProtectedResourceRoute, PROTECTED_RESOURCE_PATH, type ProtectedResourceConfig, protectedResourceMetadataUrl, wwwAuthenticateHeader, } from '../server/oauth/metadata.js';
7
6
  export { type ApplicationType, type AuthCodeData, type AuthRequest, type ClientMetadata, mountOAuthProvider, type OAuthClientRegistrationConfig, type OAuthProviderConfig, type RefreshData, type RegisteredClient, } from '../server/oauth/provider.js';
8
7
  export type { OperationIdentity } from '../server/types.js';
9
- export { type AgentContext, type AgentMountConfig, mountAgent } from '../tools/agent.js';
10
8
  export { AgentToolError, isAgentToolError } from '../tools/agent-tool-error.js';
11
9
  export type { DurableJsonValue, ToolDurability, ToolDurabilityFactory, } from '../tools/durability-port.js';
12
10
  export type { ToolExecutionControlReason, ToolOperation } from '../tools/execute.js';
@@ -18,13 +16,6 @@ export { createToolInvoker, type ToolInvocationOptions, type ToolInvoker, type T
18
16
  export { composeToolLifecycle } from '../tools/lifecycle.js';
19
17
  export { listContractToolNames, listToolNames, type ToolNameEntry, } from '../tools/list-names.js';
20
18
  export { buildToolManifest, describeToolCatalog, type ToolCatalogConfig, type ToolCatalogEntry, type ToolManifestConfig, type ToolManifestEntry, } from '../tools/manifest.js';
21
- export { EXT_APPS_BUNDLE_PLACEHOLDER, inlineMcpAppBundle, type McpAppCsp, type McpAppResourceMeta, type McpResourceDef, RESOURCE_MIME_TYPE, } from '../tools/mcp/app.js';
22
- export { MCP_CATALOG_META_KEY, type McpCatalogStamp, mcpCatalogMeta, readMcpCatalogStamp, } from '../tools/mcp/catalog.js';
23
- export { createMcpHandler, createMcpHttpRoute, type McpHandlerConfig, type McpHttpConfig, type McpHttpHandler, type McpHttpSecurityConfig, type McpLegacyPolicy, } from '../tools/mcp/handler.js';
24
- export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfig, type McpMountConfig, type McpServerBuildConfig, type McpServerSharedConfig, mountMcp, mountMcpResource, validateMcpSchemas, } from '../tools/mcp/mount.js';
25
- export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from '../tools/mcp/prepare.js';
26
- export { createStdioMcpServer, type McpStdioHandle, type StdioAuthConfig, type StdioMcpServerConfig, } from '../tools/mcp/stdio.js';
27
- export { bindStdioProcessSignals, type StdioCloseTarget, type StdioProcessSignalsBinding, type StdioProcessSignalsErrorPhase, type StdioProcessSignalsOptions, } from '../tools/mcp/stdio-signals.js';
28
19
  export { type CollectToolsConfig, collectTools, type MountableTool, type ToolExtend, } from '../tools/mount.js';
29
20
  export type { ManagedNativeToolConfig, NativeToolIdentity, } from '../tools/native-definition.js';
30
21
  export { bindContractAsyncOperation } from '../tools/operations/async-operation-binding.js';
@@ -42,7 +33,6 @@ export { flattenToolJsonSchema, type ToolPresentationSchema, } from '../tools/sc
42
33
  export { findNonPortableFormats, type NonPortableFormat, PORTABLE_JSON_SCHEMA_FORMATS, } from '../tools/schema/portable-formats.js';
43
34
  export { findUntypedProperties, type UntypedProperty, } from '../tools/schema/untyped-properties.js';
44
35
  export { createToolLogger, type ToolCallRecord, type ToolLoggerConfig, } from '../tools/tool-logger.js';
45
- export { createToolkit, type Toolkit } from '../tools/toolkit.js';
46
36
  export { type DefineDownloadToolConfig, defineDownloadTool, } from '../tools/transfer/define-download-tool.js';
47
37
  export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, } from '../tools/transfer/define-upload-tool.js';
48
38
  export { type DefineViewFileToolConfig, defineViewFileTool, } from '../tools/transfer/define-view-file-tool.js';
@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";
4
4
  import {
5
- createLocalStepDurability2,
6
- AgentToolError2,
7
- isAgentToolError2
8
- } from "../index-tvtacc9a.js";
5
+ createLocalStepDurability2
6
+ } from "../index-zyc64nbh.js";
9
7
  import {
10
8
  normalizeError2
11
9
  } from "../index-k42ckyzx.js";
@@ -33,36 +31,10 @@ import {
33
31
  import {
34
32
  collectTools2
35
33
  } from "../index-ycqhyars.js";
36
- import {
37
- mountAgent2,
38
- describeToolCatalog2,
39
- buildToolManifest2
40
- } from "../index-6a69xzrx.js";
41
34
  import"../index-m38ej7e5.js";
42
35
  import {
43
36
  defineContract2
44
37
  } from "../index-4jpykzvw.js";
45
- import {
46
- PROTECTED_RESOURCE_PATH2,
47
- protectedResourceMetadataUrl2,
48
- wwwAuthenticateHeader2,
49
- oauthProtectedResourceRoute2,
50
- RESOURCE_MIME_TYPE2,
51
- EXT_APPS_BUNDLE_PLACEHOLDER2,
52
- inlineMcpAppBundle2,
53
- MCP_CATALOG_META_KEY2,
54
- mcpCatalogMeta2,
55
- readMcpCatalogStamp2,
56
- createMcpProgressReporter,
57
- validateMcpSchemas2,
58
- mountMcp2,
59
- buildMcpServer2,
60
- mountMcpResource2,
61
- createMcpHandler2,
62
- createMcpHttpRoute2,
63
- createStdioMcpServer2,
64
- bindStdioProcessSignals2
65
- } from "../index-bbvc59gw.js";
66
38
  import {
67
39
  AsyncOperationCancelResultSchema2,
68
40
  createAsyncOperationSnapshotSchema2,
@@ -72,12 +44,6 @@ import {
72
44
  ViewFileOutputSchema2,
73
45
  ViewFileInputSchema2
74
46
  } from "../index-sba3e6m4.js";
75
- import {
76
- WaitTimeoutError,
77
- runWaitOperation,
78
- createCli2
79
- } from "../index-s0qjs6ee.js";
80
- import"../index-2kbysk9s.js";
81
47
  import {
82
48
  ManagedFilePathSchema2,
83
49
  ManagedFileRefSchema2
@@ -90,14 +56,32 @@ import {
90
56
  contractOnlyService,
91
57
  mediaTypeEssence
92
58
  } from "../index-sa99p98w.js";
59
+ import"../index-pfvde2fz.js";
60
+ import {
61
+ describeToolCatalog2,
62
+ buildToolManifest2
63
+ } from "../index-h1j71dr1.js";
64
+ import {
65
+ PROTECTED_RESOURCE_PATH2,
66
+ protectedResourceMetadataUrl2,
67
+ wwwAuthenticateHeader2,
68
+ oauthProtectedResourceRoute2,
69
+ createMcpProgressReporter
70
+ } from "../index-568w258r.js";
93
71
  import {
94
72
  DEFAULT_CORS_ALLOW_HEADERS2
95
- } from "../index-yk4g8805.js";
73
+ } from "../index-pq7rkwkk.js";
74
+ import {
75
+ AgentToolError2,
76
+ isAgentToolError2
77
+ } from "../index-1psbyyhj.js";
96
78
  import {
97
79
  createToolInvoker2
98
80
  } from "../index-kz9734jc.js";
99
- import"../index-q968hy6y.js";
100
- import"../index-arjmb6de.js";
81
+ import {
82
+ WaitTimeoutError,
83
+ runWaitOperation
84
+ } from "../index-bph35vpy.js";
101
85
  import {
102
86
  collectToolSurface
103
87
  } from "../index-ff39f9dr.js";
@@ -115,12 +99,11 @@ import {
115
99
  fetchGuarded,
116
100
  fetchPinnedDocument,
117
101
  readCapped
118
- } from "../index-mgb7r8b8.js";
119
- import"../index-pfvde2fz.js";
102
+ } from "../index-jswst0h3.js";
120
103
  import {
121
104
  readBoundedChunks,
122
105
  concatChunks
123
- } from "../index-qndsr7f0.js";
106
+ } from "../index-5efrpfmj.js";
124
107
  import {
125
108
  assertPositiveSafeInteger
126
109
  } from "../index-0s4xebbg.js";
@@ -1424,17 +1407,6 @@ function createToolLogger(config = {}) {
1424
1407
  }
1425
1408
  };
1426
1409
  }
1427
- // src/tools/toolkit.ts
1428
- function createToolkit() {
1429
- return {
1430
- mountMcp: (server, services, config) => mountMcp2(server, services, config),
1431
- mountAgent: (services, config) => mountAgent2(services, config),
1432
- buildMcpServer: (config, auth) => buildMcpServer2(config, auth),
1433
- createMcpHandler: (config) => createMcpHandler2(config),
1434
- createStdioMcpServer: (config) => createStdioMcpServer2(config),
1435
- createCli: (config) => createCli2(config)
1436
- };
1437
- }
1438
1410
  // src/tools/transfer/download-core.ts
1439
1411
  import { basename, extname } from "node:path";
1440
1412
  var DEFAULT_MAX_BYTES = 100 * 1024 * 1024;
@@ -1971,36 +1943,27 @@ function summarizeTransports(surface) {
1971
1943
  export {
1972
1944
  AgentToolError2 as AgentToolError,
1973
1945
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
1974
- EXT_APPS_BUNDLE_PLACEHOLDER2 as EXT_APPS_BUNDLE_PLACEHOLDER,
1975
1946
  EffectUnresolvedError2 as EffectUnresolvedError,
1976
- MCP_CATALOG_META_KEY2 as MCP_CATALOG_META_KEY,
1977
1947
  McpAnnotationsSchema2 as McpAnnotationsSchema,
1978
1948
  McpMediaContentSchema2 as McpMediaContentSchema,
1979
1949
  PORTABLE_JSON_SCHEMA_FORMATS2 as PORTABLE_JSON_SCHEMA_FORMATS,
1980
1950
  PROTECTED_RESOURCE_PATH2 as PROTECTED_RESOURCE_PATH,
1981
- RESOURCE_MIME_TYPE2 as RESOURCE_MIME_TYPE,
1982
1951
  ToolExecutionControlError2 as ToolExecutionControlError,
1983
1952
  UploadToolInputSchema,
1984
1953
  ViewFileErrorSchema2 as ViewFileErrorSchema,
1985
1954
  ViewFileInputSchema2 as ViewFileInputSchema,
1986
1955
  ViewFileOutputSchema2 as ViewFileOutputSchema,
1987
1956
  bindContractAsyncOperation,
1988
- bindStdioProcessSignals2 as bindStdioProcessSignals,
1989
- buildMcpServer2 as buildMcpServer,
1990
1957
  buildToolManifest2 as buildToolManifest,
1991
1958
  coerceJsonArgs2 as coerceJsonArgs,
1992
1959
  collectTools2 as collectTools,
1993
1960
  composeToolLifecycle,
1994
1961
  createAsyncOperationSnapshotSchema2 as createAsyncOperationSnapshotSchema,
1995
1962
  createLocalStepDurability2 as createLocalStepDurability,
1996
- createMcpHandler2 as createMcpHandler,
1997
- createMcpHttpRoute2 as createMcpHttpRoute,
1998
1963
  createRuntimeToolFactory2 as createRuntimeToolFactory,
1999
1964
  createSecureClientMetadataFetcher,
2000
- createStdioMcpServer2 as createStdioMcpServer,
2001
1965
  createToolInvoker2 as createToolInvoker,
2002
1966
  createToolLogger,
2003
- createToolkit,
2004
1967
  defineAsyncOperation,
2005
1968
  defineAsyncOperationContract,
2006
1969
  defineDownloadTool,
@@ -2013,25 +1976,18 @@ export {
2013
1976
  findNonPortableFormats2 as findNonPortableFormats,
2014
1977
  findUntypedProperties2 as findUntypedProperties,
2015
1978
  flattenToolJsonSchema2 as flattenToolJsonSchema,
2016
- inlineMcpAppBundle2 as inlineMcpAppBundle,
2017
1979
  isAgentToolError2 as isAgentToolError,
2018
1980
  isToolExecutionControlError2 as isToolExecutionControlError,
2019
1981
  listContractToolNames,
2020
1982
  listToolNames,
2021
- mcpCatalogMeta2 as mcpCatalogMeta,
2022
- mountAgent2 as mountAgent,
2023
1983
  mountDownload,
2024
- mountMcp2 as mountMcp,
2025
- mountMcpResource2 as mountMcpResource,
2026
1984
  mountOAuthProvider,
2027
1985
  mountUpload,
2028
1986
  mountViewFile,
2029
1987
  mountWait,
2030
1988
  oauthProtectedResourceRoute2 as oauthProtectedResourceRoute,
2031
1989
  protectedResourceMetadataUrl2 as protectedResourceMetadataUrl,
2032
- readMcpCatalogStamp2 as readMcpCatalogStamp,
2033
1990
  resolveMedia,
2034
1991
  summarizeTransports,
2035
- validateMcpSchemas2 as validateMcpSchemas,
2036
1992
  wwwAuthenticateHeader2 as wwwAuthenticateHeader
2037
1993
  };
@@ -25,25 +25,25 @@ import {
25
25
  } from "./index-ycqhyars.js";
26
26
  import {
27
27
  writeContainedFile
28
- } from "./index-q968hy6y.js";
28
+ } from "./index-aqmadanx.js";
29
29
  import {
30
30
  openPinnedDirectory,
31
31
  isSafeEntryName,
32
32
  containedEntryMetadata
33
- } from "./index-arjmb6de.js";
33
+ } from "./index-eeahxwvg.js";
34
+ import {
35
+ pollUntil
36
+ } from "./index-bph35vpy.js";
34
37
  import {
35
38
  collectToolSurface
36
39
  } from "./index-ff39f9dr.js";
37
40
  import {
38
41
  fetchGuarded,
39
42
  readCapped
40
- } from "./index-mgb7r8b8.js";
43
+ } from "./index-jswst0h3.js";
41
44
  import {
42
45
  errnoOf
43
46
  } from "./index-jj9228tt.js";
44
- import {
45
- sleep
46
- } from "./index-eemvahkc.js";
47
47
  import {
48
48
  isUnsafeKey,
49
49
  safeJsonParse
@@ -59,78 +59,6 @@ import {
59
59
  isRecord
60
60
  } from "./index-9jfdm5tg.js";
61
61
 
62
- // src/tools/operations/wait-core.ts
63
- var DEFAULT_BACKOFF = [2, 3, 5, 5, 8, 10];
64
- var DEFAULT_TIMEOUT = 600;
65
-
66
- class WaitTimeoutError extends Error {
67
- constructor() {
68
- super("wait deadline elapsed before the first snapshot");
69
- this.name = "WaitTimeoutError";
70
- }
71
- }
72
- async function pollUntil(params) {
73
- const backoff = params.backoff?.length ? params.backoff : DEFAULT_BACKOFF;
74
- const lastBackoff = backoff[backoff.length - 1] ?? 5;
75
- const timeoutSec = params.timeoutSec ?? DEFAULT_TIMEOUT;
76
- const pause = params.sleepFn ?? sleep;
77
- const now = params.nowFn ?? (() => performance.now());
78
- const startedAt = now();
79
- const deadline = startedAt + timeoutSec * 1000;
80
- let last;
81
- for (let attempt = 0;; attempt++) {
82
- params.signal?.throwIfAborted();
83
- const remainingBeforePoll = Math.max(0, deadline - now());
84
- if (remainingBeforePoll === 0 && last) {
85
- return { state: last.state, timedOut: true };
86
- }
87
- const deadlineController = new AbortController;
88
- const onCallerAbort = () => deadlineController.abort(params.signal?.reason);
89
- params.signal?.addEventListener("abort", onCallerAbort, { once: true });
90
- const deadlineTimer = setTimeout(() => deadlineController.abort(new WaitTimeoutError), remainingBeforePoll);
91
- deadlineTimer.unref?.();
92
- let state;
93
- try {
94
- state = await params.poll(deadlineController.signal);
95
- } catch (error) {
96
- if (params.signal?.aborted)
97
- throw params.signal.reason ?? error;
98
- if (deadlineController.signal.aborted && now() >= deadline) {
99
- if (last)
100
- return { state: last.state, timedOut: true };
101
- throw new WaitTimeoutError;
102
- }
103
- throw error;
104
- } finally {
105
- clearTimeout(deadlineTimer);
106
- params.signal?.removeEventListener("abort", onCallerAbort);
107
- }
108
- params.signal?.throwIfAborted();
109
- last = { state };
110
- if (params.done(state))
111
- return { state, timedOut: false };
112
- const elapsedMs = now() - startedAt;
113
- const elapsedSec = elapsedMs / 1000;
114
- params.onTick?.(attempt + 1, elapsedSec);
115
- if (elapsedSec >= timeoutSec)
116
- return { state, timedOut: true };
117
- const waitSec = backoff[Math.min(attempt, backoff.length - 1)] ?? lastBackoff;
118
- await pause(Math.min(waitSec * 1000, Math.max(0, deadline - now())), params.signal);
119
- }
120
- }
121
- function runWaitOperation(params) {
122
- return pollUntil({
123
- poll: (signal) => params.poll(params.input, signal),
124
- done: params.done,
125
- backoff: params.backoff,
126
- timeoutSec: params.timeoutSec,
127
- sleepFn: params.sleepFn,
128
- onTick: params.onTick,
129
- signal: params.signal,
130
- nowFn: params.nowFn
131
- });
132
- }
133
-
134
62
  // src/tools/cli/command.ts
135
63
  function defineCliCommand2(definition) {
136
64
  return definition;
@@ -2151,7 +2079,7 @@ function renderCliView2(data, view) {
2151
2079
  }
2152
2080
 
2153
2081
  // src/tools/cli/wait.ts
2154
- var DEFAULT_TIMEOUT2 = 600;
2082
+ var DEFAULT_TIMEOUT = 600;
2155
2083
  function waitFailure(tool, result) {
2156
2084
  return {
2157
2085
  ok: false,
@@ -2173,7 +2101,7 @@ async function pollUntilDone2(params) {
2173
2101
  const pollArgs = wait.poll(initial.data);
2174
2102
  if (!pollArgs)
2175
2103
  return initial;
2176
- const timeoutSec = params.timeoutSec ?? wait.timeout ?? DEFAULT_TIMEOUT2;
2104
+ const timeoutSec = params.timeoutSec ?? wait.timeout ?? DEFAULT_TIMEOUT;
2177
2105
  let failedState;
2178
2106
  const { state, timedOut } = await pollUntil({
2179
2107
  poll: () => call(wait.tool, pollArgs),
@@ -2455,4 +2383,4 @@ async function createCli2(config) {
2455
2383
  return runManagedInvocation(session, route);
2456
2384
  }
2457
2385
 
2458
- export { WaitTimeoutError, runWaitOperation, defineCliCommand2, DEFAULT_EXIT_CODES2, cliExitCode2, emitResult2, CliArgumentError2, cliInvocationResult2, createCliInvoker2, routeCliArgv2, parseCliArgs2, extractCliGlobalOptions2, renderCliView2, pollUntilDone2, createCli2 };
2386
+ export { defineCliCommand2, DEFAULT_EXIT_CODES2, cliExitCode2, emitResult2, CliArgumentError2, cliInvocationResult2, createCliInvoker2, routeCliArgv2, parseCliArgs2, extractCliGlobalOptions2, renderCliView2, pollUntilDone2, createCli2 };
@@ -4,7 +4,7 @@ import {
4
4
  AgentSandboxRestrictionSchema2,
5
5
  AgentSandboxGradeSchema2,
6
6
  AGENT_CODING_TOOL_NAMES
7
- } from "./index-1k18qzqa.js";
7
+ } from "./index-qaqxdbxf.js";
8
8
  import {
9
9
  AgentRecordIdSchema2,
10
10
  AgentRecordVersionSchema2,
@@ -0,0 +1,21 @@
1
+ // src/tools/agent-tool-error.ts
2
+ var AGENT_TOOL_ERROR_BRAND = Symbol.for("stitchkit.AgentToolError");
3
+
4
+ class AgentToolError2 extends Error {
5
+ output;
6
+ constructor(output, cause) {
7
+ let message = "Tool execution failed";
8
+ try {
9
+ message = JSON.stringify(output);
10
+ } catch {}
11
+ super(message, cause === undefined ? undefined : { cause });
12
+ this.name = "AgentToolError";
13
+ this.output = output;
14
+ Object.defineProperty(this, AGENT_TOOL_ERROR_BRAND, { value: true });
15
+ }
16
+ }
17
+ function isAgentToolError2(value) {
18
+ return typeof value === "object" && value !== null && AGENT_TOOL_ERROR_BRAND in value;
19
+ }
20
+
21
+ export { AgentToolError2, isAgentToolError2 };
@@ -0,0 +1,30 @@
1
+ // src/server/process-signal-common.ts
2
+ var DEFAULT_PROCESS_SIGNALS = ["SIGINT", "SIGTERM"];
3
+ var defaultSignalSource = {
4
+ on: (signal, handler) => {
5
+ process.on(signal, handler);
6
+ },
7
+ off: (signal, handler) => {
8
+ process.off(signal, handler);
9
+ },
10
+ raiseDefault: (signal) => {
11
+ if (process.listenerCount(signal) > 0)
12
+ return false;
13
+ process.kill(process.pid, signal);
14
+ return true;
15
+ }
16
+ };
17
+ function reportSignalError(phase, error, onError) {
18
+ try {
19
+ onError?.(phase, error);
20
+ } catch {}
21
+ }
22
+ function guardSignalCallback(run, phase, onError) {
23
+ try {
24
+ run();
25
+ } catch (error) {
26
+ reportSignalError(phase, error, onError);
27
+ }
28
+ }
29
+
30
+ export { DEFAULT_PROCESS_SIGNALS, defaultSignalSource, reportSignalError, guardSignalCallback };
@@ -15,7 +15,7 @@ import {
15
15
  appendEventIn,
16
16
  ArchiveProjectionSchema,
17
17
  createAgentRuntimeStore2
18
- } from "./index-rxcgp4b9.js";
18
+ } from "./index-10rg78vf.js";
19
19
  import {
20
20
  AgentMessageSchema2,
21
21
  AgentRunSchema2
@@ -0,0 +1,76 @@
1
+ import {
2
+ DEFAULT_CORS_ALLOW_HEADERS2
3
+ } from "./index-pq7rkwkk.js";
4
+
5
+ // src/server/oauth/metadata.ts
6
+ var PROTECTED_RESOURCE_PATH2 = "/.well-known/oauth-protected-resource";
7
+ function metadataPath(resource) {
8
+ const { pathname } = new URL(resource);
9
+ return pathname === "/" ? PROTECTED_RESOURCE_PATH2 : `${PROTECTED_RESOURCE_PATH2}${pathname}`;
10
+ }
11
+ function protectedResourceMetadataUrl2(resource) {
12
+ return `${new URL(resource).origin}${metadataPath(resource)}`;
13
+ }
14
+ function wwwAuthenticateHeader2(resource) {
15
+ return `Bearer resource_metadata="${protectedResourceMetadataUrl2(resource)}"`;
16
+ }
17
+ var PUBLIC_CORS = {
18
+ "Access-Control-Allow-Origin": "*",
19
+ "Access-Control-Allow-Methods": "GET, OPTIONS",
20
+ "Access-Control-Allow-Headers": DEFAULT_CORS_ALLOW_HEADERS2
21
+ };
22
+ function oauthProtectedResourceRoute2(config) {
23
+ const body = JSON.stringify({
24
+ resource: config.resource,
25
+ authorization_servers: config.authorizationServers,
26
+ ...config.scopesSupported && { scopes_supported: config.scopesSupported },
27
+ bearer_methods_supported: ["header"]
28
+ });
29
+ return {
30
+ method: "ALL",
31
+ path: metadataPath(config.resource),
32
+ handler: (req) => {
33
+ if (req.method === "OPTIONS")
34
+ return new Response(null, { status: 204, headers: PUBLIC_CORS });
35
+ if (req.method !== "GET")
36
+ return new Response("Method Not Allowed", { status: 405 });
37
+ return new Response(body, {
38
+ status: 200,
39
+ headers: { "Content-Type": "application/json", ...PUBLIC_CORS }
40
+ });
41
+ }
42
+ };
43
+ }
44
+
45
+ // src/tools/mcp/progress.ts
46
+ function mcpProgressToken(context) {
47
+ const token = context.mcpReq._meta?.progressToken;
48
+ return typeof token === "string" || typeof token === "number" ? token : undefined;
49
+ }
50
+ function createMcpProgressReporter(context) {
51
+ const token = mcpProgressToken(context);
52
+ if (token === undefined)
53
+ return async () => {
54
+ return;
55
+ };
56
+ let sent = 0;
57
+ let highWater = 0;
58
+ return async (update) => {
59
+ sent += 1;
60
+ const value = update.progress ?? Math.max(sent, highWater + 1);
61
+ highWater = Math.max(highWater, value);
62
+ try {
63
+ await context.mcpReq.notify({
64
+ method: "notifications/progress",
65
+ params: {
66
+ progressToken: token,
67
+ progress: value,
68
+ ...update.total !== undefined && { total: update.total },
69
+ ...update.message !== undefined && { message: update.message }
70
+ }
71
+ });
72
+ } catch {}
73
+ };
74
+ }
75
+
76
+ export { PROTECTED_RESOURCE_PATH2, protectedResourceMetadataUrl2, wwwAuthenticateHeader2, oauthProtectedResourceRoute2, mcpProgressToken, createMcpProgressReporter };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withExclusiveLock2
3
- } from "./index-g444vfz2.js";
3
+ } from "./index-nwm3ww60.js";
4
4
  import {
5
5
  readBoundedFile
6
6
  } from "./index-m616f0yz.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ loadDarwinBinding
3
+ } from "./index-m5m9rmvt.js";
1
4
  import {
2
5
  errnoOf
3
6
  } from "./index-jj9228tt.js";
@@ -269,6 +272,7 @@ function ownerLossGuardCommand(guard, executable, args) {
269
272
  guard.entry,
270
273
  OWNER_LOSS_GUARD_FLAG,
271
274
  guard.signalTarget,
275
+ ...guard.cwdDescriptor === undefined ? [] : ["--stitchkit-cwd-fd", "4"],
272
276
  executable,
273
277
  ...args
274
278
  ];
@@ -407,10 +411,16 @@ function spawnBunChild(input) {
407
411
  const guarded = ownerLoss !== undefined;
408
412
  const command = guarded ? ownerLossGuardCommand(ownerLoss, input.executable, input.args) : [input.executable, ...input.args];
409
413
  const subprocess = guarded ? Bun.spawn(command, {
410
- cwd: input.cwd,
414
+ cwd: ownerLoss.cwdDescriptor === undefined ? input.cwd : undefined,
411
415
  env: input.env,
412
416
  detached: input.group,
413
- stdio: ["pipe", "pipe", "pipe", "socket-fd"]
417
+ stdio: [
418
+ "pipe",
419
+ "pipe",
420
+ "pipe",
421
+ "socket-fd",
422
+ ...ownerLoss.cwdDescriptor === undefined ? [] : [ownerLoss.cwdDescriptor]
423
+ ]
414
424
  }) : Bun.spawn(command, {
415
425
  cwd: input.cwd,
416
426
  env: input.env,
@@ -446,10 +456,16 @@ function spawnBunInheritedChild(input) {
446
456
  const guarded = ownerLoss !== undefined;
447
457
  const command = guarded ? ownerLossGuardCommand(ownerLoss, input.executable, input.args) : [input.executable, ...input.args];
448
458
  const subprocess = guarded ? Bun.spawn(command, {
449
- cwd: input.cwd,
459
+ cwd: ownerLoss.cwdDescriptor === undefined ? input.cwd : undefined,
450
460
  env: input.env,
451
461
  detached: input.group,
452
- stdio: ["inherit", "inherit", "inherit", "socket-fd"]
462
+ stdio: [
463
+ "inherit",
464
+ "inherit",
465
+ "inherit",
466
+ "socket-fd",
467
+ ...ownerLoss.cwdDescriptor === undefined ? [] : [ownerLoss.cwdDescriptor]
468
+ ]
453
469
  }) : Bun.spawn(command, {
454
470
  cwd: input.cwd,
455
471
  env: input.env,
@@ -484,6 +500,7 @@ function spawnBunGuardTarget(executable, args) {
484
500
 
485
501
  // src/process/owner-loss-guard.ts
486
502
  import { spawn } from "node:child_process";
503
+ import { closeSync } from "node:fs";
487
504
  import { Socket } from "node:net";
488
505
  import { fileURLToPath } from "node:url";
489
506
  var FORWARDED_SIGNALS = [
@@ -547,7 +564,7 @@ function spawnBunTarget(executable, args, onStarted, onExit, onUnavailable) {
547
564
  onStarted(child.pid);
548
565
  child.exited.then(() => onExit(child.exitCode, child.signalCode));
549
566
  }
550
- function runOwnerLossGuard(signalTarget, executable, args) {
567
+ function runOwnerLossGuard(signalTarget, executable, args, cwdDescriptor) {
551
568
  const bun = hostIsBun();
552
569
  const control = bun ? connectOwnerLossSocket(3) : new Socket({ fd: 3, readable: true, writable: true });
553
570
  let armed = true;
@@ -613,6 +630,20 @@ function runOwnerLossGuard(signalTarget, executable, args) {
613
630
  removeForwarders();
614
631
  refuseTarget(control, cause);
615
632
  };
633
+ if (cwdDescriptor !== undefined) {
634
+ try {
635
+ if (process.platform === "darwin")
636
+ loadDarwinBinding().changeDirectory(cwdDescriptor);
637
+ else if (process.platform === "linux")
638
+ process.chdir(`/proc/self/fd/${cwdDescriptor}`);
639
+ else
640
+ throw new Error("Descriptor command directories require Linux or macOS");
641
+ closeSync(cwdDescriptor);
642
+ } catch (cause) {
643
+ targetUnavailable(cause);
644
+ return;
645
+ }
646
+ }
616
647
  if (!bun)
617
648
  spawnNodeTarget(executable, args, targetStarted, targetExit, targetUnavailable);
618
649
  else
@@ -625,7 +656,10 @@ function startOwnerLossGuardEntry() {
625
656
  const entry = process.argv[1];
626
657
  if (entry === undefined || fileURLToPath(import.meta.url) !== entry)
627
658
  return;
628
- runOwnerLossGuard(process.argv[3], process.argv[4], process.argv.slice(5));
659
+ const pinnedCwd = process.argv[4] === "--stitchkit-cwd-fd";
660
+ if (pinnedCwd && process.argv[5] !== "4")
661
+ throw new Error("Invalid command directory descriptor");
662
+ runOwnerLossGuard(process.argv[3], process.argv[pinnedCwd ? 6 : 4], process.argv.slice(pinnedCwd ? 7 : 5), pinnedCwd ? 4 : undefined);
629
663
  guardInvocation = true;
630
664
  }
631
665
  function bootstrapNativeCommandOwnerLoss2() {