@versatly/workgraph 0.3.0 → 1.0.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;
@@ -152,6 +152,9 @@ interface DispatchRun {
152
152
  adapter: string;
153
153
  objective: string;
154
154
  status: RunStatus;
155
+ leaseExpires?: string;
156
+ leaseDurationMinutes?: number;
157
+ heartbeats?: string[];
155
158
  idempotencyKey?: string;
156
159
  context?: Record<string, unknown>;
157
160
  output?: string;
@@ -294,8 +297,12 @@ declare function create(workspacePath: string, typeName: string, fields: Record<
294
297
  pathOverride?: string;
295
298
  }): PrimitiveInstance;
296
299
  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;
300
+ declare function list$1(workspacePath: string, typeName: string): PrimitiveInstance[];
301
+ interface PrimitiveUpdateOptions {
302
+ expectedEtag?: string;
303
+ concurrentConflictMode?: 'warn' | 'error';
304
+ }
305
+ declare function update(workspacePath: string, relPath: string, fieldUpdates: Record<string, unknown>, bodyUpdate: string | undefined, actor: string, options?: PrimitiveUpdateOptions): PrimitiveInstance;
299
306
  declare function remove(workspacePath: string, relPath: string, actor: string): void;
300
307
  declare function findByField(workspacePath: string, typeName: string, field: string, value: unknown): PrimitiveInstance[];
301
308
  declare function openThreads(workspacePath: string): PrimitiveInstance[];
@@ -303,18 +310,49 @@ declare function activeThreads(workspacePath: string): PrimitiveInstance[];
303
310
  declare function blockedThreads(workspacePath: string): PrimitiveInstance[];
304
311
  declare function threadsInSpace(workspacePath: string, spaceRef: string): PrimitiveInstance[];
305
312
 
313
+ type store_PrimitiveUpdateOptions = PrimitiveUpdateOptions;
306
314
  declare const store_activeThreads: typeof activeThreads;
307
315
  declare const store_blockedThreads: typeof blockedThreads;
308
316
  declare const store_create: typeof create;
309
317
  declare const store_findByField: typeof findByField;
310
- declare const store_list: typeof list;
311
318
  declare const store_openThreads: typeof openThreads;
312
319
  declare const store_read: typeof read;
313
320
  declare const store_remove: typeof remove;
314
321
  declare const store_threadsInSpace: typeof threadsInSpace;
315
322
  declare const store_update: typeof update;
316
323
  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 };
324
+ 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 };
325
+ }
326
+
327
+ interface ClaimLeaseRecord {
328
+ target: string;
329
+ owner: string;
330
+ claimedAt: string;
331
+ lastHeartbeatAt: string;
332
+ expiresAt: string;
333
+ ttlMinutes: number;
334
+ }
335
+ interface ClaimLeaseStatus extends ClaimLeaseRecord {
336
+ stale: boolean;
337
+ msUntilExpiry: number;
338
+ }
339
+ declare function listClaimLeases(workspacePath: string, nowMs?: number): ClaimLeaseStatus[];
340
+ declare function setClaimLease(workspacePath: string, target: string, owner: string, options?: {
341
+ ttlMinutes?: number;
342
+ now?: Date;
343
+ claimedAt?: string;
344
+ }): ClaimLeaseRecord;
345
+ declare function removeClaimLease(workspacePath: string, target: string): void;
346
+ declare function claimLeasePath(workspacePath: string): string;
347
+
348
+ type claimLease_ClaimLeaseRecord = ClaimLeaseRecord;
349
+ type claimLease_ClaimLeaseStatus = ClaimLeaseStatus;
350
+ declare const claimLease_claimLeasePath: typeof claimLeasePath;
351
+ declare const claimLease_listClaimLeases: typeof listClaimLeases;
352
+ declare const claimLease_removeClaimLease: typeof removeClaimLease;
353
+ declare const claimLease_setClaimLease: typeof setClaimLease;
354
+ declare namespace claimLease {
355
+ 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
356
  }
319
357
 
