eve 0.34.0 → 0.35.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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/dist/src/chunks/{use-eve-agent-BNdcle_M.js → use-eve-agent-COmP-H8R.js} +6 -3
- package/dist/src/chunks/{use-eve-agent-FJkEMXYk.js → use-eve-agent-CnppTEFk.js} +6 -3
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/commands/trace-detail.d.ts +3 -2
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +4 -6
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -2
- package/dist/src/client/agent-info-schema.d.ts +12 -4
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/index.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/@chat-adapter/slack/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +1 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +92 -35
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -2
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +25 -23
- package/dist/src/compiled/@workflow/world/queue.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +53 -0
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +36 -1
- package/dist/src/compiled/@workflow/world/steps.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/ulid.d.ts +6 -0
- package/dist/src/compiled/@workflow/world-local/index.js +4 -4
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -17
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-6OqdYdi4.js → attribute-changes-BoH7JsWp.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-DlFv0aHY.js +40 -0
- package/dist/src/compiled/_chunks/workflow/env-config-DxamfI7T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/frames-CTpeJYEQ.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{functions-CXb61C6h.js → functions-CeeNvKsq.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BPQHjeY5.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DQ5dOyjm.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +1 -0
- package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-CUIybhQ2.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-DK2lnH6U.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{wrapper-CDq65xJV.js → wrapper-CMGju7QA.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport-Csi6Cydc.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +8 -8
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-extension.d.ts +3 -3
- package/dist/src/compiler/normalize-extension.js +1 -1
- package/dist/src/compiler/normalize-instructions.d.ts +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -3
- package/dist/src/context/dynamic-instruction-lifecycle.d.ts +5 -1
- package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +6 -2
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/manifest.d.ts +1 -1
- package/dist/src/discover/manifest.js +1 -1
- package/dist/src/evals/index.d.ts +2 -2
- package/dist/src/evals/reporters/index.d.ts +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +5 -0
- package/dist/src/evals/runner/execute-eval.js +1 -1
- package/dist/src/evals/runner/execute-task.d.ts +3 -0
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/types.d.ts +28 -2
- package/dist/src/evals/runner/run-evals.js +1 -1
- package/dist/src/evals/session.d.ts +11 -2
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +10 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-trace-context.d.ts +11 -0
- package/dist/src/execution/workflow-trace-context.js +1 -0
- package/dist/src/harness/ai-sdk-hook-bridge.d.ts +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
- package/dist/src/harness/emission.d.ts +2 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/instrumentation/config.js +1 -0
- package/dist/src/harness/{instrumentation-content.d.ts → instrumentation/content.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.d.ts → instrumentation/dispatch.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.js → instrumentation/dispatch.js} +1 -1
- package/dist/src/harness/{instrumentation-lifecycle.d.ts → instrumentation/lifecycle.d.ts} +3 -6
- package/dist/src/harness/{instrumentation-lifecycle.js → instrumentation/lifecycle.js} +1 -1
- package/dist/src/harness/{instrumentation-native-events.d.ts → instrumentation/native-events.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-native-events.js → instrumentation/native-events.js} +1 -1
- package/dist/src/harness/{instrumentation-providers.d.ts → instrumentation/providers.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-providers.js → instrumentation/providers.js} +1 -1
- package/dist/src/harness/{instrumentation-runtime.d.ts → instrumentation/runtime.d.ts} +4 -2
- package/dist/src/harness/{instrumentation-state.d.ts → instrumentation/state.d.ts} +1 -1
- package/dist/src/harness/parent-lineage.d.ts +1 -1
- package/dist/src/harness/prepare-trace-context.d.ts +16 -0
- package/dist/src/harness/prepare-trace-context.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.d.ts +3 -3
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/instrumentation.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +4 -3
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/vercel/project-link.d.ts +1 -1
- package/dist/src/internal/vercel/project-link.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +10 -9
- package/dist/src/internal/vercel-agent-summary.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/protocol/message.d.ts +15 -1
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/github/auth.d.ts +30 -0
- package/dist/src/public/channels/github/auth.js +2 -2
- package/dist/src/public/channels/github/defaults.d.ts +4 -4
- package/dist/src/public/channels/github/defaults.js +1 -1
- package/dist/src/public/channels/github/dispatch.d.ts +3 -2
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +7 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/index.d.ts +1 -1
- package/dist/src/public/definitions/instructions.d.ts +14 -4
- package/dist/src/public/definitions/instructions.js +1 -1
- package/dist/src/public/definitions/tool.d.ts +5 -8
- package/dist/src/public/instructions/index.d.ts +1 -2
- package/dist/src/public/instructions/index.js +1 -1
- package/dist/src/public/instrumentation/index.d.ts +4 -3
- package/dist/src/public/instrumentation/otel.d.ts +5 -4
- package/dist/src/public/instrumentation/provider.d.ts +2 -2
- package/dist/src/runtime/agent/bootstrap.d.ts +2 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +1 -1
- package/dist/src/runtime/prompt/compose.js +3 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/types.d.ts +4 -3
- package/dist/src/setup/project-resolution.d.ts +3 -3
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.d.ts +0 -9
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slackbot.d.ts +2 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/shared/dynamic-tool-definition.d.ts +3 -4
- package/dist/src/shared/instructions-definition.d.ts +15 -11
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +4 -2
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.d.ts +17 -0
- package/dist/src/tracing/agent-otel-session-context.js +1 -0
- package/dist/src/tracing/agent-otel-usage.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +1 -1
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -2
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-traces.d.ts +3 -3
- package/dist/src/tracing/local-traces.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +2 -2
- package/dist/src/tracing/otel-declaration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +18 -20
- package/docs/agent-config.md +5 -5
- package/docs/channels/eve.mdx +10 -56
- package/docs/channels/github.mdx +1 -1
- package/docs/channels/meta.json +1 -0
- package/docs/concepts/context-control.md +32 -56
- package/docs/concepts/default-harness.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +4 -4
- package/docs/concepts/meta.json +3 -1
- package/docs/concepts/sessions-runs-and-streaming.md +22 -10
- package/docs/{guides → concepts}/state.md +3 -3
- package/docs/connections/mcp.mdx +6 -89
- package/docs/connections/meta.json +1 -0
- package/docs/connections/openapi.mdx +5 -69
- package/docs/connections/overview.mdx +29 -3
- package/docs/evals/meta.json +1 -0
- package/docs/evals/reporters.mdx +14 -4
- package/docs/extensions.md +1 -1
- package/docs/getting-started.mdx +175 -13
- package/docs/guides/auth-and-route-protection.md +3 -18
- package/docs/guides/client/meta.json +2 -1
- package/docs/guides/client/output-schema.mdx +2 -2
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/deployment/meta.json +1 -0
- package/docs/guides/deployment/overview.md +1 -1
- package/docs/guides/deployment/self-hosting.md +3 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/dev-tui.md +3 -13
- package/docs/guides/dynamic-capabilities.md +26 -4
- package/docs/guides/frontend/meta.json +2 -1
- package/docs/guides/frontend/nextjs.mdx +1 -10
- package/docs/guides/frontend/nuxt.mdx +1 -10
- package/docs/guides/frontend/overview.mdx +12 -3
- package/docs/guides/frontend/sveltekit.mdx +1 -10
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +39 -126
- package/docs/guides/frontend/use-eve-agent-vue.mdx +40 -139
- package/docs/guides/instrumentation.md +15 -15
- package/docs/guides/meta.json +1 -5
- package/docs/guides/remote-agents.md +9 -9
- package/docs/guides/session-context.md +34 -103
- package/docs/install-integrations.mdx +1 -1
- package/docs/instructions.mdx +45 -12
- package/docs/meta.json +24 -13
- package/docs/patterns/dynamic-scheduling.md +1 -1
- package/docs/patterns/meta.json +1 -0
- package/docs/patterns/multi-tenant-approvals.md +1 -1
- package/docs/patterns/multi-tenant-auth.md +1 -1
- package/docs/patterns/multi-tenant-memory.md +4 -3
- package/docs/{guides → protocols}/acp.md +1 -1
- package/docs/protocols/meta.json +5 -0
- package/docs/reference/cli.md +34 -34
- package/docs/reference/meta.json +1 -1
- package/docs/reference/typescript-api.md +4 -2
- package/docs/{subagents.mdx → subagents/index.mdx} +2 -2
- package/docs/subagents/meta.json +5 -0
- package/docs/{guides/dynamic-workflows.md → subagents/workflow-tool.md} +6 -6
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tools/meta.json +1 -0
- package/docs/tools/overview.mdx +1 -1
- package/docs/tutorial/connect-a-warehouse.mdx +1 -1
- package/docs/tutorial/meta.json +1 -0
- package/docs/tutorial/remember-definitions.mdx +2 -2
- package/docs/tutorial/ship-it.mdx +2 -2
- package/package.json +4 -4
- package/dist/src/compiled/_chunks/workflow/dist-C8PhDW9B.js +0 -1
- package/dist/src/compiled/_chunks/workflow/functions-xMPAeWFr.js +0 -1
- package/dist/src/compiled/_chunks/workflow/node-Smb57EnG.js +0 -40
- package/dist/src/compiled/_chunks/workflow/resume-hook-BrduAuFX.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-CX7_sJnW.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-tsb2HjWK.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-BNc_0O4m.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BYKVqrwc.js +0 -15
- package/dist/src/harness/instrumentation-config.js +0 -1
- package/docs/installation.mdx +0 -66
- package/docs/project-structure.mdx +0 -53
- package/docs/reference/project-layout.md +0 -123
- /package/dist/src/harness/{instrumentation-config.d.ts → instrumentation/config.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-content.js → instrumentation/content.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.d.ts → instrumentation/runtime-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.js → instrumentation/runtime-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime.js → instrumentation/runtime.js} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.d.ts → instrumentation/setup-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.js → instrumentation/setup-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-state.js → instrumentation/state.js} +0 -0
- /package/docs/{guides → protocols}/ucp.mdx +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from '#compiled/zod/index.js';
|
|
2
|
+
import type { Hook } from './hooks.js';
|
|
3
|
+
import type { StartedWorkflowRun, WorkflowRun } from './runs.js';
|
|
2
4
|
import type { PaginationOptions, ResolveData } from './shared.js';
|
|
5
|
+
import type { StartedStep, Step } from './steps.js';
|
|
6
|
+
import type { Wait } from './waits.js';
|
|
3
7
|
export declare const EventTypeSchema: z.ZodEnum<{
|
|
4
8
|
run_created: "run_created";
|
|
5
9
|
run_started: "run_started";
|
|
@@ -685,6 +689,38 @@ export interface CreateEventParams {
|
|
|
685
689
|
* authoritative full reload, which is always correct.
|
|
686
690
|
*/
|
|
687
691
|
stateCursor?: string;
|
|
692
|
+
/**
|
|
693
|
+
* How many events the writer held in its loaded log when it decided to write
|
|
694
|
+
* this one — equivalently, the slot it expects to land on minus one.
|
|
695
|
+
*
|
|
696
|
+
* Only meaningful against a World that declares
|
|
697
|
+
* `WorldCapabilities.slotEventIds`, where slots are dense and 1-based so a
|
|
698
|
+
* count and a position are the same number. Such a World attempts
|
|
699
|
+
* `eventCount + 1`, and on contention **bumps** to the next free slot and
|
|
700
|
+
* commits there anyway — a stale count never rejects a write. What it does
|
|
701
|
+
* instead is report: when the committed slot is higher than the one asked
|
|
702
|
+
* for, the events occupying the skipped slots come back on the success
|
|
703
|
+
* response in {@link EventResult.events} / `cursor` / `hasMore`, so the
|
|
704
|
+
* writer learns exactly what it had not seen.
|
|
705
|
+
*
|
|
706
|
+
* This supersedes the {@link stateUpdatedAt} / {@link stateEventCount} /
|
|
707
|
+
* {@link stateCursor} triple for slot Worlds. That triple approximates a
|
|
708
|
+
* position with a ULID-time watermark plus a count of events at or below it,
|
|
709
|
+
* which is why a *complete but stale* prefix passes it: every event the
|
|
710
|
+
* writer holds is at or below its own watermark, so the count matches and no
|
|
711
|
+
* fence fires. A dense position has no such blind spot. Worlds without slots
|
|
712
|
+
* ignore this field and keep using the triple.
|
|
713
|
+
*
|
|
714
|
+
* A batch of writes issued from one snapshot starts from the same
|
|
715
|
+
* `eventCount`; they land on consecutive slots in whatever order the World
|
|
716
|
+
* serializes them, which is why they can stay a parallel fan-out instead of
|
|
717
|
+
* a chain of round-trips. The count a given write sends is the writer's
|
|
718
|
+
* position *at that moment*, so it advances mid-batch as reported events are
|
|
719
|
+
* folded back into the loaded log: a write issued after a sibling's
|
|
720
|
+
* bump-and-report already holds the slots that report named, and asks for a
|
|
721
|
+
* slot above them.
|
|
722
|
+
*/
|
|
723
|
+
eventCount?: number;
|
|
688
724
|
/**
|
|
689
725
|
* Timestamp for when the event occurred on the client side. Worlds that
|
|
690
726
|
* support this can persist it separately from `createdAt`, which represents
|
|
@@ -704,21 +740,23 @@ export interface CreateEventParams {
|
|
|
704
740
|
* on the resulting {@link EventResult}, the first page of events written
|
|
705
741
|
* strictly after this cursor (via `events`/`cursor`/`hasMore`) — the
|
|
706
742
|
* same page an `events.list({ cursor: sinceCursor, sortOrder: 'asc' })`
|
|
707
|
-
* call would return immediately after this write.
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
743
|
+
* call would return immediately after this write. Outside turbo mode the
|
|
744
|
+
* runtime sets this on every write it makes from the orchestrator loop
|
|
745
|
+
* and folds any returned delta into its in-memory log, so each write
|
|
746
|
+
* carries the log forward and the loop reads it back for free: instead of
|
|
747
|
+
* re-reading its own just-written events (and any events interleaved
|
|
748
|
+
* in-band, such as `hook_received`), it consumes the authoritative delta
|
|
749
|
+
* the write already had to compute. Turbo mode does not set it — the
|
|
750
|
+
* point there is to keep the first invocation's writes as cheap as
|
|
751
|
+
* possible, and it has no loaded log to extend.
|
|
712
752
|
*
|
|
713
753
|
* The cursor MUST share `events.list` semantics: the returned `events`
|
|
714
754
|
* are everything sorted strictly after `sinceCursor`, `cursor` is the
|
|
715
755
|
* position past the last returned event, and `hasMore` indicates a
|
|
716
756
|
* further page exists. A World MAY return a single page and set
|
|
717
|
-
* `hasMore: true` rather than paginating to exhaustion
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
* body emitting more in-band events than one page silently bypasses this
|
|
721
|
-
* fast path, which is correct but forgoes the saved round-trip.)
|
|
757
|
+
* `hasMore: true` rather than paginating to exhaustion. The runtime
|
|
758
|
+
* consumes that page and continues from its cursor, so it never reads the
|
|
759
|
+
* returned prefix again.
|
|
722
760
|
* Returning these fields at all is OPTIONAL — a World that omits them is
|
|
723
761
|
* fully supported; the runtime falls back to `events.list`. This
|
|
724
762
|
* preserves the same divergence guarantees as the fetch path because the
|
|
@@ -741,7 +779,7 @@ export interface CreateEventParams {
|
|
|
741
779
|
* option end-to-end (cf. {@link sinceCursor}) so the single name greps
|
|
742
780
|
* across the SDK and the backend.
|
|
743
781
|
*/
|
|
744
|
-
skipPreload?:
|
|
782
|
+
skipPreload?: true;
|
|
745
783
|
/**
|
|
746
784
|
* Replay-log preload opt-in (advisory) — the `hook_received` dual of
|
|
747
785
|
* {@link skipPreload}. Set only by the queue consumer's idempotent
|
|
@@ -785,19 +823,34 @@ export interface CreateEventParams {
|
|
|
785
823
|
*
|
|
786
824
|
* Note: `event` is optional to support legacy runs where event storage is skipped.
|
|
787
825
|
*/
|
|
788
|
-
export
|
|
826
|
+
export type EventResult<T extends EventType = EventType> = {
|
|
789
827
|
/** The created event (optional for legacy compatibility) */
|
|
790
828
|
event?: Event;
|
|
791
829
|
/** The workflow run entity (for run_* events) */
|
|
792
|
-
run?:
|
|
830
|
+
run?: WorkflowRun;
|
|
793
831
|
/** The step entity (for step_* events) */
|
|
794
|
-
step?:
|
|
832
|
+
step?: Step;
|
|
795
833
|
/** The hook entity (for hook_created events) */
|
|
796
|
-
hook?:
|
|
834
|
+
hook?: Hook;
|
|
797
835
|
/** The wait entity (for wait_created/wait_completed events) */
|
|
798
|
-
wait?:
|
|
836
|
+
wait?: Wait;
|
|
837
|
+
/**
|
|
838
|
+
* Lazy step start: set to `true` only when a `step_started` event with
|
|
839
|
+
* step-creation data atomically *created* the step on this call (the
|
|
840
|
+
* caller won the create-claim), as opposed to transitioning a step that
|
|
841
|
+
* already existed. The owned-inline runtime path uses this as the
|
|
842
|
+
* exactly-once ownership signal — it runs the step body inline only when
|
|
843
|
+
* it created the step, so a concurrent handler that lost the create race
|
|
844
|
+
* (and gets `EntityConflictError`/skipped) never double-executes. Absent
|
|
845
|
+
* (undefined) on the legacy path and from older servers/worlds, which is
|
|
846
|
+
* the safe default (treated as "not the lazy creator").
|
|
847
|
+
*/
|
|
848
|
+
stepCreated?: true;
|
|
849
|
+
/** Server-owned max event count for the run (run-lifecycle responses); the runtime enforces it. */
|
|
850
|
+
maxEvents?: number;
|
|
851
|
+
} & ({
|
|
799
852
|
/**
|
|
800
|
-
* Events with data resolved.
|
|
853
|
+
* Events with data resolved. Four producers populate this:
|
|
801
854
|
*
|
|
802
855
|
* - On a `run_started` response: all events up to this point, so the
|
|
803
856
|
* runtime can skip the initial `events.list` call and reduce TTFB.
|
|
@@ -810,32 +863,36 @@ export interface EventResult {
|
|
|
810
863
|
* log through the canonical `hook_received`, so the lazy hook queue
|
|
811
864
|
* consumer can skip both the `run_started` write and the initial
|
|
812
865
|
* `events.list`.
|
|
866
|
+
* - On any response from a slot-allocating World (see
|
|
867
|
+
* `WorldCapabilities.slotEventIds`) whose committed slot came out
|
|
868
|
+
* higher than the one {@link CreateEventParams.eventCount} asked for:
|
|
869
|
+
* the events occupying the slots that were skipped over, in slot
|
|
870
|
+
* order. This is the "report" half of bump-and-report — the write
|
|
871
|
+
* succeeded, and these are the events the writer had not seen when it
|
|
872
|
+
* decided to make it.
|
|
813
873
|
*/
|
|
814
|
-
events
|
|
874
|
+
events: Event[];
|
|
815
875
|
/** Pagination cursor for `events`, matching events.list semantics. */
|
|
816
|
-
cursor
|
|
876
|
+
cursor: string | null;
|
|
817
877
|
/** Whether additional event pages are available for `events`. */
|
|
818
|
-
hasMore
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
stepCreated?: boolean;
|
|
831
|
-
/** Server-owned max event count for the run (run-lifecycle responses); the runtime enforces it. */
|
|
832
|
-
maxEvents?: number;
|
|
833
|
-
}
|
|
878
|
+
hasMore: boolean;
|
|
879
|
+
} | {
|
|
880
|
+
events?: undefined;
|
|
881
|
+
cursor?: undefined;
|
|
882
|
+
hasMore?: undefined;
|
|
883
|
+
}) & (T extends 'run_created' ? {
|
|
884
|
+
run: WorkflowRun;
|
|
885
|
+
} : T extends 'run_started' ? {
|
|
886
|
+
run: StartedWorkflowRun;
|
|
887
|
+
} : T extends 'step_started' ? {
|
|
888
|
+
step: StartedStep;
|
|
889
|
+
} : unknown);
|
|
834
890
|
export interface GetEventParams {
|
|
835
891
|
resolveData?: ResolveData;
|
|
836
892
|
}
|
|
837
893
|
export interface ListEventsParams {
|
|
838
894
|
runId: string;
|
|
895
|
+
/** Omit `limit` to return every remaining event. */
|
|
839
896
|
pagination?: PaginationOptions;
|
|
840
897
|
resolveData?: ResolveData;
|
|
841
898
|
}
|
|
@@ -2,7 +2,7 @@ export type * from './analytics.js';
|
|
|
2
2
|
export { AnalyticsAttributeKeySchema, AnalyticsEventSchema, AnalyticsHookSchema, AnalyticsRunSchema, AnalyticsStepSchema, AnalyticsWaitSchema, } from './analytics.js';
|
|
3
3
|
export type * from './attributes.js';
|
|
4
4
|
export { ATTRIBUTE_KEY_MAX_LENGTH, ATTRIBUTE_MAX_PER_RUN, ATTRIBUTE_VALUE_MAX_BYTES, AttributeChangeSchema, AttributeChangesSchema, AttributeValidationError, applyAttributeChanges, PARENT_RUN_ID_ATTRIBUTE, RESERVED_ATTRIBUTE_KEY_PREFIX, ROOT_RUN_ID_ATTRIBUTE, validateAttributeChanges, validateAttributeKey, validateAttributeValue, } from './attributes.js';
|
|
5
|
-
export { _resetEnvWarnCacheForTests, type EnvNumberOptions, envNumber, } from './env-config.js';
|
|
5
|
+
export { _resetEnvWarnCacheForTests, type EnvNumberOptions, envNumber, getMaxEventsPerRun, } from './env-config.js';
|
|
6
6
|
export type * from './events.js';
|
|
7
7
|
export { BaseEventSchema, CHILD_ENTITY_CREATION_EVENT_TYPES, CreateEventSchema, EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE, EVENT_DATA_REF_FIELDS, EventSchema, EventTypeSchema, getEventDataPayloadField, getEventDataRefFields, HOOK_EVENTS_REQUIRING_EXISTENCE, HOOK_LIFECYCLE_EVENT_TYPES, HookCreatedEventSchema, isChildEntityCreationEvent, isChildEntityCreationEventType, isHookEventRequiringExistence, isHookLifecycleEventType, isRunEventType, isStepEventType, isTerminalRunEventType, isTerminalStepEventType, isWaitEventType, RUN_EVENT_TYPES, STEP_EVENT_TYPES, stripEventDataRefs, TERMINAL_RUN_EVENT_TYPES, TERMINAL_STEP_EVENT_TYPES, TerminalRunEventTypeSchema, WAIT_EVENT_TYPES, } from './events.js';
|
|
8
8
|
export type * from './hooks.js';
|
|
@@ -18,8 +18,9 @@ export { LegacySerializedDataSchemaV1, SerializedDataSchema, } from './serializa
|
|
|
18
18
|
export type * from './shared.js';
|
|
19
19
|
export type { GetChunksOptions, StreamChunk, StreamChunksResponse, StreamInfoResponse, } from './shared.js';
|
|
20
20
|
export { PaginatedResponseSchema, StructuredErrorSchema, } from './shared.js';
|
|
21
|
+
export { EVENT_ID_BODY_LENGTH, EVENT_ID_PREFIX, eventIdToSlot, FIRST_EVENT_SLOT, isSlotBody, isSlotEventId, MAX_EVENT_SLOT, slotToEventId, } from './slot-identity.js';
|
|
21
22
|
export type { SpecVersion } from './spec-version.js';
|
|
22
|
-
export { isLegacySpecVersion, requiresNewerWorld, SPEC_VERSION_CURRENT, SPEC_VERSION_LEGACY, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_COMPRESSION, SPEC_VERSION_SUPPORTS_EVENT_SOURCING, } from './spec-version.js';
|
|
23
|
+
export { isLegacySpecVersion, requiresNewerWorld, SPEC_VERSION_CURRENT, SPEC_VERSION_LEGACY, SPEC_VERSION_MAX_SUPPORTED, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_COMPRESSION, SPEC_VERSION_SUPPORTS_EVENT_SOURCING, SPEC_VERSION_SUPPORTS_SLOT_IDENTITY, } from './spec-version.js';
|
|
23
24
|
export type * from './steps.js';
|
|
24
25
|
export { isTerminalStepStatus, StepSchema, StepStatusSchema, TERMINAL_STEP_STATUSES, TerminalStepStatusSchema, } from './steps.js';
|
|
25
26
|
export type { WorkflowRunId } from './ulid.js';
|
|
@@ -178,7 +178,7 @@ export interface Storage {
|
|
|
178
178
|
* @param params - Optional parameters for event creation
|
|
179
179
|
* @returns Promise resolving to the created event and run entity
|
|
180
180
|
*/
|
|
181
|
-
create(runId: string | null, data:
|
|
181
|
+
create<T extends RunCreatedEventRequest>(runId: string | null, data: T, params?: CreateEventParams): Promise<EventResult<T['eventType']>>;
|
|
182
182
|
/**
|
|
183
183
|
* Create an event for an existing workflow run and atomically update the entity.
|
|
184
184
|
* Returns both the event and the affected entity (run/step/hook).
|
|
@@ -188,7 +188,7 @@ export interface Storage {
|
|
|
188
188
|
* @param params - Optional parameters for event creation
|
|
189
189
|
* @returns Promise resolving to the created event and affected entity
|
|
190
190
|
*/
|
|
191
|
-
create(runId: string, data:
|
|
191
|
+
create<T extends CreateEventRequest>(runId: string, data: T, params?: CreateEventParams): Promise<EventResult<T['eventType']>>;
|
|
192
192
|
get(runId: string, eventId: string, params?: GetEventParams): Promise<Event>;
|
|
193
193
|
list(params: ListEventsParams): Promise<PaginatedResponse<Event>>;
|
|
194
194
|
listByCorrelationId(params: ListEventsByCorrelationIdParams): Promise<PaginatedResponse<Event>>;
|
|
@@ -305,6 +305,29 @@ export interface WorldCapabilities {
|
|
|
305
305
|
* fail ordinary runs after a version bump.
|
|
306
306
|
*/
|
|
307
307
|
deploymentAffinity?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* The World allocates **slot-numbered** event ids: `evnt_` plus the event's
|
|
310
|
+
* dense, 1-based position in its run's log, zero-padded to 26 characters
|
|
311
|
+
* (see `slot-identity.ts`). Two guarantees come with it, and the runtime
|
|
312
|
+
* relies on both:
|
|
313
|
+
*
|
|
314
|
+
* - **Density.** A run's slots are contiguous from 1, so the number of
|
|
315
|
+
* events a reader holds *is* the position of the last one. That is what
|
|
316
|
+
* makes {@link CreateEventParams.eventCount} a complete statement of the
|
|
317
|
+
* writer's snapshot, where the `stateUpdatedAt` / `stateEventCount`
|
|
318
|
+
* watermark pair could only approximate it.
|
|
319
|
+
* - **Bump and report.** A create never fails because its requested slot is
|
|
320
|
+
* taken. The World advances to the next free slot, commits there, and
|
|
321
|
+
* returns the events occupying the slots it skipped over on the success
|
|
322
|
+
* response (see {@link EventResult.events}). The writer learns its
|
|
323
|
+
* snapshot was stale without the write being rejected.
|
|
324
|
+
*
|
|
325
|
+
* A run's scheme is pinned by the run, not by this flag: it is readable off
|
|
326
|
+
* the shape of the run's own first event id, so a World that turns slots on
|
|
327
|
+
* keeps replaying its existing ULID-numbered runs unchanged. The capability
|
|
328
|
+
* only says what *new* runs get.
|
|
329
|
+
*/
|
|
330
|
+
slotEventIds?: boolean;
|
|
308
331
|
}
|
|
309
332
|
/**
|
|
310
333
|
* The "World" interface represents how Workflows are able to communicate with the outside world.
|
|
@@ -332,27 +355,6 @@ export interface World extends Queue, Streamer, Storage {
|
|
|
332
355
|
* "unsupported": runtime optimizations gated on a capability fail closed.
|
|
333
356
|
*/
|
|
334
357
|
capabilities?: WorldCapabilities;
|
|
335
|
-
/**
|
|
336
|
-
* Whether calling `process.exit(1)` from a queue handler is observed by
|
|
337
|
-
* the World as a delivery failure that will be retried.
|
|
338
|
-
*
|
|
339
|
-
* Set to `true` for worlds running inside a managed serverless platform
|
|
340
|
-
* (e.g. `world-vercel`) where the platform fails the invocation when the
|
|
341
|
-
* function process exits non-zero, and the queue redelivers the message
|
|
342
|
-
* via a separate fresh invocation.
|
|
343
|
-
*
|
|
344
|
-
* Set to `false` (the default) for in-process worlds (e.g. `world-local`,
|
|
345
|
-
* dev servers) where calling `process.exit()` would terminate the host
|
|
346
|
-
* process — including the user's `pnpm dev` — without producing a
|
|
347
|
-
* redelivery. Such worlds should instead surface failures via the event
|
|
348
|
-
* log and return normally.
|
|
349
|
-
*
|
|
350
|
-
* The core runtime reads this when deciding how to handle an exhausted
|
|
351
|
-
* replay budget: when `true` it exits so the queue redelivers; when
|
|
352
|
-
* `false` it writes `run_failed` best-effort and returns. See
|
|
353
|
-
* `packages/core/src/runtime/replay-budget.ts`.
|
|
354
|
-
*/
|
|
355
|
-
processExitTriggersQueueRedelivery?: boolean;
|
|
356
358
|
/**
|
|
357
359
|
* Absolute wall-clock time when the current function invocation will be
|
|
358
360
|
* terminated by the hosting platform, if known. Used to optimize runtime behavior.
|
|
@@ -73,6 +73,7 @@ export declare const HookResumeInputSchema: z.ZodObject<{
|
|
|
73
73
|
token: z.ZodString;
|
|
74
74
|
payload: z.ZodUnknown;
|
|
75
75
|
payloadDigest: z.ZodString;
|
|
76
|
+
deploymentId: z.ZodOptional<z.ZodString>;
|
|
76
77
|
}, z.core.$strip>;
|
|
77
78
|
export type HookResumeInput = z.infer<typeof HookResumeInputSchema>;
|
|
78
79
|
export declare const WorkflowInvokePayloadSchema: z.ZodObject<{
|
|
@@ -104,6 +105,7 @@ export declare const WorkflowInvokePayloadSchema: z.ZodObject<{
|
|
|
104
105
|
token: z.ZodString;
|
|
105
106
|
payload: z.ZodUnknown;
|
|
106
107
|
payloadDigest: z.ZodString;
|
|
108
|
+
deploymentId: z.ZodOptional<z.ZodString>;
|
|
107
109
|
}, z.core.$strip>>;
|
|
108
110
|
}, z.core.$strip>;
|
|
109
111
|
export type WorkflowInvokePayload = z.infer<typeof WorkflowInvokePayloadSchema>;
|
|
@@ -167,6 +169,7 @@ export declare const QueuePayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
167
169
|
token: z.ZodString;
|
|
168
170
|
payload: z.ZodUnknown;
|
|
169
171
|
payloadDigest: z.ZodString;
|
|
172
|
+
deploymentId: z.ZodOptional<z.ZodString>;
|
|
170
173
|
}, z.core.$strip>>;
|
|
171
174
|
}, z.core.$strip>]>;
|
|
172
175
|
export type QueuePayload = z.infer<typeof QueuePayloadSchema>;
|
|
@@ -211,6 +214,7 @@ export interface Queue {
|
|
|
211
214
|
}>;
|
|
212
215
|
/**
|
|
213
216
|
* Creates an HTTP queue handler for processing messages from a specific queue.
|
|
217
|
+
* A rejected handler must retry the same message with an incremented attempt.
|
|
214
218
|
*
|
|
215
219
|
* `meta.messageId` SHOULD be stable across redeliveries of the same message
|
|
216
220
|
* (one ID per enqueued message, reused on every delivery attempt). The
|
|
@@ -127,6 +127,10 @@ export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
127
127
|
completedAt: z.ZodCoercedDate<unknown>;
|
|
128
128
|
}, z.core.$strip>], "status">;
|
|
129
129
|
export type WorkflowRun = z.infer<typeof WorkflowRunSchema>;
|
|
130
|
+
/** A workflow run with its first start time materialized. */
|
|
131
|
+
export type StartedWorkflowRun = WorkflowRun & {
|
|
132
|
+
startedAt: Date;
|
|
133
|
+
};
|
|
130
134
|
/**
|
|
131
135
|
* WorkflowRun with input/output fields excluded (when resolveData='none').
|
|
132
136
|
* Used for listing runs without fetching the full serialized data.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slot-based event identity.
|
|
3
|
+
*
|
|
4
|
+
* An event id is `evnt_` followed by 26 characters. Historically that body was
|
|
5
|
+
* a ULID; a World that allocates *slots* instead writes the event's dense
|
|
6
|
+
* 1-based position in its run's log, as a zero-padded decimal.
|
|
7
|
+
*
|
|
8
|
+
* The padding is what makes this a drop-in change rather than a format break.
|
|
9
|
+
* Decimal digits are a subset of Crockford base32, and every id is still
|
|
10
|
+
* exactly 26 characters, so existing ULID validators accept a slot id,
|
|
11
|
+
* lexicographic ordering still matches creation order (fixed width, so string
|
|
12
|
+
* order is numeric order), and `eid:` cursors and range fences keep working
|
|
13
|
+
* untouched.
|
|
14
|
+
*
|
|
15
|
+
* The one thing that does *not* survive: a slot id's leading characters are
|
|
16
|
+
* zeros, so decoding it as a ULID timestamp yields the Unix epoch. Nothing may
|
|
17
|
+
* derive a time from an event id without first ruling out a slot id — see
|
|
18
|
+
* {@link isSlotBody} and the guard in `ulidToDate`.
|
|
19
|
+
*/
|
|
20
|
+
/** Characters in an event id body, ULID or slot alike. */
|
|
21
|
+
export declare const EVENT_ID_BODY_LENGTH = 26;
|
|
22
|
+
/** First slot in a run's log. Slots are 1-based and dense. */
|
|
23
|
+
export declare const FIRST_EVENT_SLOT = 1;
|
|
24
|
+
/**
|
|
25
|
+
* Largest representable slot. Bounded by JavaScript's safe-integer range
|
|
26
|
+
* rather than by the 16 significant digits the format allows, so a parsed slot
|
|
27
|
+
* is always exact.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MAX_EVENT_SLOT: number;
|
|
30
|
+
/** Canonical prefix for event ids. */
|
|
31
|
+
export declare const EVENT_ID_PREFIX = "evnt_";
|
|
32
|
+
/**
|
|
33
|
+
* Whether a 26-character event id *body* is a slot rather than a ULID.
|
|
34
|
+
*
|
|
35
|
+
* Takes the body, not the prefixed id, because the same test applies to event
|
|
36
|
+
* ids however they are spelled (`evnt_`, the legacy `wevt_`, or bare).
|
|
37
|
+
*/
|
|
38
|
+
export declare function isSlotBody(body: string): boolean;
|
|
39
|
+
/** Whether a (possibly prefixed) event id is slot-numbered. */
|
|
40
|
+
export declare function isSlotEventId(eventId: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Formats a slot as a prefixed event id.
|
|
43
|
+
*
|
|
44
|
+
* @throws if the slot is outside the representable range — a caller that
|
|
45
|
+
* overflows must fail loudly rather than mint an id that sorts wrong.
|
|
46
|
+
*/
|
|
47
|
+
export declare function slotToEventId(slot: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* Reads the slot out of a (possibly prefixed) event id, or null when the id is
|
|
50
|
+
* not slot-numbered.
|
|
51
|
+
*/
|
|
52
|
+
export declare function eventIdToSlot(eventId: string): number | null;
|
|
53
|
+
//# sourceMappingURL=slot-identity.d.ts.map
|
|
@@ -26,11 +26,46 @@ export declare const SPEC_VERSION_SUPPORTS_ATTRIBUTES: SpecVersion;
|
|
|
26
26
|
* `requiresNewerWorld()` instead of failing on individual payloads.
|
|
27
27
|
*/
|
|
28
28
|
export declare const SPEC_VERSION_SUPPORTS_COMPRESSION: SpecVersion;
|
|
29
|
+
/**
|
|
30
|
+
* Runs at this spec version get slot-numbered event ids: `evnt_` followed by a
|
|
31
|
+
* zero-padded decimal position, dense and contiguous from 1 within one run.
|
|
32
|
+
*
|
|
33
|
+
* This exists for Worlds that cannot read a run's scheme off its own storage.
|
|
34
|
+
* `world-local` and `world-postgres` own the counter that mints the ids, so
|
|
35
|
+
* they know per run which scheme it started under. `world-vercel` writes
|
|
36
|
+
* through an API whose allocator has to make that decision on each request,
|
|
37
|
+
* and the spec version stamped on `run_created` is what carries it. A run
|
|
38
|
+
* created before the backend adopted slots stays on ULIDs for its whole life
|
|
39
|
+
* because its stamped version is below this one.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SPEC_VERSION_SUPPORTS_SLOT_IDENTITY: SpecVersion;
|
|
29
42
|
/**
|
|
30
43
|
* Current spec version (event-sourced architecture with native attributes
|
|
31
44
|
* and compressed payloads).
|
|
45
|
+
*
|
|
46
|
+
* Deliberately NOT bumped for slot-numbered event ids. Slot numbering is a
|
|
47
|
+
* property of a run's whole log rather than of an individual event, and it is
|
|
48
|
+
* already self-describing: a run's scheme is readable from the shape of its
|
|
49
|
+
* own first event id (see `isSlotEventId`), so a World that owns its own id
|
|
50
|
+
* allocation needs no version negotiation to pin one. Bumping this constant
|
|
51
|
+
* would stamp the new version on every World
|
|
52
|
+
* including ones that have not adopted slots yet, which is exactly the
|
|
53
|
+
* cross-version breakage the pin exists to avoid. A World that does allocate
|
|
54
|
+
* slots declares the higher version itself (see `world-vercel`), and
|
|
55
|
+
* `SPEC_VERSION_MAX_SUPPORTED` is what keeps this reader from rejecting the
|
|
56
|
+
* runs it produces.
|
|
32
57
|
*/
|
|
33
58
|
export declare const SPEC_VERSION_CURRENT: SpecVersion;
|
|
59
|
+
/**
|
|
60
|
+
* The highest spec version this SDK can read.
|
|
61
|
+
*
|
|
62
|
+
* Distinct from `SPEC_VERSION_CURRENT`, which is the *default* a World stamps
|
|
63
|
+
* on runs it creates. A World may declare a higher version than the default,
|
|
64
|
+
* so the "was this run made by a newer SDK?" test has to be against the
|
|
65
|
+
* ceiling: comparing against the default would make the SDK reject runs its
|
|
66
|
+
* own adapters just created.
|
|
67
|
+
*/
|
|
68
|
+
export declare const SPEC_VERSION_MAX_SUPPORTED: SpecVersion;
|
|
34
69
|
/**
|
|
35
70
|
* Check if a spec version is legacy (<= SPEC_VERSION_LEGACY or undefined).
|
|
36
71
|
* Legacy runs require different handling - they use direct entity mutation
|
|
@@ -45,7 +80,7 @@ export declare const SPEC_VERSION_CURRENT: SpecVersion;
|
|
|
45
80
|
*/
|
|
46
81
|
export declare function isLegacySpecVersion(v: number | undefined | null): boolean;
|
|
47
82
|
/**
|
|
48
|
-
* Check if a spec version requires a newer world (>
|
|
83
|
+
* Check if a spec version requires a newer world (> SPEC_VERSION_MAX_SUPPORTED).
|
|
49
84
|
* This happens when a run was created by a newer SDK version.
|
|
50
85
|
*
|
|
51
86
|
* @param v - The spec version number, or undefined/null for legacy runs
|
|
@@ -47,6 +47,10 @@ export type TerminalStepStatus = z.infer<typeof TerminalStepStatusSchema>;
|
|
|
47
47
|
export declare const TERMINAL_STEP_STATUSES: ("completed" | "failed" | "cancelled")[];
|
|
48
48
|
export declare function isTerminalStepStatus(status: string): status is TerminalStepStatus;
|
|
49
49
|
export type Step = z.infer<typeof StepSchema>;
|
|
50
|
+
/** A step with its first start time materialized. */
|
|
51
|
+
export type StartedStep = Step & {
|
|
52
|
+
startedAt: Date;
|
|
53
|
+
};
|
|
50
54
|
/**
|
|
51
55
|
* Step with input/output fields excluded (when resolveData='none').
|
|
52
56
|
* Used for listing steps without fetching the full serialized data.
|
|
@@ -26,6 +26,12 @@ export declare const DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS: number;
|
|
|
26
26
|
export declare const DEFAULT_TIMESTAMP_THRESHOLD_MS: number;
|
|
27
27
|
/**
|
|
28
28
|
* Extracts a Date from a ULID string, or null if the string is not a valid ULID.
|
|
29
|
+
*
|
|
30
|
+
* A slot-numbered event id is syntactically a valid ULID (26 zero-padded
|
|
31
|
+
* decimal digits are all Crockford characters) whose timestamp component is
|
|
32
|
+
* zero, so decoding one would silently yield the Unix epoch. Slots carry no
|
|
33
|
+
* time at all, so this returns null for them and callers fall back to a real
|
|
34
|
+
* `createdAt`. See `slot-identity.ts`.
|
|
29
35
|
*/
|
|
30
36
|
export declare function ulidToDate(maybeUlid: string): Date | null;
|
|
31
37
|
/**
|