stitchkit 0.59.2 → 0.59.4
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/README.md +7 -1
- package/dist/agent-runtime-openrouter.js +0 -1
- package/dist/agent-runtime.js +0 -1
- package/dist/application/health.d.ts +12 -0
- package/dist/application/health.d.ts.map +1 -1
- package/dist/application/opentelemetry.d.ts +25 -0
- package/dist/application/opentelemetry.d.ts.map +1 -0
- package/dist/application-grammy.js +0 -1
- package/dist/application-opentelemetry.d.ts +2 -0
- package/dist/application-opentelemetry.d.ts.map +1 -0
- package/dist/application-opentelemetry.js +248 -0
- package/dist/application.d.ts +1 -1
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +58 -1241
- package/dist/cli.js +0 -1
- package/dist/files.js +0 -1
- package/dist/index-2nzpcfbp.js +560 -0
- package/dist/index-5c8n2123.js +617 -0
- package/dist/index-mgf6cdkm.js +66 -0
- package/dist/{index-he4psyve.js → index-s8w2y7kr.js} +7 -8
- package/dist/node.js +8 -9
- package/dist/observability/index.js +0 -1
- package/dist/remote.js +0 -1
- package/dist/server/index.js +8 -9
- package/dist/server/socket-io.d.ts.map +1 -1
- package/dist/testing/managed-resource-conformance-contract.d.ts +114 -0
- package/dist/testing/managed-resource-conformance-contract.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance-driver.d.ts +20 -0
- package/dist/testing/managed-resource-conformance-driver.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance-scenarios.d.ts +33 -0
- package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance.d.ts +5 -0
- package/dist/testing/managed-resource-conformance.d.ts.map +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +658 -71
- package/dist/tools.js +0 -1
- package/llms-full.txt +290 -1
- package/llms.txt +1 -0
- package/package.json +11 -2
- package/dist/index-1bx83sw4.js +0 -4
package/dist/tools.js
CHANGED
package/llms-full.txt
CHANGED
|
@@ -3766,6 +3766,10 @@ signal APIs when one managed server is already the complete lifecycle boundary.
|
|
|
3766
3766
|
The neutral entrypoint is server-only and works on Bun and Node ≥ 22. It does
|
|
3767
3767
|
not import provider SDKs.
|
|
3768
3768
|
|
|
3769
|
+
For complete database, poller, queue-consumer and operational-publisher
|
|
3770
|
+
cutovers, continue with the executable
|
|
3771
|
+
[application migration recipes](./application-migration-recipes.md).
|
|
3772
|
+
|
|
3769
3773
|
## Minimal composition
|
|
3770
3774
|
|
|
3771
3775
|
```ts
|
|
@@ -3878,6 +3882,58 @@ through a Fetch-compatible handler, suitable for a raw route on Bun or Node.
|
|
|
3878
3882
|
Product-specific probes may be composed beside it; do not put secrets or raw
|
|
3879
3883
|
provider failures in the response.
|
|
3880
3884
|
|
|
3885
|
+
For the conventional three-route surface, reuse the same semantics instead of
|
|
3886
|
+
copying them into the application:
|
|
3887
|
+
|
|
3888
|
+
```ts
|
|
3889
|
+
const operational = createApplicationOperationalHandlers(app)
|
|
3890
|
+
|
|
3891
|
+
const rawRoutes = [
|
|
3892
|
+
{ method: 'GET', path: '/status', handler: operational.status },
|
|
3893
|
+
{ method: 'GET', path: '/ready', handler: operational.readiness },
|
|
3894
|
+
{ method: 'GET', path: '/live', handler: operational.liveness },
|
|
3895
|
+
]
|
|
3896
|
+
```
|
|
3897
|
+
|
|
3898
|
+
`status` always returns the current sanitized snapshot with HTTP 200, including
|
|
3899
|
+
while starting, draining or stopped. The two probes retain the existing
|
|
3900
|
+
readiness/liveness status and `Retry-After` policy.
|
|
3901
|
+
|
|
3902
|
+
Applications that already own an OpenTelemetry SDK may inject its `Meter` into
|
|
3903
|
+
the isolated adapter:
|
|
3904
|
+
|
|
3905
|
+
```ts
|
|
3906
|
+
import { createApplicationOpenTelemetry } from 'stitchkit/application/opentelemetry'
|
|
3907
|
+
|
|
3908
|
+
const telemetry = createApplicationOpenTelemetry({
|
|
3909
|
+
meter,
|
|
3910
|
+
application: app,
|
|
3911
|
+
activities: [activity],
|
|
3912
|
+
schedules: [schedule],
|
|
3913
|
+
})
|
|
3914
|
+
|
|
3915
|
+
// During application cleanup:
|
|
3916
|
+
telemetry.close()
|
|
3917
|
+
```
|
|
3918
|
+
|
|
3919
|
+
The adapter registers fixed observable gauges and pulls the latest canonical
|
|
3920
|
+
snapshots on every collection. It owns no exporter, SDK lifecycle, cache,
|
|
3921
|
+
subscription or polling loop. Attributes are limited to declared application,
|
|
3922
|
+
resource, activity, stage and schedule IDs plus bounded framework states;
|
|
3923
|
+
epoch, revision, timestamps, failures and product/provider identities are never
|
|
3924
|
+
metric attributes. Install `@opentelemetry/api` only when this entrypoint is
|
|
3925
|
+
used; the neutral `stitchkit/application` graph remains peer-free.
|
|
3926
|
+
|
|
3927
|
+
Every instrument uses unit `1` and reports an absolute current/lifetime value:
|
|
3928
|
+
|
|
3929
|
+
| Instruments | Meaning |
|
|
3930
|
+
|---|---|
|
|
3931
|
+
| `stitchkit.application.lifecycle`, `.ready` | current lifecycle/health fact and readiness |
|
|
3932
|
+
| `stitchkit.application.admission.accepting`, `.accepted`, `.completed`, `.pending` | current gate and absolute lifetime admission counts |
|
|
3933
|
+
| `stitchkit.application.resource.ready` | readiness for each declared resource with required/state/health attributes |
|
|
3934
|
+
| `stitchkit.application.schedule.accepting`, `.active`, `.queued`, `.runs_started`, `.runs_completed`, `.runs_failed`, `.ticks_skipped` | current schedule state and absolute run/tick counts |
|
|
3935
|
+
| `stitchkit.application.activity.active`, `.queued`, `.completed`, `.failed` | absolute stage projections for declared activity sources |
|
|
3936
|
+
|
|
3881
3937
|
## Admission and graceful shutdown
|
|
3882
3938
|
|
|
3883
3939
|
Use the application operation lease for work that is not already counted by a
|
|
@@ -4037,6 +4093,154 @@ retry rules do **not** disappear. They were never process-local glue and remain
|
|
|
4037
4093
|
application-owned.
|
|
4038
4094
|
|
|
4039
4095
|
|
|
4096
|
+
==============================================================================
|
|
4097
|
+
# Guide: Application migration recipes (docs/guide/application-migration-recipes.md)
|
|
4098
|
+
==============================================================================
|
|
4099
|
+
|
|
4100
|
+
---
|
|
4101
|
+
title: Application migration recipes
|
|
4102
|
+
description: Executable patterns for moving database, poller, queue and operational publishing lifecycle into the managed application kernel.
|
|
4103
|
+
type: architecture
|
|
4104
|
+
status: active
|
|
4105
|
+
created: 2026-08-24
|
|
4106
|
+
updated: 2026-08-24
|
|
4107
|
+
---
|
|
4108
|
+
|
|
4109
|
+
# Application migration recipes
|
|
4110
|
+
|
|
4111
|
+
These recipes are the migration companion to the
|
|
4112
|
+
[managed application kernel](./application-kernel.md). Their canonical source is
|
|
4113
|
+
the packed-consumer fixture
|
|
4114
|
+
[`application-migration-recipes.ts`](../../packages/core/scripts/consumer-lane/fixtures/minimal/src/application-migration-recipes.ts):
|
|
4115
|
+
the consumer lane installs the package tarball, typechecks that file and runs it
|
|
4116
|
+
only through `stitchkit/application` exports.
|
|
4117
|
+
|
|
4118
|
+
## Database connection
|
|
4119
|
+
|
|
4120
|
+
Wrap connection allocation and readiness in `start`, and make `close` safe after
|
|
4121
|
+
partial setup. Stitchkit invokes cleanup for every attempted start, including a
|
|
4122
|
+
start that allocates a client and then rejects.
|
|
4123
|
+
|
|
4124
|
+
```ts
|
|
4125
|
+
const database = defineManagedResource({
|
|
4126
|
+
id: 'database',
|
|
4127
|
+
async start({ signal, reportHealth }) {
|
|
4128
|
+
await databaseClient.connect(signal)
|
|
4129
|
+
await databaseClient.assertReady()
|
|
4130
|
+
reportHealth('healthy')
|
|
4131
|
+
},
|
|
4132
|
+
close: () => databaseClient.close(),
|
|
4133
|
+
})
|
|
4134
|
+
```
|
|
4135
|
+
|
|
4136
|
+
The application still owns the client, ORM configuration, transactions,
|
|
4137
|
+
migrations and reconnect policy. The executable recipe deliberately fails after
|
|
4138
|
+
allocation and proves one rollback close.
|
|
4139
|
+
|
|
4140
|
+
## Long-running poller
|
|
4141
|
+
|
|
4142
|
+
Return separate readiness and completion promises. Readiness says dependants may
|
|
4143
|
+
start; completion represents the whole background lifetime.
|
|
4144
|
+
|
|
4145
|
+
```ts
|
|
4146
|
+
const poller = defineManagedResource({
|
|
4147
|
+
id: 'poller',
|
|
4148
|
+
start: ({ signal }) => ({
|
|
4149
|
+
ready: providerPoller.ready,
|
|
4150
|
+
completion: providerPoller.run(signal),
|
|
4151
|
+
}),
|
|
4152
|
+
stopAdmission: () => providerPoller.stop(),
|
|
4153
|
+
drain: () => providerPoller.completion,
|
|
4154
|
+
close: () => providerPoller.close(),
|
|
4155
|
+
})
|
|
4156
|
+
```
|
|
4157
|
+
|
|
4158
|
+
Completion before readiness fails startup and rolls back. Completion after
|
|
4159
|
+
readiness removes application readiness. Provider cursor persistence, retry,
|
|
4160
|
+
backoff and restart policy remain application/provider concerns.
|
|
4161
|
+
|
|
4162
|
+
## Queue consumer
|
|
4163
|
+
|
|
4164
|
+
Acquire the application lease only after provider delivery/claim. If admission
|
|
4165
|
+
is already closed, reject the delivery through the provider's own nack/requeue
|
|
4166
|
+
primitive. Work admitted before shutdown releases its lease after ack/nack and
|
|
4167
|
+
therefore participates in application drain.
|
|
4168
|
+
|
|
4169
|
+
```ts
|
|
4170
|
+
async function handleDelivery(delivery: Delivery) {
|
|
4171
|
+
const lease = app.admission.acquire()
|
|
4172
|
+
if (!lease) return delivery.nack({ requeue: true })
|
|
4173
|
+
try {
|
|
4174
|
+
await processClaim(delivery.claim)
|
|
4175
|
+
await delivery.ack()
|
|
4176
|
+
} catch (error) {
|
|
4177
|
+
await delivery.nack({ requeue: shouldRetry(error) })
|
|
4178
|
+
throw error
|
|
4179
|
+
} finally {
|
|
4180
|
+
lease.release()
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
```
|
|
4184
|
+
|
|
4185
|
+
Stitchkit owns only process-local admission accounting and drain. Durable claims,
|
|
4186
|
+
visibility timeouts, deduplication, idempotency and retry classification remain
|
|
4187
|
+
in the queue/product layer.
|
|
4188
|
+
|
|
4189
|
+
## Operational publisher
|
|
4190
|
+
|
|
4191
|
+
Project anonymous aggregate activity, then feed absolute snapshots into the
|
|
4192
|
+
latest-value sink. A slow transport holds one write plus one replaceable latest
|
|
4193
|
+
revision rather than an unbounded event queue.
|
|
4194
|
+
|
|
4195
|
+
```ts
|
|
4196
|
+
const publisher = createApplicationSnapshotSink({
|
|
4197
|
+
write: (snapshot) => monitoring.publish(snapshot),
|
|
4198
|
+
})
|
|
4199
|
+
const activity = createActivityProjection({
|
|
4200
|
+
id: 'generation',
|
|
4201
|
+
stages: ['queued', 'running'],
|
|
4202
|
+
})
|
|
4203
|
+
const unsubscribe = activity.subscribe((snapshot) => {
|
|
4204
|
+
publisher.publish(snapshot)
|
|
4205
|
+
})
|
|
4206
|
+
|
|
4207
|
+
// cleanup boundary
|
|
4208
|
+
unsubscribe()
|
|
4209
|
+
publisher.publish(activity.getSnapshot())
|
|
4210
|
+
await publisher.close()
|
|
4211
|
+
```
|
|
4212
|
+
|
|
4213
|
+
The monitoring backend, transport retry and cross-process aggregation remain
|
|
4214
|
+
outside Stitchkit. The executable recipe blocks revision 0, coalesces
|
|
4215
|
+
intermediate revisions, explicitly admits the final absolute snapshot after
|
|
4216
|
+
unsubscribe and proves that `close()` flushes revision 3. Do not rely on an
|
|
4217
|
+
asynchronous subscriber callback racing cleanup: publish `getSnapshot()` before
|
|
4218
|
+
closing the outer sink, so any older or duplicate late delivery is rejected as
|
|
4219
|
+
stale instead of dropping the final state.
|
|
4220
|
+
|
|
4221
|
+
## Deletion checklist
|
|
4222
|
+
|
|
4223
|
+
After the cutover, remove the old generic lifecycle path completely:
|
|
4224
|
+
|
|
4225
|
+
- duplicate `process.on(...)` handlers and shutdown promise caches;
|
|
4226
|
+
- manual readiness waiters and resource close fan-out;
|
|
4227
|
+
- raw interval handles, overlap flags and timer drain code;
|
|
4228
|
+
- global in-flight counters and waiter sets replaced by application leases;
|
|
4229
|
+
- progress delta queues replaced by absolute snapshot publishing.
|
|
4230
|
+
|
|
4231
|
+
Keep the product code that still owns durable state and policy:
|
|
4232
|
+
|
|
4233
|
+
- database schema, transactions and migrations;
|
|
4234
|
+
- queue claims, ack/nack, deduplication and external-effect idempotency;
|
|
4235
|
+
- provider cursor, retry/backoff and credentials;
|
|
4236
|
+
- monitoring transport configuration and durable retention;
|
|
4237
|
+
- process exit code, hard-exit and deployment/supervisor policy.
|
|
4238
|
+
|
|
4239
|
+
Run the old and new lifecycle paths separately during development if needed,
|
|
4240
|
+
but do not ship both. Before cutover, verify there is exactly one signal binding,
|
|
4241
|
+
one timer owner, one admission gate and one resource cleanup chain.
|
|
4242
|
+
|
|
4243
|
+
|
|
4040
4244
|
==============================================================================
|
|
4041
4245
|
# Guide: CLI (docs/guide/cli.md)
|
|
4042
4246
|
==============================================================================
|
|
@@ -6451,6 +6655,63 @@ The suite in `packages/core/tests` is the working reference for testing each
|
|
|
6451
6655
|
piece. Its size changes with the public surface, so the guide does not pin a
|
|
6452
6656
|
count that can drift independently from the test runner.
|
|
6453
6657
|
|
|
6658
|
+
### Managed-resource conformance
|
|
6659
|
+
|
|
6660
|
+
Consumer-owned resource adapters can run the framework's deterministic
|
|
6661
|
+
lifecycle matrix without importing `bun:test`:
|
|
6662
|
+
|
|
6663
|
+
```ts
|
|
6664
|
+
import { defineManagedResource } from 'stitchkit/application'
|
|
6665
|
+
import { runManagedResourceConformance } from 'stitchkit/testing'
|
|
6666
|
+
|
|
6667
|
+
await runManagedResourceConformance({
|
|
6668
|
+
createFixture: ({ controls }) => {
|
|
6669
|
+
const resource = defineManagedResource({
|
|
6670
|
+
id: 'provider-adapter',
|
|
6671
|
+
async start() {
|
|
6672
|
+
await controls.startup
|
|
6673
|
+
return {
|
|
6674
|
+
ready: controls.readiness,
|
|
6675
|
+
completion: controls.completion,
|
|
6676
|
+
}
|
|
6677
|
+
},
|
|
6678
|
+
activate: () => controls.activation,
|
|
6679
|
+
stopAdmission: () => provider.stopAdmission(),
|
|
6680
|
+
drain: () => provider.drain(),
|
|
6681
|
+
close: () => controls.close,
|
|
6682
|
+
force: () => controls.force,
|
|
6683
|
+
})
|
|
6684
|
+
return {
|
|
6685
|
+
resource,
|
|
6686
|
+
dispose: () => provider.releaseFixtureHandles(),
|
|
6687
|
+
}
|
|
6688
|
+
},
|
|
6689
|
+
})
|
|
6690
|
+
```
|
|
6691
|
+
|
|
6692
|
+
The runner creates a fresh fixture for every scenario and controls startup,
|
|
6693
|
+
readiness, long-lived completion, activation, close and force settlement. The
|
|
6694
|
+
adapter must wire those promises to the corresponding public resource phases;
|
|
6695
|
+
`dispose` releases fixture-owned handles even after a failed scenario. Semantic
|
|
6696
|
+
ordering uses controlled barriers and shutdown abort, while
|
|
6697
|
+
`watchdogTimeoutMs` is only an emergency bound for a broken fixture. An
|
|
6698
|
+
explicit `scenarios` subset must contain at least one stable scenario ID.
|
|
6699
|
+
|
|
6700
|
+
### Published-package optional-peer matrix
|
|
6701
|
+
|
|
6702
|
+
The repository's `consumer-lane` is a release invariant over the package users
|
|
6703
|
+
actually install, not the source tree. One declarative matrix classifies every
|
|
6704
|
+
public export and relevant mixed-barrel feature by browser/Bun/Node target,
|
|
6705
|
+
installed optional peers, runtime bundle inputs, emitted-declaration inputs and
|
|
6706
|
+
whether the built artifact can execute. Exact export-map coverage means a new
|
|
6707
|
+
subpath fails the gate until its dependency boundary is explicit.
|
|
6708
|
+
|
|
6709
|
+
Peer-neutral cases run from a packed minimal install. Provider adapters run only
|
|
6710
|
+
with their declared peer family and retain a negative missing-peer proof. A new
|
|
6711
|
+
runtime or type-only package outside a case's budget fails with both the case id
|
|
6712
|
+
and package name, so an accidental eager import cannot hide behind another
|
|
6713
|
+
fixture's transitive dependency.
|
|
6714
|
+
|
|
6454
6715
|
## Deployment
|
|
6455
6716
|
|
|
6456
6717
|
### Build
|
|
@@ -8426,7 +8687,9 @@ Also re-exports the error helpers from `stitchkit/contract`.
|
|
|
8426
8687
|
|
|
8427
8688
|
Server-only process-local application composition. See the
|
|
8428
8689
|
[application kernel guide](../guide/application-kernel.md) and
|
|
8429
|
-
[architecture](../architecture/application-kernel.md).
|
|
8690
|
+
[architecture](../architecture/application-kernel.md). Complete consumer
|
|
8691
|
+
cutovers are covered by the executable
|
|
8692
|
+
[migration recipes](../guide/application-migration-recipes.md).
|
|
8430
8693
|
|
|
8431
8694
|
### Kernel and resources
|
|
8432
8695
|
|
|
@@ -8436,12 +8699,14 @@ Server-only process-local application composition. See the
|
|
|
8436
8699
|
| `defineManagedResource` | function | retain the exact typed resource declaration; every invoked start is rollback-eligible |
|
|
8437
8700
|
| `managedServerResource` | function | adapt an existing managed server without copying its HTTP/WebSocket shutdown machine |
|
|
8438
8701
|
| `createApplicationHealthHandler` | function | build a Fetch-clean liveness or readiness response from the sanitized application snapshot |
|
|
8702
|
+
| `createApplicationOperationalHandlers` | function | compose always-readable status plus the canonical readiness/liveness handlers |
|
|
8439
8703
|
| `ApplicationAdmissionError` | class | stable `APPLICATION_NOT_ACCEPTING` rejection from `admission.run(...)` |
|
|
8440
8704
|
| `ApplicationConfig` / `ApplicationHandle` | _type_ | application declaration and its start/snapshot/subscription/admission/shutdown handle |
|
|
8441
8705
|
| `ApplicationAdmission` / `ApplicationOperationLease` | _type_ | atomic process-local admission and idempotent release primitive |
|
|
8442
8706
|
| `ManagedResource` / `ManagedResourceContext` / `ManagedResourceStartResult` | _type_ | resource lifecycle callbacks, shared deadlines, health reporting and separate readiness/completion promises |
|
|
8443
8707
|
| `ManagedServerResourceConfig` | _type_ | existing managed server, stable ID, dependencies and policy for `managedServerResource` |
|
|
8444
8708
|
| `ApplicationHealthHandlerOptions` / `ApplicationHealthHandlerOptionsSchema` | _type_ / schema | liveness/readiness selection and sanitized `Retry-After` policy |
|
|
8709
|
+
| `ApplicationOperationalHandlers` / `ApplicationOperationalHandlersOptions` / `ApplicationOperationalHandlersOptionsSchema` | _type_ / schema | conventional status/readiness/liveness route surface and shared retry policy |
|
|
8445
8710
|
|
|
8446
8711
|
### Managed schedules
|
|
8447
8712
|
|
|
@@ -8506,6 +8771,20 @@ does not resolve grammY.
|
|
|
8506
8771
|
| `GrammyWebhookResourceConfig` / `GrammyWebhookResource` | _type_ | injected webhook bot declaration and `{ resource, handleUpdate }` handle |
|
|
8507
8772
|
| `GrammyUpdate` | _type_ | exact update input inferred from the injected grammY bot context |
|
|
8508
8773
|
|
|
8774
|
+
## `stitchkit/application/opentelemetry`
|
|
8775
|
+
|
|
8776
|
+
Type-only optional-peer adapter for applications that already own an
|
|
8777
|
+
OpenTelemetry SDK and exporter. Its observable gauges pull absolute canonical
|
|
8778
|
+
snapshots; the adapter owns no SDK lifecycle, polling or delta state.
|
|
8779
|
+
|
|
8780
|
+
| Export | Kind | Summary |
|
|
8781
|
+
|--------|------|---------|
|
|
8782
|
+
| `createApplicationOpenTelemetry` | function | register fixed observable application, resource, admission, schedule and activity gauges on an injected Meter |
|
|
8783
|
+
| `ApplicationOpenTelemetryConfig` | _type_ | injected meter and canonical application/activity/schedule pull sources plus isolated diagnostic hook |
|
|
8784
|
+
| `ApplicationOpenTelemetryBinding` | _type_ | idempotent exact callback removal and closed state |
|
|
8785
|
+
| `ApplicationTelemetryMeter` | _type_ | minimal structural `Meter.createObservableGauge` boundary compatible with `@opentelemetry/api` |
|
|
8786
|
+
| `ApplicationOpenTelemetryCollectionError` | _type_ | isolated instrument-name/error diagnostic without product/provider attributes |
|
|
8787
|
+
|
|
8509
8788
|
---
|
|
8510
8789
|
|
|
8511
8790
|
## `stitchkit/agent-runtime`
|
|
@@ -8947,6 +9226,16 @@ handler pipeline without opening a TCP port.
|
|
|
8947
9226
|
| `createHandlerTestClients` | function | exact contract-registry batch form |
|
|
8948
9227
|
| `runAgentStoreConformance` | function | reusable black-box duplicate/coalescing/stale/recovery contract for durable agent-store adapters |
|
|
8949
9228
|
| `AgentStoreConformanceConfig` | _type_ | factory configuration for running the same contract against a fresh adapter |
|
|
9229
|
+
| `runManagedResourceConformance` | function | run the canonical deterministic lifecycle matrix against a fresh consumer-owned `ManagedResource` fixture; resolves `void` or throws `ManagedResourceConformanceError` with a stable scenario ID and normalized trace |
|
|
9230
|
+
| `ManagedResourceConformanceScenarioIdSchema` / `ManagedResourceConformanceScenarioId` | schema / _type_ | stable clean, rollback, readiness/completion, activation, shutdown-race and forced-cleanup scenario vocabulary |
|
|
9231
|
+
| `ManagedResourceConformanceScenarioSchema` / `ManagedResourceConformanceScenario` | schema / _type_ | discriminated scenario record including whether the controlled resource is required |
|
|
9232
|
+
| `ManagedResourceConformanceTraceEntrySchema` / `ManagedResourceConformanceTraceEntry` | schema / _type_ | sequence-numbered phase/outcome diagnostic without timestamps or generated IDs |
|
|
9233
|
+
| `ManagedResourceConformancePhaseSchema` / `ManagedResourceConformancePhase` | schema / _type_ | lifecycle and disposal trace phases |
|
|
9234
|
+
| `ManagedResourceConformanceTraceOutcomeSchema` / `ManagedResourceConformanceTraceOutcome` | schema / _type_ | normalized `enter`, `resolve` or `reject` outcome |
|
|
9235
|
+
| `ManagedResourceConformanceConfig` | _type_ | fresh-fixture factory, optional scenario subset and emergency watchdog bound |
|
|
9236
|
+
| `ManagedResourceConformanceFactoryInput` / `ManagedResourceConformanceControls` | _type_ | current discriminated scenario and caller-controlled startup, readiness, completion, activation, close and force promises |
|
|
9237
|
+
| `ManagedResourceConformanceFixture` | _type_ | tested resource plus required bounded disposal callback |
|
|
9238
|
+
| `ManagedResourceConformanceError` | class | `MANAGED_RESOURCE_CONFORMANCE_FAILED` diagnostic carrying scenario, expected phase subsequence and observed trace |
|
|
8950
9239
|
| `createAgentRaceBarrier` / `createAgentRaceDriver` / `createAgentRaceTrace` | function | bounded named barriers and exact partial-order traces for deterministic runtime race probes |
|
|
8951
9240
|
| `AgentRaceBarrier` / `AgentRaceDriver` / `AgentRaceTrace` / `AgentRaceTraceEntry` | _type_ | public packed-consumer types for the deterministic race harness |
|
|
8952
9241
|
| `HandlerTestClientDefaults` | _type_ | ordinary bare-client defaults with handler-owned `baseUrl` and `fetch` removed |
|
package/llms.txt
CHANGED
|
@@ -12,6 +12,7 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
|
|
|
12
12
|
- [MCP & agents](https://github.com/max-listov/stitchkit/blob/master/docs/guide/mcp-and-agents.md): contracts as MCP tools (createMcpHandler) and AI-agent tools (mountAgent); tool lifecycle, extend, identity
|
|
13
13
|
- [Agent application runtime](https://github.com/max-listov/stitchkit/blob/master/docs/guide/agent-runtime.md): optional durable history, prompt/model composition, stream loop, coordination, fencing and events
|
|
14
14
|
- [Managed application kernel](https://github.com/max-listov/stitchkit/blob/master/docs/guide/application-kernel.md): process-local resources, readiness, admission, schedules, projections and optional provider adapters
|
|
15
|
+
- [Application migration recipes](https://github.com/max-listov/stitchkit/blob/master/docs/guide/application-migration-recipes.md): executable database, poller, queue-consumer and operational publishing cutovers
|
|
15
16
|
- [CLI](https://github.com/max-listov/stitchkit/blob/master/docs/guide/cli.md): contracts as a command-line program
|
|
16
17
|
- [Realtime](https://github.com/max-listov/stitchkit/blob/master/docs/guide/realtime.md): Socket.IO server/client wrappers, handshake auth, the cache bridge, a raw WebSocket lane
|
|
17
18
|
- [Auth & errors](https://github.com/max-listov/stitchkit/blob/master/docs/guide/auth-and-errors.md): scopes, createAuthHook, JWT/cookies, the AppError model, the stitch error-code registry
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.4",
|
|
4
4
|
"description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
"types": "./dist/application-grammy.d.ts",
|
|
93
93
|
"import": "./dist/application-grammy.js"
|
|
94
94
|
},
|
|
95
|
+
"./application/opentelemetry": {
|
|
96
|
+
"types": "./dist/application-opentelemetry.d.ts",
|
|
97
|
+
"import": "./dist/application-opentelemetry.js"
|
|
98
|
+
},
|
|
95
99
|
"./testing": {
|
|
96
100
|
"types": "./dist/testing.d.ts",
|
|
97
101
|
"import": "./dist/testing.js"
|
|
@@ -111,7 +115,7 @@
|
|
|
111
115
|
"scripts": {
|
|
112
116
|
"check": "bun x tsc --noEmit",
|
|
113
117
|
"build:browser": "bun build src/index.ts src/react.ts src/contract/index.ts --outdir dist --target node --packages external --splitting --root src",
|
|
114
|
-
"build:server": "bun build src/server/index.ts src/node.ts src/tools.ts src/cli.ts src/remote.ts src/files.ts src/testing.ts src/observability/index.ts src/agent-runtime.ts src/agent-runtime-openrouter.ts src/application.ts src/application-grammy.ts --outdir dist --target node --packages external --splitting --root src",
|
|
118
|
+
"build:server": "bun build src/server/index.ts src/node.ts src/tools.ts src/cli.ts src/remote.ts src/files.ts src/testing.ts src/observability/index.ts src/agent-runtime.ts src/agent-runtime-openrouter.ts src/application.ts src/application-grammy.ts src/application-opentelemetry.ts --outdir dist --target node --packages external --splitting --root src",
|
|
115
119
|
"build:js": "bun run build:browser && bun run build:server",
|
|
116
120
|
"build:types": "bun x tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
117
121
|
"build": "rm -rf dist && bun run build:js && bun run build:types && bun scripts/check-browser-clean.mjs && bun scripts/check-env-live.mjs && bun scripts/check-public-types.mjs",
|
|
@@ -126,6 +130,7 @@
|
|
|
126
130
|
"peerDependencies": {
|
|
127
131
|
"@modelcontextprotocol/ext-apps": "^1.7.2",
|
|
128
132
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
133
|
+
"@opentelemetry/api": "^1.9.0",
|
|
129
134
|
"@openrouter/ai-sdk-provider": "^3.0.0",
|
|
130
135
|
"@types/bun": "^1.3.14",
|
|
131
136
|
"@socket.io/bun-engine": "^0.1.1",
|
|
@@ -150,6 +155,9 @@
|
|
|
150
155
|
"@modelcontextprotocol/server": {
|
|
151
156
|
"optional": true
|
|
152
157
|
},
|
|
158
|
+
"@opentelemetry/api": {
|
|
159
|
+
"optional": true
|
|
160
|
+
},
|
|
153
161
|
"@openrouter/ai-sdk-provider": {
|
|
154
162
|
"optional": true
|
|
155
163
|
},
|
|
@@ -191,6 +199,7 @@
|
|
|
191
199
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
192
200
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
193
201
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
202
|
+
"@opentelemetry/api": "^1.9.0",
|
|
194
203
|
"@openrouter/ai-sdk-provider": "^3.0.0",
|
|
195
204
|
"@socket.io/bun-engine": "^0.1.1",
|
|
196
205
|
"@socket.io/component-emitter": "^3.1.2",
|
package/dist/index-1bx83sw4.js
DELETED