stitchkit 0.134.1 → 0.134.2

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 (90) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -6
  3. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  4. package/dist/agent-runtime/sqlite-schema.d.ts +2 -2
  5. package/dist/agent-runtime/sqlite.d.ts +1 -1
  6. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  7. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  8. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  9. package/dist/application/grammy.d.ts +1 -1
  10. package/dist/browser/contract-identity.d.ts +1 -1
  11. package/dist/browser/http-fetch.d.ts +1 -1
  12. package/dist/browser/socket-io-contract.d.ts +1 -1
  13. package/dist/contract/bridge-envelope.d.ts +1 -1
  14. package/dist/contract/client-types.d.ts +1 -1
  15. package/dist/contract/define.d.ts +2 -2
  16. package/dist/contract/errors-factory.d.ts +1 -1
  17. package/dist/contract/fingerprint.d.ts +1 -1
  18. package/dist/device-relay/hub.d.ts +1 -1
  19. package/dist/entrypoints/agent-runtime/postgres.js +3 -3
  20. package/dist/entrypoints/agent-runtime/sqlite/bun.js +1 -1
  21. package/dist/entrypoints/agent-runtime/sqlite/node.js +1 -1
  22. package/dist/entrypoints/bin/upgrade-cli.js +1 -1
  23. package/dist/entrypoints/files/packaging.js +2 -2
  24. package/dist/entrypoints/handler.js +2 -2
  25. package/dist/entrypoints/node.js +2 -2
  26. package/dist/entrypoints/server.js +2 -2
  27. package/dist/entrypoints/tools/mcp.js +3 -3
  28. package/dist/entrypoints/tools/toolkit.js +3 -3
  29. package/dist/entrypoints/tools.js +2 -2
  30. package/dist/files/native-packaging-layout.d.ts +1 -1
  31. package/dist/{index-654rhe5d.js → index-7mjsb7zv.js} +5 -1
  32. package/dist/{index-kdw0n92g.js → index-a09r9ff0.js} +1 -1
  33. package/dist/{index-epyj7ptp.js → index-a84wj6y8.js} +4 -4
  34. package/dist/{index-qymek778.js → index-m2b49tvc.js} +76 -22
  35. package/dist/{index-mrng24wq.js → index-zag9sjpd.js} +1 -1
  36. package/dist/internal/postgres-query.d.ts +1 -1
  37. package/dist/react/query-client.d.ts +1 -1
  38. package/dist/server/bridge-host.d.ts +1 -1
  39. package/dist/server/bun.d.ts +1 -1
  40. package/dist/server/endpoint-dispatch.d.ts.map +1 -1
  41. package/dist/server/middleware/cors.d.ts +3 -3
  42. package/dist/server/middleware/cors.d.ts.map +1 -1
  43. package/dist/server/socket-io-config.d.ts +1 -1
  44. package/dist/service-host/identity.d.ts +1 -1
  45. package/dist/service-host/systemd-inspect.d.ts +1 -1
  46. package/dist/testing/manual-clock.d.ts +1 -1
  47. package/dist/tools/connections/types.d.ts +1 -1
  48. package/dist/tools/mcp/handler.d.ts +1 -1
  49. package/dist/tools/mcp/lazy-discovery.d.ts +1 -1
  50. package/dist/tools/mcp/mount.d.ts +1 -1
  51. package/dist/tools/mcp/stdio.d.ts +1 -1
  52. package/llms/agent-runtime-browser.txt +1 -1
  53. package/llms/agent-runtime-sqlite-bun.txt +1 -1
  54. package/llms/agent-runtime.2.txt +1 -1
  55. package/llms/agent-runtime.3.txt +4 -4
  56. package/llms/agent-runtime.txt +3 -3
  57. package/llms/application.2.txt +4 -4
  58. package/llms/application.txt +4 -4
  59. package/llms/cli.2.txt +27 -6
  60. package/llms/cli.txt +2 -2
  61. package/llms/contract.txt +1 -1
  62. package/llms/files-packaging.txt +1 -1
  63. package/llms/geo.txt +1 -1
  64. package/llms/live.txt +1 -1
  65. package/llms/oauth.txt +4 -4
  66. package/llms/observability.txt +3 -3
  67. package/llms/primitives.txt +1 -1
  68. package/llms/process.2.txt +7 -7
  69. package/llms/react.txt +4 -4
  70. package/llms/server.2.txt +7 -7
  71. package/llms/server.3.txt +5 -5
  72. package/llms/server.4.txt +6 -6
  73. package/llms/server.txt +13 -5
  74. package/llms/stitchkit.2.txt +3 -3
  75. package/llms/stitchkit.3.txt +1 -1
  76. package/llms/stitchkit.txt +4 -4
  77. package/llms/telegram.txt +1 -1
  78. package/llms/testing.txt +4 -4
  79. package/llms/tools-connections.txt +1 -1
  80. package/llms/tools-toolkit.txt +3 -1
  81. package/llms/tools.2.txt +6 -6
  82. package/llms/tools.3.txt +8 -8
  83. package/llms/upgrading-0.106.0-0.126.0.txt +1 -1
  84. package/llms/upgrading-0.128.0-0.134.0.txt +7 -1
  85. package/llms/upgrading-0.37.0-0.53.0.txt +7 -7
  86. package/llms/upgrading-0.69.0-0.95.0.txt +1 -1
  87. package/llms/upgrading-0.96.0-0.105.0.txt +1 -1
  88. package/llms-full.txt +149 -112
  89. package/llms.txt +5 -5
  90. package/package.json +1 -1
