stitchkit 0.106.1 → 0.108.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 (147) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/README.md +2 -0
  3. package/darwin-native.cjs +17 -4
  4. package/dist/agent-runtime/deferred-tool-types.d.ts +6 -27
  5. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  6. package/dist/browser/stream.d.ts +38 -12
  7. package/dist/browser/stream.d.ts.map +1 -1
  8. package/dist/entrypoints/agent-runtime/browser.js +2 -3
  9. package/dist/entrypoints/agent-runtime/coding-tools.js +6 -8
  10. package/dist/entrypoints/agent-runtime/harness.js +7 -11
  11. package/dist/entrypoints/agent-runtime/realtime.js +2 -3
  12. package/dist/entrypoints/agent-runtime/sandbox.js +6 -8
  13. package/dist/entrypoints/agent-runtime.d.ts +2 -1
  14. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  15. package/dist/entrypoints/agent-runtime.js +20 -23
  16. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  17. package/dist/entrypoints/application/directory-inbox.js +8 -9
  18. package/dist/entrypoints/application/grammy.js +3 -3
  19. package/dist/entrypoints/application.js +7 -8
  20. package/dist/entrypoints/bin/upgrade-cli.d.ts +32 -0
  21. package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
  22. package/dist/entrypoints/bin/upgrade-cli.js +451 -8
  23. package/dist/entrypoints/cli/publish.js +10 -11
  24. package/dist/entrypoints/cli.js +12 -16
  25. package/dist/entrypoints/contract.js +1 -1
  26. package/dist/entrypoints/files/packaging.d.ts +3 -1
  27. package/dist/entrypoints/files/packaging.d.ts.map +1 -1
  28. package/dist/entrypoints/files/packaging.js +171 -55
  29. package/dist/entrypoints/files.js +16 -16
  30. package/dist/entrypoints/index.d.ts +1 -1
  31. package/dist/entrypoints/index.d.ts.map +1 -1
  32. package/dist/entrypoints/index.js +47 -41
  33. package/dist/entrypoints/node.js +27 -29
  34. package/dist/entrypoints/observability.js +10 -12
  35. package/dist/entrypoints/process.js +2 -2
  36. package/dist/entrypoints/react.js +3 -4
  37. package/dist/entrypoints/remote.js +8 -9
  38. package/dist/entrypoints/server.js +48 -51
  39. package/dist/entrypoints/telegram/html.js +3 -3
  40. package/dist/entrypoints/telegram/screens.js +6 -6
  41. package/dist/entrypoints/telegram.d.ts +2 -0
  42. package/dist/entrypoints/telegram.d.ts.map +1 -1
  43. package/dist/entrypoints/telegram.js +344 -11
  44. package/dist/entrypoints/testing.d.ts +1 -0
  45. package/dist/entrypoints/testing.d.ts.map +1 -1
  46. package/dist/entrypoints/testing.js +138 -11
  47. package/dist/entrypoints/tools/connections.js +11 -11
  48. package/dist/entrypoints/tools/invoker.js +5 -9
  49. package/dist/entrypoints/tools/mcp.js +8 -14
  50. package/dist/entrypoints/tools.js +19 -25
  51. package/dist/entrypoints/tracking.js +3 -3
  52. package/dist/files/native-artifact.d.ts +14 -0
  53. package/dist/files/native-artifact.d.ts.map +1 -0
  54. package/dist/files/native-packaging-layout.d.ts +11 -2
  55. package/dist/files/native-packaging-layout.d.ts.map +1 -1
  56. package/dist/files/native-packaging-plugin.d.ts +53 -0
  57. package/dist/files/native-packaging-plugin.d.ts.map +1 -0
  58. package/dist/files/native-packaging.d.ts +44 -43
  59. package/dist/files/native-packaging.d.ts.map +1 -1
  60. package/dist/{index-v5ee8ath.js → index-1h2zv8rx.js} +10 -40
  61. package/dist/index-2kbysk9s.js +42 -0
  62. package/dist/{index-wbhdzxar.js → index-2s6fpehp.js} +5 -5
  63. package/dist/{index-ksfagmyz.js → index-4qh90tyw.js} +8 -8
  64. package/dist/{index-yvfk3y36.js → index-636mggad.js} +4 -3
  65. package/dist/{index-f199nfq5.js → index-6y9t2fwz.js} +7 -7
  66. package/dist/{index-w8etpm8j.js → index-9j2atjte.js} +1 -1
  67. package/dist/index-a5qr2rj6.js +26 -0
  68. package/dist/{index-azx12jgv.js → index-bh2ht9y5.js} +13 -7
  69. package/dist/{index-pz3y6b6g.js → index-cx2nh595.js} +3 -3
  70. package/dist/{index-2k91mewf.js → index-dm2fv45z.js} +9 -9
  71. package/dist/{index-9bskshe3.js → index-dwf0gymy.js} +10 -10
  72. package/dist/{index-qaqbdm7s.js → index-h7qms8f9.js} +8 -8
  73. package/dist/{index-drs41arz.js → index-ktjmgq9p.js} +1 -1
  74. package/dist/{index-916yh4e2.js → index-mep4sb48.js} +14 -14
  75. package/dist/{index-wdy68sh6.js → index-njs9gvrh.js} +17 -17
  76. package/dist/{index-1ptj98e0.js → index-nx49x0tw.js} +2 -2
  77. package/dist/{index-1pwwan01.js → index-p5kx5vqd.js} +214 -59
  78. package/dist/{index-sj28htvf.js → index-pvh3z03x.js} +1 -1
  79. package/dist/{index-r393tnfp.js → index-q6crhe1n.js} +4 -4
  80. package/dist/{index-dsnjzb62.js → index-t2bsd0hm.js} +1 -1
  81. package/dist/{index-4vsby8n8.js → index-w9mqgnz9.js} +1 -1
  82. package/dist/{index-z23rfxhj.js → index-xmgjtkvr.js} +1 -1
  83. package/dist/{index-e05cjgtf.js → index-xvj9h8yh.js} +28 -1
  84. package/dist/{index-gr5g3xfw.js → index-yz8x0hbx.js} +1 -1
  85. package/dist/{index-gxm9rc97.js → index-zrtrjkbf.js} +1 -1
  86. package/dist/internal/bounded-lines.d.ts +46 -2
  87. package/dist/internal/bounded-lines.d.ts.map +1 -1
  88. package/dist/internal/darwin-binding-error.d.ts +9 -1
  89. package/dist/internal/darwin-binding-error.d.ts.map +1 -1
  90. package/dist/internal/darwin-binding.d.ts.map +1 -1
  91. package/dist/internal/process-identity.d.ts.map +1 -1
  92. package/dist/internal/until-aborted.d.ts +9 -0
  93. package/dist/internal/until-aborted.d.ts.map +1 -0
  94. package/dist/internal/upgrade-affects.d.ts +58 -0
  95. package/dist/internal/upgrade-affects.d.ts.map +1 -0
  96. package/dist/internal/upgrade-plan.d.ts +20 -0
  97. package/dist/internal/upgrade-plan.d.ts.map +1 -1
  98. package/dist/internal/upgrade-usage.d.ts +61 -0
  99. package/dist/internal/upgrade-usage.d.ts.map +1 -0
  100. package/dist/telegram/bot-api.d.ts +10 -4
  101. package/dist/telegram/bot-api.d.ts.map +1 -1
  102. package/dist/telegram/broadcast.d.ts +2 -1
  103. package/dist/telegram/broadcast.d.ts.map +1 -1
  104. package/dist/telegram/not-dispatched.d.ts +26 -0
  105. package/dist/telegram/not-dispatched.d.ts.map +1 -0
  106. package/dist/telegram/operator-channel.d.ts +2 -1
  107. package/dist/telegram/operator-channel.d.ts.map +1 -1
  108. package/dist/telegram/send-failure.d.ts +4 -3
  109. package/dist/telegram/send-failure.d.ts.map +1 -1
  110. package/dist/telegram/transport-connect.d.ts +38 -0
  111. package/dist/telegram/transport-connect.d.ts.map +1 -0
  112. package/dist/telegram/transport.d.ts +43 -0
  113. package/dist/telegram/transport.d.ts.map +1 -0
  114. package/dist/telegram/webhook.d.ts +2 -1
  115. package/dist/telegram/webhook.d.ts.map +1 -1
  116. package/dist/testing/manual-clock.d.ts +82 -0
  117. package/dist/testing/manual-clock.d.ts.map +1 -0
  118. package/dist/tools/internal/surface-projector.d.ts +0 -7
  119. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  120. package/dist/tools/runtime-tool-declaration.d.ts +11 -0
  121. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
  122. package/dist/tools/runtime-tool.d.ts +2 -3
  123. package/dist/tools/runtime-tool.d.ts.map +1 -1
  124. package/llms/files-packaging.txt +13 -6
  125. package/llms/process.txt +71 -15
  126. package/llms/stitchkit.2.txt +211 -628
  127. package/llms/stitchkit.txt +635 -10
  128. package/llms/telegram.txt +36 -3
  129. package/llms/testing.txt +47 -0
  130. package/llms/{upgrading-0.96.0-0.106.0.txt → upgrading-0.100.0-0.108.0.txt} +112 -144
  131. package/llms/{upgrading-0.37.0-0.53.0.txt → upgrading-0.37.0-0.58.0.txt} +209 -3
  132. package/llms/{upgrading-0.55.0-0.68.0.txt → upgrading-0.59.0-0.71.0.txt} +149 -209
  133. package/llms/{upgrading-0.69.0-0.95.0.txt → upgrading-0.72.0-0.99.0.txt} +137 -149
  134. package/llms/upgrading.txt +36 -4
  135. package/llms-full.txt +360 -39
  136. package/llms.txt +10 -10
  137. package/package.json +2 -1
  138. package/llms/stitchkit.3.txt +0 -177
  139. package/dist/{index-cazts87s.js → index-07dcf2yn.js} +3 -3
  140. package/dist/{index-n1nszyk0.js → index-7jvwrjqa.js} +3 -3
  141. package/dist/{index-cmzvhhtd.js → index-85qve8mq.js} +3 -3
  142. package/dist/{index-rpzewktb.js → index-fynr93w4.js} +3 -3
  143. package/dist/{index-37asdw3a.js → index-k7qdkh3n.js} +3 -3
  144. package/dist/{index-x7w1z6pf.js → index-q4hjtyye.js} +4 -4
  145. package/dist/{index-7n68nmc6.js → index-y3nemndz.js} +3 -3
  146. package/dist/{index-12zsej7b.js → index-y70v24cw.js} +3 -3
  147. package/dist/{index-pzb63z66.js → index-ykdcnq1f.js} +3 -3
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type NativePackagingPlugin } from './native-packaging-plugin.js';
2
3
  declare const ArchitectureSchema: z.ZodEnum<{
3
4
  arm64: "arm64";
4
5
  x64: "x64";
@@ -13,12 +14,20 @@ declare const SingleOptionsSchema: z.ZodObject<{
13
14
  }>;
14
15
  entryPath: z.ZodString;
15
16
  architecture: z.ZodString;
16
- delivery: z.ZodEnum<{
17
- companion: "companion";
18
- embedded: "embedded";
19
- }>;
17
+ delivery: z.ZodLiteral<"companion">;
20
18
  assetPath: z.ZodString;
21
19
  }, z.core.$strip>;
