agentera 3.0.0-dev.3 → 3.0.0-dev.31
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/LICENSE +201 -0
- package/README.md +96 -6
- package/bundle/.agentera-npx-bundle.json +1 -1
- package/bundle/CHANGELOG.md +1144 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +136 -0
- package/bundle/UPGRADE.md +201 -0
- package/bundle/extract-corpus-parity.json +21 -0
- package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
- package/bundle/references/adapters/package-manifest-interface-model.yaml +42 -252
- package/bundle/references/adapters/package-registry.yaml +20 -188
- package/bundle/references/adapters/package-surface-characterization.md +36 -37
- package/bundle/references/adapters/runtime-lifecycle-adapters.yaml +74 -0
- package/bundle/references/adapters/runtime-lifecycle-authority.yaml +62 -0
- package/bundle/references/adapters/runtime-lifecycle-operation-contract.yaml +84 -0
- package/bundle/references/adapters/runtime-retired-resources.yaml +97 -0
- package/bundle/references/analysis/benchmark.md +10 -6
- package/bundle/references/analysis/evidence-tier-authority.yaml +516 -0
- package/bundle/references/analysis/startup-measurement-contract.yaml +37 -26
- package/bundle/references/analysis/verification-policy.yaml +142 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +9 -8
- package/bundle/references/artifacts/state-storage-authority.yaml +2167 -0
- package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
- package/bundle/references/cli/agent-ready-state-contract.yaml +64 -81
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +7 -8
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +58 -29
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +12 -49
- package/bundle/references/cli/capability-instruction-contract.yaml +96 -58
- package/bundle/references/cli/capability-instruction-structure.md +144 -0
- package/bundle/references/cli/capability-tool-classification.yaml +14 -14
- package/bundle/references/cli/coexistence-probe.yaml +13 -0
- package/bundle/references/cli/hybrid-route-contract.yaml +416 -0
- package/bundle/references/cli/parity-expected-actual-template.md +30 -0
- package/bundle/references/cli/prime-consumer-compatibility.yaml +651 -0
- package/bundle/references/cli/routing-execution-vocabulary.yaml +16 -38
- package/bundle/references/cli/routing-model.md +139 -0
- package/bundle/references/cli/single-name-protocol.yaml +42 -0
- package/bundle/references/cli/trigger-schema-enrichment.md +140 -0
- package/bundle/references/cli/update-channels.yaml +45 -7
- package/bundle/references/cli/upgrade-repair-wording.md +25 -0
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +97 -0
- package/bundle/references/cli/vocabulary-index.yaml +23 -18
- package/bundle/references/cli/vocabulary.md +346 -331
- package/bundle/references/meta/documentation-inventory.md +10 -3
- package/bundle/registry.json +14 -14
- package/bundle/skills/agentera/SKILL.md +182 -407
- package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +84 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +25 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +20 -19
- package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +85 -0
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +3 -3
- package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +27 -0
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/validation.yaml +16 -16
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +12 -12
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +5 -5
- package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +49 -0
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +20 -0
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/validation.yaml +9 -8
- package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +80 -0
- package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +18 -18
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +17 -17
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +9 -9
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +76 -0
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +9 -7
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +121 -0
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +63 -0
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +89 -0
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/artifacts.yaml +4 -4
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +3 -3
- package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +20 -0
- package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +85 -0
- package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +24 -0
- package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +72 -0
- package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +22 -0
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +16 -16
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +18 -20
- package/bundle/skills/agentera/capability_schema_contract.yaml +200 -37
- package/bundle/skills/agentera/protocol.yaml +31 -31
- package/bundle/skills/agentera/references/contract.md +387 -329
- package/bundle/skills/agentera/route-phrases.yaml +81 -0
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +5 -4
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +40 -22
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +5 -4
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +15 -19
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +145 -14
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +58 -21
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +22 -8
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +327 -15
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +51 -53
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +257 -28
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
- package/dist/analytics/extractCorpus/cli.js +191 -0
- package/dist/analytics/extractCorpus/cli.js.map +1 -0
- package/dist/analytics/extractCorpus/copilotSessions.js +276 -0
- package/dist/analytics/extractCorpus/copilotSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/core.js +393 -0
- package/dist/analytics/extractCorpus/core.js.map +1 -0
- package/dist/analytics/extractCorpus/corpus.js +168 -0
- package/dist/analytics/extractCorpus/corpus.js.map +1 -0
- package/dist/analytics/extractCorpus/coverageAudit.js +261 -0
- package/dist/analytics/extractCorpus/coverageAudit.js.map +1 -0
- package/dist/analytics/extractCorpus/cursorSessions.js +426 -0
- package/dist/analytics/extractCorpus/cursorSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/evidenceTiers.js +561 -0
- package/dist/analytics/extractCorpus/evidenceTiers.js.map +1 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +106 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js.map +1 -0
- package/dist/analytics/extractCorpus/filesystemSources.js +119 -0
- package/dist/analytics/extractCorpus/filesystemSources.js.map +1 -0
- package/dist/analytics/extractCorpus/index.js +15 -0
- package/dist/analytics/extractCorpus/index.js.map +1 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js +205 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js +44 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js +368 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/tierReader.js +109 -0
- package/dist/analytics/extractCorpus/tierReader.js.map +1 -0
- package/dist/analytics/extractCorpus.js +2 -1790
- package/dist/analytics/extractCorpus.js.map +1 -1
- package/dist/analytics/profileSignals.js +212 -0
- package/dist/analytics/profileSignals.js.map +1 -0
- package/dist/analytics/usageStats.js +191 -41
- package/dist/analytics/usageStats.js.map +1 -1
- package/dist/bin/agentera.js +3 -1
- package/dist/bin/agentera.js.map +1 -1
- package/dist/capabilities/audit/instructions.js +16 -0
- package/dist/capabilities/audit/instructions.js.map +1 -0
- package/dist/capabilities/build/instructions.js +18 -0
- package/dist/capabilities/build/instructions.js.map +1 -0
- package/dist/capabilities/design/instructions.js +5 -0
- package/dist/capabilities/design/instructions.js.map +1 -0
- package/dist/capabilities/discuss/instructions.js +16 -0
- package/dist/capabilities/discuss/instructions.js.map +1 -0
- package/dist/capabilities/document/instructions.js +12 -0
- package/dist/capabilities/document/instructions.js.map +1 -0
- package/dist/capabilities/index.js +39 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/optimize/instructions.js +14 -0
- package/dist/capabilities/optimize/instructions.js.map +1 -0
- package/dist/capabilities/orchestrate/instructions.js +41 -0
- package/dist/capabilities/orchestrate/instructions.js.map +1 -0
- package/dist/capabilities/plan/instructions.js +15 -0
- package/dist/capabilities/plan/instructions.js.map +1 -0
- package/dist/capabilities/profile/instructions.js +5 -0
- package/dist/capabilities/profile/instructions.js.map +1 -0
- package/dist/capabilities/research/instructions.js +6 -0
- package/dist/capabilities/research/instructions.js.map +1 -0
- package/dist/capabilities/status/instructions.js +5 -0
- package/dist/capabilities/status/instructions.js.map +1 -0
- package/dist/capabilities/status/startupInstructions.js +39 -0
- package/dist/capabilities/status/startupInstructions.js.map +1 -0
- package/dist/capabilities/vision/instructions.js +5 -0
- package/dist/capabilities/vision/instructions.js.map +1 -0
- package/dist/cli/appContext.js +30 -23
- package/dist/cli/appContext.js.map +1 -1
- package/dist/cli/argvalidate.js.map +1 -1
- package/dist/cli/capabilityContext/benchmark.js +564 -0
- package/dist/cli/capabilityContext/benchmark.js.map +1 -0
- package/dist/cli/capabilityContext/bespoke.js +44 -0
- package/dist/cli/capabilityContext/bespoke.js.map +1 -0
- package/dist/cli/capabilityContext/build.js +191 -0
- package/dist/cli/capabilityContext/build.js.map +1 -0
- package/dist/cli/capabilityContext/closeout.js +231 -0
- package/dist/cli/capabilityContext/closeout.js.map +1 -0
- package/dist/cli/capabilityContext/contract.js +214 -0
- package/dist/cli/capabilityContext/contract.js.map +1 -0
- package/dist/cli/capabilityContext/evidence.js +469 -0
- package/dist/cli/capabilityContext/evidence.js.map +1 -0
- package/dist/cli/capabilityContext/index.js +4 -0
- package/dist/cli/capabilityContext/index.js.map +1 -0
- package/dist/cli/capabilityContext/orchestration.js +128 -0
- package/dist/cli/capabilityContext/orchestration.js.map +1 -0
- package/dist/cli/capabilityContext/planState.js +280 -0
- package/dist/cli/capabilityContext/planState.js.map +1 -0
- package/dist/cli/capabilityContext/progress.js +143 -0
- package/dist/cli/capabilityContext/progress.js.map +1 -0
- package/dist/cli/capabilityContext/shared.js +100 -0
- package/dist/cli/capabilityContext/shared.js.map +1 -0
- package/dist/cli/capabilityContext/slim.js +153 -0
- package/dist/cli/capabilityContext/slim.js.map +1 -0
- package/dist/cli/capabilityContext/startup.js +257 -0
- package/dist/cli/capabilityContext/startup.js.map +1 -0
- package/dist/cli/capabilityContext/types.js +51 -0
- package/dist/cli/capabilityContext/types.js.map +1 -0
- package/dist/cli/capabilityContext.js +1 -2420
- package/dist/cli/capabilityContext.js.map +1 -1
- package/dist/cli/commands/appHome.js +23 -0
- package/dist/cli/commands/appHome.js.map +1 -0
- package/dist/cli/commands/capability.js +3 -10
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/cli/commands/compact.js +41 -12
- package/dist/cli/commands/compact.js.map +1 -1
- package/dist/cli/commands/doctor.js +59 -97
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/durability.js +82 -0
- package/dist/cli/commands/durability.js.map +1 -0
- package/dist/cli/commands/entityMigrate.js +132 -0
- package/dist/cli/commands/entityMigrate.js.map +1 -0
- package/dist/cli/commands/lint.js +26 -43
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/prime/briefOrientation.js +592 -0
- package/dist/cli/commands/prime/briefOrientation.js.map +1 -0
- package/dist/cli/commands/prime/bundleStatus.js +191 -0
- package/dist/cli/commands/prime/bundleStatus.js.map +1 -0
- package/dist/cli/commands/prime/collectEntityOrientation.js +266 -0
- package/dist/cli/commands/prime/collectEntityOrientation.js.map +1 -0
- package/dist/cli/commands/prime/collectOrientationState.js +180 -0
- package/dist/cli/commands/prime/collectOrientationState.js.map +1 -0
- package/dist/cli/commands/prime/orientationOutput.js +360 -0
- package/dist/cli/commands/prime/orientationOutput.js.map +1 -0
- package/dist/cli/commands/prime/types.js +2 -0
- package/dist/cli/commands/prime/types.js.map +1 -0
- package/dist/cli/commands/prime/v1Migration.js +39 -0
- package/dist/cli/commands/prime/v1Migration.js.map +1 -0
- package/dist/cli/commands/prime.js +61 -556
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/query.js +66 -51
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/report.js +100 -24
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/route.js +142 -0
- package/dist/cli/commands/route.js.map +1 -0
- package/dist/cli/commands/schema.js +260 -78
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/decisions.js +388 -0
- package/dist/cli/commands/state/decisions.js.map +1 -0
- package/dist/cli/commands/state/docs.js +71 -0
- package/dist/cli/commands/state/docs.js.map +1 -0
- package/dist/cli/commands/state/experimentRecords.js +139 -0
- package/dist/cli/commands/state/experimentRecords.js.map +1 -0
- package/dist/cli/commands/state/experiments.js +15 -0
- package/dist/cli/commands/state/experiments.js.map +1 -0
- package/dist/cli/commands/state/get.js +127 -0
- package/dist/cli/commands/state/get.js.map +1 -0
- package/dist/cli/commands/state/health.js +15 -0
- package/dist/cli/commands/state/health.js.map +1 -0
- package/dist/cli/commands/state/index.js +60 -0
- package/dist/cli/commands/state/index.js.map +1 -0
- package/dist/cli/commands/state/list.js +176 -0
- package/dist/cli/commands/state/list.js.map +1 -0
- package/dist/cli/commands/state/objective.js +26 -0
- package/dist/cli/commands/state/objective.js.map +1 -0
- package/dist/cli/commands/state/plan.js +15 -0
- package/dist/cli/commands/state/plan.js.map +1 -0
- package/dist/cli/commands/state/planTasks.js +142 -0
- package/dist/cli/commands/state/planTasks.js.map +1 -0
- package/dist/cli/commands/state/plans.js +143 -0
- package/dist/cli/commands/state/plans.js.map +1 -0
- package/dist/cli/commands/state/progress.js +14 -0
- package/dist/cli/commands/state/progress.js.map +1 -0
- package/dist/cli/commands/state/shared.js +15 -0
- package/dist/cli/commands/state/shared.js.map +1 -0
- package/dist/cli/commands/state/todo.js +42 -0
- package/dist/cli/commands/state/todo.js.map +1 -0
- package/dist/cli/commands/state/write.js +418 -0
- package/dist/cli/commands/state/write.js.map +1 -0
- package/dist/cli/commands/upgrade.js +146 -4
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/upgradeVerify.js +119 -0
- package/dist/cli/commands/upgradeVerify.js.map +1 -0
- package/dist/cli/commands/validate.js +133 -210
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/verify.js +30 -8
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/contracts/bundleStatus.js +2 -0
- package/dist/cli/contracts/bundleStatus.js.map +1 -0
- package/dist/cli/contracts/orientationState.js +2 -0
- package/dist/cli/contracts/orientationState.js.map +1 -0
- package/dist/cli/dispatch/argvParser.js +33 -0
- package/dist/cli/dispatch/argvParser.js.map +1 -0
- package/dist/cli/dispatch/check.js +390 -0
- package/dist/cli/dispatch/check.js.map +1 -0
- package/dist/cli/dispatch/commands.js +27 -0
- package/dist/cli/dispatch/commands.js.map +1 -0
- package/dist/cli/dispatch/index.js +226 -0
- package/dist/cli/dispatch/index.js.map +1 -0
- package/dist/cli/dispatch/lifecycle.js +653 -0
- package/dist/cli/dispatch/lifecycle.js.map +1 -0
- package/dist/cli/dispatch/prime.js +119 -0
- package/dist/cli/dispatch/prime.js.map +1 -0
- package/dist/cli/dispatch/shared.js +64 -0
- package/dist/cli/dispatch/shared.js.map +1 -0
- package/dist/cli/dispatch/state.js +174 -0
- package/dist/cli/dispatch/state.js.map +1 -0
- package/dist/cli/dispatch.js +1 -957
- package/dist/cli/dispatch.js.map +1 -1
- package/dist/cli/errors.js +53 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/help.js +419 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/migrationRequired.js +87 -0
- package/dist/cli/migrationRequired.js.map +1 -0
- package/dist/cli/orientation/attention.js +67 -0
- package/dist/cli/orientation/attention.js.map +1 -0
- package/dist/cli/orientation/corpusCoverage.js +103 -0
- package/dist/cli/orientation/corpusCoverage.js.map +1 -0
- package/dist/cli/orientation.js +407 -159
- package/dist/cli/orientation.js.map +1 -1
- package/dist/cli/planArtifacts.js +351 -0
- package/dist/cli/planArtifacts.js.map +1 -0
- package/dist/cli/planEvidence.js +158 -0
- package/dist/cli/planEvidence.js.map +1 -0
- package/dist/cli/planLifecycleState.js +34 -0
- package/dist/cli/planLifecycleState.js.map +1 -0
- package/dist/cli/planTaskIndex.js +12 -0
- package/dist/cli/planTaskIndex.js.map +1 -0
- package/dist/cli/prime-blob.js +69 -2
- package/dist/cli/prime-blob.js.map +1 -1
- package/dist/cli/startupCompletenessContract.js +57 -0
- package/dist/cli/startupCompletenessContract.js.map +1 -0
- package/dist/cli/stateQuery.js +63 -10
- package/dist/cli/stateQuery.js.map +1 -1
- package/dist/cli/structured.js.map +1 -1
- package/dist/cli/todoMarkdown.js +33 -0
- package/dist/cli/todoMarkdown.js.map +1 -0
- package/dist/cli/todoReadinessSelection.js +157 -0
- package/dist/cli/todoReadinessSelection.js.map +1 -0
- package/dist/cli/todoSeverity.js +19 -0
- package/dist/cli/todoSeverity.js.map +1 -0
- package/dist/core/atomicWriter.js +21 -0
- package/dist/core/atomicWriter.js.map +1 -0
- package/dist/core/difflib.js.map +1 -1
- package/dist/core/envPaths.js +21 -0
- package/dist/core/envPaths.js.map +1 -0
- package/dist/core/jsonValue.js +6 -0
- package/dist/core/jsonValue.js.map +1 -0
- package/dist/core/paths.js.map +1 -1
- package/dist/core/pyjson.js +67 -2
- package/dist/core/pyjson.js.map +1 -1
- package/dist/core/skillIdentity.js +24 -0
- package/dist/core/skillIdentity.js.map +1 -0
- package/dist/core/sourceRoot.js.map +1 -1
- package/dist/core/text.js +11 -0
- package/dist/core/text.js.map +1 -0
- package/dist/core/toml.js.map +1 -1
- package/dist/core/yaml.js +8 -0
- package/dist/core/yaml.js.map +1 -1
- package/dist/eval/evalSkills.js +30 -25
- package/dist/eval/evalSkills.js.map +1 -1
- package/dist/eval/hybridRouteEvaluation.js +156 -0
- package/dist/eval/hybridRouteEvaluation.js.map +1 -0
- package/dist/eval/semanticEval.js +43 -19
- package/dist/eval/semanticEval.js.map +1 -1
- package/dist/eval/semanticFixtures.js +16 -4
- package/dist/eval/semanticFixtures.js.map +1 -1
- package/dist/hooks/common.js +10 -27
- package/dist/hooks/common.js.map +1 -1
- package/dist/hooks/compaction/apply.js +447 -0
- package/dist/hooks/compaction/apply.js.map +1 -0
- package/dist/hooks/compaction/dryRun.js +185 -0
- package/dist/hooks/compaction/dryRun.js.map +1 -0
- package/dist/hooks/compaction/index.js +23 -0
- package/dist/hooks/compaction/index.js.map +1 -0
- package/dist/hooks/compaction/parse.js +326 -0
- package/dist/hooks/compaction/parse.js.map +1 -0
- package/dist/hooks/compaction/retention.js +203 -0
- package/dist/hooks/compaction/retention.js.map +1 -0
- package/dist/hooks/compaction/status.js +361 -0
- package/dist/hooks/compaction/status.js.map +1 -0
- package/dist/hooks/compaction/types.js +6 -0
- package/dist/hooks/compaction/types.js.map +1 -0
- package/dist/hooks/cursorPreToolUse.js +1 -1
- package/dist/hooks/cursorPreToolUse.js.map +1 -1
- package/dist/hooks/cursorSessionStart.js +14 -21
- package/dist/hooks/cursorSessionStart.js.map +1 -1
- package/dist/hooks/projectHookInput.js +26 -0
- package/dist/hooks/projectHookInput.js.map +1 -0
- package/dist/hooks/sessionStart.js +55 -170
- package/dist/hooks/sessionStart.js.map +1 -1
- package/dist/hooks/sessionStop.js +12 -26
- package/dist/hooks/sessionStop.js.map +1 -1
- package/dist/hooks/validateArtifact/agentFacing.js +10 -0
- package/dist/hooks/validateArtifact/agentFacing.js.map +1 -0
- package/dist/hooks/validateArtifact/index.js +151 -0
- package/dist/hooks/validateArtifact/index.js.map +1 -0
- package/dist/hooks/validateArtifact/markdown.js +146 -0
- package/dist/hooks/validateArtifact/markdown.js.map +1 -0
- package/dist/hooks/validateArtifact/runtime.js +86 -0
- package/dist/hooks/validateArtifact/runtime.js.map +1 -0
- package/dist/hooks/validateArtifact/schema.js +541 -0
- package/dist/hooks/validateArtifact/schema.js.map +1 -0
- package/dist/hooks/validateArtifact/traversal.js +108 -0
- package/dist/hooks/validateArtifact/traversal.js.map +1 -0
- package/dist/hooks/validateArtifact/violations.js +108 -0
- package/dist/hooks/validateArtifact/violations.js.map +1 -0
- package/dist/migrate/v2HandoffManifest.js +455 -0
- package/dist/migrate/v2HandoffManifest.js.map +1 -0
- package/dist/registries/artifactProtocolIds.js +77 -0
- package/dist/registries/artifactProtocolIds.js.map +1 -0
- package/dist/registries/artifactRegistry.js +222 -62
- package/dist/registries/artifactRegistry.js.map +1 -1
- package/dist/registries/capabilityContract.js +141 -12
- package/dist/registries/capabilityContract.js.map +1 -1
- package/dist/registries/evaluatorHandoffContract.js +171 -0
- package/dist/registries/evaluatorHandoffContract.js.map +1 -0
- package/dist/registries/evidenceTierContract.js +362 -0
- package/dist/registries/evidenceTierContract.js.map +1 -0
- package/dist/registries/hybridRoute.js +203 -0
- package/dist/registries/hybridRoute.js.map +1 -0
- package/dist/registries/hybridRouteReceipt.js +221 -0
- package/dist/registries/hybridRouteReceipt.js.map +1 -0
- package/dist/registries/packageRegistry.js +90 -230
- package/dist/registries/packageRegistry.js.map +1 -1
- package/dist/registries/todoReadinessContract.js +406 -0
- package/dist/registries/todoReadinessContract.js.map +1 -0
- package/dist/registries/triggerLoader.js +175 -0
- package/dist/registries/triggerLoader.js.map +1 -0
- package/dist/registries/verbosityBudgetContract.js +206 -0
- package/dist/registries/verbosityBudgetContract.js.map +1 -0
- package/dist/release/releaseMetadata.js +319 -0
- package/dist/release/releaseMetadata.js.map +1 -0
- package/dist/runtime/lifecycleAdapterContract.js +458 -0
- package/dist/runtime/lifecycleAdapterContract.js.map +1 -0
- package/dist/runtime/lifecycleAdapters.js +778 -0
- package/dist/runtime/lifecycleAdapters.js.map +1 -0
- package/dist/runtime/lifecycleAuthority.js +454 -0
- package/dist/runtime/lifecycleAuthority.js.map +1 -0
- package/dist/runtime/lifecycleOperationContract.js +114 -0
- package/dist/runtime/lifecycleOperationContract.js.map +1 -0
- package/dist/runtime/lifecycleOperations.js +635 -0
- package/dist/runtime/lifecycleOperations.js.map +1 -0
- package/dist/runtime/lifecycleOwnershipJournal.js +623 -0
- package/dist/runtime/lifecycleOwnershipJournal.js.map +1 -0
- package/dist/runtime/lifecyclePublication.js +416 -0
- package/dist/runtime/lifecyclePublication.js.map +1 -0
- package/dist/runtime/lifecycleSnapshot.js +439 -0
- package/dist/runtime/lifecycleSnapshot.js.map +1 -0
- package/dist/runtime/nativeResourceCleanup.js +317 -0
- package/dist/runtime/nativeResourceCleanup.js.map +1 -0
- package/dist/setup/codex/cli.js +130 -0
- package/dist/setup/codex/cli.js.map +1 -0
- package/dist/setup/codex/configToml.js +558 -0
- package/dist/setup/codex/configToml.js.map +1 -0
- package/dist/setup/codex/constants.js +14 -0
- package/dist/setup/codex/constants.js.map +1 -0
- package/dist/setup/codex/installRoot.js +64 -0
- package/dist/setup/codex/installRoot.js.map +1 -0
- package/dist/setup/codex/state.js +252 -0
- package/dist/setup/codex/state.js.map +1 -0
- package/dist/setup/codex.js +9 -1055
- package/dist/setup/codex.js.map +1 -1
- package/dist/setup/opencode.js +21 -0
- package/dist/setup/opencode.js.map +1 -0
- package/dist/setup/opencodeConstants.js +2 -0
- package/dist/setup/opencodeConstants.js.map +1 -0
- package/dist/setup/sharedSkill.js +46 -0
- package/dist/setup/sharedSkill.js.map +1 -0
- package/dist/setup/smokeChecks.js +82 -0
- package/dist/setup/smokeChecks.js.map +1 -0
- package/dist/state/archiveDiscovery.js +578 -0
- package/dist/state/archiveDiscovery.js.map +1 -0
- package/dist/state/archivePublication.js +226 -0
- package/dist/state/archivePublication.js.map +1 -0
- package/dist/state/archiveRecovery.js +238 -0
- package/dist/state/archiveRecovery.js.map +1 -0
- package/dist/state/archiveReplay.js +54 -0
- package/dist/state/archiveReplay.js.map +1 -0
- package/dist/state/canonicalMigrationRecord.js +37 -0
- package/dist/state/canonicalMigrationRecord.js.map +1 -0
- package/dist/state/decisionEntities.js +322 -0
- package/dist/state/decisionEntities.js.map +1 -0
- package/dist/state/decisionLegacyValidation.js +216 -0
- package/dist/state/decisionLegacyValidation.js.map +1 -0
- package/dist/state/decisionMigrationProvenance.js +117 -0
- package/dist/state/decisionMigrationProvenance.js.map +1 -0
- package/dist/state/decisionOverlay.js +278 -0
- package/dist/state/decisionOverlay.js.map +1 -0
- package/dist/state/decisionRevision.js +632 -0
- package/dist/state/decisionRevision.js.map +1 -0
- package/dist/state/decisionRevisionPublication.js +532 -0
- package/dist/state/decisionRevisionPublication.js.map +1 -0
- package/dist/state/directRetrieval.js +373 -0
- package/dist/state/directRetrieval.js.map +1 -0
- package/dist/state/durability.js +325 -0
- package/dist/state/durability.js.map +1 -0
- package/dist/state/entityCutover.js +294 -0
- package/dist/state/entityCutover.js.map +1 -0
- package/dist/state/entityCutoverGit.js +128 -0
- package/dist/state/entityCutoverGit.js.map +1 -0
- package/dist/state/entityMigrationCausality.js +99 -0
- package/dist/state/entityMigrationCausality.js.map +1 -0
- package/dist/state/entityMigrationPreview.js +864 -0
- package/dist/state/entityMigrationPreview.js.map +1 -0
- package/dist/state/entityPublicationContext.js +662 -0
- package/dist/state/entityPublicationContext.js.map +1 -0
- package/dist/state/entityStorage.js +881 -0
- package/dist/state/entityStorage.js.map +1 -0
- package/dist/state/experimentArchive.js +64 -0
- package/dist/state/experimentArchive.js.map +1 -0
- package/dist/state/experimentIdentity.js +203 -0
- package/dist/state/experimentIdentity.js.map +1 -0
- package/dist/state/experimentRetrieval.js +447 -0
- package/dist/state/experimentRetrieval.js.map +1 -0
- package/dist/state/healthEntities.js +266 -0
- package/dist/state/healthEntities.js.map +1 -0
- package/dist/state/healthEntityValidation.js +19 -0
- package/dist/state/healthEntityValidation.js.map +1 -0
- package/dist/state/healthRepair.js +70 -0
- package/dist/state/healthRepair.js.map +1 -0
- package/dist/state/installRoot.js +64 -24
- package/dist/state/installRoot.js.map +1 -1
- package/dist/state/legacyEntityCutoverEvidence.js +66 -0
- package/dist/state/legacyEntityCutoverEvidence.js.map +1 -0
- package/dist/state/legacyIdentity.js +48 -0
- package/dist/state/legacyIdentity.js.map +1 -0
- package/dist/state/legacySummaryRecord.js +7 -0
- package/dist/state/legacySummaryRecord.js.map +1 -0
- package/dist/state/listAccounting.js +55 -0
- package/dist/state/listAccounting.js.map +1 -0
- package/dist/state/listClassification.js +18 -0
- package/dist/state/listClassification.js.map +1 -0
- package/dist/state/listCursor.js +43 -0
- package/dist/state/listCursor.js.map +1 -0
- package/dist/state/listRetrieval.js +813 -0
- package/dist/state/listRetrieval.js.map +1 -0
- package/dist/state/migrationSourceBinding.js +31 -0
- package/dist/state/migrationSourceBinding.js.map +1 -0
- package/dist/state/objectiveExperimentEntities.js +323 -0
- package/dist/state/objectiveExperimentEntities.js.map +1 -0
- package/dist/state/planEntities.js +444 -0
- package/dist/state/planEntities.js.map +1 -0
- package/dist/state/planIdentity.js +45 -0
- package/dist/state/planIdentity.js.map +1 -0
- package/dist/state/planRetrieval.js +314 -0
- package/dist/state/planRetrieval.js.map +1 -0
- package/dist/state/planTaskRetrieval.js +285 -0
- package/dist/state/planTaskRetrieval.js.map +1 -0
- package/dist/state/progressEntities.js +360 -0
- package/dist/state/progressEntities.js.map +1 -0
- package/dist/state/projectRoot.js +63 -0
- package/dist/state/projectRoot.js.map +1 -0
- package/dist/state/projectionPolicy.js +184 -0
- package/dist/state/projectionPolicy.js.map +1 -0
- package/dist/state/retrievalAuthority.js +343 -0
- package/dist/state/retrievalAuthority.js.map +1 -0
- package/dist/state/safeProjectFile.js +153 -0
- package/dist/state/safeProjectFile.js.map +1 -0
- package/dist/state/startupAnalysis/benchmark.js +433 -0
- package/dist/state/startupAnalysis/benchmark.js.map +1 -0
- package/dist/state/startupAnalysis/contract.js +126 -0
- package/dist/state/startupAnalysis/contract.js.map +1 -0
- package/dist/state/startupAnalysis/helpers.js +287 -0
- package/dist/state/startupAnalysis/helpers.js.map +1 -0
- package/dist/state/startupAnalysis/index.js +7 -0
- package/dist/state/startupAnalysis/index.js.map +1 -0
- package/dist/state/startupAnalysis/metrics.js +341 -0
- package/dist/state/startupAnalysis/metrics.js.map +1 -0
- package/dist/state/startupAnalysis/records.js +199 -0
- package/dist/state/startupAnalysis/records.js.map +1 -0
- package/dist/state/startupAnalysis/report.js +112 -0
- package/dist/state/startupAnalysis/report.js.map +1 -0
- package/dist/state/startupAnalysis/threshold.js +513 -0
- package/dist/state/startupAnalysis/threshold.js.map +1 -0
- package/dist/state/startupAnalysis.js +2 -1952
- package/dist/state/startupAnalysis.js.map +1 -1
- package/dist/state/startupProjection.js +567 -0
- package/dist/state/startupProjection.js.map +1 -0
- package/dist/state/stateMode.js +83 -0
- package/dist/state/stateMode.js.map +1 -0
- package/dist/state/summaryEntityRead.js +26 -0
- package/dist/state/summaryEntityRead.js.map +1 -0
- package/dist/state/summaryMigrationProvenance.js +67 -0
- package/dist/state/summaryMigrationProvenance.js.map +1 -0
- package/dist/state/summarySourceRowAuthority.js +37 -0
- package/dist/state/summarySourceRowAuthority.js.map +1 -0
- package/dist/state/todoDocsEntities.js +267 -0
- package/dist/state/todoDocsEntities.js.map +1 -0
- package/dist/state/todoDocsEntityValidation.js +34 -0
- package/dist/state/todoDocsEntityValidation.js.map +1 -0
- package/dist/state/write/assign.js +21 -0
- package/dist/state/write/assign.js.map +1 -0
- package/dist/state/write/candidateMutation.js +281 -0
- package/dist/state/write/candidateMutation.js.map +1 -0
- package/dist/state/write/errors.js +12 -0
- package/dist/state/write/errors.js.map +1 -0
- package/dist/state/write/experimentPublication.js +193 -0
- package/dist/state/write/experimentPublication.js.map +1 -0
- package/dist/state/write/explain.js +303 -0
- package/dist/state/write/explain.js.map +1 -0
- package/dist/state/write/fields.js +62 -0
- package/dist/state/write/fields.js.map +1 -0
- package/dist/state/write/helpers.js +30 -0
- package/dist/state/write/helpers.js.map +1 -0
- package/dist/state/write/index.js +12 -0
- package/dist/state/write/index.js.map +1 -0
- package/dist/state/write/input.js +22 -0
- package/dist/state/write/input.js.map +1 -0
- package/dist/state/write/lock.js +838 -0
- package/dist/state/write/lock.js.map +1 -0
- package/dist/state/write/mutation.js +235 -0
- package/dist/state/write/mutation.js.map +1 -0
- package/dist/state/write/operations.js +375 -0
- package/dist/state/write/operations.js.map +1 -0
- package/dist/state/write/planEvaluation.js +121 -0
- package/dist/state/write/planEvaluation.js.map +1 -0
- package/dist/state/write/planPublication.js +135 -0
- package/dist/state/write/planPublication.js.map +1 -0
- package/dist/state/write/serialize.js +2 -0
- package/dist/state/write/serialize.js.map +1 -0
- package/dist/state/write/transaction.js +44 -0
- package/dist/state/write/transaction.js.map +1 -0
- package/dist/state/write/validate.js +8 -0
- package/dist/state/write/validate.js.map +1 -0
- package/dist/upgrade/appContentRefresh.js +384 -0
- package/dist/upgrade/appContentRefresh.js.map +1 -0
- package/dist/upgrade/appModel.js +8 -6
- package/dist/upgrade/appModel.js.map +1 -1
- package/dist/upgrade/atomicWriter.js +2 -0
- package/dist/upgrade/atomicWriter.js.map +1 -0
- package/dist/upgrade/bundleEvidence.js +34 -0
- package/dist/upgrade/bundleEvidence.js.map +1 -0
- package/dist/upgrade/channels.js +21 -10
- package/dist/upgrade/channels.js.map +1 -1
- package/dist/upgrade/coexistenceProbe.js +105 -0
- package/dist/upgrade/coexistenceProbe.js.map +1 -0
- package/dist/upgrade/compatibility.js +56 -20
- package/dist/upgrade/compatibility.js.map +1 -1
- package/dist/upgrade/doctor.js +197 -191
- package/dist/upgrade/doctor.js.map +1 -1
- package/dist/upgrade/doctorClassifier.js +188 -0
- package/dist/upgrade/doctorClassifier.js.map +1 -0
- package/dist/upgrade/installedHooksRetirement.js +197 -0
- package/dist/upgrade/installedHooksRetirement.js.map +1 -0
- package/dist/upgrade/legacyAgentCleanup.js +283 -0
- package/dist/upgrade/legacyAgentCleanup.js.map +1 -0
- package/dist/upgrade/lifecycleUpgrade.js +114 -0
- package/dist/upgrade/lifecycleUpgrade.js.map +1 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +363 -137
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
- package/dist/upgrade/migrationPublication.js +123 -0
- package/dist/upgrade/migrationPublication.js.map +1 -0
- package/dist/upgrade/nextMajorDoctor.js +156 -0
- package/dist/upgrade/nextMajorDoctor.js.map +1 -0
- package/dist/upgrade/npxPlatformStatus.js +23 -0
- package/dist/upgrade/npxPlatformStatus.js.map +1 -0
- package/dist/upgrade/projectIntegration.js +142 -171
- package/dist/upgrade/projectIntegration.js.map +1 -1
- package/dist/upgrade/projectIntegrationDecision.js +51 -0
- package/dist/upgrade/projectIntegrationDecision.js.map +1 -0
- package/dist/upgrade/runtimeMigration.js +336 -281
- package/dist/upgrade/runtimeMigration.js.map +1 -1
- package/dist/upgrade/upgradeCommands.js +9 -0
- package/dist/upgrade/upgradeCommands.js.map +1 -1
- package/dist/upgrade/upgradeLock.js +86 -0
- package/dist/upgrade/upgradeLock.js.map +1 -0
- package/dist/upgrade/upgradeOrchestrator.js +212 -56
- package/dist/upgrade/upgradeOrchestrator.js.map +1 -1
- package/dist/upgrade/v3CapabilitySurface.js +15 -0
- package/dist/upgrade/v3CapabilitySurface.js.map +1 -0
- package/dist/upgrade/versionResolution.js +12 -4
- package/dist/upgrade/versionResolution.js.map +1 -1
- package/dist/validate/appHomeContract.js +5 -9
- package/dist/validate/appHomeContract.js.map +1 -1
- package/dist/validate/capability.js +144 -14
- package/dist/validate/capability.js.map +1 -1
- package/dist/validate/crossCapability.js +12 -9
- package/dist/validate/crossCapability.js.map +1 -1
- package/dist/validate/selfAudit.js +73 -36
- package/dist/validate/selfAudit.js.map +1 -1
- package/dist/validate/vocabularyAuthority.js +303 -0
- package/dist/validate/vocabularyAuthority.js.map +1 -0
- package/package.json +45 -27
- package/bundle/references/adapters/cursor.md +0 -213
- package/bundle/references/adapters/opencode.md +0 -530
- package/bundle/references/adapters/runtime-adapter-characterization.md +0 -79
- package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
- package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -548
- package/bundle/references/adapters/runtime-feature-parity.md +0 -189
- package/bundle/references/v1-section-mapping.md +0 -47
- package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
- package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
- package/bundle/skills/agentera/agents/hej.toml +0 -6
- package/bundle/skills/agentera/agents/inspektera.toml +0 -6
- package/bundle/skills/agentera/agents/inspirera.toml +0 -6
- package/bundle/skills/agentera/agents/optimera.toml +0 -6
- package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
- package/bundle/skills/agentera/agents/planera.toml +0 -6
- package/bundle/skills/agentera/agents/profilera.toml +0 -6
- package/bundle/skills/agentera/agents/realisera.toml +0 -6
- package/bundle/skills/agentera/agents/resonera.toml +0 -6
- package/bundle/skills/agentera/agents/visionera.toml +0 -6
- package/bundle/skills/agentera/agents/visualisera.toml +0 -6
- package/bundle/skills/agentera/capabilities/dokumentera/instructions.md +0 -428
- package/bundle/skills/agentera/capabilities/dokumentera/schemas/artifacts.yaml +0 -73
- package/bundle/skills/agentera/capabilities/dokumentera/schemas/triggers.yaml +0 -35
- package/bundle/skills/agentera/capabilities/hej/instructions.md +0 -331
- package/bundle/skills/agentera/capabilities/hej/schemas/artifacts.yaml +0 -69
- package/bundle/skills/agentera/capabilities/hej/schemas/triggers.yaml +0 -58
- package/bundle/skills/agentera/capabilities/inspektera/instructions.md +0 -514
- package/bundle/skills/agentera/capabilities/inspektera/schemas/artifacts.yaml +0 -76
- package/bundle/skills/agentera/capabilities/inspektera/schemas/triggers.yaml +0 -38
- package/bundle/skills/agentera/capabilities/inspirera/instructions.md +0 -280
- package/bundle/skills/agentera/capabilities/inspirera/schemas/artifacts.yaml +0 -24
- package/bundle/skills/agentera/capabilities/inspirera/schemas/triggers.yaml +0 -34
- package/bundle/skills/agentera/capabilities/optimera/instructions.md +0 -437
- package/bundle/skills/agentera/capabilities/optimera/schemas/triggers.yaml +0 -39
- package/bundle/skills/agentera/capabilities/orkestrera/instructions.md +0 -433
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/artifacts.yaml +0 -64
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/triggers.yaml +0 -42
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/validation.yaml +0 -107
- package/bundle/skills/agentera/capabilities/planera/instructions.md +0 -368
- package/bundle/skills/agentera/capabilities/planera/schemas/artifacts.yaml +0 -62
- package/bundle/skills/agentera/capabilities/planera/schemas/triggers.yaml +0 -34
- package/bundle/skills/agentera/capabilities/planera/schemas/validation.yaml +0 -61
- package/bundle/skills/agentera/capabilities/profilera/instructions.md +0 -419
- package/bundle/skills/agentera/capabilities/profilera/schemas/triggers.yaml +0 -45
- package/bundle/skills/agentera/capabilities/profilera/schemas/validation.yaml +0 -57
- package/bundle/skills/agentera/capabilities/realisera/instructions.md +0 -403
- package/bundle/skills/agentera/capabilities/realisera/schemas/artifacts.yaml +0 -80
- package/bundle/skills/agentera/capabilities/realisera/schemas/triggers.yaml +0 -39
- package/bundle/skills/agentera/capabilities/resonera/instructions.md +0 -329
- package/bundle/skills/agentera/capabilities/resonera/schemas/artifacts.yaml +0 -47
- package/bundle/skills/agentera/capabilities/resonera/schemas/triggers.yaml +0 -46
- package/bundle/skills/agentera/capabilities/visionera/instructions.md +0 -309
- package/bundle/skills/agentera/capabilities/visionera/schemas/triggers.yaml +0 -41
- package/bundle/skills/agentera/capabilities/visualisera/instructions.md +0 -400
- package/bundle/skills/agentera/capabilities/visualisera/schemas/triggers.yaml +0 -33
- package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
- package/bundle/skills/hej/SKILL.md +0 -69
- package/bundle/skills/hej/agents/hej.toml +0 -11
- package/bundle/skills/hej/agents/openai.yaml +0 -8
- package/dist/cli/commands/backfill.js +0 -84
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/state.js +0 -1012
- package/dist/cli/commands/state.js.map +0 -1
- package/dist/core/git.js +0 -43
- package/dist/core/git.js.map +0 -1
- package/dist/hooks/compaction.js +0 -935
- package/dist/hooks/compaction.js.map +0 -1
- package/dist/hooks/validateArtifact.js +0 -933
- package/dist/hooks/validateArtifact.js.map +0 -1
- package/dist/registries/runtimeAdapterRegistry.js +0 -315
- package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
- package/dist/setup/copilot.js +0 -227
- package/dist/setup/copilot.js.map +0 -1
- package/dist/setup/cursor.js +0 -127
- package/dist/setup/cursor.js.map +0 -1
- package/dist/setup/doctor.js +0 -1276
- package/dist/setup/doctor.js.map +0 -1
- package/dist/state/progressCommit.js +0 -289
- package/dist/state/progressCommit.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -571
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
- package/dist/validate/lifecycleAdapters.js +0 -772
- package/dist/validate/lifecycleAdapters.js.map +0 -1
- /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { assertValidatedProjectRoot } from "./projectRoot.js";
|
|
5
|
+
import { reject } from "./write/errors.js";
|
|
6
|
+
const DIRECTORY_FLAGS = fs.constants.O_RDONLY
|
|
7
|
+
| (fs.constants.O_DIRECTORY ?? 0)
|
|
8
|
+
| (fs.constants.O_NOFOLLOW ?? 0);
|
|
9
|
+
const FILE_FLAGS = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0);
|
|
10
|
+
function samePublished(left, right) {
|
|
11
|
+
return left.dev === right.dev
|
|
12
|
+
&& left.ino === right.ino
|
|
13
|
+
&& left.type === right.type
|
|
14
|
+
&& left.size === right.size
|
|
15
|
+
&& left.sha256 === right.sha256;
|
|
16
|
+
}
|
|
17
|
+
function fdPath(fd, name) {
|
|
18
|
+
return name ? `/proc/self/fd/${fd}/${name}` : `/proc/self/fd/${fd}`;
|
|
19
|
+
}
|
|
20
|
+
function identity(stat) {
|
|
21
|
+
return {
|
|
22
|
+
dev: stat.dev,
|
|
23
|
+
ino: stat.ino,
|
|
24
|
+
size: stat.size,
|
|
25
|
+
mtimeNs: stat.mtimeNs,
|
|
26
|
+
ctimeNs: stat.ctimeNs,
|
|
27
|
+
nlink: stat.nlink,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function sameObject(left, right) {
|
|
31
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
32
|
+
}
|
|
33
|
+
function sameIdentity(left, right) {
|
|
34
|
+
return left.dev === right.dev
|
|
35
|
+
&& left.ino === right.ino
|
|
36
|
+
&& left.size === right.size
|
|
37
|
+
&& left.mtimeNs === right.mtimeNs
|
|
38
|
+
&& left.ctimeNs === right.ctimeNs
|
|
39
|
+
&& left.nlink === right.nlink;
|
|
40
|
+
}
|
|
41
|
+
function readDescriptor(fd) {
|
|
42
|
+
const stat = fs.fstatSync(fd, { bigint: true });
|
|
43
|
+
if (!stat.isFile() || stat.size > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
44
|
+
throw new Error("state mode marker descriptor is not a readable regular file");
|
|
45
|
+
}
|
|
46
|
+
const bytes = Buffer.alloc(Number(stat.size));
|
|
47
|
+
let offset = 0;
|
|
48
|
+
while (offset < bytes.length) {
|
|
49
|
+
const count = fs.readSync(fd, bytes, offset, bytes.length - offset, offset);
|
|
50
|
+
if (count === 0)
|
|
51
|
+
break;
|
|
52
|
+
offset += count;
|
|
53
|
+
}
|
|
54
|
+
if (offset !== bytes.length)
|
|
55
|
+
throw new Error("state mode marker changed while its exact bytes were read");
|
|
56
|
+
return bytes;
|
|
57
|
+
}
|
|
58
|
+
function publishedIdentity(fd) {
|
|
59
|
+
const stat = fs.fstatSync(fd, { bigint: true });
|
|
60
|
+
const bytes = readDescriptor(fd);
|
|
61
|
+
return {
|
|
62
|
+
dev: stat.dev,
|
|
63
|
+
ino: stat.ino,
|
|
64
|
+
type: stat.mode & BigInt(fs.constants.S_IFMT),
|
|
65
|
+
size: stat.size,
|
|
66
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function matchesPublished(fd, expected) {
|
|
70
|
+
const stat = fs.fstatSync(fd, { bigint: true });
|
|
71
|
+
if (stat.dev !== expected.dev
|
|
72
|
+
|| stat.ino !== expected.ino
|
|
73
|
+
|| (stat.mode & BigInt(fs.constants.S_IFMT)) !== expected.type
|
|
74
|
+
|| stat.size !== expected.size)
|
|
75
|
+
return false;
|
|
76
|
+
return createHash("sha256").update(readDescriptor(fd)).digest("hex") === expected.sha256;
|
|
77
|
+
}
|
|
78
|
+
function openMatches(parentFd, name, expectedFd, flags) {
|
|
79
|
+
let observed;
|
|
80
|
+
try {
|
|
81
|
+
observed = fs.openSync(fdPath(parentFd, name), flags);
|
|
82
|
+
return sameObject(fs.fstatSync(observed, { bigint: true }), fs.fstatSync(expectedFd, { bigint: true }));
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
if (observed !== undefined)
|
|
89
|
+
fs.closeSync(observed);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function syncDirectory(fd) {
|
|
93
|
+
fs.fsyncSync(fd);
|
|
94
|
+
}
|
|
95
|
+
function publicationConflict(markerPath) {
|
|
96
|
+
reject({
|
|
97
|
+
class: "conflict",
|
|
98
|
+
message: `state mode marker '${markerPath}' changed after entity mode detection; this is a conflict and cannot fall back to legacy state`,
|
|
99
|
+
syntax: "agentera state <artifact-id> <verb> ... --format json",
|
|
100
|
+
example: `restore the exact '${markerPath}' marker selected at command start and retry`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Pins one entity write to the root and exact valid marker selected by mode
|
|
105
|
+
* detection. Node cannot combine pathname validation and mutation atomically,
|
|
106
|
+
* so publication uses held directory descriptors, validates before and after
|
|
107
|
+
* every observable boundary, and rolls back only links and empty directories
|
|
108
|
+
* whose descriptor identities still match this attempt. Success linearizes at
|
|
109
|
+
* the final root, marker, directory-chain, and target validation.
|
|
110
|
+
*/
|
|
111
|
+
export class EntityPublicationContext {
|
|
112
|
+
projectRoot;
|
|
113
|
+
validatedRoot;
|
|
114
|
+
markerPath;
|
|
115
|
+
rootFd;
|
|
116
|
+
markerParentEntries;
|
|
117
|
+
markerFd;
|
|
118
|
+
markerIdentity;
|
|
119
|
+
markerBytes;
|
|
120
|
+
createdDirectories = new Map();
|
|
121
|
+
closed = false;
|
|
122
|
+
constructor(root, markerPath, expectedBytes) {
|
|
123
|
+
this.projectRoot = root.path;
|
|
124
|
+
this.validatedRoot = root;
|
|
125
|
+
this.markerPath = markerPath;
|
|
126
|
+
this.markerBytes = Buffer.from(expectedBytes);
|
|
127
|
+
this.rootFd = fs.openSync(root.path, DIRECTORY_FLAGS);
|
|
128
|
+
this.markerParentEntries = [];
|
|
129
|
+
let markerFd;
|
|
130
|
+
try {
|
|
131
|
+
const rootStat = fs.fstatSync(this.rootFd, { bigint: true });
|
|
132
|
+
const rootIdentity = root.identities.at(-1);
|
|
133
|
+
if (rootStat.dev !== rootIdentity.dev || rootStat.ino !== rootIdentity.ino) {
|
|
134
|
+
throw new Error(`project root '${root.path}' changed while its publication context was opened`);
|
|
135
|
+
}
|
|
136
|
+
const segments = markerPath.split("/").filter(Boolean);
|
|
137
|
+
let parentFd = this.rootFd;
|
|
138
|
+
for (const name of segments.slice(0, -1)) {
|
|
139
|
+
const fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
140
|
+
this.markerParentEntries.push({ parentFd, name, fd, created: false });
|
|
141
|
+
parentFd = fd;
|
|
142
|
+
}
|
|
143
|
+
markerFd = fs.openSync(fdPath(parentFd, segments.at(-1)), FILE_FLAGS);
|
|
144
|
+
const before = fs.fstatSync(markerFd, { bigint: true });
|
|
145
|
+
const bytes = readDescriptor(markerFd);
|
|
146
|
+
const after = fs.fstatSync(markerFd, { bigint: true });
|
|
147
|
+
if (!before.isFile() || !sameIdentity(identity(before), after) || !bytes.equals(expectedBytes)) {
|
|
148
|
+
publicationConflict(markerPath);
|
|
149
|
+
}
|
|
150
|
+
this.markerFd = markerFd;
|
|
151
|
+
this.markerIdentity = identity(after);
|
|
152
|
+
this.assertValid();
|
|
153
|
+
markerFd = undefined;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (markerFd !== undefined)
|
|
157
|
+
fs.closeSync(markerFd);
|
|
158
|
+
for (const entry of this.markerParentEntries.reverse())
|
|
159
|
+
fs.closeSync(entry.fd);
|
|
160
|
+
fs.closeSync(this.rootFd);
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
static open(root, markerPath, expectedBytes) {
|
|
165
|
+
return new EntityPublicationContext(root, markerPath, expectedBytes);
|
|
166
|
+
}
|
|
167
|
+
pinnedPath(relativePath = "") {
|
|
168
|
+
if (this.closed)
|
|
169
|
+
throw new Error("entity publication context is closed");
|
|
170
|
+
return relativePath ? path.join(fdPath(this.rootFd), relativePath) : fdPath(this.rootFd);
|
|
171
|
+
}
|
|
172
|
+
assertValid() {
|
|
173
|
+
if (this.closed)
|
|
174
|
+
throw new Error("entity publication context is closed");
|
|
175
|
+
assertValidatedProjectRoot(this.validatedRoot);
|
|
176
|
+
const currentRoot = fs.fstatSync(this.rootFd, { bigint: true });
|
|
177
|
+
const expectedRoot = this.validatedRoot.identities.at(-1);
|
|
178
|
+
if (currentRoot.dev !== expectedRoot.dev || currentRoot.ino !== expectedRoot.ino) {
|
|
179
|
+
throw new Error(`project root '${this.projectRoot}' changed after validation; restore the exact real directory and retry`);
|
|
180
|
+
}
|
|
181
|
+
for (const entry of this.markerParentEntries) {
|
|
182
|
+
if (!openMatches(entry.parentFd, entry.name, entry.fd, DIRECTORY_FLAGS)) {
|
|
183
|
+
publicationConflict(this.markerPath);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const parentFd = this.markerParentEntries.at(-1)?.fd ?? this.rootFd;
|
|
187
|
+
const markerName = this.markerPath.split("/").filter(Boolean).at(-1);
|
|
188
|
+
if (!openMatches(parentFd, markerName, this.markerFd, FILE_FLAGS)
|
|
189
|
+
|| !sameIdentity(this.markerIdentity, fs.fstatSync(this.markerFd, { bigint: true }))
|
|
190
|
+
|| !readDescriptor(this.markerFd).equals(this.markerBytes))
|
|
191
|
+
publicationConflict(this.markerPath);
|
|
192
|
+
}
|
|
193
|
+
publishImmutable(relativeTarget, bytes) {
|
|
194
|
+
const normalized = relativeTarget.split(path.sep).join("/");
|
|
195
|
+
const segments = normalized.split("/").filter(Boolean);
|
|
196
|
+
if (segments.length < 2
|
|
197
|
+
|| path.isAbsolute(relativeTarget)
|
|
198
|
+
|| segments.includes("..")
|
|
199
|
+
|| segments.includes("."))
|
|
200
|
+
throw new Error(`unsafe entity publication target '${relativeTarget}'`);
|
|
201
|
+
this.assertValid();
|
|
202
|
+
const directories = [];
|
|
203
|
+
const createdPaths = [];
|
|
204
|
+
let stageFd;
|
|
205
|
+
let stageName;
|
|
206
|
+
let targetLinked = false;
|
|
207
|
+
try {
|
|
208
|
+
let parentFd = this.rootFd;
|
|
209
|
+
for (const name of segments.slice(0, -1)) {
|
|
210
|
+
this.assertBoundary(directories);
|
|
211
|
+
const entryParentFd = parentFd;
|
|
212
|
+
let fd;
|
|
213
|
+
let created = false;
|
|
214
|
+
try {
|
|
215
|
+
fd = fs.openSync(fdPath(entryParentFd, name), DIRECTORY_FLAGS);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
if (error.code !== "ENOENT")
|
|
219
|
+
throw error;
|
|
220
|
+
this.assertBoundary(directories);
|
|
221
|
+
fs.mkdirSync(fdPath(entryParentFd, name));
|
|
222
|
+
created = true;
|
|
223
|
+
fd = fs.openSync(fdPath(entryParentFd, name), DIRECTORY_FLAGS);
|
|
224
|
+
}
|
|
225
|
+
const entry = { parentFd: entryParentFd, name, fd, created };
|
|
226
|
+
directories.push(entry);
|
|
227
|
+
if (created)
|
|
228
|
+
createdPaths.push({ relativePath: segments.slice(0, directories.length).join("/"), fd });
|
|
229
|
+
parentFd = fd;
|
|
230
|
+
if (created)
|
|
231
|
+
syncDirectory(entryParentFd);
|
|
232
|
+
this.assertBoundary(directories);
|
|
233
|
+
}
|
|
234
|
+
const directoryFd = directories.at(-1).fd;
|
|
235
|
+
const targetName = segments.at(-1);
|
|
236
|
+
stageName = `.${targetName}.${process.pid}.${randomUUID()}.tmp`;
|
|
237
|
+
this.assertBoundary(directories);
|
|
238
|
+
stageFd = fs.openSync(fdPath(directoryFd, stageName), fs.constants.O_RDWR | fs.constants.O_CREAT | fs.constants.O_EXCL | (fs.constants.O_NOFOLLOW ?? 0), 0o600);
|
|
239
|
+
this.assertBoundary(directories, { name: stageName, fd: stageFd });
|
|
240
|
+
fs.writeFileSync(stageFd, bytes, "utf8");
|
|
241
|
+
fs.fsyncSync(stageFd);
|
|
242
|
+
this.assertBoundary(directories, { name: stageName, fd: stageFd });
|
|
243
|
+
try {
|
|
244
|
+
this.assertBoundary(directories, { name: stageName, fd: stageFd });
|
|
245
|
+
fs.linkSync(fdPath(directoryFd, stageName), fdPath(directoryFd, targetName));
|
|
246
|
+
targetLinked = true;
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
if (error.code !== "EEXIST")
|
|
250
|
+
throw error;
|
|
251
|
+
this.removeOwnedFile(directoryFd, stageName, stageFd);
|
|
252
|
+
stageName = undefined;
|
|
253
|
+
syncDirectory(directoryFd);
|
|
254
|
+
this.assertBoundary(directories);
|
|
255
|
+
this.removeCreatedDirectories(directories);
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
syncDirectory(directoryFd);
|
|
259
|
+
this.assertBoundary(directories, { name: stageName, fd: stageFd }, { name: targetName, fd: stageFd });
|
|
260
|
+
this.removeOwnedFile(directoryFd, stageName, stageFd);
|
|
261
|
+
stageName = undefined;
|
|
262
|
+
syncDirectory(directoryFd);
|
|
263
|
+
this.assertBoundary(directories, undefined, { name: targetName, fd: stageFd });
|
|
264
|
+
for (const createdPath of createdPaths)
|
|
265
|
+
this.createdDirectories.set(createdPath.relativePath, identity(fs.fstatSync(createdPath.fd, { bigint: true })));
|
|
266
|
+
return publishedIdentity(stageFd);
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
const directoryFd = directories.at(-1)?.fd;
|
|
270
|
+
const targetName = segments.at(-1);
|
|
271
|
+
const cleanupFailures = [];
|
|
272
|
+
if (directoryFd !== undefined && stageFd !== undefined && targetLinked) {
|
|
273
|
+
try {
|
|
274
|
+
this.removeOwnedFile(directoryFd, targetName, stageFd);
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
cleanupFailures.push("entity");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (directoryFd !== undefined && stageFd !== undefined && stageName !== undefined) {
|
|
281
|
+
try {
|
|
282
|
+
this.removeOwnedFile(directoryFd, stageName, stageFd);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
cleanupFailures.push("stage");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (directoryFd !== undefined) {
|
|
289
|
+
try {
|
|
290
|
+
syncDirectory(directoryFd);
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
cleanupFailures.push("directory sync");
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
this.removeCreatedDirectories(directories);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
cleanupFailures.push("directory");
|
|
301
|
+
}
|
|
302
|
+
if (cleanupFailures.length > 0) {
|
|
303
|
+
throw new Error(`entity publication failed and exact rollback could not remove its ${cleanupFailures.join(", ")}; inspect the pinned project state before retrying`, { cause: error });
|
|
304
|
+
}
|
|
305
|
+
throw error;
|
|
306
|
+
}
|
|
307
|
+
finally {
|
|
308
|
+
if (stageFd !== undefined)
|
|
309
|
+
fs.closeSync(stageFd);
|
|
310
|
+
for (const entry of directories.reverse())
|
|
311
|
+
fs.closeSync(entry.fd);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
publishPreowned(relativeTarget, relativeReceipt, expected) {
|
|
315
|
+
const targetSegments = relativeTarget.split(path.sep).filter(Boolean);
|
|
316
|
+
const receiptSegments = relativeReceipt.split(path.sep).filter(Boolean);
|
|
317
|
+
if ([targetSegments, receiptSegments].some((segments) => segments.length < 2 || segments.includes("..") || segments.includes("."))
|
|
318
|
+
|| path.isAbsolute(relativeTarget) || path.isAbsolute(relativeReceipt))
|
|
319
|
+
throw new Error("unsafe preowned publication path");
|
|
320
|
+
this.assertValid();
|
|
321
|
+
const receiptDirectories = [];
|
|
322
|
+
const targetDirectories = [];
|
|
323
|
+
const createdPaths = [];
|
|
324
|
+
let receiptFd;
|
|
325
|
+
let targetFd;
|
|
326
|
+
let linked = false;
|
|
327
|
+
try {
|
|
328
|
+
let receiptParent = this.rootFd;
|
|
329
|
+
for (const name of receiptSegments.slice(0, -1)) {
|
|
330
|
+
const fd = fs.openSync(fdPath(receiptParent, name), DIRECTORY_FLAGS);
|
|
331
|
+
receiptDirectories.push({ parentFd: receiptParent, name, fd, created: false });
|
|
332
|
+
receiptParent = fd;
|
|
333
|
+
}
|
|
334
|
+
receiptFd = fs.openSync(fdPath(receiptParent, receiptSegments.at(-1)), FILE_FLAGS);
|
|
335
|
+
const receiptIdentity = publishedIdentity(receiptFd);
|
|
336
|
+
if (!samePublished(receiptIdentity, expected))
|
|
337
|
+
throw new Error(`migration ownership receipt '${relativeReceipt}' changed`);
|
|
338
|
+
let targetParent = this.rootFd;
|
|
339
|
+
for (const [index, name] of targetSegments.slice(0, -1).entries()) {
|
|
340
|
+
this.assertBoundary(targetDirectories);
|
|
341
|
+
const parentFd = targetParent;
|
|
342
|
+
let fd;
|
|
343
|
+
let created = false;
|
|
344
|
+
try {
|
|
345
|
+
fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
if (error.code !== "ENOENT")
|
|
349
|
+
throw error;
|
|
350
|
+
fs.mkdirSync(fdPath(parentFd, name));
|
|
351
|
+
created = true;
|
|
352
|
+
fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
353
|
+
syncDirectory(parentFd);
|
|
354
|
+
}
|
|
355
|
+
targetDirectories.push({ parentFd, name, fd, created });
|
|
356
|
+
if (created)
|
|
357
|
+
createdPaths.push({ relativePath: targetSegments.slice(0, index + 1).join("/"), fd });
|
|
358
|
+
targetParent = fd;
|
|
359
|
+
}
|
|
360
|
+
const targetName = targetSegments.at(-1);
|
|
361
|
+
try {
|
|
362
|
+
fs.linkSync(fdPath(receiptParent, receiptSegments.at(-1)), fdPath(targetParent, targetName));
|
|
363
|
+
linked = true;
|
|
364
|
+
syncDirectory(targetParent);
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
if (error.code !== "EEXIST")
|
|
368
|
+
throw error;
|
|
369
|
+
}
|
|
370
|
+
targetFd = fs.openSync(fdPath(targetParent, targetName), FILE_FLAGS);
|
|
371
|
+
const targetIdentity = publishedIdentity(targetFd);
|
|
372
|
+
if (!sameObject(fs.fstatSync(receiptFd, { bigint: true }), fs.fstatSync(targetFd, { bigint: true })) || !samePublished(targetIdentity, expected)) {
|
|
373
|
+
throw new Error(`canonical target '${relativeTarget}' collides with migration ownership receipt; byte-identical replacement inodes are never adopted`);
|
|
374
|
+
}
|
|
375
|
+
this.assertBoundary(targetDirectories, undefined, { name: targetName, fd: targetFd });
|
|
376
|
+
for (const createdPath of createdPaths)
|
|
377
|
+
this.createdDirectories.set(createdPath.relativePath, identity(fs.fstatSync(createdPath.fd, { bigint: true })));
|
|
378
|
+
return targetIdentity;
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
const targetParent = targetDirectories.at(-1)?.fd;
|
|
382
|
+
if (linked && targetParent !== undefined && receiptFd !== undefined)
|
|
383
|
+
this.removeOwnedFile(targetParent, targetSegments.at(-1), receiptFd);
|
|
384
|
+
this.removeCreatedDirectories(targetDirectories);
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
if (targetFd !== undefined)
|
|
389
|
+
fs.closeSync(targetFd);
|
|
390
|
+
if (receiptFd !== undefined)
|
|
391
|
+
fs.closeSync(receiptFd);
|
|
392
|
+
for (const entry of targetDirectories.reverse())
|
|
393
|
+
fs.closeSync(entry.fd);
|
|
394
|
+
for (const entry of receiptDirectories.reverse())
|
|
395
|
+
fs.closeSync(entry.fd);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
removeExact(relativeTarget, expected) {
|
|
399
|
+
const segments = relativeTarget.split(path.sep).filter(Boolean);
|
|
400
|
+
if (segments.length < 2 || path.isAbsolute(relativeTarget) || segments.includes("..") || segments.includes("."))
|
|
401
|
+
throw new Error(`unsafe entity rollback target '${relativeTarget}'`);
|
|
402
|
+
const directories = [];
|
|
403
|
+
let targetFd;
|
|
404
|
+
try {
|
|
405
|
+
let parentFd = this.rootFd;
|
|
406
|
+
for (const name of segments.slice(0, -1)) {
|
|
407
|
+
let fd;
|
|
408
|
+
try {
|
|
409
|
+
fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
if (error.code === "ENOENT")
|
|
413
|
+
return "absent";
|
|
414
|
+
throw error;
|
|
415
|
+
}
|
|
416
|
+
directories.push({ parentFd, name, fd, created: false });
|
|
417
|
+
parentFd = fd;
|
|
418
|
+
}
|
|
419
|
+
const directoryFd = directories.at(-1).fd;
|
|
420
|
+
const targetName = segments.at(-1);
|
|
421
|
+
try {
|
|
422
|
+
targetFd = fs.openSync(fdPath(directoryFd, targetName), FILE_FLAGS);
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
if (error.code === "ENOENT")
|
|
426
|
+
return "absent";
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
if (!matchesPublished(targetFd, expected))
|
|
430
|
+
return "identity_mismatch";
|
|
431
|
+
const rollbackName = `.${targetName}.${process.pid}.${randomUUID()}.rollback`;
|
|
432
|
+
fs.renameSync(fdPath(directoryFd, targetName), fdPath(directoryFd, rollbackName));
|
|
433
|
+
if (openMatches(directoryFd, rollbackName, targetFd, FILE_FLAGS)) {
|
|
434
|
+
this.removeOwnedFile(directoryFd, rollbackName, targetFd);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
try {
|
|
438
|
+
fs.linkSync(fdPath(directoryFd, rollbackName), fdPath(directoryFd, targetName));
|
|
439
|
+
fs.unlinkSync(fdPath(directoryFd, rollbackName));
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
if (error.code !== "EEXIST")
|
|
443
|
+
throw error;
|
|
444
|
+
}
|
|
445
|
+
syncDirectory(directoryFd);
|
|
446
|
+
return "identity_mismatch";
|
|
447
|
+
}
|
|
448
|
+
syncDirectory(directoryFd);
|
|
449
|
+
return "removed";
|
|
450
|
+
}
|
|
451
|
+
finally {
|
|
452
|
+
if (targetFd !== undefined)
|
|
453
|
+
fs.closeSync(targetFd);
|
|
454
|
+
for (const entry of directories.reverse())
|
|
455
|
+
fs.closeSync(entry.fd);
|
|
456
|
+
this.removeAttemptDirectories();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
removeAttemptDirectories() {
|
|
460
|
+
const paths = [...this.createdDirectories.keys()].sort((left, right) => right.split("/").length - left.split("/").length);
|
|
461
|
+
for (const relativePath of paths) {
|
|
462
|
+
const segments = relativePath.split("/");
|
|
463
|
+
const descriptors = [];
|
|
464
|
+
let targetFd;
|
|
465
|
+
let parentFd = this.rootFd;
|
|
466
|
+
try {
|
|
467
|
+
for (const name of segments.slice(0, -1)) {
|
|
468
|
+
const fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
469
|
+
descriptors.push(fd);
|
|
470
|
+
parentFd = fd;
|
|
471
|
+
}
|
|
472
|
+
targetFd = fs.openSync(fdPath(parentFd, segments.at(-1)), DIRECTORY_FLAGS);
|
|
473
|
+
const expected = this.createdDirectories.get(relativePath);
|
|
474
|
+
const observed = fs.fstatSync(targetFd, { bigint: true });
|
|
475
|
+
if (observed.dev !== expected.dev || observed.ino !== expected.ino) {
|
|
476
|
+
this.createdDirectories.delete(relativePath);
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
fs.rmdirSync(fdPath(parentFd, segments.at(-1)));
|
|
480
|
+
syncDirectory(parentFd);
|
|
481
|
+
this.createdDirectories.delete(relativePath);
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
const code = error.code ?? "";
|
|
485
|
+
if (code === "ENOENT")
|
|
486
|
+
this.createdDirectories.delete(relativePath);
|
|
487
|
+
else if (!["ENOTEMPTY", "EEXIST"].includes(code))
|
|
488
|
+
throw error;
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
if (targetFd !== undefined)
|
|
492
|
+
fs.closeSync(targetFd);
|
|
493
|
+
for (const fd of descriptors.reverse())
|
|
494
|
+
fs.closeSync(fd);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
replaceExisting(relativeTarget, expectedBytes, bytes) {
|
|
499
|
+
return this.replaceOwned(relativeTarget, expectedBytes, bytes);
|
|
500
|
+
}
|
|
501
|
+
restoreExact(relativeTarget, expected, bytes) {
|
|
502
|
+
// Recovery stays bound to the pinned root and exact archived target even when context invalidation caused the primary failure.
|
|
503
|
+
return this.replaceOwned(relativeTarget, expected, bytes, false);
|
|
504
|
+
}
|
|
505
|
+
replaceOwned(relativeTarget, expected, bytes, verifyContext = true) {
|
|
506
|
+
const segments = relativeTarget.split(path.sep).filter(Boolean);
|
|
507
|
+
if (segments.length < 2 || path.isAbsolute(relativeTarget) || segments.includes("..") || segments.includes("."))
|
|
508
|
+
throw new Error(`unsafe entity replacement target '${relativeTarget}'`);
|
|
509
|
+
const directories = [];
|
|
510
|
+
let targetFd;
|
|
511
|
+
let stageFd;
|
|
512
|
+
let stageName;
|
|
513
|
+
let backupName;
|
|
514
|
+
let displacedName;
|
|
515
|
+
let displacedFd;
|
|
516
|
+
let displacedOwned = false;
|
|
517
|
+
let replacementVisible = false;
|
|
518
|
+
try {
|
|
519
|
+
let parentFd = this.rootFd;
|
|
520
|
+
for (const name of segments.slice(0, -1)) {
|
|
521
|
+
const fd = fs.openSync(fdPath(parentFd, name), DIRECTORY_FLAGS);
|
|
522
|
+
directories.push({ parentFd, name, fd, created: false });
|
|
523
|
+
parentFd = fd;
|
|
524
|
+
}
|
|
525
|
+
const directoryFd = directories.at(-1).fd;
|
|
526
|
+
const targetName = segments.at(-1);
|
|
527
|
+
targetFd = fs.openSync(fdPath(directoryFd, targetName), FILE_FLAGS);
|
|
528
|
+
this.assertBoundary(directories, undefined, { name: targetName, fd: targetFd }, verifyContext);
|
|
529
|
+
const previousBytes = readDescriptor(targetFd);
|
|
530
|
+
if (typeof expected === "string" ? !previousBytes.equals(Buffer.from(expected)) : !matchesPublished(targetFd, expected))
|
|
531
|
+
throw new Error(`entity '${relativeTarget}' ownership changed before replacement; preserve both changes and retry explicitly`);
|
|
532
|
+
backupName = `.${targetName}.${process.pid}.${randomUUID()}.previous`;
|
|
533
|
+
fs.linkSync(fdPath(directoryFd, targetName), fdPath(directoryFd, backupName));
|
|
534
|
+
if (!openMatches(directoryFd, backupName, targetFd, FILE_FLAGS))
|
|
535
|
+
throw new Error(`entity '${relativeTarget}' prior value could not be pinned for replacement`);
|
|
536
|
+
stageName = `.${targetName}.${process.pid}.${randomUUID()}.tmp`;
|
|
537
|
+
stageFd = fs.openSync(fdPath(directoryFd, stageName), fs.constants.O_RDWR | fs.constants.O_CREAT | fs.constants.O_EXCL | (fs.constants.O_NOFOLLOW ?? 0), 0o600);
|
|
538
|
+
fs.writeFileSync(stageFd, bytes, "utf8");
|
|
539
|
+
fs.fsyncSync(stageFd);
|
|
540
|
+
this.assertBoundary(directories, { name: stageName, fd: stageFd }, { name: targetName, fd: targetFd }, verifyContext);
|
|
541
|
+
if (verifyContext) {
|
|
542
|
+
fs.renameSync(fdPath(directoryFd, stageName), fdPath(directoryFd, targetName));
|
|
543
|
+
replacementVisible = true;
|
|
544
|
+
stageName = undefined;
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
displacedName = `.${targetName}.${process.pid}.${randomUUID()}.displaced`;
|
|
548
|
+
fs.renameSync(fdPath(directoryFd, targetName), fdPath(directoryFd, displacedName));
|
|
549
|
+
displacedFd = fs.openSync(fdPath(directoryFd, displacedName), FILE_FLAGS);
|
|
550
|
+
if (typeof expected === "string" || !matchesPublished(displacedFd, expected)) {
|
|
551
|
+
try {
|
|
552
|
+
fs.linkSync(fdPath(directoryFd, displacedName), fdPath(directoryFd, targetName));
|
|
553
|
+
if (!openMatches(directoryFd, targetName, displacedFd, FILE_FLAGS))
|
|
554
|
+
throw new Error("competing entity could not be returned to its pathname");
|
|
555
|
+
syncDirectory(directoryFd);
|
|
556
|
+
}
|
|
557
|
+
catch (restoreError) {
|
|
558
|
+
throw new Error(`entity '${relativeTarget}' ownership changed immediately before restoration; competing bytes remain at '${displacedName}'`, { cause: restoreError });
|
|
559
|
+
}
|
|
560
|
+
throw new Error(`entity '${relativeTarget}' ownership changed immediately before restoration; competing bytes were preserved at the target and '${displacedName}'`);
|
|
561
|
+
}
|
|
562
|
+
displacedOwned = true;
|
|
563
|
+
try {
|
|
564
|
+
fs.linkSync(fdPath(directoryFd, stageName), fdPath(directoryFd, targetName));
|
|
565
|
+
}
|
|
566
|
+
catch (publishError) {
|
|
567
|
+
if (publishError.code === "EEXIST")
|
|
568
|
+
throw new Error(`entity '${relativeTarget}' ownership changed during no-clobber restoration publication; competing bytes were preserved`, { cause: publishError });
|
|
569
|
+
throw publishError;
|
|
570
|
+
}
|
|
571
|
+
replacementVisible = true;
|
|
572
|
+
this.removeOwnedFile(directoryFd, stageName, stageFd);
|
|
573
|
+
stageName = undefined;
|
|
574
|
+
this.removeOwnedFile(directoryFd, displacedName, targetFd);
|
|
575
|
+
displacedName = undefined;
|
|
576
|
+
}
|
|
577
|
+
syncDirectory(directoryFd);
|
|
578
|
+
this.assertBoundary(directories, undefined, { name: targetName, fd: stageFd }, verifyContext);
|
|
579
|
+
this.removeOwnedFile(directoryFd, backupName, targetFd);
|
|
580
|
+
backupName = undefined;
|
|
581
|
+
return { previousBytes: previousBytes.toString("utf8"), publishedIdentity: publishedIdentity(stageFd) };
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
const directoryFd = directories.at(-1)?.fd;
|
|
585
|
+
if (verifyContext && replacementVisible && directoryFd !== undefined && stageFd !== undefined && targetFd !== undefined) {
|
|
586
|
+
const ownsReplacement = openMatches(directoryFd, segments.at(-1), stageFd, FILE_FLAGS);
|
|
587
|
+
const ownsPrior = backupName !== undefined && openMatches(directoryFd, backupName, targetFd, FILE_FLAGS);
|
|
588
|
+
if (ownsReplacement && ownsPrior) {
|
|
589
|
+
fs.renameSync(fdPath(directoryFd, backupName), fdPath(directoryFd, segments.at(-1)));
|
|
590
|
+
backupName = undefined;
|
|
591
|
+
syncDirectory(directoryFd);
|
|
592
|
+
}
|
|
593
|
+
else if (ownsReplacement) {
|
|
594
|
+
throw new Error(`entity '${relativeTarget}' replacement failed and its descriptor-pinned prior value could not be restored`, { cause: error });
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
throw error;
|
|
598
|
+
}
|
|
599
|
+
finally {
|
|
600
|
+
const directoryFd = directories.at(-1)?.fd;
|
|
601
|
+
if (directoryFd !== undefined && stageFd !== undefined && stageName !== undefined)
|
|
602
|
+
this.removeOwnedFile(directoryFd, stageName, stageFd);
|
|
603
|
+
if (directoryFd !== undefined && targetFd !== undefined && backupName !== undefined)
|
|
604
|
+
this.removeOwnedFile(directoryFd, backupName, targetFd);
|
|
605
|
+
if (directoryFd !== undefined && targetFd !== undefined && displacedName !== undefined && displacedOwned)
|
|
606
|
+
this.removeOwnedFile(directoryFd, displacedName, targetFd);
|
|
607
|
+
if (displacedFd !== undefined)
|
|
608
|
+
fs.closeSync(displacedFd);
|
|
609
|
+
if (stageFd !== undefined)
|
|
610
|
+
fs.closeSync(stageFd);
|
|
611
|
+
if (targetFd !== undefined)
|
|
612
|
+
fs.closeSync(targetFd);
|
|
613
|
+
for (const entry of directories.reverse())
|
|
614
|
+
fs.closeSync(entry.fd);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
close() {
|
|
618
|
+
if (this.closed)
|
|
619
|
+
return;
|
|
620
|
+
this.closed = true;
|
|
621
|
+
fs.closeSync(this.markerFd);
|
|
622
|
+
for (const entry of this.markerParentEntries.reverse())
|
|
623
|
+
fs.closeSync(entry.fd);
|
|
624
|
+
fs.closeSync(this.rootFd);
|
|
625
|
+
}
|
|
626
|
+
assertBoundary(directories, stage, target, verifyContext = true) {
|
|
627
|
+
if (verifyContext)
|
|
628
|
+
this.assertValid();
|
|
629
|
+
for (const entry of directories) {
|
|
630
|
+
if (!openMatches(entry.parentFd, entry.name, entry.fd, DIRECTORY_FLAGS)) {
|
|
631
|
+
throw new Error(`entity publication directory '${entry.name}' changed during publication`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const directoryFd = directories.at(-1)?.fd;
|
|
635
|
+
if (directoryFd !== undefined && stage && !openMatches(directoryFd, stage.name, stage.fd, FILE_FLAGS)) {
|
|
636
|
+
throw new Error("entity publication stage changed during publication");
|
|
637
|
+
}
|
|
638
|
+
if (directoryFd !== undefined && target && !openMatches(directoryFd, target.name, target.fd, FILE_FLAGS)) {
|
|
639
|
+
throw new Error("entity publication target changed during publication");
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
removeOwnedFile(parentFd, name, expectedFd) {
|
|
643
|
+
if (!openMatches(parentFd, name, expectedFd, FILE_FLAGS))
|
|
644
|
+
return;
|
|
645
|
+
fs.unlinkSync(fdPath(parentFd, name));
|
|
646
|
+
}
|
|
647
|
+
removeCreatedDirectories(directories) {
|
|
648
|
+
for (const entry of [...directories].reverse()) {
|
|
649
|
+
if (!entry.created || !openMatches(entry.parentFd, entry.name, entry.fd, DIRECTORY_FLAGS))
|
|
650
|
+
continue;
|
|
651
|
+
try {
|
|
652
|
+
fs.rmdirSync(fdPath(entry.parentFd, entry.name));
|
|
653
|
+
syncDirectory(entry.parentFd);
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
if (!["ENOTEMPTY", "EEXIST", "ENOENT"].includes(error.code ?? ""))
|
|
657
|
+
throw error;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
//# sourceMappingURL=entityPublicationContext.js.map
|