320
358
  /**
@@ -336,18 +374,58 @@ declare function pickNextReadyThread(workspacePath: string): PrimitiveInstance |
336
374
  declare function pickNextReadyThreadInSpace(workspacePath: string, spaceRef: string): PrimitiveInstance | null;
337
375
  declare function claimNextReady(workspacePath: string, actor: string): PrimitiveInstance | null;
338
376
  declare function claimNextReadyInSpace(workspacePath: string, actor: string, spaceRef: string): PrimitiveInstance | null;
339
- declare function claim(workspacePath: string, threadPath: string, actor: string): PrimitiveInstance;
377
+ declare function claim(workspacePath: string, threadPath: string, actor: string, options?: {
378
+ leaseTtlMinutes?: number;
379
+ }): PrimitiveInstance;
340
380
  declare function release(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
381
+ declare function heartbeat$2(workspacePath: string, threadPath: string, actor: string, leaseMinutes?: number): PrimitiveInstance;
382
+ declare function handoff(workspacePath: string, threadPath: string, fromActor: string, toActor: string, note?: string): PrimitiveInstance;
341
383
  declare function block(workspacePath: string, threadPath: string, actor: string, blockedBy: string, reason?: string): PrimitiveInstance;
342
384
  declare function unblock(workspacePath: string, threadPath: string, actor: string): PrimitiveInstance;
343
385
  declare function done(workspacePath: string, threadPath: string, actor: string, output?: string): PrimitiveInstance;
344
386
  declare function cancel(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
387
+ declare function reopen(workspacePath: string, threadPath: string, actor: string, reason?: string): PrimitiveInstance;
388
+ interface ThreadHeartbeatResult {
389
+ actor: string;
390
+ touched: Array<{
391
+ threadPath: string;
392
+ expiresAt: string;
393
+ ttlMinutes: number;
394
+ }>;
395
+ skipped: Array<{
396
+ threadPath: string;
397
+ reason: string;
398
+ }>;
399
+ }
400
+ declare function heartbeatClaim(workspacePath: string, actor: string, threadPath?: string, options?: {
401
+ ttlMinutes?: number;
402
+ }): ThreadHeartbeatResult;
403
+ interface ReapStaleClaimsResult {
404
+ actor: string;
405
+ scanned: number;
406
+ reaped: Array<{
407
+ threadPath: string;
408
+ previousOwner: string;
409
+ expiredAt: string;
410
+ }>;
411
+ skipped: Array<{
412
+ threadPath: string;
413
+ reason: string;
414
+ }>;
415
+ }
416
+ declare function reapStaleClaims(workspacePath: string, actor: string, options?: {
417
+ limit?: number;
418
+ }): ReapStaleClaimsResult;
419
+ declare function listClaimLeaseStatus(workspacePath: string): ClaimLeaseStatus[];
345
420
  declare function decompose(workspacePath: string, parentPath: string, subthreads: Array<{
346
421
  title: string;
347
422
  goal: string;
348
423
  deps?: string[];
349
424
  }>, actor: string): PrimitiveInstance[];
425
+ declare function inferThreadDependenciesFromText(text: string): string[];
350
426
 
427
+ type thread_ReapStaleClaimsResult = ReapStaleClaimsResult;
428
+ type thread_ThreadHeartbeatResult = ThreadHeartbeatResult;
351
429
  declare const thread_block: typeof block;
352
430
  declare const thread_cancel: typeof cancel;
353
431
  declare const thread_claim: typeof claim;
@@ -356,15 +434,21 @@ declare const thread_claimNextReadyInSpace: typeof claimNextReadyInSpace;
356
434
  declare const thread_createThread: typeof createThread;
357
435
  declare const thread_decompose: typeof decompose;
358
436
  declare const thread_done: typeof done;
437
+ declare const thread_handoff: typeof handoff;
438
+ declare const thread_heartbeatClaim: typeof heartbeatClaim;
439
+ declare const thread_inferThreadDependenciesFromText: typeof inferThreadDependenciesFromText;
359
440
  declare const thread_isReadyForClaim: typeof isReadyForClaim;
441
+ declare const thread_listClaimLeaseStatus: typeof listClaimLeaseStatus;
360
442
  declare const thread_listReadyThreads: typeof listReadyThreads;
361
443
  declare const thread_listReadyThreadsInSpace: typeof listReadyThreadsInSpace;
362
444
  declare const thread_pickNextReadyThread: typeof pickNextReadyThread;
363
445
  declare const thread_pickNextReadyThreadInSpace: typeof pickNextReadyThreadInSpace;
446
+ declare const thread_reapStaleClaims: typeof reapStaleClaims;
364
447
  declare const thread_release: typeof release;
448
+ declare const thread_reopen: typeof reopen;
365
449
  declare const thread_unblock: typeof unblock;
366
450
  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 };
451
+ 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
452
  }
369
453
 
370
454
  /**
@@ -572,15 +656,26 @@ declare namespace orientation {
572
656
  }
573
657
 
574
658
  /**
575
- * Wiki-link graph indexing and hygiene reports.
659
+ * Wiki-link graph indexing and graph-intelligence queries.
576
660
  */
661
+ type WikiGraphEdgeType = 'wiki' | 'context_refs' | 'depends_on' | 'blocks' | 'informs' | 'contradicts' | 'supports' | 'supersedes' | 'parent';
577
662
  interface WikiGraphEdge {
578
663
  from: string;
579
664
  to: string;
665
+ type: WikiGraphEdgeType;
666
+ source: 'body' | 'frontmatter';
667
+ field?: string;
668
+ }
669
+ interface WikiGraphNode {
670
+ path: string;
671
+ slug: string;
672
+ type: string;
673
+ title?: string;
580
674
  }
581
675
  interface WikiGraphIndex {
582
676
  generatedAt: string;
583
677
  nodes: string[];
678
+ nodeInfo: Record<string, WikiGraphNode>;
584
679
  edges: WikiGraphEdge[];
585
680
  backlinks: Record<string, string[]>;
586
681
  orphans: string[];
@@ -599,6 +694,66 @@ interface WikiGraphNeighborhood {
599
694
  outgoing: string[];
600
695
  incoming: string[];
601
696
  }
697
+ interface WikiGraphNeighborhoodQueryNode extends WikiGraphNode {
698
+ exists: boolean;
699
+ distance: number;
700
+ }
701
+ interface WikiGraphNeighborhoodQuery {
702
+ center: WikiGraphNeighborhoodQueryNode;
703
+ depth: number;
704
+ connectedNodes: WikiGraphNeighborhoodQueryNode[];
705
+ edges: WikiGraphEdge[];
706
+ }
707
+ interface WikiGraphImpactReference {
708
+ node: WikiGraphNode;
709
+ edgeTypes: WikiGraphEdgeType[];
710
+ referenceCount: number;
711
+ }
712
+ interface WikiGraphImpactGroup {
713
+ type: string;
714
+ references: WikiGraphImpactReference[];
715
+ referenceCount: number;
716
+ }
717
+ interface WikiGraphImpactAnalysis {
718
+ target: WikiGraphNode & {
719
+ exists: boolean;
720
+ };
721
+ totalReferences: number;
722
+ incomingEdges: WikiGraphEdge[];
723
+ groups: WikiGraphImpactGroup[];
724
+ }
725
+ interface WikiGraphContextSection {
726
+ path: string;
727
+ type: string;
728
+ distance: number;
729
+ chars: number;
730
+ tokens: number;
731
+ }
732
+ interface WikiGraphContextAssembly {
733
+ center: WikiGraphNode & {
734
+ exists: boolean;
735
+ };
736
+ budgetTokens: number;
737
+ usedTokens: number;
738
+ sections: WikiGraphContextSection[];
739
+ markdown: string;
740
+ }
741
+ interface WikiGraphTypedEdges {
742
+ node: WikiGraphNode & {
743
+ exists: boolean;
744
+ };
745
+ outgoing: WikiGraphEdge[];
746
+ incoming: WikiGraphEdge[];
747
+ }
748
+ interface WikiGraphExportResult {
749
+ center: WikiGraphNode;
750
+ depth: number;
751
+ format: 'md';
752
+ outputDirectory: string;
753
+ manifestPath: string;
754
+ exportedNodes: string[];
755
+ exportedEdgeCount: number;
756
+ }
602
757
  declare function graphIndexPath(workspacePath: string): string;
603
758
  declare function buildWikiLinkGraph(workspacePath: string): WikiGraphIndex;
604
759
  declare function refreshWikiLinkGraphIndex(workspacePath: string): WikiGraphIndex;
@@ -619,21 +774,60 @@ declare function graphHygieneReport(workspacePath: string): {
619
774
  to: string;
620
775
  }>;
621
776
  };
