@holmes-lab/holmes-kit 0.19.5 → 0.20.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +135 -0
  2. package/README.md +17 -1
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/approve-status.d.ts +24 -0
  5. package/dist/holmes/cli/approve-status.js +166 -0
  6. package/dist/holmes/cli/approve-watch.d.ts +6 -0
  7. package/dist/holmes/cli/approve-watch.js +6 -0
  8. package/dist/holmes/cli/approve.d.ts +27 -0
  9. package/dist/holmes/cli/approve.js +68 -7
  10. package/dist/holmes/cli/cli-execution.d.ts +2 -0
  11. package/dist/holmes/cli/cli-execution.js +24 -0
  12. package/dist/holmes/cli/gitignore-merge.d.ts +0 -5
  13. package/dist/holmes/cli/gitignore-merge.js +6 -2
  14. package/dist/holmes/cli/index.js +176 -139
  15. package/dist/holmes/cli/playbook-skills.d.ts +2 -22
  16. package/dist/holmes/cli/playbook-skills.js +10 -54
  17. package/dist/holmes/governance/approval-grants.d.ts +22 -0
  18. package/dist/holmes/governance/approval-grants.js +55 -1
  19. package/dist/holmes/governance/approval-queue.d.ts +43 -4
  20. package/dist/holmes/governance/approval-queue.js +86 -12
  21. package/dist/holmes/governance/display-id-aliases.d.ts +29 -0
  22. package/dist/holmes/governance/display-id-aliases.js +86 -0
  23. package/dist/holmes/governance/ledger-store.d.ts +42 -14
  24. package/dist/holmes/governance/ledger-store.js +49 -3
  25. package/dist/holmes/governance/ledger-timeline.d.ts +3 -1
  26. package/dist/holmes/governance/ledger-timeline.js +11 -1
  27. package/dist/holmes/governance/provenance-chain.d.ts +2 -0
  28. package/dist/holmes/governance/provenance-chain.js +13 -2
  29. package/dist/holmes/governance/provenance-ledger.d.ts +28 -0
  30. package/dist/holmes/governance/provenance-ledger.js +69 -16
  31. package/dist/holmes/governance/session-context.d.ts +3 -0
  32. package/dist/holmes/governance/session-context.js +26 -8
  33. package/dist/holmes/guardrail/risk-classifier.js +2 -2
  34. package/dist/holmes/guardrail/write-target.js +2 -1
  35. package/dist/holmes/hooks/pre-tool-use.js +12 -1
  36. package/dist/holmes/hooks/stop.js +14 -3
  37. package/dist/holmes/mcp/handlers/adoption.d.ts +118 -0
  38. package/dist/holmes/mcp/handlers/adoption.js +186 -0
  39. package/dist/holmes/mcp/handlers/entity-integration.d.ts +100 -0
  40. package/dist/holmes/mcp/handlers/entity-integration.js +324 -0
  41. package/dist/holmes/mcp/handlers/entity-renumber.d.ts +137 -0
  42. package/dist/holmes/mcp/handlers/entity-renumber.js +228 -0
  43. package/dist/holmes/mcp/handlers/entity-store.d.ts +78 -0
  44. package/dist/holmes/mcp/handlers/entity-store.js +212 -0
  45. package/dist/holmes/mcp/handlers/graph-operations.d.ts +90 -0
  46. package/dist/holmes/mcp/handlers/graph-operations.js +260 -0
  47. package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +34 -0
  48. package/dist/holmes/mcp/handlers/maintenance-analysis.js +288 -0
  49. package/dist/holmes/mcp/handlers/maintenance-evidence.d.ts +40 -0
  50. package/dist/holmes/mcp/handlers/maintenance-evidence.js +104 -0
  51. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +167 -0
  52. package/dist/holmes/mcp/handlers/operator-inspection.js +284 -0
  53. package/dist/holmes/mcp/handlers/phase-queries.d.ts +34 -0
  54. package/dist/holmes/mcp/handlers/phase-queries.js +86 -0
  55. package/dist/holmes/mcp/handlers/review-evidence.d.ts +47 -0
  56. package/dist/holmes/mcp/handlers/review-evidence.js +370 -0
  57. package/dist/holmes/mcp/handlers/review-queries.d.ts +68 -0
  58. package/dist/holmes/mcp/handlers/review-queries.js +79 -0
  59. package/dist/holmes/mcp/handlers/risk-assessment.d.ts +25 -0
  60. package/dist/holmes/mcp/handlers/risk-assessment.js +181 -0
  61. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +55 -0
  62. package/dist/holmes/mcp/handlers/slice-orchestration.js +324 -0
  63. package/dist/holmes/mcp/handlers/spec-approval.d.ts +105 -0
  64. package/dist/holmes/mcp/handlers/spec-approval.js +504 -0
  65. package/dist/holmes/mcp/handlers/spec-authoring.d.ts +57 -0
  66. package/dist/holmes/mcp/handlers/spec-authoring.js +326 -0
  67. package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +122 -0
  68. package/dist/holmes/mcp/handlers/spec-lifecycle.js +339 -0
  69. package/dist/holmes/mcp/handlers/spec-queries.d.ts +30 -0
  70. package/dist/holmes/mcp/handlers/spec-queries.js +74 -0
  71. package/dist/holmes/mcp/handlers/taint-screening.d.ts +48 -0
  72. package/dist/holmes/mcp/handlers/taint-screening.js +183 -0
  73. package/dist/holmes/mcp/handlers/test-execution.d.ts +63 -0
  74. package/dist/holmes/mcp/handlers/test-execution.js +210 -0
  75. package/dist/holmes/mcp/handlers/workspace-identity.d.ts +30 -0
  76. package/dist/holmes/mcp/handlers/workspace-identity.js +68 -0
  77. package/dist/holmes/mcp/handlers/workspace-queries.d.ts +77 -0
  78. package/dist/holmes/mcp/handlers/workspace-queries.js +193 -0
  79. package/dist/holmes/mcp/handlers.d.ts +653 -424
  80. package/dist/holmes/mcp/handlers.js +267 -3250
  81. package/dist/holmes/mcp/server.js +2 -1
  82. package/dist/holmes/mcp/tool-schemas.js +43 -2
  83. package/dist/holmes/project/execution-context.d.ts +17 -0
  84. package/dist/holmes/project/execution-context.js +120 -0
  85. package/dist/holmes/project/installer-markers.d.ts +34 -0
  86. package/dist/holmes/project/installer-markers.js +65 -0
  87. package/dist/holmes/project/root.d.ts +3 -1
  88. package/dist/holmes/project/root.js +4 -3
  89. package/dist/holmes/project/workspace-identity.d.ts +29 -0
  90. package/dist/holmes/project/workspace-identity.js +181 -0
  91. package/dist/holmes/review/test-outcomes.d.ts +6 -1
  92. package/dist/holmes/review/test-outcomes.js +23 -5
  93. package/dist/holmes/review/test-runner.d.ts +18 -0
  94. package/dist/holmes/review/test-runner.js +132 -4
  95. package/dist/holmes/rtm/graph-store.d.ts +50 -1
  96. package/dist/holmes/rtm/graph-store.js +244 -3
  97. package/dist/holmes/rtm/incremental.d.ts +1 -0
  98. package/dist/holmes/rtm/incremental.js +12 -3
  99. package/dist/holmes/rtm/localize.js +7 -0
  100. package/dist/holmes/rtm/rtm-graph.d.ts +9 -0
  101. package/dist/holmes/rtm/rtm-graph.js +13 -0
  102. package/dist/holmes/semantic/vector-cache.d.ts +16 -1
  103. package/dist/holmes/semantic/vector-cache.js +155 -19
  104. package/dist/holmes/spec/approval-status.d.ts +10 -0
  105. package/dist/holmes/spec/approval-status.js +7 -3
  106. package/dist/holmes/spec/entity-git-snapshot.d.ts +50 -0
  107. package/dist/holmes/spec/entity-git-snapshot.js +276 -0
  108. package/dist/holmes/spec/entity-integration-discharge.d.ts +73 -0
  109. package/dist/holmes/spec/entity-integration-discharge.js +233 -0
  110. package/dist/holmes/spec/entity-integration-transaction.d.ts +179 -0
  111. package/dist/holmes/spec/entity-integration-transaction.js +1221 -0
  112. package/dist/holmes/spec/entity-integration.d.ts +207 -0
  113. package/dist/holmes/spec/entity-integration.js +747 -0
  114. package/dist/holmes/spec/entity-renumber-transaction.d.ts +82 -0
  115. package/dist/holmes/spec/entity-renumber-transaction.js +711 -0
  116. package/dist/holmes/spec/entity-renumber.d.ts +32 -0
  117. package/dist/holmes/spec/entity-renumber.js +156 -0
  118. package/dist/holmes/spec/entity-store.d.ts +135 -0
  119. package/dist/holmes/spec/entity-store.js +1051 -0
  120. package/dist/holmes/spec/entity-transaction.d.ts +89 -0
  121. package/dist/holmes/spec/entity-transaction.js +701 -0
  122. package/dist/holmes/spec/renumber.d.ts +58 -0
  123. package/dist/holmes/spec/renumber.js +200 -1
  124. package/dist/holmes/spec/spec-store.d.ts +3 -2
  125. package/dist/holmes/spec/spec-store.js +23 -2
  126. package/dist/holmes/spec/transition-policy.d.ts +36 -0
  127. package/dist/holmes/spec/transition-policy.js +135 -0
  128. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ import * as fs from 'node:fs';