20
+ /**
21
+ * A standalone executable carries the addon inside itself, so there is no output layout to name;
22
+ * a path passed anyway is refused rather than ignored.
23
+ */
24
+ declare const EmbeddedOptionsSchema: z.ZodObject<{
25
+ platform: z.ZodEnum<{
26
+ darwin: "darwin";
27
+ }>;
28
+ architecture: z.ZodString;
29
+ delivery: z.ZodLiteral<"embedded">;
30
+ }, z.core.$strict>;
22
31
  declare const MultipleOptionsSchema: z.ZodObject<{
23
32
  platform: z.ZodEnum<{
24
33
  darwin: "darwin";
@@ -28,17 +37,22 @@ declare const MultipleOptionsSchema: z.ZodObject<{
28
37
  delivery: z.ZodLiteral<"companion">;
29
38
  assetPath: z.ZodRecord<z.ZodString, z.ZodString>;
30
39
  }, z.core.$strip>;
40
+ declare const EmbeddedAssetSchema: z.ZodObject<{
41
+ size: z.ZodInt;
42
+ sha256: z.ZodString;
43
+ bytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
44
+ }, z.core.$strip>;
31
45
  declare const AssetSchema: z.ZodObject<{
32
- outputPath: z.ZodString;
33
46
  size: z.ZodInt;
34
47
  sha256: z.ZodString;
35
48
  bytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
49
+ outputPath: z.ZodString;
36
50
  }, z.core.$strip>;
37
51
  declare const TargetAssetSchema: z.ZodObject<{
38
- outputPath: z.ZodString;
39
52
  size: z.ZodInt;
40
53
  sha256: z.ZodString;
41
54
  bytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
55
+ outputPath: z.ZodString;
42
56
  architecture: z.ZodEnum<{
43
57
  arm64: "arm64";
44
58
  x64: "x64";
@@ -81,10 +95,12 @@ declare const RefusalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
81
95
  }, z.core.$strip>;
82
96
  }, z.core.$strip>], "state">;
83
97
  /**
84
- * Input to `createNativePackaging`: platform, entry path, delivery and addon path per
85
- * architecture; `Multiple` selects one target or a list of them.
98
+ * Input to `createNativePackaging` for companion delivery: platform, entry path and addon path
99
+ * per architecture; `Multiple` selects one target or a list of them.
86
100
  */
87
101
  export type NativePackagingOptions<Multiple extends boolean = false> = Multiple extends true ? z.input<typeof MultipleOptionsSchema> : z.input<typeof SingleOptionsSchema>;
102
+ /** Input to `createNativePackaging` for a standalone executable: platform and one architecture. */
103
+ export type NativePackagingEmbeddedOptions = z.input<typeof EmbeddedOptionsSchema>;
88
104
  /**
89
105
  * One native addon to ship with the bundle: where it lands in the output, its `bytes` already
90
106
  * checked against the `size` and `sha256` the package published, and those published values.
@@ -92,40 +108,10 @@ export type NativePackagingOptions<Multiple extends boolean = false> = Multiple
92
108
  */
93
109
  export type NativePackagingAsset<Multiple extends boolean = false> = Multiple extends true ? z.infer<typeof TargetAssetSchema> : z.infer<typeof AssetSchema>;
94
110
  /**
95
- * Structural Bun plugin protocol: declarations need no Bun runtime or ambient types.
111
+ * The addon a standalone executable embeds: its verified `bytes` with the published `size` and
112
+ * `sha256`, for qualification. The plugin hands Bun these bytes; there is nothing to write.
96
113
  */
97
- export type NativePackagingPlugin = {
98
- name: string;
99
- setup: (build: {
100
- config: {
101
- splitting?: boolean;
102
- naming?: string | {
103
- entry?: string;
104
- };
105
- entrypoints: string[];
106
- };
107
- onLoad: (options: {
108
- filter: RegExp;
109
- }, callback: (args: {
110
- path: string;
111
- }) => {
112
- contents: string;
113
- loader: 'js';
114
- } | {
115
- contents: Uint8Array;
116
- loader: 'napi';
117
- } | undefined) => unknown;
118
- onResolve: (options: {
119
- filter: RegExp;
120
- }, callback: (args: {
121
- path: string;
122
- importer: string;
123
- }) => {
124
- path: string;
125
- external: boolean;
126
- } | undefined) => unknown;
127
- }) => void;
128
- };
114
+ export type NativePackagingEmbeddedAsset = z.infer<typeof EmbeddedAssetSchema>;
129
115
  /**
130
116
  * `ready` with the verified assets to write and the Bun plugin to add, or a refusal naming an
131
117
  * unsupported architecture, a missing asset or an asset whose bytes differ from the published
@@ -139,17 +125,32 @@ export type NativePackagingResult<Multiple extends boolean = false> = z.infer<ty
139
125
  assets: NativePackagingAsset<Multiple>[];
140
126
  plugin: NativePackagingPlugin;
141
127
  };
128
+ /**
129
+ * `ready` with the verified addon and the Bun plugin that embeds it, or the refusals of
130
+ * {@link NativePackagingResult}.
131
+ */
132
+ export type NativePackagingEmbeddedResult = z.infer<typeof RefusalSchema> | {
133
+ state: 'ready';
134
+ platform: z.infer<typeof PlatformSchema>;
135
+ architecture: z.infer<typeof ArchitectureSchema>;
136
+ packageVersion: string;
137
+ assets: NativePackagingEmbeddedAsset[];
138
+ plugin: NativePackagingPlugin;
139
+ };
142
140
  /**
143
141
  * Resolve this installed package's asset graph, without parsing downstream loader text.
144
142
  * `platform` is `'darwin'`, the only platform with native addons; another name throws.
145
143
  * Each selected addon is read and hashed once per call and checked against the size and
146
144
  * SHA256 published in the package's `native-assets.json`; the first one that differs refuses
147
145
  * with `NATIVE_ASSET_DIGEST_MISMATCH` and its `expected` and `actual` size and SHA256. Call it
148
- * once per build and reuse the result: its `assets` carry the verified bytes to write and its
149
- * plugin embeds those same bytes.
146
+ * once per build and reuse the result: its plugin integrates the same verified bytes its
147
+ * `assets` carry. Companion delivery names where the entry and each addon land in the output;
148
+ * embedded delivery (`compile`) names no path, because the executable carries the addon.
150
149
  */
150
+ export declare function createNativePackaging(options: NativePackagingEmbeddedOptions): NativePackagingEmbeddedResult;
151
151
  export declare function createNativePackaging(options: NativePackagingOptions): NativePackagingResult;
152
152
  export declare function createNativePackaging(options: NativePackagingOptions<true>): NativePackagingResult<true>;
153
153
  export declare function createNativePackaging(options: NativePackagingOptions<boolean>): NativePackagingResult<boolean>;
154
+ export declare function createNativePackaging(options: NativePackagingOptions<boolean> | NativePackagingEmbeddedOptions): NativePackagingResult<boolean> | NativePackagingEmbeddedResult;
154
155
  export {};
155
156
  //# sourceMappingURL=native-packaging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-packaging.d.ts","sourceRoot":"","sources":["../../src/files/native-packaging.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,QAAA,MAAM,kBAAkB;;;EAA2B,CAAC;AACpD,mGAAmG;AACnG,QAAA,MAAM,cAAc;;EAAqB,CAAC;AAe1C,QAAA,MAAM,mBAAmB;;;;;;;;;;;iBAKvB,CAAC;AACH,QAAA,MAA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qB,CACnC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,8BAA8B,GACxE,qBAAqB,CAAC,OAAO,CAAC,GAAG,6BAA6B,CAAC"}
@@ -1,14 +1,14 @@
1
- // src/internal/darwin-binding.ts
2
- import loadDarwinAddon from "#stitchkit-darwin-native";
3
-
4
1
  // src/internal/darwin-binding-error.ts
2
+ var NATIVE_NOT_PACKAGED = "STITCHKIT_NATIVE_NOT_PACKAGED";
5
3
  var messages = {
6
4
  architecture: "The packaged Darwin backend does not support this architecture",
5
+ packaging: "The Darwin backend is not packaged into this bundle: build it with createNativePackaging from stitchkit/files/packaging",
7
6
  resolve: "The packaged Darwin backend is missing",
8
7
  load: "The packaged Darwin backend could not be loaded",
9
8
  surface: "The packaged Darwin backend has an invalid surface"
10
9
  };
11
10
  var nativeCodes = new Set([
11
+ NATIVE_NOT_PACKAGED,
12
12
  "MODULE_NOT_FOUND",
13
13
  "ERR_MODULE_NOT_FOUND",
14
14
  "ERR_DLOPEN_FAILED",
@@ -28,6 +28,12 @@ function darwinNativeCode(cause) {
28
28
  }
29
29
  return;
30
30
  }
31
+ function darwinLoadStage(cause) {
32
+ const code = darwinNativeCode(cause);
33
+ if (code === NATIVE_NOT_PACKAGED)
34
+ return "packaging";
35
+ return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ENOENT" ? "resolve" : "load";
36
+ }
31
37
 
32
38
  class DarwinBackendError extends Error {
33
39
  stage;
@@ -49,40 +55,4 @@ class DarwinBackendError extends Error {
49
55
  }
50
56
  }
51
57
 
52
- // src/internal/darwin-binding.ts
53
- function hasFunctions(value, names) {
54
- return typeof value === "object" && value !== null && names.every((name) => typeof Reflect.get(value, name) === "function");
55
- }
56
- var darwinBinding;
57
- function loadDarwinBinding() {
58
- if (darwinBinding)
59
- return darwinBinding;
60
- if (process.arch !== "arm64" && process.arch !== "x64") {
61
- throw new DarwinBackendError("architecture");
62
- }
63
- let loaded;
64
- try {
65
- loaded = loadDarwinAddon();
66
- } catch (cause) {
67
- const code = darwinNativeCode(cause);
68
- throw new DarwinBackendError(code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ENOENT" ? "resolve" : "load", cause);
69
- }
70
- const methods = [
71
- "openDirectoryAt",
72
- "openFileAt",
73
- "createFileAt",
74
- "createDirectoryAt",
75
- "statAt",
76
- "listAt",
77
- "renameAt",
78
- "unlinkAt",
79
- "processIdentity"
80
- ];
81
- if (!hasFunctions(loaded, methods)) {
82
- throw new DarwinBackendError("surface");
83
- }
84
- darwinBinding = loaded;
85
- return darwinBinding;
86
- }
87
-
88
- export { loadDarwinBinding };
58
+ export { NATIVE_NOT_PACKAGED, darwinLoadStage, DarwinBackendError };
@@ -0,0 +1,42 @@
1
+ import {
2
+ darwinLoadStage,
3
+ DarwinBackendError
4
+ } from "./index-1h2zv8rx.js";
5
+
6
+ // src/internal/darwin-binding.ts
7
+ import loadDarwinAddon from "#stitchkit-darwin-native";
8
+ function hasFunctions(value, names) {
9
+ return typeof value === "object" && value !== null && names.every((name) => typeof Reflect.get(value, name) === "function");
10
+ }
11
+ var darwinBinding;
12
+ function loadDarwinBinding() {
13
+ if (darwinBinding)
14
+ return darwinBinding;
15
+ if (process.arch !== "arm64" && process.arch !== "x64") {
16
+ throw new DarwinBackendError("architecture");
17
+ }
18
+ let loaded;
19
+ try {
20
+ loaded = loadDarwinAddon();
21
+ } catch (cause) {
22
+ throw new DarwinBackendError(darwinLoadStage(cause), cause);
23
+ }
24
+ const methods = [
25
+ "openDirectoryAt",
26
+ "openFileAt",
27
+ "createFileAt",
28
+ "createDirectoryAt",
29
+ "statAt",
30
+ "listAt",
31
+ "renameAt",
32
+ "unlinkAt",
33
+ "processIdentity"
34
+ ];
35
+ if (!hasFunctions(loaded, methods)) {
36
+ throw new DarwinBackendError("surface");
37
+ }
38
+ darwinBinding = loaded;
39
+ return darwinBinding;
40
+ }
41
+
42
+ export { loadDarwinBinding };
@@ -1,16 +1,16 @@
1
- import {
2
- isRetryableStatus2
3
- } from "./index-j9gxbztg.js";
4
1
  import {
5
2
  rebuildObject,
6
3
  mergeSchemas,
7
4
  assertToolExtensionCompatible,
8
5
  projectToolSurface
9
- } from "./index-r393tnfp.js";
6
+ } from "./index-q6crhe1n.js";
10
7
  import {
11
8
  toolErrorFromResult,
12
9
  executeToolMethod
13
- } from "./index-2k91mewf.js";
10
+ } from "./index-dm2fv45z.js";
11
+ import {
12
+ isRetryableStatus2
13
+ } from "./index-j9gxbztg.js";
14
14
 
15
15
  // src/tools/mount.ts
16
16
  import { z } from "zod";
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  validateDeclaredOutput
3
- } from "./index-rpzewktb.js";
4
- import {
5
- toolResultFromError,
6
- toolErrorFromResult
7
- } from "./index-2k91mewf.js";
3
+ } from "./index-fynr93w4.js";
8
4
  import {
9
5
  coerceJsonArgs2
10
6
  } from "./index-6yxhe58g.js";
