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
@@ -19,16 +19,17 @@ import {
19
19
  createToolRunner,
20
20
  formatToolError
21
21
  } from "./index-ycqhyars.js";
22
- import {
23
- DEFAULT_CORS_ALLOW_HEADERS2,
24
- DEFAULT_PROCESS_SIGNALS,
25
- defaultSignalSource,
26
- reportSignalError,
27
- guardSignalCallback
28
- } from "./index-yk4g8805.js";
29
22
  import {
30
23
  redact2
31
24
  } from "./index-e6c2spsd.js";
25
+ import {
26
+ argumentsDigest
27
+ } from "./index-r7a7r7ha.js";
28
+ import {
29
+ wwwAuthenticateHeader2,
30
+ mcpProgressToken,
31
+ createMcpProgressReporter
32
+ } from "./index-568w258r.js";
32
33
  import {
33
34
  collectToolSurface
34
35
  } from "./index-ff39f9dr.js";
@@ -42,9 +43,6 @@ import {
42
43
  import {
43
44
  AppError2
44
45
  } from "./index-qcn84byh.js";
45
- import {
46
- argumentsDigest
47
- } from "./index-r7a7r7ha.js";
48
46
  import {
49
47
  compareCodeUnits,
50
48
  serializeCanonicalJson
@@ -56,46 +54,6 @@ import {
56
54
  isRecord
57
55
  } from "./index-9jfdm5tg.js";
58
56
 
59
- // src/server/oauth/metadata.ts
60
- var PROTECTED_RESOURCE_PATH2 = "/.well-known/oauth-protected-resource";
61
- function metadataPath(resource) {
62
- const { pathname } = new URL(resource);
63
- return pathname === "/" ? PROTECTED_RESOURCE_PATH2 : `${PROTECTED_RESOURCE_PATH2}${pathname}`;
64
- }
65
- function protectedResourceMetadataUrl2(resource) {
66
- return `${new URL(resource).origin}${metadataPath(resource)}`;
67
- }
68
- function wwwAuthenticateHeader2(resource) {
69
- return `Bearer resource_metadata="${protectedResourceMetadataUrl2(resource)}"`;
70
- }
71
- var PUBLIC_CORS = {
72
- "Access-Control-Allow-Origin": "*",
73
- "Access-Control-Allow-Methods": "GET, OPTIONS",
74
- "Access-Control-Allow-Headers": DEFAULT_CORS_ALLOW_HEADERS2
75
- };
76
- function oauthProtectedResourceRoute2(config) {
77
- const body = JSON.stringify({
78
- resource: config.resource,
79
- authorization_servers: config.authorizationServers,
80
- ...config.scopesSupported && { scopes_supported: config.scopesSupported },
81
- bearer_methods_supported: ["header"]
82
- });
83
- return {
84
- method: "ALL",
85
- path: metadataPath(config.resource),
86
- handler: (req) => {
87
- if (req.method === "OPTIONS")
88
- return new Response(null, { status: 204, headers: PUBLIC_CORS });
89
- if (req.method !== "GET")
90
- return new Response("Method Not Allowed", { status: 405 });
91
- return new Response(body, {
92
- status: 200,
93
- headers: { "Content-Type": "application/json", ...PUBLIC_CORS }
94
- });
95
- }
96
- };
97
- }
98
-
99
57
  // src/tools/mcp/app.ts
100
58
  import { readFileSync } from "node:fs";
101
59
  import { fileURLToPath } from "node:url";
@@ -301,39 +259,6 @@ import {
301
259
  CLIENT_INFO_META_KEY,
302
260
  PROTOCOL_VERSION_META_KEY
303
261
  } from "@modelcontextprotocol/server";
304
-
305
- // src/tools/mcp/progress.ts
306
- function mcpProgressToken(context) {
307
- const token = context.mcpReq._meta?.progressToken;
308
- return typeof token === "string" || typeof token === "number" ? token : undefined;
309
- }
310
- function createMcpProgressReporter(context) {
311
- const token = mcpProgressToken(context);
312
- if (token === undefined)
313
- return async () => {
314
- return;
315
- };
316
- let sent = 0;
317
- let highWater = 0;
318
- return async (update) => {
319
- sent += 1;
320
- const value = update.progress ?? Math.max(sent, highWater + 1);
321
- highWater = Math.max(highWater, value);
322
- try {
323
- await context.mcpReq.notify({
324
- method: "notifications/progress",
325
- params: {
326
- progressToken: token,
327
- progress: value,
328
- ...update.total !== undefined && { total: update.total },
329
- ...update.message !== undefined && { message: update.message }
330
- }
331
- });
332
- } catch {}
333
- };
334
- }
335
-
336
- // src/tools/mcp/round-context.ts
337
262
  function transportContext(context, toolName, outcome, round) {
338
263
  const protocolVersionValue = isRecord(context.mcpReq.envelope) ? Reflect.get(context.mcpReq.envelope, PROTOCOL_VERSION_META_KEY) : undefined;
339
264
  const protocolVersion = typeof protocolVersionValue === "string" ? protocolVersionValue : undefined;
@@ -1062,100 +987,4 @@ async function createStdioMcpServer2(config) {
1062
987
  });
1063
988
  }
1064
989
 
1065
- // src/tools/mcp/stdio-signals.ts
1066
- var bound = new WeakSet;
1067
- function bindStdioProcessSignals2(handle, options = {}) {
1068
- if (bound.has(handle)) {
1069
- throw new Error("[stitchkit] bindStdioProcessSignals: this stdio handle is already bound; close the first binding before creating another");
1070
- }
1071
- bound.add(handle);
1072
- const signals = [...new Set(options.signals ?? DEFAULT_PROCESS_SIGNALS)];
1073
- const source = options.signalSource ?? defaultSignalSource;
1074
- const handlers = [];
1075
- let started = false;
1076
- let sameTurnAsStart = false;
1077
- let closed = false;
1078
- let resolveChain = () => {
1079
- return;
1080
- };
1081
- let rejectChain = () => {
1082
- return;
1083
- };
1084
- const promise = new Promise((resolve, reject) => {
1085
- resolveChain = resolve;
1086
- rejectChain = reject;
1087
- });
1088
- promise.catch(() => {
1089
- return;
1090
- });
1091
- const removeListeners = () => {
1092
- if (closed)
1093
- return;
1094
- closed = true;
1095
- for (const [signal, handler] of handlers)
1096
- source.off(signal, handler);
1097
- if (!started)
1098
- bound.delete(handle);
1099
- };
1100
- const close = () => {
1101
- const hadStarted = started;
1102
- removeListeners();
1103
- if (!hadStarted)
1104
- resolveChain();
1105
- };
1106
- const run = async (signal) => {
1107
- try {
1108
- await options.onClose?.(signal);
1109
- } catch (error) {
1110
- reportSignalError("prepare", error, options.onError);
1111
- }
1112
- try {
1113
- await handle.close();
1114
- } catch (error) {
1115
- rejectChain(error);
1116
- reportSignalError("close", error, options.onError);
1117
- removeListeners();
1118
- return;
1119
- }
1120
- resolveChain();
1121
- try {
1122
- await options.onComplete?.();
1123
- } catch (error) {
1124
- reportSignalError("complete", error, options.onError);
1125
- } finally {
1126
- removeListeners();
1127
- }
1128
- };
1129
- const onSignal = (signal) => {
1130
- if (!started) {
1131
- started = true;
1132
- sameTurnAsStart = true;
1133
- queueMicrotask(() => {
1134
- sameTurnAsStart = false;
1135
- });
1136
- run(signal).catch((error) => reportSignalError("close", error, options.onError));
1137
- return;
1138
- }
1139
- if (sameTurnAsStart)
1140
- return;
1141
- removeListeners();
1142
- guardSignalCallback(() => options.onRepeatedSignal?.(signal), "close", options.onError);
1143
- let restored = false;
1144
- try {
1145
- restored = source.raiseDefault(signal);
1146
- } catch (error) {
1147
- reportSignalError("close", error, options.onError);
1148
- }
1149
- if (!restored) {
1150
- guardSignalCallback(() => options.onEscalationBlocked?.(signal), "close", options.onError);
1151
- }
1152
- };
1153
- for (const signal of signals) {
1154
- const handler = () => onSignal(signal);
1155
- handlers.push([signal, handler]);
1156
- source.on(signal, handler);
1157
- }
1158
- return { promise, close };
1159
- }
1160
-
1161
- export { PROTECTED_RESOURCE_PATH2, protectedResourceMetadataUrl2, wwwAuthenticateHeader2, oauthProtectedResourceRoute2, RESOURCE_MIME_TYPE2, EXT_APPS_BUNDLE_PLACEHOLDER2, inlineMcpAppBundle2, MCP_CATALOG_META_KEY2, mcpCatalogMeta2, readMcpCatalogStamp2, createMcpProgressReporter, validateMcpSchemas2, mountMcp2, buildMcpServer2, mountMcpResource2, createMcpHandler2, createMcpHttpRoute2, createStdioMcpServer2, bindStdioProcessSignals2 };
990
+ export { RESOURCE_MIME_TYPE2, EXT_APPS_BUNDLE_PLACEHOLDER2, inlineMcpAppBundle2, MCP_CATALOG_META_KEY2, mcpCatalogMeta2, readMcpCatalogStamp2, validateMcpSchemas2, mountMcp2, buildMcpServer2, mountMcpResource2, createMcpHandler2, createMcpHttpRoute2, createStdioMcpServer2 };
@@ -23,6 +23,8 @@ function loadDarwinBinding() {
23
23
  }
24
24
  const methods = [
25
25
  "openDirectoryAt",
26
+ "reopenDirectory",
27
+ "changeDirectory",
26
28
  "openFileAt",
27
29
  "createFileAt",
28
30
  "createDirectoryAt",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  attemptExclusiveLock
3
- } from "./index-ynrf908v.js";
3
+ } from "./index-gtx3eknx.js";
4
4
  import {
5
5
  sleep
6
6
  } from "./index-eemvahkc.js";
