@powerhousedao/switchboard 6.2.3-dev.84 → 6.2.3-dev.86

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.
Files changed (72) hide show
  1. package/.tsbuild/test/ai-gateway.test.d.ts +2 -0
  2. package/.tsbuild/test/ai-gateway.test.d.ts.map +1 -0
  3. package/.tsbuild/test/keyframe-reclaim-store.test.d.ts +2 -0
  4. package/.tsbuild/test/keyframe-reclaim-store.test.d.ts.map +1 -0
  5. package/.tsbuild/test/processor-timing-log.test.d.ts +2 -0
  6. package/.tsbuild/test/processor-timing-log.test.d.ts.map +1 -0
  7. package/.tsbuild/test/workflow/waitpoint-routes.test.d.ts +2 -0
  8. package/.tsbuild/test/workflow/waitpoint-routes.test.d.ts.map +1 -0
  9. package/.tsbuild/test/workflow/waitpoint-runtime.test.d.ts +2 -0
  10. package/.tsbuild/test/workflow/waitpoint-runtime.test.d.ts.map +1 -0
  11. package/.tsbuild/tsconfig.tsbuildinfo +1 -1
  12. package/CHANGELOG.md +33 -0
  13. package/README.md +33 -0
  14. package/dist/boot.d.mts +1 -1
  15. package/dist/boot.mjs +1 -1
  16. package/dist/config/from-env.d.mts +1 -1
  17. package/dist/config/from-env.d.mts.map +1 -1
  18. package/dist/config/from-env.mjs +3 -3
  19. package/dist/config/schema.d.mts +1 -1
  20. package/dist/config/schema.mjs +3 -3
  21. package/dist/{from-env-BO0n9R02.mjs → from-env-BgyZQAxw.mjs} +79 -7
  22. package/dist/from-env-BgyZQAxw.mjs.map +1 -0
  23. package/dist/index.mjs +13 -10
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/{plugin-host-C1sYEm8g.d.mts → plugin-host-C0bSz1Oe.d.mts} +2 -2
  26. package/dist/{plugin-host-C1sYEm8g.d.mts.map → plugin-host-C0bSz1Oe.d.mts.map} +1 -1
  27. package/dist/plugins/ai.d.mts +37 -0
  28. package/dist/plugins/ai.d.mts.map +1 -0
  29. package/dist/plugins/ai.mjs +352 -0
  30. package/dist/plugins/ai.mjs.map +1 -0
  31. package/dist/plugins/attachments.d.mts +1 -1
  32. package/dist/plugins/attachments.mjs +3 -3
  33. package/dist/plugins/mcp.d.mts +1 -1
  34. package/dist/plugins/privacy.d.mts +1 -1
  35. package/dist/plugins/workflows.d.mts +2 -2
  36. package/dist/plugins/workflows.mjs +3 -3
  37. package/dist/{schema-ivUWPQOn.d.mts → schema-DhempFjb.d.mts} +41 -1
  38. package/dist/schema-DhempFjb.d.mts.map +1 -0
  39. package/dist/{schema-0g_QdOWn.mjs → schema-XEZrdmag.mjs} +55 -6
  40. package/dist/schema-XEZrdmag.mjs.map +1 -0
  41. package/dist/{server-B3qhPKNn.mjs → server-BRVMofWD.mjs} +102 -14
  42. package/dist/server-BRVMofWD.mjs.map +1 -0
  43. package/dist/server.d.mts +7 -3
  44. package/dist/server.d.mts.map +1 -1
  45. package/dist/server.mjs +5 -5
  46. package/dist/{workflow-runtime-7GaJ13c9.d.mts → workflow-runtime-CF5pc8mt.d.mts} +5 -2
  47. package/dist/workflow-runtime-CF5pc8mt.d.mts.map +1 -0
  48. package/dist/{workflows-B1VsL5Lo.mjs → workflows-C_pWcP2u.mjs} +446 -9
  49. package/dist/workflows-C_pWcP2u.mjs.map +1 -0
  50. package/package.json +22 -16
  51. package/test/ai-gateway.test.ts +555 -0
  52. package/test/config-from-env.test.ts +184 -0
  53. package/test/config-schema.test.ts +28 -0
  54. package/test/goldens/packages.graphql +1 -1
  55. package/test/goldens/privacy.graphql +1 -1
  56. package/test/goldens/reactor-drive-nodes.graphql +1 -1
  57. package/test/goldens/resolvers.json +4 -0
  58. package/test/goldens/supergraph.graphql +217 -1
  59. package/test/goldens/workflow-runtime.graphql +95 -1
  60. package/test/keyframe-reclaim-store.test.ts +156 -0
  61. package/test/processor-timing-log.test.ts +109 -0
  62. package/test/redact-webhook-path.test.ts +9 -0
  63. package/test/workflow/resolvers.test.ts +106 -0
  64. package/test/workflow/waitpoint-routes.test.ts +284 -0
  65. package/test/workflow/waitpoint-runtime.test.ts +204 -0
  66. package/tsdown.config.ts +1 -0
  67. package/dist/from-env-BO0n9R02.mjs.map +0 -1
  68. package/dist/schema-0g_QdOWn.mjs.map +0 -1
  69. package/dist/schema-ivUWPQOn.d.mts.map +0 -1
  70. package/dist/server-B3qhPKNn.mjs.map +0 -1
  71. package/dist/workflow-runtime-7GaJ13c9.d.mts.map +0 -1
  72. package/dist/workflows-B1VsL5Lo.mjs.map +0 -1