@@ -15,11 +11,15 @@ import {
15
11
  objectShapeKeys,
16
12
  assertUniqueToolName,
17
13
  buildToolPresentationSchema
18
- } from "./index-r393tnfp.js";
14
+ } from "./index-q6crhe1n.js";
15
+ import {
16
+ toolResultFromError,
17
+ toolErrorFromResult
18
+ } from "./index-dm2fv45z.js";
19
19
  import {
20
20
  createToolRunner,
21
21
  formatToolError
22
- } from "./index-wbhdzxar.js";
22
+ } from "./index-2s6fpehp.js";
23
23
  import {
24
24
  fetchGuarded,
25
25
  readCapped
@@ -32,7 +32,7 @@ import {
32
32
  } from "./index-eemvahkc.js";
33
33
  import {
34
34
  collectToolSurface
35
- } from "./index-pz3y6b6g.js";
35
+ } from "./index-cx2nh595.js";
36
36
  import {
37
37
  formatZodError2
38
38
  } from "./index-1eeqpadm.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  projectRuntimeTool
3
- } from "./index-r393tnfp.js";
3
+ } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  isRecord
6
6
  } from "./index-9jfdm5tg.js";
@@ -97,10 +97,11 @@ function executableAgentRuntimeTools(tools) {
97
97
  if (typeof tool.handler !== "function") {
98
98
  throw new TypeError(`Runtime tool "${tool.name}" must provide a handler`);
99
99
  }
100
- if (tool.present?.agent !== undefined && typeof tool.present.agent !== "function") {
100
+ const presenter = isRecord(tool.present) ? tool.present.agent : undefined;
101
+ if (presenter !== undefined && typeof presenter !== "function") {
101
102
  throw new TypeError(`Runtime tool "${tool.name}" Agent presenter must be a function`);
102
103
  }
103
- if (tool.present?.agent !== undefined && tool.output === undefined) {
104
+ if (presenter !== undefined && tool.output === undefined) {
104
105
  throw new TypeError(`Runtime tool "${tool.name}" Agent presenter requires an output schema`);
105
106
  }
106
107
  }
@@ -1,16 +1,16 @@
1
1
  import {
2
- AppError2
3
- } from "./index-j9gxbztg.js";
2
+ assertUniqueToolName
3
+ } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  toolErrorFromResult
6
- } from "./index-2k91mewf.js";
7
- import {
8
- assertUniqueToolName
9
- } from "./index-r393tnfp.js";
6
+ } from "./index-dm2fv45z.js";
10
7
  import {
11
8
  collectTools2,
12
9
  createToolRunner
13
- } from "./index-wbhdzxar.js";
10
+ } from "./index-2s6fpehp.js";
11
+ import {
12
+ AppError2
13
+ } from "./index-j9gxbztg.js";
14
14
 
