@slicedearth/whoisleuth-cli 2.4.0 → 2.6.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 (340) hide show
  1. package/DISCLOSURE +1 -1
  2. package/NOTICE +2 -2
  3. package/cli/argument-values.mjs +55 -0
  4. package/cli/arguments.mjs +24 -470
  5. package/cli/artifact-validation/case-response.mjs +67 -9
  6. package/cli/artifact-validation/lookup-evidence.mjs +18 -4
  7. package/cli/artifact-validation/signed-review.mjs +61 -64
  8. package/cli/artifact-verify.mjs +11 -2
  9. package/cli/assurance-arguments.mjs +56 -0
  10. package/cli/assurance-command-definitions.mjs +179 -0
  11. package/cli/assurance-command-runner.mjs +1 -1
  12. package/cli/bounded-json.mjs +1 -1
  13. package/cli/bulk-checkpoint.mjs +1 -1
  14. package/cli/bulk-command-runner.mjs +6 -8
  15. package/cli/bulk.mjs +2 -3
  16. package/cli/case-command.mjs +99 -6
  17. package/cli/case-pack.mjs +19 -4
  18. package/cli/ci-report.mjs +6 -3
  19. package/cli/collection-arguments.mjs +123 -0
  20. package/cli/collection-command-definitions.mjs +330 -0
  21. package/cli/collection-preflight.mjs +8 -1
  22. package/cli/command-argument-grammar.mjs +8 -210
  23. package/cli/command-definition.mjs +330 -0
  24. package/cli/command-reference.mjs +55 -1388
  25. package/cli/command-seeds.mjs +18 -0
  26. package/cli/compare.mjs +1 -1
  27. package/cli/config-profile.mjs +1 -1
  28. package/cli/ct-event-intake.mjs +4 -4
  29. package/cli/discover.mjs +2 -2
  30. package/cli/discovery-observation-snapshot.mjs +2 -2
  31. package/cli/discovery-scan-command-runner.mjs +7 -9
  32. package/cli/discovery-scan.mjs +1 -1
  33. package/cli/discovery-snapshot.mjs +2 -2
  34. package/cli/discovery-workflow.mjs +4 -4
  35. package/cli/domain-control-monitor.mjs +6 -6
  36. package/cli/domain-control-observations.mjs +2 -1
  37. package/cli/domain-feed.mjs +61 -0
  38. package/cli/errors.mjs +5 -6
  39. package/cli/evidence-arguments.mjs +46 -0
  40. package/cli/evidence-command-definitions.mjs +69 -0
  41. package/cli/evidence-command-runner.mjs +2 -3
  42. package/cli/evidence-signing.mjs +3 -2
  43. package/cli/external-observation-mapping.mjs +2 -2
  44. package/cli/formatters/json.mjs +1 -13
  45. package/cli/formatters/terminal-command-formats.mjs +6 -0
  46. package/cli/formatters/terminal-lookup.mjs +6 -0
  47. package/cli/history-arguments.mjs +39 -0
  48. package/cli/history-command-definitions.mjs +88 -0
  49. package/cli/indicator-set-command.mjs +32 -0
  50. package/cli/inline-command-families.mjs +6 -47
  51. package/cli/inline-command-runner.mjs +4 -31
  52. package/cli/input.mjs +2 -2
  53. package/cli/intake-command.mjs +147 -0
  54. package/cli/interchange-report.mjs +4 -2
  55. package/cli/investigation-artifacts.mjs +3 -4
  56. package/cli/investigation-package-review.mjs +2 -0
  57. package/cli/investigation-plan.mjs +32 -154
  58. package/cli/investigation-recipes.mjs +177 -0
  59. package/cli/investigation-run.mjs +78 -12
  60. package/cli/local-mmdb-review.mjs +220 -17
  61. package/cli/lookalike-calibration.mjs +1 -1
  62. package/cli/lookup-brief.mjs +2 -2
  63. package/cli/lookup-command-runner.mjs +19 -35
  64. package/cli/lookup-diff.mjs +10 -9
  65. package/cli/lookup-plan.mjs +10 -14
  66. package/cli/lookup-reconcile.mjs +6 -5
  67. package/cli/lookup-timeline.mjs +7 -6
  68. package/cli/mail-header-review.mjs +24 -247
  69. package/cli/mail-review.mjs +9 -7
  70. package/cli/network-arguments.mjs +51 -0
  71. package/cli/network-command-definitions.mjs +130 -0
  72. package/cli/network-command-runner.mjs +43 -31
  73. package/cli/offline-evidence-review.mjs +85 -6
  74. package/cli/posture.mjs +1 -1
  75. package/cli/registry-fixture-scaffold.mjs +1 -1
  76. package/cli/retained-artifact-diff.mjs +8 -7
  77. package/cli/review-arguments.mjs +132 -0
  78. package/cli/review-command-definitions.mjs +279 -0
  79. package/cli/review-command-runner.mjs +72 -159
  80. package/cli/risk-calibration.mjs +14 -12
  81. package/cli/runner.mjs +20 -32
  82. package/cli/saved-lookup.mjs +2 -2
  83. package/cli/selected-input-worker.mjs +73 -0
  84. package/cli/sharing-review.mjs +5 -64
  85. package/cli/source-reliability.mjs +2 -2
  86. package/cli/support-arguments.mjs +49 -0
  87. package/cli/support-command-definitions.mjs +209 -0
  88. package/cli/support-command-runner.mjs +4 -4
  89. package/cli/watchlist-review.mjs +43 -0
  90. package/cli/workflow-arguments.mjs +100 -0
  91. package/cli/workflow-command-definitions.mjs +103 -0
  92. package/cli/workflow-command-runner.mjs +40 -1
  93. package/docs/cli-reference.md +27 -0
  94. package/docs/cli.md +322 -4
  95. package/docs/contextual-reviews.md +178 -0
  96. package/docs/infrastructure-observations.md +126 -0
  97. package/docs/offline-intake-context.md +213 -0
  98. package/lib/analyst-taxonomy.mjs +2 -40
  99. package/lib/application-version.mjs +1 -1
  100. package/lib/availability.mjs +13 -789
  101. package/lib/bounded-contract-normalizers.mjs +4 -0
  102. package/lib/bounded-json.mjs +2 -330
  103. package/lib/browser-library-profile.mjs +62 -84
  104. package/lib/candidate-provenance-bounds.mjs +2 -0
  105. package/lib/classify.mjs +1 -1
  106. package/lib/credential-form-attribution.mjs +136 -0
  107. package/lib/credential-surface-profile.mjs +6 -2
  108. package/lib/ct-query.mjs +2 -27
  109. package/lib/ct-response-bounds.mjs +2 -9
  110. package/lib/ct-search.mjs +83 -47
  111. package/lib/dmarc-discovery.mjs +62 -0
  112. package/lib/dns-convergence-review.mjs +21 -8
  113. package/lib/dns-delegation-health.mjs +35 -15
  114. package/lib/dns-inheritance-review.mjs +53 -63
  115. package/lib/dns-intelligence.mjs +27 -11
  116. package/lib/dns-query-coverage.mjs +40 -0
  117. package/lib/domain-assurance.mjs +1 -1
  118. package/lib/domain-change-packet.mjs +12 -13
  119. package/lib/domain-change-review.mjs +32 -14
  120. package/lib/domain-control-flight-recorder.mjs +103 -27
  121. package/lib/domain-control-manifest.mjs +25 -17
  122. package/lib/domain-posture-analysis.mjs +75 -7
  123. package/lib/domain-posture-parsers.mjs +9 -0
  124. package/lib/domain-posture.mjs +45 -25
  125. package/lib/domain-registration.mjs +392 -0
  126. package/lib/evidence-export-privacy.mjs +27 -17
  127. package/lib/evidence-export.mjs +3 -3
  128. package/lib/evidence-report.mjs +5 -1
  129. package/lib/external-intelligence-risk.mjs +2 -124
  130. package/lib/favicon.mjs +13 -4
  131. package/lib/generated/cisa-kev-catalog.mjs +41 -3
  132. package/lib/generated/registrar-standing-catalogue.mjs +18 -10
  133. package/lib/generated/retire-browser-catalog.mjs +332 -19
  134. package/lib/generated/{unicode-confusables-17.mjs → unicode-confusables.mjs} +33 -33
  135. package/lib/html-signals.mjs +13 -2
  136. package/lib/http-evidence-bounds.mjs +2 -8
  137. package/lib/http-intelligence.mjs +13 -1
  138. package/lib/idn-confusable-policy.mjs +6 -4
  139. package/lib/idn-confusables.mjs +1 -1
  140. package/lib/interchange-fidelity-registry.mjs +10 -0
  141. package/lib/lookup-child-profile-contract.mjs +28 -11
  142. package/lib/lookup-contract-primitives.mjs +1 -1
  143. package/lib/lookup-diagnostics.mjs +1 -23
  144. package/lib/lookup-network-evidence-bounds.mjs +1 -10
  145. package/lib/lookup-progress.mjs +50 -1
  146. package/lib/lookup-response-contract.mjs +70 -40
  147. package/lib/lookup-response.mjs +5 -15
  148. package/lib/lookup-source-progress.mjs +8 -22
  149. package/lib/lookup.mjs +1 -1
  150. package/lib/operation-budget.mjs +4 -0
  151. package/lib/opportunity-scoring.mjs +2 -107
  152. package/lib/outbound-identity.mjs +1 -1
  153. package/lib/page-fingerprints.mjs +18 -1
  154. package/lib/perceptual-hash-comparison.mjs +2 -34
  155. package/lib/perceptual-hash.mjs +36 -10
  156. package/lib/portable-generator.mjs +2 -29
  157. package/lib/project-metadata.mjs +2 -8
  158. package/lib/rdap-client.mjs +11 -7
  159. package/lib/registrable-domain.mjs +2 -56
  160. package/lib/registrar-standing-contract.mjs +1 -1
  161. package/lib/registrar-standing.mjs +9 -13
  162. package/lib/registry-capabilities.mjs +2 -2
  163. package/lib/registry-capability-catalogue.mjs +27 -19
  164. package/lib/risk-calibration-summary.mjs +2 -352
  165. package/lib/risk-scoring.mjs +2 -345
  166. package/lib/scoring-evidence-quality.mjs +2 -107
  167. package/lib/semantic-version.mjs +2 -54
  168. package/lib/service-binding-dns.mjs +46 -2
  169. package/lib/smtp-transport-review.mjs +48 -19
  170. package/lib/sslbl-certificates.generated.mjs +142 -139
  171. package/lib/static-html-analysis.mjs +32 -4
  172. package/lib/structured-data-identity.mjs +1 -1
  173. package/lib/technology-evidence-role.mjs +1 -51
  174. package/lib/threat-intelligence-manifests.mjs +1 -1
  175. package/lib/threat-intelligence-runtime.mjs +1 -1
  176. package/lib/threat-intelligence-targets.mjs +1 -1
  177. package/lib/threat-intelligence-types.mjs +2 -75
  178. package/lib/tls-intelligence.mjs +30 -5
  179. package/lib/typosquat-generator.mjs +11 -2
  180. package/lib/website-enrichment.mjs +404 -0
  181. package/lib/whois-authority.mjs +43 -5
  182. package/lib/whois-chain.mjs +12 -3
  183. package/lib/whois-common-formats.mjs +3 -1
  184. package/lib/whois-contacts.mjs +13 -2
  185. package/lib/whois-normalization.mjs +3 -1
  186. package/lib/whois-parser.mjs +5 -3
  187. package/package.json +15 -14
  188. package/packages/analysis/analyst-taxonomy.mjs +40 -0
  189. package/packages/analysis/bounded-json.mjs +330 -0
  190. package/packages/analysis/candidate-provenance-bounds.mjs +4 -0
  191. package/packages/analysis/cli-argument-grammar.mjs +216 -0
  192. package/packages/analysis/ct-query.mjs +27 -0
  193. package/packages/analysis/ct-response-bounds.mjs +9 -0
  194. package/packages/analysis/external-intelligence-risk.mjs +124 -0
  195. package/packages/analysis/http-evidence-bounds.mjs +8 -0
  196. package/packages/analysis/lookup-network-evidence-bounds.mjs +10 -0
  197. package/packages/analysis/opportunity-scoring.mjs +107 -0
  198. package/packages/analysis/perceptual-hash-comparison.mjs +34 -0
  199. package/packages/analysis/portable-generator.mjs +29 -0
  200. package/packages/analysis/project-metadata.mjs +8 -0
  201. package/packages/analysis/registrable-domain.mjs +56 -0
  202. package/packages/analysis/risk-calibration-summary.mjs +352 -0
  203. package/packages/analysis/risk-scoring.mjs +348 -0
  204. package/packages/analysis/scoring-evidence-quality.mjs +107 -0
  205. package/packages/analysis/semantic-version.mjs +54 -0
  206. package/packages/analysis/threat-intelligence-types.mjs +75 -0
  207. package/packages/cases/case-containment-handoff.mjs +195 -0
  208. package/packages/cases/case-evidence-links.mjs +151 -0
  209. package/packages/cases/case-evidence-model.mjs +89 -12
  210. package/packages/cases/case-evidence-quality.mjs +5 -0
  211. package/packages/cases/case-export-input.mjs +7 -5
  212. package/packages/cases/case-incident-context.mjs +52 -0
  213. package/packages/cases/case-markdown.mjs +11 -0
  214. package/packages/cases/case-migration-model.mjs +40 -24
  215. package/packages/cases/case-object-coverage.mjs +33 -0
  216. package/packages/cases/case-packet-correction.mjs +106 -0
  217. package/packages/cases/case-recheck-model.mjs +124 -36
  218. package/packages/cases/case-record-contracts.mjs +1 -1
  219. package/packages/cases/case-record-core.mjs +1 -1
  220. package/packages/cases/case-record-operations.mjs +111 -118
  221. package/packages/cases/case-record-projection.mjs +23 -4
  222. package/packages/cases/case-record-version-input.mjs +41 -0
  223. package/packages/cases/case-report.mjs +93 -27
  224. package/packages/cases/case-requested-evidence.mjs +146 -0
  225. package/packages/cases/case-response-actions.mjs +159 -1
  226. package/packages/cases/case-response-model.mjs +16 -1
  227. package/packages/cases/case-response-object.mjs +119 -0
  228. package/packages/cases/case-response-outcomes.mjs +108 -20
  229. package/packages/cases/case-response-packet-render.mjs +35 -12
  230. package/packages/cases/case-response-packet.mjs +55 -13
  231. package/packages/cases/case-response-records.mjs +0 -1
  232. package/packages/cases/case-response-review-inputs.mjs +60 -8
  233. package/packages/cases/case-storage-model.mjs +1 -1
  234. package/packages/cases/case-workflow-metadata.mjs +217 -0
  235. package/packages/cases/case-workflow-migration.mjs +43 -0
  236. package/packages/cases/http-summary.mjs +6 -1
  237. package/packages/comparison/favicon-similarity.mjs +1 -1
  238. package/packages/comparison/page-similarity.mjs +1 -1
  239. package/packages/comparison/relationship-evidence.mjs +21 -9
  240. package/packages/comparison/relationship-provenance.mjs +7 -1
  241. package/packages/contracts/analyst-interchange.mjs +35 -15
  242. package/packages/contracts/candidate-watch-review.mjs +54 -0
  243. package/packages/contracts/case-portability.mjs +360 -49
  244. package/packages/contracts/cli-command-semantics.mjs +5 -0
  245. package/packages/contracts/cli-grammar.mjs +6 -0
  246. package/packages/contracts/cli-lookup-brief.mjs +2 -0
  247. package/packages/contracts/context-review.mjs +25 -0
  248. package/packages/contracts/document-intake.mjs +11 -0
  249. package/packages/contracts/domain-control-flight-recorder.mjs +30 -14
  250. package/packages/contracts/domain-control-manifest.mjs +1 -1
  251. package/packages/contracts/domain-control-monitor.mjs +13 -2
  252. package/packages/contracts/domain-control-review.mjs +36 -15
  253. package/packages/contracts/external-observation-interchange.mjs +96 -28
  254. package/packages/contracts/har-review.mjs +2 -0
  255. package/packages/contracts/identity-events.mjs +4 -0
  256. package/packages/contracts/investigation-run.mjs +2 -0
  257. package/packages/contracts/ip-address.mjs +10 -0
  258. package/packages/contracts/lookup-evidence.mjs +3 -2
  259. package/packages/contracts/mail-authentication.mjs +5 -0
  260. package/packages/contracts/message-intake.mjs +37 -0
  261. package/packages/contracts/offline-comparison.mjs +4 -1
  262. package/packages/contracts/passive-mail.mjs +10 -0
  263. package/packages/contracts/risk-calibration.mjs +44 -29
  264. package/packages/contracts/schema-lifecycle.mjs +3 -1
  265. package/packages/contracts/web-capture.mjs +2 -2
  266. package/packages/contracts/workspace-portability.mjs +144 -28
  267. package/packages/evidence/collection-quality.mjs +67 -0
  268. package/packages/evidence/credential-form-attribution.mjs +60 -0
  269. package/packages/evidence/dns-query-outcome.mjs +72 -0
  270. package/packages/evidence/email-recipient.mjs +18 -0
  271. package/packages/evidence/image-regions.mjs +15 -0
  272. package/packages/evidence/lookup-target.mjs +5 -1
  273. package/packages/evidence/observation.mjs +2 -0
  274. package/packages/evidence/png-pixels.mjs +117 -0
  275. package/packages/evidence/public-address-policy.mjs +83 -0
  276. package/packages/evidence/record-identity.mjs +60 -16
  277. package/packages/evidence/technology-evidence-role.mjs +51 -0
  278. package/packages/interchange/defensive-indicator-export.mjs +264 -0
  279. package/packages/interchange/external-findings-import.mjs +36 -29
  280. package/packages/interchange/json-output.mjs +14 -0
  281. package/packages/interchange/managed-indicator-export.mjs +36 -0
  282. package/packages/interchange/managed-indicator-set.mjs +223 -0
  283. package/packages/interchange/misp-indicator-export.mjs +93 -0
  284. package/packages/interchange/sharing-policy.mjs +56 -0
  285. package/packages/interchange/stix-indicator-export.mjs +129 -0
  286. package/packages/interchange/web-capture-import.mjs +22 -15
  287. package/packages/investigation/acquisition-decision-packet.mjs +79 -1
  288. package/packages/investigation/bulk-mail-exposure.mjs +7 -13
  289. package/packages/investigation/capture-coverage.mjs +57 -0
  290. package/packages/investigation/connector-provenance-review.mjs +100 -0
  291. package/packages/investigation/context-review.mjs +35 -0
  292. package/packages/investigation/document-intake.mjs +87 -0
  293. package/packages/investigation/docx-intake.mjs +133 -0
  294. package/packages/investigation/domain-history-review.mjs +132 -0
  295. package/packages/investigation/domain-transition-review.mjs +49 -0
  296. package/packages/investigation/evidence-coverage-ledger.mjs +9 -1
  297. package/packages/investigation/har-intake.mjs +68 -0
  298. package/packages/investigation/identity-event-intake.mjs +131 -0
  299. package/packages/investigation/identity-incident-review.mjs +39 -0
  300. package/packages/investigation/incident-sequence-review.mjs +58 -0
  301. package/packages/investigation/infrastructure-observation.mjs +234 -0
  302. package/packages/investigation/intake-context.mjs +284 -0
  303. package/packages/investigation/intake-indicators.mjs +116 -0
  304. package/packages/investigation/intake-phones.mjs +155 -0
  305. package/packages/investigation/intake-report.mjs +20 -0
  306. package/packages/investigation/investigation-manifest.mjs +35 -9
  307. package/packages/investigation/link-intake.mjs +209 -0
  308. package/packages/investigation/lookup-asset-graph.mjs +1 -1
  309. package/packages/investigation/mail-authentication-review.mjs +222 -0
  310. package/packages/investigation/mail-header-identity.mjs +209 -0
  311. package/packages/investigation/message-intake.mjs +235 -0
  312. package/packages/investigation/page-behaviour.mjs +113 -0
  313. package/packages/investigation/pdf-intake.mjs +155 -0
  314. package/packages/investigation/platform-continuity-review.mjs +60 -0
  315. package/packages/investigation/qr-intake.mjs +56 -0
  316. package/packages/investigation/requested-action-hints.mjs +11 -0
  317. package/packages/investigation/selected-input-review.mjs +17 -0
  318. package/packages/investigation/storefront-review.mjs +70 -0
  319. package/packages/monitoring/domain-feed.mjs +321 -0
  320. package/packages/workspace/brand-candidate-workflow.mjs +351 -0
  321. package/packages/workspace/brand-keyword-campaign.mjs +231 -0
  322. package/packages/workspace/brand-profile-model.mjs +48 -4
  323. package/packages/workspace/bulk-review-model.mjs +28 -26
  324. package/packages/workspace/bulk-session-model.mjs +27 -13
  325. package/packages/workspace/campaign-model.mjs +1 -1
  326. package/packages/workspace/candidate-watch-handoff.mjs +195 -0
  327. package/packages/workspace/detection-rule-model.mjs +11 -3
  328. package/packages/workspace/hostile-input.mjs +1 -1
  329. package/packages/workspace/investigation-guide.mjs +2 -2
  330. package/packages/workspace/investigation-template-model.mjs +26 -2
  331. package/packages/workspace/page-baseline.mjs +2 -2
  332. package/packages/workspace/relationship-observation-model.mjs +17 -13
  333. package/packages/workspace/shortlist-model.mjs +24 -7
  334. package/packages/workspace/watchlist-history.mjs +59 -16
  335. package/packages/workspace/watchlist-store.mjs +152 -11
  336. package/packages/workspace/website-snapshot-model.mjs +28 -3
  337. package/packages/workspace/workspace-archive-crypto.mjs +1 -1
  338. package/packages/workspace/workspace-archive.mjs +5 -4
  339. package/third-party-notices.txt +549 -16
  340. package/lib/hostname.mjs +0 -2
