stitchkit 0.68.8 → 0.68.9
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/llms-full.txt +70 -3
- package/package.json +1 -1
package/llms-full.txt
CHANGED
|
@@ -3533,6 +3533,36 @@ const exportOperation = defineAsyncOperation({
|
|
|
3533
3533
|
const runtimeTools = exportOperation.runtimeTools
|
|
3534
3534
|
```
|
|
3535
3535
|
|
|
3536
|
+
#### Durable application-owned execution
|
|
3537
|
+
|
|
3538
|
+
The executable reference
|
|
3539
|
+
[`durable-async-operation-harness.ts`](../../packages/core/examples/durable-async-operation-harness.ts)
|
|
3540
|
+
shows the complete boundary behind that surface. It composes
|
|
3541
|
+
`defineAsyncOperationContract`, `defineAsyncOperation`, `createApplication`,
|
|
3542
|
+
`createBoundedAdmission`, managed shutdown and `createAgentToolFenceLifecycle`
|
|
3543
|
+
around an injected store and provider.
|
|
3544
|
+
|
|
3545
|
+
The store transactionally owns the idempotency key **and normalized request
|
|
3546
|
+
hash**. Reusing both returns the existing operation; reusing the key with a
|
|
3547
|
+
different hash conflicts. Every mutation is an expected-revision CAS. Before an
|
|
3548
|
+
external call, the application persists a unique attempt/effect key and marks
|
|
3549
|
+
the dispatch `possibly-dispatched`; a lost response is therefore reconciled by
|
|
3550
|
+
that key after restart and is never treated as permission to submit the effect
|
|
3551
|
+
again. Provider acknowledgement, progress, cancellation intent, result and
|
|
3552
|
+
artifact references remain durable application state.
|
|
3553
|
+
|
|
3554
|
+
Agent tool fencing and operation idempotency are separate guarantees. The fence
|
|
3555
|
+
prevents a stale run owner from crossing an effect boundary; the transactional
|
|
3556
|
+
idempotency record makes a repeated current call converge on one operation.
|
|
3557
|
+
Neither replaces the other.
|
|
3558
|
+
|
|
3559
|
+
Stitchkit deliberately does **not** own the durable queue, operation database,
|
|
3560
|
+
lease renewal, provider retry/reconciliation protocol, asset catalog or domain
|
|
3561
|
+
states. The process-local application resource stops admission and drains
|
|
3562
|
+
accepted work; unresolved durable records survive shutdown for the next
|
|
3563
|
+
recovery pass. The packed consumer lane executes this composition from the
|
|
3564
|
+
published package on Bun and Node.
|
|
3565
|
+
|
|
3536
3566
|
Every follow-up repeats `authorize`; an opaque id is never authority. Aborting
|
|
3537
3567
|
`wait` only stops waiting and never calls optional domain `cancel`.
|
|
3538
3568
|
|
|
@@ -4348,6 +4378,43 @@ These are post-commit notifications, not a transactional outbox: a process can
|
|
|
4348
4378
|
crash between the database commit and `publish`. Reconnect should load canonical
|
|
4349
4379
|
state. Exactly-once external delivery remains an application-owned outbox.
|
|
4350
4380
|
|
|
4381
|
+
### External channel ingress and delivery
|
|
4382
|
+
|
|
4383
|
+
The executable
|
|
4384
|
+
[`external-channel-harness.ts`](../../packages/core/examples/external-channel-harness.ts)
|
|
4385
|
+
is the reference composition for webhooks, polling transports and local-device
|
|
4386
|
+
adapters. Its generic boundary injects a runtime, durable store and delivery
|
|
4387
|
+
adapter; the optional
|
|
4388
|
+
[`external-channel-grammy.ts`](../../packages/core/examples/external-channel-grammy.ts)
|
|
4389
|
+
attaches the same ingress function to grammY polling or webhook lifecycle
|
|
4390
|
+
without putting provider types in the agent runtime.
|
|
4391
|
+
|
|
4392
|
+
Inbound update identity, principal resolution, conversation mapping and reply
|
|
4393
|
+
target are application policy. Persist and deduplicate the update before
|
|
4394
|
+
`runtime.submit`, use the stored idempotency key on crash recovery, then persist
|
|
4395
|
+
the admitted `runId`. A duplicate arriving after restart resolves to that same
|
|
4396
|
+
mapping instead of creating another model turn.
|
|
4397
|
+
|
|
4398
|
+
For output, choose `terminal-only` or `streaming` explicitly. Stable durable
|
|
4399
|
+
`eventId` values and transient `(runtimeEpoch, sequence)` identities become
|
|
4400
|
+
outbox keys; the application store assigns causal ordinals. A bounded channel
|
|
4401
|
+
is only a process-local wakeup and never the durable authority. Before sending,
|
|
4402
|
+
persist one of these states:
|
|
4403
|
+
|
|
4404
|
+
| State | Recovery action |
|
|
4405
|
+
| --- | --- |
|
|
4406
|
+
| `not-dispatched` | may dispatch once |
|
|
4407
|
+
| `possibly-dispatched` | reconcile with the adapter or remain unresolved |
|
|
4408
|
+
| `acknowledged` | deduplicate; delivery is complete |
|
|
4409
|
+
|
|
4410
|
+
The agent `terminal` event and the adapter's delivery receipt are intentionally
|
|
4411
|
+
different records. A successful run does not prove that a reply reached its
|
|
4412
|
+
channel, and a delivery failure never rewrites the canonical agent result.
|
|
4413
|
+
Shutdown stops ingress, drains accepted process-local work and leaves ambiguous
|
|
4414
|
+
outbox records visible for a later reconciliation pass. Stitchkit does not own
|
|
4415
|
+
a channel database, durable broker, provider payload schema or application
|
|
4416
|
+
identity policy.
|
|
4417
|
+
|
|
4351
4418
|
Durable event IDs are derived from run, event type and snapshot version. Use
|
|
4352
4419
|
`advanceAgentRuntimeEventCursor` to classify delivery.
|
|
4353
4420
|
|
|
@@ -11646,7 +11713,7 @@ Server-only optional application runtime. See the
|
|
|
11646
11713
|
| `AgentSessionCloseOptions` | _type_ | `gracePeriodMs` for natural settlement, then abort, then `forceTimeoutMs` for bounded settlement after it |
|
|
11647
11714
|
| `AgentSessionCloseResult` | _type_ | what `close()` achieved: `settled`, or `timedOut` with `remaining` runs still in flight. Only omitting `forceTimeoutMs` guarantees nothing is in flight on return |
|
|
11648
11715
|
| `AgentHistoryProjectionOptions` | _type_ | storage-neutral file resolver, explicit unresolved-file behavior, and how an interrupted turn reaches the model (`interruptedAssistant`) |
|
|
11649
|
-
| `createAgentToolFenceLifecycle` | function | pre-effect and post-effect run ownership fence for `mountAgent
|
|
11716
|
+
| `createAgentToolFenceLifecycle` | function | pre-effect and post-effect run ownership fence for `mountAgent`; compose beside application idempotency for [durable operations](../guide/mcp-and-agents.md#durable-application-owned-execution) |
|
|
11650
11717
|
| `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/terminal projections |
|
|
11651
11718
|
| `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
|
|
11652
11719
|
|
|
@@ -12035,8 +12102,8 @@ runtime-tool runner, plus deliberate raw MCP adapters over the same mechanics.
|
|
|
12035
12102
|
| `NativeToolIdentity` | _type_ | pathless service/action/scope/meta identity; semantic method is factory-owned |
|
|
12036
12103
|
| `ManagedWaitRender` | _type_ | optional managed wait terminal text and failure classification |
|
|
12037
12104
|
| `UploadToolInputSchema` | constant | fixed `{ path: string }` input schema for `defineUploadTool` |
|
|
12038
|
-
| `defineAsyncOperation` | function | runtime-only start/status/wait plus configured cancel/result/artifacts definitions |
|
|
12039
|
-
| `defineAsyncOperationContract` | function | define one canonical Zod-first HTTP contract for start/status/wait plus optional capabilities |
|
|
12105
|
+
| `defineAsyncOperation` | function | runtime-only start/status/wait plus configured cancel/result/artifacts definitions; see the [durable application-owned recipe](../guide/mcp-and-agents.md#durable-application-owned-execution) |
|
|
12106
|
+
| `defineAsyncOperationContract` | function | define one canonical Zod-first HTTP contract for start/status/wait plus optional capabilities; execution and recovery remain application-owned |
|
|
12040
12107
|
| `bindContractAsyncOperation` | function | bind literal methods from an existing contract without creating another HTTP surface |
|
|
12041
12108
|
| `createAsyncOperationSnapshotSchema` | function | canonical pending/running/succeeded/failed/cancelled Zod snapshot |
|
|
12042
12109
|
| `AsyncOperationCancelResultSchema` | constant | validated accepted/already_terminal/rejected cancellation result |
|
package/package.json
CHANGED