@@ -101,33 +101,4 @@ function setCorsHeader(headers, key, value) {
101
101
  headers.set("Vary", `${existing}, ${value}`);
102
102
  }
103
103
 
104
- // src/server/process-signal-common.ts
105
- var DEFAULT_PROCESS_SIGNALS = ["SIGINT", "SIGTERM"];
106
- var defaultSignalSource = {
107
- on: (signal, handler) => {
108
- process.on(signal, handler);
109
- },
110
- off: (signal, handler) => {
111
- process.off(signal, handler);
112
- },
113
- raiseDefault: (signal) => {
114
- if (process.listenerCount(signal) > 0)
115
- return false;
116
- process.kill(process.pid, signal);
117
- return true;
118
- }
119
- };
120
- function reportSignalError(phase, error, onError) {
121
- try {
122
- onError?.(phase, error);
123
- } catch {}
124
- }
125
- function guardSignalCallback(run, phase, onError) {
126
- try {
127
- run();
128
- } catch (error) {
129
- reportSignalError(phase, error, onError);
130
- }
131
- }
132
-
133
- export { DEFAULT_CORS_ALLOW_HEADERS2, DEFAULT_CORS_EXPOSE_HEADERS2, assertCorsConfig, isOriginAllowed, corsHeaders2, corsPreflightResponse2, requestCorsHeaders, applyCors, DEFAULT_PROCESS_SIGNALS, defaultSignalSource, reportSignalError, guardSignalCallback };
104
+ export { DEFAULT_CORS_ALLOW_HEADERS2, DEFAULT_CORS_EXPOSE_HEADERS2, assertCorsConfig, isOriginAllowed, corsHeaders2, corsPreflightResponse2, requestCorsHeaders, applyCors };