@lostgradient/weft 0.9.0 → 0.11.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.
- package/README.md +12 -4
- package/dist/alerting/alert-manager.d.ts +3 -1
- package/dist/alerting/alert-manager.js +5 -2
- package/dist/cli-main.js +63 -63
- package/dist/core/checkpoint/serialization.js +2 -2
- package/dist/core/context/index.d.ts +2 -1
- package/dist/core/context/index.js +8 -0
- package/dist/core/context/operation-request.d.ts +2 -0
- package/dist/core/context/parallel-cache-entry.d.ts +1 -1
- package/dist/core/context/parallel-cache-entry.js +12 -8
- package/dist/core/context/parallel-operations.d.ts +1 -1
- package/dist/core/context/parallel-operations.js +50 -8
- package/dist/core/engine/async-activity-completion.d.ts +24 -54
- package/dist/core/engine/async-activity-completion.js +25 -90
- package/dist/core/engine/async-activity-records.d.ts +106 -0
- package/dist/core/engine/async-activity-records.js +124 -0
- package/dist/core/engine/bulk-operations-purge.js +2 -1
- package/dist/core/engine/callback-creators-core.js +1 -0
- package/dist/core/engine/construction.d.ts +1 -3
- package/dist/core/engine/construction.js +2 -5
- package/dist/core/engine/deferred-consume-envelope.d.ts +10 -1
- package/dist/core/engine/deferred-consume-envelope.js +9 -1
- package/dist/core/engine/disposal.js +4 -0
- package/dist/core/engine/engine-internal-types.d.ts +1 -0
- package/dist/core/engine/engine-leak-warnings.d.ts +2 -0
- package/dist/core/engine/engine-leak-warnings.js +7 -1
- package/dist/core/engine/engine-runtime-helpers.d.ts +8 -0
- package/dist/core/engine/engine-runtime-helpers.js +9 -0
- package/dist/core/engine/errors.js +1 -1
- package/dist/core/engine/index.d.ts +18 -5
- package/dist/core/engine/index.js +41 -10
- package/dist/core/engine/inline-parking.js +14 -1
- package/dist/core/engine/internals.d.ts +23 -2
- package/dist/core/engine/lifecycle/recovered-services.d.ts +4 -2
- package/dist/core/engine/lifecycle/recovered-services.js +37 -7
- package/dist/core/engine/lifecycle/resume.d.ts +2 -2
- package/dist/core/engine/lifecycle/resume.js +39 -7
- package/dist/core/engine/lifecycle/shared.d.ts +34 -0
- package/dist/core/engine/lifecycle/transition.d.ts +1 -1
- package/dist/core/engine/lifecycle/transition.js +3 -3
- package/dist/core/engine/lifecycle.d.ts +1 -1
- package/dist/core/engine/memo-durable-activity.js +7 -9
- package/dist/core/engine/operations-activity.js +1 -1
- package/dist/core/engine/operations-coordination.d.ts +15 -1
- package/dist/core/engine/operations-coordination.js +43 -10
- package/dist/core/engine/operations-time.js +8 -28
- package/dist/core/engine/ownership-options.d.ts +1 -0
- package/dist/core/engine/ownership-options.js +14 -0
- package/dist/core/engine/retention.js +4 -0
- package/dist/core/engine/schedule-run-metadata.d.ts +3 -0
- package/dist/core/engine/schedule-run-metadata.js +29 -0
- package/dist/core/engine/schedule-run.js +19 -4
- package/dist/core/engine/schedules.js +4 -3
- package/dist/core/engine/sleep-timer-acknowledgements.d.ts +15 -0
- package/dist/core/engine/sleep-timer-acknowledgements.js +144 -0
- package/dist/core/engine/sub-operation.js +6 -13
- package/dist/core/engine/termination/cleanup.js +6 -1
- package/dist/core/types/options.d.ts +12 -0
- package/dist/core/types/services-resolution.d.ts +8 -3
- package/dist/core/types/workflow-builder.d.ts +2 -2
- package/dist/core/types/workflow-context.d.ts +27 -0
- package/dist/index.d.ts +2 -2
- package/dist/mcp/cli.js +17 -17
- package/dist/server/authorization.d.ts +3 -3
- package/dist/server/fault-to-json-rpc.d.ts +2 -1
- package/dist/server/handler.js +22 -22
- package/dist/server/index.js +17 -17
- package/dist/server/json-rpc-dispatch.d.ts +2 -2
- package/dist/server/json-rpc-parse.d.ts +1 -1
- package/dist/server/json-rpc-protocol.d.ts +2 -2
- package/dist/server/json-rpc-websocket.d.ts +1 -1
- package/dist/server/operation-fault.d.ts +3 -1
- package/dist/server/operations/async-activity.js +2 -2
- package/dist/server/principal.d.ts +2 -2
- package/dist/server/stdio-session.d.ts +4 -4
- package/dist/service-worker/index.js +13 -13
- package/dist/service-worker/scheduler.js +1 -0
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/http.js +2 -2
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/indexeddb.js +1 -1
- package/dist/storage/interface.d.ts +1 -0
- package/dist/storage/interface.js +1 -1
- package/dist/storage/lazy-postgres-pool.d.ts +38 -0
- package/dist/storage/lazy-postgres-pool.js +38 -0
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon-batch.d.ts +8 -8
- package/dist/storage/neon.d.ts +26 -79
- package/dist/storage/neon.js +3 -3
- package/dist/storage/postgres-key-value-queries.d.ts +1 -1
- package/dist/storage/postgres-key-value-queries.js +1 -1
- package/dist/storage/postgres-key-value-storage.d.ts +110 -0
- package/dist/storage/postgres-key-value-storage.js +204 -0
- package/dist/storage/postgres.d.ts +59 -0
- package/dist/storage/postgres.js +15 -0
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/testing.js +1 -1
- package/dist/storage/turso.js +1 -1
- package/dist/storage/typed-storage.js +1 -1
- package/dist/storage/web-extension.js +1 -1
- package/dist/testing/index.js +17 -17
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +17 -4
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* body, resolves each request via `executeOperation`, and produces the
|
|
6
6
|
* wire-level response shape.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* order. Response order matches request order by construction —
|
|
8
|
+
* The stable JSON-RPC operation-catalog contract mandates sequential dispatch
|
|
9
|
+
* in request order. Response order matches request order by construction —
|
|
10
10
|
* notifications are dropped from the response array, so the returned
|
|
11
11
|
* indices are the non-notification request indices.
|
|
12
12
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* parsed JSON) and returns a discriminated-union `ParseResult` that
|
|
4
4
|
* describes what the transport should dispatch.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* The stable JSON-RPC operation-catalog contract enforces:
|
|
7
7
|
* - `params` MUST be absent or a JSON object. Array-form positional
|
|
8
8
|
* params are rejected with `InvalidRequest` (-32600). This matches
|
|
9
9
|
* OpenRPC's `paramStructure: "by-name"` contract and eliminates a
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* - Runtime stdio session (`stdio-session.ts`, Phase 13)
|
|
11
11
|
*
|
|
12
12
|
* Reserved-spec error codes (-32700..-32603) keep their JSON-RPC 2.0
|
|
13
|
-
* meanings. Weft domain codes live in the -32010..-32099 band
|
|
14
|
-
*
|
|
13
|
+
* meanings. Weft domain codes live in the -32010..-32099 band; this stable
|
|
14
|
+
* error-code allocation preserves compatibility across JSON-RPC transports.
|
|
15
15
|
*/
|
|
16
16
|
/** Literal `"2.0"` — the only `jsonrpc` version this runtime accepts. */
|
|
17
17
|
export declare const JSON_RPC_VERSION: "2.0";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* that binds the authenticated principal at upgrade time and reuses it
|
|
6
6
|
* for every frame. The session:
|
|
7
7
|
* - Parses incoming frames as single JSON-RPC requests (batches over
|
|
8
|
-
* WS are rejected per
|
|
8
|
+
* WS are rejected per stable operation-catalog contract).
|
|
9
9
|
* - Dispatches `weft.workflows.subscribe` / `weft.workflows.unsubscribe`
|
|
10
10
|
* as first-class session primitives against the `WorkflowEventFeed`.
|
|
11
11
|
* - Delegates all other methods to the standard `dispatchJsonRpc`.
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
* adapters never branch on `data === undefined`. This uniformity is what
|
|
31
31
|
* lets the exhaustive switch in `extractFaultDataPayload` stay small.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* The stable fault model with transport-neutral code, message, and typed
|
|
34
|
+
* `data` payload forms the basis of cross-transport parity: every fault is
|
|
35
|
+
* serialized consistently across REST and JSON-RPC transports.
|
|
34
36
|
*/
|
|
35
37
|
import type { FaultCode } from '../core/fault-code.ts';
|
|
36
38
|
import type { WeftErrorCode } from '../core/weft-error.ts';
|
|
@@ -41,7 +41,7 @@ export const completeAsyncActivityOperation = defineOperation({
|
|
|
41
41
|
name: "weft.activities.complete",
|
|
42
42
|
mcpExposable: !1,
|
|
43
43
|
summary: "Complete a deferred activity by task token",
|
|
44
|
-
description: 'Resolve an out-of-band ("async") activity with a result, resuming its parked workflow as though the activity had returned that result inline. Requires the durable task token announced through the `activity:async-pending` event. Faults with NotFound when the token is unknown or already completed/failed (tokens are single-use), and InvalidParams when the result exceeds the payload size limit.',
|
|
44
|
+
description: 'Resolve an out-of-band ("async") activity with a result, resuming its parked workflow as though the activity had returned that result inline. Requires the durable task token announced through the `activity:async-pending` event. Faults with NotFound when the token is unknown or already completed/failed (tokens are single-use), and InvalidParams when the result exceeds the payload size limit. ' + "A success response is durable \u2014 the completion is persisted before the operation " + "returns, and a crash afterward cannot lose it. A failed call leaves the token completable, so treat storage-side faults as retryable.",
|
|
45
45
|
destructive: !0,
|
|
46
46
|
tags: ["Activities"],
|
|
47
47
|
inputSchema: completeAsyncActivityInput,
|
|
@@ -63,7 +63,7 @@ export const completeAsyncActivityOperation = defineOperation({
|
|
|
63
63
|
name: "weft.activities.fail",
|
|
64
64
|
mcpExposable: !1,
|
|
65
65
|
summary: "Fail a deferred activity by task token",
|
|
66
|
-
description: 'Fail an out-of-band ("async") activity, throwing the supplied error into its ' + "parked workflow at the deferred step \u2014 identical to an inline activity that threw, " + "so the workflow\u2019s own try/catch and retry policy apply unchanged. Requires the " + "durable task token from the `activity:async-pending` event. Faults with NotFound when the token is unknown or already completed/failed (tokens are single-use), and InvalidParams when the failure message exceeds the payload size limit.",
|
|
66
|
+
description: 'Fail an out-of-band ("async") activity, throwing the supplied error into its ' + "parked workflow at the deferred step \u2014 identical to an inline activity that threw, " + "so the workflow\u2019s own try/catch and retry policy apply unchanged. Requires the " + "durable task token from the `activity:async-pending` event. Faults with NotFound when the token is unknown or already completed/failed (tokens are single-use), and InvalidParams when the failure message exceeds the payload size limit. " + "A success response is durable \u2014 the failure outcome is persisted before the " + "operation returns, and a crash afterward cannot lose it. A failed call leaves the token completable, so treat storage-side faults as retryable.",
|
|
67
67
|
destructive: !0,
|
|
68
68
|
tags: ["Activities"],
|
|
69
69
|
inputSchema: failAsyncActivityInput,
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* Credential *validation* (signature verification, expiry, revocation, format
|
|
10
10
|
* checks) is the transport edge's responsibility — these factories assume the
|
|
11
11
|
* inputs they receive describe a credential that has already been accepted.
|
|
12
|
+
* This stable principal model ensures consistent authentication across all
|
|
13
|
+
* transport layers.
|
|
12
14
|
*
|
|
13
15
|
* The discriminator string for API keys is `'api-key'` (kebab-case) to match
|
|
14
16
|
* the existing `AuthMethod` literal in `authentication.ts`. Keep them aligned;
|
|
15
17
|
* the bridge from `AuthResult` to `Principal` relies on byte-identical strings.
|
|
16
|
-
*
|
|
17
|
-
* See Track 8 design decisions 3 and 10.
|
|
18
18
|
*/
|
|
19
19
|
import { type AuthorizationScope } from './authorization-scope.ts';
|
|
20
20
|
/**
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Runtime JSON-RPC stdio session.
|
|
3
3
|
*
|
|
4
4
|
* `runStdioSession({ input, output, admission, registry, engine, feed, ... })`
|
|
5
|
-
* drives the `weft rpc-stdio` CLI subcommand
|
|
6
|
-
*
|
|
7
|
-
* through the
|
|
8
|
-
*
|
|
5
|
+
* drives the `weft rpc-stdio` CLI subcommand. It implements the stable
|
|
6
|
+
* JSON-RPC stdio transport: reading newline-delimited JSON frames from
|
|
7
|
+
* `input`, running each through the JSON-RPC dispatcher, and writing
|
|
8
|
+
* responses to `output`.
|
|
9
9
|
*
|
|
10
10
|
* Admission is mandatory:
|
|
11
11
|
* - `{ kind: 'startup-token', token }` — the first frame must be a
|