777
+ /**
778
+ * Backward-compatible one-hop direct neighborhood.
779
+ */
622
780
  declare function graphNeighborhood(workspacePath: string, nodeRef: string, options?: {
623
781
  refresh?: boolean;
624
782
  }): WikiGraphNeighborhood;
783
+ declare function graphNeighborhoodQuery(workspacePath: string, nodeRef: string, options?: {
784
+ depth?: number;
785
+ refresh?: boolean;
786
+ }): WikiGraphNeighborhoodQuery;
787
+ declare function graphImpactAnalysis(workspacePath: string, nodeRef: string, options?: {
788
+ refresh?: boolean;
789
+ }): WikiGraphImpactAnalysis;
790
+ declare function graphContextAssembly(workspacePath: string, nodeRef: string, options?: {
791
+ budgetTokens?: number;
792
+ refresh?: boolean;
793
+ }): WikiGraphContextAssembly;
794
+ declare function graphTypedEdges(workspacePath: string, nodeRef: string, options?: {
795
+ refresh?: boolean;
796
+ }): WikiGraphTypedEdges;
797
+ declare function graphExportSubgraph(workspacePath: string, nodeRef: string, options?: {
798
+ depth?: number;
799
+ format?: 'md';
800
+ outputDir?: string;
801
+ refresh?: boolean;
802
+ }): WikiGraphExportResult;
625
803
 
804
+ type graph_WikiGraphContextAssembly = WikiGraphContextAssembly;
805
+ type graph_WikiGraphContextSection = WikiGraphContextSection;
626
806
  type graph_WikiGraphEdge = WikiGraphEdge;
807
+ type graph_WikiGraphEdgeType = WikiGraphEdgeType;
808
+ type graph_WikiGraphExportResult = WikiGraphExportResult;
809
+ type graph_WikiGraphImpactAnalysis = WikiGraphImpactAnalysis;
810
+ type graph_WikiGraphImpactGroup = WikiGraphImpactGroup;
811
+ type graph_WikiGraphImpactReference = WikiGraphImpactReference;
627
812
  type graph_WikiGraphIndex = WikiGraphIndex;
628
813
  type graph_WikiGraphNeighborhood = WikiGraphNeighborhood;
814
+ type graph_WikiGraphNeighborhoodQuery = WikiGraphNeighborhoodQuery;
815
+ type graph_WikiGraphNeighborhoodQueryNode = WikiGraphNeighborhoodQueryNode;
816
+ type graph_WikiGraphNode = WikiGraphNode;
817
+ type graph_WikiGraphTypedEdges = WikiGraphTypedEdges;
629
818
  declare const graph_buildWikiLinkGraph: typeof buildWikiLinkGraph;
819
+ declare const graph_graphContextAssembly: typeof graphContextAssembly;
820
+ declare const graph_graphExportSubgraph: typeof graphExportSubgraph;
630
821
  declare const graph_graphHygieneReport: typeof graphHygieneReport;
822
+ declare const graph_graphImpactAnalysis: typeof graphImpactAnalysis;
631
823
  declare const graph_graphIndexPath: typeof graphIndexPath;
632
824
  declare const graph_graphNeighborhood: typeof graphNeighborhood;
825
+ declare const graph_graphNeighborhoodQuery: typeof graphNeighborhoodQuery;
826
+ declare const graph_graphTypedEdges: typeof graphTypedEdges;
633
827
  declare const graph_readWikiLinkGraphIndex: typeof readWikiLinkGraphIndex;
634
828
  declare const graph_refreshWikiLinkGraphIndex: typeof refreshWikiLinkGraphIndex;
635
829
  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 };
830
+ 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
831
  }
638
832
 
639
833
  /**
@@ -695,6 +889,39 @@ declare namespace policy {
695
889
  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
890
  }
697
891
 
892
+ /**
893
+ * Thread quality gate evaluation.
894
+ */
895
+ interface GateRuleResult {
896
+ rule: 'required-facts' | 'required-approvals' | 'min-age-seconds' | 'gate-status' | 'gate-exists';
897
+ ok: boolean;
898
+ message: string;
899
+ }
900
+ interface GateEvaluation {
901
+ gateRef: string;
902
+ gatePath?: string;
903
+ gateTitle?: string;
904
+ ok: boolean;
905
+ rules: GateRuleResult[];
906
+ }
907
+ interface ThreadGateCheckResult {
908
+ checkedAt: string;
909
+ threadPath: string;
910
+ allowed: boolean;
911
+ gates: GateEvaluation[];
912
+ }
913
+ declare function checkThreadGates(workspacePath: string, threadRef: string, now?: Date): ThreadGateCheckResult;
914
+ declare function summarizeGateFailures(result: ThreadGateCheckResult): string;
915
+
916
+ type gate_GateEvaluation = GateEvaluation;
917
+ type gate_GateRuleResult = GateRuleResult;
918
+ type gate_ThreadGateCheckResult = ThreadGateCheckResult;
919
+ declare const gate_checkThreadGates: typeof checkThreadGates;
920
+ declare const gate_summarizeGateFailures: typeof summarizeGateFailures;
921
+ declare namespace gate {
922
+ export { type gate_GateEvaluation as GateEvaluation, type gate_GateRuleResult as GateRuleResult, type gate_ThreadGateCheckResult as ThreadGateCheckResult, gate_checkThreadGates as checkThreadGates, gate_summarizeGateFailures as summarizeGateFailures };
923
+ }
924
+
698
925
  /**
699
926
  * Runtime dispatch contract with adapter-backed execution.
700
927
  */