@@ -297,7 +297,7 @@ function initializeAgentRuntimeSqlite2(database) {
297
297
  const existing = database.prepare(`SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE 'stitchkit_agent_runtime_%' ORDER BY name`).all().map((row) => TableRowSchema.parse(row).name);
298
298
  const hasMeta = existing.includes("stitchkit_agent_runtime_meta");
299
299
  if (!hasMeta && existing.length > 0) {
300
- throw new Error("Refusing an unversioned partial Stitchkit agent-runtime SQLite schema");
300
+ throw new Error("Refusing an unversioned partial StitchKit agent-runtime SQLite schema");
301
301
  }
302
302
  database.exec(`
303
303
  CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_meta (
@@ -330,18 +330,18 @@ function initializeAgentRuntimeSqlite2(database) {
330
330
  return;
331
331
  }
332
332
  if (version !== SCHEMA_VERSION) {
333
- throw new Error(`Unsupported Stitchkit agent-runtime SQLite schema version ${version}; expected ${SCHEMA_VERSION}`);
333
+ throw new Error(`Unsupported StitchKit agent-runtime SQLite schema version ${version}; expected ${SCHEMA_VERSION}`);
334
334
  }
335
335
  const missingTables = TABLES2.filter((table) => !existing.includes(table));
336
336
  if (missingTables.length > 0) {
337
- throw new Error(`Refusing a partial Stitchkit agent-runtime SQLite schema; missing ${missingTables.join(", ")}`);
337
+ throw new Error(`Refusing a partial StitchKit agent-runtime SQLite schema; missing ${missingTables.join(", ")}`);
338
338
  }
339
339
  initializeSqliteConversationPurge(database);
340
340
  database.exec("COMMIT");
341
341
  return;
342
342
  }
343
343
  if (existing.some((table) => table !== "stitchkit_agent_runtime_meta")) {
344
- throw new Error("Refusing an unversioned partial Stitchkit agent-runtime SQLite schema");
344
+ throw new Error("Refusing an unversioned partial StitchKit agent-runtime SQLite schema");
345
345
  }
346
346
  database.exec(`
347
347
  CREATE TABLE stitchkit_agent_runtime_heads (
@@ -4,7 +4,7 @@ import {
4
4
  assertCorsConfig,
5
5
  requestCorsHeaders,
6
6
  applyCors
7
- } from "./index-654rhe5d.js";
7
+ } from "./index-7mjsb7zv.js";
8
8
  import {
9
9
  joinRoutePath,
10
10
  parseTrailingWildcard
@@ -1670,6 +1670,29 @@ async function dataEndpointResponse(state, request, {
1670
1670
  }
1671
1671
 
1672
1672
  // src/server/endpoint-dispatch.ts
1673
+ function forwardAbortSignal(sourceSignal, target) {
1674
+ if (sourceSignal.aborted) {
1675
+ target.abort(sourceSignal.reason);
1676
+ return () => {
1677
+ return;
1678
+ };
1679
+ }
1680
+ const onAbort = () => {
1681
+ target.abort(sourceSignal.reason);
1682
+ };
1683
+ sourceSignal.addEventListener("abort", onAbort, { once: true });
1684
+ return () => sourceSignal.removeEventListener("abort", onAbort);
1685
+ }
1686
+ function closeLateStreamSource(value) {
1687
+ if (!isAsyncIterable(value))
1688
+ return;
1689
+ try {
1690
+ const iterator = value[Symbol.asyncIterator]();
1691
+ Promise.resolve(iterator.return?.(undefined)).catch(() => {
1692
+ return;
1693
+ });
1694
+ } catch {}
1695
+ }
1673
1696
  async function dispatchEndpoint(state, request, match) {
1674
1697
  const { hooks, config } = state;
1675
1698
  const { req, url, traceId, clientIp } = request;
@@ -1682,14 +1705,25 @@ async function dispatchEndpoint(state, request, match) {
1682
1705
  }
1683
1706
  let deadlineTimer;
1684
1707
  let deadlineLink;
1685
- let deadlineOwnedByStream = false;
1686
- const releaseDeadline = () => {
1708
+ let deadlineController;
1709
+ let releaseStreamReq;
1710
+ let releaseStreamOpenDeadline;
1711
+ let streamOpened = false;
1712
+ let keepRawBodySignalLink = false;
1713
+ const disarmDeadlineTimer = () => {
1687
1714
  if (deadlineTimer !== undefined) {
1688
1715
  clearTimeout(deadlineTimer);
1689
1716
  deadlineTimer = undefined;
1690
1717
  }
1691
- deadlineLink?.release();
1692
- deadlineLink = undefined;
1718
+ };
1719
+ const releaseOpenDeadline = () => {
1720
+ disarmDeadlineTimer();
1721
+ if (!keepRawBodySignalLink) {
1722
+ deadlineLink?.release();
1723
+ deadlineLink = undefined;
1724
+ }
1725
+ releaseStreamOpenDeadline?.();
1726
+ releaseStreamOpenDeadline = undefined;
1693
1727
  };
1694
1728
  let multipartLifecycle;
1695
1729
  try {
@@ -1697,22 +1731,22 @@ async function dispatchEndpoint(state, request, match) {
1697
1731
  headerValue: req.headers.get(DEADLINE_BUDGET_HEADER2),
1698
1732
  endpointTimeoutMs: method.timeout
1699
1733
  });
1734
+ let activeDeadlineReader;
1700
1735
  if (budget.kind === "bounded") {
1701
1736
  const deadlineAt = performance.now() + budget.budgetMs;
1702
- const deadlineController = new AbortController;
1737
+ deadlineController = new AbortController;
1703
1738
  deadlineTimer = setTimeout(() => {
1704
- deadlineController.abort(abortError("Request deadline exceeded", "TimeoutError"));
1739
+ deadlineController?.abort(abortError("Request deadline exceeded", "TimeoutError"));
1705
1740
  }, budget.budgetMs);
1706
1741
  deadlineTimer.unref?.();
1707
1742
  deadlineLink = linkAbortSignals(req.signal, deadlineController.signal);
1708
1743
  ctx.signal = deadlineLink.signal;
1709
- ctx.remainingTimeoutMs = createRemainingTimeoutReader(deadlineAt);
1744
+ activeDeadlineReader = createRemainingTimeoutReader(deadlineAt);
1745
+ ctx.remainingTimeoutMs = (reserveMs) => activeDeadlineReader?.(reserveMs);
1710
1746
  } else if (budget.kind === "expired") {
1711
1747
  ctx.remainingTimeoutMs = () => 0;
1712
1748
  } else {
1713
- ctx.remainingTimeoutMs = () => {
1714
- return;
1715
- };
1749
+ ctx.remainingTimeoutMs = (reserveMs) => activeDeadlineReader?.(reserveMs);
1716
1750
  }
1717
1751
  parsePathParamsInto(ctx, method);
1718
1752
  if (hooks?.authorize) {
@@ -1746,18 +1780,30 @@ async function dispatchEndpoint(state, request, match) {
1746
1780
  ctx.response = responseMetadata;
1747
1781
  const streamAbort = method.stream ? new AbortController : undefined;
1748
1782
  if (streamAbort) {
1749
- const signal = ctx.signal ?? req.signal;
1750
- if (signal.aborted)
1751
- streamAbort.abort(signal.reason);
1752
- else {
1753
- signal.addEventListener("abort", () => streamAbort.abort(signal.reason), {
1754
- once: true
1755
- });
1783
+ releaseStreamReq = forwardAbortSignal(req.signal, streamAbort);
1784
+ if (deadlineController && !streamAbort.signal.aborted) {
1785
+ releaseStreamOpenDeadline = forwardAbortSignal(deadlineController.signal, streamAbort);
1756
1786
  }
1757
- streamAbort.signal.addEventListener("abort", releaseDeadline, { once: true });
1787
+ streamAbort.signal.addEventListener("abort", () => {
1788
+ releaseStreamReq?.();
1789
+ releaseStreamReq = undefined;
1790
+ releaseStreamOpenDeadline?.();
1791
+ releaseStreamOpenDeadline = undefined;
1792
+ }, { once: true });
1758
1793
  ctx.signal = streamAbort.signal;
1759
1794
  }
1760
1795
  const result = await method.handler(ctx);
1796
+ if (method.stream) {
1797
+ if (deadlineController?.signal.aborted && !req.signal.aborted) {
1798
+ closeLateStreamSource(result);
1799
+ throw new AppError2("REQUEST_TIMEOUT", {
1800
+ status: 408,
1801
+ message: "Request deadline exceeded"
1802
+ });
1803
+ }
1804
+ releaseOpenDeadline();
1805
+ activeDeadlineReader = method.stream.lifetimeMs !== undefined ? createRemainingTimeoutReader(performance.now() + method.stream.lifetimeMs) : undefined;
1806
+ }
1761
1807
  const response = await endpointResponse(state, request, {
1762
1808
  ctx,
1763
1809
  match,
@@ -1766,15 +1812,23 @@ async function dispatchEndpoint(state, request, match) {
1766
1812
  streamAbort
1767
1813
  });
1768
1814
  if (streamAbort && !streamAbort.signal.aborted) {
1769
- deadlineOwnedByStream = true;
1815
+ streamOpened = true;
1816
+ }
1817
+ if (method.rawResponse && response.body !== null && !req.signal.aborted && !deadlineController?.signal.aborted) {
1818
+ disarmDeadlineTimer();
1819
+ activeDeadlineReader = undefined;
1820
+ keepRawBodySignalLink = true;
1770
1821
  }
1771
1822
  return response;
1772
1823
  } catch (err) {
1773
1824
  await multipartLifecycle?.rollback();
1774
1825
  return request.respondError(err, ctx, method, groupHooks);
1775
1826
  } finally {
1776
- if (!deadlineOwnedByStream)
1777
- releaseDeadline();
1827
+ releaseOpenDeadline();
1828
+ if (!streamOpened) {
1829
+ releaseStreamReq?.();
1830
+ releaseStreamReq = undefined;
1831
+ }
1778
1832
  }
1779
1833
  }
1780
1834
 
@@ -40,7 +40,7 @@ import {
40
40
  wwwAuthenticateHeader2,
41
41
  mcpProgressToken,
42
42
  createMcpProgressReporter
43
- } from "./index-kdw0n92g.js";
43
+ } from "./index-a09r9ff0.js";
44
44
  import {
45
45
  MCP_CATALOG_HEADER,
46
46
  mcpCatalogMeta2,
@@ -2,7 +2,7 @@
2
2
  * The one Postgres boundary the stores type against: run one statement with
3
3
  * `$1…$n` parameters in the caller's transaction, resolve with its rows.
4
4
  *
5
- * Stitchkit never opens a connection or imports a client. The application
5
+ * StitchKit never opens a connection or imports a client. The application
6
6
  * hands a store its transaction and this function, so Bun's SQL client,
7
7
  * Prisma and `pg` all fit without an adapter of ours:
8
8
  *
@@ -9,7 +9,7 @@ export interface ApiErrorRetryConfig {
9
9
  /** Whether an unclassified non-API error is treated as a network failure. */
10
10
  network?: boolean;
11
11
  }
12
- /** Build a React Query retry predicate from Stitchkit's cross-bundle API error model. */
12
+ /** Build a React Query retry predicate from StitchKit's cross-bundle API error model. */
13
13
  export declare function apiErrorRetry(config?: ApiErrorRetryConfig): (failureCount: number, error: unknown) => boolean;
14
14
  export type QueryClientServerCache = (factory: () => QueryClient) => () => QueryClient;
15
15
  export type QueryRetryValue = NonNullable<NonNullable<QueryClientConfig['defaultOptions']>['queries']>['retry'];
@@ -42,7 +42,7 @@ export interface BridgeHostHandle {
42
42
  readonly hostInstance: string;
43
43
  }
44
44
  /**
45
- * Serve a Stitchkit `FetchHandler` over a string-only `postMessage` bridge.
45
+ * Serve a StitchKit `FetchHandler` over a string-only `postMessage` bridge.
46
46
  *
47
47
  * Announces a `hello` frame on startup so a reconnecting window drops stale
48
48
  * in-flight calls and applies normal idempotency replay rules.
@@ -48,7 +48,7 @@ export interface BunServerConfig extends BunHandlerConfig, BunFetchComposition {
48
48
  */
49
49
  unix?: UnixListenConfig;
50
50
  websocket?: BunWebSocketHandlers;
51
- /** Full Stitchkit Socket.IO lifecycle; route and default websocket are mounted automatically. */
51
+ /** Full StitchKit Socket.IO lifecycle; route and default websocket are mounted automatically. */
52
52
  socket?: SocketIOServerLifecycle;
53
53
  development?: BunDevelopmentOptions;
54
54
  bun?: ServerPassthrough;
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint-dispatch.d.ts","sourceRoot":"","sources":["../../src/server/endpoint-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAsB,gBAAgB,CAAC,OAAO,EAC5C,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAC9B,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,QAAQ,CAAC,CA8HnB"}
1
+ {"version":3,"file":"endpoint-dispatch.d.ts","sourceRoot":"","sources":["../../src/server/endpoint-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA0B3C,wBAAsB,gBAAgB,CAAC,OAAO,EAC5C,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAC9B,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,QAAQ,CAAC,CAyLnB"}
@@ -67,10 +67,10 @@ export declare function deniedRequestCors(config: Pick<CorsConfig, 'methods' | '
67
67
  * - `traceparent` / `tracestate` — W3C Trace Context, what
68
68
  * `createHttpClient({ trace: true })` emits on every request; without it that
69
69
  * feature dies on the cross-origin preflight.
70
- * - `X-Stitchkit-Timeout-Ms` — relative remaining deadline budget propagated by
71
- * `createClient` / `createHttpClient`.
70
+ * - `x-stitchkit-timeout-ms` — relative remaining deadline budget propagated by
71
+ * `createClient` / `createHttpClient` (`DEADLINE_BUDGET_HEADER`).
72
72
  */
73
- export declare const DEFAULT_CORS_ALLOW_HEADERS = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate, X-Stitchkit-Timeout-Ms";
73
+ export declare const DEFAULT_CORS_ALLOW_HEADERS = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate, x-stitchkit-timeout-ms";
74
74
  /**
75
75
  * The default `Access-Control-Expose-Headers`. Without it a cross-origin
76
76
  * `fetch` can read only the CORS-safelisted response headers, so a browser
@@ -1 +1 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/cors.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC;AAED;;;GAGG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AAM,CAAC,CAExF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAehF"}
@@ -4,7 +4,7 @@ import type { z } from 'zod';
4
4
  /**
5
5
  * How this project loads its optional Socket.IO peers.
6
6
  *
7
- * Stitchkit resolves them through a variable rather than a literal
7
+ * StitchKit resolves them through a variable rather than a literal
8
8
  * `import('socket.io')`, deliberately: a consumer bundling an unrelated
9
9
  * `stitchkit/server` export must not have to resolve peers it never uses, and
10
10
  * `@socket.io/bun-engine` is Bun-only, so a top-level value import would break
@@ -98,7 +98,7 @@ export type SupervisedProcessVerification = {
98
98
  };
99
99
  /**
100
100
  * Create the default process-identity adapter backed by Linux `/proc` and
101
- * Stitchkit's `observeProcessInstance` / `probeProcessOwner`. A `socketPath` check needs
101
+ * StitchKit's `observeProcessInstance` / `probeProcessOwner`. A `socketPath` check needs
102
102
  * iproute2 `ss` at `/usr/bin/ss` or `/usr/sbin/ss`; it never looks `ss` up on `PATH`.
103
103
  */
104
104
  export declare function createDefaultProcessIdentityAdapter(procRoot?: string): ProcessIdentityAdapter;
@@ -60,7 +60,7 @@ export interface CheckSystemdUnitOptions {
60
60
  * - `digest-mismatch`: the file at `unitPath` has other bytes;
61
61
  * - `fragment-mismatch`: systemd answers for the name from somewhere other than `unitPath` — a
62
62
  * vendor, transient or generated unit, a mask, a loaded unit with no file — or has not loaded it;
63
- * - `foreign-drop-in`: a drop-in Stitchkit does not trust changes the unit.
63
+ * - `foreign-drop-in`: a drop-in StitchKit does not trust changes the unit.
64
64
  */
65
65
  export type SystemdUnitCheckStatus = 'matches' | 'missing' | 'digest-mismatch' | 'fragment-mismatch' | 'foreign-drop-in';
66
66
  /** Structured inspection report produced by {@link checkSystemdUnit}. */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Time stands still until the test moves it, and due timers fire strictly in deadline order
5
5
  * (ties in scheduling order), so "retry after 5 s" runs in milliseconds and the same way every
6
- * time. It satisfies every timer boundary Stitchkit accepts: `ManagedScheduleClock`,
6
+ * time. It satisfies every timer boundary StitchKit accepts: `ManagedScheduleClock`,
7
7
  * `DurabilityClock`, `RevisionSignalClock` and `BoundedAdmissionClock`.
8
8
  *
9
9
  * Between firings the clock yields to the **real event loop** (`setImmediate` turns), not just to
@@ -69,7 +69,7 @@ export interface McpClientConnectionConfig {
69
69
  limits?: McpConnectionLimits;
70
70
  /**
71
71
  * Where the discovered catalog is kept between processes. When the server stamps its
72
- * catalog (a Stitchkit server does), a stored catalog with the live stamp is mounted without
72
+ * catalog (a StitchKit server does), a stored catalog with the live stamp is mounted without
73
73
  * asking for `tools/list`; any other answer lists and stores again.
74
74
  */
75
75
  catalog?: McpConnectionCatalogStore;
@@ -45,7 +45,7 @@ export interface McpHttpHandler {
45
45
  }
46
46
  /**
47
47
  * Build a stateless MCP HTTP handler on the official SDK v2 request factory.
48
- * Every request gets a fresh SDK server and a fresh Stitchkit tool context;
48
+ * Every request gets a fresh SDK server and a fresh StitchKit tool context;
49
49
  * no protocol session, event store or `Mcp-Session-Id` exists in this layer.
50
50
  */
51
51
  export declare function createMcpHandler<TAuth, const TSurfaces extends McpSurfaceRegistry = McpSurfaceRegistry>(config: McpHandlerConfig<TAuth, TSurfaces>): McpHttpHandler;
@@ -30,7 +30,7 @@ export interface ManagedLazyMcpTool {
30
30
  export declare function validateMcpLazyDiscovery(rawConfig: unknown, contractToolNames: readonly string[], reservedToolNames?: readonly string[]): ValidatedMcpLazyDiscovery;
31
31
  /**
32
32
  * Hide non-initial contract tools on this `McpServer` session and register the built-in discovery
33
- * tool through Stitchkit's standard runtime-tool pipeline (`access`, `hooks`, `catalog` stamp).
33
+ * tool through StitchKit's standard runtime-tool pipeline (`access`, `hooks`, `catalog` stamp).
34
34
  */
35
35
  export declare function applyMcpLazyDiscovery(input: {
36
36
  readonly server: McpServer;
@@ -181,7 +181,7 @@ export declare function buildMcpServer(config: McpServerBuildConfig<undefined>):
181
181
  export declare function buildMcpServer<TAuth>(config: McpServerBuildConfig<TAuth>, auth: TAuth): McpServer;
182
182
  /**
183
183
  * The stamp of everything a built server advertises in `tools/list`, or `undefined` when part
184
- * of it is unknown to Stitchkit (`rawTools`).
184
+ * of it is unknown to StitchKit (`rawTools`).
185
185
  */
186
186
  export declare function servedMcpCatalog(server: McpServer): McpCatalogStamp | undefined;
187
187
  /** Build one fresh server from a deterministic surface prepared by its owner. */
@@ -21,7 +21,7 @@ export interface McpStdioHandle {
21
21
  }
22
22
  /**
23
23
  * Serve one dual-era MCP connection over process stdio. The official SDK owns
24
- * opening-era negotiation and transport shutdown; Stitchkit owns the surface.
24
+ * opening-era negotiation and transport shutdown; StitchKit owns the surface.
25
25
  */
26
26
  export declare function createStdioMcpServer<TAuth>(config: StdioMcpServerConfig<TAuth>): Promise<McpStdioHandle>;
27
27
  //# sourceMappingURL=stdio.d.ts.map
@@ -57,7 +57,7 @@ protocol but exclude runtime `context`. Submit permits only strict text/file par
57
57
  file ownership and metadata policy are checked by server authorization. The shared
58
58
  `agentControlRealtimeContract` owns `agent:control` acknowledgements and `agent:delivery`.
59
59
 
60
- `createAgentController` / `AgentControllerConfig` take an existing Stitchkit
60
+ `createAgentController` / `AgentControllerConfig` take an existing StitchKit
61
61
  realtime `transport`, `conversationId`, `access` (`observe` or `control`), optional
62
62
  `timeoutMs` (10000), `maxBufferedEvents` (256), `maxBufferedBytes` (1048576) and
63
63
  `maxPendingRequests` (32). All bounds are positive safe integers. One controller owns one
@@ -22,7 +22,7 @@ loaded by the neutral, browser or Node runtime surfaces.
22
22
  | `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate the schema, migrate older versions transactionally and return `{ store, conversations, host, close }` |
23
23
  | `BunSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional create and initialization policies |
24
24
  | `createSqliteAgentRuntimeStore` | function | build the normalized store over an injected synchronous SQLite boundary |
25
- | `initializeAgentRuntimeSqlite` | function | initialize or validate only Stitchkit's namespaced SQLite schema |
25
+ | `initializeAgentRuntimeSqlite` | function | initialize or validate only StitchKit's namespaced SQLite schema |
26
26
  | `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
27
27
  | `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle — `store`, `conversations`, `host`, `close` — owned connection lifecycle, initialization policy, and the companion host every companion takes |
28
28
 
@@ -41,7 +41,7 @@ const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sq
41
41
  Initialization creates only `stitchkit_agent_runtime_*` tables and records
42
42
  schema version 2 in `stitchkit_agent_runtime_meta`; it does not use
43
43
  `PRAGMA user_version` or mutate application tables. An unknown schema version or
44
- unversioned partial Stitchkit schema is refused. The connection is owned by the
44
+ unversioned partial StitchKit schema is refused. The connection is owned by the
45
45
  returned handle and closes only after accepted operations drain.
46
46
 
47
47
  Each handle serializes its transactions. Separate connections use
@@ -45,7 +45,7 @@ what it produced"**:
45
45
  surface that sends nothing until the run is done never showed it at all. When
46
46
  it reached nobody, it is not part of the conversation. That is `supersede`.
47
47
 
48
- **Stitchkit cannot answer that question for you** — delivery belongs to the
48
+ **StitchKit cannot answer that question for you** — delivery belongs to the
49
49
  transport, and the runtime sees an abort, not a screen. Hence a declared policy
50
50
  (→ ADR 0108), and hence `inputPolicy` accepting a function, so one application
51
51
  can hold two surfaces with different rules without the core learning which is
@@ -173,7 +173,7 @@ while the predecessor still owns managed callbacks. A hung predecessor blocks
173
173
  the lane in the first version.
174
174
 
175
175
  Shutdown is two-phase, and both budgets carry the names they carry everywhere
176
- else in Stitchkit:
176
+ else in StitchKit:
177
177
 
178
178
  ```ts
179
179
  const closed = await runtime.close({ gracePeriodMs: 30_000, forceTimeoutMs: 5_000 })
@@ -535,7 +535,7 @@ The agent `terminal` event and the adapter's delivery receipt are intentionally
535
535
  different records. A successful run does not prove that a reply reached its
536
536
  channel, and a delivery failure never rewrites the canonical agent result.
537
537
  Shutdown stops ingress, drains accepted process-local work and leaves ambiguous
538
- outbox records visible for a later reconciliation pass. Stitchkit does not own
538
+ outbox records visible for a later reconciliation pass. StitchKit does not own
539
539
  a channel database, durable broker, provider payload schema or application
540
540
  identity policy.
541
541
 
@@ -574,7 +574,7 @@ prepareStep: (step) => {
574
574
  ```
575
575
 
576
576
  That deliberate refusal ends the run as `context_overflow` on the durable
577
- record, delivery terminal and operator event. Stitchkit does not inspect error
577
+ record, delivery terminal and operator event. StitchKit does not inspect error
578
578
  messages — it recognises failures by identity, not by text. A store refusing an
579
579
  owned mutation ends the run `storage_conflict`; `protocol.acceptTerminal`
580
580
  refusing a finished message ends it `output_rejected`; a check the SDK runs on
@@ -24,7 +24,7 @@ Parts of this slice:
24
24
  > from `stitchkit/tools/agent` for an AI SDK loop) is the direct path.
25
25
 
26
26
  `stitchkit/agent-runtime` is the peer-free, server-only, opinionated layer above
27
- `mountAgentTools`. Use it when the application wants Stitchkit to own conversation
27
+ `mountAgentTools`. Use it when the application wants StitchKit to own conversation
28
28
  mechanics: durable acceptance, history projection, the native `AgentModelDriver`
29
29
  step loop, checkpoints, keyed interruption, terminal commit and stable application
30
30
  events.
@@ -472,7 +472,7 @@ is a reference structured control loop for `submit`, `interrupt`, `snapshot` and
472
472
  It starts no process and chooses no framing, authentication or transport. Importing either example
473
473
  has no side effect; an external supervisor owns process placement and restart.
474
474
 
475
- | Concern | Public Stitchkit composition | Boundary |
475
+ | Concern | Public StitchKit composition | Boundary |
476
476
  | --- | --- | --- |
477
477
  | execution loop | `createAgentRuntime` | already available; do not copy a second loop |
478
478
  | model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
@@ -760,7 +760,7 @@ fit. Exact equality (including a zero window with zero reservations/history)
760
760
  fits; any unavailable component keeps the decision `unavailable`.
761
761
 
762
762
  The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
763
- and supplies atomicity; Stitchkit owns transition validation and revision
763
+ and supplies atomicity; StitchKit owns transition validation and revision
764
764
  arithmetic. The executable reference is
765
765
  [`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
766
766
  `compareAndSwap` returns either `{ outcome: 'applied' }` or
@@ -296,7 +296,7 @@ only through `stitchkit/application` exports.
296
296
  ## Database connection
297
297
 
298
298
  Wrap connection allocation and readiness in `start`, and make `close` safe after
299
- partial setup. Stitchkit invokes cleanup for every attempted start, including a
299
+ partial setup. StitchKit invokes cleanup for every attempted start, including a
300
300
  start that allocates a client and then rejects.
301
301
 
302
302
  ```ts
@@ -319,7 +319,7 @@ allocation and proves one rollback close.
319
319
 
320
320
  An application-owned client is an ordinary managed resource. Keep SDK creation,
321
321
  credentials, authorization and reconnect policy in the application; no Telegram
322
- client SDK is required by Stitchkit. Create a fresh client inside each `start`,
322
+ client SDK is required by StitchKit. Create a fresh client inside each `start`,
323
323
  publish it after connection/readiness succeeds, and share one memoized destroy
324
324
  promise between partial-start cleanup, `close` and `force`:
325
325
 
@@ -485,7 +485,7 @@ async function handleDelivery(delivery: Delivery) {
485
485
  }
486
486
  ```
487
487
 
488
- Stitchkit owns only process-local admission accounting and drain. Durable claims,
488
+ StitchKit owns only process-local admission accounting and drain. Durable claims,
489
489
  visibility timeouts, deduplication, idempotency and retry classification remain
490
490
  in the queue/product layer.
491
491
 
@@ -514,7 +514,7 @@ await publisher.close()
514
514
  ```
515
515
 
516
516
  The monitoring backend, transport retry and cross-process aggregation remain
517
- outside Stitchkit. The executable recipe blocks revision 0, coalesces
517
+ outside StitchKit. The executable recipe blocks revision 0, coalesces
518
518
  intermediate revisions, explicitly admits the final absolute snapshot after
519
519
  unsubscribe and proves that `close()` flushes revision 3. Do not rely on an
520
520
  asynchronous subscriber callback racing cleanup: publish `getSnapshot()` before
@@ -104,7 +104,7 @@ no cost to binding first.
104
104
 
105
105
  The exact resource callbacks are typed by their public configuration. The
106
106
  important ownership rule is stable: the application decides what the
107
- database/server/provider objects are and how they are configured; Stitchkit
107
+ database/server/provider objects are and how they are configured; StitchKit
108
108
  orders their process-local lifecycle and decides *when* they come into
109
109
  existence.
110
110
 
@@ -117,9 +117,9 @@ dependency.
117
117
 
118
118
  Start and readiness are different. A connection can finish setup and return a
119
119
  ready handle. A poller can return a handle immediately, settle `ready` later,
120
- and keep a long-lived `completion` promise. Stitchkit observes both.
120
+ and keep a long-lived `completion` promise. StitchKit observes both.
121
121
 
122
- Once Stitchkit invokes start/activation, cleanup is guaranteed to be attempted.
122
+ Once StitchKit invokes start/activation, cleanup is guaranteed to be attempted.
123
123
  Write `close` so it is safe when setup was partial:
124
124
 
125
125
  ```ts
@@ -267,7 +267,7 @@ failure, and the startup error stays the `cause` of the `AggregateError` that
267
267
  failed startup from ever reporting why it failed.
268
268
 
269
269
  A required long-lived completion that rejects after startup makes readiness
270
- false and health unhealthy. Stitchkit records the failure but does not restart
270
+ false and health unhealthy. StitchKit records the failure but does not restart
271
271
  the resource or process.
272
272
 
273
273
  `ApplicationResourceShutdown.failures` names the phase that failed — `start`,
package/llms/cli.2.txt CHANGED
@@ -106,7 +106,7 @@ on stdout. A native `defineCliCommand` declares none of those facts, so a failed
106
106
 
107
107
  A CLI that mounts a server's tools through `defineMcpClientConnection` never sees the
108
108
  method or contract `effect` — every MCP call is a `POST` — so it reads the `readOnlyHint`
109
- the server publishes. A Stitchkit server publishes it for every repeatable read by the
109
+ the server publishes. A StitchKit server publishes it for every repeatable read by the
110
110
  rule above ([MCP → `readOnlyHint`](./mcp-and-agents.md#saying-which-tools-only-read--readonlyhint)),
111
111
  so the same command behaves the same over the contract and over MCP. The hint is the
112
112
  server's word: a server that labels a write as read-only makes the CLI withhold that
@@ -720,7 +720,7 @@ counts raw UTF-8 body bytes, including SSE framing, regardless of `Content-Lengt
720
720
  Pending legacy calls also count comments and wrong-id frames. `budget.maxTools`
721
721
  and `budget.maxSchemaBytes` remain separate mount limits.
722
722
 
723
- **A stored catalog is mounted while it is current.** A Stitchkit server sends its
723
+ **A stored catalog is mounted while it is current.** A StitchKit server sends its
724
724
  [catalog stamp](./mcp-and-agents.md#knowing-your-catalog-is-stale--the-catalog-stamp) with
725
725
  the `initialize` answer, as the `stitchkit-catalog` response header. Given a `catalog:
726
726
  { load, store }`, the connection compares it with the stamp of the stored `tools/list`
@@ -731,7 +731,7 @@ stores again. A listing is stored only when every tool in it carries the stamp t
731
731
  `initialize` answer announced, so a rolling deploy answering the two requests from
732
732
  different builds stores nothing. A server without a stamp, a surface with raw SDK tools
733
733
  and a failing `load` or `store` all cost one `tools/list`, never the mount. The stamp
734
- covers what `tools/list` publishes as Stitchkit builds it; the JSON Schema text the
734
+ covers what `tools/list` publishes as StitchKit builds it; the JSON Schema text the
735
735
  server's MCP SDK renders from the same schema is not hashed separately.
736
736
 
737
737
  Only the initial `initialize` can negotiate HTTP-to-legacy fallback on 400, 404
@@ -867,11 +867,32 @@ A native-only CLI (only `commands`, no `services` or `runtimeTools`) takes no
867
867
 
868
868
  ## Typed context
869
869
 
870
- Use `createToolkit<AppContext>()` to type the injected `context` against your
871
- app's context shape — the tool-side mirror of `createImplement`
872
- ([ADR 0017](../decisions/0017-typed-tool-context.md)):
870
+ For a peer-free CLI, import `createCli` directly from `stitchkit/cli` and
871
+ annotate the `context` factory's return type against your app's context shape
872
+ — no optional peers are loaded:
873
873
 
874
874
  ```ts
875
+ import { createCli } from 'stitchkit/cli'
876
+
877
+ await createCli({
878
+ name: 'myapp',
879
+ version: '1.0.0',
880
+ services,
881
+ access: { gate: { beforeHandle: authHook } },
882
+ context: (identity): { user: User | undefined } => ({ user: identity }),
883
+ })
884
+ ```
885
+
886
+ If your application already installs both `@modelcontextprotocol/server` and
887
+ `ai` and mounts MCP, AI SDK `mountAgent`, and CLI surfaces together, you can
888
+ also pin the shared context type once via `createToolkit<AppContext>()` from
889
+ `stitchkit/tools/toolkit` — the tool-side mirror of `createImplement`
890
+ ([ADR 0017](../decisions/0017-typed-tool-context.md),
891
+ [ADR 0284](../decisions/0284-the-tools-barrel-loads-no-optional-peer.md)):
892
+
893
+ ```ts
894
+ import { createToolkit } from 'stitchkit/tools/toolkit'
895
+
875
896
  const tools = createToolkit<{ user: User }>()
876
897
  await tools.createCli({
877
898
  name: 'myapp',
package/llms/cli.txt CHANGED
@@ -112,7 +112,7 @@ await createCli({
112
112
  ```
113
113
 
114
114
  `createCli({ signal })` and its wait loop honor an explicit caller
115
- `AbortSignal`. Stitchkit does not install a process-global SIGINT handler for
115
+ `AbortSignal`. StitchKit does not install a process-global SIGINT handler for
116
116
  ordinary CLI programs: if desired, the application binds SIGINT to an
117
117
  `AbortController` and passes its signal. Aborting wait stops polling only; it
118
118
  does not cancel the underlying job.
@@ -213,7 +213,7 @@ const doctor = defineCliCommand({
213
213
  })
214
214
  ```
215
215
 
216
- `present` returns the exact stdout bytes, which Stitchkit writes once. Without
216
+ `present` returns the exact stdout bytes, which StitchKit writes once. Without
217
217
  it the canonical JSON output is unchanged. `exitCode` classifies a successfully
218
218
  validated result and must return an integer in `0..255`; failed `ToolResult`
219
219
  envelopes and the application-wide `exitCodes` mapping remain authoritative for
package/llms/contract.txt CHANGED
@@ -88,7 +88,7 @@ export const users = defineContract({ prefix: 'users' }, {
88
88
  `HEAD` is an explicit HTTP-only operation, never an automatic alias for `GET`.
89
89
  It must declare `rawResponse: true`; request body, `input`, multipart, `rawBody`,
90
90
  typed `output` and tool exposure are rejected. The handler owns status and
91
- headers, while Stitchkit guarantees an empty wire body even if the returned
91
+ headers, while StitchKit guarantees an empty wire body even if the returned
92
92
  `Response` accidentally contains one.
93
93
 
94
94
  ## `params` vs `input` vs `output`
@@ -23,7 +23,7 @@ fails a build whose entry imports the default loader of another `stitchkit` inst
23
23
  both versions and roots.
24
24
  It resolves the installed package's target/version, reads each selected addon once and checks it
25
25
  against the `size` and `sha256` published in the package's `native-assets.json` (`formatVersion: 2`,
26
- written when Stitchkit is built). Call it once per build and reuse the result.
26
+ written when StitchKit is built). Call it once per build and reuse the result.
27
27
  `platform`, `architecture`, `delivery`, `entryPath` and `assetPath` are the explicit inputs of
28
28
  companion delivery; embedded delivery takes `platform`, one `architecture` and `delivery` only, and
29
29
  refuses a path. `assetPath` accepts one template, `[hash]`, replaced by the first 16 hex digits of