@rpamis/comet 0.4.0-beta.9 → 0.4.0-rc.2
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/README.md +68 -609
- package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.html +8 -0
- package/assets/eval-reports/comet-native-vs-beta16-beta17-20260810/native-benchmark-report.json +286 -0
- package/assets/manifest.json +41 -12
- package/assets/skills/comet/SKILL.md +14 -13
- package/assets/skills/comet/agents/openai.yaml +3 -0
- package/assets/skills/comet/rules/comet-phase-guard.en.md +15 -13
- package/assets/skills/comet/rules/comet-phase-guard.md +15 -13
- package/assets/skills/comet/rules/comet-workflow-guard.en.md +23 -7
- package/assets/skills/comet/rules/comet-workflow-guard.md +23 -7
- package/assets/skills/comet/scripts/comet-archive.mjs +165 -2
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +146 -7943
- package/assets/skills/comet/scripts/comet-guard.mjs +206 -2
- package/assets/skills/comet/scripts/comet-handoff.mjs +165 -2
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +152 -2
- package/assets/skills/comet/scripts/comet-hook-router.mjs +284 -10522
- package/assets/skills/comet/scripts/comet-intent.mjs +10 -2
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +148 -2
- package/assets/skills/comet/scripts/comet-runtime.mjs +294 -14687
- package/assets/skills/comet/scripts/comet-state.mjs +165 -2
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +149 -2
- package/assets/skills/comet-any/SKILL.md +4 -3
- package/assets/skills/comet-any/agents/openai.yaml +5 -0
- package/assets/skills/comet-any/reference/authoring-subagents.md +3 -11
- package/assets/skills/comet-any/reference/bundle-authoring.md +1 -1
- package/assets/skills/comet-any/reference/subagents/pause-points-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/reference-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/script-author.md +2 -5
- package/assets/skills/comet-any/reference/subagents/skill-core-author.md +1 -4
- package/assets/skills/comet-any/reference/subagents/skill-reviewer.md +1 -4
- package/assets/skills/comet-any/reference/subagents/workflow-entry-author.md +1 -4
- package/assets/skills/comet-archive/SKILL.md +34 -27
- package/assets/skills/comet-archive/agents/openai.yaml +5 -0
- package/assets/skills/comet-build/SKILL.md +84 -127
- package/assets/skills/comet-build/agents/openai.yaml +5 -0
- package/assets/skills/comet-classic/SKILL.md +45 -35
- package/assets/skills/comet-classic/agents/openai.yaml +3 -0
- package/assets/skills/{comet → comet-classic}/reference/auto-transition.md +1 -1
- package/assets/skills/comet-classic/reference/classic-layout.md +34 -0
- package/assets/skills/{comet → comet-classic}/reference/comet-yaml-fields.md +4 -4
- package/assets/skills/{comet → comet-classic}/reference/context-recovery.md +7 -7
- package/assets/skills/{comet → comet-classic}/reference/debug-gate.md +2 -2
- package/assets/skills/{comet → comet-classic}/reference/decision-point.md +5 -6
- package/assets/skills/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
- package/assets/skills/{comet → comet-classic}/reference/file-structure.md +3 -3
- package/assets/skills/{comet → comet-classic}/reference/intent-frame.md +2 -2
- package/assets/skills/comet-classic/reference/scripts.md +73 -0
- package/assets/skills/{comet → comet-classic}/reference/subagent-dispatch.md +27 -31
- package/assets/skills/comet-classic/reference/workspace.md +23 -0
- package/assets/skills/comet-design/SKILL.md +26 -24
- package/assets/skills/comet-design/agents/openai.yaml +5 -0
- package/assets/skills/comet-hotfix/SKILL.md +20 -13
- package/assets/skills/comet-hotfix/agents/openai.yaml +5 -0
- package/assets/skills/comet-memory/SKILL.md +67 -0
- package/assets/skills/comet-memory/agents/openai.yaml +5 -0
- package/assets/skills/comet-native/SKILL.md +87 -239
- package/assets/skills/comet-native/agents/openai.yaml +3 -0
- package/assets/skills/comet-native/reference/artifacts.md +48 -181
- package/assets/skills/comet-native/reference/clarification.md +77 -0
- package/assets/skills/comet-native/reference/commands.md +34 -107
- package/assets/skills/comet-native/reference/recovery.md +37 -113
- package/assets/skills/comet-native/reference/workspace.md +23 -0
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +234 -0
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +286 -0
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +173 -2
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +194 -0
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +205 -0
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +260 -0
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +203 -0
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +309 -29560
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +193 -0
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +166 -0
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +170 -0
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +190 -0
- package/assets/skills/comet-open/SKILL.md +50 -20
- package/assets/skills/comet-open/agents/openai.yaml +5 -0
- package/assets/skills/comet-review/SKILL.md +121 -0
- package/assets/skills/comet-review/agents/openai.yaml +5 -0
- package/assets/skills/comet-tweak/SKILL.md +23 -13
- package/assets/skills/comet-tweak/agents/openai.yaml +5 -0
- package/assets/skills/comet-verify/SKILL.md +25 -30
- package/assets/skills/comet-verify/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet/SKILL.md +14 -12
- package/assets/skills-zh/comet/agents/openai.yaml +3 -0
- package/assets/skills-zh/comet-any/SKILL.md +4 -3
- package/assets/skills-zh/comet-any/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-any/reference/authoring-subagents.md +3 -14
- package/assets/skills-zh/comet-any/reference/bundle-authoring.md +1 -1
- package/assets/skills-zh/comet-any/reference/subagents/pause-points-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/reference-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/script-author.md +2 -5
- package/assets/skills-zh/comet-any/reference/subagents/skill-core-author.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/skill-reviewer.md +1 -4
- package/assets/skills-zh/comet-any/reference/subagents/workflow-entry-author.md +1 -4
- package/assets/skills-zh/comet-archive/SKILL.md +34 -27
- package/assets/skills-zh/comet-archive/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-build/SKILL.md +62 -105
- package/assets/skills-zh/comet-build/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-classic/SKILL.md +44 -34
- package/assets/skills-zh/comet-classic/agents/openai.yaml +3 -0
- package/assets/skills-zh/{comet → comet-classic}/reference/auto-transition.md +1 -1
- package/assets/skills-zh/comet-classic/reference/classic-layout.md +34 -0
- package/assets/skills-zh/{comet → comet-classic}/reference/comet-yaml-fields.md +4 -4
- package/assets/skills-zh/{comet → comet-classic}/reference/context-recovery.md +7 -7
- package/assets/skills-zh/{comet → comet-classic}/reference/debug-gate.md +2 -2
- package/assets/skills-zh/{comet → comet-classic}/reference/decision-point.md +5 -6
- package/assets/skills-zh/{comet → comet-classic}/reference/dirty-worktree.md +1 -1
- package/assets/skills-zh/{comet → comet-classic}/reference/file-structure.md +3 -3
- package/assets/skills-zh/{comet → comet-classic}/reference/intent-frame.md +2 -2
- package/assets/skills-zh/comet-classic/reference/scripts.md +73 -0
- package/assets/skills-zh/{comet → comet-classic}/reference/subagent-dispatch.md +27 -31
- package/assets/skills-zh/comet-classic/reference/workspace.md +23 -0
- package/assets/skills-zh/comet-design/SKILL.md +26 -24
- package/assets/skills-zh/comet-design/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-hotfix/SKILL.md +21 -14
- package/assets/skills-zh/comet-hotfix/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-memory/SKILL.md +67 -0
- package/assets/skills-zh/comet-memory/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-native/SKILL.md +85 -237
- package/assets/skills-zh/comet-native/agents/openai.yaml +3 -0
- package/assets/skills-zh/comet-native/reference/artifacts.md +48 -183
- package/assets/skills-zh/comet-native/reference/clarification.md +77 -0
- package/assets/skills-zh/comet-native/reference/commands.md +34 -107
- package/assets/skills-zh/comet-native/reference/recovery.md +37 -113
- package/assets/skills-zh/comet-native/reference/workspace.md +23 -0
- package/assets/skills-zh/comet-open/SKILL.md +55 -25
- package/assets/skills-zh/comet-open/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-review/SKILL.md +121 -0
- package/assets/skills-zh/comet-review/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-tweak/SKILL.md +23 -13
- package/assets/skills-zh/comet-tweak/agents/openai.yaml +5 -0
- package/assets/skills-zh/comet-verify/SKILL.md +25 -30
- package/assets/skills-zh/comet-verify/agents/openai.yaml +5 -0
- package/bin/comet.js +5 -1
- package/bin/fast-runtime-router.js +79 -0
- package/dist/app/cli/index.js +346 -19
- package/dist/app/cli/index.js.map +1 -1
- package/dist/app/commands/classic.d.ts +1 -0
- package/dist/app/commands/classic.d.ts.map +1 -1
- package/dist/app/commands/classic.js +127 -1
- package/dist/app/commands/classic.js.map +1 -1
- package/dist/app/commands/comet-task.d.ts +29 -0
- package/dist/app/commands/comet-task.d.ts.map +1 -0
- package/dist/app/commands/comet-task.js +96 -0
- package/dist/app/commands/comet-task.js.map +1 -0
- package/dist/app/commands/dashboard.d.ts.map +1 -1
- package/dist/app/commands/dashboard.js +8 -2
- package/dist/app/commands/dashboard.js.map +1 -1
- package/dist/app/commands/doctor.d.ts +2 -0
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +787 -94
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/eval.d.ts +9 -2
- package/dist/app/commands/eval.d.ts.map +1 -1
- package/dist/app/commands/eval.js +303 -47
- package/dist/app/commands/eval.js.map +1 -1
- package/dist/app/commands/i18n.d.ts +1 -1
- package/dist/app/commands/i18n.d.ts.map +1 -1
- package/dist/app/commands/i18n.js +100 -0
- package/dist/app/commands/i18n.js.map +1 -1
- package/dist/app/commands/init.d.ts +2 -0
- package/dist/app/commands/init.d.ts.map +1 -1
- package/dist/app/commands/init.js +305 -72
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/native.d.ts.map +1 -1
- package/dist/app/commands/native.js +126 -1
- package/dist/app/commands/native.js.map +1 -1
- package/dist/app/commands/personal-memory.d.ts +42 -0
- package/dist/app/commands/personal-memory.d.ts.map +1 -0
- package/dist/app/commands/personal-memory.js +330 -0
- package/dist/app/commands/personal-memory.js.map +1 -0
- package/dist/app/commands/project-knowledge.d.ts +23 -0
- package/dist/app/commands/project-knowledge.d.ts.map +1 -0
- package/dist/app/commands/project-knowledge.js +198 -0
- package/dist/app/commands/project-knowledge.js.map +1 -0
- package/dist/app/commands/project-scope-selection.d.ts +2 -1
- package/dist/app/commands/project-scope-selection.d.ts.map +1 -1
- package/dist/app/commands/project-scope-selection.js +5 -7
- package/dist/app/commands/project-scope-selection.js.map +1 -1
- package/dist/app/commands/resume-probe.d.ts +1 -0
- package/dist/app/commands/resume-probe.d.ts.map +1 -1
- package/dist/app/commands/resume-probe.js +9 -10
- package/dist/app/commands/resume-probe.js.map +1 -1
- package/dist/app/commands/status.d.ts.map +1 -1
- package/dist/app/commands/status.js +67 -7
- package/dist/app/commands/status.js.map +1 -1
- package/dist/app/commands/uninstall.d.ts +6 -0
- package/dist/app/commands/uninstall.d.ts.map +1 -1
- package/dist/app/commands/uninstall.js +298 -69
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/app/commands/update.d.ts +4 -1
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +485 -79
- package/dist/app/commands/update.js.map +1 -1
- package/dist/app/commands/workflow.d.ts +4 -0
- package/dist/app/commands/workflow.d.ts.map +1 -1
- package/dist/app/commands/workflow.js +25 -2
- package/dist/app/commands/workflow.js.map +1 -1
- package/dist/config/repository-layout.json +30 -3
- package/dist/domains/agent-learning/context-director.d.ts +135 -0
- package/dist/domains/agent-learning/context-director.d.ts.map +1 -0
- package/dist/domains/agent-learning/context-director.js +639 -0
- package/dist/domains/agent-learning/context-director.js.map +1 -0
- package/dist/domains/agent-learning/coordinator.d.ts +71 -0
- package/dist/domains/agent-learning/coordinator.d.ts.map +1 -0
- package/dist/domains/agent-learning/coordinator.js +321 -0
- package/dist/domains/agent-learning/coordinator.js.map +1 -0
- package/dist/domains/agent-learning/experience-journal.d.ts +88 -0
- package/dist/domains/agent-learning/experience-journal.d.ts.map +1 -0
- package/dist/domains/agent-learning/experience-journal.js +330 -0
- package/dist/domains/agent-learning/experience-journal.js.map +1 -0
- package/dist/domains/agent-learning/index.d.ts +6 -0
- package/dist/domains/agent-learning/index.d.ts.map +1 -0
- package/dist/domains/agent-learning/index.js +6 -0
- package/dist/domains/agent-learning/index.js.map +1 -0
- package/dist/domains/agent-learning/policy-compiler.d.ts +22 -0
- package/dist/domains/agent-learning/policy-compiler.d.ts.map +1 -0
- package/dist/domains/agent-learning/policy-compiler.js +20 -0
- package/dist/domains/agent-learning/policy-compiler.js.map +1 -0
- package/dist/domains/agent-learning/types.d.ts +137 -0
- package/dist/domains/agent-learning/types.d.ts.map +1 -0
- package/dist/domains/agent-learning/types.js +319 -0
- package/dist/domains/agent-learning/types.js.map +1 -0
- package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
- package/dist/domains/bundle/bundle-platform.js +79 -10
- package/dist/domains/bundle/bundle-platform.js.map +1 -1
- package/dist/domains/bundle/compatibility-benchmark.d.ts.map +1 -1
- package/dist/domains/bundle/compatibility-benchmark.js +9 -1
- package/dist/domains/bundle/compatibility-benchmark.js.map +1 -1
- package/dist/domains/bundle/eval-manifest-runtime.d.ts +2 -0
- package/dist/domains/bundle/eval-manifest-runtime.d.ts.map +1 -1
- package/dist/domains/bundle/eval-manifest-runtime.js +67 -7
- package/dist/domains/bundle/eval-manifest-runtime.js.map +1 -1
- package/dist/domains/bundle/eval-run-result.d.ts +22 -0
- package/dist/domains/bundle/eval-run-result.d.ts.map +1 -0
- package/dist/domains/bundle/eval-run-result.js +207 -0
- package/dist/domains/bundle/eval-run-result.js.map +1 -0
- package/dist/domains/bundle/eval.d.ts.map +1 -1
- package/dist/domains/bundle/eval.js +21 -24
- package/dist/domains/bundle/eval.js.map +1 -1
- package/dist/domains/bundle/factory.d.ts.map +1 -1
- package/dist/domains/bundle/factory.js +2 -9
- package/dist/domains/bundle/factory.js.map +1 -1
- package/dist/domains/bundle/review-summary.js +1 -1
- package/dist/domains/bundle/review-summary.js.map +1 -1
- package/dist/domains/bundle/state.d.ts.map +1 -1
- package/dist/domains/bundle/state.js +117 -2
- package/dist/domains/bundle/state.js.map +1 -1
- package/dist/domains/bundle/types.d.ts +2 -2
- package/dist/domains/bundle/types.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.js +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-archive-pointer.d.ts +8 -0
- package/dist/domains/comet-classic/classic-archive-pointer.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-archive-pointer.js +66 -0
- package/dist/domains/comet-classic/classic-archive-pointer.js.map +1 -0
- package/dist/domains/comet-classic/classic-archive.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-archive.js +186 -80
- package/dist/domains/comet-classic/classic-archive.js.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.js +10 -2
- package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
- package/dist/domains/comet-classic/classic-cli.d.ts +11 -1
- package/dist/domains/comet-classic/classic-cli.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-cli.js +22 -3
- package/dist/domains/comet-classic/classic-cli.js.map +1 -1
- package/dist/domains/comet-classic/classic-command-checks.d.ts +2 -2
- package/dist/domains/comet-classic/classic-command-checks.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-command-checks.js +8 -11
- package/dist/domains/comet-classic/classic-command-checks.js.map +1 -1
- package/dist/domains/comet-classic/classic-command-context.d.ts +21 -0
- package/dist/domains/comet-classic/classic-command-context.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-command-context.js +52 -0
- package/dist/domains/comet-classic/classic-command-context.js.map +1 -0
- package/dist/domains/comet-classic/classic-current-change.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-current-change.js +45 -25
- package/dist/domains/comet-classic/classic-current-change.js.map +1 -1
- package/dist/domains/comet-classic/classic-evidence.d.ts +1 -0
- package/dist/domains/comet-classic/classic-evidence.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-evidence.js +136 -40
- package/dist/domains/comet-classic/classic-evidence.js.map +1 -1
- package/dist/domains/comet-classic/classic-experience.d.ts +8 -0
- package/dist/domains/comet-classic/classic-experience.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-experience.js +46 -0
- package/dist/domains/comet-classic/classic-experience.js.map +1 -0
- package/dist/domains/comet-classic/classic-guard-entry.js +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-guard.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-guard.js +122 -76
- package/dist/domains/comet-classic/classic-guard.js.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-handoff.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-handoff.js +208 -109
- package/dist/domains/comet-classic/classic-handoff.js.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard-entry.js +1 -1
- package/dist/domains/comet-classic/classic-hook-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.d.ts +5 -1
- package/dist/domains/comet-classic/classic-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-hook-guard.js +242 -92
- package/dist/domains/comet-classic/classic-hook-guard.js.map +1 -1
- package/dist/domains/comet-classic/classic-intent-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-intent-command.js +2 -1
- package/dist/domains/comet-classic/classic-intent-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-intent-entry.js +1 -1
- package/dist/domains/comet-classic/classic-intent-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-layout-initialization.d.ts +87 -0
- package/dist/domains/comet-classic/classic-layout-initialization.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-layout-initialization.js +828 -0
- package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -0
- package/dist/domains/comet-classic/classic-layout.d.ts +41 -0
- package/dist/domains/comet-classic/classic-layout.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-layout.js +222 -0
- package/dist/domains/comet-classic/classic-layout.js.map +1 -0
- package/dist/domains/comet-classic/classic-migrate.d.ts +4 -0
- package/dist/domains/comet-classic/classic-migrate.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-migrate.js +8 -12
- package/dist/domains/comet-classic/classic-migrate.js.map +1 -1
- package/dist/domains/comet-classic/classic-openspec-command.d.ts +4 -0
- package/dist/domains/comet-classic/classic-openspec-command.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-openspec-command.js +45 -0
- package/dist/domains/comet-classic/classic-openspec-command.js.map +1 -0
- package/dist/domains/comet-classic/classic-openspec-root.d.ts +13 -0
- package/dist/domains/comet-classic/classic-openspec-root.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-openspec-root.js +47 -0
- package/dist/domains/comet-classic/classic-openspec-root.js.map +1 -0
- package/dist/domains/comet-classic/classic-output-language.d.ts +73 -0
- package/dist/domains/comet-classic/classic-output-language.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-output-language.js +175 -0
- package/dist/domains/comet-classic/classic-output-language.js.map +1 -0
- package/dist/domains/comet-classic/classic-paths.d.ts +11 -1
- package/dist/domains/comet-classic/classic-paths.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-paths.js +87 -35
- package/dist/domains/comet-classic/classic-paths.js.map +1 -1
- package/dist/domains/comet-classic/classic-plan-readiness.d.ts +12 -0
- package/dist/domains/comet-classic/classic-plan-readiness.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-plan-readiness.js +26 -0
- package/dist/domains/comet-classic/classic-plan-readiness.js.map +1 -0
- package/dist/domains/comet-classic/classic-project-config.d.ts +1 -0
- package/dist/domains/comet-classic/classic-project-config.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-project-config.js +16 -18
- package/dist/domains/comet-classic/classic-project-config.js.map +1 -1
- package/dist/domains/comet-classic/classic-protected-path.d.ts +39 -0
- package/dist/domains/comet-classic/classic-protected-path.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-protected-path.js +69 -0
- package/dist/domains/comet-classic/classic-protected-path.js.map +1 -0
- package/dist/domains/comet-classic/classic-resume-probe-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe-command.js +6 -4
- package/dist/domains/comet-classic/classic-resume-probe-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe-entry.js +1 -1
- package/dist/domains/comet-classic/classic-resume-probe-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.js +41 -21
- package/dist/domains/comet-classic/classic-resume-probe.js.map +1 -1
- package/dist/domains/comet-classic/classic-root-command.d.ts +8 -0
- package/dist/domains/comet-classic/classic-root-command.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-root-command.js +199 -0
- package/dist/domains/comet-classic/classic-root-command.js.map +1 -0
- package/dist/domains/comet-classic/classic-root-move.d.ts +118 -0
- package/dist/domains/comet-classic/classic-root-move.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-root-move.js +1640 -0
- package/dist/domains/comet-classic/classic-root-move.js.map +1 -0
- package/dist/domains/comet-classic/classic-runtime-run.d.ts +6 -0
- package/dist/domains/comet-classic/classic-runtime-run.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-runtime-run.js +58 -9
- package/dist/domains/comet-classic/classic-runtime-run.js.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts +2 -2
- package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.js +14 -3
- package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.js +272 -109
- package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-events.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-events.js +3 -4
- package/dist/domains/comet-classic/classic-state-events.js.map +1 -1
- package/dist/domains/comet-classic/classic-store.d.ts +2 -0
- package/dist/domains/comet-classic/classic-store.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-store.js +12 -17
- package/dist/domains/comet-classic/classic-store.js.map +1 -1
- package/dist/domains/comet-classic/classic-validate-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-validate-command.js +26 -19
- package/dist/domains/comet-classic/classic-validate-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-validate-entry.js +1 -1
- package/dist/domains/comet-classic/classic-validate-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-workspace-command.d.ts +3 -0
- package/dist/domains/comet-classic/classic-workspace-command.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-workspace-command.js +45 -0
- package/dist/domains/comet-classic/classic-workspace-command.js.map +1 -0
- package/dist/domains/comet-classic/classic-workspace.d.ts +38 -0
- package/dist/domains/comet-classic/classic-workspace.d.ts.map +1 -0
- package/dist/domains/comet-classic/classic-workspace.js +315 -0
- package/dist/domains/comet-classic/classic-workspace.js.map +1 -0
- package/dist/domains/comet-classic/index.d.ts +1 -0
- package/dist/domains/comet-classic/index.d.ts.map +1 -1
- package/dist/domains/comet-classic/index.js +1 -0
- package/dist/domains/comet-classic/index.js.map +1 -1
- package/dist/domains/comet-entry/current-selection-repair.js +1 -1
- package/dist/domains/comet-entry/current-selection-repair.js.map +1 -1
- package/dist/domains/comet-entry/entry-reads.d.ts +17 -0
- package/dist/domains/comet-entry/entry-reads.d.ts.map +1 -0
- package/dist/domains/comet-entry/entry-reads.js +20 -0
- package/dist/domains/comet-entry/entry-reads.js.map +1 -0
- package/dist/domains/comet-entry/hook-adapter.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-adapter.js +90 -4
- package/dist/domains/comet-entry/hook-adapter.js.map +1 -1
- package/dist/domains/comet-entry/hook-project-root.d.ts +3 -0
- package/dist/domains/comet-entry/hook-project-root.d.ts.map +1 -0
- package/dist/domains/comet-entry/hook-project-root.js +62 -0
- package/dist/domains/comet-entry/hook-project-root.js.map +1 -0
- package/dist/domains/comet-entry/hook-router-entry.d.ts +4 -1
- package/dist/domains/comet-entry/hook-router-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router-entry.js +47 -33
- package/dist/domains/comet-entry/hook-router-entry.js.map +1 -1
- package/dist/domains/comet-entry/hook-router.d.ts +16 -2
- package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router.js +118 -20
- package/dist/domains/comet-entry/hook-router.js.map +1 -1
- package/dist/domains/comet-entry/hook-types.d.ts +5 -1
- package/dist/domains/comet-entry/hook-types.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.d.ts +4 -1
- package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.js +65 -30
- package/dist/domains/comet-entry/init-workflow.js.map +1 -1
- package/dist/domains/comet-entry/plugin-context.d.ts +26 -0
- package/dist/domains/comet-entry/plugin-context.d.ts.map +1 -0
- package/dist/domains/comet-entry/plugin-context.js +127 -0
- package/dist/domains/comet-entry/plugin-context.js.map +1 -0
- package/dist/domains/comet-entry/project-activation.d.ts +12 -0
- package/dist/domains/comet-entry/project-activation.d.ts.map +1 -0
- package/dist/domains/comet-entry/project-activation.js +114 -0
- package/dist/domains/comet-entry/project-activation.js.map +1 -0
- package/dist/domains/comet-entry/project-status.d.ts.map +1 -1
- package/dist/domains/comet-entry/project-status.js +133 -48
- package/dist/domains/comet-entry/project-status.js.map +1 -1
- package/dist/domains/comet-entry/resolve-entry.d.ts.map +1 -1
- package/dist/domains/comet-entry/resolve-entry.js +4 -9
- package/dist/domains/comet-entry/resolve-entry.js.map +1 -1
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +115 -35
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-entry/types.d.ts +8 -2
- package/dist/domains/comet-entry/types.d.ts.map +1 -1
- package/dist/domains/comet-memory/index.d.ts +10 -0
- package/dist/domains/comet-memory/index.d.ts.map +1 -0
- package/dist/domains/comet-memory/index.js +10 -0
- package/dist/domains/comet-memory/index.js.map +1 -0
- package/dist/domains/comet-memory/personal-memory.d.ts +57 -0
- package/dist/domains/comet-memory/personal-memory.d.ts.map +1 -0
- package/dist/domains/comet-memory/personal-memory.js +2142 -0
- package/dist/domains/comet-memory/personal-memory.js.map +1 -0
- package/dist/domains/comet-memory/plugin.d.ts +5 -0
- package/dist/domains/comet-memory/plugin.d.ts.map +1 -0
- package/dist/domains/comet-memory/plugin.js +957 -0
- package/dist/domains/comet-memory/plugin.js.map +1 -0
- package/dist/domains/comet-memory/provider-config.d.ts +4 -0
- package/dist/domains/comet-memory/provider-config.d.ts.map +1 -0
- package/dist/domains/comet-memory/provider-config.js +127 -0
- package/dist/domains/comet-memory/provider-config.js.map +1 -0
- package/dist/domains/comet-memory/remote-provider.d.ts +47 -0
- package/dist/domains/comet-memory/remote-provider.d.ts.map +1 -0
- package/dist/domains/comet-memory/remote-provider.js +562 -0
- package/dist/domains/comet-memory/remote-provider.js.map +1 -0
- package/dist/domains/comet-memory/repository.d.ts +38 -0
- package/dist/domains/comet-memory/repository.d.ts.map +1 -0
- package/dist/domains/comet-memory/repository.js +341 -0
- package/dist/domains/comet-memory/repository.js.map +1 -0
- package/dist/domains/comet-memory/review-contract.d.ts +16 -0
- package/dist/domains/comet-memory/review-contract.d.ts.map +1 -0
- package/dist/domains/comet-memory/review-contract.js +642 -0
- package/dist/domains/comet-memory/review-contract.js.map +1 -0
- package/dist/domains/comet-memory/semantic-review.d.ts +3 -0
- package/dist/domains/comet-memory/semantic-review.d.ts.map +1 -0
- package/dist/domains/comet-memory/semantic-review.js +204 -0
- package/dist/domains/comet-memory/semantic-review.js.map +1 -0
- package/dist/domains/comet-memory/skill-runtime.d.ts +11 -0
- package/dist/domains/comet-memory/skill-runtime.d.ts.map +1 -0
- package/dist/domains/comet-memory/skill-runtime.js +13 -0
- package/dist/domains/comet-memory/skill-runtime.js.map +1 -0
- package/dist/domains/comet-memory/types.d.ts +580 -0
- package/dist/domains/comet-memory/types.d.ts.map +1 -0
- package/dist/domains/comet-memory/types.js +7 -0
- package/dist/domains/comet-memory/types.js.map +1 -0
- package/dist/domains/comet-native/index.d.ts +4 -0
- package/dist/domains/comet-native/index.d.ts.map +1 -1
- package/dist/domains/comet-native/index.js +4 -0
- package/dist/domains/comet-native/index.js.map +1 -1
- package/dist/domains/comet-native/native-acceptance.d.ts +15 -4
- package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-acceptance.js +168 -31
- package/dist/domains/comet-native/native-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-archive-command.d.ts +3 -0
- package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-archive-command.js +244 -0
- package/dist/domains/comet-native/native-archive-command.js.map +1 -0
- package/dist/domains/comet-native/native-archive-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-archive-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-archive-entry.js +4 -0
- package/dist/domains/comet-native/native-archive-entry.js.map +1 -0
- package/dist/domains/comet-native/native-archive-inspection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-inspection.js +14 -0
- package/dist/domains/comet-native/native-archive-inspection.js.map +1 -1
- package/dist/domains/comet-native/native-archive-preflight.d.ts +13 -1
- package/dist/domains/comet-native/native-archive-preflight.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-preflight.js +52 -0
- package/dist/domains/comet-native/native-archive-preflight.js.map +1 -1
- package/dist/domains/comet-native/native-archive-transaction.d.ts +1 -0
- package/dist/domains/comet-native/native-archive-transaction.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-transaction.js +31 -23
- package/dist/domains/comet-native/native-archive-transaction.js.map +1 -1
- package/dist/domains/comet-native/native-archive.d.ts +1 -0
- package/dist/domains/comet-native/native-archive.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive.js +76 -13
- package/dist/domains/comet-native/native-archive.js.map +1 -1
- package/dist/domains/comet-native/native-artifact-language.d.ts +10 -0
- package/dist/domains/comet-native/native-artifact-language.d.ts.map +1 -0
- package/dist/domains/comet-native/native-artifact-language.js +105 -0
- package/dist/domains/comet-native/native-artifact-language.js.map +1 -0
- package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifacts.js +21 -14
- package/dist/domains/comet-native/native-artifacts.js.map +1 -1
- package/dist/domains/comet-native/native-atomic-file.d.ts.map +1 -1
- package/dist/domains/comet-native/native-atomic-file.js +17 -10
- package/dist/domains/comet-native/native-atomic-file.js.map +1 -1
- package/dist/domains/comet-native/native-bounded-file.d.ts +32 -2
- package/dist/domains/comet-native/native-bounded-file.d.ts.map +1 -1
- package/dist/domains/comet-native/native-bounded-file.js +87 -6
- package/dist/domains/comet-native/native-bounded-file.js.map +1 -1
- package/dist/domains/comet-native/native-build-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-build-evidence.js +23 -1
- package/dist/domains/comet-native/native-build-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-change.d.ts +20 -2
- package/dist/domains/comet-native/native-change.d.ts.map +1 -1
- package/dist/domains/comet-native/native-change.js +201 -32
- package/dist/domains/comet-native/native-change.js.map +1 -1
- package/dist/domains/comet-native/native-check-command.d.ts +3 -0
- package/dist/domains/comet-native/native-check-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-check-command.js +30 -0
- package/dist/domains/comet-native/native-check-command.js.map +1 -0
- package/dist/domains/comet-native/native-check-executor.d.ts +36 -0
- package/dist/domains/comet-native/native-check-executor.d.ts.map +1 -0
- package/dist/domains/comet-native/native-check-executor.js +132 -0
- package/dist/domains/comet-native/native-check-executor.js.map +1 -0
- package/dist/domains/comet-native/native-check-receipt-model.d.ts +10 -1
- package/dist/domains/comet-native/native-check-receipt-model.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-model.js +76 -9
- package/dist/domains/comet-native/native-check-receipt-model.js.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt-storage.js +9 -8
- package/dist/domains/comet-native/native-check-receipt-storage.js.map +1 -1
- package/dist/domains/comet-native/native-check-receipt.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check-receipt.js +125 -60
- package/dist/domains/comet-native/native-check-receipt.js.map +1 -1
- package/dist/domains/comet-native/native-check.d.ts +6 -0
- package/dist/domains/comet-native/native-check.d.ts.map +1 -1
- package/dist/domains/comet-native/native-check.js +36 -15
- package/dist/domains/comet-native/native-check.js.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-command.d.ts +3 -0
- package/dist/domains/comet-native/native-checkpoint-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-command.js +33 -0
- package/dist/domains/comet-native/native-checkpoint-command.js.map +1 -0
- package/dist/domains/comet-native/native-checkpoint-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-checkpoint-storage.js +27 -19
- package/dist/domains/comet-native/native-checkpoint-storage.js.map +1 -1
- package/dist/domains/comet-native/native-children.d.ts +114 -0
- package/dist/domains/comet-native/native-children.d.ts.map +1 -0
- package/dist/domains/comet-native/native-children.js +786 -0
- package/dist/domains/comet-native/native-children.js.map +1 -0
- package/dist/domains/comet-native/native-cli-help.d.ts +6 -0
- package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -0
- package/dist/domains/comet-native/native-cli-help.js +203 -0
- package/dist/domains/comet-native/native-cli-help.js.map +1 -0
- package/dist/domains/comet-native/native-cli-shared.d.ts +46 -0
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -0
- package/dist/domains/comet-native/native-cli-shared.js +375 -0
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -0
- package/dist/domains/comet-native/native-cli.d.ts +2 -5
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +59 -729
- package/dist/domains/comet-native/native-cli.js.map +1 -1
- package/dist/domains/comet-native/native-config.d.ts +7 -2
- package/dist/domains/comet-native/native-config.d.ts.map +1 -1
- package/dist/domains/comet-native/native-config.js +24 -322
- package/dist/domains/comet-native/native-config.js.map +1 -1
- package/dist/domains/comet-native/native-conflict-inspection.d.ts +3 -1
- package/dist/domains/comet-native/native-conflict-inspection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-conflict-inspection.js +20 -10
- package/dist/domains/comet-native/native-conflict-inspection.js.map +1 -1
- package/dist/domains/comet-native/native-continuation.d.ts +3 -1
- package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-continuation.js +215 -95
- package/dist/domains/comet-native/native-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-contract.d.ts.map +1 -1
- package/dist/domains/comet-native/native-contract.js +2 -1
- package/dist/domains/comet-native/native-contract.js.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.d.ts +5 -0
- package/dist/domains/comet-native/native-diagnostics.d.ts.map +1 -1
- package/dist/domains/comet-native/native-diagnostics.js +183 -70
- package/dist/domains/comet-native/native-diagnostics.js.map +1 -1
- package/dist/domains/comet-native/native-doctor-command.d.ts +3 -0
- package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-doctor-command.js +361 -0
- package/dist/domains/comet-native/native-doctor-command.js.map +1 -0
- package/dist/domains/comet-native/native-doctor-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-doctor-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-doctor-entry.js +4 -0
- package/dist/domains/comet-native/native-doctor-entry.js.map +1 -0
- package/dist/domains/comet-native/native-doctor.d.ts +1 -0
- package/dist/domains/comet-native/native-doctor.d.ts.map +1 -1
- package/dist/domains/comet-native/native-doctor.js +123 -26
- package/dist/domains/comet-native/native-doctor.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-command.d.ts +3 -0
- package/dist/domains/comet-native/native-evidence-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-evidence-command.js +35 -0
- package/dist/domains/comet-native/native-evidence-command.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-projection.d.ts +52 -0
- package/dist/domains/comet-native/native-evidence-projection.d.ts.map +1 -0
- package/dist/domains/comet-native/native-evidence-projection.js +291 -0
- package/dist/domains/comet-native/native-evidence-projection.js.map +1 -0
- package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-retention.js +29 -14
- package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.d.ts +31 -7
- package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.js +145 -27
- package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
- package/dist/domains/comet-native/native-experience.d.ts +12 -0
- package/dist/domains/comet-native/native-experience.d.ts.map +1 -0
- package/dist/domains/comet-native/native-experience.js +71 -0
- package/dist/domains/comet-native/native-experience.js.map +1 -0
- package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
- package/dist/domains/comet-native/native-findings.js +76 -4
- package/dist/domains/comet-native/native-findings.js.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.d.ts +16 -0
- package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -0
- package/dist/domains/comet-native/native-git-provenance.js +171 -0
- package/dist/domains/comet-native/native-git-provenance.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-command.d.ts +3 -0
- package/dist/domains/comet-native/native-hook-guard-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-command.js +32 -0
- package/dist/domains/comet-native/native-hook-guard-command.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-hook-guard-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-hook-guard-entry.js +4 -0
- package/dist/domains/comet-native/native-hook-guard-entry.js.map +1 -0
- package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +221 -22
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-init-command.d.ts +3 -0
- package/dist/domains/comet-native/native-init-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-init-command.js +41 -0
- package/dist/domains/comet-native/native-init-command.js.map +1 -0
- package/dist/domains/comet-native/native-init-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-init-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-init-entry.js +4 -0
- package/dist/domains/comet-native/native-init-entry.js.map +1 -0
- package/dist/domains/comet-native/native-local-execution.d.ts +25 -0
- package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -0
- package/dist/domains/comet-native/native-local-execution.js +241 -0
- package/dist/domains/comet-native/native-local-execution.js.map +1 -0
- package/dist/domains/comet-native/native-lock.d.ts +1 -1
- package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-lock.js +9 -9
- package/dist/domains/comet-native/native-lock.js.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.d.ts +71 -0
- package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-loop-runtime.js +663 -0
- package/dist/domains/comet-native/native-loop-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-mutation-lock.d.ts +2 -0
- package/dist/domains/comet-native/native-mutation-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-mutation-lock.js +23 -2
- package/dist/domains/comet-native/native-mutation-lock.js.map +1 -1
- package/dist/domains/comet-native/native-new-command.d.ts +3 -0
- package/dist/domains/comet-native/native-new-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-new-command.js +57 -0
- package/dist/domains/comet-native/native-new-command.js.map +1 -0
- package/dist/domains/comet-native/native-new-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-new-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-new-entry.js +4 -0
- package/dist/domains/comet-native/native-new-entry.js.map +1 -0
- package/dist/domains/comet-native/native-next-command.d.ts +3 -0
- package/dist/domains/comet-native/native-next-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-next-command.js +358 -0
- package/dist/domains/comet-native/native-next-command.js.map +1 -0
- package/dist/domains/comet-native/native-next-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-next-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-next-entry.js +4 -0
- package/dist/domains/comet-native/native-next-entry.js.map +1 -0
- package/dist/domains/comet-native/native-output-language.d.ts +69 -0
- package/dist/domains/comet-native/native-output-language.d.ts.map +1 -0
- package/dist/domains/comet-native/native-output-language.js +369 -0
- package/dist/domains/comet-native/native-output-language.js.map +1 -0
- package/dist/domains/comet-native/native-paths.d.ts +18 -0
- package/dist/domains/comet-native/native-paths.d.ts.map +1 -1
- package/dist/domains/comet-native/native-paths.js +127 -26
- package/dist/domains/comet-native/native-paths.js.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.d.ts +28 -0
- package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-acceptance.js +73 -0
- package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts +37 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-archive.js +530 -0
- package/dist/domains/comet-native/native-portable-archive.js.map +1 -0
- package/dist/domains/comet-native/native-portable-continuation.d.ts +50 -0
- package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-continuation.js +633 -0
- package/dist/domains/comet-native/native-portable-continuation.js.map +1 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.d.ts +9 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.js +218 -0
- package/dist/domains/comet-native/native-portable-migration-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-portable-migration.d.ts +42 -0
- package/dist/domains/comet-native/native-portable-migration.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-migration.js +212 -0
- package/dist/domains/comet-native/native-portable-migration.js.map +1 -0
- package/dist/domains/comet-native/native-portable-recovery.d.ts +15 -0
- package/dist/domains/comet-native/native-portable-recovery.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-recovery.js +203 -0
- package/dist/domains/comet-native/native-portable-recovery.js.map +1 -0
- package/dist/domains/comet-native/native-portable-runtime.d.ts +195 -0
- package/dist/domains/comet-native/native-portable-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-runtime.js +1710 -0
- package/dist/domains/comet-native/native-portable-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-portable-state.d.ts +30 -0
- package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-state.js +730 -0
- package/dist/domains/comet-native/native-portable-state.js.map +1 -0
- package/dist/domains/comet-native/native-portable-status.d.ts +97 -0
- package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-status.js +333 -0
- package/dist/domains/comet-native/native-portable-status.js.map +1 -0
- package/dist/domains/comet-native/native-portable-summary.d.ts +29 -0
- package/dist/domains/comet-native/native-portable-summary.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-summary.js +37 -0
- package/dist/domains/comet-native/native-portable-summary.js.map +1 -0
- package/dist/domains/comet-native/native-portable-text.d.ts +8 -0
- package/dist/domains/comet-native/native-portable-text.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-text.js +28 -0
- package/dist/domains/comet-native/native-portable-text.js.map +1 -0
- package/dist/domains/comet-native/native-portable-transactions.d.ts +41 -0
- package/dist/domains/comet-native/native-portable-transactions.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-transactions.js +204 -0
- package/dist/domains/comet-native/native-portable-transactions.js.map +1 -0
- package/dist/domains/comet-native/native-portable-types.d.ts +177 -0
- package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -0
- package/dist/domains/comet-native/native-portable-types.js +19 -0
- package/dist/domains/comet-native/native-portable-types.js.map +1 -0
- package/dist/domains/comet-native/native-pull-request-finish.d.ts +35 -0
- package/dist/domains/comet-native/native-pull-request-finish.d.ts.map +1 -0
- package/dist/domains/comet-native/native-pull-request-finish.js +282 -0
- package/dist/domains/comet-native/native-pull-request-finish.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-command.d.ts +3 -0
- package/dist/domains/comet-native/native-receipt-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-command.js +120 -0
- package/dist/domains/comet-native/native-receipt-command.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-errors.d.ts +23 -0
- package/dist/domains/comet-native/native-receipt-errors.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-errors.js +9 -0
- package/dist/domains/comet-native/native-receipt-errors.js.map +1 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts +89 -0
- package/dist/domains/comet-native/native-receipt-refresh.d.ts.map +1 -0
- package/dist/domains/comet-native/native-receipt-refresh.js +243 -0
- package/dist/domains/comet-native/native-receipt-refresh.js.map +1 -0
- package/dist/domains/comet-native/native-repair-integration.d.ts +7 -5
- package/dist/domains/comet-native/native-repair-integration.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-integration.js +77 -29
- package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
- package/dist/domains/comet-native/native-repair-runtime.d.ts +5 -1
- package/dist/domains/comet-native/native-repair-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-runtime.js +114 -37
- package/dist/domains/comet-native/native-repair-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-repair-stagnation.d.ts +9 -13
- package/dist/domains/comet-native/native-repair-stagnation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-stagnation.js +76 -34
- package/dist/domains/comet-native/native-repair-stagnation.js.map +1 -1
- package/dist/domains/comet-native/native-resume-view.d.ts.map +1 -1
- package/dist/domains/comet-native/native-resume-view.js +1 -5
- package/dist/domains/comet-native/native-resume-view.js.map +1 -1
- package/dist/domains/comet-native/native-root-command.d.ts +3 -0
- package/dist/domains/comet-native/native-root-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-root-command.js +29 -0
- package/dist/domains/comet-native/native-root-command.js.map +1 -0
- package/dist/domains/comet-native/native-root-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-root-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-root-entry.js +4 -0
- package/dist/domains/comet-native/native-root-entry.js.map +1 -0
- package/dist/domains/comet-native/native-root-move.d.ts.map +1 -1
- package/dist/domains/comet-native/native-root-move.js +58 -17
- package/dist/domains/comet-native/native-root-move.js.map +1 -1
- package/dist/domains/comet-native/native-run-consistency.d.ts.map +1 -1
- package/dist/domains/comet-native/native-run-consistency.js +8 -12
- package/dist/domains/comet-native/native-run-consistency.js.map +1 -1
- package/dist/domains/comet-native/native-run-store.js +4 -4
- package/dist/domains/comet-native/native-run-store.js.map +1 -1
- package/dist/domains/comet-native/native-runner-input.d.ts +224 -0
- package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-input.js +806 -0
- package/dist/domains/comet-native/native-runner-input.js.map +1 -0
- package/dist/domains/comet-native/native-runner-protocol.d.ts +40 -0
- package/dist/domains/comet-native/native-runner-protocol.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-protocol.js +55 -0
- package/dist/domains/comet-native/native-runner-protocol.js.map +1 -0
- package/dist/domains/comet-native/native-runtime-package.d.ts +3 -0
- package/dist/domains/comet-native/native-runtime-package.d.ts.map +1 -1
- package/dist/domains/comet-native/native-runtime-package.js +5 -1
- package/dist/domains/comet-native/native-runtime-package.js.map +1 -1
- package/dist/domains/comet-native/native-schema-migration.d.ts.map +1 -1
- package/dist/domains/comet-native/native-schema-migration.js +31 -27
- package/dist/domains/comet-native/native-schema-migration.js.map +1 -1
- package/dist/domains/comet-native/native-script-entry.d.ts +13 -0
- package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-script-entry.js +36 -0
- package/dist/domains/comet-native/native-script-entry.js.map +1 -0
- package/dist/domains/comet-native/native-select-command.d.ts +3 -0
- package/dist/domains/comet-native/native-select-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-select-command.js +19 -0
- package/dist/domains/comet-native/native-select-command.js.map +1 -0
- package/dist/domains/comet-native/native-select-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-select-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-select-entry.js +4 -0
- package/dist/domains/comet-native/native-select-entry.js.map +1 -0
- package/dist/domains/comet-native/native-selection.d.ts.map +1 -1
- package/dist/domains/comet-native/native-selection.js +11 -2
- package/dist/domains/comet-native/native-selection.js.map +1 -1
- package/dist/domains/comet-native/native-show-command.d.ts +3 -0
- package/dist/domains/comet-native/native-show-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-show-command.js +78 -0
- package/dist/domains/comet-native/native-show-command.js.map +1 -0
- package/dist/domains/comet-native/native-show-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-show-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-show-entry.js +4 -0
- package/dist/domains/comet-native/native-show-entry.js.map +1 -0
- package/dist/domains/comet-native/native-snapshot.d.ts +9 -0
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +229 -26
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-spec-command.d.ts +3 -0
- package/dist/domains/comet-native/native-spec-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-spec-command.js +20 -0
- package/dist/domains/comet-native/native-spec-command.js.map +1 -0
- package/dist/domains/comet-native/native-spec-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-spec-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-spec-entry.js +4 -0
- package/dist/domains/comet-native/native-spec-entry.js.map +1 -0
- package/dist/domains/comet-native/native-specs.js +3 -3
- package/dist/domains/comet-native/native-specs.js.map +1 -1
- package/dist/domains/comet-native/native-status-command.d.ts +3 -0
- package/dist/domains/comet-native/native-status-command.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-command.js +26 -0
- package/dist/domains/comet-native/native-status-command.js.map +1 -0
- package/dist/domains/comet-native/native-status-discovery.d.ts +82 -0
- package/dist/domains/comet-native/native-status-discovery.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-discovery.js +356 -0
- package/dist/domains/comet-native/native-status-discovery.js.map +1 -0
- package/dist/domains/comet-native/native-status-entry.d.ts +2 -0
- package/dist/domains/comet-native/native-status-entry.d.ts.map +1 -0
- package/dist/domains/comet-native/native-status-entry.js +4 -0
- package/dist/domains/comet-native/native-status-entry.js.map +1 -0
- package/dist/domains/comet-native/native-supervisor.d.ts +220 -0
- package/dist/domains/comet-native/native-supervisor.d.ts.map +1 -0
- package/dist/domains/comet-native/native-supervisor.js +1210 -0
- package/dist/domains/comet-native/native-supervisor.js.map +1 -0
- package/dist/domains/comet-native/native-trajectory-recovery.d.ts.map +1 -1
- package/dist/domains/comet-native/native-trajectory-recovery.js +6 -9
- package/dist/domains/comet-native/native-trajectory-recovery.js.map +1 -1
- package/dist/domains/comet-native/native-transaction.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transaction.js +31 -20
- package/dist/domains/comet-native/native-transaction.js.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.js +1 -3
- package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-transition-journal.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transition-journal.js +71 -22
- package/dist/domains/comet-native/native-transition-journal.js.map +1 -1
- package/dist/domains/comet-native/native-transitions.d.ts +5 -0
- package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transitions.js +287 -79
- package/dist/domains/comet-native/native-transitions.js.map +1 -1
- package/dist/domains/comet-native/native-types.d.ts +66 -45
- package/dist/domains/comet-native/native-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-types.js.map +1 -1
- package/dist/domains/comet-native/native-verification-evidence.d.ts +9 -5
- package/dist/domains/comet-native/native-verification-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-evidence.js +85 -29
- package/dist/domains/comet-native/native-verification-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +99 -0
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +597 -0
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -0
- package/dist/domains/comet-native/native-verification-receipt.d.ts +79 -0
- package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verification-receipt.js +305 -0
- package/dist/domains/comet-native/native-verification-receipt.js.map +1 -0
- package/dist/domains/comet-native/native-verification-report-v2.d.ts +14 -0
- package/dist/domains/comet-native/native-verification-report-v2.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verification-report-v2.js +188 -0
- package/dist/domains/comet-native/native-verification-report-v2.js.map +1 -0
- package/dist/domains/comet-native/native-verification-runtime.d.ts +55 -2
- package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.js +235 -38
- package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-scope.d.ts +23 -0
- package/dist/domains/comet-native/native-verification-scope.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-scope.js +106 -19
- package/dist/domains/comet-native/native-verification-scope.js.map +1 -1
- package/dist/domains/comet-native/native-verifier-protocol.d.ts +49 -0
- package/dist/domains/comet-native/native-verifier-protocol.d.ts.map +1 -0
- package/dist/domains/comet-native/native-verifier-protocol.js +157 -0
- package/dist/domains/comet-native/native-verifier-protocol.js.map +1 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts +67 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -0
- package/dist/domains/comet-native/native-workspace-finish.js +400 -0
- package/dist/domains/comet-native/native-workspace-finish.js.map +1 -0
- package/dist/domains/comet-native/native-workspace-preparation.d.ts +32 -0
- package/dist/domains/comet-native/native-workspace-preparation.d.ts.map +1 -0
- package/dist/domains/comet-native/native-workspace-preparation.js +324 -0
- package/dist/domains/comet-native/native-workspace-preparation.js.map +1 -0
- package/dist/domains/comet-native/native-workspace.d.ts +48 -4
- package/dist/domains/comet-native/native-workspace.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace.js +306 -16
- package/dist/domains/comet-native/native-workspace.js.map +1 -1
- package/dist/domains/comet-plugin/index.d.ts +4 -0
- package/dist/domains/comet-plugin/index.d.ts.map +1 -0
- package/dist/domains/comet-plugin/index.js +4 -0
- package/dist/domains/comet-plugin/index.js.map +1 -0
- package/dist/domains/comet-plugin/integration.d.ts +73 -0
- package/dist/domains/comet-plugin/integration.d.ts.map +1 -0
- package/dist/domains/comet-plugin/integration.js +385 -0
- package/dist/domains/comet-plugin/integration.js.map +1 -0
- package/dist/domains/comet-plugin/plugin-runtime.d.ts +90 -0
- package/dist/domains/comet-plugin/plugin-runtime.d.ts.map +1 -0
- package/dist/domains/comet-plugin/plugin-runtime.js +611 -0
- package/dist/domains/comet-plugin/plugin-runtime.js.map +1 -0
- package/dist/domains/comet-plugin/types.d.ts +101 -0
- package/dist/domains/comet-plugin/types.d.ts.map +1 -0
- package/dist/domains/comet-plugin/types.js +2 -0
- package/dist/domains/comet-plugin/types.js.map +1 -0
- package/dist/domains/dashboard/collector.d.ts +26 -1
- package/dist/domains/dashboard/collector.d.ts.map +1 -1
- package/dist/domains/dashboard/collector.js +602 -104
- package/dist/domains/dashboard/collector.js.map +1 -1
- package/dist/domains/dashboard/default-plugin-host.d.ts +8 -0
- package/dist/domains/dashboard/default-plugin-host.d.ts.map +1 -0
- package/dist/domains/dashboard/default-plugin-host.js +34 -0
- package/dist/domains/dashboard/default-plugin-host.js.map +1 -0
- package/dist/domains/dashboard/index-reconciler.d.ts +18 -0
- package/dist/domains/dashboard/index-reconciler.d.ts.map +1 -0
- package/dist/domains/dashboard/index-reconciler.js +38 -0
- package/dist/domains/dashboard/index-reconciler.js.map +1 -0
- package/dist/domains/dashboard/index-store.d.ts +75 -0
- package/dist/domains/dashboard/index-store.d.ts.map +1 -0
- package/dist/domains/dashboard/index-store.js +274 -0
- package/dist/domains/dashboard/index-store.js.map +1 -0
- package/dist/domains/dashboard/native-adapter.d.ts +159 -114
- package/dist/domains/dashboard/native-adapter.d.ts.map +1 -1
- package/dist/domains/dashboard/native-adapter.js +165 -268
- package/dist/domains/dashboard/native-adapter.js.map +1 -1
- package/dist/domains/dashboard/native-collector.d.ts +29 -2
- package/dist/domains/dashboard/native-collector.d.ts.map +1 -1
- package/dist/domains/dashboard/native-collector.js +749 -223
- package/dist/domains/dashboard/native-collector.js.map +1 -1
- package/dist/domains/dashboard/native-legacy-adapter.d.ts +37 -0
- package/dist/domains/dashboard/native-legacy-adapter.d.ts.map +1 -0
- package/dist/domains/dashboard/native-legacy-adapter.js +127 -0
- package/dist/domains/dashboard/native-legacy-adapter.js.map +1 -0
- package/dist/domains/dashboard/plugin-host.d.ts +49 -0
- package/dist/domains/dashboard/plugin-host.d.ts.map +1 -0
- package/dist/domains/dashboard/plugin-host.js +168 -0
- package/dist/domains/dashboard/plugin-host.js.map +1 -0
- package/dist/domains/dashboard/project-config-settings.d.ts +39 -0
- package/dist/domains/dashboard/project-config-settings.d.ts.map +1 -0
- package/dist/domains/dashboard/project-config-settings.js +243 -0
- package/dist/domains/dashboard/project-config-settings.js.map +1 -0
- package/dist/domains/dashboard/project-directory.d.ts +20 -0
- package/dist/domains/dashboard/project-directory.d.ts.map +1 -0
- package/dist/domains/dashboard/project-directory.js +92 -0
- package/dist/domains/dashboard/project-directory.js.map +1 -0
- package/dist/domains/dashboard/project-root.d.ts +8 -0
- package/dist/domains/dashboard/project-root.d.ts.map +1 -0
- package/dist/domains/dashboard/project-root.js +68 -0
- package/dist/domains/dashboard/project-root.js.map +1 -0
- package/dist/domains/dashboard/server.d.ts +3 -0
- package/dist/domains/dashboard/server.d.ts.map +1 -1
- package/dist/domains/dashboard/server.js +307 -14
- package/dist/domains/dashboard/server.js.map +1 -1
- package/dist/domains/dashboard/types.d.ts +51 -1
- package/dist/domains/dashboard/types.d.ts.map +1 -1
- package/dist/domains/dashboard/verify-parser.d.ts +1 -0
- package/dist/domains/dashboard/verify-parser.d.ts.map +1 -1
- package/dist/domains/dashboard/verify-parser.js +41 -31
- package/dist/domains/dashboard/verify-parser.js.map +1 -1
- package/dist/domains/dashboard/web/assets/abnfDiagram-N423BO3Z-BkUJc7LK.js +1 -0
- package/dist/domains/dashboard/web/assets/arc-DY4Y9tSO.js +1 -0
- package/dist/domains/dashboard/web/assets/architectureDiagram-T3A2C74G-7wC9YZS-.js +36 -0
- package/dist/domains/dashboard/web/assets/blockDiagram-VBNYF7ZC-Biqe-SaL.js +132 -0
- package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-B3cFnNT7.js → c4Diagram-5PPSVZJV-CccUFD1S.js} +2 -2
- package/dist/domains/dashboard/web/assets/channel-DnRvSkOm.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-fMaIDDI2.js → chunk-2GRJ4B5K-BUL4dDxo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-C9rhF6Hm.js → chunk-2Q5K7J3B-BnKtDH9O.js} +1 -1
- package/dist/domains/dashboard/web/assets/chunk-5RXB4S5H-C9pHQ1n3.js +231 -0
- package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-eYFEZimP.js → chunk-5VM5RSS4-CopXcnFA.js} +1 -1
- package/dist/domains/dashboard/web/assets/chunk-6Q2QTUOP-CxrbngCi.js +88 -0
- package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-D02UjGND.js → chunk-GF5L2VYU-01mzgCUh.js} +5 -5
- package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-vWyemRBr.js → chunk-JWPE2WC7-wTiZVDvw.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-CBNfW-Dr.js → chunk-KBJHAD2P-Bxdv5bl-.js} +1 -1
- package/dist/domains/dashboard/web/assets/chunk-RYQCIY6F-B5vF9l9A.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-H6haOo2C.js → chunk-XXDRQBXY-Dra3NnDp.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-JCYQIIEL-D3E-rgaQ.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-OCEON4UE-D3E-rgaQ.js +1 -0
- package/dist/domains/dashboard/web/assets/cose-bilkent-JH36ORCC-DC96ge-n.js +1 -0
- package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-DN4emAQv.js → cynefin-VYW2F7L2-Tt_NiopT.js} +2 -2
- package/dist/domains/dashboard/web/assets/cynefinDiagram-MW4NZA55-BQ5__1hv.js +62 -0
- package/dist/domains/dashboard/web/assets/dagre-VZM6K2ZE-Cr2zq3ro.js +4 -0
- package/dist/domains/dashboard/web/assets/demo-lxXhgJ9-.js +456 -0
- package/dist/domains/dashboard/web/assets/diagram-7IWD3JNH-BRpYDwPl.js +30 -0
- package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-C7ZvofsM.js → diagram-B4RE2ZJO-D7u-VBxW.js} +3 -3
- package/dist/domains/dashboard/web/assets/diagram-LBJQPF4R-CHYuv2JD.js +24 -0
- package/dist/domains/dashboard/web/assets/diagram-Q27KOJAE-CV3ZE8Q3.js +24 -0
- package/dist/domains/dashboard/web/assets/diagram-UB23O5K3-co_OsTiQ.js +41 -0
- package/dist/domains/dashboard/web/assets/ebnfDiagram-BXEA7PRR-CETcWswS.js +1 -0
- package/dist/domains/dashboard/web/assets/erDiagram-JOGREHBK-edkItb7Z.js +85 -0
- package/dist/domains/dashboard/web/assets/flowDiagram-UKHOOZJN-D_oFJtSf.js +156 -0
- package/dist/domains/dashboard/web/assets/ganttDiagram-PKOTCBZU-CFjLVoA1.js +292 -0
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-DS77QQ5N-BfD0tiKH.js +106 -0
- package/dist/domains/dashboard/web/assets/{graph--OzhPTMs.js → graph-DOmOIIwC.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-BzyqCfMb.css +1 -0
- package/dist/domains/dashboard/web/assets/{index-QO0z6F4w.js → index-CCKHH_A9.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-D8dxsTJY.js +271 -0
- package/dist/domains/dashboard/web/assets/infoDiagram-6WML65LV-Cx6xa9DS.js +2 -0
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-COCMcjBM.js → ishikawaDiagram-WSZJBQD7-BjNLyyv_.js} +5 -5
- package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-DGcpcWny.js → journeyDiagram-NVQOT4AX-D2n9vrhx.js} +2 -2
- package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-QSBNsWMP.js → kanban-definition-27J2QSJJ-kJL7v018.js} +7 -7
- package/dist/domains/dashboard/web/assets/layout-D-LzfAck.js +1 -0
- package/dist/domains/dashboard/web/assets/{linear-9uyeeBZf.js → linear-CeHtd5-l.js} +1 -1
- package/dist/domains/dashboard/web/assets/map-DxJ2ADlA.js +1 -0
- package/dist/domains/dashboard/web/assets/mermaid.core-B0EPSHs2.js +306 -0
- package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CiNxI0gP.js → mindmap-definition-FAOFIHXS-bQQWINF4.js} +2 -2
- package/dist/domains/dashboard/web/assets/pegDiagram-VL7TDLO6-LxLY1W7W.js +1 -0
- package/dist/domains/dashboard/web/assets/pieDiagram-7S7Q4E2Y-BMDQqvuT.js +39 -0
- package/dist/domains/dashboard/web/assets/purify.es-Cz4mVeUR.js +3 -0
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CflW-eFH.js → quadrantDiagram-CIZ2JOQS-XWYjcuZN.js} +3 -3
- package/dist/domains/dashboard/web/assets/railroadDiagram-AXF67PYL-p-OlQTa7.js +1 -0
- package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-B9HLmRWH.js → requirementDiagram-LRYGKXZP-BL4N8Vsl.js} +2 -2
- package/dist/domains/dashboard/web/assets/sankeyDiagram-W5VNT64P-Btu-o6LN.js +40 -0
- package/dist/domains/dashboard/web/assets/sequenceDiagram-SI44F4Z6-9HpdQQ47.js +162 -0
- package/dist/domains/dashboard/web/assets/sizeCapture-X5ZJPWSS-5AnBiBHD.js +1 -0
- package/dist/domains/dashboard/web/assets/stateDiagram-OKZ733FA-Dv8IDsai.js +1 -0
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-UEYNNEHI-DxOMyFOm.js +1 -0
- package/dist/domains/dashboard/web/assets/swimlanes-SLNWSIFB-BfJcN7dK.js +2 -0
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-ULZ7WXOC-BnHRSbDk.js +8 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-g9s-m5Z4.js → timeline-definition-Z64GVDOM-DEOuEHi5.js} +5 -5
- package/dist/domains/dashboard/web/assets/vennDiagram-T6HMQDX7-BqsGpwgo.js +34 -0
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-CJLrWGXc.js → wardleyDiagram-T6FBY63Y-CXlOp9so.js} +4 -4
- package/dist/domains/dashboard/web/assets/xychartDiagram-ELKLHX3M-DyqqtC9X.js +7 -0
- package/dist/domains/dashboard/web/index.html +2 -2
- package/dist/domains/dashboard/workspace.d.ts +28 -0
- package/dist/domains/dashboard/workspace.d.ts.map +1 -0
- package/dist/domains/dashboard/workspace.js +134 -0
- package/dist/domains/dashboard/workspace.js.map +1 -0
- package/dist/domains/engine/protected-run-file.d.ts +15 -0
- package/dist/domains/engine/protected-run-file.d.ts.map +1 -0
- package/dist/domains/engine/protected-run-file.js +76 -0
- package/dist/domains/engine/protected-run-file.js.map +1 -0
- package/dist/domains/engine/run-store.d.ts +12 -11
- package/dist/domains/engine/run-store.d.ts.map +1 -1
- package/dist/domains/engine/run-store.js +46 -65
- package/dist/domains/engine/run-store.js.map +1 -1
- package/dist/domains/engine/state.d.ts +4 -3
- package/dist/domains/engine/state.d.ts.map +1 -1
- package/dist/domains/engine/state.js +10 -21
- package/dist/domains/engine/state.js.map +1 -1
- package/dist/domains/eval/agent-learning-eval.d.ts +32 -0
- package/dist/domains/eval/agent-learning-eval.d.ts.map +1 -0
- package/dist/domains/eval/agent-learning-eval.js +338 -0
- package/dist/domains/eval/agent-learning-eval.js.map +1 -0
- package/dist/domains/eval/index.d.ts +6 -0
- package/dist/domains/eval/index.d.ts.map +1 -1
- package/dist/domains/eval/index.js +6 -0
- package/dist/domains/eval/index.js.map +1 -1
- package/dist/domains/eval/semantic-memory-eval-config.d.ts +20 -0
- package/dist/domains/eval/semantic-memory-eval-config.d.ts.map +1 -0
- package/dist/domains/eval/semantic-memory-eval-config.js +26 -0
- package/dist/domains/eval/semantic-memory-eval-config.js.map +1 -0
- package/dist/domains/eval/semantic-memory-eval.d.ts +218 -0
- package/dist/domains/eval/semantic-memory-eval.d.ts.map +1 -0
- package/dist/domains/eval/semantic-memory-eval.js +1451 -0
- package/dist/domains/eval/semantic-memory-eval.js.map +1 -0
- package/dist/domains/eval/semantic-memory-judge.d.ts +34 -0
- package/dist/domains/eval/semantic-memory-judge.d.ts.map +1 -0
- package/dist/domains/eval/semantic-memory-judge.js +51 -0
- package/dist/domains/eval/semantic-memory-judge.js.map +1 -0
- package/dist/domains/eval/standalone-context.d.ts +19 -0
- package/dist/domains/eval/standalone-context.d.ts.map +1 -0
- package/dist/domains/eval/standalone-context.js +107 -0
- package/dist/domains/eval/standalone-context.js.map +1 -0
- package/dist/domains/eval/standalone-static-collect.d.ts +22 -0
- package/dist/domains/eval/standalone-static-collect.d.ts.map +1 -0
- package/dist/domains/eval/standalone-static-collect.js +779 -0
- package/dist/domains/eval/standalone-static-collect.js.map +1 -0
- package/dist/domains/eval/user-environment.d.ts +6 -0
- package/dist/domains/eval/user-environment.d.ts.map +1 -0
- package/dist/domains/eval/user-environment.js +73 -0
- package/dist/domains/eval/user-environment.js.map +1 -0
- package/dist/domains/factory/package.d.ts.map +1 -1
- package/dist/domains/factory/package.js +522 -82
- package/dist/domains/factory/package.js.map +1 -1
- package/dist/domains/integrations/codegraph.d.ts +35 -2
- package/dist/domains/integrations/codegraph.d.ts.map +1 -1
- package/dist/domains/integrations/codegraph.js +466 -12
- package/dist/domains/integrations/codegraph.js.map +1 -1
- package/dist/domains/integrations/openspec.d.ts +22 -4
- package/dist/domains/integrations/openspec.d.ts.map +1 -1
- package/dist/domains/integrations/openspec.js +304 -51
- package/dist/domains/integrations/openspec.js.map +1 -1
- package/dist/domains/integrations/superpowers.d.ts +23 -1
- package/dist/domains/integrations/superpowers.d.ts.map +1 -1
- package/dist/domains/integrations/superpowers.js +196 -10
- package/dist/domains/integrations/superpowers.js.map +1 -1
- package/dist/domains/project-knowledge/corpus.d.ts +4 -0
- package/dist/domains/project-knowledge/corpus.d.ts.map +1 -0
- package/dist/domains/project-knowledge/corpus.js +332 -0
- package/dist/domains/project-knowledge/corpus.js.map +1 -0
- package/dist/domains/project-knowledge/dashboard.d.ts +3 -0
- package/dist/domains/project-knowledge/dashboard.d.ts.map +1 -0
- package/dist/domains/project-knowledge/dashboard.js +73 -0
- package/dist/domains/project-knowledge/dashboard.js.map +1 -0
- package/dist/domains/project-knowledge/deterministic-extractors.d.ts +10 -0
- package/dist/domains/project-knowledge/deterministic-extractors.d.ts.map +1 -0
- package/dist/domains/project-knowledge/deterministic-extractors.js +397 -0
- package/dist/domains/project-knowledge/deterministic-extractors.js.map +1 -0
- package/dist/domains/project-knowledge/index-store.d.ts +68 -0
- package/dist/domains/project-knowledge/index-store.d.ts.map +1 -0
- package/dist/domains/project-knowledge/index-store.js +573 -0
- package/dist/domains/project-knowledge/index-store.js.map +1 -0
- package/dist/domains/project-knowledge/index.d.ts +14 -0
- package/dist/domains/project-knowledge/index.d.ts.map +1 -0
- package/dist/domains/project-knowledge/index.js +14 -0
- package/dist/domains/project-knowledge/index.js.map +1 -0
- package/dist/domains/project-knowledge/learning.d.ts +94 -0
- package/dist/domains/project-knowledge/learning.d.ts.map +1 -0
- package/dist/domains/project-knowledge/learning.js +639 -0
- package/dist/domains/project-knowledge/learning.js.map +1 -0
- package/dist/domains/project-knowledge/local-provider.d.ts +32 -0
- package/dist/domains/project-knowledge/local-provider.d.ts.map +1 -0
- package/dist/domains/project-knowledge/local-provider.js +638 -0
- package/dist/domains/project-knowledge/local-provider.js.map +1 -0
- package/dist/domains/project-knowledge/local-store.d.ts +49 -0
- package/dist/domains/project-knowledge/local-store.d.ts.map +1 -0
- package/dist/domains/project-knowledge/local-store.js +816 -0
- package/dist/domains/project-knowledge/local-store.js.map +1 -0
- package/dist/domains/project-knowledge/plugin.d.ts +8 -0
- package/dist/domains/project-knowledge/plugin.d.ts.map +1 -0
- package/dist/domains/project-knowledge/plugin.js +822 -0
- package/dist/domains/project-knowledge/plugin.js.map +1 -0
- package/dist/domains/project-knowledge/query.d.ts +15 -0
- package/dist/domains/project-knowledge/query.d.ts.map +1 -0
- package/dist/domains/project-knowledge/query.js +154 -0
- package/dist/domains/project-knowledge/query.js.map +1 -0
- package/dist/domains/project-knowledge/records.d.ts +67 -0
- package/dist/domains/project-knowledge/records.d.ts.map +1 -0
- package/dist/domains/project-knowledge/records.js +291 -0
- package/dist/domains/project-knowledge/records.js.map +1 -0
- package/dist/domains/project-knowledge/remote-provider.d.ts +28 -0
- package/dist/domains/project-knowledge/remote-provider.d.ts.map +1 -0
- package/dist/domains/project-knowledge/remote-provider.js +671 -0
- package/dist/domains/project-knowledge/remote-provider.js.map +1 -0
- package/dist/domains/project-knowledge/renderer.d.ts +5 -0
- package/dist/domains/project-knowledge/renderer.d.ts.map +1 -0
- package/dist/domains/project-knowledge/renderer.js +88 -0
- package/dist/domains/project-knowledge/renderer.js.map +1 -0
- package/dist/domains/project-knowledge/source-validity.d.ts +3 -0
- package/dist/domains/project-knowledge/source-validity.d.ts.map +1 -0
- package/dist/domains/project-knowledge/source-validity.js +32 -0
- package/dist/domains/project-knowledge/source-validity.js.map +1 -0
- package/dist/domains/project-knowledge/sqlite.d.ts +4 -0
- package/dist/domains/project-knowledge/sqlite.d.ts.map +1 -0
- package/dist/domains/project-knowledge/sqlite.js +27 -0
- package/dist/domains/project-knowledge/sqlite.js.map +1 -0
- package/dist/domains/project-knowledge/types.d.ts +282 -0
- package/dist/domains/project-knowledge/types.d.ts.map +1 -0
- package/dist/domains/project-knowledge/types.js +2 -0
- package/dist/domains/project-knowledge/types.js.map +1 -0
- package/dist/domains/skill/dsh-adapter.d.ts +31 -0
- package/dist/domains/skill/dsh-adapter.d.ts.map +1 -0
- package/dist/domains/skill/dsh-adapter.js +257 -0
- package/dist/domains/skill/dsh-adapter.js.map +1 -0
- package/dist/domains/skill/hook-lifecycle.d.ts +9 -0
- package/dist/domains/skill/hook-lifecycle.d.ts.map +1 -0
- package/dist/domains/skill/hook-lifecycle.js +51 -0
- package/dist/domains/skill/hook-lifecycle.js.map +1 -0
- package/dist/domains/skill/languages.d.ts +2 -1
- package/dist/domains/skill/languages.d.ts.map +1 -1
- package/dist/domains/skill/languages.js +4 -1
- package/dist/domains/skill/languages.js.map +1 -1
- package/dist/domains/skill/platform-inspect.d.ts +4 -0
- package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.js +272 -40
- package/dist/domains/skill/platform-inspect.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts +45 -5
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +583 -117
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/skill/project-hook-projection.d.ts +14 -0
- package/dist/domains/skill/project-hook-projection.d.ts.map +1 -0
- package/dist/domains/skill/project-hook-projection.js +41 -0
- package/dist/domains/skill/project-hook-projection.js.map +1 -0
- package/dist/domains/skill/project-instructions.d.ts +3 -0
- package/dist/domains/skill/project-instructions.d.ts.map +1 -1
- package/dist/domains/skill/project-instructions.js +19 -3
- package/dist/domains/skill/project-instructions.js.map +1 -1
- package/dist/domains/skill/uninstall.d.ts +16 -3
- package/dist/domains/skill/uninstall.d.ts.map +1 -1
- package/dist/domains/skill/uninstall.js +951 -65
- package/dist/domains/skill/uninstall.js.map +1 -1
- package/dist/domains/workflow-contract/builtins.d.ts.map +1 -1
- package/dist/domains/workflow-contract/builtins.js +12 -6
- package/dist/domains/workflow-contract/builtins.js.map +1 -1
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts +24 -0
- package/dist/domains/workflow-contract/contained-atomic-write.d.ts.map +1 -0
- package/dist/domains/workflow-contract/contained-atomic-write.js +256 -0
- package/dist/domains/workflow-contract/contained-atomic-write.js.map +1 -0
- package/dist/domains/workflow-contract/global-config.d.ts +10 -0
- package/dist/domains/workflow-contract/global-config.d.ts.map +1 -0
- package/dist/domains/workflow-contract/global-config.js +117 -0
- package/dist/domains/workflow-contract/global-config.js.map +1 -0
- package/dist/domains/workflow-contract/hook-target-scope.d.ts +6 -0
- package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -0
- package/dist/domains/workflow-contract/hook-target-scope.js +51 -0
- package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -0
- package/dist/domains/workflow-contract/hook-write-policy.d.ts +9 -0
- package/dist/domains/workflow-contract/hook-write-policy.d.ts.map +1 -0
- package/dist/domains/workflow-contract/hook-write-policy.js +52 -0
- package/dist/domains/workflow-contract/hook-write-policy.js.map +1 -0
- package/dist/domains/workflow-contract/index.d.ts +13 -1
- package/dist/domains/workflow-contract/index.d.ts.map +1 -1
- package/dist/domains/workflow-contract/index.js +9 -1
- package/dist/domains/workflow-contract/index.js.map +1 -1
- package/dist/domains/workflow-contract/normalize.d.ts.map +1 -1
- package/dist/domains/workflow-contract/normalize.js +2 -1
- package/dist/domains/workflow-contract/normalize.js.map +1 -1
- package/dist/domains/workflow-contract/output-envelope.d.ts +59 -0
- package/dist/domains/workflow-contract/output-envelope.d.ts.map +1 -0
- package/dist/domains/workflow-contract/output-envelope.js +108 -0
- package/dist/domains/workflow-contract/output-envelope.js.map +1 -0
- package/dist/domains/workflow-contract/project-config-reader.d.ts +26 -0
- package/dist/domains/workflow-contract/project-config-reader.d.ts.map +1 -0
- package/dist/domains/workflow-contract/project-config-reader.js +54 -0
- package/dist/domains/workflow-contract/project-config-reader.js.map +1 -0
- package/dist/domains/workflow-contract/project-config-transaction.d.ts +20 -0
- package/dist/domains/workflow-contract/project-config-transaction.d.ts.map +1 -0
- package/dist/domains/workflow-contract/project-config-transaction.js +293 -0
- package/dist/domains/workflow-contract/project-config-transaction.js.map +1 -0
- package/dist/domains/workflow-contract/project-config-writer.d.ts +13 -0
- package/dist/domains/workflow-contract/project-config-writer.d.ts.map +1 -0
- package/dist/domains/workflow-contract/project-config-writer.js +143 -0
- package/dist/domains/workflow-contract/project-config-writer.js.map +1 -0
- package/dist/domains/workflow-contract/project-config.d.ts +37 -2
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +2119 -29
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/dist/domains/workflow-contract/project-gitignore.d.ts +9 -0
- package/dist/domains/workflow-contract/project-gitignore.d.ts.map +1 -0
- package/dist/domains/workflow-contract/project-gitignore.js +108 -0
- package/dist/domains/workflow-contract/project-gitignore.js.map +1 -0
- package/dist/domains/workflow-contract/protected-project-path.d.ts +47 -0
- package/dist/domains/workflow-contract/protected-project-path.d.ts.map +1 -0
- package/dist/domains/workflow-contract/protected-project-path.js +245 -0
- package/dist/domains/workflow-contract/protected-project-path.js.map +1 -0
- package/dist/domains/workflow-contract/types.d.ts +104 -2
- package/dist/domains/workflow-contract/types.d.ts.map +1 -1
- package/dist/platform/fs/plugin-store.d.ts +31 -0
- package/dist/platform/fs/plugin-store.d.ts.map +1 -0
- package/dist/platform/fs/plugin-store.js +171 -0
- package/dist/platform/fs/plugin-store.js.map +1 -0
- package/dist/platform/fs/strip-bom.d.ts +10 -0
- package/dist/platform/fs/strip-bom.d.ts.map +1 -0
- package/dist/platform/fs/strip-bom.js +12 -0
- package/dist/platform/fs/strip-bom.js.map +1 -0
- package/dist/platform/fs/trusted-readonly-file.d.ts +31 -0
- package/dist/platform/fs/trusted-readonly-file.d.ts.map +1 -0
- package/dist/platform/fs/trusted-readonly-file.js +107 -0
- package/dist/platform/fs/trusted-readonly-file.js.map +1 -0
- package/dist/platform/http/bounded-request.d.ts +18 -0
- package/dist/platform/http/bounded-request.d.ts.map +1 -0
- package/dist/platform/http/bounded-request.js +69 -0
- package/dist/platform/http/bounded-request.js.map +1 -0
- package/dist/platform/install/detect.d.ts +1 -0
- package/dist/platform/install/detect.d.ts.map +1 -1
- package/dist/platform/install/detect.js +2 -0
- package/dist/platform/install/detect.js.map +1 -1
- package/dist/platform/install/platform-targets.d.ts +8 -0
- package/dist/platform/install/platform-targets.d.ts.map +1 -0
- package/dist/platform/install/platform-targets.js +35 -0
- package/dist/platform/install/platform-targets.js.map +1 -0
- package/dist/platform/install/platforms.d.ts +22 -3
- package/dist/platform/install/platforms.d.ts.map +1 -1
- package/dist/platform/install/platforms.js +101 -1
- package/dist/platform/install/platforms.js.map +1 -1
- package/dist/platform/paths/git-worktree.d.ts +20 -0
- package/dist/platform/paths/git-worktree.d.ts.map +1 -0
- package/dist/platform/paths/git-worktree.js +110 -0
- package/dist/platform/paths/git-worktree.js.map +1 -0
- package/dist/platform/paths/portable-path.d.ts +6 -0
- package/dist/platform/paths/portable-path.d.ts.map +1 -0
- package/dist/platform/paths/portable-path.js +15 -0
- package/dist/platform/paths/portable-path.js.map +1 -0
- package/dist/platform/paths/project-identity.d.ts +13 -0
- package/dist/platform/paths/project-identity.d.ts.map +1 -0
- package/dist/platform/paths/project-identity.js +81 -0
- package/dist/platform/paths/project-identity.js.map +1 -0
- package/dist/platform/paths/project-knowledge-storage.d.ts +8 -0
- package/dist/platform/paths/project-knowledge-storage.d.ts.map +1 -0
- package/dist/platform/paths/project-knowledge-storage.js +23 -0
- package/dist/platform/paths/project-knowledge-storage.js.map +1 -0
- package/dist/platform/process/external-command.d.ts +15 -0
- package/dist/platform/process/external-command.d.ts.map +1 -0
- package/dist/platform/process/external-command.js +57 -0
- package/dist/platform/process/external-command.js.map +1 -0
- package/dist/platform/process/git.d.ts +12 -0
- package/dist/platform/process/git.d.ts.map +1 -0
- package/dist/platform/process/git.js +86 -0
- package/dist/platform/process/git.js.map +1 -0
- package/dist/platform/process/hook-read-cache.d.ts +45 -0
- package/dist/platform/process/hook-read-cache.d.ts.map +1 -0
- package/dist/platform/process/hook-read-cache.js +102 -0
- package/dist/platform/process/hook-read-cache.js.map +1 -0
- package/dist/platform/process/ripgrep.d.ts +24 -0
- package/dist/platform/process/ripgrep.d.ts.map +1 -0
- package/dist/platform/process/ripgrep.js +140 -0
- package/dist/platform/process/ripgrep.js.map +1 -0
- package/dist/platform/process/spawn-command.d.ts +10 -0
- package/dist/platform/process/spawn-command.d.ts.map +1 -0
- package/dist/platform/process/spawn-command.js +113 -0
- package/dist/platform/process/spawn-command.js.map +1 -0
- package/dist/platform/process/terminate-process-tree.d.ts +3 -0
- package/dist/platform/process/terminate-process-tree.d.ts.map +1 -0
- package/dist/platform/process/terminate-process-tree.js +65 -0
- package/dist/platform/process/terminate-process-tree.js.map +1 -0
- package/dist/platform/version/version.d.ts +8 -0
- package/dist/platform/version/version.d.ts.map +1 -1
- package/dist/platform/version/version.js +67 -10
- package/dist/platform/version/version.js.map +1 -1
- package/eval/.env.example +115 -0
- package/eval/README.md +237 -14
- package/eval/langfuse/.env.example +9 -0
- package/eval/langfuse/tests/conftest.py +146 -0
- package/eval/langfuse/tests/tasks/test_tasks.py +109 -0
- package/eval/langfuse/tests/test_adapter.py +272 -0
- package/eval/langsmith/.env.example +16 -0
- package/eval/langsmith/tests/conftest.py +10 -1
- package/eval/local/tasks/authoring-skill-smoke/environment/Dockerfile +12 -0
- package/eval/local/tasks/comet-agent-memory-routing/environment/Dockerfile +2 -4
- package/eval/local/tasks/comet-api-cache-ttl/environment/Dockerfile +2 -6
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/.include-current-comet-cli +1 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/Dockerfile +45 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +23 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet.sh +14 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/test_wordcount.py +29 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/wordcount.py +40 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/instruction.md +18 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/task.toml +23 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/validation/test_classic_layout_lifecycle.py +604 -0
- package/eval/local/tasks/comet-cross-file-refactor/environment/Dockerfile +1 -1
- package/eval/local/tasks/comet-dependency-confusion/environment/Dockerfile +1 -4
- package/eval/local/tasks/comet-fix-median/environment/Dockerfile +2 -6
- package/eval/local/tasks/comet-framework-selection/environment/Dockerfile +1 -4
- package/eval/local/tasks/comet-full-workflow/environment/Dockerfile +2 -6
- package/eval/local/tasks/comet-graph-execution-review/environment/Dockerfile +1 -4
- package/eval/local/tasks/comet-human-approval-flow/environment/Dockerfile +1 -1
- package/eval/local/tasks/comet-layered-streaming-fix/environment/Dockerfile +1 -4
- package/eval/local/tasks/comet-native-clarification/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-clarification/validation/test_native_clarification.py +9 -21
- package/eval/local/tasks/comet-native-clarification-depth/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-clarification-depth/validation/test_native_clarification_depth.py +4 -7
- package/eval/local/tasks/comet-native-clarification-modes/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-clarification-modes/validation/test_native_clarification_modes.py +4 -10
- package/eval/local/tasks/comet-native-interrupted-transition/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-interrupted-transition/instruction.md +1 -1
- package/eval/local/tasks/comet-native-interrupted-transition/validation/test_native_interrupted_transition.py +15 -16
- package/eval/local/tasks/comet-native-repository-fact/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-repository-fact/instruction.md +2 -2
- package/eval/local/tasks/comet-native-repository-fact/validation/test_native_repository_fact.py +8 -2
- package/eval/local/tasks/comet-native-wave-b-decision-resume/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-wave-b-decision-resume/instruction.md +8 -4
- package/eval/local/tasks/comet-native-wave-b-decision-resume/task.toml +6 -6
- package/eval/local/tasks/comet-native-wave-b-decision-resume/validation/test_native_wave_b_decision_resume.py +126 -135
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/instruction.md +6 -6
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/task.toml +8 -8
- package/eval/local/tasks/comet-native-wave-c-verification-integrity/validation/test_native_wave_c_verification_integrity.py +97 -317
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/instruction.md +9 -7
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/task.toml +5 -4
- package/eval/local/tasks/comet-native-wave-d-stagnation-stop/validation/test_native_wave_d_stagnation_stop.py +174 -206
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/instruction.md +5 -5
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/task.toml +8 -8
- package/eval/local/tasks/comet-native-wave-e-parallel-safety/validation/test_native_wave_e_parallel_safety.py +135 -239
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/Dockerfile +1 -3
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +8 -3
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/instruction.md +3 -3
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/task.toml +6 -6
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/validation/test_native_wave_f_dashboard_readonly.py +81 -425
- package/eval/local/tasks/comet-native-workflow/environment/.include-trusted-native-runtime +1 -0
- package/eval/local/tasks/comet-native-workflow/environment/Dockerfile +3 -4
- package/eval/local/tasks/comet-native-workflow/instruction.md +13 -3
- package/eval/local/tasks/comet-native-workflow/task.toml +4 -2
- package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +150 -49
- package/eval/local/tasks/comet-noise-distractor/environment/Dockerfile +1 -1
- package/eval/local/tasks/comet-observability-env-template/environment/Dockerfile +1 -1
- package/eval/local/tasks/comet-perf-dedupe/environment/Dockerfile +2 -6
- package/eval/local/tasks/comet-persistence-threading/environment/Dockerfile +1 -1
- package/eval/local/tasks/comet-refactor-counter/environment/Dockerfile +2 -6
- package/eval/local/tasks/comet-robust-config/environment/Dockerfile +2 -6
- package/eval/local/tasks/generic-skill-smoke/environment/Dockerfile +12 -0
- package/eval/local/tasks/generic-skill-smoke/validation/test_generic_skill_smoke.py +6 -1
- package/eval/local/tasks/index.yaml +12 -5
- package/eval/local/tasks/workflow-overlay-contract/environment/Dockerfile +11 -0
- package/eval/local/tasks/workflow-route-conformance/environment/Dockerfile +12 -0
- package/eval/local/tests/conftest.py +759 -72
- package/eval/local/tests/scaffold/fixtures/custom-agent/adapter.yaml +19 -0
- package/eval/local/tests/scaffold/test_agents.py +76 -0
- package/eval/local/tests/scaffold/test_aligned_comparison.py +70 -0
- package/eval/local/tests/scaffold/test_auto_tasks.py +350 -0
- package/eval/local/tests/scaffold/test_conftest_helpers.py +385 -0
- package/eval/local/tests/scaffold/test_custom_agents.py +174 -0
- package/eval/local/tests/scaffold/test_eval_context.py +217 -0
- package/eval/local/tests/scaffold/test_execution.py +364 -0
- package/eval/local/tests/scaffold/test_inline_tasks.py +56 -0
- package/eval/local/tests/scaffold/test_langfuse_trajectory.py +263 -0
- package/eval/local/tests/scaffold/test_langsmith_conftest.py +63 -0
- package/eval/local/tests/scaffold/test_logging.py +231 -0
- package/eval/local/tests/scaffold/test_manifest_tasks.py +76 -0
- package/eval/local/tests/scaffold/test_manifests.py +396 -0
- package/eval/local/tests/scaffold/test_native_aligned_eval.py +170 -35
- package/eval/local/tests/scaffold/test_native_wave_evaluations.py +75 -1848
- package/eval/local/tests/scaffold/test_profiles.py +317 -9
- package/eval/local/tests/scaffold/test_task_resolution.py +212 -0
- package/eval/local/tests/scaffold/test_tasks.py +73 -53
- package/eval/local/tests/scaffold/test_treatments.py +64 -1
- package/eval/local/tests/scaffold/test_utils.py +587 -4
- package/eval/local/tests/tasks/test_tasks.py +221 -18
- package/eval/local/tests/tasks/test_validation_scripts.py +608 -1
- package/eval/local/treatments/comet/comet_classic_docs_layout.yaml +121 -0
- package/eval/local/treatments/comet/comet_native_phase1.yaml +7 -4
- package/eval/pyproject.toml +9 -4
- package/eval/scaffold/__init__.py +6 -0
- package/eval/scaffold/docker/agent-overlay.Dockerfile +41 -0
- package/eval/scaffold/python/__init__.py +128 -20
- package/eval/scaffold/python/agents.py +239 -0
- package/eval/scaffold/python/aligned_comparison.py +156 -27
- package/eval/scaffold/python/auto_tasks.py +700 -0
- package/eval/scaffold/python/custom_agents.py +172 -0
- package/eval/scaffold/python/eval_context.py +236 -0
- package/eval/scaffold/python/eval_schema.py +135 -0
- package/eval/scaffold/python/execution.py +544 -0
- package/eval/scaffold/python/generated_task_cache.py +230 -0
- package/eval/scaffold/python/generic_llm_judge.py +41 -14
- package/eval/scaffold/python/inline_tasks.py +118 -0
- package/eval/scaffold/python/judge_config.py +158 -37
- package/eval/scaffold/python/langfuse_adapter.py +1023 -0
- package/eval/scaffold/python/llm_judge.py +68 -11
- package/eval/scaffold/python/logging.py +160 -17
- package/eval/scaffold/python/manifest_tasks.py +69 -0
- package/eval/scaffold/python/manifests.py +443 -22
- package/eval/scaffold/python/native_eval.py +16 -6
- package/eval/scaffold/python/paths.py +11 -1
- package/eval/scaffold/python/task_resolution.py +176 -0
- package/eval/scaffold/python/tasks.py +17 -4
- package/eval/scaffold/python/utils.py +193 -31
- package/eval/scaffold/python/validation/authoring_rubric.py +6 -4
- package/eval/scaffold/python/validation/comet_workflow.py +46 -11
- package/eval/scaffold/python/validation/core.py +48 -2
- package/eval/scaffold/python/validation/generic_rubric.py +44 -5
- package/eval/scaffold/python/validation/native_v4.py +249 -0
- package/eval/scaffold/python/validation/native_wave.py +4 -5
- package/eval/scaffold/python/validation/native_workflow.py +199 -98
- package/eval/scaffold/python/validation/rubric.py +242 -72
- package/eval/scaffold/shell/agent-runtime-config.sh +88 -0
- package/eval/scaffold/shell/docker.sh +539 -33
- package/eval/scaffold/shell/run-agent-runtime.sh +49 -0
- package/eval/scaffold/shell/run-claude-loop.sh +153 -14
- package/eval/schemas/comet.eval/v1alpha1.schema.json +244 -0
- package/package.json +43 -34
- package/assets/skills/comet/reference/scripts.md +0 -101
- package/assets/skills-zh/comet/reference/scripts.md +0 -101
- package/dist/domains/dashboard/web/assets/_commonjsHelpers-CqkleIqs.js +0 -1
- package/dist/domains/dashboard/web/assets/arc-CxdiLJ50.js +0 -1
- package/dist/domains/dashboard/web/assets/architectureDiagram-3BPJPVTR-D5YCQu4e.js +0 -36
- package/dist/domains/dashboard/web/assets/blockDiagram-GPEHLZMM-8NfdCOQ8.js +0 -132
- package/dist/domains/dashboard/web/assets/channel-B6AFly29.js +0 -1
- package/dist/domains/dashboard/web/assets/chunk-AQP2D5EJ-wKsbOw_T.js +0 -231
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BcnrxOTt.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BcnrxOTt.js +0 -1
- package/dist/domains/dashboard/web/assets/cose-bilkent-S5V4N54A-CbaShPub.js +0 -1
- package/dist/domains/dashboard/web/assets/dagre-BM42HDAG-BpSzbk_V.js +0 -4
- package/dist/domains/dashboard/web/assets/demo-BuVau32v.js +0 -25
- package/dist/domains/dashboard/web/assets/diagram-2AECGRRQ-CfXwGGpQ.js +0 -43
- package/dist/domains/dashboard/web/assets/diagram-5GNKFQAL-DMp0Zmot.js +0 -10
- package/dist/domains/dashboard/web/assets/diagram-LMA3HP47-BjmxFnap.js +0 -24
- package/dist/domains/dashboard/web/assets/diagram-OG6HWLK6-DFBG1Iqy.js +0 -24
- package/dist/domains/dashboard/web/assets/erDiagram-TEJ5UH35-MpNT7dzt.js +0 -85
- package/dist/domains/dashboard/web/assets/flowDiagram-I6XJVG4X-_1wAR6c1.js +0 -162
- package/dist/domains/dashboard/web/assets/ganttDiagram-6RSMTGT7-DJKjDeWl.js +0 -292
- package/dist/domains/dashboard/web/assets/gitGraphDiagram-PVQCEYII-BL7yUEn-.js +0 -106
- package/dist/domains/dashboard/web/assets/index-CjE9mHGb.js +0 -24
- package/dist/domains/dashboard/web/assets/index-D-AGxvI4.css +0 -1
- package/dist/domains/dashboard/web/assets/infoDiagram-5YYISTIA-Bt5fqrOd.js +0 -2
- package/dist/domains/dashboard/web/assets/layout-SsrduOYp.js +0 -1
- package/dist/domains/dashboard/web/assets/mermaid.core-CkNdB471.js +0 -301
- package/dist/domains/dashboard/web/assets/pieDiagram-4H26LBE5-BLJ6QnRO.js +0 -30
- package/dist/domains/dashboard/web/assets/purify.es-VaSPOPhr.js +0 -3
- package/dist/domains/dashboard/web/assets/sankeyDiagram-5OEKKPKP-6xnco5k5.js +0 -40
- package/dist/domains/dashboard/web/assets/sequenceDiagram-3UESZ5HK-Dp1rujNZ.js +0 -162
- package/dist/domains/dashboard/web/assets/stateDiagram-AJRCARHV-C1Xc90ek.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-p-qmzXyE.js +0 -1
- package/dist/domains/dashboard/web/assets/vennDiagram-CIIHVFJN-rkEyhyCc.js +0 -34
- package/dist/domains/dashboard/web/assets/xychartDiagram-2RQKCTM6-BxJvPNqo.js +0 -7
- package/eval/local/tasks/comet-native-interrupted-transition/environment/.comet/config.yaml +0 -6
|
@@ -0,0 +1,2142 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { isMemoryClass } from './types.js';
|
|
3
|
+
import { hashMemoryText, memoryFilePath } from './repository.js';
|
|
4
|
+
import { validateMemoryLanguageText, validateMemoryReviewActions, validateMemoryReviewPacket, validateSafeMemoryText, } from './review-contract.js';
|
|
5
|
+
const DEFAULT_MAX_ENTRIES = 12;
|
|
6
|
+
const DEFAULT_MAX_BYTES = 8 * 1024;
|
|
7
|
+
const DEFAULT_PROFILE_MAX_CHARS = 2000;
|
|
8
|
+
const DEFAULT_TASK_MAX_CHARS = 6000;
|
|
9
|
+
const DEFAULT_MANAGEMENT_MAX_ENTRIES = 100;
|
|
10
|
+
const DEFAULT_MANAGEMENT_MAX_BYTES = 32 * 1024;
|
|
11
|
+
const MAX_SOURCES = 8;
|
|
12
|
+
export class PersonalMemoryService {
|
|
13
|
+
repository;
|
|
14
|
+
now;
|
|
15
|
+
maxEntries;
|
|
16
|
+
maxBytes;
|
|
17
|
+
profileMaxChars;
|
|
18
|
+
taskMaxChars;
|
|
19
|
+
language;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.repository = options.repository;
|
|
22
|
+
this.now = options.now ?? (() => new Date());
|
|
23
|
+
this.maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
24
|
+
this.maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
25
|
+
this.profileMaxChars = options.profileMaxChars ?? DEFAULT_PROFILE_MAX_CHARS;
|
|
26
|
+
this.taskMaxChars = options.taskMaxChars ?? DEFAULT_TASK_MAX_CHARS;
|
|
27
|
+
this.language = options.language ?? 'zh-CN';
|
|
28
|
+
}
|
|
29
|
+
async get(id) {
|
|
30
|
+
return this.repository.withLock(async () => {
|
|
31
|
+
const state = await this.loadAndReconcile();
|
|
32
|
+
await this.persist(state);
|
|
33
|
+
const record = state.records.find((entry) => entry.id === id);
|
|
34
|
+
return record === undefined ? null : cloneRecord(record);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async remember(input) {
|
|
38
|
+
validateInput(input);
|
|
39
|
+
const source = input.source ?? { kind: 'user' };
|
|
40
|
+
return this.repository.withLock(async () => {
|
|
41
|
+
const state = await this.loadAndReconcile(input.scope, input.projectKey);
|
|
42
|
+
const normalizedInput = {
|
|
43
|
+
...input,
|
|
44
|
+
memoryType: input.memoryType ?? inferPersonalMemoryType(input, 'explicit'),
|
|
45
|
+
};
|
|
46
|
+
const identity = memoryIdentity(normalizedInput);
|
|
47
|
+
const normalized = normalizeText(input.text);
|
|
48
|
+
const existing = state.records.find((entry) => entry.state !== 'superseded' &&
|
|
49
|
+
entry.identity === identity &&
|
|
50
|
+
normalizeText(entry.text) === normalized);
|
|
51
|
+
if (existing !== undefined) {
|
|
52
|
+
const refreshed = {
|
|
53
|
+
...addSource(existing, source, this.timestamp()),
|
|
54
|
+
kind: 'explicit',
|
|
55
|
+
authority: 'explicit',
|
|
56
|
+
memoryType: normalizedInput.memoryType,
|
|
57
|
+
...(normalizedInput.memoryType === 'personal-episode'
|
|
58
|
+
? { episode: normalizePersonalEpisode(normalizedInput.episode, normalizedInput) }
|
|
59
|
+
: { episode: undefined }),
|
|
60
|
+
state: 'proven',
|
|
61
|
+
source,
|
|
62
|
+
};
|
|
63
|
+
state.records = replaceRecord(state.records, refreshed);
|
|
64
|
+
clearInferredCandidates(state, identity);
|
|
65
|
+
clearTombstone(state, identity);
|
|
66
|
+
await this.persist(state);
|
|
67
|
+
return cloneRecord(refreshed);
|
|
68
|
+
}
|
|
69
|
+
const record = createRecord(normalizedInput, 'explicit', source, this.timestamp(), identity);
|
|
70
|
+
clearInferredCandidates(state, identity);
|
|
71
|
+
clearTombstone(state, identity);
|
|
72
|
+
state.records = replaceRecord(state.records, record);
|
|
73
|
+
await this.writeRecordMarkdown(state, record);
|
|
74
|
+
return cloneRecord(record);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async correct(id, correction, options = {}) {
|
|
78
|
+
validateCorrection(correction);
|
|
79
|
+
return this.repository.withLock(async () => {
|
|
80
|
+
const state = await this.loadAndReconcile();
|
|
81
|
+
const current = state.records.find((entry) => entry.id === id);
|
|
82
|
+
const userRemoved = current !== undefined &&
|
|
83
|
+
state.tombstones.some((entry) => entry.identity === current.identity && entry.reason === 'user-remove');
|
|
84
|
+
if (current === undefined || (current.state === 'superseded' && !userRemoved)) {
|
|
85
|
+
throw new Error(`Memory is not available: ${id}`);
|
|
86
|
+
}
|
|
87
|
+
if (options.idempotencyKey !== undefined &&
|
|
88
|
+
state.appliedMutationIds.includes(options.idempotencyKey)) {
|
|
89
|
+
return cloneRecord(current);
|
|
90
|
+
}
|
|
91
|
+
validateCorrection(correction);
|
|
92
|
+
if (memoryCorrectionIsUnchanged(current, correction)) {
|
|
93
|
+
if (options.idempotencyKey !== undefined) {
|
|
94
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, options.idempotencyKey);
|
|
95
|
+
await this.persist(state);
|
|
96
|
+
}
|
|
97
|
+
return cloneRecord(current);
|
|
98
|
+
}
|
|
99
|
+
pushHistory(state, current);
|
|
100
|
+
clearInferredCandidates(state, current.identity);
|
|
101
|
+
const next = this.updateRecordValue(current, { ...current, ...correction, source: { kind: 'user' } }, 'explicit');
|
|
102
|
+
state.records = replaceRecord(state.records, next);
|
|
103
|
+
clearTombstone(state, current.identity);
|
|
104
|
+
if (options.idempotencyKey !== undefined) {
|
|
105
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, options.idempotencyKey);
|
|
106
|
+
}
|
|
107
|
+
await this.writeRecordMarkdown(state, next, current.text, current.category);
|
|
108
|
+
return cloneRecord(next);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async remove(id, options = {}) {
|
|
112
|
+
await this.repository.withLock(async () => {
|
|
113
|
+
const state = await this.loadAndReconcile();
|
|
114
|
+
if (options.idempotencyKey !== undefined &&
|
|
115
|
+
state.appliedMutationIds.includes(options.idempotencyKey))
|
|
116
|
+
return;
|
|
117
|
+
const current = state.records.find((entry) => entry.id === id);
|
|
118
|
+
if (current === undefined)
|
|
119
|
+
throw new Error(`Unknown memory: ${id}`);
|
|
120
|
+
let removalProjection;
|
|
121
|
+
if (current.state !== 'superseded') {
|
|
122
|
+
const path = this.resolveMemoryFilePath(state, current.scope, current.projectKey);
|
|
123
|
+
const content = await this.readStableFile(state, path, current.scope, current.projectKey);
|
|
124
|
+
const refreshed = state.records.find((entry) => entry.id === id);
|
|
125
|
+
if (refreshed !== undefined && refreshed.state !== 'superseded') {
|
|
126
|
+
pushHistory(state, refreshed);
|
|
127
|
+
if (content !== null) {
|
|
128
|
+
const nextContent = removeMarkdownBullet(content, current.text, current.category);
|
|
129
|
+
if (nextContent !== content) {
|
|
130
|
+
const confirmed = await this.readStableFile(state, path, refreshed.scope, refreshed.projectKey);
|
|
131
|
+
if (confirmed !== content) {
|
|
132
|
+
throw new Error(`Memory file changed during update: ${path}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
removalProjection = {
|
|
136
|
+
file: path,
|
|
137
|
+
projection: {
|
|
138
|
+
content: nextContent,
|
|
139
|
+
baseHash: memoryFileHash(content),
|
|
140
|
+
scope: refreshed.scope,
|
|
141
|
+
...(refreshed.projectKey === undefined ? {} : { projectKey: refreshed.projectKey }),
|
|
142
|
+
queuedAt: this.timestamp(),
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (options.permanent) {
|
|
149
|
+
state.records = state.records.filter((entry) => entry.id !== id);
|
|
150
|
+
delete state.history[id];
|
|
151
|
+
delete state.evidence[id];
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
state.records = replaceRecord(state.records, {
|
|
155
|
+
...current,
|
|
156
|
+
state: 'superseded',
|
|
157
|
+
updatedAt: this.timestamp(),
|
|
158
|
+
});
|
|
159
|
+
delete state.evidence[id];
|
|
160
|
+
}
|
|
161
|
+
state.tombstones = upsertTombstone(state.tombstones, {
|
|
162
|
+
identity: current.identity,
|
|
163
|
+
scope: current.scope,
|
|
164
|
+
...(current.projectKey === undefined ? {} : { projectKey: current.projectKey }),
|
|
165
|
+
recordId: current.id,
|
|
166
|
+
textHash: normalizedMemoryTextHash(current.text),
|
|
167
|
+
reason: 'user-remove',
|
|
168
|
+
...(options.permanent === true ? { permanent: true } : {}),
|
|
169
|
+
removedAt: this.timestamp(),
|
|
170
|
+
});
|
|
171
|
+
if (options.idempotencyKey !== undefined) {
|
|
172
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, options.idempotencyKey);
|
|
173
|
+
}
|
|
174
|
+
if (removalProjection === undefined) {
|
|
175
|
+
await this.persist(state);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
await this.persistWithFileProjection(state, removalProjection.file, removalProjection.projection);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async rollback(id) {
|
|
183
|
+
return this.repository.withLock(async () => {
|
|
184
|
+
const state = await this.loadAndReconcile();
|
|
185
|
+
const current = state.records.find((entry) => entry.id === id);
|
|
186
|
+
const history = state.history[id] ?? [];
|
|
187
|
+
const previous = history.at(-1);
|
|
188
|
+
if (current === undefined || previous === undefined)
|
|
189
|
+
throw new Error(`No rollback available: ${id}`);
|
|
190
|
+
state.history[id] = history.slice(0, -1);
|
|
191
|
+
const next = {
|
|
192
|
+
...previous,
|
|
193
|
+
id,
|
|
194
|
+
state: 'proven',
|
|
195
|
+
updatedAt: this.timestamp(),
|
|
196
|
+
};
|
|
197
|
+
state.records = replaceRecord(state.records, next);
|
|
198
|
+
clearTombstone(state, next.identity);
|
|
199
|
+
await this.writeRecordMarkdown(state, next, current.state !== 'superseded' ? current.text : undefined, current.state !== 'superseded' ? current.category : undefined);
|
|
200
|
+
return cloneRecord(next);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async recordApplicationOutcome(id, outcome, options = {}) {
|
|
204
|
+
return this.repository.withLock(async () => {
|
|
205
|
+
const state = await this.loadAndReconcile();
|
|
206
|
+
const current = state.records.find((entry) => entry.id === id);
|
|
207
|
+
if (current === undefined)
|
|
208
|
+
return null;
|
|
209
|
+
if (options.idempotencyKey !== undefined &&
|
|
210
|
+
state.appliedMutationIds.includes(options.idempotencyKey)) {
|
|
211
|
+
return cloneRecord(current);
|
|
212
|
+
}
|
|
213
|
+
const applicationId = options.applicationId;
|
|
214
|
+
const storedOutcome = applicationId === undefined ? undefined : state.applicationOutcomes[applicationId];
|
|
215
|
+
if (storedOutcome !== undefined && storedOutcome.recordId !== id) {
|
|
216
|
+
throw new Error(`Context application ${applicationId} belongs to another memory record`);
|
|
217
|
+
}
|
|
218
|
+
const revision = options.revision ?? (storedOutcome?.revision ?? 0) + 1;
|
|
219
|
+
if (storedOutcome !== undefined && revision <= storedOutcome.revision) {
|
|
220
|
+
if (options.idempotencyKey !== undefined) {
|
|
221
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, options.idempotencyKey);
|
|
222
|
+
await this.persist(state);
|
|
223
|
+
}
|
|
224
|
+
return cloneRecord(current);
|
|
225
|
+
}
|
|
226
|
+
const feedbackState = state.feedbackState[id];
|
|
227
|
+
if (current.state === 'superseded' && feedbackState === undefined)
|
|
228
|
+
return null;
|
|
229
|
+
const successful = outcome === 'used-successfully';
|
|
230
|
+
const failed = negativeContextOutcome(outcome);
|
|
231
|
+
const previousSuccessful = storedOutcome?.status === 'used-successfully';
|
|
232
|
+
const previousFailed = negativeContextOutcome(storedOutcome?.status);
|
|
233
|
+
if (applicationId !== undefined) {
|
|
234
|
+
state.applicationOutcomes[applicationId] = { recordId: id, status: outcome, revision };
|
|
235
|
+
}
|
|
236
|
+
const hasOtherNegativeOutcome = Object.entries(state.applicationOutcomes).some(([candidateApplicationId, value]) => candidateApplicationId !== applicationId &&
|
|
237
|
+
value.recordId === id &&
|
|
238
|
+
negativeContextOutcome(value.status));
|
|
239
|
+
const shouldRestore = current.kind === 'inferred' &&
|
|
240
|
+
!failed &&
|
|
241
|
+
feedbackState !== undefined &&
|
|
242
|
+
!hasOtherNegativeOutcome;
|
|
243
|
+
const updatedAt = this.timestamp();
|
|
244
|
+
const next = {
|
|
245
|
+
...current,
|
|
246
|
+
state: current.kind === 'inferred' && failed
|
|
247
|
+
? 'superseded'
|
|
248
|
+
: shouldRestore
|
|
249
|
+
? successful && feedbackState.baseState === 'trial'
|
|
250
|
+
? 'proven'
|
|
251
|
+
: feedbackState.baseState
|
|
252
|
+
: current.state === 'trial' && successful
|
|
253
|
+
? 'proven'
|
|
254
|
+
: current.state,
|
|
255
|
+
applicationCount: current.applicationCount + Number(storedOutcome === undefined),
|
|
256
|
+
successCount: Math.max(0, current.successCount + Number(successful) - Number(previousSuccessful)),
|
|
257
|
+
failureCount: Math.max(0, current.failureCount + Number(failed) - Number(previousFailed)),
|
|
258
|
+
lastAppliedAt: updatedAt,
|
|
259
|
+
updatedAt,
|
|
260
|
+
};
|
|
261
|
+
state.records = replaceRecord(state.records, next);
|
|
262
|
+
if (options.idempotencyKey !== undefined) {
|
|
263
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, options.idempotencyKey);
|
|
264
|
+
}
|
|
265
|
+
let removalProjection;
|
|
266
|
+
if (current.kind === 'inferred' && failed && feedbackState === undefined) {
|
|
267
|
+
state.feedbackState[id] = {
|
|
268
|
+
baseState: current.state === 'trial' ? 'trial' : 'proven',
|
|
269
|
+
};
|
|
270
|
+
const file = this.resolveMemoryFilePath(state, current.scope, current.projectKey);
|
|
271
|
+
const content = await this.readStableFile(state, file, current.scope, current.projectKey);
|
|
272
|
+
if (content !== null) {
|
|
273
|
+
const nextContent = removeMarkdownBullet(content, current.text, current.category);
|
|
274
|
+
if (nextContent !== content) {
|
|
275
|
+
const confirmed = await this.readStableFile(state, file, current.scope, current.projectKey);
|
|
276
|
+
if (confirmed !== content) {
|
|
277
|
+
throw new Error(`Memory file changed during update: ${file}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
removalProjection = {
|
|
281
|
+
file,
|
|
282
|
+
projection: {
|
|
283
|
+
content: nextContent,
|
|
284
|
+
baseHash: memoryFileHash(content),
|
|
285
|
+
scope: current.scope,
|
|
286
|
+
...(current.projectKey === undefined ? {} : { projectKey: current.projectKey }),
|
|
287
|
+
queuedAt: this.timestamp(),
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
state.tombstones = upsertTombstone(state.tombstones, {
|
|
292
|
+
identity: current.identity,
|
|
293
|
+
scope: current.scope,
|
|
294
|
+
...(current.projectKey === undefined ? {} : { projectKey: current.projectKey }),
|
|
295
|
+
recordId: current.id,
|
|
296
|
+
textHash: normalizedMemoryTextHash(current.text),
|
|
297
|
+
reason: 'negative-feedback',
|
|
298
|
+
removedAt: this.timestamp(),
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (shouldRestore) {
|
|
302
|
+
delete state.feedbackState[id];
|
|
303
|
+
state.tombstones = state.tombstones.filter((entry) => !(entry.recordId === id && entry.reason === 'negative-feedback'));
|
|
304
|
+
await this.writeRecordMarkdown(state, next);
|
|
305
|
+
}
|
|
306
|
+
else if (current.state === 'trial' && next.state === 'proven') {
|
|
307
|
+
await this.writeRecordMarkdown(state, next);
|
|
308
|
+
}
|
|
309
|
+
else if (removalProjection !== undefined) {
|
|
310
|
+
await this.persistWithFileProjection(state, removalProjection.file, removalProjection.projection);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
await this.persist(state);
|
|
314
|
+
}
|
|
315
|
+
return cloneRecord(next);
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
async observe(observation) {
|
|
319
|
+
validateObservation(observation);
|
|
320
|
+
if (observation.source?.kind !== 'user' && !isUsefulAutomaticObservation(observation)) {
|
|
321
|
+
return {
|
|
322
|
+
deduplicated: false,
|
|
323
|
+
ignored: true,
|
|
324
|
+
candidate: false,
|
|
325
|
+
promoted: false,
|
|
326
|
+
record: null,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
return this.repository.withLock(async () => {
|
|
330
|
+
const state = await this.loadAndReconcile(observation.scope, observation.projectKey);
|
|
331
|
+
const projectIdentity = observation.projectIdentity ?? observation.projectKey;
|
|
332
|
+
const normalizedObservation = {
|
|
333
|
+
...observation,
|
|
334
|
+
memoryType: observation.memoryType ?? inferPersonalMemoryType(observation, 'inferred'),
|
|
335
|
+
};
|
|
336
|
+
const candidateKey = observation.candidateKey ?? memoryIdentity(normalizedObservation);
|
|
337
|
+
const key = observationKey(normalizedObservation, projectIdentity, candidateKey);
|
|
338
|
+
const previous = state.observations.find((entry) => entry.key === key);
|
|
339
|
+
if (previous !== undefined && (previous.success || !observation.success)) {
|
|
340
|
+
return {
|
|
341
|
+
deduplicated: true,
|
|
342
|
+
ignored: false,
|
|
343
|
+
candidate: false,
|
|
344
|
+
promoted: false,
|
|
345
|
+
record: null,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
const source = observation.source ?? {
|
|
349
|
+
kind: 'workflow',
|
|
350
|
+
workflow: observation.workflow,
|
|
351
|
+
changeId: observation.changeId,
|
|
352
|
+
projectKey: observation.projectKey,
|
|
353
|
+
};
|
|
354
|
+
const stored = {
|
|
355
|
+
key,
|
|
356
|
+
changeId: observation.changeId.trim(),
|
|
357
|
+
scope: observation.scope,
|
|
358
|
+
projectKey: observation.projectKey,
|
|
359
|
+
...(projectIdentity === undefined ? {} : { projectIdentity }),
|
|
360
|
+
candidateKey,
|
|
361
|
+
identity: memoryIdentity(normalizedObservation),
|
|
362
|
+
text: observation.text,
|
|
363
|
+
normalizedText: normalizeText(observation.text),
|
|
364
|
+
success: observation.success,
|
|
365
|
+
source,
|
|
366
|
+
observedAt: observation.observedAt ?? this.timestamp(),
|
|
367
|
+
};
|
|
368
|
+
state.observations =
|
|
369
|
+
previous === undefined
|
|
370
|
+
? [...state.observations, stored]
|
|
371
|
+
: state.observations.map((entry) => (entry.key === key ? stored : entry));
|
|
372
|
+
const paused = observation.scope === 'project' &&
|
|
373
|
+
observation.projectKey !== undefined &&
|
|
374
|
+
state.settings.pausedLearningProjects.includes(observation.projectKey);
|
|
375
|
+
if (!state.settings.learningEnabled || paused || !observation.success) {
|
|
376
|
+
await this.persist(state);
|
|
377
|
+
return {
|
|
378
|
+
deduplicated: false,
|
|
379
|
+
ignored: !state.settings.learningEnabled || paused,
|
|
380
|
+
candidate: false,
|
|
381
|
+
promoted: false,
|
|
382
|
+
record: null,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
const identity = stored.identity;
|
|
386
|
+
const normalized = stored.normalizedText;
|
|
387
|
+
const normalizedTextHash = normalizedMemoryTextHash(stored.text);
|
|
388
|
+
const rawTextHash = hashMemoryText(stored.text);
|
|
389
|
+
const tombstone = state.tombstones.find((entry) => entry.identity === identity ||
|
|
390
|
+
(entry.scope === stored.scope &&
|
|
391
|
+
entry.projectKey === stored.projectKey &&
|
|
392
|
+
entry.textHash !== undefined &&
|
|
393
|
+
(entry.textHash === normalizedTextHash || entry.textHash === rawTextHash)));
|
|
394
|
+
if (tombstone?.permanent === true ||
|
|
395
|
+
(tombstone !== undefined && stored.observedAt <= tombstone.removedAt)) {
|
|
396
|
+
await this.persist(state);
|
|
397
|
+
return {
|
|
398
|
+
deduplicated: false,
|
|
399
|
+
ignored: true,
|
|
400
|
+
candidate: false,
|
|
401
|
+
promoted: false,
|
|
402
|
+
record: null,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
const candidate = state.records.find((entry) => (tombstone === undefined || entry.createdAt > tombstone.removedAt) &&
|
|
406
|
+
entry.state === 'trial' &&
|
|
407
|
+
entry.kind === 'inferred' &&
|
|
408
|
+
entry.identity === identity &&
|
|
409
|
+
normalizeText(entry.text) === normalized);
|
|
410
|
+
const record = candidate ??
|
|
411
|
+
createRecord(observationInput(normalizedObservation, source), 'inferred', source, stored.observedAt, identity);
|
|
412
|
+
state.records = candidate ? state.records : [...state.records, record];
|
|
413
|
+
const evidence = new Set(state.evidence[record.id] ?? []);
|
|
414
|
+
evidence.add(key);
|
|
415
|
+
state.evidence[record.id] = [...evidence];
|
|
416
|
+
const active = state.records.find((entry) => entry.state === 'proven' && entry.identity === identity);
|
|
417
|
+
const explicit = state.records.find((entry) => entry.state !== 'superseded' &&
|
|
418
|
+
entry.kind === 'explicit' &&
|
|
419
|
+
memoryShapeIdentity(entry) === memoryShapeIdentity(normalizedObservation));
|
|
420
|
+
if (explicit !== undefined) {
|
|
421
|
+
if (normalizeText(explicit.text) !== normalized) {
|
|
422
|
+
state.conflicts = addConflict(state.conflicts, identity, [explicit, record], this.timestamp());
|
|
423
|
+
await this.persist(state);
|
|
424
|
+
return {
|
|
425
|
+
deduplicated: false,
|
|
426
|
+
ignored: false,
|
|
427
|
+
candidate: true,
|
|
428
|
+
promoted: false,
|
|
429
|
+
record: null,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const refreshed = addSource(explicit, source, this.timestamp());
|
|
433
|
+
state.records = replaceRecord(state.records.filter((entry) => entry.id !== record.id), refreshed);
|
|
434
|
+
delete state.evidence[record.id];
|
|
435
|
+
state.conflicts = state.conflicts.filter((entry) => entry.identity !== identity);
|
|
436
|
+
await this.persist(state);
|
|
437
|
+
return {
|
|
438
|
+
deduplicated: false,
|
|
439
|
+
ignored: false,
|
|
440
|
+
candidate: false,
|
|
441
|
+
promoted: false,
|
|
442
|
+
record: cloneRecord(refreshed),
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
const conflicting = state.records.filter((entry) => entry.id !== record.id &&
|
|
446
|
+
entry.identity === identity &&
|
|
447
|
+
normalizeText(entry.text) !== normalized &&
|
|
448
|
+
(entry.state !== 'superseded' || (state.evidence[entry.id]?.length ?? 0) > 0));
|
|
449
|
+
if (conflicting.length > 0) {
|
|
450
|
+
state.conflicts = addConflict(state.conflicts, identity, [...conflicting, record], this.timestamp());
|
|
451
|
+
await this.persist(state);
|
|
452
|
+
return {
|
|
453
|
+
deduplicated: false,
|
|
454
|
+
ignored: false,
|
|
455
|
+
candidate: true,
|
|
456
|
+
promoted: false,
|
|
457
|
+
record: null,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
if (active !== undefined && normalizeText(active.text) === normalized) {
|
|
461
|
+
const refreshed = addSource(active, source, this.timestamp());
|
|
462
|
+
state.records = replaceRecord(state.records, refreshed);
|
|
463
|
+
await this.persist(state);
|
|
464
|
+
return {
|
|
465
|
+
deduplicated: false,
|
|
466
|
+
ignored: false,
|
|
467
|
+
candidate: false,
|
|
468
|
+
promoted: false,
|
|
469
|
+
record: cloneRecord(refreshed),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
const independentEvidence = independentEvidenceCount(observation.scope, state.observations.filter((entry) => evidence.has(entry.key)));
|
|
473
|
+
const requiredEvidence = observation.scope === 'global' ? 2 : 2;
|
|
474
|
+
if (independentEvidence < requiredEvidence) {
|
|
475
|
+
await this.persist(state);
|
|
476
|
+
return {
|
|
477
|
+
deduplicated: false,
|
|
478
|
+
ignored: false,
|
|
479
|
+
candidate: true,
|
|
480
|
+
promoted: false,
|
|
481
|
+
record: null,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
if (active !== undefined && active.id !== record.id) {
|
|
485
|
+
state.conflicts = addConflict(state.conflicts, identity, [active, record], this.timestamp());
|
|
486
|
+
await this.persist(state);
|
|
487
|
+
return {
|
|
488
|
+
deduplicated: false,
|
|
489
|
+
ignored: false,
|
|
490
|
+
candidate: true,
|
|
491
|
+
promoted: false,
|
|
492
|
+
record: null,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
const candidateSources = state.observations
|
|
496
|
+
.filter((entry) => evidence.has(entry.key))
|
|
497
|
+
.map((entry) => entry.source);
|
|
498
|
+
const promoted = {
|
|
499
|
+
...record,
|
|
500
|
+
state: 'proven',
|
|
501
|
+
source: candidateSources[0] ?? record.source,
|
|
502
|
+
sources: mergeSources(record.sources, candidateSources),
|
|
503
|
+
updatedAt: this.timestamp(),
|
|
504
|
+
};
|
|
505
|
+
state.records = replaceRecord(state.records, promoted);
|
|
506
|
+
clearTombstone(state, identity);
|
|
507
|
+
await this.writeRecordMarkdown(state, promoted);
|
|
508
|
+
return {
|
|
509
|
+
deduplicated: false,
|
|
510
|
+
ignored: false,
|
|
511
|
+
candidate: true,
|
|
512
|
+
promoted: true,
|
|
513
|
+
record: cloneRecord(promoted),
|
|
514
|
+
};
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
async reviewAndApply(packet, actions) {
|
|
518
|
+
// Validate the complete packet and action envelope before touching the repository.
|
|
519
|
+
const validatedPacket = validateMemoryReviewPacket(packet);
|
|
520
|
+
const validatedActions = validateMemoryReviewActions(validatedPacket, actions);
|
|
521
|
+
const results = [];
|
|
522
|
+
for (const action of validatedActions.actions) {
|
|
523
|
+
results.push(await this.applyReviewAction(validatedPacket, action));
|
|
524
|
+
}
|
|
525
|
+
const first = results[0];
|
|
526
|
+
if (first === undefined) {
|
|
527
|
+
return { action: 'skip', persisted: false };
|
|
528
|
+
}
|
|
529
|
+
if (results.length === 1)
|
|
530
|
+
return first;
|
|
531
|
+
return {
|
|
532
|
+
action: first.action,
|
|
533
|
+
persisted: results.some((result) => result.persisted),
|
|
534
|
+
...(results.find((result) => result.reason !== undefined)?.reason === undefined
|
|
535
|
+
? {}
|
|
536
|
+
: { reason: results.find((result) => result.reason !== undefined)?.reason }),
|
|
537
|
+
...(results.find((result) => result.notification !== undefined)?.notification === undefined
|
|
538
|
+
? {}
|
|
539
|
+
: {
|
|
540
|
+
notification: results.find((result) => result.notification !== undefined)?.notification,
|
|
541
|
+
}),
|
|
542
|
+
results,
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
async query(request) {
|
|
546
|
+
if (request.view === 'manage')
|
|
547
|
+
return this.manage(request.query);
|
|
548
|
+
if (request.view === 'expand') {
|
|
549
|
+
if (!request.query.id)
|
|
550
|
+
throw new Error('Memory expand requires an id');
|
|
551
|
+
const record = await this.get(request.query.id);
|
|
552
|
+
const available = record !== null &&
|
|
553
|
+
(record.scope === 'global' ||
|
|
554
|
+
(request.query.projectKey !== undefined &&
|
|
555
|
+
record.projectKey === request.query.projectKey));
|
|
556
|
+
return { kind: 'expand', record: available ? record : null };
|
|
557
|
+
}
|
|
558
|
+
if (request.view === 'manifest') {
|
|
559
|
+
const retrieval = await this.retrieve({ ...request.query, view: 'task' });
|
|
560
|
+
return {
|
|
561
|
+
kind: 'manifest',
|
|
562
|
+
truncated: retrieval.truncated,
|
|
563
|
+
items: retrieval.records.map((record) => ({
|
|
564
|
+
id: record.id,
|
|
565
|
+
memoryType: record.memoryType,
|
|
566
|
+
state: record.state,
|
|
567
|
+
authority: record.authority,
|
|
568
|
+
title: record.title ?? record.category,
|
|
569
|
+
summary: record.text,
|
|
570
|
+
scope: record.scope,
|
|
571
|
+
...(record.projectKey === undefined ? {} : { projectKey: record.projectKey }),
|
|
572
|
+
pathPatterns: [...record.pathPatterns],
|
|
573
|
+
taskTypes: [...record.taskTypes],
|
|
574
|
+
operations: [...record.operations],
|
|
575
|
+
phases: [...record.phases],
|
|
576
|
+
evidence: record.evidence.map(cloneExperienceEvidence),
|
|
577
|
+
})),
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
return this.retrieve({ ...request.query, view: request.view });
|
|
581
|
+
}
|
|
582
|
+
async apply(mutation) {
|
|
583
|
+
switch (mutation.operation) {
|
|
584
|
+
case 'remember':
|
|
585
|
+
return this.remember(mutation.input);
|
|
586
|
+
case 'correct': {
|
|
587
|
+
const input = mutation.input;
|
|
588
|
+
return this.correct(input.id, input.correction);
|
|
589
|
+
}
|
|
590
|
+
case 'forget': {
|
|
591
|
+
const input = mutation.input;
|
|
592
|
+
return this.remove(input.id, { permanent: input.permanent });
|
|
593
|
+
}
|
|
594
|
+
case 'rollback':
|
|
595
|
+
return this.rollback(mutation.input.id);
|
|
596
|
+
case 'observe':
|
|
597
|
+
return this.observe(mutation.input);
|
|
598
|
+
case 'review': {
|
|
599
|
+
const input = mutation.input;
|
|
600
|
+
return this.reviewAndApply(input.packet, input.actions);
|
|
601
|
+
}
|
|
602
|
+
case 'feedback': {
|
|
603
|
+
const input = mutation.input;
|
|
604
|
+
return this.recordApplicationOutcome(input.id, input.outcome, {
|
|
605
|
+
...(input.previousOutcome === undefined
|
|
606
|
+
? {}
|
|
607
|
+
: { previousOutcome: input.previousOutcome }),
|
|
608
|
+
...(input.applicationId === undefined ? {} : { applicationId: input.applicationId }),
|
|
609
|
+
...(input.revision === undefined ? {} : { revision: input.revision }),
|
|
610
|
+
...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
case 'experience-delta':
|
|
614
|
+
return this.applyExperienceDelta(mutation.input.delta, mutation.input.idempotencyKey);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
async applyExperienceDelta(delta, idempotencyKey) {
|
|
618
|
+
if (delta.owner !== 'personal-memory' && delta.owner !== 'comet.personal-memory') {
|
|
619
|
+
throw new Error('Learning Delta owner does not match Personal Memory');
|
|
620
|
+
}
|
|
621
|
+
if (await this.mutationWasApplied(idempotencyKey))
|
|
622
|
+
return { changed: false };
|
|
623
|
+
if (delta.feedback !== undefined) {
|
|
624
|
+
if (!delta.targetId)
|
|
625
|
+
throw new Error('Learning Delta feedback target is required');
|
|
626
|
+
const record = await this.recordApplicationOutcome(delta.targetId, delta.feedback.status, {
|
|
627
|
+
previousOutcome: delta.feedback.previousStatus,
|
|
628
|
+
applicationId: delta.feedback.applicationId,
|
|
629
|
+
revision: delta.feedback.revision,
|
|
630
|
+
idempotencyKey,
|
|
631
|
+
});
|
|
632
|
+
return { changed: record !== null, record };
|
|
633
|
+
}
|
|
634
|
+
if (delta.action === 'noop') {
|
|
635
|
+
await this.markMutationApplied(idempotencyKey);
|
|
636
|
+
return { changed: false };
|
|
637
|
+
}
|
|
638
|
+
if (delta.action === 'forget' || delta.action === 'supersede') {
|
|
639
|
+
if (!delta.targetId)
|
|
640
|
+
throw new Error('Learning Delta target is required');
|
|
641
|
+
await this.remove(delta.targetId, {
|
|
642
|
+
permanent: delta.action === 'forget',
|
|
643
|
+
idempotencyKey,
|
|
644
|
+
});
|
|
645
|
+
return { changed: true, record: null };
|
|
646
|
+
}
|
|
647
|
+
if (delta.action === 'update') {
|
|
648
|
+
if (!delta.targetId)
|
|
649
|
+
throw new Error('Learning Delta target is required');
|
|
650
|
+
const record = await this.correct(delta.targetId, {
|
|
651
|
+
...(delta.title === undefined ? {} : { title: delta.title }),
|
|
652
|
+
text: delta.statement,
|
|
653
|
+
category: delta.kind,
|
|
654
|
+
pathPatterns: delta.applicability.paths,
|
|
655
|
+
taskTypes: delta.applicability.tasks,
|
|
656
|
+
operations: delta.applicability.operations,
|
|
657
|
+
phases: delta.applicability.phases,
|
|
658
|
+
}, { idempotencyKey });
|
|
659
|
+
return { changed: true, record };
|
|
660
|
+
}
|
|
661
|
+
const scope = delta.applicability.projectId === undefined ? 'global' : 'project';
|
|
662
|
+
const actionPayload = delta.payload?.kind === 'memory-action' ? delta.payload : undefined;
|
|
663
|
+
const candidateKey = typeof actionPayload?.candidateKey === 'string' ? actionPayload.candidateKey : idempotencyKey;
|
|
664
|
+
const language = actionPayload?.language === 'en' || actionPayload?.language === 'zh-CN'
|
|
665
|
+
? actionPayload.language
|
|
666
|
+
: undefined;
|
|
667
|
+
const memoryClass = isMemoryClass(actionPayload?.memoryClass)
|
|
668
|
+
? actionPayload.memoryClass
|
|
669
|
+
: undefined;
|
|
670
|
+
const memoryType = isPersonalMemoryType(delta.memoryType) ? delta.memoryType : undefined;
|
|
671
|
+
const reason = typeof actionPayload?.reason === 'string' ? actionPayload.reason : undefined;
|
|
672
|
+
const episode = personalEpisodeFromPayload(actionPayload?.episode);
|
|
673
|
+
const record = delta.authority === 'explicit' || delta.authority === 'user'
|
|
674
|
+
? await this.remember({
|
|
675
|
+
scope,
|
|
676
|
+
...(delta.applicability.projectId === undefined
|
|
677
|
+
? {}
|
|
678
|
+
: { projectKey: delta.applicability.projectId }),
|
|
679
|
+
category: delta.kind,
|
|
680
|
+
...(delta.title === undefined ? {} : { title: delta.title }),
|
|
681
|
+
text: delta.statement,
|
|
682
|
+
pathPatterns: delta.applicability.paths,
|
|
683
|
+
taskTypes: delta.applicability.tasks,
|
|
684
|
+
operations: delta.applicability.operations,
|
|
685
|
+
phases: delta.applicability.phases,
|
|
686
|
+
evidence: delta.evidence,
|
|
687
|
+
candidateKey,
|
|
688
|
+
...(language === undefined ? {} : { language }),
|
|
689
|
+
...(memoryClass === undefined ? {} : { memoryClass }),
|
|
690
|
+
...(memoryType === undefined ? {} : { memoryType }),
|
|
691
|
+
...(episode === undefined ? {} : { episode }),
|
|
692
|
+
...(reason === undefined ? {} : { reason }),
|
|
693
|
+
source: { kind: 'user' },
|
|
694
|
+
})
|
|
695
|
+
: (await this.observe({
|
|
696
|
+
scope,
|
|
697
|
+
...(delta.applicability.projectId === undefined
|
|
698
|
+
? {}
|
|
699
|
+
: { projectKey: delta.applicability.projectId }),
|
|
700
|
+
category: delta.kind,
|
|
701
|
+
...(delta.title === undefined ? {} : { title: delta.title }),
|
|
702
|
+
text: delta.statement,
|
|
703
|
+
pathPatterns: delta.applicability.paths,
|
|
704
|
+
taskTypes: delta.applicability.tasks,
|
|
705
|
+
operations: delta.applicability.operations,
|
|
706
|
+
phases: delta.applicability.phases,
|
|
707
|
+
evidence: delta.evidence,
|
|
708
|
+
candidateKey,
|
|
709
|
+
...(language === undefined ? {} : { language }),
|
|
710
|
+
...(memoryClass === undefined ? {} : { memoryClass }),
|
|
711
|
+
...(memoryType === undefined ? {} : { memoryType }),
|
|
712
|
+
...(episode === undefined ? {} : { episode }),
|
|
713
|
+
...(reason === undefined ? {} : { reason }),
|
|
714
|
+
workflow: 'agent-learning',
|
|
715
|
+
changeId: idempotencyKey,
|
|
716
|
+
success: delta.recommendedState !== 'superseded',
|
|
717
|
+
source: { kind: delta.authority === 'repository' ? 'repository' : 'workflow' },
|
|
718
|
+
})).record;
|
|
719
|
+
await this.markMutationApplied(idempotencyKey);
|
|
720
|
+
return { changed: record !== null, record };
|
|
721
|
+
}
|
|
722
|
+
async mutationWasApplied(idempotencyKey) {
|
|
723
|
+
return this.repository.withLock(async () => {
|
|
724
|
+
const state = await this.loadAndReconcile();
|
|
725
|
+
return state.appliedMutationIds.includes(idempotencyKey);
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
async markMutationApplied(idempotencyKey) {
|
|
729
|
+
await this.repository.withLock(async () => {
|
|
730
|
+
const state = await this.loadAndReconcile();
|
|
731
|
+
if (state.appliedMutationIds.includes(idempotencyKey))
|
|
732
|
+
return;
|
|
733
|
+
state.appliedMutationIds = appendBoundedMutationId(state.appliedMutationIds, idempotencyKey);
|
|
734
|
+
await this.persist(state);
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
async applyReviewAction(packet, action) {
|
|
738
|
+
if (action.action === 'skip') {
|
|
739
|
+
return {
|
|
740
|
+
action: 'skip',
|
|
741
|
+
persisted: false,
|
|
742
|
+
...(action.reason === undefined ? {} : { reason: action.reason }),
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (action.action === 'create') {
|
|
746
|
+
if (packet.explicitRequest?.action === 'remember') {
|
|
747
|
+
const record = await this.remember({
|
|
748
|
+
scope: action.scope,
|
|
749
|
+
...(action.projectKey === undefined ? {} : { projectKey: action.projectKey }),
|
|
750
|
+
category: action.category,
|
|
751
|
+
text: action.text,
|
|
752
|
+
memoryClass: action.memoryClass,
|
|
753
|
+
title: action.title,
|
|
754
|
+
reason: action.reason,
|
|
755
|
+
tags: action.tags,
|
|
756
|
+
pathPatterns: action.pathPatterns,
|
|
757
|
+
taskTypes: action.taskTypes,
|
|
758
|
+
operations: action.operations,
|
|
759
|
+
phases: action.phases,
|
|
760
|
+
language: action.language,
|
|
761
|
+
source: { kind: 'user' },
|
|
762
|
+
});
|
|
763
|
+
return {
|
|
764
|
+
action: 'create',
|
|
765
|
+
persisted: true,
|
|
766
|
+
observation: {
|
|
767
|
+
deduplicated: false,
|
|
768
|
+
ignored: false,
|
|
769
|
+
candidate: false,
|
|
770
|
+
promoted: true,
|
|
771
|
+
record,
|
|
772
|
+
},
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
const observation = await this.observe({
|
|
776
|
+
scope: action.scope,
|
|
777
|
+
...(action.projectKey === undefined ? {} : { projectKey: action.projectKey }),
|
|
778
|
+
category: action.category,
|
|
779
|
+
text: action.text,
|
|
780
|
+
memoryClass: action.memoryClass,
|
|
781
|
+
title: action.title,
|
|
782
|
+
reason: action.reason,
|
|
783
|
+
tags: action.tags,
|
|
784
|
+
pathPatterns: action.pathPatterns,
|
|
785
|
+
taskTypes: action.taskTypes,
|
|
786
|
+
operations: action.operations,
|
|
787
|
+
phases: action.phases,
|
|
788
|
+
language: action.language,
|
|
789
|
+
projectIdentity: packet.projectIdentity,
|
|
790
|
+
candidateKey: action.candidateKey,
|
|
791
|
+
observedAt: packet.createdAt,
|
|
792
|
+
workflow: packet.workflow,
|
|
793
|
+
changeId: packet.changeId,
|
|
794
|
+
success: true,
|
|
795
|
+
source: {
|
|
796
|
+
kind: 'review',
|
|
797
|
+
label: packet.checkpoint,
|
|
798
|
+
workflow: packet.workflow,
|
|
799
|
+
changeId: packet.changeId,
|
|
800
|
+
projectKey: action.projectKey,
|
|
801
|
+
},
|
|
802
|
+
});
|
|
803
|
+
return {
|
|
804
|
+
action: 'create',
|
|
805
|
+
persisted: !observation.ignored &&
|
|
806
|
+
(observation.deduplicated || observation.candidate || observation.promoted),
|
|
807
|
+
...(observation.promoted
|
|
808
|
+
? {
|
|
809
|
+
notification: action.language === 'en'
|
|
810
|
+
? 'A reusable workflow preference is now available.'
|
|
811
|
+
: '已形成一条可复用的协作偏好。',
|
|
812
|
+
}
|
|
813
|
+
: {}),
|
|
814
|
+
observation,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
if (action.action === 'update') {
|
|
818
|
+
await this.correct(action.targetId, {
|
|
819
|
+
...(action.text === undefined ? {} : { text: action.text }),
|
|
820
|
+
...(action.category === undefined ? {} : { category: action.category }),
|
|
821
|
+
...(action.tags === undefined ? {} : { tags: action.tags }),
|
|
822
|
+
...(action.pathPatterns === undefined ? {} : { pathPatterns: action.pathPatterns }),
|
|
823
|
+
...(action.taskTypes === undefined ? {} : { taskTypes: action.taskTypes }),
|
|
824
|
+
...(action.operations === undefined ? {} : { operations: action.operations }),
|
|
825
|
+
...(action.phases === undefined ? {} : { phases: action.phases }),
|
|
826
|
+
...(action.title === undefined ? {} : { title: action.title }),
|
|
827
|
+
...(action.reason === undefined ? {} : { reason: action.reason }),
|
|
828
|
+
...(action.memoryClass === undefined ? {} : { memoryClass: action.memoryClass }),
|
|
829
|
+
});
|
|
830
|
+
return {
|
|
831
|
+
action: 'update',
|
|
832
|
+
persisted: true,
|
|
833
|
+
...(action.reason === undefined ? {} : { reason: action.reason }),
|
|
834
|
+
observation: undefined,
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
await this.remove(action.targetId, {
|
|
838
|
+
permanent: action.permanent === true,
|
|
839
|
+
});
|
|
840
|
+
return {
|
|
841
|
+
action: 'forget',
|
|
842
|
+
persisted: true,
|
|
843
|
+
...(action.reason === undefined ? {} : { reason: action.reason }),
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
async retrieve(query) {
|
|
847
|
+
return this.repository.withLock(async () => {
|
|
848
|
+
const state = await this.loadAndReconcile(query.scope === 'global' ? 'global' : query.scope === 'project' ? 'project' : undefined, query.projectKey);
|
|
849
|
+
await this.persist(state);
|
|
850
|
+
if (!state.settings.retrievalEnabled ||
|
|
851
|
+
isProjectRetrievalPaused(state.settings, query.projectKey)) {
|
|
852
|
+
return { records: [], text: '', truncated: false, disabled: true };
|
|
853
|
+
}
|
|
854
|
+
if (query.view === 'combined' || query.view === 'profile' || query.view === 'task') {
|
|
855
|
+
return buildContextRetrieval(state, query, query.profileMaxChars ?? this.profileMaxChars, query.taskMaxChars ?? query.maxChars ?? this.taskMaxChars);
|
|
856
|
+
}
|
|
857
|
+
const maxEntries = boundedPositive(query.maxEntries ?? this.maxEntries, this.maxEntries);
|
|
858
|
+
const maxBytes = boundedPositive(query.maxBytes ?? this.maxBytes, this.maxBytes);
|
|
859
|
+
const candidates = state.records
|
|
860
|
+
.filter((entry) => entry.state !== 'superseded' &&
|
|
861
|
+
(entry.state !== 'trial' || trialIsEligibleForRetrieval(state, entry)))
|
|
862
|
+
.filter((entry) => !isConflictedInferred(state.conflicts, entry))
|
|
863
|
+
.filter((entry) => scopeMatches(entry, query))
|
|
864
|
+
.filter((entry) => attributesMatch(entry, query))
|
|
865
|
+
.map((entry, index) => ({ record: entry, score: scoreRecord(entry, query), index }))
|
|
866
|
+
.filter(({ score }) => score > 0 || query.query === undefined)
|
|
867
|
+
.sort((left, right) => right.score - left.score ||
|
|
868
|
+
right.record.updatedAt.localeCompare(left.record.updatedAt) ||
|
|
869
|
+
left.index - right.index ||
|
|
870
|
+
left.record.id.localeCompare(right.record.id));
|
|
871
|
+
const records = [];
|
|
872
|
+
let text = '';
|
|
873
|
+
let truncated = false;
|
|
874
|
+
for (const candidate of candidates) {
|
|
875
|
+
if (records.length >= maxEntries) {
|
|
876
|
+
truncated = true;
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
const nextRecord = [...records, candidate.record];
|
|
880
|
+
const nextText = renderRetrieval(nextRecord);
|
|
881
|
+
if (Buffer.byteLength(nextText, 'utf8') > maxBytes) {
|
|
882
|
+
truncated = true;
|
|
883
|
+
break;
|
|
884
|
+
}
|
|
885
|
+
records.push(candidate.record);
|
|
886
|
+
text = nextText;
|
|
887
|
+
}
|
|
888
|
+
return { records: records.map(cloneRecord), text, truncated, disabled: false };
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
async manage(query = {}) {
|
|
892
|
+
return this.repository.withLock(async () => {
|
|
893
|
+
const state = await this.loadAndReconcile(query.scope === 'global' ? 'global' : query.scope === 'project' ? 'project' : undefined, query.projectKey);
|
|
894
|
+
await this.persist(state);
|
|
895
|
+
const candidates = state.records
|
|
896
|
+
.filter((entry) => scopeMatches(entry, query))
|
|
897
|
+
.filter((entry) => attributesMatch(entry, query))
|
|
898
|
+
.sort((left, right) => right.updatedAt.localeCompare(left.updatedAt) || left.id.localeCompare(right.id));
|
|
899
|
+
const maxEntries = boundedPositive(query.maxEntries ?? DEFAULT_MANAGEMENT_MAX_ENTRIES, DEFAULT_MANAGEMENT_MAX_ENTRIES);
|
|
900
|
+
const maxBytes = boundedPositive(query.maxBytes ?? DEFAULT_MANAGEMENT_MAX_BYTES, DEFAULT_MANAGEMENT_MAX_BYTES);
|
|
901
|
+
const candidateIds = new Set(candidates.map((record) => record.id));
|
|
902
|
+
const records = [];
|
|
903
|
+
let bytes = 0;
|
|
904
|
+
let entryCount = 0;
|
|
905
|
+
let truncated = false;
|
|
906
|
+
for (const record of candidates) {
|
|
907
|
+
if (entryCount >= maxEntries) {
|
|
908
|
+
truncated = true;
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
const next = projectManagementRecord(state, record);
|
|
912
|
+
const nextBytes = Buffer.byteLength(JSON.stringify(next), 'utf8');
|
|
913
|
+
if (bytes + nextBytes > maxBytes) {
|
|
914
|
+
truncated = true;
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
records.push(next);
|
|
918
|
+
bytes += nextBytes;
|
|
919
|
+
entryCount += 1;
|
|
920
|
+
}
|
|
921
|
+
const conflicts = [];
|
|
922
|
+
for (const conflict of state.conflicts) {
|
|
923
|
+
const next = projectManagementConflict(conflict, candidateIds);
|
|
924
|
+
if (next === null)
|
|
925
|
+
continue;
|
|
926
|
+
if (entryCount >= maxEntries) {
|
|
927
|
+
truncated = true;
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
const nextBytes = Buffer.byteLength(JSON.stringify(next), 'utf8');
|
|
931
|
+
if (bytes + nextBytes > maxBytes) {
|
|
932
|
+
truncated = true;
|
|
933
|
+
break;
|
|
934
|
+
}
|
|
935
|
+
conflicts.push(next);
|
|
936
|
+
bytes += nextBytes;
|
|
937
|
+
entryCount += 1;
|
|
938
|
+
}
|
|
939
|
+
return { records, conflicts, truncated };
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
async status() {
|
|
943
|
+
const status = await this.repository.withLock(async () => {
|
|
944
|
+
const state = await this.loadAndReconcile();
|
|
945
|
+
await this.persist(state);
|
|
946
|
+
return {
|
|
947
|
+
learningEnabled: state.settings.learningEnabled,
|
|
948
|
+
retrievalEnabled: state.settings.retrievalEnabled,
|
|
949
|
+
pausedProjects: [...state.settings.pausedProjects],
|
|
950
|
+
pausedLearningProjects: [...state.settings.pausedLearningProjects],
|
|
951
|
+
pausedRetrievalProjects: [...state.settings.pausedRetrievalProjects],
|
|
952
|
+
files: Object.keys(state.files)
|
|
953
|
+
.filter((file) => state.files[file]?.hash !== '')
|
|
954
|
+
.sort(),
|
|
955
|
+
provider: { provider: 'local', configured: true },
|
|
956
|
+
profile: { usedChars: profileUsedChars(state), maxChars: this.profileMaxChars },
|
|
957
|
+
};
|
|
958
|
+
});
|
|
959
|
+
return {
|
|
960
|
+
...status,
|
|
961
|
+
remote: redactRemote((await this.repository.remote?.()) ?? null),
|
|
962
|
+
sync: null,
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
async sync() {
|
|
966
|
+
return this.repository.sync();
|
|
967
|
+
}
|
|
968
|
+
async testProvider() {
|
|
969
|
+
return { ok: true, message: 'Local Provider is ready.' };
|
|
970
|
+
}
|
|
971
|
+
async remote() {
|
|
972
|
+
return redactRemote((await this.repository.remote?.()) ?? null);
|
|
973
|
+
}
|
|
974
|
+
async configureRemote(url) {
|
|
975
|
+
if (this.repository.configureRemote === undefined)
|
|
976
|
+
throw new Error('Memory Git sync is unavailable');
|
|
977
|
+
await this.repository.configureRemote(url);
|
|
978
|
+
}
|
|
979
|
+
async setLearningEnabled(enabled) {
|
|
980
|
+
await this.updateSettings((settings) => ({ ...settings, learningEnabled: enabled }));
|
|
981
|
+
}
|
|
982
|
+
async setRetrievalEnabled(enabled) {
|
|
983
|
+
await this.updateSettings((settings) => ({ ...settings, retrievalEnabled: enabled }));
|
|
984
|
+
}
|
|
985
|
+
async pauseProject(projectKey, paused) {
|
|
986
|
+
await this.pauseProjectLearning(projectKey, paused);
|
|
987
|
+
await this.pauseProjectRetrieval(projectKey, paused);
|
|
988
|
+
}
|
|
989
|
+
async pauseProjectLearning(projectKey, paused) {
|
|
990
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(projectKey))
|
|
991
|
+
throw new Error('Project key is invalid');
|
|
992
|
+
await this.updateSettings((settings) => {
|
|
993
|
+
const projects = new Set(settings.pausedLearningProjects);
|
|
994
|
+
if (paused)
|
|
995
|
+
projects.add(projectKey);
|
|
996
|
+
else
|
|
997
|
+
projects.delete(projectKey);
|
|
998
|
+
return {
|
|
999
|
+
...settings,
|
|
1000
|
+
pausedLearningProjects: [...projects].sort(),
|
|
1001
|
+
pausedProjects: mergePausedProjects(projects, new Set(settings.pausedRetrievalProjects)),
|
|
1002
|
+
};
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
async pauseProjectRetrieval(projectKey, paused) {
|
|
1006
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(projectKey))
|
|
1007
|
+
throw new Error('Project key is invalid');
|
|
1008
|
+
await this.updateSettings((settings) => {
|
|
1009
|
+
const projects = new Set(settings.pausedRetrievalProjects);
|
|
1010
|
+
if (paused)
|
|
1011
|
+
projects.add(projectKey);
|
|
1012
|
+
else
|
|
1013
|
+
projects.delete(projectKey);
|
|
1014
|
+
return {
|
|
1015
|
+
...settings,
|
|
1016
|
+
pausedRetrievalProjects: [...projects].sort(),
|
|
1017
|
+
pausedProjects: mergePausedProjects(new Set(settings.pausedLearningProjects), projects),
|
|
1018
|
+
};
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
async updateSettings(update) {
|
|
1022
|
+
await this.repository.withLock(async () => {
|
|
1023
|
+
const state = await this.loadAndReconcile();
|
|
1024
|
+
state.settings = update(state.settings);
|
|
1025
|
+
await this.persist(state);
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
async loadAndReconcile(scope, projectKey) {
|
|
1029
|
+
const raw = await this.repository.readState();
|
|
1030
|
+
const state = mutableState(raw);
|
|
1031
|
+
await this.flushPendingFileProjections(state);
|
|
1032
|
+
await this.prepareProjectFileBinding(state);
|
|
1033
|
+
const knownProjectKeys = new Set();
|
|
1034
|
+
for (const knownProjectKey of Object.keys(state.projectFiles)) {
|
|
1035
|
+
knownProjectKeys.add(knownProjectKey);
|
|
1036
|
+
}
|
|
1037
|
+
const binding = this.repository.projectFileBinding?.();
|
|
1038
|
+
if (binding !== undefined)
|
|
1039
|
+
knownProjectKeys.add(binding.projectKey);
|
|
1040
|
+
for (const record of state.records) {
|
|
1041
|
+
if (record.scope === 'project' && record.projectKey !== undefined)
|
|
1042
|
+
knownProjectKeys.add(record.projectKey);
|
|
1043
|
+
}
|
|
1044
|
+
for (const file of Object.keys(state.files)) {
|
|
1045
|
+
const match = /^projects\/([A-Za-z0-9][A-Za-z0-9._-]*)\.md$/u.exec(file);
|
|
1046
|
+
if (match?.[1] !== undefined && !Object.values(state.projectFiles).includes(file)) {
|
|
1047
|
+
knownProjectKeys.add(match[1]);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
const targets = scope === undefined
|
|
1051
|
+
? [
|
|
1052
|
+
{ scope: 'global' },
|
|
1053
|
+
...[...knownProjectKeys].map((knownProjectKey) => ({
|
|
1054
|
+
scope: 'project',
|
|
1055
|
+
projectKey: knownProjectKey,
|
|
1056
|
+
})),
|
|
1057
|
+
...(projectKey !== undefined && !knownProjectKeys.has(projectKey)
|
|
1058
|
+
? [{ scope: 'project', projectKey }]
|
|
1059
|
+
: []),
|
|
1060
|
+
]
|
|
1061
|
+
: [{ scope, ...(scope === 'project' ? { projectKey } : {}) }];
|
|
1062
|
+
for (const target of targets) {
|
|
1063
|
+
if (target.scope === 'project' && target.projectKey === undefined)
|
|
1064
|
+
continue;
|
|
1065
|
+
const file = this.resolveMemoryFilePath(state, target.scope, target.projectKey);
|
|
1066
|
+
const content = await this.repository.readText(file);
|
|
1067
|
+
reconcileMarkdown(state, file, target.scope, target.projectKey, content, this.timestamp());
|
|
1068
|
+
}
|
|
1069
|
+
return state;
|
|
1070
|
+
}
|
|
1071
|
+
async persist(state) {
|
|
1072
|
+
await this.repository.writeState(state);
|
|
1073
|
+
}
|
|
1074
|
+
resolveMemoryFilePath(state, scope, projectKey) {
|
|
1075
|
+
if (scope === 'global')
|
|
1076
|
+
return memoryFilePath(scope);
|
|
1077
|
+
if (projectKey === undefined)
|
|
1078
|
+
throw new Error('Project memory requires a project key');
|
|
1079
|
+
const binding = this.repository.projectFileBinding?.();
|
|
1080
|
+
return (state.projectFiles[projectKey] ??
|
|
1081
|
+
(binding?.projectKey === projectKey ? binding.path : undefined) ??
|
|
1082
|
+
memoryFilePath(scope, projectKey));
|
|
1083
|
+
}
|
|
1084
|
+
async prepareProjectFileBinding(state) {
|
|
1085
|
+
const binding = this.repository.projectFileBinding?.();
|
|
1086
|
+
if (binding === undefined)
|
|
1087
|
+
return;
|
|
1088
|
+
const occupiedByAnotherProject = Object.entries(state.projectFiles).some(([projectKey, file]) => projectKey !== binding.projectKey && file === binding.path);
|
|
1089
|
+
const projectPath = occupiedByAnotherProject
|
|
1090
|
+
? `projects/${binding.projectName}-${binding.projectKey.slice(-8)}.md`
|
|
1091
|
+
: binding.path;
|
|
1092
|
+
if (state.projectFiles[binding.projectKey] === undefined) {
|
|
1093
|
+
state.projectFiles[binding.projectKey] = projectPath;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
async writeRecordMarkdown(state, record, previousText, previousCategory) {
|
|
1097
|
+
const file = this.resolveMemoryFilePath(state, record.scope, record.projectKey);
|
|
1098
|
+
const existing = await this.readStableFile(state, file, record.scope, record.projectKey);
|
|
1099
|
+
const next = previousText
|
|
1100
|
+
? replaceMarkdownBullet(existing ?? '', previousText, record.text, record.category, previousCategory, record.scope, this.language)
|
|
1101
|
+
: appendMarkdownBullet(existing ?? '', record.category, record.text, record.scope, this.language);
|
|
1102
|
+
if (next !== existing) {
|
|
1103
|
+
const confirmed = await this.readStableFile(state, file, record.scope, record.projectKey);
|
|
1104
|
+
if (confirmed !== existing)
|
|
1105
|
+
throw new Error(`Memory file changed during update: ${file}`);
|
|
1106
|
+
}
|
|
1107
|
+
await this.persistWithFileProjection(state, file, {
|
|
1108
|
+
content: next,
|
|
1109
|
+
baseHash: memoryFileHash(existing),
|
|
1110
|
+
scope: record.scope,
|
|
1111
|
+
...(record.projectKey === undefined ? {} : { projectKey: record.projectKey }),
|
|
1112
|
+
queuedAt: this.timestamp(),
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
async persistWithFileProjection(state, file, projection) {
|
|
1116
|
+
state.pendingFileProjections[file] = projection;
|
|
1117
|
+
state.files[file] = fileState(projection.content, projection.queuedAt);
|
|
1118
|
+
if (projection.scope === 'project' && projection.projectKey !== undefined) {
|
|
1119
|
+
state.projectFiles[projection.projectKey] = file;
|
|
1120
|
+
}
|
|
1121
|
+
await this.persist(state);
|
|
1122
|
+
try {
|
|
1123
|
+
await this.flushPendingFileProjections(state);
|
|
1124
|
+
}
|
|
1125
|
+
catch {
|
|
1126
|
+
// The mutation and its idempotency key are already authoritative. The durable
|
|
1127
|
+
// projection remains pending on disk and is replayed before the next reconcile.
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
async flushPendingFileProjections(state) {
|
|
1131
|
+
const pending = Object.entries(state.pendingFileProjections);
|
|
1132
|
+
if (pending.length === 0)
|
|
1133
|
+
return;
|
|
1134
|
+
for (const [file, projection] of pending) {
|
|
1135
|
+
const current = await this.repository.readText(file);
|
|
1136
|
+
const currentHash = memoryFileHash(current);
|
|
1137
|
+
const targetHash = hashMemoryText(projection.content);
|
|
1138
|
+
if (currentHash !== targetHash && currentHash === projection.baseHash) {
|
|
1139
|
+
await this.repository.writeText(file, projection.content);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
for (const [file] of pending)
|
|
1143
|
+
delete state.pendingFileProjections[file];
|
|
1144
|
+
await this.persist(state);
|
|
1145
|
+
}
|
|
1146
|
+
async readStableFile(state, file, scope, projectKey) {
|
|
1147
|
+
const content = await this.repository.readText(file);
|
|
1148
|
+
const expectedHash = state.files[file]?.hash;
|
|
1149
|
+
if (expectedHash !== undefined && memoryFileHash(content) !== expectedHash) {
|
|
1150
|
+
reconcileMarkdown(state, file, scope, projectKey, content, this.timestamp());
|
|
1151
|
+
await this.persist(state);
|
|
1152
|
+
throw new Error(`Memory file changed during update: ${file}`);
|
|
1153
|
+
}
|
|
1154
|
+
return content;
|
|
1155
|
+
}
|
|
1156
|
+
updateRecordValue(current, input, kind) {
|
|
1157
|
+
const source = input.source ?? current.source;
|
|
1158
|
+
const nextInput = {
|
|
1159
|
+
scope: input.scope,
|
|
1160
|
+
projectKey: input.projectKey,
|
|
1161
|
+
memoryClass: input.memoryClass ?? current.memoryClass,
|
|
1162
|
+
title: input.title ?? current.title,
|
|
1163
|
+
reason: input.reason ?? current.reason,
|
|
1164
|
+
category: input.category ?? current.category,
|
|
1165
|
+
text: input.text ?? current.text,
|
|
1166
|
+
memoryType: input.memoryType ?? current.memoryType,
|
|
1167
|
+
tags: input.tags ?? current.tags,
|
|
1168
|
+
pathPatterns: input.pathPatterns ?? current.pathPatterns,
|
|
1169
|
+
taskTypes: input.taskTypes ?? current.taskTypes,
|
|
1170
|
+
operations: input.operations ?? current.operations,
|
|
1171
|
+
phases: input.phases ?? current.phases,
|
|
1172
|
+
episode: input.episode ?? current.episode,
|
|
1173
|
+
candidateKey: input.candidateKey ?? current.candidateKey,
|
|
1174
|
+
language: input.language ?? current.language,
|
|
1175
|
+
source,
|
|
1176
|
+
};
|
|
1177
|
+
return {
|
|
1178
|
+
...current,
|
|
1179
|
+
identity: memoryIdentity(nextInput),
|
|
1180
|
+
memoryClass: nextInput.memoryClass,
|
|
1181
|
+
...(nextInput.title === undefined ? {} : { title: nextInput.title }),
|
|
1182
|
+
...(nextInput.reason === undefined ? {} : { reason: nextInput.reason }),
|
|
1183
|
+
category: nextInput.category,
|
|
1184
|
+
text: nextInput.text,
|
|
1185
|
+
tags: normalizeArray(nextInput.tags),
|
|
1186
|
+
pathPatterns: normalizeArray(nextInput.pathPatterns),
|
|
1187
|
+
taskTypes: normalizeArray(nextInput.taskTypes),
|
|
1188
|
+
operations: normalizeArray(nextInput.operations),
|
|
1189
|
+
phases: normalizeArray(nextInput.phases),
|
|
1190
|
+
kind,
|
|
1191
|
+
authority: kind,
|
|
1192
|
+
state: 'proven',
|
|
1193
|
+
source,
|
|
1194
|
+
sources: mergeSources(current.sources, [source]),
|
|
1195
|
+
evidence: mergeMemoryEvidence(current.evidence, normalizeMemoryEvidence(nextInput.evidence, source, nextInput.text, this.timestamp())),
|
|
1196
|
+
memoryType: nextInput.memoryType ?? current.memoryType,
|
|
1197
|
+
...((nextInput.memoryType ?? current.memoryType) === 'personal-episode'
|
|
1198
|
+
? { episode: normalizePersonalEpisode(nextInput.episode, nextInput) }
|
|
1199
|
+
: { episode: undefined }),
|
|
1200
|
+
updatedAt: this.timestamp(),
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
timestamp() {
|
|
1204
|
+
return this.now().toISOString();
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
function mutableState(raw) {
|
|
1208
|
+
const normalizeRecord = (entry) => {
|
|
1209
|
+
const memoryType = entry.memoryType ?? inferPersonalMemoryType(entry, entry.kind);
|
|
1210
|
+
const normalized = {
|
|
1211
|
+
...entry,
|
|
1212
|
+
phases: [...(entry.phases ?? [])],
|
|
1213
|
+
authority: entry.authority ?? entry.kind,
|
|
1214
|
+
evidence: (entry.evidence ?? []).map(cloneExperienceEvidence),
|
|
1215
|
+
memoryType,
|
|
1216
|
+
...(memoryType === 'personal-episode'
|
|
1217
|
+
? { episode: normalizePersonalEpisode(entry.episode, entry) }
|
|
1218
|
+
: {}),
|
|
1219
|
+
};
|
|
1220
|
+
if (entry.scope === 'global' && entry.projectKey !== undefined) {
|
|
1221
|
+
const { projectKey, ...withoutProjectKey } = normalized;
|
|
1222
|
+
void projectKey;
|
|
1223
|
+
return { ...withoutProjectKey, identity: memoryIdentity(withoutProjectKey) };
|
|
1224
|
+
}
|
|
1225
|
+
return { ...normalized, identity: memoryIdentity(normalized) };
|
|
1226
|
+
};
|
|
1227
|
+
return {
|
|
1228
|
+
version: 3,
|
|
1229
|
+
records: raw.records.map(normalizeRecord),
|
|
1230
|
+
history: Object.fromEntries(Object.entries(raw.history).map(([id, entries]) => [id, entries.map(normalizeRecord)])),
|
|
1231
|
+
observations: raw.observations.map((entry) => ({
|
|
1232
|
+
...entry,
|
|
1233
|
+
changeId: entry.changeId ?? entry.source.changeId ?? entry.key,
|
|
1234
|
+
candidateKey: entry.candidateKey ?? entry.identity,
|
|
1235
|
+
...(entry.projectIdentity === undefined && entry.projectKey === undefined
|
|
1236
|
+
? {}
|
|
1237
|
+
: { projectIdentity: entry.projectIdentity ?? entry.projectKey }),
|
|
1238
|
+
})),
|
|
1239
|
+
conflicts: [...raw.conflicts],
|
|
1240
|
+
tombstones: normalizeTombstones(raw),
|
|
1241
|
+
settings: {
|
|
1242
|
+
learningEnabled: raw.settings.learningEnabled,
|
|
1243
|
+
retrievalEnabled: raw.settings.retrievalEnabled,
|
|
1244
|
+
pausedProjects: [...raw.settings.pausedProjects],
|
|
1245
|
+
pausedLearningProjects: [
|
|
1246
|
+
...(raw.settings.pausedLearningProjects ?? raw.settings.pausedProjects ?? []),
|
|
1247
|
+
],
|
|
1248
|
+
pausedRetrievalProjects: [
|
|
1249
|
+
...(raw.settings.pausedRetrievalProjects ?? raw.settings.pausedProjects ?? []),
|
|
1250
|
+
],
|
|
1251
|
+
},
|
|
1252
|
+
files: { ...raw.files },
|
|
1253
|
+
projectFiles: { ...(raw.projectFiles ?? {}) },
|
|
1254
|
+
evidence: raw.evidence ?? {},
|
|
1255
|
+
appliedMutationIds: [...(raw.appliedMutationIds ?? [])],
|
|
1256
|
+
applicationOutcomes: { ...(raw.applicationOutcomes ?? {}) },
|
|
1257
|
+
feedbackState: { ...(raw.feedbackState ?? {}) },
|
|
1258
|
+
pendingFileProjections: { ...(raw.pendingFileProjections ?? {}) },
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
function negativeContextOutcome(outcome) {
|
|
1262
|
+
return outcome === 'corrected' || outcome === 'contributed-to-failure';
|
|
1263
|
+
}
|
|
1264
|
+
function appendBoundedMutationId(ids, id) {
|
|
1265
|
+
if (ids.includes(id))
|
|
1266
|
+
return [...ids];
|
|
1267
|
+
return [...ids, id].slice(-10_000);
|
|
1268
|
+
}
|
|
1269
|
+
function cloneRecord(record) {
|
|
1270
|
+
return {
|
|
1271
|
+
...record,
|
|
1272
|
+
tags: [...record.tags],
|
|
1273
|
+
pathPatterns: [...record.pathPatterns],
|
|
1274
|
+
taskTypes: [...record.taskTypes],
|
|
1275
|
+
operations: [...record.operations],
|
|
1276
|
+
phases: [...record.phases],
|
|
1277
|
+
evidence: record.evidence.map(cloneExperienceEvidence),
|
|
1278
|
+
...(record.episode === undefined ? {} : { episode: { ...record.episode } }),
|
|
1279
|
+
source: { ...record.source },
|
|
1280
|
+
sources: record.sources.map((source) => ({ ...source })),
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function projectManagementRecord(state, record) {
|
|
1284
|
+
const evidenceKeys = state.evidence[record.id] ?? [];
|
|
1285
|
+
const evidenceDates = state.observations
|
|
1286
|
+
.filter((entry) => evidenceKeys.includes(entry.key))
|
|
1287
|
+
.map((entry) => entry.observedAt);
|
|
1288
|
+
const tombstoned = state.tombstones.some((entry) => entry.recordId === record.id || entry.identity === record.identity);
|
|
1289
|
+
const conflicted = isConflictedInferred(state.conflicts, record);
|
|
1290
|
+
const status = tombstoned
|
|
1291
|
+
? 'tombstoned'
|
|
1292
|
+
: conflicted
|
|
1293
|
+
? 'conflict'
|
|
1294
|
+
: record.state;
|
|
1295
|
+
return {
|
|
1296
|
+
id: record.id,
|
|
1297
|
+
scope: record.scope,
|
|
1298
|
+
...(record.projectKey === undefined ? {} : { projectKey: record.projectKey }),
|
|
1299
|
+
memoryClass: record.memoryClass ?? inferMemoryClass(record),
|
|
1300
|
+
...(record.title === undefined ? {} : { title: record.title }),
|
|
1301
|
+
...(record.reason === undefined ? {} : { reason: record.reason }),
|
|
1302
|
+
category: record.category,
|
|
1303
|
+
text: record.text,
|
|
1304
|
+
tags: [...record.tags],
|
|
1305
|
+
pathPatterns: [...record.pathPatterns],
|
|
1306
|
+
taskTypes: [...record.taskTypes],
|
|
1307
|
+
operations: [...record.operations],
|
|
1308
|
+
phases: [...record.phases],
|
|
1309
|
+
...(record.language === undefined ? {} : { language: record.language }),
|
|
1310
|
+
kind: record.kind,
|
|
1311
|
+
authority: record.authority,
|
|
1312
|
+
evidence: record.evidence.map(cloneExperienceEvidence),
|
|
1313
|
+
...(record.episode === undefined ? {} : { episode: { ...record.episode } }),
|
|
1314
|
+
memoryType: record.memoryType,
|
|
1315
|
+
applicationCount: record.applicationCount,
|
|
1316
|
+
successCount: record.successCount,
|
|
1317
|
+
failureCount: record.failureCount,
|
|
1318
|
+
...(record.lastAppliedAt === undefined ? {} : { lastAppliedAt: record.lastAppliedAt }),
|
|
1319
|
+
status,
|
|
1320
|
+
evidenceCount: evidenceKeys.length,
|
|
1321
|
+
sourceKind: record.source.kind,
|
|
1322
|
+
lastConfirmedAt: [...evidenceDates, record.updatedAt].sort().at(-1) ?? record.updatedAt,
|
|
1323
|
+
updatedAt: record.updatedAt,
|
|
1324
|
+
canRollback: (state.history[record.id]?.length ?? 0) > 0,
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
function projectManagementConflict(conflict, candidateIds) {
|
|
1328
|
+
const recordIds = [...(conflict.recordIds ?? [])].sort();
|
|
1329
|
+
if (recordIds.length === 0 || !recordIds.some((id) => candidateIds.has(id)))
|
|
1330
|
+
return null;
|
|
1331
|
+
return {
|
|
1332
|
+
texts: [...conflict.texts],
|
|
1333
|
+
updatedAt: conflict.updatedAt,
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
function createRecord(input, kind, source, timestamp, identity) {
|
|
1337
|
+
const memoryType = input.memoryType ?? inferPersonalMemoryType(input, kind);
|
|
1338
|
+
return {
|
|
1339
|
+
id: createHash('sha256')
|
|
1340
|
+
.update(`${identity}\n${normalizeText(input.text)}\n${randomUUID()}`)
|
|
1341
|
+
.digest('hex')
|
|
1342
|
+
.slice(0, 24),
|
|
1343
|
+
identity,
|
|
1344
|
+
scope: input.scope,
|
|
1345
|
+
...(input.projectKey === undefined ? {} : { projectKey: input.projectKey }),
|
|
1346
|
+
memoryClass: input.memoryClass ?? inferMemoryClass(input),
|
|
1347
|
+
...(input.title === undefined ? {} : { title: input.title.trim() }),
|
|
1348
|
+
...(input.reason === undefined ? {} : { reason: input.reason.trim() }),
|
|
1349
|
+
category: input.category.trim(),
|
|
1350
|
+
text: input.text.trim(),
|
|
1351
|
+
tags: normalizeArray(input.tags),
|
|
1352
|
+
pathPatterns: normalizeArray(input.pathPatterns),
|
|
1353
|
+
taskTypes: normalizeArray(input.taskTypes),
|
|
1354
|
+
operations: normalizeArray(input.operations),
|
|
1355
|
+
phases: normalizeArray(input.phases),
|
|
1356
|
+
...(input.candidateKey === undefined ? {} : { candidateKey: input.candidateKey }),
|
|
1357
|
+
...(input.language === undefined ? {} : { language: input.language }),
|
|
1358
|
+
kind,
|
|
1359
|
+
authority: kind,
|
|
1360
|
+
evidence: normalizeMemoryEvidence(input.evidence, source, input.text, timestamp),
|
|
1361
|
+
memoryType,
|
|
1362
|
+
...(memoryType === 'personal-episode'
|
|
1363
|
+
? { episode: normalizePersonalEpisode(input.episode, input) }
|
|
1364
|
+
: {}),
|
|
1365
|
+
state: kind === 'explicit' ? 'proven' : 'trial',
|
|
1366
|
+
applicationCount: 0,
|
|
1367
|
+
successCount: 0,
|
|
1368
|
+
failureCount: 0,
|
|
1369
|
+
source,
|
|
1370
|
+
sources: [source],
|
|
1371
|
+
createdAt: timestamp,
|
|
1372
|
+
updatedAt: timestamp,
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function addSource(record, source, timestamp) {
|
|
1376
|
+
return {
|
|
1377
|
+
...record,
|
|
1378
|
+
source: record.source,
|
|
1379
|
+
sources: mergeSources(record.sources, [source]),
|
|
1380
|
+
evidence: mergeMemoryEvidence(record.evidence, normalizeMemoryEvidence(undefined, source, record.text, timestamp)),
|
|
1381
|
+
updatedAt: timestamp,
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function mergeSources(current, additions) {
|
|
1385
|
+
const result = [...current];
|
|
1386
|
+
for (const source of additions) {
|
|
1387
|
+
if (result.some((entry) => JSON.stringify(entry) === JSON.stringify(source)))
|
|
1388
|
+
continue;
|
|
1389
|
+
result.push(source);
|
|
1390
|
+
}
|
|
1391
|
+
return result.slice(-MAX_SOURCES);
|
|
1392
|
+
}
|
|
1393
|
+
function normalizeMemoryEvidence(values, source, text, _timestamp) {
|
|
1394
|
+
const sourceLabel = source.label ?? source.changeId ?? source.workflow ?? source.projectKey;
|
|
1395
|
+
const digest = createHash('sha256')
|
|
1396
|
+
.update(JSON.stringify({ source, text: normalizeText(text) }))
|
|
1397
|
+
.digest('hex');
|
|
1398
|
+
const inferred = {
|
|
1399
|
+
id: `memory-evidence:${digest.slice(0, 20)}`,
|
|
1400
|
+
kind: source.kind === 'user'
|
|
1401
|
+
? 'user'
|
|
1402
|
+
: source.kind === 'repository'
|
|
1403
|
+
? 'source'
|
|
1404
|
+
: source.kind === 'review'
|
|
1405
|
+
? 'review'
|
|
1406
|
+
: 'outcome',
|
|
1407
|
+
summary: text.slice(0, 500),
|
|
1408
|
+
...(sourceLabel === undefined ? {} : { source: sourceLabel }),
|
|
1409
|
+
digest,
|
|
1410
|
+
success: true,
|
|
1411
|
+
};
|
|
1412
|
+
return mergeMemoryEvidence(values ?? [], [inferred]);
|
|
1413
|
+
}
|
|
1414
|
+
function mergeMemoryEvidence(current, additions) {
|
|
1415
|
+
const merged = new Map();
|
|
1416
|
+
for (const evidence of [...current, ...additions]) {
|
|
1417
|
+
const clone = cloneExperienceEvidence(evidence);
|
|
1418
|
+
merged.set(clone.digest ?? clone.id, clone);
|
|
1419
|
+
}
|
|
1420
|
+
return [...merged.values()].slice(-32);
|
|
1421
|
+
}
|
|
1422
|
+
function cloneExperienceEvidence(evidence) {
|
|
1423
|
+
return { ...evidence };
|
|
1424
|
+
}
|
|
1425
|
+
function replaceRecord(records, next) {
|
|
1426
|
+
let found = false;
|
|
1427
|
+
const updated = records.map((entry) => {
|
|
1428
|
+
if (entry.id !== next.id)
|
|
1429
|
+
return entry;
|
|
1430
|
+
found = true;
|
|
1431
|
+
return next;
|
|
1432
|
+
});
|
|
1433
|
+
return found ? updated : [...updated, next];
|
|
1434
|
+
}
|
|
1435
|
+
function pushHistory(state, record) {
|
|
1436
|
+
state.history[record.id] = [...(state.history[record.id] ?? []), { ...record }].slice(-10);
|
|
1437
|
+
}
|
|
1438
|
+
function clearInferredCandidates(state, identity) {
|
|
1439
|
+
const candidates = state.records.filter((entry) => entry.identity === identity && entry.kind === 'inferred' && entry.state === 'trial');
|
|
1440
|
+
for (const candidate of candidates) {
|
|
1441
|
+
state.records = state.records.filter((entry) => entry.id !== candidate.id);
|
|
1442
|
+
delete state.evidence[candidate.id];
|
|
1443
|
+
}
|
|
1444
|
+
state.conflicts = state.conflicts.filter((conflict) => conflict.identity !== identity);
|
|
1445
|
+
}
|
|
1446
|
+
function normalizeText(value) {
|
|
1447
|
+
return value.normalize('NFC').replace(/\s+/gu, ' ').trim().toLocaleLowerCase();
|
|
1448
|
+
}
|
|
1449
|
+
function normalizeArray(values) {
|
|
1450
|
+
return [...new Set((values ?? []).map((value) => value.trim()).filter(Boolean))].sort();
|
|
1451
|
+
}
|
|
1452
|
+
function memoryIdentity(input) {
|
|
1453
|
+
const semanticIdentity = input.candidateKey === undefined
|
|
1454
|
+
? ['category', normalizeText(input.category)]
|
|
1455
|
+
: ['candidate', input.candidateKey];
|
|
1456
|
+
return JSON.stringify([
|
|
1457
|
+
input.scope,
|
|
1458
|
+
input.scope === 'project' ? (input.projectKey ?? '') : '',
|
|
1459
|
+
input.memoryType ?? '',
|
|
1460
|
+
input.memoryClass ?? inferMemoryClass(input),
|
|
1461
|
+
semanticIdentity,
|
|
1462
|
+
normalizeArray(input.tags),
|
|
1463
|
+
normalizeArray(input.pathPatterns),
|
|
1464
|
+
normalizeArray(input.taskTypes),
|
|
1465
|
+
normalizeArray(input.operations),
|
|
1466
|
+
normalizeArray(input.phases),
|
|
1467
|
+
]);
|
|
1468
|
+
}
|
|
1469
|
+
function memoryShapeIdentity(input) {
|
|
1470
|
+
return memoryIdentity({ ...input, candidateKey: undefined });
|
|
1471
|
+
}
|
|
1472
|
+
function observationKey(observation, projectIdentity, candidateKey) {
|
|
1473
|
+
// Comet keeps a stable change id while a change is resumed or upgraded
|
|
1474
|
+
// between presets (for example hotfix/tweak -> full). The workflow label
|
|
1475
|
+
// is retained as source metadata, but must not turn one change into two
|
|
1476
|
+
// independent observations.
|
|
1477
|
+
return JSON.stringify([projectIdentity ?? '', observation.changeId.trim(), candidateKey]);
|
|
1478
|
+
}
|
|
1479
|
+
function observationInput(observation, source) {
|
|
1480
|
+
return {
|
|
1481
|
+
scope: observation.scope,
|
|
1482
|
+
...(observation.scope === 'project' && observation.projectKey !== undefined
|
|
1483
|
+
? { projectKey: observation.projectKey }
|
|
1484
|
+
: {}),
|
|
1485
|
+
...(observation.memoryType === undefined ? {} : { memoryType: observation.memoryType }),
|
|
1486
|
+
memoryClass: observation.memoryClass ?? inferMemoryClass(observation),
|
|
1487
|
+
...(observation.language === undefined ? {} : { language: observation.language }),
|
|
1488
|
+
...(observation.title === undefined ? {} : { title: observation.title }),
|
|
1489
|
+
...(observation.reason === undefined ? {} : { reason: observation.reason }),
|
|
1490
|
+
category: observation.category,
|
|
1491
|
+
text: observation.text,
|
|
1492
|
+
tags: observation.tags,
|
|
1493
|
+
pathPatterns: observation.pathPatterns,
|
|
1494
|
+
taskTypes: observation.taskTypes,
|
|
1495
|
+
operations: observation.operations,
|
|
1496
|
+
phases: observation.phases,
|
|
1497
|
+
evidence: observation.evidence,
|
|
1498
|
+
episode: observation.episode,
|
|
1499
|
+
candidateKey: observation.candidateKey,
|
|
1500
|
+
source,
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
function fileState(content, timestamp) {
|
|
1504
|
+
return { hash: hashMemoryText(content), observedAt: timestamp };
|
|
1505
|
+
}
|
|
1506
|
+
function memoryFileHash(content) {
|
|
1507
|
+
return content === null ? '' : hashMemoryText(content);
|
|
1508
|
+
}
|
|
1509
|
+
function parseMarkdown(content) {
|
|
1510
|
+
const lines = content.replace(/\r\n?/gu, '\n').split('\n');
|
|
1511
|
+
let category = '其他';
|
|
1512
|
+
const bullets = [];
|
|
1513
|
+
lines.forEach((line, index) => {
|
|
1514
|
+
const heading = /^(?:#{2,6})\s+(.+?)\s*#*\s*$/u.exec(line);
|
|
1515
|
+
if (heading)
|
|
1516
|
+
category = heading[1].trim();
|
|
1517
|
+
const bullet = /^\s*[-*+]\s+(.+?)\s*$/u.exec(line);
|
|
1518
|
+
if (bullet && bullet[1].trim().length > 0)
|
|
1519
|
+
bullets.push({ category, text: bullet[1].trim(), line: index });
|
|
1520
|
+
});
|
|
1521
|
+
return bullets;
|
|
1522
|
+
}
|
|
1523
|
+
function reconcileMarkdown(state, file, scope, projectKey, content, timestamp) {
|
|
1524
|
+
const hash = content === null ? '' : hashMemoryText(content);
|
|
1525
|
+
const previous = state.files[file]?.hash;
|
|
1526
|
+
if (previous === hash)
|
|
1527
|
+
return;
|
|
1528
|
+
const bullets = content === null ? [] : parseMarkdown(content);
|
|
1529
|
+
const known = state.records.filter((entry) => entry.scope === scope && entry.projectKey === projectKey);
|
|
1530
|
+
for (const record of known) {
|
|
1531
|
+
if (record.state === 'superseded')
|
|
1532
|
+
continue;
|
|
1533
|
+
const stillPresent = bullets.some((bullet) => normalizeText(bullet.text) === normalizeText(record.text));
|
|
1534
|
+
if (!stillPresent) {
|
|
1535
|
+
pushHistory(state, record);
|
|
1536
|
+
state.records = replaceRecord(state.records, {
|
|
1537
|
+
...record,
|
|
1538
|
+
state: 'superseded',
|
|
1539
|
+
updatedAt: timestamp,
|
|
1540
|
+
});
|
|
1541
|
+
delete state.evidence[record.id];
|
|
1542
|
+
state.tombstones = upsertTombstone(state.tombstones, {
|
|
1543
|
+
identity: record.identity,
|
|
1544
|
+
scope: record.scope,
|
|
1545
|
+
...(record.projectKey === undefined ? {} : { projectKey: record.projectKey }),
|
|
1546
|
+
recordId: record.id,
|
|
1547
|
+
textHash: normalizedMemoryTextHash(record.text),
|
|
1548
|
+
reason: 'markdown-delete',
|
|
1549
|
+
removedAt: timestamp,
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
const seen = new Set();
|
|
1554
|
+
for (const bullet of bullets) {
|
|
1555
|
+
const normalized = normalizeText(bullet.text);
|
|
1556
|
+
if (seen.has(normalized))
|
|
1557
|
+
continue;
|
|
1558
|
+
seen.add(normalized);
|
|
1559
|
+
if (isTombstonedMarkdownText(state.tombstones, scope, projectKey, bullet.text))
|
|
1560
|
+
continue;
|
|
1561
|
+
const matched = known.find((record) => record.state !== 'superseded' && normalizeText(record.text) === normalized);
|
|
1562
|
+
if (matched !== undefined) {
|
|
1563
|
+
if (normalizeText(matched.category) !== normalizeText(bullet.category)) {
|
|
1564
|
+
pushHistory(state, matched);
|
|
1565
|
+
const input = {
|
|
1566
|
+
scope,
|
|
1567
|
+
...(projectKey ? { projectKey } : {}),
|
|
1568
|
+
memoryType: matched.memoryType,
|
|
1569
|
+
memoryClass: matched.memoryClass,
|
|
1570
|
+
category: bullet.category,
|
|
1571
|
+
text: bullet.text,
|
|
1572
|
+
tags: matched.tags,
|
|
1573
|
+
pathPatterns: matched.pathPatterns,
|
|
1574
|
+
taskTypes: matched.taskTypes,
|
|
1575
|
+
operations: matched.operations,
|
|
1576
|
+
source: { kind: 'user' },
|
|
1577
|
+
};
|
|
1578
|
+
state.records = replaceRecord(state.records, {
|
|
1579
|
+
...matched,
|
|
1580
|
+
identity: memoryIdentity(input),
|
|
1581
|
+
category: bullet.category,
|
|
1582
|
+
kind: 'explicit',
|
|
1583
|
+
source: { kind: 'user' },
|
|
1584
|
+
sources: mergeSources(matched.sources, [{ kind: 'user' }]),
|
|
1585
|
+
updatedAt: timestamp,
|
|
1586
|
+
});
|
|
1587
|
+
clearTombstone(state, matched.identity);
|
|
1588
|
+
}
|
|
1589
|
+
continue;
|
|
1590
|
+
}
|
|
1591
|
+
const input = {
|
|
1592
|
+
scope,
|
|
1593
|
+
...(projectKey ? { projectKey } : {}),
|
|
1594
|
+
memoryType: inferPersonalMemoryType({ scope, category: bullet.category }, 'explicit'),
|
|
1595
|
+
category: bullet.category,
|
|
1596
|
+
text: bullet.text,
|
|
1597
|
+
};
|
|
1598
|
+
const identity = memoryIdentity(input);
|
|
1599
|
+
clearTombstone(state, identity);
|
|
1600
|
+
const record = createRecord(input, 'explicit', input.source ?? { kind: 'user' }, timestamp, identity);
|
|
1601
|
+
state.records.push(record);
|
|
1602
|
+
}
|
|
1603
|
+
state.files[file] = { hash, observedAt: timestamp };
|
|
1604
|
+
}
|
|
1605
|
+
function appendMarkdownBullet(content, category, text, scope, language) {
|
|
1606
|
+
const heading = `## ${category.trim()}`;
|
|
1607
|
+
if (content.trim().length === 0) {
|
|
1608
|
+
const title = scope === 'global'
|
|
1609
|
+
? language === 'en'
|
|
1610
|
+
? '# Personal Profile'
|
|
1611
|
+
: '# 个人画像'
|
|
1612
|
+
: language === 'en'
|
|
1613
|
+
? '# Project Memory'
|
|
1614
|
+
: '# 项目记忆';
|
|
1615
|
+
return `${title}\n\n${heading}\n\n- ${text.trim()}\n`;
|
|
1616
|
+
}
|
|
1617
|
+
const lines = content.replace(/\r\n?/gu, '\n').split('\n');
|
|
1618
|
+
const headingIndex = lines.findIndex((line) => normalizeText(line.replace(/^#{2,6}\s+/u, '')) === normalizeText(category) &&
|
|
1619
|
+
/^#{2,6}\s+/u.test(line));
|
|
1620
|
+
if (headingIndex === -1) {
|
|
1621
|
+
const prefix = content.endsWith('\n') ? content : `${content}\n`;
|
|
1622
|
+
return `${prefix}\n${heading}\n\n- ${text.trim()}\n`;
|
|
1623
|
+
}
|
|
1624
|
+
let insertAt = lines.length;
|
|
1625
|
+
for (let index = headingIndex + 1; index < lines.length; index += 1) {
|
|
1626
|
+
if (/^#{1,6}\s+/u.test(lines[index] ?? '')) {
|
|
1627
|
+
insertAt = index;
|
|
1628
|
+
break;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
lines.splice(insertAt, 0, `- ${text.trim()}`);
|
|
1632
|
+
return `${lines.join('\n').replace(/\n*$/u, '')}\n`;
|
|
1633
|
+
}
|
|
1634
|
+
function replaceMarkdownBullet(content, previousText, nextText, category, previousCategory, scope, language) {
|
|
1635
|
+
const lines = content.replace(/\r\n?/gu, '\n').split('\n');
|
|
1636
|
+
const index = lines.findIndex((line) => {
|
|
1637
|
+
const bullet = /^\s*([-*+])\s+(.+?)\s*$/u.exec(line);
|
|
1638
|
+
return bullet !== null && normalizeText(bullet[2]) === normalizeText(previousText);
|
|
1639
|
+
});
|
|
1640
|
+
if (index >= 0) {
|
|
1641
|
+
if (previousCategory !== undefined &&
|
|
1642
|
+
normalizeText(previousCategory) !== normalizeText(category)) {
|
|
1643
|
+
lines.splice(index, 1);
|
|
1644
|
+
return appendMarkdownBullet(`${lines.join('\n').replace(/\n*$/u, '')}\n`, category, nextText, scope, language);
|
|
1645
|
+
}
|
|
1646
|
+
const marker = /^\s*([-*+])\s+/u.exec(lines[index] ?? '')?.[1] ?? '-';
|
|
1647
|
+
lines[index] = `${marker} ${nextText.trim()}`;
|
|
1648
|
+
return `${lines.join('\n').replace(/\n*$/u, '')}\n`;
|
|
1649
|
+
}
|
|
1650
|
+
return appendMarkdownBullet(content, category, nextText, scope, language);
|
|
1651
|
+
}
|
|
1652
|
+
function removeMarkdownBullet(content, text, category) {
|
|
1653
|
+
const lines = content.replace(/\r\n?/gu, '\n').split('\n');
|
|
1654
|
+
let currentCategory = '其他';
|
|
1655
|
+
const index = lines.findIndex((line) => {
|
|
1656
|
+
const heading = /^(?:#{2,6})\s+(.+?)\s*#*\s*$/u.exec(line);
|
|
1657
|
+
if (heading) {
|
|
1658
|
+
currentCategory = heading[1].trim();
|
|
1659
|
+
return false;
|
|
1660
|
+
}
|
|
1661
|
+
const bullet = /^\s*[-*+]\s+(.+?)\s*$/u.exec(line);
|
|
1662
|
+
return (bullet !== null &&
|
|
1663
|
+
normalizeText(bullet[1]) === normalizeText(text) &&
|
|
1664
|
+
(category === undefined || normalizeText(currentCategory) === normalizeText(category)));
|
|
1665
|
+
});
|
|
1666
|
+
if (index < 0)
|
|
1667
|
+
return content;
|
|
1668
|
+
lines.splice(index, 1);
|
|
1669
|
+
return `${lines.join('\n').replace(/\n*$/u, '')}\n`;
|
|
1670
|
+
}
|
|
1671
|
+
function buildContextRetrieval(state, query, profileMaxChars, taskMaxChars) {
|
|
1672
|
+
const active = state.records
|
|
1673
|
+
.filter((entry) => entry.state !== 'superseded' &&
|
|
1674
|
+
(entry.state !== 'trial' || trialIsEligibleForRetrieval(state, entry)))
|
|
1675
|
+
.filter((entry) => !isConflictedInferred(state.conflicts, entry));
|
|
1676
|
+
const profileCandidates = active
|
|
1677
|
+
.filter(isUserProfileRecord)
|
|
1678
|
+
.sort((left, right) => profilePriority(left) - profilePriority(right) || compareRecords(left, right, query));
|
|
1679
|
+
const profileSelection = selectWithinChars(profileCandidates, profileMaxChars);
|
|
1680
|
+
const profileIds = new Set(profileSelection.records.map((entry) => entry.id));
|
|
1681
|
+
const taskSelection = query.view === 'profile'
|
|
1682
|
+
? { records: [], truncated: false }
|
|
1683
|
+
: selectWithinChars(active
|
|
1684
|
+
.filter((entry) => !profileIds.has(entry.id))
|
|
1685
|
+
.filter((entry) => scopeMatches(entry, query))
|
|
1686
|
+
.filter((entry) => attributesMatch(entry, query))
|
|
1687
|
+
.map((entry) => ({ record: entry, score: scoreRecord(entry, query) }))
|
|
1688
|
+
.filter(({ score }) => score > 0 || query.query === undefined)
|
|
1689
|
+
.sort((left, right) => right.score - left.score || compareRecords(left.record, right.record, query))
|
|
1690
|
+
.map(({ record }) => record), taskMaxChars);
|
|
1691
|
+
const profileText = renderRetrieval(profileSelection.records);
|
|
1692
|
+
const taskText = renderRetrieval(taskSelection.records);
|
|
1693
|
+
const sections = [
|
|
1694
|
+
profileText ? `## User Profile\n${profileText}` : '',
|
|
1695
|
+
taskText ? `## Relevant personal memory\n${taskText}` : '',
|
|
1696
|
+
].filter(Boolean);
|
|
1697
|
+
return {
|
|
1698
|
+
records: [...profileSelection.records, ...taskSelection.records].map(cloneRecord),
|
|
1699
|
+
text: sections.join('\n\n'),
|
|
1700
|
+
truncated: profileSelection.truncated || taskSelection.truncated,
|
|
1701
|
+
disabled: false,
|
|
1702
|
+
profileRecords: profileSelection.records.map(cloneRecord),
|
|
1703
|
+
profileText,
|
|
1704
|
+
taskRecords: taskSelection.records.map(cloneRecord),
|
|
1705
|
+
taskText,
|
|
1706
|
+
profileTruncated: profileSelection.truncated,
|
|
1707
|
+
taskTruncated: taskSelection.truncated,
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
function trialIsEligibleForRetrieval(state, record) {
|
|
1711
|
+
const evidenceKeys = state.evidence[record.id] ?? [];
|
|
1712
|
+
return evidenceKeys.length > 0;
|
|
1713
|
+
}
|
|
1714
|
+
function profileUsedChars(state) {
|
|
1715
|
+
const records = state.records
|
|
1716
|
+
.filter((entry) => entry.state !== 'superseded')
|
|
1717
|
+
.filter((entry) => !isConflictedInferred(state.conflicts, entry))
|
|
1718
|
+
.filter(isUserProfileRecord)
|
|
1719
|
+
.sort((left, right) => profilePriority(left) - profilePriority(right) ||
|
|
1720
|
+
compareRecords(left, right, { view: 'profile' }));
|
|
1721
|
+
return unicodeLength(renderRetrieval(records));
|
|
1722
|
+
}
|
|
1723
|
+
function isUserProfileRecord(record) {
|
|
1724
|
+
if (record.scope !== 'global' || record.memoryType !== 'core-profile')
|
|
1725
|
+
return false;
|
|
1726
|
+
if (record.pathPatterns.length > 0 ||
|
|
1727
|
+
record.taskTypes.length > 0 ||
|
|
1728
|
+
record.operations.length > 0 ||
|
|
1729
|
+
record.phases.length > 0)
|
|
1730
|
+
return false;
|
|
1731
|
+
const memoryClass = record.memoryClass ?? inferMemoryClass(record);
|
|
1732
|
+
return (memoryClass === 'user-fact' ||
|
|
1733
|
+
memoryClass === 'user-preference' ||
|
|
1734
|
+
memoryClass === 'collaboration-habit');
|
|
1735
|
+
}
|
|
1736
|
+
function profilePriority(record) {
|
|
1737
|
+
switch (record.memoryClass ?? inferMemoryClass(record)) {
|
|
1738
|
+
case 'user-fact':
|
|
1739
|
+
return 0;
|
|
1740
|
+
case 'user-preference':
|
|
1741
|
+
return 1;
|
|
1742
|
+
case 'collaboration-habit':
|
|
1743
|
+
return 2;
|
|
1744
|
+
default:
|
|
1745
|
+
return 3;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
function inferMemoryClass(value) {
|
|
1749
|
+
if (value.memoryClass !== undefined)
|
|
1750
|
+
return value.memoryClass;
|
|
1751
|
+
if (value.scope === 'project')
|
|
1752
|
+
return 'project-convention';
|
|
1753
|
+
if (/(?:用户事实|身份|姓名|角色|时区|user\s*fact|identity|timezone)/iu.test(value.category))
|
|
1754
|
+
return 'user-fact';
|
|
1755
|
+
if (/(?:协作|习惯|workflow|collaboration|habit)/iu.test(value.category))
|
|
1756
|
+
return 'collaboration-habit';
|
|
1757
|
+
return 'user-preference';
|
|
1758
|
+
}
|
|
1759
|
+
function inferPersonalMemoryType(value, kind) {
|
|
1760
|
+
const memoryClass = value.memoryClass ?? inferMemoryClass(value);
|
|
1761
|
+
if (kind === 'inferred') {
|
|
1762
|
+
return memoryClass === 'collaboration-habit' || memoryClass === 'project-convention'
|
|
1763
|
+
? 'collaboration-policy'
|
|
1764
|
+
: 'personal-episode';
|
|
1765
|
+
}
|
|
1766
|
+
return memoryClass === 'user-fact' || memoryClass === 'user-preference'
|
|
1767
|
+
? 'core-profile'
|
|
1768
|
+
: 'collaboration-policy';
|
|
1769
|
+
}
|
|
1770
|
+
function isPersonalMemoryType(value) {
|
|
1771
|
+
return (value === 'core-profile' || value === 'collaboration-policy' || value === 'personal-episode');
|
|
1772
|
+
}
|
|
1773
|
+
function personalEpisodeFromPayload(value) {
|
|
1774
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
1775
|
+
return undefined;
|
|
1776
|
+
const candidate = value;
|
|
1777
|
+
if (typeof candidate.situation !== 'string' ||
|
|
1778
|
+
typeof candidate.actionSummary !== 'string' ||
|
|
1779
|
+
typeof candidate.outcome !== 'string' ||
|
|
1780
|
+
typeof candidate.lesson !== 'string') {
|
|
1781
|
+
return undefined;
|
|
1782
|
+
}
|
|
1783
|
+
return {
|
|
1784
|
+
situation: candidate.situation,
|
|
1785
|
+
actionSummary: candidate.actionSummary,
|
|
1786
|
+
outcome: candidate.outcome,
|
|
1787
|
+
lesson: candidate.lesson,
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
function selectWithinChars(candidates, maxChars) {
|
|
1791
|
+
const records = [];
|
|
1792
|
+
let truncated = false;
|
|
1793
|
+
for (const candidate of candidates) {
|
|
1794
|
+
const next = [...records, candidate];
|
|
1795
|
+
if (unicodeLength(renderRetrieval(next)) > boundedPositive(maxChars, DEFAULT_TASK_MAX_CHARS)) {
|
|
1796
|
+
truncated = true;
|
|
1797
|
+
continue;
|
|
1798
|
+
}
|
|
1799
|
+
records.push(candidate);
|
|
1800
|
+
}
|
|
1801
|
+
return { records, truncated };
|
|
1802
|
+
}
|
|
1803
|
+
function compareRecords(left, right, _query) {
|
|
1804
|
+
return right.updatedAt.localeCompare(left.updatedAt) || left.id.localeCompare(right.id);
|
|
1805
|
+
}
|
|
1806
|
+
function unicodeLength(value) {
|
|
1807
|
+
return Array.from(value).length;
|
|
1808
|
+
}
|
|
1809
|
+
function scopeMatches(record, query) {
|
|
1810
|
+
if (query.scope !== undefined && record.scope !== query.scope)
|
|
1811
|
+
return false;
|
|
1812
|
+
if (record.scope === 'project' && record.projectKey !== query.projectKey)
|
|
1813
|
+
return false;
|
|
1814
|
+
if (record.scope === 'global' && query.scope === 'project')
|
|
1815
|
+
return false;
|
|
1816
|
+
return true;
|
|
1817
|
+
}
|
|
1818
|
+
function attributesMatch(record, query) {
|
|
1819
|
+
if (query.task !== undefined &&
|
|
1820
|
+
record.taskTypes.length > 0 &&
|
|
1821
|
+
!matchesAny(record.taskTypes, query.task))
|
|
1822
|
+
return false;
|
|
1823
|
+
if (query.path !== undefined &&
|
|
1824
|
+
record.pathPatterns.length > 0 &&
|
|
1825
|
+
!matchesAny(record.pathPatterns, query.path))
|
|
1826
|
+
return false;
|
|
1827
|
+
if (query.operation !== undefined &&
|
|
1828
|
+
record.operations.length > 0 &&
|
|
1829
|
+
!matchesAny(record.operations, query.operation))
|
|
1830
|
+
return false;
|
|
1831
|
+
if (record.phases.length > 0 &&
|
|
1832
|
+
(query.phase === undefined || !matchesAny(record.phases, query.phase)))
|
|
1833
|
+
return false;
|
|
1834
|
+
if (query.category !== undefined && !matchesAny([record.category], query.category))
|
|
1835
|
+
return false;
|
|
1836
|
+
if (query.tags !== undefined && !query.tags.every((tag) => matchesAny(record.tags, tag)))
|
|
1837
|
+
return false;
|
|
1838
|
+
if (query.query !== undefined) {
|
|
1839
|
+
const terms = query.query.split(/\s+/u).map(normalizeText).filter(Boolean);
|
|
1840
|
+
if (terms.length > 0) {
|
|
1841
|
+
const haystack = normalizeText([record.category, record.text, ...record.tags].join(' '));
|
|
1842
|
+
if (!terms.every((term) => haystack.includes(term)))
|
|
1843
|
+
return false;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
return true;
|
|
1847
|
+
}
|
|
1848
|
+
function matchesAny(values, value) {
|
|
1849
|
+
const normalized = normalizeText(value);
|
|
1850
|
+
return values.some((entry) => {
|
|
1851
|
+
const candidate = normalizeText(entry);
|
|
1852
|
+
if (candidate === normalized || candidate.includes(normalized))
|
|
1853
|
+
return true;
|
|
1854
|
+
if (!candidate.includes('*'))
|
|
1855
|
+
return false;
|
|
1856
|
+
const pattern = `^${candidate.split('*').map(escapeRegExp).join('.*')}$`;
|
|
1857
|
+
return new RegExp(pattern, 'u').test(normalized);
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
function escapeRegExp(value) {
|
|
1861
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
1862
|
+
}
|
|
1863
|
+
function scoreRecord(record, query) {
|
|
1864
|
+
let score = record.kind === 'explicit' ? 100 : 60;
|
|
1865
|
+
score += record.state === 'proven' ? 200 : 0;
|
|
1866
|
+
score += Math.min(record.successCount, 5) * 20;
|
|
1867
|
+
score -= Math.min(record.failureCount, 5) * 40;
|
|
1868
|
+
if (record.scope === 'project')
|
|
1869
|
+
score += 50;
|
|
1870
|
+
if (query.task !== undefined && matchesAny(record.taskTypes, query.task))
|
|
1871
|
+
score += 25;
|
|
1872
|
+
if (query.path !== undefined && matchesAny(record.pathPatterns, query.path))
|
|
1873
|
+
score += 25;
|
|
1874
|
+
if (query.operation !== undefined && matchesAny(record.operations, query.operation))
|
|
1875
|
+
score += 25;
|
|
1876
|
+
if (query.phase !== undefined && matchesAny(record.phases, query.phase))
|
|
1877
|
+
score += 25;
|
|
1878
|
+
if (query.category !== undefined && matchesAny([record.category], query.category))
|
|
1879
|
+
score += 20;
|
|
1880
|
+
if (query.tags !== undefined) {
|
|
1881
|
+
score += query.tags.filter((tag) => matchesAny(record.tags, tag)).length * 15;
|
|
1882
|
+
}
|
|
1883
|
+
if (query.query !== undefined) {
|
|
1884
|
+
const terms = query.query.split(/\s+/u).map(normalizeText).filter(Boolean);
|
|
1885
|
+
const haystack = normalizeText([record.category, record.text, ...record.tags].join(' '));
|
|
1886
|
+
for (const term of terms)
|
|
1887
|
+
if (haystack.includes(term))
|
|
1888
|
+
score += 10;
|
|
1889
|
+
}
|
|
1890
|
+
return score;
|
|
1891
|
+
}
|
|
1892
|
+
function normalizePersonalEpisode(episode, record) {
|
|
1893
|
+
const evidence = record.evidence ?? [];
|
|
1894
|
+
const evidenceSummary = evidence
|
|
1895
|
+
.map((entry) => entry.summary.trim())
|
|
1896
|
+
.filter(Boolean)
|
|
1897
|
+
.join(';');
|
|
1898
|
+
const successful = evidence.some((entry) => entry.success === true);
|
|
1899
|
+
const failed = evidence.some((entry) => entry.success === false);
|
|
1900
|
+
const english = record.language === 'en';
|
|
1901
|
+
return {
|
|
1902
|
+
situation: episode?.situation.trim() || record.title?.trim() || record.category.trim(),
|
|
1903
|
+
actionSummary: episode?.actionSummary.trim() || evidenceSummary || record.text.trim(),
|
|
1904
|
+
outcome: episode?.outcome.trim() ||
|
|
1905
|
+
(failed
|
|
1906
|
+
? english
|
|
1907
|
+
? 'Unsuccessful'
|
|
1908
|
+
: '未成功'
|
|
1909
|
+
: successful
|
|
1910
|
+
? english
|
|
1911
|
+
? 'Successful'
|
|
1912
|
+
: '成功'
|
|
1913
|
+
: record.reason?.trim() || (english ? 'Observed' : '已记录')),
|
|
1914
|
+
lesson: episode?.lesson.trim() || record.text.trim(),
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
function renderRetrieval(records) {
|
|
1918
|
+
const groups = new Map();
|
|
1919
|
+
for (const record of records)
|
|
1920
|
+
groups.set(record.category, [...(groups.get(record.category) ?? []), record]);
|
|
1921
|
+
return [...groups.entries()]
|
|
1922
|
+
.map(([category, entries]) => `## ${category}\n${entries.map((entry) => `- ${entry.text}`).join('\n')}`)
|
|
1923
|
+
.join('\n\n');
|
|
1924
|
+
}
|
|
1925
|
+
function isProjectRetrievalPaused(settings, projectKey) {
|
|
1926
|
+
return projectKey !== undefined && settings.pausedRetrievalProjects.includes(projectKey);
|
|
1927
|
+
}
|
|
1928
|
+
function mergePausedProjects(learning, retrieval) {
|
|
1929
|
+
return [...new Set([...learning, ...retrieval])].sort();
|
|
1930
|
+
}
|
|
1931
|
+
function redactRemote(remote) {
|
|
1932
|
+
if (remote === null)
|
|
1933
|
+
return null;
|
|
1934
|
+
try {
|
|
1935
|
+
const parsed = new URL(remote);
|
|
1936
|
+
if (parsed.username || parsed.password) {
|
|
1937
|
+
parsed.username = parsed.username ? '***' : '';
|
|
1938
|
+
parsed.password = parsed.password ? '***' : '';
|
|
1939
|
+
}
|
|
1940
|
+
return parsed.toString().replace(/\/$/u, '');
|
|
1941
|
+
}
|
|
1942
|
+
catch {
|
|
1943
|
+
return remote.replace(/(\/\/)[^/@]+@/u, '$1***@');
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
function boundedPositive(value, fallback) {
|
|
1947
|
+
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
1948
|
+
}
|
|
1949
|
+
function addConflict(conflicts, identity, records, timestamp) {
|
|
1950
|
+
const texts = [
|
|
1951
|
+
...new Set(records.filter((record) => record.identity === identity).map((record) => record.text)),
|
|
1952
|
+
].sort();
|
|
1953
|
+
const recordIds = [...new Set(records.map((record) => record.id))].sort();
|
|
1954
|
+
const next = { identity, texts, recordIds, updatedAt: timestamp };
|
|
1955
|
+
return [...conflicts.filter((conflict) => conflict.identity !== identity), next];
|
|
1956
|
+
}
|
|
1957
|
+
function isConflictedInferred(conflicts, record) {
|
|
1958
|
+
if (record.kind !== 'inferred')
|
|
1959
|
+
return false;
|
|
1960
|
+
return conflicts.some((conflict) => conflict.identity === record.identity &&
|
|
1961
|
+
(conflict.recordIds === undefined || conflict.recordIds.includes(record.id)));
|
|
1962
|
+
}
|
|
1963
|
+
function independentEvidenceCount(scope, observations) {
|
|
1964
|
+
if (scope === 'project')
|
|
1965
|
+
return new Set(observations.map((entry) => entry.changeId)).size;
|
|
1966
|
+
return new Set(observations
|
|
1967
|
+
.map((entry) => entry.projectIdentity ?? entry.projectKey)
|
|
1968
|
+
.filter((identity) => identity !== undefined && identity.length > 0)).size;
|
|
1969
|
+
}
|
|
1970
|
+
function upsertTombstone(tombstones, next) {
|
|
1971
|
+
return [...tombstones.filter((entry) => entry.identity !== next.identity), next];
|
|
1972
|
+
}
|
|
1973
|
+
function clearTombstone(state, identity) {
|
|
1974
|
+
state.tombstones = state.tombstones.filter((entry) => entry.identity !== identity);
|
|
1975
|
+
}
|
|
1976
|
+
function isTombstonedMarkdownText(tombstones, scope, projectKey, text) {
|
|
1977
|
+
const textHash = normalizedMemoryTextHash(text);
|
|
1978
|
+
const rawHash = hashMemoryText(text);
|
|
1979
|
+
return tombstones.some((entry) => entry.scope === scope &&
|
|
1980
|
+
entry.projectKey === projectKey &&
|
|
1981
|
+
entry.textHash !== undefined &&
|
|
1982
|
+
(entry.textHash === textHash || entry.textHash === rawHash));
|
|
1983
|
+
}
|
|
1984
|
+
function normalizedMemoryTextHash(text) {
|
|
1985
|
+
return hashMemoryText(normalizeText(text).replace(/\s+/gu, ''));
|
|
1986
|
+
}
|
|
1987
|
+
function validateInput(input, configuredLanguage) {
|
|
1988
|
+
if (input.scope === 'project' && input.projectKey === undefined)
|
|
1989
|
+
throw new Error('Project memory requires a project key');
|
|
1990
|
+
if (input.scope === 'project' && !/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(input.projectKey ?? ''))
|
|
1991
|
+
throw new Error('Project key is invalid');
|
|
1992
|
+
if (input.category.trim().length === 0 || input.text.trim().length === 0)
|
|
1993
|
+
throw new Error('Memory category and text are required');
|
|
1994
|
+
if (input.candidateKey !== undefined &&
|
|
1995
|
+
!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/u.test(input.candidateKey)) {
|
|
1996
|
+
throw new Error('Memory candidate key is invalid');
|
|
1997
|
+
}
|
|
1998
|
+
validateSafeMemoryText(input.category);
|
|
1999
|
+
validateSafeMemoryText(input.text);
|
|
2000
|
+
for (const [field, value] of [
|
|
2001
|
+
['title', input.title],
|
|
2002
|
+
['reason', input.reason],
|
|
2003
|
+
]) {
|
|
2004
|
+
if (value === undefined)
|
|
2005
|
+
continue;
|
|
2006
|
+
if (value.trim().length === 0)
|
|
2007
|
+
throw new Error(`Memory ${field} must not be empty`);
|
|
2008
|
+
validateSafeMemoryText(value);
|
|
2009
|
+
if (configuredLanguage !== undefined) {
|
|
2010
|
+
validateMemoryLanguageText(value, configuredLanguage, field);
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
validateMemoryArrays(input);
|
|
2014
|
+
validatePersonalEpisode(input.episode, configuredLanguage);
|
|
2015
|
+
}
|
|
2016
|
+
function validateCorrection(correction, language) {
|
|
2017
|
+
for (const [field, value] of [
|
|
2018
|
+
['title', correction.title],
|
|
2019
|
+
['reason', correction.reason],
|
|
2020
|
+
['text', correction.text],
|
|
2021
|
+
['category', correction.category],
|
|
2022
|
+
]) {
|
|
2023
|
+
if (value === undefined)
|
|
2024
|
+
continue;
|
|
2025
|
+
if (normalizeText(value).length === 0)
|
|
2026
|
+
throw new Error(`Memory correction ${field} must not be empty`);
|
|
2027
|
+
validateSafeMemoryText(value);
|
|
2028
|
+
if (language !== undefined && field !== 'text') {
|
|
2029
|
+
validateMemoryLanguageText(value, language, `correction.${field}`);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
validateMemoryArrays(correction);
|
|
2033
|
+
validatePersonalEpisode(correction.episode, language);
|
|
2034
|
+
}
|
|
2035
|
+
function memoryCorrectionIsUnchanged(record, correction) {
|
|
2036
|
+
return ((correction.title === undefined || correction.title === record.title) &&
|
|
2037
|
+
(correction.reason === undefined || correction.reason === record.reason) &&
|
|
2038
|
+
(correction.text === undefined || correction.text === record.text) &&
|
|
2039
|
+
(correction.category === undefined || correction.category === record.category) &&
|
|
2040
|
+
(correction.memoryType === undefined || correction.memoryType === record.memoryType) &&
|
|
2041
|
+
(correction.memoryClass === undefined || correction.memoryClass === record.memoryClass) &&
|
|
2042
|
+
(correction.tags === undefined || equalStrings(correction.tags, record.tags)) &&
|
|
2043
|
+
(correction.pathPatterns === undefined ||
|
|
2044
|
+
equalStrings(correction.pathPatterns, record.pathPatterns)) &&
|
|
2045
|
+
(correction.taskTypes === undefined || equalStrings(correction.taskTypes, record.taskTypes)) &&
|
|
2046
|
+
(correction.operations === undefined ||
|
|
2047
|
+
equalStrings(correction.operations, record.operations)) &&
|
|
2048
|
+
(correction.phases === undefined || equalStrings(correction.phases, record.phases)));
|
|
2049
|
+
}
|
|
2050
|
+
function validatePersonalEpisode(episode, language) {
|
|
2051
|
+
if (episode === undefined)
|
|
2052
|
+
return;
|
|
2053
|
+
for (const [field, value] of Object.entries(episode)) {
|
|
2054
|
+
if (value.trim().length === 0)
|
|
2055
|
+
throw new Error(`Memory episode ${field} must not be empty`);
|
|
2056
|
+
validateSafeMemoryText(value);
|
|
2057
|
+
if (language !== undefined)
|
|
2058
|
+
validateMemoryLanguageText(value, language, `episode.${field}`);
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
function equalStrings(left, right) {
|
|
2062
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
2063
|
+
}
|
|
2064
|
+
function validateMemoryArrays(input) {
|
|
2065
|
+
for (const [field, values] of [
|
|
2066
|
+
['tags', input.tags],
|
|
2067
|
+
['pathPatterns', input.pathPatterns],
|
|
2068
|
+
['taskTypes', input.taskTypes],
|
|
2069
|
+
['operations', input.operations],
|
|
2070
|
+
['phases', input.phases],
|
|
2071
|
+
]) {
|
|
2072
|
+
if (values === undefined)
|
|
2073
|
+
continue;
|
|
2074
|
+
if (values.length > 32)
|
|
2075
|
+
throw new Error(`Memory ${field} exceeds the collection limit`);
|
|
2076
|
+
values.forEach((value) => {
|
|
2077
|
+
validateSafeMemoryText(value);
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
function validateObservation(observation) {
|
|
2082
|
+
validateInput(observation, observation.language);
|
|
2083
|
+
if (observation.workflow.trim().length === 0 || observation.changeId.trim().length === 0)
|
|
2084
|
+
throw new Error('Observation workflow and change ID are required');
|
|
2085
|
+
if (observation.candidateKey !== undefined &&
|
|
2086
|
+
!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/u.test(observation.candidateKey)) {
|
|
2087
|
+
throw new Error('Observation candidate key is invalid');
|
|
2088
|
+
}
|
|
2089
|
+
if (observation.projectIdentity !== undefined &&
|
|
2090
|
+
observation.projectIdentity.trim().length === 0) {
|
|
2091
|
+
throw new Error('Observation project identity is invalid');
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function isUsefulAutomaticObservation(observation) {
|
|
2095
|
+
if (observation.language === undefined)
|
|
2096
|
+
return false;
|
|
2097
|
+
try {
|
|
2098
|
+
[
|
|
2099
|
+
observation.category,
|
|
2100
|
+
observation.text,
|
|
2101
|
+
...(observation.tags ?? []),
|
|
2102
|
+
...(observation.pathPatterns ?? []),
|
|
2103
|
+
...(observation.taskTypes ?? []),
|
|
2104
|
+
...(observation.operations ?? []),
|
|
2105
|
+
...(observation.phases ?? []),
|
|
2106
|
+
].forEach((value) => validateSafeMemoryText(value));
|
|
2107
|
+
validateMemoryLanguageText(observation.category, observation.language, 'observation.category');
|
|
2108
|
+
validateMemoryLanguageText(observation.text, observation.language, 'observation.text');
|
|
2109
|
+
(observation.tags ?? []).forEach((tag, index) => validateMemoryLanguageText(tag, observation.language, `observation.tags[${index}]`));
|
|
2110
|
+
}
|
|
2111
|
+
catch {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2114
|
+
const normalized = normalizeText([observation.category, observation.text, ...(observation.tags ?? [])].join(' '));
|
|
2115
|
+
if (Buffer.byteLength(normalized, 'utf8') < 8)
|
|
2116
|
+
return false;
|
|
2117
|
+
if (/(?:diff --git|@@\s+-\d|\+\+\+\s+[ab]\/|---\s+[ab]\/|stack trace|traceback|stderr|stdout|debug log|npm warn)/iu.test(normalized)) {
|
|
2118
|
+
return false;
|
|
2119
|
+
}
|
|
2120
|
+
if (/^(?:运行|执行|完成|通过|失败|已完成)?\s*(?:测试|test|命令|command|commit|提交|pull request|pr|issue)(?:\s|$)/iu.test(normalized)) {
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
if (/^(?:change|任务)\s*[:#-]?\s*\S+\s+(?:completed|完成|done)$/iu.test(normalized)) {
|
|
2124
|
+
return false;
|
|
2125
|
+
}
|
|
2126
|
+
return true;
|
|
2127
|
+
}
|
|
2128
|
+
function normalizeTombstones(raw) {
|
|
2129
|
+
const records = [...raw.records, ...Object.values(raw.history).flat()];
|
|
2130
|
+
return (raw.tombstones ?? []).map((entry) => {
|
|
2131
|
+
if (entry.textHash !== undefined)
|
|
2132
|
+
return { ...entry };
|
|
2133
|
+
const record = records.find((candidate) => candidate.id === entry.recordId);
|
|
2134
|
+
return record === undefined
|
|
2135
|
+
? { ...entry }
|
|
2136
|
+
: {
|
|
2137
|
+
...entry,
|
|
2138
|
+
textHash: normalizedMemoryTextHash(record.text),
|
|
2139
|
+
};
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
//# sourceMappingURL=personal-memory.js.map
|