15
15
  // src/tools/invoker.ts
16
16
  function createToolInvoker2(services, config) {
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  writeAllBytes,
17
17
  writeAtomicFileStaged
18
- } from "./index-cazts87s.js";
18
+ } from "./index-07dcf2yn.js";
19
19
  import {
20
20
  AtomicFilePublicationError2
21
21
  } from "./index-b56nnscm.js";
@@ -0,0 +1,26 @@
1
+ // src/internal/until-aborted.ts
2
+ function abortReason(signal) {
3
+ return signal.reason ?? new DOMException("The operation was aborted", "AbortError");
4
+ }
5
+ function untilAborted(pending, signal) {
6
+ return new Promise((resolve, reject) => {
7
+ const abort = () => reject(abortReason(signal));
8
+ if (signal.aborted) {
9
+ pending.catch(() => {
10
+ return;
11
+ });
12
+ abort();
13
+ return;
14
+ }
15
+ signal.addEventListener("abort", abort, { once: true });
16
+ pending.then((value) => {
17
+ signal.removeEventListener("abort", abort);
18
+ resolve(value);
19
+ }, (error) => {
20
+ signal.removeEventListener("abort", abort);
21
+ reject(error);
22
+ });
23
+ });
24
+ }
25
+
26
+ export { abortReason, untilAborted };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadDarwinBinding
3
- } from "./index-v5ee8ath.js";
3
+ } from "./index-2kbysk9s.js";
4
4
  import {
5
5
  isRecord
6
6
  } from "./index-9jfdm5tg.js";