@@ -714,7 +941,31 @@ interface DispatchExecuteInput {
714
941
  space?: string;
715
942
  createCheckpoint?: boolean;
716
943
  }
944
+ interface DispatchHeartbeatInput {
945
+ actor: string;
946
+ leaseMinutes?: number;
947
+ }
948
+ interface DispatchReconcileResult {
949
+ reconciledAt: string;
950
+ inspectedRuns: number;
951
+ requeuedRuns: DispatchRun[];
952
+ }
953
+ interface DispatchHandoffInput {
954
+ actor: string;
955
+ to: string;
956
+ reason: string;
957
+ adapter?: string;
958
+ }
959
+ interface DispatchHandoffResult {
960
+ sourceRun: DispatchRun;
961
+ handoffRun: DispatchRun;
962
+ }
963
+ interface DispatchClaimResult {
964
+ thread: PrimitiveInstance;
965
+ gateCheck: ThreadGateCheckResult;
966
+ }
717
967
  declare function createRun(workspacePath: string, input: DispatchCreateInput): DispatchRun;
968
+ declare function claimThread(workspacePath: string, threadRef: string, actor: string): DispatchClaimResult;
718
969
  declare function status(workspacePath: string, runId: string): DispatchRun;
719
970
  declare function followup(workspacePath: string, runId: string, actor: string, input: string): DispatchRun;
720
971
  declare function stop(workspacePath: string, runId: string, actor: string): DispatchRun;
@@ -723,6 +974,9 @@ declare function markRun(workspacePath: string, runId: string, actor: string, ne
723
974
  error?: string;
724
975
  contextPatch?: Record<string, unknown>;
725
976
  }): DispatchRun;
977
+ declare function heartbeat$1(workspacePath: string, runId: string, input: DispatchHeartbeatInput): DispatchRun;
978
+ declare function reconcileExpiredLeases(workspacePath: string, actor: string): DispatchReconcileResult;
979
+ declare function handoffRun(workspacePath: string, runId: string, input: DispatchHandoffInput): DispatchHandoffResult;
726
980
  declare function logs(workspacePath: string, runId: string): DispatchRun['logs'];
