stitchkit 0.124.0 → 0.124.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +1 -1
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +3 -3
- package/dist/entrypoints/agent-runtime.js +3 -3
- package/dist/entrypoints/application/diagnostic-journal.js +3 -5
- package/dist/entrypoints/application/directory-inbox.js +9 -11
- package/dist/entrypoints/application.js +3 -3
- package/dist/entrypoints/cli/publish.js +6 -6
- package/dist/entrypoints/cli.js +6 -3
- package/dist/entrypoints/files.js +5 -5
- package/dist/entrypoints/index.js +3 -3
- package/dist/entrypoints/server.js +6 -6
- package/dist/entrypoints/telegram.js +2 -2
- package/dist/entrypoints/tools/connections.d.ts +2 -2
- package/dist/entrypoints/tools/connections.d.ts.map +1 -1
- package/dist/entrypoints/tools/connections.js +121 -29
- package/dist/entrypoints/tools/mcp.d.ts +1 -1
- package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
- package/dist/entrypoints/tools/mcp.js +8 -6
- package/dist/entrypoints/tools/toolkit.js +2 -2
- package/dist/entrypoints/tools.js +2 -2
- package/dist/{index-jswst0h3.js → index-03qrr49d.js} +49 -4
- package/dist/{index-8yky60kq.js → index-1szhrfsf.js} +5 -7
- package/dist/{index-mqttte96.js → index-3ymcmpa9.js} +3 -5
- package/dist/{index-v8xm2s9v.js → index-7177dxjn.js} +1 -1
- package/dist/{index-2x2ch0bt.js → index-782qtc24.js} +1 -1
- package/dist/{index-j8rda9n6.js → index-8pwwd6rp.js} +3 -3
- package/dist/{index-m616f0yz.js → index-8x0q6yfb.js} +134 -7
- package/dist/{index-q89kd1xc.js → index-e1x6vze4.js} +1 -1
- package/dist/{index-ezwvsqx9.js → index-fvd6pvw3.js} +1 -1
- package/dist/{index-w0wy05gr.js → index-jkjh7zw4.js} +50 -40
- package/dist/{index-ac6vvm30.js → index-jp2qd9jb.js} +1 -1
- package/dist/index-mm89hd8v.js +39 -0
- package/dist/{index-jc5xgkpk.js → index-qsm899qp.js} +1 -1
- package/dist/index-wqzw3qg9.js +91 -0
- package/dist/{index-364k2zwa.js → index-wt6rw7rf.js} +5 -7
- package/dist/{index-tt3ej8r3.js → index-x0769xt9.js} +217 -24
- package/dist/internal/deadline.d.ts +30 -0
- package/dist/internal/deadline.d.ts.map +1 -1
- package/dist/internal/pinned-http.d.ts +1 -1
- package/dist/internal/pinned-http.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts +8 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/tools/cli/resumable-download.d.ts +18 -0
- package/dist/tools/cli/resumable-download.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts +18 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/connections/catalog-cache.d.ts +9 -0
- package/dist/tools/connections/catalog-cache.d.ts.map +1 -0
- package/dist/tools/connections/errors.d.ts +10 -1
- package/dist/tools/connections/errors.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts +16 -4
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts +10 -2
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools/connections/operation-limits.d.ts +12 -1
- package/dist/tools/connections/operation-limits.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts +2 -2
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +38 -2
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/mcp/catalog-stamp.d.ts +47 -0
- package/dist/tools/mcp/catalog-stamp.d.ts.map +1 -0
- package/dist/tools/mcp/catalog.d.ts +1 -30
- package/dist/tools/mcp/catalog.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +6 -1
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +1 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/llms/cli.2.txt +60 -6
- package/llms/tools-connections.txt +5 -3
- package/llms/tools-mcp.txt +5 -2
- package/llms/tools.txt +10 -3
- package/llms-full.txt +80 -14
- package/llms.txt +4 -4
- package/package.json +1 -1
- package/dist/index-9tqbxv5p.js +0 -44
- package/dist/index-b56nnscm.js +0 -132
package/llms-full.txt
CHANGED
|
@@ -4287,9 +4287,16 @@ same problem and `createMcpHandler` cannot send it: it is stateless by
|
|
|
4287
4287
|
construction, so there is no retained session to push down.
|
|
4288
4288
|
|
|
4289
4289
|
The digest covers each advertised tool's name, description, input schema, output
|
|
4290
|
-
schema and
|
|
4291
|
-
not when a handler does. Raw SDK registrations stay consumer-owned
|
|
4292
|
-
outside it.
|
|
4290
|
+
schema, annotations and MCP Apps `ui` resource, and nothing else — it moves when the
|
|
4291
|
+
contract moves and not when a handler does. Raw SDK registrations stay consumer-owned
|
|
4292
|
+
and are outside it, so a handler with `rawTools` sends no stamp header.
|
|
4293
|
+
|
|
4294
|
+
`createMcpHandler` also sends the stamp of the surface each request was served from as
|
|
4295
|
+
the `stitchkit-catalog` response header (the same `{ digest, tools }` JSON), on the
|
|
4296
|
+
`initialize` answer included — the SDK assembles that result itself and leaves no
|
|
4297
|
+
`_meta` to fill. A client can therefore tell whether its stored catalog is current
|
|
4298
|
+
before it asks for `tools/list`; `defineMcpClientConnection({ catalog })` does exactly
|
|
4299
|
+
that ([CLI → commands discovered from a running server](./cli.md#commands-discovered-from-a-running-server)).
|
|
4293
4300
|
|
|
4294
4301
|
### Saying which tools only read — `readOnlyHint`
|
|
4295
4302
|
|
|
@@ -11379,6 +11386,31 @@ Carry the build stamp inside the binary (`CliBuildStampSchema`,
|
|
|
11379
11386
|
`formatCliBuildStamp`) so the tool can say what it is rather than leaving the
|
|
11380
11387
|
reader to infer it from behaviour.
|
|
11381
11388
|
|
|
11389
|
+
#### A download on a slow link
|
|
11390
|
+
|
|
11391
|
+
A build is tens of megabytes, and on a slow link that is minutes. `applyCliUpdate` bounds
|
|
11392
|
+
the download by silence rather than length: `idleTimeoutMs` (default 30 seconds) ends it
|
|
11393
|
+
when nothing has arrived for that long, and `timeoutMs` (default 30 minutes) bounds the
|
|
11394
|
+
response headers and, separately, the body. A declared `timeoutMs` keeps meaning exactly that,
|
|
11395
|
+
with an idle deadline only when `idleTimeoutMs` is declared too.
|
|
11396
|
+
|
|
11397
|
+
Give it a `partialPath` in your state directory and an interrupted download continues where
|
|
11398
|
+
it stopped:
|
|
11399
|
+
|
|
11400
|
+
```ts
|
|
11401
|
+
await applyCliUpdate({ asset: check.asset, partialPath: join(stateDir, 'update.part') })
|
|
11402
|
+
```
|
|
11403
|
+
|
|
11404
|
+
Every received chunk is appended to that file, and `<partialPath>.json` records the URL, the
|
|
11405
|
+
build's digest and the server's validator (a strong `ETag`, else `Last-Modified`). The next
|
|
11406
|
+
attempt asks for the rest with `Range` and `If-Range`; `206` from the right offset continues
|
|
11407
|
+
the file, `200` (the build changed) replaces it, `416` with the full length means it is
|
|
11408
|
+
already whole. A part is never trusted: the finished transfer is decoded and checked against
|
|
11409
|
+
the manifest like a fresh one, and a continued file that fails — a corrupt part, a build
|
|
11410
|
+
re-published under the same URL — is thrown away and downloaded once more from zero. Both
|
|
11411
|
+
files are removed once the download is decoded, and `<partialPath>.lock` refuses a second
|
|
11412
|
+
update into the same part while one is running. The size ceiling counts the kept part too.
|
|
11413
|
+
|
|
11382
11414
|
#### A manifest inside your own network
|
|
11383
11415
|
|
|
11384
11416
|
The check goes through the same SSRF boundary every outbound fetch does, so a
|
|
@@ -11782,9 +11814,14 @@ const discovered = await mountConnections([
|
|
|
11782
11814
|
token: () => key,
|
|
11783
11815
|
transports: ['CLI'], // the opt-in: this server's tools are commands
|
|
11784
11816
|
limits: {
|
|
11785
|
-
discovery: {
|
|
11817
|
+
discovery: { maxResponseBytes: 4 * 1024 * 1024 }, // 300 s total, 30 s of silence
|
|
11786
11818
|
call: { timeoutMs: 120_000 },
|
|
11787
11819
|
},
|
|
11820
|
+
// Skip tools/list while the stored catalog is the one the server serves.
|
|
11821
|
+
catalog: {
|
|
11822
|
+
load: async () => JSON.parse(await readFile(catalogPath, 'utf8')),
|
|
11823
|
+
store: (entry) => writeFile(catalogPath, JSON.stringify(entry)),
|
|
11824
|
+
},
|
|
11788
11825
|
}),
|
|
11789
11826
|
])
|
|
11790
11827
|
await createCli({ name: 'myapp', version, runtimeTools: discovered, commands: [...] })
|
|
@@ -11826,13 +11863,37 @@ limits. Each logical operation has one deadline, including initial transport
|
|
|
11826
11863
|
negotiation and response-body reading. Legacy endpoint readiness has a discovery
|
|
11827
11864
|
deadline; the lifetime of an established SSE stream does not.
|
|
11828
11865
|
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11866
|
+
Inside that deadline an operation may have an idle one: `idleTimeoutMs` ends it when
|
|
11867
|
+
nothing has arrived for that long — the response headers and every body chunk restart
|
|
11868
|
+
it, so a slow link that keeps delivering a large catalog is never cut off, while a
|
|
11869
|
+
silent one still ends with `ConnectionTimeoutError` whose `deadline` is `'idle'`. On a
|
|
11870
|
+
shared legacy SSE stream any byte is progress for every pending operation.
|
|
11871
|
+
|
|
11872
|
+
Omitted phase fields inherit the connection-level `timeoutMs` and `maxResponseBytes`.
|
|
11873
|
+
With neither set, discovery allows 300 seconds in total and 30 seconds of silence, and
|
|
11874
|
+
a call 30 seconds with no idle deadline — a tool may compute in silence before it
|
|
11875
|
+
answers, so a call's idle deadline is only what you declare. A declared `timeoutMs`
|
|
11876
|
+
keeps meaning exactly that deadline: discovery then has an idle deadline only when you
|
|
11877
|
+
declare one too. The byte default is 1 MiB.
|
|
11878
|
+
Values must be positive safe integers; deadlines must also fit the runtime timer range. The byte ceiling
|
|
11832
11879
|
counts raw UTF-8 body bytes, including SSE framing, regardless of `Content-Length`.
|
|
11833
11880
|
Pending legacy calls also count comments and wrong-id frames. `budget.maxTools`
|
|
11834
11881
|
and `budget.maxSchemaBytes` remain separate mount limits.
|
|
11835
11882
|
|
|
11883
|
+
**A stored catalog is mounted while it is current.** A Stitchkit server sends its
|
|
11884
|
+
[catalog stamp](./mcp-and-agents.md#knowing-your-catalog-is-stale--the-catalog-stamp) with
|
|
11885
|
+
the `initialize` answer, as the `stitchkit-catalog` response header. Given a `catalog:
|
|
11886
|
+
{ load, store }`, the connection compares it with the stamp of the stored `tools/list`
|
|
11887
|
+
result and mounts the stored one when they match — every stored tool must carry the same
|
|
11888
|
+
stamp, and there must be as many — so a start costs no catalog transfer. A different
|
|
11889
|
+
stamp (the server's contract moved, or the credential sees another surface) lists and
|
|
11890
|
+
stores again. A listing is stored only when every tool in it carries the stamp the
|
|
11891
|
+
`initialize` answer announced, so a rolling deploy answering the two requests from
|
|
11892
|
+
different builds stores nothing. A server without a stamp, a surface with raw SDK tools
|
|
11893
|
+
and a failing `load` or `store` all cost one `tools/list`, never the mount. The stamp
|
|
11894
|
+
covers what `tools/list` publishes as Stitchkit builds it; the JSON Schema text the
|
|
11895
|
+
server's MCP SDK renders from the same schema is not hashed separately.
|
|
11896
|
+
|
|
11836
11897
|
Only the initial `initialize` can negotiate HTTP-to-legacy fallback on 400, 404
|
|
11837
11898
|
or 405. A failed `tools/call` is not replayed. Caller cancellation preserves its
|
|
11838
11899
|
original reason for in-process observers.
|
|
@@ -25183,7 +25244,7 @@ payload. See [MCP guide](../guide/mcp-and-agents.md#mcp--createmcphandler).
|
|
|
25183
25244
|
|
|
25184
25245
|
| Export | Kind | Purpose |
|
|
25185
25246
|
|--------|------|---------|
|
|
25186
|
-
| `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
|
|
25247
|
+
| `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler; each response carries the served surface's catalog stamp as the `stitchkit-catalog` header (none with `rawTools`) — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
|
|
25187
25248
|
| `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
|
|
25188
25249
|
| `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
|
|
25189
25250
|
| `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
|
|
@@ -25227,7 +25288,10 @@ retained session to push `notifications/tools/list_changed` down; the stamp need
|
|
|
25227
25288
|
Store the stamp beside the tools when you list them, compare it against the one on every
|
|
25228
25289
|
result, and re-list when they differ — including on a refusal, which is exactly when a
|
|
25229
25290
|
stale catalog is the likeliest explanation and the least visible one. The server side
|
|
25230
|
-
needs no wiring: every mount stamps what it advertises
|
|
25291
|
+
needs no wiring: every mount stamps what it advertises — each tool's name, description,
|
|
25292
|
+
schemas, annotations and `ui` resource — and `createMcpHandler` sends the same stamp as the
|
|
25293
|
+
`stitchkit-catalog` response header, `initialize` included, which is what a connection's
|
|
25294
|
+
`catalog` store is checked against before `tools/list`.
|
|
25231
25295
|
|
|
25232
25296
|
| Export | Kind | Summary |
|
|
25233
25297
|
|--------|------|---------|
|
|
@@ -25282,9 +25346,11 @@ and approval path.
|
|
|
25282
25346
|
| Export | Kind | Summary |
|
|
25283
25347
|
|--------|------|---------|
|
|
25284
25348
|
| `defineMcpClientConnection` | function | declare one external MCP server connection over Streamable HTTP with an optional SSE fallback |
|
|
25285
|
-
| `ConnectionOperationLimits` / `McpConnectionLimits` | _type_ | positive finite deadline
|
|
25349
|
+
| `ConnectionOperationLimits` / `McpConnectionLimits` | _type_ | positive finite deadline, idle deadline (`idleTimeoutMs`: nothing arrived for that long — headers and every chunk restart it) and raw byte ceilings with independent discovery/call overrides; omitted fields inherit the shared bounds, and discovery with no declared `timeoutMs` allows 300 s in total and 30 s of silence while a call keeps 30 s and no idle deadline; a declared `timeoutMs` has an idle deadline only when one is declared too |
|
|
25286
25350
|
| `ConnectionPhase` / `ConnectionOperation` / `ConnectionFailureContext` | _type_ | closed operation/phase vocabulary and measured read context for existing typed connection errors |
|
|
25287
|
-
| `ConnectionTimeoutError` / `ConnectionResponseTooLargeError` | class | bounded operation refusal, with phase, operation and finite observed bytes; safe tool projection retains the raw cause locally |
|
|
25351
|
+
| `ConnectionTimeoutError` / `ConnectionResponseTooLargeError` | class | bounded operation refusal, with phase, operation and finite observed bytes — a timeout also says which `deadline` fired (`'total'` or `'idle'`, with `timeoutMs` the limit that fired); safe tool projection retains the raw cause locally |
|
|
25352
|
+
| `ConnectionDeadline` / `ConnectionTimeoutContext` | _type_ | `'total' \| 'idle'`, and a timeout's diagnostics with the deadline that fired (default `'total'`) |
|
|
25353
|
+
| `McpConnectionCatalogStore` / `McpConnectionCatalogEntry` | _type_ | `{ load, store }` the application gives a connection's `catalog`, and the `{ stamp, result }` it keeps: when the server's `initialize` answer carries a catalog stamp (a Stitchkit server's does), a stored `tools/list` result whose stamp — and every tool's — matches is mounted without listing; anything else lists and stores again, and a failing store is a miss |
|
|
25288
25354
|
| `defineOpenApiConnection` | function | declare one OpenAPI document (object, JSON text or JSON URL) as a tool surface |
|
|
25289
25355
|
| `mountConnections` | function | discover every connection and return readonly `RuntimeToolDefinition`s for `mountAgent`; reported structural failures and bounds stay local, while unions and string-format/pattern refusals (including inside record keys) are judged by the server that owns the original schema (ADR 0266, ADR 0272) |
|
|
25290
25356
|
| `ConnectionAuthorizationRequiredError` | class | typed reauthorization signal raised on `401` with credentials resolved again on the next call |
|
|
@@ -25298,7 +25364,7 @@ and approval path.
|
|
|
25298
25364
|
| `ConnectionToolSkipReporter` | _type_ | `(skipped) => void` — called per discovered tool the mount could not build; defaults to a stderr line, and the rest of the surface still mounts |
|
|
25299
25365
|
| `SkippedConnectionTool` | _type_ | `{ connection, tool, reason }` — which tool was not mounted, and why |
|
|
25300
25366
|
| `McpClientConnection` | _type_ | a defined MCP client connection |
|
|
25301
|
-
| `McpClientConnectionConfig` | _type_ | name, transport, tool filter, token provider, instance key, allowed hosts and `transports` — naming `['CLI']` makes the whole server's discovered tools commands, with no per-definition rewriting |
|
|
25367
|
+
| `McpClientConnectionConfig` | _type_ | name, transport, tool filter, token provider, instance key, allowed hosts, bounds, `catalog` store and `transports` — naming `['CLI']` makes the whole server's discovered tools commands, with no per-definition rewriting |
|
|
25302
25368
|
| `McpConnectionTransport` | _type_ | `{ url, headers? }` for one MCP endpoint |
|
|
25303
25369
|
| `McpToolFilter` | _type_ | `{ allow?, block? }` discovered-tool filter |
|
|
25304
25370
|
| `OpenApiConnection` | _type_ | a defined OpenAPI connection |
|
|
@@ -25856,7 +25922,7 @@ SDK nor the `ai` peer.
|
|
|
25856
25922
|
| `CliProfileError` | class | an `AppError` refusing a named profile that is missing, unreadable or shared between users |
|
|
25857
25923
|
| `renderCliInstaller` | function | generate the one-line installer from a build manifest, with the URL and digest substituted — [guide](../guide/cli.md#distribution-and-self-update) |
|
|
25858
25924
|
| `checkCliUpdate` | function | bounded, interval-limited, never-throwing check for a newer published build |
|
|
25859
|
-
| `applyCliUpdate` | function | download, verify the decompressed digest and replace the binary by rename |
|
|
25925
|
+
| `applyCliUpdate` | function | download, verify the decompressed digest and replace the binary by rename; with `partialPath` an interrupted download continues with `Range`/`If-Range`, and a continued file that fails its checks is downloaded once more from zero |
|
|
25860
25926
|
| `assertCliPublishable` | function | refuse republishing one version from a different commit — takes one manifest or every manifest already published, because the promise a version makes does not stop at a channel boundary |
|
|
25861
25927
|
| `rollbackCliUpdate` / `CliRollbackConfig` / `RolledBackCliUpdate` | function / _types_ | put the kept previous build back, digest-checked first and written by the same atomic rename the update uses |
|
|
25862
25928
|
| `signCliManifest` / `verifyCliManifest` / `cliManifestSigningPayload` | function | Ed25519 over `{name, version, commit, builtAt, assets[]}` — every asset's digest included, so the chain closes on the file that executes |
|
|
@@ -25872,7 +25938,7 @@ SDK nor the `ai` peer.
|
|
|
25872
25938
|
| `CliBuildStampSchema` / `CliBuildStamp` | schema / _type_ | the version/commit/build time carried inside a binary |
|
|
25873
25939
|
| `CliInstallerConfig` | _type_ | manifest, binary name, default install directory, and an optional `asset` — omit it for one script that selects the target by `uname` |
|
|
25874
25940
|
| `CliUpdateCheckConfig` / `CliUpdateCheck` | _type_ | check inputs, and its four answers — `skipped`, `current`, `outdated`, `unknown` |
|
|
25875
|
-
| `CliUpdateApplyConfig` / `AppliedCliUpdate` | _type_ | apply inputs — including `verify`, run on an executable candidate beside the target before the backup and the replacement, within `verifyTimeoutMs` — and the replaced path, byte count and digest |
|
|
25941
|
+
| `CliUpdateApplyConfig` / `AppliedCliUpdate` | _type_ | apply inputs — including `verify`, run on an executable candidate beside the target before the backup and the replacement, within `verifyTimeoutMs`; `timeoutMs` (default 30 minutes) and `idleTimeoutMs` (default 30 s of silence when `timeoutMs` is not declared); `partialPath` for a resumable download — and the replaced path, byte count and digest |
|
|
25876
25942
|
| `CliProfileStore` / `CliProfileStoreConfig` / `ResolvedCliProfile` | _type_ | the profile store, its directory/schema/hint config, and one resolution |
|
|
25877
25943
|
| `CliResultView` | _type_ | the requested view — `count`, `sum`, or `records` (ordered and/or table-rendered) |
|
|
25878
25944
|
| `CliViewOutput` | _type_ | a JSON value, or the one human-facing text shape |
|
package/llms.txt
CHANGED
|
@@ -14,14 +14,14 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
14
14
|
- **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
|
|
15
15
|
- **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
|
|
16
16
|
- **stitchkit/react/keyboard/testing**: [llms/react-keyboard-testing.txt](llms/react-keyboard-testing.txt) 1.9 KB
|
|
17
|
-
- **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 43.
|
|
18
|
-
- **stitchkit/tools/mcp**: [llms/tools-mcp.txt](llms/tools-mcp.txt)
|
|
17
|
+
- **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 43.8 KB → [llms/tools.2.txt](llms/tools.2.txt) 36.5 KB → [llms/tools.3.txt](llms/tools.3.txt) 21.2 KB
|
|
18
|
+
- **stitchkit/tools/mcp**: [llms/tools-mcp.txt](llms/tools-mcp.txt) 7.0 KB
|
|
19
19
|
- **stitchkit/tools/agent**: [llms/tools-agent.txt](llms/tools-agent.txt) 1.1 KB
|
|
20
20
|
- **stitchkit/tools/toolkit**: [llms/tools-toolkit.txt](llms/tools-toolkit.txt) 0.9 KB
|
|
21
21
|
- **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
|
|
22
22
|
- **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
|
|
23
|
-
- **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt)
|
|
24
|
-
- **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.1 KB → [llms/cli.2.txt](llms/cli.2.txt)
|
|
23
|
+
- **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 4.9 KB
|
|
24
|
+
- **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.1 KB → [llms/cli.2.txt](llms/cli.2.txt) 42.9 KB
|
|
25
25
|
- **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 1.5 KB
|
|
26
26
|
- **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
|
|
27
27
|
- **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 34.1 KB
|
package/package.json
CHANGED
package/dist/index-9tqbxv5p.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MAX_TIMER_MS
|
|
3
|
-
} from "./index-eemvahkc.js";
|
|
4
|
-
import {
|
|
5
|
-
assertPositiveSafeInteger
|
|
6
|
-
} from "./index-0s4xebbg.js";
|
|
7
|
-
|
|
8
|
-
// src/internal/deadline.ts
|
|
9
|
-
async function withDeadline(value, timeoutMs) {
|
|
10
|
-
if (!(value instanceof Promise))
|
|
11
|
-
return { settled: true, value };
|
|
12
|
-
let timer;
|
|
13
|
-
const expiry = new Promise((resolve) => {
|
|
14
|
-
timer = setTimeout(() => resolve({ settled: false }), timeoutMs);
|
|
15
|
-
});
|
|
16
|
-
try {
|
|
17
|
-
return await Promise.race([
|
|
18
|
-
value.then((settledValue) => ({
|
|
19
|
-
settled: true,
|
|
20
|
-
value: settledValue
|
|
21
|
-
})),
|
|
22
|
-
expiry
|
|
23
|
-
]);
|
|
24
|
-
} finally {
|
|
25
|
-
if (timer !== undefined)
|
|
26
|
-
clearTimeout(timer);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async function withSignalDeadline(timeoutMs, caller, makeReason, body) {
|
|
30
|
-
assertPositiveSafeInteger("Deadline timeoutMs", timeoutMs, RangeError);
|
|
31
|
-
if (timeoutMs > MAX_TIMER_MS)
|
|
32
|
-
throw new RangeError("Deadline timeoutMs exceeds the timer range");
|
|
33
|
-
caller?.throwIfAborted();
|
|
34
|
-
const deadline = new AbortController;
|
|
35
|
-
const timer = setTimeout(() => deadline.abort(makeReason()), timeoutMs);
|
|
36
|
-
const signal = caller ? AbortSignal.any([caller, deadline.signal]) : deadline.signal;
|
|
37
|
-
try {
|
|
38
|
-
return await body(signal);
|
|
39
|
-
} finally {
|
|
40
|
-
clearTimeout(timer);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { withDeadline, withSignalDeadline };
|
package/dist/index-b56nnscm.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// src/internal/atomic-publication.ts
|
|
2
|
-
import { closeSync, fsyncSync, linkSync, openSync, renameSync, unlinkSync } from "node:fs";
|
|
3
|
-
import { link, open, rename, unlink } from "node:fs/promises";
|
|
4
|
-
import { dirname } from "node:path";
|
|
5
|
-
|
|
6
|
-
// src/internal/close-after.ts
|
|
7
|
-
async function closeAfter(handle, run) {
|
|
8
|
-
let result;
|
|
9
|
-
try {
|
|
10
|
-
result = await run();
|
|
11
|
-
} catch (error) {
|
|
12
|
-
await handle.close().catch(() => {
|
|
13
|
-
return;
|
|
14
|
-
});
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
await handle.close();
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
function closeAfterSync(close, run) {
|
|
21
|
-
let result;
|
|
22
|
-
try {
|
|
23
|
-
result = run();
|
|
24
|
-
} catch (error) {
|
|
25
|
-
try {
|
|
26
|
-
close();
|
|
27
|
-
} catch {}
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
close();
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/internal/atomic-publication.ts
|
|
35
|
-
class AtomicFilePublicationError2 extends Error {
|
|
36
|
-
phase;
|
|
37
|
-
published = true;
|
|
38
|
-
constructor(phase, cause) {
|
|
39
|
-
super(`File published but ${phase} failed`, { cause });
|
|
40
|
-
this.phase = phase;
|
|
41
|
-
this.name = "AtomicFilePublicationError";
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
var native = { rename, link, unlink, open };
|
|
45
|
-
var nativeSync = {
|
|
46
|
-
rename: renameSync,
|
|
47
|
-
link: linkSync,
|
|
48
|
-
unlink: unlinkSync,
|
|
49
|
-
open(path, flags) {
|
|
50
|
-
const descriptor = openSync(path, flags);
|
|
51
|
-
return { sync: () => fsyncSync(descriptor), close: () => closeSync(descriptor) };
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
function assertDirectoryDurability() {
|
|
55
|
-
if (process.platform === "win32")
|
|
56
|
-
throw new Error("Directory durability is unsupported on Windows");
|
|
57
|
-
}
|
|
58
|
-
async function syncDirectory(path, io = native) {
|
|
59
|
-
assertDirectoryDurability();
|
|
60
|
-
const directory = await io.open(path, "r");
|
|
61
|
-
await closeAfter(directory, () => directory.sync());
|
|
62
|
-
}
|
|
63
|
-
async function publishAtomicFile(staged, target, { replace, durability }, io = native) {
|
|
64
|
-
const directorySync = durability === "directory";
|
|
65
|
-
if (directorySync)
|
|
66
|
-
assertDirectoryDurability();
|
|
67
|
-
const directory = directorySync ? await io.open(dirname(target), "r") : undefined;
|
|
68
|
-
const publish = async () => {
|
|
69
|
-
if (replace)
|
|
70
|
-
await io.rename(staged, target);
|
|
71
|
-
else {
|
|
72
|
-
await io.link(staged, target);
|
|
73
|
-
try {
|
|
74
|
-
await io.unlink(staged);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
throw new AtomicFilePublicationError2("cleanup", error);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
await directory?.sync();
|
|
81
|
-
} catch (error) {
|
|
82
|
-
throw new AtomicFilePublicationError2("directory-sync", error);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
if (directory === undefined)
|
|
86
|
-
return publish();
|
|
87
|
-
await closeAfter({
|
|
88
|
-
close: async () => {
|
|
89
|
-
try {
|
|
90
|
-
await directory.close();
|
|
91
|
-
} catch (error) {
|
|
92
|
-
throw new AtomicFilePublicationError2("directory-close", error);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, publish);
|
|
96
|
-
}
|
|
97
|
-
function publishAtomicFileSync(staged, target, { replace, durability }, io = nativeSync) {
|
|
98
|
-
const directorySync = durability === "directory";
|
|
99
|
-
if (directorySync)
|
|
100
|
-
assertDirectoryDurability();
|
|
101
|
-
const directory = directorySync ? io.open(dirname(target), "r") : undefined;
|
|
102
|
-
const publish = () => {
|
|
103
|
-
if (replace)
|
|
104
|
-
io.rename(staged, target);
|
|
105
|
-
else {
|
|
106
|
-
io.link(staged, target);
|
|
107
|
-
try {
|
|
108
|
-
io.unlink(staged);
|
|
109
|
-
} catch (error) {
|
|
110
|
-
throw new AtomicFilePublicationError2("cleanup", error);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
directory?.sync();
|
|
115
|
-
} catch (error) {
|
|
116
|
-
throw new AtomicFilePublicationError2("directory-sync", error);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
if (directory === undefined) {
|
|
120
|
-
publish();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
closeAfterSync(() => {
|
|
124
|
-
try {
|
|
125
|
-
directory.close();
|
|
126
|
-
} catch (error) {
|
|
127
|
-
throw new AtomicFilePublicationError2("directory-close", error);
|
|
128
|
-
}
|
|
129
|
-
}, publish);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { closeAfter, closeAfterSync, AtomicFilePublicationError2, assertDirectoryDurability, syncDirectory, publishAtomicFile, publishAtomicFileSync };
|