@@ -14,7 +14,6 @@ import { z } from "zod";
14
14
  import { execFile } from "node:child_process";
15
15
  import { readFile } from "node:fs/promises";
16
16
  import { platform } from "node:os";
17
- import { promisify } from "node:util";
18
17
  var detectedIdentity;
19
18
  async function firstReadableLine(paths) {
20
19
  for (const path of paths) {
@@ -26,7 +25,16 @@ async function firstReadableLine(paths) {
26
25
  }
27
26
  return null;
28
27
  }
29
- var run = promisify(execFile);
28
+ function run(file, args, options) {
29
+ return new Promise((resolve, reject) => {
30
+ execFile(file, args, { ...options, encoding: "utf8" }, (error, stdout) => {
31
+ if (error)
32
+ reject(error);
33
+ else
34
+ resolve({ stdout });
35
+ });
36
+ });
37
+ }
30
38
  function parsePlatformUuid(dump) {
31
39
  return /"IOPlatformUUID"\s*=\s*"([^"]+)"/.exec(dump)?.[1] ?? null;
32
40
  }
@@ -34,8 +42,7 @@ async function readDarwinPlatformUuid(command = "ioreg") {
34
42
  try {
35
43
  const { stdout } = await run(command, ["-rd1", "-c", "IOPlatformExpertDevice"], {
36
44
  timeout: 2000,
37
- maxBuffer: 1 << 20,
38
- encoding: "utf8"
45
+ maxBuffer: 1 << 20
39
46
  });
40
47
  return parsePlatformUuid(stdout);
41
48
  } catch {
@@ -67,8 +74,7 @@ async function isZombieProcess(pid, seam = {}) {
67
74
  try {
68
75
  const { stdout } = await run(psCommand, ["-o", "state=", "-p", String(pid)], {
69
76
  timeout: 2000,
70
- maxBuffer: 1 << 16,
71
- encoding: "utf8"
77
+ maxBuffer: 1 << 16
72
78
  });
73
79
  return stdout.trim().startsWith("Z");
74
80
  } catch {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  projectToolSurface
3
- } from "./index-r393tnfp.js";
3
+ } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-wbhdzxar.js";
6
+ } from "./index-2s6fpehp.js";
7
7
  import {
8
8
  runtimeToolMountable
9
- } from "./index-yvfk3y36.js";
9
+ } from "./index-636mggad.js";
10
10
 