727
981
  declare function listRuns(workspacePath: string, options?: {
728
982
  status?: RunStatus;
@@ -731,19 +985,51 @@ declare function listRuns(workspacePath: string, options?: {
731
985
  declare function executeRun(workspacePath: string, runId: string, input: DispatchExecuteInput): Promise<DispatchRun>;
732
986
  declare function createAndExecuteRun(workspacePath: string, createInput: DispatchCreateInput, executeInput?: Omit<DispatchExecuteInput, 'actor'>): Promise<DispatchRun>;
733
987
 
988
+ type dispatch_DispatchClaimResult = DispatchClaimResult;
734
989
  type dispatch_DispatchCreateInput = DispatchCreateInput;
735
990
  type dispatch_DispatchExecuteInput = DispatchExecuteInput;
991
+ type dispatch_DispatchHandoffInput = DispatchHandoffInput;
992
+ type dispatch_DispatchHandoffResult = DispatchHandoffResult;
993
+ type dispatch_DispatchHeartbeatInput = DispatchHeartbeatInput;
994
+ type dispatch_DispatchReconcileResult = DispatchReconcileResult;
995
+ declare const dispatch_claimThread: typeof claimThread;
736
996
  declare const dispatch_createAndExecuteRun: typeof createAndExecuteRun;
737
997
  declare const dispatch_createRun: typeof createRun;
738
998
  declare const dispatch_executeRun: typeof executeRun;
739
999
  declare const dispatch_followup: typeof followup;
1000
+ declare const dispatch_handoffRun: typeof handoffRun;
740
1001
  declare const dispatch_listRuns: typeof listRuns;
741
1002
  declare const dispatch_logs: typeof logs;
742
1003
  declare const dispatch_markRun: typeof markRun;
1004
+ declare const dispatch_reconcileExpiredLeases: typeof reconcileExpiredLeases;
743
1005
  declare const dispatch_status: typeof status;
744
1006
  declare const dispatch_stop: typeof stop;
745
1007
  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 };
1008
+ 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 };
1009
+ }
1010
+
1011
+ /**
1012
+ * Agent presence primitives.
1013
+ */
1014
+
1015
+ type AgentPresenceStatus = 'online' | 'busy' | 'offline';
1016
+ interface AgentHeartbeatOptions {
1017
+ status?: AgentPresenceStatus;
1018
+ currentTask?: string;
1019
+ capabilities?: string[];
1020
+ actor?: string;
1021
+ }
1022
+ declare function heartbeat(workspacePath: string, name: string, options?: AgentHeartbeatOptions): PrimitiveInstance;
1023
+ declare function list(workspacePath: string): PrimitiveInstance[];
1024
+ declare function getPresence(workspacePath: string, name: string): PrimitiveInstance | null;
1025
+
1026
+ type agent_AgentHeartbeatOptions = AgentHeartbeatOptions;
1027
+ type agent_AgentPresenceStatus = AgentPresenceStatus;
1028
+ declare const agent_getPresence: typeof getPresence;
1029
+ declare const agent_heartbeat: typeof heartbeat;
1030
+ declare const agent_list: typeof list;
1031
+ declare namespace agent {
1032
+ export { type agent_AgentHeartbeatOptions as AgentHeartbeatOptions, type agent_AgentPresenceStatus as AgentPresenceStatus, agent_getPresence as getPresence, agent_heartbeat as heartbeat, agent_list as list };
747
1033
  }
748
1034
 
749
1035
  /**
@@ -777,6 +1063,31 @@ declare namespace onboard {
777
1063
  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
1064
  }
779
1065
 
1066
+ 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';
1067
+ interface ThreadAuditIssue {
1068
+ kind: ThreadAuditIssueKind;
1069
+ path: string;
1070
+ message: string;
1071
+ details?: Record<string, unknown>;
1072
+ }
1073
+ interface ThreadAuditReport {
1074
+ ok: boolean;
1075
+ generatedAt: string;
1076
+ totalThreads: number;
1077
+ totalClaims: number;
1078
+ totalLeases: number;
1079
+ issues: ThreadAuditIssue[];
1080
+ }
1081
+ declare function reconcileThreadState(workspacePath: string): ThreadAuditReport;
1082
+
1083
+ type threadAudit_ThreadAuditIssue = ThreadAuditIssue;
1084
+ type threadAudit_ThreadAuditIssueKind = ThreadAuditIssueKind;
1085
+ type threadAudit_ThreadAuditReport = ThreadAuditReport;
1086
+ declare const threadAudit_reconcileThreadState: typeof reconcileThreadState;
1087
+ declare namespace threadAudit {
1088
+ export { type threadAudit_ThreadAuditIssue as ThreadAuditIssue, type threadAudit_ThreadAuditIssueKind as ThreadAuditIssueKind, type threadAudit_ThreadAuditReport as ThreadAuditReport, threadAudit_reconcileThreadState as reconcileThreadState };
1089
+ }
1090
+
780
1091
  /**
781
1092
  * QMD-compatible search adapter.
782
1093
  *
@@ -828,6 +1139,167 @@ declare namespace trigger {
828
1139
  export { type trigger_FireTriggerOptions as FireTriggerOptions, type trigger_FireTriggerResult as FireTriggerResult, trigger_fireTrigger as fireTrigger };
829
1140
  }
830
1141
 
1142
+ /**
1143
+ * Trigger polling engine, cascade evaluator, and dashboard/status helpers.
1144
+ */
1145
+
1146
+ type TriggerRuntimeStatus = 'ready' | 'cooldown' | 'inactive' | 'error';
1147
+ interface TriggerRuntimeState {
1148
+ fireCount: number;
1149
+ lastEvaluatedAt?: string;
1150
+ lastFiredAt?: string;
1151
+ cooldownUntil?: string;
1152
+ lastError?: string;
1153
+ state?: TriggerRuntimeStatus;
1154
+ lastResult?: Record<string, unknown>;
1155
+ lastEventCursorTs?: string;
1156
+ lastFileScanTs?: string;
1157
+ lastCronBucket?: string;
1158
+ synthesisCursorTs?: string;
1159
+ }
1160
+ interface TriggerStateData {
1161
+ version: number;
1162
+ updatedAt: string;
1163
+ engine: {
1164
+ cycleCount: number;
1165
+ lastCycleAt?: string;
1166
+ intervalSeconds: number;
1167
+ lastError?: string;
1168
+ };
1169
+ triggers: Record<string, TriggerRuntimeState>;
1170
+ }
1171
+ interface TriggerEngineCycleTriggerResult {
1172
+ triggerPath: string;
1173
+ fired: boolean;
1174
+ reason: string;
1175
+ actionType?: string;
1176
+ runtimeState: TriggerRuntimeStatus;
1177
+ error?: string;
1178
+ }
1179
+ interface TriggerEngineCycleResult {
1180
+ cycleAt: string;
1181
+ evaluated: number;
1182
+ fired: number;
1183
+ errors: number;
1184
+ triggers: TriggerEngineCycleTriggerResult[];
1185
+ statePath: string;
1186
+ }
1187
+ interface TriggerEngineCycleOptions {
1188
+ actor?: string;
1189
+ now?: Date;
1190
+ intervalSeconds?: number;
1191
+ }
1192
+ interface StartTriggerEngineOptions {
1193
+ actor?: string;
1194
+ intervalSeconds?: number;
1195
+ maxCycles?: number;
1196
+ logger?: (line: string) => void;
1197
+ }
1198
+ interface TriggerDashboardItem {
1199
+ path: string;
1200
+ title: string;
1201
+ status: string;
1202
+ condition: string;
1203
+ action: string;
1204
+ cooldownSeconds: number;
1205
+ fireCount: number;
1206
+ lastFiredAt?: string;
1207
+ nextFireAt?: string;
1208
+ currentState: TriggerRuntimeStatus;
1209
+ lastError?: string;
1210
+ }
1211
+ interface TriggerDashboard {
1212
+ generatedAt: string;
1213
+ statePath: string;
1214
+ engine: TriggerStateData['engine'];
1215
+ triggers: TriggerDashboardItem[];
1216
+ }
1217
+ interface CascadeEvaluationResult {
1218
+ completedThreadPath: string;
1219
+ evaluated: number;
1220
+ fired: number;
1221
+ errors: number;
1222
+ results: TriggerEngineCycleTriggerResult[];
1223
+ }
1224
+ interface AddSynthesisTriggerOptions {
1225
+ tagPattern: string;
1226
+ threshold: number;
1227
+ actor: string;
1228
+ cooldownSeconds?: number;
1229
+ }
1230
+ interface AddSynthesisTriggerResult {
1231
+ trigger: PrimitiveInstance;
1232
+ }
1233
+ declare function triggerStatePath(workspacePath: string): string;
1234
+ declare function loadTriggerState(workspacePath: string): TriggerStateData;
1235
+ declare function saveTriggerState(workspacePath: string, state: TriggerStateData): void;
1236
+ declare function runTriggerEngineCycle(workspacePath: string, options?: TriggerEngineCycleOptions): TriggerEngineCycleResult;
1237
+ declare function startTriggerEngine(workspacePath: string, options?: StartTriggerEngineOptions): Promise<void>;
1238
+ declare function evaluateThreadCompleteCascadeTriggers(workspacePath: string, completedThreadPath: string, actor?: string, now?: Date): CascadeEvaluationResult;
1239
+ declare function triggerDashboard(workspacePath: string, now?: Date): TriggerDashboard;
1240
+ declare function addSynthesisTrigger(workspacePath: string, options: AddSynthesisTriggerOptions): AddSynthesisTriggerResult;
1241
+
1242
+ type triggerEngine_AddSynthesisTriggerOptions = AddSynthesisTriggerOptions;
1243
+ type triggerEngine_AddSynthesisTriggerResult = AddSynthesisTriggerResult;
1244
+ type triggerEngine_CascadeEvaluationResult = CascadeEvaluationResult;
1245
+ type triggerEngine_StartTriggerEngineOptions = StartTriggerEngineOptions;
1246
+ type triggerEngine_TriggerDashboard = TriggerDashboard;
1247
+ type triggerEngine_TriggerDashboardItem = TriggerDashboardItem;
1248
+ type triggerEngine_TriggerEngineCycleOptions = TriggerEngineCycleOptions;
1249
+ type triggerEngine_TriggerEngineCycleResult = TriggerEngineCycleResult;
1250
+ type triggerEngine_TriggerEngineCycleTriggerResult = TriggerEngineCycleTriggerResult;
1251
+ declare const triggerEngine_addSynthesisTrigger: typeof addSynthesisTrigger;
1252
+ declare const triggerEngine_evaluateThreadCompleteCascadeTriggers: typeof evaluateThreadCompleteCascadeTriggers;
1253
+ declare const triggerEngine_loadTriggerState: typeof loadTriggerState;
1254
+ declare const triggerEngine_runTriggerEngineCycle: typeof runTriggerEngineCycle;
1255
+ declare const triggerEngine_saveTriggerState: typeof saveTriggerState;
1256
+ declare const triggerEngine_startTriggerEngine: typeof startTriggerEngine;
1257
+ declare const triggerEngine_triggerDashboard: typeof triggerDashboard;
1258
+ declare const triggerEngine_triggerStatePath: typeof triggerStatePath;
1259
+ declare namespace triggerEngine {
1260
+ 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 };
1261
+ }
1262
+
1263
+ interface AutonomyLoopOptions {
1264
+ actor: string;
1265
+ adapter?: string;
1266
+ agents?: string[];
1267
+ space?: string;
1268
+ pollMs?: number;
1269
+ watch?: boolean;
1270
+ maxCycles?: number;
1271
+ maxIdleCycles?: number;
1272
+ maxSteps?: number;
1273
+ stepDelayMs?: number;
1274
+ staleClaimMinutes?: number;
1275
+ executeTriggers?: boolean;
1276
+ executeReadyThreads?: boolean;
1277
+ heartbeatFile?: string;
1278
+ }
1279
+ interface AutonomyCycleReport {
1280
+ cycle: number;
1281
+ readyThreads: number;
1282
+ triggerActions: number;
1283
+ runId?: string;
1284
+ runStatus?: string;
1285
+ driftOk: boolean;
1286
+ driftIssues: number;
1287
+ }
1288
+ interface AutonomyLoopResult {
1289
+ cycles: AutonomyCycleReport[];
1290
+ finalReadyThreads: number;
1291
+ finalDriftOk: boolean;
1292
+ }
1293
+ declare function runAutonomyLoop(workspacePath: string, options: AutonomyLoopOptions): Promise<AutonomyLoopResult>;
1294
+
1295
+ type autonomy_AutonomyCycleReport = AutonomyCycleReport;
1296
+ type autonomy_AutonomyLoopOptions = AutonomyLoopOptions;
1297
+ type autonomy_AutonomyLoopResult = AutonomyLoopResult;
1298
+ declare const autonomy_runAutonomyLoop: typeof runAutonomyLoop;
1299
+ declare namespace autonomy {
1300
+ export { type autonomy_AutonomyCycleReport as AutonomyCycleReport, type autonomy_AutonomyLoopOptions as AutonomyLoopOptions, type autonomy_AutonomyLoopResult as AutonomyLoopResult, autonomy_runAutonomyLoop as runAutonomyLoop };
1301
+ }
1302
+
831
1303
  interface SkillIntegrationProvider {
832
1304
  id: string;
833
1305
  defaultTitle: string;
@@ -889,6 +1361,310 @@ declare namespace integration {
889
1361
  export { type integration_IntegrationDescriptor as IntegrationDescriptor, integration_installIntegration as installIntegration, integration_listIntegrations as listIntegrations };
890
1362
  }
891
1363
 
1364
+ /**
1365
+ * Lightweight 5-field cron parsing and matching utilities.
1366
+ *
1367
+ * Supported field syntax:
1368
+ * - "*" (any value)
1369
+ * - step syntax (for example, star-slash-5 to mean every 5 units)
1370
+ * - "a,b,c" (list)
1371
+ * - "a-b" (range)
1372
+ * - "a-b/n" (range with step)
1373
+ * - "n" (single value)
1374
+ */
1375
+ interface CronField {
1376
+ all: boolean;
1377
+ values: Set<number>;
1378
+ }
1379
+ interface CronSchedule {
1380
+ expression: string;
1381
+ minute: CronField;
1382
+ hour: CronField;
1383
+ dayOfMonth: CronField;
1384
+ month: CronField;
1385
+ dayOfWeek: CronField;
1386
+ }
1387
+ declare function parseCronExpression(expression: string): CronSchedule;
1388
+ declare function matchesCronSchedule(schedule: CronSchedule, date: Date): boolean;
1389
+ declare function nextCronMatch(scheduleOrExpression: CronSchedule | string, after: Date, maxSearchMinutes?: number): Date | null;
1390
+
1391
+ type DoctorSeverity = 'warning' | 'error';
1392
+ interface DoctorIssue {
1393
+ code: string;
1394
+ severity: DoctorSeverity;
1395
+ message: string;
1396
+ path?: string;
1397
+ details?: Record<string, unknown>;
1398
+ }
1399
+ interface DoctorChecks {
1400
+ orphanWikiLinks: number;
1401
+ staleClaims: number;
1402
+ staleRuns: number;
1403
+ missingRequiredFields: number;
1404
+ brokenPrimitiveRegistryReferences: number;
1405
+ emptyPrimitiveDirectories: number;
1406
+ duplicateSlugs: number;
1407
+ }
1408
+ interface DoctorFixSummary {
1409
+ enabled: boolean;
1410
+ orphanLinksRemoved: number;
1411
+ staleClaimsReleased: number;
1412
+ staleRunsCancelled: number;
1413
+ filesUpdated: string[];
1414
+ errors: string[];
1415
+ }
1416
+ interface DoctorReport {
1417
+ generatedAt: string;
1418
+ workspacePath: string;
1419
+ ok: boolean;
1420
+ summary: {
1421
+ errors: number;
1422
+ warnings: number;
1423
+ };
1424
+ checks: DoctorChecks;
1425
+ issues: DoctorIssue[];
1426
+ fixes: DoctorFixSummary;
1427
+ }
1428
+ interface DoctorOptions {
1429
+ fix?: boolean;
1430
+ actor?: string;
1431
+ staleAfterMs?: number;
1432
+ }
1433
+ declare function diagnoseVaultHealth(workspacePath: string, options?: DoctorOptions): DoctorReport;
1434
+
1435
+ type ReplayEventTypeFilter = 'create' | 'update' | 'transition';
1436
+ interface ReplayOptions {
1437
+ type?: ReplayEventTypeFilter;
1438
+ actor?: string;
1439
+ primitive?: string;
1440
+ since?: string;
1441
+ until?: string;
1442
+ color?: boolean;
1443
+ }
1444
+ interface ReplayUpdateDiff {
1445
+ changedFields: string[];
1446
+ statusTransition?: {
1447
+ from: string | null;
1448
+ to: string | null;
1449
+ };
1450
+ }
1451
+ interface ReplayEvent {
1452
+ ts: string;
1453
+ actor: string;
1454
+ op: string;
1455
+ target: string;
1456
+ primitiveType?: string;
1457
+ category: ReplayEventTypeFilter;
1458
+ diff?: ReplayUpdateDiff;
1459
+ }
1460
+ interface ReplayReport {
1461
+ generatedAt: string;
1462
+ workspacePath: string;
1463
+ filters: {
1464
+ type?: ReplayEventTypeFilter;
1465
+ actor?: string;
1466
+ primitive?: string;
1467
+ since?: string;
1468
+ until?: string;
1469
+ };
1470
+ totalEvents: number;
1471
+ events: ReplayEvent[];
1472
+ }
1473
+ declare function replayLedger(workspacePath: string, options?: ReplayOptions): ReplayReport;
1474
+ declare function renderReplayText(report: ReplayReport, options?: {
1475
+ color?: boolean;
1476
+ }): string[];
1477
+
1478
+ interface VizOptions {
1479
+ focus?: string;
1480
+ depth?: number;
1481
+ top?: number;
1482
+ color?: boolean;
1483
+ }
1484
+ interface VizReport {
1485
+ generatedAt: string;
1486
+ workspacePath: string;
1487
+ nodeCount: number;
1488
+ edgeCount: number;
1489
+ hubs: Array<{
1490
+ path: string;
1491
+ degree: number;
1492
+ }>;
1493
+ focus?: string;
1494
+ rendered: string;
1495
+ }
1496
+ declare function visualizeVaultGraph(workspacePath: string, options?: VizOptions): VizReport;
1497
+
1498
+ interface VaultStats {
1499
+ generatedAt: string;
1500
+ workspacePath: string;
1501
+ primitives: {
1502
+ total: number;
1503
+ byType: Record<string, number>;
1504
+ };
1505
+ links: {
1506
+ total: number;
1507
+ wikiLinkDensity: number;
1508
+ graphDensityRatio: number;
1509
+ orphanCount: number;
1510
+ orphanNodeCount: number;
1511
+ mostConnectedNodes: Array<{
1512
+ path: string;
1513
+ degree: number;
1514
+ }>;
1515
+ };
1516
+ frontmatter: {
1517
+ averageCompleteness: number;
1518
+ byType: Record<string, number>;
1519
+ };
1520
+ ledger: {
1521
+ totalEvents: number;
1522
+ eventRatePerDay: {
1523
+ average: number;
1524
+ byDay: Array<{
1525
+ day: string;
1526
+ count: number;
1527
+ }>;
1528
+ };
1529
+ };
1530
+ threads: {
1531
+ completedCount: number;
1532
+ averageOpenToDoneHours: number;
1533
+ };
1534
+ }
1535
+ declare function computeVaultStats(workspacePath: string): VaultStats;
1536
+
1537
+ interface ChangelogOptions {
1538
+ since: string;
1539
+ until?: string;
1540
+ }
1541
+ interface ChangelogItem {
1542
+ ts: string;
1543
+ actor: string;
1544
+ op: string;
1545
+ target: string;
1546
+ summary?: string;
1547
+ }
1548
+ interface ChangelogTypeGroup {
1549
+ primitiveType: string;
1550
+ items: ChangelogItem[];
1551
+ }
1552
+ interface ChangelogDayGroup {
1553
+ day: string;
1554
+ created: ChangelogTypeGroup[];
1555
+ updated: ChangelogTypeGroup[];
1556
+ completed: ChangelogTypeGroup[];
1557
+ }
1558
+ interface ChangelogReport {
1559
+ generatedAt: string;
1560
+ workspacePath: string;
1561
+ since: string;
1562
+ until?: string;
1563
+ totalEvents: number;
1564
+ days: ChangelogDayGroup[];
1565
+ }
1566
+ declare function generateLedgerChangelog(workspacePath: string, options: ChangelogOptions): ChangelogReport;
1567
+ declare function renderChangelogText(report: ChangelogReport): string[];
1568
+
1569
+ declare function renderDoctorReport(report: DoctorReport): string[];
1570
+ declare function renderStatsReport(stats: VaultStats): string[];
1571
+
1572
+ type index_ChangelogDayGroup = ChangelogDayGroup;
1573
+ type index_ChangelogItem = ChangelogItem;
1574
+ type index_ChangelogOptions = ChangelogOptions;
1575
+ type index_ChangelogReport = ChangelogReport;
1576
+ type index_ChangelogTypeGroup = ChangelogTypeGroup;
1577
+ type index_DoctorChecks = DoctorChecks;
1578
+ type index_DoctorFixSummary = DoctorFixSummary;
1579
+ type index_DoctorIssue = DoctorIssue;
1580
+ type index_DoctorOptions = DoctorOptions;
1581
+ type index_DoctorReport = DoctorReport;
1582
+ type index_DoctorSeverity = DoctorSeverity;
1583
+ type index_ReplayEvent = ReplayEvent;
1584
+ type index_ReplayEventTypeFilter = ReplayEventTypeFilter;
1585
+ type index_ReplayOptions = ReplayOptions;
1586
+ type index_ReplayReport = ReplayReport;
1587
+ type index_ReplayUpdateDiff = ReplayUpdateDiff;
1588
+ type index_VaultStats = VaultStats;
1589
+ type index_VizOptions = VizOptions;
1590
+ type index_VizReport = VizReport;
1591
+ declare const index_computeVaultStats: typeof computeVaultStats;
1592
+ declare const index_diagnoseVaultHealth: typeof diagnoseVaultHealth;
1593
+ declare const index_generateLedgerChangelog: typeof generateLedgerChangelog;
1594
+ declare const index_renderChangelogText: typeof renderChangelogText;
1595
+ declare const index_renderDoctorReport: typeof renderDoctorReport;
1596
+ declare const index_renderReplayText: typeof renderReplayText;
1597
+ declare const index_renderStatsReport: typeof renderStatsReport;
1598
+ declare const index_replayLedger: typeof replayLedger;
1599
+ declare const index_visualizeVaultGraph: typeof visualizeVaultGraph;
1600
+ declare namespace index {
1601
+ 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 };
1602
+ }
1603
+
1604
+ interface AutonomyDaemonStartInput {
1605
+ cliEntrypointPath: string;
1606
+ actor: string;
1607
+ adapter?: string;
1608
+ agents?: string[];
1609
+ pollMs?: number;
1610
+ maxCycles?: number;
1611
+ maxIdleCycles?: number;
1612
+ maxSteps?: number;
1613
+ stepDelayMs?: number;
1614
+ space?: string;
1615
+ staleClaimMinutes?: number;
1616
+ executeTriggers?: boolean;
1617
+ executeReadyThreads?: boolean;
1618
+ logPath?: string;
1619
+ heartbeatPath?: string;
1620
+ }
1621
+ interface AutonomyDaemonStopInput {
1622
+ signal?: NodeJS.Signals;
1623
+ timeoutMs?: number;
1624
+ }
1625
+ interface AutonomyDaemonHeartbeat {
1626
+ ts: string;
1627
+ cycle?: number;
1628
+ readyThreads?: number;
1629
+ triggerActions?: number;
1630
+ runStatus?: string;
1631
+ driftOk?: boolean;
1632
+ driftIssues?: number;
1633
+ finalReadyThreads?: number;
1634
+ finalDriftOk?: boolean;
1635
+ }
1636
+ interface AutonomyDaemonStatus {
1637
+ running: boolean;
1638
+ pid?: number;
1639
+ pidPath: string;
1640
+ logPath: string;
1641
+ heartbeatPath: string;
1642
+ heartbeat?: AutonomyDaemonHeartbeat;
1643
+ }
1644
+ interface AutonomyDaemonStopResult {
1645
+ stopped: boolean;
1646
+ previouslyRunning: boolean;
1647
+ pid?: number;
1648
+ status: AutonomyDaemonStatus;
1649
+ }
1650
+ declare function startAutonomyDaemon(workspacePath: string, input: AutonomyDaemonStartInput): AutonomyDaemonStatus;
1651
+ declare function stopAutonomyDaemon(workspacePath: string, input?: AutonomyDaemonStopInput): Promise<AutonomyDaemonStopResult>;
1652
+ declare function readAutonomyDaemonStatus(workspacePath: string, options?: {
1653
+ cleanupStalePidFile?: boolean;
1654
+ }): AutonomyDaemonStatus;
1655
+
1656
+ type autonomyDaemon_AutonomyDaemonHeartbeat = AutonomyDaemonHeartbeat;
1657
+ type autonomyDaemon_AutonomyDaemonStartInput = AutonomyDaemonStartInput;
1658
+ type autonomyDaemon_AutonomyDaemonStatus = AutonomyDaemonStatus;
1659
+ type autonomyDaemon_AutonomyDaemonStopInput = AutonomyDaemonStopInput;
1660
+ type autonomyDaemon_AutonomyDaemonStopResult = AutonomyDaemonStopResult;
1661
+ declare const autonomyDaemon_readAutonomyDaemonStatus: typeof readAutonomyDaemonStatus;
1662
+ declare const autonomyDaemon_startAutonomyDaemon: typeof startAutonomyDaemon;
1663
+ declare const autonomyDaemon_stopAutonomyDaemon: typeof stopAutonomyDaemon;
1664
+ declare namespace autonomyDaemon {
1665
+ 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 };
1666
+ }
1667
+
892
1668
  interface DispatchAdapterCreateInput {
893
1669
  actor: string;
894
1670
  objective: string;
@@ -944,4 +1720,4 @@ declare class CursorCloudAdapter implements DispatchAdapter {
944
1720
  execute(input: DispatchAdapterExecutionInput): Promise<DispatchAdapterExecutionResult>;
945
1721
  }
946
1722
 
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 };
1723
+ 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 WorkgraphStatusSnapshot, type WorkgraphWorkspaceConfig, agent, autonomy, autonomyDaemon, bases, board, claimLease, clawdapus, commandCenter, index as diagnostics, dispatch, fetchSkillMarkdownFromUrl, gate, graph, installSkillIntegration, integration, ledger, matchesCronSchedule, nextCronMatch, onboard, orientation, parseCronExpression, policy, query, registry, searchQmdAdapter, skill, store, thread, threadAudit, trigger, triggerEngine, workspace };