@lucern/pack-host 1.0.0 → 1.0.1

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 (62) hide show
  1. package/dist/domain-pack/authoring.core.d.ts +161 -0
  2. package/dist/domain-pack/authoring.core.js +411 -0
  3. package/dist/domain-pack/authoring.core.js.map +1 -0
  4. package/dist/domain-pack/authoring.d.ts +12 -170
  5. package/dist/domain-pack/authoring.js +1155 -1098
  6. package/dist/domain-pack/authoring.js.map +1 -1
  7. package/dist/domain-pack/authoring.validation.d.ts +28 -0
  8. package/dist/domain-pack/authoring.validation.js +1944 -0
  9. package/dist/domain-pack/authoring.validation.js.map +1 -0
  10. package/dist/domain-pack/index.d.ts +2 -1
  11. package/dist/domain-pack/index.js +1979 -1917
  12. package/dist/domain-pack/index.js.map +1 -1
  13. package/dist/domain-pack/packs/engineering-accelerator-tail.d.ts +256 -0
  14. package/dist/domain-pack/packs/engineering-accelerator-tail.js +716 -0
  15. package/dist/domain-pack/packs/engineering-accelerator-tail.js.map +1 -0
  16. package/dist/domain-pack/packs/engineering-accelerator.js +790 -785
  17. package/dist/domain-pack/packs/engineering-accelerator.js.map +1 -1
  18. package/dist/domain-pack/packs/index.js +790 -785
  19. package/dist/domain-pack/packs/index.js.map +1 -1
  20. package/dist/domain-pack.d.ts +2 -1
  21. package/dist/domain-pack.js +1979 -1917
  22. package/dist/domain-pack.js.map +1 -1
  23. package/dist/index.d.ts +3 -1
  24. package/dist/index.js +1843 -1661
  25. package/dist/index.js.map +1 -1
  26. package/dist/manifests/chat-v1.js +17 -6
  27. package/dist/manifests/chat-v1.js.map +1 -1
  28. package/dist/manifests/deals-v1.js +10 -7
  29. package/dist/manifests/deals-v1.js.map +1 -1
  30. package/dist/manifests/decisions-v1.js +11 -4
  31. package/dist/manifests/decisions-v1.js.map +1 -1
  32. package/dist/manifests/documents-v1.js +12 -12
  33. package/dist/manifests/documents-v1.js.map +1 -1
  34. package/dist/manifests/epistemic-algorithms-v1.js +11 -6
  35. package/dist/manifests/epistemic-algorithms-v1.js.map +1 -1
  36. package/dist/manifests/graph-visualization-v1.js +9 -5
  37. package/dist/manifests/graph-visualization-v1.js.map +1 -1
  38. package/dist/manifests/index.d.ts +1 -0
  39. package/dist/manifests/index.js +230 -110
  40. package/dist/manifests/index.js.map +1 -1
  41. package/dist/manifests/news-v1.js +12 -13
  42. package/dist/manifests/news-v1.js.map +1 -1
  43. package/dist/manifests/philosophy-mode-v1.js +10 -12
  44. package/dist/manifests/philosophy-mode-v1.js.map +1 -1
  45. package/dist/manifests/sprints-v1.d.ts +10 -0
  46. package/dist/manifests/sprints-v1.js +106 -0
  47. package/dist/manifests/sprints-v1.js.map +1 -0
  48. package/dist/manifests/task-management-v1.js +18 -6
  49. package/dist/manifests/task-management-v1.js.map +1 -1
  50. package/dist/manifests/team-analysis-v1.js +12 -9
  51. package/dist/manifests/team-analysis-v1.js.map +1 -1
  52. package/dist/manifests/themes-v1.js +12 -16
  53. package/dist/manifests/themes-v1.js.map +1 -1
  54. package/dist/manifests/user-profiles-v1.js +9 -13
  55. package/dist/manifests/user-profiles-v1.js.map +1 -1
  56. package/dist/manifests.d.ts +1 -0
  57. package/dist/manifests.js +230 -110
  58. package/dist/manifests.js.map +1 -1
  59. package/dist/proof-attestation.json +1 -1
  60. package/dist/registry.js +229 -109
  61. package/dist/registry.js.map +1 -1
  62. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -269,12 +269,18 @@ var chatV1Manifest = defineAppPackManifest({
269
269
  },
270
270
  surfaces: {
271
271
  components: [
272
- "components/chat/*",
273
- "components/chat/sidebars/*",
274
- "components/chat/viewers/*"
272
+ "apps/web/components/lucern/dev/chat-debug-panel.tsx",
273
+ "apps/web/app/lucern/packs/_components/pack-try-it-panel.tsx"
275
274
  ],
276
- convex: ["convex/chats.ts", "convex/messages.ts", "convex/chatState.ts"],
277
- tools: ["lib/ai/tools/project-tools.ts"]
275
+ convex: [
276
+ "packages/reasoning-kernel/src/adapters/events.ts",
277
+ "services/master-control/convex/tools.ts",
278
+ "services/master-control/convex/toolAccess.ts"
279
+ ],
280
+ tools: [
281
+ "packages/mcp/src/handlers/functionSurface.ts",
282
+ "packages/server-core/src/mcp-context-tools.ts"
283
+ ]
278
284
  },
279
285
  policyProfile: {
280
286
  audiences: ["internal", "lp", "public"],
@@ -291,7 +297,12 @@ var chatV1Manifest = defineAppPackManifest({
291
297
  dataContract: {
292
298
  requiredNodeTypes: ["belief", "question", "evidence", "theme", "deal"],
293
299
  requiredEdgeTypes: ["informs", "answers", "belongs_to"],
294
- requiredTables: ["chats", "messages", "chatState", "projects"],
300
+ requiredTables: [
301
+ "agentMessages",
302
+ "platformAgentRuns",
303
+ "platformAgentRunToolCalls",
304
+ "epistemicNodes"
305
+ ],
295
306
  projectionBehavior: "inherits_policy"
296
307
  },
297
308
  templates: {
@@ -333,14 +344,17 @@ var dealsV1Manifest = defineAppPackManifest({
333
344
  },
334
345
  surfaces: {
335
346
  components: [
336
- "app/(projects)/projects/page.tsx",
337
- "components/project/*",
338
- "components/workspace/views/*"
347
+ "apps/web/app/lucern/tenant/workspaces/page.tsx",
348
+ "apps/web/app/lucern/tenant/_components/workspaces/*"
349
+ ],
350
+ convex: [
351
+ "packages/reasoning-kernel/src/adapters/topics.ts",
352
+ "packages/reasoning-kernel/src/adapters/decisions.ts",
353
+ "services/master-control/convex/workspaces.ts"
339
354
  ],
340
- convex: ["convex/projects.ts", "convex/epistemicDecisions.ts"],
341
355
  tools: [
342
- "lib/ai/tools/navigation-tools.ts",
343
- "lib/ai/tools/decision-tools.ts"
356
+ "packages/server-core/src/domain/topics.ts",
357
+ "packages/server-core/src/domain/worktrees.ts"
344
358
  ]
345
359
  },
346
360
  policyProfile: {
@@ -361,7 +375,7 @@ var dealsV1Manifest = defineAppPackManifest({
361
375
  "based_on_belief"
362
376
  ],
363
377
  requiredTables: [
364
- "projects",
378
+ "topics",
365
379
  "epistemicNodes",
366
380
  "epistemicEdges",
367
381
  "decisionEvents"
@@ -413,11 +427,18 @@ var decisionsV1Manifest = defineAppPackManifest({
413
427
  api: ["/api/thesis-audit/*", "/api/reports/*"]
414
428
  },
415
429
  surfaces: {
416
- components: ["app/(projects)/projects/[projectId]/decisions/page.tsx"],
417
- convex: ["convex/epistemicDecisions.ts", "convex/convictionEngine.ts"],
430
+ components: [
431
+ "apps/web/app/lucern/tenant/policy/page.tsx",
432
+ "apps/web/app/lucern/mc/policy/page.tsx"
433
+ ],
434
+ convex: [
435
+ "packages/reasoning-kernel/src/adapters/decisions.ts",
436
+ "packages/reasoning-kernel/src/adapters/questionsConvictionMutations.ts",
437
+ "packages/reasoning-kernel/src/adapters/beliefs.confidence.ts"
438
+ ],
418
439
  tools: [
419
- "lib/ai/tools/decision-tools.ts",
420
- "lib/ai/tools/conviction-tools.ts"
440
+ "packages/mcp/src/handlers/judgments.ts",
441
+ "packages/server-core/src/policy/index.ts"
421
442
  ]
422
443
  },
423
444
  policyProfile: {
@@ -498,14 +519,19 @@ var documentsV1Manifest = defineAppPackManifest({
498
519
  api: ["/api/documents/*", "/api/rag/document", "/api/rag/extract-pdf"]
499
520
  },
500
521
  surfaces: {
501
- components: ["components/documents/*", "components/document/*"],
522
+ components: [
523
+ "apps/web/app/lucern/tenant/_components/workspaces/workspace-pack-panel.tsx",
524
+ "apps/web/app/lucern/packs/_components/pack-detail-page.tsx"
525
+ ],
502
526
  convex: [
503
- "convex/projectDocuments.ts",
504
- "convex/documents.ts",
505
- "convex/documentAnnotations.ts",
506
- "convex/projectDocumentsActions.ts"
527
+ "packages/reasoning-kernel/src/adapters/evidence.ts",
528
+ "packages/reasoning-kernel/src/adapters/evidenceCreate.ts",
529
+ "packages/reasoning-kernel/src/adapters/epistemicSources.ts"
507
530
  ],
508
- tools: ["lib/ai/tools/create-document.ts"]
531
+ tools: [
532
+ "packages/server-core/src/domain/sources.ts",
533
+ "packages/mcp/src/handlers/evidence.ts"
534
+ ]
509
535
  },
510
536
  policyProfile: {
511
537
  audiences: ["internal", "lp"],
@@ -518,12 +544,7 @@ var documentsV1Manifest = defineAppPackManifest({
518
544
  dataContract: {
519
545
  requiredNodeTypes: ["source", "excerpt", "evidence", "synthesis"],
520
546
  requiredEdgeTypes: ["derived_from", "based_on", "informs"],
521
- requiredTables: [
522
- "projectDocuments",
523
- "projectDocumentsSyncLog",
524
- "documentAnnotations",
525
- "epistemicNodes"
526
- ],
547
+ requiredTables: ["researchJobs", "epistemicNodes", "epistemicEdges"],
527
548
  projectionBehavior: "inherits_policy"
528
549
  },
529
550
  templates: {
@@ -565,14 +586,19 @@ var epistemicAlgorithmsV1Manifest = defineAppPackManifest({
565
586
  api: ["/api/thesis-audit", "/api/graph-explain", "/api/lucern/*"]
566
587
  },
567
588
  surfaces: {
568
- components: ["components/epistemic/*", "components/contradiction/*"],
589
+ components: [
590
+ "apps/web/app/lucern/tenant/_components/graph/*",
591
+ "apps/web/lib/platform/react/components/ContradictionList.ts"
592
+ ],
569
593
  convex: [
570
- "convex/contradictions.ts",
571
- "convex/convictionEngine.ts",
572
- "convex/graphIntelligence.ts",
573
- "convex/thesisAuditAgents.ts"
594
+ "packages/reasoning-kernel/src/adapters/contradictions.ts",
595
+ "packages/reasoning-kernel/src/adapters/graphIntelligence.ts",
596
+ "packages/reasoning-kernel/src/adapters/graphAnalysisResults.ts"
574
597
  ],
575
- tools: ["lib/ai/tools/graph-intelligence-tools.ts"]
598
+ tools: [
599
+ "packages/mcp/src/handlers/contradictions.ts",
600
+ "packages/server-core/src/graph-analysis.ts"
601
+ ]
576
602
  },
577
603
  policyProfile: {
578
604
  audiences: ["internal", "lp"],
@@ -649,13 +675,17 @@ var graphVisualizationV1Manifest = defineAppPackManifest({
649
675
  },
650
676
  surfaces: {
651
677
  components: [
652
- "app/(projects)/projects/[projectId]/graph/components/*",
653
- "components/workspace/views/ProjectHomeView.tsx"
678
+ "apps/web/app/lucern/tenant/_components/graph/*",
679
+ "apps/web/app/lucern/tenant/graph/page.tsx"
680
+ ],
681
+ convex: [
682
+ "packages/reasoning-kernel/src/adapters/edgesQueries.ts",
683
+ "packages/reasoning-kernel/src/adapters/nodesQueries.ts",
684
+ "packages/reasoning-kernel/src/adapters/neo4jQueries.ts"
654
685
  ],
655
- convex: ["convex/epistemicQueries.ts", "convex/neo4jQueries.ts"],
656
686
  tools: [
657
- "lib/ai/tools/knowledge-graph-tools.ts",
658
- "lib/ai/tools/cypher-tools.ts"
687
+ "packages/mcp/src/handlers/graph.ts",
688
+ "packages/server-core/src/mcp-graph-tools.ts"
659
689
  ]
660
690
  },
661
691
  policyProfile: {
@@ -718,14 +748,19 @@ var newsV1Manifest = defineAppPackManifest({
718
748
  api: ["/api/news/search", "/api/intelligence/smart-news-search"]
719
749
  },
720
750
  surfaces: {
721
- components: ["components/news/*"],
751
+ components: [
752
+ "apps/web/app/lucern/packs/_components/pack-detail-page.tsx",
753
+ "apps/web/app/lucern/packs/_components/pack-catalog-page.tsx"
754
+ ],
722
755
  convex: [
723
- "convex/projectNews.ts",
724
- "convex/newsArticles.ts",
725
- "convex/newsCurationJobs.ts",
726
- "convex/articleCache.ts"
756
+ "packages/reasoning-kernel/src/adapters/evidence.ts",
757
+ "packages/reasoning-kernel/src/adapters/epistemicSources.ts",
758
+ "packages/server-core/src/domain/sources.ts"
727
759
  ],
728
- tools: ["lib/ai/tools/research-tools.ts"]
760
+ tools: [
761
+ "packages/server-core/src/sources.ts",
762
+ "packages/mcp/src/handlers/evidence.ts"
763
+ ]
729
764
  },
730
765
  policyProfile: {
731
766
  audiences: ["internal", "lp", "public"],
@@ -738,13 +773,7 @@ var newsV1Manifest = defineAppPackManifest({
738
773
  dataContract: {
739
774
  requiredNodeTypes: ["source", "evidence", "synthesis", "theme", "deal"],
740
775
  requiredEdgeTypes: ["derived_from", "informs", "belongs_to"],
741
- requiredTables: [
742
- "projectNews",
743
- "savedNewsArticles",
744
- "newsCurationJobs",
745
- "articleCache",
746
- "epistemicNodes"
747
- ],
776
+ requiredTables: ["researchJobs", "epistemicNodes", "epistemicEdges"],
748
777
  projectionBehavior: "inherits_policy"
749
778
  },
750
779
  templates: {
@@ -794,15 +823,18 @@ var philosophyModeV1Manifest = defineAppPackManifest({
794
823
  },
795
824
  surfaces: {
796
825
  components: [
797
- "components/chat/sidebars/PhilosophyModeSidebar.tsx",
798
- "components/philosophy/ArchetypeDisplay.tsx"
826
+ "apps/web/app/lucern/tenant/_components/people/*",
827
+ "apps/web/app/lucern/tenant/people/page.tsx"
799
828
  ],
800
829
  convex: [
801
- "convex/philosophy.ts",
802
- "convex/philosophyQueries.ts",
803
- "convex/projectPhilosophy.ts"
830
+ "services/master-control/convex/userSessions.ts",
831
+ "packages/reasoning-kernel/src/adapters/ontologies.ts",
832
+ "packages/reasoning-kernel/src/adapters/topics.ts"
804
833
  ],
805
- tools: ["lib/ai/tools/philosophy-tools.ts"]
834
+ tools: [
835
+ "packages/server-core/src/domain/ontologies.ts",
836
+ "packages/mcp/src/handlers/observations.ts"
837
+ ]
806
838
  },
807
839
  policyProfile: {
808
840
  audiences: ["internal"],
@@ -815,12 +847,7 @@ var philosophyModeV1Manifest = defineAppPackManifest({
815
847
  dataContract: {
816
848
  requiredNodeTypes: ["belief", "question", "theme"],
817
849
  requiredEdgeTypes: ["belongs_to", "relates_to_thesis"],
818
- requiredTables: [
819
- "marketPhilosophyProfiles",
820
- "marketPhilosophyAtoms",
821
- "marketPhilosophyContent",
822
- "philosophyUploads"
823
- ],
850
+ requiredTables: ["users", "epistemicNodes", "epistemicEdges"],
824
851
  projectionBehavior: "inherits_policy"
825
852
  },
826
853
  templates: {
@@ -846,6 +873,91 @@ var philosophyModeV1Manifest = defineAppPackManifest({
846
873
  }
847
874
  });
848
875
 
876
+ // src/manifests/sprints-v1.ts
877
+ var worktreesV1Manifest = defineAppPackManifest({
878
+ key: "sprints-v1",
879
+ name: "Worktrees",
880
+ version: "1.0.0",
881
+ lifecycle: "active",
882
+ category: "workflow",
883
+ description: "Structured research execution workflow with phases, scoring, and worktree-linked tasks.",
884
+ dependencies: ["chat-v1"],
885
+ capabilityFlags: [
886
+ "worktree.lifecycle",
887
+ "worktree.phase-navigation",
888
+ "worktree.scoring",
889
+ "worktree.workspace"
890
+ ],
891
+ routeNamespace: {
892
+ web: [
893
+ "/(projects)/topics/[topicId]/worktrees",
894
+ "/(projects)/topics/[topicId]/worktrees/[worktreeId]"
895
+ ],
896
+ api: [
897
+ "/api/sprint/assess-beliefs",
898
+ "/api/sprint/generate-thesis",
899
+ "/api/sprint/refine-thesis",
900
+ "/api/sprint/welcome"
901
+ ]
902
+ },
903
+ surfaces: {
904
+ components: [
905
+ "apps/web/app/lucern/tenant/_components/workspaces/*",
906
+ "apps/web/app/lucern/tenant/workspaces/page.tsx"
907
+ ],
908
+ convex: [
909
+ "packages/reasoning-kernel/src/adapters/worktrees.ts",
910
+ "modules/tasks/src/v1/engine/tasks.ts",
911
+ "packages/reasoning-kernel/src/adapters/questions.ts"
912
+ ],
913
+ tools: [
914
+ "packages/mcp/src/handlers/worktrees.ts",
915
+ "packages/server-core/src/worktrees.ts"
916
+ ]
917
+ },
918
+ policyProfile: {
919
+ audiences: ["internal", "lp"],
920
+ rules: [
921
+ { resource: "project", actions: ["read", "summarize", "mutate"] },
922
+ { resource: "task", actions: ["read", "mutate"] },
923
+ { resource: "tool_action", actions: ["read", "mutate"] }
924
+ ]
925
+ },
926
+ dataContract: {
927
+ requiredNodeTypes: ["belief", "question", "evidence", "theme"],
928
+ requiredEdgeTypes: ["tests", "informs", "belongs_to", "depends_on"],
929
+ requiredTables: [
930
+ "worktrees",
931
+ "workflowDefinitions",
932
+ "workflowStages",
933
+ "tasks"
934
+ ],
935
+ projectionBehavior: "inherits_policy"
936
+ },
937
+ templates: {
938
+ workflows: [
939
+ "worktree/hypothesis-formation",
940
+ "worktree/cluster-mapping",
941
+ "worktree/question-validation"
942
+ ],
943
+ prompts: ["worktree/main-system-prompt", "worktree/research-task-planning"],
944
+ reports: ["sprint_thesis"],
945
+ uiLabels: ["worktree", "phase", "conviction", "thesis"]
946
+ },
947
+ testSuite: {
948
+ parity: ["worktree-lifecycle-parity"],
949
+ policy: ["worktree-tool-enforcement"],
950
+ contract: ["worktrees-pack-contract-v1"]
951
+ },
952
+ sharedServices: [
953
+ {
954
+ service: "knowledge-compiler",
955
+ mode: "required",
956
+ contracts: ["knowledge-compiler-v1"]
957
+ }
958
+ ]
959
+ });
960
+
849
961
  // src/manifests/task-management-v1.ts
850
962
  var taskManagementV1Manifest = defineAppPackManifest({
851
963
  key: "task-management-v1",
@@ -871,13 +983,19 @@ var taskManagementV1Manifest = defineAppPackManifest({
871
983
  ]
872
984
  },
873
985
  surfaces: {
874
- components: ["components/task/*"],
986
+ components: [
987
+ "apps/web/app/lucern/tenant/tools/page.tsx",
988
+ "apps/web/app/lucern/tenant/_components/tools/*"
989
+ ],
875
990
  convex: [
876
- "convex/tasks.ts",
877
- "convex/_taskHelpers.ts",
878
- "convex/_taskQueryLogic.ts"
991
+ "modules/tasks/src/v1/engine/tasks.ts",
992
+ "modules/tasks/src/v1/engine/tasks.queries.ts",
993
+ "modules/tasks/src/v1/engine/tasks.mutations.ts"
879
994
  ],
880
- tools: ["lib/ai/tools/task-tools.ts"]
995
+ tools: [
996
+ "packages/mcp/src/handlers/tasks.ts",
997
+ "packages/server-core/src/tasks.ts"
998
+ ]
881
999
  },
882
1000
  policyProfile: {
883
1001
  audiences: ["internal", "lp"],
@@ -891,7 +1009,13 @@ var taskManagementV1Manifest = defineAppPackManifest({
891
1009
  dataContract: {
892
1010
  requiredNodeTypes: ["belief", "question", "evidence", "synthesis"],
893
1011
  requiredEdgeTypes: ["informs", "tests", "belongs_to"],
894
- requiredTables: ["tasks", "projects", "epistemicNodes", "epistemicEdges"],
1012
+ requiredTables: [
1013
+ "tasks",
1014
+ "topics",
1015
+ "worktrees",
1016
+ "epistemicNodes",
1017
+ "epistemicEdges"
1018
+ ],
895
1019
  projectionBehavior: "inherits_policy"
896
1020
  },
897
1021
  templates: {
@@ -931,13 +1055,19 @@ var teamAnalysisV1Manifest = defineAppPackManifest({
931
1055
  api: ["/api/coaching/*"]
932
1056
  },
933
1057
  surfaces: {
934
- components: ["components/charts/*", "components/coaching/*"],
1058
+ components: [
1059
+ "apps/web/app/lucern/mc/analytics/page.tsx",
1060
+ "apps/web/app/lucern/tenant/_components/people/*"
1061
+ ],
935
1062
  convex: [
936
- "convex/users.ts",
937
- "convex/userAnalytics.ts",
938
- "convex/projectCards.ts"
1063
+ "services/master-control/convex/identity.ts",
1064
+ "services/master-control/convex/groups.ts",
1065
+ "packages/reasoning-kernel/src/adapters/telemetry.ts"
939
1066
  ],
940
- tools: []
1067
+ tools: [
1068
+ "packages/server-core/src/identity.ts",
1069
+ "packages/mcp/src/handlers/observations.ts"
1070
+ ]
941
1071
  },
942
1072
  policyProfile: {
943
1073
  audiences: ["internal", "tenant_admin"],
@@ -952,13 +1082,10 @@ var teamAnalysisV1Manifest = defineAppPackManifest({
952
1082
  requiredEdgeTypes: ["informs", "tests"],
953
1083
  requiredTables: [
954
1084
  "users",
955
- "userEpistemicJourney",
956
1085
  "epistemicAudit",
957
- "proposalEvents",
958
- "biSuggestions",
959
1086
  "beliefConfidence",
960
1087
  "contradictions",
961
- "worktrees",
1088
+ "calibrationScores",
962
1089
  "tasks"
963
1090
  ],
964
1091
  projectionBehavior: "none"
@@ -1016,22 +1143,19 @@ var themesV1Manifest = defineAppPackManifest({
1016
1143
  },
1017
1144
  surfaces: {
1018
1145
  components: [
1019
- "components/project/*",
1020
- "components/belief/*",
1021
- "components/question/*",
1022
- "components/research/*",
1023
- "components/reports/*"
1146
+ "apps/web/app/lucern/tenant/_components/graph/*",
1147
+ "apps/web/app/lucern/tenant/_components/workspaces/*"
1024
1148
  ],
1025
1149
  convex: [
1026
- "convex/themes.ts",
1027
- "convex/projects.ts",
1028
- "convex/thematicWorkflow.ts",
1029
- "convex/reports.ts"
1150
+ "packages/reasoning-kernel/src/adapters/topics.ts",
1151
+ "packages/reasoning-kernel/src/adapters/beliefs.ts",
1152
+ "packages/reasoning-kernel/src/adapters/questions.ts",
1153
+ "packages/reasoning-kernel/src/adapters/evidence.ts"
1030
1154
  ],
1031
1155
  tools: [
1032
- "lib/ai/tools/belief-tools.ts",
1033
- "lib/ai/tools/question-tools.ts",
1034
- "lib/ai/tools/navigation-tools.ts"
1156
+ "packages/mcp/src/handlers/beliefs.ts",
1157
+ "packages/mcp/src/handlers/questions.ts",
1158
+ "packages/mcp/src/handlers/evidence.ts"
1035
1159
  ]
1036
1160
  },
1037
1161
  policyProfile: {
@@ -1047,12 +1171,11 @@ var themesV1Manifest = defineAppPackManifest({
1047
1171
  requiredNodeTypes: ["theme", "belief", "question", "evidence", "synthesis"],
1048
1172
  requiredEdgeTypes: ["belongs_to", "relates_to_thesis", "informs", "tests"],
1049
1173
  requiredTables: [
1050
- "projects",
1174
+ "topics",
1051
1175
  "epistemicNodes",
1052
1176
  "epistemicEdges",
1053
- "reports",
1054
- "reportSections",
1055
- "reportTemplates"
1177
+ "workflowDefinitions",
1178
+ "workflowStages"
1056
1179
  ],
1057
1180
  projectionBehavior: "projection_required"
1058
1181
  },
@@ -1101,16 +1224,15 @@ var userProfilesV1Manifest = defineAppPackManifest({
1101
1224
  },
1102
1225
  surfaces: {
1103
1226
  components: [
1104
- "components/user/*",
1105
- "components/philosophy/ArchetypeDisplay.tsx"
1227
+ "apps/web/app/lucern/tenant/_components/people/*",
1228
+ "apps/web/app/lucern/tenant/people/page.tsx"
1106
1229
  ],
1107
1230
  convex: [
1108
- "convex/users.ts",
1109
- "convex/userJourney.ts",
1110
- "convex/userSessions.ts",
1111
- "convex/userAnalytics.ts"
1231
+ "services/master-control/convex/identity.ts",
1232
+ "services/master-control/convex/userSessions.ts",
1233
+ "services/master-control/convex/groups.ts"
1112
1234
  ],
1113
- tools: []
1235
+ tools: ["packages/server-core/src/identity.ts"]
1114
1236
  },
1115
1237
  policyProfile: {
1116
1238
  audiences: ["internal", "tenant_admin"],
@@ -1129,13 +1251,10 @@ var userProfilesV1Manifest = defineAppPackManifest({
1129
1251
  requiredEdgeTypes: [],
1130
1252
  requiredTables: [
1131
1253
  "users",
1132
- "userEpistemicJourney",
1133
1254
  "userSessions",
1134
- "investorProfiles",
1135
- "investorProfileAtoms",
1136
- "voiceProfiles",
1137
- "userVoiceSettings",
1138
- "archetypeHistory"
1255
+ "principals",
1256
+ "principalIdentityAliases",
1257
+ "calibrationScores"
1139
1258
  ],
1140
1259
  projectionBehavior: "none"
1141
1260
  },
@@ -1163,6 +1282,7 @@ var userProfilesV1Manifest = defineAppPackManifest({
1163
1282
  var allAppPackManifests = [
1164
1283
  philosophyModeV1Manifest,
1165
1284
  chatV1Manifest,
1285
+ worktreesV1Manifest,
1166
1286
  graphVisualizationV1Manifest,
1167
1287
  epistemicAlgorithmsV1Manifest,
1168
1288
  themesV1Manifest,
@@ -1767,330 +1887,676 @@ function defineDomainPack(input) {
1767
1887
  };
1768
1888
  }
1769
1889
 
1770
- // src/domain-pack/validation.ts
1771
- function issue(code, message, path, severity = "error") {
1772
- return { code, severity, message, path };
1890
+ // src/domain-pack/authoring.core.ts
1891
+ var DOMAIN_PACK_MANIFEST_KIND = "lucern-domain-pack-manifest";
1892
+ var CURRENT_MANIFEST_VERSION = "1.0.0";
1893
+ function isPlainObject(value) {
1894
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
1773
1895
  }
1774
- var KEBAB_CASE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
1775
- var SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
1776
- var SHAPING_QUESTION_TYPES = /* @__PURE__ */ new Set([
1777
- "validation",
1778
- "falsification",
1779
- "assumption_probe",
1780
- "counterfactual",
1781
- "scope",
1782
- "comparison",
1783
- "mechanism",
1784
- "general"
1785
- ]);
1786
- var RUNTIME_TARGETS = /* @__PURE__ */ new Set(["claude-code", "codex", "hybrid", "portable"]);
1787
- var ONTOLOGY_PROVISION_MODES = /* @__PURE__ */ new Set(["bind", "seed", "extend"]);
1788
- function validateStringArray(values, path, label) {
1896
+ function dedupeStrings2(values) {
1789
1897
  if (!values) {
1790
- return [];
1898
+ return void 0;
1791
1899
  }
1792
- return values.flatMap((value, index) => {
1793
- if (!value?.trim()) {
1794
- return [
1795
- issue(
1796
- "INVALID_SHAPING_CONDITION",
1797
- `${label} must not contain empty strings`,
1798
- `${path}[${index}]`
1799
- )
1800
- ];
1801
- }
1802
- return [];
1803
- });
1900
+ return Array.from(
1901
+ new Set(values.map((value) => value.trim()).filter((value) => value.length))
1902
+ );
1804
1903
  }
1805
- function validateRuntimeTargets(values, path) {
1806
- const issues = validateStringArray(values, path, "runtimeTargets");
1807
- for (const [index, value] of (values || []).entries()) {
1808
- if (!RUNTIME_TARGETS.has(value)) {
1809
- issues.push(
1810
- issue(
1811
- "INVALID_RUNTIME_TARGET",
1812
- `Unsupported runtime target "${value}"`,
1813
- `${path}[${index}]`
1814
- )
1815
- );
1816
- }
1817
- }
1818
- return issues;
1904
+ function normalizeRuntimeTargets2(values) {
1905
+ return values ? dedupeStrings2(values) : void 0;
1819
1906
  }
1820
- function validatePromptBinding(prompt, index) {
1821
- const path = `operatingSystem.prompts[${index}]`;
1822
- const issues = [];
1823
- if (!prompt.promptId?.trim()) {
1824
- issues.push(
1825
- issue(
1826
- "MISSING_PROMPT_ID",
1827
- "prompt binding requires promptId",
1828
- `${path}.promptId`
1829
- )
1830
- );
1831
- }
1832
- if (!prompt.ref?.trim()) {
1833
- issues.push(
1834
- issue("MISSING_PROMPT_REF", "prompt binding requires ref", `${path}.ref`)
1835
- );
1907
+ function normalizeFrameworks(frameworks) {
1908
+ if (!frameworks) {
1909
+ return void 0;
1836
1910
  }
1837
- issues.push(
1838
- ...validateRuntimeTargets(prompt.runtimeTargets, `${path}.runtimeTargets`)
1839
- );
1840
- return issues;
1911
+ return frameworks.map((framework) => ({
1912
+ ...framework,
1913
+ frameworkId: framework.frameworkId.trim(),
1914
+ version: framework.version.trim(),
1915
+ versionConstraint: framework.versionConstraint?.trim(),
1916
+ runtimeTargets: normalizeRuntimeTargets2(framework.runtimeTargets)
1917
+ }));
1841
1918
  }
1842
- function validateToolBinding(tool, index) {
1843
- const path = `operatingSystem.tools[${index}]`;
1844
- const issues = [];
1845
- if (!tool.toolId?.trim()) {
1846
- issues.push(
1847
- issue("MISSING_TOOL_ID", "tool binding requires toolId", `${path}.toolId`)
1848
- );
1919
+ function normalizeSchemaExtensions(extensions) {
1920
+ if (!extensions) {
1921
+ return void 0;
1849
1922
  }
1850
- if (!tool.entrypoint?.trim()) {
1851
- issues.push(
1852
- issue(
1853
- "MISSING_TOOL_ENTRYPOINT",
1854
- "tool binding requires entrypoint",
1855
- `${path}.entrypoint`
1856
- )
1857
- );
1923
+ return extensions.map((extension) => ({
1924
+ ...extension,
1925
+ extensionId: extension.extensionId.trim(),
1926
+ target: extension.target,
1927
+ description: extension.description.trim(),
1928
+ version: extension.version.trim(),
1929
+ extends: extension.extends?.trim()
1930
+ }));
1931
+ }
1932
+ function normalizeOntologyExtensions(extensions) {
1933
+ if (!extensions) {
1934
+ return void 0;
1858
1935
  }
1859
- issues.push(
1860
- ...validateRuntimeTargets(tool.runtimeTargets, `${path}.runtimeTargets`)
1861
- );
1862
- return issues;
1936
+ return extensions.map((extension) => ({
1937
+ ...extension,
1938
+ extensionId: extension.extensionId.trim(),
1939
+ ontologyId: extension.ontologyId.trim(),
1940
+ baseVersionConstraint: extension.baseVersionConstraint.trim(),
1941
+ entityTypes: extension.entityTypes?.map((entityType) => ({
1942
+ ...entityType,
1943
+ value: entityType.value.trim(),
1944
+ label: entityType.label.trim(),
1945
+ description: entityType.description?.trim(),
1946
+ subtypes: dedupeStrings2(entityType.subtypes)
1947
+ })),
1948
+ edgeTypes: extension.edgeTypes?.map((edgeType) => ({
1949
+ ...edgeType,
1950
+ value: edgeType.value.trim(),
1951
+ label: edgeType.label.trim(),
1952
+ description: edgeType.description?.trim(),
1953
+ sourceTypes: dedupeStrings2(edgeType.sourceTypes),
1954
+ targetTypes: dedupeStrings2(edgeType.targetTypes)
1955
+ }))
1956
+ }));
1863
1957
  }
1864
- function validateSetupAsset(asset, index) {
1865
- const path = `operatingSystem.setupAssets[${index}]`;
1866
- const issues = [];
1867
- if (!asset.assetId?.trim()) {
1868
- issues.push(
1869
- issue(
1870
- "MISSING_SETUP_ASSET_ID",
1871
- "setup asset requires assetId",
1872
- `${path}.assetId`
1873
- )
1874
- );
1958
+ function normalizeLineage(lineage) {
1959
+ if (!lineage) {
1960
+ return { mode: "root" };
1875
1961
  }
1876
- if (!asset.path?.trim()) {
1877
- issues.push(
1878
- issue(
1879
- "MISSING_SETUP_ASSET_PATH",
1880
- "setup asset requires path",
1881
- `${path}.path`
1882
- )
1883
- );
1962
+ return {
1963
+ mode: lineage.mode,
1964
+ parentPackId: lineage.parentPackId?.trim(),
1965
+ parentVersion: lineage.parentVersion?.trim(),
1966
+ parentManifestDigest: lineage.parentManifestDigest?.trim(),
1967
+ supersedesPackId: lineage.supersedesPackId?.trim(),
1968
+ notes: lineage.notes?.trim()
1969
+ };
1970
+ }
1971
+ function normalizeMetadata(metadata) {
1972
+ if (!metadata) {
1973
+ return void 0;
1884
1974
  }
1885
- issues.push(
1886
- ...validateRuntimeTargets(asset.runtimeTargets, `${path}.runtimeTargets`)
1887
- );
1888
- return issues;
1975
+ return {
1976
+ description: metadata.description?.trim(),
1977
+ owner: metadata.owner?.trim(),
1978
+ tags: dedupeStrings2(metadata.tags)
1979
+ };
1889
1980
  }
1890
- function validateQuestionTemplate(template, index) {
1891
- const path = `inquiryShaping.questionTemplates[${index}]`;
1892
- const issues = [];
1893
- if (!template.templateId?.trim()) {
1894
- issues.push(
1895
- issue(
1896
- "MISSING_SHAPING_TEMPLATE_ID",
1897
- "question template requires templateId",
1898
- `${path}.templateId`
1899
- )
1900
- );
1981
+ function toDomainPack(pack) {
1982
+ return defineDomainPack(pack);
1983
+ }
1984
+ function defineDomainPackAuthoringManifest(input) {
1985
+ return {
1986
+ kind: input.kind ?? DOMAIN_PACK_MANIFEST_KIND,
1987
+ manifestVersion: input.manifestVersion?.trim() || CURRENT_MANIFEST_VERSION,
1988
+ pack: toDomainPack(input.pack),
1989
+ frameworks: normalizeFrameworks(input.frameworks),
1990
+ schemaExtensions: normalizeSchemaExtensions(input.schemaExtensions),
1991
+ ontologyExtensions: normalizeOntologyExtensions(input.ontologyExtensions),
1992
+ lineage: normalizeLineage(input.lineage),
1993
+ metadata: normalizeMetadata(input.metadata)
1994
+ };
1995
+ }
1996
+ function countManifestArtifacts(manifest) {
1997
+ if (!manifest) {
1998
+ return {
1999
+ topicRoots: 0,
2000
+ workflows: 0,
2001
+ gates: 0,
2002
+ artifacts: 0,
2003
+ roles: 0,
2004
+ prompts: 0,
2005
+ tools: 0,
2006
+ setupAssets: 0,
2007
+ installProfiles: 0,
2008
+ frameworks: 0,
2009
+ schemaExtensions: 0,
2010
+ ontologyExtensions: 0
2011
+ };
1901
2012
  }
1902
- if (!template.template?.trim()) {
1903
- issues.push(
1904
- issue(
1905
- "MISSING_SHAPING_TEMPLATE",
1906
- "question template requires template text",
1907
- `${path}.template`
1908
- )
1909
- );
2013
+ return {
2014
+ topicRoots: manifest.pack.topicRoots.length,
2015
+ workflows: manifest.pack.workflows.length,
2016
+ gates: manifest.pack.gates.length,
2017
+ artifacts: manifest.pack.artifacts.length,
2018
+ roles: manifest.pack.roles.length,
2019
+ prompts: manifest.pack.operatingSystem?.prompts?.length ?? 0,
2020
+ tools: manifest.pack.operatingSystem?.tools?.length ?? 0,
2021
+ setupAssets: manifest.pack.operatingSystem?.setupAssets?.length ?? 0,
2022
+ installProfiles: manifest.pack.operatingSystem?.installProfiles?.length ?? 0,
2023
+ frameworks: manifest.frameworks?.length ?? 0,
2024
+ schemaExtensions: manifest.schemaExtensions?.length ?? 0,
2025
+ ontologyExtensions: manifest.ontologyExtensions?.length ?? 0
2026
+ };
2027
+ }
2028
+ function sortJsonValue(value) {
2029
+ if (Array.isArray(value)) {
2030
+ return value.map(sortJsonValue);
1910
2031
  }
1911
- if (!SHAPING_QUESTION_TYPES.has(template.questionType)) {
1912
- issues.push(
1913
- issue(
1914
- "INVALID_SHAPING_QUESTION_TYPE",
1915
- `Unsupported questionType "${template.questionType}"`,
1916
- `${path}.questionType`
1917
- )
2032
+ if (isPlainObject(value)) {
2033
+ return Object.fromEntries(
2034
+ Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => [key, sortJsonValue(entryValue)])
1918
2035
  );
1919
2036
  }
1920
- issues.push(
1921
- ...validateStringArray(
1922
- template.whenObjectiveIncludes,
1923
- `${path}.whenObjectiveIncludes`,
1924
- "whenObjectiveIncludes"
1925
- )
1926
- );
1927
- return issues;
2037
+ return value;
1928
2038
  }
1929
- function validateTaskTemplate(template, index) {
1930
- const path = `inquiryShaping.taskTemplates[${index}]`;
1931
- const issues = [];
1932
- if (!template.templateId?.trim()) {
1933
- issues.push(
1934
- issue(
1935
- "MISSING_TASK_GENERATOR_ID",
1936
- "task template requires templateId",
1937
- `${path}.templateId`
1938
- )
1939
- );
2039
+ function toYamlScalar(value) {
2040
+ if (value === null) {
2041
+ return "null";
1940
2042
  }
1941
- if (!template.title?.trim()) {
1942
- issues.push(
1943
- issue(
1944
- "MISSING_TASK_GENERATOR_TITLE",
1945
- "task template requires title",
1946
- `${path}.title`
1947
- )
1948
- );
2043
+ if (typeof value === "boolean" || typeof value === "number") {
2044
+ return String(value);
1949
2045
  }
1950
- issues.push(
1951
- ...validateStringArray(
1952
- template.whenObjectiveIncludes,
1953
- `${path}.whenObjectiveIncludes`,
1954
- "whenObjectiveIncludes"
1955
- )
1956
- );
1957
- issues.push(
1958
- ...validateStringArray(
1959
- template.whenQuestionTypes,
1960
- `${path}.whenQuestionTypes`,
1961
- "whenQuestionTypes"
1962
- )
1963
- );
1964
- for (const [questionTypeIndex, questionType] of (template.whenQuestionTypes || []).entries()) {
1965
- if (!SHAPING_QUESTION_TYPES.has(questionType)) {
1966
- issues.push(
1967
- issue(
1968
- "INVALID_TASK_GENERATOR_QUESTION_TYPE",
1969
- `Unsupported whenQuestionTypes value "${questionType}"`,
1970
- `${path}.whenQuestionTypes[${questionTypeIndex}]`
1971
- )
1972
- );
2046
+ return JSON.stringify(String(value));
2047
+ }
2048
+ function renderYaml(value, indent = 0) {
2049
+ const prefix = " ".repeat(indent);
2050
+ if (Array.isArray(value)) {
2051
+ if (value.length === 0) {
2052
+ return [`${prefix}[]`];
2053
+ }
2054
+ return value.flatMap((entry) => {
2055
+ if (Array.isArray(entry) || isPlainObject(entry)) {
2056
+ return [`${prefix}-`, ...renderYaml(entry, indent + 2)];
2057
+ }
2058
+ return [`${prefix}- ${toYamlScalar(entry)}`];
2059
+ });
2060
+ }
2061
+ if (isPlainObject(value)) {
2062
+ const entries = Object.entries(value);
2063
+ if (entries.length === 0) {
2064
+ return [`${prefix}{}`];
1973
2065
  }
2066
+ return entries.flatMap(([key, entryValue]) => {
2067
+ if (entryValue === void 0) {
2068
+ return [];
2069
+ }
2070
+ if (Array.isArray(entryValue)) {
2071
+ if (entryValue.length === 0) {
2072
+ return [`${prefix}${key}: []`];
2073
+ }
2074
+ return [`${prefix}${key}:`, ...renderYaml(entryValue, indent + 2)];
2075
+ }
2076
+ if (isPlainObject(entryValue)) {
2077
+ if (Object.keys(entryValue).length === 0) {
2078
+ return [`${prefix}${key}: {}`];
2079
+ }
2080
+ return [`${prefix}${key}:`, ...renderYaml(entryValue, indent + 2)];
2081
+ }
2082
+ return [`${prefix}${key}: ${toYamlScalar(entryValue)}`];
2083
+ });
1974
2084
  }
1975
- return issues;
2085
+ return [`${prefix}${toYamlScalar(value)}`];
1976
2086
  }
1977
- function validateFrameworkHint(hint, index) {
1978
- const path = `inquiryShaping.frameworkHints[${index}]`;
1979
- const issues = [];
1980
- if (!hint.frameworkName?.trim()) {
1981
- issues.push(
1982
- issue(
1983
- "MISSING_FRAMEWORK_HOOK_NAME",
1984
- "framework hint requires frameworkName",
1985
- `${path}.frameworkName`
1986
- )
1987
- );
2087
+ function countIndent(line) {
2088
+ return line.length - line.trimStart().length;
2089
+ }
2090
+ function parseYamlScalar(raw) {
2091
+ const value = raw.trim();
2092
+ if (value === "null") {
2093
+ return null;
1988
2094
  }
1989
- if (hint.boost != null && (!Number.isFinite(hint.boost) || hint.boost < 0)) {
1990
- issues.push(
1991
- issue(
1992
- "INVALID_FRAMEWORK_HOOK_BOOST",
1993
- "framework hint boost must be a non-negative number",
1994
- `${path}.boost`
1995
- )
1996
- );
2095
+ if (value === "true") {
2096
+ return true;
1997
2097
  }
1998
- issues.push(
1999
- ...validateStringArray(
2000
- hint.whenObjectiveIncludes,
2001
- `${path}.whenObjectiveIncludes`,
2002
- "whenObjectiveIncludes"
2003
- )
2004
- );
2005
- issues.push(
2006
- ...validateStringArray(
2007
- hint.whenQuestionTypes,
2008
- `${path}.whenQuestionTypes`,
2009
- "whenQuestionTypes"
2010
- )
2011
- );
2012
- for (const [questionTypeIndex, questionType] of (hint.whenQuestionTypes || []).entries()) {
2013
- if (!SHAPING_QUESTION_TYPES.has(questionType)) {
2014
- issues.push(
2015
- issue(
2016
- "INVALID_FRAMEWORK_HOOK_QUESTION_TYPE",
2017
- `Unsupported whenQuestionTypes value "${questionType}"`,
2018
- `${path}.whenQuestionTypes[${questionTypeIndex}]`
2019
- )
2020
- );
2098
+ if (value === "false") {
2099
+ return false;
2100
+ }
2101
+ if (/^-?\d+(?:\.\d+)?$/.test(value)) {
2102
+ return Number(value);
2103
+ }
2104
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
2105
+ if (value.startsWith("'")) {
2106
+ return value.slice(1, -1).replace(/''/g, "'");
2021
2107
  }
2108
+ return JSON.parse(value);
2022
2109
  }
2023
- return issues;
2110
+ if (value === "[]") {
2111
+ return [];
2112
+ }
2113
+ if (value === "{}") {
2114
+ return {};
2115
+ }
2116
+ return value;
2024
2117
  }
2025
- function validateTopicTemplate(template, index, knownTopicSlugs) {
2026
- const path = `operatingSystem.topicTemplates[${index}]`;
2118
+ function splitYamlKeyValue(trimmed) {
2119
+ const separatorIndex = trimmed.indexOf(":");
2120
+ if (separatorIndex === -1) {
2121
+ throw new Error(`Invalid YAML mapping entry: ${trimmed}`);
2122
+ }
2123
+ const key = trimmed.slice(0, separatorIndex).trim();
2124
+ const value = trimmed.slice(separatorIndex + 1).trim();
2125
+ return { key, value: value.length ? value : null };
2126
+ }
2127
+ function parseYamlDocument(text) {
2128
+ const rawLines = text.replace(/\r\n/g, "\n").split("\n").map((line) => line.replace(/\t/g, " "));
2129
+ const lines = rawLines.filter((line) => {
2130
+ const trimmed = line.trim();
2131
+ return trimmed.length > 0 && trimmed !== "---" && trimmed !== "...";
2132
+ });
2133
+ let index = 0;
2134
+ function parseBlock(indent) {
2135
+ if (index >= lines.length) {
2136
+ return {};
2137
+ }
2138
+ const currentLine = lines[index];
2139
+ const currentIndent = countIndent(currentLine);
2140
+ if (currentIndent < indent) {
2141
+ return {};
2142
+ }
2143
+ if (currentLine.trimStart().startsWith("-")) {
2144
+ return parseArray(indent);
2145
+ }
2146
+ return parseObject(indent);
2147
+ }
2148
+ function parseArray(indent) {
2149
+ const items = [];
2150
+ while (index < lines.length) {
2151
+ const line = lines[index];
2152
+ const currentIndent = countIndent(line);
2153
+ if (currentIndent < indent) {
2154
+ break;
2155
+ }
2156
+ if (currentIndent !== indent) {
2157
+ throw new Error(`Invalid YAML indentation near: ${line.trim()}`);
2158
+ }
2159
+ const trimmed = line.trimStart();
2160
+ if (!trimmed.startsWith("-")) {
2161
+ break;
2162
+ }
2163
+ const rest = trimmed.slice(1).trimStart();
2164
+ index += 1;
2165
+ if (!rest.length) {
2166
+ items.push(parseBlock(indent + 2));
2167
+ continue;
2168
+ }
2169
+ items.push(parseYamlScalar(rest));
2170
+ }
2171
+ return items;
2172
+ }
2173
+ function parseObject(indent) {
2174
+ const objectValue = {};
2175
+ while (index < lines.length) {
2176
+ const line = lines[index];
2177
+ const currentIndent = countIndent(line);
2178
+ if (currentIndent < indent) {
2179
+ break;
2180
+ }
2181
+ if (currentIndent !== indent) {
2182
+ throw new Error(`Invalid YAML indentation near: ${line.trim()}`);
2183
+ }
2184
+ const trimmed = line.trim();
2185
+ if (trimmed.startsWith("-")) {
2186
+ break;
2187
+ }
2188
+ const { key, value } = splitYamlKeyValue(trimmed);
2189
+ index += 1;
2190
+ objectValue[key] = value === null ? parseBlock(indent + 2) : parseYamlScalar(value);
2191
+ }
2192
+ return objectValue;
2193
+ }
2194
+ return parseBlock(0);
2195
+ }
2196
+ function detectDomainPackManifestFormat(source, explicitFormat) {
2197
+ if (explicitFormat) {
2198
+ return explicitFormat;
2199
+ }
2200
+ const trimmed = source.trim();
2201
+ if (trimmed.startsWith("{")) {
2202
+ return "json";
2203
+ }
2204
+ return "yaml";
2205
+ }
2206
+ function serializeDomainPackAuthoringManifest(manifest, format = "json") {
2207
+ const canonicalValue = sortJsonValue(manifest);
2208
+ if (format === "json") {
2209
+ return `${JSON.stringify(canonicalValue, null, 2)}
2210
+ `;
2211
+ }
2212
+ return `${renderYaml(canonicalValue).join("\n")}
2213
+ `;
2214
+ }
2215
+ function parseDomainPackAuthoringManifest(source, format) {
2216
+ const detectedFormat = detectDomainPackManifestFormat(source, format);
2217
+ const parsed = detectedFormat === "json" ? JSON.parse(source) : parseYamlDocument(source);
2218
+ if (!isPlainObject(parsed)) {
2219
+ throw new Error("Domain pack manifest must parse to an object.");
2220
+ }
2221
+ if (!("pack" in parsed)) {
2222
+ throw new Error("Domain pack manifest requires a top-level pack object.");
2223
+ }
2224
+ return defineDomainPackAuthoringManifest({
2225
+ kind: parsed.kind,
2226
+ manifestVersion: parsed.manifestVersion,
2227
+ pack: parsed.pack,
2228
+ frameworks: parsed.frameworks,
2229
+ schemaExtensions: parsed.schemaExtensions,
2230
+ ontologyExtensions: parsed.ontologyExtensions,
2231
+ lineage: parsed.lineage,
2232
+ metadata: parsed.metadata
2233
+ });
2234
+ }
2235
+
2236
+ // src/domain-pack/validation.ts
2237
+ function issue(code, message, path, severity = "error") {
2238
+ return { code, severity, message, path };
2239
+ }
2240
+ var KEBAB_CASE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
2241
+ var SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
2242
+ var SHAPING_QUESTION_TYPES = /* @__PURE__ */ new Set([
2243
+ "validation",
2244
+ "falsification",
2245
+ "assumption_probe",
2246
+ "counterfactual",
2247
+ "scope",
2248
+ "comparison",
2249
+ "mechanism",
2250
+ "general"
2251
+ ]);
2252
+ var RUNTIME_TARGETS = /* @__PURE__ */ new Set(["claude-code", "codex", "hybrid", "portable"]);
2253
+ var ONTOLOGY_PROVISION_MODES = /* @__PURE__ */ new Set(["bind", "seed", "extend"]);
2254
+ function validateStringArray(values, path, label) {
2255
+ if (!values) {
2256
+ return [];
2257
+ }
2258
+ return values.flatMap((value, index) => {
2259
+ if (!value?.trim()) {
2260
+ return [
2261
+ issue(
2262
+ "INVALID_SHAPING_CONDITION",
2263
+ `${label} must not contain empty strings`,
2264
+ `${path}[${index}]`
2265
+ )
2266
+ ];
2267
+ }
2268
+ return [];
2269
+ });
2270
+ }
2271
+ function validateRuntimeTargets(values, path) {
2272
+ const issues = validateStringArray(values, path, "runtimeTargets");
2273
+ for (const [index, value] of (values || []).entries()) {
2274
+ if (!RUNTIME_TARGETS.has(value)) {
2275
+ issues.push(
2276
+ issue(
2277
+ "INVALID_RUNTIME_TARGET",
2278
+ `Unsupported runtime target "${value}"`,
2279
+ `${path}[${index}]`
2280
+ )
2281
+ );
2282
+ }
2283
+ }
2284
+ return issues;
2285
+ }
2286
+ function validatePromptBinding(prompt, index) {
2287
+ const path = `operatingSystem.prompts[${index}]`;
2027
2288
  const issues = [];
2028
- if (!template.slug?.trim()) {
2289
+ if (!prompt.promptId?.trim()) {
2029
2290
  issues.push(
2030
2291
  issue(
2031
- "MISSING_TOPIC_TEMPLATE_SLUG",
2032
- "topic template requires slug",
2033
- `${path}.slug`
2292
+ "MISSING_PROMPT_ID",
2293
+ "prompt binding requires promptId",
2294
+ `${path}.promptId`
2034
2295
  )
2035
2296
  );
2036
- } else if (!KEBAB_CASE.test(template.slug)) {
2297
+ }
2298
+ if (!prompt.ref?.trim()) {
2037
2299
  issues.push(
2038
- issue(
2039
- "INVALID_TOPIC_TEMPLATE_SLUG",
2040
- `topic template slug "${template.slug}" must be kebab-case`,
2041
- `${path}.slug`
2042
- )
2300
+ issue("MISSING_PROMPT_REF", "prompt binding requires ref", `${path}.ref`)
2043
2301
  );
2044
2302
  }
2045
- if (!template.name?.trim()) {
2303
+ issues.push(
2304
+ ...validateRuntimeTargets(prompt.runtimeTargets, `${path}.runtimeTargets`)
2305
+ );
2306
+ return issues;
2307
+ }
2308
+ function validateToolBinding(tool, index) {
2309
+ const path = `operatingSystem.tools[${index}]`;
2310
+ const issues = [];
2311
+ if (!tool.toolId?.trim()) {
2312
+ issues.push(
2313
+ issue("MISSING_TOOL_ID", "tool binding requires toolId", `${path}.toolId`)
2314
+ );
2315
+ }
2316
+ if (!tool.entrypoint?.trim()) {
2046
2317
  issues.push(
2047
2318
  issue(
2048
- "MISSING_TOPIC_TEMPLATE_NAME",
2049
- "topic template requires name",
2050
- `${path}.name`
2319
+ "MISSING_TOOL_ENTRYPOINT",
2320
+ "tool binding requires entrypoint",
2321
+ `${path}.entrypoint`
2051
2322
  )
2052
2323
  );
2053
2324
  }
2054
- if (!template.description?.trim()) {
2325
+ issues.push(
2326
+ ...validateRuntimeTargets(tool.runtimeTargets, `${path}.runtimeTargets`)
2327
+ );
2328
+ return issues;
2329
+ }
2330
+ function validateSetupAsset(asset, index) {
2331
+ const path = `operatingSystem.setupAssets[${index}]`;
2332
+ const issues = [];
2333
+ if (!asset.assetId?.trim()) {
2055
2334
  issues.push(
2056
2335
  issue(
2057
- "MISSING_TOPIC_TEMPLATE_DESCRIPTION",
2058
- "topic template requires description",
2059
- `${path}.description`
2336
+ "MISSING_SETUP_ASSET_ID",
2337
+ "setup asset requires assetId",
2338
+ `${path}.assetId`
2060
2339
  )
2061
2340
  );
2062
2341
  }
2063
- if (template.parentSlug && !knownTopicSlugs.has(template.parentSlug)) {
2342
+ if (!asset.path?.trim()) {
2064
2343
  issues.push(
2065
2344
  issue(
2066
- "UNKNOWN_TOPIC_PARENT",
2067
- `topic template references unknown parent "${template.parentSlug}"`,
2068
- `${path}.parentSlug`
2345
+ "MISSING_SETUP_ASSET_PATH",
2346
+ "setup asset requires path",
2347
+ `${path}.path`
2069
2348
  )
2070
2349
  );
2071
2350
  }
2351
+ issues.push(
2352
+ ...validateRuntimeTargets(asset.runtimeTargets, `${path}.runtimeTargets`)
2353
+ );
2072
2354
  return issues;
2073
2355
  }
2074
- function validateInstallProfile(profile, index, knownPromptIds, knownToolIds, knownAssetIds, knownTopicSlugs) {
2075
- const path = `operatingSystem.installProfiles[${index}]`;
2356
+ function validateQuestionTemplate(template, index) {
2357
+ const path = `inquiryShaping.questionTemplates[${index}]`;
2076
2358
  const issues = [];
2077
- if (!profile.profileId?.trim()) {
2359
+ if (!template.templateId?.trim()) {
2078
2360
  issues.push(
2079
2361
  issue(
2080
- "MISSING_INSTALL_PROFILE_ID",
2081
- "install profile requires profileId",
2082
- `${path}.profileId`
2362
+ "MISSING_SHAPING_TEMPLATE_ID",
2363
+ "question template requires templateId",
2364
+ `${path}.templateId`
2083
2365
  )
2084
2366
  );
2085
2367
  }
2086
- if (!profile.name?.trim()) {
2368
+ if (!template.template?.trim()) {
2087
2369
  issues.push(
2088
2370
  issue(
2089
- "MISSING_INSTALL_PROFILE_NAME",
2090
- "install profile requires name",
2091
- `${path}.name`
2092
- )
2093
- );
2371
+ "MISSING_SHAPING_TEMPLATE",
2372
+ "question template requires template text",
2373
+ `${path}.template`
2374
+ )
2375
+ );
2376
+ }
2377
+ if (!SHAPING_QUESTION_TYPES.has(template.questionType)) {
2378
+ issues.push(
2379
+ issue(
2380
+ "INVALID_SHAPING_QUESTION_TYPE",
2381
+ `Unsupported questionType "${template.questionType}"`,
2382
+ `${path}.questionType`
2383
+ )
2384
+ );
2385
+ }
2386
+ issues.push(
2387
+ ...validateStringArray(
2388
+ template.whenObjectiveIncludes,
2389
+ `${path}.whenObjectiveIncludes`,
2390
+ "whenObjectiveIncludes"
2391
+ )
2392
+ );
2393
+ return issues;
2394
+ }
2395
+ function validateTaskTemplate(template, index) {
2396
+ const path = `inquiryShaping.taskTemplates[${index}]`;
2397
+ const issues = [];
2398
+ if (!template.templateId?.trim()) {
2399
+ issues.push(
2400
+ issue(
2401
+ "MISSING_TASK_GENERATOR_ID",
2402
+ "task template requires templateId",
2403
+ `${path}.templateId`
2404
+ )
2405
+ );
2406
+ }
2407
+ if (!template.title?.trim()) {
2408
+ issues.push(
2409
+ issue(
2410
+ "MISSING_TASK_GENERATOR_TITLE",
2411
+ "task template requires title",
2412
+ `${path}.title`
2413
+ )
2414
+ );
2415
+ }
2416
+ issues.push(
2417
+ ...validateStringArray(
2418
+ template.whenObjectiveIncludes,
2419
+ `${path}.whenObjectiveIncludes`,
2420
+ "whenObjectiveIncludes"
2421
+ )
2422
+ );
2423
+ issues.push(
2424
+ ...validateStringArray(
2425
+ template.whenQuestionTypes,
2426
+ `${path}.whenQuestionTypes`,
2427
+ "whenQuestionTypes"
2428
+ )
2429
+ );
2430
+ for (const [questionTypeIndex, questionType] of (template.whenQuestionTypes || []).entries()) {
2431
+ if (!SHAPING_QUESTION_TYPES.has(questionType)) {
2432
+ issues.push(
2433
+ issue(
2434
+ "INVALID_TASK_GENERATOR_QUESTION_TYPE",
2435
+ `Unsupported whenQuestionTypes value "${questionType}"`,
2436
+ `${path}.whenQuestionTypes[${questionTypeIndex}]`
2437
+ )
2438
+ );
2439
+ }
2440
+ }
2441
+ return issues;
2442
+ }
2443
+ function validateFrameworkHint(hint, index) {
2444
+ const path = `inquiryShaping.frameworkHints[${index}]`;
2445
+ const issues = [];
2446
+ if (!hint.frameworkName?.trim()) {
2447
+ issues.push(
2448
+ issue(
2449
+ "MISSING_FRAMEWORK_HOOK_NAME",
2450
+ "framework hint requires frameworkName",
2451
+ `${path}.frameworkName`
2452
+ )
2453
+ );
2454
+ }
2455
+ if (hint.boost != null && (!Number.isFinite(hint.boost) || hint.boost < 0)) {
2456
+ issues.push(
2457
+ issue(
2458
+ "INVALID_FRAMEWORK_HOOK_BOOST",
2459
+ "framework hint boost must be a non-negative number",
2460
+ `${path}.boost`
2461
+ )
2462
+ );
2463
+ }
2464
+ issues.push(
2465
+ ...validateStringArray(
2466
+ hint.whenObjectiveIncludes,
2467
+ `${path}.whenObjectiveIncludes`,
2468
+ "whenObjectiveIncludes"
2469
+ )
2470
+ );
2471
+ issues.push(
2472
+ ...validateStringArray(
2473
+ hint.whenQuestionTypes,
2474
+ `${path}.whenQuestionTypes`,
2475
+ "whenQuestionTypes"
2476
+ )
2477
+ );
2478
+ for (const [questionTypeIndex, questionType] of (hint.whenQuestionTypes || []).entries()) {
2479
+ if (!SHAPING_QUESTION_TYPES.has(questionType)) {
2480
+ issues.push(
2481
+ issue(
2482
+ "INVALID_FRAMEWORK_HOOK_QUESTION_TYPE",
2483
+ `Unsupported whenQuestionTypes value "${questionType}"`,
2484
+ `${path}.whenQuestionTypes[${questionTypeIndex}]`
2485
+ )
2486
+ );
2487
+ }
2488
+ }
2489
+ return issues;
2490
+ }
2491
+ function validateTopicTemplate(template, index, knownTopicSlugs) {
2492
+ const path = `operatingSystem.topicTemplates[${index}]`;
2493
+ const issues = [];
2494
+ if (!template.slug?.trim()) {
2495
+ issues.push(
2496
+ issue(
2497
+ "MISSING_TOPIC_TEMPLATE_SLUG",
2498
+ "topic template requires slug",
2499
+ `${path}.slug`
2500
+ )
2501
+ );
2502
+ } else if (!KEBAB_CASE.test(template.slug)) {
2503
+ issues.push(
2504
+ issue(
2505
+ "INVALID_TOPIC_TEMPLATE_SLUG",
2506
+ `topic template slug "${template.slug}" must be kebab-case`,
2507
+ `${path}.slug`
2508
+ )
2509
+ );
2510
+ }
2511
+ if (!template.name?.trim()) {
2512
+ issues.push(
2513
+ issue(
2514
+ "MISSING_TOPIC_TEMPLATE_NAME",
2515
+ "topic template requires name",
2516
+ `${path}.name`
2517
+ )
2518
+ );
2519
+ }
2520
+ if (!template.description?.trim()) {
2521
+ issues.push(
2522
+ issue(
2523
+ "MISSING_TOPIC_TEMPLATE_DESCRIPTION",
2524
+ "topic template requires description",
2525
+ `${path}.description`
2526
+ )
2527
+ );
2528
+ }
2529
+ if (template.parentSlug && !knownTopicSlugs.has(template.parentSlug)) {
2530
+ issues.push(
2531
+ issue(
2532
+ "UNKNOWN_TOPIC_PARENT",
2533
+ `topic template references unknown parent "${template.parentSlug}"`,
2534
+ `${path}.parentSlug`
2535
+ )
2536
+ );
2537
+ }
2538
+ return issues;
2539
+ }
2540
+ function validateInstallProfile(profile, index, knownPromptIds, knownToolIds, knownAssetIds, knownTopicSlugs) {
2541
+ const path = `operatingSystem.installProfiles[${index}]`;
2542
+ const issues = [];
2543
+ if (!profile.profileId?.trim()) {
2544
+ issues.push(
2545
+ issue(
2546
+ "MISSING_INSTALL_PROFILE_ID",
2547
+ "install profile requires profileId",
2548
+ `${path}.profileId`
2549
+ )
2550
+ );
2551
+ }
2552
+ if (!profile.name?.trim()) {
2553
+ issues.push(
2554
+ issue(
2555
+ "MISSING_INSTALL_PROFILE_NAME",
2556
+ "install profile requires name",
2557
+ `${path}.name`
2558
+ )
2559
+ );
2094
2560
  }
2095
2561
  if (!profile.description?.trim()) {
2096
2562
  issues.push(
@@ -2539,16 +3005,18 @@ function validateDomainPack(pack) {
2539
3005
  };
2540
3006
  }
2541
3007
 
2542
- // src/domain-pack/authoring.ts
2543
- var DOMAIN_PACK_MANIFEST_KIND = "lucern-domain-pack-manifest";
2544
- var CURRENT_MANIFEST_VERSION = "1.0.0";
3008
+ // src/domain-pack/authoring.validation.ts
2545
3009
  var KEBAB_CASE2 = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
2546
3010
  var SEMVER2 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
2547
3011
  var LEGACY_PUBLIC_KEYS = /* @__PURE__ */ new Set([
2548
3012
  "project",
2549
3013
  "projects",
2550
3014
  "projectId",
2551
- "projectIds"
3015
+ "projectIds",
3016
+ "sprint",
3017
+ "sprints",
3018
+ "sprintId",
3019
+ "sprintIds"
2552
3020
  ]);
2553
3021
  var SCHEMA_EXTENSION_TARGETS = /* @__PURE__ */ new Set([
2554
3022
  "artifact",
@@ -2589,435 +3057,122 @@ function emptyCounts() {
2589
3057
  ontologyExtensions: 0
2590
3058
  };
2591
3059
  }
2592
- function isPlainObject(value) {
3060
+ function isPlainObject2(value) {
2593
3061
  return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
2594
3062
  }
2595
3063
  function describeParseFailure(error) {
2596
3064
  return error instanceof Error ? error.message : "Manifest parse failed.";
2597
3065
  }
2598
- function dedupeStrings2(values) {
2599
- if (!values) {
2600
- return void 0;
2601
- }
2602
- return Array.from(
2603
- new Set(values.map((value) => value.trim()).filter((value) => value.length))
2604
- );
2605
- }
2606
- function normalizeRuntimeTargets2(values) {
2607
- return values ? dedupeStrings2(values) : void 0;
3066
+ function asToolDefinition(tool) {
3067
+ return tool;
2608
3068
  }
2609
- function normalizeFrameworks(frameworks) {
2610
- if (!frameworks) {
2611
- return void 0;
3069
+ function detectDomainPackManifestFormat2(source, explicitFormat) {
3070
+ if (explicitFormat) {
3071
+ return explicitFormat;
2612
3072
  }
2613
- return frameworks.map((framework) => ({
2614
- ...framework,
2615
- frameworkId: framework.frameworkId.trim(),
2616
- version: framework.version.trim(),
2617
- versionConstraint: framework.versionConstraint?.trim(),
2618
- runtimeTargets: normalizeRuntimeTargets2(framework.runtimeTargets)
2619
- }));
2620
- }
2621
- function normalizeSchemaExtensions(extensions) {
2622
- if (!extensions) {
2623
- return void 0;
3073
+ const trimmed = source.trim();
3074
+ if (trimmed.startsWith("{")) {
3075
+ return "json";
2624
3076
  }
2625
- return extensions.map((extension) => ({
2626
- ...extension,
2627
- extensionId: extension.extensionId.trim(),
2628
- target: extension.target,
2629
- description: extension.description.trim(),
2630
- version: extension.version.trim(),
2631
- extends: extension.extends?.trim()
2632
- }));
3077
+ return "yaml";
2633
3078
  }
2634
- function normalizeOntologyExtensions(extensions) {
2635
- if (!extensions) {
2636
- return void 0;
3079
+ function validateFrameworks(frameworks) {
3080
+ if (!frameworks) {
3081
+ return [];
2637
3082
  }
2638
- return extensions.map((extension) => ({
2639
- ...extension,
2640
- extensionId: extension.extensionId.trim(),
2641
- ontologyId: extension.ontologyId.trim(),
2642
- baseVersionConstraint: extension.baseVersionConstraint.trim(),
2643
- entityTypes: extension.entityTypes?.map((entityType) => ({
2644
- ...entityType,
2645
- value: entityType.value.trim(),
2646
- label: entityType.label.trim(),
2647
- description: entityType.description?.trim(),
2648
- subtypes: dedupeStrings2(entityType.subtypes)
2649
- })),
2650
- edgeTypes: extension.edgeTypes?.map((edgeType) => ({
2651
- ...edgeType,
2652
- value: edgeType.value.trim(),
2653
- label: edgeType.label.trim(),
2654
- description: edgeType.description?.trim(),
2655
- sourceTypes: dedupeStrings2(edgeType.sourceTypes),
2656
- targetTypes: dedupeStrings2(edgeType.targetTypes)
2657
- }))
2658
- }));
2659
- }
2660
- function normalizeLineage(lineage) {
2661
- if (!lineage) {
2662
- return { mode: "root" };
2663
- }
2664
- return {
2665
- mode: lineage.mode,
2666
- parentPackId: lineage.parentPackId?.trim(),
2667
- parentVersion: lineage.parentVersion?.trim(),
2668
- parentManifestDigest: lineage.parentManifestDigest?.trim(),
2669
- supersedesPackId: lineage.supersedesPackId?.trim(),
2670
- notes: lineage.notes?.trim()
2671
- };
2672
- }
2673
- function normalizeMetadata(metadata) {
2674
- if (!metadata) {
2675
- return void 0;
2676
- }
2677
- return {
2678
- description: metadata.description?.trim(),
2679
- owner: metadata.owner?.trim(),
2680
- tags: dedupeStrings2(metadata.tags)
2681
- };
2682
- }
2683
- function toDomainPack(pack) {
2684
- return defineDomainPack(pack);
2685
- }
2686
- function defineDomainPackAuthoringManifest(input) {
2687
- return {
2688
- kind: input.kind ?? DOMAIN_PACK_MANIFEST_KIND,
2689
- manifestVersion: input.manifestVersion?.trim() || CURRENT_MANIFEST_VERSION,
2690
- pack: toDomainPack(input.pack),
2691
- frameworks: normalizeFrameworks(input.frameworks),
2692
- schemaExtensions: normalizeSchemaExtensions(input.schemaExtensions),
2693
- ontologyExtensions: normalizeOntologyExtensions(input.ontologyExtensions),
2694
- lineage: normalizeLineage(input.lineage),
2695
- metadata: normalizeMetadata(input.metadata)
2696
- };
2697
- }
2698
- function countManifestArtifacts(manifest) {
2699
- if (!manifest) {
2700
- return emptyCounts();
2701
- }
2702
- return {
2703
- topicRoots: manifest.pack.topicRoots.length,
2704
- workflows: manifest.pack.workflows.length,
2705
- gates: manifest.pack.gates.length,
2706
- artifacts: manifest.pack.artifacts.length,
2707
- roles: manifest.pack.roles.length,
2708
- prompts: manifest.pack.operatingSystem?.prompts?.length ?? 0,
2709
- tools: manifest.pack.operatingSystem?.tools?.length ?? 0,
2710
- setupAssets: manifest.pack.operatingSystem?.setupAssets?.length ?? 0,
2711
- installProfiles: manifest.pack.operatingSystem?.installProfiles?.length ?? 0,
2712
- frameworks: manifest.frameworks?.length ?? 0,
2713
- schemaExtensions: manifest.schemaExtensions?.length ?? 0,
2714
- ontologyExtensions: manifest.ontologyExtensions?.length ?? 0
2715
- };
2716
- }
2717
- function sortJsonValue(value) {
2718
- if (Array.isArray(value)) {
2719
- return value.map(sortJsonValue);
2720
- }
2721
- if (isPlainObject(value)) {
2722
- return Object.fromEntries(
2723
- Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => [key, sortJsonValue(entryValue)])
2724
- );
2725
- }
2726
- return value;
2727
- }
2728
- function toYamlScalar(value) {
2729
- if (value === null) {
2730
- return "null";
2731
- }
2732
- if (typeof value === "boolean" || typeof value === "number") {
2733
- return String(value);
2734
- }
2735
- return JSON.stringify(String(value));
2736
- }
2737
- function renderYaml(value, indent = 0) {
2738
- const prefix = " ".repeat(indent);
2739
- if (Array.isArray(value)) {
2740
- if (value.length === 0) {
2741
- return [`${prefix}[]`];
3083
+ const issues = [];
3084
+ const seen = /* @__PURE__ */ new Set();
3085
+ frameworks.forEach((framework, index) => {
3086
+ const path = `frameworks[${index}]`;
3087
+ if (!framework.frameworkId) {
3088
+ issues.push(
3089
+ issue2(
3090
+ "MISSING_FRAMEWORK_ID",
3091
+ "frameworkId is required",
3092
+ `${path}.frameworkId`,
3093
+ "framework"
3094
+ )
3095
+ );
3096
+ } else if (!KEBAB_CASE2.test(framework.frameworkId)) {
3097
+ issues.push(
3098
+ issue2(
3099
+ "INVALID_FRAMEWORK_ID",
3100
+ `frameworkId "${framework.frameworkId}" must be kebab-case`,
3101
+ `${path}.frameworkId`,
3102
+ "framework"
3103
+ )
3104
+ );
3105
+ } else if (seen.has(framework.frameworkId)) {
3106
+ issues.push(
3107
+ issue2(
3108
+ "DUPLICATE_FRAMEWORK_ID",
3109
+ `Duplicate frameworkId "${framework.frameworkId}"`,
3110
+ `${path}.frameworkId`,
3111
+ "framework"
3112
+ )
3113
+ );
3114
+ } else {
3115
+ seen.add(framework.frameworkId);
2742
3116
  }
2743
- return value.flatMap((entry) => {
2744
- if (Array.isArray(entry) || isPlainObject(entry)) {
2745
- return [`${prefix}-`, ...renderYaml(entry, indent + 2)];
2746
- }
2747
- return [`${prefix}- ${toYamlScalar(entry)}`];
2748
- });
2749
- }
2750
- if (isPlainObject(value)) {
2751
- const entries = Object.entries(value);
2752
- if (entries.length === 0) {
2753
- return [`${prefix}{}`];
3117
+ if (!framework.version) {
3118
+ issues.push(
3119
+ issue2(
3120
+ "MISSING_FRAMEWORK_VERSION",
3121
+ "version is required",
3122
+ `${path}.version`,
3123
+ "framework"
3124
+ )
3125
+ );
3126
+ } else if (!SEMVER2.test(framework.version)) {
3127
+ issues.push(
3128
+ issue2(
3129
+ "INVALID_FRAMEWORK_VERSION",
3130
+ `framework version "${framework.version}" must be valid semver`,
3131
+ `${path}.version`,
3132
+ "framework"
3133
+ )
3134
+ );
2754
3135
  }
2755
- return entries.flatMap(([key, entryValue]) => {
2756
- if (entryValue === void 0) {
2757
- return [];
2758
- }
2759
- if (Array.isArray(entryValue)) {
2760
- if (entryValue.length === 0) {
2761
- return [`${prefix}${key}: []`];
2762
- }
2763
- return [`${prefix}${key}:`, ...renderYaml(entryValue, indent + 2)];
2764
- }
2765
- if (isPlainObject(entryValue)) {
2766
- if (Object.keys(entryValue).length === 0) {
2767
- return [`${prefix}${key}: {}`];
2768
- }
2769
- return [`${prefix}${key}:`, ...renderYaml(entryValue, indent + 2)];
2770
- }
2771
- return [`${prefix}${key}: ${toYamlScalar(entryValue)}`];
2772
- });
2773
- }
2774
- return [`${prefix}${toYamlScalar(value)}`];
2775
- }
2776
- function countIndent(line) {
2777
- return line.length - line.trimStart().length;
3136
+ });
3137
+ return issues;
2778
3138
  }
2779
- function parseYamlScalar(raw) {
2780
- const value = raw.trim();
2781
- if (value === "null") {
2782
- return null;
2783
- }
2784
- if (value === "true") {
2785
- return true;
2786
- }
2787
- if (value === "false") {
2788
- return false;
2789
- }
2790
- if (/^-?\d+(?:\.\d+)?$/.test(value)) {
2791
- return Number(value);
2792
- }
2793
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
2794
- if (value.startsWith("'")) {
2795
- return value.slice(1, -1).replace(/''/g, "'");
2796
- }
2797
- return JSON.parse(value);
2798
- }
2799
- if (value === "[]") {
3139
+ function validateSchemaExtensions(extensions) {
3140
+ if (!extensions) {
2800
3141
  return [];
2801
3142
  }
2802
- if (value === "{}") {
2803
- return {};
2804
- }
2805
- return value;
2806
- }
2807
- function splitYamlKeyValue(trimmed) {
2808
- const separatorIndex = trimmed.indexOf(":");
2809
- if (separatorIndex === -1) {
2810
- throw new Error(`Invalid YAML mapping entry: ${trimmed}`);
2811
- }
2812
- const key = trimmed.slice(0, separatorIndex).trim();
2813
- const value = trimmed.slice(separatorIndex + 1).trim();
2814
- return { key, value: value.length ? value : null };
2815
- }
2816
- function parseYamlDocument(text) {
2817
- const rawLines = text.replace(/\r\n/g, "\n").split("\n").map((line) => line.replace(/\t/g, " "));
2818
- const lines = rawLines.filter((line) => {
2819
- const trimmed = line.trim();
2820
- return trimmed.length > 0 && trimmed !== "---" && trimmed !== "...";
2821
- });
2822
- let index = 0;
2823
- function parseBlock(indent) {
2824
- if (index >= lines.length) {
2825
- return {};
2826
- }
2827
- const currentLine = lines[index];
2828
- const currentIndent = countIndent(currentLine);
2829
- if (currentIndent < indent) {
2830
- return {};
2831
- }
2832
- if (currentLine.trimStart().startsWith("-")) {
2833
- return parseArray(indent);
2834
- }
2835
- return parseObject(indent);
2836
- }
2837
- function parseArray(indent) {
2838
- const items = [];
2839
- while (index < lines.length) {
2840
- const line = lines[index];
2841
- const currentIndent = countIndent(line);
2842
- if (currentIndent < indent) {
2843
- break;
2844
- }
2845
- if (currentIndent !== indent) {
2846
- throw new Error(`Invalid YAML indentation near: ${line.trim()}`);
2847
- }
2848
- const trimmed = line.trimStart();
2849
- if (!trimmed.startsWith("-")) {
2850
- break;
2851
- }
2852
- const rest = trimmed.slice(1).trimStart();
2853
- index += 1;
2854
- if (!rest.length) {
2855
- items.push(parseBlock(indent + 2));
2856
- continue;
2857
- }
2858
- items.push(parseYamlScalar(rest));
2859
- }
2860
- return items;
2861
- }
2862
- function parseObject(indent) {
2863
- const objectValue = {};
2864
- while (index < lines.length) {
2865
- const line = lines[index];
2866
- const currentIndent = countIndent(line);
2867
- if (currentIndent < indent) {
2868
- break;
2869
- }
2870
- if (currentIndent !== indent) {
2871
- throw new Error(`Invalid YAML indentation near: ${line.trim()}`);
2872
- }
2873
- const trimmed = line.trim();
2874
- if (trimmed.startsWith("-")) {
2875
- break;
2876
- }
2877
- const { key, value } = splitYamlKeyValue(trimmed);
2878
- index += 1;
2879
- objectValue[key] = value === null ? parseBlock(indent + 2) : parseYamlScalar(value);
2880
- }
2881
- return objectValue;
2882
- }
2883
- return parseBlock(0);
2884
- }
2885
- function detectDomainPackManifestFormat(source, explicitFormat) {
2886
- if (explicitFormat) {
2887
- return explicitFormat;
2888
- }
2889
- const trimmed = source.trim();
2890
- if (trimmed.startsWith("{")) {
2891
- return "json";
2892
- }
2893
- return "yaml";
2894
- }
2895
- function serializeDomainPackAuthoringManifest(manifest, format = "json") {
2896
- const canonicalValue = sortJsonValue(manifest);
2897
- if (format === "json") {
2898
- return `${JSON.stringify(canonicalValue, null, 2)}
2899
- `;
2900
- }
2901
- return `${renderYaml(canonicalValue).join("\n")}
2902
- `;
2903
- }
2904
- function parseDomainPackAuthoringManifest(source, format) {
2905
- const detectedFormat = detectDomainPackManifestFormat(source, format);
2906
- const parsed = detectedFormat === "json" ? JSON.parse(source) : parseYamlDocument(source);
2907
- if (!isPlainObject(parsed)) {
2908
- throw new Error("Domain pack manifest must parse to an object.");
2909
- }
2910
- if (!("pack" in parsed)) {
2911
- throw new Error("Domain pack manifest requires a top-level pack object.");
2912
- }
2913
- return defineDomainPackAuthoringManifest({
2914
- kind: parsed.kind,
2915
- manifestVersion: parsed.manifestVersion,
2916
- pack: parsed.pack,
2917
- frameworks: parsed.frameworks,
2918
- schemaExtensions: parsed.schemaExtensions,
2919
- ontologyExtensions: parsed.ontologyExtensions,
2920
- lineage: parsed.lineage,
2921
- metadata: parsed.metadata
2922
- });
2923
- }
2924
- function validateFrameworks(frameworks) {
2925
- if (!frameworks) {
2926
- return [];
2927
- }
2928
- const issues = [];
2929
- const seen = /* @__PURE__ */ new Set();
2930
- frameworks.forEach((framework, index) => {
2931
- const path = `frameworks[${index}]`;
2932
- if (!framework.frameworkId) {
2933
- issues.push(
2934
- issue2(
2935
- "MISSING_FRAMEWORK_ID",
2936
- "frameworkId is required",
2937
- `${path}.frameworkId`,
2938
- "framework"
2939
- )
2940
- );
2941
- } else if (!KEBAB_CASE2.test(framework.frameworkId)) {
2942
- issues.push(
2943
- issue2(
2944
- "INVALID_FRAMEWORK_ID",
2945
- `frameworkId "${framework.frameworkId}" must be kebab-case`,
2946
- `${path}.frameworkId`,
2947
- "framework"
2948
- )
2949
- );
2950
- } else if (seen.has(framework.frameworkId)) {
2951
- issues.push(
2952
- issue2(
2953
- "DUPLICATE_FRAMEWORK_ID",
2954
- `Duplicate frameworkId "${framework.frameworkId}"`,
2955
- `${path}.frameworkId`,
2956
- "framework"
2957
- )
2958
- );
2959
- } else {
2960
- seen.add(framework.frameworkId);
2961
- }
2962
- if (!framework.version) {
2963
- issues.push(
2964
- issue2(
2965
- "MISSING_FRAMEWORK_VERSION",
2966
- "version is required",
2967
- `${path}.version`,
2968
- "framework"
2969
- )
2970
- );
2971
- } else if (!SEMVER2.test(framework.version)) {
2972
- issues.push(
2973
- issue2(
2974
- "INVALID_FRAMEWORK_VERSION",
2975
- `framework version "${framework.version}" must be valid semver`,
2976
- `${path}.version`,
2977
- "framework"
2978
- )
2979
- );
2980
- }
2981
- });
2982
- return issues;
2983
- }
2984
- function validateSchemaExtensions(extensions) {
2985
- if (!extensions) {
2986
- return [];
2987
- }
2988
- const issues = [];
2989
- const seen = /* @__PURE__ */ new Set();
2990
- extensions.forEach((extension, index) => {
2991
- const path = `schemaExtensions[${index}]`;
2992
- if (!extension.extensionId) {
2993
- issues.push(
2994
- issue2(
2995
- "MISSING_SCHEMA_EXTENSION_ID",
2996
- "extensionId is required",
2997
- `${path}.extensionId`,
2998
- "schema-extension"
2999
- )
3000
- );
3001
- } else if (!KEBAB_CASE2.test(extension.extensionId)) {
3002
- issues.push(
3003
- issue2(
3004
- "INVALID_SCHEMA_EXTENSION_ID",
3005
- `extensionId "${extension.extensionId}" must be kebab-case`,
3006
- `${path}.extensionId`,
3007
- "schema-extension"
3008
- )
3009
- );
3010
- } else if (seen.has(extension.extensionId)) {
3011
- issues.push(
3012
- issue2(
3013
- "DUPLICATE_SCHEMA_EXTENSION_ID",
3014
- `Duplicate schema extension "${extension.extensionId}"`,
3015
- `${path}.extensionId`,
3016
- "schema-extension"
3017
- )
3018
- );
3019
- } else {
3020
- seen.add(extension.extensionId);
3143
+ const issues = [];
3144
+ const seen = /* @__PURE__ */ new Set();
3145
+ extensions.forEach((extension, index) => {
3146
+ const path = `schemaExtensions[${index}]`;
3147
+ if (!extension.extensionId) {
3148
+ issues.push(
3149
+ issue2(
3150
+ "MISSING_SCHEMA_EXTENSION_ID",
3151
+ "extensionId is required",
3152
+ `${path}.extensionId`,
3153
+ "schema-extension"
3154
+ )
3155
+ );
3156
+ } else if (!KEBAB_CASE2.test(extension.extensionId)) {
3157
+ issues.push(
3158
+ issue2(
3159
+ "INVALID_SCHEMA_EXTENSION_ID",
3160
+ `extensionId "${extension.extensionId}" must be kebab-case`,
3161
+ `${path}.extensionId`,
3162
+ "schema-extension"
3163
+ )
3164
+ );
3165
+ } else if (seen.has(extension.extensionId)) {
3166
+ issues.push(
3167
+ issue2(
3168
+ "DUPLICATE_SCHEMA_EXTENSION_ID",
3169
+ `Duplicate schema extension "${extension.extensionId}"`,
3170
+ `${path}.extensionId`,
3171
+ "schema-extension"
3172
+ )
3173
+ );
3174
+ } else {
3175
+ seen.add(extension.extensionId);
3021
3176
  }
3022
3177
  if (!SCHEMA_EXTENSION_TARGETS.has(extension.target)) {
3023
3178
  issues.push(
@@ -3049,7 +3204,7 @@ function validateSchemaExtensions(extensions) {
3049
3204
  )
3050
3205
  );
3051
3206
  }
3052
- if (!isPlainObject(extension.schema)) {
3207
+ if (!isPlainObject2(extension.schema)) {
3053
3208
  issues.push(
3054
3209
  issue2(
3055
3210
  "INVALID_SCHEMA_EXTENSION_SCHEMA",
@@ -3131,85 +3286,89 @@ function validateOntologyExtensions(extensions) {
3131
3286
  );
3132
3287
  }
3133
3288
  const entityTypeValues = /* @__PURE__ */ new Set();
3134
- extension.entityTypes?.forEach((entityType, entityTypeIndex) => {
3135
- const entityPath = `${path}.entityTypes[${entityTypeIndex}]`;
3136
- if (!entityType.value || !KEBAB_CASE2.test(entityType.value)) {
3137
- issues.push(
3138
- issue2(
3139
- "INVALID_ONTOLOGY_ENTITY_VALUE",
3140
- "entity extension value must be kebab-case",
3141
- `${entityPath}.value`,
3142
- "ontology-extension"
3143
- )
3144
- );
3145
- } else if (entityTypeValues.has(entityType.value)) {
3146
- issues.push(
3147
- issue2(
3148
- "DUPLICATE_ONTOLOGY_ENTITY_VALUE",
3149
- `Duplicate entity extension value "${entityType.value}"`,
3150
- `${entityPath}.value`,
3151
- "ontology-extension"
3152
- )
3153
- );
3154
- } else {
3155
- entityTypeValues.add(entityType.value);
3156
- }
3157
- if (!entityType.label) {
3158
- issues.push(
3159
- issue2(
3160
- "MISSING_ONTOLOGY_ENTITY_LABEL",
3161
- "entity extension label is required",
3162
- `${entityPath}.label`,
3163
- "ontology-extension"
3164
- )
3165
- );
3289
+ extension.entityTypes?.forEach(
3290
+ (entityType, entityTypeIndex) => {
3291
+ const entityPath = `${path}.entityTypes[${entityTypeIndex}]`;
3292
+ if (!entityType.value || !KEBAB_CASE2.test(entityType.value)) {
3293
+ issues.push(
3294
+ issue2(
3295
+ "INVALID_ONTOLOGY_ENTITY_VALUE",
3296
+ "entity extension value must be kebab-case",
3297
+ `${entityPath}.value`,
3298
+ "ontology-extension"
3299
+ )
3300
+ );
3301
+ } else if (entityTypeValues.has(entityType.value)) {
3302
+ issues.push(
3303
+ issue2(
3304
+ "DUPLICATE_ONTOLOGY_ENTITY_VALUE",
3305
+ `Duplicate entity extension value "${entityType.value}"`,
3306
+ `${entityPath}.value`,
3307
+ "ontology-extension"
3308
+ )
3309
+ );
3310
+ } else {
3311
+ entityTypeValues.add(entityType.value);
3312
+ }
3313
+ if (!entityType.label) {
3314
+ issues.push(
3315
+ issue2(
3316
+ "MISSING_ONTOLOGY_ENTITY_LABEL",
3317
+ "entity extension label is required",
3318
+ `${entityPath}.label`,
3319
+ "ontology-extension"
3320
+ )
3321
+ );
3322
+ }
3166
3323
  }
3167
- });
3324
+ );
3168
3325
  const edgeTypeValues = /* @__PURE__ */ new Set();
3169
- extension.edgeTypes?.forEach((edgeType, edgeTypeIndex) => {
3170
- const edgePath = `${path}.edgeTypes[${edgeTypeIndex}]`;
3171
- if (!edgeType.value || !KEBAB_CASE2.test(edgeType.value)) {
3172
- issues.push(
3173
- issue2(
3174
- "INVALID_ONTOLOGY_EDGE_VALUE",
3175
- "edge extension value must be kebab-case",
3176
- `${edgePath}.value`,
3177
- "ontology-extension"
3178
- )
3179
- );
3180
- } else if (edgeTypeValues.has(edgeType.value)) {
3181
- issues.push(
3182
- issue2(
3183
- "DUPLICATE_ONTOLOGY_EDGE_VALUE",
3184
- `Duplicate edge extension value "${edgeType.value}"`,
3185
- `${edgePath}.value`,
3186
- "ontology-extension"
3187
- )
3188
- );
3189
- } else {
3190
- edgeTypeValues.add(edgeType.value);
3191
- }
3192
- if (!edgeType.label) {
3193
- issues.push(
3194
- issue2(
3195
- "MISSING_ONTOLOGY_EDGE_LABEL",
3196
- "edge extension label is required",
3197
- `${edgePath}.label`,
3198
- "ontology-extension"
3199
- )
3200
- );
3201
- }
3202
- if (edgeType.constraintSeverity && !ONTOLOGY_CONSTRAINT_SEVERITIES.has(edgeType.constraintSeverity)) {
3203
- issues.push(
3204
- issue2(
3205
- "INVALID_ONTOLOGY_EDGE_SEVERITY",
3206
- `Unsupported constraint severity "${edgeType.constraintSeverity}"`,
3207
- `${edgePath}.constraintSeverity`,
3208
- "ontology-extension"
3209
- )
3210
- );
3326
+ extension.edgeTypes?.forEach(
3327
+ (edgeType, edgeTypeIndex) => {
3328
+ const edgePath = `${path}.edgeTypes[${edgeTypeIndex}]`;
3329
+ if (!edgeType.value || !KEBAB_CASE2.test(edgeType.value)) {
3330
+ issues.push(
3331
+ issue2(
3332
+ "INVALID_ONTOLOGY_EDGE_VALUE",
3333
+ "edge extension value must be kebab-case",
3334
+ `${edgePath}.value`,
3335
+ "ontology-extension"
3336
+ )
3337
+ );
3338
+ } else if (edgeTypeValues.has(edgeType.value)) {
3339
+ issues.push(
3340
+ issue2(
3341
+ "DUPLICATE_ONTOLOGY_EDGE_VALUE",
3342
+ `Duplicate edge extension value "${edgeType.value}"`,
3343
+ `${edgePath}.value`,
3344
+ "ontology-extension"
3345
+ )
3346
+ );
3347
+ } else {
3348
+ edgeTypeValues.add(edgeType.value);
3349
+ }
3350
+ if (!edgeType.label) {
3351
+ issues.push(
3352
+ issue2(
3353
+ "MISSING_ONTOLOGY_EDGE_LABEL",
3354
+ "edge extension label is required",
3355
+ `${edgePath}.label`,
3356
+ "ontology-extension"
3357
+ )
3358
+ );
3359
+ }
3360
+ if (edgeType.constraintSeverity && !ONTOLOGY_CONSTRAINT_SEVERITIES.has(edgeType.constraintSeverity)) {
3361
+ issues.push(
3362
+ issue2(
3363
+ "INVALID_ONTOLOGY_EDGE_SEVERITY",
3364
+ `Unsupported constraint severity "${edgeType.constraintSeverity}"`,
3365
+ `${edgePath}.constraintSeverity`,
3366
+ "ontology-extension"
3367
+ )
3368
+ );
3369
+ }
3211
3370
  }
3212
- });
3371
+ );
3213
3372
  });
3214
3373
  return issues;
3215
3374
  }
@@ -3328,7 +3487,7 @@ function scanLegacyPublicKeys(value, path = "") {
3328
3487
  });
3329
3488
  return issues;
3330
3489
  }
3331
- if (!isPlainObject(value)) {
3490
+ if (!isPlainObject2(value)) {
3332
3491
  return issues;
3333
3492
  }
3334
3493
  Object.entries(value).forEach(([key, entryValue]) => {
@@ -3427,7 +3586,7 @@ function validateDomainPackAuthoringManifest(manifest) {
3427
3586
  );
3428
3587
  }
3429
3588
  function validateDomainPackAuthoringManifestSource(source, format) {
3430
- const detectedFormat = detectDomainPackManifestFormat(source, format);
3589
+ const detectedFormat = detectDomainPackManifestFormat2(source, format);
3431
3590
  try {
3432
3591
  const manifest = parseDomainPackAuthoringManifest(source, detectedFormat);
3433
3592
  return evaluateDomainPackAuthoringManifest(manifest, detectedFormat);
@@ -3577,26 +3736,44 @@ function createDomainPackAuthoringTools() {
3577
3736
  additionalProperties: false
3578
3737
  };
3579
3738
  return {
3580
- validate: {
3739
+ validate: asToolDefinition({
3581
3740
  name: AUTHORING_TOOL_NAMES.validate,
3582
3741
  description: "Validate a domain pack authoring manifest and return structural, lineage, terminology, and extension issues.",
3583
3742
  inputSchema,
3584
3743
  execute: (args) => validateDomainPackAuthoringManifestSource(args.manifestText, args.format)
3585
- },
3586
- preview: {
3744
+ }),
3745
+ preview: asToolDefinition({
3587
3746
  name: AUTHORING_TOOL_NAMES.preview,
3588
3747
  description: "Preview a domain pack manifest with canonical JSON/YAML renderings, runtime targets, and publication readiness.",
3589
3748
  inputSchema,
3590
3749
  execute: (args) => previewDomainPackAuthoringManifestSource(args.manifestText, args.format)
3591
- },
3592
- publish: {
3750
+ }),
3751
+ publish: asToolDefinition({
3593
3752
  name: AUTHORING_TOOL_NAMES.publish,
3594
3753
  description: "Build a publication-ready domain pack artifact when validation passes, including remix/fork lineage metadata.",
3595
3754
  inputSchema,
3596
3755
  execute: (args) => publishDomainPackAuthoringManifestSource(args.manifestText, args.format)
3597
- }
3756
+ })
3598
3757
  };
3599
3758
  }
3759
+ var domainPackAuthoringValidation = {
3760
+ validateDomainPackAuthoringManifest,
3761
+ validateDomainPackAuthoringManifestSource,
3762
+ previewDomainPackAuthoringManifest,
3763
+ previewDomainPackAuthoringManifestSource,
3764
+ publishDomainPackAuthoringManifest,
3765
+ publishDomainPackAuthoringManifestSource,
3766
+ createDomainPackAuthoringTools
3767
+ };
3768
+
3769
+ // src/domain-pack/authoring.ts
3770
+ var validateDomainPackAuthoringManifest2 = domainPackAuthoringValidation.validateDomainPackAuthoringManifest;
3771
+ var validateDomainPackAuthoringManifestSource2 = domainPackAuthoringValidation.validateDomainPackAuthoringManifestSource;
3772
+ var previewDomainPackAuthoringManifest2 = domainPackAuthoringValidation.previewDomainPackAuthoringManifest;
3773
+ var previewDomainPackAuthoringManifestSource2 = domainPackAuthoringValidation.previewDomainPackAuthoringManifestSource;
3774
+ var publishDomainPackAuthoringManifest2 = domainPackAuthoringValidation.publishDomainPackAuthoringManifest;
3775
+ var publishDomainPackAuthoringManifestSource2 = domainPackAuthoringValidation.publishDomainPackAuthoringManifestSource;
3776
+ var createDomainPackAuthoringTools2 = domainPackAuthoringValidation.createDomainPackAuthoringTools;
3600
3777
 
3601
3778
  // src/domain-pack/ontology/software-entities-v1.ts
3602
3779
  var SOFTWARE_ENTITIES_V1 = {
@@ -4211,578 +4388,8 @@ var DEVELOPER_REASONING_PACK = defineDomainPack({
4211
4388
  methodologyPackId: "developer"
4212
4389
  });
4213
4390
 
4214
- // src/domain-pack/packs/engineering-accelerator.ts
4215
- var ENGINEERING_ACCELERATOR_PACK = defineDomainPack({
4216
- packId: "engineering-accelerator",
4217
- name: "Engineering Accelerator",
4218
- version: "1.0.0",
4219
- ontologyBindings: [
4220
- {
4221
- ontologyId: "software-entities",
4222
- versionConstraint: "^1.0.0",
4223
- required: true,
4224
- provisionMode: "seed",
4225
- seedRef: "packages/pack-host/src/domain-pack/ontology/software-entities-v1.ts",
4226
- requiredEntityTypes: [
4227
- "repository",
4228
- "service",
4229
- "module",
4230
- "workflow",
4231
- "incident",
4232
- "migration",
4233
- "decision_record",
4234
- "agent"
4235
- ],
4236
- requiredEdgeTypes: [
4237
- "depends_on",
4238
- "owns",
4239
- "calls",
4240
- "blocks",
4241
- "reviews",
4242
- "mitigates",
4243
- "supersedes"
4244
- ]
4245
- }
4246
- ],
4247
- topicRoots: [
4248
- {
4249
- slug: "migrations",
4250
- name: "Migrations",
4251
- description: "Schema, API, and runtime migrations with blast-radius, rollback, and parity memory",
4252
- ontologyId: "software-entities"
4253
- },
4254
- {
4255
- slug: "reviews",
4256
- name: "Reviews",
4257
- description: "Pull-request and change-review workflows grounded in prior rationale and regressions",
4258
- ontologyId: "software-entities"
4259
- },
4260
- {
4261
- slug: "incidents",
4262
- name: "Incidents",
4263
- description: "Incident response driven by competing hypotheses, contradictions, and mitigations",
4264
- ontologyId: "software-entities"
4265
- },
4266
- {
4267
- slug: "architecture",
4268
- name: "Architecture",
4269
- description: "Architecture decisions, interface trade-offs, and precedent-aware rationale recall",
4270
- ontologyId: "software-entities"
4271
- },
4272
- {
4273
- slug: "decision-memory",
4274
- name: "Decision Memory",
4275
- description: "Cross-cutting rationale recall, failed attempts, and analog reuse across engineering work",
4276
- ontologyId: "software-entities"
4277
- }
4278
- ],
4279
- workflows: [
4280
- {
4281
- workflowId: "migration-readiness",
4282
- name: "Migration Readiness",
4283
- description: "Recall similar migrations, map blast radius, and define rollback before rollout",
4284
- steps: [
4285
- {
4286
- stepId: "recall-history",
4287
- name: "Recall History",
4288
- description: "Compile analogous migrations, prior rationale, failed attempts, and compatibility constraints",
4289
- requiredRoles: ["context-compiler", "migration-owner"],
4290
- produces: ["memory-brief"],
4291
- gateId: "memory-grounded"
4292
- },
4293
- {
4294
- stepId: "plan-rollout",
4295
- name: "Plan Rollout",
4296
- description: "Define blast radius, sequencing, rollback, and verification checkpoints",
4297
- requiredRoles: ["migration-owner", "critic"],
4298
- produces: ["migration-plan"],
4299
- gateId: "rollback-ready"
4300
- },
4301
- {
4302
- stepId: "verify-rollout",
4303
- name: "Verify Rollout",
4304
- description: "Confirm canary, rollback, and parity checks are explicit before execution",
4305
- requiredRoles: ["reviewer"],
4306
- produces: ["verification-checklist"],
4307
- gateId: "verification-covered"
4308
- }
4309
- ],
4310
- requiredArtifacts: [
4311
- "memory-brief",
4312
- "migration-plan",
4313
- "verification-checklist"
4314
- ],
4315
- gateCheckpoints: [
4316
- "memory-grounded",
4317
- "rollback-ready",
4318
- "verification-covered"
4319
- ]
4320
- },
4321
- {
4322
- workflowId: "pull-request-review",
4323
- name: "Pull Request Review",
4324
- description: "Use prior rationale, regressions, and verification history to review risky changes faster",
4325
- steps: [
4326
- {
4327
- stepId: "recall-review-context",
4328
- name: "Recall Review Context",
4329
- description: "Load earlier decisions, similar diffs, failed attempts, and relevant incidents",
4330
- requiredRoles: ["context-compiler", "reviewer"],
4331
- produces: ["review-context"],
4332
- gateId: "memory-grounded"
4333
- },
4334
- {
4335
- stepId: "inspect-diff",
4336
- name: "Inspect Diff",
4337
- description: "Surface risk areas, stale assumptions, and regressions that should block approval",
4338
- requiredRoles: ["reviewer", "critic"],
4339
- produces: ["review-findings"],
4340
- gateId: "review-risks-surfaced"
4341
- },
4342
- {
4343
- stepId: "verify-changes",
4344
- name: "Verify Changes",
4345
- description: "Tie approval to explicit typecheck, test, and integration evidence",
4346
- requiredRoles: ["reviewer"],
4347
- produces: ["verification-checklist"],
4348
- gateId: "verification-covered"
4349
- }
4350
- ],
4351
- requiredArtifacts: [
4352
- "review-context",
4353
- "review-findings",
4354
- "verification-checklist"
4355
- ],
4356
- gateCheckpoints: [
4357
- "memory-grounded",
4358
- "review-risks-surfaced",
4359
- "verification-covered"
4360
- ]
4361
- },
4362
- {
4363
- workflowId: "incident-response",
4364
- name: "Incident Response",
4365
- description: "Treat incidents as contradiction-heavy reasoning tasks before committing to a root cause",
4366
- steps: [
4367
- {
4368
- stepId: "collect-signal",
4369
- name: "Collect Signal",
4370
- description: "Assemble symptoms, recent changes, precedent incidents, and active hypotheses",
4371
- requiredRoles: ["context-compiler", "incident-commander"],
4372
- produces: ["incident-brief"],
4373
- gateId: "memory-grounded"
4374
- },
4375
- {
4376
- stepId: "surface-contradictions",
4377
- name: "Surface Contradictions",
4378
- description: "Make competing explanations explicit before mitigation narrows the search space",
4379
- requiredRoles: ["incident-commander", "critic"],
4380
- produces: ["contradiction-report"],
4381
- gateId: "contradictions-surfaced"
4382
- },
4383
- {
4384
- stepId: "plan-mitigation",
4385
- name: "Plan Mitigation",
4386
- description: "Choose mitigations with owners, reversibility, and verification paths",
4387
- requiredRoles: ["incident-commander", "reviewer"],
4388
- produces: ["mitigation-plan"],
4389
- gateId: "verification-covered"
4390
- }
4391
- ],
4392
- requiredArtifacts: [
4393
- "incident-brief",
4394
- "contradiction-report",
4395
- "mitigation-plan"
4396
- ],
4397
- gateCheckpoints: [
4398
- "memory-grounded",
4399
- "contradictions-surfaced",
4400
- "verification-covered"
4401
- ]
4402
- },
4403
- {
4404
- workflowId: "architecture-decision",
4405
- name: "Architecture Decision",
4406
- description: "Ground architecture choices in cited precedent, explicit alternatives, and follow-up risk",
4407
- steps: [
4408
- {
4409
- stepId: "recall-precedent",
4410
- name: "Recall Precedent",
4411
- description: "Gather analogous decisions, trade-offs, reversals, and evidence already in the graph",
4412
- requiredRoles: ["context-compiler", "architect"],
4413
- produces: ["decision-brief"],
4414
- gateId: "memory-grounded"
4415
- },
4416
- {
4417
- stepId: "compare-options",
4418
- name: "Compare Options",
4419
- description: "Contrast viable paths, show what changes, and surface objections early",
4420
- requiredRoles: ["architect", "critic"],
4421
- produces: ["decision-brief"],
4422
- gateId: "decision-rationale-citable"
4423
- },
4424
- {
4425
- stepId: "record-decision",
4426
- name: "Record Decision",
4427
- description: "Capture the chosen path, cited rationale, and follow-up risks for later recall",
4428
- requiredRoles: ["architect"],
4429
- produces: ["decision-record"]
4430
- }
4431
- ],
4432
- requiredArtifacts: ["decision-brief", "decision-record"],
4433
- gateCheckpoints: ["memory-grounded", "decision-rationale-citable"]
4434
- }
4435
- ],
4436
- gates: [
4437
- {
4438
- gateId: "memory-grounded",
4439
- name: "Memory Grounded",
4440
- description: "The workflow is anchored in prior rationale, analogs, and failure memory before action",
4441
- criteria: [
4442
- {
4443
- criterionId: "precedent-cited",
4444
- description: "At least one prior change, incident, or decision is cited",
4445
- metric: "precedent_citations",
4446
- threshold: 1,
4447
- operator: "gte"
4448
- },
4449
- {
4450
- criterionId: "failure-log-checked",
4451
- description: "Relevant failed attempts or incident history were checked",
4452
- metric: "failure_log_checked",
4453
- threshold: 1,
4454
- operator: "eq"
4455
- }
4456
- ],
4457
- severity: "blocking"
4458
- },
4459
- {
4460
- gateId: "rollback-ready",
4461
- name: "Rollback Ready",
4462
- description: "Risky migrations cannot proceed without explicit rollback and blast-radius coverage",
4463
- criteria: [
4464
- {
4465
- criterionId: "blast-radius-scoped",
4466
- description: "Blast radius is enumerated for the proposed change",
4467
- metric: "blast_radius_scoped",
4468
- threshold: 1,
4469
- operator: "eq"
4470
- },
4471
- {
4472
- criterionId: "rollback-path-defined",
4473
- description: "Rollback path is explicit and reversible",
4474
- metric: "rollback_path_defined",
4475
- threshold: 1,
4476
- operator: "eq"
4477
- }
4478
- ],
4479
- severity: "blocking"
4480
- },
4481
- {
4482
- gateId: "review-risks-surfaced",
4483
- name: "Review Risks Surfaced",
4484
- description: "Review must explain what could regress and why approval is still justified",
4485
- criteria: [
4486
- {
4487
- criterionId: "risk-areas-documented",
4488
- description: "Risk areas and likely regressions are called out explicitly",
4489
- metric: "risk_areas_documented",
4490
- threshold: 1,
4491
- operator: "gte"
4492
- },
4493
- {
4494
- criterionId: "prior-regressions-checked",
4495
- description: "Reviewer checked analogous regressions or incidents",
4496
- metric: "prior_regressions_checked",
4497
- threshold: 1,
4498
- operator: "eq"
4499
- }
4500
- ],
4501
- severity: "blocking"
4502
- },
4503
- {
4504
- gateId: "contradictions-surfaced",
4505
- name: "Contradictions Surfaced",
4506
- description: "Incidents should preserve competing hypotheses long enough to avoid false certainty",
4507
- criteria: [
4508
- {
4509
- criterionId: "multiple-hypotheses",
4510
- description: "At least two plausible hypotheses remain visible",
4511
- metric: "competing_hypotheses_count",
4512
- threshold: 2,
4513
- operator: "gte"
4514
- },
4515
- {
4516
- criterionId: "contradictions-reviewed",
4517
- description: "Relevant contradictions or tensions were reviewed",
4518
- metric: "contradictions_reviewed",
4519
- threshold: 1,
4520
- operator: "gte"
4521
- }
4522
- ],
4523
- severity: "blocking"
4524
- },
4525
- {
4526
- gateId: "decision-rationale-citable",
4527
- name: "Decision Rationale Citable",
4528
- description: "Architecture choices should cite prior rationale and compare viable alternatives",
4529
- criteria: [
4530
- {
4531
- criterionId: "options-compared",
4532
- description: "At least two options are compared before choosing one",
4533
- metric: "options_compared",
4534
- threshold: 2,
4535
- operator: "gte"
4536
- },
4537
- {
4538
- criterionId: "prior-decisions-cited",
4539
- description: "Decision cites prior beliefs, ADRs, or incidents",
4540
- metric: "prior_decisions_cited",
4541
- threshold: 1,
4542
- operator: "gte"
4543
- }
4544
- ],
4545
- severity: "blocking"
4546
- },
4547
- {
4548
- gateId: "verification-covered",
4549
- name: "Verification Covered",
4550
- description: "Approval, rollout, and mitigation all require named verification paths",
4551
- criteria: [
4552
- {
4553
- criterionId: "checks-defined",
4554
- description: "At least one explicit verification path is named",
4555
- metric: "verification_paths_defined",
4556
- threshold: 1,
4557
- operator: "gte"
4558
- },
4559
- {
4560
- criterionId: "owners-named",
4561
- description: "Owners or on-call responsibility are explicit",
4562
- metric: "owner_count",
4563
- threshold: 1,
4564
- operator: "gte"
4565
- }
4566
- ],
4567
- severity: "blocking"
4568
- }
4569
- ],
4570
- artifacts: [
4571
- {
4572
- artifactId: "memory-brief",
4573
- name: "Memory Brief",
4574
- description: "A reusable brief of analogous changes, prior rationale, failed attempts, and contradictions",
4575
- stage: "recall-history",
4576
- contentSchema: {
4577
- type: "object",
4578
- properties: {
4579
- analogousChanges: { type: "array", items: { type: "string" } },
4580
- priorDecisions: { type: "array", items: { type: "string" } },
4581
- failedAttempts: { type: "array", items: { type: "string" } },
4582
- contradictions: { type: "array", items: { type: "string" } }
4583
- },
4584
- required: ["analogousChanges", "priorDecisions"]
4585
- },
4586
- requiredFields: ["analogousChanges", "priorDecisions"]
4587
- },
4588
- {
4589
- artifactId: "migration-plan",
4590
- name: "Migration Plan",
4591
- description: "Blast radius, rollback path, rollout checkpoints, and verification plan",
4592
- stage: "plan-rollout",
4593
- contentSchema: {
4594
- type: "object",
4595
- properties: {
4596
- blastRadius: { type: "array", items: { type: "string" } },
4597
- rollbackPlan: { type: "string" },
4598
- verificationPath: { type: "array", items: { type: "string" } },
4599
- canarySteps: { type: "array", items: { type: "string" } }
4600
- },
4601
- required: ["blastRadius", "rollbackPlan", "verificationPath"]
4602
- },
4603
- requiredFields: ["blastRadius", "rollbackPlan", "verificationPath"]
4604
- },
4605
- {
4606
- artifactId: "verification-checklist",
4607
- name: "Verification Checklist",
4608
- description: "Named checks, owners, and pass/fail criteria for rollout or approval",
4609
- stage: "verify-rollout",
4610
- contentSchema: {
4611
- type: "object",
4612
- properties: {
4613
- checks: { type: "array", items: { type: "string" } },
4614
- owners: { type: "array", items: { type: "string" } },
4615
- passCriteria: { type: "array", items: { type: "string" } }
4616
- },
4617
- required: ["checks", "owners"]
4618
- },
4619
- requiredFields: ["checks", "owners"]
4620
- },
4621
- {
4622
- artifactId: "review-context",
4623
- name: "Review Context",
4624
- description: "Prior rationale, related diffs, incidents, and failure history relevant to a review",
4625
- stage: "recall-review-context",
4626
- contentSchema: {
4627
- type: "object",
4628
- properties: {
4629
- rationaleLinks: { type: "array", items: { type: "string" } },
4630
- analogousDiffs: { type: "array", items: { type: "string" } },
4631
- relatedIncidents: { type: "array", items: { type: "string" } }
4632
- },
4633
- required: ["rationaleLinks"]
4634
- },
4635
- requiredFields: ["rationaleLinks"]
4636
- },
4637
- {
4638
- artifactId: "review-findings",
4639
- name: "Review Findings",
4640
- description: "What could regress, what evidence was checked, and whether the change should be blocked",
4641
- stage: "inspect-diff",
4642
- contentSchema: {
4643
- type: "object",
4644
- properties: {
4645
- findings: { type: "array", items: { type: "string" } },
4646
- regressionsChecked: { type: "array", items: { type: "string" } },
4647
- blockReason: { type: "string" }
4648
- },
4649
- required: ["findings", "regressionsChecked"]
4650
- },
4651
- requiredFields: ["findings", "regressionsChecked"]
4652
- },
4653
- {
4654
- artifactId: "incident-brief",
4655
- name: "Incident Brief",
4656
- description: "Signals, recent changes, competing hypotheses, and precedent incidents",
4657
- stage: "collect-signal",
4658
- contentSchema: {
4659
- type: "object",
4660
- properties: {
4661
- symptoms: { type: "array", items: { type: "string" } },
4662
- recentChanges: { type: "array", items: { type: "string" } },
4663
- competingHypotheses: { type: "array", items: { type: "string" } },
4664
- precedentIncidents: { type: "array", items: { type: "string" } }
4665
- },
4666
- required: ["symptoms", "competingHypotheses"]
4667
- },
4668
- requiredFields: ["symptoms", "competingHypotheses"]
4669
- },
4670
- {
4671
- artifactId: "contradiction-report",
4672
- name: "Contradiction Report",
4673
- description: "Active contradictions, why they matter, and what evidence could collapse them",
4674
- stage: "surface-contradictions",
4675
- contentSchema: {
4676
- type: "object",
4677
- properties: {
4678
- contradictions: { type: "array", items: { type: "string" } },
4679
- likelyRootCauses: { type: "array", items: { type: "string" } },
4680
- missingEvidence: { type: "array", items: { type: "string" } }
4681
- },
4682
- required: ["contradictions", "likelyRootCauses"]
4683
- },
4684
- requiredFields: ["contradictions", "likelyRootCauses"]
4685
- },
4686
- {
4687
- artifactId: "mitigation-plan",
4688
- name: "Mitigation Plan",
4689
- description: "Chosen mitigation, rollback path, and verification ownership for an incident",
4690
- stage: "plan-mitigation",
4691
- contentSchema: {
4692
- type: "object",
4693
- properties: {
4694
- mitigationSteps: { type: "array", items: { type: "string" } },
4695
- rollbackPlan: { type: "string" },
4696
- owners: { type: "array", items: { type: "string" } }
4697
- },
4698
- required: ["mitigationSteps", "owners"]
4699
- },
4700
- requiredFields: ["mitigationSteps", "owners"]
4701
- },
4702
- {
4703
- artifactId: "decision-brief",
4704
- name: "Decision Brief",
4705
- description: "Options, cited precedent, trade-offs, and objections for an architecture decision",
4706
- stage: "compare-options",
4707
- contentSchema: {
4708
- type: "object",
4709
- properties: {
4710
- options: { type: "array", items: { type: "string" } },
4711
- citedPrecedent: { type: "array", items: { type: "string" } },
4712
- objections: { type: "array", items: { type: "string" } }
4713
- },
4714
- required: ["options", "citedPrecedent"]
4715
- },
4716
- requiredFields: ["options", "citedPrecedent"]
4717
- },
4718
- {
4719
- artifactId: "decision-record",
4720
- name: "Decision Record",
4721
- description: "Chosen path, why it won, what it supersedes, and what follow-up remains open",
4722
- stage: "record-decision",
4723
- contentSchema: {
4724
- type: "object",
4725
- properties: {
4726
- decision: { type: "string" },
4727
- rationale: { type: "array", items: { type: "string" } },
4728
- supersedes: { type: "array", items: { type: "string" } },
4729
- followUps: { type: "array", items: { type: "string" } }
4730
- },
4731
- required: ["decision", "rationale"]
4732
- },
4733
- requiredFields: ["decision", "rationale"]
4734
- }
4735
- ],
4736
- roles: [
4737
- {
4738
- roleId: "context-compiler",
4739
- name: "Context Compiler",
4740
- description: "Compiles prior rationale, analogs, and failure memory into reusable first-hour context",
4741
- perspective: "History-first, evidence-weighted context assembly",
4742
- optimizesFor: "recall quality and anti-repetition coverage",
4743
- mayBlock: false
4744
- },
4745
- {
4746
- roleId: "migration-owner",
4747
- name: "Migration Owner",
4748
- description: "Scopes rollout blast radius, rollback, sequencing, and compatibility risk",
4749
- perspective: "Operational caution with explicit rollback discipline",
4750
- optimizesFor: "safe rollout planning",
4751
- mayBlock: false
4752
- },
4753
- {
4754
- roleId: "reviewer",
4755
- name: "Reviewer",
4756
- description: "Evaluates risky changes against prior regressions, evidence, and missing checks",
4757
- perspective: "Evidence-backed change approval with regression awareness",
4758
- optimizesFor: "defect prevention and clear approval rationale",
4759
- mayBlock: true
4760
- },
4761
- {
4762
- roleId: "incident-commander",
4763
- name: "Incident Commander",
4764
- description: "Maintains multiple plausible explanations while driving mitigation decisions",
4765
- perspective: "Fast, reversible action without collapsing uncertainty too early",
4766
- optimizesFor: "time-to-mitigation with preserved reasoning integrity",
4767
- mayBlock: false
4768
- },
4769
- {
4770
- roleId: "architect",
4771
- name: "Architect",
4772
- description: "Turns competing options into explicit decisions with cited precedent and follow-up risk",
4773
- perspective: "Trade-off clarity and long-term maintainability",
4774
- optimizesFor: "decision quality and rationale reuse",
4775
- mayBlock: false
4776
- },
4777
- {
4778
- roleId: "critic",
4779
- name: "Critic",
4780
- description: "Finds weak assumptions, missing rollback paths, and untested contradictions",
4781
- perspective: "Skeptical, adversarial, and detail-oriented",
4782
- optimizesFor: "early detection of brittle plans",
4783
- mayBlock: true
4784
- }
4785
- ],
4391
+ // src/domain-pack/packs/engineering-accelerator-tail.ts
4392
+ var ENGINEERING_ACCELERATOR_TAIL = {
4786
4393
  inquiryShaping: {
4787
4394
  questionTemplates: [
4788
4395
  {
@@ -5269,229 +4876,804 @@ var ENGINEERING_ACCELERATOR_PACK = defineDomainPack({
5269
4876
  parentSlug: "migrations",
5270
4877
  ontologyId: "software-entities"
5271
4878
  },
5272
- {
5273
- slug: "review-briefs",
5274
- name: "Review Briefs",
5275
- description: "Diff-scoped risk briefs grounded in prior regressions and rationale",
5276
- parentSlug: "reviews",
5277
- ontologyId: "software-entities"
4879
+ {
4880
+ slug: "review-briefs",
4881
+ name: "Review Briefs",
4882
+ description: "Diff-scoped risk briefs grounded in prior regressions and rationale",
4883
+ parentSlug: "reviews",
4884
+ ontologyId: "software-entities"
4885
+ },
4886
+ {
4887
+ slug: "regression-history",
4888
+ name: "Regression History",
4889
+ description: "Past regressions and approval misses that should influence current reviews",
4890
+ parentSlug: "reviews",
4891
+ ontologyId: "software-entities"
4892
+ },
4893
+ {
4894
+ slug: "active-incidents",
4895
+ name: "Active Incidents",
4896
+ description: "Current incidents with competing hypotheses, mitigations, and contradictions",
4897
+ parentSlug: "incidents",
4898
+ ontologyId: "software-entities"
4899
+ },
4900
+ {
4901
+ slug: "incident-postmortems",
4902
+ name: "Incident Postmortems",
4903
+ description: "Resolved incidents with preserved rationale and follow-up learnings",
4904
+ parentSlug: "incidents",
4905
+ ontologyId: "software-entities"
4906
+ },
4907
+ {
4908
+ slug: "adrs",
4909
+ name: "Architecture Decision Records",
4910
+ description: "Citable architecture records with precedent, objections, and supersessions",
4911
+ parentSlug: "architecture",
4912
+ ontologyId: "software-entities"
4913
+ },
4914
+ {
4915
+ slug: "interface-contracts",
4916
+ name: "Interface Contracts",
4917
+ description: "APIs, boundaries, and contract deltas that architecture work depends on",
4918
+ parentSlug: "architecture",
4919
+ ontologyId: "software-entities"
4920
+ },
4921
+ {
4922
+ slug: "failed-attempts",
4923
+ name: "Failed Attempts",
4924
+ description: "Anti-repetition log for engineering decisions and implementation dead ends",
4925
+ parentSlug: "decision-memory",
4926
+ ontologyId: "software-entities"
4927
+ },
4928
+ {
4929
+ slug: "rationale-recall",
4930
+ name: "Rationale Recall",
4931
+ description: "Recalled rationale snippets and analogs worth citing before new work",
4932
+ parentSlug: "decision-memory",
4933
+ ontologyId: "software-entities"
4934
+ }
4935
+ ],
4936
+ installProfiles: [
4937
+ {
4938
+ profileId: "claude-code",
4939
+ name: "Claude Code Engineering Kit",
4940
+ description: "Installs Claude-native hooks, commands, agent catalog, and first-hour engineering prompts on top of Lucern.",
4941
+ runtimeTarget: "claude-code",
4942
+ promptIds: [
4943
+ "claude-quick-reference",
4944
+ "build-command",
4945
+ "architect-command",
4946
+ "pipeline-command",
4947
+ "pr-command",
4948
+ "lucern-generate-questions",
4949
+ "lucern-contradiction-analysis"
4950
+ ],
4951
+ toolIds: [
4952
+ "start-investigation",
4953
+ "record-scope-learning",
4954
+ "record-attempt",
4955
+ "pipeline-snapshot",
4956
+ "session-init",
4957
+ "tool-log",
4958
+ "build-bash-gate",
4959
+ "lucern-cli-init",
4960
+ "kit-install"
4961
+ ],
4962
+ assetIds: [
4963
+ "claude-instructions",
4964
+ "mcp-config",
4965
+ "kit-manifest",
4966
+ "lucern-launcher",
4967
+ "lucern-shell-wrapper",
4968
+ "lucern-cli-script",
4969
+ "claude-settings",
4970
+ "permission-gate-hook",
4971
+ "inbox-check-hook",
4972
+ "prompt-router-hook",
4973
+ "writeback-gate-hook",
4974
+ "build-command-doc",
4975
+ "architect-command-doc",
4976
+ "pipeline-command-doc",
4977
+ "pr-command-doc",
4978
+ "claude-agent-catalog",
4979
+ "claude-skill-catalog",
4980
+ "hooks-doc",
4981
+ "setup-ui"
4982
+ ],
4983
+ defaultTopicSlugs: [
4984
+ "migrations",
4985
+ "reviews",
4986
+ "incidents",
4987
+ "architecture",
4988
+ "decision-memory"
4989
+ ]
4990
+ },
4991
+ {
4992
+ profileId: "codex",
4993
+ name: "Codex Engineering Kit",
4994
+ description: "Installs the Codex bridge, Lucern MCP wiring, and the same pack-level workflows without Claude-specific hooks.",
4995
+ runtimeTarget: "codex",
4996
+ promptIds: [
4997
+ "build-command",
4998
+ "architect-command",
4999
+ "pipeline-command",
5000
+ "pr-command",
5001
+ "lucern-generate-questions",
5002
+ "lucern-contradiction-analysis"
5003
+ ],
5004
+ toolIds: [
5005
+ "start-investigation",
5006
+ "record-scope-learning",
5007
+ "record-attempt",
5008
+ "pipeline-snapshot",
5009
+ "lucern-cli-init",
5010
+ "kit-install"
5011
+ ],
5012
+ assetIds: [
5013
+ "codex-bridge",
5014
+ "mcp-config",
5015
+ "kit-manifest",
5016
+ "lucern-launcher",
5017
+ "lucern-shell-wrapper",
5018
+ "lucern-cli-script",
5019
+ "build-command-doc",
5020
+ "architect-command-doc",
5021
+ "pipeline-command-doc",
5022
+ "pr-command-doc",
5023
+ "claude-skill-catalog",
5024
+ "skills-sync-script",
5025
+ "hooks-doc",
5026
+ "setup-ui"
5027
+ ],
5028
+ defaultTopicSlugs: [
5029
+ "migrations",
5030
+ "reviews",
5031
+ "incidents",
5032
+ "architecture",
5033
+ "decision-memory"
5034
+ ]
5035
+ },
5036
+ {
5037
+ profileId: "hybrid",
5038
+ name: "Hybrid Engineering Kit",
5039
+ description: "Installs both Claude and Codex entry surfaces against one Lucern-native engineering operating system.",
5040
+ runtimeTarget: "hybrid",
5041
+ promptIds: [
5042
+ "claude-quick-reference",
5043
+ "build-command",
5044
+ "architect-command",
5045
+ "pipeline-command",
5046
+ "pr-command",
5047
+ "lucern-generate-questions",
5048
+ "lucern-contradiction-analysis"
5049
+ ],
5050
+ toolIds: [
5051
+ "start-investigation",
5052
+ "record-scope-learning",
5053
+ "record-attempt",
5054
+ "pipeline-snapshot",
5055
+ "session-init",
5056
+ "tool-log",
5057
+ "build-bash-gate",
5058
+ "lucern-cli-init",
5059
+ "kit-install"
5060
+ ],
5061
+ assetIds: [
5062
+ "claude-instructions",
5063
+ "codex-bridge",
5064
+ "mcp-config",
5065
+ "kit-manifest",
5066
+ "lucern-launcher",
5067
+ "lucern-shell-wrapper",
5068
+ "lucern-cli-script",
5069
+ "claude-settings",
5070
+ "permission-gate-hook",
5071
+ "inbox-check-hook",
5072
+ "prompt-router-hook",
5073
+ "writeback-gate-hook",
5074
+ "build-command-doc",
5075
+ "architect-command-doc",
5076
+ "pipeline-command-doc",
5077
+ "pr-command-doc",
5078
+ "claude-agent-catalog",
5079
+ "claude-skill-catalog",
5080
+ "skills-sync-script",
5081
+ "hooks-doc",
5082
+ "setup-ui"
5083
+ ],
5084
+ defaultTopicSlugs: [
5085
+ "migrations",
5086
+ "reviews",
5087
+ "incidents",
5088
+ "architecture",
5089
+ "decision-memory"
5090
+ ]
5091
+ }
5092
+ ]
5093
+ },
5094
+ appPackKeys: [
5095
+ "chat-v1",
5096
+ "documents-v1",
5097
+ "epistemic-algorithms-v1",
5098
+ "graph-visualization-v1",
5099
+ "task-management-v1"
5100
+ ],
5101
+ methodologyPackId: "developer"
5102
+ };
5103
+
5104
+ // src/domain-pack/packs/engineering-accelerator.ts
5105
+ var ENGINEERING_ACCELERATOR_PACK = defineDomainPack({
5106
+ packId: "engineering-accelerator",
5107
+ name: "Engineering Accelerator",
5108
+ version: "1.0.0",
5109
+ ontologyBindings: [
5110
+ {
5111
+ ontologyId: "software-entities",
5112
+ versionConstraint: "^1.0.0",
5113
+ required: true,
5114
+ provisionMode: "seed",
5115
+ seedRef: "packages/pack-host/src/domain-pack/ontology/software-entities-v1.ts",
5116
+ requiredEntityTypes: [
5117
+ "repository",
5118
+ "service",
5119
+ "module",
5120
+ "workflow",
5121
+ "incident",
5122
+ "migration",
5123
+ "decision_record",
5124
+ "agent"
5125
+ ],
5126
+ requiredEdgeTypes: [
5127
+ "depends_on",
5128
+ "owns",
5129
+ "calls",
5130
+ "blocks",
5131
+ "reviews",
5132
+ "mitigates",
5133
+ "supersedes"
5134
+ ]
5135
+ }
5136
+ ],
5137
+ topicRoots: [
5138
+ {
5139
+ slug: "migrations",
5140
+ name: "Migrations",
5141
+ description: "Schema, API, and runtime migrations with blast-radius, rollback, and parity memory",
5142
+ ontologyId: "software-entities"
5143
+ },
5144
+ {
5145
+ slug: "reviews",
5146
+ name: "Reviews",
5147
+ description: "Pull-request and change-review workflows grounded in prior rationale and regressions",
5148
+ ontologyId: "software-entities"
5149
+ },
5150
+ {
5151
+ slug: "incidents",
5152
+ name: "Incidents",
5153
+ description: "Incident response driven by competing hypotheses, contradictions, and mitigations",
5154
+ ontologyId: "software-entities"
5155
+ },
5156
+ {
5157
+ slug: "architecture",
5158
+ name: "Architecture",
5159
+ description: "Architecture decisions, interface trade-offs, and precedent-aware rationale recall",
5160
+ ontologyId: "software-entities"
5161
+ },
5162
+ {
5163
+ slug: "decision-memory",
5164
+ name: "Decision Memory",
5165
+ description: "Cross-cutting rationale recall, failed attempts, and analog reuse across engineering work",
5166
+ ontologyId: "software-entities"
5167
+ }
5168
+ ],
5169
+ workflows: [
5170
+ {
5171
+ workflowId: "migration-readiness",
5172
+ name: "Migration Readiness",
5173
+ description: "Recall similar migrations, map blast radius, and define rollback before rollout",
5174
+ steps: [
5175
+ {
5176
+ stepId: "recall-history",
5177
+ name: "Recall History",
5178
+ description: "Compile analogous migrations, prior rationale, failed attempts, and compatibility constraints",
5179
+ requiredRoles: ["context-compiler", "migration-owner"],
5180
+ produces: ["memory-brief"],
5181
+ gateId: "memory-grounded"
5182
+ },
5183
+ {
5184
+ stepId: "plan-rollout",
5185
+ name: "Plan Rollout",
5186
+ description: "Define blast radius, sequencing, rollback, and verification checkpoints",
5187
+ requiredRoles: ["migration-owner", "critic"],
5188
+ produces: ["migration-plan"],
5189
+ gateId: "rollback-ready"
5190
+ },
5191
+ {
5192
+ stepId: "verify-rollout",
5193
+ name: "Verify Rollout",
5194
+ description: "Confirm canary, rollback, and parity checks are explicit before execution",
5195
+ requiredRoles: ["reviewer"],
5196
+ produces: ["verification-checklist"],
5197
+ gateId: "verification-covered"
5198
+ }
5199
+ ],
5200
+ requiredArtifacts: [
5201
+ "memory-brief",
5202
+ "migration-plan",
5203
+ "verification-checklist"
5204
+ ],
5205
+ gateCheckpoints: [
5206
+ "memory-grounded",
5207
+ "rollback-ready",
5208
+ "verification-covered"
5209
+ ]
5210
+ },
5211
+ {
5212
+ workflowId: "pull-request-review",
5213
+ name: "Pull Request Review",
5214
+ description: "Use prior rationale, regressions, and verification history to review risky changes faster",
5215
+ steps: [
5216
+ {
5217
+ stepId: "recall-review-context",
5218
+ name: "Recall Review Context",
5219
+ description: "Load earlier decisions, similar diffs, failed attempts, and relevant incidents",
5220
+ requiredRoles: ["context-compiler", "reviewer"],
5221
+ produces: ["review-context"],
5222
+ gateId: "memory-grounded"
5223
+ },
5224
+ {
5225
+ stepId: "inspect-diff",
5226
+ name: "Inspect Diff",
5227
+ description: "Surface risk areas, stale assumptions, and regressions that should block approval",
5228
+ requiredRoles: ["reviewer", "critic"],
5229
+ produces: ["review-findings"],
5230
+ gateId: "review-risks-surfaced"
5231
+ },
5232
+ {
5233
+ stepId: "verify-changes",
5234
+ name: "Verify Changes",
5235
+ description: "Tie approval to explicit typecheck, test, and integration evidence",
5236
+ requiredRoles: ["reviewer"],
5237
+ produces: ["verification-checklist"],
5238
+ gateId: "verification-covered"
5239
+ }
5240
+ ],
5241
+ requiredArtifacts: [
5242
+ "review-context",
5243
+ "review-findings",
5244
+ "verification-checklist"
5245
+ ],
5246
+ gateCheckpoints: [
5247
+ "memory-grounded",
5248
+ "review-risks-surfaced",
5249
+ "verification-covered"
5250
+ ]
5251
+ },
5252
+ {
5253
+ workflowId: "incident-response",
5254
+ name: "Incident Response",
5255
+ description: "Treat incidents as contradiction-heavy reasoning tasks before committing to a root cause",
5256
+ steps: [
5257
+ {
5258
+ stepId: "collect-signal",
5259
+ name: "Collect Signal",
5260
+ description: "Assemble symptoms, recent changes, precedent incidents, and active hypotheses",
5261
+ requiredRoles: ["context-compiler", "incident-commander"],
5262
+ produces: ["incident-brief"],
5263
+ gateId: "memory-grounded"
5264
+ },
5265
+ {
5266
+ stepId: "surface-contradictions",
5267
+ name: "Surface Contradictions",
5268
+ description: "Make competing explanations explicit before mitigation narrows the search space",
5269
+ requiredRoles: ["incident-commander", "critic"],
5270
+ produces: ["contradiction-report"],
5271
+ gateId: "contradictions-surfaced"
5272
+ },
5273
+ {
5274
+ stepId: "plan-mitigation",
5275
+ name: "Plan Mitigation",
5276
+ description: "Choose mitigations with owners, reversibility, and verification paths",
5277
+ requiredRoles: ["incident-commander", "reviewer"],
5278
+ produces: ["mitigation-plan"],
5279
+ gateId: "verification-covered"
5280
+ }
5281
+ ],
5282
+ requiredArtifacts: [
5283
+ "incident-brief",
5284
+ "contradiction-report",
5285
+ "mitigation-plan"
5286
+ ],
5287
+ gateCheckpoints: [
5288
+ "memory-grounded",
5289
+ "contradictions-surfaced",
5290
+ "verification-covered"
5291
+ ]
5292
+ },
5293
+ {
5294
+ workflowId: "architecture-decision",
5295
+ name: "Architecture Decision",
5296
+ description: "Ground architecture choices in cited precedent, explicit alternatives, and follow-up risk",
5297
+ steps: [
5298
+ {
5299
+ stepId: "recall-precedent",
5300
+ name: "Recall Precedent",
5301
+ description: "Gather analogous decisions, trade-offs, reversals, and evidence already in the graph",
5302
+ requiredRoles: ["context-compiler", "architect"],
5303
+ produces: ["decision-brief"],
5304
+ gateId: "memory-grounded"
5305
+ },
5306
+ {
5307
+ stepId: "compare-options",
5308
+ name: "Compare Options",
5309
+ description: "Contrast viable paths, show what changes, and surface objections early",
5310
+ requiredRoles: ["architect", "critic"],
5311
+ produces: ["decision-brief"],
5312
+ gateId: "decision-rationale-citable"
5313
+ },
5314
+ {
5315
+ stepId: "record-decision",
5316
+ name: "Record Decision",
5317
+ description: "Capture the chosen path, cited rationale, and follow-up risks for later recall",
5318
+ requiredRoles: ["architect"],
5319
+ produces: ["decision-record"]
5320
+ }
5321
+ ],
5322
+ requiredArtifacts: ["decision-brief", "decision-record"],
5323
+ gateCheckpoints: ["memory-grounded", "decision-rationale-citable"]
5324
+ }
5325
+ ],
5326
+ gates: [
5327
+ {
5328
+ gateId: "memory-grounded",
5329
+ name: "Memory Grounded",
5330
+ description: "The workflow is anchored in prior rationale, analogs, and failure memory before action",
5331
+ criteria: [
5332
+ {
5333
+ criterionId: "precedent-cited",
5334
+ description: "At least one prior change, incident, or decision is cited",
5335
+ metric: "precedent_citations",
5336
+ threshold: 1,
5337
+ operator: "gte"
5338
+ },
5339
+ {
5340
+ criterionId: "failure-log-checked",
5341
+ description: "Relevant failed attempts or incident history were checked",
5342
+ metric: "failure_log_checked",
5343
+ threshold: 1,
5344
+ operator: "eq"
5345
+ }
5346
+ ],
5347
+ severity: "blocking"
5348
+ },
5349
+ {
5350
+ gateId: "rollback-ready",
5351
+ name: "Rollback Ready",
5352
+ description: "Risky migrations cannot proceed without explicit rollback and blast-radius coverage",
5353
+ criteria: [
5354
+ {
5355
+ criterionId: "blast-radius-scoped",
5356
+ description: "Blast radius is enumerated for the proposed change",
5357
+ metric: "blast_radius_scoped",
5358
+ threshold: 1,
5359
+ operator: "eq"
5360
+ },
5361
+ {
5362
+ criterionId: "rollback-path-defined",
5363
+ description: "Rollback path is explicit and reversible",
5364
+ metric: "rollback_path_defined",
5365
+ threshold: 1,
5366
+ operator: "eq"
5367
+ }
5368
+ ],
5369
+ severity: "blocking"
5370
+ },
5371
+ {
5372
+ gateId: "review-risks-surfaced",
5373
+ name: "Review Risks Surfaced",
5374
+ description: "Review must explain what could regress and why approval is still justified",
5375
+ criteria: [
5376
+ {
5377
+ criterionId: "risk-areas-documented",
5378
+ description: "Risk areas and likely regressions are called out explicitly",
5379
+ metric: "risk_areas_documented",
5380
+ threshold: 1,
5381
+ operator: "gte"
5382
+ },
5383
+ {
5384
+ criterionId: "prior-regressions-checked",
5385
+ description: "Reviewer checked analogous regressions or incidents",
5386
+ metric: "prior_regressions_checked",
5387
+ threshold: 1,
5388
+ operator: "eq"
5389
+ }
5390
+ ],
5391
+ severity: "blocking"
5392
+ },
5393
+ {
5394
+ gateId: "contradictions-surfaced",
5395
+ name: "Contradictions Surfaced",
5396
+ description: "Incidents should preserve competing hypotheses long enough to avoid false certainty",
5397
+ criteria: [
5398
+ {
5399
+ criterionId: "multiple-hypotheses",
5400
+ description: "At least two plausible hypotheses remain visible",
5401
+ metric: "competing_hypotheses_count",
5402
+ threshold: 2,
5403
+ operator: "gte"
5404
+ },
5405
+ {
5406
+ criterionId: "contradictions-reviewed",
5407
+ description: "Relevant contradictions or tensions were reviewed",
5408
+ metric: "contradictions_reviewed",
5409
+ threshold: 1,
5410
+ operator: "gte"
5411
+ }
5412
+ ],
5413
+ severity: "blocking"
5414
+ },
5415
+ {
5416
+ gateId: "decision-rationale-citable",
5417
+ name: "Decision Rationale Citable",
5418
+ description: "Architecture choices should cite prior rationale and compare viable alternatives",
5419
+ criteria: [
5420
+ {
5421
+ criterionId: "options-compared",
5422
+ description: "At least two options are compared before choosing one",
5423
+ metric: "options_compared",
5424
+ threshold: 2,
5425
+ operator: "gte"
5426
+ },
5427
+ {
5428
+ criterionId: "prior-decisions-cited",
5429
+ description: "Decision cites prior beliefs, ADRs, or incidents",
5430
+ metric: "prior_decisions_cited",
5431
+ threshold: 1,
5432
+ operator: "gte"
5433
+ }
5434
+ ],
5435
+ severity: "blocking"
5436
+ },
5437
+ {
5438
+ gateId: "verification-covered",
5439
+ name: "Verification Covered",
5440
+ description: "Approval, rollout, and mitigation all require named verification paths",
5441
+ criteria: [
5442
+ {
5443
+ criterionId: "checks-defined",
5444
+ description: "At least one explicit verification path is named",
5445
+ metric: "verification_paths_defined",
5446
+ threshold: 1,
5447
+ operator: "gte"
5448
+ },
5449
+ {
5450
+ criterionId: "owners-named",
5451
+ description: "Owners or on-call responsibility are explicit",
5452
+ metric: "owner_count",
5453
+ threshold: 1,
5454
+ operator: "gte"
5455
+ }
5456
+ ],
5457
+ severity: "blocking"
5458
+ }
5459
+ ],
5460
+ artifacts: [
5461
+ {
5462
+ artifactId: "memory-brief",
5463
+ name: "Memory Brief",
5464
+ description: "A reusable brief of analogous changes, prior rationale, failed attempts, and contradictions",
5465
+ stage: "recall-history",
5466
+ contentSchema: {
5467
+ type: "object",
5468
+ properties: {
5469
+ analogousChanges: { type: "array", items: { type: "string" } },
5470
+ priorDecisions: { type: "array", items: { type: "string" } },
5471
+ failedAttempts: { type: "array", items: { type: "string" } },
5472
+ contradictions: { type: "array", items: { type: "string" } }
5473
+ },
5474
+ required: ["analogousChanges", "priorDecisions"]
5475
+ },
5476
+ requiredFields: ["analogousChanges", "priorDecisions"]
5477
+ },
5478
+ {
5479
+ artifactId: "migration-plan",
5480
+ name: "Migration Plan",
5481
+ description: "Blast radius, rollback path, rollout checkpoints, and verification plan",
5482
+ stage: "plan-rollout",
5483
+ contentSchema: {
5484
+ type: "object",
5485
+ properties: {
5486
+ blastRadius: { type: "array", items: { type: "string" } },
5487
+ rollbackPlan: { type: "string" },
5488
+ verificationPath: { type: "array", items: { type: "string" } },
5489
+ canarySteps: { type: "array", items: { type: "string" } }
5490
+ },
5491
+ required: ["blastRadius", "rollbackPlan", "verificationPath"]
5278
5492
  },
5279
- {
5280
- slug: "regression-history",
5281
- name: "Regression History",
5282
- description: "Past regressions and approval misses that should influence current reviews",
5283
- parentSlug: "reviews",
5284
- ontologyId: "software-entities"
5493
+ requiredFields: ["blastRadius", "rollbackPlan", "verificationPath"]
5494
+ },
5495
+ {
5496
+ artifactId: "verification-checklist",
5497
+ name: "Verification Checklist",
5498
+ description: "Named checks, owners, and pass/fail criteria for rollout or approval",
5499
+ stage: "verify-rollout",
5500
+ contentSchema: {
5501
+ type: "object",
5502
+ properties: {
5503
+ checks: { type: "array", items: { type: "string" } },
5504
+ owners: { type: "array", items: { type: "string" } },
5505
+ passCriteria: { type: "array", items: { type: "string" } }
5506
+ },
5507
+ required: ["checks", "owners"]
5285
5508
  },
5286
- {
5287
- slug: "active-incidents",
5288
- name: "Active Incidents",
5289
- description: "Current incidents with competing hypotheses, mitigations, and contradictions",
5290
- parentSlug: "incidents",
5291
- ontologyId: "software-entities"
5509
+ requiredFields: ["checks", "owners"]
5510
+ },
5511
+ {
5512
+ artifactId: "review-context",
5513
+ name: "Review Context",
5514
+ description: "Prior rationale, related diffs, incidents, and failure history relevant to a review",
5515
+ stage: "recall-review-context",
5516
+ contentSchema: {
5517
+ type: "object",
5518
+ properties: {
5519
+ rationaleLinks: { type: "array", items: { type: "string" } },
5520
+ analogousDiffs: { type: "array", items: { type: "string" } },
5521
+ relatedIncidents: { type: "array", items: { type: "string" } }
5522
+ },
5523
+ required: ["rationaleLinks"]
5292
5524
  },
5293
- {
5294
- slug: "incident-postmortems",
5295
- name: "Incident Postmortems",
5296
- description: "Resolved incidents with preserved rationale and follow-up learnings",
5297
- parentSlug: "incidents",
5298
- ontologyId: "software-entities"
5525
+ requiredFields: ["rationaleLinks"]
5526
+ },
5527
+ {
5528
+ artifactId: "review-findings",
5529
+ name: "Review Findings",
5530
+ description: "What could regress, what evidence was checked, and whether the change should be blocked",
5531
+ stage: "inspect-diff",
5532
+ contentSchema: {
5533
+ type: "object",
5534
+ properties: {
5535
+ findings: { type: "array", items: { type: "string" } },
5536
+ regressionsChecked: { type: "array", items: { type: "string" } },
5537
+ blockReason: { type: "string" }
5538
+ },
5539
+ required: ["findings", "regressionsChecked"]
5299
5540
  },
5300
- {
5301
- slug: "adrs",
5302
- name: "Architecture Decision Records",
5303
- description: "Citable architecture records with precedent, objections, and supersessions",
5304
- parentSlug: "architecture",
5305
- ontologyId: "software-entities"
5541
+ requiredFields: ["findings", "regressionsChecked"]
5542
+ },
5543
+ {
5544
+ artifactId: "incident-brief",
5545
+ name: "Incident Brief",
5546
+ description: "Signals, recent changes, competing hypotheses, and precedent incidents",
5547
+ stage: "collect-signal",
5548
+ contentSchema: {
5549
+ type: "object",
5550
+ properties: {
5551
+ symptoms: { type: "array", items: { type: "string" } },
5552
+ recentChanges: { type: "array", items: { type: "string" } },
5553
+ competingHypotheses: { type: "array", items: { type: "string" } },
5554
+ precedentIncidents: { type: "array", items: { type: "string" } }
5555
+ },
5556
+ required: ["symptoms", "competingHypotheses"]
5306
5557
  },
5307
- {
5308
- slug: "interface-contracts",
5309
- name: "Interface Contracts",
5310
- description: "APIs, boundaries, and contract deltas that architecture work depends on",
5311
- parentSlug: "architecture",
5312
- ontologyId: "software-entities"
5558
+ requiredFields: ["symptoms", "competingHypotheses"]
5559
+ },
5560
+ {
5561
+ artifactId: "contradiction-report",
5562
+ name: "Contradiction Report",
5563
+ description: "Active contradictions, why they matter, and what evidence could collapse them",
5564
+ stage: "surface-contradictions",
5565
+ contentSchema: {
5566
+ type: "object",
5567
+ properties: {
5568
+ contradictions: { type: "array", items: { type: "string" } },
5569
+ likelyRootCauses: { type: "array", items: { type: "string" } },
5570
+ missingEvidence: { type: "array", items: { type: "string" } }
5571
+ },
5572
+ required: ["contradictions", "likelyRootCauses"]
5313
5573
  },
5314
- {
5315
- slug: "failed-attempts",
5316
- name: "Failed Attempts",
5317
- description: "Anti-repetition log for engineering decisions and implementation dead ends",
5318
- parentSlug: "decision-memory",
5319
- ontologyId: "software-entities"
5574
+ requiredFields: ["contradictions", "likelyRootCauses"]
5575
+ },
5576
+ {
5577
+ artifactId: "mitigation-plan",
5578
+ name: "Mitigation Plan",
5579
+ description: "Chosen mitigation, rollback path, and verification ownership for an incident",
5580
+ stage: "plan-mitigation",
5581
+ contentSchema: {
5582
+ type: "object",
5583
+ properties: {
5584
+ mitigationSteps: { type: "array", items: { type: "string" } },
5585
+ rollbackPlan: { type: "string" },
5586
+ owners: { type: "array", items: { type: "string" } }
5587
+ },
5588
+ required: ["mitigationSteps", "owners"]
5320
5589
  },
5321
- {
5322
- slug: "rationale-recall",
5323
- name: "Rationale Recall",
5324
- description: "Recalled rationale snippets and analogs worth citing before new work",
5325
- parentSlug: "decision-memory",
5326
- ontologyId: "software-entities"
5327
- }
5328
- ],
5329
- installProfiles: [
5330
- {
5331
- profileId: "claude-code",
5332
- name: "Claude Code Engineering Kit",
5333
- description: "Installs Claude-native hooks, commands, agent catalog, and first-hour engineering prompts on top of Lucern.",
5334
- runtimeTarget: "claude-code",
5335
- promptIds: [
5336
- "claude-quick-reference",
5337
- "build-command",
5338
- "architect-command",
5339
- "pipeline-command",
5340
- "pr-command",
5341
- "lucern-generate-questions",
5342
- "lucern-contradiction-analysis"
5343
- ],
5344
- toolIds: [
5345
- "start-investigation",
5346
- "record-scope-learning",
5347
- "record-attempt",
5348
- "pipeline-snapshot",
5349
- "session-init",
5350
- "tool-log",
5351
- "build-bash-gate",
5352
- "lucern-cli-init",
5353
- "kit-install"
5354
- ],
5355
- assetIds: [
5356
- "claude-instructions",
5357
- "mcp-config",
5358
- "kit-manifest",
5359
- "lucern-launcher",
5360
- "lucern-shell-wrapper",
5361
- "lucern-cli-script",
5362
- "claude-settings",
5363
- "permission-gate-hook",
5364
- "inbox-check-hook",
5365
- "prompt-router-hook",
5366
- "writeback-gate-hook",
5367
- "build-command-doc",
5368
- "architect-command-doc",
5369
- "pipeline-command-doc",
5370
- "pr-command-doc",
5371
- "claude-agent-catalog",
5372
- "claude-skill-catalog",
5373
- "hooks-doc",
5374
- "setup-ui"
5375
- ],
5376
- defaultTopicSlugs: [
5377
- "migrations",
5378
- "reviews",
5379
- "incidents",
5380
- "architecture",
5381
- "decision-memory"
5382
- ]
5590
+ requiredFields: ["mitigationSteps", "owners"]
5591
+ },
5592
+ {
5593
+ artifactId: "decision-brief",
5594
+ name: "Decision Brief",
5595
+ description: "Options, cited precedent, trade-offs, and objections for an architecture decision",
5596
+ stage: "compare-options",
5597
+ contentSchema: {
5598
+ type: "object",
5599
+ properties: {
5600
+ options: { type: "array", items: { type: "string" } },
5601
+ citedPrecedent: { type: "array", items: { type: "string" } },
5602
+ objections: { type: "array", items: { type: "string" } }
5603
+ },
5604
+ required: ["options", "citedPrecedent"]
5383
5605
  },
5384
- {
5385
- profileId: "codex",
5386
- name: "Codex Engineering Kit",
5387
- description: "Installs the Codex bridge, Lucern MCP wiring, and the same pack-level workflows without Claude-specific hooks.",
5388
- runtimeTarget: "codex",
5389
- promptIds: [
5390
- "build-command",
5391
- "architect-command",
5392
- "pipeline-command",
5393
- "pr-command",
5394
- "lucern-generate-questions",
5395
- "lucern-contradiction-analysis"
5396
- ],
5397
- toolIds: [
5398
- "start-investigation",
5399
- "record-scope-learning",
5400
- "record-attempt",
5401
- "pipeline-snapshot",
5402
- "lucern-cli-init",
5403
- "kit-install"
5404
- ],
5405
- assetIds: [
5406
- "codex-bridge",
5407
- "mcp-config",
5408
- "kit-manifest",
5409
- "lucern-launcher",
5410
- "lucern-shell-wrapper",
5411
- "lucern-cli-script",
5412
- "build-command-doc",
5413
- "architect-command-doc",
5414
- "pipeline-command-doc",
5415
- "pr-command-doc",
5416
- "claude-skill-catalog",
5417
- "skills-sync-script",
5418
- "hooks-doc",
5419
- "setup-ui"
5420
- ],
5421
- defaultTopicSlugs: [
5422
- "migrations",
5423
- "reviews",
5424
- "incidents",
5425
- "architecture",
5426
- "decision-memory"
5427
- ]
5606
+ requiredFields: ["options", "citedPrecedent"]
5607
+ },
5608
+ {
5609
+ artifactId: "decision-record",
5610
+ name: "Decision Record",
5611
+ description: "Chosen path, why it won, what it supersedes, and what follow-up remains open",
5612
+ stage: "record-decision",
5613
+ contentSchema: {
5614
+ type: "object",
5615
+ properties: {
5616
+ decision: { type: "string" },
5617
+ rationale: { type: "array", items: { type: "string" } },
5618
+ supersedes: { type: "array", items: { type: "string" } },
5619
+ followUps: { type: "array", items: { type: "string" } }
5620
+ },
5621
+ required: ["decision", "rationale"]
5428
5622
  },
5429
- {
5430
- profileId: "hybrid",
5431
- name: "Hybrid Engineering Kit",
5432
- description: "Installs both Claude and Codex entry surfaces against one Lucern-native engineering operating system.",
5433
- runtimeTarget: "hybrid",
5434
- promptIds: [
5435
- "claude-quick-reference",
5436
- "build-command",
5437
- "architect-command",
5438
- "pipeline-command",
5439
- "pr-command",
5440
- "lucern-generate-questions",
5441
- "lucern-contradiction-analysis"
5442
- ],
5443
- toolIds: [
5444
- "start-investigation",
5445
- "record-scope-learning",
5446
- "record-attempt",
5447
- "pipeline-snapshot",
5448
- "session-init",
5449
- "tool-log",
5450
- "build-bash-gate",
5451
- "lucern-cli-init",
5452
- "kit-install"
5453
- ],
5454
- assetIds: [
5455
- "claude-instructions",
5456
- "codex-bridge",
5457
- "mcp-config",
5458
- "kit-manifest",
5459
- "lucern-launcher",
5460
- "lucern-shell-wrapper",
5461
- "lucern-cli-script",
5462
- "claude-settings",
5463
- "permission-gate-hook",
5464
- "inbox-check-hook",
5465
- "prompt-router-hook",
5466
- "writeback-gate-hook",
5467
- "build-command-doc",
5468
- "architect-command-doc",
5469
- "pipeline-command-doc",
5470
- "pr-command-doc",
5471
- "claude-agent-catalog",
5472
- "claude-skill-catalog",
5473
- "skills-sync-script",
5474
- "hooks-doc",
5475
- "setup-ui"
5476
- ],
5477
- defaultTopicSlugs: [
5478
- "migrations",
5479
- "reviews",
5480
- "incidents",
5481
- "architecture",
5482
- "decision-memory"
5483
- ]
5484
- }
5485
- ]
5486
- },
5487
- appPackKeys: [
5488
- "chat-v1",
5489
- "documents-v1",
5490
- "epistemic-algorithms-v1",
5491
- "graph-visualization-v1",
5492
- "task-management-v1"
5623
+ requiredFields: ["decision", "rationale"]
5624
+ }
5493
5625
  ],
5494
- methodologyPackId: "developer"
5626
+ roles: [
5627
+ {
5628
+ roleId: "context-compiler",
5629
+ name: "Context Compiler",
5630
+ description: "Compiles prior rationale, analogs, and failure memory into reusable first-hour context",
5631
+ perspective: "History-first, evidence-weighted context assembly",
5632
+ optimizesFor: "recall quality and anti-repetition coverage",
5633
+ mayBlock: false
5634
+ },
5635
+ {
5636
+ roleId: "migration-owner",
5637
+ name: "Migration Owner",
5638
+ description: "Scopes rollout blast radius, rollback, sequencing, and compatibility risk",
5639
+ perspective: "Operational caution with explicit rollback discipline",
5640
+ optimizesFor: "safe rollout planning",
5641
+ mayBlock: false
5642
+ },
5643
+ {
5644
+ roleId: "reviewer",
5645
+ name: "Reviewer",
5646
+ description: "Evaluates risky changes against prior regressions, evidence, and missing checks",
5647
+ perspective: "Evidence-backed change approval with regression awareness",
5648
+ optimizesFor: "defect prevention and clear approval rationale",
5649
+ mayBlock: true
5650
+ },
5651
+ {
5652
+ roleId: "incident-commander",
5653
+ name: "Incident Commander",
5654
+ description: "Maintains multiple plausible explanations while driving mitigation decisions",
5655
+ perspective: "Fast, reversible action without collapsing uncertainty too early",
5656
+ optimizesFor: "time-to-mitigation with preserved reasoning integrity",
5657
+ mayBlock: false
5658
+ },
5659
+ {
5660
+ roleId: "architect",
5661
+ name: "Architect",
5662
+ description: "Turns competing options into explicit decisions with cited precedent and follow-up risk",
5663
+ perspective: "Trade-off clarity and long-term maintainability",
5664
+ optimizesFor: "decision quality and rationale reuse",
5665
+ mayBlock: false
5666
+ },
5667
+ {
5668
+ roleId: "critic",
5669
+ name: "Critic",
5670
+ description: "Finds weak assumptions, missing rollback paths, and untested contradictions",
5671
+ perspective: "Skeptical, adversarial, and detail-oriented",
5672
+ optimizesFor: "early detection of brittle plans",
5673
+ mayBlock: true
5674
+ }
5675
+ ],
5676
+ ...ENGINEERING_ACCELERATOR_TAIL
5495
5677
  });
5496
5678
 
5497
5679
  // src/domain-pack/packs/index.ts
@@ -5515,6 +5697,6 @@ var listShapingContributions = shapingContributionRegistry.list.bind(
5515
5697
  shapingContributionRegistry
5516
5698
  );
5517
5699
 
5518
- export { DEVELOPER_REASONING_PACK, ENGINEERING_ACCELERATOR_PACK, PACK_NAMESPACE_COLLISION_ALLOWLIST, SOFTWARE_ENTITIES_V1, allAppPackManifests, appPackRegistry, buildShapingContribution, chatV1Manifest, createDomainPackAuthoringTools, createShapingContributionRegistry, dealsV1Manifest, decisionsV1Manifest, defineAppPackManifest, defineDomainPack, defineDomainPackAuthoringManifest, detectNamespaceCollisions, documentsV1Manifest, epistemicAlgorithmsV1Manifest, evaluateAppPackEnablement, evaluateCatalogEnablement, evaluatePackEnablement, getAppPackManifest, getDependencyClosure, getDomainPack, getShapingContribution, graphVisualizationV1Manifest, listAppPackManifests, listDomainPacks, listShapingContributions, newsV1Manifest, parseDomainPackAuthoringManifest, philosophyModeV1Manifest, previewDomainPackAuthoringManifest, previewDomainPackAuthoringManifestSource, publishDomainPackAuthoringManifest, publishDomainPackAuthoringManifestSource, resolvePackDependencyGraph, serializeDomainPackAuthoringManifest, taskManagementV1Manifest, teamAnalysisV1Manifest, themesV1Manifest, userProfilesV1Manifest, validateAppPackManifest, validateAppPackRegistry, validateDomainPack, validateDomainPackAuthoringManifest, validateDomainPackAuthoringManifestSource, validatePackNamespacePolicies, validatePackRegistry, validatePackSharedServiceContracts, validateShapingContribution };
5700
+ export { DEVELOPER_REASONING_PACK, ENGINEERING_ACCELERATOR_PACK, PACK_NAMESPACE_COLLISION_ALLOWLIST, SOFTWARE_ENTITIES_V1, allAppPackManifests, appPackRegistry, buildShapingContribution, chatV1Manifest, createDomainPackAuthoringTools2 as createDomainPackAuthoringTools, createShapingContributionRegistry, dealsV1Manifest, decisionsV1Manifest, defineAppPackManifest, defineDomainPack, defineDomainPackAuthoringManifest, detectNamespaceCollisions, documentsV1Manifest, epistemicAlgorithmsV1Manifest, evaluateAppPackEnablement, evaluateCatalogEnablement, evaluatePackEnablement, getAppPackManifest, getDependencyClosure, getDomainPack, getShapingContribution, graphVisualizationV1Manifest, listAppPackManifests, listDomainPacks, listShapingContributions, newsV1Manifest, parseDomainPackAuthoringManifest, philosophyModeV1Manifest, previewDomainPackAuthoringManifest2 as previewDomainPackAuthoringManifest, previewDomainPackAuthoringManifestSource2 as previewDomainPackAuthoringManifestSource, publishDomainPackAuthoringManifest2 as publishDomainPackAuthoringManifest, publishDomainPackAuthoringManifestSource2 as publishDomainPackAuthoringManifestSource, resolvePackDependencyGraph, serializeDomainPackAuthoringManifest, taskManagementV1Manifest, teamAnalysisV1Manifest, themesV1Manifest, userProfilesV1Manifest, validateAppPackManifest, validateAppPackRegistry, validateDomainPack, validateDomainPackAuthoringManifest2 as validateDomainPackAuthoringManifest, validateDomainPackAuthoringManifestSource2 as validateDomainPackAuthoringManifestSource, validatePackNamespacePolicies, validatePackRegistry, validatePackSharedServiceContracts, validateShapingContribution, worktreesV1Manifest };
5519
5701
  //# sourceMappingURL=index.js.map
5520
5702
  //# sourceMappingURL=index.js.map