2
+ export declare class EntityStoreError extends Error {
3
+ readonly code: string;
4
+ readonly holmesRefusal = true;
5
+ constructor(code: string, message: string);
6
+ }
7
+ export declare function entityContentVersion(bytes: Buffer | string): string;
8
+ export declare function entityStat(file: string): fs.Stats | undefined;
9
+ export declare function entityDirectory(root: string, relative: string, create?: boolean): string;
10
+ export declare function readEntityBytes(file: string): Buffer | undefined;
11
+ /** Stage and fsync complete bytes, then publish without replacing any existing target. */
12
+ export declare function publishEntityRecord(root: string, relative: string, bytes: string): void;
13
+ export interface EntityByteChange {
14
+ locator: string;
15
+ before: string | null;
16
+ after: string | null;
17
+ beforeMode?: '100644' | '100755' | null;
18
+ afterMode?: '100644' | '100755' | null;
19
+ }
20
+ /**
21
+ * @implements A-SPEC-639 — roll an operation's own publications back. Steps are judged in reverse
22
+ * order, one verdict per locator (its last step): bytes equal to `after` are the operation's own
23
+ * publication and are restored to `before`; bytes equal to `before` were never published; anything
24
+ * else is a third state and is preserved untouched.
25
+ */
26
+ export declare function abandonPublishedSteps(root: string, steps: EntityByteChange[]): {
27
+ restored: string[];
28
+ untouched: string[];
29
+ preserved: string[];
30
+ };
31
+ /** @implements A-SPEC-639 — retire a pending operation as ABANDONED: its journal and owners move under `.ax/state/entity-abandoned`. */
32
+ export declare function abandonEntityOperation(root: string, operationId: string, locator: string, expectedJournalVersion: string, outcome: {
33
+ restored: string[];
34
+ untouched: string[];
35
+ preserved: string[];
36
+ }): void;
37
+ /** Keep the complete journal as a receipt; never expose an empty pending operation. */
38
+ export declare function entityLockOwner(root: string, locator: string): {
39
+ token: string;
40
+ version: string;
41
+ } | null;
42
+ export declare function entityCompletionRecord(root: string, operationId: string, locator: string, journal: Buffer): string;
43
+ export declare function retireEntityOperation(root: string, operationId: string, locator: string, expectedJournalVersion: string): void;
44
+ export declare function assertEntityByteInput(root: string, change: EntityByteChange): void;
45
+ export declare function isEntityTransientName(name: string): boolean;
46
+ /**
47
+ * @implements A-SPEC-640 — read-only view of a target that sees through a lone aside: when the target
48
+ * is absent and exactly one aside exists beside it, the aside's bytes and mode are the target's current
49
+ * state (a crash between move-aside and link). Several asides are reported, not resolved.
50
+ */
51
+ export declare function observeEntityTarget(root: string, locator: string): {
52
+ bytes?: Buffer;
53
+ mode: '100644' | '100755' | null;
54
+ aside?: string;
55
+ asides: string[];
56
+ };
57
+ /**
58
+ * @implements A-SPEC-640 — executor-side settlement under ownership: a lone aside goes back to its
59
+ * absent target; temps in the steps' directories holding a step's own `after` bytes are removed.
60
+ * Anything else is preserved.
61
+ */
62
+ export declare function settleEntityTransients(root: string, steps: EntityByteChange[]): {
63
+ restored: string[];
64
+ removed: string[];
65
+ };
66
+ /**
67
+ * Changes are generated by the owning store, not executed from an untrusted recovery payload.
68
+ * @implements A-SPEC-640 — updates and deletions publish through a verified aside: the original is
69
+ * moved aside, checked byte-for-byte (and by mode) against the expected `before`, and only then the
70
+ * new bytes are linked into place (or the aside removed for a deletion). A foreign write inside the
71
+ * window is therefore refused with the original back in place; a file that appears at the target
72
+ * after the move-aside is refused and both files are preserved.
73
+ */
74
+ export declare function applyEntityByteChange(root: string, change: EntityByteChange): void;
75
+ /** The shared source-publication coordination namespace, independent of every configured spec store (A-SPEC-634: exported so recovery can release it without importing the renumber module). */
76
+ export declare const SOURCE_PUBLICATION_LOCATOR = ".ax/state/entity-renumber-source-publication";
77
+ /** Age after which a `.staging-*` entry beside the locks is treated as abandoned by a publisher that died before its rename (A-SPEC-633). */
78
+ export declare const LOCK_STAGING_STALE_MS: number;
79
+ export declare function withEntityStoreLock<T>(root: string, locator: string, act: () => T): T;
80
+ /** Keep ownership through asynchronous repository lookups and final publication. */
81
+ export declare function withEntityStoreLockAsync<T>(root: string, locator: string, act: () => T | Promise<T>): Promise<T>;
82
+ /**
83
+ * @implements A-SPEC-638 — whether the current generation of a store lock is held by a live process.
84
+ * Follows the owner/successor chain the recovery lock follows; a missing, malformed or released
85
+ * chain end, or a holder that no longer answers a signal probe, is "not alive".
86
+ */
87
+ export declare function entityLockHolderAlive(root: string, locator: string): boolean;
88
+ /** Claim a dead owner's immutable generation without deleting or replacing its lock. */
89
+ export declare function withEntityRecoveryLock<T>(root: string, locator: string, act: () => T): T;