mirai-graph 1.3.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +6 -0
- package/index.js +1 -0
- package/package.json +9 -121
- package/.github/workflows/ci.yml +0 -48
- package/.github/workflows/mirai-graph-validate.yml +0 -30
- package/CHANGELOG.md +0 -702
- package/CITATION.cff +0 -21
- package/LICENSE +0 -21
- package/LICENSE-DOCS +0 -26
- package/README.md +0 -351
- package/ROADMAP.md +0 -241
- package/benchmarks/protocols/measure-convert-optimize.md +0 -131
- package/benchmarks/synthetic-context-reduction-v0/README.md +0 -70
- package/benchmarks/synthetic-context-reduction-v0/RESULT.md +0 -52
- package/benchmarks/synthetic-context-reduction-v0/expected/context-pack-compact.md +0 -31
- package/benchmarks/synthetic-context-reduction-v0/gates/results.json +0 -12
- package/benchmarks/synthetic-context-reduction-v0/graph/objects.json +0 -114
- package/benchmarks/synthetic-context-reduction-v0/graph/relations.json +0 -74
- package/benchmarks/synthetic-context-reduction-v0/graph.json +0 -37
- package/benchmarks/synthetic-context-reduction-v0/metrics/example-metrics.json +0 -22
- package/benchmarks/synthetic-context-reduction-v0/results/baseline-comparison-result.json +0 -42
- package/benchmarks/synthetic-context-reduction-v0/results/context-pack.json +0 -181
- package/benchmarks/synthetic-context-reduction-v0/results/context-reduction-result.json +0 -8
- package/benchmarks/synthetic-context-reduction-v0/results/profile-conformance-result.json +0 -28
- package/benchmarks/synthetic-context-reduction-v0/results/readiness-score.json +0 -24
- package/benchmarks/synthetic-context-reduction-v0/reviews/semantic-completeness-review.json +0 -78
- package/benchmarks/synthetic-context-reduction-v0/scripts/calculate-context-reduction.js +0 -42
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/audit-events.md +0 -8
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/content-workflow.md +0 -8
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/identity-access.md +0 -8
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/notification-delivery.md +0 -8
- package/benchmarks/synthetic-context-reduction-v0/tasks/tasks.json +0 -31
- package/docs/README.md +0 -130
- package/docs/adoption/adopter-kit.md +0 -187
- package/docs/adoption/ai-employee-graph.md +0 -151
- package/docs/adoption/character-layer.md +0 -196
- package/docs/adoption/choose-profile.md +0 -106
- package/docs/adoption/cli.md +0 -134
- package/docs/adoption/connect-project-15-minutes.md +0 -122
- package/docs/adoption/developer-integration-guide.md +0 -122
- package/docs/adoption/end-to-end-control-loop.md +0 -168
- package/docs/adoption/for-developers.md +0 -210
- package/docs/adoption/getting-started.md +0 -192
- package/docs/adoption/mirai-graph-transition.md +0 -67
- package/docs/adoption/profile-conformance-fixtures.md +0 -112
- package/docs/adoption/seed-to-validated-package.md +0 -121
- package/docs/concept.md +0 -109
- package/docs/repository-purpose.md +0 -422
- package/docs/research/ai-work-field-instrumentation-bridge.md +0 -126
- package/docs/research/baseline-comparison-protocol.md +0 -79
- package/docs/research/evidence-package-v0.1.md +0 -99
- package/docs/research/evidence-package-v0.2.md +0 -150
- package/docs/research/evidence-package-v0.3.md +0 -256
- package/docs/research/independent-implementation-pilot-plan.md +0 -74
- package/docs/research/limitations-and-threats.md +0 -40
- package/docs/research/practice-science-program.md +0 -232
- package/docs/research/scientific-evidence-package.md +0 -188
- package/docs/research/semantic-completeness-review-protocol.md +0 -70
- package/docs/terminology.md +0 -119
- package/docs/transfer/ai-employee-profile-proposal.md +0 -119
- package/docs/transfer/federation-routing-control-loop-2026-05-31.md +0 -28
- package/docs/transfer/graph-capability-map-2026-05-29.md +0 -126
- package/docs/transfer/graph-skill-to-mirai-graph.md +0 -128
- package/docs/transfer/project-management-standard-harvest-2026-06-02.md +0 -322
- package/docs/transfer/skill-graph-standard-harvest-2026-05-31.md +0 -113
- package/docs/transfer/standard-gap-report-2026-05-28.md +0 -208
- package/examples/ai-employee-minimal/README.md +0 -53
- package/examples/ai-employee-minimal/gates/results.json +0 -35
- package/examples/ai-employee-minimal/graph/objects.json +0 -187
- package/examples/ai-employee-minimal/graph/relations.json +0 -167
- package/examples/ai-employee-minimal/graph.json +0 -37
- package/examples/ai-employee-minimal/results/profile-conformance-result.json +0 -28
- package/examples/character-layer-integration-minimal/README.md +0 -25
- package/examples/character-layer-integration-minimal/results/character-layer-integration.json +0 -53
- package/examples/character-layer-minimal/README.md +0 -29
- package/examples/character-layer-minimal/gates/results.json +0 -57
- package/examples/character-layer-minimal/graph/objects.json +0 -165
- package/examples/character-layer-minimal/graph/relations.json +0 -178
- package/examples/character-layer-minimal/graph.json +0 -37
- package/examples/character-layer-readiness-1-0/README.md +0 -27
- package/examples/character-layer-readiness-1-0/results/character-layer-readiness.json +0 -90
- package/examples/dynamic-episode-minimal/README.md +0 -34
- package/examples/dynamic-episode-minimal/gates/results.json +0 -12
- package/examples/dynamic-episode-minimal/graph/objects.json +0 -92
- package/examples/dynamic-episode-minimal/graph/relations.json +0 -29
- package/examples/dynamic-episode-minimal/graph.json +0 -47
- package/examples/dynamic-episode-minimal/invalid-canonical-write-allowed.json +0 -40
- package/examples/dynamic-episode-minimal/invalid-evidence-as-authorization.json +0 -46
- package/examples/dynamic-episode-minimal/invalid-missing-event.json +0 -35
- package/examples/dynamic-episode-minimal/invalid-missing-selected-path.json +0 -40
- package/examples/dynamic-episode-minimal/invalid-unclassified-finding.json +0 -50
- package/examples/dynamic-episode-minimal/results/dynamic-episode-trace.json +0 -149
- package/examples/federation-routing-smoke/README.md +0 -19
- package/examples/federation-routing-smoke/federation-health-dashboard.json +0 -42
- package/examples/federation-routing-smoke/route-explanation.json +0 -32
- package/examples/federation-routing-smoke/route-regression-result.json +0 -35
- package/examples/federation-routing-smoke/routes/production-deploy-execution-evidence.json +0 -17
- package/examples/federation-routing-smoke/routes/production-deploy-route-result.json +0 -12
- package/examples/federation-routing-smoke/routes/production-deploy-runtime-preflight.json +0 -8
- package/examples/federation-routing-smoke/routes/production-deploy-stderr.txt +0 -1
- package/examples/federation-routing-smoke/routes/production-deploy-stdout.txt +0 -1
- package/examples/federation-routing-smoke/routes/search-page-execution-evidence.json +0 -17
- package/examples/federation-routing-smoke/routes/search-page-route-result.json +0 -12
- package/examples/federation-routing-smoke/routes/search-page-stderr.txt +0 -1
- package/examples/federation-routing-smoke/routes/search-page-stdout.txt +0 -1
- package/examples/federation-routing-smoke/routing-fixture-run.json +0 -66
- package/examples/federation-routing-smoke/routing-fixtures.json +0 -44
- package/examples/goal-vector-quality-control-minimal/README.md +0 -22
- package/examples/goal-vector-quality-control-minimal/gates/results.json +0 -22
- package/examples/goal-vector-quality-control-minimal/graph/objects.json +0 -56
- package/examples/goal-vector-quality-control-minimal/graph/relations.json +0 -29
- package/examples/goal-vector-quality-control-minimal/graph.json +0 -41
- package/examples/goal-vector-quality-control-minimal/invalid-complete-without-evidence.json +0 -77
- package/examples/goal-vector-quality-control-minimal/invalid-correction-without-route.json +0 -86
- package/examples/goal-vector-quality-control-minimal/invalid-missing-reverse-audit.json +0 -77
- package/examples/goal-vector-quality-control-minimal/invalid-missing-vector-link.json +0 -62
- package/examples/goal-vector-quality-control-minimal/invalid-tests-as-acceptance.json +0 -72
- package/examples/goal-vector-quality-control-minimal/results/goal-vector-quality-control.json +0 -130
- package/examples/graph-dna-alignment-minimal/README.md +0 -16
- package/examples/graph-dna-alignment-minimal/graph/objects.json +0 -38
- package/examples/graph-dna-alignment-minimal/graph/relations.json +0 -20
- package/examples/graph-dna-alignment-minimal/graph.json +0 -37
- package/examples/graph-dna-alignment-minimal/results/graph-dna-alignment.json +0 -32
- package/examples/graph-seed-minimal/README.md +0 -9
- package/examples/graph-seed-minimal/graph-embryo.json +0 -63
- package/examples/graph-seed-minimal/graph-seed.json +0 -60
- package/examples/implementation-control-cycles/README.md +0 -47
- package/examples/implementation-control-cycles/gates/results.json +0 -22
- package/examples/implementation-control-cycles/graph/objects.json +0 -119
- package/examples/implementation-control-cycles/graph/relations.json +0 -200
- package/examples/implementation-control-cycles/graph.json +0 -37
- package/examples/implementation-control-cycles/results/implementation-control-cycles.json +0 -456
- package/examples/implementation-control-minimal/README.md +0 -39
- package/examples/implementation-control-minimal/gates/results.json +0 -42
- package/examples/implementation-control-minimal/graph/objects.json +0 -128
- package/examples/implementation-control-minimal/graph/relations.json +0 -128
- package/examples/implementation-control-minimal/graph.json +0 -37
- package/examples/implementation-control-minimal/results/implementation-control-loop.json +0 -21
- package/examples/instrumentation-layer-minimal/README.md +0 -32
- package/examples/instrumentation-layer-minimal/gates/results.json +0 -11
- package/examples/instrumentation-layer-minimal/graph/objects.json +0 -74
- package/examples/instrumentation-layer-minimal/graph/relations.json +0 -56
- package/examples/instrumentation-layer-minimal/graph.json +0 -37
- package/examples/instrumentation-layer-minimal/invalid-cockpit-missing-gates.json +0 -40
- package/examples/instrumentation-layer-minimal/invalid-feedback-accepted-with-blocking.json +0 -38
- package/examples/instrumentation-layer-minimal/invalid-feedback-process-improvement-without-kaizen.json +0 -38
- package/examples/instrumentation-layer-minimal/invalid-traceability-missing-evidence.json +0 -43
- package/examples/instrumentation-layer-minimal/results/development-cockpit.json +0 -68
- package/examples/instrumentation-layer-minimal/results/feature-implementation-traceability.json +0 -56
- package/examples/instrumentation-layer-minimal/results/multi-source-quality-feedback.json +0 -72
- package/examples/invalid-character-layer-context-authorization/graph/objects.json +0 -22
- package/examples/invalid-character-layer-context-authorization/graph/relations.json +0 -1
- package/examples/invalid-character-layer-context-authorization/graph.json +0 -35
- package/examples/invalid-character-layer-correction-loop-no-review/graph/objects.json +0 -22
- package/examples/invalid-character-layer-correction-loop-no-review/graph/relations.json +0 -1
- package/examples/invalid-character-layer-correction-loop-no-review/graph.json +0 -35
- package/examples/invalid-character-layer-feedback-auto-update/graph/objects.json +0 -22
- package/examples/invalid-character-layer-feedback-auto-update/graph/relations.json +0 -1
- package/examples/invalid-character-layer-feedback-auto-update/graph.json +0 -35
- package/examples/invalid-character-layer-object-kind/graph/objects.json +0 -22
- package/examples/invalid-character-layer-object-kind/graph/relations.json +0 -1
- package/examples/invalid-character-layer-object-kind/graph.json +0 -35
- package/examples/invalid-character-layer-relation-direction/graph/objects.json +0 -33
- package/examples/invalid-character-layer-relation-direction/graph/relations.json +0 -13
- package/examples/invalid-character-layer-relation-direction/graph.json +0 -35
- package/examples/invalid-character-layer-relation-type/graph/objects.json +0 -33
- package/examples/invalid-character-layer-relation-type/graph/relations.json +0 -13
- package/examples/invalid-character-layer-relation-type/graph.json +0 -35
- package/examples/invalid-character-layer-role-permission/graph/objects.json +0 -22
- package/examples/invalid-character-layer-role-permission/graph/relations.json +0 -1
- package/examples/invalid-character-layer-role-permission/graph.json +0 -35
- package/examples/invalid-context-pack-missing-explanation/context-pack.json +0 -25
- package/examples/invalid-missing-relation-target/graph/objects.json +0 -11
- package/examples/invalid-missing-relation-target/graph/relations.json +0 -11
- package/examples/invalid-missing-relation-target/graph.json +0 -32
- package/examples/invalid-profile-object-kind/graph/objects.json +0 -20
- package/examples/invalid-profile-object-kind/graph/relations.json +0 -1
- package/examples/invalid-profile-object-kind/graph.json +0 -32
- package/examples/invalid-profile-relation-type/graph/objects.json +0 -29
- package/examples/invalid-profile-relation-type/graph/relations.json +0 -11
- package/examples/invalid-profile-relation-type/graph.json +0 -32
- package/examples/invalid-relation-id-mismatch/graph/objects.json +0 -29
- package/examples/invalid-relation-id-mismatch/graph/relations.json +0 -11
- package/examples/invalid-relation-id-mismatch/graph.json +0 -32
- package/examples/invalid-seed-unsafe-write/graph-seed.json +0 -27
- package/examples/invalid-societal-governance-auto-learning-update/graph/objects.json +0 -29
- package/examples/invalid-societal-governance-auto-learning-update/graph/relations.json +0 -11
- package/examples/invalid-societal-governance-auto-learning-update/graph.json +0 -35
- package/examples/invalid-societal-governance-avatar-no-consent/graph/objects.json +0 -29
- package/examples/invalid-societal-governance-avatar-no-consent/graph/relations.json +0 -11
- package/examples/invalid-societal-governance-avatar-no-consent/graph.json +0 -35
- package/examples/invalid-societal-governance-generated-context-authorization/graph/objects.json +0 -38
- package/examples/invalid-societal-governance-generated-context-authorization/graph/relations.json +0 -20
- package/examples/invalid-societal-governance-generated-context-authorization/graph.json +0 -35
- package/examples/invalid-societal-governance-missing-appeal-path/graph/objects.json +0 -29
- package/examples/invalid-societal-governance-missing-appeal-path/graph/relations.json +0 -11
- package/examples/invalid-societal-governance-missing-appeal-path/graph.json +0 -35
- package/examples/invalid-societal-governance-private-trace-exposed/graph/objects.json +0 -29
- package/examples/invalid-societal-governance-private-trace-exposed/graph/relations.json +0 -11
- package/examples/invalid-societal-governance-private-trace-exposed/graph.json +0 -35
- package/examples/invalid-societal-governance-rights-overridden/graph/objects.json +0 -29
- package/examples/invalid-societal-governance-rights-overridden/graph/relations.json +0 -11
- package/examples/invalid-societal-governance-rights-overridden/graph.json +0 -35
- package/examples/launch-record-minimal/README.md +0 -29
- package/examples/launch-record-minimal/gates/results.json +0 -12
- package/examples/launch-record-minimal/graph/objects.json +0 -47
- package/examples/launch-record-minimal/graph/relations.json +0 -38
- package/examples/launch-record-minimal/graph.json +0 -34
- package/examples/launch-record-minimal/results/launch-record.json +0 -51
- package/examples/managed-project-control-loop/README.md +0 -43
- package/examples/managed-project-control-loop/gates/results.json +0 -22
- package/examples/managed-project-control-loop/graph/objects.json +0 -119
- package/examples/managed-project-control-loop/graph/relations.json +0 -110
- package/examples/managed-project-control-loop/graph.json +0 -37
- package/examples/managed-project-control-loop/results/managed-loop-result.json +0 -21
- package/examples/minimal-graph/README.md +0 -15
- package/examples/minimal-graph/gates/results.json +0 -12
- package/examples/minimal-graph/graph/objects.json +0 -24
- package/examples/minimal-graph/graph/relations.json +0 -11
- package/examples/minimal-graph/graph.json +0 -37
- package/examples/minimal-graph/results/profile-conformance-result.json +0 -26
- package/examples/model-portability-minimal/README.md +0 -15
- package/examples/model-portability-minimal/results/model-portability-evidence.json +0 -55
- package/examples/organization-governance-minimal/README.md +0 -29
- package/examples/organization-governance-minimal/gates/results.json +0 -21
- package/examples/organization-governance-minimal/graph/objects.json +0 -147
- package/examples/organization-governance-minimal/graph/relations.json +0 -147
- package/examples/organization-governance-minimal/graph.json +0 -37
- package/examples/organization-governance-minimal/results/profile-conformance-result.json +0 -31
- package/examples/process-control-contract-minimal/README.md +0 -19
- package/examples/process-control-contract-minimal/graph/objects.json +0 -38
- package/examples/process-control-contract-minimal/graph/relations.json +0 -29
- package/examples/process-control-contract-minimal/graph.json +0 -34
- package/examples/process-control-contract-minimal/results/process-control-contract.json +0 -58
- package/examples/process-transition-minimal/README.md +0 -25
- package/examples/process-transition-minimal/invalid-missing-launch-record.json +0 -14
- package/examples/process-transition-minimal/invalid-ready-to-written.json +0 -14
- package/examples/process-transition-minimal/invalid-release-missing-evidence.json +0 -14
- package/examples/process-transition-minimal/invalid-sync-to-update.json +0 -14
- package/examples/process-transition-minimal/invalid-terminal-missing-kaizen.json +0 -14
- package/examples/process-transition-minimal/invalid-tests-to-approved.json +0 -14
- package/examples/process-transition-minimal/results/transition-explanation-invalid-ready-to-written.json +0 -35
- package/examples/process-transition-minimal/results/transition-explanation-valid.json +0 -34
- package/examples/process-transition-minimal/state-machine.json +0 -79
- package/examples/process-transition-minimal/transition-request-skip-kaizen.json +0 -14
- package/examples/process-transition-minimal/transition-request.json +0 -14
- package/examples/project-technology-context-traversal/README.md +0 -17
- package/examples/project-technology-context-traversal/graph/objects.json +0 -78
- package/examples/project-technology-context-traversal/graph/relations.json +0 -47
- package/examples/project-technology-context-traversal/graph.json +0 -30
- package/examples/project-technology-context-traversal/selection.example.json +0 -29
- package/examples/project-technology-context-traversal/sources/announcement.md +0 -3
- package/examples/project-technology-context-traversal/sources/release-guide.md +0 -3
- package/examples/project-technology-context-traversal/sources/release-smoke.md +0 -3
- package/examples/project-technology-context-traversal/sources/rollback-policy.md +0 -3
- package/examples/risk-and-coordination-minimal/README.md +0 -16
- package/examples/risk-and-coordination-minimal/graph/objects.json +0 -47
- package/examples/risk-and-coordination-minimal/graph/relations.json +0 -29
- package/examples/risk-and-coordination-minimal/graph.json +0 -37
- package/examples/risk-and-coordination-minimal/results/multi-agent-coordination.json +0 -25
- package/examples/risk-and-coordination-minimal/results/risk-control-matrix.json +0 -34
- package/examples/self-service-onboarding/bootstrap-proposal/bootstrap-proposal.json +0 -20
- package/examples/self-service-onboarding/existing-graph/README.md +0 -4
- package/examples/self-service-onboarding/existing-graph/gates/results.json +0 -11
- package/examples/self-service-onboarding/existing-graph/graph/objects.json +0 -11
- package/examples/self-service-onboarding/existing-graph/graph/relations.json +0 -1
- package/examples/self-service-onboarding/existing-graph/graph.json +0 -36
- package/examples/self-service-onboarding/no-graph/README.md +0 -6
- package/examples/self-service-onboarding/no-graph/package.json +0 -6
- package/examples/self-service-onboarding/no-graph/src/index.js +0 -3
- package/examples/self-service-onboarding/stale-graph/README.md +0 -4
- package/examples/self-service-onboarding/stale-graph/graph.json +0 -36
- package/examples/semantic-intent-resolution-minimal/README.md +0 -13
- package/examples/semantic-intent-resolution-minimal/invalid-low-confidence-executes.json +0 -26
- package/examples/semantic-intent-resolution-minimal/invalid-proposal-canonical-update.json +0 -27
- package/examples/semantic-intent-resolution-minimal/results/semantic-intent-resolution.json +0 -45
- package/examples/skill-runtime-minimal/README.md +0 -29
- package/examples/skill-runtime-minimal/gates/results.json +0 -35
- package/examples/skill-runtime-minimal/graph/objects.json +0 -209
- package/examples/skill-runtime-minimal/graph/relations.json +0 -178
- package/examples/skill-runtime-minimal/graph.json +0 -37
- package/examples/skill-runtime-minimal/results/profile-conformance-result.json +0 -27
- package/examples/societal-governance-minimal/README.md +0 -37
- package/examples/societal-governance-minimal/graph/objects.json +0 -218
- package/examples/societal-governance-minimal/graph/relations.json +0 -209
- package/examples/societal-governance-minimal/graph.json +0 -37
- package/examples/source-boundary-minimal/README.md +0 -16
- package/examples/source-boundary-minimal/graph/objects.json +0 -38
- package/examples/source-boundary-minimal/graph/relations.json +0 -20
- package/examples/source-boundary-minimal/graph.json +0 -37
- package/examples/source-boundary-minimal/results/source-boundary-contract.json +0 -37
- package/examples/technology-quality-feedback-minimal/README.md +0 -33
- package/examples/technology-quality-feedback-minimal/graph/objects.json +0 -56
- package/examples/technology-quality-feedback-minimal/graph/relations.json +0 -47
- package/examples/technology-quality-feedback-minimal/graph.json +0 -34
- package/examples/technology-quality-feedback-minimal/invalid-accepted-with-blocking.json +0 -33
- package/examples/technology-quality-feedback-minimal/invalid-evidence-as-authorization.json +0 -22
- package/examples/technology-quality-feedback-minimal/invalid-missing-required-step.json +0 -22
- package/examples/technology-quality-feedback-minimal/invalid-process-improvement-without-kaizen.json +0 -33
- package/examples/technology-quality-feedback-minimal/invalid-spec-gap-without-route.json +0 -33
- package/examples/technology-quality-feedback-minimal/invalid-unclassified-finding.json +0 -33
- package/examples/technology-quality-feedback-minimal/results/technology-quality-feedback.json +0 -80
- package/examples/work-recovery-minimal/README.md +0 -15
- package/examples/work-recovery-minimal/graph/objects.json +0 -47
- package/examples/work-recovery-minimal/graph/relations.json +0 -20
- package/examples/work-recovery-minimal/graph.json +0 -37
- package/examples/work-recovery-minimal/results/recovery-resume-record.json +0 -17
- package/examples/work-recovery-minimal/results/work-state-machine.json +0 -21
- package/packages/cli/adopter-workflow.js +0 -228
- package/packages/cli/context-pack.js +0 -269
- package/packages/cli/graph-manifest.js +0 -367
- package/packages/cli/instrumentation-report.js +0 -97
- package/packages/cli/migrate-graph-manifest.js +0 -33
- package/packages/cli/mirai-graph.js +0 -154
- package/packages/cli/mirai_graph.js +0 -3
- package/packages/cli/playground-demo.js +0 -114
- package/packages/cli/project-technology.js +0 -129
- package/packages/cli/readiness-score.js +0 -164
- package/packages/cli/release-state.js +0 -329
- package/packages/cli/seed-preview.js +0 -78
- package/packages/cli/self-service-onboarding.js +0 -386
- package/packages/cli/validate-adopter-workflow.js +0 -63
- package/packages/cli/validate-artifact-releases.js +0 -282
- package/packages/cli/validate-baseline-comparison.js +0 -105
- package/packages/cli/validate-context-traversal.js +0 -292
- package/packages/cli/validate-graph-manifest-migration.js +0 -64
- package/packages/cli/validate-mirai-graph.js +0 -3245
- package/packages/cli/validate-process-transition-report.js +0 -105
- package/packages/cli/validate-profile-results.js +0 -64
- package/packages/cli/validate-project-continuity.js +0 -173
- package/packages/cli/validate-project-technology.js +0 -296
- package/packages/cli/validate-release-state.js +0 -100
- package/packages/cli/validate-routing-control-examples.js +0 -79
- package/packages/cli/validate-self-service-onboarding.js +0 -159
- package/packages/project-technology/artifact-release.js +0 -738
- package/packages/project-technology/context-traversal.js +0 -684
- package/packages/project-technology/continuity.js +0 -414
- package/packages/project-technology/index.js +0 -835
- package/pilots/independent-implementation-001-conference-planning/README.md +0 -40
- package/pilots/independent-implementation-001-conference-planning/gates/results.json +0 -12
- package/pilots/independent-implementation-001-conference-planning/graph/objects.json +0 -74
- package/pilots/independent-implementation-001-conference-planning/graph/relations.json +0 -56
- package/pilots/independent-implementation-001-conference-planning/graph-seed.json +0 -65
- package/pilots/independent-implementation-001-conference-planning/graph.json +0 -37
- package/pilots/independent-implementation-001-conference-planning/reports/pilot-report.md +0 -120
- package/pilots/independent-implementation-001-conference-planning/results/context-pack.json +0 -35
- package/pilots/independent-implementation-001-conference-planning/results/graph-embryo.json +0 -81
- package/pilots/independent-implementation-001-conference-planning/results/package-validation.json +0 -7
- package/pilots/independent-implementation-001-conference-planning/results/profile-conformance-result.json +0 -28
- package/pilots/independent-implementation-001-conference-planning/results/readiness-score.json +0 -26
- package/pilots/independent-implementation-001-conference-planning/results/seed-validation.json +0 -7
- package/pilots/independent-implementation-002-software-specification/README.md +0 -40
- package/pilots/independent-implementation-002-software-specification/gates/results.json +0 -22
- package/pilots/independent-implementation-002-software-specification/graph/objects.json +0 -101
- package/pilots/independent-implementation-002-software-specification/graph/relations.json +0 -92
- package/pilots/independent-implementation-002-software-specification/graph-seed.json +0 -72
- package/pilots/independent-implementation-002-software-specification/graph.json +0 -37
- package/pilots/independent-implementation-002-software-specification/reports/pilot-report.md +0 -142
- package/pilots/independent-implementation-002-software-specification/results/context-pack.json +0 -184
- package/pilots/independent-implementation-002-software-specification/results/graph-embryo.json +0 -90
- package/pilots/independent-implementation-002-software-specification/results/package-validation.json +0 -7
- package/pilots/independent-implementation-002-software-specification/results/profile-conformance-result.json +0 -28
- package/pilots/independent-implementation-002-software-specification/results/readiness-score.json +0 -26
- package/pilots/independent-implementation-002-software-specification/results/seed-validation.json +0 -7
- package/pilots/independent-implementation-002-software-specification/reviews/semantic-completeness-review.json +0 -81
- package/pilots/independent-implementation-003-ai-employee-workflow/README.md +0 -42
- package/pilots/independent-implementation-003-ai-employee-workflow/gates/results.json +0 -30
- package/pilots/independent-implementation-003-ai-employee-workflow/graph/objects.json +0 -156
- package/pilots/independent-implementation-003-ai-employee-workflow/graph/relations.json +0 -147
- package/pilots/independent-implementation-003-ai-employee-workflow/graph-seed.json +0 -90
- package/pilots/independent-implementation-003-ai-employee-workflow/graph.json +0 -37
- package/pilots/independent-implementation-003-ai-employee-workflow/reports/pilot-report.md +0 -49
- package/pilots/independent-implementation-003-ai-employee-workflow/results/profile-conformance-result.json +0 -30
- package/pilots/independent-implementation-004-research-program/README.md +0 -41
- package/pilots/independent-implementation-004-research-program/gates/results.json +0 -21
- package/pilots/independent-implementation-004-research-program/graph/objects.json +0 -102
- package/pilots/independent-implementation-004-research-program/graph/relations.json +0 -84
- package/pilots/independent-implementation-004-research-program/graph-seed.json +0 -76
- package/pilots/independent-implementation-004-research-program/graph.json +0 -37
- package/pilots/independent-implementation-004-research-program/reports/pilot-report.md +0 -50
- package/pilots/independent-implementation-004-research-program/results/profile-conformance-result.json +0 -30
- package/pilots/independent-implementation-005-organization-governance/README.md +0 -42
- package/pilots/independent-implementation-005-organization-governance/gates/results.json +0 -20
- package/pilots/independent-implementation-005-organization-governance/graph/objects.json +0 -137
- package/pilots/independent-implementation-005-organization-governance/graph/relations.json +0 -110
- package/pilots/independent-implementation-005-organization-governance/graph-seed.json +0 -97
- package/pilots/independent-implementation-005-organization-governance/graph.json +0 -37
- package/pilots/independent-implementation-005-organization-governance/reports/pilot-report.md +0 -47
- package/pilots/independent-implementation-005-organization-governance/results/profile-conformance-result.json +0 -29
- package/playground/README.md +0 -78
- package/playground/demo-report.md +0 -84
- package/profiles/README.md +0 -28
- package/profiles/ai-employee/README.md +0 -132
- package/profiles/ai-employee/profile.json +0 -58
- package/profiles/character-layer/README.md +0 -143
- package/profiles/character-layer/profile.json +0 -46
- package/profiles/implementation-control/README.md +0 -174
- package/profiles/implementation-control/profile.json +0 -108
- package/profiles/organization-governance/README.md +0 -60
- package/profiles/organization-governance/profile.json +0 -56
- package/profiles/project-management/README.md +0 -119
- package/profiles/project-management/profile.json +0 -38
- package/profiles/skill-runtime/README.md +0 -99
- package/profiles/skill-runtime/profile.json +0 -58
- package/profiles/societal-governance/README.md +0 -129
- package/profiles/societal-governance/profile.json +0 -121
- package/profiles/software-specification/README.md +0 -142
- package/profiles/software-specification/profile.json +0 -31
- package/publications/README.md +0 -39
- package/publications/observable-self-correcting-ai-workflows/README.md +0 -105
- package/publications/preprint-note.md +0 -11
- package/publications/preprint-outline.md +0 -45
- package/publications/semantic-intent-goal-vector-control/README.md +0 -99
- package/releases/0.1.0-alpha.0.md +0 -45
- package/releases/0.1.0-alpha.1.md +0 -63
- package/releases/0.1.0-alpha.10.md +0 -93
- package/releases/0.1.0-alpha.11.md +0 -114
- package/releases/0.1.0-alpha.2.md +0 -37
- package/releases/0.1.0-alpha.3.md +0 -61
- package/releases/0.1.0-alpha.4.md +0 -53
- package/releases/0.1.0-alpha.5.md +0 -48
- package/releases/0.1.0-alpha.6.md +0 -96
- package/releases/0.1.0-alpha.7.md +0 -114
- package/releases/0.1.0-alpha.8.md +0 -92
- package/releases/0.1.0-alpha.9.md +0 -80
- package/releases/1.0.0-rc.1.md +0 -121
- package/releases/1.0.0-rc.10.md +0 -14
- package/releases/1.0.0-rc.11.md +0 -14
- package/releases/1.0.0-rc.2.md +0 -79
- package/releases/1.0.0-rc.3.md +0 -51
- package/releases/1.0.0-rc.4.md +0 -70
- package/releases/1.0.0-rc.5.md +0 -88
- package/releases/1.0.0-rc.6.md +0 -76
- package/releases/1.0.0-rc.8.md +0 -17
- package/releases/1.0.0-rc.9.md +0 -14
- package/releases/1.0.0.md +0 -23
- package/releases/1.1.0.md +0 -36
- package/releases/1.1.1.md +0 -25
- package/releases/1.2.0.md +0 -19
- package/releases/1.3.0.md +0 -16
- package/releases/README.md +0 -135
- package/releases/societal-governance-profile-proposal.md +0 -45
- package/schemas/baseline-comparison-result.schema.json +0 -87
- package/schemas/character-layer-integration.schema.json +0 -112
- package/schemas/character-layer-readiness.schema.json +0 -73
- package/schemas/context-pack.schema.json +0 -190
- package/schemas/context-traversal-receipt.schema.json +0 -64
- package/schemas/development-cockpit.schema.json +0 -74
- package/schemas/dynamic-episode-trace.schema.json +0 -153
- package/schemas/feature-implementation-traceability.schema.json +0 -80
- package/schemas/federation-health-dashboard.schema.json +0 -47
- package/schemas/gate-result.schema.json +0 -44
- package/schemas/goal-vector-quality-control.schema.json +0 -131
- package/schemas/graph-dna-alignment.schema.json +0 -49
- package/schemas/graph-embryo.schema.json +0 -51
- package/schemas/graph-lock.schema.json +0 -28
- package/schemas/graph-manifest.schema.json +0 -154
- package/schemas/graph-seed.schema.json +0 -137
- package/schemas/implementation-control-cycle.schema.json +0 -265
- package/schemas/implementation-control-loop.schema.json +0 -84
- package/schemas/launch-record.schema.json +0 -78
- package/schemas/model-portability-evidence.schema.json +0 -93
- package/schemas/multi-agent-coordination.schema.json +0 -35
- package/schemas/multi-source-quality-feedback.schema.json +0 -54
- package/schemas/object.schema.json +0 -49
- package/schemas/package-manifest.schema.json +0 -53
- package/schemas/process-control-contract.schema.json +0 -100
- package/schemas/process-transition-request.schema.json +0 -41
- package/schemas/profile.schema.json +0 -56
- package/schemas/project-technology-extension.schema.json +0 -15
- package/schemas/project-technology-target-export.schema.json +0 -35
- package/schemas/readiness-score.schema.json +0 -43
- package/schemas/recovery-resume-record.schema.json +0 -25
- package/schemas/relation.schema.json +0 -43
- package/schemas/risk-control-matrix.schema.json +0 -36
- package/schemas/route-explanation.schema.json +0 -51
- package/schemas/route-regression-result.schema.json +0 -33
- package/schemas/routing-fixture-run.schema.json +0 -45
- package/schemas/routing-fixtures.schema.json +0 -59
- package/schemas/semantic-intent-resolution.schema.json +0 -151
- package/schemas/source-boundary-contract.schema.json +0 -31
- package/schemas/technology-quality-feedback.schema.json +0 -116
- package/schemas/work-state-machine.schema.json +0 -34
- package/standard/action-runtime-boundary.md +0 -99
- package/standard/adoption-levels.md +0 -69
- package/standard/conformance-levels.md +0 -133
- package/standard/context-pack-generation.md +0 -184
- package/standard/development-cockpit.md +0 -67
- package/standard/dynamic-episode-layer.md +0 -113
- package/standard/dynamic-layer-code-generation.md +0 -87
- package/standard/episode-trace.md +0 -97
- package/standard/evidence-provenance.md +0 -128
- package/standard/feature-implementation-traceability.md +0 -68
- package/standard/federation-health.md +0 -42
- package/standard/feedback-learning-gate.md +0 -101
- package/standard/goal-vector-quality-control.md +0 -128
- package/standard/governance.md +0 -137
- package/standard/graph-as-ai-brain.md +0 -81
- package/standard/graph-dna-alignment.md +0 -50
- package/standard/graph-dna.md +0 -70
- package/standard/graph-embryo.md +0 -69
- package/standard/graph-seed.md +0 -122
- package/standard/hybrid-source-of-truth.md +0 -91
- package/standard/implementation-control-cycles.md +0 -194
- package/standard/implementation-control.md +0 -102
- package/standard/launch-record.md +0 -53
- package/standard/lifecycle-readiness.md +0 -159
- package/standard/multi-agent-coordination.md +0 -50
- package/standard/multi-source-quality-feedback.md +0 -71
- package/standard/object-model.md +0 -167
- package/standard/organization-governance.md +0 -83
- package/standard/process-control-contract.md +0 -53
- package/standard/profile-boundaries.md +0 -225
- package/standard/profiles.md +0 -253
- package/standard/project-technology.md +0 -186
- package/standard/projection-views.md +0 -69
- package/standard/recovery-resume.md +0 -49
- package/standard/relation-model.md +0 -149
- package/standard/risk-control-matrix.md +0 -53
- package/standard/route-explanation.md +0 -35
- package/standard/route-regression.md +0 -33
- package/standard/routing-fixtures.md +0 -54
- package/standard/runtime-enablement.md +0 -85
- package/standard/semantic-intent-resolution.md +0 -91
- package/standard/source-boundary-contract.md +0 -49
- package/standard/standard-v0.1.md +0 -132
- package/standard/technology-quality-feedback.md +0 -97
- package/standard/test-suite.md +0 -159
- package/standard/work-state-machine.md +0 -62
- package/templates/README.md +0 -77
- package/templates/ai-employee-starter/README.md +0 -9
- package/templates/ai-employee-starter/gates/results.json +0 -12
- package/templates/ai-employee-starter/graph/objects.json +0 -90
- package/templates/ai-employee-starter/graph/relations.json +0 -47
- package/templates/ai-employee-starter/graph.json +0 -37
- package/templates/character-layer-starter/README.md +0 -39
- package/templates/character-layer-starter/gates/results.json +0 -20
- package/templates/character-layer-starter/graph/objects.json +0 -308
- package/templates/character-layer-starter/graph/relations.json +0 -344
- package/templates/character-layer-starter/graph.json +0 -37
- package/templates/organization-governance-starter/README.md +0 -9
- package/templates/organization-governance-starter/gates/results.json +0 -12
- package/templates/organization-governance-starter/graph/objects.json +0 -112
- package/templates/organization-governance-starter/graph/relations.json +0 -65
- package/templates/organization-governance-starter/graph.json +0 -37
- package/templates/research-program-starter/README.md +0 -9
- package/templates/research-program-starter/gates/results.json +0 -12
- package/templates/research-program-starter/graph/objects.json +0 -79
- package/templates/research-program-starter/graph/relations.json +0 -47
- package/templates/research-program-starter/graph.json +0 -37
- package/templates/software-project-starter/README.md +0 -9
- package/templates/software-project-starter/gates/results.json +0 -12
- package/templates/software-project-starter/graph/objects.json +0 -79
- package/templates/software-project-starter/graph/relations.json +0 -47
- package/templates/software-project-starter/graph.json +0 -37
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const crypto = require("crypto");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const os = require("os");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
|
|
8
|
-
// Manifest refs are portable POSIX-style identifiers even when the host is Windows.
|
|
9
|
-
// Convert them to host paths only when joining with the repository root.
|
|
10
|
-
const CONTINUITY_FILE = "graph/specs/project-continuity.json";
|
|
11
|
-
const CONTEXT_PROJECTION_FILE = "graph/docs/project-context.md";
|
|
12
|
-
const BOUNDARIES = new Set(["task_start", "stage_complete", "task_complete"]);
|
|
13
|
-
const SECRET_PATTERN = /(?:ghp_|github_pat_|bearer\s+)[a-z0-9_-]{12,}|-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|(?:^|["'\s/])\.env(?:["'\s/]|$)|(?:password|token|secret|cookie)\s*[:=]/i;
|
|
14
|
-
const PRIVATE_PATH_PATTERN = /(?:^|[^A-Za-z0-9._-])source[\\/](?:private|memory|workflow|handoff)(?:[\\/]|$)/i;
|
|
15
|
-
const HOST_PATH_PATTERN = /(?:^|["'\s])(?:\/[Uu]sers\/[^/\s]+|\/home\/[^/\s]+|[A-Za-z]:\\Users\\[^\\\s]+)/;
|
|
16
|
-
|
|
17
|
-
function sortValue(value) {
|
|
18
|
-
if (Array.isArray(value)) return value.map(sortValue);
|
|
19
|
-
if (!value || typeof value !== "object") return value;
|
|
20
|
-
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortValue(value[key])]));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function canonicalBytes(value) {
|
|
24
|
-
return `${JSON.stringify(sortValue(value), null, 2)}\n`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function digest(value) {
|
|
28
|
-
const bytes = Buffer.isBuffer(value) ? value : Buffer.from(typeof value === "string" ? value : canonicalBytes(value));
|
|
29
|
-
return `sha256:${crypto.createHash("sha256").update(bytes).digest("hex")}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function safeId(value) {
|
|
33
|
-
return String(value || "").replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 120);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function safeText(value, limit = 2000) {
|
|
37
|
-
const text = String(value || "").trim();
|
|
38
|
-
if (!text || text.length > limit || SECRET_PATTERN.test(text) || PRIVATE_PATH_PATTERN.test(text) || HOST_PATH_PATTERN.test(text)) return null;
|
|
39
|
-
return text;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function safeRef(value) {
|
|
43
|
-
const text = safeText(value, 512);
|
|
44
|
-
if (!text || path.isAbsolute(text) || text.split(/[\\/]+/).includes("..")) return null;
|
|
45
|
-
return text;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function unique(values) {
|
|
49
|
-
return [...new Set(values.filter(Boolean))].sort();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function readJson(file, fallback = null) {
|
|
53
|
-
try { return JSON.parse(fs.readFileSync(file, "utf8").replace(/^\uFEFF/, "")); } catch (_) { return fallback; }
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function atomicWrite(file, bytes) {
|
|
57
|
-
const content = Buffer.isBuffer(bytes) ? bytes : Buffer.from(String(bytes));
|
|
58
|
-
if (fs.existsSync(file) && fs.readFileSync(file).equals(content)) return false;
|
|
59
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
60
|
-
const temp = path.join(path.dirname(file), `.${path.basename(file)}.${process.pid}.${crypto.randomBytes(4).toString("hex")}`);
|
|
61
|
-
fs.writeFileSync(temp, content, { mode: 0o600 });
|
|
62
|
-
fs.renameSync(temp, file);
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function graphIdentity(repo, manifest) {
|
|
67
|
-
return safeId(manifest?.id || path.basename(repo)) || digest(repo).slice(7, 23);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function stateRoot(repo, manifest, options = {}) {
|
|
71
|
-
const explicit = options.stateRoot || process.env.MIRAI_GRAPH_STATE_ROOT;
|
|
72
|
-
let root = explicit ? path.resolve(explicit) : null;
|
|
73
|
-
if (!root && process.platform === "win32") root = path.join(process.env.LOCALAPPDATA || os.tmpdir(), "mirai-graph", "project-technology");
|
|
74
|
-
if (!root && process.platform === "darwin") root = path.join(os.homedir(), "Library", "Application Support", "mirai-graph", "project-technology");
|
|
75
|
-
if (!root) root = path.join(process.env.XDG_STATE_HOME || path.join(os.homedir(), ".local", "state"), "mirai-graph", "project-technology");
|
|
76
|
-
return path.join(root, graphIdentity(repo, manifest));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function listFiles(root) {
|
|
80
|
-
if (!fs.existsSync(root)) return [];
|
|
81
|
-
const output = [];
|
|
82
|
-
const visit = (dir) => {
|
|
83
|
-
for (const name of fs.readdirSync(dir).sort()) {
|
|
84
|
-
const file = path.join(dir, name);
|
|
85
|
-
const stat = fs.lstatSync(file);
|
|
86
|
-
if (stat.isSymbolicLink()) continue;
|
|
87
|
-
if (stat.isDirectory()) visit(file);
|
|
88
|
-
else if (stat.isFile()) output.push(file);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
visit(root);
|
|
92
|
-
return output;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function graphDigest(repo) {
|
|
96
|
-
const specs = path.join(repo, "graph", "specs");
|
|
97
|
-
const entries = [];
|
|
98
|
-
const manifest = path.join(repo, "graph.json");
|
|
99
|
-
if (fs.existsSync(manifest)) entries.push({ path: "graph.json", sha256: digest(fs.readFileSync(manifest)) });
|
|
100
|
-
for (const file of listFiles(specs)) entries.push({
|
|
101
|
-
path: path.relative(repo, file).split(path.sep).join("/"),
|
|
102
|
-
sha256: digest(fs.readFileSync(file)),
|
|
103
|
-
});
|
|
104
|
-
return digest(entries);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function continuityPolicy(manifest) {
|
|
108
|
-
return manifest?.extensions?.["mirai.project_technology"]?.continuity_policy || null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function readObjects(repo) {
|
|
112
|
-
const payload = readJson(path.join(repo, CONTINUITY_FILE), { schema_version: "1.0.0", objects: [] });
|
|
113
|
-
return payload && payload.schema_version === "1.0.0" && Array.isArray(payload.objects) ? payload.objects : [];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function latestReceipt(repo, manifest, options = {}) {
|
|
117
|
-
const root = stateRoot(repo, manifest, options);
|
|
118
|
-
const pointer = readJson(path.join(root, "latest-receipt.json"));
|
|
119
|
-
if (!pointer?.receipt_ref) return null;
|
|
120
|
-
const file = path.join(root, pointer.receipt_ref);
|
|
121
|
-
const receipt = readJson(file);
|
|
122
|
-
if (!receipt || receipt.receipt_digest !== digest(Object.fromEntries(Object.entries(receipt).filter(([key]) => key !== "receipt_digest")))) return null;
|
|
123
|
-
return receipt;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function status(repo, manifest, options = {}) {
|
|
127
|
-
const policy = continuityPolicy(manifest);
|
|
128
|
-
const currentGraphDigest = graphDigest(repo);
|
|
129
|
-
const receipt = latestReceipt(repo, manifest, options);
|
|
130
|
-
let freshness = "not_configured";
|
|
131
|
-
if (policy === "task_boundary") freshness = !receipt ? "missing" : receipt.current_graph_digest === currentGraphDigest ? "current" : "stale";
|
|
132
|
-
return {
|
|
133
|
-
policy,
|
|
134
|
-
authority: "graph/specs",
|
|
135
|
-
host_state_ref: `host-local://${graphIdentity(repo, manifest)}`,
|
|
136
|
-
graph_digest: currentGraphDigest,
|
|
137
|
-
freshness,
|
|
138
|
-
terminal_receipt: receipt ? {
|
|
139
|
-
receipt_digest: receipt.receipt_digest,
|
|
140
|
-
boundary: receipt.boundary,
|
|
141
|
-
task_digest: receipt.task_digest,
|
|
142
|
-
current_graph_digest: receipt.current_graph_digest,
|
|
143
|
-
} : null,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function normalizeEvidence(input) {
|
|
148
|
-
const blockers = [];
|
|
149
|
-
if (!input || typeof input !== "object" || Array.isArray(input)) return { evidence: {}, blockers: ["continuity_evidence_missing"] };
|
|
150
|
-
if (SECRET_PATTERN.test(JSON.stringify(input)) || PRIVATE_PATH_PATTERN.test(JSON.stringify(input)) || HOST_PATH_PATTERN.test(JSON.stringify(input))) blockers.push("continuity_sensitive_or_host_data_forbidden");
|
|
151
|
-
const taskDigest = String(input.task_digest || "").toLowerCase();
|
|
152
|
-
if (!/^sha256:[0-9a-f]{64}$/.test(taskDigest)) blockers.push("continuity_task_digest_invalid");
|
|
153
|
-
const outcome = safeText(input.outcome, 1200);
|
|
154
|
-
if (!outcome) blockers.push("continuity_outcome_missing_or_unsafe");
|
|
155
|
-
const requirementRefs = unique((input.requirement_refs || []).map(safeRef));
|
|
156
|
-
const evidenceRefs = unique((input.evidence_refs || []).map(safeRef));
|
|
157
|
-
const checks = (Array.isArray(input.checks) ? input.checks : []).map((item) => {
|
|
158
|
-
if (!item || typeof item !== "object") return null;
|
|
159
|
-
const id = safeRef(item.id); const verdict = String(item.verdict || "").toLowerCase(); const evidenceRef = safeRef(item.evidence_ref);
|
|
160
|
-
if (!id || !["pass", "fail", "blocked"].includes(verdict) || !evidenceRef) return null;
|
|
161
|
-
return { id, verdict, evidence_ref: evidenceRef };
|
|
162
|
-
}).filter(Boolean).sort((a, b) => a.id.localeCompare(b.id));
|
|
163
|
-
if (!requirementRefs.length) blockers.push("continuity_requirement_refs_missing");
|
|
164
|
-
if (!evidenceRefs.length || !checks.length) blockers.push("continuity_verification_missing");
|
|
165
|
-
if (checks.some((item) => item.verdict !== "pass")) blockers.push("continuity_result_not_verified");
|
|
166
|
-
const changedSurfaces = unique((input.changed_surfaces || []).map(safeRef));
|
|
167
|
-
const caseSignature = safeRef(input.case_signature || "");
|
|
168
|
-
const methodCandidate = safeText(input.method_candidate || "", 1200);
|
|
169
|
-
const decisions = (Array.isArray(input.decisions) ? input.decisions : []).map((item) => {
|
|
170
|
-
if (!item || typeof item !== "object") return null;
|
|
171
|
-
const summary = safeText(item.summary, 1200);
|
|
172
|
-
if (!summary) return null;
|
|
173
|
-
return {
|
|
174
|
-
summary,
|
|
175
|
-
changes_architecture: item.changes_architecture !== false,
|
|
176
|
-
owner_ref: safeRef(item.owner_ref || "") || null,
|
|
177
|
-
approval_ref: safeRef(item.approval_ref || "") || null,
|
|
178
|
-
};
|
|
179
|
-
}).filter(Boolean);
|
|
180
|
-
return {
|
|
181
|
-
evidence: {
|
|
182
|
-
task_digest: taskDigest,
|
|
183
|
-
outcome,
|
|
184
|
-
requirement_refs: requirementRefs,
|
|
185
|
-
evidence_refs: evidenceRefs,
|
|
186
|
-
checks,
|
|
187
|
-
changed_surfaces: changedSurfaces,
|
|
188
|
-
case_signature: caseSignature || digest({ outcome, requirementRefs }).slice(7, 31),
|
|
189
|
-
method_candidate: methodCandidate,
|
|
190
|
-
decisions,
|
|
191
|
-
source_revision: safeRef(input.source_revision || "") || null,
|
|
192
|
-
},
|
|
193
|
-
blockers: unique(blockers),
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function buildCandidates(existing, evidence, boundary) {
|
|
198
|
-
const signature = digest({ task: evidence.task_digest, outcome: evidence.outcome, requirements: evidence.requirement_refs });
|
|
199
|
-
const suffix = signature.slice(7, 23);
|
|
200
|
-
const promoted = [
|
|
201
|
-
{
|
|
202
|
-
id: `evidence.continuity.${suffix}`,
|
|
203
|
-
kind: "evidence",
|
|
204
|
-
title: `Verified task result ${suffix}`,
|
|
205
|
-
summary: evidence.outcome,
|
|
206
|
-
readiness: "accepted",
|
|
207
|
-
profile: "project_management",
|
|
208
|
-
requirement_refs: evidence.requirement_refs,
|
|
209
|
-
evidence_refs: evidence.evidence_refs,
|
|
210
|
-
checks: evidence.checks,
|
|
211
|
-
changed_surfaces: evidence.changed_surfaces,
|
|
212
|
-
task_digest: evidence.task_digest,
|
|
213
|
-
source_revision: evidence.source_revision,
|
|
214
|
-
provenance_digest: signature,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
id: `regression_case.continuity.${suffix}`,
|
|
218
|
-
kind: "regression_case",
|
|
219
|
-
title: `Verified reusable case ${suffix}`,
|
|
220
|
-
summary: evidence.outcome,
|
|
221
|
-
readiness: "accepted",
|
|
222
|
-
profile: "implementation_control",
|
|
223
|
-
case_signature: evidence.case_signature,
|
|
224
|
-
requirement_refs: evidence.requirement_refs,
|
|
225
|
-
evidence_refs: [`evidence.continuity.${suffix}`],
|
|
226
|
-
task_digest: evidence.task_digest,
|
|
227
|
-
boundary,
|
|
228
|
-
provenance_digest: signature,
|
|
229
|
-
},
|
|
230
|
-
];
|
|
231
|
-
const proposals = evidence.decisions.map((decision, index) => ({
|
|
232
|
-
id: `decision.proposal.${digest({ signature, decision, index }).slice(7, 23)}`,
|
|
233
|
-
kind: "decision",
|
|
234
|
-
title: `Decision proposal ${index + 1}`,
|
|
235
|
-
summary: decision.summary,
|
|
236
|
-
readiness: decision.approval_ref && !decision.changes_architecture ? "accepted" : "proposal",
|
|
237
|
-
profile: "project_management",
|
|
238
|
-
owner_ref: decision.owner_ref,
|
|
239
|
-
approval_ref: decision.approval_ref,
|
|
240
|
-
source_evidence_ref: `evidence.continuity.${suffix}`,
|
|
241
|
-
}));
|
|
242
|
-
if (evidence.method_candidate) {
|
|
243
|
-
const relatedCaseMap = new Map([...existing, ...promoted]
|
|
244
|
-
.filter((item) => item.kind === "regression_case" && item.case_signature === evidence.case_signature)
|
|
245
|
-
.map((item) => [item.id, item]));
|
|
246
|
-
const relatedCases = [...relatedCaseMap.values()];
|
|
247
|
-
const independentTasks = unique(relatedCases.map((item) => item.task_digest));
|
|
248
|
-
proposals.push({
|
|
249
|
-
id: `lesson.continuity.${digest(evidence.case_signature).slice(7, 23)}`,
|
|
250
|
-
kind: "lesson",
|
|
251
|
-
title: `Reusable method ${evidence.case_signature}`,
|
|
252
|
-
summary: evidence.method_candidate,
|
|
253
|
-
readiness: independentTasks.length >= 2 ? "accepted" : "proposal",
|
|
254
|
-
profile: "project_management",
|
|
255
|
-
case_signature: evidence.case_signature,
|
|
256
|
-
supporting_case_ids: unique(relatedCases.map((item) => item.id)),
|
|
257
|
-
auto_promotion_rule: "two_independent_verified_cases_without_architecture_change",
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return { promoted, proposals };
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function mergeObjects(existing, additions) {
|
|
264
|
-
const map = new Map(existing.map((item) => [item.id, item]));
|
|
265
|
-
for (const item of additions) map.set(item.id, item);
|
|
266
|
-
return [...map.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function ensureManifestReference(manifest) {
|
|
270
|
-
const next = JSON.parse(JSON.stringify(manifest));
|
|
271
|
-
next.graph = next.graph || {};
|
|
272
|
-
next.graph.source_of_truth = unique([...(next.graph.source_of_truth || []), "graph/specs"]);
|
|
273
|
-
next.graph.objects = unique([...(next.graph.objects || []), CONTINUITY_FILE]);
|
|
274
|
-
next.graph.generated = unique([...(next.graph.generated || []), CONTEXT_PROJECTION_FILE]);
|
|
275
|
-
next.extensions = next.extensions || {};
|
|
276
|
-
next.extensions["mirai.project_technology"] = {
|
|
277
|
-
...(next.extensions["mirai.project_technology"] || {}),
|
|
278
|
-
continuity_policy: "task_boundary",
|
|
279
|
-
};
|
|
280
|
-
return next;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function contextProjection(manifest, objects, currentDigest) {
|
|
284
|
-
const accepted = objects.filter((item) => item.readiness === "accepted");
|
|
285
|
-
const proposals = objects.filter((item) => item.readiness === "proposal");
|
|
286
|
-
const lines = [
|
|
287
|
-
`# ${manifest.title || manifest.id}: project context`,
|
|
288
|
-
"",
|
|
289
|
-
"> Generated from `graph/specs`. This document is a readable projection, not a source of truth.",
|
|
290
|
-
"",
|
|
291
|
-
`Graph digest: \`${currentDigest}\``,
|
|
292
|
-
"",
|
|
293
|
-
"## Accepted context",
|
|
294
|
-
"",
|
|
295
|
-
...(accepted.length ? accepted.map((item) => `- **${item.title}** — ${item.summary}`) : ["- No accepted continuity records yet."]),
|
|
296
|
-
"",
|
|
297
|
-
"## Proposals requiring a decision",
|
|
298
|
-
"",
|
|
299
|
-
...(proposals.length ? proposals.map((item) => `- **${item.title}** — ${item.summary}`) : ["- None."]),
|
|
300
|
-
"",
|
|
301
|
-
];
|
|
302
|
-
return `${lines.join("\n")}\n`;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function lock(repo, root) {
|
|
306
|
-
const gitBacked = fs.existsSync(path.join(repo, ".git"));
|
|
307
|
-
const file = gitBacked ? path.join(root, "continuity.lock") : path.join(repo, "graph", ".project-technology-continuity.lock");
|
|
308
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
309
|
-
try {
|
|
310
|
-
const fd = fs.openSync(file, "wx", 0o600);
|
|
311
|
-
fs.writeFileSync(fd, canonicalBytes({ pid: process.pid }));
|
|
312
|
-
fs.closeSync(fd);
|
|
313
|
-
return { file, acquired: true };
|
|
314
|
-
} catch (_) { return { file, acquired: false }; }
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function releaseLock(entry) {
|
|
318
|
-
if (entry?.acquired) try { fs.unlinkSync(entry.file); } catch (_) { /* already removed */ }
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function sync(repoArg, manifest, boundary, input, options = {}) {
|
|
322
|
-
const repo = path.resolve(repoArg || ".");
|
|
323
|
-
if (!BOUNDARIES.has(boundary)) return { status: "fail", changed: false, blockers: ["continuity_boundary_invalid"] };
|
|
324
|
-
if (boundary === "task_start") return {
|
|
325
|
-
status: "success", changed: false, blockers: [], continuity: { ...status(repo, manifest, options), input_digest: input ? digest(input) : null, omissions: ["task_start_is_read_only"] },
|
|
326
|
-
};
|
|
327
|
-
const normalized = normalizeEvidence(input);
|
|
328
|
-
if (normalized.blockers.length) return { status: "blocked", changed: false, blockers: normalized.blockers };
|
|
329
|
-
const beforeDigest = graphDigest(repo);
|
|
330
|
-
if (options.expectedGraphDigest && options.expectedGraphDigest !== beforeDigest) return { status: "blocked", changed: false, blockers: ["continuity_compare_and_swap_conflict"] };
|
|
331
|
-
const root = stateRoot(repo, manifest, options);
|
|
332
|
-
const lease = lock(repo, root);
|
|
333
|
-
if (!lease.acquired) return { status: "blocked", changed: false, blockers: ["continuity_lease_conflict"] };
|
|
334
|
-
const manifestPath = path.join(repo, "graph.json");
|
|
335
|
-
const continuityPath = path.join(repo, CONTINUITY_FILE);
|
|
336
|
-
const projectionPath = path.join(repo, CONTEXT_PROJECTION_FILE);
|
|
337
|
-
const manifestBefore = fs.readFileSync(manifestPath);
|
|
338
|
-
const continuityBefore = fs.existsSync(continuityPath) ? fs.readFileSync(continuityPath) : null;
|
|
339
|
-
const projectionBefore = fs.existsSync(projectionPath) ? fs.readFileSync(projectionPath) : null;
|
|
340
|
-
try {
|
|
341
|
-
if (graphDigest(repo) !== beforeDigest) return { status: "blocked", changed: false, blockers: ["continuity_compare_and_swap_conflict"] };
|
|
342
|
-
const existing = readObjects(repo);
|
|
343
|
-
const built = buildCandidates(existing, normalized.evidence, boundary);
|
|
344
|
-
const objects = mergeObjects(existing, [...built.promoted, ...built.proposals]);
|
|
345
|
-
const nextManifest = ensureManifestReference(manifest);
|
|
346
|
-
const backupId = digest({ beforeDigest, task: normalized.evidence.task_digest }).slice(7, 23);
|
|
347
|
-
const backupRoot = path.join(root, "rollback", backupId);
|
|
348
|
-
atomicWrite(path.join(backupRoot, "graph.json"), manifestBefore);
|
|
349
|
-
if (continuityBefore) atomicWrite(path.join(backupRoot, "project-continuity.json"), continuityBefore);
|
|
350
|
-
if (projectionBefore) atomicWrite(path.join(backupRoot, "project-context.md"), projectionBefore);
|
|
351
|
-
const manifestChanged = atomicWrite(manifestPath, canonicalBytes(nextManifest));
|
|
352
|
-
const continuityChanged = atomicWrite(continuityPath, canonicalBytes({ schema_version: "1.0.0", objects }));
|
|
353
|
-
const currentDigest = graphDigest(repo);
|
|
354
|
-
const projectionChanged = atomicWrite(projectionPath, contextProjection(nextManifest, objects, currentDigest));
|
|
355
|
-
const receiptBase = {
|
|
356
|
-
contract: "project-continuity-receipt",
|
|
357
|
-
contract_version: "1.0.0",
|
|
358
|
-
repository_id: nextManifest.id,
|
|
359
|
-
boundary,
|
|
360
|
-
task_digest: normalized.evidence.task_digest,
|
|
361
|
-
input_digest: digest(normalized.evidence),
|
|
362
|
-
previous_graph_digest: beforeDigest,
|
|
363
|
-
current_graph_digest: currentDigest,
|
|
364
|
-
saved_refs: built.promoted.map((item) => item.id).sort(),
|
|
365
|
-
proposals: built.proposals.filter((item) => item.readiness === "proposal").map((item) => item.id).sort(),
|
|
366
|
-
omissions: [],
|
|
367
|
-
freshness: "current",
|
|
368
|
-
rollback_ref: `host-local://${graphIdentity(repo, nextManifest)}/rollback/${backupId}`,
|
|
369
|
-
};
|
|
370
|
-
const receipt = { ...receiptBase, receipt_digest: digest(receiptBase) };
|
|
371
|
-
const receiptName = `receipts/${receipt.receipt_digest.slice(7)}.json`;
|
|
372
|
-
atomicWrite(path.join(root, receiptName), canonicalBytes(receipt));
|
|
373
|
-
atomicWrite(path.join(root, "latest-receipt.json"), canonicalBytes({ receipt_ref: receiptName, receipt_digest: receipt.receipt_digest }));
|
|
374
|
-
const readback = readJson(continuityPath);
|
|
375
|
-
if (!readback || graphDigest(repo) !== currentDigest) throw new Error("continuity_readback_failed");
|
|
376
|
-
return { status: "success", changed: manifestChanged || continuityChanged || projectionChanged, blockers: [], continuity: { ...status(repo, nextManifest, options), ...receipt } };
|
|
377
|
-
} catch (_) {
|
|
378
|
-
atomicWrite(manifestPath, manifestBefore);
|
|
379
|
-
if (continuityBefore) atomicWrite(continuityPath, continuityBefore);
|
|
380
|
-
else if (fs.existsSync(continuityPath)) fs.unlinkSync(continuityPath);
|
|
381
|
-
if (projectionBefore) atomicWrite(projectionPath, projectionBefore);
|
|
382
|
-
else if (fs.existsSync(projectionPath)) fs.unlinkSync(projectionPath);
|
|
383
|
-
return { status: "fail", changed: false, blockers: ["continuity_transaction_failed", "continuity_rollback_applied"] };
|
|
384
|
-
} finally { releaseLock(lease); }
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
function verify(repo, manifest, options = {}) {
|
|
388
|
-
const current = status(repo, manifest, options);
|
|
389
|
-
const blockers = [];
|
|
390
|
-
if (current.policy === "task_boundary" && current.freshness !== "current") blockers.push(`continuity_${current.freshness}`);
|
|
391
|
-
if (options.receiptDigest && current.terminal_receipt?.receipt_digest !== options.receiptDigest) blockers.push("continuity_receipt_digest_mismatch");
|
|
392
|
-
for (const object of readObjects(repo)) {
|
|
393
|
-
if (!object.id || !object.kind || !object.title || !object.summary || !object.readiness || !object.profile) blockers.push("continuity_object_incomplete");
|
|
394
|
-
if (SECRET_PATTERN.test(JSON.stringify(object)) || PRIVATE_PATH_PATTERN.test(JSON.stringify(object)) || HOST_PATH_PATTERN.test(JSON.stringify(object))) blockers.push("continuity_object_contains_sensitive_or_host_data");
|
|
395
|
-
if (["decision", "goal"].includes(object.kind) && object.readiness === "accepted" && !object.approval_ref && object.id.includes("proposal")) blockers.push("continuity_proposal_promoted_without_approval");
|
|
396
|
-
}
|
|
397
|
-
return { status: blockers.length ? "blocked" : "success", blockers: unique(blockers), continuity: current };
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
module.exports = {
|
|
401
|
-
BOUNDARIES,
|
|
402
|
-
CONTINUITY_FILE,
|
|
403
|
-
CONTEXT_PROJECTION_FILE,
|
|
404
|
-
canonicalBytes,
|
|
405
|
-
continuityPolicy,
|
|
406
|
-
digest,
|
|
407
|
-
graphDigest,
|
|
408
|
-
latestReceipt,
|
|
409
|
-
normalizeEvidence,
|
|
410
|
-
stateRoot,
|
|
411
|
-
status,
|
|
412
|
-
sync,
|
|
413
|
-
verify,
|
|
414
|
-
};
|