11
11
  // src/tools/surface.ts
12
12
  function collectToolSurface({
@@ -1,13 +1,7 @@
1
- import {
2
- AppError2,
3
- STITCH_ERROR_STATUS2,
4
- isRetryableStatus2,
5
- isStitchErrorCode2
6
- } from "./index-j9gxbztg.js";
7
1
  import {
8
2
  normalizeError2,
9
3
  validateDeclaredOutput
10
- } from "./index-rpzewktb.js";
4
+ } from "./index-fynr93w4.js";
11
5
  import {
12
6
  coerceJsonArgs2
13
7
  } from "./index-6yxhe58g.js";
@@ -15,17 +9,23 @@ import {
15
9
  applyToolViewDefaults,
16
10
  projectToolView,
17
11
  objectShapeKeys
18
- } from "./index-r393tnfp.js";
12
+ } from "./index-q6crhe1n.js";
19
13
  import {
20
14
  projectedToolError
21
15
  } from "./index-556g5hsh.js";
22
16
  import {
23
17
  runWithRequestContext2,
24
18
  getRequestContext2
25
- } from "./index-7n68nmc6.js";
19
+ } from "./index-y3nemndz.js";
26
20
  import {
27
21
  formatZodError2
28
22
  } from "./index-1eeqpadm.js";
