@litfamily/litcodex 1.0.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/LICENSE +21 -0
- package/README.md +293 -0
- package/bin/litcodex.js +12 -0
- package/dist/auto-update.d.ts +27 -0
- package/dist/auto-update.js +106 -0
- package/dist/cli-model-route.d.ts +7 -0
- package/dist/cli-model-route.js +47 -0
- package/dist/cli.d.ts +23 -0
- package/dist/cli.js +282 -0
- package/dist/config-migration/backup.d.ts +2 -0
- package/dist/config-migration/backup.js +42 -0
- package/dist/config-migration/catalog.d.ts +23 -0
- package/dist/config-migration/catalog.js +108 -0
- package/dist/config-migration/cli.d.ts +16 -0
- package/dist/config-migration/cli.js +186 -0
- package/dist/config-migration/config-file-io.d.ts +11 -0
- package/dist/config-migration/config-file-io.js +62 -0
- package/dist/config-migration/config-paths.d.ts +4 -0
- package/dist/config-migration/config-paths.js +64 -0
- package/dist/config-migration/errors.d.ts +11 -0
- package/dist/config-migration/errors.js +30 -0
- package/dist/config-migration/gpt56-policy.d.ts +53 -0
- package/dist/config-migration/gpt56-policy.js +158 -0
- package/dist/config-migration/index.d.ts +63 -0
- package/dist/config-migration/index.js +208 -0
- package/dist/config-migration/multi-agent-v2-guard.d.ts +26 -0
- package/dist/config-migration/multi-agent-v2-guard.js +166 -0
- package/dist/config-migration/native-default-route.d.ts +9 -0
- package/dist/config-migration/native-default-route.js +336 -0
- package/dist/config-migration/profile-files.d.ts +11 -0
- package/dist/config-migration/profile-files.js +72 -0
- package/dist/config-migration/root-settings.d.ts +10 -0
- package/dist/config-migration/root-settings.js +144 -0
- package/dist/config-migration/state.d.ts +16 -0
- package/dist/config-migration/state.js +40 -0
- package/dist/config-migration/toml-shape.d.ts +8 -0
- package/dist/config-migration/toml-shape.js +141 -0
- package/dist/config-migration/unsafe-route-guard.d.ts +1 -0
- package/dist/config-migration/unsafe-route-guard.js +17 -0
- package/dist/install/agent-routing.d.ts +19 -0
- package/dist/install/agent-routing.js +145 -0
- package/dist/install/agents-install.d.ts +40 -0
- package/dist/install/agents-install.js +211 -0
- package/dist/install/auth-mode.d.ts +4 -0
- package/dist/install/auth-mode.js +26 -0
- package/dist/install/bundled-skill-manifests.d.ts +25 -0
- package/dist/install/bundled-skill-manifests.js +25 -0
- package/dist/install/bundled-skills.d.ts +7 -0
- package/dist/install/bundled-skills.js +70 -0
- package/dist/install/capability-preflight-error.d.ts +3 -0
- package/dist/install/capability-preflight-error.js +33 -0
- package/dist/install/codex-version.d.ts +17 -0
- package/dist/install/codex-version.js +37 -0
- package/dist/install/codex.d.ts +56 -0
- package/dist/install/codex.js +164 -0
- package/dist/install/development-marketplace.d.ts +6 -0
- package/dist/install/development-marketplace.js +83 -0
- package/dist/install/doctor-config.d.ts +4 -0
- package/dist/install/doctor-config.js +54 -0
- package/dist/install/doctor-render.d.ts +2 -0
- package/dist/install/doctor-render.js +72 -0
- package/dist/install/doctor.d.ts +12 -0
- package/dist/install/doctor.js +223 -0
- package/dist/install/errors.d.ts +20 -0
- package/dist/install/errors.js +53 -0
- package/dist/install/execute.d.ts +56 -0
- package/dist/install/execute.js +221 -0
- package/dist/install/file-walk.d.ts +33 -0
- package/dist/install/file-walk.js +252 -0
- package/dist/install/generated-skill-payload-hashes.d.ts +330 -0
- package/dist/install/generated-skill-payload-hashes.js +331 -0
- package/dist/install/hook-verifier.d.ts +5 -0
- package/dist/install/hook-verifier.js +20 -0
- package/dist/install/host-capabilities.d.ts +23 -0
- package/dist/install/host-capabilities.js +177 -0
- package/dist/install/index.d.ts +27 -0
- package/dist/install/index.js +403 -0
- package/dist/install/install-model-prompt.d.ts +28 -0
- package/dist/install/install-model-prompt.js +82 -0
- package/dist/install/install-options.d.ts +9 -0
- package/dist/install/install-options.js +164 -0
- package/dist/install/install-output.d.ts +4 -0
- package/dist/install/install-output.js +12 -0
- package/dist/install/install-presentation.d.ts +13 -0
- package/dist/install/install-presentation.js +165 -0
- package/dist/install/install-ui.d.ts +25 -0
- package/dist/install/install-ui.js +109 -0
- package/dist/install/marketplace-payload.d.ts +10 -0
- package/dist/install/marketplace-payload.js +178 -0
- package/dist/install/marketplace.d.ts +18 -0
- package/dist/install/marketplace.js +74 -0
- package/dist/install/package-root.d.ts +13 -0
- package/dist/install/package-root.js +25 -0
- package/dist/install/plan.d.ts +3 -0
- package/dist/install/plan.js +54 -0
- package/dist/install/registration.d.ts +8 -0
- package/dist/install/registration.js +62 -0
- package/dist/install/render-plan.d.ts +3 -0
- package/dist/install/render-plan.js +16 -0
- package/dist/install/runtime-file-policy.d.ts +2 -0
- package/dist/install/runtime-file-policy.js +17 -0
- package/dist/install/skill-catalog.d.ts +17 -0
- package/dist/install/skill-catalog.js +111 -0
- package/dist/install/skill-resource-hashes.d.ts +1 -0
- package/dist/install/skill-resource-hashes.js +1 -0
- package/dist/install/spinner-motion.d.ts +2 -0
- package/dist/install/spinner-motion.js +51 -0
- package/dist/install/strict-config-probe.d.ts +14 -0
- package/dist/install/strict-config-probe.js +53 -0
- package/dist/install/types.d.ts +102 -0
- package/dist/install/types.js +5 -0
- package/dist/install/uninstall.d.ts +26 -0
- package/dist/install/uninstall.js +227 -0
- package/dist/postinstall.d.ts +1 -0
- package/dist/postinstall.js +35 -0
- package/dist/ui-style.d.ts +23 -0
- package/dist/ui-style.js +73 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.js +25 -0
- package/dist/update-check.d.ts +101 -0
- package/dist/update-check.js +502 -0
- package/marketplace/.agents/plugins/marketplace.json +17 -0
- package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +34 -0
- package/marketplace/plugins/litcodex/.mcp.json +1 -0
- package/marketplace/plugins/litcodex/assets/logo.png +0 -0
- package/marketplace/plugins/litcodex/components/auto-update/dist/auto-update.d.ts +117 -0
- package/marketplace/plugins/litcodex/components/auto-update/dist/auto-update.js +640 -0
- package/marketplace/plugins/litcodex/components/auto-update/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/auto-update/dist/cli.js +103 -0
- package/marketplace/plugins/litcodex/components/auto-update/package.json +22 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/apply-patch.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/apply-patch.js +173 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/cli.js +10 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/codex-hook.d.ts +22 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/codex-hook.js +165 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/core-values.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/core-values.js +1 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/core.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/core.js +4 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/hook-input.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/hook-input.js +10 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/record.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/record.js +11 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/request-extractor.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/request-extractor.js +104 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/runner.d.ts +26 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/runner.js +144 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/types.d.ts +43 -0
- package/marketplace/plugins/litcodex/components/comment-checker/dist/types.js +1 -0
- package/marketplace/plugins/litcodex/components/comment-checker/package.json +22 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/cli.js +29 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/codex-hook.d.ts +28 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/codex-hook.js +137 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/index.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/git-bash/dist/index.js +1 -0
- package/marketplace/plugins/litcodex/components/git-bash/package.json +22 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-default.toml +14 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-explorer.toml +81 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-librarian.toml +104 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-litwork-reviewer.toml +41 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-metis.toml +71 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-momus.toml +75 -0
- package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-plan.toml +193 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directive.md +240 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/browser-drive.md +140 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/deep-interview.md +250 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-comprehend.md +247 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-crucible.md +254 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +126 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-init.md +140 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-plan.md +472 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +209 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-scientific-visualization.md +144 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/litgoal.md +231 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/litresearch.md +218 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +507 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/review-work.md +184 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/skill-observer.md +105 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/start-work.md +149 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/_scaffold.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/_scaffold.js +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/browser-drive-route.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/browser-drive-route.js +13 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +64 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-goal-instruction.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-goal-instruction.js +146 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +53 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +228 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/directive.d.ts +43 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/directive.js +139 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/goal-status.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/goal-status.js +32 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/guards.d.ts +73 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/guards.js +215 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/handoff-route.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/handoff-route.js +11 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +189 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lit-mark.d.ts +20 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lit-mark.js +138 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-cli.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-cli.js +109 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor-render.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor-render.js +39 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor-types.d.ts +52 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor-types.js +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor.d.ts +34 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-doctor.js +336 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-errors.d.ts +15 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-errors.js +45 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-handlers.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-handlers.js +367 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-model.d.ts +51 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-model.js +166 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-stdout.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-stdout.js +11 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-types.d.ts +26 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/loop-types.js +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +33 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +38 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +29 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +176 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.d.ts +20 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +147 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +177 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/scientific-visualization-route.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/scientific-visualization-route.js +15 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/apply.d.ts +16 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/apply.js +227 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/config.d.ts +13 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/config.js +12 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/curator.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/curator.js +112 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/hook.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/hook.js +435 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/ownership.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/ownership.js +145 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/paths.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/paths.js +43 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/review.d.ts +28 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/review.js +702 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/store.d.ts +32 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/store.js +667 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/transaction.d.ts +26 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/transaction.js +524 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/types.d.ts +81 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/types.js +246 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/usage.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop/usage.js +119 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop-cli.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-loop-cli.js +111 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.d.ts +4 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +69 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer-cli.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer-cli.js +116 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer-route.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer-route.js +12 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-observer.js +946 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-renames.d.ts +20 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-renames.js +43 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-paths.d.ts +43 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-paths.js +121 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-store.d.ts +40 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-store.js +471 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-types.d.ts +121 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/state-types.js +67 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +62 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +277 -0
- package/marketplace/plugins/litcodex/components/lit-loop/package.json +33 -0
- package/marketplace/plugins/litcodex/components/lsp/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/lsp/dist/cli.js +48 -0
- package/marketplace/plugins/litcodex/components/lsp/dist/codex-hook.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/lsp/dist/codex-hook.js +53 -0
- package/marketplace/plugins/litcodex/components/lsp/package.json +22 -0
- package/marketplace/plugins/litcodex/components/rules/bundled-rules/baseline-discipline.md +53 -0
- package/marketplace/plugins/litcodex/components/rules/bundled-rules/build-decision-gate.md +20 -0
- package/marketplace/plugins/litcodex/components/rules/bundled-rules/windows-git-bash.md +10 -0
- package/marketplace/plugins/litcodex/components/rules/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/rules/dist/cli.js +148 -0
- package/marketplace/plugins/litcodex/components/rules/dist/codex-hook-options.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/rules/dist/codex-hook-options.js +1 -0
- package/marketplace/plugins/litcodex/components/rules/dist/codex-hook.d.ts +47 -0
- package/marketplace/plugins/litcodex/components/rules/dist/codex-hook.js +137 -0
- package/marketplace/plugins/litcodex/components/rules/dist/config.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/rules/dist/config.js +99 -0
- package/marketplace/plugins/litcodex/components/rules/dist/context-pressure.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/rules/dist/context-pressure.js +26 -0
- package/marketplace/plugins/litcodex/components/rules/dist/debug-log.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/rules/dist/debug-log.js +36 -0
- package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.d.ts +36 -0
- package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.js +434 -0
- package/marketplace/plugins/litcodex/components/rules/dist/dynamic-target-fingerprints.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/rules/dist/dynamic-target-fingerprints.js +65 -0
- package/marketplace/plugins/litcodex/components/rules/dist/event-budget.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/rules/dist/event-budget.js +28 -0
- package/marketplace/plugins/litcodex/components/rules/dist/hook-output.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/hook-output.js +24 -0
- package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.js +101 -0
- package/marketplace/plugins/litcodex/components/rules/dist/output-style-injection.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/rules/dist/output-style-injection.js +53 -0
- package/marketplace/plugins/litcodex/components/rules/dist/path-utils.d.ts +4 -0
- package/marketplace/plugins/litcodex/components/rules/dist/path-utils.js +24 -0
- package/marketplace/plugins/litcodex/components/rules/dist/persistent-cache.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/rules/dist/persistent-cache.js +180 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-budget.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-budget.js +103 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-claim.d.ts +4 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-claim.js +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-directive.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-directive.js +55 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-state.d.ts +13 -0
- package/marketplace/plugins/litcodex/components/rules/dist/post-compact-state.js +29 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/cache.d.ts +9 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/cache.js +51 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/constants.d.ts +70 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/constants.js +100 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-dynamic-cache.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-dynamic-cache.js +60 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-dynamic-loader.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-dynamic-loader.js +61 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-loader.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-loader.js +60 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-paths.d.ts +11 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-paths.js +75 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-static-loader.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-static-loader.js +29 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-types.d.ts +47 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine-types.js +1 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/engine.js +90 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/errors.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/errors.js +12 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-cache.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-cache.js +51 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-paths.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-paths.js +33 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-sources.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder-sources.js +39 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder.d.ts +28 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/finder.js +146 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/formatter.d.ts +13 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/formatter.js +156 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/matcher.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/matcher.js +93 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/ordering.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/ordering.js +27 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser-frontmatter.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser-frontmatter.js +30 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser-yaml.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser-yaml.js +237 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/parser.js +31 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/plugin-root.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/plugin-root.js +48 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/project-root.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/project-root.js +23 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/scanner.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/scanner.js +111 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/sources.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/sources.js +9 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/truncator.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/truncator.js +62 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/types.d.ts +126 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules/types.js +8 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules-engine-factory.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/rules-engine-factory.js +20 -0
- package/marketplace/plugins/litcodex/components/rules/dist/session-state-lock.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/session-state-lock.js +41 -0
- package/marketplace/plugins/litcodex/components/rules/dist/shell-awareness.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/rules/dist/shell-awareness.js +90 -0
- package/marketplace/plugins/litcodex/components/rules/dist/stable-file-read.d.ts +18 -0
- package/marketplace/plugins/litcodex/components/rules/dist/stable-file-read.js +120 -0
- package/marketplace/plugins/litcodex/components/rules/dist/static-injection.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/rules/dist/static-injection.js +183 -0
- package/marketplace/plugins/litcodex/components/rules/dist/tool-paths.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/rules/dist/tool-paths.js +168 -0
- package/marketplace/plugins/litcodex/components/rules/dist/transcript-rule-filter.d.ts +4 -0
- package/marketplace/plugins/litcodex/components/rules/dist/transcript-rule-filter.js +31 -0
- package/marketplace/plugins/litcodex/components/rules/dist/transcript-search.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/rules/dist/transcript-search.js +191 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/LICENSE +21 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/README.md +749 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/index.js +17 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/constants.js +184 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/parse.js +1386 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/picomatch.js +349 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/scan.js +391 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/utils.js +72 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/package.json +82 -0
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/posix.js +3 -0
- package/marketplace/plugins/litcodex/components/rules/package.json +30 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/directive.md +109 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/cli.js +345 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +12 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +292 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/directive.d.ts +1 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/directive.js +2 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/index.d.ts +11 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/index.js +6 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/lifecycle-store.d.ts +161 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/lifecycle-store.js +1664 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/plan-progress.d.ts +11 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/plan-progress.js +86 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/plan-publisher.d.ts +11 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/plan-publisher.js +183 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/types.d.ts +28 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/types.js +1 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/work-state-reader.d.ts +44 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/work-state-reader.js +67 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +24 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/cli.js +62 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/codex-hook.d.ts +14 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/codex-hook.js +14 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/provider-cache.d.ts +66 -0
- package/marketplace/plugins/litcodex/components/telemetry/dist/provider-cache.js +117 -0
- package/marketplace/plugins/litcodex/components/telemetry/package.json +22 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/cli.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/cli.js +131 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/knowledge.d.ts +72 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/knowledge.js +623 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/strict-json.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/dist/strict-json.js +94 -0
- package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +22 -0
- package/marketplace/plugins/litcodex/hooks/hooks.json +215 -0
- package/marketplace/plugins/litcodex/skills/autoconference/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/autoconference/PROVENANCE.md +23 -0
- package/marketplace/plugins/litcodex/skills/autoconference/SKILL.md +139 -0
- package/marketplace/plugins/litcodex/skills/autoconference/assets/conference_template.md +76 -0
- package/marketplace/plugins/litcodex/skills/autoconference/assets/report_template.md +56 -0
- package/marketplace/plugins/litcodex/skills/autoconference/assets/synthesis_template.md +40 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/agent-prompts.md +30 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/conference-protocol.md +21 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/core-principles.md +13 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/family-contract.md +26 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/analyze.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/core/convergence-guide.md +41 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/core/crash-recovery.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/core.md +25 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/debate.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/plan.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/resume.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/ship.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/modes/survey.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/results-logging.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoconference/references/visualization-guide.md +10 -0
- package/marketplace/plugins/litcodex/skills/autoconference/scripts/init_conference.py +656 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/code-performance.md +59 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/debate-mode.md +50 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/prompt-optimization.md +58 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/quick-conference.md +48 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/research-synthesis.md +56 -0
- package/marketplace/plugins/litcodex/skills/autoconference/templates/survey-mode.md +63 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/PROVENANCE.md +22 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/SKILL.md +142 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/assets/report_template.md +52 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/assets/research_template.md +38 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/assets/results_template.tsv +2 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/core-principles.md +16 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/family-contract.md +36 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/core/evaluator-contract.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/core/stuck-detection.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/core.md +21 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/debug/investigation-techniques.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/debug.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/fix.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/learn.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/plan.md +14 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/predict/persona-templates.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/predict.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/reason.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/scenario/dimensions.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/scenario.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/security/owasp-checklist.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/security/stride-model.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/security.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/ship/type-checklists.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/modes/ship.md +11 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/results-logging.md +12 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/references/visualization-guide.md +24 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/scripts/init_research.py +401 -0
- package/marketplace/plugins/litcodex/skills/autoresearch/scripts/style_presets.py +123 -0
- package/marketplace/plugins/litcodex/skills/browser-drive/SKILL.md +206 -0
- package/marketplace/plugins/litcodex/skills/browser-drive/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/browser-drive/references/snapshot-act-loop.md +48 -0
- package/marketplace/plugins/litcodex/skills/browser-drive/scripts/capability-probe.mjs +437 -0
- package/marketplace/plugins/litcodex/skills/coding-session-audit/SKILL.md +299 -0
- package/marketplace/plugins/litcodex/skills/coding-session-audit/references/continuation-and-handoff.md +206 -0
- package/marketplace/plugins/litcodex/skills/coding-session-audit/references/read-only-recipes.md +246 -0
- package/marketplace/plugins/litcodex/skills/coding-session-audit/references/session-formats.md +246 -0
- package/marketplace/plugins/litcodex/skills/comment-checker/SKILL.md +169 -0
- package/marketplace/plugins/litcodex/skills/comment-checker/references/comment-policy.md +83 -0
- package/marketplace/plugins/litcodex/skills/debugging/SKILL.md +259 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/00-setup.md +108 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/02-investigate.md +124 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/04-oracle-triple.md +129 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/05-escalate.md +70 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/06-fix.md +116 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/08-qa.md +94 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/methodology/partial-runtime-evidence.md +223 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/go.md +252 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/node.md +260 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/python.md +248 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/runtimes/rust.md +234 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/tools/ghidra.md +212 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/tools/playwright-cli.md +194 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/tools/pwndbg.md +263 -0
- package/marketplace/plugins/litcodex/skills/debugging/references/tools/pwntools.md +265 -0
- package/marketplace/plugins/litcodex/skills/deep-interview/SKILL.md +339 -0
- package/marketplace/plugins/litcodex/skills/deep-interview/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +62 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ATTRIBUTION.md +217 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/LICENSE-Apache-2.0.txt +201 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/MANIFEST.json +869 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/PROVENANCE.md +24 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/README.md +248 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/_INDEX.md +191 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/airbnb.md +393 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/airtable.md +92 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/apple.md +250 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/aside.md +209 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/binance.md +348 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/bmw.md +183 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/brutalist-skill.md +92 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/bugatti.md +271 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cal.md +262 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/claude.md +315 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clay.md +307 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clickhouse.md +284 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clone-from-url.md +65 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cohere.md +269 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/coinbase.md +132 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/composio.md +310 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cursor.md +312 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/design-system-architecture.md +244 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/elevenlabs.md +268 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/expo.md +284 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ferrari.md +317 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/figma.md +223 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/framer.md +249 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/gpt-tasteskill.md +74 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/hashicorp.md +281 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ibm.md +335 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/image-to-code-skill.md +1228 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-brandkit.md +798 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-frontend-mobile.md +1465 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-frontend-web.md +987 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/intercom.md +149 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/kraken.md +128 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lamborghini.md +291 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/layout-skill.md +107 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lazyweb.md +77 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/linear.app.md +370 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lovable.md +301 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mastercard.md +368 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/meta.md +369 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/minimalist-skill.md +85 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/minimax.md +260 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mintlify.md +329 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/miro.md +111 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mistral.ai.md +264 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mongodb.md +269 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/nike.md +366 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/notion.md +312 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/nvidia.md +296 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ollama.md +270 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/opencode.ai.md +284 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/output-skill.md +49 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/pinterest.md +233 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/playstation.md +367 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/posthog.md +259 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/raycast.md +271 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/react-dev-tooling-skill.md +230 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/redesign-skill.md +178 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/renault.md +314 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/replicate.md +264 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/resend.md +306 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/revolut.md +188 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/runwayml.md +247 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/sanity.md +360 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/sentry.md +265 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/shopify.md +353 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/soft-skill.md +98 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/spacex.md +197 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/spotify.md +249 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/starbucks.md +583 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stitch-design-example.md +121 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stitch-skill.md +184 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stripe.md +325 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/supabase.md +258 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/superhuman.md +255 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/taste-skill.md +1206 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/tesla.md +289 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/theverge.md +342 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/together.ai.md +266 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/uber.md +298 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/vercel.md +313 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/vodafone.md +426 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/voltagent.md +326 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/warp.md +256 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/webflow.md +95 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/wired.md +281 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/wise.md +176 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/x.ai.md +260 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/zapier.md +331 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/EVIDENCE.md +97 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/README.md +48 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/UPSTREAM.md +80 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-a-direction.md +64 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-b-execution.md +65 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-c-review.md +65 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-d-memory.md +83 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/orchestration.md +80 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/routing.md +79 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/accessibility-reviewer.md +83 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/content-writer.md +132 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-builder.md +109 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-critic.md +89 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-lead.md +113 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-scout.md +78 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-strategist.md +121 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/heuristic-evaluator.md +268 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/inspiration-scout.md +107 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/motion-designer.md +120 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/accessible-content/reference.md +101 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/adaptive-interfaces/reference.md +109 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/cognitive-accessibility/reference.md +107 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-debate/reference.md +199 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-debt-tracker/reference.md +174 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-handoff/reference.md +125 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-md/reference.md +106 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-retrospective/reference.md +266 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-review/reference.md +123 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-system-alignment/reference.md +120 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/designpowers-critique/reference.md +164 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/heuristic-evaluation/reference.md +85 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/inclusive-personas/reference.md +98 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/inspiration-scouting/reference.md +165 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/interaction-design/reference.md +122 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/motion-choreography/reference.md +81 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/research-planning/reference.md +96 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/responsive-patterns/reference.md +77 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/synthetic-user-testing/reference.md +192 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/taste-feedback/reference.md +165 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/taste-report/reference.md +78 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/token-architecture/reference.md +75 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/ui-composition/reference.md +117 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/usability-testing/reference.md +78 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/verification-before-shipping/reference.md +125 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/voice-and-tone/reference.md +79 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/writing-design-plans/reference.md +119 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/perfection/README.md +160 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/perfection/react-perf-tooling.md +127 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/README.md +659 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/charts.csv +26 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/colors.csv +162 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/icons.csv +106 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/landing.csv +35 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/products.csv +162 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/react-performance.csv +45 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/astro.csv +54 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/react.csv +54 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/vue.csv +50 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/styles.csv +85 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/typography.csv +74 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/ui-reasoning.csv +162 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/web-interface.csv +31 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/core.py +262 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/design_system.py +1148 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/search.py +114 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/adaptive-layout.md +94 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +77 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/canonical-library.md +36 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +353 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/composition.md +90 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/creative-directions.md +89 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/evidence-review.md +127 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/implementation-platforms.md +77 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/inclusive-interface.md +97 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/interaction-motion.md +96 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/operating-lanes.md +110 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/performance-delivery.md +89 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/product-direction.md +101 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/redesign-playbook.md +91 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/system-foundations.md +114 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/taste-direction.md +27 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-language.md +86 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-reconstruction.md +88 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1alpha1.json +299 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1beta1.json +32 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1beta2.json +34 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/canonical-json.mjs +186 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/stable-file-read.mjs +201 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/validate-design-contract.mjs +555 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/verify-canonical-corpus.mjs +354 -0
- package/marketplace/plugins/litcodex/skills/lit-burnoff/SKILL.md +489 -0
- package/marketplace/plugins/litcodex/skills/lit-burnoff/references/behavior-preserving-cleanup.md +105 -0
- package/marketplace/plugins/litcodex/skills/lit-burnoff-file/SKILL.md +169 -0
- package/marketplace/plugins/litcodex/skills/lit-code/SKILL.md +628 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/engineering-risk-signals.md +123 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/README.md +90 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/backend-stack.md +641 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/bootstrap.md +328 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/bubbletea-v2.md +360 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/cobra-stack.md +468 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/concurrency.md +362 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/data-modeling.md +329 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/error-handling.md +359 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/golangci-strict.md +236 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/grpc-connect.md +375 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/libraries.md +337 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/one-liners.md +202 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/sqlc-pgx.md +471 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/testing.md +467 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/go/type-patterns.md +298 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/observability-contracts.md +124 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/README.md +314 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/async-anyio.md +442 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/data-modeling.md +233 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/data-processing.md +133 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/error-handling.md +218 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/fastapi-stack.md +316 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/httpx2-optimization.md +360 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/libraries.md +307 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/one-liners.md +268 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/orjson-stack.md +378 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/pydantic-ai.md +285 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/pyproject-strict.md +232 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/textual-tui.md +201 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/python/type-patterns.md +176 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/README.md +317 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/async-tokio.md +299 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/axum-stack.md +467 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/cargo-strict.md +317 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/clap-stack.md +409 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/concurrency.md +375 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/libraries.md +439 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/one-liners.md +291 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/proptest-insta.md +429 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/type-state.md +354 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/unsafe-discipline.md +250 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust/zero-cost-safety.md +527 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust-ub/README.md +289 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/rust-ub/ub-taxonomy.md +269 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/README.md +195 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/backend-hono.md +672 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/bootstrap.md +199 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/data-modeling.md +202 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/error-handling.md +169 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/tsconfig-strict.md +152 -0
- package/marketplace/plugins/litcodex/skills/lit-code/references/typescript/type-patterns.md +196 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/check-no-excuse-rules.sh +173 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/new-project.py +138 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/.editorconfig +13 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/.golangci.yml +95 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/README.md.tmpl +12 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/Taskfile.yml +40 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/ci.yml +37 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/config.go +24 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/gitignore +15 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/main.go.tmpl +22 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/go/templates/run.go +15 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/python/check-no-excuse-rules.py +687 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/python/new-project.py +172 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/python/new-script.py +116 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/rust/check-no-excuse-rules.py +296 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/rust/new-project.py +175 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/typescript/check-no-excuse-rules.ts +344 -0
- package/marketplace/plugins/litcodex/skills/lit-code/scripts/typescript/new-project.ts +174 -0
- package/marketplace/plugins/litcodex/skills/lit-commit/SKILL.md +254 -0
- package/marketplace/plugins/litcodex/skills/lit-commit/agents/openai.yaml +13 -0
- package/marketplace/plugins/litcodex/skills/lit-commit/references/safe-git-operations.md +123 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/SKILL.md +472 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/assets/explainer-scaffold.html +231 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/references/artifact-template.md +211 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/references/micro-worlds.md +190 -0
- package/marketplace/plugins/litcodex/skills/lit-comprehend/scripts/verify-explainer.ts +409 -0
- package/marketplace/plugins/litcodex/skills/lit-crucible/SKILL.md +321 -0
- package/marketplace/plugins/litcodex/skills/lit-crucible/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-crucible/references/adversarial-workflow.md +142 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/SKILL.md +326 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/references/ab-eval.md +36 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/references/discovery-evidence.md +200 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/references/workflow.md +137 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/fetch.mjs +122 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/reader.mjs +115 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/redaction.mjs +53 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/report.mjs +190 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/routes.mjs +56 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/safety.mjs +165 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/lib/validate.mjs +189 -0
- package/marketplace/plugins/litcodex/skills/lit-fetch/scripts/read-public-page.mjs +61 -0
- package/marketplace/plugins/litcodex/skills/lit-handoff/SKILL.md +231 -0
- package/marketplace/plugins/litcodex/skills/lit-init/SKILL.md +474 -0
- package/marketplace/plugins/litcodex/skills/lit-init/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-init/references/deep-repository-map.md +116 -0
- package/marketplace/plugins/litcodex/skills/lit-korean/SKILL.md +206 -0
- package/marketplace/plugins/litcodex/skills/lit-korean/references/prompt-injection-handling.md +23 -0
- package/marketplace/plugins/litcodex/skills/lit-korean/references/quick-rules.md +38 -0
- package/marketplace/plugins/litcodex/skills/lit-korean/references/safety-checklist.md +38 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/.gitkeep +0 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +202 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/agents/openai.yaml +9 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/references/full-workflow.md +290 -0
- package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +384 -0
- package/marketplace/plugins/litcodex/skills/lit-plan/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-plan/references/full-workflow.md +188 -0
- package/marketplace/plugins/litcodex/skills/lit-plan/references/intent-clear.md +67 -0
- package/marketplace/plugins/litcodex/skills/lit-plan/references/intent-unclear.md +88 -0
- package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +222 -0
- package/marketplace/plugins/litcodex/skills/lit-recap/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +255 -0
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/scripts/dependency-preflight.py +233 -0
- package/marketplace/plugins/litcodex/skills/lit-team/SKILL.md +190 -0
- package/marketplace/plugins/litcodex/skills/lit-team/references/team-orchestration.md +147 -0
- package/marketplace/plugins/litcodex/skills/lit-team/scripts/owner-lock.mjs +82 -0
- package/marketplace/plugins/litcodex/skills/lit-team/scripts/team-guide.mjs +31 -0
- package/marketplace/plugins/litcodex/skills/lit-team/scripts/team-state.mjs +262 -0
- package/marketplace/plugins/litcodex/skills/lit-team/scripts/team.mjs +145 -0
- package/marketplace/plugins/litcodex/skills/litcodex-contribute-bug-fix/SKILL.md +386 -0
- package/marketplace/plugins/litcodex/skills/litcodex-contribute-bug-fix/agents/openai.yaml +12 -0
- package/marketplace/plugins/litcodex/skills/litcodex-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
- package/marketplace/plugins/litcodex/skills/litcodex-doctor/SKILL.md +322 -0
- package/marketplace/plugins/litcodex/skills/litcodex-doctor/agents/openai.yaml +11 -0
- package/marketplace/plugins/litcodex/skills/litcodex-report-bug/SKILL.md +429 -0
- package/marketplace/plugins/litcodex/skills/litcodex-report-bug/agents/openai.yaml +10 -0
- package/marketplace/plugins/litcodex/skills/litgoal/SKILL.md +209 -0
- package/marketplace/plugins/litcodex/skills/litgoal/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +572 -0
- package/marketplace/plugins/litcodex/skills/litresearch/references/research-operations.md +158 -0
- package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +238 -0
- package/marketplace/plugins/litcodex/skills/litwork/references/delivery-playbook.md +228 -0
- package/marketplace/plugins/litcodex/skills/lsp/SKILL.md +193 -0
- package/marketplace/plugins/litcodex/skills/lsp/references/runtime-triage.md +153 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/SKILL.md +326 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/bash/README.md +60 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/csharp/README.md +71 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/dart/README.md +48 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/elixir/README.md +51 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/go/README.md +57 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/haskell/README.md +57 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/java/README.md +57 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/julia/README.md +60 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/lua/README.md +66 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/php/README.md +62 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/python/README.md +71 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/ruby/README.md +53 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/rust/README.md +59 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/swift/README.md +51 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/terraform/README.md +62 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/typescript/README.md +77 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/yaml/README.md +70 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/references/zig/README.md +49 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/scripts/lsp-server-table.ts +175 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/scripts/tsconfig.json +18 -0
- package/marketplace/plugins/litcodex/skills/lsp-setup/scripts/verify-lsp.ts +232 -0
- package/marketplace/plugins/litcodex/skills/refactor/SKILL.md +358 -0
- package/marketplace/plugins/litcodex/skills/refactor/references/safe-change-playbook.md +155 -0
- package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +867 -0
- package/marketplace/plugins/litcodex/skills/review-work/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/review-work/references/blocking-review-gates.md +108 -0
- package/marketplace/plugins/litcodex/skills/rules/SKILL.md +181 -0
- package/marketplace/plugins/litcodex/skills/rules/references/rule-discovery-and-matching.md +112 -0
- package/marketplace/plugins/litcodex/skills/skill-observer/SKILL.md +215 -0
- package/marketplace/plugins/litcodex/skills/skill-observer/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/skill-observer/references/review-contract.md +77 -0
- package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +503 -0
- package/marketplace/plugins/litcodex/skills/start-work/references/approved-plan-execution.md +124 -0
- package/marketplace/plugins/litcodex/skills/structural-search/SKILL.md +359 -0
- package/marketplace/plugins/litcodex/skills/structural-search/references/diagnostics.md +307 -0
- package/marketplace/plugins/litcodex/skills/structural-search/references/patterns-and-rules.md +381 -0
- package/marketplace/plugins/litcodex/skills/structural-search/references/rewrite-safety.md +266 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/SKILL.md +68 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/references/capture-playbook.md +141 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/references/complete-contract.md +389 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1alpha1.json +299 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1beta1.json +32 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1beta2.json +34 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/evidence-manifest.v1alpha1.json +117 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/evidence-manifest.v1beta1.json +80 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/schemas/review-receipt.v1alpha1.json +57 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/ansi.mjs +71 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/cli.mjs +54 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/east-asian-width.mjs +31 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/entrypoint.mjs +1 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/evidence-bytes.mjs +61 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/image-diff.mjs +63 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/png-crc.mjs +19 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/png-decode.mjs +169 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/strict-input.mjs +241 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/tui-grid.mjs +117 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/types.mjs +7 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-design-contract.mjs +547 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-evidence.mjs +392 -0
- package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-review-receipt.mjs +79 -0
- package/marketplace/plugins/litcodex/skills/wikify/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/wikify/PROVENANCE.md +20 -0
- package/marketplace/plugins/litcodex/skills/wikify/SKILL.md +146 -0
- package/marketplace/plugins/litcodex/skills/wikify/assets/home-template.md +44 -0
- package/marketplace/plugins/litcodex/skills/wikify/assets/maintenance-report-template.md +46 -0
- package/marketplace/plugins/litcodex/skills/wikify/assets/paper-source-note-template.md +137 -0
- package/marketplace/plugins/litcodex/skills/wikify/assets/source-note-template.md +45 -0
- package/marketplace/plugins/litcodex/skills/wikify/assets/wiki-rules-template.md +117 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/family-contract.md +26 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/modes/ingest.md +12 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/modes/init.md +11 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/modes/lint.md +11 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/modes/query.md +15 -0
- package/marketplace/plugins/litcodex/skills/wikify/references/modes/save.md +17 -0
- package/marketplace/plugins/litcodex/vendor/NOTICE +19 -0
- package/marketplace/plugins/litcodex/vendor/handoff/SKILL.md +199 -0
- package/marketplace/plugins/litcodex/vendor/handoff/evals/evals.json +154 -0
- package/marketplace/plugins/litcodex/vendor/handoff/examples/HANDOFF-example-generic-auth-refactor.md +97 -0
- package/marketplace/plugins/litcodex/vendor/handoff/templates/HANDOFF.md +121 -0
- package/marketplace/plugins/litcodex/vendor/licenses/022_handoff-MIT.txt +21 -0
- package/marketplace/plugins/litcodex/vendor/licenses/045_scientific-visualization-MIT.txt +21 -0
- package/marketplace/plugins/litcodex/vendor/provenance/022_handoff.md +25 -0
- package/marketplace/plugins/litcodex/vendor/provenance/045_scientific-visualization.md +42 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/SKILL.md +283 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/color_palettes.py +197 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/nature.mplstyle +75 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/presentation.mplstyle +74 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/publication.mplstyle +78 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/evals/evals.json +158 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/color_palettes.md +380 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/journal_requirements.md +359 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/matplotlib_examples.md +608 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/mdanalysis_martini_visualization.md +85 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/publication_guidelines.md +217 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/seaborn_for_publications.md +293 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/scripts/figure_export.py +238 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/scripts/style_presets.py +467 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/tests/test_figure_export.py +51 -0
- package/marketplace/plugins/litcodex/vendor/scientific-visualization/tests/test_style_presets.py +114 -0
- package/model-catalog.json +36 -0
- package/node_modules/@litcodex/lit-loop/CHANGELOG.md +49 -0
- package/node_modules/@litcodex/lit-loop/LICENSE +21 -0
- package/node_modules/@litcodex/lit-loop/NOTICE +8 -0
- package/node_modules/@litcodex/lit-loop/README.md +55 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-default.toml +14 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-explorer.toml +81 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-librarian.toml +104 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-litwork-reviewer.toml +41 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-metis.toml +71 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-momus.toml +75 -0
- package/node_modules/@litcodex/lit-loop/agents/litcodex-plan.toml +193 -0
- package/node_modules/@litcodex/lit-loop/directive.md +240 -0
- package/node_modules/@litcodex/lit-loop/directives/browser-drive.md +140 -0
- package/node_modules/@litcodex/lit-loop/directives/deep-interview.md +250 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-comprehend.md +247 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-crucible.md +254 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +126 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-init.md +140 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-plan.md +472 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +209 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-scientific-visualization.md +144 -0
- package/node_modules/@litcodex/lit-loop/directives/litgoal.md +231 -0
- package/node_modules/@litcodex/lit-loop/directives/litresearch.md +218 -0
- package/node_modules/@litcodex/lit-loop/directives/litwork.md +507 -0
- package/node_modules/@litcodex/lit-loop/directives/review-work.md +184 -0
- package/node_modules/@litcodex/lit-loop/directives/skill-observer.md +105 -0
- package/node_modules/@litcodex/lit-loop/directives/start-work.md +149 -0
- package/node_modules/@litcodex/lit-loop/dist/_scaffold.d.ts +1 -0
- package/node_modules/@litcodex/lit-loop/dist/_scaffold.js +3 -0
- package/node_modules/@litcodex/lit-loop/dist/browser-drive-route.d.ts +7 -0
- package/node_modules/@litcodex/lit-loop/dist/browser-drive-route.js +13 -0
- package/node_modules/@litcodex/lit-loop/dist/cli.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/cli.js +64 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-goal-instruction.d.ts +18 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-goal-instruction.js +146 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +53 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +228 -0
- package/node_modules/@litcodex/lit-loop/dist/directive.d.ts +43 -0
- package/node_modules/@litcodex/lit-loop/dist/directive.js +139 -0
- package/node_modules/@litcodex/lit-loop/dist/goal-status.d.ts +14 -0
- package/node_modules/@litcodex/lit-loop/dist/goal-status.js +32 -0
- package/node_modules/@litcodex/lit-loop/dist/guards.d.ts +73 -0
- package/node_modules/@litcodex/lit-loop/dist/guards.js +215 -0
- package/node_modules/@litcodex/lit-loop/dist/handoff-route.d.ts +5 -0
- package/node_modules/@litcodex/lit-loop/dist/handoff-route.js +11 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +19 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +189 -0
- package/node_modules/@litcodex/lit-loop/dist/lit-mark.d.ts +20 -0
- package/node_modules/@litcodex/lit-loop/dist/lit-mark.js +138 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-cli.d.ts +19 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-cli.js +109 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor-render.d.ts +7 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor-render.js +39 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor-types.d.ts +52 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor-types.js +7 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor.d.ts +34 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-doctor.js +336 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-errors.d.ts +15 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-errors.js +45 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-handlers.d.ts +18 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-handlers.js +367 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-model.d.ts +51 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-model.js +166 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-stdout.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-stdout.js +11 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-types.d.ts +26 -0
- package/node_modules/@litcodex/lit-loop/dist/loop-types.js +8 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +33 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.js +38 -0
- package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +29 -0
- package/node_modules/@litcodex/lit-loop/dist/modes.js +176 -0
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.d.ts +20 -0
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +147 -0
- package/node_modules/@litcodex/lit-loop/dist/redaction.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/redaction.js +177 -0
- package/node_modules/@litcodex/lit-loop/dist/scientific-visualization-route.d.ts +7 -0
- package/node_modules/@litcodex/lit-loop/dist/scientific-visualization-route.js +15 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/apply.d.ts +16 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/apply.js +227 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/config.d.ts +13 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/config.js +12 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/curator.d.ts +14 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/curator.js +112 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/hook.d.ts +19 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/hook.js +435 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/ownership.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/ownership.js +145 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/paths.d.ts +18 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/paths.js +43 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/review.d.ts +28 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/review.js +702 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/store.d.ts +32 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/store.js +667 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/transaction.d.ts +26 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/transaction.js +524 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/types.d.ts +81 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/types.js +246 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/usage.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop/usage.js +119 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop-cli.d.ts +8 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-loop-cli.js +111 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.d.ts +4 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +69 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer-cli.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer-cli.js +116 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer-route.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer-route.js +12 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer.d.ts +18 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-observer.js +946 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-renames.d.ts +20 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-renames.js +43 -0
- package/node_modules/@litcodex/lit-loop/dist/state-paths.d.ts +43 -0
- package/node_modules/@litcodex/lit-loop/dist/state-paths.js +121 -0
- package/node_modules/@litcodex/lit-loop/dist/state-store.d.ts +40 -0
- package/node_modules/@litcodex/lit-loop/dist/state-store.js +471 -0
- package/node_modules/@litcodex/lit-loop/dist/state-types.d.ts +121 -0
- package/node_modules/@litcodex/lit-loop/dist/state-types.js +67 -0
- package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +62 -0
- package/node_modules/@litcodex/lit-loop/dist/trigger.js +277 -0
- package/node_modules/@litcodex/lit-loop/package.json +33 -0
- package/node_modules/@litcodex/lit-loop/skills/browser-drive/SKILL.md +206 -0
- package/node_modules/@litcodex/lit-loop/skills/browser-drive/agents/openai.yaml +6 -0
- package/node_modules/@litcodex/lit-loop/skills/browser-drive/references/snapshot-act-loop.md +48 -0
- package/node_modules/@litcodex/lit-loop/skills/browser-drive/scripts/capability-probe.mjs +437 -0
- package/node_modules/@litcodex/lit-loop/skills/deep-interview/SKILL.md +339 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-burnoff/SKILL.md +489 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-burnoff/references/behavior-preserving-cleanup.md +105 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-burnoff-file/SKILL.md +169 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/SKILL.md +628 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/engineering-risk-signals.md +123 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/README.md +90 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/backend-stack.md +641 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/bootstrap.md +328 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/bubbletea-v2.md +360 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/cobra-stack.md +468 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/concurrency.md +362 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/data-modeling.md +329 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/error-handling.md +359 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/golangci-strict.md +236 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/grpc-connect.md +375 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/libraries.md +337 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/one-liners.md +202 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/sqlc-pgx.md +471 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/testing.md +467 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/go/type-patterns.md +298 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/observability-contracts.md +124 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/README.md +314 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/async-anyio.md +442 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/data-modeling.md +233 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/data-processing.md +133 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/error-handling.md +218 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/fastapi-stack.md +316 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/httpx2-optimization.md +360 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/libraries.md +307 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/one-liners.md +268 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/orjson-stack.md +378 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/pydantic-ai.md +285 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/pyproject-strict.md +232 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/textual-tui.md +201 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/python/type-patterns.md +176 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/README.md +317 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/async-tokio.md +299 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/axum-stack.md +467 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/cargo-strict.md +317 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/clap-stack.md +409 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/concurrency.md +375 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/libraries.md +439 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/one-liners.md +291 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/proptest-insta.md +429 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/type-state.md +354 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/unsafe-discipline.md +250 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust/zero-cost-safety.md +527 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust-ub/README.md +289 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/rust-ub/ub-taxonomy.md +269 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/README.md +195 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/backend-hono.md +672 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/bootstrap.md +199 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/data-modeling.md +202 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/error-handling.md +169 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/tsconfig-strict.md +152 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/references/typescript/type-patterns.md +196 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/check-no-excuse-rules.sh +173 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/new-project.py +138 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/.editorconfig +13 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/.golangci.yml +95 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/README.md.tmpl +12 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/Taskfile.yml +40 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/ci.yml +37 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/config.go +24 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/gitignore +15 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/main.go.tmpl +22 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/go/templates/run.go +15 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/python/check-no-excuse-rules.py +687 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/python/new-project.py +172 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/python/new-script.py +116 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/rust/check-no-excuse-rules.py +296 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/rust/new-project.py +175 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/typescript/check-no-excuse-rules.ts +344 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-code/scripts/typescript/new-project.ts +174 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-commit/SKILL.md +254 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-commit/agents/openai.yaml +13 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-commit/references/safe-git-operations.md +123 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-comprehend/SKILL.md +472 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-crucible/SKILL.md +321 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-crucible/agents/openai.yaml +6 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-crucible/references/adversarial-workflow.md +142 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/SKILL.md +326 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/references/ab-eval.md +36 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/references/discovery-evidence.md +200 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/references/workflow.md +137 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/fetch.mjs +122 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/reader.mjs +115 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/redaction.mjs +53 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/report.mjs +190 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/routes.mjs +56 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/safety.mjs +165 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/lib/validate.mjs +189 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-fetch/scripts/read-public-page.mjs +61 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-handoff/SKILL.md +231 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-init/SKILL.md +474 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-init/agents/openai.yaml +6 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-init/references/deep-repository-map.md +116 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-korean/SKILL.md +206 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/prompt-injection-handling.md +23 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/quick-rules.md +38 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/safety-checklist.md +38 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +202 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +384 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +222 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +255 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/scripts/dependency-preflight.py +233 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/SKILL.md +190 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/references/team-orchestration.md +147 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/scripts/owner-lock.mjs +82 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/scripts/team-guide.mjs +31 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/scripts/team-state.mjs +262 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-team/scripts/team.mjs +145 -0
- package/node_modules/@litcodex/lit-loop/skills/litgoal/SKILL.md +209 -0
- package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +572 -0
- package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +238 -0
- package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +867 -0
- package/node_modules/@litcodex/lit-loop/skills/skill-observer/SKILL.md +215 -0
- package/node_modules/@litcodex/lit-loop/skills/skill-observer/references/review-contract.md +77 -0
- package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +503 -0
- package/node_modules/@litcodex/lit-loop/vendor/NOTICE +19 -0
- package/node_modules/@litcodex/lit-loop/vendor/handoff/SKILL.md +199 -0
- package/node_modules/@litcodex/lit-loop/vendor/handoff/evals/evals.json +154 -0
- package/node_modules/@litcodex/lit-loop/vendor/handoff/examples/HANDOFF-example-generic-auth-refactor.md +97 -0
- package/node_modules/@litcodex/lit-loop/vendor/handoff/templates/HANDOFF.md +121 -0
- package/node_modules/@litcodex/lit-loop/vendor/licenses/022_handoff-MIT.txt +21 -0
- package/node_modules/@litcodex/lit-loop/vendor/licenses/045_scientific-visualization-MIT.txt +21 -0
- package/node_modules/@litcodex/lit-loop/vendor/provenance/022_handoff.md +25 -0
- package/node_modules/@litcodex/lit-loop/vendor/provenance/045_scientific-visualization.md +42 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/SKILL.md +283 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/color_palettes.py +197 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/nature.mplstyle +75 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/presentation.mplstyle +74 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/publication.mplstyle +78 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/evals/evals.json +158 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/color_palettes.md +380 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/journal_requirements.md +359 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/matplotlib_examples.md +608 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/mdanalysis_martini_visualization.md +85 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/publication_guidelines.md +217 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/seaborn_for_publications.md +293 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/scripts/figure_export.py +238 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/scripts/style_presets.py +467 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/tests/test_figure_export.py +51 -0
- package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/tests/test_style_presets.py +114 -0
- package/package.json +64 -0
- package/readme-assets/ascii-readme.svg +5 -0
- package/readme-assets/badge-license.svg +1 -0
- package/readme-assets/badge-version.svg +1 -0
- package/readme-assets/clay-icon.png +0 -0
- package/readme-assets/cover.webp +0 -0
- package/readme-assets/ignition-poster.png +0 -0
- package/readme-assets/litcodex-continuity-1600.webp +0 -0
- package/readme-assets/litcodex-ignition-1600.webp +0 -0
- package/readme-assets/litcodex-wordmark.svg +5 -0
- package/readme-assets/lucide-book-open.svg +14 -0
- package/readme-assets/lucide-play.svg +13 -0
- package/readme-assets/lucide-shield-check.svg +14 -0
package/marketplace/plugins/litcodex/components/start-work-continuation/dist/lifecycle-store.js
ADDED
|
@@ -0,0 +1,1664 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { closeSync, constants, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readSync, realpathSync, renameSync, unlinkSync, writeSync, } from "node:fs";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { analyzePlanProgress } from "./plan-progress.js";
|
|
5
|
+
export const START_WORK_STATE_MAX_BYTES = 1_000_000;
|
|
6
|
+
export const START_WORK_PLAN_MAX_BYTES = 1_000_000;
|
|
7
|
+
export const START_WORK_LEDGER_TAIL_BYTES = 2_000_000;
|
|
8
|
+
export const START_WORK_MAX_FIELD_BYTES = 10_000;
|
|
9
|
+
export const START_WORK_MAX_DISPLAY_BYTES = 512;
|
|
10
|
+
export const START_WORK_MAX_STDIN_BYTES = 1_000_000;
|
|
11
|
+
export const START_WORK_MAX_HISTORY_EVENTS = 64;
|
|
12
|
+
export const START_WORK_MAX_AUTHORITY_BYTES = 64_000;
|
|
13
|
+
export const START_WORK_MAX_INIT_BYTES = 256_000;
|
|
14
|
+
const MAX_AUTHORITY_ITEMS = 64;
|
|
15
|
+
const MAX_AUTHORITY_GRANTS = 64;
|
|
16
|
+
const LOCK_ATTEMPTS = 8;
|
|
17
|
+
const LOCK_STALE_MS = 30_000;
|
|
18
|
+
const O_NOFOLLOW = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
|
|
19
|
+
export class LifecycleStoreError extends Error {
|
|
20
|
+
constructor(code, message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.name = "LifecycleStoreError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function statePathFor(cwd) {
|
|
27
|
+
return join(cwd, ".litcodex", "start-work", "state.json");
|
|
28
|
+
}
|
|
29
|
+
export function ledgerPathFor(cwd) {
|
|
30
|
+
return join(cwd, ".litcodex", "lit-loop", "ledger.jsonl");
|
|
31
|
+
}
|
|
32
|
+
export function isBoundedLifecycleText(value, maxBytes = START_WORK_MAX_FIELD_BYTES) {
|
|
33
|
+
return typeof value === "string" && value.length > 0 && Buffer.byteLength(value, "utf8") <= maxBytes;
|
|
34
|
+
}
|
|
35
|
+
export function readLifecycleState(cwd) {
|
|
36
|
+
try {
|
|
37
|
+
const paths = managedPaths(cwd, false);
|
|
38
|
+
return loadState(paths).state;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof Error)
|
|
42
|
+
return null;
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function inspectLifecycleState(cwd) {
|
|
47
|
+
try {
|
|
48
|
+
const loaded = loadState(managedPaths(cwd, false));
|
|
49
|
+
return { ok: true, state: loaded.state, sourceSchema: loaded.sourceSchema };
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof LifecycleStoreError)
|
|
53
|
+
return { ok: false, code: error.code, message: error.message };
|
|
54
|
+
if (error instanceof Error)
|
|
55
|
+
return { ok: false, code: "STATE_UNREADABLE", message: error.message };
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function selectWorkForSession(state, sessionId, statuses) {
|
|
60
|
+
if (state.active_work_id === null)
|
|
61
|
+
return null;
|
|
62
|
+
const prefixed = `codex:${sessionId}`;
|
|
63
|
+
const selected = state.works[state.active_work_id];
|
|
64
|
+
if (selected === undefined || selected.work_id !== state.active_work_id)
|
|
65
|
+
return null;
|
|
66
|
+
if (!statuses.includes(selected.status) || !selected.session_ids.includes(prefixed))
|
|
67
|
+
return null;
|
|
68
|
+
const matches = Object.entries(state.works).filter(([id, work]) => id === work.work_id && statuses.includes(work.status) && work.session_ids.includes(prefixed));
|
|
69
|
+
return matches.length === 1 && matches[0]?.[0] === state.active_work_id ? selected : null;
|
|
70
|
+
}
|
|
71
|
+
export function resolveCanonicalPlan(cwd, activePlan, allowHistoricalAbsolute = false) {
|
|
72
|
+
return canonicalPlan(managedPaths(cwd, false), activePlan, allowHistoricalAbsolute);
|
|
73
|
+
}
|
|
74
|
+
export function initializeWork(cwd, request, options = {}) {
|
|
75
|
+
validateInitRequest(cwd, request);
|
|
76
|
+
const paths = managedPaths(cwd, true);
|
|
77
|
+
const plan = canonicalPlan(paths, request.plan, false);
|
|
78
|
+
if (!plan.progress.contractValid)
|
|
79
|
+
throw new LifecycleStoreError("PLAN_EMPTY", "start-work plan requires real Todos and final verification checkbox rows");
|
|
80
|
+
const authority = normalizeAuthority(paths, request.authority);
|
|
81
|
+
const worktreePath = normalizeWorktree(request.worktreePath ?? null, authority.allowed_roots);
|
|
82
|
+
const normalizedRequest = { ...request, authority, worktreePath, plan: plan.relativePath };
|
|
83
|
+
const initFingerprint = digest(stableJson(normalizedRequest));
|
|
84
|
+
return withStateLock(paths, options, () => {
|
|
85
|
+
if (pathExists(paths.state)) {
|
|
86
|
+
const loaded = loadState(paths);
|
|
87
|
+
reconcileAllLastTransitions(paths, loaded.state, options);
|
|
88
|
+
const existing = findCanonicalEvent(paths, loaded.state, request.initId, options);
|
|
89
|
+
if (existing !== undefined) {
|
|
90
|
+
if (existing.kind !== "start_work_initialized" || existing.initFingerprint !== initFingerprint) {
|
|
91
|
+
throw new LifecycleStoreError("INIT_CONFLICT", "existing state does not match the requested init id");
|
|
92
|
+
}
|
|
93
|
+
ensureLedgerEvent(paths, existing, options);
|
|
94
|
+
return { changed: false, state: loaded.state, event: existing };
|
|
95
|
+
}
|
|
96
|
+
const state = normalizeStateForMutation(paths, loaded);
|
|
97
|
+
if (state.active_work_id !== null || Object.values(state.works).some((work) => isNonterminal(work.status))) {
|
|
98
|
+
throw new LifecycleStoreError("INIT_NONTERMINAL", "new init is rejected while nonterminal work exists");
|
|
99
|
+
}
|
|
100
|
+
assertReplayAvailable(loaded.state, request.expectedRevision);
|
|
101
|
+
if (state.revision !== request.expectedRevision) {
|
|
102
|
+
throw new LifecycleStoreError("REVISION_CONFLICT", "expected revision does not match current revision");
|
|
103
|
+
}
|
|
104
|
+
if (state.works[request.workId] !== undefined) {
|
|
105
|
+
throw new LifecycleStoreError("WORK_ID_CONFLICT", "new init cannot replace a preserved work record");
|
|
106
|
+
}
|
|
107
|
+
const at = options.now?.() ?? new Date().toISOString();
|
|
108
|
+
const event = initEvent(request, plan, initFingerprint, state.revision + 1, at);
|
|
109
|
+
const work = initializedWork(request, plan, authority, worktreePath, event, at);
|
|
110
|
+
const history = appendHistory(state, event);
|
|
111
|
+
const nextState = compactTerminalWorks({
|
|
112
|
+
...state,
|
|
113
|
+
schema_version: 3,
|
|
114
|
+
revision: event.revision,
|
|
115
|
+
active_work_id: request.workId,
|
|
116
|
+
works: { ...state.works, [request.workId]: work },
|
|
117
|
+
transition_history: history.events,
|
|
118
|
+
history_floor_revision: history.floorRevision,
|
|
119
|
+
init_id: request.initId,
|
|
120
|
+
});
|
|
121
|
+
validateStateConsistency(nextState);
|
|
122
|
+
writeStateAtomic(paths, nextState, false);
|
|
123
|
+
options.afterStateWrite?.();
|
|
124
|
+
ensureLedgerEvent(paths, event, options);
|
|
125
|
+
return { changed: true, state: nextState, event };
|
|
126
|
+
}
|
|
127
|
+
if (request.expectedRevision !== 0) {
|
|
128
|
+
throw new LifecycleStoreError("REVISION_CONFLICT", "fresh init requires expected revision zero");
|
|
129
|
+
}
|
|
130
|
+
const existingLedger = scanLedgerForTransition(paths, request.initId, options);
|
|
131
|
+
if (existingLedger.event !== undefined || existingLedger.conflict) {
|
|
132
|
+
throw new LifecycleStoreError("INIT_CONFLICT", "init id already exists in lifecycle ledger");
|
|
133
|
+
}
|
|
134
|
+
const at = options.now?.() ?? new Date().toISOString();
|
|
135
|
+
const event = initEvent(request, plan, initFingerprint, 1, at);
|
|
136
|
+
const work = initializedWork(request, plan, authority, worktreePath, event, at);
|
|
137
|
+
const state = {
|
|
138
|
+
schema_version: 3,
|
|
139
|
+
revision: 1,
|
|
140
|
+
active_work_id: request.workId,
|
|
141
|
+
works: { [request.workId]: work },
|
|
142
|
+
transition_history: { [request.initId]: event },
|
|
143
|
+
history_floor_revision: 1,
|
|
144
|
+
init_id: request.initId,
|
|
145
|
+
};
|
|
146
|
+
validateStateConsistency(state);
|
|
147
|
+
writeStateAtomic(paths, state, true);
|
|
148
|
+
options.afterStateWrite?.();
|
|
149
|
+
ensureLedgerEvent(paths, event, options);
|
|
150
|
+
return { changed: true, state, event };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
export function transitionWork(cwd, request, options = {}) {
|
|
154
|
+
validateTransitionRequest(cwd, request);
|
|
155
|
+
const paths = managedPaths(cwd, true);
|
|
156
|
+
return withStateLock(paths, options, () => {
|
|
157
|
+
const loaded = loadState(paths);
|
|
158
|
+
reconcileAllLastTransitions(paths, loaded.state, options);
|
|
159
|
+
const existing = findCanonicalEvent(paths, loaded.state, request.transitionId, options);
|
|
160
|
+
if (existing !== undefined) {
|
|
161
|
+
if (!requestMatchesEvent(request, existing)) {
|
|
162
|
+
throw new LifecycleStoreError("TRANSITION_ID_CONFLICT", "transition id has a conflicting canonical event");
|
|
163
|
+
}
|
|
164
|
+
ensureLedgerEvent(paths, existing, options);
|
|
165
|
+
return { changed: false, state: loaded.state, event: existing };
|
|
166
|
+
}
|
|
167
|
+
assertReplayAvailable(loaded.state, request.expectedRevision);
|
|
168
|
+
const migrationAuthority = request.authority === undefined ? undefined : normalizeAuthority(paths, request.authority);
|
|
169
|
+
const state = normalizeStateForMutation(paths, loaded, migrationAuthority);
|
|
170
|
+
const work = state.works[request.workId];
|
|
171
|
+
if (work === undefined ||
|
|
172
|
+
work.work_id !== request.workId ||
|
|
173
|
+
!work.session_ids.includes(`codex:${request.sessionId}`) ||
|
|
174
|
+
state.active_work_id !== request.workId) {
|
|
175
|
+
throw new LifecycleStoreError("WORK_SELECTION_INVALID", "workId did not select the active matching work");
|
|
176
|
+
}
|
|
177
|
+
const authority = work.authority;
|
|
178
|
+
if (authority === undefined) {
|
|
179
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "nonterminal work lacks authority");
|
|
180
|
+
}
|
|
181
|
+
const boundary = request.boundary === undefined ? undefined : normalizeBoundary(request.boundary, authority);
|
|
182
|
+
if (request.action === "pause" &&
|
|
183
|
+
work.status === "paused" &&
|
|
184
|
+
boundary !== undefined &&
|
|
185
|
+
work.pending_boundary !== undefined &&
|
|
186
|
+
boundariesEquivalent(boundary, work.pending_boundary)) {
|
|
187
|
+
const prior = work.last_transition;
|
|
188
|
+
if (prior === undefined || prior.kind !== "start_work_paused") {
|
|
189
|
+
throw new LifecycleStoreError("BOUNDARY_STATE_INVALID", "pending boundary lacks its pause event");
|
|
190
|
+
}
|
|
191
|
+
ensureLedgerEvent(paths, prior, options);
|
|
192
|
+
return { changed: false, state, event: prior };
|
|
193
|
+
}
|
|
194
|
+
if (request.action === "pause" && work.status === "active" && boundary !== undefined) {
|
|
195
|
+
if (authorityAuthorizesBoundary(authority, boundary)) {
|
|
196
|
+
const prior = work.last_transition;
|
|
197
|
+
if (prior === undefined) {
|
|
198
|
+
throw new LifecycleStoreError("BOUNDARY_STATE_INVALID", "authorized work lacks its canonical event");
|
|
199
|
+
}
|
|
200
|
+
ensureLedgerEvent(paths, prior, options);
|
|
201
|
+
return { changed: false, state, event: prior };
|
|
202
|
+
}
|
|
203
|
+
const consumed = work.authority_grants?.find((grant) => grantAuthorizesBoundary(grant, boundary));
|
|
204
|
+
if (consumed !== undefined) {
|
|
205
|
+
const prior = work.last_transition;
|
|
206
|
+
if (prior === undefined) {
|
|
207
|
+
throw new LifecycleStoreError("BOUNDARY_STATE_INVALID", "authorized work lacks its canonical event");
|
|
208
|
+
}
|
|
209
|
+
ensureLedgerEvent(paths, prior, options);
|
|
210
|
+
return { changed: false, state, event: prior };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (state.revision !== request.expectedRevision) {
|
|
214
|
+
throw new LifecycleStoreError("REVISION_CONFLICT", "expected revision does not match current revision");
|
|
215
|
+
}
|
|
216
|
+
const plan = canonicalPlan(paths, work.active_plan, false);
|
|
217
|
+
// Fresh init enforces the planner contract; persisted work retains legacy progress compatibility.
|
|
218
|
+
if (plan.progress.total === 0)
|
|
219
|
+
throw new LifecycleStoreError("PLAN_EMPTY", "start-work plan has no executable checkbox");
|
|
220
|
+
const target = targetStatus(request.action, work.status, request.reasonCode);
|
|
221
|
+
if (request.action === "complete" && plan.progress.remaining !== 0) {
|
|
222
|
+
throw new LifecycleStoreError("PLAN_INCOMPLETE", "complete requires zero remaining executable checkboxes");
|
|
223
|
+
}
|
|
224
|
+
const grant = request.grant === undefined ? undefined : normalizeGrant(request.grant, authority, boundary);
|
|
225
|
+
if (request.action === "pause" && boundary === undefined) {
|
|
226
|
+
throw new LifecycleStoreError("BOUNDARY_REQUIRED", "pause requires an explicit authority boundary");
|
|
227
|
+
}
|
|
228
|
+
if (request.action === "resume") {
|
|
229
|
+
if (boundary === undefined || grant === undefined) {
|
|
230
|
+
throw new LifecycleStoreError("GRANT_REQUIRED", "resume requires matching boundary and grant");
|
|
231
|
+
}
|
|
232
|
+
const pending = work.pending_boundary ?? (loaded.sourceSchema === 2 ? boundary : undefined);
|
|
233
|
+
if (pending === undefined || !boundariesEquivalent(boundary, pending)) {
|
|
234
|
+
throw new LifecycleStoreError("BOUNDARY_MISMATCH", "resume boundary does not match pending boundary");
|
|
235
|
+
}
|
|
236
|
+
const conflictingGrant = work.authority_grants?.find((item) => item.grant_id === grant.grant_id && !grantMatchesBoundary(item, boundary));
|
|
237
|
+
if (conflictingGrant !== undefined) {
|
|
238
|
+
throw new LifecycleStoreError("GRANT_CONFLICT", "grant id is already bound to a different boundary");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const event = transitionEvent(state, work, request, target, plan, options.now?.() ?? new Date().toISOString(), boundary, grant);
|
|
242
|
+
const grants = request.action === "resume" && grant !== undefined
|
|
243
|
+
? [...(work.authority_grants ?? []).filter((item) => item.grant_id !== grant.grant_id), grant].slice(-MAX_AUTHORITY_GRANTS)
|
|
244
|
+
: work.authority_grants;
|
|
245
|
+
const updatedWork = {
|
|
246
|
+
...work,
|
|
247
|
+
status: target,
|
|
248
|
+
...(request.action === "pause" && boundary !== undefined ? { pending_boundary: boundary } : {}),
|
|
249
|
+
...(request.action === "resume" && grants !== undefined ? { authority_grants: grants } : {}),
|
|
250
|
+
last_transition: event,
|
|
251
|
+
};
|
|
252
|
+
const nextWork = request.action === "resume" || terminalAction(request.action) ? omitPendingBoundary(updatedWork) : updatedWork;
|
|
253
|
+
const terminal = target === "abandoned" || target === "completed";
|
|
254
|
+
const history = appendHistory(state, event);
|
|
255
|
+
const nextState = compactTerminalWorks({
|
|
256
|
+
...state,
|
|
257
|
+
schema_version: 3,
|
|
258
|
+
revision: event.revision,
|
|
259
|
+
active_work_id: terminal ? null : request.workId,
|
|
260
|
+
works: { ...state.works, [request.workId]: nextWork },
|
|
261
|
+
transition_history: history.events,
|
|
262
|
+
history_floor_revision: history.floorRevision,
|
|
263
|
+
});
|
|
264
|
+
validateStateConsistency(nextState);
|
|
265
|
+
writeStateAtomic(paths, nextState, false);
|
|
266
|
+
options.afterStateWrite?.();
|
|
267
|
+
ensureLedgerEvent(paths, event, options);
|
|
268
|
+
return { changed: true, state: nextState, event };
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
export function advanceStopLease(cwd, request, options = {}) {
|
|
272
|
+
if (!isBoundedLifecycleText(cwd) ||
|
|
273
|
+
!isBoundedLifecycleText(request.sessionId) ||
|
|
274
|
+
!isBoundedLifecycleText(request.turnId) ||
|
|
275
|
+
!isBoundedLifecycleText(request.workId) ||
|
|
276
|
+
!Number.isSafeInteger(request.expectedRevision) ||
|
|
277
|
+
request.expectedRevision < 0 ||
|
|
278
|
+
!isHash(request.progressToken)) {
|
|
279
|
+
throw new LifecycleStoreError("LEASE_INPUT_INVALID", "continuation lease input is malformed or oversized");
|
|
280
|
+
}
|
|
281
|
+
const paths = managedPaths(cwd, true);
|
|
282
|
+
return withStateLock(paths, options, () => {
|
|
283
|
+
const loaded = loadState(paths);
|
|
284
|
+
reconcileAllLastTransitions(paths, loaded.state, options);
|
|
285
|
+
const state = normalizeStateForMutation(paths, loaded);
|
|
286
|
+
if (state.revision !== request.expectedRevision || state.active_work_id !== request.workId) {
|
|
287
|
+
return { outcome: "silent", state };
|
|
288
|
+
}
|
|
289
|
+
const work = selectWorkForSession(state, request.sessionId, ["active"]);
|
|
290
|
+
if (work === null || work.work_id !== request.workId)
|
|
291
|
+
return { outcome: "silent", state };
|
|
292
|
+
const plan = canonicalPlan(paths, work.active_plan, false);
|
|
293
|
+
if (plan.progress.total === 0 || plan.progress.remaining === 0)
|
|
294
|
+
return { outcome: "silent", state };
|
|
295
|
+
if (plan.progress.progressToken !== request.progressToken) {
|
|
296
|
+
throw new LifecycleStoreError("PROGRESS_TOKEN_MISMATCH", "continuation progress token does not match the plan");
|
|
297
|
+
}
|
|
298
|
+
const lease = work.continuation_lease;
|
|
299
|
+
if (lease?.progress_token === request.progressToken && lease.turn_id === request.turnId) {
|
|
300
|
+
const event = findCanonicalEvent(paths, state, lease.transition_id, options);
|
|
301
|
+
if (event === undefined || event.kind !== "start_work_continuation_issued") {
|
|
302
|
+
throw new LifecycleStoreError("LEASE_STATE_INVALID", "continuation lease lacks its canonical event");
|
|
303
|
+
}
|
|
304
|
+
return { outcome: "replay", state, event };
|
|
305
|
+
}
|
|
306
|
+
if (lease?.progress_token === request.progressToken)
|
|
307
|
+
return { outcome: "silent", state };
|
|
308
|
+
const at = options.now?.() ?? new Date().toISOString();
|
|
309
|
+
const transitionId = `stop-continue:${shortDigest(request.sessionId)}:${shortDigest(request.turnId)}:${request.progressToken}`;
|
|
310
|
+
const existing = findCanonicalEvent(paths, state, transitionId, options);
|
|
311
|
+
if (existing !== undefined) {
|
|
312
|
+
ensureLedgerEvent(paths, existing, options);
|
|
313
|
+
return { outcome: "replay", state, event: existing };
|
|
314
|
+
}
|
|
315
|
+
const revision = state.revision + 1;
|
|
316
|
+
const event = {
|
|
317
|
+
kind: "start_work_continuation_issued",
|
|
318
|
+
at,
|
|
319
|
+
workId: work.work_id,
|
|
320
|
+
transitionId,
|
|
321
|
+
revision,
|
|
322
|
+
fromWorkStatus: "active",
|
|
323
|
+
toWorkStatus: "active",
|
|
324
|
+
plan: work.active_plan,
|
|
325
|
+
sessionId: `codex:${request.sessionId}`,
|
|
326
|
+
turnId: request.turnId,
|
|
327
|
+
progressToken: request.progressToken,
|
|
328
|
+
};
|
|
329
|
+
const nextWork = {
|
|
330
|
+
...work,
|
|
331
|
+
continuation_lease: {
|
|
332
|
+
progress_token: request.progressToken,
|
|
333
|
+
turn_id: request.turnId,
|
|
334
|
+
transition_id: transitionId,
|
|
335
|
+
},
|
|
336
|
+
last_transition: event,
|
|
337
|
+
};
|
|
338
|
+
const history = appendHistory(state, event);
|
|
339
|
+
const nextState = compactTerminalWorks({
|
|
340
|
+
...state,
|
|
341
|
+
schema_version: 3,
|
|
342
|
+
revision,
|
|
343
|
+
works: { ...state.works, [work.work_id]: nextWork },
|
|
344
|
+
transition_history: history.events,
|
|
345
|
+
history_floor_revision: history.floorRevision,
|
|
346
|
+
});
|
|
347
|
+
validateStateConsistency(nextState);
|
|
348
|
+
writeStateAtomic(paths, nextState, false);
|
|
349
|
+
options.afterStateWrite?.();
|
|
350
|
+
ensureLedgerEvent(paths, event, options);
|
|
351
|
+
return { outcome: "issued", state: nextState, event };
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
export function reconcileLifecycleState(cwd, options = {}) {
|
|
355
|
+
try {
|
|
356
|
+
const paths = managedPaths(cwd, true);
|
|
357
|
+
return withStateLock(paths, options, () => {
|
|
358
|
+
const loaded = loadState(paths);
|
|
359
|
+
reconcileAllLastTransitions(paths, loaded.state, options);
|
|
360
|
+
return loaded.state;
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
if (error instanceof LifecycleStoreError && error.code === "STATE_MISSING")
|
|
365
|
+
return null;
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function managedPaths(cwd, createMutableDirs) {
|
|
370
|
+
if (!isBoundedLifecycleText(cwd))
|
|
371
|
+
throw new LifecycleStoreError("CWD_INVALID", "cwd is malformed or oversized");
|
|
372
|
+
let canonicalCwd;
|
|
373
|
+
try {
|
|
374
|
+
canonicalCwd = realpathSync(cwd);
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
throw managedError("CWD_UNREADABLE", "cwd is unreadable", error);
|
|
378
|
+
}
|
|
379
|
+
assertSafeDirectory(canonicalCwd, canonicalCwd, "cwd");
|
|
380
|
+
const litcodex = join(canonicalCwd, ".litcodex");
|
|
381
|
+
const plans = join(litcodex, "plans");
|
|
382
|
+
assertSafeDirectory(litcodex, canonicalCwd, ".litcodex");
|
|
383
|
+
assertSafeDirectory(plans, canonicalCwd, "plans");
|
|
384
|
+
const startWork = join(litcodex, "start-work");
|
|
385
|
+
const litLoop = join(litcodex, "lit-loop");
|
|
386
|
+
ensureManagedDirectory(startWork, litcodex, createMutableDirs, "start-work");
|
|
387
|
+
ensureManagedDirectory(litLoop, litcodex, createMutableDirs, "lit-loop");
|
|
388
|
+
const paths = {
|
|
389
|
+
cwd: canonicalCwd,
|
|
390
|
+
litcodex,
|
|
391
|
+
plans,
|
|
392
|
+
startWork,
|
|
393
|
+
litLoop,
|
|
394
|
+
state: join(startWork, "state.json"),
|
|
395
|
+
ledger: join(litLoop, "ledger.jsonl"),
|
|
396
|
+
lock: join(startWork, "state.json.lock"),
|
|
397
|
+
};
|
|
398
|
+
for (const [path, label] of [
|
|
399
|
+
[paths.state, "state"],
|
|
400
|
+
[paths.ledger, "ledger"],
|
|
401
|
+
[paths.lock, "lock"],
|
|
402
|
+
]) {
|
|
403
|
+
if (pathExists(path))
|
|
404
|
+
assertSafeLeaf(path, label);
|
|
405
|
+
}
|
|
406
|
+
return paths;
|
|
407
|
+
}
|
|
408
|
+
function assertSafeDirectory(path, root, label) {
|
|
409
|
+
let stat;
|
|
410
|
+
try {
|
|
411
|
+
stat = lstatSync(path);
|
|
412
|
+
}
|
|
413
|
+
catch (error) {
|
|
414
|
+
throw managedError("MANAGED_PATH_MISSING", `${label} directory is missing`, error);
|
|
415
|
+
}
|
|
416
|
+
if (stat.isSymbolicLink())
|
|
417
|
+
throw new LifecycleStoreError("MANAGED_PATH_SYMLINK", `${label} is a symbolic link`);
|
|
418
|
+
if (!stat.isDirectory())
|
|
419
|
+
throw new LifecycleStoreError("MANAGED_PATH_INVALID", `${label} is not a directory`);
|
|
420
|
+
const canonical = realpathSync(path);
|
|
421
|
+
if (!isWithin(root, canonical))
|
|
422
|
+
throw new LifecycleStoreError("MANAGED_PATH_ESCAPE", `${label} escapes canonical cwd`);
|
|
423
|
+
}
|
|
424
|
+
function ensureManagedDirectory(path, root, create, label) {
|
|
425
|
+
if (!pathExists(path)) {
|
|
426
|
+
if (!create)
|
|
427
|
+
return;
|
|
428
|
+
mkdirSync(path, { mode: 0o700 });
|
|
429
|
+
}
|
|
430
|
+
assertSafeDirectory(path, root, label);
|
|
431
|
+
}
|
|
432
|
+
function assertSafeLeaf(path, label) {
|
|
433
|
+
const stat = lstatSync(path);
|
|
434
|
+
if (stat.isSymbolicLink())
|
|
435
|
+
throw new LifecycleStoreError("MANAGED_PATH_SYMLINK", `${label} is a symbolic link`);
|
|
436
|
+
if (!stat.isFile())
|
|
437
|
+
throw new LifecycleStoreError("MANAGED_PATH_INVALID", `${label} is not a regular file`);
|
|
438
|
+
}
|
|
439
|
+
function canonicalPlan(paths, input, allowHistoricalAbsolute) {
|
|
440
|
+
if (!isBoundedLifecycleText(input))
|
|
441
|
+
throw new LifecycleStoreError("PLAN_PATH_INVALID", "plan path is invalid");
|
|
442
|
+
let candidate;
|
|
443
|
+
if (isAbsolute(input)) {
|
|
444
|
+
if (!allowHistoricalAbsolute)
|
|
445
|
+
throw new LifecycleStoreError("PLAN_PATH_INVALID", "absolute plan path is not allowed");
|
|
446
|
+
candidate = input;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
if (!/^\.litcodex\/plans\/[^/\\]+\.md$/.test(input)) {
|
|
450
|
+
throw new LifecycleStoreError("PLAN_PATH_INVALID", "plan must be .litcodex/plans/*.md");
|
|
451
|
+
}
|
|
452
|
+
candidate = resolve(paths.cwd, input);
|
|
453
|
+
}
|
|
454
|
+
let canonical;
|
|
455
|
+
try {
|
|
456
|
+
const leaf = lstatSync(candidate);
|
|
457
|
+
if (leaf.isSymbolicLink())
|
|
458
|
+
throw new LifecycleStoreError("PLAN_SYMLINK", "plan is a symbolic link");
|
|
459
|
+
canonical = realpathSync(candidate);
|
|
460
|
+
}
|
|
461
|
+
catch (error) {
|
|
462
|
+
if (error instanceof LifecycleStoreError)
|
|
463
|
+
throw error;
|
|
464
|
+
throw managedError("PLAN_UNREADABLE", "plan is unreadable", error);
|
|
465
|
+
}
|
|
466
|
+
if (dirname(canonical) !== paths.plans || !isWithin(paths.plans, canonical)) {
|
|
467
|
+
throw new LifecycleStoreError("PLAN_REALPATH_ESCAPE", "plan resolves outside canonical plans root");
|
|
468
|
+
}
|
|
469
|
+
const relativePath = `.litcodex/plans/${basename(canonical)}`;
|
|
470
|
+
const fd = openNoFollow(canonical, constants.O_RDONLY, undefined, "plan");
|
|
471
|
+
try {
|
|
472
|
+
const stat = fstatSync(fd);
|
|
473
|
+
if (!stat.isFile())
|
|
474
|
+
throw new LifecycleStoreError("PLAN_NOT_REGULAR", "plan is not a regular file");
|
|
475
|
+
const text = readBoundedUtf8(fd, stat.size, START_WORK_PLAN_MAX_BYTES, "PLAN_TOO_LARGE");
|
|
476
|
+
return { absolutePath: canonical, relativePath, text, progress: analyzePlanProgress(text) };
|
|
477
|
+
}
|
|
478
|
+
finally {
|
|
479
|
+
closeSync(fd);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function loadState(paths) {
|
|
483
|
+
if (!pathExists(paths.state))
|
|
484
|
+
throw new LifecycleStoreError("STATE_MISSING", "start-work state is missing");
|
|
485
|
+
assertSafeLeaf(paths.state, "state");
|
|
486
|
+
const fd = openNoFollow(paths.state, constants.O_RDONLY, undefined, "state");
|
|
487
|
+
let raw;
|
|
488
|
+
try {
|
|
489
|
+
const stat = fstatSync(fd);
|
|
490
|
+
raw = readBoundedUtf8(fd, stat.size, START_WORK_STATE_MAX_BYTES, "STATE_TOO_LARGE");
|
|
491
|
+
}
|
|
492
|
+
finally {
|
|
493
|
+
closeSync(fd);
|
|
494
|
+
}
|
|
495
|
+
let parsed;
|
|
496
|
+
try {
|
|
497
|
+
parsed = JSON.parse(raw);
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
throw managedError("STATE_INVALID_JSON", "state is not valid JSON", error);
|
|
501
|
+
}
|
|
502
|
+
if (!isRecord(parsed))
|
|
503
|
+
throw new LifecycleStoreError("STATE_INVALID", "state must be an object");
|
|
504
|
+
const schema = parsed["schema_version"];
|
|
505
|
+
if (schema !== 2 && schema !== 3)
|
|
506
|
+
throw new LifecycleStoreError("UNSUPPORTED_SCHEMA", "unsupported start-work schema");
|
|
507
|
+
const active = parsed["active_work_id"];
|
|
508
|
+
if ((schema === 2 && typeof active !== "string") ||
|
|
509
|
+
(schema === 3 && active !== null && typeof active !== "string")) {
|
|
510
|
+
throw new LifecycleStoreError("ACTIVE_WORK_INVALID", "active_work_id is invalid");
|
|
511
|
+
}
|
|
512
|
+
const worksValue = parsed["works"];
|
|
513
|
+
if (!isRecord(worksValue))
|
|
514
|
+
throw new LifecycleStoreError("STATE_INVALID", "works must be an object");
|
|
515
|
+
const entries = [];
|
|
516
|
+
for (const [id, value] of Object.entries(worksValue)) {
|
|
517
|
+
const work = parseWork(paths, id, value, schema);
|
|
518
|
+
if (work === null)
|
|
519
|
+
throw new LifecycleStoreError("STATE_INVALID", `invalid work entry ${id}`);
|
|
520
|
+
entries.push([id, work]);
|
|
521
|
+
}
|
|
522
|
+
const works = Object.fromEntries(entries);
|
|
523
|
+
if (typeof active === "string" && (works[active] === undefined || works[active]?.work_id !== active)) {
|
|
524
|
+
throw new LifecycleStoreError("ACTIVE_WORK_INVALID", "active_work_id is dangling or mismatched");
|
|
525
|
+
}
|
|
526
|
+
const revision = schema === 2 ? 0 : parsed["revision"];
|
|
527
|
+
if (!Number.isSafeInteger(revision) || revision < 0) {
|
|
528
|
+
throw new LifecycleStoreError("STATE_INVALID", "revision must be a non-negative safe integer");
|
|
529
|
+
}
|
|
530
|
+
const history = parseHistory(parsed["transition_history"]);
|
|
531
|
+
const historyFloor = schema === 2 ? 0 : (parsed["history_floor_revision"] ?? (history === undefined ? 0 : 1));
|
|
532
|
+
if (!Number.isSafeInteger(historyFloor) ||
|
|
533
|
+
historyFloor < 0 ||
|
|
534
|
+
historyFloor > revision) {
|
|
535
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "history floor is inconsistent with state revision");
|
|
536
|
+
}
|
|
537
|
+
const state = {
|
|
538
|
+
...parsed,
|
|
539
|
+
schema_version: 3,
|
|
540
|
+
revision: revision,
|
|
541
|
+
active_work_id: active,
|
|
542
|
+
works,
|
|
543
|
+
...(history === undefined ? {} : { transition_history: history }),
|
|
544
|
+
...(schema === 2 ? {} : { history_floor_revision: historyFloor }),
|
|
545
|
+
};
|
|
546
|
+
if (schema === 3)
|
|
547
|
+
validateStateConsistency(state);
|
|
548
|
+
return { state, sourceSchema: schema };
|
|
549
|
+
}
|
|
550
|
+
function parseWork(paths, id, value, schema) {
|
|
551
|
+
if (!isBoundedLifecycleText(id) || !isRecord(value))
|
|
552
|
+
return null;
|
|
553
|
+
const activePlan = value["active_plan"];
|
|
554
|
+
if (!isBoundedLifecycleText(activePlan) || (schema === 3 && !/^\.litcodex\/plans\/[^/\\]+\.md$/.test(activePlan))) {
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
557
|
+
const sessionIds = value["session_ids"];
|
|
558
|
+
const status = value["status"];
|
|
559
|
+
if (schema === 3 && !Object.hasOwn(value, "worktree_path")) {
|
|
560
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "schema-3 work requires its own worktree_path");
|
|
561
|
+
}
|
|
562
|
+
const worktree = value["worktree_path"] ?? null;
|
|
563
|
+
if (value["work_id"] !== id ||
|
|
564
|
+
!isBoundedLifecycleText(value["plan_name"], START_WORK_MAX_DISPLAY_BYTES) ||
|
|
565
|
+
!Array.isArray(sessionIds) ||
|
|
566
|
+
sessionIds.length === 0 ||
|
|
567
|
+
!sessionIds.every((item) => isBoundedLifecycleText(item)) ||
|
|
568
|
+
!isWorkStatus(status) ||
|
|
569
|
+
!(worktree === null || isBoundedLifecycleText(worktree)))
|
|
570
|
+
return null;
|
|
571
|
+
const lease = parseLease(value["continuation_lease"]);
|
|
572
|
+
if (value["continuation_lease"] !== undefined && lease === undefined)
|
|
573
|
+
return null;
|
|
574
|
+
const last = parseLifecycleEvent(value["last_transition"]);
|
|
575
|
+
if (value["last_transition"] !== undefined && last === undefined)
|
|
576
|
+
return null;
|
|
577
|
+
if (last !== undefined && (last.workId !== id || last.plan !== activePlan || last.toWorkStatus !== status))
|
|
578
|
+
return null;
|
|
579
|
+
let authority;
|
|
580
|
+
try {
|
|
581
|
+
authority = parseStoredAuthority(paths, value["authority"], status, schema);
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
if (error instanceof LifecycleStoreError)
|
|
585
|
+
throw error;
|
|
586
|
+
throw error;
|
|
587
|
+
}
|
|
588
|
+
const pending = parseBoundary(value["pending_boundary"]);
|
|
589
|
+
if (value["pending_boundary"] !== undefined && pending === undefined)
|
|
590
|
+
return null;
|
|
591
|
+
if (pending !== undefined) {
|
|
592
|
+
if (status !== "paused" || authority === undefined)
|
|
593
|
+
return null;
|
|
594
|
+
validateBoundaryAgainstAuthority(pending, authority, true);
|
|
595
|
+
}
|
|
596
|
+
const grants = parseGrants(value["authority_grants"]);
|
|
597
|
+
if (value["authority_grants"] !== undefined && grants === undefined)
|
|
598
|
+
return null;
|
|
599
|
+
if (grants !== undefined) {
|
|
600
|
+
if (authority === undefined || grants.some((grant) => !grantMatchesStoredAuthority(grant, authority, status))) {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
let normalizedWorktree = worktree;
|
|
605
|
+
if (schema === 3) {
|
|
606
|
+
if (isNonterminal(status) && authority === undefined) {
|
|
607
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "nonterminal work requires authority-bound execution cwd");
|
|
608
|
+
}
|
|
609
|
+
const roots = authority === undefined ? [] : effectiveRoots(authority, grants ?? []);
|
|
610
|
+
if (worktree === null) {
|
|
611
|
+
if (isNonterminal(status) && !roots.some((root) => isWithin(root, paths.cwd))) {
|
|
612
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "null worktree requires authority over canonical cwd");
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
normalizedWorktree = validateStoredWorktree(worktree, roots, status);
|
|
617
|
+
}
|
|
618
|
+
if (status === "paused") {
|
|
619
|
+
if (pending === undefined ||
|
|
620
|
+
last === undefined ||
|
|
621
|
+
last.kind !== "start_work_paused" ||
|
|
622
|
+
last.fromWorkStatus !== "active" ||
|
|
623
|
+
last.reasonCode === undefined ||
|
|
624
|
+
!isPauseReason(last.reasonCode) ||
|
|
625
|
+
last.boundary === undefined ||
|
|
626
|
+
!boundariesEquivalent(last.boundary, pending)) {
|
|
627
|
+
throw new LifecycleStoreError("BOUNDARY_STATE_INVALID", "paused work requires its matching last pause event");
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
...value,
|
|
633
|
+
work_id: id,
|
|
634
|
+
active_plan: activePlan,
|
|
635
|
+
plan_name: value["plan_name"],
|
|
636
|
+
session_ids: sessionIds,
|
|
637
|
+
status,
|
|
638
|
+
worktree_path: normalizedWorktree,
|
|
639
|
+
...(authority === undefined ? {} : { authority }),
|
|
640
|
+
...(pending === undefined ? {} : { pending_boundary: pending }),
|
|
641
|
+
...(grants === undefined ? {} : { authority_grants: grants }),
|
|
642
|
+
...(lease === undefined ? {} : { continuation_lease: lease }),
|
|
643
|
+
...(last === undefined ? {} : { last_transition: last }),
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function normalizeStateForMutation(paths, loaded, migrationAuthority) {
|
|
647
|
+
if (loaded.sourceSchema === 3)
|
|
648
|
+
return loaded.state;
|
|
649
|
+
const works = Object.fromEntries(Object.entries(loaded.state.works).map(([id, work]) => {
|
|
650
|
+
const plan = canonicalPlan(paths, work.active_plan, true);
|
|
651
|
+
if (isNonterminal(work.status) && migrationAuthority === undefined) {
|
|
652
|
+
throw new LifecycleStoreError("MIGRATION_AUTHORITY_REQUIRED", "schema-2 migration authority is required");
|
|
653
|
+
}
|
|
654
|
+
const authority = isNonterminal(work.status) ? migrationAuthority : work.authority;
|
|
655
|
+
const worktree = work.worktree_path === null || authority === undefined
|
|
656
|
+
? work.worktree_path
|
|
657
|
+
: normalizeWorktree(work.worktree_path, authority.allowed_roots);
|
|
658
|
+
return [
|
|
659
|
+
id,
|
|
660
|
+
{
|
|
661
|
+
...work,
|
|
662
|
+
active_plan: plan.relativePath,
|
|
663
|
+
worktree_path: worktree,
|
|
664
|
+
...(authority === undefined ? {} : { authority }),
|
|
665
|
+
},
|
|
666
|
+
];
|
|
667
|
+
}));
|
|
668
|
+
const history = { ...(loaded.state.transition_history ?? {}) };
|
|
669
|
+
for (const work of Object.values(works)) {
|
|
670
|
+
if (work.last_transition !== undefined)
|
|
671
|
+
history[work.last_transition.transitionId] = work.last_transition;
|
|
672
|
+
}
|
|
673
|
+
return {
|
|
674
|
+
...loaded.state,
|
|
675
|
+
schema_version: 3,
|
|
676
|
+
revision: 0,
|
|
677
|
+
works,
|
|
678
|
+
transition_history: history,
|
|
679
|
+
history_floor_revision: 0,
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function initEvent(request, plan, initFingerprint, revision, at) {
|
|
683
|
+
return {
|
|
684
|
+
kind: "start_work_initialized",
|
|
685
|
+
at,
|
|
686
|
+
workId: request.workId,
|
|
687
|
+
transitionId: request.initId,
|
|
688
|
+
revision,
|
|
689
|
+
toWorkStatus: "active",
|
|
690
|
+
plan: plan.relativePath,
|
|
691
|
+
sessionId: `codex:${request.sessionId}`,
|
|
692
|
+
progressToken: plan.progress.progressToken,
|
|
693
|
+
initFingerprint,
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function initializedWork(request, plan, authority, worktreePath, event, at) {
|
|
697
|
+
return {
|
|
698
|
+
work_id: request.workId,
|
|
699
|
+
active_plan: plan.relativePath,
|
|
700
|
+
plan_name: request.planName,
|
|
701
|
+
session_ids: [`codex:${request.sessionId}`],
|
|
702
|
+
status: "active",
|
|
703
|
+
worktree_path: worktreePath,
|
|
704
|
+
authority,
|
|
705
|
+
started_at: at,
|
|
706
|
+
last_transition: event,
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function appendHistory(state, event) {
|
|
710
|
+
const entries = [...sortedHistoryEntries(state), [event.transitionId, event]]
|
|
711
|
+
.sort((left, right) => left[1].revision - right[1].revision)
|
|
712
|
+
.slice(-START_WORK_MAX_HISTORY_EVENTS);
|
|
713
|
+
return {
|
|
714
|
+
events: Object.fromEntries(entries),
|
|
715
|
+
floorRevision: entries[0]?.[1].revision ?? event.revision,
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
function assertReplayAvailable(state, expectedRevision) {
|
|
719
|
+
const floor = state.history_floor_revision ?? 0;
|
|
720
|
+
if (floor > 0 && expectedRevision < floor) {
|
|
721
|
+
throw new LifecycleStoreError("REPLAY_EXPIRED", "transition replay expired from retained history");
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function validateStateConsistency(state) {
|
|
725
|
+
const nonterminal = Object.values(state.works).filter((work) => isNonterminal(work.status));
|
|
726
|
+
if (state.active_work_id === null) {
|
|
727
|
+
if (nonterminal.length !== 0) {
|
|
728
|
+
throw new LifecycleStoreError("ACTIVE_WORK_INVALID", "nonterminal work requires active_work_id");
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
const active = state.works[state.active_work_id];
|
|
733
|
+
if (active === undefined || !isNonterminal(active.status) || nonterminal.length !== 1) {
|
|
734
|
+
throw new LifecycleStoreError("ACTIVE_WORK_INVALID", "schema-3 state must select exactly one nonterminal work");
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
const history = sortedHistoryEvents(state);
|
|
738
|
+
if (new Set(history.map((event) => event.revision)).size !== history.length) {
|
|
739
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "transition history revisions must be unique");
|
|
740
|
+
}
|
|
741
|
+
let previous = 0;
|
|
742
|
+
for (const event of history) {
|
|
743
|
+
if (event.revision <= previous ||
|
|
744
|
+
event.revision > state.revision ||
|
|
745
|
+
(previous > 0 && event.revision !== previous + 1)) {
|
|
746
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "transition history revisions must increase monotonically");
|
|
747
|
+
}
|
|
748
|
+
const work = state.works[event.workId];
|
|
749
|
+
if (work === undefined) {
|
|
750
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "transition history references unknown work");
|
|
751
|
+
}
|
|
752
|
+
if (work.authority !== undefined && event.boundary !== undefined) {
|
|
753
|
+
try {
|
|
754
|
+
validateBoundaryAgainstAuthority(event.boundary, work.authority, true, !isNonterminal(work.status));
|
|
755
|
+
}
|
|
756
|
+
catch {
|
|
757
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "history boundary is outside stored authority");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (work.authority !== undefined &&
|
|
761
|
+
event.grant !== undefined &&
|
|
762
|
+
!grantMatchesStoredAuthority(event.grant, work.authority, work.status)) {
|
|
763
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "history grant is outside stored authority");
|
|
764
|
+
}
|
|
765
|
+
if (event.grant !== undefined &&
|
|
766
|
+
(event.boundary === undefined ||
|
|
767
|
+
event.grant.boundary_id !== event.boundary.boundary_id ||
|
|
768
|
+
event.grant.action !== event.boundary.action ||
|
|
769
|
+
event.grant.root !== event.boundary.root)) {
|
|
770
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "history grant does not match its boundary");
|
|
771
|
+
}
|
|
772
|
+
previous = event.revision;
|
|
773
|
+
}
|
|
774
|
+
if (history.length > START_WORK_MAX_HISTORY_EVENTS) {
|
|
775
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "transition history exceeds its retained-event limit");
|
|
776
|
+
}
|
|
777
|
+
if (history.length > 0) {
|
|
778
|
+
if (history.at(-1)?.revision !== state.revision) {
|
|
779
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "state revision must match newest retained event");
|
|
780
|
+
}
|
|
781
|
+
if ((state.history_floor_revision ?? 0) !== history[0]?.revision) {
|
|
782
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "history floor must match oldest retained event");
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
else if (state.revision !== 0) {
|
|
786
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "nonzero revision requires retained history");
|
|
787
|
+
}
|
|
788
|
+
for (const work of Object.values(state.works)) {
|
|
789
|
+
const last = work.last_transition;
|
|
790
|
+
if (work.status === "paused" && last?.revision !== state.revision) {
|
|
791
|
+
throw new LifecycleStoreError("BOUNDARY_STATE_INVALID", "paused work pause event must be the latest revision");
|
|
792
|
+
}
|
|
793
|
+
if (last === undefined)
|
|
794
|
+
continue;
|
|
795
|
+
if (last.revision > state.revision) {
|
|
796
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "work transition exceeds state revision");
|
|
797
|
+
}
|
|
798
|
+
const retained = state.transition_history?.[last.transitionId];
|
|
799
|
+
if (last.revision >= (state.history_floor_revision ?? 0) &&
|
|
800
|
+
(retained === undefined || !eventsEquivalent(last, retained))) {
|
|
801
|
+
throw new LifecycleStoreError("STATE_REVISION_INVALID", "work transition conflicts with retained history");
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function sortedHistoryEntries(state) {
|
|
806
|
+
return Object.entries(state.transition_history ?? {}).sort((left, right) => {
|
|
807
|
+
const revision = left[1].revision - right[1].revision;
|
|
808
|
+
return revision === 0 ? left[0].localeCompare(right[0]) : revision;
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
function sortedHistoryEvents(state) {
|
|
812
|
+
return sortedHistoryEntries(state).map(([, event]) => event);
|
|
813
|
+
}
|
|
814
|
+
function compactTerminalWorks(state) {
|
|
815
|
+
const floor = state.history_floor_revision ?? 0;
|
|
816
|
+
if (floor === 0)
|
|
817
|
+
return state;
|
|
818
|
+
const retainedWorkIds = new Set(sortedHistoryEvents(state).map((event) => event.workId));
|
|
819
|
+
const works = Object.fromEntries(Object.entries(state.works).filter(([, work]) => {
|
|
820
|
+
if (isNonterminal(work.status) || retainedWorkIds.has(work.work_id))
|
|
821
|
+
return true;
|
|
822
|
+
return work.last_transition === undefined || work.last_transition.revision >= floor;
|
|
823
|
+
}));
|
|
824
|
+
return Object.keys(works).length === Object.keys(state.works).length ? state : { ...state, works };
|
|
825
|
+
}
|
|
826
|
+
function parseLease(value) {
|
|
827
|
+
if (value === undefined)
|
|
828
|
+
return undefined;
|
|
829
|
+
if (!isRecord(value))
|
|
830
|
+
return undefined;
|
|
831
|
+
return isHash(value["progress_token"]) &&
|
|
832
|
+
isBoundedLifecycleText(value["turn_id"]) &&
|
|
833
|
+
isBoundedLifecycleText(value["transition_id"])
|
|
834
|
+
? {
|
|
835
|
+
progress_token: value["progress_token"],
|
|
836
|
+
turn_id: value["turn_id"],
|
|
837
|
+
transition_id: value["transition_id"],
|
|
838
|
+
}
|
|
839
|
+
: undefined;
|
|
840
|
+
}
|
|
841
|
+
function parseHistory(value) {
|
|
842
|
+
if (value === undefined)
|
|
843
|
+
return undefined;
|
|
844
|
+
if (!isRecord(value))
|
|
845
|
+
throw new LifecycleStoreError("STATE_INVALID", "transition_history must be an object");
|
|
846
|
+
const entries = [];
|
|
847
|
+
for (const [id, candidate] of Object.entries(value)) {
|
|
848
|
+
const event = parseLifecycleEvent(candidate);
|
|
849
|
+
if (event === undefined || event.transitionId !== id) {
|
|
850
|
+
throw new LifecycleStoreError("STATE_INVALID", `invalid transition_history event ${id}`);
|
|
851
|
+
}
|
|
852
|
+
entries.push([id, event]);
|
|
853
|
+
}
|
|
854
|
+
return Object.fromEntries(entries);
|
|
855
|
+
}
|
|
856
|
+
function parseLifecycleEvent(value) {
|
|
857
|
+
if (!isRecord(value) || Object.hasOwn(value, "reason"))
|
|
858
|
+
return undefined;
|
|
859
|
+
const allowed = new Set([
|
|
860
|
+
"kind",
|
|
861
|
+
"at",
|
|
862
|
+
"workId",
|
|
863
|
+
"transitionId",
|
|
864
|
+
"revision",
|
|
865
|
+
"fromWorkStatus",
|
|
866
|
+
"toWorkStatus",
|
|
867
|
+
"plan",
|
|
868
|
+
"sessionId",
|
|
869
|
+
"reasonCode",
|
|
870
|
+
"turnId",
|
|
871
|
+
"progressToken",
|
|
872
|
+
"initFingerprint",
|
|
873
|
+
"boundary",
|
|
874
|
+
"grant",
|
|
875
|
+
]);
|
|
876
|
+
if (Object.keys(value).some((key) => !allowed.has(key)))
|
|
877
|
+
return undefined;
|
|
878
|
+
if (!isLifecycleKind(value["kind"]) ||
|
|
879
|
+
!isBoundedLifecycleText(value["at"]) ||
|
|
880
|
+
!isBoundedLifecycleText(value["workId"]) ||
|
|
881
|
+
!isBoundedLifecycleText(value["transitionId"]) ||
|
|
882
|
+
!Number.isSafeInteger(value["revision"]) ||
|
|
883
|
+
value["revision"] < 0 ||
|
|
884
|
+
!isWorkStatus(value["toWorkStatus"]) ||
|
|
885
|
+
!isBoundedLifecycleText(value["plan"]) ||
|
|
886
|
+
!isBoundedLifecycleText(value["sessionId"]))
|
|
887
|
+
return undefined;
|
|
888
|
+
if (value["fromWorkStatus"] !== undefined && !isWorkStatus(value["fromWorkStatus"]))
|
|
889
|
+
return undefined;
|
|
890
|
+
if (value["reasonCode"] !== undefined && !isReasonCode(value["reasonCode"]))
|
|
891
|
+
return undefined;
|
|
892
|
+
if (value["turnId"] !== undefined && !isBoundedLifecycleText(value["turnId"]))
|
|
893
|
+
return undefined;
|
|
894
|
+
if (value["progressToken"] !== undefined && !isHash(value["progressToken"]))
|
|
895
|
+
return undefined;
|
|
896
|
+
if (value["initFingerprint"] !== undefined && !isHash(value["initFingerprint"]))
|
|
897
|
+
return undefined;
|
|
898
|
+
const boundary = parseBoundary(value["boundary"]);
|
|
899
|
+
if (value["boundary"] !== undefined && boundary === undefined)
|
|
900
|
+
return undefined;
|
|
901
|
+
const grant = parseGrant(value["grant"]);
|
|
902
|
+
if (value["grant"] !== undefined && grant === undefined)
|
|
903
|
+
return undefined;
|
|
904
|
+
return {
|
|
905
|
+
...value,
|
|
906
|
+
...(boundary === undefined ? {} : { boundary }),
|
|
907
|
+
...(grant === undefined ? {} : { grant }),
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function transitionEvent(state, work, request, target, plan, at, boundary, grant) {
|
|
911
|
+
return {
|
|
912
|
+
kind: kindForAction(request.action),
|
|
913
|
+
at,
|
|
914
|
+
workId: request.workId,
|
|
915
|
+
transitionId: request.transitionId,
|
|
916
|
+
revision: state.revision + 1,
|
|
917
|
+
fromWorkStatus: work.status,
|
|
918
|
+
toWorkStatus: target,
|
|
919
|
+
plan: plan.relativePath,
|
|
920
|
+
sessionId: `codex:${request.sessionId}`,
|
|
921
|
+
reasonCode: request.reasonCode,
|
|
922
|
+
...(request.turnId === undefined ? {} : { turnId: request.turnId }),
|
|
923
|
+
progressToken: plan.progress.progressToken,
|
|
924
|
+
...(boundary === undefined ? {} : { boundary }),
|
|
925
|
+
...(grant === undefined ? {} : { grant }),
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
function targetStatus(action, status, reasonCode) {
|
|
929
|
+
if (action === "pause" && status === "active" && isPauseReason(reasonCode))
|
|
930
|
+
return "paused";
|
|
931
|
+
if (action === "resume" && status === "paused" && reasonCode === "explicit_user_resume")
|
|
932
|
+
return "active";
|
|
933
|
+
if (action === "cancel" && (status === "active" || status === "paused") && reasonCode === "user_cancelled") {
|
|
934
|
+
return "abandoned";
|
|
935
|
+
}
|
|
936
|
+
if (action === "complete" && status === "active" && reasonCode === "completed") {
|
|
937
|
+
return "completed";
|
|
938
|
+
}
|
|
939
|
+
throw new LifecycleStoreError("TRANSITION_INVALID", `cannot ${action} work from ${status} with ${reasonCode}`);
|
|
940
|
+
}
|
|
941
|
+
function kindForAction(action) {
|
|
942
|
+
if (action === "pause")
|
|
943
|
+
return "start_work_paused";
|
|
944
|
+
if (action === "resume")
|
|
945
|
+
return "start_work_resumed";
|
|
946
|
+
if (action === "cancel")
|
|
947
|
+
return "start_work_cancelled";
|
|
948
|
+
return "start_work_completed";
|
|
949
|
+
}
|
|
950
|
+
function requestMatchesEvent(request, event) {
|
|
951
|
+
return (event.kind === kindForAction(request.action) &&
|
|
952
|
+
event.workId === request.workId &&
|
|
953
|
+
event.sessionId === `codex:${request.sessionId}` &&
|
|
954
|
+
event.reasonCode === request.reasonCode &&
|
|
955
|
+
event.turnId === request.turnId &&
|
|
956
|
+
authorityReplayValueEqual(event.boundary, request.boundary) &&
|
|
957
|
+
authorityReplayValueEqual(event.grant, request.grant));
|
|
958
|
+
}
|
|
959
|
+
function reconcileAllLastTransitions(paths, state, options) {
|
|
960
|
+
const newest = Object.values(state.works)
|
|
961
|
+
.map((work) => work.last_transition)
|
|
962
|
+
.filter((event) => event !== undefined)
|
|
963
|
+
.sort((left, right) => right.revision - left.revision)[0];
|
|
964
|
+
if (newest !== undefined && newest.revision === state.revision)
|
|
965
|
+
ensureLedgerEvent(paths, newest, options);
|
|
966
|
+
}
|
|
967
|
+
function findCanonicalEvent(paths, state, transitionId, options) {
|
|
968
|
+
const retained = state.transition_history?.[transitionId];
|
|
969
|
+
const scanned = scanLedgerForTransition(paths, transitionId, options);
|
|
970
|
+
if (scanned.conflict)
|
|
971
|
+
throw new LifecycleStoreError("LEDGER_CONFLICT", "transition id has conflicting ledger payloads");
|
|
972
|
+
if (retained !== undefined && scanned.event !== undefined && !eventsEquivalent(retained, scanned.event)) {
|
|
973
|
+
throw new LifecycleStoreError("LEDGER_CONFLICT", "retained transition conflicts with lifecycle ledger");
|
|
974
|
+
}
|
|
975
|
+
const canonical = retained ?? scanned.event;
|
|
976
|
+
if (retained === undefined && canonical !== undefined && canonical.revision < (state.history_floor_revision ?? 0)) {
|
|
977
|
+
throw new LifecycleStoreError("REPLAY_EXPIRED", "transition replay expired from retained history");
|
|
978
|
+
}
|
|
979
|
+
return canonical;
|
|
980
|
+
}
|
|
981
|
+
function ensureLedgerEvent(paths, event, options) {
|
|
982
|
+
const scanned = scanLedgerForTransition(paths, event.transitionId, options);
|
|
983
|
+
if (scanned.conflict || (scanned.event !== undefined && !eventsEquivalent(scanned.event, event))) {
|
|
984
|
+
throw new LifecycleStoreError("LEDGER_CONFLICT", "transition id has a conflicting ledger payload");
|
|
985
|
+
}
|
|
986
|
+
if (scanned.event !== undefined)
|
|
987
|
+
return;
|
|
988
|
+
appendLedgerEvent(paths, event);
|
|
989
|
+
}
|
|
990
|
+
function scanLedgerForTransition(paths, transitionId, options) {
|
|
991
|
+
if (!pathExists(paths.ledger))
|
|
992
|
+
return { conflict: false };
|
|
993
|
+
assertSafeLeaf(paths.ledger, "ledger");
|
|
994
|
+
const fd = openNoFollow(paths.ledger, constants.O_RDONLY, undefined, "ledger");
|
|
995
|
+
try {
|
|
996
|
+
const stat = fstatSync(fd);
|
|
997
|
+
const bytes = Math.min(stat.size, START_WORK_LEDGER_TAIL_BYTES);
|
|
998
|
+
const offset = Math.max(0, stat.size - bytes);
|
|
999
|
+
const buffer = Buffer.alloc(bytes);
|
|
1000
|
+
const read = readInto(fd, buffer, offset);
|
|
1001
|
+
options.onLedgerRead?.(read, offset);
|
|
1002
|
+
let text = buffer.subarray(0, read).toString("utf8");
|
|
1003
|
+
if (offset > 0)
|
|
1004
|
+
text = text.slice(Math.max(0, text.indexOf("\n") + 1));
|
|
1005
|
+
let event;
|
|
1006
|
+
let conflict = false;
|
|
1007
|
+
for (const line of text.split(/\r?\n/)) {
|
|
1008
|
+
let parsed;
|
|
1009
|
+
try {
|
|
1010
|
+
parsed = JSON.parse(line);
|
|
1011
|
+
}
|
|
1012
|
+
catch {
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
if (!isRecord(parsed) || parsed["transitionId"] !== transitionId)
|
|
1016
|
+
continue;
|
|
1017
|
+
const candidate = parseLifecycleEvent(parsed);
|
|
1018
|
+
if (candidate === undefined) {
|
|
1019
|
+
conflict = true;
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
if (event !== undefined && !eventsEquivalent(event, candidate))
|
|
1023
|
+
conflict = true;
|
|
1024
|
+
event ??= candidate;
|
|
1025
|
+
}
|
|
1026
|
+
return { ...(event === undefined ? {} : { event }), conflict };
|
|
1027
|
+
}
|
|
1028
|
+
finally {
|
|
1029
|
+
closeSync(fd);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
function appendLedgerEvent(paths, event) {
|
|
1033
|
+
const fd = openNoFollow(paths.ledger, constants.O_CREAT | constants.O_RDWR | constants.O_APPEND, 0o600, "ledger");
|
|
1034
|
+
try {
|
|
1035
|
+
const stat = fstatSync(fd);
|
|
1036
|
+
if (!stat.isFile())
|
|
1037
|
+
throw new LifecycleStoreError("LEDGER_INVALID", "ledger is not a regular file");
|
|
1038
|
+
if (stat.size > 0) {
|
|
1039
|
+
const last = Buffer.alloc(1);
|
|
1040
|
+
readSync(fd, last, 0, 1, stat.size - 1);
|
|
1041
|
+
if (last[0] !== 0x0a)
|
|
1042
|
+
writeAll(fd, Buffer.from("\n"));
|
|
1043
|
+
}
|
|
1044
|
+
writeAll(fd, Buffer.from(`${stableEventJson(event)}\n`, "utf8"));
|
|
1045
|
+
fsyncSync(fd);
|
|
1046
|
+
}
|
|
1047
|
+
finally {
|
|
1048
|
+
closeSync(fd);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function writeStateAtomic(paths, state, createOnly) {
|
|
1052
|
+
const serialized = `${JSON.stringify(state, null, 2)}\n`;
|
|
1053
|
+
if (Buffer.byteLength(serialized, "utf8") > START_WORK_STATE_MAX_BYTES) {
|
|
1054
|
+
throw new LifecycleStoreError("STATE_WRITE_TOO_LARGE", "state write would exceed the readable state limit");
|
|
1055
|
+
}
|
|
1056
|
+
const temp = join(paths.startWork, `.${randomUUID()}.state.tmp`);
|
|
1057
|
+
const fd = openNoFollow(temp, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o600, "state temp");
|
|
1058
|
+
try {
|
|
1059
|
+
writeAll(fd, Buffer.from(serialized, "utf8"));
|
|
1060
|
+
fsyncSync(fd);
|
|
1061
|
+
}
|
|
1062
|
+
finally {
|
|
1063
|
+
closeSync(fd);
|
|
1064
|
+
}
|
|
1065
|
+
try {
|
|
1066
|
+
if (createOnly) {
|
|
1067
|
+
linkSync(temp, paths.state);
|
|
1068
|
+
unlinkSync(temp);
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
renameSync(temp, paths.state);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
catch (error) {
|
|
1075
|
+
try {
|
|
1076
|
+
unlinkSync(temp);
|
|
1077
|
+
}
|
|
1078
|
+
catch {
|
|
1079
|
+
// Preserve the primary atomic-write failure.
|
|
1080
|
+
}
|
|
1081
|
+
throw managedError(createOnly ? "STATE_EXISTS" : "STATE_WRITE_FAILED", "atomic state write failed", error);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
function withStateLock(paths, options, operation) {
|
|
1085
|
+
const owner = acquireLock(paths, options.nowMs ?? Date.now);
|
|
1086
|
+
try {
|
|
1087
|
+
return operation();
|
|
1088
|
+
}
|
|
1089
|
+
finally {
|
|
1090
|
+
releaseLock(paths.lock, owner);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function acquireLock(paths, nowMs) {
|
|
1094
|
+
for (let attempt = 0; attempt < LOCK_ATTEMPTS; attempt += 1) {
|
|
1095
|
+
const body = JSON.stringify({ token: randomUUID(), createdAt: nowMs() });
|
|
1096
|
+
try {
|
|
1097
|
+
const fd = openNoFollow(paths.lock, constants.O_CREAT | constants.O_EXCL | constants.O_RDWR, 0o600, "lock");
|
|
1098
|
+
writeAll(fd, Buffer.from(body, "utf8"));
|
|
1099
|
+
fsyncSync(fd);
|
|
1100
|
+
const stat = fstatSync(fd, { bigint: true });
|
|
1101
|
+
return { fd, body, dev: stat.dev, ino: stat.ino };
|
|
1102
|
+
}
|
|
1103
|
+
catch (error) {
|
|
1104
|
+
if (!isCode(error, "EEXIST"))
|
|
1105
|
+
throw error;
|
|
1106
|
+
tryRemoveStaleLock(paths.lock, nowMs());
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
throw new LifecycleStoreError("LOCK_BUSY", "start-work state lock is busy");
|
|
1110
|
+
}
|
|
1111
|
+
function tryRemoveStaleLock(path, nowMs) {
|
|
1112
|
+
const stat = lstatSync(path, { bigint: true });
|
|
1113
|
+
if (stat.isSymbolicLink())
|
|
1114
|
+
throw new LifecycleStoreError("MANAGED_PATH_SYMLINK", "lock is a symbolic link");
|
|
1115
|
+
if (!stat.isFile())
|
|
1116
|
+
return;
|
|
1117
|
+
const fd = openNoFollow(path, constants.O_RDONLY, undefined, "lock");
|
|
1118
|
+
try {
|
|
1119
|
+
const fdStat = fstatSync(fd, { bigint: true });
|
|
1120
|
+
const size = Number(fdStat.size > 4096n ? 4096n : fdStat.size);
|
|
1121
|
+
const buffer = Buffer.alloc(size);
|
|
1122
|
+
const read = readInto(fd, buffer, 0);
|
|
1123
|
+
const text = buffer.subarray(0, read).toString("utf8");
|
|
1124
|
+
let stale = false;
|
|
1125
|
+
try {
|
|
1126
|
+
const parsed = JSON.parse(text);
|
|
1127
|
+
stale =
|
|
1128
|
+
isRecord(parsed) &&
|
|
1129
|
+
typeof parsed["createdAt"] === "number" &&
|
|
1130
|
+
parsed["createdAt"] <= nowMs &&
|
|
1131
|
+
nowMs - parsed["createdAt"] > LOCK_STALE_MS;
|
|
1132
|
+
}
|
|
1133
|
+
catch {
|
|
1134
|
+
const mtimeMs = Number(fdStat.mtimeMs);
|
|
1135
|
+
stale = mtimeMs <= nowMs && nowMs - mtimeMs > LOCK_STALE_MS;
|
|
1136
|
+
}
|
|
1137
|
+
if (!stale)
|
|
1138
|
+
return;
|
|
1139
|
+
const current = lstatSync(path, { bigint: true });
|
|
1140
|
+
if (current.dev === fdStat.dev && current.ino === fdStat.ino)
|
|
1141
|
+
unlinkSync(path);
|
|
1142
|
+
}
|
|
1143
|
+
finally {
|
|
1144
|
+
closeSync(fd);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
function releaseLock(path, owner) {
|
|
1148
|
+
try {
|
|
1149
|
+
if (pathExists(path)) {
|
|
1150
|
+
const current = lstatSync(path, { bigint: true });
|
|
1151
|
+
const held = fstatSync(owner.fd, { bigint: true });
|
|
1152
|
+
const body = readFdText(owner.fd, Number(held.size));
|
|
1153
|
+
if (current.dev === owner.dev &&
|
|
1154
|
+
current.ino === owner.ino &&
|
|
1155
|
+
held.dev === owner.dev &&
|
|
1156
|
+
held.ino === owner.ino &&
|
|
1157
|
+
body === owner.body) {
|
|
1158
|
+
unlinkSync(path);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
finally {
|
|
1163
|
+
closeSync(owner.fd);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function validateInitRequest(cwd, request) {
|
|
1167
|
+
if (!isBoundedLifecycleText(cwd) ||
|
|
1168
|
+
!isBoundedLifecycleText(request.initId) ||
|
|
1169
|
+
!isBoundedLifecycleText(request.workId) ||
|
|
1170
|
+
!isBoundedLifecycleText(request.plan) ||
|
|
1171
|
+
!isBoundedLifecycleText(request.planName, START_WORK_MAX_DISPLAY_BYTES) ||
|
|
1172
|
+
!isBoundedLifecycleText(request.sessionId) ||
|
|
1173
|
+
!Number.isSafeInteger(request.expectedRevision) ||
|
|
1174
|
+
request.expectedRevision < 0 ||
|
|
1175
|
+
!(request.worktreePath === undefined ||
|
|
1176
|
+
request.worktreePath === null ||
|
|
1177
|
+
isBoundedLifecycleText(request.worktreePath))) {
|
|
1178
|
+
throw new LifecycleStoreError("INIT_INPUT_INVALID", "init input is malformed or oversized");
|
|
1179
|
+
}
|
|
1180
|
+
if (Buffer.byteLength(stableJson(request), "utf8") > START_WORK_MAX_INIT_BYTES) {
|
|
1181
|
+
throw new LifecycleStoreError("INIT_INPUT_TOO_LARGE", "init payload exceeds its total byte budget");
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
function validateTransitionRequest(cwd, request) {
|
|
1185
|
+
if (!isBoundedLifecycleText(cwd) ||
|
|
1186
|
+
!isTransitionAction(request.action) ||
|
|
1187
|
+
!Number.isSafeInteger(request.expectedRevision) ||
|
|
1188
|
+
request.expectedRevision < 0 ||
|
|
1189
|
+
!isBoundedLifecycleText(request.sessionId) ||
|
|
1190
|
+
!isBoundedLifecycleText(request.transitionId) ||
|
|
1191
|
+
!isBoundedLifecycleText(request.workId) ||
|
|
1192
|
+
!isReasonCode(request.reasonCode) ||
|
|
1193
|
+
(request.boundary !== undefined && parseBoundary(request.boundary) === undefined) ||
|
|
1194
|
+
(request.grant !== undefined && parseGrant(request.grant) === undefined)) {
|
|
1195
|
+
throw new LifecycleStoreError("TRANSITION_INPUT_INVALID", "transition input is malformed or oversized");
|
|
1196
|
+
}
|
|
1197
|
+
if (request.turnId !== undefined && !isBoundedLifecycleText(request.turnId)) {
|
|
1198
|
+
throw new LifecycleStoreError("TRANSITION_INPUT_INVALID", "transition turn id is malformed or oversized");
|
|
1199
|
+
}
|
|
1200
|
+
if (request.action === "pause" && (request.boundary === undefined || !isPauseReason(request.reasonCode))) {
|
|
1201
|
+
throw new LifecycleStoreError("TRANSITION_INPUT_INVALID", "pause requires a boundary and blocker reason");
|
|
1202
|
+
}
|
|
1203
|
+
if (request.action === "resume" && (request.boundary === undefined || request.grant === undefined)) {
|
|
1204
|
+
throw new LifecycleStoreError("TRANSITION_INPUT_INVALID", "resume requires boundary and grant");
|
|
1205
|
+
}
|
|
1206
|
+
if ((request.action === "cancel" || request.action === "complete") &&
|
|
1207
|
+
(request.boundary !== undefined || request.grant !== undefined)) {
|
|
1208
|
+
throw new LifecycleStoreError("TRANSITION_INPUT_INVALID", "terminal transitions do not accept boundary or grant");
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
function normalizeAuthority(paths, input) {
|
|
1212
|
+
if (!isRecord(input) ||
|
|
1213
|
+
!isBoundedLifecycleText(input.authorityId) ||
|
|
1214
|
+
!validStringArray(input.allowedRoots) ||
|
|
1215
|
+
!validStringArray(input.allowedActions) ||
|
|
1216
|
+
!validStringArray(input.forbiddenActions)) {
|
|
1217
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "authority envelope is malformed or oversized");
|
|
1218
|
+
}
|
|
1219
|
+
if (Buffer.byteLength(stableJson(input), "utf8") > START_WORK_MAX_AUTHORITY_BYTES) {
|
|
1220
|
+
throw new LifecycleStoreError("AUTHORITY_BUDGET_EXCEEDED", "authority envelope exceeds its total byte budget");
|
|
1221
|
+
}
|
|
1222
|
+
const allowedRoots = input.allowedRoots.map((root) => {
|
|
1223
|
+
if (!isAbsolute(root))
|
|
1224
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "allowed roots must be absolute");
|
|
1225
|
+
const canonical = realpathSync(root);
|
|
1226
|
+
assertSafeDirectory(canonical, canonical, "allowed root");
|
|
1227
|
+
return canonical;
|
|
1228
|
+
});
|
|
1229
|
+
if (new Set(allowedRoots).size !== allowedRoots.length) {
|
|
1230
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "allowed roots must be unique");
|
|
1231
|
+
}
|
|
1232
|
+
if (new Set(input.allowedActions).size !== input.allowedActions.length ||
|
|
1233
|
+
new Set(input.forbiddenActions).size !== input.forbiddenActions.length) {
|
|
1234
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "authority actions must be unique");
|
|
1235
|
+
}
|
|
1236
|
+
if (input.allowedActions.some((action) => input.forbiddenActions.includes(action))) {
|
|
1237
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "allowed and forbidden actions overlap");
|
|
1238
|
+
}
|
|
1239
|
+
if (!allowedRoots.some((root) => isWithin(root, paths.cwd))) {
|
|
1240
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "authority allowed_roots do not contain cwd");
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
authority_id: input.authorityId,
|
|
1244
|
+
allowed_roots: allowedRoots,
|
|
1245
|
+
allowed_actions: [...input.allowedActions],
|
|
1246
|
+
forbidden_actions: [...input.forbiddenActions],
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
function normalizeWorktree(value, allowedRoots) {
|
|
1250
|
+
if (value === null)
|
|
1251
|
+
return null;
|
|
1252
|
+
if (!isAbsolute(value))
|
|
1253
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "worktree path must be absolute");
|
|
1254
|
+
const canonical = realpathSync(value);
|
|
1255
|
+
assertSafeDirectory(canonical, canonical, "worktree");
|
|
1256
|
+
if (!allowedRoots.some((root) => isWithin(root, canonical))) {
|
|
1257
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "worktree is outside authority allowed_roots");
|
|
1258
|
+
}
|
|
1259
|
+
return canonical;
|
|
1260
|
+
}
|
|
1261
|
+
function validStringArray(value) {
|
|
1262
|
+
return (Array.isArray(value) &&
|
|
1263
|
+
value.length > 0 &&
|
|
1264
|
+
value.length <= MAX_AUTHORITY_ITEMS &&
|
|
1265
|
+
value.every((item) => isBoundedLifecycleText(item)));
|
|
1266
|
+
}
|
|
1267
|
+
function parseStoredAuthority(paths, value, status, schema) {
|
|
1268
|
+
if (value === undefined) {
|
|
1269
|
+
if (schema === 3 && isNonterminal(status)) {
|
|
1270
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "active or paused schema-3 work requires authority");
|
|
1271
|
+
}
|
|
1272
|
+
return undefined;
|
|
1273
|
+
}
|
|
1274
|
+
if (!isRecord(value))
|
|
1275
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority must be an object");
|
|
1276
|
+
const allowed = new Set(["authority_id", "allowed_roots", "allowed_actions", "forbidden_actions"]);
|
|
1277
|
+
if (Object.keys(value).some((key) => !allowed.has(key))) {
|
|
1278
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority contains unknown fields");
|
|
1279
|
+
}
|
|
1280
|
+
if (!isBoundedLifecycleText(value["authority_id"]) ||
|
|
1281
|
+
!validStringArray(value["allowed_roots"]) ||
|
|
1282
|
+
!validStringArray(value["allowed_actions"]) ||
|
|
1283
|
+
!validStringArray(value["forbidden_actions"])) {
|
|
1284
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority is malformed or oversized");
|
|
1285
|
+
}
|
|
1286
|
+
if (Buffer.byteLength(stableJson(value), "utf8") > START_WORK_MAX_AUTHORITY_BYTES) {
|
|
1287
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority exceeds its total byte budget");
|
|
1288
|
+
}
|
|
1289
|
+
const roots = value["allowed_roots"];
|
|
1290
|
+
for (const root of roots) {
|
|
1291
|
+
if (!isAbsolute(root))
|
|
1292
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored allowed roots must be absolute");
|
|
1293
|
+
if (!isNonterminal(status)) {
|
|
1294
|
+
if (resolve(root) !== root) {
|
|
1295
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "terminal stored roots must be normalized absolute paths");
|
|
1296
|
+
}
|
|
1297
|
+
try {
|
|
1298
|
+
if (realpathSync(root) !== root) {
|
|
1299
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "terminal stored roots must remain canonical");
|
|
1300
|
+
}
|
|
1301
|
+
assertSafeDirectory(root, root, "allowed root");
|
|
1302
|
+
}
|
|
1303
|
+
catch (error) {
|
|
1304
|
+
if (error instanceof LifecycleStoreError)
|
|
1305
|
+
throw error;
|
|
1306
|
+
if (!isCode(error, "ENOENT"))
|
|
1307
|
+
throw managedError("AUTHORITY_INVALID", "stored allowed root is unreadable", error);
|
|
1308
|
+
}
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1311
|
+
let canonical;
|
|
1312
|
+
try {
|
|
1313
|
+
canonical = realpathSync(root);
|
|
1314
|
+
}
|
|
1315
|
+
catch (error) {
|
|
1316
|
+
throw managedError("AUTHORITY_INVALID", "stored allowed root is unreadable", error);
|
|
1317
|
+
}
|
|
1318
|
+
if (canonical !== root)
|
|
1319
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored allowed roots must be canonical");
|
|
1320
|
+
assertSafeDirectory(root, root, "allowed root");
|
|
1321
|
+
}
|
|
1322
|
+
if (new Set(roots).size !== roots.length)
|
|
1323
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored roots must be unique");
|
|
1324
|
+
const allowedActions = value["allowed_actions"];
|
|
1325
|
+
const forbiddenActions = value["forbidden_actions"];
|
|
1326
|
+
if (new Set(allowedActions).size !== allowedActions.length ||
|
|
1327
|
+
new Set(forbiddenActions).size !== forbiddenActions.length ||
|
|
1328
|
+
allowedActions.some((action) => forbiddenActions.includes(action))) {
|
|
1329
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority actions are inconsistent");
|
|
1330
|
+
}
|
|
1331
|
+
if (isNonterminal(status) && !roots.some((root) => isWithin(root, paths.cwd))) {
|
|
1332
|
+
throw new LifecycleStoreError("AUTHORITY_INVALID", "stored authority does not contain canonical cwd");
|
|
1333
|
+
}
|
|
1334
|
+
return {
|
|
1335
|
+
authority_id: value["authority_id"],
|
|
1336
|
+
allowed_roots: [...roots],
|
|
1337
|
+
allowed_actions: [...allowedActions],
|
|
1338
|
+
forbidden_actions: [...forbiddenActions],
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
function validateStoredWorktree(value, allowedRoots, status) {
|
|
1342
|
+
if (!isAbsolute(value))
|
|
1343
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "stored worktree must be absolute");
|
|
1344
|
+
let canonical;
|
|
1345
|
+
try {
|
|
1346
|
+
canonical = realpathSync(value);
|
|
1347
|
+
}
|
|
1348
|
+
catch (error) {
|
|
1349
|
+
if (!isNonterminal(status) && resolve(value) === value && isCode(error, "ENOENT"))
|
|
1350
|
+
return value;
|
|
1351
|
+
throw managedError("WORKTREE_INVALID", "stored worktree is unreadable", error);
|
|
1352
|
+
}
|
|
1353
|
+
if (canonical !== value)
|
|
1354
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "stored worktree must be canonical");
|
|
1355
|
+
assertSafeDirectory(value, value, "worktree");
|
|
1356
|
+
if (allowedRoots.length > 0 && !allowedRoots.some((root) => isWithin(root, value))) {
|
|
1357
|
+
throw new LifecycleStoreError("WORKTREE_INVALID", "stored worktree is outside authority roots");
|
|
1358
|
+
}
|
|
1359
|
+
return value;
|
|
1360
|
+
}
|
|
1361
|
+
function parseBoundary(value) {
|
|
1362
|
+
if (!isRecord(value))
|
|
1363
|
+
return undefined;
|
|
1364
|
+
const allowed = new Set(["boundary_id", "authority_id", "action", "root"]);
|
|
1365
|
+
if (Object.keys(value).some((key) => !allowed.has(key)))
|
|
1366
|
+
return undefined;
|
|
1367
|
+
return isBoundedLifecycleText(value["boundary_id"]) &&
|
|
1368
|
+
isBoundedLifecycleText(value["authority_id"]) &&
|
|
1369
|
+
isBoundedLifecycleText(value["action"]) &&
|
|
1370
|
+
isBoundedLifecycleText(value["root"])
|
|
1371
|
+
? {
|
|
1372
|
+
boundary_id: value["boundary_id"],
|
|
1373
|
+
authority_id: value["authority_id"],
|
|
1374
|
+
action: value["action"],
|
|
1375
|
+
root: value["root"],
|
|
1376
|
+
}
|
|
1377
|
+
: undefined;
|
|
1378
|
+
}
|
|
1379
|
+
function parseGrant(value) {
|
|
1380
|
+
if (!isRecord(value))
|
|
1381
|
+
return undefined;
|
|
1382
|
+
const allowed = new Set(["grant_id", "authority_id", "boundary_id", "action", "root"]);
|
|
1383
|
+
if (Object.keys(value).some((key) => !allowed.has(key)))
|
|
1384
|
+
return undefined;
|
|
1385
|
+
return isBoundedLifecycleText(value["grant_id"]) &&
|
|
1386
|
+
isBoundedLifecycleText(value["authority_id"]) &&
|
|
1387
|
+
isBoundedLifecycleText(value["boundary_id"]) &&
|
|
1388
|
+
isBoundedLifecycleText(value["action"]) &&
|
|
1389
|
+
isBoundedLifecycleText(value["root"])
|
|
1390
|
+
? {
|
|
1391
|
+
grant_id: value["grant_id"],
|
|
1392
|
+
authority_id: value["authority_id"],
|
|
1393
|
+
boundary_id: value["boundary_id"],
|
|
1394
|
+
action: value["action"],
|
|
1395
|
+
root: value["root"],
|
|
1396
|
+
}
|
|
1397
|
+
: undefined;
|
|
1398
|
+
}
|
|
1399
|
+
function parseGrants(value) {
|
|
1400
|
+
if (value === undefined)
|
|
1401
|
+
return undefined;
|
|
1402
|
+
if (!Array.isArray(value) || value.length > MAX_AUTHORITY_GRANTS)
|
|
1403
|
+
return undefined;
|
|
1404
|
+
const grants = value.map(parseGrant);
|
|
1405
|
+
if (grants.some((grant) => grant === undefined))
|
|
1406
|
+
return undefined;
|
|
1407
|
+
const defined = grants;
|
|
1408
|
+
if (new Set(defined.map((grant) => grant.grant_id)).size !== defined.length)
|
|
1409
|
+
return undefined;
|
|
1410
|
+
return defined;
|
|
1411
|
+
}
|
|
1412
|
+
function normalizeBoundary(value, authority) {
|
|
1413
|
+
const parsed = parseBoundary(value);
|
|
1414
|
+
if (parsed === undefined)
|
|
1415
|
+
throw new LifecycleStoreError("BOUNDARY_INVALID", "authority boundary is malformed");
|
|
1416
|
+
let root;
|
|
1417
|
+
try {
|
|
1418
|
+
root = realpathSync(parsed.root);
|
|
1419
|
+
}
|
|
1420
|
+
catch (error) {
|
|
1421
|
+
throw managedError("BOUNDARY_INVALID", "authority boundary root is unreadable", error);
|
|
1422
|
+
}
|
|
1423
|
+
const normalized = { ...parsed, root };
|
|
1424
|
+
validateBoundaryAgainstAuthority(normalized, authority, false);
|
|
1425
|
+
return normalized;
|
|
1426
|
+
}
|
|
1427
|
+
function validateBoundaryAgainstAuthority(boundary, authority, requireCanonical, allowMissing = false) {
|
|
1428
|
+
if (boundary.authority_id !== authority.authority_id) {
|
|
1429
|
+
throw new LifecycleStoreError("BOUNDARY_MISMATCH", "boundary authority identity does not match work authority");
|
|
1430
|
+
}
|
|
1431
|
+
if (authority.forbidden_actions.includes(boundary.action)) {
|
|
1432
|
+
throw new LifecycleStoreError("BOUNDARY_MISMATCH", "boundary action is permanently forbidden");
|
|
1433
|
+
}
|
|
1434
|
+
if (!isAbsolute(boundary.root))
|
|
1435
|
+
throw new LifecycleStoreError("BOUNDARY_MISMATCH", "boundary root must be absolute");
|
|
1436
|
+
let canonical;
|
|
1437
|
+
try {
|
|
1438
|
+
canonical = realpathSync(boundary.root);
|
|
1439
|
+
}
|
|
1440
|
+
catch (error) {
|
|
1441
|
+
if (allowMissing && resolve(boundary.root) === boundary.root && isCode(error, "ENOENT"))
|
|
1442
|
+
return;
|
|
1443
|
+
throw error;
|
|
1444
|
+
}
|
|
1445
|
+
if (requireCanonical && canonical !== boundary.root) {
|
|
1446
|
+
throw new LifecycleStoreError("BOUNDARY_MISMATCH", "stored boundary root must be canonical");
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function normalizeGrant(value, authority, boundary) {
|
|
1450
|
+
const parsed = parseGrant(value);
|
|
1451
|
+
if (parsed === undefined || boundary === undefined) {
|
|
1452
|
+
throw new LifecycleStoreError("GRANT_INVALID", "authority grant is malformed or lacks a boundary");
|
|
1453
|
+
}
|
|
1454
|
+
const root = realpathSync(parsed.root);
|
|
1455
|
+
const normalized = { ...parsed, root };
|
|
1456
|
+
if (!grantMatchesAuthority(normalized, authority) || normalized.boundary_id !== boundary.boundary_id) {
|
|
1457
|
+
throw new LifecycleStoreError("GRANT_MISMATCH", "grant does not match pending boundary and authority");
|
|
1458
|
+
}
|
|
1459
|
+
if (normalized.action !== boundary.action || normalized.root !== boundary.root) {
|
|
1460
|
+
throw new LifecycleStoreError("GRANT_MISMATCH", "grant action or root does not match pending boundary");
|
|
1461
|
+
}
|
|
1462
|
+
return normalized;
|
|
1463
|
+
}
|
|
1464
|
+
function grantMatchesAuthority(grant, authority) {
|
|
1465
|
+
try {
|
|
1466
|
+
return (grant.authority_id === authority.authority_id &&
|
|
1467
|
+
!authority.forbidden_actions.includes(grant.action) &&
|
|
1468
|
+
isAbsolute(grant.root) &&
|
|
1469
|
+
realpathSync(grant.root) === grant.root);
|
|
1470
|
+
}
|
|
1471
|
+
catch {
|
|
1472
|
+
return false;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function grantMatchesStoredAuthority(grant, authority, status) {
|
|
1476
|
+
if (grantMatchesAuthority(grant, authority))
|
|
1477
|
+
return true;
|
|
1478
|
+
return (!isNonterminal(status) &&
|
|
1479
|
+
grant.authority_id === authority.authority_id &&
|
|
1480
|
+
!authority.forbidden_actions.includes(grant.action) &&
|
|
1481
|
+
isAbsolute(grant.root) &&
|
|
1482
|
+
resolve(grant.root) === grant.root &&
|
|
1483
|
+
!pathExists(grant.root));
|
|
1484
|
+
}
|
|
1485
|
+
function grantMatchesBoundary(grant, boundary) {
|
|
1486
|
+
return (grant.authority_id === boundary.authority_id &&
|
|
1487
|
+
grant.boundary_id === boundary.boundary_id &&
|
|
1488
|
+
grant.action === boundary.action &&
|
|
1489
|
+
grant.root === boundary.root);
|
|
1490
|
+
}
|
|
1491
|
+
function authorityAuthorizesBoundary(authority, boundary) {
|
|
1492
|
+
return (authority.allowed_actions.includes(boundary.action) &&
|
|
1493
|
+
authority.allowed_roots.some((root) => isWithin(root, boundary.root)));
|
|
1494
|
+
}
|
|
1495
|
+
function grantAuthorizesBoundary(grant, boundary) {
|
|
1496
|
+
return (grant.authority_id === boundary.authority_id &&
|
|
1497
|
+
grant.action === boundary.action &&
|
|
1498
|
+
isWithin(grant.root, boundary.root));
|
|
1499
|
+
}
|
|
1500
|
+
function effectiveRoots(authority, grants) {
|
|
1501
|
+
return [...new Set([...authority.allowed_roots, ...grants.map((grant) => grant.root)])];
|
|
1502
|
+
}
|
|
1503
|
+
function boundariesEquivalent(left, right) {
|
|
1504
|
+
return stableJson(left) === stableJson(right);
|
|
1505
|
+
}
|
|
1506
|
+
function openNoFollow(path, flags, mode, label) {
|
|
1507
|
+
try {
|
|
1508
|
+
return mode === undefined ? openSync(path, flags | O_NOFOLLOW) : openSync(path, flags | O_NOFOLLOW, mode);
|
|
1509
|
+
}
|
|
1510
|
+
catch (error) {
|
|
1511
|
+
if (isCode(error, "ELOOP"))
|
|
1512
|
+
throw new LifecycleStoreError("MANAGED_PATH_SYMLINK", `${label} is a symbolic link`);
|
|
1513
|
+
throw error;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
function readBoundedUtf8(fd, size, max, code) {
|
|
1517
|
+
if (size > max)
|
|
1518
|
+
throw new LifecycleStoreError(code, "managed file exceeds its byte limit");
|
|
1519
|
+
return readFdText(fd, size);
|
|
1520
|
+
}
|
|
1521
|
+
function readFdText(fd, size) {
|
|
1522
|
+
const buffer = Buffer.alloc(size);
|
|
1523
|
+
const read = readInto(fd, buffer, 0);
|
|
1524
|
+
return buffer.subarray(0, read).toString("utf8");
|
|
1525
|
+
}
|
|
1526
|
+
function readInto(fd, buffer, position) {
|
|
1527
|
+
let total = 0;
|
|
1528
|
+
while (total < buffer.byteLength) {
|
|
1529
|
+
const read = readSync(fd, buffer, total, buffer.byteLength - total, position + total);
|
|
1530
|
+
if (read === 0)
|
|
1531
|
+
break;
|
|
1532
|
+
total += read;
|
|
1533
|
+
}
|
|
1534
|
+
return total;
|
|
1535
|
+
}
|
|
1536
|
+
function writeAll(fd, buffer) {
|
|
1537
|
+
let offset = 0;
|
|
1538
|
+
while (offset < buffer.byteLength)
|
|
1539
|
+
offset += writeSync(fd, buffer, offset, buffer.byteLength - offset);
|
|
1540
|
+
}
|
|
1541
|
+
function eventsEquivalent(left, right) {
|
|
1542
|
+
return stableEventJson(left) === stableEventJson(right);
|
|
1543
|
+
}
|
|
1544
|
+
function stableEventJson(event) {
|
|
1545
|
+
return JSON.stringify({
|
|
1546
|
+
kind: event.kind,
|
|
1547
|
+
at: event.at,
|
|
1548
|
+
workId: event.workId,
|
|
1549
|
+
transitionId: event.transitionId,
|
|
1550
|
+
revision: event.revision,
|
|
1551
|
+
...(event.fromWorkStatus === undefined ? {} : { fromWorkStatus: event.fromWorkStatus }),
|
|
1552
|
+
toWorkStatus: event.toWorkStatus,
|
|
1553
|
+
plan: event.plan,
|
|
1554
|
+
sessionId: event.sessionId,
|
|
1555
|
+
...(event.reasonCode === undefined ? {} : { reasonCode: event.reasonCode }),
|
|
1556
|
+
...(event.turnId === undefined ? {} : { turnId: event.turnId }),
|
|
1557
|
+
...(event.progressToken === undefined ? {} : { progressToken: event.progressToken }),
|
|
1558
|
+
...(event.initFingerprint === undefined ? {} : { initFingerprint: event.initFingerprint }),
|
|
1559
|
+
...(event.boundary === undefined ? {} : { boundary: event.boundary }),
|
|
1560
|
+
...(event.grant === undefined ? {} : { grant: event.grant }),
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
function optionalStableEqual(left, right) {
|
|
1564
|
+
if (left === undefined || right === undefined)
|
|
1565
|
+
return left === right;
|
|
1566
|
+
return stableJson(left) === stableJson(right);
|
|
1567
|
+
}
|
|
1568
|
+
function authorityReplayValueEqual(left, right) {
|
|
1569
|
+
if (left === undefined || right === undefined)
|
|
1570
|
+
return left === right;
|
|
1571
|
+
if (!isRecord(left) || !isRecord(right))
|
|
1572
|
+
return false;
|
|
1573
|
+
const leftRoot = left["root"];
|
|
1574
|
+
const rightRoot = right["root"];
|
|
1575
|
+
if (typeof leftRoot !== "string" || typeof rightRoot !== "string")
|
|
1576
|
+
return optionalStableEqual(left, right);
|
|
1577
|
+
try {
|
|
1578
|
+
return (stableJson({ ...left, root: realpathSync(leftRoot) }) ===
|
|
1579
|
+
stableJson({ ...right, root: realpathSync(rightRoot) }));
|
|
1580
|
+
}
|
|
1581
|
+
catch {
|
|
1582
|
+
return false;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
function stableJson(value) {
|
|
1586
|
+
if (Array.isArray(value))
|
|
1587
|
+
return `[${value.map(stableJson).join(",")}]`;
|
|
1588
|
+
if (isRecord(value)) {
|
|
1589
|
+
return `{${Object.keys(value)
|
|
1590
|
+
.sort()
|
|
1591
|
+
.map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`)
|
|
1592
|
+
.join(",")}}`;
|
|
1593
|
+
}
|
|
1594
|
+
return JSON.stringify(value);
|
|
1595
|
+
}
|
|
1596
|
+
function pathExists(path) {
|
|
1597
|
+
try {
|
|
1598
|
+
lstatSync(path);
|
|
1599
|
+
return true;
|
|
1600
|
+
}
|
|
1601
|
+
catch (error) {
|
|
1602
|
+
if (isCode(error, "ENOENT"))
|
|
1603
|
+
return false;
|
|
1604
|
+
throw error;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
function isWithin(root, candidate) {
|
|
1608
|
+
const rel = relative(root, candidate);
|
|
1609
|
+
return rel === "" || (rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
|
|
1610
|
+
}
|
|
1611
|
+
function managedError(code, message, cause) {
|
|
1612
|
+
return new LifecycleStoreError(code, cause instanceof Error ? `${message}: ${cause.message}` : message);
|
|
1613
|
+
}
|
|
1614
|
+
function digest(value) {
|
|
1615
|
+
return createHash("sha256").update(value).digest("hex");
|
|
1616
|
+
}
|
|
1617
|
+
function shortDigest(value) {
|
|
1618
|
+
return digest(value).slice(0, 16);
|
|
1619
|
+
}
|
|
1620
|
+
function isHash(value) {
|
|
1621
|
+
return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
|
|
1622
|
+
}
|
|
1623
|
+
function isPauseReason(value) {
|
|
1624
|
+
return value === "authorization_required" || value === "credential_required" || value === "host_capability_required";
|
|
1625
|
+
}
|
|
1626
|
+
function isReasonCode(value) {
|
|
1627
|
+
return (value === "authorization_required" ||
|
|
1628
|
+
value === "credential_required" ||
|
|
1629
|
+
value === "host_capability_required" ||
|
|
1630
|
+
value === "explicit_user_resume" ||
|
|
1631
|
+
value === "user_cancelled" ||
|
|
1632
|
+
value === "completed");
|
|
1633
|
+
}
|
|
1634
|
+
function isLifecycleKind(value) {
|
|
1635
|
+
return (value === "start_work_initialized" ||
|
|
1636
|
+
value === "start_work_continuation_issued" ||
|
|
1637
|
+
value === "start_work_paused" ||
|
|
1638
|
+
value === "start_work_resumed" ||
|
|
1639
|
+
value === "start_work_cancelled" ||
|
|
1640
|
+
value === "start_work_completed");
|
|
1641
|
+
}
|
|
1642
|
+
function isWorkStatus(value) {
|
|
1643
|
+
return value === "active" || value === "paused" || value === "abandoned" || value === "completed";
|
|
1644
|
+
}
|
|
1645
|
+
function isNonterminal(value) {
|
|
1646
|
+
return value === "active" || value === "paused";
|
|
1647
|
+
}
|
|
1648
|
+
function isTransitionAction(value) {
|
|
1649
|
+
return value === "pause" || value === "resume" || value === "cancel" || value === "complete";
|
|
1650
|
+
}
|
|
1651
|
+
function terminalAction(value) {
|
|
1652
|
+
return value === "cancel" || value === "complete";
|
|
1653
|
+
}
|
|
1654
|
+
function omitPendingBoundary(work) {
|
|
1655
|
+
const copy = { ...work };
|
|
1656
|
+
delete copy.pending_boundary;
|
|
1657
|
+
return copy;
|
|
1658
|
+
}
|
|
1659
|
+
function isCode(error, code) {
|
|
1660
|
+
return isRecord(error) && error["code"] === code;
|
|
1661
|
+
}
|
|
1662
|
+
function isRecord(value) {
|
|
1663
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1664
|
+
}
|