@versatly/workgraph 0.3.0 → 1.1.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/dist/index.d.ts CHANGED
@@ -48,7 +48,7 @@ interface Registry {
48
48
  version: number;
49
49
  types: Record<string, PrimitiveTypeDefinition>;
50
50
  }
51
- type LedgerOp = 'create' | 'update' | 'delete' | 'claim' | 'release' | 'block' | 'unblock' | 'done' | 'cancel' | 'define' | 'decompose';
51
+ type LedgerOp = 'create' | 'update' | 'delete' | 'claim' | 'heartbeat' | 'release' | 'block' | 'unblock' | 'done' | 'reopen' | 'cancel' | 'define' | 'decompose' | 'handoff';
52
52
  interface LedgerEntry {
53
53
  ts: string;
54
54
  actor: string;
@@ -132,6 +132,51 @@ interface WorkgraphBrief {
132
132
  nextReadyThreads: PrimitiveInstance[];
133
133
  recentActivity: LedgerEntry[];
134
134
  }
135
+ type WorkgraphLensId = 'my-work' | 'team-risk' | 'customer-health' | 'exec-brief';
136
+ interface WorkgraphLensDescriptor {
137
+ id: WorkgraphLensId;
138
+ description: string;
139
+ }
140
+ interface WorkgraphLensOptions {
141
+ actor?: string;
142
+ lookbackHours?: number;
143
+ staleHours?: number;
144
+ limit?: number;
145
+ }
146
+ interface WorkgraphLensItem {
147
+ title: string;
148
+ path?: string;
149
+ status?: string;
150
+ priority?: string;
151
+ owner?: string;
152
+ detail?: string;
153
+ ageHours?: number;
154
+ }
155
+ interface WorkgraphLensSection {
156
+ id: string;
157
+ title: string;
158
+ items: WorkgraphLensItem[];
159
+ }
160
+ interface WorkgraphLensResult {
161
+ lens: WorkgraphLensId;
162
+ generatedAt: string;
163
+ actor?: string;
164
+ options: {
165
+ lookbackHours: number;
166
+ staleHours: number;
167
+ limit: number;
168
+ };
169
+ metrics: Record<string, number>;
170
+ sections: WorkgraphLensSection[];
171
+ markdown: string;
172
+ }
173
+ interface WorkgraphMaterializeLensOptions extends WorkgraphLensOptions {
174
+ outputPath: string;
175
+ }
176
+ interface WorkgraphMaterializedLensResult extends WorkgraphLensResult {
177
+ outputPath: string;
178
+ created: boolean;
179
+ }
135
180
  interface PolicyParty {
136
181
  id: string;
137
182
  roles: string[];
@@ -152,6 +197,9 @@ interface DispatchRun {
152
197
  adapter: string;
153
198
  objective: string;
154
199
  status: RunStatus;
200
+ leaseExpires?: string;
201
+ leaseDurationMinutes?: number;
202
+ heartbeats?: string[];
155
203
  idempotencyKey?: string;
156
204
  context?: Record<string, unknown>;
157
205
  output?: string;
@@ -294,8 +342,12 @@ declare function create(workspacePath: string, typeName: string, fields: Record<
294
342
  pathOverride?: string;
295
343
  }): PrimitiveInstance;
296
344
  declare function read(workspacePath: string, relPath: string): PrimitiveInstance | null;
297
- declare function list(workspacePath: string, typeName: string): PrimitiveInstance[];
298
- declare function update(workspacePath: string, relPath: string, fieldUpdates: Record<string, unknown>, bodyUpdate: string | undefined, actor: string): PrimitiveInstance;
345
+ declare function list$1(workspacePath: string, typeName: string): PrimitiveInstance[];
346
+ interface PrimitiveUpdateOptions {
347
+ expectedEtag?: string;
348
+ concurrentConflictMode?: 'warn' | 'error';
349
+ }
350
+ declare function update(workspacePath: string, relPath: string, fieldUpdates: Record<string, unknown>, bodyUpdate: string | undefined, actor: string, options?: PrimitiveUpdateOptions): PrimitiveInstance;
299
351
  declare function remove(workspacePath: string, relPath: string, actor: string): void;
300
352
  declare function findByField(workspacePath: string, typeName: string, field: string, value: unknown): PrimitiveInstance[];
301
353
  declare function openThreads(workspacePath: string): PrimitiveInstance[];
@@ -303,18 +355,49 @@ declare function activeThreads(workspacePath: string): PrimitiveInstance[];
303
355
  declare function blockedThreads(workspacePath: string): PrimitiveInstance[];
304
356
  declare function threadsInSpace(workspacePath: string, spaceRef: string): PrimitiveInstance[];
305
357
 
358
+ type store_PrimitiveUpdateOptions = PrimitiveUpdateOptions;
306
359
  declare const store_activeThreads: typeof activeThreads;
307
360
  declare const store_blockedThreads: typeof blockedThreads;
308
361
  declare const store_create: typeof create;
309
362
  declare const store_findByField: typeof findByField;
310
- declare const store_list: typeof list;
311
363
  declare const store_openThreads: typeof openThreads;
312
364
  declare const store_read: typeof read;
313
365
  declare const store_remove: typeof remove;
314
366
  declare const store_threadsInSpace: typeof threadsInSpace;
315
367
  declare const store_update: typeof update;
316
368
  declare namespace store {
317
- export { store_activeThreads as activeThreads, store_blockedThreads as blockedThreads, store_create as create, store_findByField as findByField, store_list as list, store_openThreads as openThreads, store_read as read, store_remove as remove, store_threadsInSpace as threadsInSpace, store_update as update };
369
+ export { type store_PrimitiveUpdateOptions as PrimitiveUpdateOptions, store_activeThreads as activeThreads, store_blockedThreads as blockedThreads, store_create as create, store_findByField as findByField, list$1 as list, store_openThreads as openThreads, store_read as read, store_remove as remove, store_threadsInSpace as threadsInSpace, store_update as update };
370
+ }
371
+
372
+ interface ClaimLeaseRecord {
373
+ target: string;
374
+ owner: string;
375
+ claimedAt: string;
376
+ lastHeartbeatAt: string;
377
+ expiresAt: string;
378
+ ttlMinutes: number;
379
+ }
380
+ interface ClaimLeaseStatus extends ClaimLeaseRecord {
381
+ stale: boolean;
382
+ msUntilExpiry: number;
383
+ }
384
+ declare function listClaimLeases(workspacePath: string, nowMs?: number): ClaimLeaseStatus[];
385
+ declare function setClaimLease(workspacePath: string, target: string, owner: string, options?: {
386
+ ttlMinutes?: number;
387
+ now?: Date;
388
+ claimedAt?: string;
389
+ }): ClaimLeaseRecord;
390
+ declare function removeClaimLease(workspacePath: string, target: string): void;
391
+ declare function claimLeasePath(workspacePath: string): string;
392
+
393
+ type claimLease_ClaimLeaseRecord = ClaimLeaseRecord;
394
+ type claimLease_ClaimLeaseStatus = ClaimLeaseStatus;
395
+ declare const claimLease_claimLeasePath: typeof claimLeasePath;
396
+ declare const claimLease_listClaimLeases: typeof listClaimLeases;
397
+ declare const claimLease_removeClaimLease: typeof removeClaimLease;
398
+ declare const claimLease_setClaimLease: typeof setClaimLease;
399
+ declare namespace claimLease {
400
+ export { type claimLease_ClaimLeaseRecord as ClaimLeaseRecord, type claimLease_ClaimLeaseStatus as ClaimLeaseStatus, claimLease_claimLeasePath as claimLeasePath, claimLease_listClaimLeases as listClaimLeases, claimLease_removeClaimLease as removeClaimLease, claimLease_setClaimLease as setClaimLease };
318
401
  }
319
402
 
320
403
  /**
@@ -336,18 +419,58 @@ declare function pickNextReadyThread(workspacePath: string): PrimitiveInstance |
336
419
  declare function pickNextReadyThreadInSpace(workspacePath: string, spaceRef: string): PrimitiveInstance | null;
337
420
  declare function claimNextReady(workspacePath: string, actor: string): PrimitiveInstance | null;
338
421
  declare function claimNextReadyInSpace(workspacePath: string, actor: string, spaceRef: string): PrimitiveInstance | null;
339
- declare function claim(workspacePath: string, threadPath: string, actor: string): PrimitiveInstance;
422
+ declare function claim(workspacePath: string, threadPath: string, actor: string, options?: {
423
+ leaseTtlMinutes?: number;
424
+ }): PrimitiveInstance;
340
425
  declare function release(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
426
+ declare function heartbeat$2(workspacePath: string, threadPath: string, actor: string, leaseMinutes?: number): PrimitiveInstance;
427
+ declare function handoff(workspacePath: string, threadPath: string, fromActor: string, toActor: string, note?: string): PrimitiveInstance;
341
428
  declare function block(workspacePath: string, threadPath: string, actor: string, blockedBy: string, reason?: string): PrimitiveInstance;
342
429
  declare function unblock(workspacePath: string, threadPath: string, actor: string): PrimitiveInstance;
343
430
  declare function done(workspacePath: string, threadPath: string, actor: string, output?: string): PrimitiveInstance;
344
431
  declare function cancel(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
432
+ declare function reopen(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
433
+ interface ThreadHeartbeatResult {
434
+ actor: string;
435
+ touched: Array<{
436
+ threadPath: string;
437
+ expiresAt: string;
438
+ ttlMinutes: number;
439
+ }>;
440
+ skipped: Array<{
441
+ threadPath: string;
442
+ reason: string;
443
+ }>;
444
+ }
445
+ declare function heartbeatClaim(workspacePath: string, actor: string, threadPath?: string, options?: {
446
+ ttlMinutes?: number;
447
+ }): ThreadHeartbeatResult;
448
+ interface ReapStaleClaimsResult {
449
+ actor: string;
450
+ scanned: number;
451
+ reaped: Array<{
452
+ threadPath: string;
453
+ previousOwner: string;
454
+ expiredAt: string;
455
+ }>;
456
+ skipped: Array<{
457
+ threadPath: string;
458
+ reason: string;
459
+ }>;
460
+ }
461
+ declare function reapStaleClaims(workspacePath: string, actor: string, options?: {
462
+ limit?: number;
463
+ }): ReapStaleClaimsResult;
464
+ declare function listClaimLeaseStatus(workspacePath: string): ClaimLeaseStatus[];
345
465
  declare function decompose(workspacePath: string, parentPath: string, subthreads: Array<{
346
466
  title: string;
347
467
  goal: string;
348
468
  deps?: string[];
349
469
  }>, actor: string): PrimitiveInstance[];
470
+ declare function inferThreadDependenciesFromText(text: string): string[];
350
471
 
472
+ type thread_ReapStaleClaimsResult = ReapStaleClaimsResult;
473
+ type thread_ThreadHeartbeatResult = ThreadHeartbeatResult;
351
474
  declare const thread_block: typeof block;
352
475
  declare const thread_cancel: typeof cancel;
353
476
  declare const thread_claim: typeof claim;
@@ -356,15 +479,21 @@ declare const thread_claimNextReadyInSpace: typeof claimNextReadyInSpace;
356
479
  declare const thread_createThread: typeof createThread;
357
480
  declare const thread_decompose: typeof decompose;
358
481
  declare const thread_done: typeof done;
482
+ declare const thread_handoff: typeof handoff;
483
+ declare const thread_heartbeatClaim: typeof heartbeatClaim;
484
+ declare const thread_inferThreadDependenciesFromText: typeof inferThreadDependenciesFromText;
359
485
  declare const thread_isReadyForClaim: typeof isReadyForClaim;
486
+ declare const thread_listClaimLeaseStatus: typeof listClaimLeaseStatus;
360
487
  declare const thread_listReadyThreads: typeof listReadyThreads;
361
488
  declare const thread_listReadyThreadsInSpace: typeof listReadyThreadsInSpace;
362
489
  declare const thread_pickNextReadyThread: typeof pickNextReadyThread;
363
490
  declare const thread_pickNextReadyThreadInSpace: typeof pickNextReadyThreadInSpace;
491
+ declare const thread_reapStaleClaims: typeof reapStaleClaims;
364
492
  declare const thread_release: typeof release;
493
+ declare const thread_reopen: typeof reopen;
365
494
  declare const thread_unblock: typeof unblock;
366
495
  declare namespace thread {
367
- export { thread_block as block, thread_cancel as cancel, thread_claim as claim, thread_claimNextReady as claimNextReady, thread_claimNextReadyInSpace as claimNextReadyInSpace, thread_createThread as createThread, thread_decompose as decompose, thread_done as done, thread_isReadyForClaim as isReadyForClaim, thread_listReadyThreads as listReadyThreads, thread_listReadyThreadsInSpace as listReadyThreadsInSpace, thread_pickNextReadyThread as pickNextReadyThread, thread_pickNextReadyThreadInSpace as pickNextReadyThreadInSpace, thread_release as release, thread_unblock as unblock };
496
+ export { type thread_ReapStaleClaimsResult as ReapStaleClaimsResult, type thread_ThreadHeartbeatResult as ThreadHeartbeatResult, thread_block as block, thread_cancel as cancel, thread_claim as claim, thread_claimNextReady as claimNextReady, thread_claimNextReadyInSpace as claimNextReadyInSpace, thread_createThread as createThread, thread_decompose as decompose, thread_done as done, thread_handoff as handoff, heartbeat$2 as heartbeat, thread_heartbeatClaim as heartbeatClaim, thread_inferThreadDependenciesFromText as inferThreadDependenciesFromText, thread_isReadyForClaim as isReadyForClaim, thread_listClaimLeaseStatus as listClaimLeaseStatus, thread_listReadyThreads as listReadyThreads, thread_listReadyThreadsInSpace as listReadyThreadsInSpace, thread_pickNextReadyThread as pickNextReadyThread, thread_pickNextReadyThreadInSpace as pickNextReadyThreadInSpace, thread_reapStaleClaims as reapStaleClaims, thread_release as release, thread_reopen as reopen, thread_unblock as unblock };
368
497
  }
369
498
 
370
499
  /**
@@ -572,15 +701,41 @@ declare namespace orientation {
572
701
  }
573
702
 
574
703
  /**
575
- * Wiki-link graph indexing and hygiene reports.
704
+ * Deterministic context lenses for fast, runtime-agnostic orientation.
705
+ */
706
+
707
+ declare function listContextLenses(): WorkgraphLensDescriptor[];
708
+ declare function generateContextLens(workspacePath: string, lensId: WorkgraphLensId | string, options?: WorkgraphLensOptions): WorkgraphLensResult;
709
+ declare function materializeContextLens(workspacePath: string, lensId: WorkgraphLensId | string, options: WorkgraphMaterializeLensOptions): WorkgraphMaterializedLensResult;
710
+
711
+ declare const lens_generateContextLens: typeof generateContextLens;
712
+ declare const lens_listContextLenses: typeof listContextLenses;
713
+ declare const lens_materializeContextLens: typeof materializeContextLens;
714
+ declare namespace lens {
715
+ export { lens_generateContextLens as generateContextLens, lens_listContextLenses as listContextLenses, lens_materializeContextLens as materializeContextLens };
716
+ }
717
+
718
+ /**
719
+ * Wiki-link graph indexing and graph-intelligence queries.
576
720
  */
721
+ type WikiGraphEdgeType = 'wiki' | 'context_refs' | 'depends_on' | 'blocks' | 'informs' | 'contradicts' | 'supports' | 'supersedes' | 'parent';
577
722
  interface WikiGraphEdge {
578
723
  from: string;
579
724
  to: string;
725
+ type: WikiGraphEdgeType;
726
+ source: 'body' | 'frontmatter';
727
+ field?: string;
728
+ }
729
+ interface WikiGraphNode {
730
+ path: string;
731
+ slug: string;
732
+ type: string;
733
+ title?: string;
580
734
  }
581
735
  interface WikiGraphIndex {
582
736
  generatedAt: string;
583
737
  nodes: string[];
738
+ nodeInfo: Record<string, WikiGraphNode>;
584
739
  edges: WikiGraphEdge[];
585
740
  backlinks: Record<string, string[]>;
586
741
  orphans: string[];
@@ -599,6 +754,66 @@ interface WikiGraphNeighborhood {
599
754
  outgoing: string[];
600
755
  incoming: string[];
601
756
  }
757
+ interface WikiGraphNeighborhoodQueryNode extends WikiGraphNode {
758
+ exists: boolean;
759
+ distance: number;
760
+ }
761
+ interface WikiGraphNeighborhoodQuery {
762
+ center: WikiGraphNeighborhoodQueryNode;
763
+ depth: number;
764
+ connectedNodes: WikiGraphNeighborhoodQueryNode[];
765
+ edges: WikiGraphEdge[];
766
+ }
767
+ interface WikiGraphImpactReference {
768
+ node: WikiGraphNode;
769
+ edgeTypes: WikiGraphEdgeType[];
770
+ referenceCount: number;
771
+ }
772
+ interface WikiGraphImpactGroup {
773
+ type: string;
774
+ references: WikiGraphImpactReference[];
775
+ referenceCount: number;
776
+ }
777
+ interface WikiGraphImpactAnalysis {
778
+ target: WikiGraphNode & {
779
+ exists: boolean;
780
+ };
781
+ totalReferences: number;
782
+ incomingEdges: WikiGraphEdge[];
783
+ groups: WikiGraphImpactGroup[];
784
+ }
785
+ interface WikiGraphContextSection {
786
+ path: string;
787
+ type: string;
788
+ distance: number;
789
+ chars: number;
790
+ tokens: number;
791
+ }
792
+ interface WikiGraphContextAssembly {
793
+ center: WikiGraphNode & {
794
+ exists: boolean;
795
+ };
796
+ budgetTokens: number;
797
+ usedTokens: number;
798
+ sections: WikiGraphContextSection[];
799
+ markdown: string;
800
+ }
801
+ interface WikiGraphTypedEdges {
802
+ node: WikiGraphNode & {
803
+ exists: boolean;
804
+ };
805
+ outgoing: WikiGraphEdge[];
806
+ incoming: WikiGraphEdge[];
807
+ }
808
+ interface WikiGraphExportResult {
809
+ center: WikiGraphNode;
810
+ depth: number;
811
+ format: 'md';
812
+ outputDirectory: string;
813
+ manifestPath: string;
814
+ exportedNodes: string[];
815
+ exportedEdgeCount: number;
816
+ }
602
817
  declare function graphIndexPath(workspacePath: string): string;
603
818
  declare function buildWikiLinkGraph(workspacePath: string): WikiGraphIndex;
604
819
  declare function refreshWikiLinkGraphIndex(workspacePath: string): WikiGraphIndex;
@@ -619,21 +834,60 @@ declare function graphHygieneReport(workspacePath: string): {
619
834
  to: string;
620
835
  }>;
621
836
  };
837
+ /**
838
+ * Backward-compatible one-hop direct neighborhood.
839
+ */
622
840
  declare function graphNeighborhood(workspacePath: string, nodeRef: string, options?: {
623
841
  refresh?: boolean;
624
842
  }): WikiGraphNeighborhood;
843
+ declare function graphNeighborhoodQuery(workspacePath: string, nodeRef: string, options?: {
844
+ depth?: number;
845
+ refresh?: boolean;
846
+ }): WikiGraphNeighborhoodQuery;
847
+ declare function graphImpactAnalysis(workspacePath: string, nodeRef: string, options?: {
848
+ refresh?: boolean;
849
+ }): WikiGraphImpactAnalysis;
850
+ declare function graphContextAssembly(workspacePath: string, nodeRef: string, options?: {
851
+ budgetTokens?: number;
852
+ refresh?: boolean;
853
+ }): WikiGraphContextAssembly;
854
+ declare function graphTypedEdges(workspacePath: string, nodeRef: string, options?: {
855
+ refresh?: boolean;
856
+ }): WikiGraphTypedEdges;
857
+ declare function graphExportSubgraph(workspacePath: string, nodeRef: string, options?: {
858
+ depth?: number;
859
+ format?: 'md';
860
+ outputDir?: string;
861
+ refresh?: boolean;
862
+ }): WikiGraphExportResult;
625
863
 
864
+ type graph_WikiGraphContextAssembly = WikiGraphContextAssembly;
865
+ type graph_WikiGraphContextSection = WikiGraphContextSection;
626
866
  type graph_WikiGraphEdge = WikiGraphEdge;
867
+ type graph_WikiGraphEdgeType = WikiGraphEdgeType;
868
+ type graph_WikiGraphExportResult = WikiGraphExportResult;
869
+ type graph_WikiGraphImpactAnalysis = WikiGraphImpactAnalysis;
870
+ type graph_WikiGraphImpactGroup = WikiGraphImpactGroup;
871
+ type graph_WikiGraphImpactReference = WikiGraphImpactReference;
627
872
  type graph_WikiGraphIndex = WikiGraphIndex;
628
873
  type graph_WikiGraphNeighborhood = WikiGraphNeighborhood;
874
+ type graph_WikiGraphNeighborhoodQuery = WikiGraphNeighborhoodQuery;
875
+ type graph_WikiGraphNeighborhoodQueryNode = WikiGraphNeighborhoodQueryNode;
876
+ type graph_WikiGraphNode = WikiGraphNode;
877
+ type graph_WikiGraphTypedEdges = WikiGraphTypedEdges;
629
878
  declare const graph_buildWikiLinkGraph: typeof buildWikiLinkGraph;
879
+ declare const graph_graphContextAssembly: typeof graphContextAssembly;
880
+ declare const graph_graphExportSubgraph: typeof graphExportSubgraph;
630
881
  declare const graph_graphHygieneReport: typeof graphHygieneReport;
882
+ declare const graph_graphImpactAnalysis: typeof graphImpactAnalysis;
631
883
  declare const graph_graphIndexPath: typeof graphIndexPath;
632
884
  declare const graph_graphNeighborhood: typeof graphNeighborhood;
885
+ declare const graph_graphNeighborhoodQuery: typeof graphNeighborhoodQuery;
886
+ declare const graph_graphTypedEdges: typeof graphTypedEdges;
633
887
  declare const graph_readWikiLinkGraphIndex: typeof readWikiLinkGraphIndex;
634
888
  declare const graph_refreshWikiLinkGraphIndex: typeof refreshWikiLinkGraphIndex;
635
889
  declare namespace graph {
636
- export { type graph_WikiGraphEdge as WikiGraphEdge, type graph_WikiGraphIndex as WikiGraphIndex, type graph_WikiGraphNeighborhood as WikiGraphNeighborhood, graph_buildWikiLinkGraph as buildWikiLinkGraph, graph_graphHygieneReport as graphHygieneReport, graph_graphIndexPath as graphIndexPath, graph_graphNeighborhood as graphNeighborhood, graph_readWikiLinkGraphIndex as readWikiLinkGraphIndex, graph_refreshWikiLinkGraphIndex as refreshWikiLinkGraphIndex };
890
+ export { type graph_WikiGraphContextAssembly as WikiGraphContextAssembly, type graph_WikiGraphContextSection as WikiGraphContextSection, type graph_WikiGraphEdge as WikiGraphEdge, type graph_WikiGraphEdgeType as WikiGraphEdgeType, type graph_WikiGraphExportResult as WikiGraphExportResult, type graph_WikiGraphImpactAnalysis as WikiGraphImpactAnalysis, type graph_WikiGraphImpactGroup as WikiGraphImpactGroup, type graph_WikiGraphImpactReference as WikiGraphImpactReference, type graph_WikiGraphIndex as WikiGraphIndex, type graph_WikiGraphNeighborhood as WikiGraphNeighborhood, type graph_WikiGraphNeighborhoodQuery as WikiGraphNeighborhoodQuery, type graph_WikiGraphNeighborhoodQueryNode as WikiGraphNeighborhoodQueryNode, type graph_WikiGraphNode as WikiGraphNode, type graph_WikiGraphTypedEdges as WikiGraphTypedEdges, graph_buildWikiLinkGraph as buildWikiLinkGraph, graph_graphContextAssembly as graphContextAssembly, graph_graphExportSubgraph as graphExportSubgraph, graph_graphHygieneReport as graphHygieneReport, graph_graphImpactAnalysis as graphImpactAnalysis, graph_graphIndexPath as graphIndexPath, graph_graphNeighborhood as graphNeighborhood, graph_graphNeighborhoodQuery as graphNeighborhoodQuery, graph_graphTypedEdges as graphTypedEdges, graph_readWikiLinkGraphIndex as readWikiLinkGraphIndex, graph_refreshWikiLinkGraphIndex as refreshWikiLinkGraphIndex };
637
891
  }
638
892
 
639
893
  /**
@@ -695,6 +949,39 @@ declare namespace policy {
695
949
  export { type policy_PolicyDecision as PolicyDecision, policy_canTransitionStatus as canTransitionStatus, policy_getParty as getParty, policy_loadPolicyRegistry as loadPolicyRegistry, policy_policyPath as policyPath, policy_savePolicyRegistry as savePolicyRegistry, policy_upsertParty as upsertParty };
696
950
  }
697
951
 
952
+ /**
953
+ * Thread quality gate evaluation.
954
+ */
955
+ interface GateRuleResult {
956
+ rule: 'required-facts' | 'required-approvals' | 'min-age-seconds' | 'gate-status' | 'gate-exists';
957
+ ok: boolean;
958
+ message: string;
959
+ }
960
+ interface GateEvaluation {
961
+ gateRef: string;
962
+ gatePath?: string;
963
+ gateTitle?: string;
964
+ ok: boolean;
965
+ rules: GateRuleResult[];
966
+ }
967
+ interface ThreadGateCheckResult {
968
+ checkedAt: string;
969
+ threadPath: string;
970
+ allowed: boolean;
971
+ gates: GateEvaluation[];
972
+ }
973
+ declare function checkThreadGates(workspacePath: string, threadRef: string, now?: Date): ThreadGateCheckResult;
974
+ declare function summarizeGateFailures(result: ThreadGateCheckResult): string;
975
+
976
+ type gate_GateEvaluation = GateEvaluation;
977
+ type gate_GateRuleResult = GateRuleResult;
978
+ type gate_ThreadGateCheckResult = ThreadGateCheckResult;
979
+ declare const gate_checkThreadGates: typeof checkThreadGates;
980
+ declare const gate_summarizeGateFailures: typeof summarizeGateFailures;
981
+ declare namespace gate {
982
+ export { type gate_GateEvaluation as GateEvaluation, type gate_GateRuleResult as GateRuleResult, type gate_ThreadGateCheckResult as ThreadGateCheckResult, gate_checkThreadGates as checkThreadGates, gate_summarizeGateFailures as summarizeGateFailures };
983
+ }
984
+
698
985
  /**
699
986
  * Runtime dispatch contract with adapter-backed execution.
700
987
  */
@@ -714,7 +1001,31 @@ interface DispatchExecuteInput {
714
1001
  space?: string;
715
1002
  createCheckpoint?: boolean;
716
1003
  }
1004
+ interface DispatchHeartbeatInput {
1005
+ actor: string;
1006
+ leaseMinutes?: number;
1007
+ }
1008
+ interface DispatchReconcileResult {
1009
+ reconciledAt: string;
1010
+ inspectedRuns: number;
1011
+ requeuedRuns: DispatchRun[];
1012
+ }
1013
+ interface DispatchHandoffInput {
1014
+ actor: string;
1015
+ to: string;
1016
+ reason: string;
1017
+ adapter?: string;
1018
+ }
1019
+ interface DispatchHandoffResult {
1020
+ sourceRun: DispatchRun;
1021
+ handoffRun: DispatchRun;
1022
+ }
1023
+ interface DispatchClaimResult {
1024
+ thread: PrimitiveInstance;
1025
+ gateCheck: ThreadGateCheckResult;
1026
+ }
717
1027
  declare function createRun(workspacePath: string, input: DispatchCreateInput): DispatchRun;
1028
+ declare function claimThread(workspacePath: string, threadRef: string, actor: string): DispatchClaimResult;
718
1029
  declare function status(workspacePath: string, runId: string): DispatchRun;
719
1030
  declare function followup(workspacePath: string, runId: string, actor: string, input: string): DispatchRun;
720
1031
  declare function stop(workspacePath: string, runId: string, actor: string): DispatchRun;
@@ -723,6 +1034,9 @@ declare function markRun(workspacePath: string, runId: string, actor: string, ne
723
1034
  error?: string;
724
1035
  contextPatch?: Record<string, unknown>;
725
1036
  }): DispatchRun;
1037
+ declare function heartbeat$1(workspacePath: string, runId: string, input: DispatchHeartbeatInput): DispatchRun;
1038
+ declare function reconcileExpiredLeases(workspacePath: string, actor: string): DispatchReconcileResult;
1039
+ declare function handoffRun(workspacePath: string, runId: string, input: DispatchHandoffInput): DispatchHandoffResult;
726
1040
  declare function logs(workspacePath: string, runId: string): DispatchRun['logs'];
727
1041
  declare function listRuns(workspacePath: string, options?: {
728
1042
  status?: RunStatus;
@@ -731,19 +1045,51 @@ declare function listRuns(workspacePath: string, options?: {
731
1045
  declare function executeRun(workspacePath: string, runId: string, input: DispatchExecuteInput): Promise<DispatchRun>;
732
1046
  declare function createAndExecuteRun(workspacePath: string, createInput: DispatchCreateInput, executeInput?: Omit<DispatchExecuteInput, 'actor'>): Promise<DispatchRun>;
733
1047
 
1048
+ type dispatch_DispatchClaimResult = DispatchClaimResult;
734
1049
  type dispatch_DispatchCreateInput = DispatchCreateInput;
735
1050
  type dispatch_DispatchExecuteInput = DispatchExecuteInput;
1051
+ type dispatch_DispatchHandoffInput = DispatchHandoffInput;
1052
+ type dispatch_DispatchHandoffResult = DispatchHandoffResult;
1053
+ type dispatch_DispatchHeartbeatInput = DispatchHeartbeatInput;
1054
+ type dispatch_DispatchReconcileResult = DispatchReconcileResult;
1055
+ declare const dispatch_claimThread: typeof claimThread;
736
1056
  declare const dispatch_createAndExecuteRun: typeof createAndExecuteRun;
737
1057
  declare const dispatch_createRun: typeof createRun;
738
1058
  declare const dispatch_executeRun: typeof executeRun;
739
1059
  declare const dispatch_followup: typeof followup;
1060
+ declare const dispatch_handoffRun: typeof handoffRun;
740
1061
  declare const dispatch_listRuns: typeof listRuns;
741
1062
  declare const dispatch_logs: typeof logs;
742
1063
  declare const dispatch_markRun: typeof markRun;
1064
+ declare const dispatch_reconcileExpiredLeases: typeof reconcileExpiredLeases;
743
1065
  declare const dispatch_status: typeof status;
744
1066
  declare const dispatch_stop: typeof stop;
745
1067
  declare namespace dispatch {
746
- export { type dispatch_DispatchCreateInput as DispatchCreateInput, type dispatch_DispatchExecuteInput as DispatchExecuteInput, dispatch_createAndExecuteRun as createAndExecuteRun, dispatch_createRun as createRun, dispatch_executeRun as executeRun, dispatch_followup as followup, dispatch_listRuns as listRuns, dispatch_logs as logs, dispatch_markRun as markRun, dispatch_status as status, dispatch_stop as stop };
1068
+ export { type dispatch_DispatchClaimResult as DispatchClaimResult, type dispatch_DispatchCreateInput as DispatchCreateInput, type dispatch_DispatchExecuteInput as DispatchExecuteInput, type dispatch_DispatchHandoffInput as DispatchHandoffInput, type dispatch_DispatchHandoffResult as DispatchHandoffResult, type dispatch_DispatchHeartbeatInput as DispatchHeartbeatInput, type dispatch_DispatchReconcileResult as DispatchReconcileResult, dispatch_claimThread as claimThread, dispatch_createAndExecuteRun as createAndExecuteRun, dispatch_createRun as createRun, dispatch_executeRun as executeRun, dispatch_followup as followup, dispatch_handoffRun as handoffRun, heartbeat$1 as heartbeat, dispatch_listRuns as listRuns, dispatch_logs as logs, dispatch_markRun as markRun, dispatch_reconcileExpiredLeases as reconcileExpiredLeases, dispatch_status as status, dispatch_stop as stop };
1069
+ }
1070
+
1071
+ /**
1072
+ * Agent presence primitives.
1073
+ */
1074
+
1075
+ type AgentPresenceStatus = 'online' | 'busy' | 'offline';
1076
+ interface AgentHeartbeatOptions {
1077
+ status?: AgentPresenceStatus;
1078
+ currentTask?: string;
1079
+ capabilities?: string[];
1080
+ actor?: string;
1081
+ }
1082
+ declare function heartbeat(workspacePath: string, name: string, options?: AgentHeartbeatOptions): PrimitiveInstance;
1083
+ declare function list(workspacePath: string): PrimitiveInstance[];
1084
+ declare function getPresence(workspacePath: string, name: string): PrimitiveInstance | null;
1085
+
1086
+ type agent_AgentHeartbeatOptions = AgentHeartbeatOptions;
1087
+ type agent_AgentPresenceStatus = AgentPresenceStatus;
1088
+ declare const agent_getPresence: typeof getPresence;
1089
+ declare const agent_heartbeat: typeof heartbeat;
1090
+ declare const agent_list: typeof list;
1091
+ declare namespace agent {
1092
+ export { type agent_AgentHeartbeatOptions as AgentHeartbeatOptions, type agent_AgentPresenceStatus as AgentPresenceStatus, agent_getPresence as getPresence, agent_heartbeat as heartbeat, agent_list as list };
747
1093
  }
748
1094
 
749
1095
  /**
@@ -777,6 +1123,31 @@ declare namespace onboard {
777
1123
  export { type onboard_OnboardOptions as OnboardOptions, type onboard_OnboardResult as OnboardResult, type onboard_OnboardingStatus as OnboardingStatus, onboard_onboardWorkspace as onboardWorkspace, onboard_updateOnboardingStatus as updateOnboardingStatus };
778
1124
  }
779
1125
 
1126
+ type ThreadAuditIssueKind = 'thread_without_ledger_history' | 'active_without_claim' | 'active_owner_mismatch' | 'claim_without_active_status' | 'owner_set_without_active' | 'dependency_reference_not_declared' | 'declared_dependency_missing_target' | 'active_without_lease' | 'stale_lease';
1127
+ interface ThreadAuditIssue {
1128
+ kind: ThreadAuditIssueKind;
1129
+ path: string;
1130
+ message: string;
1131
+ details?: Record<string, unknown>;
1132
+ }
1133
+ interface ThreadAuditReport {
1134
+ ok: boolean;
1135
+ generatedAt: string;
1136
+ totalThreads: number;
1137
+ totalClaims: number;
1138
+ totalLeases: number;
1139
+ issues: ThreadAuditIssue[];
1140
+ }
1141
+ declare function reconcileThreadState(workspacePath: string): ThreadAuditReport;
1142
+
1143
+ type threadAudit_ThreadAuditIssue = ThreadAuditIssue;
1144
+ type threadAudit_ThreadAuditIssueKind = ThreadAuditIssueKind;
1145
+ type threadAudit_ThreadAuditReport = ThreadAuditReport;
1146
+ declare const threadAudit_reconcileThreadState: typeof reconcileThreadState;
1147
+ declare namespace threadAudit {
1148
+ export { type threadAudit_ThreadAuditIssue as ThreadAuditIssue, type threadAudit_ThreadAuditIssueKind as ThreadAuditIssueKind, type threadAudit_ThreadAuditReport as ThreadAuditReport, threadAudit_reconcileThreadState as reconcileThreadState };
1149
+ }
1150
+
780
1151
  /**
781
1152
  * QMD-compatible search adapter.
782
1153
  *
@@ -828,6 +1199,167 @@ declare namespace trigger {
828
1199
  export { type trigger_FireTriggerOptions as FireTriggerOptions, type trigger_FireTriggerResult as FireTriggerResult, trigger_fireTrigger as fireTrigger };
829
1200
  }
830
1201
 
1202
+ /**
1203
+ * Trigger polling engine, cascade evaluator, and dashboard/status helpers.
1204
+ */
1205
+
1206
+ type TriggerRuntimeStatus = 'ready' | 'cooldown' | 'inactive' | 'error';
1207
+ interface TriggerRuntimeState {
1208
+ fireCount: number;
1209
+ lastEvaluatedAt?: string;
1210
+ lastFiredAt?: string;
1211
+ cooldownUntil?: string;
1212
+ lastError?: string;
1213
+ state?: TriggerRuntimeStatus;
1214
+ lastResult?: Record<string, unknown>;
1215
+ lastEventCursorTs?: string;
1216
+ lastFileScanTs?: string;
1217
+ lastCronBucket?: string;
1218
+ synthesisCursorTs?: string;
1219
+ }
1220
+ interface TriggerStateData {
1221
+ version: number;
1222
+ updatedAt: string;
1223
+ engine: {
1224
+ cycleCount: number;
1225
+ lastCycleAt?: string;
1226
+ intervalSeconds: number;
1227
+ lastError?: string;
1228
+ };
1229
+ triggers: Record<string, TriggerRuntimeState>;
1230
+ }
1231
+ interface TriggerEngineCycleTriggerResult {
1232
+ triggerPath: string;
1233
+ fired: boolean;
1234
+ reason: string;
1235
+ actionType?: string;
1236
+ runtimeState: TriggerRuntimeStatus;
1237
+ error?: string;
1238
+ }
1239
+ interface TriggerEngineCycleResult {
1240
+ cycleAt: string;
1241
+ evaluated: number;
1242
+ fired: number;
1243
+ errors: number;
1244
+ triggers: TriggerEngineCycleTriggerResult[];
1245
+ statePath: string;
1246
+ }
1247
+ interface TriggerEngineCycleOptions {
1248
+ actor?: string;
1249
+ now?: Date;
1250
+ intervalSeconds?: number;
1251
+ }
1252
+ interface StartTriggerEngineOptions {
1253
+ actor?: string;
1254
+ intervalSeconds?: number;
1255
+ maxCycles?: number;
1256
+ logger?: (line: string) => void;
1257
+ }
1258
+ interface TriggerDashboardItem {
1259
+ path: string;
1260
+ title: string;
1261
+ status: string;
1262
+ condition: string;
1263
+ action: string;
1264
+ cooldownSeconds: number;
1265
+ fireCount: number;
1266
+ lastFiredAt?: string;
1267
+ nextFireAt?: string;
1268
+ currentState: TriggerRuntimeStatus;
1269
+ lastError?: string;
1270
+ }
1271
+ interface TriggerDashboard {
1272
+ generatedAt: string;
1273
+ statePath: string;
1274
+ engine: TriggerStateData['engine'];
1275
+ triggers: TriggerDashboardItem[];
1276
+ }
1277
+ interface CascadeEvaluationResult {
1278
+ completedThreadPath: string;
1279
+ evaluated: number;
1280
+ fired: number;
1281
+ errors: number;
1282
+ results: TriggerEngineCycleTriggerResult[];
1283
+ }
1284
+ interface AddSynthesisTriggerOptions {
1285
+ tagPattern: string;
1286
+ threshold: number;
1287
+ actor: string;
1288
+ cooldownSeconds?: number;
1289
+ }
1290
+ interface AddSynthesisTriggerResult {
1291
+ trigger: PrimitiveInstance;
1292
+ }
1293
+ declare function triggerStatePath(workspacePath: string): string;
1294
+ declare function loadTriggerState(workspacePath: string): TriggerStateData;
1295
+ declare function saveTriggerState(workspacePath: string, state: TriggerStateData): void;
1296
+ declare function runTriggerEngineCycle(workspacePath: string, options?: TriggerEngineCycleOptions): TriggerEngineCycleResult;
1297
+ declare function startTriggerEngine(workspacePath: string, options?: StartTriggerEngineOptions): Promise<void>;
1298
+ declare function evaluateThreadCompleteCascadeTriggers(workspacePath: string, completedThreadPath: string, actor?: string, now?: Date): CascadeEvaluationResult;
1299
+ declare function triggerDashboard(workspacePath: string, now?: Date): TriggerDashboard;
1300
+ declare function addSynthesisTrigger(workspacePath: string, options: AddSynthesisTriggerOptions): AddSynthesisTriggerResult;
1301
+
1302
+ type triggerEngine_AddSynthesisTriggerOptions = AddSynthesisTriggerOptions;
1303
+ type triggerEngine_AddSynthesisTriggerResult = AddSynthesisTriggerResult;
1304
+ type triggerEngine_CascadeEvaluationResult = CascadeEvaluationResult;
1305
+ type triggerEngine_StartTriggerEngineOptions = StartTriggerEngineOptions;
1306
+ type triggerEngine_TriggerDashboard = TriggerDashboard;
1307
+ type triggerEngine_TriggerDashboardItem = TriggerDashboardItem;
1308
+ type triggerEngine_TriggerEngineCycleOptions = TriggerEngineCycleOptions;
1309
+ type triggerEngine_TriggerEngineCycleResult = TriggerEngineCycleResult;
1310
+ type triggerEngine_TriggerEngineCycleTriggerResult = TriggerEngineCycleTriggerResult;
1311
+ declare const triggerEngine_addSynthesisTrigger: typeof addSynthesisTrigger;
1312
+ declare const triggerEngine_evaluateThreadCompleteCascadeTriggers: typeof evaluateThreadCompleteCascadeTriggers;
1313
+ declare const triggerEngine_loadTriggerState: typeof loadTriggerState;
1314
+ declare const triggerEngine_runTriggerEngineCycle: typeof runTriggerEngineCycle;
1315
+ declare const triggerEngine_saveTriggerState: typeof saveTriggerState;
1316
+ declare const triggerEngine_startTriggerEngine: typeof startTriggerEngine;
1317
+ declare const triggerEngine_triggerDashboard: typeof triggerDashboard;
1318
+ declare const triggerEngine_triggerStatePath: typeof triggerStatePath;
1319
+ declare namespace triggerEngine {
1320
+ export { type triggerEngine_AddSynthesisTriggerOptions as AddSynthesisTriggerOptions, type triggerEngine_AddSynthesisTriggerResult as AddSynthesisTriggerResult, type triggerEngine_CascadeEvaluationResult as CascadeEvaluationResult, type triggerEngine_StartTriggerEngineOptions as StartTriggerEngineOptions, type triggerEngine_TriggerDashboard as TriggerDashboard, type triggerEngine_TriggerDashboardItem as TriggerDashboardItem, type triggerEngine_TriggerEngineCycleOptions as TriggerEngineCycleOptions, type triggerEngine_TriggerEngineCycleResult as TriggerEngineCycleResult, type triggerEngine_TriggerEngineCycleTriggerResult as TriggerEngineCycleTriggerResult, triggerEngine_addSynthesisTrigger as addSynthesisTrigger, triggerEngine_evaluateThreadCompleteCascadeTriggers as evaluateThreadCompleteCascadeTriggers, triggerEngine_loadTriggerState as loadTriggerState, triggerEngine_runTriggerEngineCycle as runTriggerEngineCycle, triggerEngine_saveTriggerState as saveTriggerState, triggerEngine_startTriggerEngine as startTriggerEngine, triggerEngine_triggerDashboard as triggerDashboard, triggerEngine_triggerStatePath as triggerStatePath };
1321
+ }
1322
+
1323
+ interface AutonomyLoopOptions {
1324
+ actor: string;
1325
+ adapter?: string;
1326
+ agents?: string[];
1327
+ space?: string;
1328
+ pollMs?: number;
1329
+ watch?: boolean;
1330
+ maxCycles?: number;
1331
+ maxIdleCycles?: number;
1332
+ maxSteps?: number;
1333
+ stepDelayMs?: number;
1334
+ staleClaimMinutes?: number;
1335
+ executeTriggers?: boolean;
1336
+ executeReadyThreads?: boolean;
1337
+ heartbeatFile?: string;
1338
+ }
1339
+ interface AutonomyCycleReport {
1340
+ cycle: number;
1341
+ readyThreads: number;
1342
+ triggerActions: number;
1343
+ runId?: string;
1344
+ runStatus?: string;
1345
+ driftOk: boolean;
1346
+ driftIssues: number;
1347
+ }
1348
+ interface AutonomyLoopResult {
1349
+ cycles: AutonomyCycleReport[];
1350
+ finalReadyThreads: number;
1351
+ finalDriftOk: boolean;
1352
+ }
1353
+ declare function runAutonomyLoop(workspacePath: string, options: AutonomyLoopOptions): Promise<AutonomyLoopResult>;
1354
+
1355
+ type autonomy_AutonomyCycleReport = AutonomyCycleReport;
1356
+ type autonomy_AutonomyLoopOptions = AutonomyLoopOptions;
1357
+ type autonomy_AutonomyLoopResult = AutonomyLoopResult;
1358
+ declare const autonomy_runAutonomyLoop: typeof runAutonomyLoop;
1359
+ declare namespace autonomy {
1360
+ export { type autonomy_AutonomyCycleReport as AutonomyCycleReport, type autonomy_AutonomyLoopOptions as AutonomyLoopOptions, type autonomy_AutonomyLoopResult as AutonomyLoopResult, autonomy_runAutonomyLoop as runAutonomyLoop };
1361
+ }
1362
+
831
1363
  interface SkillIntegrationProvider {
832
1364
  id: string;
833
1365
  defaultTitle: string;
@@ -889,6 +1421,310 @@ declare namespace integration {
889
1421
  export { type integration_IntegrationDescriptor as IntegrationDescriptor, integration_installIntegration as installIntegration, integration_listIntegrations as listIntegrations };
890
1422
  }
891
1423
 
1424
+ /**
1425
+ * Lightweight 5-field cron parsing and matching utilities.
1426
+ *
1427
+ * Supported field syntax:
1428
+ * - "*" (any value)
1429
+ * - step syntax (for example, star-slash-5 to mean every 5 units)
1430
+ * - "a,b,c" (list)
1431
+ * - "a-b" (range)
1432
+ * - "a-b/n" (range with step)
1433
+ * - "n" (single value)
1434
+ */
1435
+ interface CronField {
1436
+ all: boolean;
1437
+ values: Set<number>;
1438
+ }
1439
+ interface CronSchedule {
1440
+ expression: string;
1441
+ minute: CronField;
1442
+ hour: CronField;
1443
+ dayOfMonth: CronField;
1444
+ month: CronField;
1445
+ dayOfWeek: CronField;
1446
+ }
1447
+ declare function parseCronExpression(expression: string): CronSchedule;
1448
+ declare function matchesCronSchedule(schedule: CronSchedule, date: Date): boolean;
1449
+ declare function nextCronMatch(scheduleOrExpression: CronSchedule | string, after: Date, maxSearchMinutes?: number): Date | null;
1450
+
1451
+ type DoctorSeverity = 'warning' | 'error';
1452
+ interface DoctorIssue {
1453
+ code: string;
1454
+ severity: DoctorSeverity;
1455
+ message: string;
1456
+ path?: string;
1457
+ details?: Record<string, unknown>;
1458
+ }
1459
+ interface DoctorChecks {
1460
+ orphanWikiLinks: number;
1461
+ staleClaims: number;
1462
+ staleRuns: number;
1463
+ missingRequiredFields: number;
1464
+ brokenPrimitiveRegistryReferences: number;
1465
+ emptyPrimitiveDirectories: number;
1466
+ duplicateSlugs: number;
1467
+ }
1468
+ interface DoctorFixSummary {
1469
+ enabled: boolean;
1470
+ orphanLinksRemoved: number;
1471
+ staleClaimsReleased: number;
1472
+ staleRunsCancelled: number;
1473
+ filesUpdated: string[];
1474
+ errors: string[];
1475
+ }
1476
+ interface DoctorReport {
1477
+ generatedAt: string;
1478
+ workspacePath: string;
1479
+ ok: boolean;
1480
+ summary: {
1481
+ errors: number;
1482
+ warnings: number;
1483
+ };
1484
+ checks: DoctorChecks;
1485
+ issues: DoctorIssue[];
1486
+ fixes: DoctorFixSummary;
1487
+ }
1488
+ interface DoctorOptions {
1489
+ fix?: boolean;
1490
+ actor?: string;
1491
+ staleAfterMs?: number;
1492
+ }
1493
+ declare function diagnoseVaultHealth(workspacePath: string, options?: DoctorOptions): DoctorReport;
1494
+
1495
+ type ReplayEventTypeFilter = 'create' | 'update' | 'transition';
1496
+ interface ReplayOptions {
1497
+ type?: ReplayEventTypeFilter;
1498
+ actor?: string;
1499
+ primitive?: string;
1500
+ since?: string;
1501
+ until?: string;
1502
+ color?: boolean;
1503
+ }
1504
+ interface ReplayUpdateDiff {
1505
+ changedFields: string[];
1506
+ statusTransition?: {
1507
+ from: string | null;
1508
+ to: string | null;
1509
+ };
1510
+ }
1511
+ interface ReplayEvent {
1512
+ ts: string;
1513
+ actor: string;
1514
+ op: string;
1515
+ target: string;
1516
+ primitiveType?: string;
1517
+ category: ReplayEventTypeFilter;
1518
+ diff?: ReplayUpdateDiff;
1519
+ }
1520
+ interface ReplayReport {
1521
+ generatedAt: string;
1522
+ workspacePath: string;
1523
+ filters: {
1524
+ type?: ReplayEventTypeFilter;
1525
+ actor?: string;
1526
+ primitive?: string;
1527
+ since?: string;
1528
+ until?: string;
1529
+ };
1530
+ totalEvents: number;
1531
+ events: ReplayEvent[];
1532
+ }
1533
+ declare function replayLedger(workspacePath: string, options?: ReplayOptions): ReplayReport;
1534
+ declare function renderReplayText(report: ReplayReport, options?: {
1535
+ color?: boolean;
1536
+ }): string[];
1537
+
1538
+ interface VizOptions {
1539
+ focus?: string;
1540
+ depth?: number;
1541
+ top?: number;
1542
+ color?: boolean;
1543
+ }
1544
+ interface VizReport {
1545
+ generatedAt: string;
1546
+ workspacePath: string;
1547
+ nodeCount: number;
1548
+ edgeCount: number;
1549
+ hubs: Array<{
1550
+ path: string;
1551
+ degree: number;
1552
+ }>;
1553
+ focus?: string;
1554
+ rendered: string;
1555
+ }
1556
+ declare function visualizeVaultGraph(workspacePath: string, options?: VizOptions): VizReport;
1557
+
1558
+ interface VaultStats {
1559
+ generatedAt: string;
1560
+ workspacePath: string;
1561
+ primitives: {
1562
+ total: number;
1563
+ byType: Record<string, number>;
1564
+ };
1565
+ links: {
1566
+ total: number;
1567
+ wikiLinkDensity: number;
1568
+ graphDensityRatio: number;
1569
+ orphanCount: number;
1570
+ orphanNodeCount: number;
1571
+ mostConnectedNodes: Array<{
1572
+ path: string;
1573
+ degree: number;
1574
+ }>;
1575
+ };
1576
+ frontmatter: {
1577
+ averageCompleteness: number;
1578
+ byType: Record<string, number>;
1579
+ };
1580
+ ledger: {
1581
+ totalEvents: number;
1582
+ eventRatePerDay: {
1583
+ average: number;
1584
+ byDay: Array<{
1585
+ day: string;
1586
+ count: number;
1587
+ }>;
1588
+ };
1589
+ };
1590
+ threads: {
1591
+ completedCount: number;
1592
+ averageOpenToDoneHours: number;
1593
+ };
1594
+ }
1595
+ declare function computeVaultStats(workspacePath: string): VaultStats;
1596
+
1597
+ interface ChangelogOptions {
1598
+ since: string;
1599
+ until?: string;
1600
+ }
1601
+ interface ChangelogItem {
1602
+ ts: string;
1603
+ actor: string;
1604
+ op: string;
1605
+ target: string;
1606
+ summary?: string;
1607
+ }
1608
+ interface ChangelogTypeGroup {
1609
+ primitiveType: string;
1610
+ items: ChangelogItem[];
1611
+ }
1612
+ interface ChangelogDayGroup {
1613
+ day: string;
1614
+ created: ChangelogTypeGroup[];
1615
+ updated: ChangelogTypeGroup[];
1616
+ completed: ChangelogTypeGroup[];
1617
+ }
1618
+ interface ChangelogReport {
1619
+ generatedAt: string;
1620
+ workspacePath: string;
1621
+ since: string;
1622
+ until?: string;
1623
+ totalEvents: number;
1624
+ days: ChangelogDayGroup[];
1625
+ }
1626
+ declare function generateLedgerChangelog(workspacePath: string, options: ChangelogOptions): ChangelogReport;
1627
+ declare function renderChangelogText(report: ChangelogReport): string[];
1628
+
1629
+ declare function renderDoctorReport(report: DoctorReport): string[];
1630
+ declare function renderStatsReport(stats: VaultStats): string[];
1631
+
1632
+ type index_ChangelogDayGroup = ChangelogDayGroup;
1633
+ type index_ChangelogItem = ChangelogItem;
1634
+ type index_ChangelogOptions = ChangelogOptions;
1635
+ type index_ChangelogReport = ChangelogReport;
1636
+ type index_ChangelogTypeGroup = ChangelogTypeGroup;
1637
+ type index_DoctorChecks = DoctorChecks;
1638
+ type index_DoctorFixSummary = DoctorFixSummary;
1639
+ type index_DoctorIssue = DoctorIssue;
1640
+ type index_DoctorOptions = DoctorOptions;
1641
+ type index_DoctorReport = DoctorReport;
1642
+ type index_DoctorSeverity = DoctorSeverity;
1643
+ type index_ReplayEvent = ReplayEvent;
1644
+ type index_ReplayEventTypeFilter = ReplayEventTypeFilter;
1645
+ type index_ReplayOptions = ReplayOptions;
1646
+ type index_ReplayReport = ReplayReport;
1647
+ type index_ReplayUpdateDiff = ReplayUpdateDiff;
1648
+ type index_VaultStats = VaultStats;
1649
+ type index_VizOptions = VizOptions;
1650
+ type index_VizReport = VizReport;
1651
+ declare const index_computeVaultStats: typeof computeVaultStats;
1652
+ declare const index_diagnoseVaultHealth: typeof diagnoseVaultHealth;
1653
+ declare const index_generateLedgerChangelog: typeof generateLedgerChangelog;
1654
+ declare const index_renderChangelogText: typeof renderChangelogText;
1655
+ declare const index_renderDoctorReport: typeof renderDoctorReport;
1656
+ declare const index_renderReplayText: typeof renderReplayText;
1657
+ declare const index_renderStatsReport: typeof renderStatsReport;
1658
+ declare const index_replayLedger: typeof replayLedger;
1659
+ declare const index_visualizeVaultGraph: typeof visualizeVaultGraph;
1660
+ declare namespace index {
1661
+ export { type index_ChangelogDayGroup as ChangelogDayGroup, type index_ChangelogItem as ChangelogItem, type index_ChangelogOptions as ChangelogOptions, type index_ChangelogReport as ChangelogReport, type index_ChangelogTypeGroup as ChangelogTypeGroup, type index_DoctorChecks as DoctorChecks, type index_DoctorFixSummary as DoctorFixSummary, type index_DoctorIssue as DoctorIssue, type index_DoctorOptions as DoctorOptions, type index_DoctorReport as DoctorReport, type index_DoctorSeverity as DoctorSeverity, type index_ReplayEvent as ReplayEvent, type index_ReplayEventTypeFilter as ReplayEventTypeFilter, type index_ReplayOptions as ReplayOptions, type index_ReplayReport as ReplayReport, type index_ReplayUpdateDiff as ReplayUpdateDiff, type index_VaultStats as VaultStats, type index_VizOptions as VizOptions, type index_VizReport as VizReport, index_computeVaultStats as computeVaultStats, index_diagnoseVaultHealth as diagnoseVaultHealth, index_generateLedgerChangelog as generateLedgerChangelog, index_renderChangelogText as renderChangelogText, index_renderDoctorReport as renderDoctorReport, index_renderReplayText as renderReplayText, index_renderStatsReport as renderStatsReport, index_replayLedger as replayLedger, index_visualizeVaultGraph as visualizeVaultGraph };
1662
+ }
1663
+
1664
+ interface AutonomyDaemonStartInput {
1665
+ cliEntrypointPath: string;
1666
+ actor: string;
1667
+ adapter?: string;
1668
+ agents?: string[];
1669
+ pollMs?: number;
1670
+ maxCycles?: number;
1671
+ maxIdleCycles?: number;
1672
+ maxSteps?: number;
1673
+ stepDelayMs?: number;
1674
+ space?: string;
1675
+ staleClaimMinutes?: number;
1676
+ executeTriggers?: boolean;
1677
+ executeReadyThreads?: boolean;
1678
+ logPath?: string;
1679
+ heartbeatPath?: string;
1680
+ }
1681
+ interface AutonomyDaemonStopInput {
1682
+ signal?: NodeJS.Signals;
1683
+ timeoutMs?: number;
1684
+ }
1685
+ interface AutonomyDaemonHeartbeat {
1686
+ ts: string;
1687
+ cycle?: number;
1688
+ readyThreads?: number;
1689
+ triggerActions?: number;
1690
+ runStatus?: string;
1691
+ driftOk?: boolean;
1692
+ driftIssues?: number;
1693
+ finalReadyThreads?: number;
1694
+ finalDriftOk?: boolean;
1695
+ }
1696
+ interface AutonomyDaemonStatus {
1697
+ running: boolean;
1698
+ pid?: number;
1699
+ pidPath: string;
1700
+ logPath: string;
1701
+ heartbeatPath: string;
1702
+ heartbeat?: AutonomyDaemonHeartbeat;
1703
+ }
1704
+ interface AutonomyDaemonStopResult {
1705
+ stopped: boolean;
1706
+ previouslyRunning: boolean;
1707
+ pid?: number;
1708
+ status: AutonomyDaemonStatus;
1709
+ }
1710
+ declare function startAutonomyDaemon(workspacePath: string, input: AutonomyDaemonStartInput): AutonomyDaemonStatus;
1711
+ declare function stopAutonomyDaemon(workspacePath: string, input?: AutonomyDaemonStopInput): Promise<AutonomyDaemonStopResult>;
1712
+ declare function readAutonomyDaemonStatus(workspacePath: string, options?: {
1713
+ cleanupStalePidFile?: boolean;
1714
+ }): AutonomyDaemonStatus;
1715
+
1716
+ type autonomyDaemon_AutonomyDaemonHeartbeat = AutonomyDaemonHeartbeat;
1717
+ type autonomyDaemon_AutonomyDaemonStartInput = AutonomyDaemonStartInput;
1718
+ type autonomyDaemon_AutonomyDaemonStatus = AutonomyDaemonStatus;
1719
+ type autonomyDaemon_AutonomyDaemonStopInput = AutonomyDaemonStopInput;
1720
+ type autonomyDaemon_AutonomyDaemonStopResult = AutonomyDaemonStopResult;
1721
+ declare const autonomyDaemon_readAutonomyDaemonStatus: typeof readAutonomyDaemonStatus;
1722
+ declare const autonomyDaemon_startAutonomyDaemon: typeof startAutonomyDaemon;
1723
+ declare const autonomyDaemon_stopAutonomyDaemon: typeof stopAutonomyDaemon;
1724
+ declare namespace autonomyDaemon {
1725
+ export { type autonomyDaemon_AutonomyDaemonHeartbeat as AutonomyDaemonHeartbeat, type autonomyDaemon_AutonomyDaemonStartInput as AutonomyDaemonStartInput, type autonomyDaemon_AutonomyDaemonStatus as AutonomyDaemonStatus, type autonomyDaemon_AutonomyDaemonStopInput as AutonomyDaemonStopInput, type autonomyDaemon_AutonomyDaemonStopResult as AutonomyDaemonStopResult, autonomyDaemon_readAutonomyDaemonStatus as readAutonomyDaemonStatus, autonomyDaemon_startAutonomyDaemon as startAutonomyDaemon, autonomyDaemon_stopAutonomyDaemon as stopAutonomyDaemon };
1726
+ }
1727
+
892
1728
  interface DispatchAdapterCreateInput {
893
1729
  actor: string;
894
1730
  objective: string;
@@ -944,4 +1780,4 @@ declare class CursorCloudAdapter implements DispatchAdapter {
944
1780
  execute(input: DispatchAdapterExecutionInput): Promise<DispatchAdapterExecutionResult>;
945
1781
  }
946
1782
 
947
- export { CursorCloudAdapter, type DispatchAdapter, type DispatchAdapterCreateInput, type DispatchAdapterExecutionInput, type DispatchAdapterExecutionResult, type DispatchAdapterLogEntry, type DispatchAdapterRunStatus, type DispatchRun, type FieldDefinition, type InstallSkillIntegrationOptions, type InstallSkillIntegrationResult, type LedgerChainState, type LedgerEntry, type LedgerIndex, type LedgerOp, type PolicyParty, type PolicyRegistry, type PrimitiveInstance, type PrimitiveQueryFilters, type PrimitiveTypeDefinition, type Registry, type RunStatus, type SkillIntegrationProvider, THREAD_STATUS_TRANSITIONS, type ThreadStatus, type WorkgraphBrief, type WorkgraphStatusSnapshot, type WorkgraphWorkspaceConfig, bases, board, clawdapus, commandCenter, dispatch, fetchSkillMarkdownFromUrl, graph, installSkillIntegration, integration, ledger, onboard, orientation, policy, query, registry, searchQmdAdapter, skill, store, thread, trigger, workspace };
1783
+ export { type CronField, type CronSchedule, CursorCloudAdapter, type DispatchAdapter, type DispatchAdapterCreateInput, type DispatchAdapterExecutionInput, type DispatchAdapterExecutionResult, type DispatchAdapterLogEntry, type DispatchAdapterRunStatus, type DispatchRun, type FieldDefinition, type InstallSkillIntegrationOptions, type InstallSkillIntegrationResult, type LedgerChainState, type LedgerEntry, type LedgerIndex, type LedgerOp, type PolicyParty, type PolicyRegistry, type PrimitiveInstance, type PrimitiveQueryFilters, type PrimitiveTypeDefinition, type Registry, type RunStatus, type SkillIntegrationProvider, THREAD_STATUS_TRANSITIONS, type ThreadStatus, type WorkgraphBrief, type WorkgraphLensDescriptor, type WorkgraphLensId, type WorkgraphLensItem, type WorkgraphLensOptions, type WorkgraphLensResult, type WorkgraphLensSection, type WorkgraphMaterializeLensOptions, type WorkgraphMaterializedLensResult, type WorkgraphStatusSnapshot, type WorkgraphWorkspaceConfig, agent, autonomy, autonomyDaemon, bases, board, claimLease, clawdapus, commandCenter, index as diagnostics, dispatch, fetchSkillMarkdownFromUrl, gate, graph, installSkillIntegration, integration, ledger, lens, matchesCronSchedule, nextCronMatch, onboard, orientation, parseCronExpression, policy, query, registry, searchQmdAdapter, skill, store, thread, threadAudit, trigger, triggerEngine, workspace };