23
+ import {
24
+ AppError2,
25
+ STITCH_ERROR_STATUS2,
26
+ isRetryableStatus2,
27
+ isStitchErrorCode2
28
+ } from "./index-j9gxbztg.js";
29
29
  import {
30
30
  isUnsafeKey
31
31
  } from "./index-zsarb5xp.js";
@@ -1,13 +1,6 @@
1
- import {
2
- forbidden2,
3
- conflict2
4
- } from "./index-j9gxbztg.js";
5
1
  import {
6
2
  loadDarwinBinding
7
- } from "./index-v5ee8ath.js";
8
- import {
9
- stagingName
10
- } from "./index-j4zh647a.js";
3
+ } from "./index-2kbysk9s.js";
11
4
  import {
12
5
  NativeCommandError2,
13
6
  CommandStopped,
@@ -33,10 +26,17 @@ import {
33
26
  openContainedParentFile,
34
27
  readContainedUtf8Handle,
35
28
  scanContainedFiles
36
- } from "./index-gxm9rc97.js";
29
+ } from "./index-zrtrjkbf.js";
30
+ import {
31
+ stagingName
32
+ } from "./index-j4zh647a.js";
37
33
  import {
38
34
  defineRuntimeTool2
39
- } from "./index-yvfk3y36.js";
35
+ } from "./index-636mggad.js";
36
+ import {
37
+ forbidden2,
38
+ conflict2
39
+ } from "./index-j9gxbztg.js";
40
40
 
