pulseed 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/dist/base/config/identity-loader.d.ts +12 -3
- package/dist/base/config/identity-loader.d.ts.map +1 -1
- package/dist/base/config/identity-loader.js +15 -7
- package/dist/base/config/identity-loader.js.map +1 -1
- package/dist/grounding/contracts.d.ts +13 -0
- package/dist/grounding/contracts.d.ts.map +1 -1
- package/dist/grounding/providers/knowledge-provider.d.ts.map +1 -1
- package/dist/grounding/providers/knowledge-provider.js +25 -3
- package/dist/grounding/providers/knowledge-provider.js.map +1 -1
- package/dist/grounding/providers/soil-provider.d.ts.map +1 -1
- package/dist/grounding/providers/soil-provider.js +28 -3
- package/dist/grounding/providers/soil-provider.js.map +1 -1
- package/dist/grounding/providers/static-policy-provider.d.ts +3 -1
- package/dist/grounding/providers/static-policy-provider.d.ts.map +1 -1
- package/dist/grounding/providers/static-policy-provider.js +4 -3
- package/dist/grounding/providers/static-policy-provider.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/chat/chat-event-state.d.ts.map +1 -1
- package/dist/interface/chat/chat-event-state.js +92 -9
- package/dist/interface/chat/chat-event-state.js.map +1 -1
- package/dist/interface/chat/chat-events.d.ts +15 -1
- package/dist/interface/chat/chat-events.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.d.ts +3 -0
- package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.js +54 -8
- package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -1
- package/dist/interface/chat/chat-runner-routes.d.ts +20 -0
- package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-routes.js +76 -0
- package/dist/interface/chat/chat-runner-routes.js.map +1 -1
- package/dist/interface/chat/chat-runner.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner.js +26 -2
- package/dist/interface/chat/chat-runner.js.map +1 -1
- package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
- package/dist/interface/chat/cross-platform-session.js +9 -3
- package/dist/interface/chat/cross-platform-session.js.map +1 -1
- package/dist/interface/chat/freeform-route-classifier.d.ts +21 -0
- package/dist/interface/chat/freeform-route-classifier.d.ts.map +1 -0
- package/dist/interface/chat/freeform-route-classifier.js +42 -0
- package/dist/interface/chat/freeform-route-classifier.js.map +1 -0
- package/dist/interface/chat/grounding.js +1 -1
- package/dist/interface/chat/grounding.js.map +1 -1
- package/dist/interface/chat/ingress-router.d.ts +9 -0
- package/dist/interface/chat/ingress-router.d.ts.map +1 -1
- package/dist/interface/chat/ingress-router.js +19 -0
- package/dist/interface/chat/ingress-router.js.map +1 -1
- package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
- package/dist/interface/cli/cli-command-registry.js +9 -1
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/cli-runner.d.ts.map +1 -1
- package/dist/interface/cli/cli-runner.js +4 -1
- package/dist/interface/cli/cli-runner.js.map +1 -1
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +17 -1
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/goal-read.d.ts.map +1 -1
- package/dist/interface/cli/commands/goal-read.js +4 -0
- package/dist/interface/cli/commands/goal-read.js.map +1 -1
- package/dist/interface/cli/commands/memory.d.ts +3 -0
- package/dist/interface/cli/commands/memory.d.ts.map +1 -0
- package/dist/interface/cli/commands/memory.js +78 -0
- package/dist/interface/cli/commands/memory.js.map +1 -0
- package/dist/interface/cli/commands/plugin.d.ts.map +1 -1
- package/dist/interface/cli/commands/plugin.js +134 -12
- package/dist/interface/cli/commands/plugin.js.map +1 -1
- package/dist/interface/cli/commands/profile.d.ts +3 -0
- package/dist/interface/cli/commands/profile.d.ts.map +1 -0
- package/dist/interface/cli/commands/profile.js +459 -0
- package/dist/interface/cli/commands/profile.js.map +1 -0
- package/dist/interface/cli/commands/runtime.d.ts.map +1 -1
- package/dist/interface/cli/commands/runtime.js +101 -2
- package/dist/interface/cli/commands/runtime.js.map +1 -1
- package/dist/interface/cli/commands/setup-wizard.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup-wizard.js +30 -0
- package/dist/interface/cli/commands/setup-wizard.js.map +1 -1
- package/dist/interface/cli/utils.d.ts.map +1 -1
- package/dist/interface/cli/utils.js +4 -2
- package/dist/interface/cli/utils.js.map +1 -1
- package/dist/interface/tui/intent-recognizer.js +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts +2 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.js +3 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts +109 -0
- package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-timeline.js +261 -0
- package/dist/orchestrator/execution/agent-loop/agent-timeline.js.map +1 -0
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +1 -0
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/execution-policy.d.ts +2 -0
- package/dist/orchestrator/execution/agent-loop/execution-policy.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/execution-policy.js +9 -3
- package/dist/orchestrator/execution/agent-loop/execution-policy.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/self-protection.d.ts +9 -0
- package/dist/orchestrator/execution/agent-loop/self-protection.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/self-protection.js +74 -0
- package/dist/orchestrator/execution/agent-loop/self-protection.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js +10 -1
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-specs.d.ts +85 -0
- package/dist/orchestrator/loop/core-loop/phase-specs.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-specs.js +7 -0
- package/dist/orchestrator/loop/core-loop/phase-specs.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle.js +24 -2
- package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
- package/dist/platform/corrections/index.d.ts +2 -0
- package/dist/platform/corrections/index.d.ts.map +1 -0
- package/dist/platform/corrections/index.js +2 -0
- package/dist/platform/corrections/index.js.map +1 -0
- package/dist/platform/corrections/memory-correction-ledger.d.ts +656 -0
- package/dist/platform/corrections/memory-correction-ledger.d.ts.map +1 -0
- package/dist/platform/corrections/memory-correction-ledger.js +120 -0
- package/dist/platform/corrections/memory-correction-ledger.js.map +1 -0
- package/dist/platform/corrections/memory-governance.d.ts +118 -0
- package/dist/platform/corrections/memory-governance.d.ts.map +1 -0
- package/dist/platform/corrections/memory-governance.js +32 -0
- package/dist/platform/corrections/memory-governance.js.map +1 -0
- package/dist/platform/corrections/memory-quarantine.d.ts +57 -0
- package/dist/platform/corrections/memory-quarantine.d.ts.map +1 -0
- package/dist/platform/corrections/memory-quarantine.js +42 -0
- package/dist/platform/corrections/memory-quarantine.js.map +1 -0
- package/dist/platform/corrections/user-memory-operations.d.ts +31 -0
- package/dist/platform/corrections/user-memory-operations.d.ts.map +1 -0
- package/dist/platform/corrections/user-memory-operations.js +139 -0
- package/dist/platform/corrections/user-memory-operations.js.map +1 -0
- package/dist/platform/dream/dream-consolidator.d.ts +5 -0
- package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
- package/dist/platform/dream/dream-consolidator.js +235 -13
- package/dist/platform/dream/dream-consolidator.js.map +1 -1
- package/dist/platform/dream/dream-soil-mutation.d.ts.map +1 -1
- package/dist/platform/dream/dream-soil-mutation.js +10 -0
- package/dist/platform/dream/dream-soil-mutation.js.map +1 -1
- package/dist/platform/dream/dream-types.d.ts +412 -0
- package/dist/platform/dream/dream-types.d.ts.map +1 -1
- package/dist/platform/dream/dream-types.js +3 -0
- package/dist/platform/dream/dream-types.js.map +1 -1
- package/dist/platform/dream/playbook-memory.d.ts +14 -14
- package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +48 -0
- package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-manager-agent-memory.js +154 -4
- package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -1
- package/dist/platform/knowledge/knowledge-manager-lint.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-manager-lint.js +98 -4
- package/dist/platform/knowledge/knowledge-manager-lint.js.map +1 -1
- package/dist/platform/knowledge/knowledge-manager.d.ts +41 -2
- package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-manager.js +45 -5
- package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
- package/dist/platform/knowledge/types/agent-memory.d.ts +1170 -42
- package/dist/platform/knowledge/types/agent-memory.d.ts.map +1 -1
- package/dist/platform/knowledge/types/agent-memory.js +13 -3
- package/dist/platform/knowledge/types/agent-memory.js.map +1 -1
- package/dist/platform/profile/proactive-feedback-proposals.d.ts +11 -0
- package/dist/platform/profile/proactive-feedback-proposals.d.ts.map +1 -0
- package/dist/platform/profile/proactive-feedback-proposals.js +106 -0
- package/dist/platform/profile/proactive-feedback-proposals.js.map +1 -0
- package/dist/platform/profile/profile-change-proposal.d.ts +464 -0
- package/dist/platform/profile/profile-change-proposal.d.ts.map +1 -0
- package/dist/platform/profile/profile-change-proposal.js +352 -0
- package/dist/platform/profile/profile-change-proposal.js.map +1 -0
- package/dist/platform/profile/relationship-profile.d.ts +351 -0
- package/dist/platform/profile/relationship-profile.d.ts.map +1 -0
- package/dist/platform/profile/relationship-profile.js +351 -0
- package/dist/platform/profile/relationship-profile.js.map +1 -0
- package/dist/platform/profile/retrieval-context.d.ts +12 -0
- package/dist/platform/profile/retrieval-context.d.ts.map +1 -0
- package/dist/platform/profile/retrieval-context.js +21 -0
- package/dist/platform/profile/retrieval-context.js.map +1 -0
- package/dist/platform/profile/user-md-profile-import.d.ts +73 -0
- package/dist/platform/profile/user-md-profile-import.d.ts.map +1 -0
- package/dist/platform/profile/user-md-profile-import.js +179 -0
- package/dist/platform/profile/user-md-profile-import.js.map +1 -0
- package/dist/platform/soil/content-projections.d.ts.map +1 -1
- package/dist/platform/soil/content-projections.js +17 -7
- package/dist/platform/soil/content-projections.js.map +1 -1
- package/dist/platform/soil/context-compiler.d.ts +16 -1
- package/dist/platform/soil/context-compiler.d.ts.map +1 -1
- package/dist/platform/soil/context-compiler.js +142 -4
- package/dist/platform/soil/context-compiler.js.map +1 -1
- package/dist/platform/soil/contracts.d.ts +720 -60
- package/dist/platform/soil/contracts.d.ts.map +1 -1
- package/dist/platform/soil/contracts.js +22 -0
- package/dist/platform/soil/contracts.js.map +1 -1
- package/dist/platform/soil/ddl.d.ts.map +1 -1
- package/dist/platform/soil/ddl.js +19 -0
- package/dist/platform/soil/ddl.js.map +1 -1
- package/dist/platform/soil/display/materialize.d.ts.map +1 -1
- package/dist/platform/soil/display/materialize.js.map +1 -1
- package/dist/platform/soil/importer.d.ts +6 -6
- package/dist/platform/soil/sqlite-repository-helpers.d.ts +4 -0
- package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -1
- package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -1
- package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -1
- package/dist/platform/soil/sqlite-repository-search.js +48 -3
- package/dist/platform/soil/sqlite-repository-search.js.map +1 -1
- package/dist/platform/soil/sqlite-repository-storage.d.ts +3 -1
- package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -1
- package/dist/platform/soil/sqlite-repository-storage.js +124 -3
- package/dist/platform/soil/sqlite-repository-storage.js.map +1 -1
- package/dist/platform/soil/sqlite-repository.d.ts +10 -1
- package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
- package/dist/platform/soil/sqlite-repository.js +46 -4
- package/dist/platform/soil/sqlite-repository.js.map +1 -1
- package/dist/platform/soil/types.d.ts +8 -8
- package/dist/platform/traits/curiosity-engine.d.ts +3 -1
- package/dist/platform/traits/curiosity-engine.d.ts.map +1 -1
- package/dist/platform/traits/curiosity-engine.js +3 -1
- package/dist/platform/traits/curiosity-engine.js.map +1 -1
- package/dist/platform/traits/curiosity-proposals.d.ts +6 -2
- package/dist/platform/traits/curiosity-proposals.d.ts.map +1 -1
- package/dist/platform/traits/curiosity-proposals.js +9 -3
- package/dist/platform/traits/curiosity-proposals.js.map +1 -1
- package/dist/reflection/evening-catchup.d.ts.map +1 -1
- package/dist/reflection/evening-catchup.js +4 -1
- package/dist/reflection/evening-catchup.js.map +1 -1
- package/dist/reflection/morning-planning.d.ts.map +1 -1
- package/dist/reflection/morning-planning.js +4 -1
- package/dist/reflection/morning-planning.js.map +1 -1
- package/dist/reflection/weekly-review.d.ts.map +1 -1
- package/dist/reflection/weekly-review.js +4 -1
- package/dist/reflection/weekly-review.js.map +1 -1
- package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
- package/dist/runtime/daemon/maintenance.js +21 -2
- package/dist/runtime/daemon/maintenance.js.map +1 -1
- package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-resident-curiosity.js +5 -1
- package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -1
- package/dist/runtime/daemon/runner-resident-shared.d.ts +1 -1
- package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-resident-shared.js +16 -0
- package/dist/runtime/daemon/runner-resident-shared.js.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.js +2 -0
- package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
- package/dist/runtime/dream-sidecar-review.d.ts +2 -1
- package/dist/runtime/dream-sidecar-review.d.ts.map +1 -1
- package/dist/runtime/dream-sidecar-review.js +49 -55
- package/dist/runtime/dream-sidecar-review.js.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.js +4 -3
- package/dist/runtime/gateway/telegram-gateway-adapter.js.map +1 -1
- package/dist/runtime/plugin-loader.d.ts +1 -0
- package/dist/runtime/plugin-loader.d.ts.map +1 -1
- package/dist/runtime/plugin-loader.js +7 -2
- package/dist/runtime/plugin-loader.js.map +1 -1
- package/dist/runtime/store/dream-checkpoints.d.ts +3 -0
- package/dist/runtime/store/dream-checkpoints.d.ts.map +1 -1
- package/dist/runtime/store/dream-checkpoints.js +2 -0
- package/dist/runtime/store/dream-checkpoints.js.map +1 -1
- package/dist/runtime/store/evidence-ledger.d.ts +1315 -38
- package/dist/runtime/store/evidence-ledger.d.ts.map +1 -1
- package/dist/runtime/store/evidence-ledger.js +299 -34
- package/dist/runtime/store/evidence-ledger.js.map +1 -1
- package/dist/runtime/store/index.d.ts +2 -0
- package/dist/runtime/store/index.d.ts.map +1 -1
- package/dist/runtime/store/index.js +1 -0
- package/dist/runtime/store/index.js.map +1 -1
- package/dist/runtime/store/proactive-intervention-store.d.ts +360 -0
- package/dist/runtime/store/proactive-intervention-store.d.ts.map +1 -0
- package/dist/runtime/store/proactive-intervention-store.js +252 -0
- package/dist/runtime/store/proactive-intervention-store.js.map +1 -0
- package/dist/runtime/store/runtime-paths.d.ts +2 -0
- package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
- package/dist/runtime/store/runtime-paths.js +4 -0
- package/dist/runtime/store/runtime-paths.js.map +1 -1
- package/dist/runtime/types/daemon.d.ts +8 -0
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +1 -0
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/runtime/types/plugin.d.ts.map +1 -1
- package/dist/runtime/types/plugin.js +1 -1
- package/dist/runtime/types/plugin.js.map +1 -1
- package/dist/runtime/types/schedule.d.ts +10 -10
- package/dist/tools/builtin/exports.d.ts +1 -0
- package/dist/tools/builtin/exports.d.ts.map +1 -1
- package/dist/tools/builtin/exports.js +1 -0
- package/dist/tools/builtin/exports.js.map +1 -1
- package/dist/tools/builtin/factory.d.ts.map +1 -1
- package/dist/tools/builtin/factory.js +2 -1
- package/dist/tools/builtin/factory.js.map +1 -1
- package/dist/tools/execution/MemoryConsolidateTool/MemoryConsolidateTool.d.ts +4 -4
- package/dist/tools/execution/MemoryCorrectionTool/MemoryCorrectionTool.d.ts +76 -0
- package/dist/tools/execution/MemoryCorrectionTool/MemoryCorrectionTool.d.ts.map +1 -0
- package/dist/tools/execution/MemoryCorrectionTool/MemoryCorrectionTool.js +79 -0
- package/dist/tools/execution/MemoryCorrectionTool/MemoryCorrectionTool.js.map +1 -0
- package/dist/tools/execution/MemoryCorrectionTool/constants.d.ts +6 -0
- package/dist/tools/execution/MemoryCorrectionTool/constants.d.ts.map +1 -0
- package/dist/tools/execution/MemoryCorrectionTool/constants.js +6 -0
- package/dist/tools/execution/MemoryCorrectionTool/constants.js.map +1 -0
- package/dist/tools/execution/MemoryCorrectionTool/prompt.d.ts +2 -0
- package/dist/tools/execution/MemoryCorrectionTool/prompt.d.ts.map +1 -0
- package/dist/tools/execution/MemoryCorrectionTool/prompt.js +2 -0
- package/dist/tools/execution/MemoryCorrectionTool/prompt.js.map +1 -0
- package/dist/tools/execution/MemorySaveTool/MemorySaveTool.d.ts +306 -4
- package/dist/tools/execution/MemorySaveTool/MemorySaveTool.d.ts.map +1 -1
- package/dist/tools/execution/MemorySaveTool/MemorySaveTool.js +8 -0
- package/dist/tools/execution/MemorySaveTool/MemorySaveTool.js.map +1 -1
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.d.ts.map +1 -1
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js +37 -4
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js.map +1 -1
- package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
- package/dist/tools/fs/FileValidationTool/protected-path-policy.js +12 -0
- package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +16 -4
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts.map +1 -1
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.js +12 -0
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.js.map +1 -1
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts +7 -0
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +20 -0
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.js +1 -1
- package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
- package/dist/tools/system/ShellTool/command-policy.d.ts +1 -1
- package/dist/tools/system/ShellTool/command-policy.d.ts.map +1 -1
- package/dist/tools/system/ShellTool/command-policy.js +25 -1
- package/dist/tools/system/ShellTool/command-policy.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryCorrectionTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/execution/MemoryCorrectionTool/MemoryCorrectionTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,KAAK,EACL,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAQzE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,qBAAa,oBAAqB,YAAW,KAAK,CAAC,qBAAqB,EAAE,OAAO,CAAC;IAgBpE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAfzC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAW7B;IAEF,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAA+B;gBAEtB,YAAY,EAAE,YAAY;IAEvD,WAAW,CAAC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAIhD,IAAI,CAAC,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAiClF,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK/G,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO;CAG1D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { parseMemoryCorrectionRef, runUserMemoryOperation, } from "../../../platform/corrections/user-memory-operations.js";
|
|
3
|
+
import { DESCRIPTION } from "./prompt.js";
|
|
4
|
+
import { ALIASES, PERMISSION_LEVEL, READ_ONLY, TAGS, TOOL_NAME } from "./constants.js";
|
|
5
|
+
export const MemoryCorrectionInputSchema = z.object({
|
|
6
|
+
operation: z.enum(["correct", "forget", "retract", "history"]),
|
|
7
|
+
target_ref: z.string().min(1).describe("Exact typed ref: agent_memory:<id>, runtime_evidence:<id>, dream_checkpoint:<ref>, or soil_record:<id>"),
|
|
8
|
+
reason: z.string().min(1).optional(),
|
|
9
|
+
replacement_value: z.string().min(1).optional(),
|
|
10
|
+
replacement_ref: z.string().min(1).optional(),
|
|
11
|
+
replacement_key: z.string().min(1).optional(),
|
|
12
|
+
goal_id: z.string().min(1).optional(),
|
|
13
|
+
run_id: z.string().min(1).optional(),
|
|
14
|
+
task_id: z.string().min(1).optional(),
|
|
15
|
+
});
|
|
16
|
+
export class MemoryCorrectionTool {
|
|
17
|
+
stateManager;
|
|
18
|
+
metadata = {
|
|
19
|
+
name: TOOL_NAME,
|
|
20
|
+
aliases: [...ALIASES],
|
|
21
|
+
permissionLevel: PERMISSION_LEVEL,
|
|
22
|
+
isReadOnly: READ_ONLY,
|
|
23
|
+
isDestructive: false,
|
|
24
|
+
shouldDefer: false,
|
|
25
|
+
alwaysLoad: false,
|
|
26
|
+
maxConcurrency: 0,
|
|
27
|
+
maxOutputChars: 2000,
|
|
28
|
+
tags: [...TAGS],
|
|
29
|
+
};
|
|
30
|
+
inputSchema = MemoryCorrectionInputSchema;
|
|
31
|
+
constructor(stateManager) {
|
|
32
|
+
this.stateManager = stateManager;
|
|
33
|
+
}
|
|
34
|
+
description(_context) {
|
|
35
|
+
return DESCRIPTION;
|
|
36
|
+
}
|
|
37
|
+
async call(input, _context) {
|
|
38
|
+
const startTime = Date.now();
|
|
39
|
+
try {
|
|
40
|
+
const result = await runUserMemoryOperation(this.stateManager, {
|
|
41
|
+
operation: input.operation,
|
|
42
|
+
targetRef: parseMemoryCorrectionRef(input.target_ref),
|
|
43
|
+
reason: input.reason,
|
|
44
|
+
replacementValue: input.replacement_value,
|
|
45
|
+
replacementKey: input.replacement_key,
|
|
46
|
+
replacementRef: input.replacement_ref ? parseMemoryCorrectionRef(input.replacement_ref) : null,
|
|
47
|
+
goalId: input.goal_id,
|
|
48
|
+
runId: input.run_id,
|
|
49
|
+
taskId: input.task_id,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
success: true,
|
|
53
|
+
data: result,
|
|
54
|
+
summary: input.operation === "history"
|
|
55
|
+
? `Found ${result.history.length} correction history entries`
|
|
56
|
+
: `Memory ${input.operation} recorded: ${result.correction?.correction_id}`,
|
|
57
|
+
durationMs: Date.now() - startTime,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
data: null,
|
|
64
|
+
summary: "MemoryCorrectionTool failed: " + err.message,
|
|
65
|
+
error: err.message,
|
|
66
|
+
durationMs: Date.now() - startTime,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async checkPermissions(input, _context) {
|
|
71
|
+
if (input.operation === "history")
|
|
72
|
+
return { status: "allowed" };
|
|
73
|
+
return { status: "allowed" };
|
|
74
|
+
}
|
|
75
|
+
isConcurrencySafe(_input) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=MemoryCorrectionTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryCorrect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BACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,KAAK,CAAC,SAAS,KAAK,SAAS;oBACpC,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,6BAA6B;oBAC7D,CAAC,CAAC,UAAU,KAAK,CAAC,SAAS,cAAc,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE;gBAC7E,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aACnC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,+BAA+B,GAAI,GAAa,CAAC,OAAO;gBACjE,KAAK,EAAG,GAAa,CAAC,OAAO;gBAC7B,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aACnC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,KAA4B,EAAE,QAAyB;QAC5E,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;YAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAChE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC/B,CAAC;IAED,iBAAiB,CAAC,MAA6B;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const TOOL_NAME = "memory_correction";
|
|
2
|
+
export declare const ALIASES: readonly ["memory_correct", "memory_forget", "memory_retract", "memory_history"];
|
|
3
|
+
export declare const TAGS: readonly ["memory", "correction", "write"];
|
|
4
|
+
export declare const READ_ONLY = false;
|
|
5
|
+
export declare const PERMISSION_LEVEL: "write_local";
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/tools/execution/MemoryCorrectionTool/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,sBAAsB,CAAC;AAC7C,eAAO,MAAM,OAAO,kFAAmF,CAAC;AACxG,eAAO,MAAM,IAAI,4CAA6C,CAAC;AAC/D,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,gBAAgB,EAAG,aAAsB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const TOOL_NAME = "memory_correction";
|
|
2
|
+
export const ALIASES = ["memory_correct", "memory_forget", "memory_retract", "memory_history"];
|
|
3
|
+
export const TAGS = ["memory", "correction", "write"];
|
|
4
|
+
export const READ_ONLY = false;
|
|
5
|
+
export const PERMISSION_LEVEL = "write_local";
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/tools/execution/MemoryCorrectionTool/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AACxG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/tools/execution/MemoryCorrectionTool/prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,8HAA8H,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/tools/execution/MemoryCorrectionTool/prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,2HAA2H,CAAC"}
|
|
@@ -7,18 +7,169 @@ export declare const MemorySaveInputSchema: z.ZodObject<{
|
|
|
7
7
|
category: z.ZodOptional<z.ZodString>;
|
|
8
8
|
memory_type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fact", "procedure", "preference", "observation"]>>>;
|
|
9
9
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
verification_status: z.ZodOptional<z.ZodEnum<["unknown", "unverified", "verified", "contradicted", "suspicious"]>>;
|
|
11
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
source_type: z.ZodDefault<z.ZodEnum<["user", "runtime", "tool", "web", "external", "imported", "unknown"]>>;
|
|
13
|
+
source_ref: z.ZodOptional<z.ZodString>;
|
|
14
|
+
raw_refs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
reliability: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
verification_status: z.ZodDefault<z.ZodEnum<["unknown", "unverified", "verified", "contradicted", "suspicious"]>>;
|
|
17
|
+
risk_signals: z.ZodDefault<z.ZodArray<z.ZodEnum<["hallucinated", "low_provenance", "contradiction", "prompt_injection_like", "unverified_external"]>, "many">>;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
source_type: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported";
|
|
20
|
+
raw_refs: string[];
|
|
21
|
+
verification_status: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious";
|
|
22
|
+
risk_signals: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[];
|
|
23
|
+
reliability?: number | undefined;
|
|
24
|
+
source_ref?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
reliability?: number | undefined;
|
|
27
|
+
source_type?: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported" | undefined;
|
|
28
|
+
source_ref?: string | undefined;
|
|
29
|
+
raw_refs?: string[] | undefined;
|
|
30
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
31
|
+
risk_signals?: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[] | undefined;
|
|
32
|
+
}>>;
|
|
33
|
+
governance: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
sensitivity: z.ZodDefault<z.ZodEnum<["public", "local", "private", "secret"]>>;
|
|
35
|
+
consent: z.ZodDefault<z.ZodObject<{
|
|
36
|
+
scope_id: z.ZodDefault<z.ZodString>;
|
|
37
|
+
allowed_contexts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
+
source_actor: z.ZodDefault<z.ZodString>;
|
|
39
|
+
collection_context: z.ZodDefault<z.ZodString>;
|
|
40
|
+
granted_at: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
scope_id: string;
|
|
43
|
+
allowed_contexts: string[];
|
|
44
|
+
source_actor: string;
|
|
45
|
+
collection_context: string;
|
|
46
|
+
granted_at?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
scope_id?: string | undefined;
|
|
49
|
+
allowed_contexts?: string[] | undefined;
|
|
50
|
+
source_actor?: string | undefined;
|
|
51
|
+
collection_context?: string | undefined;
|
|
52
|
+
granted_at?: string | undefined;
|
|
53
|
+
}>>;
|
|
54
|
+
retention: z.ZodDefault<z.ZodObject<{
|
|
55
|
+
policy_id: z.ZodDefault<z.ZodString>;
|
|
56
|
+
retain_until: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
57
|
+
review_after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
delete_requires_approval: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
policy_id: string;
|
|
61
|
+
retain_until: string | null;
|
|
62
|
+
review_after: string | null;
|
|
63
|
+
delete_requires_approval: boolean;
|
|
64
|
+
}, {
|
|
65
|
+
policy_id?: string | undefined;
|
|
66
|
+
retain_until?: string | null | undefined;
|
|
67
|
+
review_after?: string | null | undefined;
|
|
68
|
+
delete_requires_approval?: boolean | undefined;
|
|
69
|
+
}>>;
|
|
70
|
+
export_visibility: z.ZodDefault<z.ZodEnum<["listed", "redacted", "hidden"]>>;
|
|
71
|
+
owner_ref: z.ZodDefault<z.ZodString>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
sensitivity: "local" | "public" | "private" | "secret";
|
|
74
|
+
consent: {
|
|
75
|
+
scope_id: string;
|
|
76
|
+
allowed_contexts: string[];
|
|
77
|
+
source_actor: string;
|
|
78
|
+
collection_context: string;
|
|
79
|
+
granted_at?: string | undefined;
|
|
80
|
+
};
|
|
81
|
+
retention: {
|
|
82
|
+
policy_id: string;
|
|
83
|
+
retain_until: string | null;
|
|
84
|
+
review_after: string | null;
|
|
85
|
+
delete_requires_approval: boolean;
|
|
86
|
+
};
|
|
87
|
+
export_visibility: "listed" | "redacted" | "hidden";
|
|
88
|
+
owner_ref: string;
|
|
89
|
+
}, {
|
|
90
|
+
sensitivity?: "local" | "public" | "private" | "secret" | undefined;
|
|
91
|
+
consent?: {
|
|
92
|
+
scope_id?: string | undefined;
|
|
93
|
+
allowed_contexts?: string[] | undefined;
|
|
94
|
+
source_actor?: string | undefined;
|
|
95
|
+
collection_context?: string | undefined;
|
|
96
|
+
granted_at?: string | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
retention?: {
|
|
99
|
+
policy_id?: string | undefined;
|
|
100
|
+
retain_until?: string | null | undefined;
|
|
101
|
+
review_after?: string | null | undefined;
|
|
102
|
+
delete_requires_approval?: boolean | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
export_visibility?: "listed" | "redacted" | "hidden" | undefined;
|
|
105
|
+
owner_ref?: string | undefined;
|
|
106
|
+
}>>;
|
|
10
107
|
}, "strip", z.ZodTypeAny, {
|
|
11
108
|
value: string;
|
|
12
109
|
key: string;
|
|
13
|
-
memory_type: "observation" | "
|
|
110
|
+
memory_type: "observation" | "preference" | "fact" | "procedure";
|
|
14
111
|
category?: string | undefined;
|
|
15
112
|
tags?: string[] | undefined;
|
|
113
|
+
provenance?: {
|
|
114
|
+
source_type: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported";
|
|
115
|
+
raw_refs: string[];
|
|
116
|
+
verification_status: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious";
|
|
117
|
+
risk_signals: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[];
|
|
118
|
+
reliability?: number | undefined;
|
|
119
|
+
source_ref?: string | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
122
|
+
governance?: {
|
|
123
|
+
sensitivity: "local" | "public" | "private" | "secret";
|
|
124
|
+
consent: {
|
|
125
|
+
scope_id: string;
|
|
126
|
+
allowed_contexts: string[];
|
|
127
|
+
source_actor: string;
|
|
128
|
+
collection_context: string;
|
|
129
|
+
granted_at?: string | undefined;
|
|
130
|
+
};
|
|
131
|
+
retention: {
|
|
132
|
+
policy_id: string;
|
|
133
|
+
retain_until: string | null;
|
|
134
|
+
review_after: string | null;
|
|
135
|
+
delete_requires_approval: boolean;
|
|
136
|
+
};
|
|
137
|
+
export_visibility: "listed" | "redacted" | "hidden";
|
|
138
|
+
owner_ref: string;
|
|
139
|
+
} | undefined;
|
|
16
140
|
}, {
|
|
17
141
|
value: string;
|
|
18
142
|
key: string;
|
|
19
143
|
category?: string | undefined;
|
|
20
144
|
tags?: string[] | undefined;
|
|
21
|
-
|
|
145
|
+
provenance?: {
|
|
146
|
+
reliability?: number | undefined;
|
|
147
|
+
source_type?: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported" | undefined;
|
|
148
|
+
source_ref?: string | undefined;
|
|
149
|
+
raw_refs?: string[] | undefined;
|
|
150
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
151
|
+
risk_signals?: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[] | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
154
|
+
memory_type?: "observation" | "preference" | "fact" | "procedure" | undefined;
|
|
155
|
+
governance?: {
|
|
156
|
+
sensitivity?: "local" | "public" | "private" | "secret" | undefined;
|
|
157
|
+
consent?: {
|
|
158
|
+
scope_id?: string | undefined;
|
|
159
|
+
allowed_contexts?: string[] | undefined;
|
|
160
|
+
source_actor?: string | undefined;
|
|
161
|
+
collection_context?: string | undefined;
|
|
162
|
+
granted_at?: string | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
retention?: {
|
|
165
|
+
policy_id?: string | undefined;
|
|
166
|
+
retain_until?: string | null | undefined;
|
|
167
|
+
review_after?: string | null | undefined;
|
|
168
|
+
delete_requires_approval?: boolean | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
export_visibility?: "listed" | "redacted" | "hidden" | undefined;
|
|
171
|
+
owner_ref?: string | undefined;
|
|
172
|
+
} | undefined;
|
|
22
173
|
}>;
|
|
23
174
|
export type MemorySaveInput = z.infer<typeof MemorySaveInputSchema>;
|
|
24
175
|
export declare class MemorySaveTool implements ITool<MemorySaveInput, unknown> {
|
|
@@ -30,18 +181,169 @@ export declare class MemorySaveTool implements ITool<MemorySaveInput, unknown> {
|
|
|
30
181
|
category: z.ZodOptional<z.ZodString>;
|
|
31
182
|
memory_type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fact", "procedure", "preference", "observation"]>>>;
|
|
32
183
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
184
|
+
verification_status: z.ZodOptional<z.ZodEnum<["unknown", "unverified", "verified", "contradicted", "suspicious"]>>;
|
|
185
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
source_type: z.ZodDefault<z.ZodEnum<["user", "runtime", "tool", "web", "external", "imported", "unknown"]>>;
|
|
187
|
+
source_ref: z.ZodOptional<z.ZodString>;
|
|
188
|
+
raw_refs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
189
|
+
reliability: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
verification_status: z.ZodDefault<z.ZodEnum<["unknown", "unverified", "verified", "contradicted", "suspicious"]>>;
|
|
191
|
+
risk_signals: z.ZodDefault<z.ZodArray<z.ZodEnum<["hallucinated", "low_provenance", "contradiction", "prompt_injection_like", "unverified_external"]>, "many">>;
|
|
192
|
+
}, "strict", z.ZodTypeAny, {
|
|
193
|
+
source_type: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported";
|
|
194
|
+
raw_refs: string[];
|
|
195
|
+
verification_status: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious";
|
|
196
|
+
risk_signals: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[];
|
|
197
|
+
reliability?: number | undefined;
|
|
198
|
+
source_ref?: string | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
reliability?: number | undefined;
|
|
201
|
+
source_type?: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported" | undefined;
|
|
202
|
+
source_ref?: string | undefined;
|
|
203
|
+
raw_refs?: string[] | undefined;
|
|
204
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
205
|
+
risk_signals?: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[] | undefined;
|
|
206
|
+
}>>;
|
|
207
|
+
governance: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
sensitivity: z.ZodDefault<z.ZodEnum<["public", "local", "private", "secret"]>>;
|
|
209
|
+
consent: z.ZodDefault<z.ZodObject<{
|
|
210
|
+
scope_id: z.ZodDefault<z.ZodString>;
|
|
211
|
+
allowed_contexts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
212
|
+
source_actor: z.ZodDefault<z.ZodString>;
|
|
213
|
+
collection_context: z.ZodDefault<z.ZodString>;
|
|
214
|
+
granted_at: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, "strict", z.ZodTypeAny, {
|
|
216
|
+
scope_id: string;
|
|
217
|
+
allowed_contexts: string[];
|
|
218
|
+
source_actor: string;
|
|
219
|
+
collection_context: string;
|
|
220
|
+
granted_at?: string | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
scope_id?: string | undefined;
|
|
223
|
+
allowed_contexts?: string[] | undefined;
|
|
224
|
+
source_actor?: string | undefined;
|
|
225
|
+
collection_context?: string | undefined;
|
|
226
|
+
granted_at?: string | undefined;
|
|
227
|
+
}>>;
|
|
228
|
+
retention: z.ZodDefault<z.ZodObject<{
|
|
229
|
+
policy_id: z.ZodDefault<z.ZodString>;
|
|
230
|
+
retain_until: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
231
|
+
review_after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
232
|
+
delete_requires_approval: z.ZodDefault<z.ZodBoolean>;
|
|
233
|
+
}, "strict", z.ZodTypeAny, {
|
|
234
|
+
policy_id: string;
|
|
235
|
+
retain_until: string | null;
|
|
236
|
+
review_after: string | null;
|
|
237
|
+
delete_requires_approval: boolean;
|
|
238
|
+
}, {
|
|
239
|
+
policy_id?: string | undefined;
|
|
240
|
+
retain_until?: string | null | undefined;
|
|
241
|
+
review_after?: string | null | undefined;
|
|
242
|
+
delete_requires_approval?: boolean | undefined;
|
|
243
|
+
}>>;
|
|
244
|
+
export_visibility: z.ZodDefault<z.ZodEnum<["listed", "redacted", "hidden"]>>;
|
|
245
|
+
owner_ref: z.ZodDefault<z.ZodString>;
|
|
246
|
+
}, "strict", z.ZodTypeAny, {
|
|
247
|
+
sensitivity: "local" | "public" | "private" | "secret";
|
|
248
|
+
consent: {
|
|
249
|
+
scope_id: string;
|
|
250
|
+
allowed_contexts: string[];
|
|
251
|
+
source_actor: string;
|
|
252
|
+
collection_context: string;
|
|
253
|
+
granted_at?: string | undefined;
|
|
254
|
+
};
|
|
255
|
+
retention: {
|
|
256
|
+
policy_id: string;
|
|
257
|
+
retain_until: string | null;
|
|
258
|
+
review_after: string | null;
|
|
259
|
+
delete_requires_approval: boolean;
|
|
260
|
+
};
|
|
261
|
+
export_visibility: "listed" | "redacted" | "hidden";
|
|
262
|
+
owner_ref: string;
|
|
263
|
+
}, {
|
|
264
|
+
sensitivity?: "local" | "public" | "private" | "secret" | undefined;
|
|
265
|
+
consent?: {
|
|
266
|
+
scope_id?: string | undefined;
|
|
267
|
+
allowed_contexts?: string[] | undefined;
|
|
268
|
+
source_actor?: string | undefined;
|
|
269
|
+
collection_context?: string | undefined;
|
|
270
|
+
granted_at?: string | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
retention?: {
|
|
273
|
+
policy_id?: string | undefined;
|
|
274
|
+
retain_until?: string | null | undefined;
|
|
275
|
+
review_after?: string | null | undefined;
|
|
276
|
+
delete_requires_approval?: boolean | undefined;
|
|
277
|
+
} | undefined;
|
|
278
|
+
export_visibility?: "listed" | "redacted" | "hidden" | undefined;
|
|
279
|
+
owner_ref?: string | undefined;
|
|
280
|
+
}>>;
|
|
33
281
|
}, "strip", z.ZodTypeAny, {
|
|
34
282
|
value: string;
|
|
35
283
|
key: string;
|
|
36
|
-
memory_type: "observation" | "
|
|
284
|
+
memory_type: "observation" | "preference" | "fact" | "procedure";
|
|
37
285
|
category?: string | undefined;
|
|
38
286
|
tags?: string[] | undefined;
|
|
287
|
+
provenance?: {
|
|
288
|
+
source_type: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported";
|
|
289
|
+
raw_refs: string[];
|
|
290
|
+
verification_status: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious";
|
|
291
|
+
risk_signals: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[];
|
|
292
|
+
reliability?: number | undefined;
|
|
293
|
+
source_ref?: string | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
296
|
+
governance?: {
|
|
297
|
+
sensitivity: "local" | "public" | "private" | "secret";
|
|
298
|
+
consent: {
|
|
299
|
+
scope_id: string;
|
|
300
|
+
allowed_contexts: string[];
|
|
301
|
+
source_actor: string;
|
|
302
|
+
collection_context: string;
|
|
303
|
+
granted_at?: string | undefined;
|
|
304
|
+
};
|
|
305
|
+
retention: {
|
|
306
|
+
policy_id: string;
|
|
307
|
+
retain_until: string | null;
|
|
308
|
+
review_after: string | null;
|
|
309
|
+
delete_requires_approval: boolean;
|
|
310
|
+
};
|
|
311
|
+
export_visibility: "listed" | "redacted" | "hidden";
|
|
312
|
+
owner_ref: string;
|
|
313
|
+
} | undefined;
|
|
39
314
|
}, {
|
|
40
315
|
value: string;
|
|
41
316
|
key: string;
|
|
42
317
|
category?: string | undefined;
|
|
43
318
|
tags?: string[] | undefined;
|
|
44
|
-
|
|
319
|
+
provenance?: {
|
|
320
|
+
reliability?: number | undefined;
|
|
321
|
+
source_type?: "unknown" | "external" | "web" | "tool" | "user" | "runtime" | "imported" | undefined;
|
|
322
|
+
source_ref?: string | undefined;
|
|
323
|
+
raw_refs?: string[] | undefined;
|
|
324
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
325
|
+
risk_signals?: ("hallucinated" | "low_provenance" | "contradiction" | "prompt_injection_like" | "unverified_external")[] | undefined;
|
|
326
|
+
} | undefined;
|
|
327
|
+
verification_status?: "unknown" | "unverified" | "verified" | "contradicted" | "suspicious" | undefined;
|
|
328
|
+
memory_type?: "observation" | "preference" | "fact" | "procedure" | undefined;
|
|
329
|
+
governance?: {
|
|
330
|
+
sensitivity?: "local" | "public" | "private" | "secret" | undefined;
|
|
331
|
+
consent?: {
|
|
332
|
+
scope_id?: string | undefined;
|
|
333
|
+
allowed_contexts?: string[] | undefined;
|
|
334
|
+
source_actor?: string | undefined;
|
|
335
|
+
collection_context?: string | undefined;
|
|
336
|
+
granted_at?: string | undefined;
|
|
337
|
+
} | undefined;
|
|
338
|
+
retention?: {
|
|
339
|
+
policy_id?: string | undefined;
|
|
340
|
+
retain_until?: string | null | undefined;
|
|
341
|
+
review_after?: string | null | undefined;
|
|
342
|
+
delete_requires_approval?: boolean | undefined;
|
|
343
|
+
} | undefined;
|
|
344
|
+
export_visibility?: "listed" | "redacted" | "hidden" | undefined;
|
|
345
|
+
owner_ref?: string | undefined;
|
|
346
|
+
} | undefined;
|
|
45
347
|
}>;
|
|
46
348
|
constructor(knowledgeManager: KnowledgeManager);
|
|
47
349
|
description(_context?: ToolDescriptionContext): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySaveTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/execution/MemorySaveTool/MemorySaveTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"MemorySaveTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/execution/MemorySaveTool/MemorySaveTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AASzF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAahC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,qBAAa,cAAe,YAAW,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC;IAgBxD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAf7C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAW7B;IAEF,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAyB;gBAEhB,gBAAgB,EAAE,gBAAgB;IAE/D,WAAW,CAAC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAIhD,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IA8B5E,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1G,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;CAGpD"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { MemoryProvenanceSchema, MemoryVerificationStatusSchema, } from "../../../platform/corrections/memory-quarantine.js";
|
|
3
|
+
import { MemoryGovernanceSchema } from "../../../platform/corrections/memory-governance.js";
|
|
2
4
|
import { DESCRIPTION } from "./prompt.js";
|
|
3
5
|
import { TAGS, READ_ONLY, PERMISSION_LEVEL, TOOL_NAME, ALIASES } from "./constants.js";
|
|
4
6
|
export const MemorySaveInputSchema = z.object({
|
|
@@ -11,6 +13,9 @@ export const MemorySaveInputSchema = z.object({
|
|
|
11
13
|
.default("fact")
|
|
12
14
|
.describe("Type of memory entry"),
|
|
13
15
|
tags: z.array(z.string()).optional().describe("Tags for filtering and search"),
|
|
16
|
+
verification_status: MemoryVerificationStatusSchema.optional(),
|
|
17
|
+
provenance: MemoryProvenanceSchema.optional(),
|
|
18
|
+
governance: MemoryGovernanceSchema.optional(),
|
|
14
19
|
});
|
|
15
20
|
export class MemorySaveTool {
|
|
16
21
|
knowledgeManager;
|
|
@@ -42,6 +47,9 @@ export class MemorySaveTool {
|
|
|
42
47
|
category: input.category,
|
|
43
48
|
memory_type: input.memory_type,
|
|
44
49
|
tags: input.tags,
|
|
50
|
+
verification_status: input.verification_status,
|
|
51
|
+
provenance: input.provenance,
|
|
52
|
+
governance: input.governance,
|
|
45
53
|
});
|
|
46
54
|
return {
|
|
47
55
|
success: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemorySaveTool.js","sourceRoot":"","sources":["../../../../src/tools/execution/MemorySaveTool/MemorySaveTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEvF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAClE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ApplyPatchTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/fs/ApplyPatchTool/ApplyPatchTool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG9G,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,qBAAa,cAAe,YAAW,KAAK,CAAC,eAAe,CAAC;IAC3D,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAW7B;IAEF,QAAQ,CAAC,WAAW;;;;;;;;;;;;OAAyB;IAE7C,WAAW,IAAI,MAAM;IAIf,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;YAqCnE,cAAc;IAiDtB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1G,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;CAGnD"}
|
|
@@ -2,6 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { validateProtectedPath } from "../FileValidationTool/protected-path-policy.js";
|
|
5
6
|
export const ApplyPatchInputSchema = z.object({
|
|
6
7
|
patch: z.string().min(1),
|
|
7
8
|
cwd: z.string().optional(),
|
|
@@ -28,11 +29,22 @@ export class ApplyPatchTool {
|
|
|
28
29
|
const started = Date.now();
|
|
29
30
|
const cwd = input.cwd ?? context.cwd;
|
|
30
31
|
if (input.patch.trimStart().startsWith("*** Begin Patch")) {
|
|
31
|
-
return this.callCodexPatch(input, cwd, started);
|
|
32
|
+
return this.callCodexPatch(input, cwd, started, context.executionPolicy?.protectedPaths);
|
|
33
|
+
}
|
|
34
|
+
const changedPaths = extractPatchPaths(input.patch);
|
|
35
|
+
const blockedPath = findBlockedPatchPath(changedPaths, cwd, context.executionPolicy?.protectedPaths);
|
|
36
|
+
if (blockedPath) {
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
data: { changedPaths, stdout: "", stderr: blockedPath.error, checkOnly: input.checkOnly },
|
|
40
|
+
summary: `Patch blocked: ${blockedPath.error}`,
|
|
41
|
+
error: blockedPath.error,
|
|
42
|
+
durationMs: Date.now() - started,
|
|
43
|
+
artifacts: changedPaths,
|
|
44
|
+
};
|
|
32
45
|
}
|
|
33
46
|
const args = input.checkOnly ? ["apply", "--check", "--whitespace=nowarn", "-"] : ["apply", "--whitespace=nowarn", "-"];
|
|
34
47
|
const result = await runGitApply(args, input.patch, cwd);
|
|
35
|
-
const changedPaths = extractPatchPaths(input.patch);
|
|
36
48
|
return {
|
|
37
49
|
success: result.exitCode === 0,
|
|
38
50
|
data: {
|
|
@@ -49,9 +61,14 @@ export class ApplyPatchTool {
|
|
|
49
61
|
artifacts: changedPaths,
|
|
50
62
|
};
|
|
51
63
|
}
|
|
52
|
-
async callCodexPatch(input, cwd, started) {
|
|
64
|
+
async callCodexPatch(input, cwd, started, protectedPaths) {
|
|
53
65
|
try {
|
|
54
66
|
const operations = parseCodexPatch(input.patch);
|
|
67
|
+
const changedPaths = operations.map((operation) => operation.filePath);
|
|
68
|
+
const blockedPath = findBlockedPatchPath(changedPaths, cwd, protectedPaths);
|
|
69
|
+
if (blockedPath) {
|
|
70
|
+
throw new Error(blockedPath.error);
|
|
71
|
+
}
|
|
55
72
|
if (input.checkOnly) {
|
|
56
73
|
for (const operation of operations) {
|
|
57
74
|
await validateCodexPatchOperation(operation, cwd);
|
|
@@ -62,7 +79,6 @@ export class ApplyPatchTool {
|
|
|
62
79
|
await applyCodexPatchOperation(operation, cwd);
|
|
63
80
|
}
|
|
64
81
|
}
|
|
65
|
-
const changedPaths = operations.map((operation) => operation.filePath);
|
|
66
82
|
return {
|
|
67
83
|
success: true,
|
|
68
84
|
data: {
|
|
@@ -122,9 +138,26 @@ function extractPatchPaths(patch) {
|
|
|
122
138
|
if (match?.[1] && match[1] !== "/dev/null") {
|
|
123
139
|
paths.add(match[1]);
|
|
124
140
|
}
|
|
141
|
+
const deletedMatch = line.match(/^---\s+a\/(.+)$/);
|
|
142
|
+
if (deletedMatch?.[1] && deletedMatch[1] !== "/dev/null") {
|
|
143
|
+
paths.add(deletedMatch[1]);
|
|
144
|
+
}
|
|
125
145
|
}
|
|
126
146
|
return [...paths];
|
|
127
147
|
}
|
|
148
|
+
function findBlockedPatchPath(changedPaths, cwd, protectedPaths) {
|
|
149
|
+
for (const changedPath of changedPaths) {
|
|
150
|
+
const validation = validateProtectedPath(changedPath, {
|
|
151
|
+
cwd,
|
|
152
|
+
workspaceRoot: cwd,
|
|
153
|
+
protectedPaths,
|
|
154
|
+
});
|
|
155
|
+
if (!validation.valid) {
|
|
156
|
+
return { path: changedPath, error: validation.error ?? `Blocked patch path: ${changedPath}` };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
128
161
|
function parseCodexPatch(patch) {
|
|
129
162
|
const lines = patch.split("\n");
|
|
130
163
|
const operations = [];
|