@@ -1,156 +1,20 @@
1
1
  import { domainToASCII } from 'node:url';
2
2
  import { normalizeExplicitIsoTimestamp } from "../packages/evidence/observation.mjs";
3
- import { CLI_DOMAIN_CONTROL_MONITOR_SCHEMA } from "../packages/contracts/domain-control-monitor.mjs";
4
- import { DOMAIN_CONTROL_REVIEW_SCHEMA } from "../packages/contracts/domain-control-review.mjs";
5
- import { EXTERNAL_FINDINGS_SCHEMA } from "../packages/interchange/external-findings-import.mjs";
6
- import { CLI_LOOKUP_BRIEF_SCHEMA } from "./lookup-brief.mjs";
7
- import { INVESTIGATION_PLAN_RECIPES, RUNNABLE_INVESTIGATION_PLAN_RECIPES, cliInvocationNetworkEffect, } from "./command-reference.mjs";
3
+ import { cliInvocationNetworkEffect } from "./command-reference.mjs";
4
+ import { INVESTIGATION_RECIPE_DEFINITIONS, INVESTIGATION_PLAN_RECIPES, RUNNABLE_INVESTIGATION_PLAN_RECIPES, } from "./investigation-recipes.mjs";
8
5
  export const CLI_INVESTIGATION_PLAN_SCHEMA = 'whoisleuth.cli.investigation-plan';