41
41
  // src/agent-runtime/coding-tool-contract.ts
42
42
  import { z } from "zod";
@@ -1,22 +1,22 @@
1
- import {
2
- AgentToolError2,
3
- resolveToolDurability
4
- } from "./index-c17xcx4k.js";
5
1
  import {
6
2
  toolResultFromError,
7
3
  toolCauseFromResult,
8
4
  isToolExecutionControlError2
9
- } from "./index-2k91mewf.js";
5
+ } from "./index-dm2fv45z.js";
10
6
  import {
11
7
  createToolRunner,
12
8
  formatToolError
13
- } from "./index-wbhdzxar.js";
9
+ } from "./index-2s6fpehp.js";
10
+ import {
11
+ AgentToolError2,
12
+ resolveToolDurability
13
+ } from "./index-c17xcx4k.js";
14
14
  import {
15
15
  collectToolSurface
16
- } from "./index-pz3y6b6g.js";
16
+ } from "./index-cx2nh595.js";
17
17
  import {
18
18
  agentPresenterOf
19
- } from "./index-yvfk3y36.js";
19
+ } from "./index-636mggad.js";
20
20
  import {
21
21
  isRecord
22
22
  } from "./index-9jfdm5tg.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./index-b0kddvzw.js";
12
12
  import {
13
13
  writeFileAtomicSync2
14
- } from "./index-cazts87s.js";
14
+ } from "./index-07dcf2yn.js";
15
15
  import {
16
16
  assertPositiveSafeInteger
17
17
  } from "./index-0s4xebbg.js";