@@ -17,6 +17,7 @@ import { resolveAttachmentUrlSigning } from "../src/attachments/url-signer.js";
17
17
  import { reactorDbUrlOf } from "../src/boot-preconditions.mjs";
18
18
  import { switchboardConfigFromEnv } from "../src/config/from-env.js";
19
19
  import {
20
+ mergeSwitchboardConfig,
20
21
  switchboardConfigSchema,
21
22
  type SwitchboardConfig,
22
23
  } from "../src/config/schema.js";
@@ -85,6 +86,25 @@ const KEYS = [
85
86
  "REACTOR_LEGACY_PROCESSOR_IDS",
86
87
  "MAX_SKIP_THRESHOLD",
87
88
  "PH_CATCH_UP_PRIORITY",
89
+ "PH_TELEMETRY",
90
+ "PH_TELEMETRY_DIR",
91
+ "PH_PROCESSOR_TIMING",
92
+ "PH_PROCESSOR_TIMING_WINDOW_MS",
93
+ "PH_PROCESSOR_SLOW_BATCH_MS",
94
+ "PH_PROCESSOR_TIMING_LOG_MS",
95
+ "PH_MEMORY_TELEMETRY",
96
+ "PH_MEMORY_TELEMETRY_INTERVAL_MS",
97
+ "PH_MEMORY_TELEMETRY_OUTPUT",
98
+ "PH_MEMORY_TELEMETRY_FILE",
99
+ "PH_MEMORY_TELEMETRY_FILE_MAX_MB",
100
+ "PH_MEMORY_TELEMETRY_FILE_KEEP",
101
+ "PH_MEMORY_TELEMETRY_RING",
102
+ "PH_MEMORY_TELEMETRY_CONSOLE",
103
+ "PH_MEMORY_TELEMETRY_CONSOLE_INTERVAL_MS",
104
+ "PH_MEMORY_TELEMETRY_WORKERS",
105
+ "PH_MEMORY_TELEMETRY_WINDOW_MIN",
106
+ "PH_HEAP_SNAPSHOT_DIR",
107
+ "PH_KEYFRAMES",
88
108
  "AUTH_ENABLED",
89
109
  "RESOLVE_CALLER_IDENTITY",
90
110
  "REQUIRE_AUTHENTICATED_CALLER",
@@ -617,6 +637,94 @@ describe("switchboardConfigFromEnv errors", () => {
617
637
  });
618
638
  });
619
639
 