9
6
  export const CLI_INVESTIGATION_PLAN_VERSION = 1;
10
7
  export const CLI_WORKFLOW_RECIPE_CATALOGUE_SCHEMA = 'whoisleuth.cli.workflow-recipe-catalogue';
11
8
  export const CLI_WORKFLOW_RECIPE_CATALOGUE_VERSION = 1;
12
9
  export { INVESTIGATION_PLAN_RECIPES, RUNNABLE_INVESTIGATION_PLAN_RECIPES };
13
- const RECIPES = Object.freeze({
14
- 'domain-triage': Object.freeze({
15
- id: 'domain-triage',
16
- label: 'New domain triage',
17
- standardInputs: Object.freeze([
18
- { stepId: 'export', input: 1, sourceStepId: 'collect' },
19
- { stepId: 'verify', input: 1, sourceStepId: 'export' },
20
- ]),
21
- subjectRequirement: 'domain',
22
- objective: 'Collect and preserve separately attributed registration, DNS, HTTP, TLS, page, and network-context evidence.',
23
- limitations: Object.freeze([
24
- 'Collection remains analyst-triggered and source limitations remain explicit.',
25
- 'Disposition, reviewed response actions, monitoring, and closure continue in the saved Case workspace; this CLI recipe does not submit reports.',
26
- ]),
27
- steps: (domain) => Object.freeze([
28
- step('collect', 'Collect a Deep lookup', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Review source health and limitations before using missing fields.'),
29
- step('export', 'Create a portable evidence report', 'export', ['<saved-lookup.json>'], 'offline', 'analyst_selection', 'whoisleuth.lookup-evidence', 'Reuse the collected Lookup by default, or select a different reviewed Lookup file.'),
30
- step('verify', 'Verify the exported artefact', 'verify-artifact', ['<evidence.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.offline-artifact-verification', 'Keep verification distinct from a claim that the observations are correct or current.'),
31
- ]),
32
- }),
33
- 'lookalike-review': Object.freeze({
34
- id: 'lookalike-review',
35
- label: 'Lookalike candidate review',
36
- subjectRequirement: 'brand_or_domain',
37
- objective: 'Generate a bounded candidate queue, collect only the selected scope, and retain a reviewed candidate lookup.',
38
- limitations: Object.freeze([
39
- 'Candidate generation does not establish registration, control, intent, or maliciousness.',
40
- 'Official-reference collection and page comparison require analyst-selected saved evidence; use page-compare after retaining the reference and candidate observations.',
41
- ]),
42
- steps: (subject) => Object.freeze([
43
- step('generate', 'Generate candidates offline', 'discover', [subject, '--preset', 'all', '--json'], 'offline', 'none', 'whoisleuth.cli.discover', 'Review mutation families and suppressions before collection.'),
44
- step('scan', 'Collect a bounded candidate queue', 'discover-scan', [subject, '--fast', '--scan-limit', '50', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.discovery-scan', 'Fast collection is a triage boundary; partial or inconclusive authority evidence remains explicit.'),
45
- step('inspect', 'Deep-review one selected candidate', 'lookup', ['<selected-domain>', '--deep', '--json'], 'network', 'analyst_selection', 'whoisleuth.cli.lookup', 'Select a candidate deliberately; generation does not prove registration, control, intent, or maliciousness.'),
46
- ]),
47
- }),
48
- 'owned-domain-review': Object.freeze({
49
- id: 'owned-domain-review',
50
- label: 'Owned domain posture review',
51
- subjectRequirement: 'domain',
52
- objective: 'Review current passive posture and compare supplied observations with an analyst-authored control manifest.',
53
- limitations: Object.freeze(['Use only for a domain the analyst owns or is authorised to review.']),
54
- steps: (domain) => Object.freeze([
55
- step('posture', 'Collect bounded DNS posture', 'posture', [domain, '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.posture', 'Review mail profile and delegation evidence before interpreting missing records.'),
56
- step('lookup', 'Collect supporting Deep evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Retain separately attributed registration, DNS, TLS, and page observations.'),
57
- step('manifest', 'Review the domain control manifest', 'domain-control', ['<review-input.json>', '--json'], 'offline', 'analyst_selection', DOMAIN_CONTROL_REVIEW_SCHEMA, 'Only complete supplied observations may produce drift.'),
58
- ]),
59
- }),
60
- 'historical-comparison': Object.freeze({
61
- id: 'historical-comparison',
62
- label: 'Historical observation comparison',
63
- standardInputs: Object.freeze([
64
- { stepId: 'diff', input: 2, sourceStepId: 'current' },
65
- { stepId: 'timeline', input: 3, sourceStepId: 'current' },
66
- ]),
67
- subjectRequirement: 'domain',
68
- objective: 'Collect a current observation and compare it with analyst-selected saved observations without merging source states.',
69
- limitations: Object.freeze(['A later observation does not retroactively refresh retained evidence.']),
70
- steps: (domain) => Object.freeze([
71
- step('current', 'Collect the current lookup', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'A current request does not refresh or validate older provider-reported history.'),
72
- step('diff', 'Compare two selected observations', 'diff', ['<previous.json>', '<current.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-diff', 'Equal, different, conflicting, and unavailable evidence remain separate.'),
73
- step('timeline', 'Build a bounded local timeline', 'timeline', ['<oldest.json>', '<newer.json>', '<current.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-timeline', 'Choose two to twenty same-domain files in chronological scope.'),
74
- ]),
75
- }),
76
- 'campaign-review': Object.freeze({
77
- id: 'campaign-review',
78
- label: 'Campaign candidate review',
79
- subjectRequirement: 'brand_or_domain',
80
- objective: 'Prepare a bounded candidate set, collect a deliberately selected queue, and review retained evidence without asserting campaign attribution.',
81
- limitations: Object.freeze(['Grouping candidates is analyst triage and does not prove common ownership, control, infrastructure, or intent.']),
82
- steps: (subject) => Object.freeze([
83
- step('prepare', 'Prepare candidates offline', 'discover', [subject, '--preset', 'all', '--json'], 'offline', 'none', 'whoisleuth.cli.discover', 'Review mutation families and bounded omissions before selecting a collection scope.'),
84
- step('collect', 'Collect the selected candidate queue', 'discover-scan', [subject, '--fast', '--scan-limit', '50', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.discovery-scan', 'Treat partial and inconclusive authority results as explicit outcomes.'),
85
- step('review', 'Prepare a selected candidate brief', 'brief', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', CLI_LOOKUP_BRIEF_SCHEMA, 'Select a saved candidate Lookup; keep any campaign grouping analyst-authored.'),
86
- ]),
87
- }),
88
- 'certificate-anomaly': Object.freeze({
89
- id: 'certificate-anomaly',
90
- label: 'Certificate anomaly review',
91
- subjectRequirement: 'domain',
92
- objective: 'Review bounded certificate observations alongside current source-qualified domain evidence without treating issuance as proof of control or intent.',
93
- limitations: Object.freeze(['Certificate observations are separately attributed and do not establish current service control.']),
94
- steps: (domain) => Object.freeze([
95
- step('search', 'Collect bounded certificate observations', 'ct-search', [domain, '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.ct-search', 'Review source availability, truncation, and observation timing.'),
96
- step('intake', 'Normalise the selected observations', 'ct-intake', ['<certificate-events.json>', '--json'], 'offline', 'analyst_selection', EXTERNAL_FINDINGS_SCHEMA, 'Select a certificate-event batch; a certificate-search report is not interchangeable with that input.'),
97
- step('corroborate', 'Collect supporting domain evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Compare evidence families without collapsing certificate and registration identities.'),
98
- ]),
99
- }),
100
- 'registry-disagreement': Object.freeze({
101
- id: 'registry-disagreement',
102
- label: 'Registry disagreement review',
103
- standardInputs: Object.freeze([
104
- { stepId: 'compare', input: 1, sourceStepId: 'collect' },
105
- { stepId: 'report', input: 1, sourceStepId: 'collect' },
106
- ]),
107
- subjectRequirement: 'domain',
108
- objective: 'Collect separately attributed registration evidence and review conflicting publications without selecting an arbitrary source as truth.',
109
- limitations: Object.freeze(['Only authority-aware registration evidence may decide availability; disagreement remains explicit.']),
110
- steps: (domain) => Object.freeze([
111
- step('collect', 'Collect source-qualified registration evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Retain RDAP, registrar RDAP, WHOIS, and authority states separately.'),
112
- step('compare', 'Compare registry publications offline', 'compare', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.compare', 'Do not convert conflicting or unavailable publications into equivalence.'),
113
- step('report', 'Prepare a target-free source report', 'source-report', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.source-reliability-report', 'The report describes source behaviour, not ownership, safety, or legal status.'),
114
- ]),
115
- }),
116
- 'evidence-handoff': Object.freeze({
117
- id: 'evidence-handoff',
118
- label: 'Reviewed evidence handoff',
119
- standardInputs: Object.freeze([{ stepId: 'lint', input: 1, sourceStepId: 'package' }]),
120
- subjectRequirement: 'review_label',
121
- objective: 'Verify, minimise, and package analyst-selected evidence for a deliberate handoff without transmitting or submitting it.',
122
- limitations: Object.freeze(['The recipe prepares local material only; sharing remains a separate deliberate action.']),
123
- steps: () => Object.freeze([
124
- step('verify', 'Verify the selected artefact', 'verify-artifact', ['<evidence.json>', '--json', '--strict-exit'], 'offline', 'analyst_selection', 'whoisleuth.offline-artifact-verification', 'Verification checks structure and integrity, not the truth or currency of observations.'),
125
- step('package', 'Build a reviewed public Case-pack', 'case-pack', ['<cases.json>', '--audience', 'public', '--reviewed', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.case-pack', 'Review minimisation and audience projection before retaining the separate package.'),
126
- step('lint', 'Review deliberate-sharing metadata', 'sharing-review', ['<package.json>', '--marking', 'clear', '--recipient-scope', 'public', '--purpose', 'reviewed evidence handoff', '--human-reviewed', '--personal-data-reviewed', '--redactions-confirmed', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.sharing-review', 'A clear lint result does not send, upload, publish, or authorise the artefact.'),
127
- ]),
128
- }),
129
- 'planned-domain-change': Object.freeze({
130
- id: 'planned-domain-change',
131
- label: 'Planned domain change',
132
- subjectRequirement: 'domain',
133
- objective: 'Review an analyst-authored desired state and prepare bounded change material without changing DNS, registry, mail, or hosted configuration.',
134
- limitations: Object.freeze(['Planning and packaging never apply, submit, schedule, or enforce a change.']),
135
- steps: () => Object.freeze([
136
- step('control', 'Review the desired-state manifest', 'domain-control', ['<review-input.json>', '--json'], 'offline', 'analyst_selection', DOMAIN_CONTROL_REVIEW_SCHEMA, 'Only supplied complete observations may produce drift.'),
137
- step('assure', 'Review change and recovery assumptions', 'assurance', ['<assurance-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-assurance', 'Record uncertainty, rollback dependencies, and unavailable evidence explicitly.'),
138
- step('package', 'Build a reviewed change packet', 'change-packet', ['<change-packet-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-change-packet', 'The packet is local reviewed material and performs no submission or enforcement.'),
139
- ]),
140
- }),
141
- 'post-change-verification': Object.freeze({
142
- id: 'post-change-verification',
143
- label: 'Post-change verification',
144
- subjectRequirement: 'domain',
145
- objective: 'Perform one explicit later observation and compare it with analyst-selected retained evidence after an authorised change.',
146
- limitations: Object.freeze(['This is a one-time recheck, not monitoring setup or proof that every resolver or service has converged.']),
147
- steps: () => Object.freeze([
148
- step('recheck', 'Run one bounded retained-manifest review', 'monitor-once', ['<manifest.json>', '--limit', '1', '--json'], 'network', 'network_disclosure', CLI_DOMAIN_CONTROL_MONITOR_SCHEMA, 'One later observation may remain partial, unavailable, stale, or conflicting.'),
149
- step('compare', 'Compare selected before and after evidence', 'diff', ['<before.json>', '<after.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-diff', 'Materiality is derived from compatible retained evidence and does not infer intent.'),
150
- step('record', 'Record reviewed completion material', 'change-packet', ['<post-change-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-change-packet', 'Recording reviewed material does not submit it or start automatic monitoring.'),
151
- ]),
10
+ const RECIPES = Object.freeze(Object.fromEntries(INVESTIGATION_PLAN_RECIPES.map((id) => [
11
+ id,
12
+ Object.freeze({
13
+ ...INVESTIGATION_RECIPE_DEFINITIONS[id],
14
+ id,
15
+ steps: (subject) => validatedSteps(INVESTIGATION_RECIPE_DEFINITIONS[id].steps(subject)),
152
16
  }),
153
- });
17
+ ])));
154
18
  export const INVESTIGATION_RECIPE_REGISTRY = RECIPES;
155
19
  export function workflowStandardInputs(recipe) {
156
20
  return RECIPES[recipe].standardInputs ?? [];
@@ -160,7 +24,12 @@ export function isRunnableInvestigationRecipe(value) {
160
24
  return RUNNABLE_INVESTIGATION_PLAN_RECIPES.includes(value);
161
25
  }
162
26
  export function workflowReviewDeclarations(step) {
163
- return step.arguments.filter(argument => ['--reviewed', '--human-reviewed', '--personal-data-reviewed', '--redactions-confirmed'].includes(argument));
27
+ return step.arguments.filter((argument) => [
28
+ '--reviewed',
29
+ '--human-reviewed',
30
+ '--personal-data-reviewed',
31
+ '--redactions-confirmed',
32
+ ].includes(argument));
164
33
  }
165
34
  function recipeCatalogueEntry(recipe) {
166
35
  const exampleSubject = recipe.subjectRequirement === 'domain' ? 'example.test' : 'Example Organisation';
@@ -215,15 +84,20 @@ export function formatWorkflowRecipeCatalogue(catalogue) {
215
84
  '',
216
85
  ].join('\n');
217
86
  }
218
- function step(id, label, command, args, mode, approval, produces, completion) {
219
- const invocationEffect = cliInvocationNetworkEffect(command, args);
220
- if ((mode === 'network') !== (invocationEffect === 'network')) {
221
- throw new Error(`Investigation step ${id} does not match the registered network effect for ${command}.`);
87
+ function validatedSteps(steps) {
88
+ for (const step of steps) {
89
+ const invocationEffect = cliInvocationNetworkEffect(step.command, step.arguments);
90
+ if ((step.mode === 'network') !== (invocationEffect === 'network')) {
91
+ throw new Error(`Investigation step ${step.id} does not match the registered network effect for ${step.command}.`);
92
+ }
222
93
  }
223
- return Object.freeze({ id, label, command, arguments: Object.freeze([...args]), mode, approval, produces, completion });
94
+ return steps;
224
95
  }
225
96
  function boundedSubject(value) {
226
- if (typeof value !== 'string' || !value.trim() || value.length > 253 || /[\u0000-\u001f\u007f]/u.test(value)) {
97
+ if (typeof value !== 'string' ||
98
+ !value.trim() ||
99
+ value.length > 253 ||
100
+ /[\u0000-\u001f\u007f]/u.test(value)) {
227
101
  throw new TypeError('Investigation-plan subject must be bounded text without control characters.');
228
102
  }
229
103
  return value.replace(/\s+/gu, ' ').trim();
@@ -232,7 +106,9 @@ function normalizedDomain(value) {
232
106
  const candidate = domainToASCII(value.toLowerCase().replace(/\.$/u, ''));
233
107
  if (!candidate || candidate.length > 253 || !candidate.includes('.'))
234
108
  return null;
235
- return candidate.split('.').every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label))
109
+ return candidate
110
+ .split('.')
111
+ .every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label))
236
112
  ? candidate
237
113
  : null;
238
114
  }
@@ -241,7 +117,9 @@ export function buildInvestigationPlan(recipeId, subjectValue, generatedAtValue
241
117
  if (!recipe)
242
118
  throw new TypeError('Investigation-plan recipe is unsupported.');
243
119
  const suppliedSubject = boundedSubject(subjectValue);
244
- const subject = recipe.subjectRequirement === 'domain' ? normalizedDomain(suppliedSubject) : suppliedSubject.toLowerCase();
120
+ const subject = recipe.subjectRequirement === 'domain'
121
+ ? normalizedDomain(suppliedSubject)
122
+ : suppliedSubject.toLowerCase();
245
123
  if (!subject)
246
124
  throw new TypeError('This investigation-plan recipe requires one valid domain.');
247
125
  const generatedAt = normalizeExplicitIsoTimestamp(generatedAtValue);
@@ -0,0 +1,177 @@
1
+ import { CLI_DOMAIN_CONTROL_MONITOR_SCHEMA } from "../packages/contracts/domain-control-monitor.mjs";
2
+ import { DOMAIN_CONTROL_REVIEW_SCHEMA } from "../packages/contracts/domain-control-review.mjs";
3
+ import { EXTERNAL_FINDINGS_SCHEMA } from "../packages/contracts/external-observation-interchange.mjs";
4
+ import { CLI_LOOKUP_BRIEF_SCHEMA } from "../packages/contracts/cli-lookup-brief.mjs";
5
+ export const INVESTIGATION_RECIPE_DEFINITIONS = Object.freeze({
6
+ 'domain-triage': Object.freeze({
7
+ label: 'New domain triage',
8
+ standardInputs: Object.freeze([
9
+ { stepId: 'export', input: 1, sourceStepId: 'collect' },
10
+ { stepId: 'verify', input: 1, sourceStepId: 'export' },
11
+ ]),
12
+ subjectRequirement: 'domain',
13
+ objective: 'Collect and preserve separately attributed registration, DNS, HTTP, TLS, page, and network-context evidence.',
14
+ limitations: Object.freeze([
15
+ 'Collection remains analyst-triggered and source limitations remain explicit.',
16
+ 'Disposition, reviewed response actions, monitoring, and closure continue in the saved Case workspace; this CLI recipe does not submit reports.',
17
+ ]),
18
+ steps: (domain) => Object.freeze([
19
+ step('collect', 'Collect a Deep lookup', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Review source health and limitations before using missing fields.'),
20
+ step('export', 'Create a portable evidence report', 'export', ['<saved-lookup.json>'], 'offline', 'analyst_selection', 'whoisleuth.lookup-evidence', 'Reuse the collected Lookup by default, or select a different reviewed Lookup file.'),
21
+ step('verify', 'Verify the exported artefact', 'verify-artifact', ['<evidence.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.offline-artifact-verification', 'Keep verification distinct from a claim that the observations are correct or current.'),
22
+ ]),
23
+ }),
24
+ 'lookalike-review': Object.freeze({
25
+ label: 'Lookalike candidate review',
26
+ subjectRequirement: 'brand_or_domain',
27
+ objective: 'Generate a bounded candidate queue, collect only the selected scope, and retain a reviewed candidate lookup.',
28
+ limitations: Object.freeze([
29
+ 'Candidate generation does not establish registration, control, intent, or maliciousness.',
30
+ 'Official-reference collection and page comparison require analyst-selected saved evidence; use page-compare after retaining the reference and candidate observations.',
31
+ ]),
32
+ steps: (subject) => Object.freeze([
33
+ step('generate', 'Generate candidates offline', 'discover', [subject, '--preset', 'all', '--json'], 'offline', 'none', 'whoisleuth.cli.discover', 'Review mutation families and suppressions before collection.'),
34
+ step('scan', 'Collect a bounded candidate queue', 'discover-scan', [subject, '--fast', '--scan-limit', '50', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.discovery-scan', 'Fast collection is a triage boundary; partial or inconclusive authority evidence remains explicit.'),
35
+ step('inspect', 'Deep-review one selected candidate', 'lookup', ['<selected-domain>', '--deep', '--json'], 'network', 'analyst_selection', 'whoisleuth.cli.lookup', 'Select a candidate deliberately; generation does not prove registration, control, intent, or maliciousness.'),
36
+ ]),
37
+ }),
38
+ 'owned-domain-review': Object.freeze({
39
+ label: 'Owned domain posture review',
40
+ subjectRequirement: 'domain',
41
+ objective: 'Review current passive posture and compare supplied observations with an analyst-authored control manifest.',
42
+ limitations: Object.freeze([
43
+ 'Use only for a domain the analyst owns or is authorised to review.',
44
+ ]),
45
+ steps: (domain) => Object.freeze([
46
+ step('posture', 'Collect bounded DNS posture', 'posture', [domain, '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.posture', 'Review mail profile and delegation evidence before interpreting missing records.'),
47
+ step('lookup', 'Collect supporting Deep evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Retain separately attributed registration, DNS, TLS, and page observations.'),
48
+ step('manifest', 'Review the domain control manifest', 'domain-control', ['<review-input.json>', '--json'], 'offline', 'analyst_selection', DOMAIN_CONTROL_REVIEW_SCHEMA, 'Only complete supplied observations may produce drift.'),
49
+ ]),
50
+ }),
51
+ 'historical-comparison': Object.freeze({
52
+ label: 'Historical observation comparison',
53
+ standardInputs: Object.freeze([
54
+ { stepId: 'diff', input: 2, sourceStepId: 'current' },
55
+ { stepId: 'timeline', input: 3, sourceStepId: 'current' },
56
+ ]),
57
+ subjectRequirement: 'domain',
58
+ objective: 'Collect a current observation and compare it with analyst-selected saved observations without merging source states.',
59
+ limitations: Object.freeze([
60
+ 'A later observation does not retroactively refresh retained evidence.',
61
+ ]),
62
+ steps: (domain) => Object.freeze([
63
+ step('current', 'Collect the current lookup', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'A current request does not refresh or validate older provider-reported history.'),
64
+ step('diff', 'Compare two selected observations', 'diff', ['<previous.json>', '<current.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-diff', 'Equal, different, conflicting, and unavailable evidence remain separate.'),
65
+ step('timeline', 'Build a bounded local timeline', 'timeline', ['<oldest.json>', '<newer.json>', '<current.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-timeline', 'Choose two to twenty same-domain files in chronological scope.'),
66
+ ]),
67
+ }),
68
+ 'campaign-review': Object.freeze({
69
+ label: 'Campaign candidate review',
70
+ subjectRequirement: 'brand_or_domain',
71
+ objective: 'Prepare a bounded candidate set, collect a deliberately selected queue, and review retained evidence without asserting campaign attribution.',
72
+ limitations: Object.freeze([
73
+ 'Grouping candidates is analyst triage and does not prove common ownership, control, infrastructure, or intent.',
74
+ ]),
75
+ steps: (subject) => Object.freeze([
76
+ step('prepare', 'Prepare candidates offline', 'discover', [subject, '--preset', 'all', '--json'], 'offline', 'none', 'whoisleuth.cli.discover', 'Review mutation families and bounded omissions before selecting a collection scope.'),
77
+ step('collect', 'Collect the selected candidate queue', 'discover-scan', [subject, '--fast', '--scan-limit', '50', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.discovery-scan', 'Treat partial and inconclusive authority results as explicit outcomes.'),
78
+ step('review', 'Prepare a selected candidate brief', 'brief', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', CLI_LOOKUP_BRIEF_SCHEMA, 'Select a saved candidate Lookup; keep any campaign grouping analyst-authored.'),
79
+ ]),
80
+ }),
81
+ 'certificate-anomaly': Object.freeze({
82
+ label: 'Certificate anomaly review',
83
+ subjectRequirement: 'domain',
84
+ objective: 'Review bounded certificate observations alongside current source-qualified domain evidence without treating issuance as proof of control or intent.',
85
+ limitations: Object.freeze([
86
+ 'Certificate observations are separately attributed and do not establish current service control.',
87
+ ]),
88
+ steps: (domain) => Object.freeze([
89
+ step('search', 'Collect bounded certificate observations', 'ct-search', [domain, '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.ct-search', 'Review source availability, truncation, and observation timing.'),
90
+ step('intake', 'Normalise the selected observations', 'ct-intake', ['<certificate-events.json>', '--json'], 'offline', 'analyst_selection', EXTERNAL_FINDINGS_SCHEMA, 'Select a certificate-event batch; a certificate-search report is not interchangeable with that input.'),
91
+ step('corroborate', 'Collect supporting domain evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Compare evidence families without collapsing certificate and registration identities.'),
92
+ ]),
93
+ }),
94
+ 'registry-disagreement': Object.freeze({
95
+ label: 'Registry disagreement review',
96
+ standardInputs: Object.freeze([
97
+ { stepId: 'compare', input: 1, sourceStepId: 'collect' },
98
+ { stepId: 'report', input: 1, sourceStepId: 'collect' },
99
+ ]),
100
+ subjectRequirement: 'domain',
101
+ objective: 'Collect separately attributed registration evidence and review conflicting publications without selecting an arbitrary source as truth.',
102
+ limitations: Object.freeze([
103
+ 'Only authority-aware registration evidence may decide availability; disagreement remains explicit.',
104
+ ]),
105
+ steps: (domain) => Object.freeze([
106
+ step('collect', 'Collect source-qualified registration evidence', 'lookup', [domain, '--deep', '--json'], 'network', 'network_disclosure', 'whoisleuth.cli.lookup', 'Retain RDAP, registrar RDAP, WHOIS, and authority states separately.'),
107
+ step('compare', 'Compare registry publications offline', 'compare', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.compare', 'Do not convert conflicting or unavailable publications into equivalence.'),
108
+ step('report', 'Prepare a target-free source report', 'source-report', ['<saved-lookup.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.source-reliability-report', 'The report describes source behaviour, not ownership, safety, or legal status.'),
109
+ ]),
110
+ }),
111
+ 'evidence-handoff': Object.freeze({
112
+ label: 'Reviewed evidence handoff',
113
+ standardInputs: Object.freeze([{ stepId: 'lint', input: 1, sourceStepId: 'package' }]),
114
+ subjectRequirement: 'review_label',
115
+ objective: 'Verify, minimise, and package analyst-selected evidence for a deliberate handoff without transmitting or submitting it.',
116
+ limitations: Object.freeze([
117
+ 'The recipe prepares local material only; sharing remains a separate deliberate action.',
118
+ ]),
119
+ steps: () => Object.freeze([
120
+ step('verify', 'Verify the selected artefact', 'verify-artifact', ['<evidence.json>', '--json', '--strict-exit'], 'offline', 'analyst_selection', 'whoisleuth.offline-artifact-verification', 'Verification checks structure and integrity, not the truth or currency of observations.'),
121
+ step('package', 'Build a reviewed public Case-pack', 'case-pack', ['<cases.json>', '--audience', 'public', '--reviewed', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.case-pack', 'Review minimisation and audience projection before retaining the separate package.'),
122
+ step('lint', 'Review deliberate-sharing metadata', 'sharing-review', [
123
+ '<package.json>',
124
+ '--marking',
125
+ 'clear',
126
+ '--recipient-scope',
127
+ 'public',
128
+ '--purpose',
129
+ 'reviewed evidence handoff',
130
+ '--human-reviewed',
131
+ '--personal-data-reviewed',
132
+ '--redactions-confirmed',
133
+ '--json',
134
+ ], 'offline', 'analyst_selection', 'whoisleuth.cli.sharing-review', 'A clear lint result does not send, upload, publish, or authorise the artefact.'),
135
+ ]),
136
+ }),
137
+ 'planned-domain-change': Object.freeze({
138
+ label: 'Planned domain change',
139
+ subjectRequirement: 'domain',
140
+ objective: 'Review an analyst-authored desired state and prepare bounded change material without changing DNS, registry, mail, or hosted configuration.',
141
+ limitations: Object.freeze([
142
+ 'Planning and packaging never apply, submit, schedule, or enforce a change.',
143
+ ]),
144
+ steps: () => Object.freeze([
145
+ step('control', 'Review the desired-state manifest', 'domain-control', ['<review-input.json>', '--json'], 'offline', 'analyst_selection', DOMAIN_CONTROL_REVIEW_SCHEMA, 'Only supplied complete observations may produce drift.'),
146
+ step('assure', 'Review change and recovery assumptions', 'assurance', ['<assurance-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-assurance', 'Record uncertainty, rollback dependencies, and unavailable evidence explicitly.'),
147
+ step('package', 'Build a reviewed change packet', 'change-packet', ['<change-packet-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-change-packet', 'The packet is local reviewed material and performs no submission or enforcement.'),
148
+ ]),
149
+ }),
150
+ 'post-change-verification': Object.freeze({
151
+ label: 'Post-change verification',
152
+ subjectRequirement: 'domain',
153
+ objective: 'Perform one explicit later observation and compare it with analyst-selected retained evidence after an authorised change.',
154
+ limitations: Object.freeze([
155
+ 'This is a one-time recheck, not monitoring setup or proof that every resolver or service has converged.',
156
+ ]),
157
+ steps: () => Object.freeze([
158
+ step('recheck', 'Run one bounded retained-manifest review', 'monitor-once', ['<manifest.json>', '--limit', '1', '--json'], 'network', 'network_disclosure', CLI_DOMAIN_CONTROL_MONITOR_SCHEMA, 'One later observation may remain partial, unavailable, stale, or conflicting.'),
159
+ step('compare', 'Compare selected before and after evidence', 'diff', ['<before.json>', '<after.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.cli.lookup-diff', 'Materiality is derived from compatible retained evidence and does not infer intent.'),
160
+ step('record', 'Record reviewed completion material', 'change-packet', ['<post-change-input.json>', '--json'], 'offline', 'analyst_selection', 'whoisleuth.domain-change-packet', 'Recording reviewed material does not submit it or start automatic monitoring.'),
161
+ ]),
162
+ }),
163
+ });
164
+ export const INVESTIGATION_PLAN_RECIPES = Object.freeze(Object.keys(INVESTIGATION_RECIPE_DEFINITIONS));
165
+ export const RUNNABLE_INVESTIGATION_PLAN_RECIPES = INVESTIGATION_PLAN_RECIPES;
166
+ function step(id, label, command, args, mode, approval, produces, completion) {
167
+ return Object.freeze({
168
+ id,
169
+ label,
170
+ command,
171
+ arguments: Object.freeze([...args]),
172
+ mode,
173
+ approval,
174
+ produces,
175
+ completion,
176
+ });
177
+ }
@@ -4,8 +4,8 @@ import { buildInvestigationPlan, isRunnableInvestigationRecipe, workflowReviewDe
4
4
  import { CliUsageError } from "./errors.mjs";
5
5
  import { hasUnsafeCliText } from "./errors.mjs";
6
6
  import EXIT_CODES from "./exit-codes.mjs";
7
- import { scanBoundedJson } from "../lib/bounded-json.mjs";
8
- import { CLI_INVESTIGATION_RUN_SCHEMA, CLI_INVESTIGATION_RUN_VERSION, SUPPORTED_CLI_INVESTIGATION_RUN_VERSIONS, MAX_INVESTIGATION_RUN_BYTES, MAX_INVESTIGATION_RUN_SELECTIONS, MAX_INVESTIGATION_RUN_SELECTION_LENGTH, } from "../packages/contracts/investigation-run.mjs";
7
+ import { scanBoundedJson } from "../packages/analysis/bounded-json.mjs";
8
+ import { CLI_INVESTIGATION_RUN_SCHEMA, CLI_INVESTIGATION_PREVIEW_SCHEMA, CLI_INVESTIGATION_PREVIEW_VERSION, CLI_INVESTIGATION_RUN_VERSION, SUPPORTED_CLI_INVESTIGATION_RUN_VERSIONS, MAX_INVESTIGATION_RUN_BYTES, MAX_INVESTIGATION_RUN_SELECTIONS, MAX_INVESTIGATION_RUN_SELECTION_LENGTH, } from "../packages/contracts/investigation-run.mjs";
9
9
  import { normalizeWorkflowBindings, validateWorkflowResult, workflowArtifactReference, workflowInputSchemas, } from "./investigation-artifacts.mjs";
10
10
  export { CLI_INVESTIGATION_RUN_SCHEMA, CLI_INVESTIGATION_RUN_VERSION, SUPPORTED_CLI_INVESTIGATION_RUN_VERSIONS, MAX_INVESTIGATION_RUN_BYTES, MAX_INVESTIGATION_RUN_SELECTIONS, MAX_INVESTIGATION_RUN_SELECTION_LENGTH, };
11
11
  const PLACEHOLDER_PATTERN = /^<[^>]+>$/u;
@@ -180,7 +180,7 @@ function validateSelectedInputs(plan, selections, bindings, completed) {
180
180
  }
181
181
  function parseResumeState(input, plan) {
182
182
  if (!input)
183
- return Object.freeze({ completed: Object.freeze([]), selections: Object.freeze([]), bindings: Object.freeze([]) });
183
+ return Object.freeze({ completed: Object.freeze([]), selections: Object.freeze([]), bindings: Object.freeze([]), retryableStepId: null });
184
184
  if (Buffer.byteLength(input, 'utf8') > MAX_INVESTIGATION_RUN_BYTES)
185
185
  throw new CliUsageError('Investigation resume state exceeds the 24 MiB limit.');
186
186
  const normalizedInput = input.replace(/^\uFEFF/u, '');
@@ -222,6 +222,7 @@ function parseResumeState(input, plan) {
222
222
  throw new CliUsageError('Investigation resume state contains more steps than the installed fixed recipe.');
223
223
  }
224
224
  const completed = [];
225
+ let retryableStepId = null;
225
226
  for (const [index, value] of root.completedSteps.entries()) {
226
227
  const baseStep = plan.steps[index];
227
228
  const planned = baseStep ? selectedStep(baseStep, selectionsByStep.get(baseStep.id) ?? [], bindings, completed) : null;
@@ -251,6 +252,7 @@ function parseResumeState(input, plan) {
251
252
  if (index !== root.completedSteps.length - 1) {
252
253
  throw new CliUsageError('A failed investigation step must be the final retained step.');
253
254
  }
255
+ retryableStepId = planned.id;
254
256
  break;
255
257
  }
256
258
  completed.push(Object.freeze({
@@ -265,19 +267,13 @@ function parseResumeState(input, plan) {
265
267
  }));
266
268
  }
267
269
  validateSelectedInputs(plan, selections, bindings, completed);
268
- return Object.freeze({ completed: Object.freeze(completed), selections, bindings });
270
+ return Object.freeze({ completed: Object.freeze(completed), selections, bindings, retryableStepId });
269
271
  }
270
- export async function runInvestigationRecipe(recipe, subjectValue, options) {
272
+ function prepareInvestigationInvocation(recipe, subjectValue, options) {
271
273
  if (!isRunnableInvestigationRecipe(recipe)) {
272
274
  throw new CliUsageError('workflow-run supports only installed recipes whose exact steps satisfy the execution contract.');
273
275
  }
274
276
  const plan = buildInvestigationPlan(recipe, subjectValue, options.generatedAt);
275
- const confirmedReviews = options.confirmedReviews ?? [];
276
- if (!Array.isArray(confirmedReviews) || confirmedReviews.length > plan.steps.length
277
- || new Set(confirmedReviews).size !== confirmedReviews.length
278
- || confirmedReviews.some(id => !plan.steps.some(step => step.id === id && workflowReviewDeclarations(step).length))) {
279
- throw new CliUsageError('--confirm-review must name each selected review-declaration step at most once.');
280
- }
281
277
  const prior = parseResumeState(options.resumeInput, plan);
282
278
  const suppliedSelections = normalizeInvocationSelections(plan, options.selections ?? []);
283
279
  // A complete explicit input list replaces a not-yet-run step's standard or
@@ -286,8 +282,78 @@ export async function runInvestigationRecipe(recipe, subjectValue, options) {
286
282
  && !prior.completed.some(step => step.id === selection.stepId)).map(selection => selection.stepId));
287
283
  const initialBindings = options.resumeInput === null ? workflowStandardInputs(recipe) : prior.bindings;
288
284
  const bindings = mergeBindings(plan, initialBindings.filter(binding => !explicitSteps.has(binding.stepId)), normalizeWorkflowBindings(plan, options.artifactBindings ?? []), prior.completed);
289
- let selections = mergeSelections(plan, prior.selections, suppliedSelections, prior.completed, bindings);
285
+ const selections = mergeSelections(plan, prior.selections, suppliedSelections, prior.completed, bindings);
290
286
  validateSelectedInputs(plan, selections, bindings, prior.completed);
287
+ return { plan, prior, bindings, selections };
288
+ }
289
+ /** Validate exactly what execution would resume, without an executor or authority. */
290
+ export function previewInvestigationRecipe(recipe, subjectValue, options) {
291
+ const { plan, prior, bindings, selections } = prepareInvestigationInvocation(recipe, subjectValue, options);
292
+ const selected = new Map(selections.map(item => [item.stepId, item.values]));
293
+ const steps = plan.steps.map(base => {
294
+ const retained = prior.completed.find(item => item.id === base.id);
295
+ const step = selectedStep(base, selected.get(base.id) ?? [], bindings, prior.completed);
296
+ let input = 0;
297
+ const inputs = base.arguments.flatMap((argument, index) => {
298
+ if (!PLACEHOLDER_PATTERN.test(argument))
299
+ return [];
300
+ input++;
301
+ const binding = bindings.find(item => item.stepId === base.id && item.input === input);
302
+ const source = binding ? prior.completed.find(item => item.id === binding.sourceStepId) : undefined;
303
+ return [{
304
+ input, placeholder: argument,
305
+ state: binding ? source?.artifact ? 'validated_output' : 'awaiting_output'
306
+ : PLACEHOLDER_PATTERN.test(step.arguments[index]) ? 'unresolved' : 'selected_file_or_value',
307
+ sourceStepId: binding?.sourceStepId ?? null,
308
+ artifactId: source?.artifact?.id ?? null,
309
+ value: binding ? null : PLACEHOLDER_PATTERN.test(step.arguments[index]) ? null : step.arguments[index],
310
+ }];
311
+ });
312
+ return {
313
+ id: step.id, label: step.label, command: step.command, mode: step.mode,
314
+ state: retained ? retained.exitCode === EXIT_CODES.PARTIAL_FAILURE ? 'retained_partial' : 'retained_complete'
315
+ : prior.retryableStepId === step.id ? 'retryable_failure' : 'remaining',
316
+ artifact: retained?.artifact ?? null, inputs,
317
+ networkApprovalRequired: !retained && step.mode === 'network',
318
+ reviewDeclarationsRequired: retained ? [] : workflowReviewDeclarations(step),
319
+ arguments: step.arguments,
320
+ };
321
+ });
322
+ return {
323
+ schema: CLI_INVESTIGATION_PREVIEW_SCHEMA, version: CLI_INVESTIGATION_PREVIEW_VERSION,
324
+ generatedAt: options.generatedAt, recipe, subject: plan.subject, steps,
325
+ requestsExecuted: 0, checkpointWritten: false,
326
+ limitations: [
327
+ 'This preview validates retained results and connections but does not open selected input files, execute steps, or grant approvals.',
328
+ 'Retained partial observations are reused as partial, not silently recollected. Failed steps remain retryable.',
329
+ 'File paths and selected values are included in this local preview. Review them before sharing.',
330
+ ],
331
+ };
332
+ }
333
+ export function formatInvestigationPreview(document) {
334
+ return [
335
+ `Workflow preview: ${document.recipe}`, `Subject: ${document.subject}`,
336
+ 'Offline inspection only; no requests or checkpoint writes.',
337
+ ...document.steps.flatMap(step => [
338
+ `${step.id}: ${step.state.replaceAll('_', ' ')} · ${step.label}`,
339
+ ...(step.artifact ? [` Retained: ${step.artifact.schema} v${step.artifact.version} · ${step.artifact.id}`] : []),
340
+ ...step.inputs.map(input => ` Input ${input.input}: ${input.state.replaceAll('_', ' ')}${input.sourceStepId ? ` from ${input.sourceStepId}` : ''}${input.value ? ` · ${input.value}` : ''}`),
341
+ ...(step.networkApprovalRequired ? [' Requires fresh network approval.'] : []),
342
+ ...(step.reviewDeclarationsRequired.length ? [` Requires human review: ${step.reviewDeclarationsRequired.join(', ')}.`] : []),
343
+ ]),
344
+ ...document.limitations, '',
345
+ ].join('\n');
346
+ }
347
+ export async function runInvestigationRecipe(recipe, subjectValue, options) {
348
+ const prepared = prepareInvestigationInvocation(recipe, subjectValue, options);
349
+ const { plan, prior, bindings } = prepared;
350
+ let selections = prepared.selections;
351
+ const confirmedReviews = options.confirmedReviews ?? [];
352
+ if (!Array.isArray(confirmedReviews) || confirmedReviews.length > plan.steps.length
353
+ || new Set(confirmedReviews).size !== confirmedReviews.length
354
+ || confirmedReviews.some(id => !plan.steps.some(step => step.id === id && workflowReviewDeclarations(step).length))) {
355
+ throw new CliUsageError('--confirm-review must name each selected review-declaration step at most once.');
356
+ }
291
357
  const selectionsByStep = new Map(selections.map((item) => [item.stepId, item.values]));
292
358
  const completed = [...prior.completed];
293
359
  let state = completed.some((step) => step.exitCode === EXIT_CODES.PARTIAL_FAILURE) ? 'partial' : 'complete';