640
+ describe("switchboardConfigFromEnv telemetry", () => {
641
+ const layer = (env: Env) => switchboardConfigFromEnv(env, { logger: silent });
642
+
643
+ it("maps the processor timing settings", () => {
644
+ expect(
645
+ layer({
646
+ PH_PROCESSOR_TIMING: "detailed",
647
+ PH_PROCESSOR_TIMING_WINDOW_MS: "120000",
648
+ PH_PROCESSOR_SLOW_BATCH_MS: "250",
649
+ PH_PROCESSOR_TIMING_LOG_MS: "60000",
650
+ }).protocol,
651
+ ).toEqual({
652
+ processorTiming: "detailed",
653
+ processorTimingWindowMs: 120_000,
654
+ processorSlowBatchMs: 250,
655
+ processorTimingLogMs: 60_000,
656
+ });
657
+ });
658
+
659
+ it("maps the memory telemetry settings", () => {
660
+ expect(
661
+ layer({
662
+ PH_MEMORY_TELEMETRY: "on",
663
+ PH_MEMORY_TELEMETRY_INTERVAL_MS: "5000",
664
+ PH_MEMORY_TELEMETRY_OUTPUT: "file,console",
665
+ PH_MEMORY_TELEMETRY_FILE_MAX_MB: "20",
666
+ PH_MEMORY_TELEMETRY_FILE_KEEP: "3",
667
+ PH_MEMORY_TELEMETRY_RING: "100",
668
+ PH_MEMORY_TELEMETRY_CONSOLE_INTERVAL_MS: "60000",
669
+ PH_MEMORY_TELEMETRY_WORKERS: "false",
670
+ PH_MEMORY_TELEMETRY_WINDOW_MIN: "10",
671
+ PH_HEAP_SNAPSHOT_DIR: "/snapshots",
672
+ }).telemetry,
673
+ ).toEqual({
674
+ memory: {
675
+ enabled: true,
676
+ intervalMs: 5000,
677
+ outputs: ["memory", "file", "console"],
678
+ file: { maxMb: 20, keep: 3 },
679
+ ringSize: 100,
680
+ consoleIntervalMs: 60_000,
681
+ workers: false,
682
+ windowMin: 10,
683
+ },
684
+ heapSnapshotDir: "/snapshots",
685
+ });
686
+ });
687
+
688
+ it("leaves the telemetry block out with nothing set", () => {
689
+ expect(layer({}).telemetry).toBeUndefined();
690
+ });
691
+
692
+ it("drops the console output when told to", () => {
693
+ expect(
694
+ layer({
695
+ PH_MEMORY_TELEMETRY_OUTPUT: "console,file",
696
+ PH_MEMORY_TELEMETRY_CONSOLE: "false",
697
+ }).telemetry?.memory?.outputs,
698
+ ).toEqual(["memory", "file"]);
699
+ });
700
+
701
+ it("adds the file output for an explicit path", () => {
702
+ expect(
703
+ layer({
704
+ PH_MEMORY_TELEMETRY_OUTPUT: "memory",
705
+ PH_MEMORY_TELEMETRY_FILE: "/x/memory.jsonl",
706
+ }).telemetry?.memory,
707
+ ).toEqual({
708
+ outputs: ["memory", "file"],
709
+ file: { path: "/x/memory.jsonl" },
710
+ });
711
+ });
712
+
713
+ it("lets PH_TELEMETRY=off win over both switches", () => {
714
+ const off = layer({
715
+ PH_TELEMETRY: "off",
716
+ PH_PROCESSOR_TIMING: "detailed",
717
+ PH_MEMORY_TELEMETRY: "on",
718
+ });
719
+ expect(off.protocol?.processorTiming).toBe("off");
720
+ expect(off.telemetry?.memory?.enabled).toBe(false);
721
+ });
722
+
723
+ it("carries the shared telemetry directory", () => {
724
+ expect(layer({ PH_TELEMETRY_DIR: "/t" }).telemetry?.dir).toBe("/t");
725
+ });
726
+ });
727
+
620
728
  describe("switchboardConfigFromEnv warnings", () => {
621
729
  it.each<
622
730
  [
@@ -630,6 +738,27 @@ describe("switchboardConfigFromEnv warnings", () => {
630
738
  { PH_CATCH_UP_PRIORITY: "fast" },
631
739
  (l) => l.protocol,
632
740
  ],
741
+ ["PH_PROCESSOR_TIMING", { PH_PROCESSOR_TIMING: "full" }, (l) => l.protocol],
742
+ [
743
+ "PH_PROCESSOR_TIMING_WINDOW_MS",
744
+ { PH_PROCESSOR_TIMING_WINDOW_MS: "0" },
745
+ (l) => l.protocol,
746
+ ],
747
+ [
748
+ "PH_MEMORY_TELEMETRY",
749
+ { PH_MEMORY_TELEMETRY: "maybe" },
750
+ (l) => l.telemetry,
751
+ ],
752
+ [
753
+ "PH_MEMORY_TELEMETRY_OUTPUT",
754
+ { PH_MEMORY_TELEMETRY_OUTPUT: "memory,otel" },
755
+ (l) => l.telemetry,
756
+ ],
757
+ [
758
+ "PH_MEMORY_TELEMETRY_INTERVAL_MS",
759
+ { PH_MEMORY_TELEMETRY_INTERVAL_MS: "soon" },
760
+ (l) => l.telemetry,
761
+ ],
633
762
  ["GATEWAY_ADAPTER", { GATEWAY_ADAPTER: "nginx" }, (l) => l.server],
634
763
  ["LOG_LEVEL", { LOG_LEVEL: "INFO" }, (l) => l.logLevel],
635
764
  ["PORT", { PORT: "http" }, (l) => l.server],
@@ -756,3 +885,58 @@ describe("switchboardConfigFromEnv for the bin", () => {
756
885
  expect(switchboardConfigFromEnv(env, { logger: silent })).toEqual({});
757
886
  });
758
887
  });
888
+
889
+ describe("PH_KEYFRAMES", () => {
890
+ it("leaves keyframes unset without it", () => {
891
+ expect(switchboardConfigFromEnv({}).storage?.keyframes).toBeUndefined();
892
+ expect(
893
+ switchboardConfigFromEnv({ PH_KEYFRAMES: " " }).storage?.keyframes,
894
+ ).toBeUndefined();
895
+ });
896
+
897
+ it("reads the rules", () => {
898
+ const rules = {
899
+ default: { interval: 10, keep: 4 },
900
+ types: { "a/b": { interval: 50, keep: 1 }, "a/c": { keep: null } },
901
+ };
902
+
903
+ const config = switchboardConfigFromEnv({
904
+ PH_KEYFRAMES: JSON.stringify(rules),
905
+ });
906
+
907
+ expect(config.storage?.keyframes).toEqual(rules);
908
+ expect(switchboardConfigSchema.parse(config).storage.keyframes).toEqual(
909
+ rules,
910
+ );
911
+ });
912
+
913
+ it("stops the boot on JSON it cannot read", () => {
914
+ expect(() =>
915
+ switchboardConfigFromEnv({ PH_KEYFRAMES: "{keep:1}" }),
916
+ ).toThrow("PH_KEYFRAMES is not valid JSON");
917
+ });
918
+
919
+ it("stops the boot on a rule it cannot use", () => {
920
+ expect(() =>
921
+ switchboardConfigFromEnv({
922
+ PH_KEYFRAMES: JSON.stringify({ default: { keep: 0 } }),
923
+ }),
924
+ ).toThrow("PH_KEYFRAMES.default.keep");
925
+ });
926
+
927
+ it("is replaced whole by a later layer", () => {
928
+ const merged = mergeSwitchboardConfig(
929
+ {
930
+ storage: {
931
+ keyframes: {
932
+ default: { keep: 4 },
933
+ types: { "a/b": { keep: 1 } },
934
+ },
935
+ },
936
+ },
937
+ { storage: { keyframes: { default: { keep: 2 } } } },
938
+ );
939
+
940
+ expect(merged.storage?.keyframes).toEqual({ default: { keep: 2 } });
941
+ });
942
+ });
@@ -35,6 +35,22 @@ describe("switchboardConfigSchema", () => {
35
35
  unsupportedStoredDocuments: "refuse",
36
36
  legacyProcessorIds: true,
37
37
  catchUpPriority: "dynamic",
38
+ processorTiming: "basic",
39
+ processorTimingWindowMs: 60_000,
40
+ processorSlowBatchMs: 1_000,
41
+ processorTimingLogMs: 0,
42
+ });
43
+ expect(config.telemetry).toEqual({
44
+ memory: {
45
+ enabled: false,
46
+ intervalMs: 30_000,
47
+ outputs: ["memory", "file"],
48
+ file: { maxMb: 10, keep: 5 },
49
+ ringSize: 720,
50
+ consoleIntervalMs: 300_000,
51
+ workers: true,
52
+ windowMin: 30,
53
+ },
38
54
  });
39
55
  expect(config.workers).toEqual({
40
56
  executor: { count: 0, poolSize: 2, acquireTimeoutMs: 5000 },
@@ -75,6 +91,18 @@ describe("switchboardConfigSchema", () => {
75
91
  ["a fractional worker count", { workers: { executor: { count: 1.5 } } }],
76
92
  ["a host pool of 0", { workers: { hostPoolSize: 0 } }],
77
93
  ["a catch-up level above 7", { protocol: { catchUpPriority: 8 } }],
94
+ [
95
+ "an unknown timing level",
96
+ { protocol: { processorTiming: "full" as never } },
97
+ ],
98
+ [
99
+ "a sampling interval under a second",
100
+ { telemetry: { memory: { intervalMs: 10 } } },
101
+ ],
102
+ [
103
+ "an unknown memory output",
104
+ { telemetry: { memory: { outputs: ["otel" as never] } } },
105
+ ],
78
106
  [
79
107
  "an unknown signature policy",
80
108
  { protocol: { createSignaturePolicy: "v3" as "legacy" } },
@@ -664,7 +664,7 @@ type Workflow_WorkflowPolicy {
664
664
  """
665
665
  runTimeoutSeconds: Int!
666
666
  """
667
- NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.
667
+ Bounds how long a run may stay suspended on a waitpoint: a waitpoint expires this long after it is created, ending the run CANCELLED with WaitpointExpired. A Delay longer than this is refused.
668
668
  """
669
669
  maxSuspensionDays: Int!
670
670
  """
@@ -720,7 +720,7 @@ type Workflow_WorkflowPolicy {
720
720
  """
721
721
  runTimeoutSeconds: Int!
722
722
  """
723
- NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.
723
+ Bounds how long a run may stay suspended on a waitpoint: a waitpoint expires this long after it is created, ending the run CANCELLED with WaitpointExpired. A Delay longer than this is refused.
724
724
  """
725
725
  maxSuspensionDays: Int!
726
726
  """
@@ -694,7 +694,7 @@ type Workflow_WorkflowPolicy {
694
694
  """
695
695
  runTimeoutSeconds: Int!
696
696
  """
697
- NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.
697
+ Bounds how long a run may stay suspended on a waitpoint: a waitpoint expires this long after it is created, ending the run CANCELLED with WaitpointExpired. A Delay longer than this is refused.
698
698
  """
699
699
  maxSuspensionDays: Int!
700
700
  """
@@ -281,6 +281,8 @@
281
281
  "Upload.parseLiteral",
282
282
  "Upload.parseValue",
283
283
  "Upload.serialize",
284
+ "WorkflowRunRecord.waitpoints",
285
+ "WorkflowRuntimeMutations.cancelRun",
284
286
  "WorkflowRuntimeMutations.cancelTriggerTest",
285
287
  "WorkflowRuntimeMutations.checkConnection",
286
288
  "WorkflowRuntimeMutations.createSecret",
@@ -288,6 +290,7 @@
288
290
  "WorkflowRuntimeMutations.fire",
289
291
  "WorkflowRuntimeMutations.pollNow",
290
292
  "WorkflowRuntimeMutations.rerun",
293
+ "WorkflowRuntimeMutations.resolveWaitpoint",
291
294
  "WorkflowRuntimeMutations.rotateSecret",
292
295
  "WorkflowRuntimeMutations.startOAuth",
293
296
  "WorkflowRuntimeMutations.testStep",
@@ -318,6 +321,7 @@
318
321
  "WorkflowRuntimeQueries.secrets",
319
322
  "WorkflowRuntimeQueries.stepOutputTree",
320
323
  "WorkflowRuntimeQueries.triggerStates",
324
+ "WorkflowRuntimeQueries.waitingRuns",
321
325
  "WorkflowRuntimeQueries.webhookEndpoint"
322
326
  ]
323
327
  }
@@ -169,6 +169,27 @@ type AnalyticsSeriesDimension {
169
169
  icon: String
170
170
  }
171
171
 
172
+ """
173
+ Who may decide an approval, and how the editor renders it.
174
+ """
175
+ type ApprovalRequest {
176
+ title: String!
177
+ """
178
+ Markdown.
179
+ """
180
+ body: String
181
+ approveLabel: String!
182
+ rejectLabel: String!
183
+ """
184
+ none | reject | both
185
+ """
186
+ reasonRequiredOn: String!
187
+ """
188
+ DIDs allowed to decide; empty means anyone with write access.
189
+ """
190
+ approvers: [String!]!
191
+ }
192
+
172
193
  scalar AttachmentRef
173
194
 
174
195
  enum AuthDecision {
@@ -2561,6 +2582,22 @@ type InspectionMailboxDepths {
2561
2582
  deadLetter: Int!
2562
2583
  }
2563
2584
 
2585
+ """
2586
+ Memory samples correlated with operations processed. samples are newest
2587
+ last; summary holds the rates over the correlation window and is null until
2588
+ two samples exist.
2589
+ """
2590
+ type InspectionMemoryTelemetry {
2591
+ enabled: Boolean!
2592
+ intervalMs: Float!
2593
+ consoleIntervalMs: Float!
2594
+ outputs: [String!]!
2595
+ file: String
2596
+ startedAt: String
2597
+ summary: JSONObject
2598
+ samples: [JSONObject!]!
2599
+ }
2600
+
2564
2601
  type InspectionProcessor {
2565
2602
  processorId: String!
2566
2603
  factoryId: String!
@@ -2576,6 +2613,107 @@ type InspectionProcessor {
2576
2613
  phase: String!
2577
2614
  }
2578
2615
 
2616
+ type InspectionProcessorQueueDepth {
2617
+ tasks: Float!
2618
+ ops: Float!
2619
+ }
2620
+
2621
+ """
2622
+ One processor's timing. The horizons are null while timing is off.
2623
+ """
2624
+ type InspectionProcessorTiming {
2625
+ processorId: String!
2626
+ name: String!
2627
+ driveLabel: String!
2628
+ factoryId: String!
2629
+ driveId: String!
2630
+ phase: String!
2631
+ lastOrdinal: Float!
2632
+ queueDepth: InspectionProcessorQueueDepth!
2633
+ ordinalsBehind: Float!
2634
+ opsPerSecond: Float!
2635
+ ordinalsPerSecond: Float!
2636
+ etaMs: Float
2637
+ sinceUtcMs: Float
2638
+ total: InspectionProcessorTimingHorizon
2639
+ window: InspectionProcessorTimingHorizon
2640
+ windowMs: Float!
2641
+ currentRun: InspectionProcessorTimingRun
2642
+ lastRun: InspectionProcessorTimingLastRun
2643
+ lastBatch: InspectionProcessorTimingBatch
2644
+ byDocumentType: [InspectionProcessorTimingDocumentType!]!
2645
+ }
2646
+
2647
+ type InspectionProcessorTimingBatch {
2648
+ atUtcMs: Float!
2649
+ path: String!
2650
+ ops: Float!
2651
+ ms: Float!
2652
+ fromOrdinal: Float!
2653
+ toOrdinal: Float!
2654
+ }
2655
+
2656
+ """
2657
+ One path's numbers over one horizon. Times are wall-clock milliseconds the
2658
+ processor's queue awaited, not CPU; read time includes waiting for the store.
2659
+ slotWaitMs and pauseMs are throttling and count toward no busy time.
2660
+ """
2661
+ type InspectionProcessorTimingCounters {
2662
+ batches: Float!
2663
+ opsDelivered: Float!
2664
+ opsScanned: Float!
2665
+ opsMatched: Float!
2666
+ pages: Float!
2667
+ handlerMs: Float!
2668
+ maxBatchMs: Float!
2669
+ readMs: Float!
2670
+ lookupMs: Float!
2671
+ fillMs: Float!
2672
+ slotWaitMs: Float!
2673
+ pauseMs: Float!
2674
+ errors: Float!
2675
+ }
2676
+
2677
+ type InspectionProcessorTimingDocumentType {
2678
+ documentType: String!
2679
+ ops: Float!
2680
+ handlerMs: Float!
2681
+ }
2682
+
2683
+ type InspectionProcessorTimingHorizon {
2684
+ live: InspectionProcessorTimingCounters!
2685
+ replay: InspectionProcessorTimingCounters!
2686
+ ordinalsAdvanced: Float!
2687
+ busyMs: Float!
2688
+ }
2689
+
2690
+ type InspectionProcessorTimingLastRun {
2691
+ startedAtUtcMs: Float!
2692
+ durationMs: Float!
2693
+ ordinals: Float!
2694
+ opsDelivered: Float!
2695
+ busyMs: Float!
2696
+ }
2697
+
2698
+ """
2699
+ level is off, basic or detailed. Without a catch-up status, head is the
2700
+ highest cursor and headKnown is false.
2701
+ """
2702
+ type InspectionProcessorTimingReport {
2703
+ level: String!
2704
+ windowMs: Float!
2705
+ head: Float!
2706
+ headKnown: Boolean!
2707
+ processors: [InspectionProcessorTiming!]!
2708
+ }
2709
+
2710
+ type InspectionProcessorTimingRun {
2711
+ startedAtUtcMs: Float!
2712
+ runFrom: Float!
2713
+ counters: InspectionProcessorTimingCounters!
2714
+ ordinalsAdvanced: Float!
2715
+ }
2716
+
2579
2717
  """
2580
2718
  A queued job without its actions or operations.
2581
2719
  """
@@ -3938,6 +4076,11 @@ type ReactorInspection {
3938
4076
  attachmentInfo: InspectionAttachmentInfo!
3939
4077
  queueState: InspectionQueueState!
3940
4078
  processors: [InspectionProcessor!]!
4079
+ processorTiming: InspectionProcessorTimingReport!
4080
+ """
4081
+ Refused on a host without memory telemetry.
4082
+ """
4083
+ memoryTelemetry(limit: Int, sinceIso: String): InspectionMemoryTelemetry!
3941
4084
  catchUpStatus: JSONObject!
3942
4085
  catchUpPriority: InspectionCatchUpPriority!
3943
4086
  storageHealth: InspectionStorageHealth!
@@ -4206,6 +4349,47 @@ input ViewFilterInput {
4206
4349
  scopes: [String!]
4207
4350
  }
4208
4351
 
4352
+ """
4353
+ A point where a run paused, and how it resumes.
4354
+ """
4355
+ type WaitpointRecord {
4356
+ id: String!
4357
+ runId: String!
4358
+ workflowId: String!
4359
+ stepId: String!
4360
+ stepKey: String!
4361
+ stepPath: String!
4362
+ pieceName: String!
4363
+ blockName: String!
4364
+ """
4365
+ DELAY | WEBHOOK
4366
+ """
4367
+ type: String!
4368
+ """
4369
+ approval | webhook | delay
4370
+ """
4371
+ kind: String!
4372
+ """
4373
+ PENDING | COMPLETED | CONSUMED | EXPIRED | CANCELLED
4374
+ """
4375
+ status: String!
4376
+ createdAt: String!
4377
+ """
4378
+ DELAY only: when the run resumes.
4379
+ """
4380
+ resumeAt: String
4381
+ expiresAt: String
4382
+ resolvedAt: String
4383
+ """
4384
+ The DID that resolved it from the editor.
4385
+ """
4386
+ decidedBy: String
4387
+ """
4388
+ Set by the Request approval block; null otherwise.
4389
+ """
4390
+ approval: ApprovalRequest
4391
+ }
4392
+
4209
4393
  type WebhookEndpointRecord {
4210
4394
  workflowId: String!
4211
4395
  url: String!
@@ -4550,6 +4734,10 @@ type WorkflowRunRecord {
4550
4734
  workflowVersion: Int!
4551
4735
  triggerKind: String!
4552
4736
  triggerPayload: Unknown
4737
+ """
4738
+ PENDING | RUNNING | WAITING | SUCCEEDED | FAILED | CANCELLED. WAITING: paused
4739
+ at a waitpoint (approval, webhook or delay); the run holds no worker.
4740
+ """
4553
4741
  status: String!
4554
4742
  error: String
4555
4743
  errorName: String
@@ -4568,6 +4756,10 @@ type WorkflowRunRecord {
4568
4756
  """
4569
4757
  warningNotes: [String!]!
4570
4758
  steps: [WorkflowStepRunRecord!]!
4759
+ """
4760
+ Where the run paused, resolved ones included.
4761
+ """
4762
+ waitpoints: [WaitpointRecord!]!
4571
4763
  }
4572
4764
 
4573
4765
  type WorkflowRunResultPage {
@@ -4641,6 +4833,21 @@ type WorkflowRuntimeMutations {
4641
4833
  """
4642
4834
  rerun(runId: String!): WorkflowRunPayload!
4643
4835
  """
4836
+ Approves or rejects a PENDING WEBHOOK waitpoint, resuming its run. Needs
4837
+ write access to the workflow; with approvers listed, the caller's DID must
4838
+ be one. reason may be required, per approval.reasonRequiredOn.
4839
+ """
4840
+ resolveWaitpoint(
4841
+ waitpointId: String!
4842
+ approved: Boolean!
4843
+ reason: String
4844
+ ): WaitpointRecord!
4845
+ """
4846
+ Cancels a WAITING or PENDING run and its open waitpoints. A RUNNING run
4847
+ cannot be cancelled yet.
4848
+ """
4849
+ cancelRun(runId: String!): WorkflowRunPayload
4850
+ """
4644
4851
  Mints a managed secret for a connection or workflow document and returns
4645
4852
  its ref; only that document resolves it. The value is stored encrypted
4646
4853
  and is never readable back over any API.
@@ -4734,6 +4941,15 @@ type WorkflowRuntimeQueries {
4734
4941
  ): WorkflowRunResultPage!
4735
4942
  run(id: String!): WorkflowRunRecord
4736
4943
  """
4944
+ WAITING runs, each with its waitpoints. Scope them to one
4945
+ workflow, or to every workflow a drive holds; workflowId wins.
4946
+ """
4947
+ waitingRuns(
4948
+ driveId: String
4949
+ workflowId: String
4950
+ first: Int
4951
+ ): [WorkflowRunRecord!]!
4952
+ """
4737
4953
  The descriptor (props, auth, ports) of one action or trigger, as the
4738
4954
  version that runs it describes it; triggers come back under "trigger".
4739
4955
  """
@@ -5496,7 +5712,7 @@ type Workflow_WorkflowPolicy {
5496
5712
  """
5497
5713
  runTimeoutSeconds: Int!
5498
5714
  """
5499
- NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.
5715
+ Bounds how long a run may stay suspended on a waitpoint: a waitpoint expires this long after it is created, ending the run CANCELLED with WaitpointExpired. A Delay longer than this is refused.
5500
5716
  """
5501
5717
  maxSuspensionDays: Int!
5502
5718
  """